@projectwallace/css-analyzer 9.2.0 → 9.3.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.
- package/dist/css-analyzer.js +814 -783
- package/dist/index.d.ts +1 -0
- package/package.json +2 -2
package/dist/css-analyzer.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var vr = Object.defineProperty;
|
|
2
|
+
var Ti = (r) => {
|
|
3
3
|
throw TypeError(r);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
5
|
+
var Tr = (r, e, t) => e in r ? vr(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
6
|
+
var k = (r, e, t) => Tr(r, typeof e != "symbol" ? e + "" : e, t), Si = (r, e, t) => e.has(r) || Ti("Cannot " + t);
|
|
7
|
+
var E = (r, e, t) => (Si(r, e, "read from private field"), t ? t.call(r) : e.get(r)), Y = (r, e, t) => e.has(r) ? Ti("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), z = (r, e, t, s) => (Si(r, e, "write to private field"), s ? s.call(r, t) : e.set(r, t), t);
|
|
8
|
+
var ss = (r, e, t, s) => ({
|
|
9
9
|
set _(i) {
|
|
10
|
-
|
|
10
|
+
z(r, e, i, t);
|
|
11
11
|
},
|
|
12
12
|
get _() {
|
|
13
|
-
return
|
|
13
|
+
return E(r, e, s);
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
-
import { walk as
|
|
17
|
-
function
|
|
18
|
-
|
|
19
|
-
if (t.type ===
|
|
16
|
+
import { walk as G, SUPPORTS_QUERY as Wi, BREAK as Q, MEDIA_TYPE as Sr, MEDIA_FEATURE as Yi, str_equals as ge, DIMENSION as At, NUMBER as Cs, IDENTIFIER as _e, ATTRIBUTE_SELECTOR as Et, str_starts_with as Qi, PSEUDO_ELEMENT_SELECTOR as Qe, PSEUDO_CLASS_SELECTOR as Le, TYPE_SELECTOR as Ct, SELECTOR as ke, NTH_SELECTOR as Or, SKIP as D, COMBINATOR as _s, SELECTOR_LIST as ys, NTH_OF_SELECTOR as Nr, CLASS_SELECTOR as Lr, ID_SELECTOR as Ur, FUNCTION as bs, OPERATOR as Re, is_custom as Rs, is_vendor_prefixed as vs, parse as Ir, AT_RULE as Hr, BLOCK as Pr, DECLARATION as is, LAYER_NAME as Dr, CONTAINER_QUERY as Fr, STYLE_RULE as Mr, HASH as zr, URL as qr } from "@projectwallace/css-parser";
|
|
17
|
+
function Kr(r, e) {
|
|
18
|
+
G(r, function(t) {
|
|
19
|
+
if (t.type === Wi) {
|
|
20
20
|
const i = (t.prelude || t.value || "").toString().toLowerCase().replaceAll(/\s+/g, "");
|
|
21
21
|
if (i.includes("-webkit-appearance:none"))
|
|
22
22
|
return e("-webkit-appearance: none"), Q;
|
|
@@ -25,16 +25,16 @@ function qr(r, e) {
|
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
if (t.type ===
|
|
28
|
+
function $r(r, e) {
|
|
29
|
+
G(r, function(t) {
|
|
30
|
+
if (t.type === Sr) {
|
|
31
31
|
const s = t.text || "";
|
|
32
32
|
if (s.startsWith("\\0"))
|
|
33
33
|
return e("\\0"), Q;
|
|
34
34
|
if (s.includes("\\9"))
|
|
35
35
|
return e("\\9"), Q;
|
|
36
36
|
}
|
|
37
|
-
if (t.type ===
|
|
37
|
+
if (t.type === Yi) {
|
|
38
38
|
const s = t.name || "";
|
|
39
39
|
if (ge("-moz-images-in-menus", s))
|
|
40
40
|
return e("-moz-images-in-menus"), Q;
|
|
@@ -44,12 +44,12 @@ function Kr(r, e) {
|
|
|
44
44
|
return e("-ms-high-contrast"), Q;
|
|
45
45
|
if (ge("min-resolution", s) && t.has_children) {
|
|
46
46
|
for (const i of t)
|
|
47
|
-
if (i.type ===
|
|
47
|
+
if (i.type === At && i.value === 1e-3 && ge("dpcm", i.unit || ""))
|
|
48
48
|
return e("min-resolution: .001dpcm"), Q;
|
|
49
49
|
}
|
|
50
50
|
if (ge("-webkit-min-device-pixel-ratio", s) && t.has_children) {
|
|
51
51
|
for (const i of t)
|
|
52
|
-
if (i.type ===
|
|
52
|
+
if (i.type === Cs && (i.value === 0 || i.value === 1e4))
|
|
53
53
|
return e("-webkit-min-device-pixel-ratio"), Q;
|
|
54
54
|
}
|
|
55
55
|
if (t.has_children) {
|
|
@@ -62,98 +62,88 @@ function Kr(r, e) {
|
|
|
62
62
|
}
|
|
63
63
|
class W {
|
|
64
64
|
constructor(e) {
|
|
65
|
-
|
|
65
|
+
k(this, "set");
|
|
66
66
|
this.set = new Set(e);
|
|
67
67
|
}
|
|
68
68
|
has(e) {
|
|
69
69
|
return this.set.has(e.toLowerCase());
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function Vi(r) {
|
|
73
73
|
return r.replaceAll(/(?:^['"])|(?:['"]$)/g, "");
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function Br(r, e) {
|
|
76
76
|
return e >= 65 && e <= 90 && (e = e | 32), r === e;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function us(r, e) {
|
|
79
79
|
if (r === e) return !0;
|
|
80
80
|
let t = e.length, s = t - r.length;
|
|
81
81
|
if (s < 0)
|
|
82
82
|
return !1;
|
|
83
83
|
for (let i = t - 1; i >= s; i--)
|
|
84
|
-
if (
|
|
84
|
+
if (Br(r.charCodeAt(i - s), e.charCodeAt(i)) === !1)
|
|
85
85
|
return !1;
|
|
86
86
|
return !0;
|
|
87
87
|
}
|
|
88
|
-
const
|
|
89
|
-
function
|
|
90
|
-
|
|
91
|
-
if ((t.type === Qe || t.type === Le || t.type ===
|
|
88
|
+
const Gr = new W(["nth-child", "where", "not", "is", "has", "nth-last-child", "matches", "-webkit-any", "-moz-any"]);
|
|
89
|
+
function Wr(r, e) {
|
|
90
|
+
G(r, function(t) {
|
|
91
|
+
if ((t.type === Qe || t.type === Le || t.type === Ct) && t.is_vendor_prefixed) {
|
|
92
92
|
let s = "";
|
|
93
93
|
t.type === Le ? s = ":" : t.type === Qe && (s = "::"), e(s + (t.name || t.text));
|
|
94
94
|
}
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function Yr(r, e) {
|
|
98
98
|
function t(s) {
|
|
99
99
|
var n, l;
|
|
100
100
|
let i = s.clone();
|
|
101
|
-
return i.value ? "[" + ((n = i.name) == null ? void 0 : n.toLowerCase()) + i.attr_operator + '"' +
|
|
101
|
+
return i.value ? "[" + ((n = i.name) == null ? void 0 : n.toLowerCase()) + i.attr_operator + '"' + Vi(i.value.toString()) + '"]' : "[" + ((l = i.name) == null ? void 0 : l.toLowerCase()) + "]";
|
|
102
102
|
}
|
|
103
|
-
|
|
104
|
-
if (s.type ===
|
|
103
|
+
G(r, function(s) {
|
|
104
|
+
if (s.type === Et) {
|
|
105
105
|
const i = s.name || "";
|
|
106
|
-
(ge("role", i) ||
|
|
106
|
+
(ge("role", i) || Qi(i, "aria-")) && e(t(s));
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
z(r, function(t) {
|
|
112
|
-
t.type === Le && t.name && e(t.name);
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
function Qr(r, e) {
|
|
116
|
-
z(r, function(t) {
|
|
117
|
-
t.type === Qe && t.name && e(t.name);
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
function as(r) {
|
|
110
|
+
function fs(r) {
|
|
121
111
|
let e = 0;
|
|
122
112
|
function t(s, i) {
|
|
123
|
-
|
|
124
|
-
n.type ===
|
|
113
|
+
G(s, function(n) {
|
|
114
|
+
n.type === ke && i.push(fs(n));
|
|
125
115
|
});
|
|
126
116
|
}
|
|
127
|
-
return
|
|
117
|
+
return G(r, function(s) {
|
|
128
118
|
const i = s.type;
|
|
129
|
-
if (i !==
|
|
130
|
-
if (i ===
|
|
119
|
+
if (i !== ke) {
|
|
120
|
+
if (i === Or) {
|
|
131
121
|
s.text && s.text.trim() && e++;
|
|
132
122
|
return;
|
|
133
123
|
}
|
|
134
|
-
if (e++, (i === Qe || i ===
|
|
135
|
-
return s.value && e++,
|
|
124
|
+
if (e++, (i === Qe || i === Ct || i === Le) && s.is_vendor_prefixed && e++, i === Et)
|
|
125
|
+
return s.value && e++, D;
|
|
136
126
|
if (i === Le) {
|
|
137
127
|
const n = s.name || "";
|
|
138
|
-
if (
|
|
128
|
+
if (Gr.has(n.toLowerCase())) {
|
|
139
129
|
const l = [];
|
|
140
130
|
if (s.has_children)
|
|
141
131
|
for (const a of s)
|
|
142
|
-
a.type ===
|
|
132
|
+
a.type === ke ? l.push(fs(a)) : t(a, l);
|
|
143
133
|
if (l.length > 0) {
|
|
144
134
|
for (const a of l)
|
|
145
135
|
e += a;
|
|
146
|
-
return
|
|
136
|
+
return D;
|
|
147
137
|
}
|
|
148
138
|
}
|
|
149
139
|
}
|
|
150
140
|
}
|
|
151
141
|
}), e;
|
|
152
142
|
}
|
|
153
|
-
function
|
|
154
|
-
|
|
143
|
+
function Qr(r, e) {
|
|
144
|
+
G(r, function(t) {
|
|
155
145
|
var s;
|
|
156
|
-
t.type ===
|
|
146
|
+
t.type === _s && e({
|
|
157
147
|
name: ((s = t.name) == null ? void 0 : s.trim()) === "" ? " " : t.name,
|
|
158
148
|
loc: {
|
|
159
149
|
offset: t.start,
|
|
@@ -164,98 +154,106 @@ function Vr(r, e) {
|
|
|
164
154
|
});
|
|
165
155
|
});
|
|
166
156
|
}
|
|
167
|
-
let
|
|
157
|
+
let yt = 1, K = 2, bt = 4, ve = 8, ie = 16, xe = 32, g = new Uint8Array(128);
|
|
168
158
|
for (let r = 48; r <= 57; r++)
|
|
169
|
-
|
|
159
|
+
g[r] = K;
|
|
170
160
|
for (let r = 48; r <= 57; r++)
|
|
171
|
-
|
|
161
|
+
g[r] |= bt;
|
|
172
162
|
for (let r = 65; r <= 70; r++)
|
|
173
|
-
|
|
163
|
+
g[r] = bt;
|
|
174
164
|
for (let r = 97; r <= 102; r++)
|
|
175
|
-
|
|
165
|
+
g[r] = bt;
|
|
176
166
|
for (let r = 65; r <= 90; r++)
|
|
177
|
-
|
|
167
|
+
g[r] |= yt;
|
|
178
168
|
for (let r = 97; r <= 122; r++)
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
169
|
+
g[r] |= yt;
|
|
170
|
+
g[32] = ve;
|
|
171
|
+
g[9] = ve;
|
|
172
|
+
g[10] = ie;
|
|
173
|
+
g[13] = ie;
|
|
174
|
+
g[12] = ie;
|
|
175
|
+
for (let r = 0; r < 128; r++)
|
|
176
|
+
g[r] & (yt | K) && (g[r] |= xe);
|
|
177
|
+
g[45] |= xe;
|
|
178
|
+
g[95] |= xe;
|
|
188
179
|
function pe(r) {
|
|
189
|
-
return r < 128 && (
|
|
190
|
-
}
|
|
191
|
-
function Xr(r) {
|
|
192
|
-
return r < 128 && (y[r] & ys) !== 0;
|
|
180
|
+
return r < 128 && (g[r] & bt) !== 0;
|
|
193
181
|
}
|
|
194
|
-
function
|
|
195
|
-
return r < 128 && (
|
|
182
|
+
function Vr(r) {
|
|
183
|
+
return r < 128 && (g[r] & yt) !== 0;
|
|
196
184
|
}
|
|
197
|
-
function
|
|
198
|
-
return r < 128 && (
|
|
199
|
-
}
|
|
200
|
-
function Ke(r) {
|
|
201
|
-
return r >= 128 || r === 95 ? !0 : Xr(r);
|
|
185
|
+
function rs(r) {
|
|
186
|
+
return r < 128 && (g[r] & ve) !== 0;
|
|
202
187
|
}
|
|
203
188
|
function at(r) {
|
|
204
|
-
return r ===
|
|
189
|
+
return r >= 128 || r === 95 ? !0 : Vr(r);
|
|
190
|
+
}
|
|
191
|
+
const ae = 1, ut = 2, jr = 3, ji = 4, Xi = 5, Oi = 6, me = 9, ft = 10, Zi = 11, Ji = 12, ps = 13, Xr = 14, Zr = 15, er = 16, Jr = 17, $e = 18, ds = 19, tr = 20, sr = 21, ir = 22, en = 23, tn = 24, gs = 26, Ni = 27;
|
|
192
|
+
function ye(r) {
|
|
193
|
+
return r < 128 && (g[r] & ie) !== 0;
|
|
205
194
|
}
|
|
206
|
-
const
|
|
207
|
-
class
|
|
195
|
+
const sn = 123, rn = 125, nn = 58, ln = 59, on = 44, an = 91, hn = 93, Li = 40, cn = 41, ht = 47, ct = 42, _n = 34, un = 39, ns = 46, fn = 60, pn = 33, q = 45, dn = 62, gn = 64, xn = 35, ls = 92, Me = 43, mn = 37, kn = 101, wn = 69, An = 117, En = 85, Cn = 63, Ui = 13, Ii = 10;
|
|
196
|
+
class xs {
|
|
208
197
|
constructor(e, t) {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
198
|
+
k(this, "source");
|
|
199
|
+
k(this, "pos");
|
|
200
|
+
k(this, "_line");
|
|
201
|
+
k(this, "_line_offset");
|
|
202
|
+
k(this, "on_comment");
|
|
214
203
|
// Current token properties (avoiding object allocation)
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
this.source = e, this.pos = 0, this.
|
|
204
|
+
k(this, "token_type");
|
|
205
|
+
k(this, "token_start");
|
|
206
|
+
k(this, "token_end");
|
|
207
|
+
k(this, "token_line");
|
|
208
|
+
k(this, "token_column");
|
|
209
|
+
this.source = e, this.pos = 0, this._line = 1, this._line_offset = 0, this.on_comment = t, this.token_type = gs, this.token_start = 0, this.token_end = 0, this.token_line = 1, this.token_column = 1;
|
|
210
|
+
}
|
|
211
|
+
get line() {
|
|
212
|
+
return this._line;
|
|
213
|
+
}
|
|
214
|
+
get column() {
|
|
215
|
+
return this.pos - this._line_offset + 1;
|
|
216
|
+
}
|
|
217
|
+
seek(e, t, s = 1) {
|
|
218
|
+
this.pos = e, this._line = t, this._line_offset = e - s + 1;
|
|
221
219
|
}
|
|
222
220
|
// Fast token advancing without object allocation (for internal parser use)
|
|
223
221
|
next_token_fast(e = !1) {
|
|
224
222
|
if (e)
|
|
225
223
|
for (; this.pos < this.source.length; ) {
|
|
226
224
|
let l = this.source.charCodeAt(this.pos);
|
|
227
|
-
if (l >= 128 || (
|
|
225
|
+
if (l >= 128 || (g[l] & (ve | ie)) === 0) break;
|
|
228
226
|
this.advance();
|
|
229
227
|
}
|
|
230
228
|
if (this.pos >= this.source.length)
|
|
231
|
-
return this.make_token(
|
|
229
|
+
return this.make_token(gs, this.pos, this.pos);
|
|
232
230
|
let t = this.source.charCodeAt(this.pos), s = this.pos, i = this.line, n = this.column;
|
|
233
231
|
switch (t) {
|
|
232
|
+
case sn:
|
|
233
|
+
return this.advance(), this.make_token(en, s, this.pos, i, n);
|
|
234
|
+
case rn:
|
|
235
|
+
return this.advance(), this.make_token(tn, s, this.pos, i, n);
|
|
234
236
|
case nn:
|
|
235
|
-
return this.advance(), this.make_token(
|
|
237
|
+
return this.advance(), this.make_token(er, s, this.pos, i, n);
|
|
236
238
|
case ln:
|
|
237
|
-
return this.advance(), this.make_token(
|
|
239
|
+
return this.advance(), this.make_token(Jr, s, this.pos, i, n);
|
|
238
240
|
case on:
|
|
239
|
-
return this.advance(), this.make_token(
|
|
241
|
+
return this.advance(), this.make_token($e, s, this.pos, i, n);
|
|
240
242
|
case an:
|
|
241
|
-
return this.advance(), this.make_token(
|
|
243
|
+
return this.advance(), this.make_token(ds, s, this.pos, i, n);
|
|
242
244
|
case hn:
|
|
243
|
-
return this.advance(), this.make_token($e, s, this.pos, i, n);
|
|
244
|
-
case cn:
|
|
245
|
-
return this.advance(), this.make_token(cs, s, this.pos, i, n);
|
|
246
|
-
case _n:
|
|
247
|
-
return this.advance(), this.make_token(Ji, s, this.pos, i, n);
|
|
248
|
-
case Ti:
|
|
249
|
-
return this.advance(), this.make_token(er, s, this.pos, i, n);
|
|
250
|
-
case un:
|
|
251
245
|
return this.advance(), this.make_token(tr, s, this.pos, i, n);
|
|
246
|
+
case Li:
|
|
247
|
+
return this.advance(), this.make_token(sr, s, this.pos, i, n);
|
|
248
|
+
case cn:
|
|
249
|
+
return this.advance(), this.make_token(ir, s, this.pos, i, n);
|
|
252
250
|
}
|
|
253
|
-
if (t < 128 && (
|
|
251
|
+
if (t < 128 && (g[t] & (ve | ie)) !== 0)
|
|
254
252
|
return this.consume_whitespace(i, n);
|
|
255
|
-
if (t ===
|
|
253
|
+
if (t === ht && this.peek() === ct) {
|
|
256
254
|
let l = s, a = i, h = n;
|
|
257
255
|
for (this.advance(2); this.pos < this.source.length - 1; ) {
|
|
258
|
-
if (this.source.charCodeAt(this.pos) ===
|
|
256
|
+
if (this.source.charCodeAt(this.pos) === ct && this.peek() === ht) {
|
|
259
257
|
this.advance(2);
|
|
260
258
|
break;
|
|
261
259
|
}
|
|
@@ -270,74 +268,74 @@ class sr {
|
|
|
270
268
|
column: h
|
|
271
269
|
}), this.next_token_fast(e);
|
|
272
270
|
}
|
|
273
|
-
if (t ===
|
|
271
|
+
if (t === _n || t === un)
|
|
274
272
|
return this.consume_string(t, i, n);
|
|
275
|
-
if (t < 128 && (
|
|
273
|
+
if (t < 128 && (g[t] & K) !== 0)
|
|
276
274
|
return this.consume_number(i, n);
|
|
277
|
-
if (t ===
|
|
275
|
+
if (t === ns) {
|
|
278
276
|
let l = this.peek();
|
|
279
|
-
if (l < 128 && (
|
|
277
|
+
if (l < 128 && (g[l] & K) !== 0)
|
|
280
278
|
return this.consume_number(i, n);
|
|
281
279
|
}
|
|
282
|
-
if (t ===
|
|
283
|
-
return this.advance(4), this.make_token(
|
|
284
|
-
if (t ===
|
|
285
|
-
return this.advance(3), this.make_token(
|
|
286
|
-
if (t ===
|
|
280
|
+
if (t === fn && this.pos + 3 < this.source.length && this.peek() === pn && this.peek(2) === q && this.peek(3) === q)
|
|
281
|
+
return this.advance(4), this.make_token(Xr, s, this.pos, i, n);
|
|
282
|
+
if (t === q && this.pos + 2 < this.source.length && this.peek() === q && this.peek(2) === dn)
|
|
283
|
+
return this.advance(3), this.make_token(Zr, s, this.pos, i, n);
|
|
284
|
+
if (t === gn)
|
|
287
285
|
return this.consume_at_keyword(i, n);
|
|
288
|
-
if (t ===
|
|
286
|
+
if (t === xn)
|
|
289
287
|
return this.consume_hash(i, n);
|
|
290
|
-
if (
|
|
288
|
+
if (at(t))
|
|
291
289
|
return this.consume_ident_or_function(i, n);
|
|
292
|
-
if (t ===
|
|
290
|
+
if (t === q) {
|
|
293
291
|
let l = this.peek();
|
|
294
|
-
if (
|
|
292
|
+
if (at(l) || l === q)
|
|
295
293
|
return this.consume_ident_or_function(i, n);
|
|
296
294
|
}
|
|
297
|
-
if (t ===
|
|
295
|
+
if (t === ls) {
|
|
298
296
|
let l = this.peek();
|
|
299
|
-
if (l !== 0 && !
|
|
297
|
+
if (l !== 0 && !ye(l))
|
|
300
298
|
return this.consume_ident_or_function(i, n);
|
|
301
299
|
}
|
|
302
|
-
if (t ===
|
|
300
|
+
if (t === q || t === Me) {
|
|
303
301
|
let l = this.peek();
|
|
304
|
-
if (l < 128 && (
|
|
302
|
+
if (l < 128 && (g[l] & K) !== 0)
|
|
305
303
|
return this.consume_number(i, n);
|
|
306
|
-
if (l ===
|
|
304
|
+
if (l === ns) {
|
|
307
305
|
let h = this.peek(2);
|
|
308
|
-
if (h < 128 && (
|
|
306
|
+
if (h < 128 && (g[h] & K) !== 0)
|
|
309
307
|
return this.consume_number(i, n);
|
|
310
308
|
}
|
|
311
309
|
}
|
|
312
|
-
return this.advance(), this.make_token(
|
|
310
|
+
return this.advance(), this.make_token(me, s, this.pos, i, n);
|
|
313
311
|
}
|
|
314
312
|
consume_whitespace(e, t) {
|
|
315
313
|
let s = this.pos;
|
|
316
314
|
for (; this.pos < this.source.length; ) {
|
|
317
315
|
let i = this.source.charCodeAt(this.pos);
|
|
318
|
-
if (i >= 128 || (
|
|
316
|
+
if (i >= 128 || (g[i] & (ve | ie)) === 0) break;
|
|
319
317
|
this.advance();
|
|
320
318
|
}
|
|
321
|
-
return this.make_token(
|
|
319
|
+
return this.make_token(ps, s, this.pos, e, t);
|
|
322
320
|
}
|
|
323
321
|
consume_string(e, t, s) {
|
|
324
322
|
let i = this.pos;
|
|
325
323
|
for (this.advance(); this.pos < this.source.length; ) {
|
|
326
324
|
let n = this.source.charCodeAt(this.pos);
|
|
327
325
|
if (n === e)
|
|
328
|
-
return this.advance(), this.make_token(
|
|
329
|
-
if (
|
|
330
|
-
return this.make_token(
|
|
331
|
-
if (n ===
|
|
326
|
+
return this.advance(), this.make_token(Xi, i, this.pos, t, s);
|
|
327
|
+
if (ye(n))
|
|
328
|
+
return this.make_token(Oi, i, this.pos, t, s);
|
|
329
|
+
if (n === ls) {
|
|
332
330
|
if (this.advance(), this.pos < this.source.length) {
|
|
333
331
|
let l = this.source.charCodeAt(this.pos);
|
|
334
|
-
pe(l) ? this.consume_hex_escape() :
|
|
332
|
+
pe(l) ? this.consume_hex_escape() : ye(l) ? this.advance() : this.advance();
|
|
335
333
|
}
|
|
336
334
|
continue;
|
|
337
335
|
}
|
|
338
336
|
this.advance();
|
|
339
337
|
}
|
|
340
|
-
return this.make_token(
|
|
338
|
+
return this.make_token(Oi, i, this.pos, t, s);
|
|
341
339
|
}
|
|
342
340
|
consume_hex_escape() {
|
|
343
341
|
let e = 0;
|
|
@@ -348,37 +346,37 @@ class sr {
|
|
|
348
346
|
}
|
|
349
347
|
if (this.pos < this.source.length) {
|
|
350
348
|
let t = this.source.charCodeAt(this.pos);
|
|
351
|
-
(
|
|
349
|
+
(rs(t) || ye(t)) && this.advance();
|
|
352
350
|
}
|
|
353
351
|
}
|
|
354
352
|
consume_number(e, t) {
|
|
355
353
|
let s = this.pos, i = this.source.charCodeAt(this.pos);
|
|
356
|
-
for ((i === Me || i ===
|
|
354
|
+
for ((i === Me || i === q) && this.advance(); this.pos < this.source.length; ) {
|
|
357
355
|
let n = this.source.charCodeAt(this.pos);
|
|
358
|
-
if (n >= 128 || (
|
|
356
|
+
if (n >= 128 || (g[n] & K) === 0) break;
|
|
359
357
|
this.advance();
|
|
360
358
|
}
|
|
361
|
-
if (this.pos < this.source.length && this.source.charCodeAt(this.pos) ===
|
|
359
|
+
if (this.pos < this.source.length && this.source.charCodeAt(this.pos) === ns && this.pos + 1 < this.source.length) {
|
|
362
360
|
let n = this.peek();
|
|
363
|
-
if (n < 128 && (
|
|
361
|
+
if (n < 128 && (g[n] & K) !== 0)
|
|
364
362
|
for (this.advance(); this.pos < this.source.length; ) {
|
|
365
363
|
let l = this.source.charCodeAt(this.pos);
|
|
366
|
-
if (l >= 128 || (
|
|
364
|
+
if (l >= 128 || (g[l] & K) === 0) break;
|
|
367
365
|
this.advance();
|
|
368
366
|
}
|
|
369
367
|
}
|
|
370
368
|
if (this.pos < this.source.length) {
|
|
371
369
|
let n = this.source.charCodeAt(this.pos);
|
|
372
|
-
if (n ===
|
|
373
|
-
let l = this.peek(), a = l < 128 && (
|
|
374
|
-
if (a || (l === Me || l ===
|
|
370
|
+
if (n === kn || n === wn) {
|
|
371
|
+
let l = this.peek(), a = l < 128 && (g[l] & K) !== 0, h = this.peek(2), o = h < 128 && (g[h] & K) !== 0;
|
|
372
|
+
if (a || (l === Me || l === q) && o) {
|
|
375
373
|
if (this.advance(), this.pos < this.source.length) {
|
|
376
374
|
let u = this.source.charCodeAt(this.pos);
|
|
377
|
-
(u === Me || u ===
|
|
375
|
+
(u === Me || u === q) && this.advance();
|
|
378
376
|
}
|
|
379
377
|
for (; this.pos < this.source.length; ) {
|
|
380
378
|
let u = this.source.charCodeAt(this.pos);
|
|
381
|
-
if (u >= 128 || (
|
|
379
|
+
if (u >= 128 || (g[u] & K) === 0) break;
|
|
382
380
|
this.advance();
|
|
383
381
|
}
|
|
384
382
|
}
|
|
@@ -386,45 +384,48 @@ class sr {
|
|
|
386
384
|
}
|
|
387
385
|
if (this.pos < this.source.length) {
|
|
388
386
|
let n = this.source.charCodeAt(this.pos);
|
|
389
|
-
if (n ===
|
|
390
|
-
return this.advance(), this.make_token(
|
|
391
|
-
if (
|
|
392
|
-
for (; this.pos < this.source.length
|
|
387
|
+
if (n === mn)
|
|
388
|
+
return this.advance(), this.make_token(Zi, s, this.pos, e, t);
|
|
389
|
+
if (at(n) || n === q && at(this.peek())) {
|
|
390
|
+
for (; this.pos < this.source.length; ) {
|
|
391
|
+
let l = this.source.charCodeAt(this.pos);
|
|
392
|
+
if (l < 128 && (g[l] & xe) === 0) break;
|
|
393
393
|
this.advance();
|
|
394
|
-
|
|
394
|
+
}
|
|
395
|
+
return this.make_token(Ji, s, this.pos, e, t);
|
|
395
396
|
}
|
|
396
397
|
}
|
|
397
|
-
return this.make_token(
|
|
398
|
+
return this.make_token(ft, s, this.pos, e, t);
|
|
398
399
|
}
|
|
399
400
|
consume_ident_or_function(e, t) {
|
|
400
401
|
let s = this.pos;
|
|
401
402
|
for (; this.pos < this.source.length; ) {
|
|
402
403
|
let i = this.source.charCodeAt(this.pos);
|
|
403
|
-
if (i ===
|
|
404
|
+
if (i === ls) {
|
|
404
405
|
if (this.pos + 1 >= this.source.length) break;
|
|
405
406
|
let n = this.peek();
|
|
406
|
-
if (
|
|
407
|
+
if (ye(n)) break;
|
|
407
408
|
if (this.advance(), pe(n)) {
|
|
408
409
|
this.advance();
|
|
409
410
|
for (let l = 0; l < 5 && this.pos < this.source.length && pe(this.source.charCodeAt(this.pos)); l++)
|
|
410
411
|
this.advance();
|
|
411
412
|
if (this.pos < this.source.length) {
|
|
412
413
|
let l = this.source.charCodeAt(this.pos);
|
|
413
|
-
(
|
|
414
|
+
(rs(l) || ye(l)) && this.advance();
|
|
414
415
|
}
|
|
415
416
|
} else
|
|
416
417
|
this.advance();
|
|
417
|
-
} else if (
|
|
418
|
+
} else if (i >= 128 || (g[i] & xe) !== 0)
|
|
418
419
|
this.advance();
|
|
419
420
|
else
|
|
420
421
|
break;
|
|
421
422
|
}
|
|
422
423
|
if (this.pos - s === 1) {
|
|
423
424
|
let i = this.source.charCodeAt(s);
|
|
424
|
-
if ((i ===
|
|
425
|
+
if ((i === An || i === En) && this.pos < this.source.length && this.source.charCodeAt(this.pos) === Me)
|
|
425
426
|
return this.consume_unicode_range(s, e, t);
|
|
426
427
|
}
|
|
427
|
-
return this.pos < this.source.length && this.source.charCodeAt(this.pos) ===
|
|
428
|
+
return this.pos < this.source.length && this.source.charCodeAt(this.pos) === Li ? (this.advance(), this.make_token(ut, s, this.pos, e, t)) : this.make_token(ae, s, this.pos, e, t);
|
|
428
429
|
}
|
|
429
430
|
consume_unicode_range(e, t, s) {
|
|
430
431
|
this.advance();
|
|
@@ -435,14 +436,14 @@ class sr {
|
|
|
435
436
|
if (n)
|
|
436
437
|
break;
|
|
437
438
|
this.advance(), i++;
|
|
438
|
-
} else if (l ===
|
|
439
|
+
} else if (l === Cn)
|
|
439
440
|
this.advance(), i++, n = !0;
|
|
440
441
|
else
|
|
441
442
|
break;
|
|
442
443
|
}
|
|
443
444
|
if (n)
|
|
444
|
-
return this.make_token(
|
|
445
|
-
if (this.pos < this.source.length && this.source.charCodeAt(this.pos) ===
|
|
445
|
+
return this.make_token(Ni, e, this.pos, t, s);
|
|
446
|
+
if (this.pos < this.source.length && this.source.charCodeAt(this.pos) === q && this.pos + 1 < this.source.length && pe(this.source.charCodeAt(this.pos + 1))) {
|
|
446
447
|
this.advance();
|
|
447
448
|
let l = 0;
|
|
448
449
|
for (; this.pos < this.source.length && l < 6; ) {
|
|
@@ -453,30 +454,36 @@ class sr {
|
|
|
453
454
|
break;
|
|
454
455
|
}
|
|
455
456
|
}
|
|
456
|
-
return this.make_token(
|
|
457
|
+
return this.make_token(Ni, e, this.pos, t, s);
|
|
457
458
|
}
|
|
458
459
|
consume_at_keyword(e, t) {
|
|
459
460
|
let s = this.pos;
|
|
460
|
-
for (this.advance(); this.pos < this.source.length
|
|
461
|
+
for (this.advance(); this.pos < this.source.length; ) {
|
|
462
|
+
let i = this.source.charCodeAt(this.pos);
|
|
463
|
+
if (i < 128 && (g[i] & xe) === 0) break;
|
|
461
464
|
this.advance();
|
|
462
|
-
|
|
465
|
+
}
|
|
466
|
+
return this.make_token(jr, s, this.pos, e, t);
|
|
463
467
|
}
|
|
464
468
|
consume_hash(e, t) {
|
|
465
469
|
let s = this.pos;
|
|
466
|
-
for (this.advance(); this.pos < this.source.length
|
|
470
|
+
for (this.advance(); this.pos < this.source.length; ) {
|
|
471
|
+
let i = this.source.charCodeAt(this.pos);
|
|
472
|
+
if (i < 128 && (g[i] & xe) === 0) break;
|
|
467
473
|
this.advance();
|
|
468
|
-
|
|
474
|
+
}
|
|
475
|
+
return this.make_token(ji, s, this.pos, e, t);
|
|
469
476
|
}
|
|
470
477
|
advance(e = 1) {
|
|
471
478
|
if (e === 1) {
|
|
472
479
|
if (this.pos >= this.source.length) return;
|
|
473
480
|
let t = this.source.charCodeAt(this.pos);
|
|
474
|
-
this.pos++,
|
|
481
|
+
this.pos++, t < 128 && (g[t] & ie) !== 0 && (t === Ui && this.pos < this.source.length && this.source.charCodeAt(this.pos) === Ii && this.pos++, this._line++, this._line_offset = this.pos);
|
|
475
482
|
return;
|
|
476
483
|
}
|
|
477
484
|
for (let t = 0; t < e && !(this.pos >= this.source.length); t++) {
|
|
478
485
|
let s = this.source.charCodeAt(this.pos);
|
|
479
|
-
this.pos++,
|
|
486
|
+
this.pos++, s < 128 && (g[s] & ie) !== 0 && (s === Ui && this.pos < this.source.length && this.source.charCodeAt(this.pos) === Ii && (this.pos++, t++), this._line++, this._line_offset = this.pos);
|
|
480
487
|
}
|
|
481
488
|
}
|
|
482
489
|
peek(e = 1) {
|
|
@@ -503,8 +510,9 @@ class sr {
|
|
|
503
510
|
save_position() {
|
|
504
511
|
return {
|
|
505
512
|
pos: this.pos,
|
|
506
|
-
line: this.
|
|
513
|
+
line: this._line,
|
|
507
514
|
column: this.column,
|
|
515
|
+
_line_offset: this._line_offset,
|
|
508
516
|
token_type: this.token_type,
|
|
509
517
|
token_start: this.token_start,
|
|
510
518
|
token_end: this.token_end,
|
|
@@ -517,22 +525,46 @@ class sr {
|
|
|
517
525
|
* @param saved The saved position to restore
|
|
518
526
|
*/
|
|
519
527
|
restore_position(e) {
|
|
520
|
-
this.pos = e.pos, this.
|
|
528
|
+
this.pos = e.pos, this._line = e.line, this._line_offset = e._line_offset, this.token_type = e.token_type, this.token_start = e.token_start, this.token_end = e.token_end, this.token_line = e.token_line, this.token_column = e.token_column;
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Skip whitespace and comments within a range, maintaining line/column tracking
|
|
532
|
+
* @param end The end boundary (exclusive)
|
|
533
|
+
*/
|
|
534
|
+
skip_whitespace_in_range(e) {
|
|
535
|
+
for (; this.pos < e; ) {
|
|
536
|
+
let t = this.source.charCodeAt(this.pos);
|
|
537
|
+
if (rs(t)) {
|
|
538
|
+
this.advance();
|
|
539
|
+
continue;
|
|
540
|
+
}
|
|
541
|
+
if (t === ht && this.pos + 1 < e && this.source.charCodeAt(this.pos + 1) === ct) {
|
|
542
|
+
for (this.advance(), this.advance(); this.pos < e; ) {
|
|
543
|
+
if (this.source.charCodeAt(this.pos) === ct && this.pos + 1 < e && this.source.charCodeAt(this.pos + 1) === ht) {
|
|
544
|
+
this.advance(), this.advance();
|
|
545
|
+
break;
|
|
546
|
+
}
|
|
547
|
+
this.advance();
|
|
548
|
+
}
|
|
549
|
+
continue;
|
|
550
|
+
}
|
|
551
|
+
break;
|
|
552
|
+
}
|
|
521
553
|
}
|
|
522
554
|
}
|
|
523
|
-
let
|
|
524
|
-
const
|
|
555
|
+
let _t = 36;
|
|
556
|
+
const yn = 1, pt = 2, Be = 3, J = 4, Ts = 5, rr = 6, dt = 7, nr = 10, ms = 11, Ge = 12, lr = 13, bn = 14, or = 15, ks = 16, Rn = 17, ar = 18, vn = 19, Rt = 20, ws = 21, hr = 22, cr = 23, We = 24, Te = 25, Ve = 26, gt = 27, As = 28, _r = 29, Ye = 30, le = 31, ur = 56, Tn = 32, fr = 33, Sn = 34, On = 35, Nn = 36, Ln = 37, Un = 38, In = 39, pr = 40, Hn = 50, Pn = 1, Dn = 2, Hi = 4, Fn = 8, Mn = 32, dr = 64, zn = 128, Es = 0, gr = 1, xr = 2, mr = 3, kr = 4, wr = 5, Ar = 6, be = 0, Er = 1, Cr = 2, oe = class oe {
|
|
525
557
|
constructor(e = 1024) {
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
558
|
+
k(this, "buffer");
|
|
559
|
+
k(this, "view");
|
|
560
|
+
k(this, "capacity");
|
|
529
561
|
// Number of nodes that can fit
|
|
530
|
-
|
|
562
|
+
k(this, "count");
|
|
531
563
|
// Number of nodes currently allocated
|
|
532
|
-
|
|
564
|
+
k(this, "growth_count");
|
|
533
565
|
// Number of times the arena has grown
|
|
534
|
-
|
|
535
|
-
this.capacity = e, this.count = 1, this.growth_count = 0, this.buffer = new ArrayBuffer(e *
|
|
566
|
+
k(this, "overflow_lengths");
|
|
567
|
+
this.capacity = e, this.count = 1, this.growth_count = 0, this.buffer = new ArrayBuffer(e * _t), this.view = new DataView(this.buffer), this.overflow_lengths = /* @__PURE__ */ new Map();
|
|
536
568
|
}
|
|
537
569
|
// Calculate recommended initial capacity based on CSS source size
|
|
538
570
|
static capacity_for_source(e) {
|
|
@@ -553,7 +585,7 @@ const Rn = 1, ut = 2, Be = 3, J = 4, Cs = 5, ir = 6, ft = 7, rr = 10, us = 11, G
|
|
|
553
585
|
}
|
|
554
586
|
// Calculate byte offset for a node
|
|
555
587
|
node_offset(e) {
|
|
556
|
-
return e *
|
|
588
|
+
return e * _t;
|
|
557
589
|
}
|
|
558
590
|
// Read node type
|
|
559
591
|
get_type(e) {
|
|
@@ -569,7 +601,7 @@ const Rn = 1, ut = 2, Be = 3, J = 4, Cs = 5, ir = 6, ft = 7, rr = 10, us = 11, G
|
|
|
569
601
|
}
|
|
570
602
|
// Read length in source
|
|
571
603
|
get_length(e) {
|
|
572
|
-
if (this.has_flag(e,
|
|
604
|
+
if (this.has_flag(e, Hi)) {
|
|
573
605
|
const t = this.overflow_lengths.get(e);
|
|
574
606
|
if (t !== void 0)
|
|
575
607
|
return t;
|
|
@@ -629,7 +661,7 @@ const Rn = 1, ut = 2, Be = 3, J = 4, Cs = 5, ir = 6, ft = 7, rr = 10, us = 11, G
|
|
|
629
661
|
}
|
|
630
662
|
// Write length in source
|
|
631
663
|
set_length(e, t) {
|
|
632
|
-
t > 65535 ? (this.view.setUint16(this.node_offset(e) + 2, 65535, !0), this.set_flag(e,
|
|
664
|
+
t > 65535 ? (this.view.setUint16(this.node_offset(e) + 2, 65535, !0), this.set_flag(e, Hi), this.overflow_lengths.set(e, t)) : this.view.setUint16(this.node_offset(e) + 2, t, !0);
|
|
633
665
|
}
|
|
634
666
|
// Write content start delta (offset from startOffset)
|
|
635
667
|
set_content_start_delta(e, t) {
|
|
@@ -667,7 +699,7 @@ const Rn = 1, ut = 2, Be = 3, J = 4, Cs = 5, ir = 6, ft = 7, rr = 10, us = 11, G
|
|
|
667
699
|
// Grow the arena by 1.3x when capacity is exceeded
|
|
668
700
|
grow() {
|
|
669
701
|
this.growth_count++;
|
|
670
|
-
let e = Math.ceil(this.capacity * oe.GROWTH_FACTOR), t = new ArrayBuffer(e *
|
|
702
|
+
let e = Math.ceil(this.capacity * oe.GROWTH_FACTOR), t = new ArrayBuffer(e * _t);
|
|
671
703
|
new Uint8Array(t).set(new Uint8Array(this.buffer)), this.buffer = t, this.view = new DataView(t), this.capacity = e;
|
|
672
704
|
}
|
|
673
705
|
// Allocate and initialize a new node with core properties
|
|
@@ -676,7 +708,7 @@ const Rn = 1, ut = 2, Be = 3, J = 4, Cs = 5, ir = 6, ft = 7, rr = 10, us = 11, G
|
|
|
676
708
|
this.count >= this.capacity && this.grow();
|
|
677
709
|
const l = this.count;
|
|
678
710
|
this.count++;
|
|
679
|
-
const a = l *
|
|
711
|
+
const a = l * _t;
|
|
680
712
|
return this.view.setUint8(a, e), this.view.setUint32(a + 12, t, !0), this.view.setUint32(a + 24, i, !0), this.view.setUint32(a + 28, n, !0), this.set_length(l, s), l;
|
|
681
713
|
}
|
|
682
714
|
// --- Tree Building Helpers ---
|
|
@@ -715,20 +747,20 @@ const Rn = 1, ut = 2, Be = 3, J = 4, Cs = 5, ir = 6, ft = 7, rr = 10, us = 11, G
|
|
|
715
747
|
};
|
|
716
748
|
// Stores actual lengths for nodes > 65535 chars
|
|
717
749
|
// Growth multiplier when capacity is exceeded
|
|
718
|
-
|
|
750
|
+
k(oe, "GROWTH_FACTOR", 1.3), // Estimated nodes per KB of CSS (based on real-world data)
|
|
719
751
|
// Increased from 270 to 325 to account for VALUE wrapper nodes
|
|
720
752
|
// (~20% of nodes are declarations, +1 VALUE node per declaration = +20% nodes)
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
let
|
|
724
|
-
const
|
|
725
|
-
function
|
|
726
|
-
return r ===
|
|
753
|
+
k(oe, "NODES_PER_KB", 325), // Buffer to avoid frequent growth (15%)
|
|
754
|
+
k(oe, "CAPACITY_BUFFER", 1.2);
|
|
755
|
+
let mt = oe;
|
|
756
|
+
const qn = 32, Kn = 9, $n = 10, Bn = 13, Gn = 12, Ue = 47, j = 42, M = 45, Wn = 39, Yn = 34, re = 43, yr = 46, xt = 126, br = 62, Qn = 38, de = 61, ze = 124, Pi = 36, Di = 94, Vn = 58;
|
|
757
|
+
function ne(r) {
|
|
758
|
+
return r === qn || r === Kn || r === $n || r === Bn || r === Gn;
|
|
727
759
|
}
|
|
728
|
-
function
|
|
729
|
-
return r ===
|
|
760
|
+
function jn(r) {
|
|
761
|
+
return r === br || r === re || r === xt;
|
|
730
762
|
}
|
|
731
|
-
function
|
|
763
|
+
function os(r) {
|
|
732
764
|
return r >= 48 && r <= 57;
|
|
733
765
|
}
|
|
734
766
|
function V(r, e) {
|
|
@@ -741,7 +773,7 @@ function V(r, e) {
|
|
|
741
773
|
}
|
|
742
774
|
return !0;
|
|
743
775
|
}
|
|
744
|
-
function
|
|
776
|
+
function Xn(r, e) {
|
|
745
777
|
if (r.length < e.length)
|
|
746
778
|
return !1;
|
|
747
779
|
for (let t = 0; t < e.length; t++) {
|
|
@@ -751,7 +783,7 @@ function Jn(r, e) {
|
|
|
751
783
|
}
|
|
752
784
|
return !0;
|
|
753
785
|
}
|
|
754
|
-
function
|
|
786
|
+
function Zn(r, e) {
|
|
755
787
|
if (e.length === 0)
|
|
756
788
|
return -1;
|
|
757
789
|
if (e.length === 1) {
|
|
@@ -785,15 +817,15 @@ function qe(r, e, t) {
|
|
|
785
817
|
return !0;
|
|
786
818
|
return !1;
|
|
787
819
|
}
|
|
788
|
-
function
|
|
789
|
-
for (; e < t &&
|
|
820
|
+
function Jn(r, e, t) {
|
|
821
|
+
for (; e < t && ne(r.charCodeAt(e)); )
|
|
790
822
|
e++;
|
|
791
823
|
return e;
|
|
792
824
|
}
|
|
793
|
-
function
|
|
825
|
+
function Ke(r, e, t) {
|
|
794
826
|
for (; e < t; ) {
|
|
795
827
|
let s = r.charCodeAt(e);
|
|
796
|
-
if (
|
|
828
|
+
if (ne(s)) {
|
|
797
829
|
e++;
|
|
798
830
|
continue;
|
|
799
831
|
}
|
|
@@ -811,10 +843,10 @@ function be(r, e, t) {
|
|
|
811
843
|
}
|
|
812
844
|
return e;
|
|
813
845
|
}
|
|
814
|
-
function
|
|
846
|
+
function el(r, e, t) {
|
|
815
847
|
for (; e > t; ) {
|
|
816
848
|
let s = r.charCodeAt(e - 1);
|
|
817
|
-
if (
|
|
849
|
+
if (ne(s)) {
|
|
818
850
|
e--;
|
|
819
851
|
continue;
|
|
820
852
|
}
|
|
@@ -832,20 +864,20 @@ function sl(r, e, t) {
|
|
|
832
864
|
}
|
|
833
865
|
return e;
|
|
834
866
|
}
|
|
835
|
-
function
|
|
867
|
+
function as(r) {
|
|
836
868
|
let e = 0;
|
|
837
869
|
for (let n = 0; n < r.length; n++) {
|
|
838
870
|
let l = r.charCodeAt(n);
|
|
839
871
|
if (l === 101 || l === 69) {
|
|
840
872
|
if (n + 1 < r.length) {
|
|
841
873
|
let a = r.charCodeAt(n + 1);
|
|
842
|
-
if (
|
|
874
|
+
if (os(a)) {
|
|
843
875
|
e = n + 1;
|
|
844
876
|
continue;
|
|
845
877
|
}
|
|
846
878
|
if ((a === 43 || a === 45) && n + 2 < r.length) {
|
|
847
879
|
let h = r.charCodeAt(n + 2);
|
|
848
|
-
if (
|
|
880
|
+
if (os(h)) {
|
|
849
881
|
e = n + 1;
|
|
850
882
|
continue;
|
|
851
883
|
}
|
|
@@ -853,7 +885,7 @@ function is(r) {
|
|
|
853
885
|
}
|
|
854
886
|
break;
|
|
855
887
|
}
|
|
856
|
-
if (
|
|
888
|
+
if (os(l) || l === yr || l === M || l === re)
|
|
857
889
|
e = n + 1;
|
|
858
890
|
else
|
|
859
891
|
break;
|
|
@@ -861,65 +893,65 @@ function is(r) {
|
|
|
861
893
|
let t = r.substring(0, e), s = r.substring(e);
|
|
862
894
|
return { value: t ? parseFloat(t) : 0, unit: s };
|
|
863
895
|
}
|
|
864
|
-
const
|
|
865
|
-
[
|
|
866
|
-
[
|
|
896
|
+
const tl = {
|
|
897
|
+
[yn]: "StyleSheet",
|
|
898
|
+
[pt]: "Rule",
|
|
867
899
|
[Be]: "Atrule",
|
|
868
900
|
[J]: "Declaration",
|
|
869
|
-
[
|
|
870
|
-
[
|
|
871
|
-
[
|
|
872
|
-
[
|
|
873
|
-
[
|
|
901
|
+
[Ts]: "Selector",
|
|
902
|
+
[rr]: "Comment",
|
|
903
|
+
[dt]: "Block",
|
|
904
|
+
[nr]: "Identifier",
|
|
905
|
+
[ms]: "Number",
|
|
874
906
|
[Ge]: "Dimension",
|
|
875
|
-
[
|
|
876
|
-
[
|
|
877
|
-
[
|
|
878
|
-
[
|
|
879
|
-
[
|
|
880
|
-
[
|
|
881
|
-
[
|
|
882
|
-
[
|
|
883
|
-
[
|
|
884
|
-
[
|
|
885
|
-
[
|
|
886
|
-
[
|
|
907
|
+
[lr]: "String",
|
|
908
|
+
[bn]: "Hash",
|
|
909
|
+
[or]: "Function",
|
|
910
|
+
[ks]: "Operator",
|
|
911
|
+
[Rn]: "Parentheses",
|
|
912
|
+
[ar]: "Url",
|
|
913
|
+
[vn]: "UnicodeRange",
|
|
914
|
+
[Hn]: "Value",
|
|
915
|
+
[Rt]: "SelectorList",
|
|
916
|
+
[ws]: "TypeSelector",
|
|
917
|
+
[hr]: "ClassSelector",
|
|
918
|
+
[cr]: "IdSelector",
|
|
887
919
|
[We]: "AttributeSelector",
|
|
888
920
|
[Te]: "PseudoClassSelector",
|
|
889
921
|
[Ve]: "PseudoElementSelector",
|
|
890
|
-
[
|
|
891
|
-
[
|
|
892
|
-
[
|
|
922
|
+
[gt]: "Combinator",
|
|
923
|
+
[As]: "UniversalSelector",
|
|
924
|
+
[_r]: "NestingSelector",
|
|
893
925
|
[Ye]: "Nth",
|
|
894
926
|
[le]: "NthOf",
|
|
895
|
-
[
|
|
896
|
-
[
|
|
897
|
-
[
|
|
898
|
-
[
|
|
899
|
-
[
|
|
900
|
-
[
|
|
901
|
-
[
|
|
902
|
-
[
|
|
903
|
-
[
|
|
904
|
-
[
|
|
905
|
-
},
|
|
906
|
-
[
|
|
907
|
-
[
|
|
908
|
-
[
|
|
909
|
-
[
|
|
910
|
-
[
|
|
911
|
-
[
|
|
912
|
-
[
|
|
913
|
-
},
|
|
914
|
-
[
|
|
915
|
-
[
|
|
916
|
-
[
|
|
927
|
+
[ur]: "Lang",
|
|
928
|
+
[Tn]: "MediaQuery",
|
|
929
|
+
[fr]: "Feature",
|
|
930
|
+
[Sn]: "MediaType",
|
|
931
|
+
[On]: "ContainerQuery",
|
|
932
|
+
[Nn]: "SupportsQuery",
|
|
933
|
+
[Ln]: "Layer",
|
|
934
|
+
[Un]: "Operator",
|
|
935
|
+
[In]: "MediaFeatureRange",
|
|
936
|
+
[pr]: "AtrulePrelude"
|
|
937
|
+
}, sl = {
|
|
938
|
+
[Es]: null,
|
|
939
|
+
[gr]: "=",
|
|
940
|
+
[xr]: "~=",
|
|
941
|
+
[mr]: "|=",
|
|
942
|
+
[kr]: "^=",
|
|
943
|
+
[wr]: "$=",
|
|
944
|
+
[Ar]: "*="
|
|
945
|
+
}, il = {
|
|
946
|
+
[be]: null,
|
|
947
|
+
[Er]: "i",
|
|
948
|
+
[Cr]: "s"
|
|
917
949
|
};
|
|
918
950
|
class je {
|
|
919
951
|
constructor(e, t, s) {
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
952
|
+
k(this, "arena");
|
|
953
|
+
k(this, "source");
|
|
954
|
+
k(this, "index");
|
|
923
955
|
this.arena = e, this.source = t, this.index = s;
|
|
924
956
|
}
|
|
925
957
|
/**
|
|
@@ -939,7 +971,7 @@ class je {
|
|
|
939
971
|
}
|
|
940
972
|
/** Get node type as human-readable string */
|
|
941
973
|
get type_name() {
|
|
942
|
-
return
|
|
974
|
+
return tl[this.type] || "unknown";
|
|
943
975
|
}
|
|
944
976
|
/** Get the full text of this node from source */
|
|
945
977
|
get text() {
|
|
@@ -949,7 +981,7 @@ class je {
|
|
|
949
981
|
/** Get the "content" text (at-rule name for at-rules, layer name for import layers) */
|
|
950
982
|
get name() {
|
|
951
983
|
let { type: e } = this;
|
|
952
|
-
if (!(e === J || e ===
|
|
984
|
+
if (!(e === J || e === ks || e === Ts))
|
|
953
985
|
return this.get_content();
|
|
954
986
|
}
|
|
955
987
|
/**
|
|
@@ -958,7 +990,7 @@ class je {
|
|
|
958
990
|
*/
|
|
959
991
|
get property() {
|
|
960
992
|
let { type: e } = this;
|
|
961
|
-
if (!(e !== J && e !==
|
|
993
|
+
if (!(e !== J && e !== fr))
|
|
962
994
|
return this.get_content();
|
|
963
995
|
}
|
|
964
996
|
/**
|
|
@@ -973,20 +1005,20 @@ class je {
|
|
|
973
1005
|
if (e === J && s)
|
|
974
1006
|
return s;
|
|
975
1007
|
if (e === Ge)
|
|
976
|
-
return
|
|
977
|
-
if (e ===
|
|
1008
|
+
return as(t).value;
|
|
1009
|
+
if (e === ms)
|
|
978
1010
|
return Number.parseFloat(t);
|
|
979
|
-
if (e ===
|
|
980
|
-
if ((s == null ? void 0 : s.type) ===
|
|
1011
|
+
if (e === ar) {
|
|
1012
|
+
if ((s == null ? void 0 : s.type) === lr)
|
|
981
1013
|
return s.text;
|
|
982
|
-
if (
|
|
1014
|
+
if (Xn(t, "url(")) {
|
|
983
1015
|
let l = t.indexOf("("), a = t.lastIndexOf(")");
|
|
984
1016
|
if (l !== -1 && a !== -1 && a > l)
|
|
985
1017
|
return t.substring(l + 1, a).trim();
|
|
986
1018
|
} else if (t.startsWith('"') || t.startsWith("'"))
|
|
987
1019
|
return t;
|
|
988
1020
|
}
|
|
989
|
-
if (e ===
|
|
1021
|
+
if (e === ks)
|
|
990
1022
|
return this.get_content();
|
|
991
1023
|
let i = this.arena.get_value_start(this.index), n = this.arena.get_value_length(this.index);
|
|
992
1024
|
return n === 0 ? null : this.source.substring(i, i + n);
|
|
@@ -994,7 +1026,7 @@ class je {
|
|
|
994
1026
|
/** Get the numeric value for NUMBER and DIMENSION nodes, or null for other node types */
|
|
995
1027
|
get value_as_number() {
|
|
996
1028
|
let { text: e, type: t } = this;
|
|
997
|
-
return t ===
|
|
1029
|
+
return t === ms ? Number.parseFloat(e) : t === Ge ? as(e).value : null;
|
|
998
1030
|
}
|
|
999
1031
|
/**
|
|
1000
1032
|
* Get the prelude node:
|
|
@@ -1005,9 +1037,9 @@ class je {
|
|
|
1005
1037
|
get prelude() {
|
|
1006
1038
|
if (this.type === Be) {
|
|
1007
1039
|
let e = this.first_child;
|
|
1008
|
-
return e && e.type ===
|
|
1040
|
+
return e && e.type === pr ? e : null;
|
|
1009
1041
|
}
|
|
1010
|
-
if (this.type ===
|
|
1042
|
+
if (this.type === pt)
|
|
1011
1043
|
return this.first_child;
|
|
1012
1044
|
}
|
|
1013
1045
|
/**
|
|
@@ -1029,17 +1061,17 @@ class je {
|
|
|
1029
1061
|
/** Get the unit for dimension nodes (e.g., "px" from "100px", "%" from "50%") */
|
|
1030
1062
|
get unit() {
|
|
1031
1063
|
if (this.type === Ge)
|
|
1032
|
-
return
|
|
1064
|
+
return as(this.text).unit;
|
|
1033
1065
|
}
|
|
1034
1066
|
/** Check if this declaration has !important */
|
|
1035
1067
|
get is_important() {
|
|
1036
1068
|
if (this.type === J)
|
|
1037
|
-
return this.arena.has_flag(this.index,
|
|
1069
|
+
return this.arena.has_flag(this.index, Pn);
|
|
1038
1070
|
}
|
|
1039
1071
|
/** Check if this declaration has a browser hack prefix */
|
|
1040
1072
|
get is_browserhack() {
|
|
1041
1073
|
if (this.type === J)
|
|
1042
|
-
return this.arena.has_flag(this.index,
|
|
1074
|
+
return this.arena.has_flag(this.index, zn);
|
|
1043
1075
|
}
|
|
1044
1076
|
/** Check if this has a vendor prefix (computed on-demand) */
|
|
1045
1077
|
get is_vendor_prefixed() {
|
|
@@ -1051,9 +1083,9 @@ class je {
|
|
|
1051
1083
|
return qe(this.get_content());
|
|
1052
1084
|
case Be:
|
|
1053
1085
|
return qe(this.get_content());
|
|
1054
|
-
case
|
|
1086
|
+
case or:
|
|
1055
1087
|
return qe(this.get_content());
|
|
1056
|
-
case
|
|
1088
|
+
case nr:
|
|
1057
1089
|
return qe(this.text);
|
|
1058
1090
|
default:
|
|
1059
1091
|
return !1;
|
|
@@ -1061,34 +1093,34 @@ class je {
|
|
|
1061
1093
|
}
|
|
1062
1094
|
/** Check if this node has an error */
|
|
1063
1095
|
get has_error() {
|
|
1064
|
-
return this.arena.has_flag(this.index,
|
|
1096
|
+
return this.arena.has_flag(this.index, Dn);
|
|
1065
1097
|
}
|
|
1066
1098
|
/** Check if this node has a prelude (at-rules and style rules) */
|
|
1067
1099
|
get has_prelude() {
|
|
1068
1100
|
let { type: e } = this;
|
|
1069
|
-
return e === Be ? this.arena.get_value_length(this.index) > 0 : e ===
|
|
1101
|
+
return e === Be ? this.arena.get_value_length(this.index) > 0 : e === pt ? this.first_child !== null : !1;
|
|
1070
1102
|
}
|
|
1071
1103
|
/** Check if this rule has a block { } */
|
|
1072
1104
|
get has_block() {
|
|
1073
|
-
return this.arena.has_flag(this.index,
|
|
1105
|
+
return this.arena.has_flag(this.index, Fn);
|
|
1074
1106
|
}
|
|
1075
1107
|
/** Check if this style rule has declarations */
|
|
1076
1108
|
get has_declarations() {
|
|
1077
|
-
return this.arena.has_flag(this.index,
|
|
1109
|
+
return this.arena.has_flag(this.index, Mn);
|
|
1078
1110
|
}
|
|
1079
1111
|
/** Get the block node (for style rules and at-rules with blocks) */
|
|
1080
1112
|
get block() {
|
|
1081
1113
|
let { type: e } = this;
|
|
1082
|
-
if (e ===
|
|
1114
|
+
if (e === pt) {
|
|
1083
1115
|
let t = this.first_child;
|
|
1084
1116
|
if (!t) return null;
|
|
1085
1117
|
let s = t.next_sibling;
|
|
1086
|
-
return (s == null ? void 0 : s.type) ===
|
|
1118
|
+
return (s == null ? void 0 : s.type) === dt ? s : null;
|
|
1087
1119
|
}
|
|
1088
1120
|
if (e === Be) {
|
|
1089
1121
|
let t = this.first_child;
|
|
1090
1122
|
for (; t; ) {
|
|
1091
|
-
if (t.type ===
|
|
1123
|
+
if (t.type === dt && !t.next_sibling)
|
|
1092
1124
|
return t;
|
|
1093
1125
|
t = t.next_sibling;
|
|
1094
1126
|
}
|
|
@@ -1098,10 +1130,10 @@ class je {
|
|
|
1098
1130
|
}
|
|
1099
1131
|
/** Check if this block is empty (no declarations or rules, only comments allowed) */
|
|
1100
1132
|
get is_empty() {
|
|
1101
|
-
if (this.type !==
|
|
1133
|
+
if (this.type !== dt) return;
|
|
1102
1134
|
let e = this.first_child;
|
|
1103
1135
|
for (; e; ) {
|
|
1104
|
-
if (e.type !==
|
|
1136
|
+
if (e.type !== rr)
|
|
1105
1137
|
return !1;
|
|
1106
1138
|
e = e.next_sibling;
|
|
1107
1139
|
}
|
|
@@ -1152,7 +1184,7 @@ class je {
|
|
|
1152
1184
|
*/
|
|
1153
1185
|
get has_children() {
|
|
1154
1186
|
let { type: e } = this;
|
|
1155
|
-
return (e === Te || e === Ve) && this.arena.has_flag(this.index,
|
|
1187
|
+
return (e === Te || e === Ve) && this.arena.has_flag(this.index, dr) ? !0 : this.arena.has_children(this.index);
|
|
1156
1188
|
}
|
|
1157
1189
|
/** Get all children as an array */
|
|
1158
1190
|
get children() {
|
|
@@ -1186,11 +1218,11 @@ class je {
|
|
|
1186
1218
|
let l = t.get_value_start(s), a = i.substring(l, l + n), h = l - 1;
|
|
1187
1219
|
for (; h >= 0; ) {
|
|
1188
1220
|
let o = i.charCodeAt(h);
|
|
1189
|
-
if (
|
|
1221
|
+
if (ne(o)) {
|
|
1190
1222
|
h--;
|
|
1191
1223
|
continue;
|
|
1192
1224
|
}
|
|
1193
|
-
o === M ? a = "-" + a : o ===
|
|
1225
|
+
o === M ? a = "-" + a : o === re && (a = "+" + a);
|
|
1194
1226
|
break;
|
|
1195
1227
|
}
|
|
1196
1228
|
return a;
|
|
@@ -1216,7 +1248,7 @@ class je {
|
|
|
1216
1248
|
if (this.type !== Te) return;
|
|
1217
1249
|
let e = this.first_child;
|
|
1218
1250
|
if (e) {
|
|
1219
|
-
if (e.type ===
|
|
1251
|
+
if (e.type === Rt)
|
|
1220
1252
|
return e;
|
|
1221
1253
|
if (e.type === le)
|
|
1222
1254
|
return e.selector;
|
|
@@ -1243,7 +1275,7 @@ class je {
|
|
|
1243
1275
|
d && (o.is_important = !0), f && (o.is_browserhack = !0);
|
|
1244
1276
|
}
|
|
1245
1277
|
let { is_vendor_prefixed: u, has_error: p } = this;
|
|
1246
|
-
if (u && (o.is_vendor_prefixed = !0), p && (o.has_error = !0), i === We && (o.attr_operator =
|
|
1278
|
+
if (u && (o.is_vendor_prefixed = !0), p && (o.has_error = !0), i === We && (o.attr_operator = sl[this.attr_operator], o.attr_flags = il[this.attr_flags]), (i === Ye || i === le) && (o.nth_a = this.nth_a, o.nth_b = this.nth_b), s && (o.line = this.line, o.column = this.column, o.start = this.start, o.length = this.length, o.end = this.end), t && i !== J) {
|
|
1247
1279
|
o.children = [];
|
|
1248
1280
|
for (let d of this.children)
|
|
1249
1281
|
o.children.push(d.clone({ deep: !0, locations: s }));
|
|
@@ -1251,20 +1283,20 @@ class je {
|
|
|
1251
1283
|
return o;
|
|
1252
1284
|
}
|
|
1253
1285
|
}
|
|
1254
|
-
class
|
|
1286
|
+
class Fi {
|
|
1255
1287
|
constructor(e, t) {
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
this.arena = e, this.source = t, this.lexer = new
|
|
1288
|
+
k(this, "lexer");
|
|
1289
|
+
k(this, "arena");
|
|
1290
|
+
k(this, "source");
|
|
1291
|
+
k(this, "expr_end");
|
|
1292
|
+
this.arena = e, this.source = t, this.lexer = new xs(t), this.expr_end = 0;
|
|
1261
1293
|
}
|
|
1262
1294
|
/**
|
|
1263
1295
|
* Parse An+B expression
|
|
1264
1296
|
* Examples: odd, even, 3, n, -n, 2n, 2n+1, -3n-5
|
|
1265
1297
|
*/
|
|
1266
1298
|
parse_anplusb(e, t, s = 1) {
|
|
1267
|
-
this.expr_end = t, this.lexer.
|
|
1299
|
+
this.expr_end = t, this.lexer.seek(e, s);
|
|
1268
1300
|
let i = null, n = e, l = e, a = e, h = e;
|
|
1269
1301
|
const o = e;
|
|
1270
1302
|
if (this.skip_whitespace(), this.lexer.pos >= this.expr_end)
|
|
@@ -1276,14 +1308,14 @@ class Pi {
|
|
|
1276
1308
|
const p = this.source.charCodeAt(this.lexer.token_start), d = this.lexer.token_end > this.lexer.token_start + 1 ? this.source.charCodeAt(this.lexer.token_start + 1) : 0;
|
|
1277
1309
|
return p === M && d === 110 ? this.lexer.token_end > this.lexer.token_start + 2 && this.source.charCodeAt(this.lexer.token_start + 2) === M ? (n = this.lexer.token_start, l = this.lexer.token_start + 2, i = this.source.substring(this.lexer.token_start + 2, this.lexer.token_end), a = this.lexer.token_start + 2, h = this.lexer.token_end, this.create_anplusb_node(o, n, l, a, h)) : (n = this.lexer.token_start, l = this.lexer.token_start + 2, i = this.parse_b_part(), i !== null && (a = this.lexer.token_start, h = this.lexer.token_end), this.create_anplusb_node(o, n, l, i !== null ? a : 0, i !== null ? h : 0)) : p === 110 ? this.lexer.token_end > this.lexer.token_start + 1 && this.source.charCodeAt(this.lexer.token_start + 1) === M ? (n = this.lexer.token_start, l = this.lexer.token_start + 1, i = this.source.substring(this.lexer.token_start + 1, this.lexer.token_end), a = this.lexer.token_start + 1, h = this.lexer.token_end, this.create_anplusb_node(o, n, l, a, h)) : (n = this.lexer.token_start, l = this.lexer.token_start + 1, i = this.parse_b_part(), i !== null && (a = this.lexer.token_start, h = this.lexer.token_end), this.create_anplusb_node(o, n, l, i !== null ? a : 0, i !== null ? h : 0)) : null;
|
|
1278
1310
|
}
|
|
1279
|
-
if (this.lexer.token_type ===
|
|
1311
|
+
if (this.lexer.token_type === me && this.source.charCodeAt(this.lexer.token_start) === re) {
|
|
1280
1312
|
const u = this.lexer.save_position();
|
|
1281
1313
|
if (this.lexer.next_token_fast(!0), this.lexer.token_type === ae && this.source.substring(this.lexer.token_start, this.lexer.token_end).charCodeAt(0) === 110)
|
|
1282
1314
|
return n = u.pos - 1, l = this.lexer.token_start + 1, this.lexer.token_end > this.lexer.token_start + 1 && this.source.charCodeAt(this.lexer.token_start + 1) === M ? (i = this.source.substring(this.lexer.token_start + 1, this.lexer.token_end), a = this.lexer.token_start + 1, h = this.lexer.token_end, this.create_anplusb_node(o, n, l, a, h)) : (i = this.parse_b_part(), i !== null && (a = this.lexer.token_start, h = this.lexer.token_end), this.create_anplusb_node(o, n, l, i !== null ? a : 0, i !== null ? h : 0));
|
|
1283
1315
|
this.lexer.restore_position(u);
|
|
1284
1316
|
}
|
|
1285
|
-
if (this.lexer.token_type ===
|
|
1286
|
-
const u = this.source.substring(this.lexer.token_start, this.lexer.token_end), p =
|
|
1317
|
+
if (this.lexer.token_type === Ji) {
|
|
1318
|
+
const u = this.source.substring(this.lexer.token_start, this.lexer.token_end), p = Zn(u, "n");
|
|
1287
1319
|
if (p !== -1) {
|
|
1288
1320
|
if (n = this.lexer.token_start, l = this.lexer.token_start + p + 1, p + 1 < u.length) {
|
|
1289
1321
|
const d = u.substring(p + 1);
|
|
@@ -1293,7 +1325,7 @@ class Pi {
|
|
|
1293
1325
|
return i = this.parse_b_part(), i !== null && (a = this.lexer.token_start, h = this.lexer.token_end), this.create_anplusb_node(o, n, l, a, h);
|
|
1294
1326
|
}
|
|
1295
1327
|
}
|
|
1296
|
-
return this.lexer.token_type ===
|
|
1328
|
+
return this.lexer.token_type === ft ? (i = this.source.substring(this.lexer.token_start, this.lexer.token_end), a = this.lexer.token_start, h = this.lexer.token_end, this.create_anplusb_node(o, 0, 0, a, h)) : null;
|
|
1297
1329
|
}
|
|
1298
1330
|
/**
|
|
1299
1331
|
* Parse the b part after 'n'
|
|
@@ -1302,44 +1334,44 @@ class Pi {
|
|
|
1302
1334
|
parse_b_part() {
|
|
1303
1335
|
if (this.skip_whitespace(), this.lexer.pos >= this.expr_end)
|
|
1304
1336
|
return null;
|
|
1305
|
-
if (this.lexer.next_token_fast(!0), this.lexer.token_type ===
|
|
1337
|
+
if (this.lexer.next_token_fast(!0), this.lexer.token_type === me) {
|
|
1306
1338
|
const e = this.source.charCodeAt(this.lexer.token_start);
|
|
1307
|
-
if (e ===
|
|
1339
|
+
if (e === re || e === M) {
|
|
1308
1340
|
const t = e === M ? "-" : "";
|
|
1309
|
-
if (this.skip_whitespace(), this.lexer.next_token_fast(!0), this.lexer.token_type ===
|
|
1341
|
+
if (this.skip_whitespace(), this.lexer.next_token_fast(!0), this.lexer.token_type === ft) {
|
|
1310
1342
|
let s = this.source.substring(this.lexer.token_start, this.lexer.token_end);
|
|
1311
|
-
return s.charCodeAt(0) ===
|
|
1343
|
+
return s.charCodeAt(0) === re && (s = s.substring(1)), t === "-" ? t + s : s;
|
|
1312
1344
|
}
|
|
1313
1345
|
}
|
|
1314
1346
|
}
|
|
1315
|
-
if (this.lexer.token_type ===
|
|
1347
|
+
if (this.lexer.token_type === ft) {
|
|
1316
1348
|
let e = this.source.substring(this.lexer.token_start, this.lexer.token_end);
|
|
1317
1349
|
const t = e.charCodeAt(0);
|
|
1318
|
-
if (t ===
|
|
1319
|
-
return t ===
|
|
1350
|
+
if (t === re || t === M)
|
|
1351
|
+
return t === re && (e = e.substring(1)), e;
|
|
1320
1352
|
}
|
|
1321
1353
|
return null;
|
|
1322
1354
|
}
|
|
1323
1355
|
skip_whitespace() {
|
|
1324
|
-
this.lexer.
|
|
1356
|
+
this.lexer.skip_whitespace_in_range(this.expr_end);
|
|
1325
1357
|
}
|
|
1326
1358
|
create_anplusb_node(e, t, s, i, n) {
|
|
1327
1359
|
const l = this.arena.create_node(Ye, e, this.lexer.pos - e, this.lexer.line, 1);
|
|
1328
1360
|
return s > t && (this.arena.set_content_start_delta(l, t - e), this.arena.set_content_length(l, s - t)), n > i && (this.arena.set_value_start_delta(l, i - e), this.arena.set_value_length(l, n - i)), l;
|
|
1329
1361
|
}
|
|
1330
1362
|
}
|
|
1331
|
-
class
|
|
1363
|
+
class rl {
|
|
1332
1364
|
constructor(e, t) {
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
this.arena = e, this.source = t, this.lexer = new
|
|
1365
|
+
k(this, "lexer");
|
|
1366
|
+
k(this, "arena");
|
|
1367
|
+
k(this, "source");
|
|
1368
|
+
k(this, "selector_end");
|
|
1369
|
+
this.arena = e, this.source = t, this.lexer = new xs(t), this.selector_end = 0;
|
|
1338
1370
|
}
|
|
1339
1371
|
// Parse a selector range into selector nodes (standalone use)
|
|
1340
1372
|
// Always returns a NODE_SELECTOR_LIST with selector components as children
|
|
1341
1373
|
parse_selector(e, t, s = 1, i = 1, n = !0) {
|
|
1342
|
-
return this.selector_end = t, this.lexer.
|
|
1374
|
+
return this.selector_end = t, this.lexer.seek(e, s, i), this.parse_selector_list(n);
|
|
1343
1375
|
}
|
|
1344
1376
|
// Parse comma-separated selectors
|
|
1345
1377
|
parse_selector_list(e = !0) {
|
|
@@ -1348,7 +1380,7 @@ class ll {
|
|
|
1348
1380
|
let l = this.lexer.pos, a = this.lexer.line, h = this.lexer.column, o = this.parse_complex_selector(e);
|
|
1349
1381
|
if (o !== null) {
|
|
1350
1382
|
let p = this.arena.create_node(
|
|
1351
|
-
|
|
1383
|
+
Ts,
|
|
1352
1384
|
l,
|
|
1353
1385
|
this.lexer.pos - l,
|
|
1354
1386
|
a,
|
|
@@ -1368,7 +1400,7 @@ class ll {
|
|
|
1368
1400
|
break;
|
|
1369
1401
|
}
|
|
1370
1402
|
if (t.length >= 1) {
|
|
1371
|
-
let l = this.arena.create_node(
|
|
1403
|
+
let l = this.arena.create_node(Rt, s, this.lexer.pos - s, i, n);
|
|
1372
1404
|
return this.arena.append_children(l, t), l;
|
|
1373
1405
|
}
|
|
1374
1406
|
return null;
|
|
@@ -1380,11 +1412,11 @@ class ll {
|
|
|
1380
1412
|
let t = [];
|
|
1381
1413
|
if (this.skip_whitespace(), e && this.lexer.pos < this.selector_end) {
|
|
1382
1414
|
const s = this.lexer.save_position();
|
|
1383
|
-
if (this.lexer.next_token_fast(!1), this.lexer.token_type ===
|
|
1415
|
+
if (this.lexer.next_token_fast(!1), this.lexer.token_type === me) {
|
|
1384
1416
|
let n = this.source.charCodeAt(this.lexer.token_start);
|
|
1385
|
-
if (n ===
|
|
1417
|
+
if (n === br || n === re || n === xt) {
|
|
1386
1418
|
let l = this.create_node_at(
|
|
1387
|
-
|
|
1419
|
+
gt,
|
|
1388
1420
|
this.lexer.token_start,
|
|
1389
1421
|
this.lexer.token_end,
|
|
1390
1422
|
this.lexer.token_line,
|
|
@@ -1434,7 +1466,7 @@ class ll {
|
|
|
1434
1466
|
let e = [];
|
|
1435
1467
|
for (; this.lexer.pos < this.selector_end; ) {
|
|
1436
1468
|
const t = this.lexer.save_position();
|
|
1437
|
-
if (this.lexer.next_token_fast(!1), this.lexer.token_start >= this.selector_end || this.lexer.token_type ===
|
|
1469
|
+
if (this.lexer.next_token_fast(!1), this.lexer.token_start >= this.selector_end || this.lexer.token_type === gs) break;
|
|
1438
1470
|
let i = this.parse_simple_selector();
|
|
1439
1471
|
if (i !== null)
|
|
1440
1472
|
e.push(i);
|
|
@@ -1454,20 +1486,20 @@ class ll {
|
|
|
1454
1486
|
switch (e) {
|
|
1455
1487
|
case ae:
|
|
1456
1488
|
return this.parse_type_or_namespace_selector(t, s);
|
|
1457
|
-
case
|
|
1458
|
-
return this.create_node(
|
|
1459
|
-
case
|
|
1489
|
+
case ji:
|
|
1490
|
+
return this.create_node(cr, t, s);
|
|
1491
|
+
case me:
|
|
1460
1492
|
let i = this.source.charCodeAt(t);
|
|
1461
|
-
return i === yr ? this.parse_class_selector(t) : i === j ? this.parse_universal_or_namespace_selector(t, s) : i ===
|
|
1462
|
-
case
|
|
1493
|
+
return i === yr ? this.parse_class_selector(t) : i === j ? this.parse_universal_or_namespace_selector(t, s) : i === Qn ? this.create_node(_r, t, s) : i === ze ? this.parse_empty_namespace_selector(t) : null;
|
|
1494
|
+
case ds:
|
|
1463
1495
|
return this.parse_attribute_selector(t);
|
|
1464
|
-
case
|
|
1496
|
+
case er:
|
|
1465
1497
|
return this.parse_pseudo(t);
|
|
1466
|
-
case
|
|
1498
|
+
case ut:
|
|
1467
1499
|
return this.parse_pseudo_function(t, s);
|
|
1468
|
-
case
|
|
1500
|
+
case Zi:
|
|
1469
1501
|
return this.create_node(Ge, t, s);
|
|
1470
|
-
case
|
|
1502
|
+
case ps:
|
|
1471
1503
|
case $e:
|
|
1472
1504
|
return null;
|
|
1473
1505
|
default:
|
|
@@ -1481,9 +1513,9 @@ class ll {
|
|
|
1481
1513
|
this.lexer.next_token_fast(!1);
|
|
1482
1514
|
let n;
|
|
1483
1515
|
if (this.lexer.token_type === ae)
|
|
1484
|
-
n =
|
|
1485
|
-
else if (this.lexer.token_type ===
|
|
1486
|
-
n =
|
|
1516
|
+
n = ws;
|
|
1517
|
+
else if (this.lexer.token_type === me && this.source.charCodeAt(this.lexer.token_start) === j)
|
|
1518
|
+
n = As;
|
|
1487
1519
|
else
|
|
1488
1520
|
return this.lexer.restore_position(i), null;
|
|
1489
1521
|
let l = this.create_node(n, e, this.lexer.token_end);
|
|
@@ -1497,10 +1529,10 @@ class ll {
|
|
|
1497
1529
|
this.lexer.pos++;
|
|
1498
1530
|
let i = this.parse_namespace_local_part(e, e, t - e);
|
|
1499
1531
|
if (i !== null) return i;
|
|
1500
|
-
this.lexer.
|
|
1532
|
+
this.lexer.restore_position(s);
|
|
1501
1533
|
} else
|
|
1502
1534
|
this.lexer.restore_position(s);
|
|
1503
|
-
return this.create_node(
|
|
1535
|
+
return this.create_node(ws, e, t);
|
|
1504
1536
|
}
|
|
1505
1537
|
// Parse universal selector or namespace selector (*|E or *|*)
|
|
1506
1538
|
// Called when we've seen a * DELIM token
|
|
@@ -1510,10 +1542,10 @@ class ll {
|
|
|
1510
1542
|
this.lexer.pos++;
|
|
1511
1543
|
let i = this.parse_namespace_local_part(e, e, t - e);
|
|
1512
1544
|
if (i !== null) return i;
|
|
1513
|
-
this.lexer.
|
|
1545
|
+
this.lexer.restore_position(s);
|
|
1514
1546
|
} else
|
|
1515
1547
|
this.lexer.restore_position(s);
|
|
1516
|
-
return this.create_node(
|
|
1548
|
+
return this.create_node(As, e, t);
|
|
1517
1549
|
}
|
|
1518
1550
|
// Parse empty namespace selector (|E or |*)
|
|
1519
1551
|
// Called when we've seen a | DELIM token at the start
|
|
@@ -1522,20 +1554,21 @@ class ll {
|
|
|
1522
1554
|
}
|
|
1523
1555
|
// Parse combinator (>, +, ~, or descendant space)
|
|
1524
1556
|
try_parse_combinator() {
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1557
|
+
const e = this.lexer.save_position();
|
|
1558
|
+
let t = this.lexer.pos < this.selector_end;
|
|
1559
|
+
if (this.skip_whitespace(), t = t && this.lexer.pos > e.pos, this.lexer.pos >= this.selector_end)
|
|
1560
|
+
return this.lexer.restore_position(e), null;
|
|
1561
|
+
if (this.lexer.next_token_fast(!1), this.lexer.token_type === me) {
|
|
1562
|
+
let s = this.source.charCodeAt(this.lexer.token_start);
|
|
1563
|
+
if (jn(s))
|
|
1564
|
+
return this.create_node_at(gt, this.lexer.token_start, this.lexer.token_end, this.lexer.token_line, this.lexer.token_column);
|
|
1532
1565
|
}
|
|
1533
|
-
return
|
|
1566
|
+
return t ? (this.lexer.restore_position(e), this.skip_whitespace(), this.create_node_at(gt, e.pos, this.lexer.pos, e.line, e.column)) : (this.lexer.restore_position(e), null);
|
|
1534
1567
|
}
|
|
1535
1568
|
// Parse class selector (.classname)
|
|
1536
1569
|
parse_class_selector(e) {
|
|
1537
1570
|
const t = this.lexer.save_position();
|
|
1538
|
-
return this.lexer.next_token_fast(!1), this.lexer.token_type !== ae ? (this.lexer.restore_position(t), null) : this.create_node(
|
|
1571
|
+
return this.lexer.next_token_fast(!1), this.lexer.token_type !== ae ? (this.lexer.restore_position(t), null) : this.create_node(hr, e, this.lexer.token_end);
|
|
1539
1572
|
}
|
|
1540
1573
|
// Parse attribute selector ([attr], [attr=value], etc.)
|
|
1541
1574
|
parse_attribute_selector(e) {
|
|
@@ -1543,9 +1576,9 @@ class ll {
|
|
|
1543
1576
|
for (; this.lexer.pos < this.selector_end && t > 0; ) {
|
|
1544
1577
|
this.lexer.next_token_fast(!1);
|
|
1545
1578
|
let a = this.lexer.token_type;
|
|
1546
|
-
if (a ===
|
|
1579
|
+
if (a === ds)
|
|
1547
1580
|
t++;
|
|
1548
|
-
else if (a ===
|
|
1581
|
+
else if (a === tr && (t--, t === 0)) {
|
|
1549
1582
|
n = this.lexer.token_start, s = this.lexer.token_end;
|
|
1550
1583
|
break;
|
|
1551
1584
|
}
|
|
@@ -1555,80 +1588,80 @@ class ll {
|
|
|
1555
1588
|
}
|
|
1556
1589
|
// Parse attribute content to extract name, operator, and value
|
|
1557
1590
|
parse_attribute_content(e, t, s) {
|
|
1558
|
-
if (t =
|
|
1591
|
+
if (t = Ke(this.source, t, s), s = el(this.source, s, t), t >= s) return;
|
|
1559
1592
|
let i = t, n = t, l = -1, a = -1, h = -1;
|
|
1560
1593
|
for (; n < s; ) {
|
|
1561
1594
|
let f = this.source.charCodeAt(n);
|
|
1562
|
-
if (
|
|
1595
|
+
if (ne(f) || f === de || f === xt || f === ze || f === Di || f === Pi || f === j)
|
|
1563
1596
|
break;
|
|
1564
1597
|
n++;
|
|
1565
1598
|
}
|
|
1566
1599
|
n > i && (this.arena.set_content_start_delta(e, i - this.arena.get_start_offset(e)), this.arena.set_content_length(e, n - i));
|
|
1567
|
-
let o =
|
|
1600
|
+
let o = Ke(this.source, n, s);
|
|
1568
1601
|
if (o >= s) {
|
|
1569
|
-
this.arena.set_attr_operator(e,
|
|
1602
|
+
this.arena.set_attr_operator(e, Es), this.arena.set_attr_flags(e, be);
|
|
1570
1603
|
return;
|
|
1571
1604
|
}
|
|
1572
1605
|
let u = this.source.charCodeAt(o), p = o + 1 < s ? this.source.charCodeAt(o + 1) : 0;
|
|
1573
1606
|
if (u === de)
|
|
1574
|
-
l = o + 1, this.arena.set_attr_operator(e,
|
|
1575
|
-
else if (u ===
|
|
1576
|
-
l = o + 2, this.arena.set_attr_operator(e, gr);
|
|
1577
|
-
else if (u === ze && p === de)
|
|
1607
|
+
l = o + 1, this.arena.set_attr_operator(e, gr);
|
|
1608
|
+
else if (u === xt && p === de)
|
|
1578
1609
|
l = o + 2, this.arena.set_attr_operator(e, xr);
|
|
1579
|
-
else if (u ===
|
|
1610
|
+
else if (u === ze && p === de)
|
|
1580
1611
|
l = o + 2, this.arena.set_attr_operator(e, mr);
|
|
1581
|
-
else if (u ===
|
|
1612
|
+
else if (u === Di && p === de)
|
|
1582
1613
|
l = o + 2, this.arena.set_attr_operator(e, kr);
|
|
1583
|
-
else if (u ===
|
|
1614
|
+
else if (u === Pi && p === de)
|
|
1584
1615
|
l = o + 2, this.arena.set_attr_operator(e, wr);
|
|
1616
|
+
else if (u === j && p === de)
|
|
1617
|
+
l = o + 2, this.arena.set_attr_operator(e, Ar);
|
|
1585
1618
|
else {
|
|
1586
|
-
this.arena.set_attr_operator(e,
|
|
1619
|
+
this.arena.set_attr_operator(e, Es), this.arena.set_attr_flags(e, be);
|
|
1587
1620
|
return;
|
|
1588
1621
|
}
|
|
1589
|
-
if (o =
|
|
1590
|
-
this.arena.set_attr_flags(e,
|
|
1622
|
+
if (o = Ke(this.source, l, s), o >= s) {
|
|
1623
|
+
this.arena.set_attr_flags(e, be);
|
|
1591
1624
|
return;
|
|
1592
1625
|
}
|
|
1593
1626
|
a = o;
|
|
1594
1627
|
let d = this.source.charCodeAt(o);
|
|
1595
|
-
if (d ===
|
|
1628
|
+
if (d === Wn || d === Yn) {
|
|
1596
1629
|
let f = d;
|
|
1597
1630
|
for (a = o, o++; o < s; ) {
|
|
1598
|
-
let
|
|
1599
|
-
if (
|
|
1631
|
+
let U = this.source.charCodeAt(o);
|
|
1632
|
+
if (U === f) {
|
|
1600
1633
|
o++;
|
|
1601
1634
|
break;
|
|
1602
1635
|
}
|
|
1603
|
-
|
|
1636
|
+
U === 92 ? o += 2 : o++;
|
|
1604
1637
|
}
|
|
1605
1638
|
h = o;
|
|
1606
1639
|
} else {
|
|
1607
1640
|
for (; o < s; ) {
|
|
1608
1641
|
let f = this.source.charCodeAt(o);
|
|
1609
|
-
if (
|
|
1642
|
+
if (ne(f))
|
|
1610
1643
|
break;
|
|
1611
1644
|
o++;
|
|
1612
1645
|
}
|
|
1613
1646
|
h = o;
|
|
1614
1647
|
}
|
|
1615
|
-
if (h > a && (this.arena.set_value_start_delta(e, a - this.arena.get_start_offset(e)), this.arena.set_value_length(e, h - a)), o =
|
|
1648
|
+
if (h > a && (this.arena.set_value_start_delta(e, a - this.arena.get_start_offset(e)), this.arena.set_value_length(e, h - a)), o = Ke(this.source, h, s), o < s) {
|
|
1616
1649
|
let f = this.source.charCodeAt(o);
|
|
1617
|
-
f === 105 || f === 73 ? this.arena.set_attr_flags(e,
|
|
1650
|
+
f === 105 || f === 73 ? this.arena.set_attr_flags(e, Er) : f === 115 || f === 83 ? this.arena.set_attr_flags(e, Cr) : this.arena.set_attr_flags(e, be);
|
|
1618
1651
|
} else
|
|
1619
|
-
this.arena.set_attr_flags(e,
|
|
1652
|
+
this.arena.set_attr_flags(e, be);
|
|
1620
1653
|
}
|
|
1621
1654
|
// Parse pseudo-class or pseudo-element (:hover, ::before)
|
|
1622
1655
|
parse_pseudo(e) {
|
|
1623
1656
|
const t = this.lexer.save_position(), s = this.lexer.save_position();
|
|
1624
1657
|
this.skip_whitespace();
|
|
1625
1658
|
let i = !1;
|
|
1626
|
-
this.lexer.pos < this.selector_end && this.source.charCodeAt(this.lexer.pos) ===
|
|
1659
|
+
this.lexer.pos < this.selector_end && this.source.charCodeAt(this.lexer.pos) === Vn ? (i = !0, this.lexer.pos++) : this.lexer.restore_position(s), this.lexer.next_token_fast(!1);
|
|
1627
1660
|
let n = this.lexer.token_type;
|
|
1628
1661
|
if (n === ae) {
|
|
1629
1662
|
let l = this.create_node(i ? Ve : Te, e, this.lexer.token_end);
|
|
1630
1663
|
return this.arena.set_content_start_delta(l, this.lexer.token_start - e), this.arena.set_content_length(l, this.lexer.token_end - this.lexer.token_start), l;
|
|
1631
|
-
} else if (n ===
|
|
1664
|
+
} else if (n === ut)
|
|
1632
1665
|
return this.parse_pseudo_function_after_colon(e, i);
|
|
1633
1666
|
return this.lexer.restore_position(t), null;
|
|
1634
1667
|
}
|
|
@@ -1642,15 +1675,15 @@ class ll {
|
|
|
1642
1675
|
for (; this.lexer.pos < this.selector_end && a > 0; ) {
|
|
1643
1676
|
this.lexer.next_token_fast(!1);
|
|
1644
1677
|
let u = this.lexer.token_type;
|
|
1645
|
-
if (u ===
|
|
1678
|
+
if (u === sr || u === ut)
|
|
1646
1679
|
a++;
|
|
1647
|
-
else if (u ===
|
|
1680
|
+
else if (u === ir && (a--, a === 0)) {
|
|
1648
1681
|
l = this.lexer.token_start, h = this.lexer.token_end;
|
|
1649
1682
|
break;
|
|
1650
1683
|
}
|
|
1651
1684
|
}
|
|
1652
1685
|
let o = this.create_node(t ? Ve : Te, e, h);
|
|
1653
|
-
if (this.arena.set_content_start_delta(o, s - e), this.arena.set_content_length(o, i - s), this.arena.set_flag(o,
|
|
1686
|
+
if (this.arena.set_content_start_delta(o, s - e), this.arena.set_content_length(o, i - s), this.arena.set_flag(o, dr), l > n) {
|
|
1654
1687
|
let u = this.source.substring(s, i);
|
|
1655
1688
|
if (this.is_nth_pseudo(u)) {
|
|
1656
1689
|
let p = this.parse_nth_expression(n, l);
|
|
@@ -1660,8 +1693,8 @@ class ll {
|
|
|
1660
1693
|
else {
|
|
1661
1694
|
let p = this.selector_end;
|
|
1662
1695
|
const d = this.lexer.save_position();
|
|
1663
|
-
let f = V("has", u),
|
|
1664
|
-
this.selector_end = p, this.lexer.restore_position(d),
|
|
1696
|
+
let f = V("has", u), U = this.parse_selector(n, l, this.lexer.line, this.lexer.column, f);
|
|
1697
|
+
this.selector_end = p, this.lexer.restore_position(d), U !== null && this.arena.set_first_child(o, U);
|
|
1665
1698
|
}
|
|
1666
1699
|
}
|
|
1667
1700
|
return o;
|
|
@@ -1673,31 +1706,32 @@ class ll {
|
|
|
1673
1706
|
// Parse :lang() content - comma-separated language identifiers
|
|
1674
1707
|
// Accepts both quoted strings: :lang("en", "fr") and unquoted: :lang(en, fr)
|
|
1675
1708
|
parse_lang_identifiers(e, t, s) {
|
|
1676
|
-
let i = this.
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1709
|
+
let i = new xs(this.source);
|
|
1710
|
+
i.seek(e, this.lexer.line, this.lexer.column);
|
|
1711
|
+
let n = this.selector_end, l = this.lexer;
|
|
1712
|
+
this.lexer = i, this.selector_end = t;
|
|
1713
|
+
let a = null, h = null;
|
|
1680
1714
|
for (; this.lexer.pos < t; ) {
|
|
1681
1715
|
this.lexer.next_token_fast(!1);
|
|
1682
|
-
let
|
|
1683
|
-
if (
|
|
1684
|
-
if (
|
|
1685
|
-
let
|
|
1686
|
-
|
|
1716
|
+
let o = this.lexer.token_type, u = this.lexer.token_start, p = this.lexer.token_end;
|
|
1717
|
+
if (o !== ps && o !== $e) {
|
|
1718
|
+
if (o === Xi || o === ae) {
|
|
1719
|
+
let d = this.create_node(ur, u, p);
|
|
1720
|
+
a === null && (a = d), h !== null && this.arena.set_next_sibling(h, d), h = d;
|
|
1687
1721
|
}
|
|
1688
1722
|
if (this.lexer.pos >= t)
|
|
1689
1723
|
break;
|
|
1690
1724
|
}
|
|
1691
1725
|
}
|
|
1692
|
-
|
|
1726
|
+
a !== null && this.arena.set_first_child(s, a), this.selector_end = n, this.lexer = l;
|
|
1693
1727
|
}
|
|
1694
1728
|
// Parse An+B expression for nth-* pseudo-classes
|
|
1695
1729
|
// Handles both simple An+B and "An+B of S" syntax
|
|
1696
1730
|
parse_nth_expression(e, t) {
|
|
1697
1731
|
let s = this.find_of_keyword(e, t);
|
|
1698
1732
|
if (s !== -1) {
|
|
1699
|
-
let n = new
|
|
1700
|
-
l =
|
|
1733
|
+
let n = new Fi(this.arena, this.source).parse_anplusb(e, s, this.lexer.line), l = s + 2;
|
|
1734
|
+
l = Jn(this.source, l, t);
|
|
1701
1735
|
let a = this.selector_end;
|
|
1702
1736
|
const h = this.lexer.save_position();
|
|
1703
1737
|
this.selector_end = t, this.lexer.pos = l;
|
|
@@ -1706,15 +1740,15 @@ class ll {
|
|
|
1706
1740
|
let u = this.arena.create_node(le, e, t - e, this.lexer.line, 1);
|
|
1707
1741
|
return n !== null && o !== null ? (this.arena.set_first_child(u, n), this.arena.set_next_sibling(n, o)) : n !== null && this.arena.set_first_child(u, n), u;
|
|
1708
1742
|
} else
|
|
1709
|
-
return new
|
|
1743
|
+
return new Fi(this.arena, this.source).parse_anplusb(e, t, this.lexer.line);
|
|
1710
1744
|
}
|
|
1711
1745
|
// Find the position of standalone "of" keyword (case-insensitive)
|
|
1712
1746
|
find_of_keyword(e, t) {
|
|
1713
1747
|
let s = e;
|
|
1714
|
-
for (; s < t - 1 && (s =
|
|
1748
|
+
for (; s < t - 1 && (s = Ke(this.source, s, t), !(s >= t - 1)); ) {
|
|
1715
1749
|
let i = this.source.charCodeAt(s), n = this.source.charCodeAt(s + 1);
|
|
1716
1750
|
if ((i === 111 || i === 79) && (n === 102 || n === 70)) {
|
|
1717
|
-
let l = s === e ||
|
|
1751
|
+
let l = s === e || ne(this.source.charCodeAt(s - 1)), a = s + 2 >= t || ne(this.source.charCodeAt(s + 2));
|
|
1718
1752
|
if (l && a)
|
|
1719
1753
|
return s;
|
|
1720
1754
|
}
|
|
@@ -1734,7 +1768,7 @@ class ll {
|
|
|
1734
1768
|
skip_whitespace() {
|
|
1735
1769
|
for (; this.lexer.pos < this.selector_end; ) {
|
|
1736
1770
|
let e = this.source.charCodeAt(this.lexer.pos);
|
|
1737
|
-
if (
|
|
1771
|
+
if (ne(e)) {
|
|
1738
1772
|
this.lexer.advance();
|
|
1739
1773
|
continue;
|
|
1740
1774
|
}
|
|
@@ -1752,30 +1786,30 @@ class ll {
|
|
|
1752
1786
|
}
|
|
1753
1787
|
}
|
|
1754
1788
|
}
|
|
1755
|
-
function
|
|
1756
|
-
const e = new
|
|
1789
|
+
function nl(r) {
|
|
1790
|
+
const e = new mt(mt.capacity_for_source(r.length)), s = new rl(e, r).parse_selector(0, r.length);
|
|
1757
1791
|
if (s === null) {
|
|
1758
|
-
const i = e.create_node(
|
|
1792
|
+
const i = e.create_node(Rt, 0, 0, 1, 1);
|
|
1759
1793
|
return new je(e, r, i);
|
|
1760
1794
|
}
|
|
1761
1795
|
return new je(e, r, s);
|
|
1762
1796
|
}
|
|
1763
|
-
function
|
|
1797
|
+
function ll(r, e) {
|
|
1764
1798
|
return r[0] === e[0] ? r[1] === e[1] ? r[2] - e[2] : r[1] - e[1] : r[0] - e[0];
|
|
1765
1799
|
}
|
|
1766
|
-
function
|
|
1767
|
-
return r.sort(
|
|
1800
|
+
function Mi(r) {
|
|
1801
|
+
return r.sort(ll).at(-1);
|
|
1768
1802
|
}
|
|
1769
|
-
const
|
|
1803
|
+
const kt = (r) => {
|
|
1770
1804
|
var n, l, a, h, o;
|
|
1771
1805
|
let e = 0, t = 0, s = 0, i = r.first_child;
|
|
1772
1806
|
for (; i; ) {
|
|
1773
1807
|
switch (i.type) {
|
|
1774
|
-
case
|
|
1808
|
+
case Ur:
|
|
1775
1809
|
e += 1;
|
|
1776
1810
|
break;
|
|
1777
|
-
case
|
|
1778
|
-
case
|
|
1811
|
+
case Et:
|
|
1812
|
+
case Lr:
|
|
1779
1813
|
t += 1;
|
|
1780
1814
|
break;
|
|
1781
1815
|
case Le:
|
|
@@ -1795,9 +1829,9 @@ const xt = (r) => {
|
|
|
1795
1829
|
case "has":
|
|
1796
1830
|
if (i.has_children) {
|
|
1797
1831
|
const f = i.first_child;
|
|
1798
|
-
if ((f == null ? void 0 : f.type) ===
|
|
1799
|
-
const
|
|
1800
|
-
e +=
|
|
1832
|
+
if ((f == null ? void 0 : f.type) === ys) {
|
|
1833
|
+
const U = Mi(zi(f));
|
|
1834
|
+
e += U[0], t += U[1], s += U[2];
|
|
1801
1835
|
}
|
|
1802
1836
|
}
|
|
1803
1837
|
break;
|
|
@@ -1806,8 +1840,8 @@ const xt = (r) => {
|
|
|
1806
1840
|
case "nth-last-child":
|
|
1807
1841
|
t += 1;
|
|
1808
1842
|
const p = i.first_child;
|
|
1809
|
-
if ((p == null ? void 0 : p.type) ===
|
|
1810
|
-
const f =
|
|
1843
|
+
if ((p == null ? void 0 : p.type) === Nr && p.selector) {
|
|
1844
|
+
const f = Mi(zi(p.selector));
|
|
1811
1845
|
e += f[0], t += f[1], s += f[2];
|
|
1812
1846
|
}
|
|
1813
1847
|
break;
|
|
@@ -1817,13 +1851,13 @@ const xt = (r) => {
|
|
|
1817
1851
|
case "host":
|
|
1818
1852
|
t += 1;
|
|
1819
1853
|
const d = (l = i.first_child) == null ? void 0 : l.first_child;
|
|
1820
|
-
if ((d == null ? void 0 : d.type) ===
|
|
1854
|
+
if ((d == null ? void 0 : d.type) === ke) {
|
|
1821
1855
|
let f = d.first_child;
|
|
1822
|
-
for (; f && f.type !==
|
|
1823
|
-
const
|
|
1856
|
+
for (; f && f.type !== _s; ) {
|
|
1857
|
+
const U = kt({
|
|
1824
1858
|
first_child: f
|
|
1825
1859
|
});
|
|
1826
|
-
e +=
|
|
1860
|
+
e += U[0] ?? 0, t += U[1] ?? 0, s += U[2] ?? 0, f = f.next_sibling;
|
|
1827
1861
|
}
|
|
1828
1862
|
}
|
|
1829
1863
|
break;
|
|
@@ -1846,10 +1880,10 @@ const xt = (r) => {
|
|
|
1846
1880
|
case "slotted":
|
|
1847
1881
|
s += 1;
|
|
1848
1882
|
const p = (h = i.first_child) == null ? void 0 : h.first_child;
|
|
1849
|
-
if ((p == null ? void 0 : p.type) ===
|
|
1883
|
+
if ((p == null ? void 0 : p.type) === ke) {
|
|
1850
1884
|
let d = p.first_child;
|
|
1851
|
-
for (; d && d.type !==
|
|
1852
|
-
const f =
|
|
1885
|
+
for (; d && d.type !== _s; ) {
|
|
1886
|
+
const f = kt({
|
|
1853
1887
|
first_child: d
|
|
1854
1888
|
});
|
|
1855
1889
|
e += f[0] ?? 0, t += f[1] ?? 0, s += f[2] ?? 0, d = d.next_sibling;
|
|
@@ -1869,7 +1903,7 @@ const xt = (r) => {
|
|
|
1869
1903
|
break;
|
|
1870
1904
|
}
|
|
1871
1905
|
break;
|
|
1872
|
-
case
|
|
1906
|
+
case Ct:
|
|
1873
1907
|
let u = i.name ?? "";
|
|
1874
1908
|
u.includes("|") && (u = u.split("|")[1] ?? ""), u !== "*" && (s += 1);
|
|
1875
1909
|
break;
|
|
@@ -1877,29 +1911,29 @@ const xt = (r) => {
|
|
|
1877
1911
|
i = i.next_sibling;
|
|
1878
1912
|
}
|
|
1879
1913
|
return [e, t, s];
|
|
1880
|
-
},
|
|
1914
|
+
}, ol = (r) => {
|
|
1881
1915
|
if (typeof r == "string")
|
|
1882
1916
|
try {
|
|
1883
|
-
return
|
|
1917
|
+
return nl(r);
|
|
1884
1918
|
} catch (e) {
|
|
1885
1919
|
const t = e instanceof Error ? e.message : String(e);
|
|
1886
1920
|
throw new TypeError(`Could not convert passed in source '${r}' to SelectorList: ${t}`);
|
|
1887
1921
|
}
|
|
1888
1922
|
if (r instanceof Object) {
|
|
1889
|
-
if (r.type ===
|
|
1923
|
+
if (r.type === ys)
|
|
1890
1924
|
return r;
|
|
1891
1925
|
throw new TypeError("Passed in source is an Object but no AST / AST of the type SelectorList");
|
|
1892
1926
|
}
|
|
1893
1927
|
throw new TypeError("Passed in source is not a String nor an Object. I don't know what to do with it.");
|
|
1894
|
-
},
|
|
1928
|
+
}, zi = (r) => {
|
|
1895
1929
|
if (!r)
|
|
1896
1930
|
return [];
|
|
1897
|
-
const e =
|
|
1931
|
+
const e = ol(r), t = [];
|
|
1898
1932
|
let s = e.first_child;
|
|
1899
1933
|
for (; s; )
|
|
1900
|
-
t.push(
|
|
1934
|
+
t.push(kt(s)), s = s.next_sibling;
|
|
1901
1935
|
return t;
|
|
1902
|
-
},
|
|
1936
|
+
}, al = new W([
|
|
1903
1937
|
// CSS Named Colors
|
|
1904
1938
|
// Spec: https://drafts.csswg.org/css-color/#named-colors
|
|
1905
1939
|
// Heuristic: popular names first for quick finding in set.has()
|
|
@@ -2052,7 +2086,7 @@ const xt = (r) => {
|
|
|
2052
2086
|
"mediumorchid",
|
|
2053
2087
|
"darksalmon",
|
|
2054
2088
|
"mediumspringgreen"
|
|
2055
|
-
]),
|
|
2089
|
+
]), hl = new W([
|
|
2056
2090
|
// CSS System Colors
|
|
2057
2091
|
// Spec: https://drafts.csswg.org/css-color/#css-system-colors
|
|
2058
2092
|
"accentcolor",
|
|
@@ -2074,7 +2108,7 @@ const xt = (r) => {
|
|
|
2074
2108
|
"selecteditem",
|
|
2075
2109
|
"selecteditemtext",
|
|
2076
2110
|
"visitedtext"
|
|
2077
|
-
]),
|
|
2111
|
+
]), cl = new W(["rgba", "rgb", "hsla", "hsl", "oklch", "color", "hwb", "lch", "lab", "oklab"]), _l = new W(["transparent", "currentcolor"]), wt = new W([
|
|
2078
2112
|
"auto",
|
|
2079
2113
|
"none",
|
|
2080
2114
|
// for `text-shadow`, `box-shadow` and `background`
|
|
@@ -2084,13 +2118,13 @@ const xt = (r) => {
|
|
|
2084
2118
|
"revert",
|
|
2085
2119
|
"revert-layer"
|
|
2086
2120
|
]);
|
|
2087
|
-
function
|
|
2121
|
+
function ul(r) {
|
|
2088
2122
|
for (let e of r.children)
|
|
2089
|
-
if (!(e.type ===
|
|
2123
|
+
if (!(e.type === Cs && e.value === 0) && !(e.type === At && e.value === 0))
|
|
2090
2124
|
return !1;
|
|
2091
2125
|
return !0;
|
|
2092
2126
|
}
|
|
2093
|
-
const
|
|
2127
|
+
const hs = new W(["caption", "icon", "menu", "message-box", "small-caption", "status-bar"]), fl = new W([
|
|
2094
2128
|
/* <absolute-size> values */
|
|
2095
2129
|
"xx-small",
|
|
2096
2130
|
"x-small",
|
|
@@ -2103,27 +2137,27 @@ const rs = new W(["caption", "icon", "menu", "message-box", "small-caption", "st
|
|
|
2103
2137
|
/* <relative-size> values */
|
|
2104
2138
|
"smaller",
|
|
2105
2139
|
"larger"
|
|
2106
|
-
]),
|
|
2107
|
-
function
|
|
2140
|
+
]), pl = 44, qi = 47;
|
|
2141
|
+
function dl(r, e) {
|
|
2108
2142
|
var a;
|
|
2109
2143
|
let t = [void 0, void 0], s, i;
|
|
2110
|
-
if (r.first_child.type ===
|
|
2144
|
+
if (r.first_child.type === bs && ((a = r.first_child.name) == null ? void 0 : a.toLowerCase()) === "var")
|
|
2111
2145
|
return null;
|
|
2112
2146
|
let n;
|
|
2113
2147
|
for (let h of r.children) {
|
|
2114
2148
|
let o = h.next_sibling;
|
|
2115
|
-
if (h.type === _e &&
|
|
2149
|
+
if (h.type === _e && wt.has(h.name) && e({
|
|
2116
2150
|
type: "keyword",
|
|
2117
2151
|
value: h.name
|
|
2118
|
-
}), o && o.type === Re && o.text.charCodeAt(0) ===
|
|
2152
|
+
}), o && o.type === Re && o.text.charCodeAt(0) === qi) {
|
|
2119
2153
|
s = h.text, n = h;
|
|
2120
2154
|
continue;
|
|
2121
2155
|
}
|
|
2122
|
-
if ((n == null ? void 0 : n.type) === Re && n.text.charCodeAt(0) ===
|
|
2156
|
+
if ((n == null ? void 0 : n.type) === Re && n.text.charCodeAt(0) === qi) {
|
|
2123
2157
|
i = h.text, n = h;
|
|
2124
2158
|
continue;
|
|
2125
2159
|
}
|
|
2126
|
-
if ((o == null ? void 0 : o.type) === Re && o.text.charCodeAt(0) ===
|
|
2160
|
+
if ((o == null ? void 0 : o.type) === Re && o.text.charCodeAt(0) === pl && !t[0]) {
|
|
2127
2161
|
t[0] = h, !s && n && (s = n.text), n = h;
|
|
2128
2162
|
continue;
|
|
2129
2163
|
}
|
|
@@ -2131,13 +2165,13 @@ function xl(r, e) {
|
|
|
2131
2165
|
t[1] = h, !s && !t[0] && n && (s = n.text), n = h;
|
|
2132
2166
|
continue;
|
|
2133
2167
|
}
|
|
2134
|
-
if (h.type ===
|
|
2168
|
+
if (h.type === Cs) {
|
|
2135
2169
|
n = h;
|
|
2136
2170
|
continue;
|
|
2137
2171
|
}
|
|
2138
2172
|
if (h.type === _e) {
|
|
2139
2173
|
let u = h.name;
|
|
2140
|
-
if (u &&
|
|
2174
|
+
if (u && fl.has(u)) {
|
|
2141
2175
|
s = u, n = h;
|
|
2142
2176
|
continue;
|
|
2143
2177
|
}
|
|
@@ -2156,28 +2190,28 @@ function xl(r, e) {
|
|
|
2156
2190
|
font_family: l
|
|
2157
2191
|
};
|
|
2158
2192
|
}
|
|
2159
|
-
const
|
|
2160
|
-
function
|
|
2193
|
+
const gl = new W(["linear", "ease", "ease-in", "ease-out", "ease-in-out", "step-start", "step-end"]), xl = new W(["cubic-bezier", "steps"]);
|
|
2194
|
+
function ml(r, e) {
|
|
2161
2195
|
let t = !1;
|
|
2162
2196
|
for (let s of r) {
|
|
2163
2197
|
let i = s.type, n = s.name;
|
|
2164
|
-
i === Re ? t = !1 : i ===
|
|
2198
|
+
i === Re ? t = !1 : i === At && t === !1 ? (t = !0, e({
|
|
2165
2199
|
type: "duration",
|
|
2166
2200
|
value: s
|
|
2167
|
-
})) : i === _e && n ?
|
|
2201
|
+
})) : i === _e && n ? gl.has(n) ? e({
|
|
2168
2202
|
type: "fn",
|
|
2169
2203
|
value: s
|
|
2170
|
-
}) :
|
|
2204
|
+
}) : wt.has(n) && e({
|
|
2171
2205
|
type: "keyword",
|
|
2172
2206
|
value: s
|
|
2173
|
-
}) : i ===
|
|
2207
|
+
}) : i === bs && n && xl.has(n) && e({
|
|
2174
2208
|
type: "fn",
|
|
2175
2209
|
value: s
|
|
2176
2210
|
});
|
|
2177
2211
|
}
|
|
2178
2212
|
}
|
|
2179
|
-
function
|
|
2180
|
-
|
|
2213
|
+
function kl(r, e) {
|
|
2214
|
+
G(r, function(t) {
|
|
2181
2215
|
t.is_vendor_prefixed && e(t.name || t.text);
|
|
2182
2216
|
});
|
|
2183
2217
|
}
|
|
@@ -2188,25 +2222,25 @@ class _ {
|
|
|
2188
2222
|
Y(this, ee);
|
|
2189
2223
|
Y(this, te, []);
|
|
2190
2224
|
Y(this, Se);
|
|
2191
|
-
|
|
2225
|
+
z(this, he, /* @__PURE__ */ new Map()), z(this, ee, 0), e && z(this, te, []), z(this, Se, e);
|
|
2192
2226
|
}
|
|
2193
2227
|
p(e, t) {
|
|
2194
|
-
let s =
|
|
2195
|
-
if (
|
|
2228
|
+
let s = E(this, ee);
|
|
2229
|
+
if (E(this, Se)) {
|
|
2196
2230
|
let i = s * 4;
|
|
2197
|
-
|
|
2231
|
+
E(this, te)[i] = t.line, E(this, te)[i + 1] = t.column, E(this, te)[i + 2] = t.offset, E(this, te)[i + 3] = t.length;
|
|
2198
2232
|
}
|
|
2199
|
-
if (
|
|
2200
|
-
|
|
2233
|
+
if (E(this, he).has(e)) {
|
|
2234
|
+
E(this, he).get(e).push(s), ss(this, ee)._++;
|
|
2201
2235
|
return;
|
|
2202
2236
|
}
|
|
2203
|
-
|
|
2237
|
+
E(this, he).set(e, [s]), ss(this, ee)._++;
|
|
2204
2238
|
}
|
|
2205
2239
|
size() {
|
|
2206
|
-
return
|
|
2240
|
+
return E(this, ee);
|
|
2207
2241
|
}
|
|
2208
2242
|
c() {
|
|
2209
|
-
let e = /* @__PURE__ */ new Map(), t = {}, s =
|
|
2243
|
+
let e = /* @__PURE__ */ new Map(), t = {}, s = E(this, Se), i = E(this, he), n = E(this, te), l = i.size;
|
|
2210
2244
|
i.forEach((h, o) => {
|
|
2211
2245
|
if (s) {
|
|
2212
2246
|
let u = h.map(function(p) {
|
|
@@ -2222,7 +2256,7 @@ class _ {
|
|
|
2222
2256
|
} else
|
|
2223
2257
|
t[o] = h.length;
|
|
2224
2258
|
});
|
|
2225
|
-
let a =
|
|
2259
|
+
let a = E(this, ee);
|
|
2226
2260
|
return s ? {
|
|
2227
2261
|
total: a,
|
|
2228
2262
|
totalUnique: l,
|
|
@@ -2240,12 +2274,12 @@ class _ {
|
|
|
2240
2274
|
}
|
|
2241
2275
|
he = new WeakMap(), ee = new WeakMap(), te = new WeakMap(), Se = new WeakMap();
|
|
2242
2276
|
var Oe, ce, Xe;
|
|
2243
|
-
class
|
|
2277
|
+
class cs {
|
|
2244
2278
|
constructor(e) {
|
|
2245
2279
|
Y(this, Oe);
|
|
2246
2280
|
Y(this, ce);
|
|
2247
2281
|
Y(this, Xe);
|
|
2248
|
-
|
|
2282
|
+
z(this, Oe, new _(e)), z(this, ce, /* @__PURE__ */ new Map()), z(this, Xe, e);
|
|
2249
2283
|
}
|
|
2250
2284
|
/**
|
|
2251
2285
|
* Add an item to this #list's context
|
|
@@ -2254,19 +2288,19 @@ class ns {
|
|
|
2254
2288
|
* @param node_location
|
|
2255
2289
|
*/
|
|
2256
2290
|
push(e, t, s) {
|
|
2257
|
-
|
|
2291
|
+
E(this, Oe).p(e, s), E(this, ce).has(t) || E(this, ce).set(t, new _(E(this, Xe))), E(this, ce).get(t).p(e, s);
|
|
2258
2292
|
}
|
|
2259
2293
|
count() {
|
|
2260
2294
|
let e = /* @__PURE__ */ new Map();
|
|
2261
|
-
for (let [t, s] of
|
|
2295
|
+
for (let [t, s] of E(this, ce).entries())
|
|
2262
2296
|
e.set(t, s.c());
|
|
2263
|
-
return Object.assign(
|
|
2297
|
+
return Object.assign(E(this, Oe).c(), {
|
|
2264
2298
|
itemsPerContext: Object.fromEntries(e)
|
|
2265
2299
|
});
|
|
2266
2300
|
}
|
|
2267
2301
|
}
|
|
2268
2302
|
Oe = new WeakMap(), ce = new WeakMap(), Xe = new WeakMap();
|
|
2269
|
-
function
|
|
2303
|
+
function wl(r) {
|
|
2270
2304
|
let e = /* @__PURE__ */ new Map(), t = -1, s = 0, i = 0, n = r.length;
|
|
2271
2305
|
for (let l = 0; l < n; l++) {
|
|
2272
2306
|
let a = r[l], h = (e.get(a) || 0) + 1;
|
|
@@ -2275,24 +2309,24 @@ function El(r) {
|
|
|
2275
2309
|
return i / s;
|
|
2276
2310
|
}
|
|
2277
2311
|
var se, Ne;
|
|
2278
|
-
class
|
|
2312
|
+
class H {
|
|
2279
2313
|
constructor() {
|
|
2280
2314
|
Y(this, se);
|
|
2281
2315
|
Y(this, Ne);
|
|
2282
|
-
|
|
2316
|
+
z(this, se, []), z(this, Ne, 0);
|
|
2283
2317
|
}
|
|
2284
2318
|
/**
|
|
2285
2319
|
* Add a new Integer at the end of this AggregateCollection
|
|
2286
2320
|
* @param item - The item to add
|
|
2287
2321
|
*/
|
|
2288
2322
|
push(e) {
|
|
2289
|
-
|
|
2323
|
+
E(this, se).push(e), z(this, Ne, E(this, Ne) + e);
|
|
2290
2324
|
}
|
|
2291
2325
|
size() {
|
|
2292
|
-
return
|
|
2326
|
+
return E(this, se).length;
|
|
2293
2327
|
}
|
|
2294
2328
|
aggregate() {
|
|
2295
|
-
let e =
|
|
2329
|
+
let e = E(this, se).length;
|
|
2296
2330
|
if (e === 0)
|
|
2297
2331
|
return {
|
|
2298
2332
|
min: 0,
|
|
@@ -2302,7 +2336,7 @@ class I {
|
|
|
2302
2336
|
range: 0,
|
|
2303
2337
|
sum: 0
|
|
2304
2338
|
};
|
|
2305
|
-
let t =
|
|
2339
|
+
let t = E(this, se).slice().sort((a, h) => a - h), s = t[0], i = t[e - 1], n = wl(t), l = E(this, Ne);
|
|
2306
2340
|
return {
|
|
2307
2341
|
min: s,
|
|
2308
2342
|
max: i,
|
|
@@ -2313,23 +2347,23 @@ class I {
|
|
|
2313
2347
|
};
|
|
2314
2348
|
}
|
|
2315
2349
|
toArray() {
|
|
2316
|
-
return
|
|
2350
|
+
return E(this, se);
|
|
2317
2351
|
}
|
|
2318
2352
|
}
|
|
2319
2353
|
se = new WeakMap(), Ne = new WeakMap();
|
|
2320
|
-
function
|
|
2354
|
+
function Al(r) {
|
|
2321
2355
|
let e = 5, t = r.indexOf(";"), s = r.indexOf(",");
|
|
2322
2356
|
return t === -1 || s !== -1 && s < t ? r.substring(e, s) : r.substring(e, t);
|
|
2323
2357
|
}
|
|
2324
|
-
function
|
|
2358
|
+
function Ki(r) {
|
|
2325
2359
|
let e = r.children;
|
|
2326
2360
|
if (e) {
|
|
2327
2361
|
let t = e.at(-1);
|
|
2328
|
-
return !!(t && t.type === _e &&
|
|
2362
|
+
return !!(t && t.type === _e && us("\\9", t.text));
|
|
2329
2363
|
}
|
|
2330
2364
|
return !1;
|
|
2331
2365
|
}
|
|
2332
|
-
const
|
|
2366
|
+
const El = /* @__PURE__ */ new Set([
|
|
2333
2367
|
"margin",
|
|
2334
2368
|
"margin-block",
|
|
2335
2369
|
"margin-inline",
|
|
@@ -2352,7 +2386,7 @@ const Cl = /* @__PURE__ */ new Set([
|
|
|
2352
2386
|
"padding-block-end",
|
|
2353
2387
|
"padding-inline-start",
|
|
2354
2388
|
"padding-inline-end"
|
|
2355
|
-
]),
|
|
2389
|
+
]), Cl = new W([
|
|
2356
2390
|
"border-radius",
|
|
2357
2391
|
"border-top-left-radius",
|
|
2358
2392
|
"border-top-right-radius",
|
|
@@ -2363,8 +2397,8 @@ const Cl = /* @__PURE__ */ new Set([
|
|
|
2363
2397
|
"border-end-end-radius",
|
|
2364
2398
|
"border-end-start-radius"
|
|
2365
2399
|
]);
|
|
2366
|
-
function
|
|
2367
|
-
if (
|
|
2400
|
+
function yl(r) {
|
|
2401
|
+
if (Rs(r) || vs(r)) return !1;
|
|
2368
2402
|
let e = r.charCodeAt(0);
|
|
2369
2403
|
return e === 47 || // /
|
|
2370
2404
|
e === 42 || // *
|
|
@@ -2374,28 +2408,28 @@ function Rl(r) {
|
|
|
2374
2408
|
e === 36 || // $
|
|
2375
2409
|
e === 35;
|
|
2376
2410
|
}
|
|
2377
|
-
function
|
|
2378
|
-
return
|
|
2411
|
+
function $i(r) {
|
|
2412
|
+
return Rs(r) ? r : vs(r) ? r.slice(r.indexOf("-", 2) + 1).toLowerCase() : yl(r) ? r.slice(1).toLowerCase() : r.toLowerCase();
|
|
2379
2413
|
}
|
|
2380
|
-
function
|
|
2381
|
-
return
|
|
2414
|
+
function vl(r) {
|
|
2415
|
+
return vs(r);
|
|
2382
2416
|
}
|
|
2383
|
-
function
|
|
2417
|
+
function P(r, e) {
|
|
2384
2418
|
return e === 0 ? 0 : r / e;
|
|
2385
2419
|
}
|
|
2386
|
-
function
|
|
2387
|
-
return e.useLocations === !0 ?
|
|
2420
|
+
function Tl(r, e = {}) {
|
|
2421
|
+
return e.useLocations === !0 ? Bi(r, e, !0) : Bi(r, e, !1);
|
|
2388
2422
|
}
|
|
2389
|
-
function
|
|
2423
|
+
function Bi(r, e, t) {
|
|
2390
2424
|
let s = Date.now(), i = (r.match(/\n/g) || []).length + 1, n = 0, l = 0, a = 0, h = {
|
|
2391
2425
|
total: 0,
|
|
2392
2426
|
unique: /* @__PURE__ */ new Map()
|
|
2393
|
-
}, o = Date.now(), u =
|
|
2427
|
+
}, o = Date.now(), u = Ir(r, {
|
|
2394
2428
|
on_comment({ length: c }) {
|
|
2395
2429
|
n++, l += c;
|
|
2396
2430
|
}
|
|
2397
|
-
}), p = Date.now(), d = new _(t), f = new
|
|
2398
|
-
function
|
|
2431
|
+
}), p = Date.now(), d = new _(t), f = new H(), U = [], Ss = new _(t), Ze = new _(t), Os = new _(t), Ns = new _(t), Ls = new _(t), Us = new _(t), Is = new _(t), vt = new _(t), Hs = new _(t), Tt = new _(t), St = new _(t), Ps = new _(t), Je = new _(t), Ds = new _(t), Fs = new _(t), Ot = new H(), Ms = new _(t), Nt = 0, Lt = 0, Ut = new H(), It = new H(), Ht = new H(), zs = new _(t), qs = new _(t), Ks = new _(t), Pt = new H(), $s = new _(t), Dt = new _(t), Bs = /* @__PURE__ */ new Set(), Ft = new _(t), ue, fe, Gs = new H(), Ws = new H(), Ys = new H(), Qs = new _(t), et = new H(), Vs = new _(t), js = [], Mt = new _(t), zt = new _(t), Xs = new _(t), Zs = new _(t), Js = new _(t), ei = new _(t), ti = new _(t), qt = new H(), si = new _(t), ii = /* @__PURE__ */ new Set(), Ie = 0, ri = new H(), tt = 0, Kt = 0, $t = new _(t), Bt = new H(), ni = new _(t), He = new _(t), Gt = new _(t), Wt = new _(t), st = new _(t), Pe = new H(), Yt = new H(), li = new _(t), Qt = new _(t), it = new _(t), oi = new _(t), ai = new _(t), hi = new _(t), Vt = new _(t), rt = new _(t), nt = new _(t), jt = new _(t), lt = new _(t), we = new cs(t), Ae = new _(t), ci = new cs(t), _i = new _(t), De = new _(t), ui = new cs(t), fi = new _(t);
|
|
2432
|
+
function w(c) {
|
|
2399
2433
|
return {
|
|
2400
2434
|
line: c.line,
|
|
2401
2435
|
column: c.column,
|
|
@@ -2404,241 +2438,237 @@ function Ki(r, e, t) {
|
|
|
2404
2438
|
};
|
|
2405
2439
|
}
|
|
2406
2440
|
let Ee = -1;
|
|
2407
|
-
|
|
2408
|
-
var
|
|
2441
|
+
G(u, (c, F) => {
|
|
2442
|
+
var Ci, yi, bi, Ri, vi;
|
|
2409
2443
|
Ee >= 0 && F <= Ee && (Ee = -1);
|
|
2410
|
-
let
|
|
2411
|
-
if (c.type ===
|
|
2412
|
-
let
|
|
2413
|
-
|
|
2414
|
-
let
|
|
2415
|
-
if (d.p(
|
|
2416
|
-
let
|
|
2417
|
-
t &&
|
|
2418
|
-
let
|
|
2419
|
-
for (let
|
|
2420
|
-
|
|
2421
|
-
f.push(1),
|
|
2444
|
+
let ts = Ee >= 0 && F > Ee;
|
|
2445
|
+
if (c.type === Hr) {
|
|
2446
|
+
let R = w(c);
|
|
2447
|
+
Ot.push(F), Ms.p(F, R);
|
|
2448
|
+
let y = $i(c.name ?? "");
|
|
2449
|
+
if (d.p(y, R), y === "font-face") {
|
|
2450
|
+
let A = /* @__PURE__ */ Object.create(null);
|
|
2451
|
+
t && Ss.p(c.start, w(c));
|
|
2452
|
+
let x = c.children.find((C) => C.type === Pr);
|
|
2453
|
+
for (let C of (x == null ? void 0 : x.children) || [])
|
|
2454
|
+
C.type === is && C.value && (A[C.property] = C.value.text);
|
|
2455
|
+
f.push(1), U.push(A);
|
|
2422
2456
|
}
|
|
2423
2457
|
if (c.prelude === null || c.prelude === void 0)
|
|
2424
|
-
|
|
2458
|
+
y === "layer" && (Ze.p("<anonymous>", w(c)), f.push(2));
|
|
2425
2459
|
else {
|
|
2426
|
-
let
|
|
2427
|
-
if (
|
|
2428
|
-
|
|
2429
|
-
|
|
2460
|
+
let A = 1;
|
|
2461
|
+
if (y === "media")
|
|
2462
|
+
Ns.p(c.prelude.text, w(c)), $r(c.prelude, (x) => {
|
|
2463
|
+
Ls.p(x, w(c)), A++;
|
|
2430
2464
|
});
|
|
2431
|
-
else if (
|
|
2432
|
-
|
|
2433
|
-
|
|
2465
|
+
else if (y === "supports")
|
|
2466
|
+
vt.p(c.prelude.text, w(c)), Kr(c.prelude, (x) => {
|
|
2467
|
+
Hs.p(x, w(c)), A++;
|
|
2434
2468
|
});
|
|
2435
|
-
else if (
|
|
2436
|
-
let
|
|
2437
|
-
|
|
2438
|
-
} else if (
|
|
2439
|
-
for (let
|
|
2440
|
-
Ze.p(
|
|
2441
|
-
else if (
|
|
2442
|
-
if (
|
|
2443
|
-
for (let
|
|
2444
|
-
|
|
2445
|
-
} else
|
|
2446
|
-
f.push(
|
|
2469
|
+
else if (y.endsWith("keyframes")) {
|
|
2470
|
+
let x = c.prelude.text;
|
|
2471
|
+
Tt.p(x, w(c)), c.is_vendor_prefixed && (St.p(`@${(Ci = c.name) == null ? void 0 : Ci.toLowerCase()} ${c.prelude.text}`, w(c)), A++), Ee = F;
|
|
2472
|
+
} else if (y === "layer")
|
|
2473
|
+
for (let x of c.prelude.text.split(",").map((C) => C.trim()))
|
|
2474
|
+
Ze.p(x, w(c));
|
|
2475
|
+
else if (y === "import") {
|
|
2476
|
+
if (Os.p(c.prelude.text, w(c)), c.prelude.has_children)
|
|
2477
|
+
for (let x of c.prelude)
|
|
2478
|
+
x.type === Wi && typeof x.value == "string" ? vt.p(x.value, w(x)) : x.type === Dr && typeof x.value == "string" && Ze.p(x.value, w(x));
|
|
2479
|
+
} else y === "container" ? (Ps.p(c.prelude.text, w(c)), ((yi = c.prelude.first_child) == null ? void 0 : yi.type) === Fr && ((bi = c.prelude.first_child.first_child) == null ? void 0 : bi.type) === _e && Je.p(c.prelude.first_child.first_child.text, w(c))) : y === "property" ? Ds.p(c.prelude.text, w(c)) : y === "charset" ? Is.p(c.prelude.text.toLowerCase(), w(c)) : y === "scope" && Fs.p(c.prelude.text, w(c));
|
|
2480
|
+
f.push(A);
|
|
2447
2481
|
}
|
|
2448
|
-
} else if (c.type ===
|
|
2449
|
-
if (
|
|
2450
|
-
if (c.prelude.type ===
|
|
2451
|
-
for (let
|
|
2452
|
-
|
|
2482
|
+
} else if (c.type === Mr)
|
|
2483
|
+
if (ts && c.prelude) {
|
|
2484
|
+
if (c.prelude.type === ys && c.prelude.children.length > 0)
|
|
2485
|
+
for (let R of c.prelude.children)
|
|
2486
|
+
Dt.p(R.text, w(R));
|
|
2453
2487
|
} else {
|
|
2454
|
-
|
|
2455
|
-
let
|
|
2488
|
+
Nt++, (Ri = c.block) != null && Ri.is_empty && Lt++;
|
|
2489
|
+
let R = 0, y = 0, A = w(c);
|
|
2456
2490
|
if (c.prelude)
|
|
2457
|
-
for (const
|
|
2458
|
-
|
|
2491
|
+
for (const x of c.prelude.children)
|
|
2492
|
+
x.type === ke && R++;
|
|
2459
2493
|
if (c.block)
|
|
2460
|
-
for (const
|
|
2461
|
-
|
|
2462
|
-
|
|
2494
|
+
for (const x of c.block.children)
|
|
2495
|
+
x.type === is && y++;
|
|
2496
|
+
Ut.push(R + y), zs.p(R + y, A), It.push(R), qs.p(R, A), Ht.push(y), Ks.p(y, A), Pt.push(F), $s.p(F, A);
|
|
2463
2497
|
}
|
|
2464
|
-
else if (c.type ===
|
|
2465
|
-
if (
|
|
2466
|
-
return
|
|
2467
|
-
let
|
|
2468
|
-
|
|
2469
|
-
let
|
|
2470
|
-
et.push(
|
|
2471
|
-
|
|
2472
|
-
}),
|
|
2473
|
-
|
|
2474
|
-
}),
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
U.type === wt && Vs.p(((G = U.name) == null ? void 0 : G.toLowerCase()) ?? "", v);
|
|
2481
|
-
}), Vr(c, (U) => {
|
|
2482
|
-
let G = U.name.trim() === "" ? " " : U.name;
|
|
2483
|
-
js.p(G, U.loc);
|
|
2498
|
+
else if (c.type === ke) {
|
|
2499
|
+
if (ts)
|
|
2500
|
+
return D;
|
|
2501
|
+
let R = w(c);
|
|
2502
|
+
qt.push(F > 0 ? F - 1 : 0), si.p(F > 0 ? F - 1 : 0, R), Bs.add(c.text);
|
|
2503
|
+
let y = fs(c);
|
|
2504
|
+
et.push(y), Vs.p(y, R), Wr(c, (L) => {
|
|
2505
|
+
Ft.p(L.toLowerCase(), R);
|
|
2506
|
+
}), Yr(c, (L) => {
|
|
2507
|
+
zt.p(L, R);
|
|
2508
|
+
}), G(c, (L) => {
|
|
2509
|
+
var B, v, I, S;
|
|
2510
|
+
L.type === Et ? Js.p(((B = L.name) == null ? void 0 : B.toLowerCase()) ?? "", R) : L.type === Ct && ((v = L.name) != null && v.includes("-")) ? ei.p(L.name.toLowerCase(), R) : L.type === Le ? Xs.p(((I = L.name) == null ? void 0 : I.toLowerCase()) ?? "", R) : L.type === Qe && Zs.p(((S = L.name) == null ? void 0 : S.toLowerCase()) ?? "", R);
|
|
2511
|
+
}), Qr(c, (L) => {
|
|
2512
|
+
let B = L.name.trim() === "" ? " " : L.name;
|
|
2513
|
+
ti.p(B, L.loc);
|
|
2484
2514
|
});
|
|
2485
|
-
let
|
|
2486
|
-
return
|
|
2487
|
-
} else if (c.type ===
|
|
2488
|
-
Ie++,
|
|
2489
|
-
let
|
|
2490
|
-
|
|
2491
|
-
let
|
|
2492
|
-
c.is_important && (
|
|
2493
|
-
let { is_important:
|
|
2494
|
-
if (!
|
|
2495
|
-
let
|
|
2496
|
-
|
|
2497
|
-
let
|
|
2498
|
-
He.p(
|
|
2515
|
+
let A = kt(c), [x, C, $] = A;
|
|
2516
|
+
return Qs.p(A.toString(), R), Gs.push(x), Ws.push(C), Ys.push($), ue === void 0 && (ue = A), fe === void 0 && (fe = A), fe !== void 0 && Gi(fe, A) < 0 && (fe = A), ue !== void 0 && Gi(ue, A) > 0 && (ue = A), js.push(A), x > 0 && Mt.p(c.text, R), D;
|
|
2517
|
+
} else if (c.type === is) {
|
|
2518
|
+
Ie++, ii.add(c.text);
|
|
2519
|
+
let R = w(c), y = F > 0 ? F - 1 : 0;
|
|
2520
|
+
Bt.push(y), ni.p(y, R);
|
|
2521
|
+
let A = 1;
|
|
2522
|
+
c.is_important && (A++, c.text.toLowerCase().includes("!important") || Qt.p("!ie", w(c.value)), ts && (Kt++, A++)), ri.push(A);
|
|
2523
|
+
let { is_important: x, property: C, is_browserhack: $, is_vendor_prefixed: L } = c;
|
|
2524
|
+
if (!C) return;
|
|
2525
|
+
let B = w(c);
|
|
2526
|
+
B.length = C.length;
|
|
2527
|
+
let v = $i(C);
|
|
2528
|
+
He.p(v, B), x && tt++, L ? (Pe.push(2), Wt.p(C, B)) : Rs(C) ? (st.p(C, B), Pe.push(x ? 3 : 2), x && $t.p(C, B)) : $ ? (Gt.p(C.charAt(0), B), Pe.push(2)) : Pe.push(1);
|
|
2499
2529
|
{
|
|
2500
|
-
let
|
|
2501
|
-
if (
|
|
2502
|
-
De.p(
|
|
2530
|
+
let I = c.value, { text: S } = I, b = w(I), ot = 1;
|
|
2531
|
+
if (wt.has(S)) {
|
|
2532
|
+
De.p(S.toLowerCase(), b), Yt.push(ot), v === "display" && it.p(S.toLowerCase(), b);
|
|
2503
2533
|
return;
|
|
2504
2534
|
}
|
|
2505
|
-
if (
|
|
2506
|
-
|
|
2507
|
-
}),
|
|
2508
|
-
|
|
2509
|
-
else if (
|
|
2510
|
-
/var\(/i.test(
|
|
2535
|
+
if (kl(I, (m) => {
|
|
2536
|
+
li.p(m.toLowerCase(), b), ot++;
|
|
2537
|
+
}), Ki(I) && (Qt.p("\\9", b), S = S.slice(0, -2), ot++), Yt.push(ot), El.has(v))
|
|
2538
|
+
ul(I) && fi.p(v, b);
|
|
2539
|
+
else if (v === "display")
|
|
2540
|
+
/var\(/i.test(S) ? it.p(S, b) : it.p(S.toLowerCase(), b);
|
|
2511
2541
|
else {
|
|
2512
|
-
if (
|
|
2513
|
-
return
|
|
2514
|
-
if (
|
|
2515
|
-
if (!
|
|
2516
|
-
let
|
|
2542
|
+
if (v === "z-index")
|
|
2543
|
+
return oi.p(S, b), D;
|
|
2544
|
+
if (v === "font") {
|
|
2545
|
+
if (!hs.has(S)) {
|
|
2546
|
+
let m = dl(I, function(Z) {
|
|
2517
2547
|
Z.type === "keyword" && De.p(Z.value.toLowerCase(), b);
|
|
2518
2548
|
});
|
|
2519
|
-
if (!
|
|
2520
|
-
return
|
|
2521
|
-
let { font_size: X, line_height:
|
|
2522
|
-
|
|
2549
|
+
if (!m)
|
|
2550
|
+
return D;
|
|
2551
|
+
let { font_size: X, line_height: N, font_family: O } = m;
|
|
2552
|
+
O && Vt.p(O, b), X && rt.p(X.toLowerCase(), b), N && nt.p(N.toLowerCase(), b);
|
|
2523
2553
|
}
|
|
2524
|
-
} else if (
|
|
2525
|
-
if (!
|
|
2526
|
-
let
|
|
2527
|
-
|
|
2554
|
+
} else if (v === "font-size") {
|
|
2555
|
+
if (!hs.has(S)) {
|
|
2556
|
+
let m = S.toLowerCase();
|
|
2557
|
+
m.includes("var(") ? rt.p(S, b) : rt.p(m, b);
|
|
2528
2558
|
}
|
|
2529
2559
|
} else {
|
|
2530
|
-
if (
|
|
2531
|
-
return
|
|
2532
|
-
if (
|
|
2533
|
-
let
|
|
2534
|
-
|
|
2560
|
+
if (v === "font-family")
|
|
2561
|
+
return hs.has(S) || Vt.p(S, b), D;
|
|
2562
|
+
if (v === "line-height") {
|
|
2563
|
+
let m = S.toLowerCase();
|
|
2564
|
+
m.includes("var(") ? nt.p(S, b) : nt.p(m, b);
|
|
2535
2565
|
} else {
|
|
2536
|
-
if (
|
|
2537
|
-
return
|
|
2538
|
-
|
|
2539
|
-
}),
|
|
2540
|
-
if (
|
|
2541
|
-
for (let
|
|
2542
|
-
if (
|
|
2543
|
-
let X =
|
|
2566
|
+
if (v === "transition" || v === "animation")
|
|
2567
|
+
return ml(I.children, function(m) {
|
|
2568
|
+
m.type === "fn" ? jt.p(m.value.text.toLowerCase(), b) : m.type === "duration" ? lt.p(m.value.text.toLowerCase(), b) : m.type === "keyword" && De.p(m.value.text.toLowerCase(), b);
|
|
2569
|
+
}), D;
|
|
2570
|
+
if (v === "animation-duration" || v === "transition-duration") {
|
|
2571
|
+
for (let m of I.children)
|
|
2572
|
+
if (m.type !== Re) {
|
|
2573
|
+
let X = m.text;
|
|
2544
2574
|
/var\(/i.test(X) ? lt.p(X, b) : lt.p(X.toLowerCase(), b);
|
|
2545
2575
|
}
|
|
2546
|
-
} else if (
|
|
2547
|
-
for (let
|
|
2548
|
-
|
|
2549
|
-
else
|
|
2576
|
+
} else if (v === "transition-timing-function" || v === "animation-timing-function")
|
|
2577
|
+
for (let m of I.children)
|
|
2578
|
+
m.type !== Re && jt.p(m.text, b);
|
|
2579
|
+
else v === "container-name" ? Je.p(S, b) : v === "container" ? ((vi = I.first_child) == null ? void 0 : vi.type) === _e && Je.p(I.first_child.text, b) : Cl.has(v) ? ui.push(S, C, b) : v === "text-shadow" ? ai.p(S, b) : v === "box-shadow" && hi.p(S, b);
|
|
2550
2580
|
}
|
|
2551
2581
|
}
|
|
2552
2582
|
}
|
|
2553
|
-
let
|
|
2554
|
-
|
|
2583
|
+
let Rr = Ki(I);
|
|
2584
|
+
G(I, (m) => {
|
|
2555
2585
|
var X;
|
|
2556
|
-
switch (
|
|
2557
|
-
case
|
|
2558
|
-
let
|
|
2559
|
-
return
|
|
2586
|
+
switch (m.type) {
|
|
2587
|
+
case At: {
|
|
2588
|
+
let N = ((X = m.unit) == null ? void 0 : X.toLowerCase()) ?? "", O = w(m);
|
|
2589
|
+
return ci.push(N, C, O), D;
|
|
2560
2590
|
}
|
|
2561
|
-
case
|
|
2562
|
-
let
|
|
2563
|
-
if (!
|
|
2564
|
-
return
|
|
2565
|
-
let
|
|
2566
|
-
|
|
2567
|
-
let Z =
|
|
2568
|
-
|
|
2569
|
-
let Fe =
|
|
2570
|
-
return we.push(
|
|
2591
|
+
case zr: {
|
|
2592
|
+
let N = m.text;
|
|
2593
|
+
if (!N || !N.startsWith("#"))
|
|
2594
|
+
return D;
|
|
2595
|
+
let O = N.toLowerCase();
|
|
2596
|
+
Rr && !O.endsWith("\\9") && (O = O + "\\9");
|
|
2597
|
+
let Z = O.length - 1;
|
|
2598
|
+
us("\\9", O) && (Z = Z - 2);
|
|
2599
|
+
let Fe = w(m);
|
|
2600
|
+
return we.push(O, C, Fe), Ae.p("hex" + Z, Fe), D;
|
|
2571
2601
|
}
|
|
2572
2602
|
case _e: {
|
|
2573
|
-
let
|
|
2574
|
-
if (
|
|
2575
|
-
return
|
|
2576
|
-
|
|
2577
|
-
let Z =
|
|
2603
|
+
let N = m.text, O = w(m);
|
|
2604
|
+
if (v === "font" || v === "font-family")
|
|
2605
|
+
return D;
|
|
2606
|
+
wt.has(N) && De.p(N.toLowerCase(), O);
|
|
2607
|
+
let Z = N.length;
|
|
2578
2608
|
if (Z > 20 || Z < 3)
|
|
2579
|
-
return
|
|
2580
|
-
if (
|
|
2581
|
-
let Fe =
|
|
2582
|
-
we.push(Fe,
|
|
2609
|
+
return D;
|
|
2610
|
+
if (_l.has(N)) {
|
|
2611
|
+
let Fe = N.toLowerCase();
|
|
2612
|
+
we.push(Fe, C, O), Ae.p(Fe, O);
|
|
2583
2613
|
return;
|
|
2584
2614
|
}
|
|
2585
|
-
if (
|
|
2586
|
-
we.push(
|
|
2615
|
+
if (al.has(N)) {
|
|
2616
|
+
we.push(N.toLowerCase(), C, O), Ae.p("named", O);
|
|
2587
2617
|
return;
|
|
2588
2618
|
}
|
|
2589
|
-
if (
|
|
2590
|
-
we.push(
|
|
2619
|
+
if (hl.has(N)) {
|
|
2620
|
+
we.push(N.toLowerCase(), C, O), Ae.p("system", O);
|
|
2591
2621
|
return;
|
|
2592
2622
|
}
|
|
2593
|
-
return
|
|
2623
|
+
return D;
|
|
2594
2624
|
}
|
|
2595
|
-
case
|
|
2596
|
-
let
|
|
2597
|
-
if (
|
|
2598
|
-
we.push(
|
|
2625
|
+
case bs: {
|
|
2626
|
+
let N = m.name, O = w(m);
|
|
2627
|
+
if (cl.has(N)) {
|
|
2628
|
+
we.push(m.text, C, O), Ae.p(N.toLowerCase(), O);
|
|
2599
2629
|
return;
|
|
2600
2630
|
}
|
|
2601
|
-
if (
|
|
2602
|
-
|
|
2631
|
+
if (us("gradient", N)) {
|
|
2632
|
+
_i.p(m.text, O);
|
|
2603
2633
|
return;
|
|
2604
2634
|
}
|
|
2605
2635
|
}
|
|
2606
2636
|
}
|
|
2607
2637
|
});
|
|
2608
2638
|
}
|
|
2609
|
-
} else if (c.type ===
|
|
2610
|
-
let { value:
|
|
2611
|
-
if (
|
|
2612
|
-
let
|
|
2613
|
-
h.total++, a +=
|
|
2614
|
-
let
|
|
2639
|
+
} else if (c.type === qr) {
|
|
2640
|
+
let { value: R } = c, y = Vi(R || "");
|
|
2641
|
+
if (Qi(y, "data:")) {
|
|
2642
|
+
let A = y.length, x = Al(y);
|
|
2643
|
+
h.total++, a += A;
|
|
2644
|
+
let C = {
|
|
2615
2645
|
line: c.line,
|
|
2616
2646
|
column: c.column,
|
|
2617
2647
|
offset: c.start,
|
|
2618
2648
|
length: c.length
|
|
2619
2649
|
};
|
|
2620
|
-
if (h.unique.has(
|
|
2621
|
-
let
|
|
2622
|
-
|
|
2650
|
+
if (h.unique.has(x)) {
|
|
2651
|
+
let $ = h.unique.get(x);
|
|
2652
|
+
$.count++, $.size += A, h.unique.set(x, $), t && $.uniqueWithLocations && $.uniqueWithLocations.push(C);
|
|
2623
2653
|
} else {
|
|
2624
|
-
let
|
|
2654
|
+
let $ = {
|
|
2625
2655
|
count: 1,
|
|
2626
|
-
size:
|
|
2627
|
-
uniqueWithLocations: t ? [
|
|
2656
|
+
size: A,
|
|
2657
|
+
uniqueWithLocations: t ? [C] : void 0
|
|
2628
2658
|
};
|
|
2629
|
-
h.unique.set(
|
|
2659
|
+
h.unique.set(x, $);
|
|
2630
2660
|
}
|
|
2631
2661
|
}
|
|
2632
|
-
} else if (c.type ===
|
|
2633
|
-
return c.name &&
|
|
2662
|
+
} else if (c.type === Yi)
|
|
2663
|
+
return c.name && Us.p(c.name.toLowerCase(), w(c)), D;
|
|
2634
2664
|
});
|
|
2635
|
-
let
|
|
2665
|
+
let pi = ii.size, Ce = et.size(), Xt = Gs.aggregate(), Zt = Ws.aggregate(), Jt = Ys.aggregate(), di = Bs.size, T = Object.assign, gi = r.length, es = U.length, xi = f.aggregate(), mi = et.aggregate(), ki = ri.aggregate(), wi = Pe.aggregate(), Ai = Yt.aggregate(), Ei = d.c();
|
|
2636
2666
|
return {
|
|
2637
2667
|
stylesheet: {
|
|
2638
|
-
sourceLinesOfCode:
|
|
2668
|
+
sourceLinesOfCode: Ei.total + Ce + Ie + Dt.size(),
|
|
2639
2669
|
linesOfCode: i,
|
|
2640
|
-
size:
|
|
2641
|
-
complexity:
|
|
2670
|
+
size: gi,
|
|
2671
|
+
complexity: xi.sum + mi.sum + ki.sum + wi.sum + Ai.sum,
|
|
2642
2672
|
comments: {
|
|
2643
2673
|
total: n,
|
|
2644
2674
|
size: l
|
|
@@ -2646,196 +2676,197 @@ function Ki(r, e, t) {
|
|
|
2646
2676
|
embeddedContent: {
|
|
2647
2677
|
size: {
|
|
2648
2678
|
total: a,
|
|
2649
|
-
ratio:
|
|
2679
|
+
ratio: P(a, gi)
|
|
2650
2680
|
},
|
|
2651
2681
|
types: {
|
|
2652
2682
|
total: h.total,
|
|
2653
2683
|
totalUnique: h.unique.size,
|
|
2654
|
-
uniquenessRatio:
|
|
2684
|
+
uniquenessRatio: P(h.unique.size, h.total),
|
|
2655
2685
|
unique: Object.fromEntries(h.unique)
|
|
2656
2686
|
}
|
|
2657
2687
|
}
|
|
2658
2688
|
},
|
|
2659
|
-
atrules:
|
|
2660
|
-
fontface:
|
|
2689
|
+
atrules: T(Ei, {
|
|
2690
|
+
fontface: T(
|
|
2661
2691
|
{
|
|
2662
|
-
total:
|
|
2663
|
-
totalUnique:
|
|
2664
|
-
unique:
|
|
2665
|
-
uniquenessRatio:
|
|
2692
|
+
total: es,
|
|
2693
|
+
totalUnique: es,
|
|
2694
|
+
unique: U,
|
|
2695
|
+
uniquenessRatio: es === 0 ? 0 : 1
|
|
2666
2696
|
},
|
|
2667
2697
|
t ? {
|
|
2668
|
-
uniqueWithLocations:
|
|
2698
|
+
uniqueWithLocations: Ss.c().uniqueWithLocations
|
|
2669
2699
|
} : {}
|
|
2670
2700
|
),
|
|
2671
|
-
import:
|
|
2672
|
-
media:
|
|
2673
|
-
browserhacks:
|
|
2674
|
-
features:
|
|
2701
|
+
import: Os.c(),
|
|
2702
|
+
media: T(Ns.c(), {
|
|
2703
|
+
browserhacks: Ls.c(),
|
|
2704
|
+
features: Us.c()
|
|
2675
2705
|
}),
|
|
2676
|
-
charset:
|
|
2677
|
-
supports:
|
|
2678
|
-
browserhacks:
|
|
2706
|
+
charset: Is.c(),
|
|
2707
|
+
supports: T(vt.c(), {
|
|
2708
|
+
browserhacks: Hs.c()
|
|
2679
2709
|
}),
|
|
2680
|
-
keyframes:
|
|
2681
|
-
prefixed:
|
|
2682
|
-
ratio:
|
|
2710
|
+
keyframes: T(Tt.c(), {
|
|
2711
|
+
prefixed: T(St.c(), {
|
|
2712
|
+
ratio: P(St.size(), Tt.size())
|
|
2683
2713
|
})
|
|
2684
2714
|
}),
|
|
2685
|
-
container:
|
|
2715
|
+
container: T(Ps.c(), {
|
|
2686
2716
|
names: Je.c()
|
|
2687
2717
|
}),
|
|
2688
2718
|
layer: Ze.c(),
|
|
2689
|
-
property:
|
|
2690
|
-
scope:
|
|
2691
|
-
complexity:
|
|
2692
|
-
nesting:
|
|
2693
|
-
|
|
2719
|
+
property: Ds.c(),
|
|
2720
|
+
scope: Fs.c(),
|
|
2721
|
+
complexity: xi,
|
|
2722
|
+
nesting: T(
|
|
2723
|
+
Ot.aggregate(),
|
|
2694
2724
|
{
|
|
2695
|
-
items:
|
|
2725
|
+
items: Ot.toArray()
|
|
2696
2726
|
},
|
|
2697
|
-
|
|
2727
|
+
Ms.c()
|
|
2698
2728
|
)
|
|
2699
2729
|
}),
|
|
2700
2730
|
rules: {
|
|
2701
|
-
total:
|
|
2731
|
+
total: Nt,
|
|
2702
2732
|
empty: {
|
|
2703
|
-
total:
|
|
2704
|
-
ratio:
|
|
2733
|
+
total: Lt,
|
|
2734
|
+
ratio: P(Lt, Nt)
|
|
2705
2735
|
},
|
|
2706
|
-
sizes:
|
|
2707
|
-
|
|
2736
|
+
sizes: T(
|
|
2737
|
+
Ut.aggregate(),
|
|
2708
2738
|
{
|
|
2709
|
-
items:
|
|
2739
|
+
items: Ut.toArray()
|
|
2710
2740
|
},
|
|
2711
|
-
|
|
2741
|
+
zs.c()
|
|
2712
2742
|
),
|
|
2713
|
-
nesting:
|
|
2714
|
-
|
|
2743
|
+
nesting: T(
|
|
2744
|
+
Pt.aggregate(),
|
|
2715
2745
|
{
|
|
2716
|
-
items:
|
|
2746
|
+
items: Pt.toArray()
|
|
2717
2747
|
},
|
|
2718
|
-
|
|
2748
|
+
$s.c()
|
|
2719
2749
|
),
|
|
2720
|
-
selectors:
|
|
2721
|
-
|
|
2750
|
+
selectors: T(
|
|
2751
|
+
It.aggregate(),
|
|
2722
2752
|
{
|
|
2723
|
-
items:
|
|
2753
|
+
items: It.toArray()
|
|
2724
2754
|
},
|
|
2725
|
-
|
|
2755
|
+
qs.c()
|
|
2726
2756
|
),
|
|
2727
|
-
declarations:
|
|
2728
|
-
|
|
2757
|
+
declarations: T(
|
|
2758
|
+
Ht.aggregate(),
|
|
2729
2759
|
{
|
|
2730
|
-
items:
|
|
2760
|
+
items: Ht.toArray()
|
|
2731
2761
|
},
|
|
2732
|
-
|
|
2762
|
+
Ks.c()
|
|
2733
2763
|
)
|
|
2734
2764
|
},
|
|
2735
2765
|
selectors: {
|
|
2736
|
-
total:
|
|
2737
|
-
totalUnique:
|
|
2738
|
-
uniquenessRatio:
|
|
2739
|
-
specificity:
|
|
2766
|
+
total: Ce,
|
|
2767
|
+
totalUnique: di,
|
|
2768
|
+
uniquenessRatio: P(di, Ce),
|
|
2769
|
+
specificity: T(
|
|
2740
2770
|
{
|
|
2741
2771
|
/** @type Specificity */
|
|
2742
2772
|
min: fe === void 0 ? [0, 0, 0] : fe,
|
|
2743
2773
|
/** @type Specificity */
|
|
2744
2774
|
max: ue === void 0 ? [0, 0, 0] : ue,
|
|
2745
2775
|
/** @type Specificity */
|
|
2746
|
-
sum: [
|
|
2776
|
+
sum: [Xt.sum, Zt.sum, Jt.sum],
|
|
2747
2777
|
/** @type Specificity */
|
|
2748
|
-
mean: [
|
|
2778
|
+
mean: [Xt.mean, Zt.mean, Jt.mean],
|
|
2749
2779
|
/** @type Specificity */
|
|
2750
|
-
mode: [
|
|
2780
|
+
mode: [Xt.mode, Zt.mode, Jt.mode],
|
|
2751
2781
|
/** @type Specificity */
|
|
2752
|
-
items:
|
|
2782
|
+
items: js
|
|
2753
2783
|
},
|
|
2754
|
-
|
|
2784
|
+
Qs.c()
|
|
2755
2785
|
),
|
|
2756
|
-
complexity:
|
|
2786
|
+
complexity: T(mi, Vs.c(), {
|
|
2757
2787
|
items: et.toArray()
|
|
2758
2788
|
}),
|
|
2759
|
-
nesting:
|
|
2760
|
-
|
|
2789
|
+
nesting: T(
|
|
2790
|
+
qt.aggregate(),
|
|
2761
2791
|
{
|
|
2762
|
-
items:
|
|
2792
|
+
items: qt.toArray()
|
|
2763
2793
|
},
|
|
2764
|
-
|
|
2794
|
+
si.c()
|
|
2765
2795
|
),
|
|
2766
|
-
id:
|
|
2767
|
-
ratio:
|
|
2796
|
+
id: T(Mt.c(), {
|
|
2797
|
+
ratio: P(Mt.size(), Ce)
|
|
2768
2798
|
}),
|
|
2769
|
-
pseudoClasses:
|
|
2770
|
-
pseudoElements:
|
|
2771
|
-
accessibility:
|
|
2772
|
-
ratio:
|
|
2799
|
+
pseudoClasses: Xs.c(),
|
|
2800
|
+
pseudoElements: Zs.c(),
|
|
2801
|
+
accessibility: T(zt.c(), {
|
|
2802
|
+
ratio: P(zt.size(), Ce)
|
|
2773
2803
|
}),
|
|
2774
|
-
attributes:
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2804
|
+
attributes: Js.c(),
|
|
2805
|
+
customElements: ei.c(),
|
|
2806
|
+
keyframes: Dt.c(),
|
|
2807
|
+
prefixed: T(Ft.c(), {
|
|
2808
|
+
ratio: P(Ft.size(), Ce)
|
|
2778
2809
|
}),
|
|
2779
|
-
combinators:
|
|
2810
|
+
combinators: ti.c()
|
|
2780
2811
|
},
|
|
2781
2812
|
declarations: {
|
|
2782
2813
|
total: Ie,
|
|
2783
|
-
totalUnique:
|
|
2784
|
-
uniquenessRatio:
|
|
2814
|
+
totalUnique: pi,
|
|
2815
|
+
uniquenessRatio: P(pi, Ie),
|
|
2785
2816
|
importants: {
|
|
2786
2817
|
total: tt,
|
|
2787
|
-
ratio:
|
|
2818
|
+
ratio: P(tt, Ie),
|
|
2788
2819
|
inKeyframes: {
|
|
2789
|
-
total:
|
|
2790
|
-
ratio:
|
|
2820
|
+
total: Kt,
|
|
2821
|
+
ratio: P(Kt, tt)
|
|
2791
2822
|
}
|
|
2792
2823
|
},
|
|
2793
|
-
complexity:
|
|
2794
|
-
nesting:
|
|
2795
|
-
|
|
2824
|
+
complexity: ki,
|
|
2825
|
+
nesting: T(
|
|
2826
|
+
Bt.aggregate(),
|
|
2796
2827
|
{
|
|
2797
|
-
items:
|
|
2828
|
+
items: Bt.toArray()
|
|
2798
2829
|
},
|
|
2799
|
-
|
|
2830
|
+
ni.c()
|
|
2800
2831
|
)
|
|
2801
2832
|
},
|
|
2802
|
-
properties:
|
|
2803
|
-
prefixed:
|
|
2804
|
-
ratio:
|
|
2833
|
+
properties: T(He.c(), {
|
|
2834
|
+
prefixed: T(Wt.c(), {
|
|
2835
|
+
ratio: P(Wt.size(), He.size())
|
|
2805
2836
|
}),
|
|
2806
|
-
custom:
|
|
2807
|
-
ratio:
|
|
2808
|
-
importants:
|
|
2809
|
-
ratio:
|
|
2837
|
+
custom: T(st.c(), {
|
|
2838
|
+
ratio: P(st.size(), He.size()),
|
|
2839
|
+
importants: T($t.c(), {
|
|
2840
|
+
ratio: P($t.size(), st.size())
|
|
2810
2841
|
})
|
|
2811
2842
|
}),
|
|
2812
|
-
browserhacks:
|
|
2813
|
-
ratio:
|
|
2843
|
+
browserhacks: T(Gt.c(), {
|
|
2844
|
+
ratio: P(Gt.size(), He.size())
|
|
2814
2845
|
}),
|
|
2815
|
-
complexity:
|
|
2846
|
+
complexity: wi
|
|
2816
2847
|
}),
|
|
2817
2848
|
values: {
|
|
2818
|
-
colors:
|
|
2849
|
+
colors: T(we.count(), {
|
|
2819
2850
|
formats: Ae.c()
|
|
2820
2851
|
}),
|
|
2821
|
-
gradients:
|
|
2822
|
-
fontFamilies:
|
|
2852
|
+
gradients: _i.c(),
|
|
2853
|
+
fontFamilies: Vt.c(),
|
|
2823
2854
|
fontSizes: rt.c(),
|
|
2824
2855
|
lineHeights: nt.c(),
|
|
2825
|
-
zindexes:
|
|
2826
|
-
textShadows:
|
|
2827
|
-
boxShadows:
|
|
2828
|
-
borderRadiuses:
|
|
2856
|
+
zindexes: oi.c(),
|
|
2857
|
+
textShadows: ai.c(),
|
|
2858
|
+
boxShadows: hi.c(),
|
|
2859
|
+
borderRadiuses: ui.count(),
|
|
2829
2860
|
animations: {
|
|
2830
2861
|
durations: lt.c(),
|
|
2831
|
-
timingFunctions:
|
|
2862
|
+
timingFunctions: jt.c()
|
|
2832
2863
|
},
|
|
2833
|
-
prefixes:
|
|
2834
|
-
browserhacks:
|
|
2835
|
-
units:
|
|
2836
|
-
complexity:
|
|
2864
|
+
prefixes: li.c(),
|
|
2865
|
+
browserhacks: Qt.c(),
|
|
2866
|
+
units: ci.count(),
|
|
2867
|
+
complexity: Ai,
|
|
2837
2868
|
keywords: De.c(),
|
|
2838
|
-
resets:
|
|
2869
|
+
resets: fi.c(),
|
|
2839
2870
|
displays: it.c()
|
|
2840
2871
|
},
|
|
2841
2872
|
__meta__: {
|
|
@@ -2845,25 +2876,25 @@ function Ki(r, e, t) {
|
|
|
2845
2876
|
}
|
|
2846
2877
|
};
|
|
2847
2878
|
}
|
|
2848
|
-
function
|
|
2879
|
+
function Gi(r, e) {
|
|
2849
2880
|
return r[0] === e[0] ? r[1] === e[1] ? e[2] - r[2] : e[1] - r[1] : e[0] - r[0];
|
|
2850
2881
|
}
|
|
2851
2882
|
export {
|
|
2852
2883
|
W as KeywordSet,
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2884
|
+
Tl as analyze,
|
|
2885
|
+
zi as calculateSpecificity,
|
|
2886
|
+
cl as colorFunctions,
|
|
2887
|
+
_l as colorKeywords,
|
|
2888
|
+
Gi as compareSpecificity,
|
|
2889
|
+
wt as cssKeywords,
|
|
2890
|
+
vl as hasVendorPrefix,
|
|
2891
|
+
Yr as isAccessibilitySelector,
|
|
2892
|
+
$r as isMediaBrowserhack,
|
|
2893
|
+
yl as isPropertyHack,
|
|
2894
|
+
Wr as isSelectorPrefixed,
|
|
2895
|
+
Kr as isSupportsBrowserhack,
|
|
2896
|
+
kl as isValuePrefixed,
|
|
2897
|
+
al as namedColors,
|
|
2898
|
+
fs as selectorComplexity,
|
|
2899
|
+
hl as systemColors
|
|
2869
2900
|
};
|