styled-components 6.4.0-prerelease.2 → 6.4.0-prerelease.4

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 (36) hide show
  1. package/dist/base.d.ts +2 -1
  2. package/dist/constants.d.ts +1 -0
  3. package/dist/constructors/createTheme.d.ts +89 -0
  4. package/dist/models/ComponentStyle.d.ts +1 -4
  5. package/dist/sheet/Sheet.d.ts +2 -0
  6. package/dist/styled-components.browser.cjs.js +5 -1
  7. package/dist/styled-components.browser.cjs.js.map +1 -1
  8. package/dist/styled-components.browser.esm.js +5 -1
  9. package/dist/styled-components.browser.esm.js.map +1 -1
  10. package/dist/styled-components.cjs.js +5 -1
  11. package/dist/styled-components.cjs.js.map +1 -1
  12. package/dist/styled-components.esm.js +5 -1
  13. package/dist/styled-components.esm.js.map +1 -1
  14. package/dist/styled-components.js +760 -915
  15. package/dist/styled-components.js.map +1 -1
  16. package/dist/styled-components.min.js +5 -1
  17. package/dist/styled-components.min.js.map +1 -1
  18. package/dist/utils/hoist.d.ts +0 -4
  19. package/native/dist/base.d.ts +2 -1
  20. package/native/dist/constants.d.ts +1 -0
  21. package/native/dist/constructors/createTheme.d.ts +89 -0
  22. package/native/dist/dist/base.d.ts +2 -1
  23. package/native/dist/dist/constants.d.ts +1 -0
  24. package/native/dist/dist/constructors/createTheme.d.ts +89 -0
  25. package/native/dist/dist/models/ComponentStyle.d.ts +1 -4
  26. package/native/dist/dist/sheet/Sheet.d.ts +2 -0
  27. package/native/dist/dist/utils/hoist.d.ts +0 -4
  28. package/native/dist/models/ComponentStyle.d.ts +1 -4
  29. package/native/dist/sheet/Sheet.d.ts +2 -0
  30. package/native/dist/sheet/Tag.d.ts +4 -4
  31. package/native/dist/styled-components.native.cjs.js +1 -1
  32. package/native/dist/styled-components.native.cjs.js.map +1 -1
  33. package/native/dist/styled-components.native.esm.js +1 -1
  34. package/native/dist/styled-components.native.esm.js.map +1 -1
  35. package/native/dist/utils/hoist.d.ts +0 -4
  36. package/package.json +4 -4
@@ -4,80 +4,36 @@
4
4
  (global = global || self, factory(global.styled = {}, global.React));
5
5
  })(this, (function (exports, React) { 'use strict';
6
6
 
7
- var SC_ATTR = (typeof process !== 'undefined' &&
7
+ var _a$1, _b;
8
+ const SC_ATTR = (typeof process !== 'undefined' &&
8
9
  typeof process.env !== 'undefined' &&
9
10
  (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR)) ||
10
11
  'data-styled';
11
- var SC_ATTR_ACTIVE = 'active';
12
- var SC_ATTR_VERSION = 'data-styled-version';
13
- var SC_VERSION = "6.4.0-prerelease.2";
14
- var SPLITTER = '/*!sc*/\n';
15
- var IS_BROWSER = typeof window !== 'undefined' && typeof document !== 'undefined';
16
- var DISABLE_SPEEDY = Boolean(typeof SC_DISABLE_SPEEDY === 'boolean'
12
+ const SC_ATTR_ACTIVE = 'active';
13
+ const SC_ATTR_VERSION = 'data-styled-version';
14
+ const SC_VERSION = "6.4.0-prerelease.4";
15
+ const SPLITTER = '/*!sc*/\n';
16
+ const IS_BROWSER = typeof window !== 'undefined' && typeof document !== 'undefined';
17
+ function readSpeedyFlag(name) {
18
+ if (typeof process !== 'undefined' && typeof process.env !== 'undefined') {
19
+ const val = process.env[name];
20
+ if (val !== undefined && val !== '') {
21
+ return val !== 'false';
22
+ }
23
+ }
24
+ return undefined;
25
+ }
26
+ const DISABLE_SPEEDY = Boolean(typeof SC_DISABLE_SPEEDY === 'boolean'
17
27
  ? SC_DISABLE_SPEEDY
18
- : typeof process !== 'undefined' &&
19
- typeof process.env !== 'undefined' &&
20
- typeof process.env.REACT_APP_SC_DISABLE_SPEEDY !== 'undefined' &&
21
- process.env.REACT_APP_SC_DISABLE_SPEEDY !== ''
22
- ? process.env.REACT_APP_SC_DISABLE_SPEEDY === 'false'
23
- ? false
24
- : process.env.REACT_APP_SC_DISABLE_SPEEDY
25
- : typeof process !== 'undefined' &&
26
- typeof process.env !== 'undefined' &&
27
- typeof process.env.SC_DISABLE_SPEEDY !== 'undefined' &&
28
- process.env.SC_DISABLE_SPEEDY !== ''
29
- ? process.env.SC_DISABLE_SPEEDY === 'false'
30
- ? false
31
- : process.env.SC_DISABLE_SPEEDY
32
- : "development" !== 'production');
28
+ : ((_b = (_a$1 = readSpeedyFlag('REACT_APP_SC_DISABLE_SPEEDY')) !== null && _a$1 !== void 0 ? _a$1 : readSpeedyFlag('SC_DISABLE_SPEEDY')) !== null && _b !== void 0 ? _b : (typeof process !== 'undefined' && typeof process.env !== 'undefined'
29
+ ? "development" !== 'production'
30
+ : true)));
31
+ const KEYFRAMES_ID_PREFIX = 'sc-keyframes-';
33
32
  // Shared empty execution context when generating static styles
34
- var STATIC_EXECUTION_CONTEXT = {};
35
-
36
- /******************************************************************************
37
- Copyright (c) Microsoft Corporation.
38
-
39
- Permission to use, copy, modify, and/or distribute this software for any
40
- purpose with or without fee is hereby granted.
41
-
42
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
43
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
44
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
45
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
46
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
47
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
48
- PERFORMANCE OF THIS SOFTWARE.
49
- ***************************************************************************** */
50
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
51
-
52
-
53
- var __assign = function() {
54
- __assign = Object.assign || function __assign(t) {
55
- for (var s, i = 1, n = arguments.length; i < n; i++) {
56
- s = arguments[i];
57
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
58
- }
59
- return t;
60
- };
61
- return __assign.apply(this, arguments);
62
- };
63
-
64
- function __spreadArray(to, from, pack) {
65
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
66
- if (ar || !(i in from)) {
67
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
68
- ar[i] = from[i];
69
- }
70
- }
71
- return to.concat(ar || Array.prototype.slice.call(from));
72
- }
73
-
74
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
75
- var e = new Error(message);
76
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
77
- };
33
+ const STATIC_EXECUTION_CONTEXT = {};
78
34
 
79
- var EMPTY_ARRAY = Object.freeze([]);
80
- var EMPTY_OBJECT = Object.freeze({});
35
+ const EMPTY_ARRAY = Object.freeze([]);
36
+ const EMPTY_OBJECT = Object.freeze({});
81
37
 
82
38
  /**
83
39
  * If the Object prototype is frozen, the "toString" property is non-writable. This means that any objects which inherit this property
@@ -120,21 +76,17 @@
120
76
  '18': 'ThemeProvider: Please make sure your useTheme hook is within a `<ThemeProvider>`',
121
77
  };
122
78
 
123
- var ERRORS = errorMap ;
79
+ const ERRORS = errorMap ;
124
80
  /**
125
81
  * super basic version of sprintf
126
82
  */
127
- function format() {
128
- var args = [];
129
- for (var _i = 0; _i < arguments.length; _i++) {
130
- args[_i] = arguments[_i];
131
- }
132
- var a = args[0];
133
- var b = [];
134
- for (var c = 1, len = args.length; c < len; c += 1) {
83
+ function format(...args) {
84
+ let a = args[0];
85
+ const b = [];
86
+ for (let c = 1, len = args.length; c < len; c += 1) {
135
87
  b.push(args[c]);
136
88
  }
137
- b.forEach(function (d) {
89
+ b.forEach(d => {
138
90
  a = a.replace(/%[a-z]/, d);
139
91
  });
140
92
  return a;
@@ -143,68 +95,64 @@
143
95
  * Create an error file out of errors.md for development and a simple web link to the full errors
144
96
  * in production mode.
145
97
  */
146
- function throwStyledComponentsError(code) {
147
- var interpolations = [];
148
- for (var _i = 1; _i < arguments.length; _i++) {
149
- interpolations[_i - 1] = arguments[_i];
150
- }
98
+ function throwStyledComponentsError(code, ...interpolations) {
151
99
  {
152
- return new Error(format.apply(void 0, __spreadArray([ERRORS[code]], interpolations, false)).trim());
100
+ return new Error(format(ERRORS[code], ...interpolations).trim());
153
101
  }
154
102
  }
155
103
 
156
104
  /** Create a GroupedTag with an underlying Tag implementation */
157
- var makeGroupedTag = function (tag) {
105
+ const makeGroupedTag = (tag) => {
158
106
  return new DefaultGroupedTag(tag);
159
107
  };
160
- var BASE_SIZE = 1 << 9;
161
- var DefaultGroupedTag = /** @class */ (function () {
162
- function DefaultGroupedTag(tag) {
108
+ const BASE_SIZE = 1 << 9;
109
+ const DefaultGroupedTag = class DefaultGroupedTag {
110
+ constructor(tag) {
163
111
  this.groupSizes = new Uint32Array(BASE_SIZE);
164
112
  this.length = BASE_SIZE;
165
113
  this.tag = tag;
166
114
  this._cGroup = 0;
167
115
  this._cIndex = 0;
168
116
  }
169
- DefaultGroupedTag.prototype.indexOfGroup = function (group) {
117
+ indexOfGroup(group) {
170
118
  if (group === this._cGroup)
171
119
  return this._cIndex;
172
- var index = this._cIndex;
120
+ let index = this._cIndex;
173
121
  if (group > this._cGroup) {
174
- for (var i = this._cGroup; i < group; i++) {
122
+ for (let i = this._cGroup; i < group; i++) {
175
123
  index += this.groupSizes[i];
176
124
  }
177
125
  }
178
126
  else {
179
- for (var i = this._cGroup - 1; i >= group; i--) {
127
+ for (let i = this._cGroup - 1; i >= group; i--) {
180
128
  index -= this.groupSizes[i];
181
129
  }
182
130
  }
183
131
  this._cGroup = group;
184
132
  this._cIndex = index;
185
133
  return index;
186
- };
187
- DefaultGroupedTag.prototype.insertRules = function (group, rules) {
134
+ }
135
+ insertRules(group, rules) {
188
136
  if (group >= this.groupSizes.length) {
189
- var oldBuffer = this.groupSizes;
190
- var oldSize = oldBuffer.length;
191
- var newSize = oldSize;
137
+ const oldBuffer = this.groupSizes;
138
+ const oldSize = oldBuffer.length;
139
+ let newSize = oldSize;
192
140
  while (group >= newSize) {
193
141
  newSize <<= 1;
194
142
  if (newSize < 0) {
195
- throw throwStyledComponentsError(16, "".concat(group));
143
+ throw throwStyledComponentsError(16, `${group}`);
196
144
  }
197
145
  }
198
146
  this.groupSizes = new Uint32Array(newSize);
199
147
  this.groupSizes.set(oldBuffer);
200
148
  this.length = newSize;
201
- for (var i = oldSize; i < newSize; i++) {
149
+ for (let i = oldSize; i < newSize; i++) {
202
150
  this.groupSizes[i] = 0;
203
151
  }
204
152
  }
205
- var ruleIndex = this.indexOfGroup(group + 1);
206
- var insertedCount = 0;
207
- for (var i = 0, l = rules.length; i < l; i++) {
153
+ let ruleIndex = this.indexOfGroup(group + 1);
154
+ let insertedCount = 0;
155
+ for (let i = 0, l = rules.length; i < l; i++) {
208
156
  if (this.tag.insertRule(ruleIndex, rules[i])) {
209
157
  this.groupSizes[group]++;
210
158
  ruleIndex++;
@@ -215,74 +163,73 @@
215
163
  if (insertedCount > 0 && this._cGroup > group) {
216
164
  this._cIndex += insertedCount;
217
165
  }
218
- };
219
- DefaultGroupedTag.prototype.clearGroup = function (group) {
166
+ }
167
+ clearGroup(group) {
220
168
  if (group < this.length) {
221
- var length_1 = this.groupSizes[group];
222
- var startIndex = this.indexOfGroup(group);
223
- var endIndex = startIndex + length_1;
169
+ const length = this.groupSizes[group];
170
+ const startIndex = this.indexOfGroup(group);
171
+ const endIndex = startIndex + length;
224
172
  this.groupSizes[group] = 0;
225
- for (var i = startIndex; i < endIndex; i++) {
173
+ for (let i = startIndex; i < endIndex; i++) {
226
174
  this.tag.deleteRule(startIndex);
227
175
  }
228
176
  // Keep cache consistent: groups after the cleared group shift backward
229
- if (length_1 > 0 && this._cGroup > group) {
230
- this._cIndex -= length_1;
177
+ if (length > 0 && this._cGroup > group) {
178
+ this._cIndex -= length;
231
179
  }
232
180
  }
233
- };
234
- DefaultGroupedTag.prototype.getGroup = function (group) {
235
- var css = '';
181
+ }
182
+ getGroup(group) {
183
+ let css = '';
236
184
  if (group >= this.length || this.groupSizes[group] === 0) {
237
185
  return css;
238
186
  }
239
- var length = this.groupSizes[group];
240
- var startIndex = this.indexOfGroup(group);
241
- var endIndex = startIndex + length;
242
- for (var i = startIndex; i < endIndex; i++) {
187
+ const length = this.groupSizes[group];
188
+ const startIndex = this.indexOfGroup(group);
189
+ const endIndex = startIndex + length;
190
+ for (let i = startIndex; i < endIndex; i++) {
243
191
  css += this.tag.getRule(i) + SPLITTER;
244
192
  }
245
193
  return css;
246
- };
247
- return DefaultGroupedTag;
248
- }());
194
+ }
195
+ };
249
196
 
250
- var MAX_SMI = 1 << (31 - 1);
251
- var groupIDRegister = new Map();
252
- var reverseRegister = new Map();
253
- var nextFreeGroup = 1;
254
- var getGroupForId = function (id) {
197
+ const MAX_SMI = 1 << (31 - 1);
198
+ let groupIDRegister = new Map();
199
+ let reverseRegister = new Map();
200
+ let nextFreeGroup = 1;
201
+ const getGroupForId = (id) => {
255
202
  if (groupIDRegister.has(id)) {
256
203
  return groupIDRegister.get(id);
257
204
  }
258
205
  while (reverseRegister.has(nextFreeGroup)) {
259
206
  nextFreeGroup++;
260
207
  }
261
- var group = nextFreeGroup++;
208
+ const group = nextFreeGroup++;
262
209
  if (((group | 0) < 0 || group > MAX_SMI)) {
263
- throw throwStyledComponentsError(16, "".concat(group));
210
+ throw throwStyledComponentsError(16, `${group}`);
264
211
  }
265
212
  groupIDRegister.set(id, group);
266
213
  reverseRegister.set(group, id);
267
214
  return group;
268
215
  };
269
- var getIdForGroup = function (group) {
216
+ const getIdForGroup = (group) => {
270
217
  return reverseRegister.get(group);
271
218
  };
272
- var setGroupForId = function (id, group) {
219
+ const setGroupForId = (id, group) => {
273
220
  // move pointer
274
221
  nextFreeGroup = group + 1;
275
222
  groupIDRegister.set(id, group);
276
223
  reverseRegister.set(group, id);
277
224
  };
278
225
 
279
- var SELECTOR = "style[".concat(SC_ATTR, "][").concat(SC_ATTR_VERSION, "=\"").concat(SC_VERSION, "\"]");
280
- var MARKER_RE = new RegExp("^".concat(SC_ATTR, "\\.g(\\d+)\\[id=\"([\\w\\d-]+)\"\\].*?\"([^\"]*)"));
226
+ const SELECTOR = `style[${SC_ATTR}][${SC_ATTR_VERSION}="${SC_VERSION}"]`;
227
+ const MARKER_RE = new RegExp(`^${SC_ATTR}\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)`);
281
228
  /**
282
229
  * Type guard to check if a node is a ShadowRoot.
283
230
  * Uses instanceof when available, with duck-typing fallback for cross-realm scenarios.
284
231
  */
285
- var isShadowRoot = function (node) {
232
+ const isShadowRoot = (node) => {
286
233
  return ((typeof ShadowRoot !== 'undefined' && node instanceof ShadowRoot) ||
287
234
  ('host' in node &&
288
235
  // https://dom.spec.whatwg.org/#dom-node-document_fragment_node
@@ -293,7 +240,7 @@
293
240
  * If the target is a ShadowRoot, return it directly.
294
241
  * If the target is an HTMLElement, return its root node if it's a ShadowRoot, otherwise return document.
295
242
  */
296
- var getRehydrationContainer = function (target) {
243
+ const getRehydrationContainer = (target) => {
297
244
  if (!target) {
298
245
  return document;
299
246
  }
@@ -303,30 +250,30 @@
303
250
  }
304
251
  // Check if target is an HTMLElement inside a ShadowRoot
305
252
  if ('getRootNode' in target) {
306
- var root = target.getRootNode();
253
+ const root = target.getRootNode();
307
254
  if (isShadowRoot(root)) {
308
255
  return root;
309
256
  }
310
257
  }
311
258
  return document;
312
259
  };
313
- var outputSheet = function (sheet) {
314
- var tag = sheet.getTag();
315
- var length = tag.length;
316
- var css = '';
317
- var _loop_1 = function (group) {
318
- var id = getIdForGroup(group);
260
+ const outputSheet = (sheet) => {
261
+ const tag = sheet.getTag();
262
+ const { length } = tag;
263
+ let css = '';
264
+ for (let group = 0; group < length; group++) {
265
+ const id = getIdForGroup(group);
319
266
  if (id === undefined)
320
- return "continue";
321
- var names = sheet.names.get(id);
267
+ continue;
268
+ const names = sheet.names.get(id);
322
269
  if (names === undefined || !names.size)
323
- return "continue";
324
- var rules = tag.getGroup(group);
270
+ continue;
271
+ const rules = tag.getGroup(group);
325
272
  if (rules.length === 0)
326
- return "continue";
327
- var selector = SC_ATTR + '.g' + group + '[id="' + id + '"]';
328
- var content = '';
329
- names.forEach(function (name) {
273
+ continue;
274
+ const selector = SC_ATTR + '.g' + group + '[id="' + id + '"]';
275
+ let content = '';
276
+ names.forEach(name => {
330
277
  if (name.length > 0) {
331
278
  content += name + ',';
332
279
  }
@@ -334,33 +281,30 @@
334
281
  // NOTE: It's easier to collect rules and have the marker
335
282
  // after the actual rules to simplify the rehydration
336
283
  css += rules + selector + '{content:"' + content + '"}' + SPLITTER;
337
- };
338
- for (var group = 0; group < length; group++) {
339
- _loop_1(group);
340
284
  }
341
285
  return css;
342
286
  };
343
- var rehydrateNamesFromContent = function (sheet, id, content) {
344
- var names = content.split(',');
345
- var name;
346
- for (var i = 0, l = names.length; i < l; i++) {
287
+ const rehydrateNamesFromContent = (sheet, id, content) => {
288
+ const names = content.split(',');
289
+ let name;
290
+ for (let i = 0, l = names.length; i < l; i++) {
347
291
  if ((name = names[i])) {
348
292
  sheet.registerName(id, name);
349
293
  }
350
294
  }
351
295
  };
352
- var rehydrateSheetFromTag = function (sheet, style) {
296
+ const rehydrateSheetFromTag = (sheet, style) => {
353
297
  var _a;
354
- var parts = ((_a = style.textContent) !== null && _a !== void 0 ? _a : '').split(SPLITTER);
355
- var rules = [];
356
- for (var i = 0, l = parts.length; i < l; i++) {
357
- var part = parts[i].trim();
298
+ const parts = ((_a = style.textContent) !== null && _a !== void 0 ? _a : '').split(SPLITTER);
299
+ const rules = [];
300
+ for (let i = 0, l = parts.length; i < l; i++) {
301
+ const part = parts[i].trim();
358
302
  if (!part)
359
303
  continue;
360
- var marker = part.match(MARKER_RE);
304
+ const marker = part.match(MARKER_RE);
361
305
  if (marker) {
362
- var group = parseInt(marker[1], 10) | 0;
363
- var id = marker[2];
306
+ const group = parseInt(marker[1], 10) | 0;
307
+ const id = marker[2];
364
308
  if (group !== 0) {
365
309
  // Rehydrate componentId to group index mapping
366
310
  setGroupForId(id, group);
@@ -376,11 +320,11 @@
376
320
  }
377
321
  }
378
322
  };
379
- var rehydrateSheet = function (sheet) {
380
- var container = getRehydrationContainer(sheet.options.target);
381
- var nodes = container.querySelectorAll(SELECTOR);
382
- for (var i = 0, l = nodes.length; i < l; i++) {
383
- var node = nodes[i];
323
+ const rehydrateSheet = (sheet) => {
324
+ const container = getRehydrationContainer(sheet.options.target);
325
+ const nodes = container.querySelectorAll(SELECTOR);
326
+ for (let i = 0, l = nodes.length; i < l; i++) {
327
+ const node = nodes[i];
384
328
  if (node && node.getAttribute(SC_ATTR) !== SC_ATTR_ACTIVE) {
385
329
  rehydrateSheetFromTag(sheet, node);
386
330
  if (node.parentNode) {
@@ -399,17 +343,17 @@
399
343
  * For Next.js/Remix, pass nonces explicitly via StyleSheetManager or
400
344
  * ServerStyleSheet instead—auto-detection doesn't apply to header-based nonces.
401
345
  */
402
- var cached = false;
346
+ let cached = false;
403
347
  function getNonce() {
404
348
  if (cached !== false)
405
349
  return cached;
406
350
  if (typeof document !== 'undefined') {
407
351
  // Vite sets the nonce in the `nonce` attribute. Browsers expose this via
408
352
  // the .nonce DOM property but return "" from getAttribute('nonce').
409
- var viteMeta = document.head.querySelector('meta[property="csp-nonce"]');
353
+ const viteMeta = document.head.querySelector('meta[property="csp-nonce"]');
410
354
  if (viteMeta)
411
355
  return (cached = viteMeta.nonce || viteMeta.getAttribute('content') || undefined);
412
- var scMeta = document.head.querySelector('meta[name="sc-nonce"]');
356
+ const scMeta = document.head.querySelector('meta[name="sc-nonce"]');
413
357
  if (scMeta)
414
358
  return (cached = scMeta.getAttribute('content') || undefined);
415
359
  }
@@ -417,27 +361,27 @@
417
361
  }
418
362
 
419
363
  /** Find last style element if any inside target */
420
- var findLastStyleTag = function (target) {
421
- var arr = Array.from(target.querySelectorAll("style[".concat(SC_ATTR, "]")));
364
+ const findLastStyleTag = (target) => {
365
+ const arr = Array.from(target.querySelectorAll(`style[${SC_ATTR}]`));
422
366
  return arr[arr.length - 1];
423
367
  };
424
368
  /** Create a style element inside `target` or <head> after the last */
425
- var makeStyleTag = function (target, nonce) {
426
- var head = document.head;
427
- var parent = target || head;
428
- var style = document.createElement('style');
429
- var prevStyle = findLastStyleTag(parent);
430
- var nextSibling = prevStyle !== undefined ? prevStyle.nextSibling : null;
369
+ const makeStyleTag = (target, nonce) => {
370
+ const head = document.head;
371
+ const parent = target || head;
372
+ const style = document.createElement('style');
373
+ const prevStyle = findLastStyleTag(parent);
374
+ const nextSibling = prevStyle !== undefined ? prevStyle.nextSibling : null;
431
375
  style.setAttribute(SC_ATTR, SC_ATTR_ACTIVE);
432
376
  style.setAttribute(SC_ATTR_VERSION, SC_VERSION);
433
- var resolvedNonce = nonce || getNonce();
377
+ const resolvedNonce = nonce || getNonce();
434
378
  if (resolvedNonce)
435
379
  style.setAttribute('nonce', resolvedNonce);
436
380
  parent.insertBefore(style, nextSibling);
437
381
  return style;
438
382
  };
439
383
  /** Get the CSSStyleSheet instance for a given style element */
440
- var getSheet = function (tag) {
384
+ const getSheet = (tag) => {
441
385
  var _a;
442
386
  if (tag.sheet) {
443
387
  return tag.sheet;
@@ -445,10 +389,10 @@
445
389
  // Avoid Firefox quirk where the style element might not have a sheet property.
446
390
  // Use the tag's root node to find styleSheets — document.styleSheets doesn't
447
391
  // include sheets inside shadow roots.
448
- var root = tag.getRootNode();
449
- var styleSheets = (_a = root.styleSheets) !== null && _a !== void 0 ? _a : document.styleSheets;
450
- for (var i = 0, l = styleSheets.length; i < l; i++) {
451
- var sheet = styleSheets[i];
392
+ const root = tag.getRootNode();
393
+ const styleSheets = (_a = root.styleSheets) !== null && _a !== void 0 ? _a : document.styleSheets;
394
+ for (let i = 0, l = styleSheets.length; i < l; i++) {
395
+ const sheet = styleSheets[i];
452
396
  if (sheet.ownerNode === tag) {
453
397
  return sheet;
454
398
  }
@@ -457,8 +401,7 @@
457
401
  };
458
402
 
459
403
  /** Create a CSSStyleSheet-like tag depending on the environment */
460
- var makeTag = function (_a) {
461
- var isServer = _a.isServer, useCSSOMInjection = _a.useCSSOMInjection, target = _a.target, nonce = _a.nonce;
404
+ const makeTag = ({ isServer, useCSSOMInjection, target, nonce }) => {
462
405
  if (isServer) {
463
406
  return new VirtualTag(target);
464
407
  }
@@ -469,15 +412,15 @@
469
412
  return new TextTag(target, nonce);
470
413
  }
471
414
  };
472
- var CSSOMTag = /** @class */ (function () {
473
- function CSSOMTag(target, nonce) {
415
+ const CSSOMTag = class CSSOMTag {
416
+ constructor(target, nonce) {
474
417
  this.element = makeStyleTag(target, nonce);
475
418
  // Avoid Edge bug where empty style elements don't create sheets
476
419
  this.element.appendChild(document.createTextNode(''));
477
420
  this.sheet = getSheet(this.element);
478
421
  this.length = 0;
479
422
  }
480
- CSSOMTag.prototype.insertRule = function (index, rule) {
423
+ insertRule(index, rule) {
481
424
  try {
482
425
  this.sheet.insertRule(rule, index);
483
426
  this.length++;
@@ -486,13 +429,13 @@
486
429
  catch (_error) {
487
430
  return false;
488
431
  }
489
- };
490
- CSSOMTag.prototype.deleteRule = function (index) {
432
+ }
433
+ deleteRule(index) {
491
434
  this.sheet.deleteRule(index);
492
435
  this.length--;
493
- };
494
- CSSOMTag.prototype.getRule = function (index) {
495
- var rule = this.sheet.cssRules[index];
436
+ }
437
+ getRule(index) {
438
+ const rule = this.sheet.cssRules[index];
496
439
  // Avoid IE11 quirk where cssText is inaccessible on some invalid rules
497
440
  if (rule && rule.cssText) {
498
441
  return rule.cssText;
@@ -500,20 +443,19 @@
500
443
  else {
501
444
  return '';
502
445
  }
503
- };
504
- return CSSOMTag;
505
- }());
446
+ }
447
+ };
506
448
  /** A Tag that emulates the CSSStyleSheet API but uses text nodes */
507
- var TextTag = /** @class */ (function () {
508
- function TextTag(target, nonce) {
449
+ const TextTag = class TextTag {
450
+ constructor(target, nonce) {
509
451
  this.element = makeStyleTag(target, nonce);
510
452
  this.nodes = this.element.childNodes;
511
453
  this.length = 0;
512
454
  }
513
- TextTag.prototype.insertRule = function (index, rule) {
455
+ insertRule(index, rule) {
514
456
  if (index <= this.length && index >= 0) {
515
- var node = document.createTextNode(rule);
516
- var refNode = this.nodes[index];
457
+ const node = document.createTextNode(rule);
458
+ const refNode = this.nodes[index];
517
459
  this.element.insertBefore(node, refNode || null);
518
460
  this.length++;
519
461
  return true;
@@ -521,28 +463,27 @@
521
463
  else {
522
464
  return false;
523
465
  }
524
- };
525
- TextTag.prototype.deleteRule = function (index) {
466
+ }
467
+ deleteRule(index) {
526
468
  this.element.removeChild(this.nodes[index]);
527
469
  this.length--;
528
- };
529
- TextTag.prototype.getRule = function (index) {
470
+ }
471
+ getRule(index) {
530
472
  if (index < this.length) {
531
473
  return this.nodes[index].textContent;
532
474
  }
533
475
  else {
534
476
  return '';
535
477
  }
536
- };
537
- return TextTag;
538
- }());
478
+ }
479
+ };
539
480
  /** A completely virtual (server-side) Tag that doesn't manipulate the DOM */
540
- var VirtualTag = /** @class */ (function () {
541
- function VirtualTag(_target) {
481
+ const VirtualTag = class VirtualTag {
482
+ constructor(_target) {
542
483
  this.rules = [];
543
484
  this.length = 0;
544
485
  }
545
- VirtualTag.prototype.insertRule = function (index, rule) {
486
+ insertRule(index, rule) {
546
487
  if (index <= this.length) {
547
488
  if (index === this.length) {
548
489
  this.rules.push(rule);
@@ -556,35 +497,36 @@
556
497
  else {
557
498
  return false;
558
499
  }
559
- };
560
- VirtualTag.prototype.deleteRule = function (index) {
500
+ }
501
+ deleteRule(index) {
561
502
  this.rules.splice(index, 1);
562
503
  this.length--;
563
- };
564
- VirtualTag.prototype.getRule = function (index) {
504
+ }
505
+ getRule(index) {
565
506
  if (index < this.length) {
566
507
  return this.rules[index];
567
508
  }
568
509
  else {
569
510
  return '';
570
511
  }
571
- };
572
- return VirtualTag;
573
- }());
512
+ }
513
+ };
574
514
 
575
- var SHOULD_REHYDRATE = IS_BROWSER;
576
- var defaultOptions = {
515
+ let SHOULD_REHYDRATE = IS_BROWSER;
516
+ const defaultOptions = {
577
517
  isServer: !IS_BROWSER,
578
518
  useCSSOMInjection: !DISABLE_SPEEDY,
579
519
  };
580
520
  /** Contains the main stylesheet logic for stringification and caching */
581
- var StyleSheet = /** @class */ (function () {
582
- function StyleSheet(options, globalStyles, names) {
583
- if (options === void 0) { options = EMPTY_OBJECT; }
584
- if (globalStyles === void 0) { globalStyles = {}; }
585
- var _this = this;
586
- this.options = __assign(__assign({}, defaultOptions), options);
521
+ class StyleSheet {
522
+ /** Register a group ID to give it an index */
523
+ static registerId(id) {
524
+ return getGroupForId(id);
525
+ }
526
+ constructor(options = EMPTY_OBJECT, globalStyles = {}, names) {
527
+ this.options = Object.assign(Object.assign({}, defaultOptions), options);
587
528
  this.gs = globalStyles;
529
+ this.keyframeIds = new Set();
588
530
  this.names = new Map(names);
589
531
  this.server = !!options.isServer;
590
532
  // We rehydrate only once and use the sheet that is created first
@@ -592,139 +534,131 @@
592
534
  SHOULD_REHYDRATE = false;
593
535
  rehydrateSheet(this);
594
536
  }
595
- setToString(this, function () { return outputSheet(_this); });
537
+ setToString(this, () => outputSheet(this));
596
538
  }
597
- /** Register a group ID to give it an index */
598
- StyleSheet.registerId = function (id) {
599
- return getGroupForId(id);
600
- };
601
- StyleSheet.prototype.rehydrate = function () {
539
+ rehydrate() {
602
540
  if (!this.server && IS_BROWSER) {
603
541
  rehydrateSheet(this);
604
542
  }
605
- };
606
- StyleSheet.prototype.reconstructWithOptions = function (options, withNames) {
607
- if (withNames === void 0) { withNames = true; }
608
- var newSheet = new StyleSheet(__assign(__assign({}, this.options), options), this.gs, (withNames && this.names) || undefined);
543
+ }
544
+ reconstructWithOptions(options, withNames = true) {
545
+ const newSheet = new StyleSheet(Object.assign(Object.assign({}, this.options), options), this.gs, (withNames && this.names) || undefined);
546
+ newSheet.keyframeIds = new Set(this.keyframeIds);
609
547
  // If we're reconstructing with a new target on the client, check if the container changed
610
548
  // This handles the case where StyleSheetManager's target prop changes (e.g., from undefined to shadowRoot)
611
549
  // We only rehydrate if the container (Document or ShadowRoot) actually changes
612
550
  if (!this.server && IS_BROWSER && options.target !== this.options.target) {
613
- var oldContainer = getRehydrationContainer(this.options.target);
614
- var newContainer = getRehydrationContainer(options.target);
551
+ const oldContainer = getRehydrationContainer(this.options.target);
552
+ const newContainer = getRehydrationContainer(options.target);
615
553
  if (oldContainer !== newContainer) {
616
554
  rehydrateSheet(newSheet);
617
555
  }
618
556
  }
619
557
  return newSheet;
620
- };
621
- StyleSheet.prototype.allocateGSInstance = function (id) {
558
+ }
559
+ allocateGSInstance(id) {
622
560
  return (this.gs[id] = (this.gs[id] || 0) + 1);
623
- };
561
+ }
624
562
  /** Lazily initialises a GroupedTag for when it's actually needed */
625
- StyleSheet.prototype.getTag = function () {
563
+ getTag() {
626
564
  return this.tag || (this.tag = makeGroupedTag(makeTag(this.options)));
627
- };
565
+ }
628
566
  /** Check whether a name is known for caching */
629
- StyleSheet.prototype.hasNameForId = function (id, name) {
567
+ hasNameForId(id, name) {
630
568
  var _a, _b;
631
569
  return (_b = (_a = this.names.get(id)) === null || _a === void 0 ? void 0 : _a.has(name)) !== null && _b !== void 0 ? _b : false;
632
- };
570
+ }
633
571
  /** Mark a group's name as known for caching */
634
- StyleSheet.prototype.registerName = function (id, name) {
572
+ registerName(id, name) {
635
573
  getGroupForId(id);
636
- var existing = this.names.get(id);
574
+ if (id.startsWith(KEYFRAMES_ID_PREFIX)) {
575
+ this.keyframeIds.add(id);
576
+ }
577
+ const existing = this.names.get(id);
637
578
  if (existing) {
638
579
  existing.add(name);
639
580
  }
640
581
  else {
641
582
  this.names.set(id, new Set([name]));
642
583
  }
643
- };
584
+ }
644
585
  /** Insert new rules which also marks the name as known */
645
- StyleSheet.prototype.insertRules = function (id, name, rules) {
586
+ insertRules(id, name, rules) {
646
587
  this.registerName(id, name);
647
588
  this.getTag().insertRules(getGroupForId(id), rules);
648
- };
589
+ }
649
590
  /** Clears all cached names for a given group ID */
650
- StyleSheet.prototype.clearNames = function (id) {
591
+ clearNames(id) {
651
592
  if (this.names.has(id)) {
652
593
  this.names.get(id).clear();
653
594
  }
654
- };
595
+ }
655
596
  /** Clears all rules for a given group ID */
656
- StyleSheet.prototype.clearRules = function (id) {
597
+ clearRules(id) {
657
598
  this.getTag().clearGroup(getGroupForId(id));
658
599
  this.clearNames(id);
659
- };
600
+ }
660
601
  /** Clears the entire tag which deletes all rules but not its names */
661
- StyleSheet.prototype.clearTag = function () {
602
+ clearTag() {
662
603
  // NOTE: This does not clear the names, since it's only used during SSR
663
604
  // so that we can continuously output only new rules
664
605
  this.tag = undefined;
665
- };
666
- return StyleSheet;
667
- }());
606
+ }
607
+ }
668
608
 
669
- var unitlessKeys = {
670
- animationIterationCount: 1,
671
- aspectRatio: 1,
672
- borderImageOutset: 1,
673
- borderImageSlice: 1,
674
- borderImageWidth: 1,
675
- boxFlex: 1,
676
- boxFlexGroup: 1,
677
- boxOrdinalGroup: 1,
678
- columnCount: 1,
679
- columns: 1,
680
- flex: 1,
681
- flexGrow: 1,
682
- flexPositive: 1,
683
- flexShrink: 1,
684
- flexNegative: 1,
685
- flexOrder: 1,
686
- gridRow: 1,
687
- gridRowEnd: 1,
688
- gridRowSpan: 1,
689
- gridRowStart: 1,
690
- gridColumn: 1,
691
- gridColumnEnd: 1,
692
- gridColumnSpan: 1,
693
- gridColumnStart: 1,
694
- msGridRow: 1,
695
- msGridRowSpan: 1,
696
- msGridColumn: 1,
697
- msGridColumnSpan: 1,
698
- fontWeight: 1,
699
- lineHeight: 1,
700
- opacity: 1,
701
- order: 1,
702
- orphans: 1,
703
- scale: 1,
704
- tabSize: 1,
705
- widows: 1,
706
- zIndex: 1,
707
- zoom: 1,
708
- WebkitLineClamp: 1,
709
- // SVG-related properties
710
- fillOpacity: 1,
711
- floodOpacity: 1,
712
- stopOpacity: 1,
713
- strokeDasharray: 1,
714
- strokeDashoffset: 1,
715
- strokeMiterlimit: 1,
716
- strokeOpacity: 1,
717
- strokeWidth: 1
609
+ /**
610
+ * CSS properties that accept unitless numeric values.
611
+ * Inlined from @emotion/unitless with IE-only entries removed
612
+ * (boxFlex, boxFlexGroup, boxOrdinalGroup, flexPositive, flexNegative,
613
+ * flexOrder, msGridRow, msGridRowSpan, msGridColumn, msGridColumnSpan).
614
+ */
615
+ const unitless = {
616
+ animationIterationCount: 1,
617
+ aspectRatio: 1,
618
+ borderImageOutset: 1,
619
+ borderImageSlice: 1,
620
+ borderImageWidth: 1,
621
+ columnCount: 1,
622
+ columns: 1,
623
+ flex: 1,
624
+ flexGrow: 1,
625
+ flexShrink: 1,
626
+ gridRow: 1,
627
+ gridRowEnd: 1,
628
+ gridRowSpan: 1,
629
+ gridRowStart: 1,
630
+ gridColumn: 1,
631
+ gridColumnEnd: 1,
632
+ gridColumnSpan: 1,
633
+ gridColumnStart: 1,
634
+ fontWeight: 1,
635
+ lineHeight: 1,
636
+ opacity: 1,
637
+ order: 1,
638
+ orphans: 1,
639
+ scale: 1,
640
+ tabSize: 1,
641
+ widows: 1,
642
+ zIndex: 1,
643
+ zoom: 1,
644
+ WebkitLineClamp: 1,
645
+ fillOpacity: 1,
646
+ floodOpacity: 1,
647
+ stopOpacity: 1,
648
+ strokeDasharray: 1,
649
+ strokeDashoffset: 1,
650
+ strokeMiterlimit: 1,
651
+ strokeOpacity: 1,
652
+ strokeWidth: 1,
718
653
  };
719
-
720
654
  // Taken from https://github.com/facebook/react/blob/b87aabdfe1b7461e7331abb3601d9e6bb27544bc/packages/react-dom/src/shared/dangerousStyleValue.js
721
655
  function addUnitIfNeeded(name, value) {
722
656
  // https://github.com/amilajack/eslint-plugin-flowtype-errors/issues/133
723
657
  if (value == null || typeof value === 'boolean' || value === '') {
724
658
  return '';
725
659
  }
726
- if (typeof value === 'number' && value !== 0 && !(name in unitlessKeys) && !name.startsWith('--')) {
727
- return "".concat(value, "px"); // Presumes implicit 'px' suffix for unitless numbers except for CSS variables
660
+ if (typeof value === 'number' && value !== 0 && !(name in unitless) && !name.startsWith('--')) {
661
+ return `${value}px`; // Presumes implicit 'px' suffix for unitless numbers except for CSS variables
728
662
  }
729
663
  return String(value).trim();
730
664
  }
@@ -736,7 +670,7 @@
736
670
  'Component');
737
671
  }
738
672
 
739
- var isUpper = function (c) { return c >= 'A' && c <= 'Z'; };
673
+ const isUpper = (c) => c >= 'A' && c <= 'Z';
740
674
  /**
741
675
  * Hyphenates a camelcased CSS property name, for example:
742
676
  *
@@ -751,9 +685,9 @@
751
685
  * is converted to `-ms-`.
752
686
  */
753
687
  function hyphenateStyleName(string) {
754
- var output = '';
755
- for (var i = 0; i < string.length; i++) {
756
- var c = string[i];
688
+ let output = '';
689
+ for (let i = 0; i < string.length; i++) {
690
+ const c = string[i];
757
691
  // Check for CSS variable prefix
758
692
  if (i === 1 && c === '-' && string[0] === '-') {
759
693
  return string;
@@ -772,7 +706,7 @@
772
706
  return typeof test === 'function';
773
707
  }
774
708
 
775
- var KEYFRAMES_SYMBOL = Symbol.for('sc-keyframes');
709
+ const KEYFRAMES_SYMBOL = Symbol.for('sc-keyframes');
776
710
  function isKeyframes(value) {
777
711
  return typeof value === 'object' && value !== null && KEYFRAMES_SYMBOL in value;
778
712
  }
@@ -796,30 +730,27 @@
796
730
  /**
797
731
  * It's falsish not falsy because 0 is allowed.
798
732
  */
799
- var isFalsish = function (chunk) {
800
- return chunk === undefined || chunk === null || chunk === false || chunk === '';
801
- };
802
- var objToCssArray = function (obj) {
803
- var rules = [];
804
- for (var key in obj) {
805
- var val = obj[key];
733
+ const isFalsish = (chunk) => chunk === undefined || chunk === null || chunk === false || chunk === '';
734
+ const objToCssArray = (obj) => {
735
+ const rules = [];
736
+ for (const key in obj) {
737
+ const val = obj[key];
806
738
  if (!obj.hasOwnProperty(key) || isFalsish(val))
807
739
  continue;
808
740
  // @ts-expect-error Property 'isCss' does not exist on type 'any[]'
809
741
  if ((Array.isArray(val) && val.isCss) || isFunction(val)) {
810
- rules.push("".concat(hyphenateStyleName(key), ":"), val, ';');
742
+ rules.push(`${hyphenateStyleName(key)}:`, val, ';');
811
743
  }
812
744
  else if (isPlainObject(val)) {
813
- rules.push.apply(rules, __spreadArray(__spreadArray(["".concat(key, " {")], objToCssArray(val), false), ['}'], false));
745
+ rules.push(`${key} {`, ...objToCssArray(val), '}');
814
746
  }
815
747
  else {
816
- rules.push("".concat(hyphenateStyleName(key), ": ").concat(addUnitIfNeeded(key, val), ";"));
748
+ rules.push(`${hyphenateStyleName(key)}: ${addUnitIfNeeded(key, val)};`);
817
749
  }
818
750
  }
819
751
  return rules;
820
752
  };
821
- function flatten(chunk, executionContext, styleSheet, stylisInstance, result) {
822
- if (result === void 0) { result = []; }
753
+ function flatten(chunk, executionContext, styleSheet, stylisInstance, result = []) {
823
754
  if (typeof chunk === 'string') {
824
755
  if (chunk)
825
756
  result.push(chunk);
@@ -830,19 +761,19 @@
830
761
  }
831
762
  /* Handle other components */
832
763
  if (isStyledComponent(chunk)) {
833
- result.push(".".concat(chunk.styledComponentId));
764
+ result.push(`.${chunk.styledComponentId}`);
834
765
  return result;
835
766
  }
836
767
  /* Either execute or defer the function */
837
768
  if (isFunction(chunk)) {
838
769
  if (isStatelessFunction(chunk) && executionContext) {
839
- var fnResult = chunk(executionContext);
770
+ const fnResult = chunk(executionContext);
840
771
  if (typeof fnResult === 'object' &&
841
772
  !Array.isArray(fnResult) &&
842
773
  !isKeyframes(fnResult) &&
843
774
  !isPlainObject(fnResult) &&
844
775
  fnResult !== null) {
845
- 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."));
776
+ console.error(`${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.`);
846
777
  }
847
778
  return flatten(fnResult, executionContext, styleSheet, stylisInstance, result);
848
779
  }
@@ -863,8 +794,8 @@
863
794
  }
864
795
  /* Handle objects */
865
796
  if (isPlainObject(chunk)) {
866
- var cssArr = objToCssArray(chunk);
867
- for (var i = 0; i < cssArr.length; i++)
797
+ const cssArr = objToCssArray(chunk);
798
+ for (let i = 0; i < cssArr.length; i++)
868
799
  result.push(cssArr[i]);
869
800
  return result;
870
801
  }
@@ -872,15 +803,15 @@
872
803
  result.push(chunk.toString());
873
804
  return result;
874
805
  }
875
- for (var i = 0; i < chunk.length; i++) {
806
+ for (let i = 0; i < chunk.length; i++) {
876
807
  flatten(chunk[i], executionContext, styleSheet, stylisInstance, result);
877
808
  }
878
809
  return result;
879
810
  }
880
811
 
881
812
  function isStaticRules(rules) {
882
- for (var i = 0; i < rules.length; i += 1) {
883
- var rule = rules[i];
813
+ for (let i = 0; i < rules.length; i += 1) {
814
+ const rule = rules[i];
884
815
  if (isFunction(rule) && !isStyledComponent(rule)) {
885
816
  // functions are allowed to be static if they're just being
886
817
  // used to get the classname of a nested styled component
@@ -894,14 +825,14 @@
894
825
  * Convenience function for joining strings to form className chains
895
826
  */
896
827
  function joinStrings(a, b) {
897
- return a && b ? "".concat(a, " ").concat(b) : a || b || '';
828
+ return a && b ? `${a} ${b}` : a || b || '';
898
829
  }
899
830
  function joinStringArray(arr, sep) {
900
831
  return arr.join(sep || '');
901
832
  }
902
833
 
903
- var GlobalStyle = /** @class */ (function () {
904
- function GlobalStyle(rules, componentId) {
834
+ class GlobalStyle {
835
+ constructor(rules, componentId) {
905
836
  /** @internal Per-instance rule cache for shared-group rebuild. */
906
837
  this.instanceRules = new Map();
907
838
  this.rules = rules;
@@ -911,15 +842,15 @@
911
842
  // components always appear before them in the stylesheet.
912
843
  StyleSheet.registerId(this.componentId);
913
844
  }
914
- GlobalStyle.prototype.removeStyles = function (instance, styleSheet) {
845
+ removeStyles(instance, styleSheet) {
915
846
  this.instanceRules.delete(instance);
916
847
  this.rebuildGroup(styleSheet);
917
- };
918
- GlobalStyle.prototype.renderStyles = function (instance, executionContext, styleSheet, stylis) {
919
- var id = this.componentId;
848
+ }
849
+ renderStyles(instance, executionContext, styleSheet, stylis) {
850
+ const id = this.componentId;
920
851
  if (this.isStatic) {
921
852
  if (!styleSheet.hasNameForId(id, id + instance)) {
922
- var entry = this.computeRules(instance, executionContext, styleSheet, stylis);
853
+ const entry = this.computeRules(instance, executionContext, styleSheet, stylis);
923
854
  styleSheet.insertRules(id, entry.name, entry.rules);
924
855
  }
925
856
  else if (!this.instanceRules.has(instance)) {
@@ -932,14 +863,14 @@
932
863
  // Compute new rules; skip CSSOM rebuild if CSS is unchanged.
933
864
  // The fast-path is only safe on the client where the tag persists between renders.
934
865
  // During SSR, clearTag() destroys the tag between requests, so we must always rebuild.
935
- var prev = this.instanceRules.get(instance);
866
+ const prev = this.instanceRules.get(instance);
936
867
  this.computeRules(instance, executionContext, styleSheet, stylis);
937
868
  if (!styleSheet.server && prev) {
938
- var a = prev.rules;
939
- var b = this.instanceRules.get(instance).rules;
869
+ const a = prev.rules;
870
+ const b = this.instanceRules.get(instance).rules;
940
871
  if (a.length === b.length) {
941
- var same = true;
942
- for (var i = 0; i < a.length; i++) {
872
+ let same = true;
873
+ for (let i = 0; i < a.length; i++) {
943
874
  if (a[i] !== b[i]) {
944
875
  same = false;
945
876
  break;
@@ -950,61 +881,60 @@
950
881
  }
951
882
  }
952
883
  this.rebuildGroup(styleSheet);
953
- };
954
- GlobalStyle.prototype.computeRules = function (instance, executionContext, styleSheet, stylis) {
955
- var flatCSS = joinStringArray(flatten(this.rules, executionContext, styleSheet, stylis));
956
- var entry = {
884
+ }
885
+ computeRules(instance, executionContext, styleSheet, stylis) {
886
+ const flatCSS = joinStringArray(flatten(this.rules, executionContext, styleSheet, stylis));
887
+ const entry = {
957
888
  name: this.componentId + instance,
958
889
  rules: stylis(flatCSS, ''),
959
890
  };
960
891
  this.instanceRules.set(instance, entry);
961
892
  return entry;
962
- };
893
+ }
963
894
  /**
964
895
  * Clear all CSS rules in the shared group and re-insert from surviving instances.
965
896
  * Must run synchronously — no yielding between clear and re-insert.
966
897
  */
967
- GlobalStyle.prototype.rebuildGroup = function (styleSheet) {
968
- var id = this.componentId;
898
+ rebuildGroup(styleSheet) {
899
+ const id = this.componentId;
969
900
  styleSheet.clearRules(id);
970
- this.instanceRules.forEach(function (entry) {
901
+ this.instanceRules.forEach(entry => {
971
902
  styleSheet.insertRules(id, entry.name, entry.rules);
972
903
  });
973
- };
974
- return GlobalStyle;
975
- }());
904
+ }
905
+ }
976
906
 
977
907
  var e="-ms-";var r="-moz-";var a="-webkit-";var c="comm";var n="rule";var s="decl";var i="@import";var v="@namespace";var b="@keyframes";var g="@layer";var $=Math.abs;var m=String.fromCharCode;var x=Object.assign;function y(e,r){return A(e,0)^45?(((r<<2^A(e,0))<<2^A(e,1))<<2^A(e,2))<<2^A(e,3):0}function j(e){return e.trim()}function z(e,r){return (e=r.exec(e))?e[0]:e}function C(e,r,a){return e.replace(r,a)}function O(e,r,a){return e.indexOf(r,a)}function A(e,r){return e.charCodeAt(r)|0}function M(e,r,a){return e.slice(r,a)}function S(e){return e.length}function q(e){return e.length}function B(e,r){return r.push(e),e}function D(e,r){return e.map(r).join("")}function E(e,r){return e.filter((function(e){return !z(e,r)}))}var F=1;var G=1;var H=0;var I=0;var J=0;var K="";function L(e,r,a,c,n,s,t,u){return {value:e,root:r,parent:a,type:c,props:n,children:s,line:F,column:G,length:t,return:"",siblings:u}}function N(e,r){return x(L("",null,null,"",null,null,0,e.siblings),e,{length:-e.length},r)}function P(e){while(e.root)e=N(e.root,{children:[e]});B(e,e.siblings);}function Q(){return J}function R(){J=I>0?A(K,--I):0;if(G--,J===10)G=1,F--;return J}function T(){J=I<H?A(K,I++):0;if(G++,J===10)G=1,F++;return J}function U(){return A(K,I)}function V(){return I}function W(e,r){return M(K,e,r)}function X(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 Y(e){return F=G=1,H=S(K=e),I=0,[]}function Z(e){return K="",e}function _(e){return j(W(I-1,ne(e===91?e+2:e===40?e+1:e)))}function re(e){while(J=U())if(J<33)T();else break;return X(e)>2||X(J)>3?"":" "}function ce(e,r){while(--r&&T())if(J<48||J>102||J>57&&J<65||J>70&&J<97)break;return W(e,V()+(r<6&&U()==32&&T()==32))}function ne(e){while(T())switch(J){case e:return I;case 34:case 39:if(e!==34&&e!==39)ne(J);break;case 40:if(e===41)ne(e);break;case 92:T();break}return I}function se(e,r){while(T())if(e+J===47+10)break;else if(e+J===42+42&&U()===47)break;return "/*"+W(r,I-1)+"*"+m(e===47?e:T())}function te(e){while(!X(U()))T();return W(e,I)}function ue(e){return Z(ie("",null,null,null,[""],e=Y(e),0,[0],e))}function ie(e,r,a,c,n,s,t,u,i){var f=0;var o=0;var l=t;var p=0;var v=0;var b=0;var h=1;var w=1;var d=1;var g=0;var k="";var x=n;var y=s;var j=c;var z=k;while(w)switch(b=g,g=T()){case 40:if(b!=108&&A(z,l-1)==58){if(O(z+=C(_(g),"&","&\f"),"&\f",$(f?u[f-1]:0))!=-1)d=-1;break}case 34:case 39:case 91:z+=_(g);break;case 9:case 10:case 13:case 32:z+=re(b);break;case 92:z+=ce(V()-1,7);continue;case 47:switch(U()){case 42:case 47:B(oe(se(T(),V()),r,a,i),i);if((X(b||1)==5||X(U()||1)==5)&&S(z)&&M(z,-1,void 0)!==" ")z+=" ";break;default:z+="/";}break;case 123*h:u[f++]=S(z)*d;case 125*h:case 59:case 0:switch(g){case 0:case 125:w=0;case 59+o:if(d==-1)z=C(z,/\f/g,"");if(v>0&&(S(z)-l||h===0&&b===47))B(v>32?le(z+";",c,a,l-1,i):le(C(z," ","")+";",c,a,l-2,i),i);break;case 59:z+=";";default:B(j=fe(z,r,a,f,o,n,u,k,x=[],y=[],l,s),s);if(g===123)if(o===0)ie(z,r,j,j,x,s,l,u,y);else {switch(p){case 99:if(A(z,3)===110)break;case 108:if(A(z,2)===97)break;default:o=0;case 100:case 109:case 115:}if(o)ie(e,j,j,c&&B(fe(e,j,j,0,0,n,u,k,n,x=[],l,y),y),n,y,l,u,c?x:y);else ie(z,j,j,j,[""],y,0,u,y);}}f=o=v=0,h=d=1,k=z="",l=t;break;case 58:l=1+S(z),v=b;default:if(h<1)if(g==123)--h;else if(g==125&&h++==0&&R()==125)continue;switch(z+=m(g),g*h){case 38:d=o>0?1:(z+="\f",-1);break;case 44:u[f++]=(S(z)-1)*d,d=1;break;case 64:if(U()===45)z+=_(T());p=U(),o=l=S(k=z+=te(V())),g++;break;case 45:if(b===45&&S(z)==2)h=0;}}return s}function fe(e,r,a,c,s,t,u,i,f,o,l,p){var v=s-1;var b=s===0?t:[""];var h=q(b);for(var w=0,d=0,g=0;w<c;++w)for(var k=0,m=M(e,v+1,v=$(d=u[w])),x=e;k<h;++k)if(x=j(d>0?b[k]+" "+m:C(m,/&\f/g,b[k])))f[g++]=x;return L(e,r,a,s===0?n:i,f,o,l,p)}function oe(e,r,a,n){return L(e,r,a,c,m(Q()),M(e,2,-2),0,n)}function le(e,r,a,c,n){return L(e,r,a,s,M(e,0,c),M(e,c+1,-1),c,n)}function pe(c,n,s){switch(y(c,n)){case 5103:return a+"print-"+c+c;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 4215:case 6389:case 5109:case 5365:case 5621:case 3829:case 6391:case 5879:case 5623:case 6135:case 4599:return a+c+c;case 4855:return a+c.replace("add","source-over").replace("substract","source-out").replace("intersect","source-in").replace("exclude","xor")+c;case 4789:return r+c+c;case 5349:case 4246:case 4810:case 6968:case 2756:return a+c+r+c+e+c+c;case 5936:switch(A(c,n+11)){case 114:return a+c+e+C(c,/[svh]\w+-[tblr]{2}/,"tb")+c;case 108:return a+c+e+C(c,/[svh]\w+-[tblr]{2}/,"tb-rl")+c;case 45:return a+c+e+C(c,/[svh]\w+-[tblr]{2}/,"lr")+c}case 6828:case 4268:case 2903:return a+c+e+c+c;case 6165:return a+c+e+"flex-"+c+c;case 5187:return a+c+C(c,/(\w+).+(:[^]+)/,a+"box-$1$2"+e+"flex-$1$2")+c;case 5443:return a+c+e+"flex-item-"+C(c,/flex-|-self/g,"")+(!z(c,/flex-|baseline/)?e+"grid-row-"+C(c,/flex-|-self/g,""):"")+c;case 4675:return a+c+e+"flex-line-pack"+C(c,/align-content|flex-|-self/g,"")+c;case 5548:return a+c+e+C(c,"shrink","negative")+c;case 5292:return a+c+e+C(c,"basis","preferred-size")+c;case 6060:return a+"box-"+C(c,"-grow","")+a+c+e+C(c,"grow","positive")+c;case 4554:return a+C(c,/([^-])(transform)/g,"$1"+a+"$2")+c;case 6187:return C(C(C(c,/(zoom-|grab)/,a+"$1"),/(image-set)/,a+"$1"),c,"")+c;case 5495:case 3959:return C(c,/(image-set\([^]*)/,a+"$1"+"$`$1");case 4968:return C(C(c,/(.+:)(flex-)?(.*)/,a+"box-pack:$3"+e+"flex-pack:$3"),/space-between/,"justify")+a+c+c;case 4200:if(!z(c,/flex-|baseline/))return e+"grid-column-align"+M(c,n)+c;break;case 2592:case 3360:return e+C(c,"template-","")+c;case 4384:case 3616:if(s&&s.some((function(e,r){return n=r,z(e.props,/grid-\w+-end/)}))){return ~O(c+(s=s[n].value),"span",0)?c:e+C(c,"-start","")+c+e+"grid-row-span:"+(~O(s,"span",0)?z(s,/\d+/):+z(s,/\d+/)-+z(c,/\d+/))+";"}return e+C(c,"-start","")+c;case 4896:case 4128:return s&&s.some((function(e){return z(e.props,/grid-\w+-start/)}))?c:e+C(C(c,"-end","-span"),"span ","")+c;case 4095:case 3583:case 4068:case 2532:return C(c,/(.+)-inline(.+)/,a+"$1$2")+c;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(S(c)-1-n>6)switch(A(c,n+1)){case 109:if(A(c,n+4)!==45)break;case 102:return C(c,/(.+:)(.+)-([^]+)/,"$1"+a+"$2-$3"+"$1"+r+(A(c,n+3)==108?"$3":"$2-$3"))+c;case 115:return ~O(c,"stretch",0)?pe(C(c,"stretch","fill-available"),n,s)+c:c}break;case 5152:case 5920:return C(c,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,(function(r,a,n,s,t,u,i){return e+a+":"+n+i+(s?e+a+"-span:"+(t?u:+u-+n)+i:"")+c}));case 4949:if(A(c,n+6)===121)return C(c,":",":"+a)+c;break;case 6444:switch(A(c,A(c,14)===45?18:11)){case 120:return C(c,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+a+(A(c,14)===45?"inline-":"")+"box$3"+"$1"+a+"$2$3"+"$1"+e+"$2box$3")+c;case 100:return C(c,":",":"+e)+c}break;case 5719:case 2647:case 2135:case 3927:case 2391:return C(c,"scroll-","scroll-snap-")+c}return c}function ve(e,r){var a="";for(var c=0;c<e.length;c++)a+=r(e[c],c,e,r)||"";return a}function be(e,r,a,t){switch(e.type){case g:if(e.children.length)break;case i:case v:case s:return e.return=e.return||e.value;case c:return "";case b:return e.return=e.value+"{"+ve(e.children,t)+"}";case n:if(!S(e.value=e.props.join(",")))return ""}return S(a=ve(e.children,t))?e.return=e.value+"{"+a+"}":""}function he(e){var r=q(e);return function(a,c,n,s){var t="";for(var u=0;u<r;u++)t+=e[u](a,c,n,s)||"";return t}}function we(e){return function(r){if(!r.root)if(r=r.return)e(r);}}function de(c,t,u,i){if(c.length>-1)if(!c.return)switch(c.type){case s:c.return=pe(c.value,c.length,u);return;case b:return ve([N(c,{value:C(c.value,"@","@"+a)})],i);case n:if(c.length)return D(u=c.props,(function(n){switch(z(n,i=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":P(N(c,{props:[C(n,/:(read-\w+)/,":"+r+"$1")]}));P(N(c,{props:[n]}));x(c,{props:E(u,i)});break;case"::placeholder":P(N(c,{props:[C(n,/:(plac\w+)/,":"+a+"input-$1")]}));P(N(c,{props:[C(n,/:(plac\w+)/,":"+r+"$1")]}));P(N(c,{props:[C(n,/:(plac\w+)/,e+"input-$1")]}));P(N(c,{props:[n]}));x(c,{props:E(u,i)});break}return ""}))}}
978
908
 
979
- var SEED$1 = 5381;
909
+ const SEED$1 = 5381;
980
910
  // When we have separate strings it's useful to run a progressive
981
911
  // version of djb2 where we pretend that we're still looping over
982
912
  // the same string
983
- var phash = function (h, x) {
984
- var i = x.length;
913
+ const phash = (h, x) => {
914
+ let i = x.length;
985
915
  while (i) {
986
916
  h = (h * 33) ^ x.charCodeAt(--i);
987
917
  }
988
918
  return h;
989
919
  };
990
920
  // This is a djb2 hashing function
991
- var hash = function (x) {
921
+ const hash = (x) => {
992
922
  return phash(SEED$1, x);
993
923
  };
994
924
 
995
- var AMP_REGEX = /&/g;
925
+ const AMP_REGEX = /&/g;
996
926
  // Character codes for fast comparison
997
- var DOUBLE_QUOTE = 34; // "
998
- var SINGLE_QUOTE = 39; // '
999
- var SLASH = 47; // /
1000
- var ASTERISK = 42; // *
1001
- var BACKSLASH = 92; // \
1002
- var OPEN_BRACE = 123; // {
1003
- var CLOSE_BRACE = 125; // }
1004
- var SEMICOLON = 59; // ;
1005
- var NEWLINE = 10; // \n
1006
- var OPEN_PAREN = 40; // (
1007
- var CLOSE_PAREN = 41; // )
927
+ const DOUBLE_QUOTE = 34; // "
928
+ const SINGLE_QUOTE = 39; // '
929
+ const SLASH = 47; // /
930
+ const ASTERISK = 42; // *
931
+ const BACKSLASH = 92; // \
932
+ const OPEN_BRACE = 123; // {
933
+ const CLOSE_BRACE = 125; // }
934
+ const SEMICOLON = 59; // ;
935
+ const NEWLINE = 10; // \n
936
+ const OPEN_PAREN = 40; // (
937
+ const CLOSE_PAREN = 41; // )
1008
938
  /**
1009
939
  * Strips JS-style line comments (//) from CSS, handling comments anywhere
1010
940
  * in the line while preserving strings, url() contents, and valid CSS.
@@ -1014,14 +944,14 @@
1014
944
  // Fast path: no // means no line comments
1015
945
  if (css.indexOf('//') === -1)
1016
946
  return css;
1017
- var len = css.length;
1018
- var parts = [];
1019
- var start = 0;
1020
- var i = 0;
1021
- var inString = 0; // 0 = none, DOUBLE_QUOTE or SINGLE_QUOTE when in string
1022
- var urlDepth = 0; // Track nesting depth inside url()
947
+ const len = css.length;
948
+ const parts = [];
949
+ let start = 0;
950
+ let i = 0;
951
+ let inString = 0; // 0 = none, DOUBLE_QUOTE or SINGLE_QUOTE when in string
952
+ let urlDepth = 0; // Track nesting depth inside url()
1023
953
  while (i < len) {
1024
- var code = css.charCodeAt(i);
954
+ const code = css.charCodeAt(i);
1025
955
  // Track string state
1026
956
  if ((code === DOUBLE_QUOTE || code === SINGLE_QUOTE) &&
1027
957
  (i === 0 || css.charCodeAt(i - 1) !== BACKSLASH)) {
@@ -1105,12 +1035,12 @@
1105
1035
  // Fast path: no closing brace means can't have unbalanced braces
1106
1036
  if (css.indexOf('}') === -1)
1107
1037
  return false;
1108
- var len = css.length;
1109
- var depth = 0;
1110
- var inString = 0; // 0 = none, char code when in string
1111
- var inComment = false;
1112
- for (var i = 0; i < len; i++) {
1113
- var code = css.charCodeAt(i);
1038
+ const len = css.length;
1039
+ let depth = 0;
1040
+ let inString = 0; // 0 = none, char code when in string
1041
+ let inComment = false;
1042
+ for (let i = 0; i < len; i++) {
1043
+ const code = css.charCodeAt(i);
1114
1044
  // Handle CSS comments
1115
1045
  if (inString === 0 && !inComment && code === SLASH && css.charCodeAt(i + 1) === ASTERISK) {
1116
1046
  inComment = true;
@@ -1159,14 +1089,14 @@
1159
1089
  if (!hasUnbalancedBraces(css)) {
1160
1090
  return css;
1161
1091
  }
1162
- var len = css.length;
1163
- var result = '';
1164
- var declStart = 0;
1165
- var braceDepth = 0;
1166
- var inString = 0;
1167
- var inComment = false;
1168
- for (var i = 0; i < len; i++) {
1169
- var code = css.charCodeAt(i);
1092
+ const len = css.length;
1093
+ let result = '';
1094
+ let declStart = 0;
1095
+ let braceDepth = 0;
1096
+ let inString = 0;
1097
+ let inComment = false;
1098
+ for (let i = 0; i < len; i++) {
1099
+ const code = css.charCodeAt(i);
1170
1100
  // Handle CSS comments
1171
1101
  if (inString === 0 && !inComment && code === SLASH && css.charCodeAt(i + 1) === ASTERISK) {
1172
1102
  inComment = true;
@@ -1200,9 +1130,9 @@
1200
1130
  braceDepth--;
1201
1131
  if (braceDepth < 0) {
1202
1132
  // Extra closing brace - skip to next semicolon or newline
1203
- var skipEnd = i + 1;
1133
+ let skipEnd = i + 1;
1204
1134
  while (skipEnd < len) {
1205
- var skipCode = css.charCodeAt(skipEnd);
1135
+ const skipCode = css.charCodeAt(skipEnd);
1206
1136
  if (skipCode === SEMICOLON || skipCode === NEWLINE)
1207
1137
  break;
1208
1138
  skipEnd++;
@@ -1226,7 +1156,7 @@
1226
1156
  }
1227
1157
  // Add remaining valid content
1228
1158
  if (declStart < len) {
1229
- var remaining = css.substring(declStart);
1159
+ const remaining = css.substring(declStart);
1230
1160
  if (!hasUnbalancedBraces(remaining)) {
1231
1161
  result += remaining;
1232
1162
  }
@@ -1238,14 +1168,14 @@
1238
1168
  * Takes into account media queries by recursing through child rules if they are present.
1239
1169
  */
1240
1170
  function recursivelySetNamepace(compiled, namespace) {
1241
- return compiled.map(function (rule) {
1171
+ return compiled.map(rule => {
1242
1172
  if (rule.type === 'rule') {
1243
1173
  // add the namespace to the start
1244
- rule.value = "".concat(namespace, " ").concat(rule.value);
1174
+ rule.value = `${namespace} ${rule.value}`;
1245
1175
  // add the namespace after each comma for subsequent selectors.
1246
- rule.value = rule.value.replaceAll(',', ",".concat(namespace, " "));
1247
- rule.props = rule.props.map(function (prop) {
1248
- return "".concat(namespace, " ").concat(prop);
1176
+ rule.value = rule.value.replaceAll(',', `,${namespace} `);
1177
+ rule.props = rule.props.map(prop => {
1178
+ return `${namespace} ${prop}`;
1249
1179
  });
1250
1180
  }
1251
1181
  if (Array.isArray(rule.children) && rule.type !== '@keyframes') {
@@ -1254,12 +1184,11 @@
1254
1184
  return rule;
1255
1185
  });
1256
1186
  }
1257
- function createStylisInstance(_a) {
1258
- 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;
1259
- var _componentId;
1260
- var _selector;
1261
- var _selectorRegexp;
1262
- var selfReferenceReplacer = function (match, offset, string) {
1187
+ function createStylisInstance({ options = EMPTY_OBJECT, plugins = EMPTY_ARRAY, } = EMPTY_OBJECT) {
1188
+ let _componentId;
1189
+ let _selector;
1190
+ let _selectorRegexp;
1191
+ const selfReferenceReplacer = (match, offset, string) => {
1263
1192
  if (
1264
1193
  /**
1265
1194
  * We only want to refer to the static class directly if the selector is part of a
@@ -1268,7 +1197,7 @@
1268
1197
  string.startsWith(_selector) &&
1269
1198
  string.endsWith(_selector) &&
1270
1199
  string.replaceAll(_selector, '').length > 0) {
1271
- return ".".concat(_componentId);
1200
+ return `.${_componentId}`;
1272
1201
  }
1273
1202
  return match;
1274
1203
  };
@@ -1284,11 +1213,11 @@
1284
1213
  *
1285
1214
  * https://github.com/thysultan/stylis.js/tree/v4.0.2#abstract-syntax-structure
1286
1215
  */
1287
- var selfReferenceReplacementPlugin = function (element) {
1216
+ const selfReferenceReplacementPlugin = element => {
1288
1217
  if (element.type === n && element.value.includes('&')) {
1289
1218
  // Lazy RegExp creation: only allocate when self-reference pattern is actually used
1290
1219
  if (!_selectorRegexp) {
1291
- _selectorRegexp = new RegExp("\\".concat(_selector, "\\b"), 'g');
1220
+ _selectorRegexp = new RegExp(`\\${_selector}\\b`, 'g');
1292
1221
  }
1293
1222
  element.props[0] = element.props[0]
1294
1223
  // catch any hanging references that stylis missed
@@ -1296,7 +1225,7 @@
1296
1225
  .replace(_selectorRegexp, selfReferenceReplacer);
1297
1226
  }
1298
1227
  };
1299
- var middlewares = plugins.slice();
1228
+ const middlewares = plugins.slice();
1300
1229
  middlewares.push(selfReferenceReplacementPlugin);
1301
1230
  /**
1302
1231
  * Enables automatic vendor-prefixing for styles.
@@ -1308,24 +1237,21 @@
1308
1237
  // Pre-build the middleware chain once to avoid allocating closures,
1309
1238
  // arrays, and middleware wrappers on every stringifyRules call.
1310
1239
  // Safe because JS is single-threaded and _stack is consumed before next call.
1311
- var _stack = [];
1312
- var _middleware = he(middlewares.concat(we(function (value) { return _stack.push(value); })));
1313
- var stringifyRules = function (css, selector,
1240
+ let _stack = [];
1241
+ const _middleware = he(middlewares.concat(we(value => _stack.push(value))));
1242
+ const stringifyRules = (css, selector = '',
1314
1243
  /**
1315
1244
  * This "prefix" referes to a _selector_ prefix.
1316
1245
  */
1317
- prefix, componentId) {
1318
- if (selector === void 0) { selector = ''; }
1319
- if (prefix === void 0) { prefix = ''; }
1320
- if (componentId === void 0) { componentId = '&'; }
1246
+ prefix = '', componentId = '&') => {
1321
1247
  // stylis has no concept of state to be passed to plugins
1322
1248
  // but since JS is single-threaded, we can rely on that to ensure
1323
1249
  // these properties stay in sync with the current stylis run
1324
1250
  _componentId = componentId;
1325
1251
  _selector = selector;
1326
1252
  _selectorRegexp = undefined; // Reset for lazy creation per call
1327
- var flatCSS = sanitizeCSS(stripLineComments(css));
1328
- var compiled = ue(prefix || selector ? "".concat(prefix, " ").concat(selector, " { ").concat(flatCSS, " }") : flatCSS);
1253
+ const flatCSS = sanitizeCSS(stripLineComments(css));
1254
+ let compiled = ue(prefix || selector ? `${prefix} ${selector} { ${flatCSS} }` : flatCSS);
1329
1255
  if (options.namespace) {
1330
1256
  compiled = recursivelySetNamepace(compiled, options.namespace);
1331
1257
  }
@@ -1335,7 +1261,7 @@
1335
1261
  };
1336
1262
  stringifyRules.hash = plugins.length
1337
1263
  ? plugins
1338
- .reduce(function (acc, plugin) {
1264
+ .reduce((acc, plugin) => {
1339
1265
  if (!plugin.name) {
1340
1266
  throwStyledComponentsError(15);
1341
1267
  }
@@ -1346,18 +1272,18 @@
1346
1272
  return stringifyRules;
1347
1273
  }
1348
1274
 
1349
- var mainSheet = new StyleSheet();
1350
- var mainStylis = createStylisInstance();
1351
- var defaultContextValue = {
1275
+ const mainSheet = new StyleSheet();
1276
+ const mainStylis = createStylisInstance();
1277
+ const defaultContextValue = {
1352
1278
  shouldForwardProp: undefined,
1353
1279
  styleSheet: mainSheet,
1354
1280
  stylis: mainStylis,
1355
1281
  };
1356
1282
  // Create context only if createContext is available, otherwise create a fallback
1357
- var StyleSheetContext = React.createContext(defaultContextValue)
1283
+ const StyleSheetContext = React.createContext(defaultContextValue)
1358
1284
  ;
1359
- var StyleSheetConsumer = StyleSheetContext.Consumer;
1360
- var StylisContext = React.createContext(undefined)
1285
+ const StyleSheetConsumer = StyleSheetContext.Consumer;
1286
+ const StylisContext = React.createContext(undefined)
1361
1287
  ;
1362
1288
  function useStyleSheetContext() {
1363
1289
  // Skip useContext if we're in an RSC environment without context support
@@ -1368,9 +1294,9 @@
1368
1294
  if (!React.useMemo) {
1369
1295
  return props.children;
1370
1296
  }
1371
- var styleSheet = useStyleSheetContext().styleSheet;
1372
- var resolvedStyleSheet = React.useMemo(function () {
1373
- var sheet = styleSheet;
1297
+ const { styleSheet } = useStyleSheetContext();
1298
+ const resolvedStyleSheet = React.useMemo(() => {
1299
+ let sheet = styleSheet;
1374
1300
  if (props.sheet) {
1375
1301
  sheet = props.sheet;
1376
1302
  }
@@ -1385,32 +1311,30 @@
1385
1311
  }
1386
1312
  return sheet;
1387
1313
  }, [props.disableCSSOMInjection, props.nonce, props.sheet, props.target, styleSheet]);
1388
- var stylis = React.useMemo(function () {
1389
- return createStylisInstance({
1390
- options: { namespace: props.namespace, prefix: props.enableVendorPrefixes },
1391
- plugins: props.stylisPlugins,
1392
- });
1393
- }, [props.enableVendorPrefixes, props.namespace, props.stylisPlugins]);
1394
- var styleSheetContextValue = React.useMemo(function () { return ({
1314
+ const stylis = React.useMemo(() => createStylisInstance({
1315
+ options: { namespace: props.namespace, prefix: props.enableVendorPrefixes },
1316
+ plugins: props.stylisPlugins,
1317
+ }), [props.enableVendorPrefixes, props.namespace, props.stylisPlugins]);
1318
+ const styleSheetContextValue = React.useMemo(() => ({
1395
1319
  shouldForwardProp: props.shouldForwardProp,
1396
1320
  styleSheet: resolvedStyleSheet,
1397
- stylis: stylis,
1398
- }); }, [props.shouldForwardProp, resolvedStyleSheet, stylis]);
1321
+ stylis,
1322
+ }), [props.shouldForwardProp, resolvedStyleSheet, stylis]);
1399
1323
  return (React.createElement(StyleSheetContext.Provider, { value: styleSheetContextValue },
1400
1324
  React.createElement(StylisContext.Provider, { value: stylis }, props.children)));
1401
1325
  }
1402
1326
 
1403
1327
  // Create context only if createContext is available, otherwise create a fallback
1404
- var ThemeContext = React.createContext(undefined)
1328
+ const ThemeContext = React.createContext(undefined)
1405
1329
  ;
1406
- var ThemeConsumer = ThemeContext.Consumer;
1330
+ const ThemeConsumer = ThemeContext.Consumer;
1407
1331
  function mergeTheme(theme, outerTheme) {
1408
1332
  if (!theme) {
1409
1333
  throw throwStyledComponentsError(14);
1410
1334
  }
1411
1335
  if (isFunction(theme)) {
1412
- var themeFn = theme;
1413
- var mergedTheme = themeFn(outerTheme);
1336
+ const themeFn = theme;
1337
+ const mergedTheme = themeFn(outerTheme);
1414
1338
  if ((mergedTheme === null || Array.isArray(mergedTheme) || typeof mergedTheme !== 'object')) {
1415
1339
  throw throwStyledComponentsError(7);
1416
1340
  }
@@ -1419,7 +1343,7 @@
1419
1343
  if (Array.isArray(theme) || typeof theme !== 'object') {
1420
1344
  throw throwStyledComponentsError(8);
1421
1345
  }
1422
- return outerTheme ? __assign(__assign({}, outerTheme), theme) : theme;
1346
+ return outerTheme ? Object.assign(Object.assign({}, outerTheme), theme) : theme;
1423
1347
  }
1424
1348
  /**
1425
1349
  * Returns the current theme (as provided by the closest ancestor `ThemeProvider`.)
@@ -1430,7 +1354,7 @@
1430
1354
  */
1431
1355
  function useTheme() {
1432
1356
  // Skip useContext if we're in an RSC environment without context support
1433
- var theme = React.useContext(ThemeContext) ;
1357
+ const theme = React.useContext(ThemeContext) ;
1434
1358
  if (!theme) {
1435
1359
  throw throwStyledComponentsError(18);
1436
1360
  }
@@ -1440,43 +1364,39 @@
1440
1364
  * Provide a theme to an entire react component tree via context
1441
1365
  */
1442
1366
  function ThemeProvider(props) {
1443
- var outerTheme = React.useContext(ThemeContext);
1444
- var themeContext = React.useMemo(function () { return mergeTheme(props.theme, outerTheme); }, [props.theme, outerTheme]);
1367
+ const outerTheme = React.useContext(ThemeContext);
1368
+ const themeContext = React.useMemo(() => mergeTheme(props.theme, outerTheme), [props.theme, outerTheme]);
1445
1369
  if (!props.children) {
1446
1370
  return null;
1447
1371
  }
1448
1372
  return React.createElement(ThemeContext.Provider, { value: themeContext }, props.children);
1449
1373
  }
1450
1374
 
1451
- var invalidHookCallRe = /invalid hook call/i;
1452
- var seen = new Set();
1453
- var checkDynamicCreation = function (displayName, componentId) {
1375
+ const invalidHookCallRe = /invalid hook call/i;
1376
+ const seen = new Set();
1377
+ const checkDynamicCreation = (displayName, componentId) => {
1454
1378
  {
1455
- var parsedIdString = componentId ? " with the id of \"".concat(componentId, "\"") : '';
1456
- var message_1 = "The component ".concat(displayName).concat(parsedIdString, " has been created dynamically.\n") +
1379
+ const parsedIdString = componentId ? ` with the id of "${componentId}"` : '';
1380
+ const message = `The component ${displayName}${parsedIdString} has been created dynamically.\n` +
1457
1381
  "You may see this warning because you've called styled inside another component.\n" +
1458
1382
  'To resolve this only create new StyledComponents outside of any render method and function component.\n' +
1459
1383
  'See https://styled-components.com/docs/basics#define-styled-components-outside-of-the-render-method for more info.\n';
1460
1384
  // If a hook is called outside of a component:
1461
1385
  // React 17 and earlier throw an error
1462
1386
  // React 18 and above use console.error
1463
- var originalConsoleError_1 = console.error;
1387
+ const originalConsoleError = console.error;
1464
1388
  try {
1465
- var didNotCallInvalidHook_1 = true;
1466
- console.error = function (consoleErrorMessage) {
1467
- var consoleErrorArgs = [];
1468
- for (var _i = 1; _i < arguments.length; _i++) {
1469
- consoleErrorArgs[_i - 1] = arguments[_i];
1470
- }
1389
+ let didNotCallInvalidHook = true;
1390
+ console.error = (consoleErrorMessage, ...consoleErrorArgs) => {
1471
1391
  // The error here is expected, since we're expecting anything that uses `checkDynamicCreation` to
1472
1392
  // be called outside of a React component.
1473
1393
  if (invalidHookCallRe.test(consoleErrorMessage)) {
1474
- didNotCallInvalidHook_1 = false;
1394
+ didNotCallInvalidHook = false;
1475
1395
  // This shouldn't happen, but resets `warningSeen` if we had this error happen intermittently
1476
- seen.delete(message_1);
1396
+ seen.delete(message);
1477
1397
  }
1478
1398
  else {
1479
- originalConsoleError_1.apply(void 0, __spreadArray([consoleErrorMessage], consoleErrorArgs, false));
1399
+ originalConsoleError(consoleErrorMessage, ...consoleErrorArgs);
1480
1400
  }
1481
1401
  };
1482
1402
  // We purposefully call a hook outside of a component and expect it to throw
@@ -1485,9 +1405,9 @@
1485
1405
  if (typeof React.useState === 'function') {
1486
1406
  React.useState(null);
1487
1407
  }
1488
- if (didNotCallInvalidHook_1 && !seen.has(message_1)) {
1489
- console.warn(message_1);
1490
- seen.add(message_1);
1408
+ if (didNotCallInvalidHook && !seen.has(message)) {
1409
+ console.warn(message);
1410
+ seen.add(message);
1491
1411
  }
1492
1412
  }
1493
1413
  catch (error) {
@@ -1495,30 +1415,29 @@
1495
1415
  // be called outside of a React component.
1496
1416
  if (invalidHookCallRe.test(error.message)) {
1497
1417
  // This shouldn't happen, but resets `warningSeen` if we had this error happen intermittently
1498
- seen.delete(message_1);
1418
+ seen.delete(message);
1499
1419
  }
1500
1420
  }
1501
1421
  finally {
1502
- console.error = originalConsoleError_1;
1422
+ console.error = originalConsoleError;
1503
1423
  }
1504
1424
  }
1505
1425
  };
1506
1426
 
1507
- function determineTheme(props, providedTheme, defaultProps) {
1508
- if (defaultProps === void 0) { defaultProps = EMPTY_OBJECT; }
1427
+ function determineTheme(props, providedTheme, defaultProps = EMPTY_OBJECT) {
1509
1428
  return (props.theme !== defaultProps.theme && props.theme) || providedTheme || defaultProps.theme;
1510
1429
  }
1511
1430
 
1512
- var AD_REPLACER_R = /(a)(d)/gi;
1431
+ const AD_REPLACER_R = /(a)(d)/gi;
1513
1432
  /* This is the "capacity" of our alphabet i.e. 2x26 for all letters plus their capitalised
1514
1433
  * counterparts */
1515
- var charsLength = 52;
1434
+ const charsLength = 52;
1516
1435
  /* start at 75 for 'a' until 'z' (25) and then start at 65 for capitalised letters */
1517
- var getAlphabeticChar = function (code) { return String.fromCharCode(code + (code > 25 ? 39 : 97)); };
1436
+ const getAlphabeticChar = (code) => String.fromCharCode(code + (code > 25 ? 39 : 97));
1518
1437
  /* input a number, usually a hash and convert it to base-52 */
1519
1438
  function generateAlphabeticName(code) {
1520
- var name = '';
1521
- var x;
1439
+ let name = '';
1440
+ let x;
1522
1441
  /* get a char and divide by alphabet-length */
1523
1442
  for (x = Math.abs(code); x > charsLength; x = (x / charsLength) | 0) {
1524
1443
  name = getAlphabeticChar(x % charsLength) + name;
@@ -1531,8 +1450,8 @@
1531
1450
  }
1532
1451
 
1533
1452
  function interleave(strings, interpolations) {
1534
- var result = [strings[0]];
1535
- for (var i = 0, len = interpolations.length; i < len; i += 1) {
1453
+ const result = [strings[0]];
1454
+ for (let i = 0, len = interpolations.length; i < len; i += 1) {
1536
1455
  result.push(interpolations[i], strings[i + 1]);
1537
1456
  }
1538
1457
  return result;
@@ -1542,21 +1461,16 @@
1542
1461
  * Used when flattening object styles to determine if we should
1543
1462
  * expand an array of styles.
1544
1463
  */
1545
- var addTag = function (arg) {
1546
- return Object.assign(arg, { isCss: true });
1547
- };
1548
- function css(styles) {
1549
- var interpolations = [];
1550
- for (var _i = 1; _i < arguments.length; _i++) {
1551
- interpolations[_i - 1] = arguments[_i];
1552
- }
1464
+ const addTag = (arg) => Object.assign(arg, { isCss: true });
1465
+ function css(styles, ...interpolations) {
1553
1466
  if (isFunction(styles) || isPlainObject(styles)) {
1554
- var styleFunctionOrObject = styles;
1555
- return addTag(flatten(interleave(EMPTY_ARRAY, __spreadArray([
1556
- styleFunctionOrObject
1557
- ], interpolations, true))));
1467
+ const styleFunctionOrObject = styles;
1468
+ return addTag(flatten(interleave(EMPTY_ARRAY, [
1469
+ styleFunctionOrObject,
1470
+ ...interpolations,
1471
+ ])));
1558
1472
  }
1559
- var styleStringArray = styles;
1473
+ const styleStringArray = styles;
1560
1474
  if (interpolations.length === 0 &&
1561
1475
  styleStringArray.length === 1 &&
1562
1476
  typeof styleStringArray[0] === 'string') {
@@ -1565,28 +1479,24 @@
1565
1479
  return addTag(flatten(interleave(styleStringArray, interpolations)));
1566
1480
  }
1567
1481
 
1568
- function createGlobalStyle(strings) {
1569
- var interpolations = [];
1570
- for (var _i = 1; _i < arguments.length; _i++) {
1571
- interpolations[_i - 1] = arguments[_i];
1572
- }
1573
- var rules = css.apply(void 0, __spreadArray([strings], interpolations, false));
1574
- var styledComponentId = "sc-global-".concat(generateComponentId(JSON.stringify(rules)));
1575
- var globalStyle = new GlobalStyle(rules, styledComponentId);
1482
+ function createGlobalStyle(strings, ...interpolations) {
1483
+ const rules = css(strings, ...interpolations);
1484
+ const styledComponentId = `sc-global-${generateComponentId(JSON.stringify(rules))}`;
1485
+ const globalStyle = new GlobalStyle(rules, styledComponentId);
1576
1486
  {
1577
1487
  checkDynamicCreation(styledComponentId);
1578
1488
  }
1579
- var GlobalStyleComponent = function (props) {
1580
- var ssc = useStyleSheetContext();
1581
- var theme = React.useContext(ThemeContext) ;
1489
+ const GlobalStyleComponent = props => {
1490
+ const ssc = useStyleSheetContext();
1491
+ const theme = React.useContext(ThemeContext) ;
1582
1492
  // Each mount needs a unique instance ID for the shared-group instanceRules cache.
1583
1493
  // false is a build-time constant: the dead branch is entirely eliminated,
1584
1494
  // so React never sees a conditional hook call.
1585
1495
  // Server bundle: direct allocation (one-shot renders, no stability needed).
1586
1496
  // Browser bundle: useRef for stable ID across re-renders + useLayoutEffect cleanup.
1587
- var instance;
1497
+ let instance;
1588
1498
  {
1589
- var instanceRef = React.useRef(null);
1499
+ const instanceRef = React.useRef(null);
1590
1500
  if (instanceRef.current === null) {
1591
1501
  instanceRef.current = ssc.styleSheet.allocateGSInstance(styledComponentId);
1592
1502
  }
@@ -1594,29 +1504,42 @@
1594
1504
  }
1595
1505
  if (// @ts-expect-error invariant check
1596
1506
  React.Children.count(props.children)) {
1597
- console.warn("The global style component ".concat(styledComponentId, " was given child JSX. createGlobalStyle does not render children."));
1598
- }
1599
- if (rules.some(function (rule) { return typeof rule === 'string' && rule.indexOf('@import') !== -1; })) {
1600
- 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.");
1601
- }
1602
- // Render styles during component execution for server environments.
1603
- // Uses false (build-time constant) OR styleSheet.server (runtime flag set by
1604
- // ServerStyleSheet) because some bundlers (Turbopack) resolve the browser entry
1605
- // for SSR of client components, making false false on the server.
1507
+ console.warn(`The global style component ${styledComponentId} was given child JSX. createGlobalStyle does not render children.`);
1508
+ }
1509
+ if (rules.some(rule => typeof rule === 'string' && rule.indexOf('@import') !== -1)) {
1510
+ 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.`);
1511
+ }
1512
+ // Render styles during component execution for RSC or explicit ServerStyleSheet.
1513
+ // Gate on IS_RSC or styleSheet.server (runtime flag from ServerStyleSheet),
1514
+ // NOT on false alone. The server build sets false=true and eliminates
1515
+ // useLayoutEffect, so if we rendered here without cleanup, styles would
1516
+ // accumulate unboundedly in jsdom test environments (O(n²) regression).
1517
+ // On a real server without ServerStyleSheet, VirtualTag is used and styles are
1518
+ // discarded anyway, so skipping this path has no functional impact.
1519
+ // Turbopack resolves the browser entry for SSR, so false is false there;
1520
+ // styleSheet.server handles that case at runtime.
1606
1521
  if (ssc.styleSheet.server) {
1607
1522
  renderStyles(instance, props, ssc.styleSheet, theme, ssc.stylis);
1608
1523
  }
1609
1524
  // Client-side lifecycle: render styles in effect and clean up on unmount.
1610
1525
  // false and IS_RSC are build/module-level constants, so this doesn't violate rules of hooks.
1611
1526
  {
1612
- React.useLayoutEffect(function () {
1527
+ // For static global styles, renderStyles exits early after the first injection
1528
+ // (via hasNameForId check in GlobalStyle.renderStyles). We still need the effect
1529
+ // for initial injection and unmount cleanup, but we use a narrow deps array
1530
+ // to avoid unnecessary effect re-runs on every render.
1531
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1532
+ const effectDeps = globalStyle.isStatic
1533
+ ? [instance, ssc.styleSheet]
1534
+ : [instance, props, ssc.styleSheet, theme, ssc.stylis];
1535
+ React.useLayoutEffect(() => {
1613
1536
  if (!ssc.styleSheet.server) {
1614
1537
  renderStyles(instance, props, ssc.styleSheet, theme, ssc.stylis);
1615
1538
  }
1616
- return function () {
1539
+ return () => {
1617
1540
  globalStyle.removeStyles(instance, ssc.styleSheet);
1618
1541
  };
1619
- }, [instance, props, ssc.styleSheet, theme, ssc.stylis]);
1542
+ }, effectDeps);
1620
1543
  }
1621
1544
  // Clean up server instance cache — no useLayoutEffect cleanup runs on the
1622
1545
  // server, so instanceRules would grow unboundedly across SSR requests.
@@ -1630,82 +1553,190 @@
1630
1553
  globalStyle.renderStyles(instance, STATIC_EXECUTION_CONTEXT, styleSheet, stylis);
1631
1554
  }
1632
1555
  else {
1633
- var context = __assign(__assign({}, props), { theme: determineTheme(props, theme, GlobalStyleComponent.defaultProps) });
1556
+ const context = Object.assign(Object.assign({}, props), { theme: determineTheme(props, theme, GlobalStyleComponent.defaultProps) });
1634
1557
  globalStyle.renderStyles(instance, context, styleSheet, stylis);
1635
1558
  }
1636
1559
  }
1637
1560
  return React.memo(GlobalStyleComponent);
1638
1561
  }
1639
1562
 
1640
- var _a$1;
1641
- var Keyframes = /** @class */ (function () {
1642
- function Keyframes(name, rules) {
1643
- var _this = this;
1644
- this[_a$1] = true;
1645
- this.inject = function (styleSheet, stylisInstance) {
1646
- if (stylisInstance === void 0) { stylisInstance = mainStylis; }
1647
- var resolvedName = _this.name + stylisInstance.hash;
1648
- if (!styleSheet.hasNameForId(_this.id, resolvedName)) {
1649
- styleSheet.insertRules(_this.id, resolvedName, stylisInstance(_this.rules, resolvedName, '@keyframes'));
1563
+ /** Shared recursive traversal — calls `leafFn` for each leaf, recurses for objects. */
1564
+ function walkTheme(obj, varPrefix, result, leafFn, path) {
1565
+ for (const key in obj) {
1566
+ const val = obj[key];
1567
+ const fullPath = path ? path + '-' + key : key;
1568
+ if (typeof val === 'object' && val !== null) {
1569
+ const nested = {};
1570
+ walkTheme(val, varPrefix, nested, leafFn, fullPath);
1571
+ result[key] = nested;
1572
+ }
1573
+ else {
1574
+ result[key] = leafFn(fullPath, val, key);
1575
+ }
1576
+ }
1577
+ }
1578
+ /** Build `var(--prefix-a-b, fallback)` accessor object */
1579
+ function buildVars(obj, varPrefix) {
1580
+ const result = {};
1581
+ walkTheme(obj, varPrefix, result, (fullPath, val) => {
1582
+ {
1583
+ const str = String(val);
1584
+ let depth = 0;
1585
+ for (let i = 0; i < str.length; i++) {
1586
+ if (str.charCodeAt(i) === 40)
1587
+ depth++;
1588
+ else if (str.charCodeAt(i) === 41)
1589
+ depth--;
1590
+ if (depth < 0)
1591
+ break;
1592
+ }
1593
+ if (depth !== 0) {
1594
+ console.warn(`createTheme: value "${str}" at "${fullPath}" contains unbalanced parentheses and may break the var() fallback`);
1595
+ }
1596
+ }
1597
+ return 'var(--' + varPrefix + fullPath + ', ' + val + ')';
1598
+ });
1599
+ return result;
1600
+ }
1601
+ /** Read computed CSS variable values from the DOM */
1602
+ function resolveVars(obj, varPrefix, styles) {
1603
+ const result = {};
1604
+ walkTheme(obj, varPrefix, result, (fullPath, val) => {
1605
+ const resolved = styles.getPropertyValue('--' + varPrefix + fullPath).trim();
1606
+ return resolved || val;
1607
+ });
1608
+ return result;
1609
+ }
1610
+ /**
1611
+ * Emit CSS var declarations by walking `shape` for structure and reading
1612
+ * values from `theme`. This avoids hardcoded skip lists — only keys
1613
+ * present in the original theme shape are traversed.
1614
+ */
1615
+ function emitVarDeclarations(shape, theme, varPrefix, path) {
1616
+ let css = '';
1617
+ for (const key in shape) {
1618
+ const shapeVal = shape[key];
1619
+ const themeVal = theme[key];
1620
+ const fullPath = path ? path + '-' + key : key;
1621
+ if (typeof shapeVal === 'object' && shapeVal !== null) {
1622
+ if (typeof themeVal === 'object' && themeVal !== null) {
1623
+ css += emitVarDeclarations(shapeVal, themeVal, varPrefix, fullPath);
1624
+ }
1625
+ }
1626
+ else if (themeVal !== undefined && typeof themeVal !== 'function') {
1627
+ css += '--' + varPrefix + fullPath + ':' + themeVal + ';';
1628
+ }
1629
+ }
1630
+ return css;
1631
+ }
1632
+ /**
1633
+ * Create a theme contract that bridges `ThemeProvider` and CSS custom properties.
1634
+ *
1635
+ * Returns an object with the same shape as the input theme, but every leaf value
1636
+ * is a `var(--prefix-*, fallback)` CSS string. Use these in styled component
1637
+ * templates — they work in both client and RSC contexts.
1638
+ *
1639
+ * Mount the returned `GlobalStyle` component inside your `ThemeProvider` to emit
1640
+ * the CSS variables. When the theme changes (e.g. light → dark), the variables
1641
+ * update automatically.
1642
+ *
1643
+ * @example
1644
+ * ```tsx
1645
+ * const theme = createTheme({
1646
+ * colors: { primary: '#0070f3', text: '#111' },
1647
+ * });
1648
+ *
1649
+ * // Root layout (client):
1650
+ * <ThemeProvider theme={themes[preset]}>
1651
+ * <theme.GlobalStyle />
1652
+ * {children}
1653
+ * </ThemeProvider>
1654
+ *
1655
+ * // Any RSC file:
1656
+ * const Card = styled.div`
1657
+ * color: ${theme.colors.primary};
1658
+ * // → "var(--sc-colors-primary, #0070f3)"
1659
+ * `;
1660
+ * ```
1661
+ */
1662
+ function createTheme(defaultTheme, options) {
1663
+ var _a, _b;
1664
+ const pfx = ((_a = options === null || options === void 0 ? void 0 : options.prefix) !== null && _a !== void 0 ? _a : 'sc') + '-';
1665
+ const sel = (_b = options === null || options === void 0 ? void 0 : options.selector) !== null && _b !== void 0 ? _b : ':root';
1666
+ const vars = buildVars(defaultTheme, pfx);
1667
+ const GlobalStyle = createGlobalStyle `
1668
+ ${sel} {
1669
+ ${(p) => emitVarDeclarations(defaultTheme, p.theme, pfx)}
1670
+ }
1671
+ `;
1672
+ return Object.assign(vars, {
1673
+ GlobalStyle,
1674
+ raw: defaultTheme,
1675
+ resolve(el) {
1676
+ if (!IS_BROWSER) {
1677
+ throw new Error('createTheme.resolve() is client-only');
1678
+ }
1679
+ const target = el !== null && el !== void 0 ? el : document.documentElement;
1680
+ return resolveVars(defaultTheme, pfx, getComputedStyle(target));
1681
+ },
1682
+ });
1683
+ }
1684
+
1685
+ var _a;
1686
+ class Keyframes {
1687
+ constructor(name, rules) {
1688
+ this[_a] = true;
1689
+ this.inject = (styleSheet, stylisInstance = mainStylis) => {
1690
+ const resolvedName = this.name + stylisInstance.hash;
1691
+ if (!styleSheet.hasNameForId(this.id, resolvedName)) {
1692
+ styleSheet.insertRules(this.id, resolvedName, stylisInstance(this.rules, resolvedName, '@keyframes'));
1650
1693
  }
1651
1694
  };
1652
1695
  this.name = name;
1653
- this.id = "sc-keyframes-".concat(name);
1696
+ this.id = KEYFRAMES_ID_PREFIX + name;
1654
1697
  this.rules = rules;
1655
1698
  // Eagerly register the group so keyframes defined before components
1656
1699
  // get a lower group ID and appear before them in the stylesheet.
1657
1700
  // Uses getGroupForId directly (not StyleSheet.registerId) because
1658
1701
  // GroupIDAllocator is pure JS — safe for native builds.
1659
1702
  getGroupForId(this.id);
1660
- setToString(this, function () {
1661
- throw throwStyledComponentsError(12, String(_this.name));
1703
+ setToString(this, () => {
1704
+ throw throwStyledComponentsError(12, String(this.name));
1662
1705
  });
1663
1706
  }
1664
- Keyframes.prototype.getName = function (stylisInstance) {
1665
- if (stylisInstance === void 0) { stylisInstance = mainStylis; }
1707
+ getName(stylisInstance = mainStylis) {
1666
1708
  return this.name + stylisInstance.hash;
1667
- };
1668
- return Keyframes;
1669
- }());
1670
- _a$1 = KEYFRAMES_SYMBOL;
1671
-
1672
- function keyframes(strings) {
1673
- var interpolations = [];
1674
- for (var _i = 1; _i < arguments.length; _i++) {
1675
- interpolations[_i - 1] = arguments[_i];
1676
1709
  }
1710
+ }
1711
+ _a = KEYFRAMES_SYMBOL;
1712
+
1713
+ function keyframes(strings, ...interpolations) {
1677
1714
  /* Warning if you've used keyframes on React Native */
1678
1715
  if (typeof navigator !== 'undefined' &&
1679
1716
  navigator.product === 'ReactNative') {
1680
1717
  console.warn('`keyframes` cannot be used on ReactNative, only on the web. To do animation in ReactNative please use Animated.');
1681
1718
  }
1682
- var rules = joinStringArray(css.apply(void 0, __spreadArray([strings], interpolations, false)));
1683
- var name = generateComponentId(rules);
1719
+ const rules = joinStringArray(css(strings, ...interpolations));
1720
+ const name = generateComponentId(rules);
1684
1721
  return new Keyframes(name, rules);
1685
1722
  }
1686
1723
 
1687
- var _a;
1688
- var hasSymbol = typeof Symbol === 'function' && Symbol.for;
1689
1724
  // copied from react-is
1690
- var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
1691
- var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
1725
+ const REACT_MEMO_TYPE = Symbol.for('react.memo');
1726
+ const REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
1692
1727
  /**
1693
1728
  * Adapted from hoist-non-react-statics to avoid the react-is dependency.
1694
1729
  */
1695
- var REACT_STATICS = {
1696
- childContextTypes: true,
1730
+ const REACT_STATICS = {
1697
1731
  contextType: true,
1698
- contextTypes: true,
1699
1732
  defaultProps: true,
1700
1733
  displayName: true,
1701
- getDefaultProps: true,
1702
1734
  getDerivedStateFromError: true,
1703
1735
  getDerivedStateFromProps: true,
1704
- mixins: true,
1705
1736
  propTypes: true,
1706
1737
  type: true,
1707
1738
  };
1708
- var KNOWN_STATICS = {
1739
+ const KNOWN_STATICS = {
1709
1740
  name: true,
1710
1741
  length: true,
1711
1742
  prototype: true,
@@ -1714,14 +1745,14 @@
1714
1745
  arguments: true,
1715
1746
  arity: true,
1716
1747
  };
1717
- var FORWARD_REF_STATICS = {
1748
+ const FORWARD_REF_STATICS = {
1718
1749
  $$typeof: true,
1719
1750
  render: true,
1720
1751
  defaultProps: true,
1721
1752
  displayName: true,
1722
1753
  propTypes: true,
1723
1754
  };
1724
- var MEMO_STATICS = {
1755
+ const MEMO_STATICS = {
1725
1756
  $$typeof: true,
1726
1757
  compare: true,
1727
1758
  defaultProps: true,
@@ -1729,13 +1760,13 @@
1729
1760
  propTypes: true,
1730
1761
  type: true,
1731
1762
  };
1732
- var TYPE_STATICS = (_a = {},
1733
- _a[REACT_FORWARD_REF_TYPE] = FORWARD_REF_STATICS,
1734
- _a[REACT_MEMO_TYPE] = MEMO_STATICS,
1735
- _a);
1763
+ const TYPE_STATICS = {
1764
+ [REACT_FORWARD_REF_TYPE]: FORWARD_REF_STATICS,
1765
+ [REACT_MEMO_TYPE]: MEMO_STATICS,
1766
+ };
1736
1767
  // adapted from react-is
1737
1768
  function isMemo(object) {
1738
- var $$typeofType = 'type' in object && object.type.$$typeof;
1769
+ const $$typeofType = 'type' in object && object.type.$$typeof;
1739
1770
  return $$typeofType === REACT_MEMO_TYPE;
1740
1771
  }
1741
1772
  function getStatics(component) {
@@ -1748,34 +1779,29 @@
1748
1779
  ? TYPE_STATICS[component['$$typeof']]
1749
1780
  : REACT_STATICS;
1750
1781
  }
1751
- var defineProperty = Object.defineProperty;
1752
- var getOwnPropertyNames = Object.getOwnPropertyNames;
1753
- var getOwnPropertySymbols = Object.getOwnPropertySymbols;
1754
- var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
1755
- var getPrototypeOf = Object.getPrototypeOf;
1756
- var objectPrototype = Object.prototype;
1782
+ const defineProperty = Object.defineProperty;
1783
+ const getOwnPropertyNames = Object.getOwnPropertyNames;
1784
+ const getOwnPropertySymbols = Object.getOwnPropertySymbols;
1785
+ const getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
1786
+ const getPrototypeOf = Object.getPrototypeOf;
1787
+ const objectPrototype = Object.prototype;
1757
1788
  function hoistNonReactStatics(targetComponent, sourceComponent, excludelist) {
1758
1789
  if (typeof sourceComponent !== 'string') {
1759
1790
  // don't hoist over string (html) components
1760
- if (objectPrototype) {
1761
- var inheritedComponent = getPrototypeOf(sourceComponent);
1762
- if (inheritedComponent && inheritedComponent !== objectPrototype) {
1763
- hoistNonReactStatics(targetComponent, inheritedComponent, excludelist);
1764
- }
1765
- }
1766
- var keys = getOwnPropertyNames(sourceComponent);
1767
- if (getOwnPropertySymbols) {
1768
- keys = keys.concat(getOwnPropertySymbols(sourceComponent));
1769
- }
1770
- var targetStatics = getStatics(targetComponent);
1771
- var sourceStatics = getStatics(sourceComponent);
1772
- for (var i = 0; i < keys.length; ++i) {
1773
- var key = keys[i];
1791
+ const inheritedComponent = getPrototypeOf(sourceComponent);
1792
+ if (inheritedComponent && inheritedComponent !== objectPrototype) {
1793
+ hoistNonReactStatics(targetComponent, inheritedComponent, excludelist);
1794
+ }
1795
+ const keys = getOwnPropertyNames(sourceComponent).concat(getOwnPropertySymbols(sourceComponent));
1796
+ const targetStatics = getStatics(targetComponent);
1797
+ const sourceStatics = getStatics(sourceComponent);
1798
+ for (let i = 0; i < keys.length; ++i) {
1799
+ const key = keys[i];
1774
1800
  if (!(key in KNOWN_STATICS) &&
1775
1801
  !(excludelist && excludelist[key]) &&
1776
1802
  !(sourceStatics && key in sourceStatics) &&
1777
1803
  !(targetStatics && key in targetStatics)) {
1778
- var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
1804
+ const descriptor = getOwnPropertyDescriptor(sourceComponent, key);
1779
1805
  try {
1780
1806
  // Avoid failures from read-only properties
1781
1807
  defineProperty(targetComponent, key, descriptor);
@@ -1790,102 +1816,98 @@
1790
1816
  }
1791
1817
 
1792
1818
  function withTheme(Component) {
1793
- var WithTheme = React.forwardRef(function (props, ref) {
1794
- var theme = React.useContext(ThemeContext) ;
1795
- var themeProp = determineTheme(props, theme, Component.defaultProps);
1819
+ const WithTheme = React.forwardRef((props, ref) => {
1820
+ const theme = React.useContext(ThemeContext) ;
1821
+ const themeProp = determineTheme(props, theme, Component.defaultProps);
1796
1822
  if (themeProp === undefined) {
1797
- 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), "\""));
1823
+ console.warn(`[withTheme] You are not using a ThemeProvider nor passing a theme prop or a theme in defaultProps in component class "${getComponentName(Component)}"`);
1798
1824
  }
1799
- return React.createElement(Component, __assign(__assign({}, props), { theme: themeProp, ref: ref }));
1825
+ return React.createElement(Component, Object.assign(Object.assign({}, props), { theme: themeProp, ref }));
1800
1826
  });
1801
- WithTheme.displayName = "WithTheme(".concat(getComponentName(Component), ")");
1827
+ WithTheme.displayName = `WithTheme(${getComponentName(Component)})`;
1802
1828
  return hoistNonReactStatics(WithTheme, Component);
1803
1829
  }
1804
1830
 
1805
- var ServerStyleSheet = /** @class */ (function () {
1806
- function ServerStyleSheet(_a) {
1807
- var _b = _a === void 0 ? {} : _a, nonce = _b.nonce;
1808
- var _this = this;
1809
- this._emitSheetCSS = function () {
1810
- var css = _this.instance.toString();
1831
+ class ServerStyleSheet {
1832
+ constructor({ nonce } = {}) {
1833
+ this._emitSheetCSS = () => {
1834
+ const css = this.instance.toString();
1811
1835
  if (!css)
1812
1836
  return '';
1813
- var nonce = _this.instance.options.nonce || getNonce();
1814
- var attrs = [
1815
- nonce && "nonce=\"".concat(nonce, "\""),
1816
- "".concat(SC_ATTR, "=\"true\""),
1817
- "".concat(SC_ATTR_VERSION, "=\"").concat(SC_VERSION, "\""),
1837
+ const nonce = this.instance.options.nonce || getNonce();
1838
+ const attrs = [
1839
+ nonce && `nonce="${nonce}"`,
1840
+ `${SC_ATTR}="true"`,
1841
+ `${SC_ATTR_VERSION}="${SC_VERSION}"`,
1818
1842
  ];
1819
- var htmlAttr = joinStringArray(attrs.filter(Boolean), ' ');
1820
- return "<style ".concat(htmlAttr, ">").concat(css, "</style>");
1843
+ const htmlAttr = joinStringArray(attrs.filter(Boolean), ' ');
1844
+ return `<style ${htmlAttr}>${css}</style>`;
1821
1845
  };
1822
- this.getStyleTags = function () {
1823
- if (_this.sealed) {
1846
+ this.getStyleTags = () => {
1847
+ if (this.sealed) {
1824
1848
  throw throwStyledComponentsError(2);
1825
1849
  }
1826
- return _this._emitSheetCSS();
1850
+ return this._emitSheetCSS();
1827
1851
  };
1828
- this.getStyleElement = function () {
1829
- var _a;
1830
- if (_this.sealed) {
1852
+ this.getStyleElement = () => {
1853
+ if (this.sealed) {
1831
1854
  throw throwStyledComponentsError(2);
1832
1855
  }
1833
- var css = _this.instance.toString();
1856
+ const css = this.instance.toString();
1834
1857
  if (!css)
1835
1858
  return [];
1836
- var props = (_a = {},
1837
- _a[SC_ATTR] = '',
1838
- _a[SC_ATTR_VERSION] = SC_VERSION,
1839
- _a.dangerouslySetInnerHTML = {
1859
+ const props = {
1860
+ [SC_ATTR]: '',
1861
+ [SC_ATTR_VERSION]: SC_VERSION,
1862
+ dangerouslySetInnerHTML: {
1840
1863
  __html: css,
1841
1864
  },
1842
- _a);
1843
- var nonce = _this.instance.options.nonce || getNonce();
1865
+ };
1866
+ const nonce = this.instance.options.nonce || getNonce();
1844
1867
  if (nonce) {
1845
1868
  props.nonce = nonce;
1846
1869
  }
1847
1870
  // v4 returned an array for this fn, so we'll do the same for v5 for backward compat
1848
- return [React.createElement("style", __assign({}, props, { key: "sc-0-0" }))];
1871
+ return [React.createElement("style", Object.assign({}, props, { key: "sc-0-0" }))];
1849
1872
  };
1850
- this.seal = function () {
1851
- _this.sealed = true;
1873
+ this.seal = () => {
1874
+ this.sealed = true;
1852
1875
  };
1853
- this.instance = new StyleSheet({ isServer: true, nonce: nonce });
1876
+ this.instance = new StyleSheet({ isServer: true, nonce });
1854
1877
  this.sealed = false;
1855
1878
  }
1856
- ServerStyleSheet.prototype.collectStyles = function (children) {
1879
+ collectStyles(children) {
1857
1880
  if (this.sealed) {
1858
1881
  throw throwStyledComponentsError(2);
1859
1882
  }
1860
1883
  return React.createElement(StyleSheetManager, { sheet: this.instance }, children);
1861
- };
1862
- ServerStyleSheet.prototype.interleaveWithNodeStream = function (input) {
1884
+ }
1885
+ interleaveWithNodeStream(input) {
1863
1886
  {
1864
1887
  throw throwStyledComponentsError(3);
1865
1888
  }
1866
- };
1867
- return ServerStyleSheet;
1868
- }());
1889
+ }
1890
+ }
1869
1891
 
1870
- var __PRIVATE__ = {
1871
- StyleSheet: StyleSheet,
1872
- mainSheet: mainSheet,
1892
+ const __PRIVATE__ = {
1893
+ StyleSheet,
1894
+ mainSheet,
1873
1895
  };
1874
1896
 
1875
1897
  /* Import singletons */
1876
1898
  /* Warning if you've imported this file on React Native */
1877
1899
  if (typeof navigator !== 'undefined' &&
1878
1900
  navigator.product === 'ReactNative') {
1879
- 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");
1901
+ 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`);
1880
1902
  }
1881
- var windowGlobalKey = "__sc-".concat(SC_ATTR, "__");
1903
+ const windowGlobalKey = `__sc-${SC_ATTR}__`;
1882
1904
  /* Warning if there are several instances of styled-components */
1883
1905
  if (typeof window !== 'undefined') {
1884
1906
  // @ts-expect-error dynamic key not in window object
1885
1907
  window[windowGlobalKey] || (window[windowGlobalKey] = 0);
1886
1908
  // @ts-expect-error dynamic key not in window object
1887
1909
  if (window[windowGlobalKey] === 1) {
1888
- 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.");
1910
+ 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.`);
1889
1911
  }
1890
1912
  // @ts-expect-error dynamic key not in window object
1891
1913
  window[windowGlobalKey] += 1;
@@ -1902,6 +1924,7 @@
1902
1924
  ThemeProvider: ThemeProvider,
1903
1925
  __PRIVATE__: __PRIVATE__,
1904
1926
  createGlobalStyle: createGlobalStyle,
1927
+ createTheme: createTheme,
1905
1928
  css: css,
1906
1929
  isStyledComponent: isStyledComponent,
1907
1930
  keyframes: keyframes,
@@ -1931,17 +1954,17 @@
1931
1954
  /* Z+1 */
1932
1955
  );
1933
1956
 
1934
- var LIMIT = 200;
1935
- var createWarnTooManyClasses = (function (displayName, componentId) {
1936
- var generatedClasses = {};
1937
- var warningSeen = false;
1938
- return function (className) {
1957
+ const LIMIT = 200;
1958
+ var createWarnTooManyClasses = (displayName, componentId) => {
1959
+ let generatedClasses = {};
1960
+ let warningSeen = false;
1961
+ return (className) => {
1939
1962
  if (!warningSeen) {
1940
1963
  generatedClasses[className] = true;
1941
1964
  if (Object.keys(generatedClasses).length >= LIMIT) {
1942
1965
  // Unable to find latestRule in test environment.
1943
- var parsedIdString = componentId ? " with the id of \"".concat(componentId, "\"") : '';
1944
- console.warn("Over ".concat(LIMIT, " classes were generated for component ").concat(displayName).concat(parsedIdString, ".\n") +
1966
+ const parsedIdString = componentId ? ` with the id of "${componentId}"` : '';
1967
+ console.warn(`Over ${LIMIT} classes were generated for component ${displayName}${parsedIdString}.\n` +
1945
1968
  'Consider using the attrs method, together with a style object for frequently changed styles.\n' +
1946
1969
  'Example:\n' +
1947
1970
  ' const Component = styled.div.attrs(props => ({\n' +
@@ -1955,169 +1978,18 @@
1955
1978
  }
1956
1979
  }
1957
1980
  };
1958
- });
1981
+ };
1959
1982
 
1960
- var elements = [
1961
- 'a',
1962
- 'abbr',
1963
- 'address',
1964
- 'area',
1965
- 'article',
1966
- 'aside',
1967
- 'audio',
1968
- 'b',
1969
- 'bdi',
1970
- 'bdo',
1971
- 'blockquote',
1972
- 'body',
1973
- 'button',
1974
- 'br',
1975
- 'canvas',
1976
- 'caption',
1977
- 'cite',
1978
- 'code',
1979
- 'col',
1980
- 'colgroup',
1981
- 'data',
1982
- 'datalist',
1983
- 'dd',
1984
- 'del',
1985
- 'details',
1986
- 'dfn',
1987
- 'dialog',
1988
- 'div',
1989
- 'dl',
1990
- 'dt',
1991
- 'em',
1992
- 'embed',
1993
- 'fieldset',
1994
- 'figcaption',
1995
- 'figure',
1996
- 'footer',
1997
- 'form',
1998
- 'h1',
1999
- 'h2',
2000
- 'h3',
2001
- 'h4',
2002
- 'h5',
2003
- 'h6',
2004
- 'header',
2005
- 'hgroup',
2006
- 'hr',
2007
- 'html',
2008
- 'i',
2009
- 'iframe',
2010
- 'img',
2011
- 'input',
2012
- 'ins',
2013
- 'kbd',
2014
- 'label',
2015
- 'legend',
2016
- 'li',
2017
- 'main',
2018
- 'map',
2019
- 'mark',
2020
- 'menu',
2021
- 'meter',
2022
- 'nav',
2023
- 'object',
2024
- 'ol',
2025
- 'optgroup',
2026
- 'option',
2027
- 'output',
2028
- 'p',
2029
- 'picture',
2030
- 'pre',
2031
- 'progress',
2032
- 'q',
2033
- 'rp',
2034
- 'rt',
2035
- 'ruby',
2036
- 's',
2037
- 'samp',
2038
- 'search',
2039
- 'section',
2040
- 'select',
2041
- 'slot',
2042
- 'small',
2043
- 'span',
2044
- 'strong',
2045
- 'sub',
2046
- 'summary',
2047
- 'sup',
2048
- 'table',
2049
- 'tbody',
2050
- 'td',
2051
- 'template',
2052
- 'textarea',
2053
- 'tfoot',
2054
- 'th',
2055
- 'thead',
2056
- 'time',
2057
- 'tr',
2058
- 'u',
2059
- 'ul',
2060
- 'var',
2061
- 'video',
2062
- 'wbr',
2063
- 'circle',
2064
- 'clipPath',
2065
- 'defs',
2066
- 'ellipse',
2067
- 'feBlend',
2068
- 'feColorMatrix',
2069
- 'feComponentTransfer',
2070
- 'feComposite',
2071
- 'feConvolveMatrix',
2072
- 'feDiffuseLighting',
2073
- 'feDisplacementMap',
2074
- 'feDistantLight',
2075
- 'feDropShadow',
2076
- 'feFlood',
2077
- 'feFuncA',
2078
- 'feFuncB',
2079
- 'feFuncG',
2080
- 'feFuncR',
2081
- 'feGaussianBlur',
2082
- 'feImage',
2083
- 'feMerge',
2084
- 'feMergeNode',
2085
- 'feMorphology',
2086
- 'feOffset',
2087
- 'fePointLight',
2088
- 'feSpecularLighting',
2089
- 'feSpotLight',
2090
- 'feTile',
2091
- 'feTurbulence',
2092
- 'filter',
2093
- 'foreignObject',
2094
- 'g',
2095
- 'image',
2096
- 'line',
2097
- 'linearGradient',
2098
- 'marker',
2099
- 'mask',
2100
- 'path',
2101
- 'pattern',
2102
- 'polygon',
2103
- 'polyline',
2104
- 'radialGradient',
2105
- 'rect',
2106
- 'stop',
2107
- 'svg',
2108
- 'switch',
2109
- 'symbol',
2110
- 'text',
2111
- 'textPath',
2112
- 'tspan',
2113
- 'use',
1983
+ // prettier-ignore
1984
+ const elements = [
1985
+ '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',
2114
1986
  ];
2115
1987
  var domElements = new Set(elements);
2116
1988
 
2117
1989
  // Source: https://www.w3.org/TR/cssom-1/#serialize-an-identifier
2118
1990
  // Control characters and non-letter first symbols are not supported
2119
- var escapeRegex = /[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g;
2120
- var dashesAtEnds = /(^-|-$)/g;
1991
+ const escapeRegex = /[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g;
1992
+ const dashesAtEnds = /(^-|-$)/g;
2121
1993
  /**
2122
1994
  * TODO: Explore using CSS.escape when it becomes more available
2123
1995
  * in evergreen browsers.
@@ -2135,23 +2007,22 @@
2135
2007
  }
2136
2008
 
2137
2009
  function generateDisplayName(target) {
2138
- return isTag(target) ? "styled.".concat(target) : "Styled(".concat(getComponentName(target), ")");
2010
+ return isTag(target) ? `styled.${target}` : `Styled(${getComponentName(target)})`;
2139
2011
  }
2140
2012
 
2141
- function mixinRecursively(target, source, forceMerge) {
2142
- if (forceMerge === void 0) { forceMerge = false; }
2013
+ function mixinRecursively(target, source, forceMerge = false) {
2143
2014
  /* only merge into POJOs, Arrays, but for top level objects only
2144
2015
  * allow to merge into anything by passing forceMerge = true */
2145
2016
  if (!forceMerge && !isPlainObject(target) && !Array.isArray(target)) {
2146
2017
  return source;
2147
2018
  }
2148
2019
  if (Array.isArray(source)) {
2149
- for (var key = 0; key < source.length; key++) {
2020
+ for (let key = 0; key < source.length; key++) {
2150
2021
  target[key] = mixinRecursively(target[key], source[key]);
2151
2022
  }
2152
2023
  }
2153
2024
  else if (isPlainObject(source)) {
2154
- for (var key in source) {
2025
+ for (const key in source) {
2155
2026
  target[key] = mixinRecursively(target[key], source[key]);
2156
2027
  }
2157
2028
  }
@@ -2162,24 +2033,19 @@
2162
2033
  * If target is not a POJO or an Array, it will get source properties injected via shallow merge
2163
2034
  * Source objects applied left to right. Mutates & returns target. Similar to lodash merge.
2164
2035
  */
2165
- function mixinDeep(target) {
2166
- var sources = [];
2167
- for (var _i = 1; _i < arguments.length; _i++) {
2168
- sources[_i - 1] = arguments[_i];
2169
- }
2170
- for (var _a = 0, sources_1 = sources; _a < sources_1.length; _a++) {
2171
- var source = sources_1[_a];
2036
+ function mixinDeep(target, ...sources) {
2037
+ for (const source of sources) {
2172
2038
  mixinRecursively(target, source, true);
2173
2039
  }
2174
2040
  return target;
2175
2041
  }
2176
2042
 
2177
- var SEED = hash(SC_VERSION);
2043
+ const SEED = hash(SC_VERSION);
2178
2044
  /**
2179
2045
  * ComponentStyle is all the CSS-specific stuff, not the React-specific stuff.
2180
2046
  */
2181
- var ComponentStyle = /** @class */ (function () {
2182
- function ComponentStyle(rules, componentId, baseStyle) {
2047
+ class ComponentStyle {
2048
+ constructor(rules, componentId, baseStyle) {
2183
2049
  this.rules = rules;
2184
2050
  this.staticRulesId = '';
2185
2051
  this.isStatic =
@@ -2191,9 +2057,9 @@
2191
2057
  // for this component's styles compared to others
2192
2058
  StyleSheet.registerId(componentId);
2193
2059
  }
2194
- ComponentStyle.prototype.generateAndInjectStyles = function (executionContext, styleSheet, stylis) {
2195
- var names = this.baseStyle
2196
- ? this.baseStyle.generateAndInjectStyles(executionContext, styleSheet, stylis).className
2060
+ generateAndInjectStyles(executionContext, styleSheet, stylis) {
2061
+ let names = this.baseStyle
2062
+ ? this.baseStyle.generateAndInjectStyles(executionContext, styleSheet, stylis)
2197
2063
  : '';
2198
2064
  // force dynamic classnames if user-supplied stylis plugins are in use
2199
2065
  if (this.isStatic && !stylis.hash) {
@@ -2201,27 +2067,27 @@
2201
2067
  names = joinStrings(names, this.staticRulesId);
2202
2068
  }
2203
2069
  else {
2204
- var cssStatic = joinStringArray(flatten(this.rules, executionContext, styleSheet, stylis));
2205
- var name_1 = generateAlphabeticName(phash(this.baseHash, cssStatic) >>> 0);
2206
- if (!styleSheet.hasNameForId(this.componentId, name_1)) {
2207
- var cssStaticFormatted = stylis(cssStatic, ".".concat(name_1), undefined, this.componentId);
2208
- styleSheet.insertRules(this.componentId, name_1, cssStaticFormatted);
2070
+ const cssStatic = joinStringArray(flatten(this.rules, executionContext, styleSheet, stylis));
2071
+ const name = generateAlphabeticName(phash(this.baseHash, cssStatic) >>> 0);
2072
+ if (!styleSheet.hasNameForId(this.componentId, name)) {
2073
+ const cssStaticFormatted = stylis(cssStatic, '.' + name, undefined, this.componentId);
2074
+ styleSheet.insertRules(this.componentId, name, cssStaticFormatted);
2209
2075
  }
2210
- names = joinStrings(names, name_1);
2211
- this.staticRulesId = name_1;
2076
+ names = joinStrings(names, name);
2077
+ this.staticRulesId = name;
2212
2078
  }
2213
2079
  }
2214
2080
  else {
2215
- var dynamicHash = phash(this.baseHash, stylis.hash);
2216
- var css = '';
2217
- for (var i = 0; i < this.rules.length; i++) {
2218
- var partRule = this.rules[i];
2081
+ let dynamicHash = phash(this.baseHash, stylis.hash);
2082
+ let css = '';
2083
+ for (let i = 0; i < this.rules.length; i++) {
2084
+ const partRule = this.rules[i];
2219
2085
  if (typeof partRule === 'string') {
2220
2086
  css += partRule;
2221
2087
  dynamicHash = phash(dynamicHash, partRule);
2222
2088
  }
2223
2089
  else if (partRule) {
2224
- var partString = joinStringArray(flatten(partRule, executionContext, styleSheet, stylis));
2090
+ const partString = joinStringArray(flatten(partRule, executionContext, styleSheet, stylis));
2225
2091
  // The same value can switch positions in the array, so we include "i" in the hash.
2226
2092
  // Split into two phash calls to avoid temp string allocation (partString + i).
2227
2093
  // phash processes right-to-left, so phash(h, a+b) === phash(phash(h, b), a).
@@ -2230,59 +2096,53 @@
2230
2096
  }
2231
2097
  }
2232
2098
  if (css) {
2233
- var name_2 = generateAlphabeticName(dynamicHash >>> 0);
2234
- if (!styleSheet.hasNameForId(this.componentId, name_2)) {
2235
- var cssFormatted = stylis(css, ".".concat(name_2), undefined, this.componentId);
2236
- styleSheet.insertRules(this.componentId, name_2, cssFormatted);
2099
+ const name = generateAlphabeticName(dynamicHash >>> 0);
2100
+ if (!styleSheet.hasNameForId(this.componentId, name)) {
2101
+ const cssFormatted = stylis(css, '.' + name, undefined, this.componentId);
2102
+ styleSheet.insertRules(this.componentId, name, cssFormatted);
2237
2103
  }
2238
- names = joinStrings(names, name_2);
2104
+ names = joinStrings(names, name);
2239
2105
  }
2240
2106
  }
2241
- // Retrieve CSS from Tag for RSC rendering
2242
- var generatedCSS = typeof window === 'undefined'
2243
- ? styleSheet.getTag().getGroup(getGroupForId(this.componentId))
2244
- : '';
2245
- return { className: names, css: generatedCSS };
2246
- };
2247
- return ComponentStyle;
2248
- }());
2107
+ return names;
2108
+ }
2109
+ }
2249
2110
 
2250
- var identifiers = {};
2111
+ const identifiers = {};
2251
2112
  /* We depend on components having unique IDs */
2252
2113
  function generateId(displayName, parentComponentId) {
2253
- var name = typeof displayName !== 'string' ? 'sc' : escape(displayName);
2114
+ const name = typeof displayName !== 'string' ? 'sc' : escape(displayName);
2254
2115
  // Ensure that no displayName can lead to duplicate componentIds
2255
2116
  identifiers[name] = (identifiers[name] || 0) + 1;
2256
- var componentId = "".concat(name, "-").concat(generateComponentId(
2257
- // SC_VERSION gives us isolation between multiple runtimes on the page at once
2258
- // this is improved further with use of the babel plugin "namespace" feature
2259
- SC_VERSION + name + identifiers[name]));
2260
- return parentComponentId ? "".concat(parentComponentId, "-").concat(componentId) : componentId;
2261
- }
2262
- function useInjectedStyle(componentStyle, resolvedAttrs) {
2263
- var ssc = useStyleSheetContext();
2264
- var result = componentStyle.generateAndInjectStyles(resolvedAttrs, ssc.styleSheet, ssc.stylis);
2117
+ const componentId = `${name}-${generateComponentId(
2118
+ // SC_VERSION gives us isolation between multiple runtimes on the page at once
2119
+ // this is improved further with use of the babel plugin "namespace" feature
2120
+ SC_VERSION + name + identifiers[name])}`;
2121
+ return parentComponentId ? `${parentComponentId}-${componentId}` : componentId;
2122
+ }
2123
+ function useInjectedStyle(componentStyle, resolvedAttrs, styleSheet, stylis) {
2124
+ const className = componentStyle.generateAndInjectStyles(resolvedAttrs, styleSheet, stylis);
2265
2125
  if (React.useDebugValue) {
2266
- React.useDebugValue(result.className);
2126
+ React.useDebugValue(className);
2267
2127
  }
2268
- return result;
2128
+ return className;
2269
2129
  }
2270
2130
  function resolveContext(attrs, props, theme) {
2271
- var context = __assign(__assign({}, props), {
2131
+ const context = Object.assign(Object.assign({}, props), {
2272
2132
  // unset, add `props.className` back at the end so props always "wins"
2273
- className: undefined, theme: theme });
2274
- var attrDef;
2275
- for (var i = 0; i < attrs.length; i += 1) {
2133
+ className: undefined, theme });
2134
+ let attrDef;
2135
+ for (let i = 0; i < attrs.length; i += 1) {
2276
2136
  attrDef = attrs[i];
2277
2137
  // Pass a shallow copy to function attrs so the callback's captured
2278
2138
  // reference isn't mutated by subsequent attrs processing (#3336).
2279
- var resolvedAttrDef = isFunction(attrDef) ? attrDef(__assign({}, context)) : attrDef;
2280
- for (var key in resolvedAttrDef) {
2139
+ const resolvedAttrDef = isFunction(attrDef) ? attrDef(Object.assign({}, context)) : attrDef;
2140
+ for (const key in resolvedAttrDef) {
2281
2141
  if (key === 'className') {
2282
2142
  context.className = joinStrings(context.className, resolvedAttrDef[key]);
2283
2143
  }
2284
2144
  else if (key === 'style') {
2285
- context.style = __assign(__assign({}, context.style), resolvedAttrDef[key]);
2145
+ context.style = Object.assign(Object.assign({}, context.style), resolvedAttrDef[key]);
2286
2146
  }
2287
2147
  else if (!(key in props && props[key] === undefined)) {
2288
2148
  // Apply attr value unless the user explicitly passed undefined for this prop,
@@ -2297,23 +2157,23 @@
2297
2157
  }
2298
2158
  return context;
2299
2159
  }
2300
- var seenUnknownProps = new Set();
2160
+ let seenUnknownProps = new Set();
2301
2161
  function useStyledComponentImpl(forwardedComponent, props, forwardedRef) {
2302
- var componentAttrs = forwardedComponent.attrs, componentStyle = forwardedComponent.componentStyle, defaultProps = forwardedComponent.defaultProps, foldedComponentIds = forwardedComponent.foldedComponentIds, styledComponentId = forwardedComponent.styledComponentId, target = forwardedComponent.target;
2303
- var contextTheme = React.useContext(ThemeContext) ;
2304
- var ssc = useStyleSheetContext();
2305
- var shouldForwardProp = forwardedComponent.shouldForwardProp || ssc.shouldForwardProp;
2162
+ const { attrs: componentAttrs, componentStyle, defaultProps, foldedComponentIds, styledComponentId, target, } = forwardedComponent;
2163
+ const contextTheme = React.useContext(ThemeContext) ;
2164
+ const ssc = useStyleSheetContext();
2165
+ const shouldForwardProp = forwardedComponent.shouldForwardProp || ssc.shouldForwardProp;
2306
2166
  if (React.useDebugValue) {
2307
2167
  React.useDebugValue(styledComponentId);
2308
2168
  }
2309
2169
  // NOTE: the non-hooks version only subscribes to this when !componentStyle.isStatic,
2310
2170
  // but that'd be against the rules-of-hooks. We could be naughty and do it anyway as it
2311
2171
  // should be an immutable value, but behave for now.
2312
- var theme = determineTheme(props, contextTheme, defaultProps) || (EMPTY_OBJECT);
2313
- var context = resolveContext(componentAttrs, props, theme);
2314
- var elementToBeCreated = context.as || target;
2315
- var propsForElement = {};
2316
- for (var key in context) {
2172
+ const theme = determineTheme(props, contextTheme, defaultProps) || (EMPTY_OBJECT);
2173
+ const context = resolveContext(componentAttrs, props, theme);
2174
+ const elementToBeCreated = context.as || target;
2175
+ const propsForElement = {};
2176
+ for (const key in context) {
2317
2177
  // @ts-expect-error context may have arbitrary properties from attrs
2318
2178
  if (context[key] === undefined) ;
2319
2179
  else if (key[0] === '$' || key === 'as' || (key === 'theme' && context.theme === theme)) ;
@@ -2330,15 +2190,15 @@
2330
2190
  // Only warn on DOM Element.
2331
2191
  domElements.has(elementToBeCreated)) {
2332
2192
  seenUnknownProps.add(key);
2333
- console.warn("styled-components: it looks like an unknown prop \"".concat(key, "\" 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.)"));
2193
+ console.warn(`styled-components: it looks like an unknown prop "${key}" 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.)`);
2334
2194
  }
2335
2195
  }
2336
2196
  }
2337
- var _a = useInjectedStyle(componentStyle, context), generatedClassName = _a.className;
2197
+ const generatedClassName = useInjectedStyle(componentStyle, context, ssc.styleSheet, ssc.stylis);
2338
2198
  if (forwardedComponent.warnTooManyClasses) {
2339
2199
  forwardedComponent.warnTooManyClasses(generatedClassName);
2340
2200
  }
2341
- var classString = joinStrings(foldedComponentIds, styledComponentId);
2201
+ let classString = joinStrings(foldedComponentIds, styledComponentId);
2342
2202
  if (generatedClassName) {
2343
2203
  classString += ' ' + generatedClassName;
2344
2204
  }
@@ -2357,37 +2217,35 @@
2357
2217
  if (forwardedRef) {
2358
2218
  propsForElement.ref = forwardedRef;
2359
2219
  }
2360
- var element = React.createElement(elementToBeCreated, propsForElement);
2220
+ const element = React.createElement(elementToBeCreated, propsForElement);
2361
2221
  return element;
2362
2222
  }
2363
2223
  function createStyledComponent(target, options, rules) {
2364
- var isTargetStyledComp = isStyledComponent(target);
2365
- var styledComponentTarget = target;
2366
- var isCompositeComponent = !isTag(target);
2367
- var _a = options.attrs, attrs = _a === void 0 ? EMPTY_ARRAY : _a, _b = options.componentId, componentId = _b === void 0 ? generateId(options.displayName, options.parentComponentId) : _b, _c = options.displayName, displayName = _c === void 0 ? generateDisplayName(target) : _c;
2368
- var styledComponentId = options.displayName && options.componentId
2369
- ? "".concat(escape(options.displayName), "-").concat(options.componentId)
2224
+ const isTargetStyledComp = isStyledComponent(target);
2225
+ const styledComponentTarget = target;
2226
+ const isCompositeComponent = !isTag(target);
2227
+ const { attrs = EMPTY_ARRAY, componentId = generateId(options.displayName, options.parentComponentId), displayName = generateDisplayName(target), } = options;
2228
+ const styledComponentId = options.displayName && options.componentId
2229
+ ? `${escape(options.displayName)}-${options.componentId}`
2370
2230
  : options.componentId || componentId;
2371
2231
  // fold the underlying StyledComponent attrs up (implicit extend)
2372
- var finalAttrs = isTargetStyledComp && styledComponentTarget.attrs
2232
+ const finalAttrs = isTargetStyledComp && styledComponentTarget.attrs
2373
2233
  ? styledComponentTarget.attrs.concat(attrs).filter(Boolean)
2374
2234
  : attrs;
2375
- var shouldForwardProp = options.shouldForwardProp;
2235
+ let { shouldForwardProp } = options;
2376
2236
  if (isTargetStyledComp && styledComponentTarget.shouldForwardProp) {
2377
- var shouldForwardPropFn_1 = styledComponentTarget.shouldForwardProp;
2237
+ const shouldForwardPropFn = styledComponentTarget.shouldForwardProp;
2378
2238
  if (options.shouldForwardProp) {
2379
- var passedShouldForwardPropFn_1 = options.shouldForwardProp;
2239
+ const passedShouldForwardPropFn = options.shouldForwardProp;
2380
2240
  // compose nested shouldForwardProp calls
2381
- shouldForwardProp = function (prop, elementToBeCreated) {
2382
- return shouldForwardPropFn_1(prop, elementToBeCreated) &&
2383
- passedShouldForwardPropFn_1(prop, elementToBeCreated);
2384
- };
2241
+ shouldForwardProp = (prop, elementToBeCreated) => shouldForwardPropFn(prop, elementToBeCreated) &&
2242
+ passedShouldForwardPropFn(prop, elementToBeCreated);
2385
2243
  }
2386
2244
  else {
2387
- shouldForwardProp = shouldForwardPropFn_1;
2245
+ shouldForwardProp = shouldForwardPropFn;
2388
2246
  }
2389
2247
  }
2390
- var componentStyle = new ComponentStyle(rules, styledComponentId, isTargetStyledComp ? styledComponentTarget.componentStyle : undefined);
2248
+ const componentStyle = new ComponentStyle(rules, styledComponentId, isTargetStyledComp ? styledComponentTarget.componentStyle : undefined);
2391
2249
  function forwardRefRender(props, ref) {
2392
2250
  return useStyledComponentImpl(WrappedStyledComponent, props, ref);
2393
2251
  }
@@ -2396,7 +2254,7 @@
2396
2254
  * forwardRef creates a new interim component, which we'll take advantage of
2397
2255
  * instead of extending ParentComponent to create _another_ interim class
2398
2256
  */
2399
- var WrappedStyledComponent = React.forwardRef(forwardRefRender);
2257
+ let WrappedStyledComponent = React.forwardRef(forwardRefRender);
2400
2258
  WrappedStyledComponent.attrs = finalAttrs;
2401
2259
  WrappedStyledComponent.componentStyle = componentStyle;
2402
2260
  WrappedStyledComponent.displayName = displayName;
@@ -2410,10 +2268,10 @@
2410
2268
  // fold the underlying StyledComponent target up since we folded the styles
2411
2269
  WrappedStyledComponent.target = isTargetStyledComp ? styledComponentTarget.target : target;
2412
2270
  Object.defineProperty(WrappedStyledComponent, 'defaultProps', {
2413
- get: function () {
2271
+ get() {
2414
2272
  return this._foldedDefaultProps;
2415
2273
  },
2416
- set: function (obj) {
2274
+ set(obj) {
2417
2275
  this._foldedDefaultProps = isTargetStyledComp
2418
2276
  ? mixinDeep({}, styledComponentTarget.defaultProps, obj)
2419
2277
  : obj;
@@ -2423,9 +2281,9 @@
2423
2281
  checkDynamicCreation(displayName, styledComponentId);
2424
2282
  WrappedStyledComponent.warnTooManyClasses = createWarnTooManyClasses(displayName, styledComponentId);
2425
2283
  }
2426
- setToString(WrappedStyledComponent, function () { return ".".concat(WrappedStyledComponent.styledComponentId); });
2284
+ setToString(WrappedStyledComponent, () => `.${WrappedStyledComponent.styledComponentId}`);
2427
2285
  if (isCompositeComponent) {
2428
- var compositeComponentTarget = target;
2286
+ const compositeComponentTarget = target;
2429
2287
  hoistNonReactStatics(WrappedStyledComponent, compositeComponentTarget, {
2430
2288
  // all SC-specific things should not be hoisted
2431
2289
  attrs: true,
@@ -2440,8 +2298,7 @@
2440
2298
  return WrappedStyledComponent;
2441
2299
  }
2442
2300
 
2443
- function constructWithOptions(componentConstructor, tag, options) {
2444
- if (options === void 0) { options = EMPTY_OBJECT; }
2301
+ function constructWithOptions(componentConstructor, tag, options = EMPTY_OBJECT) {
2445
2302
  /**
2446
2303
  * We trust that the tag is a valid component as long as it isn't
2447
2304
  * falsish. Typically the tag here is a string or function (i.e.
@@ -2453,38 +2310,26 @@
2453
2310
  throw throwStyledComponentsError(1, tag);
2454
2311
  }
2455
2312
  /* This is callable directly as a template function */
2456
- var templateFunction = function (initialStyles) {
2457
- var interpolations = [];
2458
- for (var _i = 1; _i < arguments.length; _i++) {
2459
- interpolations[_i - 1] = arguments[_i];
2460
- }
2461
- return componentConstructor(tag, options, css.apply(void 0, __spreadArray([initialStyles], interpolations, false)));
2462
- };
2313
+ const templateFunction = (initialStyles, ...interpolations) => componentConstructor(tag, options, css(initialStyles, ...interpolations));
2463
2314
  /**
2464
2315
  * Attrs allows for accomplishing two goals:
2465
2316
  *
2466
2317
  * 1. Backfilling props at runtime more expressively than defaultProps
2467
2318
  * 2. Amending the prop interface of a wrapped styled component
2468
2319
  */
2469
- templateFunction.attrs = function (attrs) {
2470
- return constructWithOptions(componentConstructor, tag, __assign(__assign({}, options), { attrs: Array.prototype.concat(options.attrs, attrs).filter(Boolean) }));
2471
- };
2320
+ templateFunction.attrs = (attrs) => constructWithOptions(componentConstructor, tag, Object.assign(Object.assign({}, options), { attrs: Array.prototype.concat(options.attrs, attrs).filter(Boolean) }));
2472
2321
  /**
2473
2322
  * If config methods are called, wrap up a new template function
2474
2323
  * and merge options.
2475
2324
  */
2476
- templateFunction.withConfig = function (config) {
2477
- return constructWithOptions(componentConstructor, tag, __assign(__assign({}, options), config));
2478
- };
2325
+ templateFunction.withConfig = (config) => constructWithOptions(componentConstructor, tag, Object.assign(Object.assign({}, options), config));
2479
2326
  return templateFunction;
2480
2327
  }
2481
2328
 
2482
- var baseStyled = function (tag) {
2483
- return constructWithOptions(createStyledComponent, tag);
2484
- };
2485
- var styled = baseStyled;
2329
+ const baseStyled = (tag) => constructWithOptions(createStyledComponent, tag);
2330
+ const styled = baseStyled;
2486
2331
  // Shorthands for all valid HTML Elements
2487
- domElements.forEach(function (domElement) {
2332
+ domElements.forEach(domElement => {
2488
2333
  // @ts-expect-error some react typing bs
2489
2334
  styled[domElement] = baseStyled(domElement);
2490
2335
  });
@@ -2493,7 +2338,7 @@
2493
2338
  * eliminates the need to do styled.default since the other APIs
2494
2339
  * are directly assigned as properties to the main function
2495
2340
  * */
2496
- for (var key in secondary) {
2341
+ for (const key in secondary) {
2497
2342
  // @ts-expect-error shush
2498
2343
  styled[key] = secondary[key];
2499
2344
  }