@polymarket-developers/clob-client 1.0.7

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 (48) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE +21 -0
  3. package/README.md +78 -0
  4. package/cache/LICENSE +21 -0
  5. package/cache/README.md +62 -0
  6. package/cache/dist/declarations/src/index.d.ts +2 -0
  7. package/cache/dist/declarations/types/index.d.ts +45 -0
  8. package/cache/dist/emotion-cache.browser.cjs.default.js +1 -0
  9. package/cache/dist/emotion-cache.browser.cjs.js +471 -0
  10. package/cache/dist/emotion-cache.browser.cjs.mjs +2 -0
  11. package/cache/dist/emotion-cache.browser.development.cjs.default.js +1 -0
  12. package/cache/dist/emotion-cache.browser.development.cjs.js +616 -0
  13. package/cache/dist/emotion-cache.browser.development.cjs.mjs +2 -0
  14. package/cache/dist/emotion-cache.browser.development.esm.js +612 -0
  15. package/cache/dist/emotion-cache.browser.esm.js +467 -0
  16. package/cache/dist/emotion-cache.cjs.d.mts +3 -0
  17. package/cache/dist/emotion-cache.cjs.d.ts +3 -0
  18. package/cache/dist/emotion-cache.cjs.default.d.ts +1 -0
  19. package/cache/dist/emotion-cache.cjs.default.js +1 -0
  20. package/cache/dist/emotion-cache.cjs.js +565 -0
  21. package/cache/dist/emotion-cache.cjs.mjs +2 -0
  22. package/cache/dist/emotion-cache.development.cjs.default.js +1 -0
  23. package/cache/dist/emotion-cache.development.cjs.js +714 -0
  24. package/cache/dist/emotion-cache.development.cjs.mjs +2 -0
  25. package/cache/dist/emotion-cache.development.edge-light.cjs.default.js +1 -0
  26. package/cache/dist/emotion-cache.development.edge-light.cjs.js +621 -0
  27. package/cache/dist/emotion-cache.development.edge-light.cjs.mjs +2 -0
  28. package/cache/dist/emotion-cache.development.edge-light.esm.js +612 -0
  29. package/cache/dist/emotion-cache.development.esm.js +705 -0
  30. package/cache/dist/emotion-cache.edge-light.cjs.default.js +1 -0
  31. package/cache/dist/emotion-cache.edge-light.cjs.js +490 -0
  32. package/cache/dist/emotion-cache.edge-light.cjs.mjs +2 -0
  33. package/cache/dist/emotion-cache.edge-light.esm.js +481 -0
  34. package/cache/dist/emotion-cache.esm.js +556 -0
  35. package/cache/package.json +100 -0
  36. package/cache/src/conditions/false.js +1 -0
  37. package/cache/src/conditions/is-browser.js +1 -0
  38. package/cache/src/conditions/true.js +1 -0
  39. package/cache/src/index.d.ts +2 -0
  40. package/cache/src/index.js +257 -0
  41. package/cache/src/prefixer.js +340 -0
  42. package/cache/src/stylis-plugins.js +269 -0
  43. package/cache/src/types.js +26 -0
  44. package/cache/types/index.d.ts +45 -0
  45. package/index.d.ts +63 -0
  46. package/index.js +204 -0
  47. package/package.json +27 -0
  48. package/utils.js +15 -0
@@ -0,0 +1,705 @@
1
+ import { StyleSheet } from '@emotion/sheet';
2
+ import { dealloc, alloc, next, token, from, peek, delimit, slice, position, RULESET, combine, match, serialize, copy, replace, WEBKIT, MOZ, MS, KEYFRAMES, DECLARATION, hash, charat, strlen, indexof, middleware, stringify, COMMENT, compile } from 'stylis';
3
+ import weakMemoize from '@emotion/weak-memoize';
4
+ import memoize from '@emotion/memoize';
5
+
6
+ var isBrowser = typeof document !== 'undefined';
7
+
8
+ var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
9
+ var previous = 0;
10
+ var character = 0;
11
+
12
+ while (true) {
13
+ previous = character;
14
+ character = peek(); // &\f
15
+
16
+ if (previous === 38 && character === 12) {
17
+ points[index] = 1;
18
+ }
19
+
20
+ if (token(character)) {
21
+ break;
22
+ }
23
+
24
+ next();
25
+ }
26
+
27
+ return slice(begin, position);
28
+ };
29
+
30
+ var toRules = function toRules(parsed, points) {
31
+ // pretend we've started with a comma
32
+ var index = -1;
33
+ var character = 44;
34
+
35
+ do {
36
+ switch (token(character)) {
37
+ case 0:
38
+ // &\f
39
+ if (character === 38 && peek() === 12) {
40
+ // this is not 100% correct, we don't account for literal sequences here - like for example quoted strings
41
+ // stylis inserts \f after & to know when & where it should replace this sequence with the context selector
42
+ // and when it should just concatenate the outer and inner selectors
43
+ // it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here
44
+ points[index] = 1;
45
+ }
46
+
47
+ parsed[index] += identifierWithPointTracking(position - 1, points, index);
48
+ break;
49
+
50
+ case 2:
51
+ parsed[index] += delimit(character);
52
+ break;
53
+
54
+ case 4:
55
+ // comma
56
+ if (character === 44) {
57
+ // colon
58
+ parsed[++index] = peek() === 58 ? '&\f' : '';
59
+ points[index] = parsed[index].length;
60
+ break;
61
+ }
62
+
63
+ // fallthrough
64
+
65
+ default:
66
+ parsed[index] += from(character);
67
+ }
68
+ } while (character = next());
69
+
70
+ return parsed;
71
+ };
72
+
73
+ var getRules = function getRules(value, points) {
74
+ return dealloc(toRules(alloc(value), points));
75
+ }; // WeakSet would be more appropriate, but only WeakMap is supported in IE11
76
+
77
+
78
+ var fixedElements = /* #__PURE__ */new WeakMap();
79
+ var compat = function compat(element) {
80
+ if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo
81
+ // negative .length indicates that this rule has been already prefixed
82
+ element.length < 1) {
83
+ return;
84
+ }
85
+
86
+ var value = element.value,
87
+ parent = element.parent;
88
+ var isImplicitRule = element.column === parent.column && element.line === parent.line;
89
+
90
+ while (parent.type !== 'rule') {
91
+ parent = parent.parent;
92
+ if (!parent) return;
93
+ } // short-circuit for the simplest case
94
+
95
+
96
+ if (element.props.length === 1 && value.charCodeAt(0) !== 58
97
+ /* colon */
98
+ && !fixedElements.get(parent)) {
99
+ return;
100
+ } // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)
101
+ // then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent"
102
+
103
+
104
+ if (isImplicitRule) {
105
+ return;
106
+ }
107
+
108
+ fixedElements.set(element, true);
109
+ var points = [];
110
+ var rules = getRules(value, points);
111
+ var parentRules = parent.props;
112
+
113
+ for (var i = 0, k = 0; i < rules.length; i++) {
114
+ for (var j = 0; j < parentRules.length; j++, k++) {
115
+ element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
116
+ }
117
+ }
118
+ };
119
+ var removeLabel = function removeLabel(element) {
120
+ if (element.type === 'decl') {
121
+ var value = element.value;
122
+
123
+ if ( // charcode for l
124
+ value.charCodeAt(0) === 108 && // charcode for b
125
+ value.charCodeAt(2) === 98) {
126
+ // this ignores label
127
+ element["return"] = '';
128
+ element.value = '';
129
+ }
130
+ }
131
+ };
132
+ var ignoreFlag = 'emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason';
133
+
134
+ var isIgnoringComment = function isIgnoringComment(element) {
135
+ return element.type === 'comm' && element.children.indexOf(ignoreFlag) > -1;
136
+ };
137
+
138
+ var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm(cache) {
139
+ return function (element, index, children) {
140
+ if (element.type !== 'rule' || cache.compat) return;
141
+ var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g);
142
+
143
+ if (unsafePseudoClasses) {
144
+ var isNested = !!element.parent; // in nested rules comments become children of the "auto-inserted" rule and that's always the `element.parent`
145
+ //
146
+ // considering this input:
147
+ // .a {
148
+ // .b /* comm */ {}
149
+ // color: hotpink;
150
+ // }
151
+ // we get output corresponding to this:
152
+ // .a {
153
+ // & {
154
+ // /* comm */
155
+ // color: hotpink;
156
+ // }
157
+ // .b {}
158
+ // }
159
+
160
+ var commentContainer = isNested ? element.parent.children : // global rule at the root level
161
+ children;
162
+
163
+ for (var i = commentContainer.length - 1; i >= 0; i--) {
164
+ var node = commentContainer[i];
165
+
166
+ if (node.line < element.line) {
167
+ break;
168
+ } // it is quite weird but comments are *usually* put at `column: element.column - 1`
169
+ // so we seek *from the end* for the node that is earlier than the rule's `element` and check that
170
+ // this will also match inputs like this:
171
+ // .a {
172
+ // /* comm */
173
+ // .b {}
174
+ // }
175
+ //
176
+ // but that is fine
177
+ //
178
+ // it would be the easiest to change the placement of the comment to be the first child of the rule:
179
+ // .a {
180
+ // .b { /* comm */ }
181
+ // }
182
+ // with such inputs we wouldn't have to search for the comment at all
183
+ // TODO: consider changing this comment placement in the next major version
184
+
185
+
186
+ if (node.column < element.column) {
187
+ if (isIgnoringComment(node)) {
188
+ return;
189
+ }
190
+
191
+ break;
192
+ }
193
+ }
194
+
195
+ unsafePseudoClasses.forEach(function (unsafePseudoClass) {
196
+ console.error("The pseudo class \"" + unsafePseudoClass + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + unsafePseudoClass.split('-child')[0] + "-of-type\".");
197
+ });
198
+ }
199
+ };
200
+ };
201
+
202
+ var isImportRule = function isImportRule(element) {
203
+ return element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64;
204
+ };
205
+
206
+ var isPrependedWithRegularRules = function isPrependedWithRegularRules(index, children) {
207
+ for (var i = index - 1; i >= 0; i--) {
208
+ if (!isImportRule(children[i])) {
209
+ return true;
210
+ }
211
+ }
212
+
213
+ return false;
214
+ }; // use this to remove incorrect elements from further processing
215
+ // so they don't get handed to the `sheet` (or anything else)
216
+ // as that could potentially lead to additional logs which in turn could be overhelming to the user
217
+
218
+
219
+ var nullifyElement = function nullifyElement(element) {
220
+ element.type = '';
221
+ element.value = '';
222
+ element["return"] = '';
223
+ element.children = '';
224
+ element.props = '';
225
+ };
226
+
227
+ var incorrectImportAlarm = function incorrectImportAlarm(element, index, children) {
228
+ if (!isImportRule(element)) {
229
+ return;
230
+ }
231
+
232
+ if (element.parent) {
233
+ console.error("`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles.");
234
+ nullifyElement(element);
235
+ } else if (isPrependedWithRegularRules(index, children)) {
236
+ console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules.");
237
+ nullifyElement(element);
238
+ }
239
+ };
240
+
241
+ /* eslint-disable no-fallthrough */
242
+
243
+ function prefix(value, length) {
244
+ switch (hash(value, length)) {
245
+ // color-adjust
246
+ case 5103:
247
+ return WEBKIT + 'print-' + value + value;
248
+ // animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
249
+
250
+ case 5737:
251
+ case 4201:
252
+ case 3177:
253
+ case 3433:
254
+ case 1641:
255
+ case 4457:
256
+ case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
257
+
258
+ case 5572:
259
+ case 6356:
260
+ case 5844:
261
+ case 3191:
262
+ case 6645:
263
+ case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
264
+
265
+ case 6391:
266
+ case 5879:
267
+ case 5623:
268
+ case 6135:
269
+ case 4599:
270
+ case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
271
+
272
+ case 4215:
273
+ case 6389:
274
+ case 5109:
275
+ case 5365:
276
+ case 5621:
277
+ case 3829:
278
+ return WEBKIT + value + value;
279
+ // appearance, user-select, transform, hyphens, text-size-adjust
280
+
281
+ case 5349:
282
+ case 4246:
283
+ case 4810:
284
+ case 6968:
285
+ case 2756:
286
+ return WEBKIT + value + MOZ + value + MS + value + value;
287
+ // flex, flex-direction
288
+
289
+ case 6828:
290
+ case 4268:
291
+ return WEBKIT + value + MS + value + value;
292
+ // order
293
+
294
+ case 6165:
295
+ return WEBKIT + value + MS + 'flex-' + value + value;
296
+ // align-items
297
+
298
+ case 5187:
299
+ return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + 'box-$1$2' + MS + 'flex-$1$2') + value;
300
+ // align-self
301
+
302
+ case 5443:
303
+ return WEBKIT + value + MS + 'flex-item-' + replace(value, /flex-|-self/, '') + value;
304
+ // align-content
305
+
306
+ case 4675:
307
+ return WEBKIT + value + MS + 'flex-line-pack' + replace(value, /align-content|flex-|-self/, '') + value;
308
+ // flex-shrink
309
+
310
+ case 5548:
311
+ return WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value;
312
+ // flex-basis
313
+
314
+ case 5292:
315
+ return WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value;
316
+ // flex-grow
317
+
318
+ case 6060:
319
+ return WEBKIT + 'box-' + replace(value, '-grow', '') + WEBKIT + value + MS + replace(value, 'grow', 'positive') + value;
320
+ // transition
321
+
322
+ case 4554:
323
+ return WEBKIT + replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') + value;
324
+ // cursor
325
+
326
+ case 6187:
327
+ return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + '$1'), /(image-set)/, WEBKIT + '$1'), value, '') + value;
328
+ // background, background-image
329
+
330
+ case 5495:
331
+ case 3959:
332
+ return replace(value, /(image-set\([^]*)/, WEBKIT + '$1' + '$`$1');
333
+ // justify-content
334
+
335
+ case 4968:
336
+ return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + WEBKIT + value + value;
337
+ // (margin|padding)-inline-(start|end)
338
+
339
+ case 4095:
340
+ case 3583:
341
+ case 4068:
342
+ case 2532:
343
+ return replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value;
344
+ // (min|max)?(width|height|inline-size|block-size)
345
+
346
+ case 8116:
347
+ case 7059:
348
+ case 5753:
349
+ case 5535:
350
+ case 5445:
351
+ case 5701:
352
+ case 4933:
353
+ case 4677:
354
+ case 5533:
355
+ case 5789:
356
+ case 5021:
357
+ case 4765:
358
+ // stretch, max-content, min-content, fill-available
359
+ if (strlen(value) - 1 - length > 6) switch (charat(value, length + 1)) {
360
+ // (m)ax-content, (m)in-content
361
+ case 109:
362
+ // -
363
+ if (charat(value, length + 4) !== 45) break;
364
+ // (f)ill-available, (f)it-content
365
+
366
+ case 102:
367
+ return replace(value, /(.+:)(.+)-([^]+)/, '$1' + WEBKIT + '$2-$3' + '$1' + MOZ + (charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value;
368
+ // (s)tretch
369
+
370
+ case 115:
371
+ return ~indexof(value, 'stretch') ? prefix(replace(value, 'stretch', 'fill-available'), length) + value : value;
372
+ }
373
+ break;
374
+ // position: sticky
375
+
376
+ case 4949:
377
+ // (s)ticky?
378
+ if (charat(value, length + 1) !== 115) break;
379
+ // display: (flex|inline-flex)
380
+
381
+ case 6444:
382
+ switch (charat(value, strlen(value) - 3 - (~indexof(value, '!important') && 10))) {
383
+ // stic(k)y
384
+ case 107:
385
+ return replace(value, ':', ':' + WEBKIT) + value;
386
+ // (inline-)?fl(e)x
387
+
388
+ case 101:
389
+ return replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + WEBKIT + (charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + WEBKIT + '$2$3' + '$1' + MS + '$2box$3') + value;
390
+ }
391
+
392
+ break;
393
+ // writing-mode
394
+
395
+ case 5936:
396
+ switch (charat(value, length + 11)) {
397
+ // vertical-l(r)
398
+ case 114:
399
+ return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value;
400
+ // vertical-r(l)
401
+
402
+ case 108:
403
+ return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value;
404
+ // horizontal(-)tb
405
+
406
+ case 45:
407
+ return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value;
408
+ }
409
+
410
+ return WEBKIT + value + MS + value + value;
411
+ }
412
+
413
+ return value;
414
+ }
415
+
416
+ var prefixer = function prefixer(element, index, children, callback) {
417
+ if (element.length > -1) if (!element["return"]) switch (element.type) {
418
+ case DECLARATION:
419
+ element["return"] = prefix(element.value, element.length);
420
+ break;
421
+
422
+ case KEYFRAMES:
423
+ return serialize([copy(element, {
424
+ value: replace(element.value, '@', '@' + WEBKIT)
425
+ })], callback);
426
+
427
+ case RULESET:
428
+ if (element.length) return combine(element.props, function (value) {
429
+ switch (match(value, /(::plac\w+|:read-\w+)/)) {
430
+ // :read-(only|write)
431
+ case ':read-only':
432
+ case ':read-write':
433
+ return serialize([copy(element, {
434
+ props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]
435
+ })], callback);
436
+ // :placeholder
437
+
438
+ case '::placeholder':
439
+ return serialize([copy(element, {
440
+ props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')]
441
+ }), copy(element, {
442
+ props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]
443
+ }), copy(element, {
444
+ props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]
445
+ })], callback);
446
+ }
447
+
448
+ return '';
449
+ });
450
+ }
451
+ };
452
+
453
+ /* import type { StylisPlugin } from './types' */
454
+
455
+ /*
456
+ export type Options = {
457
+ nonce?: string,
458
+ stylisPlugins?: StylisPlugin[],
459
+ key: string,
460
+ container?: HTMLElement,
461
+ speedy?: boolean,
462
+ prepend?: boolean,
463
+ insertionPoint?: HTMLElement
464
+ }
465
+ */
466
+
467
+ var getServerStylisCache = isBrowser ? undefined : weakMemoize(function () {
468
+ return memoize(function () {
469
+ var cache = {};
470
+ return function (name) {
471
+ return cache[name];
472
+ };
473
+ });
474
+ });
475
+ var defaultStylisPlugins = [prefixer];
476
+
477
+ var createCache = function
478
+ /*: EmotionCache */
479
+ createCache(options
480
+ /*: Options */
481
+ ) {
482
+ var key = options.key;
483
+
484
+ if (!key) {
485
+ throw new Error("You have to configure `key` for your cache. Please make sure it's unique (and not equal to 'css') as it's used for linking styles to your cache.\n" + "If multiple caches share the same key they might \"fight\" for each other's style elements.");
486
+ }
487
+
488
+ if (isBrowser && key === 'css') {
489
+ var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration
490
+ // document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)
491
+ // note this very very intentionally targets all style elements regardless of the key to ensure
492
+ // that creating a cache works inside of render of a React component
493
+
494
+ Array.prototype.forEach.call(ssrStyles, function (node
495
+ /*: HTMLStyleElement */
496
+ ) {
497
+ // we want to only move elements which have a space in the data-emotion attribute value
498
+ // because that indicates that it is an Emotion 11 server-side rendered style elements
499
+ // while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector
500
+ // Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes)
501
+ // so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles
502
+ // will not result in the Emotion 10 styles being destroyed
503
+ var dataEmotionAttribute = node.getAttribute('data-emotion');
504
+
505
+ if (dataEmotionAttribute.indexOf(' ') === -1) {
506
+ return;
507
+ }
508
+
509
+ document.head.appendChild(node);
510
+ node.setAttribute('data-s', '');
511
+ });
512
+ }
513
+
514
+ var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
515
+
516
+ {
517
+ if (/[^a-z-]/.test(key)) {
518
+ throw new Error("Emotion key must only contain lower case alphabetical characters and - but \"" + key + "\" was passed");
519
+ }
520
+ }
521
+
522
+ var inserted = {};
523
+ var container;
524
+ /* : Node */
525
+
526
+ var nodesToHydrate = [];
527
+
528
+ if (isBrowser) {
529
+ container = options.container || document.head;
530
+ Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which
531
+ // means that the style elements we're looking at are only Emotion 11 server-rendered style elements
532
+ document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node
533
+ /*: HTMLStyleElement */
534
+ ) {
535
+ var attrib = node.getAttribute("data-emotion").split(' ');
536
+
537
+ for (var i = 1; i < attrib.length; i++) {
538
+ inserted[attrib[i]] = true;
539
+ }
540
+
541
+ nodesToHydrate.push(node);
542
+ });
543
+ }
544
+
545
+ var _insert;
546
+ /*: (
547
+ selector: string,
548
+ serialized: SerializedStyles,
549
+ sheet: StyleSheet,
550
+ shouldCache: boolean
551
+ ) => string | void */
552
+
553
+
554
+ var omnipresentPlugins = [compat, removeLabel];
555
+
556
+ {
557
+ omnipresentPlugins.push(createUnsafeSelectorsAlarm({
558
+ get compat() {
559
+ return cache.compat;
560
+ }
561
+
562
+ }), incorrectImportAlarm);
563
+ }
564
+
565
+ if (isBrowser) {
566
+ var currentSheet;
567
+ var finalizingPlugins = [stringify, function (element) {
568
+ if (!element.root) {
569
+ if (element["return"]) {
570
+ currentSheet.insert(element["return"]);
571
+ } else if (element.value && element.type !== COMMENT) {
572
+ // insert empty rule in non-production environments
573
+ // so @emotion/jest can grab `key` from the (JS)DOM for caches without any rules inserted yet
574
+ currentSheet.insert(element.value + "{}");
575
+ }
576
+ }
577
+ } ];
578
+ var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
579
+
580
+ var stylis = function stylis(styles) {
581
+ return serialize(compile(styles), serializer);
582
+ };
583
+
584
+ _insert = function
585
+ /*: void */
586
+ insert(selector
587
+ /*: string */
588
+ , serialized
589
+ /*: SerializedStyles */
590
+ , sheet
591
+ /*: StyleSheet */
592
+ , shouldCache
593
+ /*: boolean */
594
+ ) {
595
+ currentSheet = sheet;
596
+
597
+ if (serialized.map !== undefined) {
598
+ currentSheet = {
599
+ insert: function insert(rule
600
+ /*: string */
601
+ ) {
602
+ sheet.insert(rule + serialized.map);
603
+ }
604
+ };
605
+ }
606
+
607
+ stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
608
+
609
+ if (shouldCache) {
610
+ cache.inserted[serialized.name] = true;
611
+ }
612
+ };
613
+ } else {
614
+ var _finalizingPlugins = [stringify];
615
+
616
+ var _serializer = middleware(omnipresentPlugins.concat(stylisPlugins, _finalizingPlugins));
617
+
618
+ var _stylis = function _stylis(styles) {
619
+ return serialize(compile(styles), _serializer);
620
+ };
621
+
622
+ var serverStylisCache = getServerStylisCache(stylisPlugins)(key);
623
+
624
+ var getRules = function
625
+ /*: string */
626
+ getRules(selector
627
+ /*: string */
628
+ , serialized
629
+ /*: SerializedStyles */
630
+ ) {
631
+ var name = serialized.name;
632
+
633
+ if (serverStylisCache[name] === undefined) {
634
+ serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
635
+ }
636
+
637
+ return serverStylisCache[name];
638
+ };
639
+
640
+ _insert = function
641
+ /*: string | void */
642
+ _insert(selector
643
+ /*: string */
644
+ , serialized
645
+ /*: SerializedStyles */
646
+ , sheet
647
+ /*: StyleSheet */
648
+ , shouldCache
649
+ /*: boolean */
650
+ ) {
651
+ var name = serialized.name;
652
+ var rules = getRules(selector, serialized);
653
+
654
+ if (cache.compat === undefined) {
655
+ // in regular mode, we don't set the styles on the inserted cache
656
+ // since we don't need to and that would be wasting memory
657
+ // we return them so that they are rendered in a style tag
658
+ if (shouldCache) {
659
+ cache.inserted[name] = true;
660
+ }
661
+
662
+ if (serialized.map !== undefined) {
663
+ return rules + serialized.map;
664
+ }
665
+
666
+ return rules;
667
+ } else {
668
+ // in compat mode, we put the styles on the inserted cache so
669
+ // that emotion-server can pull out the styles
670
+ // except when we don't want to cache it which was in Global but now
671
+ // is nowhere but we don't want to do a major right now
672
+ // and just in case we're going to leave the case here
673
+ // it's also not affecting client side bundle size
674
+ // so it's really not a big deal
675
+ if (shouldCache) {
676
+ cache.inserted[name] = rules;
677
+ } else {
678
+ return rules;
679
+ }
680
+ }
681
+ };
682
+ }
683
+
684
+ var cache
685
+ /*: EmotionCache */
686
+ = {
687
+ key: key,
688
+ sheet: new StyleSheet({
689
+ key: key,
690
+ container: container,
691
+ nonce: options.nonce,
692
+ speedy: options.speedy,
693
+ prepend: options.prepend,
694
+ insertionPoint: options.insertionPoint
695
+ }),
696
+ nonce: options.nonce,
697
+ inserted: inserted,
698
+ registered: {},
699
+ insert: _insert
700
+ };
701
+ cache.sheet.hydrate(nodesToHydrate);
702
+ return cache;
703
+ };
704
+
705
+ export { createCache as default };
@@ -0,0 +1 @@
1
+ exports._default = require("./emotion-cache.edge-light.cjs.js").default;