styled-components 6.0.0-beta.9 → 6.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/base.d.ts +2 -8
  2. package/dist/constructors/constructWithOptions.d.ts +6 -6
  3. package/dist/hoc/withTheme.d.ts +1 -1
  4. package/dist/index.d.ts +1 -1
  5. package/dist/models/ComponentStyle.d.ts +0 -1
  6. package/dist/models/StyleSheetManager.d.ts +27 -9
  7. package/dist/models/ThemeProvider.d.ts +4 -3
  8. package/dist/native/index.d.ts +25 -26
  9. package/dist/sheet/GroupedTag.d.ts +1 -1
  10. package/dist/sheet/Sheet.d.ts +3 -3
  11. package/dist/sheet/types.d.ts +1 -1
  12. package/dist/styled-components-macro.cjs.js +0 -1
  13. package/dist/styled-components-macro.cjs.js.map +1 -1
  14. package/dist/styled-components-macro.esm.js +0 -1
  15. package/dist/styled-components-macro.esm.js.map +1 -1
  16. package/dist/styled-components.browser.cjs.js +1 -1845
  17. package/dist/styled-components.browser.cjs.js.map +1 -1
  18. package/dist/styled-components.browser.esm.js +1 -1819
  19. package/dist/styled-components.browser.esm.js.map +1 -1
  20. package/dist/styled-components.cjs.js +1 -1865
  21. package/dist/styled-components.cjs.js.map +1 -1
  22. package/dist/styled-components.esm.js +1 -1839
  23. package/dist/styled-components.esm.js.map +1 -1
  24. package/dist/styled-components.js +258 -235
  25. package/dist/styled-components.js.map +1 -1
  26. package/dist/styled-components.min.js +1 -1
  27. package/dist/styled-components.min.js.map +1 -1
  28. package/dist/test/types.d.ts +9 -0
  29. package/dist/tsconfig.tsbuildinfo +1 -1
  30. package/dist/types.d.ts +34 -41
  31. package/dist/utils/determineTheme.d.ts +4 -2
  32. package/dist/utils/domElements.d.ts +1 -1
  33. package/dist/utils/flatten.d.ts +1 -1
  34. package/dist/utils/hoist.d.ts +3 -3
  35. package/dist/utils/isFunction.d.ts +1 -1
  36. package/dist/utils/isPlainObject.d.ts +1 -1
  37. package/dist/utils/isStatelessFunction.d.ts +1 -1
  38. package/dist/utils/joinStrings.d.ts +2 -1
  39. package/dist/utils/stylis.d.ts +1 -1
  40. package/native/dist/base.d.ts +2 -8
  41. package/native/dist/constructors/constructWithOptions.d.ts +6 -6
  42. package/native/dist/hoc/withTheme.d.ts +1 -1
  43. package/native/dist/index.d.ts +1 -1
  44. package/native/dist/models/ComponentStyle.d.ts +0 -1
  45. package/native/dist/models/StyleSheetManager.d.ts +27 -9
  46. package/native/dist/models/ThemeProvider.d.ts +4 -3
  47. package/native/dist/native/index.d.ts +25 -26
  48. package/native/dist/sheet/GroupedTag.d.ts +1 -1
  49. package/native/dist/sheet/Sheet.d.ts +3 -3
  50. package/native/dist/sheet/types.d.ts +1 -1
  51. package/native/dist/styled-components.native.cjs.js +1 -1305
  52. package/native/dist/styled-components.native.cjs.js.map +1 -1
  53. package/native/dist/styled-components.native.esm.js +1 -1287
  54. package/native/dist/styled-components.native.esm.js.map +1 -1
  55. package/native/dist/test/types.d.ts +9 -0
  56. package/native/dist/types.d.ts +34 -41
  57. package/native/dist/utils/determineTheme.d.ts +4 -2
  58. package/native/dist/utils/domElements.d.ts +1 -1
  59. package/native/dist/utils/flatten.d.ts +1 -1
  60. package/native/dist/utils/hoist.d.ts +3 -3
  61. package/native/dist/utils/isFunction.d.ts +1 -1
  62. package/native/dist/utils/isPlainObject.d.ts +1 -1
  63. package/native/dist/utils/isStatelessFunction.d.ts +1 -1
  64. package/native/dist/utils/joinStrings.d.ts +2 -1
  65. package/native/dist/utils/stylis.d.ts +1 -1
  66. package/package.json +23 -48
  67. package/dist/hooks/useTheme.d.ts +0 -3
@@ -4,22 +4,24 @@
4
4
  (global = global || self, global.styled = factory(global.React));
5
5
  })(this, (function (React) { 'use strict';
6
6
 
7
- var SC_ATTR = (typeof process !== 'undefined' && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR)) ||
7
+ var SC_ATTR = (typeof process !== 'undefined' && typeof process.env !== 'undefined' && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR)) ||
8
8
  'data-styled';
9
9
  var SC_ATTR_ACTIVE = 'active';
10
10
  var SC_ATTR_VERSION = 'data-styled-version';
11
- var SC_VERSION = "6.0.0-beta.9";
11
+ var SC_VERSION = "6.0.0-rc.1";
12
12
  var SPLITTER = '/*!sc*/\n';
13
13
  var IS_BROWSER = typeof window !== 'undefined' && 'HTMLElement' in window;
14
14
  var DISABLE_SPEEDY = Boolean(typeof SC_DISABLE_SPEEDY === 'boolean'
15
15
  ? SC_DISABLE_SPEEDY
16
16
  : typeof process !== 'undefined' &&
17
+ typeof process.env !== 'undefined' &&
17
18
  typeof process.env.REACT_APP_SC_DISABLE_SPEEDY !== 'undefined' &&
18
19
  process.env.REACT_APP_SC_DISABLE_SPEEDY !== ''
19
20
  ? process.env.REACT_APP_SC_DISABLE_SPEEDY === 'false'
20
21
  ? false
21
22
  : process.env.REACT_APP_SC_DISABLE_SPEEDY
22
23
  : typeof process !== 'undefined' &&
24
+ typeof process.env !== 'undefined' &&
23
25
  typeof process.env.SC_DISABLE_SPEEDY !== 'undefined' &&
24
26
  process.env.SC_DISABLE_SPEEDY !== ''
25
27
  ? process.env.SC_DISABLE_SPEEDY === 'false'
@@ -158,17 +160,10 @@
158
160
  }
159
161
  }
160
162
  var ruleIndex = this.indexOfGroup(group + 1);
161
- if (Array.isArray(rules)) {
162
- for (var i = 0, l = rules.length; i < l; i++) {
163
- if (this.tag.insertRule(ruleIndex, rules[i])) {
164
- this.groupSizes[group]++;
165
- ruleIndex++;
166
- }
167
- }
168
- }
169
- else {
170
- if (this.tag.insertRule(ruleIndex, rules)) {
163
+ for (var i = 0, l = rules.length; i < l; i++) {
164
+ if (this.tag.insertRule(ruleIndex, rules[i])) {
171
165
  this.groupSizes[group]++;
166
+ ruleIndex++;
172
167
  }
173
168
  }
174
169
  };
@@ -262,7 +257,6 @@
262
257
  var names = content.split(',');
263
258
  var name;
264
259
  for (var i = 0, l = names.length; i < l; i++) {
265
- // eslint-disable-next-line
266
260
  if ((name = names[i])) {
267
261
  sheet.registerName(id, name);
268
262
  }
@@ -371,10 +365,10 @@
371
365
  };
372
366
  var CSSOMTag = /** @class */ (function () {
373
367
  function CSSOMTag(target) {
374
- var element = (this.element = makeStyleTag(target));
368
+ this.element = makeStyleTag(target);
375
369
  // Avoid Edge bug where empty style elements don't create sheets
376
- element.appendChild(document.createTextNode(''));
377
- this.sheet = getSheet(element);
370
+ this.element.appendChild(document.createTextNode(''));
371
+ this.sheet = getSheet(this.element);
378
372
  this.length = 0;
379
373
  }
380
374
  CSSOMTag.prototype.insertRule = function (index, rule) {
@@ -394,7 +388,7 @@
394
388
  CSSOMTag.prototype.getRule = function (index) {
395
389
  var rule = this.sheet.cssRules[index];
396
390
  // Avoid IE11 quirk where cssText is inaccessible on some invalid rules
397
- if (rule !== undefined && typeof rule.cssText === 'string') {
391
+ if (rule && rule.cssText) {
398
392
  return rule.cssText;
399
393
  }
400
394
  else {
@@ -406,8 +400,8 @@
406
400
  /** A Tag that emulates the CSSStyleSheet API but uses text nodes */
407
401
  var TextTag = /** @class */ (function () {
408
402
  function TextTag(target) {
409
- var element = (this.element = makeStyleTag(target));
410
- this.nodes = element.childNodes;
403
+ this.element = makeStyleTag(target);
404
+ this.nodes = this.element.childNodes;
411
405
  this.length = 0;
412
406
  }
413
407
  TextTag.prototype.insertRule = function (index, rule) {
@@ -594,7 +588,7 @@
594
588
  return true;
595
589
  };
596
590
 
597
- var e="-ms-";var r="-moz-";var a="-webkit-";var n="comm";var c="rule";var s="decl";var i="@import";var h="@keyframes";var $=Math.abs;var k=String.fromCharCode;var g=Object.assign;function m(e,r){return C(e,0)^45?(((r<<2^C(e,0))<<2^C(e,1))<<2^C(e,2))<<2^C(e,3):0}function x(e){return e.trim()}function y(e,r){return (e=r.exec(e))?e[0]:e}function j(e,r,a){return e.replace(r,a)}function z(e,r){return e.indexOf(r)}function C(e,r){return e.charCodeAt(r)|0}function O(e,r,a){return e.slice(r,a)}function A(e){return e.length}function M(e){return e.length}function S(e,r){return r.push(e),e}function q(e,r){return e.map(r).join("")}var B=1;var D=1;var E=0;var F=0;var G=0;var H="";function I(e,r,a,n,c,s,t){return {value:e,root:r,parent:a,type:n,props:c,children:s,line:B,column:D,length:t,return:""}}function J(e,r){return g(I("",null,null,"",null,null,0),e,{length:-e.length},r)}function K(){return G}function L(){G=F>0?C(H,--F):0;if(D--,G===10)D=1,B--;return G}function N(){G=F<E?C(H,F++):0;if(D++,G===10)D=1,B++;return G}function P(){return C(H,F)}function Q(){return F}function R(e,r){return O(H,e,r)}function T(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function U(e){return B=D=1,E=A(H=e),F=0,[]}function V(e){return H="",e}function W(e){return x(R(F-1,ee(e===91?e+2:e===40?e+1:e)))}function Y(e){while(G=P())if(G<33)N();else break;return T(e)>2||T(G)>3?"":" "}function _(e,r){while(--r&&N())if(G<48||G>102||G>57&&G<65||G>70&&G<97)break;return R(e,Q()+(r<6&&P()==32&&N()==32))}function ee(e){while(N())switch(G){case e:return F;case 34:case 39:if(e!==34&&e!==39)ee(G);break;case 40:if(e===41)ee(e);break;case 92:N();break}return F}function re(e,r){while(N())if(e+G===47+10)break;else if(e+G===42+42&&P()===47)break;return "/*"+R(r,F-1)+"*"+k(e===47?e:N())}function ae(e){while(!T(P()))N();return R(e,F)}function ne(e){return V(ce("",null,null,null,[""],e=U(e),0,[0],e))}function ce(e,r,a,n,c,s,t,u,i){var f=0;var o=0;var l=t;var v=0;var p=0;var h=0;var b=1;var w=1;var d=1;var $=0;var g="";var m=c;var x=s;var y=n;var O=g;while(w)switch(h=$,$=N()){case 40:if(h!=108&&C(O,l-1)==58){if(z(O+=j(W($),"&","&\f"),"&\f")!=-1)d=-1;break}case 34:case 39:case 91:O+=W($);break;case 9:case 10:case 13:case 32:O+=Y(h);break;case 92:O+=_(Q()-1,7);continue;case 47:switch(P()){case 42:case 47:S(te(re(N(),Q()),r,a),i);break;default:O+="/";}break;case 123*b:u[f++]=A(O)*d;case 125*b:case 59:case 0:switch($){case 0:case 125:w=0;case 59+o:if(p>0&&A(O)-l)S(p>32?ue(O+";",n,a,l-1):ue(j(O," ","")+";",n,a,l-2),i);break;case 59:O+=";";default:S(y=se(O,r,a,f,o,c,u,g,m=[],x=[],l),s);if($===123)if(o===0)ce(O,r,y,y,m,s,l,u,x);else switch(v===99&&C(O,3)===110?100:v){case 100:case 109:case 115:ce(e,y,y,n&&S(se(e,y,y,0,0,c,u,g,c,m=[],l),x),c,x,l,u,n?m:x);break;default:ce(O,y,y,y,[""],x,0,u,x);}}f=o=p=0,b=d=1,g=O="",l=t;break;case 58:l=1+A(O),p=h;default:if(b<1)if($==123)--b;else if($==125&&b++==0&&L()==125)continue;switch(O+=k($),$*b){case 38:d=o>0?1:(O+="\f",-1);break;case 44:u[f++]=(A(O)-1)*d,d=1;break;case 64:if(P()===45)O+=W(N());v=P(),o=l=A(g=O+=ae(Q())),$++;break;case 45:if(h===45&&A(O)==2)b=0;}}return s}function se(e,r,a,n,s,t,u,i,f,o,l){var v=s-1;var p=s===0?t:[""];var h=M(p);for(var b=0,w=0,d=0;b<n;++b)for(var k=0,g=O(e,v+1,v=$(w=u[b])),m=e;k<h;++k)if(m=x(w>0?p[k]+" "+g:j(g,/&\f/g,p[k])))f[d++]=m;return I(e,r,a,s===0?c:i,f,o,l)}function te(e,r,a){return I(e,r,a,n,k(K()),O(e,2,-2),0)}function ue(e,r,a,n){return I(e,r,a,s,O(e,0,n),O(e,n+1,-1),n)}function ie(n,c,s){switch(m(n,c)){case 5103:return a+"print-"+n+n;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return a+n+n;case 4789:return r+n+n;case 5349:case 4246:case 4810:case 6968:case 2756:return a+n+r+n+e+n+n;case 5936:switch(C(n,c+11)){case 114:return a+n+e+j(n,/[svh]\w+-[tblr]{2}/,"tb")+n;case 108:return a+n+e+j(n,/[svh]\w+-[tblr]{2}/,"tb-rl")+n;case 45:return a+n+e+j(n,/[svh]\w+-[tblr]{2}/,"lr")+n}case 6828:case 4268:case 2903:return a+n+e+n+n;case 6165:return a+n+e+"flex-"+n+n;case 5187:return a+n+j(n,/(\w+).+(:[^]+)/,a+"box-$1$2"+e+"flex-$1$2")+n;case 5443:return a+n+e+"flex-item-"+j(n,/flex-|-self/g,"")+(!y(n,/flex-|baseline/)?e+"grid-row-"+j(n,/flex-|-self/g,""):"")+n;case 4675:return a+n+e+"flex-line-pack"+j(n,/align-content|flex-|-self/g,"")+n;case 5548:return a+n+e+j(n,"shrink","negative")+n;case 5292:return a+n+e+j(n,"basis","preferred-size")+n;case 6060:return a+"box-"+j(n,"-grow","")+a+n+e+j(n,"grow","positive")+n;case 4554:return a+j(n,/([^-])(transform)/g,"$1"+a+"$2")+n;case 6187:return j(j(j(n,/(zoom-|grab)/,a+"$1"),/(image-set)/,a+"$1"),n,"")+n;case 5495:case 3959:return j(n,/(image-set\([^]*)/,a+"$1"+"$`$1");case 4968:return j(j(n,/(.+:)(flex-)?(.*)/,a+"box-pack:$3"+e+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+a+n+n;case 4200:if(!y(n,/flex-|baseline/))return e+"grid-column-align"+O(n,c)+n;break;case 2592:case 3360:return e+j(n,"template-","")+n;case 4384:case 3616:if(s&&s.some((function(e,r){return c=r,y(e.props,/grid-\w+-end/)}))){return ~z(n+(s=s[c].value),"span")?n:e+j(n,"-start","")+n+e+"grid-row-span:"+(~z(s,"span")?y(s,/\d+/):+y(s,/\d+/)-+y(n,/\d+/))+";"}return e+j(n,"-start","")+n;case 4896:case 4128:return s&&s.some((function(e){return y(e.props,/grid-\w+-start/)}))?n:e+j(j(n,"-end","-span"),"span ","")+n;case 4095:case 3583:case 4068:case 2532:return j(n,/(.+)-inline(.+)/,a+"$1$2")+n;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(A(n)-1-c>6)switch(C(n,c+1)){case 109:if(C(n,c+4)!==45)break;case 102:return j(n,/(.+:)(.+)-([^]+)/,"$1"+a+"$2-$3"+"$1"+r+(C(n,c+3)==108?"$3":"$2-$3"))+n;case 115:return ~z(n,"stretch")?ie(j(n,"stretch","fill-available"),c,s)+n:n}break;case 5152:case 5920:return j(n,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,(function(r,a,c,s,t,u,i){return e+a+":"+c+i+(s?e+a+"-span:"+(t?u:+u-+c)+i:"")+n}));case 4949:if(C(n,c+6)===121)return j(n,":",":"+a)+n;break;case 6444:switch(C(n,C(n,14)===45?18:11)){case 120:return j(n,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+a+(C(n,14)===45?"inline-":"")+"box$3"+"$1"+a+"$2$3"+"$1"+e+"$2box$3")+n;case 100:return j(n,":",":"+e)+n}break;case 5719:case 2647:case 2135:case 3927:case 2391:return j(n,"scroll-","scroll-snap-")+n}return n}function fe(e,r){var a="";var n=M(e);for(var c=0;c<n;c++)a+=r(e[c],c,e,r)||"";return a}function oe(e,r,a,t){switch(e.type){case i:case s:return e.return=e.return||e.value;case n:return "";case h:return e.return=e.value+"{"+fe(e.children,t)+"}";case c:e.value=e.props.join(",");}return A(a=fe(e.children,t))?e.return=e.value+"{"+a+"}":""}function le(e){var r=M(e);return function(a,n,c,s){var t="";for(var u=0;u<r;u++)t+=e[u](a,n,c,s)||"";return t}}function pe(n,t,u,i){if(n.length>-1)if(!n.return)switch(n.type){case s:n.return=ie(n.value,n.length,u);return;case h:return fe([J(n,{value:j(n.value,"@","@"+a)})],i);case c:if(n.length)return q(n.props,(function(c){switch(y(c,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return fe([J(n,{props:[j(c,/:(read-\w+)/,":"+r+"$1")]})],i);case"::placeholder":return fe([J(n,{props:[j(c,/:(plac\w+)/,":"+a+"input-$1")]}),J(n,{props:[j(c,/:(plac\w+)/,":"+r+"$1")]}),J(n,{props:[j(c,/:(plac\w+)/,e+"input-$1")]})],i)}return ""}))}}
591
+ var e="-ms-";var r="-moz-";var a="-webkit-";var n="comm";var c="rule";var s="decl";var i="@import";var h="@keyframes";var $="@layer";var g=Math.abs;var k=String.fromCharCode;var m=Object.assign;function x(e,r){return O(e,0)^45?(((r<<2^O(e,0))<<2^O(e,1))<<2^O(e,2))<<2^O(e,3):0}function y(e){return e.trim()}function j(e,r){return (e=r.exec(e))?e[0]:e}function z(e,r,a){return e.replace(r,a)}function C(e,r){return e.indexOf(r)}function O(e,r){return e.charCodeAt(r)|0}function A(e,r,a){return e.slice(r,a)}function M(e){return e.length}function S(e){return e.length}function q(e,r){return r.push(e),e}function B(e,r){return e.map(r).join("")}var D=1;var E=1;var F=0;var G=0;var H=0;var I="";function J(e,r,a,n,c,s,t){return {value:e,root:r,parent:a,type:n,props:c,children:s,line:D,column:E,length:t,return:""}}function K(e,r){return m(J("",null,null,"",null,null,0),e,{length:-e.length},r)}function L(){return H}function N(){H=G>0?O(I,--G):0;if(E--,H===10)E=1,D--;return H}function P(){H=G<F?O(I,G++):0;if(E++,H===10)E=1,D++;return H}function Q(){return O(I,G)}function R(){return G}function T(e,r){return A(I,e,r)}function U(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function V(e){return D=E=1,F=M(I=e),G=0,[]}function W(e){return I="",e}function X(e){return y(T(G-1,re(e===91?e+2:e===40?e+1:e)))}function Z(e){while(H=Q())if(H<33)P();else break;return U(e)>2||U(H)>3?"":" "}function ee(e,r){while(--r&&P())if(H<48||H>102||H>57&&H<65||H>70&&H<97)break;return T(e,R()+(r<6&&Q()==32&&P()==32))}function re(e){while(P())switch(H){case e:return G;case 34:case 39:if(e!==34&&e!==39)re(H);break;case 40:if(e===41)re(e);break;case 92:P();break}return G}function ae(e,r){while(P())if(e+H===47+10)break;else if(e+H===42+42&&Q()===47)break;return "/*"+T(r,G-1)+"*"+k(e===47?e:P())}function ne(e){while(!U(Q()))P();return T(e,G)}function ce(e){return W(se("",null,null,null,[""],e=V(e),0,[0],e))}function se(e,r,a,n,c,s,t,u,i){var f=0;var o=0;var l=t;var v=0;var p=0;var h=0;var b=1;var w=1;var d=1;var $=0;var g="";var m=c;var x=s;var y=n;var j=g;while(w)switch(h=$,$=P()){case 40:if(h!=108&&O(j,l-1)==58){if(C(j+=z(X($),"&","&\f"),"&\f")!=-1)d=-1;break}case 34:case 39:case 91:j+=X($);break;case 9:case 10:case 13:case 32:j+=Z(h);break;case 92:j+=ee(R()-1,7);continue;case 47:switch(Q()){case 42:case 47:q(ue(ae(P(),R()),r,a),i);break;default:j+="/";}break;case 123*b:u[f++]=M(j)*d;case 125*b:case 59:case 0:switch($){case 0:case 125:w=0;case 59+o:if(d==-1)j=z(j,/\f/g,"");if(p>0&&M(j)-l)q(p>32?ie(j+";",n,a,l-1):ie(z(j," ","")+";",n,a,l-2),i);break;case 59:j+=";";default:q(y=te(j,r,a,f,o,c,u,g,m=[],x=[],l),s);if($===123)if(o===0)se(j,r,y,y,m,s,l,u,x);else switch(v===99&&O(j,3)===110?100:v){case 100:case 108:case 109:case 115:se(e,y,y,n&&q(te(e,y,y,0,0,c,u,g,c,m=[],l),x),c,x,l,u,n?m:x);break;default:se(j,y,y,y,[""],x,0,u,x);}}f=o=p=0,b=d=1,g=j="",l=t;break;case 58:l=1+M(j),p=h;default:if(b<1)if($==123)--b;else if($==125&&b++==0&&N()==125)continue;switch(j+=k($),$*b){case 38:d=o>0?1:(j+="\f",-1);break;case 44:u[f++]=(M(j)-1)*d,d=1;break;case 64:if(Q()===45)j+=X(P());v=Q(),o=l=M(g=j+=ne(R())),$++;break;case 45:if(h===45&&M(j)==2)b=0;}}return s}function te(e,r,a,n,s,t,u,i,f,o,l){var v=s-1;var p=s===0?t:[""];var h=S(p);for(var b=0,w=0,d=0;b<n;++b)for(var $=0,k=A(e,v+1,v=g(w=u[b])),m=e;$<h;++$)if(m=y(w>0?p[$]+" "+k:z(k,/&\f/g,p[$])))f[d++]=m;return J(e,r,a,s===0?c:i,f,o,l)}function ue(e,r,a){return J(e,r,a,n,k(L()),A(e,2,-2),0)}function ie(e,r,a,n){return J(e,r,a,s,A(e,0,n),A(e,n+1,-1),n)}function fe(n,c,s){switch(x(n,c)){case 5103:return a+"print-"+n+n;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return a+n+n;case 4789:return r+n+n;case 5349:case 4246:case 4810:case 6968:case 2756:return a+n+r+n+e+n+n;case 5936:switch(O(n,c+11)){case 114:return a+n+e+z(n,/[svh]\w+-[tblr]{2}/,"tb")+n;case 108:return a+n+e+z(n,/[svh]\w+-[tblr]{2}/,"tb-rl")+n;case 45:return a+n+e+z(n,/[svh]\w+-[tblr]{2}/,"lr")+n}case 6828:case 4268:case 2903:return a+n+e+n+n;case 6165:return a+n+e+"flex-"+n+n;case 5187:return a+n+z(n,/(\w+).+(:[^]+)/,a+"box-$1$2"+e+"flex-$1$2")+n;case 5443:return a+n+e+"flex-item-"+z(n,/flex-|-self/g,"")+(!j(n,/flex-|baseline/)?e+"grid-row-"+z(n,/flex-|-self/g,""):"")+n;case 4675:return a+n+e+"flex-line-pack"+z(n,/align-content|flex-|-self/g,"")+n;case 5548:return a+n+e+z(n,"shrink","negative")+n;case 5292:return a+n+e+z(n,"basis","preferred-size")+n;case 6060:return a+"box-"+z(n,"-grow","")+a+n+e+z(n,"grow","positive")+n;case 4554:return a+z(n,/([^-])(transform)/g,"$1"+a+"$2")+n;case 6187:return z(z(z(n,/(zoom-|grab)/,a+"$1"),/(image-set)/,a+"$1"),n,"")+n;case 5495:case 3959:return z(n,/(image-set\([^]*)/,a+"$1"+"$`$1");case 4968:return z(z(n,/(.+:)(flex-)?(.*)/,a+"box-pack:$3"+e+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+a+n+n;case 4200:if(!j(n,/flex-|baseline/))return e+"grid-column-align"+A(n,c)+n;break;case 2592:case 3360:return e+z(n,"template-","")+n;case 4384:case 3616:if(s&&s.some((function(e,r){return c=r,j(e.props,/grid-\w+-end/)}))){return ~C(n+(s=s[c].value),"span")?n:e+z(n,"-start","")+n+e+"grid-row-span:"+(~C(s,"span")?j(s,/\d+/):+j(s,/\d+/)-+j(n,/\d+/))+";"}return e+z(n,"-start","")+n;case 4896:case 4128:return s&&s.some((function(e){return j(e.props,/grid-\w+-start/)}))?n:e+z(z(n,"-end","-span"),"span ","")+n;case 4095:case 3583:case 4068:case 2532:return z(n,/(.+)-inline(.+)/,a+"$1$2")+n;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(M(n)-1-c>6)switch(O(n,c+1)){case 109:if(O(n,c+4)!==45)break;case 102:return z(n,/(.+:)(.+)-([^]+)/,"$1"+a+"$2-$3"+"$1"+r+(O(n,c+3)==108?"$3":"$2-$3"))+n;case 115:return ~C(n,"stretch")?fe(z(n,"stretch","fill-available"),c,s)+n:n}break;case 5152:case 5920:return z(n,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,(function(r,a,c,s,t,u,i){return e+a+":"+c+i+(s?e+a+"-span:"+(t?u:+u-+c)+i:"")+n}));case 4949:if(O(n,c+6)===121)return z(n,":",":"+a)+n;break;case 6444:switch(O(n,O(n,14)===45?18:11)){case 120:return z(n,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+a+(O(n,14)===45?"inline-":"")+"box$3"+"$1"+a+"$2$3"+"$1"+e+"$2box$3")+n;case 100:return z(n,":",":"+e)+n}break;case 5719:case 2647:case 2135:case 3927:case 2391:return z(n,"scroll-","scroll-snap-")+n}return n}function oe(e,r){var a="";var n=S(e);for(var c=0;c<n;c++)a+=r(e[c],c,e,r)||"";return a}function le(e,r,a,t){switch(e.type){case $:if(e.children.length)break;case i:case s:return e.return=e.return||e.value;case n:return "";case h:return e.return=e.value+"{"+oe(e.children,t)+"}";case c:e.value=e.props.join(",");}return M(a=oe(e.children,t))?e.return=e.value+"{"+a+"}":""}function ve(e){var r=S(e);return function(a,n,c,s){var t="";for(var u=0;u<r;u++)t+=e[u](a,n,c,s)||"";return t}}function he(n,t,u,i){if(n.length>-1)if(!n.return)switch(n.type){case s:n.return=fe(n.value,n.length,u);return;case h:return oe([K(n,{value:z(n.value,"@","@"+a)})],i);case c:if(n.length)return B(n.props,(function(c){switch(j(c,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return oe([K(n,{props:[z(c,/:(read-\w+)/,":"+r+"$1")]})],i);case"::placeholder":return oe([K(n,{props:[z(c,/:(plac\w+)/,":"+a+"input-$1")]}),K(n,{props:[z(c,/:(plac\w+)/,":"+r+"$1")]}),K(n,{props:[z(c,/:(plac\w+)/,e+"input-$1")]})],i)}return ""}))}}
598
592
 
599
593
  var SEED$1 = 5381;
600
594
  // When we have separate strings it's useful to run a progressive
@@ -612,26 +606,60 @@
612
606
  return phash(SEED$1, x);
613
607
  };
614
608
 
609
+ var AMP_REGEX = /&/g;
615
610
  var COMMENT_REGEX = /^\s*\/\/.*$/gm;
616
- var COMPLEX_SELECTOR_PREFIX = [':', '[', '.', '#'];
617
611
  /**
618
612
  * Serialize stylis output as an array of css strings. It is important that rules are
619
613
  * separated when using CSSOM injection.
620
614
  */
621
615
  function serialize(children, callback) {
622
- return children.map(function (c, i) { return callback(c, i, children, callback); }).filter(Boolean);
616
+ var ret = [];
617
+ for (var i = 0, result = void 0; i < children.length; i += 1) {
618
+ result = callback(children[i], i, children, callback);
619
+ if (result)
620
+ ret.push(result);
621
+ }
622
+ return ret;
623
+ }
624
+ /**
625
+ * Takes an element and recurses through it's rules added the namespace to the start of each selector.
626
+ * Takes into account media queries by recursing through child rules if they are present.
627
+ */
628
+ function recursivelySetNamepace(compiled, namespace) {
629
+ return compiled.map(function (rule) {
630
+ if (rule.type === 'rule') {
631
+ // add the namespace to the start
632
+ rule.value = "".concat(namespace, " ").concat(rule.value);
633
+ // add the namespace after each comma for subsequent selectors.
634
+ // @ts-expect-error we target modern browsers but intentionally transpile to ES5 for speed
635
+ rule.value = rule.value.replaceAll(',', ",".concat(namespace, " "));
636
+ rule.props = rule.props.map(function (prop) {
637
+ return "".concat(namespace, " ").concat(prop);
638
+ });
639
+ }
640
+ if (Array.isArray(rule.children) && rule.type !== '@keyframes') {
641
+ rule.children = recursivelySetNamepace(rule.children, namespace);
642
+ }
643
+ return rule;
644
+ });
623
645
  }
624
646
  function createStylisInstance(_a) {
625
647
  var _b = _a === void 0 ? EMPTY_OBJECT : _a, _c = _b.options, options = _c === void 0 ? EMPTY_OBJECT : _c, _d = _b.plugins, plugins = _d === void 0 ? EMPTY_ARRAY : _d;
626
648
  var _componentId;
627
649
  var _selector;
628
650
  var _selectorRegexp;
629
- var _consecutiveSelfRefRegExp;
630
651
  var selfReferenceReplacer = function (match, offset, string) {
631
652
  if (
632
- // do not replace the first occurrence if it is complex (has a modifier)
633
- (offset === 0 ? !COMPLEX_SELECTOR_PREFIX.includes(string[_selector.length]) : true) && // no consecutive self refs (.b.b); that is a precedence boost and treated differently
634
- !string.match(_consecutiveSelfRefRegExp)) {
653
+ /**
654
+ * We only want to refer to the static class directly in the following scenarios:
655
+ *
656
+ * 1. The selector is alone on the line `& { color: red; }`
657
+ * 2. The selector is part of a self-reference selector `& + & { color: red; }`
658
+ */
659
+ string === _selector ||
660
+ (string.startsWith(_selector) &&
661
+ string.endsWith(_selector) &&
662
+ string.replaceAll(_selector, '').length > 0)) {
635
663
  return ".".concat(_componentId);
636
664
  }
637
665
  return match;
@@ -650,10 +678,20 @@
650
678
  */
651
679
  var selfReferenceReplacementPlugin = function (element) {
652
680
  if (element.type === c && element.value.includes('&')) {
653
- var props = element.props;
654
- props[0] = props[0].replace(_selectorRegexp, selfReferenceReplacer);
681
+ element.props[0] = element.props[0]
682
+ // catch any hanging references that stylis missed
683
+ .replace(AMP_REGEX, _selector)
684
+ .replace(_selectorRegexp, selfReferenceReplacer);
655
685
  }
656
686
  };
687
+ var middlewares = plugins.slice();
688
+ /**
689
+ * Enables automatic vendor-prefixing for styles.
690
+ */
691
+ if (options.prefix) {
692
+ middlewares.unshift(he);
693
+ }
694
+ middlewares.push(selfReferenceReplacementPlugin, le);
657
695
  var stringifyRules = function (css, selector,
658
696
  /**
659
697
  * This "prefix" referes to a _selector_ prefix.
@@ -662,25 +700,18 @@
662
700
  if (selector === void 0) { selector = ''; }
663
701
  if (prefix === void 0) { prefix = ''; }
664
702
  if (componentId === void 0) { componentId = '&'; }
665
- var flatCSS = css.replace(COMMENT_REGEX, '');
666
703
  // stylis has no concept of state to be passed to plugins
667
704
  // but since JS is single-threaded, we can rely on that to ensure
668
705
  // these properties stay in sync with the current stylis run
669
706
  _componentId = componentId;
670
707
  _selector = selector;
671
708
  _selectorRegexp = new RegExp("\\".concat(_selector, "\\b"), 'g');
672
- _consecutiveSelfRefRegExp = new RegExp("(\\".concat(_selector, "\\b){2,}"));
673
- var middlewares = plugins.slice();
674
- /**
675
- * Enables automatic vendor-prefixing for styles.
676
- */
677
- if (options.prefix || options.prefix === undefined) {
678
- middlewares.unshift(pe);
709
+ var flatCSS = css.replace(COMMENT_REGEX, '');
710
+ var compiled = ce(prefix || selector ? "".concat(prefix, " ").concat(selector, " { ").concat(flatCSS, " }") : flatCSS);
711
+ if (options.namespace) {
712
+ compiled = recursivelySetNamepace(compiled, options.namespace);
679
713
  }
680
- middlewares.push(selfReferenceReplacementPlugin, oe);
681
- return serialize(ne(options.namespace || prefix || selector
682
- ? "".concat(options.namespace ? options.namespace + ' ' : '').concat(prefix, " ").concat(selector, " { ").concat(flatCSS, " }")
683
- : flatCSS), le(middlewares));
714
+ return serialize(compiled, ve(middlewares));
684
715
  };
685
716
  stringifyRules.hash = plugins.length
686
717
  ? plugins
@@ -695,24 +726,24 @@
695
726
  return stringifyRules;
696
727
  }
697
728
 
698
- var StyleSheetContext = React.createContext(undefined);
699
- var StyleSheetConsumer = StyleSheetContext.Consumer;
700
- var StylisContext = React.createContext(undefined);
701
729
  var mainSheet = new StyleSheet();
702
730
  var mainStylis = createStylisInstance();
703
- function useStyleSheet() {
704
- return React.useContext(StyleSheetContext) || mainSheet;
705
- }
706
- function useStylis() {
707
- return React.useContext(StylisContext) || mainStylis;
731
+ var StyleSheetContext = React.createContext({
732
+ shouldForwardProp: undefined,
733
+ styleSheet: mainSheet,
734
+ stylis: mainStylis,
735
+ });
736
+ var StyleSheetConsumer = StyleSheetContext.Consumer;
737
+ var StylisContext = React.createContext(undefined);
738
+ function useStyleSheetContext() {
739
+ return React.useContext(StyleSheetContext);
708
740
  }
709
741
  function StyleSheetManager(props) {
710
742
  var _a = React.useState(props.stylisPlugins), plugins = _a[0], setPlugins = _a[1];
711
- var contextStyleSheet = useStyleSheet();
712
- var styleSheet = React.useMemo(function () {
713
- var sheet = contextStyleSheet;
743
+ var styleSheet = useStyleSheetContext().styleSheet;
744
+ var resolvedStyleSheet = React.useMemo(function () {
745
+ var sheet = styleSheet;
714
746
  if (props.sheet) {
715
- // eslint-disable-next-line prefer-destructuring
716
747
  sheet = props.sheet;
717
748
  }
718
749
  else if (props.target) {
@@ -722,20 +753,19 @@
722
753
  sheet = sheet.reconstructWithOptions({ useCSSOMInjection: false });
723
754
  }
724
755
  return sheet;
725
- }, [props.disableCSSOMInjection, props.sheet, props.target]);
756
+ }, [props.disableCSSOMInjection, props.sheet, props.target, styleSheet]);
726
757
  var stylis = React.useMemo(function () {
727
758
  return createStylisInstance({
728
- options: { namespace: props.namespace, prefix: !props.disableVendorPrefixes },
759
+ options: { namespace: props.namespace, prefix: props.enableVendorPrefixes },
729
760
  plugins: plugins,
730
761
  });
731
- }, [props.disableVendorPrefixes, props.namespace, plugins]);
762
+ }, [props.enableVendorPrefixes, props.namespace, plugins]);
732
763
  React.useEffect(function () {
733
764
  if (!shallowequal(plugins, props.stylisPlugins))
734
765
  setPlugins(props.stylisPlugins);
735
766
  }, [props.stylisPlugins]);
736
- return (React.createElement(StyleSheetContext.Provider, { value: styleSheet },
737
- React.createElement(StylisContext.Provider, { value: stylis }, React.Children.only(props.children)
738
- )));
767
+ return (React.createElement(StyleSheetContext.Provider, { value: { shouldForwardProp: props.shouldForwardProp, styleSheet: resolvedStyleSheet, stylis: stylis } },
768
+ React.createElement(StylisContext.Provider, { value: stylis }, props.children)));
739
769
  }
740
770
 
741
771
  var Keyframes = /** @class */ (function () {
@@ -817,8 +847,8 @@
817
847
  if (value == null || typeof value === 'boolean' || value === '') {
818
848
  return '';
819
849
  }
820
- if (typeof value === 'number' && value !== 0 && !(name in unitlessKeys)) {
821
- return "".concat(value, "px"); // Presumes implicit 'px' suffix for unitless numbers
850
+ if (typeof value === 'number' && value !== 0 && !(name in unitlessKeys) && !name.startsWith('--')) {
851
+ return "".concat(value, "px"); // Presumes implicit 'px' suffix for unitless numbers except for CSS variables
822
852
  }
823
853
  return String(value).trim();
824
854
  }
@@ -830,14 +860,7 @@
830
860
  'Component');
831
861
  }
832
862
 
833
- /**
834
- * inlined version of
835
- * https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/core/hyphenateStyleName.js
836
- */
837
- var uppercaseCheck = /[A-Z]/;
838
- var uppercasePattern = /[A-Z]/g;
839
- var msPattern = /^ms-/;
840
- var prefixAndLowerCase = function (char) { return "-".concat(char.toLowerCase()); };
863
+ var isUpper = function (c) { return c >= 'A' && c <= 'Z'; };
841
864
  /**
842
865
  * Hyphenates a camelcased CSS property name, for example:
843
866
  *
@@ -852,9 +875,21 @@
852
875
  * is converted to `-ms-`.
853
876
  */
854
877
  function hyphenateStyleName(string) {
855
- return uppercaseCheck.test(string) && !string.startsWith('--')
856
- ? string.replace(uppercasePattern, prefixAndLowerCase).replace(msPattern, '-ms-')
857
- : string;
878
+ var output = '';
879
+ for (var i = 0; i < string.length; i++) {
880
+ var c = string[i];
881
+ // Check for CSS variable prefix
882
+ if (i === 1 && c === '-' && string[0] === '-') {
883
+ return string;
884
+ }
885
+ if (isUpper(c)) {
886
+ output += '-' + c.toLowerCase();
887
+ }
888
+ else {
889
+ output += c;
890
+ }
891
+ }
892
+ return output.startsWith('ms-') ? '-' + output : output;
858
893
  }
859
894
 
860
895
  function isFunction(test) {
@@ -864,16 +899,13 @@
864
899
  function isPlainObject(x) {
865
900
  return (x !== null &&
866
901
  typeof x === 'object' &&
867
- /* a check for empty prototype would be more typical, but that
868
- doesn't play well with objects created in different vm contexts */
869
- (!x.constructor || x.constructor.name === 'Object') &&
870
- (x.toString ? x.toString() : Object.prototype.toString.call(x)) === '[object Object]' &&
902
+ x.constructor.name === Object.name &&
871
903
  /* check for reasonable markers that the object isn't an element for react & preact/compat */
872
- !('props' in x && (x.$$typeof || x.constructor === undefined)));
904
+ !('props' in x && x.$$typeof));
873
905
  }
874
906
 
875
907
  function isStatelessFunction(test) {
876
- return typeof test === 'function' && !(test.prototype && test.prototype.isReactComponent);
908
+ return isFunction(test) && !(test.prototype && test.prototype.isReactComponent);
877
909
  }
878
910
 
879
911
  function isStyledComponent(target) {
@@ -886,34 +918,26 @@
886
918
  var isFalsish = function (chunk) {
887
919
  return chunk === undefined || chunk === null || chunk === false || chunk === '';
888
920
  };
889
- var objToCssArray = function (obj, prevKey) {
921
+ var objToCssArray = function (obj) {
890
922
  var rules = [];
891
923
  for (var key in obj) {
892
- if (!obj.hasOwnProperty(key) || isFalsish(obj[key]))
924
+ var val = obj[key];
925
+ if (!obj.hasOwnProperty(key) || isFalsish(val))
893
926
  continue;
894
- if ((Array.isArray(obj[key]) && obj[key].isCss) || isFunction(obj[key])) {
895
- rules.push("".concat(hyphenateStyleName(key), ":"), obj[key], ';');
927
+ // @ts-expect-error Property 'isCss' does not exist on type 'any[]'
928
+ if ((Array.isArray(val) && val.isCss) || isFunction(val)) {
929
+ rules.push("".concat(hyphenateStyleName(key), ":"), val, ';');
896
930
  }
897
- else if (isPlainObject(obj[key])) {
898
- rules.push.apply(rules, objToCssArray(obj[key], key));
931
+ else if (isPlainObject(val)) {
932
+ rules.push.apply(rules, __spreadArray(__spreadArray(["".concat(key, " {")], objToCssArray(val), false), ['}'], false));
899
933
  }
900
934
  else {
901
- rules.push("".concat(hyphenateStyleName(key), ": ").concat(addUnitIfNeeded(key, obj[key]), ";"));
935
+ rules.push("".concat(hyphenateStyleName(key), ": ").concat(addUnitIfNeeded(key, val), ";"));
902
936
  }
903
937
  }
904
- return prevKey ? __spreadArray(__spreadArray(["".concat(prevKey, " {")], rules, true), ['}'], false) : rules;
938
+ return rules;
905
939
  };
906
940
  function flatten(chunk, executionContext, styleSheet, stylisInstance) {
907
- if (Array.isArray(chunk)) {
908
- var ruleSet = [];
909
- for (var i = 0, len = chunk.length, result = void 0; i < len; i += 1) {
910
- result = flatten(chunk[i], executionContext, styleSheet, stylisInstance);
911
- if (result.length === 0)
912
- continue;
913
- ruleSet.push.apply(ruleSet, result);
914
- }
915
- return ruleSet;
916
- }
917
941
  if (isFalsish(chunk)) {
918
942
  return [];
919
943
  }
@@ -924,14 +948,13 @@
924
948
  /* Either execute or defer the function */
925
949
  if (isFunction(chunk)) {
926
950
  if (isStatelessFunction(chunk) && executionContext) {
927
- var chunkFn = chunk;
928
- var result = chunkFn(executionContext);
951
+ var result = chunk(executionContext);
929
952
  if (typeof result === 'object' &&
930
953
  !Array.isArray(result) &&
931
954
  !(result instanceof Keyframes) &&
932
- !isPlainObject(result)) {
933
- // eslint-disable-next-line no-console
934
- console.error("".concat(getComponentName(chunkFn), " 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."));
955
+ !isPlainObject(result) &&
956
+ result !== null) {
957
+ console.error("".concat(getComponentName(chunk), " 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."));
935
958
  }
936
959
  return flatten(result, executionContext, styleSheet, stylisInstance);
937
960
  }
@@ -949,7 +972,16 @@
949
972
  }
950
973
  }
951
974
  /* Handle objects */
952
- return isPlainObject(chunk) ? objToCssArray(chunk) : [chunk.toString()];
975
+ if (isPlainObject(chunk)) {
976
+ return objToCssArray(chunk);
977
+ }
978
+ if (!Array.isArray(chunk)) {
979
+ return [chunk.toString()];
980
+ }
981
+ /* Handle objects */
982
+ return chunk.flatMap(function (chunklet) {
983
+ return flatten(chunklet, executionContext, styleSheet, stylisInstance);
984
+ });
953
985
  }
954
986
 
955
987
  function isStaticRules(rules) {
@@ -964,6 +996,23 @@
964
996
  return true;
965
997
  }
966
998
 
999
+ /**
1000
+ * Convenience function for joining strings to form className chains
1001
+ */
1002
+ function joinStrings(a, b) {
1003
+ return a && b ? "".concat(a, " ").concat(b) : a || b || '';
1004
+ }
1005
+ function joinStringArray(arr, sep) {
1006
+ if (arr.length === 0) {
1007
+ return '';
1008
+ }
1009
+ var result = arr[0];
1010
+ for (var i = 1; i < arr.length; i++) {
1011
+ result += sep ? sep + arr[i] : arr[i];
1012
+ }
1013
+ return result;
1014
+ }
1015
+
967
1016
  var GlobalStyle = /** @class */ (function () {
968
1017
  function GlobalStyle(rules, componentId) {
969
1018
  this.rules = rules;
@@ -974,8 +1023,8 @@
974
1023
  StyleSheet.registerId(this.componentId + 1);
975
1024
  }
976
1025
  GlobalStyle.prototype.createStyles = function (instance, executionContext, styleSheet, stylis) {
977
- var flatCSS = flatten(this.rules, executionContext, styleSheet, stylis);
978
- var css = stylis(flatCSS.join(''), '');
1026
+ var flatCSS = joinStringArray(flatten(this.rules, executionContext, styleSheet, stylis));
1027
+ var css = stylis(flatCSS, '');
979
1028
  var id = this.componentId + instance;
980
1029
  // NOTE: We use the id as a name as well, since these rules never change
981
1030
  styleSheet.insertRules(id, id, css);
@@ -1012,11 +1061,14 @@
1012
1061
  }
1013
1062
  return outerTheme ? __assign(__assign({}, outerTheme), theme) : theme;
1014
1063
  }
1064
+ function useTheme() {
1065
+ return React.useContext(ThemeContext);
1066
+ }
1015
1067
  /**
1016
1068
  * Provide a theme to an entire react component tree via context
1017
1069
  */
1018
1070
  function ThemeProvider(props) {
1019
- var outerTheme = React.useContext(ThemeContext);
1071
+ var outerTheme = useTheme();
1020
1072
  var themeContext = React.useMemo(function () { return mergeTheme(props.theme, outerTheme); }, [props.theme, outerTheme]);
1021
1073
  if (!props.children) {
1022
1074
  return null;
@@ -1056,10 +1108,8 @@
1056
1108
  };
1057
1109
  // We purposefully call `useRef` outside of a component and expect it to throw
1058
1110
  // If it doesn't, then we're inside another component.
1059
- // eslint-disable-next-line react-hooks/rules-of-hooks
1060
1111
  React.useRef();
1061
1112
  if (didNotCallInvalidHook_1 && !seen.has(message_1)) {
1062
- // eslint-disable-next-line no-console
1063
1113
  console.warn(message_1);
1064
1114
  seen.add(message_1);
1065
1115
  }
@@ -1151,31 +1201,27 @@
1151
1201
  checkDynamicCreation(styledComponentId);
1152
1202
  }
1153
1203
  var GlobalStyleComponent = function (props) {
1154
- var styleSheet = useStyleSheet();
1155
- var stylis = useStylis();
1156
- var theme = React.useContext(ThemeContext);
1157
- var instanceRef = React.useRef(styleSheet.allocateGSInstance(styledComponentId));
1204
+ var ssc = useStyleSheetContext();
1205
+ var theme = useTheme();
1206
+ var instanceRef = React.useRef(ssc.styleSheet.allocateGSInstance(styledComponentId));
1158
1207
  var instance = instanceRef.current;
1159
1208
  if (React.Children.count(props.children)) {
1160
- // eslint-disable-next-line no-console
1161
1209
  console.warn("The global style component ".concat(styledComponentId, " was given child JSX. createGlobalStyle does not render children."));
1162
1210
  }
1163
1211
  if (rules.some(function (rule) { return typeof rule === 'string' && rule.indexOf('@import') !== -1; })) {
1164
- // eslint-disable-next-line no-console
1165
1212
  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.");
1166
1213
  }
1167
- if (styleSheet.server) {
1168
- renderStyles(instance, props, styleSheet, theme, stylis);
1214
+ if (ssc.styleSheet.server) {
1215
+ renderStyles(instance, props, ssc.styleSheet, theme, ssc.stylis);
1169
1216
  }
1170
1217
  {
1171
- // eslint-disable-next-line react-hooks/rules-of-hooks
1172
1218
  // @ts-expect-error still using React 17 types for the time being
1173
1219
  (React.useInsertionEffect || React.useLayoutEffect)(function () {
1174
- if (!styleSheet.server) {
1175
- renderStyles(instance, props, styleSheet, theme, stylis);
1176
- return function () { return globalStyle.removeStyles(instance, styleSheet); };
1220
+ if (!ssc.styleSheet.server) {
1221
+ renderStyles(instance, props, ssc.styleSheet, theme, ssc.stylis);
1222
+ return function () { return globalStyle.removeStyles(instance, ssc.styleSheet); };
1177
1223
  }
1178
- }, [instance, props, styleSheet, theme, stylis]);
1224
+ }, [instance, props, ssc.styleSheet, theme, ssc.stylis]);
1179
1225
  }
1180
1226
  return null;
1181
1227
  };
@@ -1199,10 +1245,9 @@
1199
1245
  /* Warning if you've used keyframes on React Native */
1200
1246
  if (typeof navigator !== 'undefined' &&
1201
1247
  navigator.product === 'ReactNative') {
1202
- // eslint-disable-next-line no-console
1203
1248
  console.warn('`keyframes` cannot be used on ReactNative, only on the web. To do animation in ReactNative please use Animated.');
1204
1249
  }
1205
- var rules = css.apply(void 0, __spreadArray([strings], interpolations, false)).join('');
1250
+ var rules = joinStringArray(css.apply(void 0, __spreadArray([strings], interpolations, false)));
1206
1251
  var name = generateComponentId(rules);
1207
1252
  return new Keyframes(name, rules);
1208
1253
  }
@@ -1314,10 +1359,9 @@
1314
1359
 
1315
1360
  function withTheme(Component) {
1316
1361
  var WithTheme = React.forwardRef(function (props, ref) {
1317
- var theme = React.useContext(ThemeContext);
1362
+ var theme = useTheme();
1318
1363
  var themeProp = determineTheme(props, theme, Component.defaultProps);
1319
1364
  if (themeProp === undefined) {
1320
- // eslint-disable-next-line no-console
1321
1365
  console.warn("[withTheme] You are not using a ThemeProvider nor passing a theme prop or a theme in defaultProps in component class \"".concat(getComponentName(Component), "\""));
1322
1366
  }
1323
1367
  return React.createElement(Component, __assign({}, props, { theme: themeProp, ref: ref }));
@@ -1326,8 +1370,6 @@
1326
1370
  return hoistNonReactStatics(WithTheme, Component);
1327
1371
  }
1328
1372
 
1329
- var useTheme = function () { return React.useContext(ThemeContext); };
1330
-
1331
1373
  var ServerStyleSheet = /** @class */ (function () {
1332
1374
  function ServerStyleSheet() {
1333
1375
  var _this = this;
@@ -1339,7 +1381,7 @@
1339
1381
  "".concat(SC_ATTR, "=\"true\""),
1340
1382
  "".concat(SC_ATTR_VERSION, "=\"").concat(SC_VERSION, "\""),
1341
1383
  ];
1342
- var htmlAttr = attrs.filter(Boolean).join(' ');
1384
+ var htmlAttr = joinStringArray(attrs.filter(Boolean), ' ');
1343
1385
  return "<style ".concat(htmlAttr, ">").concat(css, "</style>");
1344
1386
  };
1345
1387
  this.getStyleTags = function () {
@@ -1379,7 +1421,6 @@
1379
1421
  }
1380
1422
  return React.createElement(StyleSheetManager, { sheet: this.instance }, children);
1381
1423
  };
1382
- // eslint-disable-next-line consistent-return
1383
1424
  // @ts-expect-error alternate return types are not possible due to code transformation
1384
1425
  ServerStyleSheet.prototype.interleaveWithNodeStream = function (input) {
1385
1426
  {
@@ -1389,7 +1430,6 @@
1389
1430
  return ServerStyleSheet;
1390
1431
  }());
1391
1432
 
1392
- /* eslint-disable */
1393
1433
  var __PRIVATE__ = {
1394
1434
  StyleSheet: StyleSheet,
1395
1435
  mainSheet: mainSheet,
@@ -1399,30 +1439,23 @@
1399
1439
  /* Warning if you've imported this file on React Native */
1400
1440
  if (typeof navigator !== 'undefined' &&
1401
1441
  navigator.product === 'ReactNative') {
1402
- // eslint-disable-next-line no-console
1403
- console.warn("It looks like you've imported 'styled-components' on React Native.\n" +
1404
- "Perhaps you're looking to import 'styled-components/native'?\n" +
1405
- 'Read more about this at https://www.styled-components.com/docs/basics#react-native');
1442
+ 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");
1406
1443
  }
1444
+ var windowGlobalKey = "__sc-".concat(SC_ATTR, "__");
1407
1445
  /* Warning if there are several instances of styled-components */
1408
1446
  if (typeof window !== 'undefined') {
1409
- window['__styled-components-init__'] || (window['__styled-components-init__'] = 0);
1410
- if (window['__styled-components-init__'] === 1) {
1411
- // eslint-disable-next-line no-console
1412
- console.warn("It looks like there are several instances of 'styled-components' initialized in this application. " +
1413
- 'This may cause dynamic styles to not render properly, errors during the rehydration process, ' +
1414
- 'a missing theme prop, and makes your application bigger without good reason.\n\n' +
1415
- 'See https://s-c.sh/2BAXzed for more info.');
1416
- }
1417
- window['__styled-components-init__'] += 1;
1447
+ // @ts-expect-error dynamic key not in window object
1448
+ window[windowGlobalKey] || (window[windowGlobalKey] = 0);
1449
+ // @ts-expect-error dynamic key not in window object
1450
+ if (window[windowGlobalKey] === 1) {
1451
+ 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://s-c.sh/2BAXzed for more info.");
1452
+ }
1453
+ // @ts-expect-error dynamic key not in window object
1454
+ window[windowGlobalKey] += 1;
1418
1455
  }
1419
1456
 
1420
1457
  var secondary = /*#__PURE__*/Object.freeze({
1421
1458
  __proto__: null,
1422
- createGlobalStyle: createGlobalStyle,
1423
- css: css,
1424
- isStyledComponent: isStyledComponent,
1425
- keyframes: keyframes,
1426
1459
  ServerStyleSheet: ServerStyleSheet,
1427
1460
  StyleSheetConsumer: StyleSheetConsumer,
1428
1461
  StyleSheetContext: StyleSheetContext,
@@ -1430,10 +1463,14 @@
1430
1463
  ThemeConsumer: ThemeConsumer,
1431
1464
  ThemeContext: ThemeContext,
1432
1465
  ThemeProvider: ThemeProvider,
1466
+ __PRIVATE__: __PRIVATE__,
1467
+ createGlobalStyle: createGlobalStyle,
1468
+ css: css,
1469
+ isStyledComponent: isStyledComponent,
1470
+ keyframes: keyframes,
1433
1471
  useTheme: useTheme,
1434
1472
  version: SC_VERSION,
1435
- withTheme: withTheme,
1436
- __PRIVATE__: __PRIVATE__
1473
+ withTheme: withTheme
1437
1474
  });
1438
1475
 
1439
1476
  var LIMIT = 200;
@@ -1445,7 +1482,6 @@
1445
1482
  generatedClasses[className] = true;
1446
1483
  if (Object.keys(generatedClasses).length >= LIMIT) {
1447
1484
  // Unable to find latestRule in test environment.
1448
- /* eslint-disable no-console, prefer-template */
1449
1485
  var parsedIdString = componentId ? " with the id of \"".concat(componentId, "\"") : '';
1450
1486
  console.warn("Over ".concat(LIMIT, " classes were generated for component ").concat(displayName).concat(parsedIdString, ".\n") +
1451
1487
  'Consider using the attrs method, together with a style object for frequently changed styles.\n' +
@@ -1464,7 +1500,7 @@
1464
1500
  });
1465
1501
 
1466
1502
  // Thanks to ReactDOMFactories for this handy list!
1467
- var domElements = [
1503
+ var domElements = new Set([
1468
1504
  'a',
1469
1505
  'abbr',
1470
1506
  'address',
@@ -1600,7 +1636,7 @@
1600
1636
  'svg',
1601
1637
  'text',
1602
1638
  'tspan',
1603
- ];
1639
+ ]);
1604
1640
 
1605
1641
  // Source: https://www.w3.org/TR/cssom-1/#serialize-an-identifier
1606
1642
  // Control characters and non-letter first symbols are not supported
@@ -1626,17 +1662,6 @@
1626
1662
  return isTag(target) ? "styled.".concat(target) : "Styled(".concat(getComponentName(target), ")");
1627
1663
  }
1628
1664
 
1629
- /**
1630
- * Convenience function for joining strings to form className chains
1631
- */
1632
- function joinStrings() {
1633
- var args = [];
1634
- for (var _i = 0; _i < arguments.length; _i++) {
1635
- args[_i] = arguments[_i];
1636
- }
1637
- return args.filter(Boolean).join(' ');
1638
- }
1639
-
1640
1665
  function mixinRecursively(target, source, forceMerge) {
1641
1666
  if (forceMerge === void 0) { forceMerge = false; }
1642
1667
  /* only merge into POJOs, Arrays, but for top level objects only
@@ -1679,74 +1704,61 @@
1679
1704
  */
1680
1705
  var ComponentStyle = /** @class */ (function () {
1681
1706
  function ComponentStyle(rules, componentId, baseStyle) {
1682
- this.names = [];
1683
1707
  this.rules = rules;
1684
1708
  this.staticRulesId = '';
1685
1709
  this.isStatic =
1686
1710
  "development" === 'production' ;
1687
1711
  this.componentId = componentId;
1688
- // SC_VERSION gives us isolation between multiple runtimes on the page at once
1689
- // this is improved further with use of the babel plugin "namespace" feature
1690
1712
  this.baseHash = phash(SEED, componentId);
1691
1713
  this.baseStyle = baseStyle;
1692
1714
  // NOTE: This registers the componentId, which ensures a consistent order
1693
1715
  // for this component's styles compared to others
1694
1716
  StyleSheet.registerId(componentId);
1695
1717
  }
1696
- /*
1697
- * Flattens a rule set into valid CSS
1698
- * Hashes it, wraps the whole chunk in a .hash1234 {}
1699
- * Returns the hash to be injected on render()
1700
- * */
1701
1718
  ComponentStyle.prototype.generateAndInjectStyles = function (executionContext, styleSheet, stylis) {
1702
- var componentId = this.componentId;
1703
- this.names.length = 0;
1704
- if (this.baseStyle) {
1705
- this.names.push(this.baseStyle.generateAndInjectStyles(executionContext, styleSheet, stylis));
1706
- }
1719
+ var names = this.baseStyle
1720
+ ? this.baseStyle.generateAndInjectStyles(executionContext, styleSheet, stylis)
1721
+ : '';
1707
1722
  // force dynamic classnames if user-supplied stylis plugins are in use
1708
1723
  if (this.isStatic && !stylis.hash) {
1709
- if (this.staticRulesId && styleSheet.hasNameForId(componentId, this.staticRulesId)) {
1710
- this.names.push(this.staticRulesId);
1724
+ if (this.staticRulesId && styleSheet.hasNameForId(this.componentId, this.staticRulesId)) {
1725
+ names = joinStrings(names, this.staticRulesId);
1711
1726
  }
1712
1727
  else {
1713
- var cssStatic = flatten(this.rules, executionContext, styleSheet, stylis).join('');
1728
+ var cssStatic = joinStringArray(flatten(this.rules, executionContext, styleSheet, stylis));
1714
1729
  var name_1 = generateAlphabeticName(phash(this.baseHash, cssStatic) >>> 0);
1715
- if (!styleSheet.hasNameForId(componentId, name_1)) {
1716
- var cssStaticFormatted = stylis(cssStatic, ".".concat(name_1), undefined, componentId);
1717
- styleSheet.insertRules(componentId, name_1, cssStaticFormatted);
1730
+ if (!styleSheet.hasNameForId(this.componentId, name_1)) {
1731
+ var cssStaticFormatted = stylis(cssStatic, ".".concat(name_1), undefined, this.componentId);
1732
+ styleSheet.insertRules(this.componentId, name_1, cssStaticFormatted);
1718
1733
  }
1719
- this.names.push(name_1);
1734
+ names = joinStrings(names, name_1);
1720
1735
  this.staticRulesId = name_1;
1721
1736
  }
1722
1737
  }
1723
1738
  else {
1724
- var length_1 = this.rules.length;
1725
1739
  var dynamicHash = phash(this.baseHash, stylis.hash);
1726
1740
  var css = '';
1727
- for (var i = 0; i < length_1; i++) {
1741
+ for (var i = 0; i < this.rules.length; i++) {
1728
1742
  var partRule = this.rules[i];
1729
1743
  if (typeof partRule === 'string') {
1730
1744
  css += partRule;
1731
1745
  dynamicHash = phash(dynamicHash, partRule);
1732
1746
  }
1733
1747
  else if (partRule) {
1734
- var partChunk = flatten(partRule, executionContext, styleSheet, stylis);
1735
- var partString = Array.isArray(partChunk) ? partChunk.join('') : partChunk;
1748
+ var partString = joinStringArray(flatten(partRule, executionContext, styleSheet, stylis));
1736
1749
  dynamicHash = phash(dynamicHash, partString);
1737
1750
  css += partString;
1738
1751
  }
1739
1752
  }
1740
1753
  if (css) {
1741
1754
  var name_2 = generateAlphabeticName(dynamicHash >>> 0);
1742
- if (!styleSheet.hasNameForId(componentId, name_2)) {
1743
- var cssFormatted = stylis(css, ".".concat(name_2), undefined, componentId);
1744
- styleSheet.insertRules(componentId, name_2, cssFormatted);
1755
+ if (!styleSheet.hasNameForId(this.componentId, name_2)) {
1756
+ styleSheet.insertRules(this.componentId, name_2, stylis(css, ".".concat(name_2), undefined, this.componentId));
1745
1757
  }
1746
- this.names.push(name_2);
1758
+ names = joinStrings(names, name_2);
1747
1759
  }
1748
1760
  }
1749
- return this.names.join(' ');
1761
+ return names;
1750
1762
  };
1751
1763
  return ComponentStyle;
1752
1764
  }());
@@ -1763,67 +1775,75 @@
1763
1775
  SC_VERSION + name + identifiers[name]));
1764
1776
  return parentComponentId ? "".concat(parentComponentId, "-").concat(componentId) : componentId;
1765
1777
  }
1766
- function useInjectedStyle(componentStyle, isStatic, resolvedAttrs, warnTooManyClasses) {
1767
- var styleSheet = useStyleSheet();
1768
- var stylis = useStylis();
1769
- var className = componentStyle.generateAndInjectStyles(isStatic ? EMPTY_OBJECT : resolvedAttrs, styleSheet, stylis);
1770
- // eslint-disable-next-line react-hooks/rules-of-hooks
1778
+ function useInjectedStyle(componentStyle, isStatic, resolvedAttrs) {
1779
+ var ssc = useStyleSheetContext();
1780
+ var className = componentStyle.generateAndInjectStyles(isStatic ? EMPTY_OBJECT : resolvedAttrs, ssc.styleSheet, ssc.stylis);
1771
1781
  React.useDebugValue(className);
1772
- if (!isStatic && warnTooManyClasses) {
1773
- warnTooManyClasses(className);
1774
- }
1775
1782
  return className;
1776
1783
  }
1777
- function useStyledComponentImpl(forwardedComponent, props, forwardedRef, isStatic) {
1778
- var componentAttrs = forwardedComponent.attrs, componentStyle = forwardedComponent.componentStyle, defaultProps = forwardedComponent.defaultProps, foldedComponentIds = forwardedComponent.foldedComponentIds, shouldForwardProp = forwardedComponent.shouldForwardProp, styledComponentId = forwardedComponent.styledComponentId, target = forwardedComponent.target;
1779
- // eslint-disable-next-line react-hooks/rules-of-hooks
1780
- React.useDebugValue(styledComponentId);
1781
- // NOTE: the non-hooks version only subscribes to this when !componentStyle.isStatic,
1782
- // but that'd be against the rules-of-hooks. We could be naughty and do it anyway as it
1783
- // should be an immutable value, but behave for now.
1784
- var theme = determineTheme(props, React.useContext(ThemeContext), defaultProps) || EMPTY_OBJECT;
1785
- var context = componentAttrs.reduce(function (p, attrDef) {
1786
- var resolvedAttrDef = typeof attrDef === 'function' ? attrDef(p) : attrDef;
1787
- /* eslint-disable guard-for-in */
1784
+ function resolveContext(attrs, props, theme) {
1785
+ var context = __assign(__assign({}, props), {
1786
+ // unset, add `props.className` back at the end so props always "wins"
1787
+ className: undefined, theme: theme });
1788
+ var attrDef;
1789
+ for (var i = 0; i < attrs.length; i += 1) {
1790
+ attrDef = attrs[i];
1791
+ var resolvedAttrDef = isFunction(attrDef) ? attrDef(context) : attrDef;
1788
1792
  for (var key in resolvedAttrDef) {
1789
1793
  // @ts-expect-error bad types
1790
- p[key] =
1794
+ context[key] =
1791
1795
  key === 'className'
1792
- ? joinStrings(p[key], resolvedAttrDef[key])
1796
+ ? joinStrings(context[key], resolvedAttrDef[key])
1793
1797
  : key === 'style'
1794
- ? __assign(__assign({}, p[key]), resolvedAttrDef[key]) : resolvedAttrDef[key];
1798
+ ? __assign(__assign({}, context[key]), resolvedAttrDef[key]) : resolvedAttrDef[key];
1795
1799
  }
1796
- /* eslint-enable guard-for-in */
1797
- return p;
1798
- }, __assign(__assign({}, props), { theme: theme }));
1799
- var generatedClassName = useInjectedStyle(componentStyle, isStatic, context, forwardedComponent.warnTooManyClasses );
1800
- var refToForward = forwardedRef;
1800
+ }
1801
+ if (props.className) {
1802
+ context.className = joinStrings(context.className, props.className);
1803
+ }
1804
+ return context;
1805
+ }
1806
+ function useStyledComponentImpl(forwardedComponent, props, forwardedRef, isStatic) {
1807
+ var componentAttrs = forwardedComponent.attrs, componentStyle = forwardedComponent.componentStyle, defaultProps = forwardedComponent.defaultProps, foldedComponentIds = forwardedComponent.foldedComponentIds, styledComponentId = forwardedComponent.styledComponentId, target = forwardedComponent.target;
1808
+ var contextTheme = useTheme();
1809
+ var ssc = useStyleSheetContext();
1810
+ var shouldForwardProp = forwardedComponent.shouldForwardProp || ssc.shouldForwardProp;
1811
+ React.useDebugValue(styledComponentId);
1812
+ // NOTE: the non-hooks version only subscribes to this when !componentStyle.isStatic,
1813
+ // but that'd be against the rules-of-hooks. We could be naughty and do it anyway as it
1814
+ // should be an immutable value, but behave for now.
1815
+ var theme = determineTheme(props, contextTheme, defaultProps) || EMPTY_OBJECT;
1816
+ var context = resolveContext(componentAttrs, props, theme);
1801
1817
  var elementToBeCreated = context.as || target;
1802
- var isTargetTag = isTag(elementToBeCreated);
1803
1818
  var propsForElement = {};
1804
- // eslint-disable-next-line guard-for-in
1805
1819
  for (var key in context) {
1806
- // @ts-expect-error for..in iterates strings instead of keyof
1807
1820
  if (context[key] === undefined) ;
1808
1821
  else if (key[0] === '$' || key === 'as' || key === 'theme') ;
1809
1822
  else if (key === 'forwardedAs') {
1810
1823
  propsForElement.as = context.forwardedAs;
1811
1824
  }
1812
1825
  else if (!shouldForwardProp || shouldForwardProp(key, elementToBeCreated)) {
1813
- // @ts-expect-error for..in iterates strings instead of keyof
1814
1826
  propsForElement[key] = context[key];
1815
1827
  }
1816
1828
  }
1829
+ var generatedClassName = useInjectedStyle(componentStyle, isStatic, context);
1830
+ if (!isStatic && forwardedComponent.warnTooManyClasses) {
1831
+ forwardedComponent.warnTooManyClasses(generatedClassName);
1832
+ }
1833
+ var classString = joinStrings(foldedComponentIds, styledComponentId);
1834
+ if (generatedClassName) {
1835
+ classString += ' ' + generatedClassName;
1836
+ }
1837
+ if (context.className) {
1838
+ classString += ' ' + context.className;
1839
+ }
1817
1840
  propsForElement[
1818
1841
  // handle custom elements which React doesn't properly alias
1819
- isTargetTag &&
1820
- domElements.indexOf(elementToBeCreated) === -1
1842
+ isTag(elementToBeCreated) &&
1843
+ !domElements.has(elementToBeCreated)
1821
1844
  ? 'class'
1822
- : 'className'] = foldedComponentIds
1823
- .concat(styledComponentId, generatedClassName !== styledComponentId ? generatedClassName : '', context.className || '')
1824
- .filter(Boolean)
1825
- .join(' ');
1826
- propsForElement.ref = refToForward;
1845
+ : 'className'] = classString;
1846
+ propsForElement.ref = forwardedRef;
1827
1847
  return React.createElement(elementToBeCreated, propsForElement);
1828
1848
  }
1829
1849
  function createStyledComponent(target, options, rules) {
@@ -1836,9 +1856,7 @@
1836
1856
  : options.componentId || componentId;
1837
1857
  // fold the underlying StyledComponent attrs up (implicit extend)
1838
1858
  var finalAttrs = isTargetStyledComp && styledComponentTarget.attrs
1839
- ? styledComponentTarget.attrs
1840
- .concat(attrs)
1841
- .filter(Boolean)
1859
+ ? styledComponentTarget.attrs.concat(attrs).filter(Boolean)
1842
1860
  : attrs;
1843
1861
  var shouldForwardProp = options.shouldForwardProp;
1844
1862
  if (isTargetStyledComp && styledComponentTarget.shouldForwardProp) {
@@ -1860,7 +1878,6 @@
1860
1878
  // and shouldn't be increasing the number of class names
1861
1879
  var isStatic = componentStyle.isStatic && attrs.length === 0;
1862
1880
  function forwardRef(props, ref) {
1863
- // eslint-disable-next-line
1864
1881
  return useStyledComponentImpl(WrappedStyledComponent, props, ref, isStatic);
1865
1882
  }
1866
1883
  forwardRef.displayName = displayName;
@@ -1876,8 +1893,8 @@
1876
1893
  // this static is used to preserve the cascade of static classes for component selector
1877
1894
  // purposes; this is especially important with usage of the css prop
1878
1895
  WrappedStyledComponent.foldedComponentIds = isTargetStyledComp
1879
- ? styledComponentTarget.foldedComponentIds.concat(styledComponentTarget.styledComponentId)
1880
- : EMPTY_ARRAY;
1896
+ ? joinStrings(styledComponentTarget.foldedComponentIds, styledComponentTarget.styledComponentId)
1897
+ : '';
1881
1898
  WrappedStyledComponent.styledComponentId = styledComponentId;
1882
1899
  // fold the underlying StyledComponent target up since we folded the styles
1883
1900
  WrappedStyledComponent.target = isTargetStyledComp ? styledComponentTarget.target : target;
@@ -1895,7 +1912,13 @@
1895
1912
  checkDynamicCreation(displayName, styledComponentId);
1896
1913
  WrappedStyledComponent.warnTooManyClasses = createWarnTooManyClasses(displayName, styledComponentId);
1897
1914
  }
1898
- WrappedStyledComponent.toString = function () { return ".".concat(WrappedStyledComponent.styledComponentId); };
1915
+ // If the Object prototype is frozen, the "toString" property is non-writable. This means that any objects which inherit this property
1916
+ // cannot have the property changed using an assignment. If using strict mode, attempting that will cause an error. If not using strict
1917
+ // mode, attempting that will be silently ignored.
1918
+ // However, we can still explicitly shadow the prototype's "toString" property by defining a new "toString" property on this object.
1919
+ Object.defineProperty(WrappedStyledComponent, 'toString', {
1920
+ value: function () { return ".".concat(WrappedStyledComponent.styledComponentId); },
1921
+ });
1899
1922
  if (isCompositeComponent) {
1900
1923
  var compositeComponentTarget = target;
1901
1924
  hoistNonReactStatics(WrappedStyledComponent, compositeComponentTarget, {