playwright-ui5 1.1.2 → 1.1.3

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.
@@ -26,11 +26,392 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  ));
27
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
28
 
29
+ // node_modules/css-selector-parser/lib/indexes.js
30
+ var require_indexes = __commonJS({
31
+ "node_modules/css-selector-parser/lib/indexes.js"(exports) {
32
+ "use strict";
33
+ Object.defineProperty(exports, "__esModule", { value: true });
34
+ exports.createRegularIndex = exports.createMulticharIndex = exports.emptyRegularIndex = exports.emptyMulticharIndex = void 0;
35
+ exports.emptyMulticharIndex = {};
36
+ exports.emptyRegularIndex = {};
37
+ function extendIndex(item, index) {
38
+ var currentIndex = index;
39
+ for (var pos = 0; pos < item.length; pos++) {
40
+ var isLast = pos === item.length - 1;
41
+ var char = item.charAt(pos);
42
+ var charIndex = currentIndex[char] || (currentIndex[char] = { chars: {} });
43
+ if (isLast) {
44
+ charIndex.self = item;
45
+ }
46
+ currentIndex = charIndex.chars;
47
+ }
48
+ }
49
+ function createMulticharIndex(items) {
50
+ if (items.length === 0) {
51
+ return exports.emptyMulticharIndex;
52
+ }
53
+ var index = {};
54
+ for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
55
+ var item = items_1[_i];
56
+ extendIndex(item, index);
57
+ }
58
+ return index;
59
+ }
60
+ exports.createMulticharIndex = createMulticharIndex;
61
+ function createRegularIndex(items) {
62
+ if (items.length === 0) {
63
+ return exports.emptyRegularIndex;
64
+ }
65
+ var result = {};
66
+ for (var _i = 0, items_2 = items; _i < items_2.length; _i++) {
67
+ var item = items_2[_i];
68
+ result[item] = true;
69
+ }
70
+ return result;
71
+ }
72
+ exports.createRegularIndex = createRegularIndex;
73
+ }
74
+ });
75
+
76
+ // node_modules/css-selector-parser/lib/pseudo-class-signatures.js
77
+ var require_pseudo_class_signatures = __commonJS({
78
+ "node_modules/css-selector-parser/lib/pseudo-class-signatures.js"(exports) {
79
+ "use strict";
80
+ Object.defineProperty(exports, "__esModule", { value: true });
81
+ exports.calculatePseudoClassSignatures = exports.inverseCategories = exports.defaultPseudoClassSignature = exports.emptyPseudoClassSignatures = void 0;
82
+ exports.emptyPseudoClassSignatures = {};
83
+ exports.defaultPseudoClassSignature = {
84
+ type: "String",
85
+ optional: true
86
+ };
87
+ function calculatePseudoClassSignature(types) {
88
+ var result = {
89
+ optional: false
90
+ };
91
+ function setResultType(type2) {
92
+ if (result.type && result.type !== type2) {
93
+ throw new Error('Conflicting pseudo-class argument type: "'.concat(result.type, '" vs "').concat(type2, '".'));
94
+ }
95
+ result.type = type2;
96
+ }
97
+ for (var _i = 0, types_1 = types; _i < types_1.length; _i++) {
98
+ var type = types_1[_i];
99
+ if (type === "NoArgument") {
100
+ result.optional = true;
101
+ }
102
+ if (type === "Formula") {
103
+ setResultType("Formula");
104
+ }
105
+ if (type === "FormulaOfSelector") {
106
+ setResultType("Formula");
107
+ result.ofSelector = true;
108
+ }
109
+ if (type === "String") {
110
+ setResultType("String");
111
+ }
112
+ if (type === "Selector") {
113
+ setResultType("Selector");
114
+ }
115
+ }
116
+ return result;
117
+ }
118
+ function inverseCategories(obj) {
119
+ var result = {};
120
+ for (var _i = 0, _a = Object.keys(obj); _i < _a.length; _i++) {
121
+ var category = _a[_i];
122
+ var items = obj[category];
123
+ if (items) {
124
+ for (var _b = 0, _c = items; _b < _c.length; _b++) {
125
+ var item = _c[_b];
126
+ (result[item] || (result[item] = [])).push(category);
127
+ }
128
+ }
129
+ }
130
+ return result;
131
+ }
132
+ exports.inverseCategories = inverseCategories;
133
+ function calculatePseudoClassSignatures(definitions) {
134
+ var pseudoClassesToArgumentTypes = inverseCategories(definitions);
135
+ var result = {};
136
+ for (var _i = 0, _a = Object.keys(pseudoClassesToArgumentTypes); _i < _a.length; _i++) {
137
+ var pseudoClass = _a[_i];
138
+ var argumentTypes = pseudoClassesToArgumentTypes[pseudoClass];
139
+ if (argumentTypes) {
140
+ result[pseudoClass] = calculatePseudoClassSignature(argumentTypes);
141
+ }
142
+ }
143
+ return result;
144
+ }
145
+ exports.calculatePseudoClassSignatures = calculatePseudoClassSignatures;
146
+ }
147
+ });
148
+
149
+ // node_modules/css-selector-parser/lib/syntax-definitions.js
150
+ var require_syntax_definitions = __commonJS({
151
+ "node_modules/css-selector-parser/lib/syntax-definitions.js"(exports) {
152
+ "use strict";
153
+ var __assign = exports && exports.__assign || function() {
154
+ __assign = Object.assign || function(t) {
155
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
156
+ s = arguments[i];
157
+ for (var p in s)
158
+ if (Object.prototype.hasOwnProperty.call(s, p))
159
+ t[p] = s[p];
160
+ }
161
+ return t;
162
+ };
163
+ return __assign.apply(this, arguments);
164
+ };
165
+ Object.defineProperty(exports, "__esModule", { value: true });
166
+ exports.cssSyntaxDefinitions = exports.extendSyntaxDefinition = exports.getXmlOptions = void 0;
167
+ var emptyXmlOptions = {};
168
+ var defaultXmlOptions = { wildcard: true };
169
+ function getXmlOptions(param) {
170
+ if (param) {
171
+ if (typeof param === "boolean") {
172
+ return defaultXmlOptions;
173
+ } else {
174
+ return param;
175
+ }
176
+ } else {
177
+ return emptyXmlOptions;
178
+ }
179
+ }
180
+ exports.getXmlOptions = getXmlOptions;
181
+ function extendSyntaxDefinition(base, extension) {
182
+ var result = __assign({}, base);
183
+ if ("tag" in extension) {
184
+ if (extension.tag) {
185
+ result.tag = __assign({}, getXmlOptions(base.tag));
186
+ var extensionOptions = getXmlOptions(extension.tag);
187
+ if ("wildcard" in extensionOptions) {
188
+ result.tag.wildcard = extensionOptions.wildcard;
189
+ }
190
+ } else {
191
+ result.tag = void 0;
192
+ }
193
+ }
194
+ if ("ids" in extension) {
195
+ result.ids = extension.ids;
196
+ }
197
+ if ("classNames" in extension) {
198
+ result.classNames = extension.classNames;
199
+ }
200
+ if ("namespace" in extension) {
201
+ if (extension.namespace) {
202
+ result.namespace = __assign({}, getXmlOptions(base.namespace));
203
+ var extensionOptions = getXmlOptions(extension.namespace);
204
+ if ("wildcard" in extensionOptions) {
205
+ result.namespace.wildcard = extensionOptions.wildcard;
206
+ }
207
+ } else {
208
+ result.namespace = void 0;
209
+ }
210
+ }
211
+ if ("combinators" in extension) {
212
+ if (extension.combinators) {
213
+ result.combinators = result.combinators ? result.combinators.concat(extension.combinators) : extension.combinators;
214
+ } else {
215
+ result.combinators = void 0;
216
+ }
217
+ }
218
+ if ("attributes" in extension) {
219
+ if (extension.attributes) {
220
+ result.attributes = __assign({}, base.attributes);
221
+ if ("unknownCaseSensitivityModifiers" in extension.attributes) {
222
+ result.attributes.unknownCaseSensitivityModifiers = extension.attributes.unknownCaseSensitivityModifiers;
223
+ }
224
+ if ("operators" in extension.attributes) {
225
+ result.attributes.operators = extension.attributes.operators ? result.attributes.operators ? result.attributes.operators.concat(extension.attributes.operators) : extension.attributes.operators : void 0;
226
+ }
227
+ if ("caseSensitivityModifiers" in extension.attributes) {
228
+ result.attributes.caseSensitivityModifiers = extension.attributes.caseSensitivityModifiers ? result.attributes.caseSensitivityModifiers ? result.attributes.caseSensitivityModifiers.concat(extension.attributes.caseSensitivityModifiers) : extension.attributes.caseSensitivityModifiers : void 0;
229
+ }
230
+ } else {
231
+ result.attributes = void 0;
232
+ }
233
+ }
234
+ if ("pseudoElements" in extension) {
235
+ if (extension.pseudoElements) {
236
+ result.pseudoElements = __assign({}, base.pseudoElements);
237
+ if ("unknown" in extension.pseudoElements) {
238
+ result.pseudoElements.unknown = extension.pseudoElements.unknown;
239
+ }
240
+ if ("notation" in extension.pseudoElements) {
241
+ result.pseudoElements.notation = extension.pseudoElements.notation;
242
+ }
243
+ if ("definitions" in extension.pseudoElements) {
244
+ result.pseudoElements.definitions = extension.pseudoElements.definitions ? result.pseudoElements.definitions ? result.pseudoElements.definitions.concat(extension.pseudoElements.definitions) : extension.pseudoElements.definitions : void 0;
245
+ }
246
+ } else {
247
+ result.pseudoElements = void 0;
248
+ }
249
+ }
250
+ if ("pseudoClasses" in extension) {
251
+ if (extension.pseudoClasses) {
252
+ result.pseudoClasses = __assign({}, base.pseudoClasses);
253
+ if ("unknown" in extension.pseudoClasses) {
254
+ result.pseudoClasses.unknown = extension.pseudoClasses.unknown;
255
+ }
256
+ if ("definitions" in extension.pseudoClasses) {
257
+ var newDefinitions = extension.pseudoClasses.definitions;
258
+ if (newDefinitions) {
259
+ result.pseudoClasses.definitions = __assign({}, result.pseudoClasses.definitions);
260
+ var existingDefinitions = result.pseudoClasses.definitions;
261
+ for (var _i = 0, _a = Object.keys(newDefinitions); _i < _a.length; _i++) {
262
+ var key = _a[_i];
263
+ var newDefinitionForNotation = newDefinitions[key];
264
+ var existingDefinitionForNotation = existingDefinitions[key];
265
+ if (newDefinitionForNotation) {
266
+ existingDefinitions[key] = existingDefinitionForNotation ? existingDefinitionForNotation.concat(newDefinitionForNotation) : newDefinitionForNotation;
267
+ } else {
268
+ existingDefinitions[key] = void 0;
269
+ }
270
+ }
271
+ } else {
272
+ result.pseudoClasses.definitions = void 0;
273
+ }
274
+ }
275
+ } else {
276
+ result.pseudoClasses = void 0;
277
+ }
278
+ }
279
+ return result;
280
+ }
281
+ exports.extendSyntaxDefinition = extendSyntaxDefinition;
282
+ var css1SyntaxDefinition = {
283
+ tag: {},
284
+ ids: true,
285
+ classNames: true,
286
+ combinators: [],
287
+ pseudoElements: {
288
+ unknown: "reject",
289
+ notation: "singleColon",
290
+ definitions: ["first-letter", "first-line"]
291
+ },
292
+ pseudoClasses: {
293
+ unknown: "reject",
294
+ definitions: {
295
+ NoArgument: ["link", "visited", "active"]
296
+ }
297
+ }
298
+ };
299
+ var css2SyntaxDefinition = extendSyntaxDefinition(css1SyntaxDefinition, {
300
+ tag: { wildcard: true },
301
+ combinators: [">", "+"],
302
+ attributes: {
303
+ unknownCaseSensitivityModifiers: "reject",
304
+ operators: ["=", "~=", "|="]
305
+ },
306
+ pseudoElements: {
307
+ definitions: ["before", "after"]
308
+ },
309
+ pseudoClasses: {
310
+ unknown: "reject",
311
+ definitions: {
312
+ NoArgument: ["hover", "focus", "first-child"],
313
+ String: ["lang"]
314
+ }
315
+ }
316
+ });
317
+ var selectors3SyntaxDefinition = extendSyntaxDefinition(css2SyntaxDefinition, {
318
+ namespace: {
319
+ wildcard: true
320
+ },
321
+ combinators: ["~"],
322
+ attributes: {
323
+ operators: ["^=", "$=", "*="]
324
+ },
325
+ pseudoElements: {
326
+ notation: "both"
327
+ },
328
+ pseudoClasses: {
329
+ definitions: {
330
+ NoArgument: [
331
+ "root",
332
+ "last-child",
333
+ "first-of-type",
334
+ "last-of-type",
335
+ "only-child",
336
+ "only-of-type",
337
+ "empty",
338
+ "target",
339
+ "enabled",
340
+ "disabled",
341
+ "checked",
342
+ "indeterminate"
343
+ ],
344
+ Formula: ["nth-child", "nth-last-child", "nth-of-type", "nth-last-of-type"],
345
+ Selector: ["not"]
346
+ }
347
+ }
348
+ });
349
+ var selectors4SyntaxDefinition = extendSyntaxDefinition(selectors3SyntaxDefinition, {
350
+ combinators: ["||"],
351
+ attributes: {
352
+ caseSensitivityModifiers: ["i", "I", "s", "S"]
353
+ },
354
+ pseudoClasses: {
355
+ definitions: {
356
+ NoArgument: [
357
+ "any-link",
358
+ "local-link",
359
+ "target-within",
360
+ "scope",
361
+ "current",
362
+ "past",
363
+ "future",
364
+ "focus-within",
365
+ "focus-visible",
366
+ "read-write",
367
+ "read-only",
368
+ "placeholder-shown",
369
+ "default",
370
+ "valid",
371
+ "invalid",
372
+ "in-range",
373
+ "out-of-range",
374
+ "required",
375
+ "optional",
376
+ "blank",
377
+ "user-invalid"
378
+ ],
379
+ Formula: ["nth-col", "nth-last-col"],
380
+ String: ["dir"],
381
+ FormulaOfSelector: ["nth-child", "nth-last-child"],
382
+ Selector: ["current", "is", "where", "has"]
383
+ }
384
+ }
385
+ });
386
+ var progressiveSyntaxDefinition = extendSyntaxDefinition(selectors4SyntaxDefinition, {
387
+ pseudoElements: {
388
+ unknown: "accept"
389
+ },
390
+ pseudoClasses: {
391
+ unknown: "accept"
392
+ },
393
+ attributes: {
394
+ unknownCaseSensitivityModifiers: "accept"
395
+ }
396
+ });
397
+ exports.cssSyntaxDefinitions = {
398
+ css1: css1SyntaxDefinition,
399
+ css2: css2SyntaxDefinition,
400
+ css3: selectors3SyntaxDefinition,
401
+ "selectors-3": selectors3SyntaxDefinition,
402
+ "selectors-4": selectors4SyntaxDefinition,
403
+ latest: selectors4SyntaxDefinition,
404
+ progressive: progressiveSyntaxDefinition
405
+ };
406
+ }
407
+ });
408
+
29
409
  // node_modules/css-selector-parser/lib/utils.js
30
410
  var require_utils = __commonJS({
31
411
  "node_modules/css-selector-parser/lib/utils.js"(exports) {
32
412
  "use strict";
33
413
  Object.defineProperty(exports, "__esModule", { value: true });
414
+ exports.escapePseudoClassString = exports.escapeStr = exports.escapeIdentifier = exports.digitsChars = exports.quoteChars = exports.whitespaceChars = exports.stringEscapeChars = exports.strReplacementsRev = exports.identSpecialChars = exports.isHex = exports.isIdent = exports.isIdentStart = void 0;
34
415
  function isIdentStart(c) {
35
416
  return c >= "a" && c <= "z" || c >= "A" && c <= "Z" || c === "-" || c === "_";
36
417
  }
@@ -43,6 +424,74 @@ var require_utils = __commonJS({
43
424
  return c >= "a" && c <= "f" || c >= "A" && c <= "F" || c >= "0" && c <= "9";
44
425
  }
45
426
  exports.isHex = isHex;
427
+ exports.identSpecialChars = {
428
+ "!": true,
429
+ '"': true,
430
+ "#": true,
431
+ $: true,
432
+ "%": true,
433
+ "&": true,
434
+ "'": true,
435
+ "(": true,
436
+ ")": true,
437
+ "*": true,
438
+ "+": true,
439
+ ",": true,
440
+ ".": true,
441
+ "/": true,
442
+ ";": true,
443
+ "<": true,
444
+ "=": true,
445
+ ">": true,
446
+ "?": true,
447
+ "@": true,
448
+ "[": true,
449
+ "\\": true,
450
+ "]": true,
451
+ "^": true,
452
+ "`": true,
453
+ "{": true,
454
+ "|": true,
455
+ "}": true,
456
+ "~": true
457
+ };
458
+ exports.strReplacementsRev = {
459
+ "\n": "\\n",
460
+ "\r": "\\r",
461
+ " ": "\\t",
462
+ "\f": "\\f",
463
+ "\v": "\\v"
464
+ };
465
+ exports.stringEscapeChars = {
466
+ n: "\n",
467
+ r: "\r",
468
+ t: " ",
469
+ f: "\f",
470
+ "\\": "\\"
471
+ };
472
+ exports.whitespaceChars = {
473
+ " ": true,
474
+ " ": true,
475
+ "\n": true,
476
+ "\r": true,
477
+ "\f": true
478
+ };
479
+ exports.quoteChars = {
480
+ '"': true,
481
+ "'": true
482
+ };
483
+ exports.digitsChars = {
484
+ 0: true,
485
+ 1: true,
486
+ 2: true,
487
+ 3: true,
488
+ 4: true,
489
+ 5: true,
490
+ 6: true,
491
+ 7: true,
492
+ 8: true,
493
+ 9: true
494
+ };
46
495
  function escapeIdentifier(s) {
47
496
  var len = s.length;
48
497
  var result = "";
@@ -68,7 +517,7 @@ var require_utils = __commonJS({
68
517
  }
69
518
  i++;
70
519
  }
71
- return result;
520
+ return result.trim();
72
521
  }
73
522
  exports.escapeIdentifier = escapeIdentifier;
74
523
  function escapeStr(s) {
@@ -88,105 +537,160 @@ var require_utils = __commonJS({
88
537
  result += chr;
89
538
  i++;
90
539
  }
91
- return '"' + result + '"';
540
+ return '"'.concat(result, '"');
92
541
  }
93
542
  exports.escapeStr = escapeStr;
94
- exports.identSpecialChars = {
95
- "!": true,
96
- '"': true,
97
- "#": true,
98
- "$": true,
99
- "%": true,
100
- "&": true,
101
- "'": true,
102
- "(": true,
103
- ")": true,
104
- "*": true,
105
- "+": true,
106
- ",": true,
107
- ".": true,
108
- "/": true,
109
- ";": true,
110
- "<": true,
111
- "=": true,
112
- ">": true,
113
- "?": true,
114
- "@": true,
115
- "[": true,
116
- "\\": true,
117
- "]": true,
118
- "^": true,
119
- "`": true,
120
- "{": true,
121
- "|": true,
122
- "}": true,
123
- "~": true
124
- };
125
- exports.strReplacementsRev = {
126
- "\n": "\\n",
127
- "\r": "\\r",
128
- " ": "\\t",
129
- "\f": "\\f",
130
- "\v": "\\v"
131
- };
132
- exports.singleQuoteEscapeChars = {
133
- n: "\n",
134
- r: "\r",
135
- t: " ",
136
- f: "\f",
137
- "\\": "\\",
138
- "'": "'"
139
- };
140
- exports.doubleQuotesEscapeChars = {
141
- n: "\n",
142
- r: "\r",
143
- t: " ",
144
- f: "\f",
145
- "\\": "\\",
146
- '"': '"'
543
+ var escapePseudoClassString = function(s) {
544
+ return s.replace(/([\\)])/g, "\\$1");
147
545
  };
546
+ exports.escapePseudoClassString = escapePseudoClassString;
148
547
  }
149
548
  });
150
549
 
151
- // node_modules/css-selector-parser/lib/parser-context.js
152
- var require_parser_context = __commonJS({
153
- "node_modules/css-selector-parser/lib/parser-context.js"(exports) {
550
+ // node_modules/css-selector-parser/lib/parser.js
551
+ var require_parser = __commonJS({
552
+ "node_modules/css-selector-parser/lib/parser.js"(exports) {
154
553
  "use strict";
155
554
  Object.defineProperty(exports, "__esModule", { value: true });
555
+ exports.createParser = void 0;
556
+ var indexes_1 = require_indexes();
557
+ var pseudo_class_signatures_1 = require_pseudo_class_signatures();
558
+ var syntax_definitions_1 = require_syntax_definitions();
156
559
  var utils_1 = require_utils();
157
- function parseCssSelector(str, pos, pseudos, attrEqualityMods, ruleNestingOperators, substitutesEnabled) {
560
+ var errorPrefix = "css-selector-parser parse error: ";
561
+ function createParser2(options) {
562
+ if (options === void 0) {
563
+ options = {};
564
+ }
565
+ var _a = options.syntax, syntax = _a === void 0 ? "latest" : _a, substitutes = options.substitutes, _b = options.strict, strict = _b === void 0 ? true : _b;
566
+ var syntaxDefinition = typeof syntax === "string" ? syntax_definitions_1.cssSyntaxDefinitions[syntax] : syntax;
567
+ if (syntaxDefinition.baseSyntax) {
568
+ syntaxDefinition = (0, syntax_definitions_1.extendSyntaxDefinition)(syntax_definitions_1.cssSyntaxDefinitions[syntaxDefinition.baseSyntax], syntaxDefinition);
569
+ }
570
+ var _c = syntaxDefinition.tag ? [true, Boolean((0, syntax_definitions_1.getXmlOptions)(syntaxDefinition.tag).wildcard)] : [false, false], tagNameEnabled = _c[0], tagNameWildcardEnabled = _c[1];
571
+ var idEnabled = Boolean(syntaxDefinition.ids);
572
+ var classNamesEnabled = Boolean(syntaxDefinition.classNames);
573
+ var namespaceEnabled = Boolean(syntaxDefinition.namespace);
574
+ var namespaceWildcardEnabled = syntaxDefinition.namespace && (syntaxDefinition.namespace === true || syntaxDefinition.namespace.wildcard === true);
575
+ if (namespaceEnabled && !tagNameEnabled) {
576
+ throw new Error("".concat(errorPrefix, "Namespaces cannot be enabled while tags are disabled."));
577
+ }
578
+ var substitutesEnabled = Boolean(substitutes);
579
+ var combinatorsIndex = syntaxDefinition.combinators ? (0, indexes_1.createMulticharIndex)(syntaxDefinition.combinators) : indexes_1.emptyMulticharIndex;
580
+ var _d = syntaxDefinition.attributes ? [
581
+ true,
582
+ syntaxDefinition.attributes.operators ? (0, indexes_1.createMulticharIndex)(syntaxDefinition.attributes.operators) : indexes_1.emptyMulticharIndex,
583
+ syntaxDefinition.attributes.caseSensitivityModifiers ? (0, indexes_1.createRegularIndex)(syntaxDefinition.attributes.caseSensitivityModifiers) : indexes_1.emptyRegularIndex,
584
+ syntaxDefinition.attributes.unknownCaseSensitivityModifiers === "accept"
585
+ ] : [false, indexes_1.emptyMulticharIndex, indexes_1.emptyRegularIndex, false], attributesEnabled = _d[0], attributesOperatorsIndex = _d[1], attributesCaseSensitivityModifiers = _d[2], attributesAcceptUnknownCaseSensitivityModifiers = _d[3];
586
+ var attributesCaseSensitivityModifiersEnabled = attributesAcceptUnknownCaseSensitivityModifiers || Object.keys(attributesCaseSensitivityModifiers).length > 0;
587
+ var _e = syntaxDefinition.pseudoClasses ? [
588
+ true,
589
+ syntaxDefinition.pseudoClasses.definitions ? (0, pseudo_class_signatures_1.calculatePseudoClassSignatures)(syntaxDefinition.pseudoClasses.definitions) : pseudo_class_signatures_1.emptyPseudoClassSignatures,
590
+ syntaxDefinition.pseudoClasses.unknown === "accept"
591
+ ] : [false, pseudo_class_signatures_1.emptyPseudoClassSignatures, false], pseudoClassesEnabled = _e[0], paeudoClassesDefinitions = _e[1], pseudoClassesAcceptUnknown = _e[2];
592
+ var _f = syntaxDefinition.pseudoElements ? [
593
+ true,
594
+ syntaxDefinition.pseudoElements.notation === "singleColon" || syntaxDefinition.pseudoElements.notation === "both",
595
+ !syntaxDefinition.pseudoElements.notation || syntaxDefinition.pseudoElements.notation === "doubleColon" || syntaxDefinition.pseudoElements.notation === "both",
596
+ syntaxDefinition.pseudoElements.definitions ? (0, indexes_1.createRegularIndex)(syntaxDefinition.pseudoElements.definitions) : indexes_1.emptyRegularIndex,
597
+ syntaxDefinition.pseudoElements.unknown === "accept"
598
+ ] : [false, false, false, indexes_1.emptyRegularIndex, false], pseudoElementsEnabled = _f[0], pseudoElementsSingleColonNotationEnabled = _f[1], pseudoElementsDoubleColonNotationEnabled = _f[2], pseudoElementsIndex = _f[3], pseudoElementsAcceptUnknown = _f[4];
599
+ var str = "";
158
600
  var l = str.length;
601
+ var pos = 0;
159
602
  var chr = "";
160
- function getStr(quote, escapeTable) {
161
- var result = "";
603
+ var is = function(comparison) {
604
+ return chr === comparison;
605
+ };
606
+ var isTagStart = function() {
607
+ return is("*") || (0, utils_1.isIdentStart)(chr) || is("\\");
608
+ };
609
+ var rewind = function(newPos) {
610
+ pos = newPos;
611
+ chr = str.charAt(pos);
612
+ };
613
+ var next = function() {
162
614
  pos++;
163
615
  chr = str.charAt(pos);
616
+ };
617
+ var readAndNext = function() {
618
+ var current = chr;
619
+ pos++;
620
+ chr = str.charAt(pos);
621
+ return current;
622
+ };
623
+ function fail(errorMessage) {
624
+ var position = Math.min(l - 1, pos);
625
+ var error = new Error("".concat(errorPrefix).concat(errorMessage, " Pos: ").concat(position, "."));
626
+ error.position = position;
627
+ error.name = "ParserError";
628
+ throw error;
629
+ }
630
+ function assert(condition, errorMessage) {
631
+ if (!condition) {
632
+ return fail(errorMessage);
633
+ }
634
+ }
635
+ var assertNonEof = function() {
636
+ assert(pos < l, "Unexpected end of input.");
637
+ };
638
+ var isEof = function() {
639
+ return pos >= l;
640
+ };
641
+ var pass = function(character) {
642
+ assert(pos < l, 'Expected "'.concat(character, '" but end of input reached.'));
643
+ assert(chr === character, 'Expected "'.concat(character, '" but "').concat(chr, '" found.'));
644
+ pos++;
645
+ chr = str.charAt(pos);
646
+ };
647
+ function matchMulticharIndex(index) {
648
+ var match = matchMulticharIndexPos(index, pos);
649
+ if (match) {
650
+ pos += match.length;
651
+ chr = str.charAt(pos);
652
+ return match;
653
+ }
654
+ }
655
+ function matchMulticharIndexPos(index, subPos) {
656
+ var char = str.charAt(subPos);
657
+ var charIndex = index[char];
658
+ if (charIndex) {
659
+ var subMatch = matchMulticharIndexPos(charIndex.chars, subPos + 1);
660
+ if (subMatch) {
661
+ return subMatch;
662
+ }
663
+ if (charIndex.self) {
664
+ return charIndex.self;
665
+ }
666
+ }
667
+ }
668
+ function parseHex() {
669
+ var hex = readAndNext();
670
+ while ((0, utils_1.isHex)(chr)) {
671
+ hex += readAndNext();
672
+ }
673
+ if (is(" ")) {
674
+ next();
675
+ }
676
+ return String.fromCharCode(parseInt(hex, 16));
677
+ }
678
+ function parseString(quote) {
679
+ var result = "";
680
+ pass(quote);
164
681
  while (pos < l) {
165
- if (chr === quote) {
166
- pos++;
682
+ if (is(quote)) {
683
+ next();
167
684
  return result;
168
- } else if (chr === "\\") {
169
- pos++;
170
- chr = str.charAt(pos);
685
+ } else if (is("\\")) {
686
+ next();
171
687
  var esc = void 0;
172
- if (chr === quote) {
688
+ if (is(quote)) {
173
689
  result += quote;
174
- } else if ((esc = escapeTable[chr]) !== void 0) {
690
+ } else if ((esc = utils_1.stringEscapeChars[chr]) !== void 0) {
175
691
  result += esc;
176
- } else if (utils_1.isHex(chr)) {
177
- var hex = chr;
178
- pos++;
179
- chr = str.charAt(pos);
180
- while (utils_1.isHex(chr)) {
181
- hex += chr;
182
- pos++;
183
- chr = str.charAt(pos);
184
- }
185
- if (chr === " ") {
186
- pos++;
187
- chr = str.charAt(pos);
188
- }
189
- result += String.fromCharCode(parseInt(hex, 16));
692
+ } else if ((0, utils_1.isHex)(chr)) {
693
+ result += parseHex();
190
694
  continue;
191
695
  } else {
192
696
  result += chr;
@@ -194,259 +698,442 @@ var require_parser_context = __commonJS({
194
698
  } else {
195
699
  result += chr;
196
700
  }
197
- pos++;
198
- chr = str.charAt(pos);
701
+ next();
199
702
  }
200
703
  return result;
201
704
  }
202
- function getIdent() {
705
+ function parseIdentifier() {
203
706
  var result = "";
204
- chr = str.charAt(pos);
205
707
  while (pos < l) {
206
- if (utils_1.isIdent(chr)) {
207
- result += chr;
208
- } else if (chr === "\\") {
209
- pos++;
210
- if (pos >= l) {
211
- throw Error("Expected symbol but end of file reached.");
212
- }
213
- chr = str.charAt(pos);
214
- if (utils_1.identSpecialChars[chr]) {
215
- result += chr;
216
- } else if (utils_1.isHex(chr)) {
217
- var hex = chr;
218
- pos++;
219
- chr = str.charAt(pos);
220
- while (utils_1.isHex(chr)) {
221
- hex += chr;
222
- pos++;
223
- chr = str.charAt(pos);
224
- }
225
- if (chr === " ") {
226
- pos++;
227
- chr = str.charAt(pos);
228
- }
229
- result += String.fromCharCode(parseInt(hex, 16));
230
- continue;
708
+ if ((0, utils_1.isIdent)(chr)) {
709
+ result += readAndNext();
710
+ } else if (is("\\")) {
711
+ next();
712
+ assertNonEof();
713
+ if ((0, utils_1.isHex)(chr)) {
714
+ result += parseHex();
231
715
  } else {
232
- result += chr;
716
+ result += readAndNext();
233
717
  }
234
718
  } else {
235
719
  return result;
236
720
  }
237
- pos++;
238
- chr = str.charAt(pos);
239
721
  }
240
722
  return result;
241
723
  }
724
+ function parsePseudoClassString() {
725
+ var result = "";
726
+ while (pos < l) {
727
+ if (is(")")) {
728
+ break;
729
+ } else if (is("\\")) {
730
+ next();
731
+ if (isEof() && !strict) {
732
+ return (result + "\\").trim();
733
+ }
734
+ assertNonEof();
735
+ if ((0, utils_1.isHex)(chr)) {
736
+ result += parseHex();
737
+ } else {
738
+ result += readAndNext();
739
+ }
740
+ } else {
741
+ result += readAndNext();
742
+ }
743
+ }
744
+ return result.trim();
745
+ }
242
746
  function skipWhitespace() {
243
- chr = str.charAt(pos);
244
- var result = false;
245
- while (chr === " " || chr === " " || chr === "\n" || chr === "\r" || chr === "\f") {
246
- result = true;
247
- pos++;
248
- chr = str.charAt(pos);
747
+ while (utils_1.whitespaceChars[chr]) {
748
+ next();
249
749
  }
250
- return result;
251
750
  }
252
- function parse() {
253
- var res = parseSelector();
254
- if (pos < l) {
255
- throw Error('Rule expected but "' + str.charAt(pos) + '" found.');
751
+ function parseSelector(relative) {
752
+ if (relative === void 0) {
753
+ relative = false;
754
+ }
755
+ skipWhitespace();
756
+ var rules = [parseRule(relative)];
757
+ while (is(",")) {
758
+ next();
759
+ skipWhitespace();
760
+ rules.push(parseRule(relative));
256
761
  }
257
- return res;
762
+ return {
763
+ type: "Selector",
764
+ rules
765
+ };
258
766
  }
259
- function parseSelector() {
260
- var selector = parseSingleSelector();
261
- if (!selector) {
262
- return null;
767
+ function parseAttribute() {
768
+ pass("[");
769
+ skipWhitespace();
770
+ var attr;
771
+ if (is("|")) {
772
+ assert(namespaceEnabled, "Namespaces are not enabled.");
773
+ next();
774
+ attr = {
775
+ type: "Attribute",
776
+ name: parseIdentifier(),
777
+ namespace: { type: "NoNamespace" }
778
+ };
779
+ } else if (is("*")) {
780
+ assert(namespaceEnabled, "Namespaces are not enabled.");
781
+ assert(namespaceWildcardEnabled, "Wildcard namespace is not enabled.");
782
+ next();
783
+ pass("|");
784
+ attr = {
785
+ type: "Attribute",
786
+ name: parseIdentifier(),
787
+ namespace: { type: "WildcardNamespace" }
788
+ };
789
+ } else {
790
+ var identifier = parseIdentifier();
791
+ attr = {
792
+ type: "Attribute",
793
+ name: identifier
794
+ };
795
+ if (is("|")) {
796
+ var savedPos = pos;
797
+ next();
798
+ if ((0, utils_1.isIdentStart)(chr) || is("\\")) {
799
+ assert(namespaceEnabled, "Namespaces are not enabled.");
800
+ attr = {
801
+ type: "Attribute",
802
+ name: parseIdentifier(),
803
+ namespace: { type: "NamespaceName", name: identifier }
804
+ };
805
+ } else {
806
+ rewind(savedPos);
807
+ }
808
+ }
263
809
  }
264
- var res = selector;
265
- chr = str.charAt(pos);
266
- while (chr === ",") {
267
- pos++;
810
+ assert(attr.name, "Expected attribute name.");
811
+ skipWhitespace();
812
+ if (isEof() && !strict) {
813
+ return attr;
814
+ }
815
+ if (is("]")) {
816
+ next();
817
+ } else {
818
+ attr.operator = matchMulticharIndex(attributesOperatorsIndex);
819
+ assert(attr.operator, "Expected a valid attribute selector operator.");
268
820
  skipWhitespace();
269
- if (res.type !== "selectors") {
270
- res = {
271
- type: "selectors",
272
- selectors: [selector]
821
+ assertNonEof();
822
+ if (utils_1.quoteChars[chr]) {
823
+ attr.value = {
824
+ type: "String",
825
+ value: parseString(chr)
826
+ };
827
+ } else if (substitutesEnabled && is("$")) {
828
+ next();
829
+ attr.value = {
830
+ type: "Substitution",
831
+ name: parseIdentifier()
832
+ };
833
+ assert(attr.value.name, "Expected substitute name.");
834
+ } else {
835
+ attr.value = {
836
+ type: "String",
837
+ value: parseIdentifier()
273
838
  };
839
+ assert(attr.value.value, "Expected attribute value.");
274
840
  }
275
- selector = parseSingleSelector();
276
- if (!selector) {
277
- throw Error('Rule expected after ",".');
841
+ skipWhitespace();
842
+ if (isEof() && !strict) {
843
+ return attr;
844
+ }
845
+ if (!is("]")) {
846
+ attr.caseSensitivityModifier = parseIdentifier();
847
+ assert(attr.caseSensitivityModifier, "Expected end of attribute selector.");
848
+ assert(attributesCaseSensitivityModifiersEnabled, "Attribute case sensitivity modifiers are not enabled.");
849
+ assert(attributesAcceptUnknownCaseSensitivityModifiers || attributesCaseSensitivityModifiers[attr.caseSensitivityModifier], "Unknown attribute case sensitivity modifier.");
850
+ skipWhitespace();
851
+ if (isEof() && !strict) {
852
+ return attr;
853
+ }
278
854
  }
279
- res.selectors.push(selector);
855
+ pass("]");
280
856
  }
281
- return res;
857
+ return attr;
282
858
  }
283
- function parseSingleSelector() {
859
+ function parseNumber(signed) {
860
+ var result = "";
861
+ if (signed && is("-")) {
862
+ result = readAndNext();
863
+ }
864
+ while (utils_1.digitsChars[chr]) {
865
+ result += readAndNext();
866
+ }
867
+ assert(result !== "" && result !== "-", "Formula parse error.");
868
+ return parseInt(result);
869
+ }
870
+ var isNumberStart = function() {
871
+ return is("-") || is("+") || utils_1.digitsChars[chr];
872
+ };
873
+ function parseFormula() {
874
+ var firstNumber = null;
875
+ if (isNumberStart()) {
876
+ if (is("+")) {
877
+ next();
878
+ assert(!is("-"), "Formula parse error.");
879
+ }
880
+ firstNumber = parseNumber(true);
881
+ if (!is("\\") && !is("n")) {
882
+ return [0, firstNumber];
883
+ }
884
+ }
885
+ if (firstNumber === null) {
886
+ firstNumber = 1;
887
+ }
888
+ var ident = parseIdentifier();
889
+ if (ident === "even") {
890
+ skipWhitespace();
891
+ return [2, 0];
892
+ }
893
+ if (ident === "odd") {
894
+ skipWhitespace();
895
+ return [2, 1];
896
+ }
897
+ assert(ident === "n", "Formula parse error");
284
898
  skipWhitespace();
285
- var selector = {
286
- type: "ruleSet"
899
+ if (is("+") || is("-")) {
900
+ var sign = is("+") ? 1 : -1;
901
+ next();
902
+ skipWhitespace();
903
+ return [firstNumber, sign * parseNumber(false)];
904
+ } else {
905
+ return [firstNumber, 0];
906
+ }
907
+ }
908
+ function parsePseudoClass(pseudoName) {
909
+ var pseudo = {
910
+ type: "PseudoClass",
911
+ name: pseudoName
287
912
  };
288
- var rule = parseRule();
289
- if (!rule) {
290
- return null;
291
- }
292
- var currentRule = selector;
293
- while (rule) {
294
- rule.type = "rule";
295
- currentRule.rule = rule;
296
- currentRule = rule;
913
+ var pseudoDefinition = paeudoClassesDefinitions[pseudoName];
914
+ if (!pseudoDefinition && pseudoClassesAcceptUnknown) {
915
+ pseudoDefinition = pseudo_class_signatures_1.defaultPseudoClassSignature;
916
+ }
917
+ assert(pseudoDefinition, 'Unknown pseudo-class: "'.concat(pseudoName, '".'));
918
+ pseudoDefinition = pseudoDefinition;
919
+ if (is("(")) {
920
+ next();
297
921
  skipWhitespace();
298
- chr = str.charAt(pos);
299
- if (pos >= l || chr === "," || chr === ")") {
300
- break;
301
- }
302
- if (ruleNestingOperators[chr]) {
303
- var op = chr;
304
- pos++;
305
- skipWhitespace();
306
- rule = parseRule();
307
- if (!rule) {
308
- throw Error('Rule expected after "' + op + '".');
922
+ if (substitutesEnabled && is("$")) {
923
+ next();
924
+ pseudo.argument = {
925
+ type: "Substitution",
926
+ name: parseIdentifier()
927
+ };
928
+ assert(pseudo.argument.name, "Expected substitute name.");
929
+ } else if (pseudoDefinition.type === "String") {
930
+ pseudo.argument = {
931
+ type: "String",
932
+ value: parsePseudoClassString()
933
+ };
934
+ assert(pseudo.argument.value, "Expected pseudo-class argument value.");
935
+ } else if (pseudoDefinition.type === "Selector") {
936
+ pseudo.argument = parseSelector(true);
937
+ } else if (pseudoDefinition.type === "Formula") {
938
+ var _a2 = parseFormula(), a = _a2[0], b = _a2[1];
939
+ pseudo.argument = {
940
+ type: "Formula",
941
+ a,
942
+ b
943
+ };
944
+ if (pseudoDefinition.ofSelector) {
945
+ skipWhitespace();
946
+ if (is("o") || is("\\")) {
947
+ var ident = parseIdentifier();
948
+ assert(ident === "of", "Formula of selector parse error.");
949
+ skipWhitespace();
950
+ pseudo.argument = {
951
+ type: "FormulaOfSelector",
952
+ a,
953
+ b,
954
+ selector: parseRule()
955
+ };
956
+ }
309
957
  }
310
- rule.nestingOperator = op;
311
958
  } else {
312
- rule = parseRule();
313
- if (rule) {
314
- rule.nestingOperator = null;
315
- }
959
+ return fail("Invalid pseudo-class signature.");
960
+ }
961
+ skipWhitespace();
962
+ if (isEof() && !strict) {
963
+ return pseudo;
316
964
  }
965
+ pass(")");
966
+ } else {
967
+ assert(pseudoDefinition.optional, 'Argument is required for pseudo-class "'.concat(pseudoName, '".'));
317
968
  }
318
- return selector;
969
+ return pseudo;
319
970
  }
320
- function parseRule() {
321
- var rule = null;
322
- while (pos < l) {
323
- chr = str.charAt(pos);
324
- if (chr === "*") {
325
- pos++;
326
- (rule = rule || {}).tagName = "*";
327
- } else if (utils_1.isIdentStart(chr) || chr === "\\") {
328
- (rule = rule || {}).tagName = getIdent();
329
- } else if (chr === ".") {
330
- pos++;
331
- rule = rule || {};
332
- (rule.classNames = rule.classNames || []).push(getIdent());
333
- } else if (chr === "#") {
334
- pos++;
335
- (rule = rule || {}).id = getIdent();
336
- } else if (chr === "[") {
337
- pos++;
338
- skipWhitespace();
339
- var attr = {
340
- name: getIdent()
971
+ function parseTagName() {
972
+ if (is("*")) {
973
+ assert(tagNameWildcardEnabled, "Wildcard tag name is not enabled.");
974
+ next();
975
+ return { type: "WildcardTag" };
976
+ } else if ((0, utils_1.isIdentStart)(chr) || is("\\")) {
977
+ assert(tagNameEnabled, "Tag names are not enabled.");
978
+ return {
979
+ type: "TagName",
980
+ name: parseIdentifier()
981
+ };
982
+ } else {
983
+ return fail("Expected tag name.");
984
+ }
985
+ }
986
+ function parseTagNameWithNamespace() {
987
+ if (is("*")) {
988
+ var savedPos = pos;
989
+ next();
990
+ if (!is("|")) {
991
+ rewind(savedPos);
992
+ return parseTagName();
993
+ }
994
+ next();
995
+ if (!isTagStart()) {
996
+ rewind(savedPos);
997
+ return parseTagName();
998
+ }
999
+ assert(namespaceEnabled, "Namespaces are not enabled.");
1000
+ assert(namespaceWildcardEnabled, "Wildcard namespace is not enabled.");
1001
+ var tagName = parseTagName();
1002
+ tagName.namespace = { type: "WildcardNamespace" };
1003
+ return tagName;
1004
+ } else if (is("|")) {
1005
+ assert(namespaceEnabled, "Namespaces are not enabled.");
1006
+ next();
1007
+ var tagName = parseTagName();
1008
+ tagName.namespace = { type: "NoNamespace" };
1009
+ return tagName;
1010
+ } else if ((0, utils_1.isIdentStart)(chr) || is("\\")) {
1011
+ var identifier = parseIdentifier();
1012
+ if (!is("|")) {
1013
+ assert(tagNameEnabled, "Tag names are not enabled.");
1014
+ return {
1015
+ type: "TagName",
1016
+ name: identifier
1017
+ };
1018
+ }
1019
+ var savedPos = pos;
1020
+ next();
1021
+ if (!isTagStart()) {
1022
+ rewind(savedPos);
1023
+ return {
1024
+ type: "TagName",
1025
+ name: identifier
341
1026
  };
1027
+ }
1028
+ assert(namespaceEnabled, "Namespaces are not enabled.");
1029
+ var tagName = parseTagName();
1030
+ tagName.namespace = { type: "NamespaceName", name: identifier };
1031
+ return tagName;
1032
+ } else {
1033
+ return fail("Expected tag name.");
1034
+ }
1035
+ }
1036
+ function parseRule(relative) {
1037
+ if (relative === void 0) {
1038
+ relative = false;
1039
+ }
1040
+ var rule = {};
1041
+ var isRuleStart = true;
1042
+ if (relative) {
1043
+ var combinator = matchMulticharIndex(combinatorsIndex);
1044
+ if (combinator) {
1045
+ rule.combinator = combinator;
342
1046
  skipWhitespace();
343
- if (chr === "]") {
344
- pos++;
1047
+ }
1048
+ }
1049
+ while (pos < l) {
1050
+ if (isTagStart()) {
1051
+ assert(isRuleStart, "Unexpected tag/namespace start.");
1052
+ rule.tag = parseTagNameWithNamespace();
1053
+ } else if (is("|")) {
1054
+ var savedPos = pos;
1055
+ next();
1056
+ if (isTagStart()) {
1057
+ assert(isRuleStart, "Unexpected tag/namespace start.");
1058
+ rewind(savedPos);
1059
+ rule.tag = parseTagNameWithNamespace();
345
1060
  } else {
346
- var operator = "";
347
- if (attrEqualityMods[chr]) {
348
- operator = chr;
349
- pos++;
350
- chr = str.charAt(pos);
351
- }
352
- if (pos >= l) {
353
- throw Error('Expected "=" but end of file reached.');
354
- }
355
- if (chr !== "=") {
356
- throw Error('Expected "=" but "' + chr + '" found.');
357
- }
358
- attr.operator = operator + "=";
359
- pos++;
360
- skipWhitespace();
361
- var attrValue = "";
362
- attr.valueType = "string";
363
- if (chr === '"') {
364
- attrValue = getStr('"', utils_1.doubleQuotesEscapeChars);
365
- } else if (chr === "'") {
366
- attrValue = getStr("'", utils_1.singleQuoteEscapeChars);
367
- } else if (substitutesEnabled && chr === "$") {
368
- pos++;
369
- attrValue = getIdent();
370
- attr.valueType = "substitute";
371
- } else {
372
- while (pos < l) {
373
- if (chr === "]") {
374
- break;
375
- }
376
- attrValue += chr;
377
- pos++;
378
- chr = str.charAt(pos);
379
- }
380
- attrValue = attrValue.trim();
381
- }
382
- skipWhitespace();
383
- if (pos >= l) {
384
- throw Error('Expected "]" but end of file reached.');
385
- }
386
- if (chr !== "]") {
387
- throw Error('Expected "]" but "' + chr + '" found.');
388
- }
389
- pos++;
390
- attr.value = attrValue;
1061
+ rewind(savedPos);
1062
+ break;
391
1063
  }
392
- rule = rule || {};
393
- (rule.attrs = rule.attrs || []).push(attr);
394
- } else if (chr === ":") {
395
- pos++;
396
- var pseudoName = getIdent();
397
- var pseudo = {
398
- name: pseudoName
399
- };
400
- if (chr === "(") {
401
- pos++;
402
- var value = "";
403
- skipWhitespace();
404
- if (pseudos[pseudoName] === "selector") {
405
- pseudo.valueType = "selector";
406
- value = parseSelector();
407
- } else {
408
- pseudo.valueType = pseudos[pseudoName] || "string";
409
- if (chr === '"') {
410
- value = getStr('"', utils_1.doubleQuotesEscapeChars);
411
- } else if (chr === "'") {
412
- value = getStr("'", utils_1.singleQuoteEscapeChars);
413
- } else if (substitutesEnabled && chr === "$") {
414
- pos++;
415
- value = getIdent();
416
- pseudo.valueType = "substitute";
417
- } else {
418
- while (pos < l) {
419
- if (chr === ")") {
420
- break;
421
- }
422
- value += chr;
423
- pos++;
424
- chr = str.charAt(pos);
425
- }
426
- value = value.trim();
427
- }
428
- skipWhitespace();
429
- }
430
- if (pos >= l) {
431
- throw Error('Expected ")" but end of file reached.');
432
- }
433
- if (chr !== ")") {
434
- throw Error('Expected ")" but "' + chr + '" found.');
1064
+ } else if (is(".")) {
1065
+ assert(classNamesEnabled, "Class names are not enabled.");
1066
+ next();
1067
+ var className = parseIdentifier();
1068
+ assert(className, "Expected class name.");
1069
+ (rule.classNames = rule.classNames || []).push(className);
1070
+ } else if (is("#")) {
1071
+ assert(idEnabled, "IDs are not enabled.");
1072
+ next();
1073
+ var idName = parseIdentifier();
1074
+ assert(idName, "Expected ID name.");
1075
+ (rule.ids = rule.ids || []).push(idName);
1076
+ } else if (is("[")) {
1077
+ assert(attributesEnabled, "Attributes are not enabled.");
1078
+ (rule.attributes = rule.attributes || []).push(parseAttribute());
1079
+ } else if (is(":")) {
1080
+ var isDoubleColon = false;
1081
+ var isPseudoElement = false;
1082
+ next();
1083
+ if (is(":")) {
1084
+ assert(pseudoElementsEnabled, "Pseudo elements are not enabled.");
1085
+ assert(pseudoElementsDoubleColonNotationEnabled, "Pseudo elements double colon notation is not enabled.");
1086
+ isDoubleColon = true;
1087
+ next();
1088
+ }
1089
+ var pseudoName = parseIdentifier();
1090
+ assert(isDoubleColon || pseudoName, "Expected pseudo-class name.");
1091
+ assert(!isDoubleColon || pseudoName, "Expected pseudo-element name.");
1092
+ assert(!isDoubleColon || pseudoElementsAcceptUnknown || pseudoElementsIndex[pseudoName], 'Unknown pseudo-element "'.concat(pseudoName, '".'));
1093
+ isPseudoElement = pseudoElementsEnabled && (isDoubleColon || !isDoubleColon && pseudoElementsSingleColonNotationEnabled && pseudoElementsIndex[pseudoName]);
1094
+ if (isPseudoElement) {
1095
+ rule.pseudoElement = pseudoName;
1096
+ if (!utils_1.whitespaceChars[chr] && !is(",") && !is(")") && !isEof()) {
1097
+ return fail("Pseudo-element should be the last component of a CSS selector rule.");
435
1098
  }
436
- pos++;
437
- pseudo.value = value;
1099
+ } else {
1100
+ assert(pseudoClassesEnabled, "Pseudo classes are not enabled.");
1101
+ (rule.pseudoClasses = rule.pseudoClasses || []).push(parsePseudoClass(pseudoName));
438
1102
  }
439
- rule = rule || {};
440
- (rule.pseudos = rule.pseudos || []).push(pseudo);
441
1103
  } else {
442
1104
  break;
443
1105
  }
1106
+ isRuleStart = false;
1107
+ }
1108
+ if (isRuleStart) {
1109
+ if (isEof()) {
1110
+ return fail("Expected rule but end of input reached.");
1111
+ } else {
1112
+ return fail('Expected rule but "'.concat(chr, '" found.'));
1113
+ }
1114
+ }
1115
+ rule.type = "Rule";
1116
+ skipWhitespace();
1117
+ if (!isEof() && !is(",") && !is(")")) {
1118
+ var combinator = matchMulticharIndex(combinatorsIndex);
1119
+ skipWhitespace();
1120
+ rule.nestedRule = parseRule();
1121
+ rule.nestedRule.combinator = combinator;
444
1122
  }
445
1123
  return rule;
446
1124
  }
447
- return parse();
1125
+ return function(input) {
1126
+ if (typeof input !== "string") {
1127
+ throw new Error("".concat(errorPrefix, "Expected string input."));
1128
+ }
1129
+ str = input;
1130
+ l = str.length;
1131
+ pos = 0;
1132
+ chr = str.charAt(0);
1133
+ return parseSelector();
1134
+ };
448
1135
  }
449
- exports.parseCssSelector = parseCssSelector;
1136
+ exports.createParser = createParser2;
450
1137
  }
451
1138
  });
452
1139
 
@@ -455,78 +1142,159 @@ var require_render = __commonJS({
455
1142
  "node_modules/css-selector-parser/lib/render.js"(exports) {
456
1143
  "use strict";
457
1144
  Object.defineProperty(exports, "__esModule", { value: true });
1145
+ exports.render = void 0;
458
1146
  var utils_1 = require_utils();
459
- function renderEntity(entity) {
460
- var res = "";
461
- switch (entity.type) {
462
- case "ruleSet":
463
- var currentEntity = entity.rule;
464
- var parts = [];
465
- while (currentEntity) {
466
- if (currentEntity.nestingOperator) {
467
- parts.push(currentEntity.nestingOperator);
468
- }
469
- parts.push(renderEntity(currentEntity));
470
- currentEntity = currentEntity.rule;
471
- }
472
- res = parts.join(" ");
473
- break;
474
- case "selectors":
475
- res = entity.selectors.map(renderEntity).join(", ");
476
- break;
477
- case "rule":
478
- if (entity.tagName) {
479
- if (entity.tagName === "*") {
480
- res = "*";
481
- } else {
482
- res = utils_1.escapeIdentifier(entity.tagName);
483
- }
1147
+ function renderNamespace(namespace) {
1148
+ if (namespace.type === "WildcardNamespace") {
1149
+ return "*|";
1150
+ } else if (namespace.type === "NamespaceName") {
1151
+ return "".concat((0, utils_1.escapeIdentifier)(namespace.name), "|");
1152
+ } else if (namespace.type === "NoNamespace") {
1153
+ return "|";
1154
+ }
1155
+ throw new Error("Unknown namespace type: ".concat(namespace.type, "."));
1156
+ }
1157
+ function renderSubstitution(sub) {
1158
+ return "$".concat((0, utils_1.escapeIdentifier)(sub.name));
1159
+ }
1160
+ function renderFormula(a, b) {
1161
+ if (a) {
1162
+ var result = "".concat(a === 1 ? "" : a, "n");
1163
+ if (b) {
1164
+ result += "".concat(b > 0 ? "+" : "").concat(b);
1165
+ }
1166
+ return result;
1167
+ } else {
1168
+ return String(b);
1169
+ }
1170
+ }
1171
+ function render(entity) {
1172
+ if (entity.type === "Selector") {
1173
+ return entity.rules.map(render).join(", ");
1174
+ }
1175
+ if (entity.type === "Rule") {
1176
+ var result = "";
1177
+ var tag = entity.tag, ids = entity.ids, classNames = entity.classNames, attributes = entity.attributes, pseudoClasses = entity.pseudoClasses, pseudoElement = entity.pseudoElement, nestedRule = entity.nestedRule;
1178
+ if (tag) {
1179
+ var namespace = tag.namespace;
1180
+ if (namespace) {
1181
+ result += renderNamespace(namespace);
484
1182
  }
485
- if (entity.id) {
486
- res += "#" + utils_1.escapeIdentifier(entity.id);
1183
+ if (tag.type === "TagName") {
1184
+ result += (0, utils_1.escapeIdentifier)(tag.name);
1185
+ } else if (tag.type === "WildcardTag") {
1186
+ result += "*";
1187
+ } else {
1188
+ throw new Error("Unknown tagName type: ".concat(tag.type, "."));
487
1189
  }
488
- if (entity.classNames) {
489
- res += entity.classNames.map(function(cn) {
490
- return "." + utils_1.escapeIdentifier(cn);
491
- }).join("");
1190
+ }
1191
+ if (ids) {
1192
+ for (var _i = 0, ids_1 = ids; _i < ids_1.length; _i++) {
1193
+ var id = ids_1[_i];
1194
+ result += "#".concat((0, utils_1.escapeIdentifier)(id));
492
1195
  }
493
- if (entity.attrs) {
494
- res += entity.attrs.map(function(attr) {
495
- if ("operator" in attr) {
496
- if (attr.valueType === "substitute") {
497
- return "[" + utils_1.escapeIdentifier(attr.name) + attr.operator + "$" + attr.value + "]";
498
- } else {
499
- return "[" + utils_1.escapeIdentifier(attr.name) + attr.operator + utils_1.escapeStr(attr.value) + "]";
500
- }
1196
+ }
1197
+ if (classNames) {
1198
+ for (var _a = 0, classNames_1 = classNames; _a < classNames_1.length; _a++) {
1199
+ var className = classNames_1[_a];
1200
+ result += ".".concat((0, utils_1.escapeIdentifier)(className));
1201
+ }
1202
+ }
1203
+ if (attributes) {
1204
+ for (var _b = 0, attributes_1 = attributes; _b < attributes_1.length; _b++) {
1205
+ var _c = attributes_1[_b], name_1 = _c.name, namespace = _c.namespace, operator = _c.operator, value = _c.value, caseSensitivityModifier = _c.caseSensitivityModifier;
1206
+ result += "[";
1207
+ if (namespace) {
1208
+ result += renderNamespace(namespace);
1209
+ }
1210
+ result += (0, utils_1.escapeIdentifier)(name_1);
1211
+ if (operator && value) {
1212
+ result += operator;
1213
+ if (value.type === "String") {
1214
+ result += (0, utils_1.escapeStr)(value.value);
1215
+ } else if (value.type === "Substitution") {
1216
+ result += renderSubstitution(value);
501
1217
  } else {
502
- return "[" + utils_1.escapeIdentifier(attr.name) + "]";
1218
+ throw new Error("Unknown attribute value type: ".concat(value.type, "."));
503
1219
  }
504
- }).join("");
505
- }
506
- if (entity.pseudos) {
507
- res += entity.pseudos.map(function(pseudo) {
508
- if (pseudo.valueType) {
509
- if (pseudo.valueType === "selector") {
510
- return ":" + utils_1.escapeIdentifier(pseudo.name) + "(" + renderEntity(pseudo.value) + ")";
511
- } else if (pseudo.valueType === "substitute") {
512
- return ":" + utils_1.escapeIdentifier(pseudo.name) + "($" + pseudo.value + ")";
513
- } else if (pseudo.valueType === "numeric") {
514
- return ":" + utils_1.escapeIdentifier(pseudo.name) + "(" + pseudo.value + ")";
515
- } else {
516
- return ":" + utils_1.escapeIdentifier(pseudo.name) + "(" + utils_1.escapeIdentifier(pseudo.value) + ")";
517
- }
1220
+ if (caseSensitivityModifier) {
1221
+ result += " ".concat((0, utils_1.escapeIdentifier)(caseSensitivityModifier));
1222
+ }
1223
+ }
1224
+ result += "]";
1225
+ }
1226
+ }
1227
+ if (pseudoClasses) {
1228
+ for (var _d = 0, pseudoClasses_1 = pseudoClasses; _d < pseudoClasses_1.length; _d++) {
1229
+ var _e = pseudoClasses_1[_d], name_2 = _e.name, argument = _e.argument;
1230
+ result += ":".concat((0, utils_1.escapeIdentifier)(name_2));
1231
+ if (argument) {
1232
+ result += "(";
1233
+ if (argument.type === "Selector") {
1234
+ result += render(argument);
1235
+ } else if (argument.type === "String") {
1236
+ result += (0, utils_1.escapePseudoClassString)(argument.value);
1237
+ } else if (argument.type === "Formula") {
1238
+ result += renderFormula(argument.a, argument.b);
1239
+ } else if (argument.type === "FormulaOfSelector") {
1240
+ result += renderFormula(argument.a, argument.b);
1241
+ result += " of ";
1242
+ result += render(argument.selector);
1243
+ } else if (argument.type === "Substitution") {
1244
+ result += renderSubstitution(argument);
518
1245
  } else {
519
- return ":" + utils_1.escapeIdentifier(pseudo.name);
1246
+ throw new Error("Unknown pseudo-class argument type: ".concat(argument.type, "."));
520
1247
  }
521
- }).join("");
1248
+ result += ")";
1249
+ }
522
1250
  }
523
- break;
524
- default:
525
- throw Error('Unknown entity type: "' + entity.type + '".');
1251
+ }
1252
+ if (pseudoElement) {
1253
+ result += "::".concat((0, utils_1.escapeIdentifier)(pseudoElement));
1254
+ }
1255
+ if (nestedRule) {
1256
+ if (nestedRule.combinator) {
1257
+ result += " ".concat(nestedRule.combinator);
1258
+ }
1259
+ result += " ".concat(render(nestedRule));
1260
+ }
1261
+ return result;
526
1262
  }
527
- return res;
1263
+ throw new Error("Render method accepts only Selector, Rule and RuleList.");
1264
+ }
1265
+ exports.render = render;
1266
+ }
1267
+ });
1268
+
1269
+ // node_modules/css-selector-parser/lib/ast.js
1270
+ var require_ast = __commonJS({
1271
+ "node_modules/css-selector-parser/lib/ast.js"(exports) {
1272
+ "use strict";
1273
+ var __assign = exports && exports.__assign || function() {
1274
+ __assign = Object.assign || function(t) {
1275
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
1276
+ s = arguments[i];
1277
+ for (var p in s)
1278
+ if (Object.prototype.hasOwnProperty.call(s, p))
1279
+ t[p] = s[p];
1280
+ }
1281
+ return t;
1282
+ };
1283
+ return __assign.apply(this, arguments);
1284
+ };
1285
+ Object.defineProperty(exports, "__esModule", { value: true });
1286
+ exports.ast = void 0;
1287
+ function astMethods(type) {
1288
+ return function(generatorName, checkerName) {
1289
+ var _a;
1290
+ return _a = {}, _a[generatorName] = function(props) {
1291
+ return __assign({ type }, props);
1292
+ }, _a[checkerName] = function(entity) {
1293
+ return typeof entity === "object" && entity !== null && entity.type === type;
1294
+ }, _a;
1295
+ };
528
1296
  }
529
- exports.renderEntity = renderEntity;
1297
+ exports.ast = __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, astMethods("Selector")("selector", "isSelector")), astMethods("Rule")("rule", "isRule")), astMethods("TagName")("tagName", "isTagName")), astMethods("WildcardTag")("wildcardTag", "isWildcardTag")), astMethods("NamespaceName")("namespaceName", "isNamespaceName")), astMethods("WildcardNamespace")("wildcardNamespace", "isWildcardNamespace")), astMethods("NoNamespace")("noNamespace", "isNoNamespace")), astMethods("Attribute")("attribute", "isAttribute")), astMethods("PseudoClass")("pseudoClass", "isPseudoClass")), astMethods("String")("string", "isString")), astMethods("Formula")("formula", "isFormula")), astMethods("FormulaOfSelector")("formulaOfSelector", "isFormulaOfSelector")), astMethods("Substitution")("substitution", "isSubstitution"));
530
1298
  }
531
1299
  });
532
1300
 
@@ -535,120 +1303,52 @@ var require_lib = __commonJS({
535
1303
  "node_modules/css-selector-parser/lib/index.js"(exports) {
536
1304
  "use strict";
537
1305
  Object.defineProperty(exports, "__esModule", { value: true });
538
- var parser_context_1 = require_parser_context();
1306
+ exports.ast = exports.render = exports.createParser = void 0;
1307
+ var parser_1 = require_parser();
1308
+ Object.defineProperty(exports, "createParser", { enumerable: true, get: function() {
1309
+ return parser_1.createParser;
1310
+ } });
539
1311
  var render_1 = require_render();
540
- var CssSelectorParser2 = function() {
541
- function CssSelectorParser3() {
542
- this.pseudos = {};
543
- this.attrEqualityMods = {};
544
- this.ruleNestingOperators = {};
545
- this.substitutesEnabled = false;
546
- }
547
- CssSelectorParser3.prototype.registerSelectorPseudos = function() {
548
- var pseudos = [];
549
- for (var _i = 0; _i < arguments.length; _i++) {
550
- pseudos[_i] = arguments[_i];
551
- }
552
- for (var _a = 0, pseudos_1 = pseudos; _a < pseudos_1.length; _a++) {
553
- var pseudo = pseudos_1[_a];
554
- this.pseudos[pseudo] = "selector";
555
- }
556
- return this;
557
- };
558
- CssSelectorParser3.prototype.unregisterSelectorPseudos = function() {
559
- var pseudos = [];
560
- for (var _i = 0; _i < arguments.length; _i++) {
561
- pseudos[_i] = arguments[_i];
562
- }
563
- for (var _a = 0, pseudos_2 = pseudos; _a < pseudos_2.length; _a++) {
564
- var pseudo = pseudos_2[_a];
565
- delete this.pseudos[pseudo];
566
- }
567
- return this;
568
- };
569
- CssSelectorParser3.prototype.registerNumericPseudos = function() {
570
- var pseudos = [];
571
- for (var _i = 0; _i < arguments.length; _i++) {
572
- pseudos[_i] = arguments[_i];
573
- }
574
- for (var _a = 0, pseudos_3 = pseudos; _a < pseudos_3.length; _a++) {
575
- var pseudo = pseudos_3[_a];
576
- this.pseudos[pseudo] = "numeric";
577
- }
578
- return this;
579
- };
580
- CssSelectorParser3.prototype.unregisterNumericPseudos = function() {
581
- var pseudos = [];
582
- for (var _i = 0; _i < arguments.length; _i++) {
583
- pseudos[_i] = arguments[_i];
584
- }
585
- for (var _a = 0, pseudos_4 = pseudos; _a < pseudos_4.length; _a++) {
586
- var pseudo = pseudos_4[_a];
587
- delete this.pseudos[pseudo];
588
- }
589
- return this;
590
- };
591
- CssSelectorParser3.prototype.registerNestingOperators = function() {
592
- var operators = [];
593
- for (var _i = 0; _i < arguments.length; _i++) {
594
- operators[_i] = arguments[_i];
595
- }
596
- for (var _a = 0, operators_1 = operators; _a < operators_1.length; _a++) {
597
- var operator = operators_1[_a];
598
- this.ruleNestingOperators[operator] = true;
599
- }
600
- return this;
601
- };
602
- CssSelectorParser3.prototype.unregisterNestingOperators = function() {
603
- var operators = [];
604
- for (var _i = 0; _i < arguments.length; _i++) {
605
- operators[_i] = arguments[_i];
606
- }
607
- for (var _a = 0, operators_2 = operators; _a < operators_2.length; _a++) {
608
- var operator = operators_2[_a];
609
- delete this.ruleNestingOperators[operator];
610
- }
611
- return this;
612
- };
613
- CssSelectorParser3.prototype.registerAttrEqualityMods = function() {
614
- var mods = [];
615
- for (var _i = 0; _i < arguments.length; _i++) {
616
- mods[_i] = arguments[_i];
617
- }
618
- for (var _a = 0, mods_1 = mods; _a < mods_1.length; _a++) {
619
- var mod = mods_1[_a];
620
- this.attrEqualityMods[mod] = true;
621
- }
622
- return this;
623
- };
624
- CssSelectorParser3.prototype.unregisterAttrEqualityMods = function() {
625
- var mods = [];
626
- for (var _i = 0; _i < arguments.length; _i++) {
627
- mods[_i] = arguments[_i];
628
- }
629
- for (var _a = 0, mods_2 = mods; _a < mods_2.length; _a++) {
630
- var mod = mods_2[_a];
631
- delete this.attrEqualityMods[mod];
632
- }
633
- return this;
634
- };
635
- CssSelectorParser3.prototype.enableSubstitutes = function() {
636
- this.substitutesEnabled = true;
637
- return this;
638
- };
639
- CssSelectorParser3.prototype.disableSubstitutes = function() {
640
- this.substitutesEnabled = false;
641
- return this;
642
- };
643
- CssSelectorParser3.prototype.parse = function(str) {
644
- return parser_context_1.parseCssSelector(str, 0, this.pseudos, this.attrEqualityMods, this.ruleNestingOperators, this.substitutesEnabled);
645
- };
646
- CssSelectorParser3.prototype.render = function(path) {
647
- return render_1.renderEntity(path).trim();
648
- };
649
- return CssSelectorParser3;
650
- }();
651
- exports.CssSelectorParser = CssSelectorParser2;
1312
+ Object.defineProperty(exports, "render", { enumerable: true, get: function() {
1313
+ return render_1.render;
1314
+ } });
1315
+ var ast_1 = require_ast();
1316
+ Object.defineProperty(exports, "ast", { enumerable: true, get: function() {
1317
+ return ast_1.ast;
1318
+ } });
1319
+ }
1320
+ });
1321
+
1322
+ // node_modules/throw-expression/index.js
1323
+ var require_throw_expression = __commonJS({
1324
+ "node_modules/throw-expression/index.js"(exports) {
1325
+ "use strict";
1326
+ Object.defineProperty(exports, "__esModule", { value: true });
1327
+ exports.throwIfFalsy = exports.throwIfUndefined = exports.throwIfNull = exports.Throw = void 0;
1328
+ exports.Throw = function(error) {
1329
+ if (typeof error === "string") {
1330
+ throw new Error(error);
1331
+ }
1332
+ throw error;
1333
+ };
1334
+ exports.throwIfNull = function(value, error) {
1335
+ if (error === void 0) {
1336
+ error = "value is null";
1337
+ }
1338
+ return value === null ? exports.Throw(error) : value;
1339
+ };
1340
+ exports.throwIfUndefined = function(value, error) {
1341
+ if (error === void 0) {
1342
+ error = "value is undefined";
1343
+ }
1344
+ return value === void 0 ? exports.Throw(error) : value;
1345
+ };
1346
+ exports.throwIfFalsy = function(value, error) {
1347
+ if (error === void 0) {
1348
+ error = "value is undefined";
1349
+ }
1350
+ return value === void 0 || value === null ? exports.Throw(error) : value;
1351
+ };
652
1352
  }
653
1353
  });
654
1354
 
@@ -659,34 +1359,48 @@ __export(main_exports, {
659
1359
  });
660
1360
  module.exports = __toCommonJS(main_exports);
661
1361
  var import_css_selector_parser = __toESM(require_lib());
662
- var parser = new import_css_selector_parser.CssSelectorParser();
663
- parser.registerAttrEqualityMods("^", "$", "*", "~", "|");
664
- var queryAll = (root, selector) => {
665
- if (typeof sap === "undefined") {
666
- return [];
1362
+ var import_throw_expression = __toESM(require_throw_expression());
1363
+ var parse = (0, import_css_selector_parser.createParser)({
1364
+ syntax: {
1365
+ combinators: [],
1366
+ namespace: false,
1367
+ attributes: { operators: ["=", "^=", "$=", "*=", "~=", "|="] },
1368
+ pseudoElements: false,
1369
+ tag: { wildcard: true },
1370
+ ids: true,
1371
+ classNames: true
667
1372
  }
668
- const parsedSelector = parser.parse(selector);
1373
+ });
1374
+ var queryAll = (root, selector) => {
1375
+ var _a;
1376
+ const parsedSelector = parse(selector);
669
1377
  if (selector === "") {
670
1378
  throw new Error("ui5 selector is empty");
671
1379
  }
672
- if (parsedSelector.type === "selectors") {
1380
+ if (parsedSelector.rules.length > 1) {
673
1381
  throw new Error("comma-separated selectors not supported");
674
1382
  }
675
- const { rule } = parsedSelector;
676
- if (rule.tagName && rule.classNames) {
1383
+ if (typeof sap === "undefined") {
1384
+ return [];
1385
+ }
1386
+ const rule = (0, import_throw_expression.throwIfUndefined)(parsedSelector.rules[0], "rules array was empty");
1387
+ if (((_a = rule.tag) == null ? void 0 : _a.type) === "TagName" && rule.classNames) {
677
1388
  const sapNamespace = "sap";
678
- if (rule.tagName !== sapNamespace) {
679
- rule.tagName = `${sapNamespace}.${rule.tagName}`;
1389
+ if (rule.tag.name !== sapNamespace) {
1390
+ rule.tag.name = `${sapNamespace}.${rule.tag.name}`;
680
1391
  }
681
- rule.tagName = [rule.tagName, ...rule.classNames].join(".");
1392
+ rule.tag.name = [rule.tag.name, ...rule.classNames].join(".");
682
1393
  delete rule.classNames;
683
1394
  }
684
1395
  const controls = sap.ui.core.Element.registry.filter((element) => {
685
- var _a;
686
- if (![element.getMetadata().getName(), "*", void 0].includes(rule.tagName) || rule.id && element.getId() !== rule.id) {
1396
+ var _a2, _b;
1397
+ if (rule.ids && rule.ids.length > 1) {
1398
+ throw new Error("multiple ids are not supported");
1399
+ }
1400
+ if (((_a2 = rule.tag) == null ? void 0 : _a2.type) === "TagName" && rule.tag.name !== element.getMetadata().getName() || rule.ids && rule.ids[0] !== element.getId()) {
687
1401
  return false;
688
1402
  }
689
- return ((_a = rule.attrs) != null ? _a : []).every((attr) => {
1403
+ return ((_b = rule.attributes) != null ? _b : []).every((attr) => {
690
1404
  let actualValue;
691
1405
  try {
692
1406
  actualValue = String(element.getProperty(attr.name));
@@ -696,14 +1410,18 @@ var queryAll = (root, selector) => {
696
1410
  if (!("value" in attr)) {
697
1411
  return true;
698
1412
  }
1413
+ const expectedValue = attr.value.value;
699
1414
  return {
700
- "=": actualValue === attr.value,
701
- "^=": actualValue.startsWith(attr.value),
702
- "$=": actualValue.endsWith(attr.value),
703
- "*=": actualValue.includes(attr.value),
704
- "~=": actualValue.split(/\s+/u).includes(attr.value),
705
- "|=": actualValue.split("-")[0] === attr.value
706
- }[attr.operator];
1415
+ "=": actualValue === expectedValue,
1416
+ "^=": actualValue.startsWith(expectedValue),
1417
+ "$=": actualValue.endsWith(expectedValue),
1418
+ "*=": actualValue.includes(expectedValue),
1419
+ "~=": actualValue.split(/\s+/u).includes(expectedValue),
1420
+ "|=": actualValue.split("-")[0] === expectedValue
1421
+ }[(0, import_throw_expression.throwIfUndefined)(
1422
+ attr.operator,
1423
+ "attribute operator was undefined when value was set (this should NEVER happen)"
1424
+ )];
707
1425
  });
708
1426
  });
709
1427
  return controls.map((control) => control.getDomRef()).filter(