@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,481 @@
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, compile } from 'stylis';
3
+ import weakMemoize from '@emotion/weak-memoize';
4
+ import memoize from '@emotion/memoize';
5
+
6
+ var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
7
+ var previous = 0;
8
+ var character = 0;
9
+
10
+ while (true) {
11
+ previous = character;
12
+ character = peek(); // &\f
13
+
14
+ if (previous === 38 && character === 12) {
15
+ points[index] = 1;
16
+ }
17
+
18
+ if (token(character)) {
19
+ break;
20
+ }
21
+
22
+ next();
23
+ }
24
+
25
+ return slice(begin, position);
26
+ };
27
+
28
+ var toRules = function toRules(parsed, points) {
29
+ // pretend we've started with a comma
30
+ var index = -1;
31
+ var character = 44;
32
+
33
+ do {
34
+ switch (token(character)) {
35
+ case 0:
36
+ // &\f
37
+ if (character === 38 && peek() === 12) {
38
+ // this is not 100% correct, we don't account for literal sequences here - like for example quoted strings
39
+ // stylis inserts \f after & to know when & where it should replace this sequence with the context selector
40
+ // and when it should just concatenate the outer and inner selectors
41
+ // it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here
42
+ points[index] = 1;
43
+ }
44
+
45
+ parsed[index] += identifierWithPointTracking(position - 1, points, index);
46
+ break;
47
+
48
+ case 2:
49
+ parsed[index] += delimit(character);
50
+ break;
51
+
52
+ case 4:
53
+ // comma
54
+ if (character === 44) {
55
+ // colon
56
+ parsed[++index] = peek() === 58 ? '&\f' : '';
57
+ points[index] = parsed[index].length;
58
+ break;
59
+ }
60
+
61
+ // fallthrough
62
+
63
+ default:
64
+ parsed[index] += from(character);
65
+ }
66
+ } while (character = next());
67
+
68
+ return parsed;
69
+ };
70
+
71
+ var getRules = function getRules(value, points) {
72
+ return dealloc(toRules(alloc(value), points));
73
+ }; // WeakSet would be more appropriate, but only WeakMap is supported in IE11
74
+
75
+
76
+ var fixedElements = /* #__PURE__ */new WeakMap();
77
+ var compat = function compat(element) {
78
+ if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo
79
+ // negative .length indicates that this rule has been already prefixed
80
+ element.length < 1) {
81
+ return;
82
+ }
83
+
84
+ var value = element.value,
85
+ parent = element.parent;
86
+ var isImplicitRule = element.column === parent.column && element.line === parent.line;
87
+
88
+ while (parent.type !== 'rule') {
89
+ parent = parent.parent;
90
+ if (!parent) return;
91
+ } // short-circuit for the simplest case
92
+
93
+
94
+ if (element.props.length === 1 && value.charCodeAt(0) !== 58
95
+ /* colon */
96
+ && !fixedElements.get(parent)) {
97
+ return;
98
+ } // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)
99
+ // then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent"
100
+
101
+
102
+ if (isImplicitRule) {
103
+ return;
104
+ }
105
+
106
+ fixedElements.set(element, true);
107
+ var points = [];
108
+ var rules = getRules(value, points);
109
+ var parentRules = parent.props;
110
+
111
+ for (var i = 0, k = 0; i < rules.length; i++) {
112
+ for (var j = 0; j < parentRules.length; j++, k++) {
113
+ element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
114
+ }
115
+ }
116
+ };
117
+ var removeLabel = function removeLabel(element) {
118
+ if (element.type === 'decl') {
119
+ var value = element.value;
120
+
121
+ if ( // charcode for l
122
+ value.charCodeAt(0) === 108 && // charcode for b
123
+ value.charCodeAt(2) === 98) {
124
+ // this ignores label
125
+ element["return"] = '';
126
+ element.value = '';
127
+ }
128
+ }
129
+ };
130
+
131
+ /* eslint-disable no-fallthrough */
132
+
133
+ function prefix(value, length) {
134
+ switch (hash(value, length)) {
135
+ // color-adjust
136
+ case 5103:
137
+ return WEBKIT + 'print-' + value + value;
138
+ // animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
139
+
140
+ case 5737:
141
+ case 4201:
142
+ case 3177:
143
+ case 3433:
144
+ case 1641:
145
+ case 4457:
146
+ case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
147
+
148
+ case 5572:
149
+ case 6356:
150
+ case 5844:
151
+ case 3191:
152
+ case 6645:
153
+ case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
154
+
155
+ case 6391:
156
+ case 5879:
157
+ case 5623:
158
+ case 6135:
159
+ case 4599:
160
+ case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
161
+
162
+ case 4215:
163
+ case 6389:
164
+ case 5109:
165
+ case 5365:
166
+ case 5621:
167
+ case 3829:
168
+ return WEBKIT + value + value;
169
+ // appearance, user-select, transform, hyphens, text-size-adjust
170
+
171
+ case 5349:
172
+ case 4246:
173
+ case 4810:
174
+ case 6968:
175
+ case 2756:
176
+ return WEBKIT + value + MOZ + value + MS + value + value;
177
+ // flex, flex-direction
178
+
179
+ case 6828:
180
+ case 4268:
181
+ return WEBKIT + value + MS + value + value;
182
+ // order
183
+
184
+ case 6165:
185
+ return WEBKIT + value + MS + 'flex-' + value + value;
186
+ // align-items
187
+
188
+ case 5187:
189
+ return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + 'box-$1$2' + MS + 'flex-$1$2') + value;
190
+ // align-self
191
+
192
+ case 5443:
193
+ return WEBKIT + value + MS + 'flex-item-' + replace(value, /flex-|-self/, '') + value;
194
+ // align-content
195
+
196
+ case 4675:
197
+ return WEBKIT + value + MS + 'flex-line-pack' + replace(value, /align-content|flex-|-self/, '') + value;
198
+ // flex-shrink
199
+
200
+ case 5548:
201
+ return WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value;
202
+ // flex-basis
203
+
204
+ case 5292:
205
+ return WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value;
206
+ // flex-grow
207
+
208
+ case 6060:
209
+ return WEBKIT + 'box-' + replace(value, '-grow', '') + WEBKIT + value + MS + replace(value, 'grow', 'positive') + value;
210
+ // transition
211
+
212
+ case 4554:
213
+ return WEBKIT + replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') + value;
214
+ // cursor
215
+
216
+ case 6187:
217
+ return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + '$1'), /(image-set)/, WEBKIT + '$1'), value, '') + value;
218
+ // background, background-image
219
+
220
+ case 5495:
221
+ case 3959:
222
+ return replace(value, /(image-set\([^]*)/, WEBKIT + '$1' + '$`$1');
223
+ // justify-content
224
+
225
+ case 4968:
226
+ return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + WEBKIT + value + value;
227
+ // (margin|padding)-inline-(start|end)
228
+
229
+ case 4095:
230
+ case 3583:
231
+ case 4068:
232
+ case 2532:
233
+ return replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value;
234
+ // (min|max)?(width|height|inline-size|block-size)
235
+
236
+ case 8116:
237
+ case 7059:
238
+ case 5753:
239
+ case 5535:
240
+ case 5445:
241
+ case 5701:
242
+ case 4933:
243
+ case 4677:
244
+ case 5533:
245
+ case 5789:
246
+ case 5021:
247
+ case 4765:
248
+ // stretch, max-content, min-content, fill-available
249
+ if (strlen(value) - 1 - length > 6) switch (charat(value, length + 1)) {
250
+ // (m)ax-content, (m)in-content
251
+ case 109:
252
+ // -
253
+ if (charat(value, length + 4) !== 45) break;
254
+ // (f)ill-available, (f)it-content
255
+
256
+ case 102:
257
+ return replace(value, /(.+:)(.+)-([^]+)/, '$1' + WEBKIT + '$2-$3' + '$1' + MOZ + (charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value;
258
+ // (s)tretch
259
+
260
+ case 115:
261
+ return ~indexof(value, 'stretch') ? prefix(replace(value, 'stretch', 'fill-available'), length) + value : value;
262
+ }
263
+ break;
264
+ // position: sticky
265
+
266
+ case 4949:
267
+ // (s)ticky?
268
+ if (charat(value, length + 1) !== 115) break;
269
+ // display: (flex|inline-flex)
270
+
271
+ case 6444:
272
+ switch (charat(value, strlen(value) - 3 - (~indexof(value, '!important') && 10))) {
273
+ // stic(k)y
274
+ case 107:
275
+ return replace(value, ':', ':' + WEBKIT) + value;
276
+ // (inline-)?fl(e)x
277
+
278
+ case 101:
279
+ return replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + WEBKIT + (charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + WEBKIT + '$2$3' + '$1' + MS + '$2box$3') + value;
280
+ }
281
+
282
+ break;
283
+ // writing-mode
284
+
285
+ case 5936:
286
+ switch (charat(value, length + 11)) {
287
+ // vertical-l(r)
288
+ case 114:
289
+ return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value;
290
+ // vertical-r(l)
291
+
292
+ case 108:
293
+ return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value;
294
+ // horizontal(-)tb
295
+
296
+ case 45:
297
+ return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value;
298
+ }
299
+
300
+ return WEBKIT + value + MS + value + value;
301
+ }
302
+
303
+ return value;
304
+ }
305
+
306
+ var prefixer = function prefixer(element, index, children, callback) {
307
+ if (element.length > -1) if (!element["return"]) switch (element.type) {
308
+ case DECLARATION:
309
+ element["return"] = prefix(element.value, element.length);
310
+ break;
311
+
312
+ case KEYFRAMES:
313
+ return serialize([copy(element, {
314
+ value: replace(element.value, '@', '@' + WEBKIT)
315
+ })], callback);
316
+
317
+ case RULESET:
318
+ if (element.length) return combine(element.props, function (value) {
319
+ switch (match(value, /(::plac\w+|:read-\w+)/)) {
320
+ // :read-(only|write)
321
+ case ':read-only':
322
+ case ':read-write':
323
+ return serialize([copy(element, {
324
+ props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]
325
+ })], callback);
326
+ // :placeholder
327
+
328
+ case '::placeholder':
329
+ return serialize([copy(element, {
330
+ props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')]
331
+ }), copy(element, {
332
+ props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]
333
+ }), copy(element, {
334
+ props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]
335
+ })], callback);
336
+ }
337
+
338
+ return '';
339
+ });
340
+ }
341
+ };
342
+
343
+ /* import type { StylisPlugin } from './types' */
344
+
345
+ /*
346
+ export type Options = {
347
+ nonce?: string,
348
+ stylisPlugins?: StylisPlugin[],
349
+ key: string,
350
+ container?: HTMLElement,
351
+ speedy?: boolean,
352
+ prepend?: boolean,
353
+ insertionPoint?: HTMLElement
354
+ }
355
+ */
356
+
357
+ var getServerStylisCache = weakMemoize(function () {
358
+ return memoize(function () {
359
+ var cache = {};
360
+ return function (name) {
361
+ return cache[name];
362
+ };
363
+ });
364
+ });
365
+ var defaultStylisPlugins = [prefixer];
366
+
367
+ var createCache = function
368
+ /*: EmotionCache */
369
+ createCache(options
370
+ /*: Options */
371
+ ) {
372
+ var key = options.key;
373
+
374
+ var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
375
+
376
+ var inserted = {};
377
+ var container;
378
+ /* : Node */
379
+
380
+ var nodesToHydrate = [];
381
+
382
+ var _insert;
383
+ /*: (
384
+ selector: string,
385
+ serialized: SerializedStyles,
386
+ sheet: StyleSheet,
387
+ shouldCache: boolean
388
+ ) => string | void */
389
+
390
+
391
+ var omnipresentPlugins = [compat, removeLabel];
392
+
393
+ {
394
+ var _finalizingPlugins = [stringify];
395
+
396
+ var _serializer = middleware(omnipresentPlugins.concat(stylisPlugins, _finalizingPlugins));
397
+
398
+ var _stylis = function _stylis(styles) {
399
+ return serialize(compile(styles), _serializer);
400
+ };
401
+
402
+ var serverStylisCache = getServerStylisCache(stylisPlugins)(key);
403
+
404
+ var getRules = function
405
+ /*: string */
406
+ getRules(selector
407
+ /*: string */
408
+ , serialized
409
+ /*: SerializedStyles */
410
+ ) {
411
+ var name = serialized.name;
412
+
413
+ if (serverStylisCache[name] === undefined) {
414
+ serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
415
+ }
416
+
417
+ return serverStylisCache[name];
418
+ };
419
+
420
+ _insert = function
421
+ /*: string | void */
422
+ _insert(selector
423
+ /*: string */
424
+ , serialized
425
+ /*: SerializedStyles */
426
+ , sheet
427
+ /*: StyleSheet */
428
+ , shouldCache
429
+ /*: boolean */
430
+ ) {
431
+ var name = serialized.name;
432
+ var rules = getRules(selector, serialized);
433
+
434
+ if (cache.compat === undefined) {
435
+ // in regular mode, we don't set the styles on the inserted cache
436
+ // since we don't need to and that would be wasting memory
437
+ // we return them so that they are rendered in a style tag
438
+ if (shouldCache) {
439
+ cache.inserted[name] = true;
440
+ }
441
+
442
+ return rules;
443
+ } else {
444
+ // in compat mode, we put the styles on the inserted cache so
445
+ // that emotion-server can pull out the styles
446
+ // except when we don't want to cache it which was in Global but now
447
+ // is nowhere but we don't want to do a major right now
448
+ // and just in case we're going to leave the case here
449
+ // it's also not affecting client side bundle size
450
+ // so it's really not a big deal
451
+ if (shouldCache) {
452
+ cache.inserted[name] = rules;
453
+ } else {
454
+ return rules;
455
+ }
456
+ }
457
+ };
458
+ }
459
+
460
+ var cache
461
+ /*: EmotionCache */
462
+ = {
463
+ key: key,
464
+ sheet: new StyleSheet({
465
+ key: key,
466
+ container: container,
467
+ nonce: options.nonce,
468
+ speedy: options.speedy,
469
+ prepend: options.prepend,
470
+ insertionPoint: options.insertionPoint
471
+ }),
472
+ nonce: options.nonce,
473
+ inserted: inserted,
474
+ registered: {},
475
+ insert: _insert
476
+ };
477
+ cache.sheet.hydrate(nodesToHydrate);
478
+ return cache;
479
+ };
480
+
481
+ export { createCache as default };