@projectwallace/css-analyzer 6.0.0 → 7.0.0

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.
@@ -1,3705 +0,0 @@
1
- import Xr from "css-tree/parser";
2
- import fe from "css-tree/walker";
3
- let Ie = null;
4
- class H {
5
- static createItem(e) {
6
- return {
7
- prev: null,
8
- next: null,
9
- data: e
10
- };
11
- }
12
- constructor() {
13
- this.head = null, this.tail = null, this.cursor = null;
14
- }
15
- createItem(e) {
16
- return H.createItem(e);
17
- }
18
- // cursor helpers
19
- allocateCursor(e, n) {
20
- let r;
21
- return Ie !== null ? (r = Ie, Ie = Ie.cursor, r.prev = e, r.next = n, r.cursor = this.cursor) : r = {
22
- prev: e,
23
- next: n,
24
- cursor: this.cursor
25
- }, this.cursor = r, r;
26
- }
27
- releaseCursor() {
28
- const { cursor: e } = this;
29
- this.cursor = e.cursor, e.prev = null, e.next = null, e.cursor = Ie, Ie = e;
30
- }
31
- updateCursors(e, n, r, s) {
32
- let { cursor: o } = this;
33
- for (; o !== null; )
34
- o.prev === e && (o.prev = n), o.next === r && (o.next = s), o = o.cursor;
35
- }
36
- *[Symbol.iterator]() {
37
- for (let e = this.head; e !== null; e = e.next)
38
- yield e.data;
39
- }
40
- // getters
41
- get size() {
42
- let e = 0;
43
- for (let n = this.head; n !== null; n = n.next)
44
- e++;
45
- return e;
46
- }
47
- get isEmpty() {
48
- return this.head === null;
49
- }
50
- get first() {
51
- return this.head && this.head.data;
52
- }
53
- get last() {
54
- return this.tail && this.tail.data;
55
- }
56
- // convertors
57
- fromArray(e) {
58
- let n = null;
59
- this.head = null;
60
- for (let r of e) {
61
- const s = H.createItem(r);
62
- n !== null ? n.next = s : this.head = s, s.prev = n, n = s;
63
- }
64
- return this.tail = n, this;
65
- }
66
- toArray() {
67
- return [...this];
68
- }
69
- toJSON() {
70
- return [...this];
71
- }
72
- // array-like methods
73
- forEach(e, n = this) {
74
- const r = this.allocateCursor(null, this.head);
75
- for (; r.next !== null; ) {
76
- const s = r.next;
77
- r.next = s.next, e.call(n, s.data, s, this);
78
- }
79
- this.releaseCursor();
80
- }
81
- forEachRight(e, n = this) {
82
- const r = this.allocateCursor(this.tail, null);
83
- for (; r.prev !== null; ) {
84
- const s = r.prev;
85
- r.prev = s.prev, e.call(n, s.data, s, this);
86
- }
87
- this.releaseCursor();
88
- }
89
- reduce(e, n, r = this) {
90
- let s = this.allocateCursor(null, this.head), o = n, a;
91
- for (; s.next !== null; )
92
- a = s.next, s.next = a.next, o = e.call(r, o, a.data, a, this);
93
- return this.releaseCursor(), o;
94
- }
95
- reduceRight(e, n, r = this) {
96
- let s = this.allocateCursor(this.tail, null), o = n, a;
97
- for (; s.prev !== null; )
98
- a = s.prev, s.prev = a.prev, o = e.call(r, o, a.data, a, this);
99
- return this.releaseCursor(), o;
100
- }
101
- some(e, n = this) {
102
- for (let r = this.head; r !== null; r = r.next)
103
- if (e.call(n, r.data, r, this))
104
- return !0;
105
- return !1;
106
- }
107
- map(e, n = this) {
108
- const r = new H();
109
- for (let s = this.head; s !== null; s = s.next)
110
- r.appendData(e.call(n, s.data, s, this));
111
- return r;
112
- }
113
- filter(e, n = this) {
114
- const r = new H();
115
- for (let s = this.head; s !== null; s = s.next)
116
- e.call(n, s.data, s, this) && r.appendData(s.data);
117
- return r;
118
- }
119
- nextUntil(e, n, r = this) {
120
- if (e === null)
121
- return;
122
- const s = this.allocateCursor(null, e);
123
- for (; s.next !== null; ) {
124
- const o = s.next;
125
- if (s.next = o.next, n.call(r, o.data, o, this))
126
- break;
127
- }
128
- this.releaseCursor();
129
- }
130
- prevUntil(e, n, r = this) {
131
- if (e === null)
132
- return;
133
- const s = this.allocateCursor(e, null);
134
- for (; s.prev !== null; ) {
135
- const o = s.prev;
136
- if (s.prev = o.prev, n.call(r, o.data, o, this))
137
- break;
138
- }
139
- this.releaseCursor();
140
- }
141
- // mutation
142
- clear() {
143
- this.head = null, this.tail = null;
144
- }
145
- copy() {
146
- const e = new H();
147
- for (let n of this)
148
- e.appendData(n);
149
- return e;
150
- }
151
- prepend(e) {
152
- return this.updateCursors(null, e, this.head, e), this.head !== null ? (this.head.prev = e, e.next = this.head) : this.tail = e, this.head = e, this;
153
- }
154
- prependData(e) {
155
- return this.prepend(H.createItem(e));
156
- }
157
- append(e) {
158
- return this.insert(e);
159
- }
160
- appendData(e) {
161
- return this.insert(H.createItem(e));
162
- }
163
- insert(e, n = null) {
164
- if (n !== null)
165
- if (this.updateCursors(n.prev, e, n, e), n.prev === null) {
166
- if (this.head !== n)
167
- throw new Error("before doesn't belong to list");
168
- this.head = e, n.prev = e, e.next = n, this.updateCursors(null, e);
169
- } else
170
- n.prev.next = e, e.prev = n.prev, n.prev = e, e.next = n;
171
- else
172
- this.updateCursors(this.tail, e, null, e), this.tail !== null ? (this.tail.next = e, e.prev = this.tail) : this.head = e, this.tail = e;
173
- return this;
174
- }
175
- insertData(e, n) {
176
- return this.insert(H.createItem(e), n);
177
- }
178
- remove(e) {
179
- if (this.updateCursors(e, e.prev, e, e.next), e.prev !== null)
180
- e.prev.next = e.next;
181
- else {
182
- if (this.head !== e)
183
- throw new Error("item doesn't belong to list");
184
- this.head = e.next;
185
- }
186
- if (e.next !== null)
187
- e.next.prev = e.prev;
188
- else {
189
- if (this.tail !== e)
190
- throw new Error("item doesn't belong to list");
191
- this.tail = e.prev;
192
- }
193
- return e.prev = null, e.next = null, e;
194
- }
195
- push(e) {
196
- this.insert(H.createItem(e));
197
- }
198
- pop() {
199
- return this.tail !== null ? this.remove(this.tail) : null;
200
- }
201
- unshift(e) {
202
- this.prepend(H.createItem(e));
203
- }
204
- shift() {
205
- return this.head !== null ? this.remove(this.head) : null;
206
- }
207
- prependList(e) {
208
- return this.insertList(e, this.head);
209
- }
210
- appendList(e) {
211
- return this.insertList(e);
212
- }
213
- insertList(e, n) {
214
- return e.head === null ? this : (n != null ? (this.updateCursors(n.prev, e.tail, n, e.head), n.prev !== null ? (n.prev.next = e.head, e.head.prev = n.prev) : this.head = e.head, n.prev = e.tail, e.tail.next = n) : (this.updateCursors(this.tail, e.tail, null, e.head), this.tail !== null ? (this.tail.next = e.head, e.head.prev = this.tail) : this.head = e.head, this.tail = e.tail), e.head = null, e.tail = null, this);
215
- }
216
- replace(e, n) {
217
- "head" in n ? this.insertList(n, e) : this.insert(n, e), this.remove(e);
218
- }
219
- }
220
- function Zr(t, e) {
221
- const n = Object.create(SyntaxError.prototype), r = new Error();
222
- return Object.assign(n, {
223
- name: t,
224
- message: e,
225
- get stack() {
226
- return (r.stack || "").replace(/^(.+\n){1,3}/, `${t}: ${e}
227
- `);
228
- }
229
- });
230
- }
231
- const qt = 100, Jn = 60, Yn = " ";
232
- function Xn({ source: t, line: e, column: n, baseLine: r, baseColumn: s }, o) {
233
- function a(S, T) {
234
- return i.slice(S, T).map(
235
- (P, G) => String(S + G + 1).padStart(y) + " |" + P
236
- ).join(`
237
- `);
238
- }
239
- const c = `
240
- `.repeat(Math.max(r - 1, 0)), u = " ".repeat(Math.max(s - 1, 0)), i = (c + u + t).split(/\r\n?|\n|\f/), l = Math.max(1, e - o) - 1, d = Math.min(e + o, i.length + 1), y = Math.max(4, String(d).length) + 1;
241
- let g = 0;
242
- n += (Yn.length - 1) * (i[e - 1].substr(0, n - 1).match(/\t/g) || []).length, n > qt && (g = n - Jn + 3, n = Jn - 2);
243
- for (let S = l; S <= d; S++)
244
- S >= 0 && S < i.length && (i[S] = i[S].replace(/\t/g, Yn), i[S] = (g > 0 && i[S].length > g ? "…" : "") + i[S].substr(g, qt - 2) + (i[S].length > g + qt - 1 ? "…" : ""));
245
- return [
246
- a(l, e),
247
- new Array(n + y + 2).join("-") + "^",
248
- a(e, d)
249
- ].filter(Boolean).join(`
250
- `).replace(/^(\s+\d+\s+\|\n)+/, "").replace(/\n(\s+\d+\s+\|)+$/, "");
251
- }
252
- function Zn(t, e, n, r, s, o = 1, a = 1) {
253
- return Object.assign(Zr("SyntaxError", t), {
254
- source: e,
255
- offset: n,
256
- line: r,
257
- column: s,
258
- sourceFragment(u) {
259
- return Xn({ source: e, line: r, column: s, baseLine: o, baseColumn: a }, isNaN(u) ? 0 : u);
260
- },
261
- get formattedMessage() {
262
- return `Parse error: ${t}
263
- ` + Xn({ source: e, line: r, column: s, baseLine: o, baseColumn: a }, 2);
264
- }
265
- });
266
- }
267
- const Be = 0, x = 1, D = 2, U = 3, z = 4, Pe = 5, ei = 6, ie = 7, se = 8, $ = 9, E = 10, M = 11, N = 12, J = 13, Lr = 14, oe = 15, te = 16, yt = 17, Me = 18, St = 19, ft = 20, ne = 21, I = 22, fn = 23, pn = 24, he = 25, ti = 0;
268
- function Q(t) {
269
- return t >= 48 && t <= 57;
270
- }
271
- function Ue(t) {
272
- return Q(t) || // 0 .. 9
273
- t >= 65 && t <= 70 || // A .. F
274
- t >= 97 && t <= 102;
275
- }
276
- function dn(t) {
277
- return t >= 65 && t <= 90;
278
- }
279
- function ni(t) {
280
- return t >= 97 && t <= 122;
281
- }
282
- function ri(t) {
283
- return dn(t) || ni(t);
284
- }
285
- function ii(t) {
286
- return t >= 128;
287
- }
288
- function pt(t) {
289
- return ri(t) || ii(t) || t === 95;
290
- }
291
- function Er(t) {
292
- return pt(t) || Q(t) || t === 45;
293
- }
294
- function si(t) {
295
- return t >= 0 && t <= 8 || t === 11 || t >= 14 && t <= 31 || t === 127;
296
- }
297
- function dt(t) {
298
- return t === 10 || t === 13 || t === 12;
299
- }
300
- function He(t) {
301
- return dt(t) || t === 32 || t === 9;
302
- }
303
- function ge(t, e) {
304
- return !(t !== 92 || dt(e) || e === ti);
305
- }
306
- function Bt(t, e, n) {
307
- return t === 45 ? pt(e) || e === 45 || ge(e, n) : pt(t) ? !0 : t === 92 ? ge(t, e) : !1;
308
- }
309
- function jt(t, e, n) {
310
- return t === 43 || t === 45 ? Q(e) ? 2 : e === 46 && Q(n) ? 3 : 0 : t === 46 ? Q(e) ? 2 : 0 : Q(t) ? 1 : 0;
311
- }
312
- function _r(t) {
313
- return t === 65279 || t === 65534 ? 1 : 0;
314
- }
315
- const on = new Array(128), oi = 128, lt = 130, Tr = 131, mn = 132, Or = 133;
316
- for (let t = 0; t < on.length; t++)
317
- on[t] = He(t) && lt || Q(t) && Tr || pt(t) && mn || si(t) && Or || t || oi;
318
- function Ut(t) {
319
- return t < 128 ? on[t] : mn;
320
- }
321
- function $e(t, e) {
322
- return e < t.length ? t.charCodeAt(e) : 0;
323
- }
324
- function an(t, e, n) {
325
- return n === 13 && $e(t, e + 1) === 10 ? 2 : 1;
326
- }
327
- function Ir(t, e, n) {
328
- let r = t.charCodeAt(e);
329
- return dn(r) && (r = r | 32), r === n;
330
- }
331
- function mt(t, e, n, r) {
332
- if (n - e !== r.length || e < 0 || n > t.length)
333
- return !1;
334
- for (let s = e; s < n; s++) {
335
- const o = r.charCodeAt(s - e);
336
- let a = t.charCodeAt(s);
337
- if (dn(a) && (a = a | 32), a !== o)
338
- return !1;
339
- }
340
- return !0;
341
- }
342
- function ai(t, e) {
343
- for (; e >= 0 && He(t.charCodeAt(e)); e--)
344
- ;
345
- return e + 1;
346
- }
347
- function nt(t, e) {
348
- for (; e < t.length && He(t.charCodeAt(e)); e++)
349
- ;
350
- return e;
351
- }
352
- function Gt(t, e) {
353
- for (; e < t.length && Q(t.charCodeAt(e)); e++)
354
- ;
355
- return e;
356
- }
357
- function Ge(t, e) {
358
- if (e += 2, Ue($e(t, e - 1))) {
359
- for (const r = Math.min(t.length, e + 5); e < r && Ue($e(t, e)); e++)
360
- ;
361
- const n = $e(t, e);
362
- He(n) && (e += an(t, e, n));
363
- }
364
- return e;
365
- }
366
- function rt(t, e) {
367
- for (; e < t.length; e++) {
368
- const n = t.charCodeAt(e);
369
- if (!Er(n)) {
370
- if (ge(n, $e(t, e + 1))) {
371
- e = Ge(t, e) - 1;
372
- continue;
373
- }
374
- break;
375
- }
376
- }
377
- return e;
378
- }
379
- function Nr(t, e) {
380
- let n = t.charCodeAt(e);
381
- if ((n === 43 || n === 45) && (n = t.charCodeAt(e += 1)), Q(n) && (e = Gt(t, e + 1), n = t.charCodeAt(e)), n === 46 && Q(t.charCodeAt(e + 1)) && (e += 2, e = Gt(t, e)), Ir(
382
- t,
383
- e,
384
- 101
385
- /* e */
386
- )) {
387
- let r = 0;
388
- n = t.charCodeAt(e + 1), (n === 45 || n === 43) && (r = 1, n = t.charCodeAt(e + 2)), Q(n) && (e = Gt(t, e + 1 + r + 1));
389
- }
390
- return e;
391
- }
392
- function Vt(t, e) {
393
- for (; e < t.length; e++) {
394
- const n = t.charCodeAt(e);
395
- if (n === 41) {
396
- e++;
397
- break;
398
- }
399
- ge(n, $e(t, e + 1)) && (e = Ge(t, e));
400
- }
401
- return e;
402
- }
403
- function li(t) {
404
- if (t.length === 1 && !Ue(t.charCodeAt(0)))
405
- return t[0];
406
- let e = parseInt(t, 16);
407
- return (e === 0 || // If this number is zero,
408
- e >= 55296 && e <= 57343 || // or is for a surrogate,
409
- e > 1114111) && (e = 65533), String.fromCodePoint(e);
410
- }
411
- const $r = [
412
- "EOF-token",
413
- "ident-token",
414
- "function-token",
415
- "at-keyword-token",
416
- "hash-token",
417
- "string-token",
418
- "bad-string-token",
419
- "url-token",
420
- "bad-url-token",
421
- "delim-token",
422
- "number-token",
423
- "percentage-token",
424
- "dimension-token",
425
- "whitespace-token",
426
- "CDO-token",
427
- "CDC-token",
428
- "colon-token",
429
- "semicolon-token",
430
- "comma-token",
431
- "[-token",
432
- "]-token",
433
- "(-token",
434
- ")-token",
435
- "{-token",
436
- "}-token",
437
- "comment-token"
438
- ], ci = 16 * 1024;
439
- function gt(t = null, e) {
440
- return t === null || t.length < e ? new Uint32Array(Math.max(e + 1024, ci)) : t;
441
- }
442
- const er = 10, ui = 12, tr = 13;
443
- function nr(t) {
444
- const e = t.source, n = e.length, r = e.length > 0 ? _r(e.charCodeAt(0)) : 0, s = gt(t.lines, n), o = gt(t.columns, n);
445
- let a = t.startLine, c = t.startColumn;
446
- for (let u = r; u < n; u++) {
447
- const i = e.charCodeAt(u);
448
- s[u] = a, o[u] = c++, (i === er || i === tr || i === ui) && (i === tr && u + 1 < n && e.charCodeAt(u + 1) === er && (u++, s[u] = a, o[u] = c), a++, c = 1);
449
- }
450
- s[n] = a, o[n] = c, t.lines = s, t.columns = o, t.computed = !0;
451
- }
452
- class hi {
453
- constructor(e, n, r, s) {
454
- this.setSource(e, n, r, s), this.lines = null, this.columns = null;
455
- }
456
- setSource(e = "", n = 0, r = 1, s = 1) {
457
- this.source = e, this.startOffset = n, this.startLine = r, this.startColumn = s, this.computed = !1;
458
- }
459
- getLocation(e, n) {
460
- return this.computed || nr(this), {
461
- source: n,
462
- offset: this.startOffset + e,
463
- line: this.lines[e],
464
- column: this.columns[e]
465
- };
466
- }
467
- getLocationRange(e, n, r) {
468
- return this.computed || nr(this), {
469
- source: r,
470
- start: {
471
- offset: this.startOffset + e,
472
- line: this.lines[e],
473
- column: this.columns[e]
474
- },
475
- end: {
476
- offset: this.startOffset + n,
477
- line: this.lines[n],
478
- column: this.columns[n]
479
- }
480
- };
481
- }
482
- }
483
- const le = 16777215, ce = 24, Ee = new Uint8Array(32);
484
- Ee[D] = I;
485
- Ee[ne] = I;
486
- Ee[St] = ft;
487
- Ee[fn] = pn;
488
- function rr(t) {
489
- return Ee[t] !== 0;
490
- }
491
- class fi {
492
- constructor(e, n) {
493
- this.setSource(e, n);
494
- }
495
- reset() {
496
- this.eof = !1, this.tokenIndex = -1, this.tokenType = 0, this.tokenStart = this.firstCharOffset, this.tokenEnd = this.firstCharOffset;
497
- }
498
- setSource(e = "", n = () => {
499
- }) {
500
- e = String(e || "");
501
- const r = e.length, s = gt(this.offsetAndType, e.length + 1), o = gt(this.balance, e.length + 1);
502
- let a = 0, c = -1, u = 0, i = e.length;
503
- this.offsetAndType = null, this.balance = null, o.fill(0), n(e, (l, d, y) => {
504
- const g = a++;
505
- if (s[g] = l << ce | y, c === -1 && (c = d), o[g] = i, l === u) {
506
- const S = o[i];
507
- o[i] = g, i = S, u = Ee[s[S] >> ce];
508
- } else rr(l) && (i = g, u = Ee[l]);
509
- }), s[a] = Be << ce | r, o[a] = a;
510
- for (let l = 0; l < a; l++) {
511
- const d = o[l];
512
- if (d <= l) {
513
- const y = o[d];
514
- y !== l && (o[l] = y);
515
- } else d > a && (o[l] = a);
516
- }
517
- this.source = e, this.firstCharOffset = c === -1 ? 0 : c, this.tokenCount = a, this.offsetAndType = s, this.balance = o, this.reset(), this.next();
518
- }
519
- lookupType(e) {
520
- return e += this.tokenIndex, e < this.tokenCount ? this.offsetAndType[e] >> ce : Be;
521
- }
522
- lookupTypeNonSC(e) {
523
- for (let n = this.tokenIndex; n < this.tokenCount; n++) {
524
- const r = this.offsetAndType[n] >> ce;
525
- if (r !== J && r !== he && e-- === 0)
526
- return r;
527
- }
528
- return Be;
529
- }
530
- lookupOffset(e) {
531
- return e += this.tokenIndex, e < this.tokenCount ? this.offsetAndType[e - 1] & le : this.source.length;
532
- }
533
- lookupOffsetNonSC(e) {
534
- for (let n = this.tokenIndex; n < this.tokenCount; n++) {
535
- const r = this.offsetAndType[n] >> ce;
536
- if (r !== J && r !== he && e-- === 0)
537
- return n - this.tokenIndex;
538
- }
539
- return Be;
540
- }
541
- lookupValue(e, n) {
542
- return e += this.tokenIndex, e < this.tokenCount ? mt(
543
- this.source,
544
- this.offsetAndType[e - 1] & le,
545
- this.offsetAndType[e] & le,
546
- n
547
- ) : !1;
548
- }
549
- getTokenStart(e) {
550
- return e === this.tokenIndex ? this.tokenStart : e > 0 ? e < this.tokenCount ? this.offsetAndType[e - 1] & le : this.offsetAndType[this.tokenCount] & le : this.firstCharOffset;
551
- }
552
- substrToCursor(e) {
553
- return this.source.substring(e, this.tokenStart);
554
- }
555
- isBalanceEdge(e) {
556
- return this.balance[this.tokenIndex] < e;
557
- }
558
- isDelim(e, n) {
559
- return n ? this.lookupType(n) === $ && this.source.charCodeAt(this.lookupOffset(n)) === e : this.tokenType === $ && this.source.charCodeAt(this.tokenStart) === e;
560
- }
561
- skip(e) {
562
- let n = this.tokenIndex + e;
563
- n < this.tokenCount ? (this.tokenIndex = n, this.tokenStart = this.offsetAndType[n - 1] & le, n = this.offsetAndType[n], this.tokenType = n >> ce, this.tokenEnd = n & le) : (this.tokenIndex = this.tokenCount, this.next());
564
- }
565
- next() {
566
- let e = this.tokenIndex + 1;
567
- e < this.tokenCount ? (this.tokenIndex = e, this.tokenStart = this.tokenEnd, e = this.offsetAndType[e], this.tokenType = e >> ce, this.tokenEnd = e & le) : (this.eof = !0, this.tokenIndex = this.tokenCount, this.tokenType = Be, this.tokenStart = this.tokenEnd = this.source.length);
568
- }
569
- skipSC() {
570
- for (; this.tokenType === J || this.tokenType === he; )
571
- this.next();
572
- }
573
- skipUntilBalanced(e, n) {
574
- let r = e, s = 0, o = 0;
575
- e:
576
- for (; r < this.tokenCount; r++) {
577
- if (s = this.balance[r], s < e)
578
- break e;
579
- switch (o = r > 0 ? this.offsetAndType[r - 1] & le : this.firstCharOffset, n(this.source.charCodeAt(o))) {
580
- case 1:
581
- break e;
582
- case 2:
583
- r++;
584
- break e;
585
- default:
586
- rr(this.offsetAndType[r] >> ce) && (r = s);
587
- }
588
- }
589
- this.skip(r - this.tokenIndex);
590
- }
591
- forEachToken(e) {
592
- for (let n = 0, r = this.firstCharOffset; n < this.tokenCount; n++) {
593
- const s = r, o = this.offsetAndType[n], a = o & le, c = o >> ce;
594
- r = a, e(c, s, a, n);
595
- }
596
- }
597
- dump() {
598
- const e = new Array(this.tokenCount);
599
- return this.forEachToken((n, r, s, o) => {
600
- e[o] = {
601
- idx: o,
602
- type: $r[n],
603
- chunk: this.source.substring(r, s),
604
- balance: this.balance[o]
605
- };
606
- }), e;
607
- }
608
- }
609
- function Dr(t, e) {
610
- function n(d) {
611
- return d < c ? t.charCodeAt(d) : 0;
612
- }
613
- function r() {
614
- if (i = Nr(t, i), Bt(n(i), n(i + 1), n(i + 2))) {
615
- l = N, i = rt(t, i);
616
- return;
617
- }
618
- if (n(i) === 37) {
619
- l = M, i++;
620
- return;
621
- }
622
- l = E;
623
- }
624
- function s() {
625
- const d = i;
626
- if (i = rt(t, i), mt(t, d, i, "url") && n(i) === 40) {
627
- if (i = nt(t, i + 1), n(i) === 34 || n(i) === 39) {
628
- l = D, i = d + 4;
629
- return;
630
- }
631
- a();
632
- return;
633
- }
634
- if (n(i) === 40) {
635
- l = D, i++;
636
- return;
637
- }
638
- l = x;
639
- }
640
- function o(d) {
641
- for (d || (d = n(i++)), l = Pe; i < t.length; i++) {
642
- const y = t.charCodeAt(i);
643
- switch (Ut(y)) {
644
- // ending code point
645
- case d:
646
- i++;
647
- return;
648
- // EOF
649
- // case EofCategory:
650
- // This is a parse error. Return the <string-token>.
651
- // return;
652
- // newline
653
- case lt:
654
- if (dt(y)) {
655
- i += an(t, i, y), l = ei;
656
- return;
657
- }
658
- break;
659
- // U+005C REVERSE SOLIDUS (\)
660
- case 92:
661
- if (i === t.length - 1)
662
- break;
663
- const g = n(i + 1);
664
- dt(g) ? i += an(t, i + 1, g) : ge(y, g) && (i = Ge(t, i) - 1);
665
- break;
666
- }
667
- }
668
- }
669
- function a() {
670
- for (l = ie, i = nt(t, i); i < t.length; i++) {
671
- const d = t.charCodeAt(i);
672
- switch (Ut(d)) {
673
- // U+0029 RIGHT PARENTHESIS ())
674
- case 41:
675
- i++;
676
- return;
677
- // EOF
678
- // case EofCategory:
679
- // This is a parse error. Return the <url-token>.
680
- // return;
681
- // whitespace
682
- case lt:
683
- if (i = nt(t, i), n(i) === 41 || i >= t.length) {
684
- i < t.length && i++;
685
- return;
686
- }
687
- i = Vt(t, i), l = se;
688
- return;
689
- // U+0022 QUOTATION MARK (")
690
- // U+0027 APOSTROPHE (')
691
- // U+0028 LEFT PARENTHESIS (()
692
- // non-printable code point
693
- case 34:
694
- case 39:
695
- case 40:
696
- case Or:
697
- i = Vt(t, i), l = se;
698
- return;
699
- // U+005C REVERSE SOLIDUS (\)
700
- case 92:
701
- if (ge(d, n(i + 1))) {
702
- i = Ge(t, i) - 1;
703
- break;
704
- }
705
- i = Vt(t, i), l = se;
706
- return;
707
- }
708
- }
709
- }
710
- t = String(t || "");
711
- const c = t.length;
712
- let u = _r(n(0)), i = u, l;
713
- for (; i < c; ) {
714
- const d = t.charCodeAt(i);
715
- switch (Ut(d)) {
716
- // whitespace
717
- case lt:
718
- l = J, i = nt(t, i + 1);
719
- break;
720
- // U+0022 QUOTATION MARK (")
721
- case 34:
722
- o();
723
- break;
724
- // U+0023 NUMBER SIGN (#)
725
- case 35:
726
- Er(n(i + 1)) || ge(n(i + 1), n(i + 2)) ? (l = z, i = rt(t, i + 1)) : (l = $, i++);
727
- break;
728
- // U+0027 APOSTROPHE (')
729
- case 39:
730
- o();
731
- break;
732
- // U+0028 LEFT PARENTHESIS (()
733
- case 40:
734
- l = ne, i++;
735
- break;
736
- // U+0029 RIGHT PARENTHESIS ())
737
- case 41:
738
- l = I, i++;
739
- break;
740
- // U+002B PLUS SIGN (+)
741
- case 43:
742
- jt(d, n(i + 1), n(i + 2)) ? r() : (l = $, i++);
743
- break;
744
- // U+002C COMMA (,)
745
- case 44:
746
- l = Me, i++;
747
- break;
748
- // U+002D HYPHEN-MINUS (-)
749
- case 45:
750
- jt(d, n(i + 1), n(i + 2)) ? r() : n(i + 1) === 45 && n(i + 2) === 62 ? (l = oe, i = i + 3) : Bt(d, n(i + 1), n(i + 2)) ? s() : (l = $, i++);
751
- break;
752
- // U+002E FULL STOP (.)
753
- case 46:
754
- jt(d, n(i + 1), n(i + 2)) ? r() : (l = $, i++);
755
- break;
756
- // U+002F SOLIDUS (/)
757
- case 47:
758
- n(i + 1) === 42 ? (l = he, i = t.indexOf("*/", i + 2), i = i === -1 ? t.length : i + 2) : (l = $, i++);
759
- break;
760
- // U+003A COLON (:)
761
- case 58:
762
- l = te, i++;
763
- break;
764
- // U+003B SEMICOLON (;)
765
- case 59:
766
- l = yt, i++;
767
- break;
768
- // U+003C LESS-THAN SIGN (<)
769
- case 60:
770
- n(i + 1) === 33 && n(i + 2) === 45 && n(i + 3) === 45 ? (l = Lr, i = i + 4) : (l = $, i++);
771
- break;
772
- // U+0040 COMMERCIAL AT (@)
773
- case 64:
774
- Bt(n(i + 1), n(i + 2), n(i + 3)) ? (l = U, i = rt(t, i + 1)) : (l = $, i++);
775
- break;
776
- // U+005B LEFT SQUARE BRACKET ([)
777
- case 91:
778
- l = St, i++;
779
- break;
780
- // U+005C REVERSE SOLIDUS (\)
781
- case 92:
782
- ge(d, n(i + 1)) ? s() : (l = $, i++);
783
- break;
784
- // U+005D RIGHT SQUARE BRACKET (])
785
- case 93:
786
- l = ft, i++;
787
- break;
788
- // U+007B LEFT CURLY BRACKET ({)
789
- case 123:
790
- l = fn, i++;
791
- break;
792
- // U+007D RIGHT CURLY BRACKET (})
793
- case 125:
794
- l = pn, i++;
795
- break;
796
- // digit
797
- case Tr:
798
- r();
799
- break;
800
- // name-start code point
801
- case mn:
802
- s();
803
- break;
804
- // EOF
805
- // case EofCategory:
806
- // Return an <EOF-token>.
807
- // break;
808
- // anything else
809
- default:
810
- l = $, i++;
811
- }
812
- e(l, u, u = i);
813
- }
814
- }
815
- function pi(t) {
816
- const e = this.createList();
817
- let n = !1;
818
- const r = {
819
- recognizer: t
820
- };
821
- for (; !this.eof; ) {
822
- switch (this.tokenType) {
823
- case he:
824
- this.next();
825
- continue;
826
- case J:
827
- n = !0, this.next();
828
- continue;
829
- }
830
- let s = t.getNode.call(this, r);
831
- if (s === void 0)
832
- break;
833
- n && (t.onWhiteSpace && t.onWhiteSpace.call(this, s, e, r), n = !1), e.push(s);
834
- }
835
- return n && t.onWhiteSpace && t.onWhiteSpace.call(this, null, e, r), e;
836
- }
837
- const ir = () => {
838
- }, di = 33, mi = 35, Ht = 59, sr = 123, or = 0;
839
- function gi(t) {
840
- return function() {
841
- return this[t]();
842
- };
843
- }
844
- function Wt(t) {
845
- const e = /* @__PURE__ */ Object.create(null);
846
- for (const n of Object.keys(t)) {
847
- const r = t[n], s = r.parse || r;
848
- s && (e[n] = s);
849
- }
850
- return e;
851
- }
852
- function ki(t) {
853
- const e = {
854
- context: /* @__PURE__ */ Object.create(null),
855
- features: Object.assign(/* @__PURE__ */ Object.create(null), t.features),
856
- scope: Object.assign(/* @__PURE__ */ Object.create(null), t.scope),
857
- atrule: Wt(t.atrule),
858
- pseudo: Wt(t.pseudo),
859
- node: Wt(t.node)
860
- };
861
- for (const [n, r] of Object.entries(t.parseContext))
862
- switch (typeof r) {
863
- case "function":
864
- e.context[n] = r;
865
- break;
866
- case "string":
867
- e.context[n] = gi(r);
868
- break;
869
- }
870
- return {
871
- config: e,
872
- ...e,
873
- ...e.node
874
- };
875
- }
876
- function yi(t) {
877
- let e = "", n = "<unknown>", r = !1, s = ir, o = !1;
878
- const a = new hi(), c = Object.assign(new fi(), ki(t || {}), {
879
- parseAtrulePrelude: !0,
880
- parseRulePrelude: !0,
881
- parseValue: !0,
882
- parseCustomProperty: !1,
883
- readSequence: pi,
884
- consumeUntilBalanceEnd: () => 0,
885
- consumeUntilLeftCurlyBracket(i) {
886
- return i === sr ? 1 : 0;
887
- },
888
- consumeUntilLeftCurlyBracketOrSemicolon(i) {
889
- return i === sr || i === Ht ? 1 : 0;
890
- },
891
- consumeUntilExclamationMarkOrSemicolon(i) {
892
- return i === di || i === Ht ? 1 : 0;
893
- },
894
- consumeUntilSemicolonIncluded(i) {
895
- return i === Ht ? 2 : 0;
896
- },
897
- createList() {
898
- return new H();
899
- },
900
- createSingleNodeList(i) {
901
- return new H().appendData(i);
902
- },
903
- getFirstListNode(i) {
904
- return i && i.first;
905
- },
906
- getLastListNode(i) {
907
- return i && i.last;
908
- },
909
- parseWithFallback(i, l) {
910
- const d = this.tokenIndex;
911
- try {
912
- return i.call(this);
913
- } catch (y) {
914
- if (o)
915
- throw y;
916
- this.skip(d - this.tokenIndex);
917
- const g = l.call(this);
918
- return o = !0, s(y, g), o = !1, g;
919
- }
920
- },
921
- lookupNonWSType(i) {
922
- let l;
923
- do
924
- if (l = this.lookupType(i++), l !== J && l !== he)
925
- return l;
926
- while (l !== or);
927
- return or;
928
- },
929
- charCodeAt(i) {
930
- return i >= 0 && i < e.length ? e.charCodeAt(i) : 0;
931
- },
932
- substring(i, l) {
933
- return e.substring(i, l);
934
- },
935
- substrToCursor(i) {
936
- return this.source.substring(i, this.tokenStart);
937
- },
938
- cmpChar(i, l) {
939
- return Ir(e, i, l);
940
- },
941
- cmpStr(i, l, d) {
942
- return mt(e, i, l, d);
943
- },
944
- consume(i) {
945
- const l = this.tokenStart;
946
- return this.eat(i), this.substrToCursor(l);
947
- },
948
- consumeFunctionName() {
949
- const i = e.substring(this.tokenStart, this.tokenEnd - 1);
950
- return this.eat(D), i;
951
- },
952
- consumeNumber(i) {
953
- const l = e.substring(this.tokenStart, Nr(e, this.tokenStart));
954
- return this.eat(i), l;
955
- },
956
- eat(i) {
957
- if (this.tokenType !== i) {
958
- const l = $r[i].slice(0, -6).replace(/-/g, " ").replace(/^./, (g) => g.toUpperCase());
959
- let d = `${/[[\](){}]/.test(l) ? `"${l}"` : l} is expected`, y = this.tokenStart;
960
- switch (i) {
961
- case x:
962
- this.tokenType === D || this.tokenType === ie ? (y = this.tokenEnd - 1, d = "Identifier is expected but function found") : d = "Identifier is expected";
963
- break;
964
- case z:
965
- this.isDelim(mi) && (this.next(), y++, d = "Name is expected");
966
- break;
967
- case M:
968
- this.tokenType === E && (y = this.tokenEnd, d = "Percent sign is expected");
969
- break;
970
- }
971
- this.error(d, y);
972
- }
973
- this.next();
974
- },
975
- eatIdent(i) {
976
- (this.tokenType !== x || this.lookupValue(0, i) === !1) && this.error(`Identifier "${i}" is expected`), this.next();
977
- },
978
- eatDelim(i) {
979
- this.isDelim(i) || this.error(`Delim "${String.fromCharCode(i)}" is expected`), this.next();
980
- },
981
- getLocation(i, l) {
982
- return r ? a.getLocationRange(
983
- i,
984
- l,
985
- n
986
- ) : null;
987
- },
988
- getLocationFromList(i) {
989
- if (r) {
990
- const l = this.getFirstListNode(i), d = this.getLastListNode(i);
991
- return a.getLocationRange(
992
- l !== null ? l.loc.start.offset - a.startOffset : this.tokenStart,
993
- d !== null ? d.loc.end.offset - a.startOffset : this.tokenStart,
994
- n
995
- );
996
- }
997
- return null;
998
- },
999
- error(i, l) {
1000
- const d = typeof l < "u" && l < e.length ? a.getLocation(l) : this.eof ? a.getLocation(ai(e, e.length - 1)) : a.getLocation(this.tokenStart);
1001
- throw new Zn(
1002
- i || "Unexpected input",
1003
- e,
1004
- d.offset,
1005
- d.line,
1006
- d.column,
1007
- a.startLine,
1008
- a.startColumn
1009
- );
1010
- }
1011
- });
1012
- return Object.assign(function(i, l) {
1013
- e = i, l = l || {}, c.setSource(e, Dr), a.setSource(
1014
- e,
1015
- l.offset,
1016
- l.line,
1017
- l.column
1018
- ), n = l.filename || "<unknown>", r = !!l.positions, s = typeof l.onParseError == "function" ? l.onParseError : ir, o = !1, c.parseAtrulePrelude = "parseAtrulePrelude" in l ? !!l.parseAtrulePrelude : !0, c.parseRulePrelude = "parseRulePrelude" in l ? !!l.parseRulePrelude : !0, c.parseValue = "parseValue" in l ? !!l.parseValue : !0, c.parseCustomProperty = "parseCustomProperty" in l ? !!l.parseCustomProperty : !1;
1019
- const { context: d = "default", onComment: y } = l;
1020
- if (!(d in c.context))
1021
- throw new Error("Unknown context `" + d + "`");
1022
- typeof y == "function" && c.forEachToken((S, T, P) => {
1023
- if (S === he) {
1024
- const G = c.getLocation(T, P), Y = mt(e, P - 2, P, "*/") ? e.slice(T + 2, P - 2) : e.slice(T + 2, P);
1025
- y(Y, G);
1026
- }
1027
- });
1028
- const g = c.context[d].call(c, l);
1029
- return c.eof || c.error(), g;
1030
- }, {
1031
- SyntaxError: Zn,
1032
- config: c.config
1033
- });
1034
- }
1035
- const Si = 35, xi = 38, Ci = 42, bi = 43, wi = 47, ar = 46, vi = 62, Ai = 124, Li = 126;
1036
- function Ei(t, e) {
1037
- e.last !== null && e.last.type !== "Combinator" && t !== null && t.type !== "Combinator" && e.push({
1038
- // FIXME: this.Combinator() should be used instead
1039
- type: "Combinator",
1040
- loc: null,
1041
- name: " "
1042
- });
1043
- }
1044
- function _i() {
1045
- switch (this.tokenType) {
1046
- case St:
1047
- return this.AttributeSelector();
1048
- case z:
1049
- return this.IdSelector();
1050
- case te:
1051
- return this.lookupType(1) === te ? this.PseudoElementSelector() : this.PseudoClassSelector();
1052
- case x:
1053
- return this.TypeSelector();
1054
- case E:
1055
- case M:
1056
- return this.Percentage();
1057
- case N:
1058
- this.charCodeAt(this.tokenStart) === ar && this.error("Identifier is expected", this.tokenStart + 1);
1059
- break;
1060
- case $: {
1061
- switch (this.charCodeAt(this.tokenStart)) {
1062
- case bi:
1063
- case vi:
1064
- case Li:
1065
- case wi:
1066
- return this.Combinator();
1067
- case ar:
1068
- return this.ClassSelector();
1069
- case Ci:
1070
- case Ai:
1071
- return this.TypeSelector();
1072
- case Si:
1073
- return this.IdSelector();
1074
- case xi:
1075
- return this.NestingSelector();
1076
- }
1077
- break;
1078
- }
1079
- }
1080
- }
1081
- const Ti = {
1082
- onWhiteSpace: Ei,
1083
- getNode: _i
1084
- };
1085
- function Oi() {
1086
- const t = this.createList();
1087
- this.skipSC();
1088
- e: for (; !this.eof; ) {
1089
- switch (this.tokenType) {
1090
- case x:
1091
- t.push(this.Identifier());
1092
- break;
1093
- case Pe:
1094
- t.push(this.String());
1095
- break;
1096
- case Me:
1097
- t.push(this.Operator());
1098
- break;
1099
- case I:
1100
- break e;
1101
- default:
1102
- this.error("Identifier, string or comma is expected");
1103
- }
1104
- this.skipSC();
1105
- }
1106
- return t;
1107
- }
1108
- const Ae = {
1109
- parse() {
1110
- return this.createSingleNodeList(
1111
- this.SelectorList()
1112
- );
1113
- }
1114
- }, Kt = {
1115
- parse() {
1116
- return this.createSingleNodeList(
1117
- this.Selector()
1118
- );
1119
- }
1120
- }, Ii = {
1121
- parse() {
1122
- return this.createSingleNodeList(
1123
- this.Identifier()
1124
- );
1125
- }
1126
- }, Ni = {
1127
- parse: Oi
1128
- }, it = {
1129
- parse() {
1130
- return this.createSingleNodeList(
1131
- this.Nth()
1132
- );
1133
- }
1134
- }, $i = {
1135
- dir: Ii,
1136
- has: Ae,
1137
- lang: Ni,
1138
- matches: Ae,
1139
- is: Ae,
1140
- "-moz-any": Ae,
1141
- "-webkit-any": Ae,
1142
- where: Ae,
1143
- not: Ae,
1144
- "nth-child": it,
1145
- "nth-last-child": it,
1146
- "nth-last-of-type": it,
1147
- "nth-of-type": it,
1148
- slotted: Kt,
1149
- host: Kt,
1150
- "host-context": Kt
1151
- }, ue = 43, K = 45, ct = 110, Le = !0, Di = !1;
1152
- function ut(t, e) {
1153
- let n = this.tokenStart + t;
1154
- const r = this.charCodeAt(n);
1155
- for ((r === ue || r === K) && (e && this.error("Number sign is not allowed"), n++); n < this.tokenEnd; n++)
1156
- Q(this.charCodeAt(n)) || this.error("Integer is expected", n);
1157
- }
1158
- function Ne(t) {
1159
- return ut.call(this, 0, t);
1160
- }
1161
- function xe(t, e) {
1162
- if (!this.cmpChar(this.tokenStart + t, e)) {
1163
- let n = "";
1164
- switch (e) {
1165
- case ct:
1166
- n = "N is expected";
1167
- break;
1168
- case K:
1169
- n = "HyphenMinus is expected";
1170
- break;
1171
- }
1172
- this.error(n, this.tokenStart + t);
1173
- }
1174
- }
1175
- function Qt() {
1176
- let t = 0, e = 0, n = this.tokenType;
1177
- for (; n === J || n === he; )
1178
- n = this.lookupType(++t);
1179
- if (n !== E)
1180
- if (this.isDelim(ue, t) || this.isDelim(K, t)) {
1181
- e = this.isDelim(ue, t) ? ue : K;
1182
- do
1183
- n = this.lookupType(++t);
1184
- while (n === J || n === he);
1185
- n !== E && (this.skip(t), Ne.call(this, Le));
1186
- } else
1187
- return null;
1188
- return t > 0 && this.skip(t), e === 0 && (n = this.charCodeAt(this.tokenStart), n !== ue && n !== K && this.error("Number sign is expected")), Ne.call(this, e !== 0), e === K ? "-" + this.consume(E) : this.consume(E);
1189
- }
1190
- function Pi() {
1191
- const t = this.tokenStart;
1192
- let e = null, n = null;
1193
- if (this.tokenType === E)
1194
- Ne.call(this, Di), n = this.consume(E);
1195
- else if (this.tokenType === x && this.cmpChar(this.tokenStart, K))
1196
- switch (e = "-1", xe.call(this, 1, ct), this.tokenEnd - this.tokenStart) {
1197
- // -n
1198
- // -n <signed-integer>
1199
- // -n ['+' | '-'] <signless-integer>
1200
- case 2:
1201
- this.next(), n = Qt.call(this);
1202
- break;
1203
- // -n- <signless-integer>
1204
- case 3:
1205
- xe.call(this, 2, K), this.next(), this.skipSC(), Ne.call(this, Le), n = "-" + this.consume(E);
1206
- break;
1207
- // <dashndashdigit-ident>
1208
- default:
1209
- xe.call(this, 2, K), ut.call(this, 3, Le), this.next(), n = this.substrToCursor(t + 2);
1210
- }
1211
- else if (this.tokenType === x || this.isDelim(ue) && this.lookupType(1) === x) {
1212
- let r = 0;
1213
- switch (e = "1", this.isDelim(ue) && (r = 1, this.next()), xe.call(this, 0, ct), this.tokenEnd - this.tokenStart) {
1214
- // '+'? n
1215
- // '+'? n <signed-integer>
1216
- // '+'? n ['+' | '-'] <signless-integer>
1217
- case 1:
1218
- this.next(), n = Qt.call(this);
1219
- break;
1220
- // '+'? n- <signless-integer>
1221
- case 2:
1222
- xe.call(this, 1, K), this.next(), this.skipSC(), Ne.call(this, Le), n = "-" + this.consume(E);
1223
- break;
1224
- // '+'? <ndashdigit-ident>
1225
- default:
1226
- xe.call(this, 1, K), ut.call(this, 2, Le), this.next(), n = this.substrToCursor(t + r + 1);
1227
- }
1228
- } else if (this.tokenType === N) {
1229
- const r = this.charCodeAt(this.tokenStart), s = r === ue || r === K;
1230
- let o = this.tokenStart + s;
1231
- for (; o < this.tokenEnd && Q(this.charCodeAt(o)); o++)
1232
- ;
1233
- o === this.tokenStart + s && this.error("Integer is expected", this.tokenStart + s), xe.call(this, o - this.tokenStart, ct), e = this.substring(t, o), o + 1 === this.tokenEnd ? (this.next(), n = Qt.call(this)) : (xe.call(this, o - this.tokenStart + 1, K), o + 2 === this.tokenEnd ? (this.next(), this.skipSC(), Ne.call(this, Le), n = "-" + this.consume(E)) : (ut.call(this, o - this.tokenStart + 2, Le), this.next(), n = this.substrToCursor(o + 1)));
1234
- } else
1235
- this.error();
1236
- return e !== null && e.charCodeAt(0) === ue && (e = e.substr(1)), n !== null && n.charCodeAt(0) === ue && (n = n.substr(1)), {
1237
- type: "AnPlusB",
1238
- loc: this.getLocation(t, this.tokenStart),
1239
- a: e,
1240
- b: n
1241
- };
1242
- }
1243
- function Mi(t) {
1244
- if (t.a) {
1245
- const e = t.a === "+1" && "n" || t.a === "1" && "n" || t.a === "-1" && "-n" || t.a + "n";
1246
- if (t.b) {
1247
- const n = t.b[0] === "-" || t.b[0] === "+" ? t.b : "+" + t.b;
1248
- this.tokenize(e + n);
1249
- } else
1250
- this.tokenize(e);
1251
- } else
1252
- this.tokenize(t.b);
1253
- }
1254
- const Fi = 36, Pr = 42, ht = 61, zi = 94, ln = 124, Ri = 126;
1255
- function qi() {
1256
- this.eof && this.error("Unexpected end of input");
1257
- const t = this.tokenStart;
1258
- let e = !1;
1259
- return this.isDelim(Pr) ? (e = !0, this.next()) : this.isDelim(ln) || this.eat(x), this.isDelim(ln) ? this.charCodeAt(this.tokenStart + 1) !== ht ? (this.next(), this.eat(x)) : e && this.error("Identifier is expected", this.tokenEnd) : e && this.error("Vertical line is expected"), {
1260
- type: "Identifier",
1261
- loc: this.getLocation(t, this.tokenStart),
1262
- name: this.substrToCursor(t)
1263
- };
1264
- }
1265
- function Bi() {
1266
- const t = this.tokenStart, e = this.charCodeAt(t);
1267
- return e !== ht && // =
1268
- e !== Ri && // ~=
1269
- e !== zi && // ^=
1270
- e !== Fi && // $=
1271
- e !== Pr && // *=
1272
- e !== ln && this.error("Attribute selector (=, ~=, ^=, $=, *=, |=) is expected"), this.next(), e !== ht && (this.isDelim(ht) || this.error("Equal sign is expected"), this.next()), this.substrToCursor(t);
1273
- }
1274
- function ji() {
1275
- const t = this.tokenStart;
1276
- let e, n = null, r = null, s = null;
1277
- return this.eat(St), this.skipSC(), e = qi.call(this), this.skipSC(), this.tokenType !== ft && (this.tokenType !== x && (n = Bi.call(this), this.skipSC(), r = this.tokenType === Pe ? this.String() : this.Identifier(), this.skipSC()), this.tokenType === x && (s = this.consume(x), this.skipSC())), this.eat(ft), {
1278
- type: "AttributeSelector",
1279
- loc: this.getLocation(t, this.tokenStart),
1280
- name: e,
1281
- matcher: n,
1282
- value: r,
1283
- flags: s
1284
- };
1285
- }
1286
- function Ui(t) {
1287
- this.token($, "["), this.node(t.name), t.matcher !== null && (this.tokenize(t.matcher), this.node(t.value)), t.flags !== null && this.token(x, t.flags), this.token($, "]");
1288
- }
1289
- const Gi = 46;
1290
- function Vi() {
1291
- return this.eatDelim(Gi), {
1292
- type: "ClassSelector",
1293
- loc: this.getLocation(this.tokenStart - 1, this.tokenEnd),
1294
- name: this.consume(x)
1295
- };
1296
- }
1297
- function Hi(t) {
1298
- this.token($, "."), this.token(x, t.name);
1299
- }
1300
- const Wi = 43, lr = 47, Ki = 62, Qi = 126;
1301
- function Ji() {
1302
- const t = this.tokenStart;
1303
- let e;
1304
- switch (this.tokenType) {
1305
- case J:
1306
- e = " ";
1307
- break;
1308
- case $:
1309
- switch (this.charCodeAt(this.tokenStart)) {
1310
- case Ki:
1311
- case Wi:
1312
- case Qi:
1313
- this.next();
1314
- break;
1315
- case lr:
1316
- this.next(), this.eatIdent("deep"), this.eatDelim(lr);
1317
- break;
1318
- default:
1319
- this.error("Combinator is expected");
1320
- }
1321
- e = this.substrToCursor(t);
1322
- break;
1323
- }
1324
- return {
1325
- type: "Combinator",
1326
- loc: this.getLocation(t, this.tokenStart),
1327
- name: e
1328
- };
1329
- }
1330
- function Yi(t) {
1331
- this.tokenize(t.name);
1332
- }
1333
- function Xi() {
1334
- return {
1335
- type: "Identifier",
1336
- loc: this.getLocation(this.tokenStart, this.tokenEnd),
1337
- name: this.consume(x)
1338
- };
1339
- }
1340
- function Zi(t) {
1341
- this.token(x, t.name);
1342
- }
1343
- function es() {
1344
- const t = this.tokenStart;
1345
- return this.eat(z), {
1346
- type: "IdSelector",
1347
- loc: this.getLocation(t, this.tokenStart),
1348
- name: this.substrToCursor(t + 1)
1349
- };
1350
- }
1351
- function ts(t) {
1352
- this.token($, "#" + t.name);
1353
- }
1354
- const ns = 38;
1355
- function rs() {
1356
- const t = this.tokenStart;
1357
- return this.eatDelim(ns), {
1358
- type: "NestingSelector",
1359
- loc: this.getLocation(t, this.tokenStart)
1360
- };
1361
- }
1362
- function is() {
1363
- this.token($, "&");
1364
- }
1365
- function ss() {
1366
- this.skipSC();
1367
- const t = this.tokenStart;
1368
- let e = t, n = null, r;
1369
- return this.lookupValue(0, "odd") || this.lookupValue(0, "even") ? r = this.Identifier() : r = this.AnPlusB(), e = this.tokenStart, this.skipSC(), this.lookupValue(0, "of") && (this.next(), n = this.SelectorList(), e = this.tokenStart), {
1370
- type: "Nth",
1371
- loc: this.getLocation(t, e),
1372
- nth: r,
1373
- selector: n
1374
- };
1375
- }
1376
- function os(t) {
1377
- this.node(t.nth), t.selector !== null && (this.token(x, "of"), this.node(t.selector));
1378
- }
1379
- function as() {
1380
- const t = this.tokenStart;
1381
- return this.next(), {
1382
- type: "Operator",
1383
- loc: this.getLocation(t, this.tokenStart),
1384
- value: this.substrToCursor(t)
1385
- };
1386
- }
1387
- function ls(t) {
1388
- this.tokenize(t.value);
1389
- }
1390
- function cs() {
1391
- return {
1392
- type: "Percentage",
1393
- loc: this.getLocation(this.tokenStart, this.tokenEnd),
1394
- value: this.consumeNumber(M)
1395
- };
1396
- }
1397
- function us(t) {
1398
- this.token(M, t.value + "%");
1399
- }
1400
- function hs() {
1401
- const t = this.tokenStart;
1402
- let e = null, n, r;
1403
- return this.eat(te), this.tokenType === D ? (n = this.consumeFunctionName(), r = n.toLowerCase(), this.lookupNonWSType(0) == I ? e = this.createList() : hasOwnProperty.call(this.pseudo, r) ? (this.skipSC(), e = this.pseudo[r].call(this), this.skipSC()) : (e = this.createList(), e.push(
1404
- this.Raw(null, !1)
1405
- )), this.eat(I)) : n = this.consume(x), {
1406
- type: "PseudoClassSelector",
1407
- loc: this.getLocation(t, this.tokenStart),
1408
- name: n,
1409
- children: e
1410
- };
1411
- }
1412
- function fs(t) {
1413
- this.token(te, ":"), t.children === null ? this.token(x, t.name) : (this.token(D, t.name + "("), this.children(t), this.token(I, ")"));
1414
- }
1415
- function ps() {
1416
- const t = this.tokenStart;
1417
- let e = null, n, r;
1418
- return this.eat(te), this.eat(te), this.tokenType === D ? (n = this.consumeFunctionName(), r = n.toLowerCase(), this.lookupNonWSType(0) == I ? e = this.createList() : hasOwnProperty.call(this.pseudo, r) ? (this.skipSC(), e = this.pseudo[r].call(this), this.skipSC()) : (e = this.createList(), e.push(
1419
- this.Raw(null, !1)
1420
- )), this.eat(I)) : n = this.consume(x), {
1421
- type: "PseudoElementSelector",
1422
- loc: this.getLocation(t, this.tokenStart),
1423
- name: n,
1424
- children: e
1425
- };
1426
- }
1427
- function ds(t) {
1428
- this.token(te, ":"), this.token(te, ":"), t.children === null ? this.token(x, t.name) : (this.token(D, t.name + "("), this.children(t), this.token(I, ")"));
1429
- }
1430
- function ms() {
1431
- return this.tokenIndex > 0 && this.lookupType(-1) === J ? this.tokenIndex > 1 ? this.getTokenStart(this.tokenIndex - 1) : this.firstCharOffset : this.tokenStart;
1432
- }
1433
- function gs(t, e) {
1434
- const n = this.getTokenStart(this.tokenIndex);
1435
- let r;
1436
- return this.skipUntilBalanced(this.tokenIndex, t || this.consumeUntilBalanceEnd), e && this.tokenStart > n ? r = ms.call(this) : r = this.tokenStart, {
1437
- type: "Raw",
1438
- loc: this.getLocation(n, r),
1439
- value: this.substring(n, r)
1440
- };
1441
- }
1442
- function ks(t) {
1443
- this.tokenize(t.value);
1444
- }
1445
- function ys() {
1446
- const t = this.readSequence(this.scope.Selector);
1447
- return this.getFirstListNode(t) === null && this.error("Selector is expected"), {
1448
- type: "Selector",
1449
- loc: this.getLocationFromList(t),
1450
- children: t
1451
- };
1452
- }
1453
- function Ss(t) {
1454
- this.children(t);
1455
- }
1456
- function xs() {
1457
- const t = this.createList();
1458
- for (; !this.eof; ) {
1459
- if (t.push(this.Selector()), this.tokenType === Me) {
1460
- this.next();
1461
- continue;
1462
- }
1463
- break;
1464
- }
1465
- return {
1466
- type: "SelectorList",
1467
- loc: this.getLocationFromList(t),
1468
- children: t
1469
- };
1470
- }
1471
- function Cs(t) {
1472
- this.children(t, () => this.token(Me, ","));
1473
- }
1474
- const cn = 92, Mr = 34, bs = 39;
1475
- function ws(t) {
1476
- const e = t.length, n = t.charCodeAt(0), r = n === Mr || n === bs ? 1 : 0, s = r === 1 && e > 1 && t.charCodeAt(e - 1) === n ? e - 2 : e - 1;
1477
- let o = "";
1478
- for (let a = r; a <= s; a++) {
1479
- let c = t.charCodeAt(a);
1480
- if (c === cn) {
1481
- if (a === s) {
1482
- a !== e - 1 && (o = t.substr(a + 1));
1483
- break;
1484
- }
1485
- if (c = t.charCodeAt(++a), ge(cn, c)) {
1486
- const u = a - 1, i = Ge(t, u);
1487
- a = i - 1, o += li(t.substring(u + 1, i));
1488
- } else
1489
- c === 13 && t.charCodeAt(a + 1) === 10 && a++;
1490
- } else
1491
- o += t[a];
1492
- }
1493
- return o;
1494
- }
1495
- function vs(t, e) {
1496
- const n = '"', r = Mr;
1497
- let s = "", o = !1;
1498
- for (let a = 0; a < t.length; a++) {
1499
- const c = t.charCodeAt(a);
1500
- if (c === 0) {
1501
- s += "�";
1502
- continue;
1503
- }
1504
- if (c <= 31 || c === 127) {
1505
- s += "\\" + c.toString(16), o = !0;
1506
- continue;
1507
- }
1508
- c === r || c === cn ? (s += "\\" + t.charAt(a), o = !1) : (o && (Ue(c) || He(c)) && (s += " "), s += t.charAt(a), o = !1);
1509
- }
1510
- return n + s + n;
1511
- }
1512
- function As() {
1513
- return {
1514
- type: "String",
1515
- loc: this.getLocation(this.tokenStart, this.tokenEnd),
1516
- value: ws(this.consume(Pe))
1517
- };
1518
- }
1519
- function Ls(t) {
1520
- this.token(Pe, vs(t.value));
1521
- }
1522
- const Es = 42, cr = 124;
1523
- function Jt() {
1524
- this.tokenType !== x && this.isDelim(Es) === !1 && this.error("Identifier or asterisk is expected"), this.next();
1525
- }
1526
- function _s() {
1527
- const t = this.tokenStart;
1528
- return this.isDelim(cr) ? (this.next(), Jt.call(this)) : (Jt.call(this), this.isDelim(cr) && (this.next(), Jt.call(this))), {
1529
- type: "TypeSelector",
1530
- loc: this.getLocation(t, this.tokenStart),
1531
- name: this.substrToCursor(t)
1532
- };
1533
- }
1534
- function Ts(t) {
1535
- this.tokenize(t.name);
1536
- }
1537
- const Os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1538
- __proto__: null,
1539
- AnPlusB: Pi,
1540
- AttributeSelector: ji,
1541
- ClassSelector: Vi,
1542
- Combinator: Ji,
1543
- IdSelector: es,
1544
- Identifier: Xi,
1545
- NestingSelector: rs,
1546
- Nth: ss,
1547
- Operator: as,
1548
- Percentage: cs,
1549
- PseudoClassSelector: hs,
1550
- PseudoElementSelector: ps,
1551
- Raw: gs,
1552
- Selector: ys,
1553
- SelectorList: xs,
1554
- String: As,
1555
- TypeSelector: _s
1556
- }, Symbol.toStringTag, { value: "Module" })), Is = {
1557
- parseContext: {
1558
- default: "SelectorList",
1559
- selectorList: "SelectorList",
1560
- selector: "Selector"
1561
- },
1562
- scope: { Selector: Ti },
1563
- atrule: {},
1564
- pseudo: $i,
1565
- node: Os
1566
- }, ur = yi(Is);
1567
- var Yt = {}, st = {}, ot = {}, hr;
1568
- function Ns() {
1569
- if (hr) return ot;
1570
- hr = 1;
1571
- var t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
1572
- return ot.encode = function(e) {
1573
- if (0 <= e && e < t.length)
1574
- return t[e];
1575
- throw new TypeError("Must be between 0 and 63: " + e);
1576
- }, ot.decode = function(e) {
1577
- var n = 65, r = 90, s = 97, o = 122, a = 48, c = 57, u = 43, i = 47, l = 26, d = 52;
1578
- return n <= e && e <= r ? e - n : s <= e && e <= o ? e - s + l : a <= e && e <= c ? e - a + d : e == u ? 62 : e == i ? 63 : -1;
1579
- }, ot;
1580
- }
1581
- var fr;
1582
- function $s() {
1583
- if (fr) return st;
1584
- fr = 1;
1585
- var t = Ns(), e = 5, n = 1 << e, r = n - 1, s = n;
1586
- function o(c) {
1587
- return c < 0 ? (-c << 1) + 1 : (c << 1) + 0;
1588
- }
1589
- function a(c) {
1590
- var u = (c & 1) === 1, i = c >> 1;
1591
- return u ? -i : i;
1592
- }
1593
- return st.encode = function(u) {
1594
- var i = "", l, d = o(u);
1595
- do
1596
- l = d & r, d >>>= e, d > 0 && (l |= s), i += t.encode(l);
1597
- while (d > 0);
1598
- return i;
1599
- }, st.decode = function(u, i, l) {
1600
- var d = u.length, y = 0, g = 0, S, T;
1601
- do {
1602
- if (i >= d)
1603
- throw new Error("Expected more digits in base 64 VLQ value.");
1604
- if (T = t.decode(u.charCodeAt(i++)), T === -1)
1605
- throw new Error("Invalid base64 digit: " + u.charAt(i - 1));
1606
- S = !!(T & s), T &= r, y = y + (T << g), g += e;
1607
- } while (S);
1608
- l.value = a(y), l.rest = i;
1609
- }, st;
1610
- }
1611
- var Xt = {}, pr;
1612
- function gn() {
1613
- return pr || (pr = 1, function(t) {
1614
- function e(h, f, k) {
1615
- if (f in h)
1616
- return h[f];
1617
- if (arguments.length === 3)
1618
- return k;
1619
- throw new Error('"' + f + '" is a required argument.');
1620
- }
1621
- t.getArg = e;
1622
- var n = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/, r = /^data:.+\,.+$/;
1623
- function s(h) {
1624
- var f = h.match(n);
1625
- return f ? {
1626
- scheme: f[1],
1627
- auth: f[2],
1628
- host: f[3],
1629
- port: f[4],
1630
- path: f[5]
1631
- } : null;
1632
- }
1633
- t.urlParse = s;
1634
- function o(h) {
1635
- var f = "";
1636
- return h.scheme && (f += h.scheme + ":"), f += "//", h.auth && (f += h.auth + "@"), h.host && (f += h.host), h.port && (f += ":" + h.port), h.path && (f += h.path), f;
1637
- }
1638
- t.urlGenerate = o;
1639
- var a = 32;
1640
- function c(h) {
1641
- var f = [];
1642
- return function(k) {
1643
- for (var p = 0; p < f.length; p++)
1644
- if (f[p].input === k) {
1645
- var Z = f[0];
1646
- return f[0] = f[p], f[p] = Z, f[0].result;
1647
- }
1648
- var j = h(k);
1649
- return f.unshift({
1650
- input: k,
1651
- result: j
1652
- }), f.length > a && f.pop(), j;
1653
- };
1654
- }
1655
- var u = c(function(f) {
1656
- var k = f, p = s(f);
1657
- if (p) {
1658
- if (!p.path)
1659
- return f;
1660
- k = p.path;
1661
- }
1662
- for (var Z = t.isAbsolute(k), j = [], ke = 0, R = 0; ; )
1663
- if (ke = R, R = k.indexOf("/", ke), R === -1) {
1664
- j.push(k.slice(ke));
1665
- break;
1666
- } else
1667
- for (j.push(k.slice(ke, R)); R < k.length && k[R] === "/"; )
1668
- R++;
1669
- for (var ye, de = 0, R = j.length - 1; R >= 0; R--)
1670
- ye = j[R], ye === "." ? j.splice(R, 1) : ye === ".." ? de++ : de > 0 && (ye === "" ? (j.splice(R + 1, de), de = 0) : (j.splice(R, 2), de--));
1671
- return k = j.join("/"), k === "" && (k = Z ? "/" : "."), p ? (p.path = k, o(p)) : k;
1672
- });
1673
- t.normalize = u;
1674
- function i(h, f) {
1675
- h === "" && (h = "."), f === "" && (f = ".");
1676
- var k = s(f), p = s(h);
1677
- if (p && (h = p.path || "/"), k && !k.scheme)
1678
- return p && (k.scheme = p.scheme), o(k);
1679
- if (k || f.match(r))
1680
- return f;
1681
- if (p && !p.host && !p.path)
1682
- return p.host = f, o(p);
1683
- var Z = f.charAt(0) === "/" ? f : u(h.replace(/\/+$/, "") + "/" + f);
1684
- return p ? (p.path = Z, o(p)) : Z;
1685
- }
1686
- t.join = i, t.isAbsolute = function(h) {
1687
- return h.charAt(0) === "/" || n.test(h);
1688
- };
1689
- function l(h, f) {
1690
- h === "" && (h = "."), h = h.replace(/\/$/, "");
1691
- for (var k = 0; f.indexOf(h + "/") !== 0; ) {
1692
- var p = h.lastIndexOf("/");
1693
- if (p < 0 || (h = h.slice(0, p), h.match(/^([^\/]+:\/)?\/*$/)))
1694
- return f;
1695
- ++k;
1696
- }
1697
- return Array(k + 1).join("../") + f.substr(h.length + 1);
1698
- }
1699
- t.relative = l;
1700
- var d = function() {
1701
- var h = /* @__PURE__ */ Object.create(null);
1702
- return !("__proto__" in h);
1703
- }();
1704
- function y(h) {
1705
- return h;
1706
- }
1707
- function g(h) {
1708
- return T(h) ? "$" + h : h;
1709
- }
1710
- t.toSetString = d ? y : g;
1711
- function S(h) {
1712
- return T(h) ? h.slice(1) : h;
1713
- }
1714
- t.fromSetString = d ? y : S;
1715
- function T(h) {
1716
- if (!h)
1717
- return !1;
1718
- var f = h.length;
1719
- if (f < 9 || h.charCodeAt(f - 1) !== 95 || h.charCodeAt(f - 2) !== 95 || h.charCodeAt(f - 3) !== 111 || h.charCodeAt(f - 4) !== 116 || h.charCodeAt(f - 5) !== 111 || h.charCodeAt(f - 6) !== 114 || h.charCodeAt(f - 7) !== 112 || h.charCodeAt(f - 8) !== 95 || h.charCodeAt(f - 9) !== 95)
1720
- return !1;
1721
- for (var k = f - 10; k >= 0; k--)
1722
- if (h.charCodeAt(k) !== 36)
1723
- return !1;
1724
- return !0;
1725
- }
1726
- function P(h, f, k) {
1727
- var p = X(h.source, f.source);
1728
- return p !== 0 || (p = h.originalLine - f.originalLine, p !== 0) || (p = h.originalColumn - f.originalColumn, p !== 0 || k) || (p = h.generatedColumn - f.generatedColumn, p !== 0) || (p = h.generatedLine - f.generatedLine, p !== 0) ? p : X(h.name, f.name);
1729
- }
1730
- t.compareByOriginalPositions = P;
1731
- function G(h, f, k) {
1732
- var p;
1733
- return p = h.originalLine - f.originalLine, p !== 0 || (p = h.originalColumn - f.originalColumn, p !== 0 || k) || (p = h.generatedColumn - f.generatedColumn, p !== 0) || (p = h.generatedLine - f.generatedLine, p !== 0) ? p : X(h.name, f.name);
1734
- }
1735
- t.compareByOriginalPositionsNoSource = G;
1736
- function Y(h, f, k) {
1737
- var p = h.generatedLine - f.generatedLine;
1738
- return p !== 0 || (p = h.generatedColumn - f.generatedColumn, p !== 0 || k) || (p = X(h.source, f.source), p !== 0) || (p = h.originalLine - f.originalLine, p !== 0) || (p = h.originalColumn - f.originalColumn, p !== 0) ? p : X(h.name, f.name);
1739
- }
1740
- t.compareByGeneratedPositionsDeflated = Y;
1741
- function be(h, f, k) {
1742
- var p = h.generatedColumn - f.generatedColumn;
1743
- return p !== 0 || k || (p = X(h.source, f.source), p !== 0) || (p = h.originalLine - f.originalLine, p !== 0) || (p = h.originalColumn - f.originalColumn, p !== 0) ? p : X(h.name, f.name);
1744
- }
1745
- t.compareByGeneratedPositionsDeflatedNoLine = be;
1746
- function X(h, f) {
1747
- return h === f ? 0 : h === null ? 1 : f === null ? -1 : h > f ? 1 : -1;
1748
- }
1749
- function Ke(h, f) {
1750
- var k = h.generatedLine - f.generatedLine;
1751
- return k !== 0 || (k = h.generatedColumn - f.generatedColumn, k !== 0) || (k = X(h.source, f.source), k !== 0) || (k = h.originalLine - f.originalLine, k !== 0) || (k = h.originalColumn - f.originalColumn, k !== 0) ? k : X(h.name, f.name);
1752
- }
1753
- t.compareByGeneratedPositionsInflated = Ke;
1754
- function Qe(h) {
1755
- return JSON.parse(h.replace(/^\)]}'[^\n]*\n/, ""));
1756
- }
1757
- t.parseSourceMapInput = Qe;
1758
- function Je(h, f, k) {
1759
- if (f = f || "", h && (h[h.length - 1] !== "/" && f[0] !== "/" && (h += "/"), f = h + f), k) {
1760
- var p = s(k);
1761
- if (!p)
1762
- throw new Error("sourceMapURL could not be parsed");
1763
- if (p.path) {
1764
- var Z = p.path.lastIndexOf("/");
1765
- Z >= 0 && (p.path = p.path.substring(0, Z + 1));
1766
- }
1767
- f = i(o(p), f);
1768
- }
1769
- return u(f);
1770
- }
1771
- t.computeSourceURL = Je;
1772
- }(Xt)), Xt;
1773
- }
1774
- var Zt = {}, dr;
1775
- function Ds() {
1776
- if (dr) return Zt;
1777
- dr = 1;
1778
- var t = gn(), e = Object.prototype.hasOwnProperty, n = typeof Map < "u";
1779
- function r() {
1780
- this._array = [], this._set = n ? /* @__PURE__ */ new Map() : /* @__PURE__ */ Object.create(null);
1781
- }
1782
- return r.fromArray = function(o, a) {
1783
- for (var c = new r(), u = 0, i = o.length; u < i; u++)
1784
- c.add(o[u], a);
1785
- return c;
1786
- }, r.prototype.size = function() {
1787
- return n ? this._set.size : Object.getOwnPropertyNames(this._set).length;
1788
- }, r.prototype.add = function(o, a) {
1789
- var c = n ? o : t.toSetString(o), u = n ? this.has(o) : e.call(this._set, c), i = this._array.length;
1790
- (!u || a) && this._array.push(o), u || (n ? this._set.set(o, i) : this._set[c] = i);
1791
- }, r.prototype.has = function(o) {
1792
- if (n)
1793
- return this._set.has(o);
1794
- var a = t.toSetString(o);
1795
- return e.call(this._set, a);
1796
- }, r.prototype.indexOf = function(o) {
1797
- if (n) {
1798
- var a = this._set.get(o);
1799
- if (a >= 0)
1800
- return a;
1801
- } else {
1802
- var c = t.toSetString(o);
1803
- if (e.call(this._set, c))
1804
- return this._set[c];
1805
- }
1806
- throw new Error('"' + o + '" is not in the set.');
1807
- }, r.prototype.at = function(o) {
1808
- if (o >= 0 && o < this._array.length)
1809
- return this._array[o];
1810
- throw new Error("No element indexed by " + o);
1811
- }, r.prototype.toArray = function() {
1812
- return this._array.slice();
1813
- }, Zt.ArraySet = r, Zt;
1814
- }
1815
- var en = {}, mr;
1816
- function Ps() {
1817
- if (mr) return en;
1818
- mr = 1;
1819
- var t = gn();
1820
- function e(r, s) {
1821
- var o = r.generatedLine, a = s.generatedLine, c = r.generatedColumn, u = s.generatedColumn;
1822
- return a > o || a == o && u >= c || t.compareByGeneratedPositionsInflated(r, s) <= 0;
1823
- }
1824
- function n() {
1825
- this._array = [], this._sorted = !0, this._last = { generatedLine: -1, generatedColumn: 0 };
1826
- }
1827
- return n.prototype.unsortedForEach = function(s, o) {
1828
- this._array.forEach(s, o);
1829
- }, n.prototype.add = function(s) {
1830
- e(this._last, s) ? (this._last = s, this._array.push(s)) : (this._sorted = !1, this._array.push(s));
1831
- }, n.prototype.toArray = function() {
1832
- return this._sorted || (this._array.sort(t.compareByGeneratedPositionsInflated), this._sorted = !0), this._array;
1833
- }, en.MappingList = n, en;
1834
- }
1835
- var gr;
1836
- function Ms() {
1837
- if (gr) return Yt;
1838
- gr = 1;
1839
- var t = $s(), e = gn(), n = Ds().ArraySet, r = Ps().MappingList;
1840
- function s(o) {
1841
- o || (o = {}), this._file = e.getArg(o, "file", null), this._sourceRoot = e.getArg(o, "sourceRoot", null), this._skipValidation = e.getArg(o, "skipValidation", !1), this._ignoreInvalidMapping = e.getArg(o, "ignoreInvalidMapping", !1), this._sources = new n(), this._names = new n(), this._mappings = new r(), this._sourcesContents = null;
1842
- }
1843
- return s.prototype._version = 3, s.fromSourceMap = function(a, c) {
1844
- var u = a.sourceRoot, i = new s(Object.assign(c || {}, {
1845
- file: a.file,
1846
- sourceRoot: u
1847
- }));
1848
- return a.eachMapping(function(l) {
1849
- var d = {
1850
- generated: {
1851
- line: l.generatedLine,
1852
- column: l.generatedColumn
1853
- }
1854
- };
1855
- l.source != null && (d.source = l.source, u != null && (d.source = e.relative(u, d.source)), d.original = {
1856
- line: l.originalLine,
1857
- column: l.originalColumn
1858
- }, l.name != null && (d.name = l.name)), i.addMapping(d);
1859
- }), a.sources.forEach(function(l) {
1860
- var d = l;
1861
- u !== null && (d = e.relative(u, l)), i._sources.has(d) || i._sources.add(d);
1862
- var y = a.sourceContentFor(l);
1863
- y != null && i.setSourceContent(l, y);
1864
- }), i;
1865
- }, s.prototype.addMapping = function(a) {
1866
- var c = e.getArg(a, "generated"), u = e.getArg(a, "original", null), i = e.getArg(a, "source", null), l = e.getArg(a, "name", null);
1867
- !this._skipValidation && this._validateMapping(c, u, i, l) === !1 || (i != null && (i = String(i), this._sources.has(i) || this._sources.add(i)), l != null && (l = String(l), this._names.has(l) || this._names.add(l)), this._mappings.add({
1868
- generatedLine: c.line,
1869
- generatedColumn: c.column,
1870
- originalLine: u != null && u.line,
1871
- originalColumn: u != null && u.column,
1872
- source: i,
1873
- name: l
1874
- }));
1875
- }, s.prototype.setSourceContent = function(a, c) {
1876
- var u = a;
1877
- this._sourceRoot != null && (u = e.relative(this._sourceRoot, u)), c != null ? (this._sourcesContents || (this._sourcesContents = /* @__PURE__ */ Object.create(null)), this._sourcesContents[e.toSetString(u)] = c) : this._sourcesContents && (delete this._sourcesContents[e.toSetString(u)], Object.keys(this._sourcesContents).length === 0 && (this._sourcesContents = null));
1878
- }, s.prototype.applySourceMap = function(a, c, u) {
1879
- var i = c;
1880
- if (c == null) {
1881
- if (a.file == null)
1882
- throw new Error(
1883
- `SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`
1884
- );
1885
- i = a.file;
1886
- }
1887
- var l = this._sourceRoot;
1888
- l != null && (i = e.relative(l, i));
1889
- var d = new n(), y = new n();
1890
- this._mappings.unsortedForEach(function(g) {
1891
- if (g.source === i && g.originalLine != null) {
1892
- var S = a.originalPositionFor({
1893
- line: g.originalLine,
1894
- column: g.originalColumn
1895
- });
1896
- S.source != null && (g.source = S.source, u != null && (g.source = e.join(u, g.source)), l != null && (g.source = e.relative(l, g.source)), g.originalLine = S.line, g.originalColumn = S.column, S.name != null && (g.name = S.name));
1897
- }
1898
- var T = g.source;
1899
- T != null && !d.has(T) && d.add(T);
1900
- var P = g.name;
1901
- P != null && !y.has(P) && y.add(P);
1902
- }, this), this._sources = d, this._names = y, a.sources.forEach(function(g) {
1903
- var S = a.sourceContentFor(g);
1904
- S != null && (u != null && (g = e.join(u, g)), l != null && (g = e.relative(l, g)), this.setSourceContent(g, S));
1905
- }, this);
1906
- }, s.prototype._validateMapping = function(a, c, u, i) {
1907
- if (c && typeof c.line != "number" && typeof c.column != "number") {
1908
- var l = "original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.";
1909
- if (this._ignoreInvalidMapping)
1910
- return typeof console < "u" && console.warn && console.warn(l), !1;
1911
- throw new Error(l);
1912
- }
1913
- if (!(a && "line" in a && "column" in a && a.line > 0 && a.column >= 0 && !c && !u && !i)) {
1914
- if (a && "line" in a && "column" in a && c && "line" in c && "column" in c && a.line > 0 && a.column >= 0 && c.line > 0 && c.column >= 0 && u)
1915
- return;
1916
- var l = "Invalid mapping: " + JSON.stringify({
1917
- generated: a,
1918
- source: u,
1919
- original: c,
1920
- name: i
1921
- });
1922
- if (this._ignoreInvalidMapping)
1923
- return typeof console < "u" && console.warn && console.warn(l), !1;
1924
- throw new Error(l);
1925
- }
1926
- }, s.prototype._serializeMappings = function() {
1927
- for (var a = 0, c = 1, u = 0, i = 0, l = 0, d = 0, y = "", g, S, T, P, G = this._mappings.toArray(), Y = 0, be = G.length; Y < be; Y++) {
1928
- if (S = G[Y], g = "", S.generatedLine !== c)
1929
- for (a = 0; S.generatedLine !== c; )
1930
- g += ";", c++;
1931
- else if (Y > 0) {
1932
- if (!e.compareByGeneratedPositionsInflated(S, G[Y - 1]))
1933
- continue;
1934
- g += ",";
1935
- }
1936
- g += t.encode(S.generatedColumn - a), a = S.generatedColumn, S.source != null && (P = this._sources.indexOf(S.source), g += t.encode(P - d), d = P, g += t.encode(S.originalLine - 1 - i), i = S.originalLine - 1, g += t.encode(S.originalColumn - u), u = S.originalColumn, S.name != null && (T = this._names.indexOf(S.name), g += t.encode(T - l), l = T)), y += g;
1937
- }
1938
- return y;
1939
- }, s.prototype._generateSourcesContent = function(a, c) {
1940
- return a.map(function(u) {
1941
- if (!this._sourcesContents)
1942
- return null;
1943
- c != null && (u = e.relative(c, u));
1944
- var i = e.toSetString(u);
1945
- return Object.prototype.hasOwnProperty.call(this._sourcesContents, i) ? this._sourcesContents[i] : null;
1946
- }, this);
1947
- }, s.prototype.toJSON = function() {
1948
- var a = {
1949
- version: this._version,
1950
- sources: this._sources.toArray(),
1951
- names: this._names.toArray(),
1952
- mappings: this._serializeMappings()
1953
- };
1954
- return this._file != null && (a.file = this._file), this._sourceRoot != null && (a.sourceRoot = this._sourceRoot), this._sourcesContents && (a.sourcesContent = this._generateSourcesContent(a.sources, a.sourceRoot)), a;
1955
- }, s.prototype.toString = function() {
1956
- return JSON.stringify(this.toJSON());
1957
- }, Yt.SourceMapGenerator = s, Yt;
1958
- }
1959
- var Fs = Ms();
1960
- const kr = /* @__PURE__ */ new Set(["Atrule", "Selector", "Declaration"]);
1961
- function zs(t) {
1962
- const e = new Fs.SourceMapGenerator(), n = {
1963
- line: 1,
1964
- column: 0
1965
- }, r = {
1966
- line: 0,
1967
- // should be zero to add first mapping
1968
- column: 0
1969
- }, s = {
1970
- line: 1,
1971
- column: 0
1972
- }, o = {
1973
- generated: s
1974
- };
1975
- let a = 1, c = 0, u = !1;
1976
- const i = t.node;
1977
- t.node = function(y) {
1978
- if (y.loc && y.loc.start && kr.has(y.type)) {
1979
- const g = y.loc.start.line, S = y.loc.start.column - 1;
1980
- (r.line !== g || r.column !== S) && (r.line = g, r.column = S, n.line = a, n.column = c, u && (u = !1, (n.line !== s.line || n.column !== s.column) && e.addMapping(o)), u = !0, e.addMapping({
1981
- source: y.loc.source,
1982
- original: r,
1983
- generated: n
1984
- }));
1985
- }
1986
- i.call(this, y), u && kr.has(y.type) && (s.line = a, s.column = c);
1987
- };
1988
- const l = t.emit;
1989
- t.emit = function(y, g, S) {
1990
- for (let T = 0; T < y.length; T++)
1991
- y.charCodeAt(T) === 10 ? (a++, c = 0) : c++;
1992
- l(y, g, S);
1993
- };
1994
- const d = t.result;
1995
- return t.result = function() {
1996
- return u && e.addMapping(o), {
1997
- css: d(),
1998
- map: e
1999
- };
2000
- }, t;
2001
- }
2002
- const Rs = 43, qs = 45, tn = (t, e) => {
2003
- if (t === $ && (t = e), typeof t == "string") {
2004
- const n = t.charCodeAt(0);
2005
- return n > 127 ? 32768 : n << 8;
2006
- }
2007
- return t;
2008
- }, Fr = [
2009
- [x, x],
2010
- [x, D],
2011
- [x, ie],
2012
- [x, se],
2013
- [x, "-"],
2014
- [x, E],
2015
- [x, M],
2016
- [x, N],
2017
- [x, oe],
2018
- [x, ne],
2019
- [U, x],
2020
- [U, D],
2021
- [U, ie],
2022
- [U, se],
2023
- [U, "-"],
2024
- [U, E],
2025
- [U, M],
2026
- [U, N],
2027
- [U, oe],
2028
- [z, x],
2029
- [z, D],
2030
- [z, ie],
2031
- [z, se],
2032
- [z, "-"],
2033
- [z, E],
2034
- [z, M],
2035
- [z, N],
2036
- [z, oe],
2037
- [N, x],
2038
- [N, D],
2039
- [N, ie],
2040
- [N, se],
2041
- [N, "-"],
2042
- [N, E],
2043
- [N, M],
2044
- [N, N],
2045
- [N, oe],
2046
- ["#", x],
2047
- ["#", D],
2048
- ["#", ie],
2049
- ["#", se],
2050
- ["#", "-"],
2051
- ["#", E],
2052
- ["#", M],
2053
- ["#", N],
2054
- ["#", oe],
2055
- // https://github.com/w3c/csswg-drafts/pull/6874
2056
- ["-", x],
2057
- ["-", D],
2058
- ["-", ie],
2059
- ["-", se],
2060
- ["-", "-"],
2061
- ["-", E],
2062
- ["-", M],
2063
- ["-", N],
2064
- ["-", oe],
2065
- // https://github.com/w3c/csswg-drafts/pull/6874
2066
- [E, x],
2067
- [E, D],
2068
- [E, ie],
2069
- [E, se],
2070
- [E, E],
2071
- [E, M],
2072
- [E, N],
2073
- [E, "%"],
2074
- [E, oe],
2075
- // https://github.com/w3c/csswg-drafts/pull/6874
2076
- ["@", x],
2077
- ["@", D],
2078
- ["@", ie],
2079
- ["@", se],
2080
- ["@", "-"],
2081
- ["@", oe],
2082
- // https://github.com/w3c/csswg-drafts/pull/6874
2083
- [".", E],
2084
- [".", M],
2085
- [".", N],
2086
- ["+", E],
2087
- ["+", M],
2088
- ["+", N],
2089
- ["/", "*"]
2090
- ], Bs = Fr.concat([
2091
- [x, z],
2092
- [N, z],
2093
- [z, z],
2094
- [U, ne],
2095
- [U, Pe],
2096
- [U, te],
2097
- [M, M],
2098
- [M, N],
2099
- [M, D],
2100
- [M, "-"],
2101
- [I, x],
2102
- [I, D],
2103
- [I, M],
2104
- [I, N],
2105
- [I, z],
2106
- [I, "-"]
2107
- ]);
2108
- function zr(t) {
2109
- const e = new Set(
2110
- t.map(([n, r]) => tn(n) << 16 | tn(r))
2111
- );
2112
- return function(n, r, s) {
2113
- const o = tn(r, s), a = s.charCodeAt(0);
2114
- return (a === qs && r !== x && r !== D && r !== oe || a === Rs ? e.has(n << 16 | a << 8) : e.has(n << 16 | o)) && this.emit(" ", J, !0), o;
2115
- };
2116
- }
2117
- const js = zr(Fr), Rr = zr(Bs), yr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2118
- __proto__: null,
2119
- safe: Rr,
2120
- spec: js
2121
- }, Symbol.toStringTag, { value: "Module" })), Us = 92;
2122
- function Gs(t, e) {
2123
- if (typeof e == "function") {
2124
- let n = null;
2125
- t.children.forEach((r) => {
2126
- n !== null && e.call(this, n), this.node(r), n = r;
2127
- });
2128
- return;
2129
- }
2130
- t.children.forEach(this.node, this);
2131
- }
2132
- function Vs(t) {
2133
- Dr(t, (e, n, r) => {
2134
- this.token(e, t.slice(n, r));
2135
- });
2136
- }
2137
- function Hs(t) {
2138
- const e = /* @__PURE__ */ new Map();
2139
- for (let [n, r] of Object.entries(t.node))
2140
- typeof (r.generate || r) == "function" && e.set(n, r.generate || r);
2141
- return function(n, r) {
2142
- let s = "", o = 0, a = {
2143
- node(u) {
2144
- if (e.has(u.type))
2145
- e.get(u.type).call(c, u);
2146
- else
2147
- throw new Error("Unknown node type: " + u.type);
2148
- },
2149
- tokenBefore: Rr,
2150
- token(u, i) {
2151
- o = this.tokenBefore(o, u, i), this.emit(i, u, !1), u === $ && i.charCodeAt(0) === Us && this.emit(`
2152
- `, J, !0);
2153
- },
2154
- emit(u) {
2155
- s += u;
2156
- },
2157
- result() {
2158
- return s;
2159
- }
2160
- };
2161
- r && (typeof r.decorator == "function" && (a = r.decorator(a)), r.sourceMap && (a = zs(a)), r.mode in yr && (a.tokenBefore = yr[r.mode]));
2162
- const c = {
2163
- node: (u) => a.node(u),
2164
- children: Gs,
2165
- token: (u, i) => a.token(u, i),
2166
- tokenize: Vs
2167
- };
2168
- return a.node(n), a.result();
2169
- };
2170
- }
2171
- function Ws(t) {
2172
- this.token(U, "@" + t.name), t.prelude !== null && this.node(t.prelude), t.block ? this.node(t.block) : this.token(yt, ";");
2173
- }
2174
- function Ks(t) {
2175
- this.children(t);
2176
- }
2177
- function Qs(t) {
2178
- this.token(fn, "{"), this.children(t, (e) => {
2179
- e.type === "Declaration" && this.token(yt, ";");
2180
- }), this.token(pn, "}");
2181
- }
2182
- function Js(t) {
2183
- this.token($, "["), this.children(t), this.token($, "]");
2184
- }
2185
- function Ys() {
2186
- this.token(oe, "-->");
2187
- }
2188
- function Xs() {
2189
- this.token(Lr, "<!--");
2190
- }
2191
- function Zs(t) {
2192
- this.token(he, "/*" + t.value + "*/");
2193
- }
2194
- function eo(t) {
2195
- t.children.forEach((e) => {
2196
- e.type === "Condition" ? (this.token(ne, "("), this.node(e), this.token(I, ")")) : this.node(e);
2197
- });
2198
- }
2199
- function to(t) {
2200
- this.token(x, t.property), this.token(te, ":"), this.node(t.value), t.important && (this.token($, "!"), this.token(x, t.important === !0 ? "important" : t.important));
2201
- }
2202
- function no(t) {
2203
- this.children(t, (e) => {
2204
- e.type === "Declaration" && this.token(yt, ";");
2205
- });
2206
- }
2207
- function ro(t) {
2208
- this.token(N, t.value + t.unit);
2209
- }
2210
- function io(t) {
2211
- this.token(ne, "("), this.token(x, t.name), t.value !== null && (this.token(te, ":"), this.node(t.value)), this.token(I, ")");
2212
- }
2213
- function so(t) {
2214
- this.token(D, t.feature + "("), this.node(t.value), this.token(I, ")");
2215
- }
2216
- function oo(t) {
2217
- this.token(ne, "("), this.node(t.left), this.tokenize(t.leftComparison), this.node(t.middle), t.right && (this.tokenize(t.rightComparison), this.node(t.right)), this.token(I, ")");
2218
- }
2219
- function ao(t) {
2220
- this.token(D, t.name + "("), this.children(t), this.token(I, ")");
2221
- }
2222
- function lo(t) {
2223
- t.function ? this.token(D, t.function + "(") : this.token(ne, "("), this.children(t), this.token(I, ")");
2224
- }
2225
- function co(t) {
2226
- this.token(z, "#" + t.value);
2227
- }
2228
- function uo(t) {
2229
- this.tokenize(t.name);
2230
- }
2231
- function ho(t) {
2232
- this.children(t, () => this.token(Me, ","));
2233
- }
2234
- function fo(t) {
2235
- t.mediaType ? (t.modifier && this.token(x, t.modifier), this.token(x, t.mediaType), t.condition && (this.token(x, "and"), this.node(t.condition))) : t.condition && this.node(t.condition);
2236
- }
2237
- function po(t) {
2238
- this.children(t, () => this.token(Me, ","));
2239
- }
2240
- function mo(t) {
2241
- this.token(E, t.value);
2242
- }
2243
- function go(t) {
2244
- this.token(ne, "("), this.children(t), this.token(I, ")");
2245
- }
2246
- function ko(t) {
2247
- this.node(t.left), this.token($, "/"), t.right ? this.node(t.right) : this.node(E, 1);
2248
- }
2249
- function yo(t) {
2250
- this.node(t.prelude), this.node(t.block);
2251
- }
2252
- function So(t) {
2253
- t.root && (this.token(ne, "("), this.node(t.root), this.token(I, ")")), t.limit && (this.token(x, "to"), this.token(ne, "("), this.node(t.limit), this.token(I, ")"));
2254
- }
2255
- function xo(t) {
2256
- this.children(t);
2257
- }
2258
- function Co(t) {
2259
- this.token(ne, "("), this.node(t.declaration), this.token(I, ")");
2260
- }
2261
- function bo(t) {
2262
- this.tokenize(t.value);
2263
- }
2264
- const wo = 32, vo = 92, Ao = 34, Lo = 39, Eo = 40, _o = 41;
2265
- function To(t) {
2266
- let e = "", n = !1;
2267
- for (let r = 0; r < t.length; r++) {
2268
- const s = t.charCodeAt(r);
2269
- if (s === 0) {
2270
- e += "�";
2271
- continue;
2272
- }
2273
- if (s <= 31 || s === 127) {
2274
- e += "\\" + s.toString(16), n = !0;
2275
- continue;
2276
- }
2277
- s === wo || s === vo || s === Ao || s === Lo || s === Eo || s === _o ? (e += "\\" + t.charAt(r), n = !1) : (n && Ue(s) && (e += " "), e += t.charAt(r), n = !1);
2278
- }
2279
- return "url(" + e + ")";
2280
- }
2281
- function Oo(t) {
2282
- this.token(ie, To(t.value));
2283
- }
2284
- function Io(t) {
2285
- this.children(t);
2286
- }
2287
- function No(t) {
2288
- this.token(J, t.value);
2289
- }
2290
- const $o = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2291
- __proto__: null,
2292
- AnPlusB: Mi,
2293
- Atrule: Ws,
2294
- AtrulePrelude: Ks,
2295
- AttributeSelector: Ui,
2296
- Block: Qs,
2297
- Brackets: Js,
2298
- CDC: Ys,
2299
- CDO: Xs,
2300
- ClassSelector: Hi,
2301
- Combinator: Yi,
2302
- Comment: Zs,
2303
- Condition: eo,
2304
- Declaration: to,
2305
- DeclarationList: no,
2306
- Dimension: ro,
2307
- Feature: io,
2308
- FeatureFunction: so,
2309
- FeatureRange: oo,
2310
- Function: ao,
2311
- GeneralEnclosed: lo,
2312
- Hash: co,
2313
- IdSelector: ts,
2314
- Identifier: Zi,
2315
- Layer: uo,
2316
- LayerList: ho,
2317
- MediaQuery: fo,
2318
- MediaQueryList: po,
2319
- NestingSelector: is,
2320
- Nth: os,
2321
- Number: mo,
2322
- Operator: ls,
2323
- Parentheses: go,
2324
- Percentage: us,
2325
- PseudoClassSelector: fs,
2326
- PseudoElementSelector: ds,
2327
- Ratio: ko,
2328
- Raw: ks,
2329
- Rule: yo,
2330
- Scope: So,
2331
- Selector: Ss,
2332
- SelectorList: Cs,
2333
- String: Ls,
2334
- StyleSheet: xo,
2335
- SupportsDeclaration: Co,
2336
- TypeSelector: Ts,
2337
- UnicodeRange: bo,
2338
- Url: Oo,
2339
- Value: Io,
2340
- WhiteSpace: No
2341
- }, Symbol.toStringTag, { value: "Module" })), Do = {
2342
- node: $o
2343
- }, Po = Hs(Do), We = (t, e) => t.a === e.a ? t.b === e.b ? t.c - e.c : t.b - e.b : t.a - e.a, Sr = (t, e) => We(t, e) === 0, xr = (t, e) => We(t, e) > 0, Cr = (t, e) => We(t, e) < 0, qr = (t, e = "ASC") => {
2344
- const n = t.sort(We);
2345
- return e === "DESC" ? n.reverse() : n;
2346
- }, Br = (...t) => qr(t, "ASC"), jr = (...t) => qr(t, "DESC"), un = (...t) => jr(...t)[0], Mo = (...t) => Br(...t)[0];
2347
- class nn extends Error {
2348
- constructor() {
2349
- super("Manipulating a Specificity instance is not allowed. Instead, create a new Specificity()");
2350
- }
2351
- }
2352
- class Fo {
2353
- constructor(e, n = null) {
2354
- this.value = e, this.selector = n;
2355
- }
2356
- get a() {
2357
- return this.value.a;
2358
- }
2359
- set a(e) {
2360
- throw new nn();
2361
- }
2362
- get b() {
2363
- return this.value.b;
2364
- }
2365
- set b(e) {
2366
- throw new nn();
2367
- }
2368
- get c() {
2369
- return this.value.c;
2370
- }
2371
- set c(e) {
2372
- throw new nn();
2373
- }
2374
- selectorString() {
2375
- return typeof this.selector == "string" || this.selector instanceof String ? this.selector : this.selector instanceof Object && this.selector.type === "Selector" ? Po(this.selector) : "";
2376
- }
2377
- toObject() {
2378
- return this.value;
2379
- }
2380
- toArray() {
2381
- return [this.value.a, this.value.b, this.value.c];
2382
- }
2383
- toString() {
2384
- return `(${this.value.a},${this.value.b},${this.value.c})`;
2385
- }
2386
- toJSON() {
2387
- return {
2388
- selector: this.selectorString(),
2389
- asObject: this.toObject(),
2390
- asArray: this.toArray(),
2391
- asString: this.toString()
2392
- };
2393
- }
2394
- isEqualTo(e) {
2395
- return Sr(this, e);
2396
- }
2397
- isGreaterThan(e) {
2398
- return xr(this, e);
2399
- }
2400
- isLessThan(e) {
2401
- return Cr(this, e);
2402
- }
2403
- static calculate(e) {
2404
- return je(e);
2405
- }
2406
- static calculateForAST(e) {
2407
- return kt(e);
2408
- }
2409
- static compare(e, n) {
2410
- return We(e, n);
2411
- }
2412
- static equals(e, n) {
2413
- return Sr(e, n);
2414
- }
2415
- static lessThan(e, n) {
2416
- return Cr(e, n);
2417
- }
2418
- static greaterThan(e, n) {
2419
- return xr(e, n);
2420
- }
2421
- static min(...e) {
2422
- return Mo(...e);
2423
- }
2424
- static max(...e) {
2425
- return un(...e);
2426
- }
2427
- static sortAsc(...e) {
2428
- return Br(...e);
2429
- }
2430
- static sortDesc(...e) {
2431
- return jr(...e);
2432
- }
2433
- }
2434
- const kt = (t) => {
2435
- if (!t || t.type !== "Selector")
2436
- throw new TypeError("Passed in source is not a Selector AST");
2437
- let e = 0, n = 0, r = 0;
2438
- return t.children.forEach((s) => {
2439
- switch (s.type) {
2440
- case "IdSelector":
2441
- e += 1;
2442
- break;
2443
- case "AttributeSelector":
2444
- case "ClassSelector":
2445
- n += 1;
2446
- break;
2447
- case "PseudoClassSelector":
2448
- switch (s.name.toLowerCase()) {
2449
- // “The specificity of a :where() pseudo-class is replaced by zero.”
2450
- case "where":
2451
- break;
2452
- case "-webkit-any":
2453
- case "any":
2454
- s.children && (n += 1);
2455
- break;
2456
- // “The specificity of an :is(), :not(), or :has() pseudo-class is replaced by the specificity of the most specific complex selector in its selector list argument.“
2457
- case "-moz-any":
2458
- case "is":
2459
- case "matches":
2460
- case "not":
2461
- case "has":
2462
- if (s.children) {
2463
- const a = un(...je(s.children.first));
2464
- e += a.a, n += a.b, r += a.c;
2465
- }
2466
- break;
2467
- // “The specificity of an :nth-child() or :nth-last-child() selector is the specificity of the pseudo class itself (counting as one pseudo-class selector) plus the specificity of the most specific complex selector in its selector list argument”
2468
- case "nth-child":
2469
- case "nth-last-child":
2470
- if (n += 1, s.children && s.children.first.selector) {
2471
- const a = un(...je(s.children.first.selector));
2472
- e += a.a, n += a.b, r += a.c;
2473
- }
2474
- break;
2475
- // “The specificity of :host is that of a pseudo-class. The specificity of :host() is that of a pseudo-class, plus the specificity of its argument.”
2476
- // “The specificity of :host-context() is that of a pseudo-class, plus the specificity of its argument.”
2477
- case "host-context":
2478
- case "host":
2479
- if (n += 1, s.children) {
2480
- const a = { type: "Selector", children: [] };
2481
- let c = !1;
2482
- s.children.first.children.forEach((i) => {
2483
- if (c) return !1;
2484
- if (i.type === "Combinator")
2485
- return c = !0, !1;
2486
- a.children.push(i);
2487
- });
2488
- const u = je(a)[0];
2489
- e += u.a, n += u.b, r += u.c;
2490
- }
2491
- break;
2492
- // Improper use of Pseudo-Class Selectors instead of a Pseudo-Element
2493
- // @ref https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-elements#index
2494
- case "after":
2495
- case "before":
2496
- case "first-letter":
2497
- case "first-line":
2498
- r += 1;
2499
- break;
2500
- default:
2501
- n += 1;
2502
- break;
2503
- }
2504
- break;
2505
- case "PseudoElementSelector":
2506
- switch (s.name) {
2507
- // “The specificity of ::slotted() is that of a pseudo-element, plus the specificity of its argument.”
2508
- case "slotted":
2509
- if (r += 1, s.children) {
2510
- const a = { type: "Selector", children: [] };
2511
- let c = !1;
2512
- s.children.first.children.forEach((i) => {
2513
- if (c) return !1;
2514
- if (i.type === "Combinator")
2515
- return c = !0, !1;
2516
- a.children.push(i);
2517
- });
2518
- const u = je(a)[0];
2519
- e += u.a, n += u.b, r += u.c;
2520
- }
2521
- break;
2522
- case "view-transition-group":
2523
- case "view-transition-image-pair":
2524
- case "view-transition-old":
2525
- case "view-transition-new":
2526
- if (s.children && s.children.first.value === "*")
2527
- break;
2528
- r += 1;
2529
- break;
2530
- default:
2531
- r += 1;
2532
- break;
2533
- }
2534
- break;
2535
- case "TypeSelector":
2536
- let o = s.name;
2537
- o.includes("|") && (o = o.split("|")[1]), o !== "*" && (r += 1);
2538
- break;
2539
- }
2540
- }), new Fo({ a: e, b: n, c: r }, t);
2541
- }, zo = (t) => {
2542
- if (typeof t == "string" || t instanceof String)
2543
- try {
2544
- return ur(t, {
2545
- context: "selectorList"
2546
- });
2547
- } catch (e) {
2548
- throw new TypeError(`Could not convert passed in source '${t}' to SelectorList: ${e.message}`);
2549
- }
2550
- if (t instanceof Object) {
2551
- if (t.type && ["Selector", "SelectorList"].includes(t.type))
2552
- return t;
2553
- if (t.type && t.type === "Raw")
2554
- try {
2555
- return ur(t.value, {
2556
- context: "selectorList"
2557
- });
2558
- } catch (e) {
2559
- throw new TypeError(`Could not convert passed in source to SelectorList: ${e.message}`);
2560
- }
2561
- throw new TypeError("Passed in source is an Object but no AST / AST of the type Selector or SelectorList");
2562
- }
2563
- throw new TypeError("Passed in source is not a String nor an Object. I don't know what to do with it.");
2564
- }, je = (t) => {
2565
- if (!t)
2566
- return [];
2567
- const e = zo(t);
2568
- if (e.type === "Selector")
2569
- return [kt(t)];
2570
- if (e.type === "SelectorList") {
2571
- const n = [];
2572
- return e.children.forEach((r) => {
2573
- const s = kt(r);
2574
- n.push(s);
2575
- }), n;
2576
- }
2577
- };
2578
- function kn(t, e) {
2579
- return e >= 65 && e <= 90 && (e = e | 32), t === e;
2580
- }
2581
- function W(t, e) {
2582
- if (t === e) return !0;
2583
- let n = t.length;
2584
- if (n !== e.length) return !1;
2585
- for (let r = 0; r < n; r++)
2586
- if (kn(t.charCodeAt(r), e.charCodeAt(r)) === !1)
2587
- return !1;
2588
- return !0;
2589
- }
2590
- function me(t, e) {
2591
- if (t === e) return !0;
2592
- let n = e.length, r = n - t.length;
2593
- if (r < 0)
2594
- return !1;
2595
- for (let s = n - 1; s >= r; s--)
2596
- if (kn(t.charCodeAt(s - r), e.charCodeAt(s)) === !1)
2597
- return !1;
2598
- return !0;
2599
- }
2600
- function yn(t, e) {
2601
- if (t === e) return !0;
2602
- let n = t.length;
2603
- if (e.length < n) return !1;
2604
- for (let r = 0; r < n; r++)
2605
- if (kn(t.charCodeAt(r), e.charCodeAt(r)) === !1)
2606
- return !1;
2607
- return !0;
2608
- }
2609
- const Ro = "Atrule", qo = "MediaQuery", Bo = "MediaFeature", jo = "Rule", Sn = "Selector", Ur = "TypeSelector", Ve = "PseudoClassSelector", Gr = "AttributeSelector", Vr = "PseudoElementSelector", hn = "Declaration", Uo = "Value", pe = "Identifier", Go = "Nth", Vo = "Combinator", Ho = "Number", Hr = "Dimension", De = "Operator", Wo = "Hash", Ko = "Url", xn = "Function";
2610
- function br(t, e, n) {
2611
- let r = t.value.children.first;
2612
- return W(e, t.property) && r.type === pe && W(n, r.name);
2613
- }
2614
- function Qo(t) {
2615
- let e = !1;
2616
- return fe(t, function(n) {
2617
- if (n.type === hn && (br(n, "-webkit-appearance", "none") || br(n, "-moz-appearance", "meterbar")))
2618
- return e = !0, this.break;
2619
- }), e;
2620
- }
2621
- function Jo(t) {
2622
- let e = !1;
2623
- return fe(t, function(n) {
2624
- let r = n.children, s = n.name, o = n.value;
2625
- if (n.type === qo && r.size === 1 && r.first.type === pe) {
2626
- let a = r.first.name;
2627
- if (yn("\\0", a) || me("\\9 ", a))
2628
- return e = !0, this.break;
2629
- } else if (n.type === Bo) {
2630
- if (o && o.unit && o.unit === "\\0")
2631
- return e = !0, this.break;
2632
- if (W("-moz-images-in-menus", s) || W("min--moz-device-pixel-ratio", s) || W("-ms-high-contrast", s))
2633
- return e = !0, this.break;
2634
- if (W("min-resolution", s) && o && W(".001", o.value) && W("dpcm", o.unit))
2635
- return e = !0, this.break;
2636
- if (W("-webkit-min-device-pixel-ratio", s) && o && o.value && (W("0", o.value) || W("10000", o.value)))
2637
- return e = !0, this.break;
2638
- }
2639
- }), e;
2640
- }
2641
- const wr = 45;
2642
- function Ce(t) {
2643
- return t.charCodeAt(0) === wr && t.charCodeAt(1) !== wr && t.indexOf("-", 2) !== -1;
2644
- }
2645
- class ae {
2646
- /** @param {string[]} items */
2647
- constructor(e) {
2648
- this.set = new Set(e);
2649
- }
2650
- /** @param {string} item */
2651
- has(e) {
2652
- return this.set.has(e.toLowerCase());
2653
- }
2654
- }
2655
- function Wr(t, e) {
2656
- let n = [];
2657
- return fe(t, {
2658
- visit: Sn,
2659
- enter: function(r) {
2660
- n.push(e(r));
2661
- }
2662
- }), n;
2663
- }
2664
- const Kr = new ae([
2665
- "nth-child",
2666
- "where",
2667
- "not",
2668
- "is",
2669
- "has",
2670
- "nth-last-child",
2671
- "matches",
2672
- "-webkit-any",
2673
- "-moz-any"
2674
- ]);
2675
- function Qr(t) {
2676
- let e = !1;
2677
- return fe(t, function(n) {
2678
- if (n.type === Gr) {
2679
- let r = n.name.name;
2680
- if (W("role", r) || yn("aria-", r))
2681
- return e = !0, this.break;
2682
- } else if (n.type === Ve && Kr.has(n.name)) {
2683
- let r = Wr(n, Qr);
2684
- for (let s of r)
2685
- if (s === !0) {
2686
- e = !0;
2687
- break;
2688
- }
2689
- return this.skip;
2690
- }
2691
- }), e;
2692
- }
2693
- function Yo(t) {
2694
- let e = !1;
2695
- return fe(t, function(n) {
2696
- let r = n.type;
2697
- if ((r === Vr || r === Ur || r === Ve) && Ce(n.name))
2698
- return e = !0, this.break;
2699
- }), e;
2700
- }
2701
- function Xo(t) {
2702
- let e = [];
2703
- return fe(t, function(n) {
2704
- n.type === Ve && e.push(n.name);
2705
- }), e.length === 0 ? !1 : e;
2706
- }
2707
- function Jr(t) {
2708
- let e = 0;
2709
- return fe(t, function(n) {
2710
- let r = n.type;
2711
- if (!(r === Sn || r === Go)) {
2712
- if (e++, (r === Vr || r === Ur || r === Ve) && Ce(n.name) && e++, r === Gr)
2713
- return n.value && e++, this.skip;
2714
- if (r === Ve && Kr.has(n.name)) {
2715
- let s = Wr(n, Jr);
2716
- if (s.length === 0) return;
2717
- for (let o of s)
2718
- e += o;
2719
- return this.skip;
2720
- }
2721
- }
2722
- }), e;
2723
- }
2724
- function Zo(t, e) {
2725
- fe(t, function(n, r) {
2726
- if (n.type === Vo) {
2727
- let s = n.loc, o = n.name;
2728
- if (s === null) {
2729
- let a = r.prev.data.loc.end, c = {
2730
- offset: a.offset,
2731
- line: a.line,
2732
- column: a.column
2733
- };
2734
- e({
2735
- name: o,
2736
- loc: {
2737
- start: c,
2738
- end: {
2739
- offset: c.offset + 1,
2740
- line: c.line,
2741
- column: c.column + 1
2742
- }
2743
- }
2744
- });
2745
- } else
2746
- e({
2747
- name: o,
2748
- loc: s
2749
- });
2750
- }
2751
- });
2752
- }
2753
- const ea = new ae([
2754
- // CSS Named Colors
2755
- // Spec: https://drafts.csswg.org/css-color/#named-colors
2756
- // Heuristic: popular names first for quick finding in set.has()
2757
- // See: https://docs.google.com/spreadsheets/d/1OU8ahxC5oYU8VRryQs9BzHToaXcOntVlh6KUHjm15G4/edit#gid=2096495459
2758
- "white",
2759
- "black",
2760
- "red",
2761
- "gray",
2762
- "silver",
2763
- "grey",
2764
- "green",
2765
- "orange",
2766
- "blue",
2767
- "dimgray",
2768
- "whitesmoke",
2769
- "lightgray",
2770
- "lightgrey",
2771
- "yellow",
2772
- "gold",
2773
- "pink",
2774
- "gainsboro",
2775
- "magenta",
2776
- "purple",
2777
- "darkgray",
2778
- "navy",
2779
- "darkred",
2780
- "teal",
2781
- "maroon",
2782
- "darkgrey",
2783
- "tomato",
2784
- "darkorange",
2785
- "brown",
2786
- "crimson",
2787
- "lightyellow",
2788
- "slategray",
2789
- "salmon",
2790
- "lightgreen",
2791
- "lightblue",
2792
- "orangered",
2793
- "aliceblue",
2794
- "dodgerblue",
2795
- "lime",
2796
- "darkblue",
2797
- "darkgoldenrod",
2798
- "skyblue",
2799
- "royalblue",
2800
- "darkgreen",
2801
- "ivory",
2802
- "olive",
2803
- "aqua",
2804
- "turquoise",
2805
- "cyan",
2806
- "khaki",
2807
- "beige",
2808
- "snow",
2809
- "ghostwhite",
2810
- "limegreen",
2811
- "coral",
2812
- "dimgrey",
2813
- "hotpink",
2814
- "midnightblue",
2815
- "firebrick",
2816
- "indigo",
2817
- "wheat",
2818
- "mediumblue",
2819
- "lightpink",
2820
- "plum",
2821
- "azure",
2822
- "violet",
2823
- "lavender",
2824
- "deepskyblue",
2825
- "darkslategrey",
2826
- "goldenrod",
2827
- "cornflowerblue",
2828
- "lightskyblue",
2829
- "indianred",
2830
- "yellowgreen",
2831
- "saddlebrown",
2832
- "palegreen",
2833
- "bisque",
2834
- "tan",
2835
- "antiquewhite",
2836
- "steelblue",
2837
- "forestgreen",
2838
- "fuchsia",
2839
- "mediumaquamarine",
2840
- "seagreen",
2841
- "sienna",
2842
- "deeppink",
2843
- "mediumseagreen",
2844
- "peru",
2845
- "greenyellow",
2846
- "lightgoldenrodyellow",
2847
- "orchid",
2848
- "cadetblue",
2849
- "navajowhite",
2850
- "lightsteelblue",
2851
- "slategrey",
2852
- "linen",
2853
- "lightseagreen",
2854
- "darkcyan",
2855
- "lightcoral",
2856
- "aquamarine",
2857
- "blueviolet",
2858
- "cornsilk",
2859
- "lightsalmon",
2860
- "chocolate",
2861
- "lightslategray",
2862
- "floralwhite",
2863
- "darkturquoise",
2864
- "darkslategray",
2865
- "rebeccapurple",
2866
- "burlywood",
2867
- "chartreuse",
2868
- "lightcyan",
2869
- "lemonchiffon",
2870
- "palevioletred",
2871
- "darkslateblue",
2872
- "mediumpurple",
2873
- "lawngreen",
2874
- "slateblue",
2875
- "darkseagreen",
2876
- "blanchedalmond",
2877
- "mistyrose",
2878
- "darkolivegreen",
2879
- "seashell",
2880
- "olivedrab",
2881
- "peachpuff",
2882
- "darkviolet",
2883
- "powderblue",
2884
- "darkmagenta",
2885
- "lightslategrey",
2886
- "honeydew",
2887
- "palegoldenrod",
2888
- "darkkhaki",
2889
- "oldlace",
2890
- "mintcream",
2891
- "sandybrown",
2892
- "mediumturquoise",
2893
- "papayawhip",
2894
- "paleturquoise",
2895
- "mediumvioletred",
2896
- "thistle",
2897
- "springgreen",
2898
- "moccasin",
2899
- "rosybrown",
2900
- "lavenderblush",
2901
- "mediumslateblue",
2902
- "darkorchid",
2903
- "mediumorchid",
2904
- "darksalmon",
2905
- "mediumspringgreen"
2906
- ]), ta = new ae([
2907
- // CSS System Colors
2908
- // Spec: https://drafts.csswg.org/css-color/#css-system-colors
2909
- "accentcolor",
2910
- "accentcolortext",
2911
- "activetext",
2912
- "buttonborder",
2913
- "buttonface",
2914
- "buttontext",
2915
- "canvas",
2916
- "canvastext",
2917
- "field",
2918
- "fieldtext",
2919
- "graytext",
2920
- "highlight",
2921
- "highlighttext",
2922
- "linktext",
2923
- "mark",
2924
- "marktext",
2925
- "selecteditem",
2926
- "selecteditemtext",
2927
- "visitedtext"
2928
- ]), na = new ae([
2929
- "rgba",
2930
- "rgb",
2931
- "hsla",
2932
- "hsl",
2933
- "oklch",
2934
- "color",
2935
- "hwb",
2936
- "lch",
2937
- "lab",
2938
- "oklab"
2939
- ]), ra = new ae([
2940
- "transparent",
2941
- "currentcolor"
2942
- ]), xt = new ae([
2943
- "auto",
2944
- "none",
2945
- // for `text-shadow`, `box-shadow` and `background`
2946
- "inherit",
2947
- "initial",
2948
- "unset",
2949
- "revert",
2950
- "revert-layer"
2951
- ]);
2952
- function at(t) {
2953
- let e = t.children, n = e.size;
2954
- if (!e || n > 1 || n === 0) return !1;
2955
- let r = e.first;
2956
- return r.type === pe && xt.has(r.name);
2957
- }
2958
- const ia = new ae([
2959
- "caption",
2960
- "icon",
2961
- "menu",
2962
- "message-box",
2963
- "small-caption",
2964
- "status-bar"
2965
- ]), sa = new ae([
2966
- /* <absolute-size> values */
2967
- "xx-small",
2968
- "x-small",
2969
- "small",
2970
- "medium",
2971
- "large",
2972
- "x-large",
2973
- "xx-large",
2974
- "xxx-large",
2975
- /* <relative-size> values */
2976
- "smaller",
2977
- "larger"
2978
- ]), oa = 44, vr = 47;
2979
- function rn(t) {
2980
- let e = t.children.first;
2981
- return e === null ? !1 : e.type === pe && ia.has(e.name);
2982
- }
2983
- function aa(t, e, n) {
2984
- let r = Array.from({ length: 2 }), s, o;
2985
- t.children.forEach(function(c, u) {
2986
- let i = u.prev ? u.prev.data : void 0, l = u.next ? u.next.data : void 0;
2987
- if (c.type === pe && xt.has(c.name) && n({
2988
- type: "keyword",
2989
- value: c.name
2990
- }), l && l.type === De && l.value.charCodeAt(0) === vr) {
2991
- s = e(c);
2992
- return;
2993
- }
2994
- if (i && i.type === De && i.value.charCodeAt(0) === vr) {
2995
- o = e(c);
2996
- return;
2997
- }
2998
- if (l && l.type === De && l.value.charCodeAt(0) === oa && !r[0]) {
2999
- r[0] = c, !s && i && (s = e(i));
3000
- return;
3001
- }
3002
- if (c.type !== Ho) {
3003
- if (u.next === null) {
3004
- r[1] = c, !s && !r[0] && i && (s = e(i));
3005
- return;
3006
- }
3007
- if (c.type === pe) {
3008
- let d = c.name;
3009
- if (sa.has(d)) {
3010
- s = d;
3011
- return;
3012
- }
3013
- }
3014
- }
3015
- });
3016
- let a = r[0] || r[1] ? e({
3017
- loc: {
3018
- start: {
3019
- offset: (r[0] || r[1]).loc.start.offset
3020
- },
3021
- end: {
3022
- offset: r[1].loc.end.offset
3023
- }
3024
- }
3025
- }) : null;
3026
- return {
3027
- font_size: s,
3028
- line_height: o,
3029
- font_family: a
3030
- };
3031
- }
3032
- const la = new ae([
3033
- "linear",
3034
- "ease",
3035
- "ease-in",
3036
- "ease-out",
3037
- "ease-in-out",
3038
- "step-start",
3039
- "step-end"
3040
- ]), ca = new ae([
3041
- "cubic-bezier",
3042
- "steps"
3043
- ]);
3044
- function ua(t, e) {
3045
- let n = !1;
3046
- for (let r of t) {
3047
- let s = r.type, o = r.name;
3048
- s === De ? n = !1 : s === Hr && n === !1 ? (n = !0, e({
3049
- type: "duration",
3050
- value: r
3051
- })) : s === pe ? la.has(o) ? e({
3052
- type: "fn",
3053
- value: r
3054
- }) : xt.has(o) && e({
3055
- type: "keyword",
3056
- value: r
3057
- }) : s === xn && ca.has(o) && e({
3058
- type: "fn",
3059
- value: r
3060
- });
3061
- }
3062
- }
3063
- function Yr(t) {
3064
- let e = t.children;
3065
- if (!e)
3066
- return !1;
3067
- for (let n of e) {
3068
- let { type: r, name: s } = n;
3069
- if (r === pe && Ce(s) || r === xn && (Ce(s) || Yr(n)))
3070
- return !0;
3071
- }
3072
- return !1;
3073
- }
3074
- class b {
3075
- /** @param {boolean} useLocations */
3076
- constructor(e = !1) {
3077
- this._items = /* @__PURE__ */ new Map(), this._total = 0, e && (this._nodes = []), this._useLocations = e;
3078
- }
3079
- /**
3080
- * @param {string | number} item
3081
- * @param {import('css-tree').CssLocation} node_location
3082
- */
3083
- p(e, n) {
3084
- let r = this._total;
3085
- if (this._useLocations) {
3086
- let s = n.start, o = s.offset, a = r * 4;
3087
- this._nodes[a] = s.line, this._nodes[a + 1] = s.column, this._nodes[a + 2] = o, this._nodes[a + 3] = n.end.offset - o;
3088
- }
3089
- if (this._items.has(e)) {
3090
- this._items.get(e).push(r), this._total++;
3091
- return;
3092
- }
3093
- this._items.set(e, [r]), this._total++;
3094
- }
3095
- size() {
3096
- return this._total;
3097
- }
3098
- /**
3099
- * @typedef CssLocation
3100
- * @property {number} line
3101
- * @property {number} column
3102
- * @property {number} offset
3103
- * @property {number} length
3104
- *
3105
- * @returns {{
3106
- * total: number;
3107
- * totalUnique: number;
3108
- * uniquenessRatio: number;
3109
- * unique: Record<string, number>;
3110
- * } & ({
3111
- * uniqueWithLocations: Record<string, CssLocation[]>
3112
- * } | {
3113
- * uniqueWithLocations?: undefined
3114
- * })}
3115
- */
3116
- c() {
3117
- let e = /* @__PURE__ */ new Map(), n = {}, r = this._useLocations, s = this._items, o = this._nodes, a = s.size;
3118
- s.forEach((i, l) => {
3119
- if (r) {
3120
- let d = i.map(function(y) {
3121
- let g = y * 4;
3122
- return {
3123
- line: o[g],
3124
- column: o[g + 1],
3125
- offset: o[g + 2],
3126
- length: o[g + 3]
3127
- };
3128
- });
3129
- e.set(l, d);
3130
- } else
3131
- n[l] = i.length;
3132
- });
3133
- let c = this._total, u = {
3134
- total: c,
3135
- totalUnique: a,
3136
- unique: n,
3137
- uniquenessRatio: c === 0 ? 0 : a / c
3138
- };
3139
- return r && (u.uniqueWithLocations = Object.fromEntries(e)), u;
3140
- }
3141
- }
3142
- class sn {
3143
- /** @param {boolean} useLocations */
3144
- constructor(e) {
3145
- this._list = new b(e), this._contexts = /* @__PURE__ */ new Map(), this._useLocations = e;
3146
- }
3147
- /**
3148
- * Add an item to this _list's context
3149
- * @param {string} item Item to push
3150
- * @param {string} context Context to push Item to
3151
- * @param {import('css-tree').CssLocation} node_location
3152
- */
3153
- push(e, n, r) {
3154
- this._list.p(e, r), this._contexts.has(n) || this._contexts.set(n, new b(this._useLocations)), this._contexts.get(n).p(e, r);
3155
- }
3156
- count() {
3157
- let e = /* @__PURE__ */ new Map();
3158
- for (let [n, r] of this._contexts.entries())
3159
- e.set(n, r.c());
3160
- return Object.assign(this._list.c(), {
3161
- itemsPerContext: Object.fromEntries(e)
3162
- });
3163
- }
3164
- }
3165
- function ha(t) {
3166
- let e = /* @__PURE__ */ new Map(), n = -1, r = 0, s = 0, o = t.length;
3167
- for (let a = 0; a < o; a++) {
3168
- let c = t[a], u = (e.get(c) || 0) + 1;
3169
- e.set(c, u), u > n && (n = u, r = 0, s = 0), u >= n && (r++, s += c);
3170
- }
3171
- return s / r;
3172
- }
3173
- class re {
3174
- constructor() {
3175
- this._items = [], this._sum = 0;
3176
- }
3177
- /**
3178
- * Add a new Integer at the end of this AggregateCollection
3179
- * @param {number} item - The item to add
3180
- */
3181
- push(e) {
3182
- this._items.push(e), this._sum += e;
3183
- }
3184
- size() {
3185
- return this._items.length;
3186
- }
3187
- aggregate() {
3188
- let e = this._items.length;
3189
- if (e === 0)
3190
- return {
3191
- min: 0,
3192
- max: 0,
3193
- mean: 0,
3194
- mode: 0,
3195
- range: 0,
3196
- sum: 0
3197
- };
3198
- let n = this._items.slice().sort((c, u) => c - u), r = n[0], s = n[e - 1], o = ha(n), a = this._sum;
3199
- return {
3200
- min: r,
3201
- max: s,
3202
- mean: a / e,
3203
- mode: o,
3204
- range: s - r,
3205
- sum: a
3206
- };
3207
- }
3208
- /**
3209
- * @returns {number[]} All _items in this collection
3210
- */
3211
- toArray() {
3212
- return this._items;
3213
- }
3214
- }
3215
- function fa(t) {
3216
- if (Cn(t) || Ce(t)) return !1;
3217
- let e = t.charCodeAt(0);
3218
- return e === 47 || e === 42 || e === 95 || e === 43 || e === 38 || e === 36 || e === 35;
3219
- }
3220
- function Cn(t) {
3221
- return t.length < 3 ? !1 : t.charCodeAt(0) === 45 && t.charCodeAt(1) === 45;
3222
- }
3223
- function V(t, e) {
3224
- return Cn(e) ? !1 : me(t, e);
3225
- }
3226
- function pa(t) {
3227
- return Ce(t) ? t.slice(t.indexOf("-", 2) + 1) : t;
3228
- }
3229
- function da(t) {
3230
- let e = 5, n = t.indexOf(";"), r = t.indexOf(",");
3231
- return n === -1 || r !== -1 && r < n ? t.substring(e, r) : t.substring(e, n);
3232
- }
3233
- function ma(t) {
3234
- let e = t.children;
3235
- if (e) {
3236
- let n = e.last;
3237
- return n && n.type === pe && me("\\9", n.name);
3238
- }
3239
- return !1;
3240
- }
3241
- let ga = new ae([
3242
- "border-radius",
3243
- "border-top-left-radius",
3244
- "border-top-right-radius",
3245
- "border-bottom-right-radius",
3246
- "border-bottom-left-radius",
3247
- "border-start-start-radius",
3248
- "border-start-end-radius",
3249
- "border-end-end-radius",
3250
- "border-end-start-radius"
3251
- ]);
3252
- function B(t, e) {
3253
- return e === 0 ? 0 : t / e;
3254
- }
3255
- let ka = {
3256
- useLocations: !1
3257
- };
3258
- function xa(t, e = {}) {
3259
- let r = Object.assign({}, ka, e).useLocations === !0, s = Date.now();
3260
- function o(m) {
3261
- return a(m).trim();
3262
- }
3263
- function a(m) {
3264
- let A = m.loc;
3265
- return t.substring(A.start.offset, A.end.offset);
3266
- }
3267
- let c = 0, u = 0, i = 0, l = {
3268
- total: 0,
3269
- /** @type {Map<string, { size: number, count: number } & ({ uniqueWithLocations?: undefined } | ({ uniqueWithLocations: { offset: number, line: number, column: number, length: number }[] })) }>} */
3270
- unique: /* @__PURE__ */ new Map()
3271
- }, d = Date.now(), y = Xr(t, {
3272
- parseCustomProperty: !0,
3273
- // To find font-families, colors, etc.
3274
- positions: !0,
3275
- // So we can use stringifyNode()
3276
- /** @param {string} comment */
3277
- onComment: function(m) {
3278
- c++, u += m.length;
3279
- }
3280
- }), g = Date.now(), S = y.loc.end.line - y.loc.start.line + 1, T = 0, P = new re(), G = [], Y = new b(r), be = new b(r), X = new b(r), Ke = new b(r), Qe = new b(r), Je = new b(r), h = new b(r), f = new b(r), k = new b(r), p = new b(r), Z = new b(r), j = new b(r), ke = 0, R = 0, ye = new re(), de = new re(), Ct = new re(), bn = new b(r), wn = new b(r), vn = new b(r), bt = new b(r), An = /* @__PURE__ */ new Set(), wt = new b(r), we, ve, Ln = new re(), En = new re(), _n = new re(), Tn = new b(r), Ye = new re(), On = new b(r), In = [], vt = new b(r), At = new b(r), Nn = new b(r), $n = new b(r), Dn = /* @__PURE__ */ new Set(), Fe = 0, Pn = new re(), Xe = 0, Lt = 0, Et = new b(r), ze = new b(r), _t = new b(r), Tt = new b(r), Ze = new b(r), Re = new re(), Ot = new re(), Mn = new b(r), It = new b(r), Fn = new b(r), zn = new b(r), Rn = new b(r), Nt = new b(r), $t = new b(r), Dt = new b(r), et = new b(r), tt = new b(r), _e = new sn(r), Te = new b(r), Pt = new sn(r), qn = new b(r), qe = new b(r), Bn = new sn(r);
3281
- fe(y, function(m) {
3282
- switch (m.type) {
3283
- case Ro: {
3284
- T++;
3285
- let A = m.name;
3286
- if (A === "font-face") {
3287
- let O = {};
3288
- r && Y.p(m.loc.start.offset, m.loc), m.block.children.forEach((w) => {
3289
- w.type === hn && (O[w.property] = o(w.value));
3290
- }), G.push(O), P.push(1);
3291
- break;
3292
- }
3293
- let C = 1;
3294
- if (m.prelude !== null) {
3295
- let O = m.prelude, w = O && o(m.prelude), L = O.loc;
3296
- if (A === "media")
3297
- Ke.p(w, L), Jo(O) && (Qe.p(w, L), C++);
3298
- else if (A === "supports")
3299
- h.p(w, L), Qo(O) && (f.p(w, L), C++);
3300
- else if (me("keyframes", A)) {
3301
- let v = "@" + A + " " + w;
3302
- Ce(A) && (p.p(v, L), C++), k.p(v, L);
3303
- } else A === "import" ? X.p(w, L) : A === "charset" ? Je.p(w, L) : A === "container" ? Z.p(w, L) : A === "layer" ? w.split(",").forEach((v) => be.p(v.trim(), L)) : A === "property" && j.p(w, L);
3304
- } else
3305
- A === "layer" && (be.p("<anonymous>", m.loc), C++);
3306
- P.push(C);
3307
- break;
3308
- }
3309
- case jo: {
3310
- let A = m.prelude, C = m.block, O = A.children, w = C.children, L = O ? O.size : 0, v = w ? w.size : 0;
3311
- ye.push(L + v), bn.p(L + v, m.loc), de.push(L), wn.p(L, A.loc), Ct.push(v), vn.p(v, C.loc), ke++, v === 0 && R++;
3312
- break;
3313
- }
3314
- case Sn: {
3315
- let A = o(m);
3316
- if (this.atrule && me("keyframes", this.atrule.name))
3317
- return bt.p(A, m.loc), this.skip;
3318
- Qr(m) && At.p(A, m.loc);
3319
- let C = Xo(m);
3320
- if (C !== !1)
3321
- for (let q of C)
3322
- Nn.p(q, m.loc);
3323
- let O = Jr(m);
3324
- Yo(m) && wt.p(A, m.loc), An.add(A), Ye.push(O), On.p(O, m.loc);
3325
- let w = kt(m).toArray(), [L, v, _] = w;
3326
- return Tn.p(w.toString(), m.loc), Ln.push(L), En.push(v), _n.push(_), we === void 0 && (we = w), ve === void 0 && (ve = w), ve !== void 0 && Ar(ve, w) < 0 && (ve = w), we !== void 0 && Ar(we, w) > 0 && (we = w), In.push(w), L > 0 && vt.p(A, m.loc), Zo(m, function(ee) {
3327
- $n.p(ee.name, ee.loc);
3328
- }), this.skip;
3329
- }
3330
- case Hr: {
3331
- if (!this.declaration)
3332
- break;
3333
- let A = m.unit;
3334
- return me("\\9", A) ? Pt.push(A.substring(0, A.length - 2), this.declaration.property, m.loc) : Pt.push(A, this.declaration.property, m.loc), this.skip;
3335
- }
3336
- case Ko: {
3337
- if (yn("data:", m.value)) {
3338
- let A = m.value, C = A.length, O = da(A);
3339
- l.total++, i += C;
3340
- let w = {
3341
- /** @type {number} */
3342
- line: m.loc.start.line,
3343
- /** @type {number} */
3344
- column: m.loc.start.column,
3345
- /** @type {number} */
3346
- offset: m.loc.start.offset,
3347
- /** @type {number} */
3348
- length: m.loc.end.offset - m.loc.start.offset
3349
- };
3350
- if (l.unique.has(O)) {
3351
- let L = l.unique.get(O);
3352
- L.count++, L.size += C, l.unique.set(O, L), r && L.uniqueWithLocations.push(w);
3353
- } else {
3354
- let L = {
3355
- count: 1,
3356
- size: C
3357
- };
3358
- r && (L.uniqueWithLocations = [w]), l.unique.set(O, L);
3359
- }
3360
- }
3361
- break;
3362
- }
3363
- case Uo: {
3364
- if (at(m)) {
3365
- Ot.push(1), qe.p(o(m), m.loc);
3366
- break;
3367
- }
3368
- let A = this.declaration, { property: C, important: O } = A, w = 1;
3369
- Yr(m) && (Mn.p(o(m), m.loc), w++), typeof O == "string" && (It.p(a(m) + "!" + O, m.loc), w++), ma(m) && (It.p(o(m), m.loc), w++);
3370
- let L = m.children, v = m.loc;
3371
- if (Ot.push(w), V("z-index", C))
3372
- return Fn.p(o(m), v), this.skip;
3373
- if (V("font", C)) {
3374
- if (rn(m)) return;
3375
- let { font_size: _, line_height: q, font_family: ee } = aa(m, o, function(Se) {
3376
- Se.type === "keyword" && qe.p(Se.value, v);
3377
- });
3378
- ee && Nt.p(ee, v), _ && $t.p(_, v), q && Dt.p(q, v);
3379
- break;
3380
- } else if (V("font-size", C)) {
3381
- rn(m) || $t.p(o(m), v);
3382
- break;
3383
- } else if (V("font-family", C)) {
3384
- rn(m) || Nt.p(o(m), v);
3385
- break;
3386
- } else if (V("line-height", C))
3387
- Dt.p(o(m), v);
3388
- else if (V("transition", C) || V("animation", C)) {
3389
- ua(L, function(_) {
3390
- _.type === "fn" ? et.p(o(_.value), v) : _.type === "duration" ? tt.p(o(_.value), v) : _.type === "keyword" && qe.p(o(_.value), v);
3391
- });
3392
- break;
3393
- } else if (V("animation-duration", C) || V("transition-duration", C)) {
3394
- L && L.size > 1 ? L.forEach((_) => {
3395
- _.type !== De && tt.p(o(_), v);
3396
- }) : tt.p(o(m), v);
3397
- break;
3398
- } else if (V("transition-timing-function", C) || V("animation-timing-function", C)) {
3399
- L && L.size > 1 ? L.forEach((_) => {
3400
- _.type !== De && et.p(o(_), v);
3401
- }) : et.p(o(m), v);
3402
- break;
3403
- } else if (ga.has(pa(C))) {
3404
- at(m) || Bn.push(o(m), C, v);
3405
- break;
3406
- } else V("text-shadow", C) ? at(m) || zn.p(o(m), v) : V("box-shadow", C) && (at(m) || Rn.p(o(m), v));
3407
- fe(m, function(_) {
3408
- let q = _.name;
3409
- switch (_.type) {
3410
- case Wo: {
3411
- let ee = _.value.length;
3412
- return me("\\9", _.value) && (ee = ee - 2), _e.push("#" + _.value, C, v), Te.p("hex" + ee, v), this.skip;
3413
- }
3414
- case pe: {
3415
- xt.has(q) && qe.p(q, v);
3416
- let ee = q.length;
3417
- if (ee > 20 || ee < 3)
3418
- return this.skip;
3419
- if (ra.has(q)) {
3420
- let Se = o(_);
3421
- _e.push(Se, C, v), Te.p(q.toLowerCase(), v);
3422
- return;
3423
- }
3424
- if (ea.has(q)) {
3425
- let Se = o(_);
3426
- _e.push(Se, C, v), Te.p("named", v);
3427
- return;
3428
- }
3429
- if (ta.has(q)) {
3430
- let Se = o(_);
3431
- _e.push(Se, C, v), Te.p("system", v);
3432
- return;
3433
- }
3434
- return this.skip;
3435
- }
3436
- case xn: {
3437
- if (W("var", q))
3438
- return this.skip;
3439
- if (na.has(q)) {
3440
- _e.push(o(_), C, _.loc), Te.p(q.toLowerCase(), _.loc);
3441
- return;
3442
- }
3443
- if (me("gradient", q)) {
3444
- qn.p(o(_), _.loc);
3445
- return;
3446
- }
3447
- }
3448
- }
3449
- });
3450
- break;
3451
- }
3452
- case hn: {
3453
- if (this.atrulePrelude !== null)
3454
- return this.skip;
3455
- Fe++;
3456
- let A = 1;
3457
- Dn.add(o(m)), m.important === !0 && (Xe++, A++, this.atrule && me("keyframes", this.atrule.name) && (Lt++, A++)), Pn.push(A);
3458
- let { property: C, loc: { start: O } } = m, w = {
3459
- start: {
3460
- line: O.line,
3461
- column: O.column,
3462
- offset: O.offset
3463
- },
3464
- end: {
3465
- offset: O.offset + C.length
3466
- }
3467
- };
3468
- ze.p(C, w), Ce(C) ? (Tt.p(C, w), Re.push(2)) : fa(C) ? (_t.p(C, w), Re.push(2)) : Cn(C) ? (Ze.p(C, w), Re.push(m.important ? 3 : 2), m.important === !0 && Et.p(C, w)) : Re.push(1);
3469
- break;
3470
- }
3471
- }
3472
- });
3473
- let jn = Dn.size, Oe = Ye.size(), Mt = Ln.aggregate(), Ft = En.aggregate(), zt = _n.aggregate(), Un = An.size, F = Object.assign, Gn = t.length, Rt = G.length, Vn = P.aggregate(), Hn = Ye.aggregate(), Wn = Pn.aggregate(), Kn = Re.aggregate(), Qn = Ot.aggregate();
3474
- return {
3475
- stylesheet: {
3476
- sourceLinesOfCode: T + Oe + Fe + bt.size(),
3477
- linesOfCode: S,
3478
- size: Gn,
3479
- complexity: Vn.sum + Hn.sum + Wn.sum + Kn.sum + Qn.sum,
3480
- comments: {
3481
- total: c,
3482
- size: u
3483
- },
3484
- embeddedContent: {
3485
- size: {
3486
- total: i,
3487
- ratio: B(i, Gn)
3488
- },
3489
- types: {
3490
- total: l.total,
3491
- totalUnique: l.unique.size,
3492
- uniquenessRatio: B(l.unique.size, l.total),
3493
- unique: Object.fromEntries(l.unique)
3494
- }
3495
- }
3496
- },
3497
- atrules: {
3498
- fontface: F({
3499
- total: Rt,
3500
- totalUnique: Rt,
3501
- unique: G,
3502
- uniquenessRatio: Rt === 0 ? 0 : 1
3503
- }, r ? {
3504
- uniqueWithLocations: Y.c().uniqueWithLocations
3505
- } : {}),
3506
- import: X.c(),
3507
- media: F(
3508
- Ke.c(),
3509
- {
3510
- browserhacks: Qe.c()
3511
- }
3512
- ),
3513
- charset: Je.c(),
3514
- supports: F(
3515
- h.c(),
3516
- {
3517
- browserhacks: f.c()
3518
- }
3519
- ),
3520
- keyframes: F(
3521
- k.c(),
3522
- {
3523
- prefixed: F(
3524
- p.c(),
3525
- {
3526
- ratio: B(p.size(), k.size())
3527
- }
3528
- )
3529
- }
3530
- ),
3531
- container: Z.c(),
3532
- layer: be.c(),
3533
- property: j.c(),
3534
- total: T,
3535
- complexity: Vn
3536
- },
3537
- rules: {
3538
- total: ke,
3539
- empty: {
3540
- total: R,
3541
- ratio: B(R, ke)
3542
- },
3543
- sizes: F(
3544
- ye.aggregate(),
3545
- {
3546
- items: ye.toArray()
3547
- },
3548
- bn.c()
3549
- ),
3550
- selectors: F(
3551
- de.aggregate(),
3552
- {
3553
- items: de.toArray()
3554
- },
3555
- wn.c()
3556
- ),
3557
- declarations: F(
3558
- Ct.aggregate(),
3559
- {
3560
- items: Ct.toArray()
3561
- },
3562
- vn.c()
3563
- )
3564
- },
3565
- selectors: {
3566
- total: Oe,
3567
- totalUnique: Un,
3568
- uniquenessRatio: B(Un, Oe),
3569
- specificity: F(
3570
- {
3571
- /** @type Specificity */
3572
- min: ve === void 0 ? [0, 0, 0] : ve,
3573
- /** @type Specificity */
3574
- max: we === void 0 ? [0, 0, 0] : we,
3575
- /** @type Specificity */
3576
- sum: [Mt.sum, Ft.sum, zt.sum],
3577
- /** @type Specificity */
3578
- mean: [Mt.mean, Ft.mean, zt.mean],
3579
- /** @type Specificity */
3580
- mode: [Mt.mode, Ft.mode, zt.mode],
3581
- /** @type Specificity */
3582
- items: In
3583
- },
3584
- Tn.c()
3585
- ),
3586
- complexity: F(
3587
- Hn,
3588
- On.c(),
3589
- {
3590
- items: Ye.toArray()
3591
- }
3592
- ),
3593
- id: F(
3594
- vt.c(),
3595
- {
3596
- ratio: B(vt.size(), Oe)
3597
- }
3598
- ),
3599
- pseudoClasses: Nn.c(),
3600
- accessibility: F(
3601
- At.c(),
3602
- {
3603
- ratio: B(At.size(), Oe)
3604
- }
3605
- ),
3606
- keyframes: bt.c(),
3607
- prefixed: F(
3608
- wt.c(),
3609
- {
3610
- ratio: B(wt.size(), Oe)
3611
- }
3612
- ),
3613
- combinators: $n.c()
3614
- },
3615
- declarations: {
3616
- total: Fe,
3617
- totalUnique: jn,
3618
- uniquenessRatio: B(jn, Fe),
3619
- importants: {
3620
- total: Xe,
3621
- ratio: B(Xe, Fe),
3622
- inKeyframes: {
3623
- total: Lt,
3624
- ratio: B(Lt, Xe)
3625
- }
3626
- },
3627
- complexity: Wn
3628
- },
3629
- properties: F(
3630
- ze.c(),
3631
- {
3632
- prefixed: F(
3633
- Tt.c(),
3634
- {
3635
- ratio: B(Tt.size(), ze.size())
3636
- }
3637
- ),
3638
- custom: F(
3639
- Ze.c(),
3640
- {
3641
- ratio: B(Ze.size(), ze.size()),
3642
- importants: F(
3643
- Et.c(),
3644
- {
3645
- ratio: B(Et.size(), Ze.size())
3646
- }
3647
- )
3648
- }
3649
- ),
3650
- browserhacks: F(
3651
- _t.c(),
3652
- {
3653
- ratio: B(_t.size(), ze.size())
3654
- }
3655
- ),
3656
- complexity: Kn
3657
- }
3658
- ),
3659
- values: {
3660
- colors: F(
3661
- _e.count(),
3662
- {
3663
- formats: Te.c()
3664
- }
3665
- ),
3666
- gradients: qn.c(),
3667
- fontFamilies: Nt.c(),
3668
- fontSizes: $t.c(),
3669
- lineHeights: Dt.c(),
3670
- zindexes: Fn.c(),
3671
- textShadows: zn.c(),
3672
- boxShadows: Rn.c(),
3673
- borderRadiuses: Bn.count(),
3674
- animations: {
3675
- durations: tt.c(),
3676
- timingFunctions: et.c()
3677
- },
3678
- prefixes: Mn.c(),
3679
- browserhacks: It.c(),
3680
- units: Pt.count(),
3681
- complexity: Qn,
3682
- keywords: qe.c()
3683
- },
3684
- __meta__: {
3685
- parseTime: g - d,
3686
- analyzeTime: Date.now() - g,
3687
- total: Date.now() - s
3688
- }
3689
- };
3690
- }
3691
- function Ar(t, e) {
3692
- return t[0] === e[0] ? t[1] === e[1] ? e[2] - t[2] : e[1] - t[1] : e[0] - t[0];
3693
- }
3694
- export {
3695
- xa as analyze,
3696
- Ar as compareSpecificity,
3697
- Ce as hasVendorPrefix,
3698
- Qr as isAccessibilitySelector,
3699
- Jo as isMediaBrowserhack,
3700
- fa as isPropertyHack,
3701
- Yo as isSelectorPrefixed,
3702
- Qo as isSupportsBrowserhack,
3703
- Yr as isValuePrefixed,
3704
- Jr as selectorComplexity
3705
- };