@alexwkleung/reika 0.9.0 → 0.11.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.
Files changed (157) hide show
  1. package/dist/THIRD_PARTY_LICENSES.txt +1271 -0
  2. package/dist/chunk-AX767B3T.js +22724 -0
  3. package/dist/chunk-JVOYWUGK.js +279 -0
  4. package/dist/chunk-KI5CTLSX.js +59 -0
  5. package/dist/chunk-SBBXMTSX.js +4050 -0
  6. package/dist/cli.js +153 -53
  7. package/dist/devtools-FYXXYYMR.js +2 -0
  8. package/dist/esm-SND35LIM.js +8494 -0
  9. package/dist/headless-Y2V6WPLB.js +592 -0
  10. package/dist/node-7FRVMBZF.js +69479 -0
  11. package/dist/tui-KWAD5BDE.js +34366 -0
  12. package/package.json +16 -17
  13. package/dist/agent/attachments.js +0 -63
  14. package/dist/agent/bashread.js +0 -177
  15. package/dist/agent/compaction.js +0 -922
  16. package/dist/agent/compactionreport.js +0 -248
  17. package/dist/agent/continuation.js +0 -153
  18. package/dist/agent/decoderate.js +0 -132
  19. package/dist/agent/entropytrace.js +0 -169
  20. package/dist/agent/genreserve.js +0 -75
  21. package/dist/agent/groundcheck.js +0 -195
  22. package/dist/agent/logitrecovery.js +0 -171
  23. package/dist/agent/loop.js +0 -3676
  24. package/dist/agent/mentions.js +0 -118
  25. package/dist/agent/noteslotmonitor.js +0 -82
  26. package/dist/agent/pastedurls.js +0 -203
  27. package/dist/agent/planpressure.js +0 -87
  28. package/dist/agent/plantrack.js +0 -503
  29. package/dist/agent/prefillcost.js +0 -95
  30. package/dist/agent/prefixtrace.js +0 -90
  31. package/dist/agent/prompt.js +0 -349
  32. package/dist/agent/readfirst.js +0 -190
  33. package/dist/agent/readtrace.js +0 -191
  34. package/dist/agent/reasoningtrace.js +0 -242
  35. package/dist/agent/shellruns.js +0 -81
  36. package/dist/agent/subagentpressure.js +0 -70
  37. package/dist/agent/subagentreport.js +0 -117
  38. package/dist/agent/warm.js +0 -163
  39. package/dist/approval.js +0 -59
  40. package/dist/check/typecheck.js +0 -345
  41. package/dist/config.js +0 -509
  42. package/dist/context/bootstrap.js +0 -122
  43. package/dist/context/bundlesize.js +0 -74
  44. package/dist/context/files.js +0 -67
  45. package/dist/context/gitignore.js +0 -102
  46. package/dist/context/repomap.js +0 -304
  47. package/dist/debug.js +0 -197
  48. package/dist/headless/headless.js +0 -440
  49. package/dist/headless/headlessargs.js +0 -108
  50. package/dist/headless/headlessprompt.js +0 -132
  51. package/dist/laststate.js +0 -71
  52. package/dist/limit.js +0 -27
  53. package/dist/mcp/client.js +0 -630
  54. package/dist/mcp/config.js +0 -187
  55. package/dist/mcp/manager.js +0 -158
  56. package/dist/mcp/tools.js +0 -323
  57. package/dist/ocr/select.js +0 -29
  58. package/dist/ocr/system.js +0 -162
  59. package/dist/ocr/types.js +0 -1
  60. package/dist/ocr/vision.js +0 -139
  61. package/dist/provider/budget.js +0 -56
  62. package/dist/provider/cachehints.js +0 -30
  63. package/dist/provider/client.js +0 -573
  64. package/dist/provider/contextwindow.js +0 -78
  65. package/dist/provider/dispatcher.js +0 -126
  66. package/dist/provider/latches.js +0 -31
  67. package/dist/provider/modellimits.js +0 -186
  68. package/dist/provider/noteslot.js +0 -239
  69. package/dist/provider/templatekwargs.js +0 -31
  70. package/dist/provider/tokens.js +0 -32
  71. package/dist/provider/toolcall.js +0 -1088
  72. package/dist/provider/transport.js +0 -264
  73. package/dist/search/_chrome.js +0 -422
  74. package/dist/search/cdp.js +0 -223
  75. package/dist/search/searxng.js +0 -86
  76. package/dist/search/types.js +0 -17
  77. package/dist/session.js +0 -411
  78. package/dist/skills/skillmatch.js +0 -143
  79. package/dist/skills/skills.js +0 -349
  80. package/dist/store/payloads.js +0 -21
  81. package/dist/store/sessions.js +0 -180
  82. package/dist/store/transcript.js +0 -390
  83. package/dist/tools/_carriers.js +0 -119
  84. package/dist/tools/_danger.js +0 -1848
  85. package/dist/tools/_deps.js +0 -203
  86. package/dist/tools/_diff.js +0 -64
  87. package/dist/tools/_exfil.js +0 -168
  88. package/dist/tools/_heredoc.js +0 -419
  89. package/dist/tools/_hosts.js +0 -224
  90. package/dist/tools/_markdown.js +0 -288
  91. package/dist/tools/_net.js +0 -65
  92. package/dist/tools/_paths.js +0 -171
  93. package/dist/tools/_readonly.js +0 -545
  94. package/dist/tools/_sandbox.js +0 -953
  95. package/dist/tools/_spill.js +0 -216
  96. package/dist/tools/_spillstats.js +0 -45
  97. package/dist/tools/_treediff.js +0 -350
  98. package/dist/tools/_urls.js +0 -335
  99. package/dist/tools/_walk.js +0 -24
  100. package/dist/tools/_writetargets.js +0 -96
  101. package/dist/tools/ask.js +0 -194
  102. package/dist/tools/bash.js +0 -638
  103. package/dist/tools/edit.js +0 -439
  104. package/dist/tools/fetch.js +0 -415
  105. package/dist/tools/glob.js +0 -142
  106. package/dist/tools/grep.js +0 -263
  107. package/dist/tools/index.js +0 -171
  108. package/dist/tools/list.js +0 -96
  109. package/dist/tools/read.js +0 -74
  110. package/dist/tools/search.js +0 -134
  111. package/dist/tools/subagent.js +0 -23
  112. package/dist/tools/write.js +0 -107
  113. package/dist/types.js +0 -1
  114. package/dist/ui/App.js +0 -2874
  115. package/dist/ui/Approval.js +0 -148
  116. package/dist/ui/Confirm.js +0 -51
  117. package/dist/ui/DiffView.js +0 -401
  118. package/dist/ui/Input.js +0 -461
  119. package/dist/ui/ModelSelect.js +0 -32
  120. package/dist/ui/PlanProgress.js +0 -50
  121. package/dist/ui/Question.js +0 -238
  122. package/dist/ui/QueuedList.js +0 -17
  123. package/dist/ui/ResumeSelect.js +0 -61
  124. package/dist/ui/Scrollback.js +0 -715
  125. package/dist/ui/Splash.js +0 -42
  126. package/dist/ui/Status.js +0 -207
  127. package/dist/ui/Suggestions.js +0 -50
  128. package/dist/ui/Working.js +0 -242
  129. package/dist/ui/clipboard.js +0 -77
  130. package/dist/ui/commands.js +0 -205
  131. package/dist/ui/dialogspecs.js +0 -38
  132. package/dist/ui/focus.js +0 -56
  133. package/dist/ui/format.js +0 -180
  134. package/dist/ui/framedrops.js +0 -34
  135. package/dist/ui/glyphs.js +0 -48
  136. package/dist/ui/harnessecho.js +0 -24
  137. package/dist/ui/highlight.js +0 -191
  138. package/dist/ui/identity.js +0 -211
  139. package/dist/ui/layout.js +0 -224
  140. package/dist/ui/markdown.js +0 -357
  141. package/dist/ui/models.js +0 -32
  142. package/dist/ui/pastes.js +0 -59
  143. package/dist/ui/paths.js +0 -19
  144. package/dist/ui/pr.js +0 -78
  145. package/dist/ui/queue.js +0 -25
  146. package/dist/ui/reactbuild.js +0 -15
  147. package/dist/ui/reasoningfold.js +0 -63
  148. package/dist/ui/redact.js +0 -51
  149. package/dist/ui/scrub.js +0 -49
  150. package/dist/ui/suggest.js +0 -92
  151. package/dist/ui/summary.js +0 -60
  152. package/dist/ui/syncframe.js +0 -97
  153. package/dist/ui/termtext.js +0 -117
  154. package/dist/ui/theme.js +0 -100
  155. package/dist/ui/tui.js +0 -9
  156. package/dist/ui/warmtrigger.js +0 -37
  157. package/dist/version.js +0 -27
@@ -0,0 +1,4050 @@
1
+ import { createRequire as __reikaCreateRequire } from 'node:module';
2
+ const require = __reikaCreateRequire(import.meta.url);
3
+ import {
4
+ __commonJS,
5
+ __esm,
6
+ __export,
7
+ __require
8
+ } from "./chunk-KI5CTLSX.js";
9
+
10
+ // node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/StyleSheet.js
11
+ var require_StyleSheet = __commonJS({
12
+ "node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/StyleSheet.js"(exports) {
13
+ var CSSOM = {};
14
+ CSSOM.StyleSheet = function StyleSheet() {
15
+ this.parentStyleSheet = null;
16
+ };
17
+ exports.StyleSheet = CSSOM.StyleSheet;
18
+ }
19
+ });
20
+
21
+ // node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/CSSRule.js
22
+ var require_CSSRule = __commonJS({
23
+ "node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/CSSRule.js"(exports) {
24
+ var CSSOM = {};
25
+ CSSOM.CSSRule = function CSSRule() {
26
+ this.parentRule = null;
27
+ this.parentStyleSheet = null;
28
+ };
29
+ CSSOM.CSSRule.UNKNOWN_RULE = 0;
30
+ CSSOM.CSSRule.STYLE_RULE = 1;
31
+ CSSOM.CSSRule.CHARSET_RULE = 2;
32
+ CSSOM.CSSRule.IMPORT_RULE = 3;
33
+ CSSOM.CSSRule.MEDIA_RULE = 4;
34
+ CSSOM.CSSRule.FONT_FACE_RULE = 5;
35
+ CSSOM.CSSRule.PAGE_RULE = 6;
36
+ CSSOM.CSSRule.KEYFRAMES_RULE = 7;
37
+ CSSOM.CSSRule.KEYFRAME_RULE = 8;
38
+ CSSOM.CSSRule.MARGIN_RULE = 9;
39
+ CSSOM.CSSRule.NAMESPACE_RULE = 10;
40
+ CSSOM.CSSRule.COUNTER_STYLE_RULE = 11;
41
+ CSSOM.CSSRule.SUPPORTS_RULE = 12;
42
+ CSSOM.CSSRule.DOCUMENT_RULE = 13;
43
+ CSSOM.CSSRule.FONT_FEATURE_VALUES_RULE = 14;
44
+ CSSOM.CSSRule.VIEWPORT_RULE = 15;
45
+ CSSOM.CSSRule.REGION_STYLE_RULE = 16;
46
+ CSSOM.CSSRule.prototype = {
47
+ constructor: CSSOM.CSSRule
48
+ //FIXME
49
+ };
50
+ exports.CSSRule = CSSOM.CSSRule;
51
+ }
52
+ });
53
+
54
+ // node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/CSSStyleRule.js
55
+ var require_CSSStyleRule = __commonJS({
56
+ "node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/CSSStyleRule.js"(exports) {
57
+ var CSSOM = {
58
+ CSSStyleDeclaration: require_CSSStyleDeclaration().CSSStyleDeclaration,
59
+ CSSRule: require_CSSRule().CSSRule
60
+ };
61
+ CSSOM.CSSStyleRule = function CSSStyleRule() {
62
+ CSSOM.CSSRule.call(this);
63
+ this.selectorText = "";
64
+ this.style = new CSSOM.CSSStyleDeclaration();
65
+ this.style.parentRule = this;
66
+ };
67
+ CSSOM.CSSStyleRule.prototype = new CSSOM.CSSRule();
68
+ CSSOM.CSSStyleRule.prototype.constructor = CSSOM.CSSStyleRule;
69
+ CSSOM.CSSStyleRule.prototype.type = 1;
70
+ Object.defineProperty(CSSOM.CSSStyleRule.prototype, "cssText", {
71
+ get: function() {
72
+ var text;
73
+ if (this.selectorText) {
74
+ text = this.selectorText + " {" + this.style.cssText + "}";
75
+ } else {
76
+ text = "";
77
+ }
78
+ return text;
79
+ },
80
+ set: function(cssText) {
81
+ var rule = CSSOM.CSSStyleRule.parse(cssText);
82
+ this.style = rule.style;
83
+ this.selectorText = rule.selectorText;
84
+ }
85
+ });
86
+ CSSOM.CSSStyleRule.parse = function(ruleText) {
87
+ var i = 0;
88
+ var state = "selector";
89
+ var index;
90
+ var j = i;
91
+ var buffer = "";
92
+ var SIGNIFICANT_WHITESPACE = {
93
+ "selector": true,
94
+ "value": true
95
+ };
96
+ var styleRule = new CSSOM.CSSStyleRule();
97
+ var name, priority = "";
98
+ for (var character; character = ruleText.charAt(i); i++) {
99
+ switch (character) {
100
+ case " ":
101
+ case " ":
102
+ case "\r":
103
+ case "\n":
104
+ case "\f":
105
+ if (SIGNIFICANT_WHITESPACE[state]) {
106
+ switch (ruleText.charAt(i - 1)) {
107
+ case " ":
108
+ case " ":
109
+ case "\r":
110
+ case "\n":
111
+ case "\f":
112
+ break;
113
+ default:
114
+ buffer += " ";
115
+ break;
116
+ }
117
+ }
118
+ break;
119
+ // String
120
+ case '"':
121
+ j = i + 1;
122
+ index = ruleText.indexOf('"', j) + 1;
123
+ if (!index) {
124
+ throw '" is missing';
125
+ }
126
+ buffer += ruleText.slice(i, index);
127
+ i = index - 1;
128
+ break;
129
+ case "'":
130
+ j = i + 1;
131
+ index = ruleText.indexOf("'", j) + 1;
132
+ if (!index) {
133
+ throw "' is missing";
134
+ }
135
+ buffer += ruleText.slice(i, index);
136
+ i = index - 1;
137
+ break;
138
+ // Comment
139
+ case "/":
140
+ if (ruleText.charAt(i + 1) === "*") {
141
+ i += 2;
142
+ index = ruleText.indexOf("*/", i);
143
+ if (index === -1) {
144
+ throw new SyntaxError("Missing */");
145
+ } else {
146
+ i = index + 1;
147
+ }
148
+ } else {
149
+ buffer += character;
150
+ }
151
+ break;
152
+ case "{":
153
+ if (state === "selector") {
154
+ styleRule.selectorText = buffer.trim();
155
+ buffer = "";
156
+ state = "name";
157
+ }
158
+ break;
159
+ case ":":
160
+ if (state === "name") {
161
+ name = buffer.trim();
162
+ buffer = "";
163
+ state = "value";
164
+ } else {
165
+ buffer += character;
166
+ }
167
+ break;
168
+ case "!":
169
+ if (state === "value" && ruleText.indexOf("!important", i) === i) {
170
+ priority = "important";
171
+ i += "important".length;
172
+ } else {
173
+ buffer += character;
174
+ }
175
+ break;
176
+ case ";":
177
+ if (state === "value") {
178
+ styleRule.style.setProperty(name, buffer.trim(), priority);
179
+ priority = "";
180
+ buffer = "";
181
+ state = "name";
182
+ } else {
183
+ buffer += character;
184
+ }
185
+ break;
186
+ case "}":
187
+ if (state === "value") {
188
+ styleRule.style.setProperty(name, buffer.trim(), priority);
189
+ priority = "";
190
+ buffer = "";
191
+ } else if (state === "name") {
192
+ break;
193
+ } else {
194
+ buffer += character;
195
+ }
196
+ state = "selector";
197
+ break;
198
+ default:
199
+ buffer += character;
200
+ break;
201
+ }
202
+ }
203
+ return styleRule;
204
+ };
205
+ exports.CSSStyleRule = CSSOM.CSSStyleRule;
206
+ }
207
+ });
208
+
209
+ // node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/CSSStyleSheet.js
210
+ var require_CSSStyleSheet = __commonJS({
211
+ "node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/CSSStyleSheet.js"(exports) {
212
+ var CSSOM = {
213
+ StyleSheet: require_StyleSheet().StyleSheet,
214
+ CSSStyleRule: require_CSSStyleRule().CSSStyleRule
215
+ };
216
+ CSSOM.CSSStyleSheet = function CSSStyleSheet() {
217
+ CSSOM.StyleSheet.call(this);
218
+ this.cssRules = [];
219
+ };
220
+ CSSOM.CSSStyleSheet.prototype = new CSSOM.StyleSheet();
221
+ CSSOM.CSSStyleSheet.prototype.constructor = CSSOM.CSSStyleSheet;
222
+ CSSOM.CSSStyleSheet.prototype.insertRule = function(rule, index) {
223
+ if (index < 0 || index > this.cssRules.length) {
224
+ throw new RangeError("INDEX_SIZE_ERR");
225
+ }
226
+ var cssRule = CSSOM.parse(rule).cssRules[0];
227
+ cssRule.parentStyleSheet = this;
228
+ this.cssRules.splice(index, 0, cssRule);
229
+ return index;
230
+ };
231
+ CSSOM.CSSStyleSheet.prototype.deleteRule = function(index) {
232
+ if (index < 0 || index >= this.cssRules.length) {
233
+ throw new RangeError("INDEX_SIZE_ERR");
234
+ }
235
+ this.cssRules.splice(index, 1);
236
+ };
237
+ CSSOM.CSSStyleSheet.prototype.toString = function() {
238
+ var result = "";
239
+ var rules = this.cssRules;
240
+ for (var i = 0; i < rules.length; i++) {
241
+ result += rules[i].cssText + "\n";
242
+ }
243
+ return result;
244
+ };
245
+ exports.CSSStyleSheet = CSSOM.CSSStyleSheet;
246
+ CSSOM.parse = require_parse().parse;
247
+ }
248
+ });
249
+
250
+ // node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/MediaList.js
251
+ var require_MediaList = __commonJS({
252
+ "node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/MediaList.js"(exports) {
253
+ var CSSOM = {};
254
+ CSSOM.MediaList = function MediaList() {
255
+ this.length = 0;
256
+ };
257
+ CSSOM.MediaList.prototype = {
258
+ constructor: CSSOM.MediaList,
259
+ /**
260
+ * @return {string}
261
+ */
262
+ get mediaText() {
263
+ return Array.prototype.join.call(this, ", ");
264
+ },
265
+ /**
266
+ * @param {string} value
267
+ */
268
+ set mediaText(value) {
269
+ var values = value.split(",");
270
+ var length = this.length = values.length;
271
+ for (var i = 0; i < length; i++) {
272
+ this[i] = values[i].trim();
273
+ }
274
+ },
275
+ /**
276
+ * @param {string} medium
277
+ */
278
+ appendMedium: function(medium) {
279
+ if (Array.prototype.indexOf.call(this, medium) === -1) {
280
+ this[this.length] = medium;
281
+ this.length++;
282
+ }
283
+ },
284
+ /**
285
+ * @param {string} medium
286
+ */
287
+ deleteMedium: function(medium) {
288
+ var index = Array.prototype.indexOf.call(this, medium);
289
+ if (index !== -1) {
290
+ Array.prototype.splice.call(this, index, 1);
291
+ }
292
+ }
293
+ };
294
+ exports.MediaList = CSSOM.MediaList;
295
+ }
296
+ });
297
+
298
+ // node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/CSSImportRule.js
299
+ var require_CSSImportRule = __commonJS({
300
+ "node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/CSSImportRule.js"(exports) {
301
+ var CSSOM = {
302
+ CSSRule: require_CSSRule().CSSRule,
303
+ CSSStyleSheet: require_CSSStyleSheet().CSSStyleSheet,
304
+ MediaList: require_MediaList().MediaList
305
+ };
306
+ CSSOM.CSSImportRule = function CSSImportRule() {
307
+ CSSOM.CSSRule.call(this);
308
+ this.href = "";
309
+ this.media = new CSSOM.MediaList();
310
+ this.styleSheet = new CSSOM.CSSStyleSheet();
311
+ };
312
+ CSSOM.CSSImportRule.prototype = new CSSOM.CSSRule();
313
+ CSSOM.CSSImportRule.prototype.constructor = CSSOM.CSSImportRule;
314
+ CSSOM.CSSImportRule.prototype.type = 3;
315
+ Object.defineProperty(CSSOM.CSSImportRule.prototype, "cssText", {
316
+ get: function() {
317
+ var mediaText = this.media.mediaText;
318
+ return "@import url(" + this.href + ")" + (mediaText ? " " + mediaText : "") + ";";
319
+ },
320
+ set: function(cssText) {
321
+ var i = 0;
322
+ var state = "";
323
+ var buffer = "";
324
+ var index;
325
+ for (var character; character = cssText.charAt(i); i++) {
326
+ switch (character) {
327
+ case " ":
328
+ case " ":
329
+ case "\r":
330
+ case "\n":
331
+ case "\f":
332
+ if (state === "after-import") {
333
+ state = "url";
334
+ } else {
335
+ buffer += character;
336
+ }
337
+ break;
338
+ case "@":
339
+ if (!state && cssText.indexOf("@import", i) === i) {
340
+ state = "after-import";
341
+ i += "import".length;
342
+ buffer = "";
343
+ }
344
+ break;
345
+ case "u":
346
+ if (state === "url" && cssText.indexOf("url(", i) === i) {
347
+ index = cssText.indexOf(")", i + 1);
348
+ if (index === -1) {
349
+ throw i + ': ")" not found';
350
+ }
351
+ i += "url(".length;
352
+ var url = cssText.slice(i, index);
353
+ if (url[0] === url[url.length - 1]) {
354
+ if (url[0] === '"' || url[0] === "'") {
355
+ url = url.slice(1, -1);
356
+ }
357
+ }
358
+ this.href = url;
359
+ i = index;
360
+ state = "media";
361
+ }
362
+ break;
363
+ case '"':
364
+ if (state === "url") {
365
+ index = cssText.indexOf('"', i + 1);
366
+ if (!index) {
367
+ throw i + `: '"' not found`;
368
+ }
369
+ this.href = cssText.slice(i + 1, index);
370
+ i = index;
371
+ state = "media";
372
+ }
373
+ break;
374
+ case "'":
375
+ if (state === "url") {
376
+ index = cssText.indexOf("'", i + 1);
377
+ if (!index) {
378
+ throw i + `: "'" not found`;
379
+ }
380
+ this.href = cssText.slice(i + 1, index);
381
+ i = index;
382
+ state = "media";
383
+ }
384
+ break;
385
+ case ";":
386
+ if (state === "media") {
387
+ if (buffer) {
388
+ this.media.mediaText = buffer.trim();
389
+ }
390
+ }
391
+ break;
392
+ default:
393
+ if (state === "media") {
394
+ buffer += character;
395
+ }
396
+ break;
397
+ }
398
+ }
399
+ }
400
+ });
401
+ exports.CSSImportRule = CSSOM.CSSImportRule;
402
+ }
403
+ });
404
+
405
+ // node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/CSSGroupingRule.js
406
+ var require_CSSGroupingRule = __commonJS({
407
+ "node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/CSSGroupingRule.js"(exports) {
408
+ var CSSOM = {
409
+ CSSRule: require_CSSRule().CSSRule
410
+ };
411
+ CSSOM.CSSGroupingRule = function CSSGroupingRule() {
412
+ CSSOM.CSSRule.call(this);
413
+ this.cssRules = [];
414
+ };
415
+ CSSOM.CSSGroupingRule.prototype = new CSSOM.CSSRule();
416
+ CSSOM.CSSGroupingRule.prototype.constructor = CSSOM.CSSGroupingRule;
417
+ CSSOM.CSSGroupingRule.prototype.insertRule = function insertRule(rule, index) {
418
+ if (index < 0 || index > this.cssRules.length) {
419
+ throw new RangeError("INDEX_SIZE_ERR");
420
+ }
421
+ var cssRule = CSSOM.parse(rule).cssRules[0];
422
+ cssRule.parentRule = this;
423
+ this.cssRules.splice(index, 0, cssRule);
424
+ return index;
425
+ };
426
+ CSSOM.CSSGroupingRule.prototype.deleteRule = function deleteRule(index) {
427
+ if (index < 0 || index >= this.cssRules.length) {
428
+ throw new RangeError("INDEX_SIZE_ERR");
429
+ }
430
+ this.cssRules.splice(index, 1)[0].parentRule = null;
431
+ };
432
+ exports.CSSGroupingRule = CSSOM.CSSGroupingRule;
433
+ }
434
+ });
435
+
436
+ // node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/CSSConditionRule.js
437
+ var require_CSSConditionRule = __commonJS({
438
+ "node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/CSSConditionRule.js"(exports) {
439
+ var CSSOM = {
440
+ CSSRule: require_CSSRule().CSSRule,
441
+ CSSGroupingRule: require_CSSGroupingRule().CSSGroupingRule
442
+ };
443
+ CSSOM.CSSConditionRule = function CSSConditionRule() {
444
+ CSSOM.CSSGroupingRule.call(this);
445
+ this.cssRules = [];
446
+ };
447
+ CSSOM.CSSConditionRule.prototype = new CSSOM.CSSGroupingRule();
448
+ CSSOM.CSSConditionRule.prototype.constructor = CSSOM.CSSConditionRule;
449
+ CSSOM.CSSConditionRule.prototype.conditionText = "";
450
+ CSSOM.CSSConditionRule.prototype.cssText = "";
451
+ exports.CSSConditionRule = CSSOM.CSSConditionRule;
452
+ }
453
+ });
454
+
455
+ // node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/CSSMediaRule.js
456
+ var require_CSSMediaRule = __commonJS({
457
+ "node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/CSSMediaRule.js"(exports) {
458
+ var CSSOM = {
459
+ CSSRule: require_CSSRule().CSSRule,
460
+ CSSGroupingRule: require_CSSGroupingRule().CSSGroupingRule,
461
+ CSSConditionRule: require_CSSConditionRule().CSSConditionRule,
462
+ MediaList: require_MediaList().MediaList
463
+ };
464
+ CSSOM.CSSMediaRule = function CSSMediaRule() {
465
+ CSSOM.CSSConditionRule.call(this);
466
+ this.media = new CSSOM.MediaList();
467
+ };
468
+ CSSOM.CSSMediaRule.prototype = new CSSOM.CSSConditionRule();
469
+ CSSOM.CSSMediaRule.prototype.constructor = CSSOM.CSSMediaRule;
470
+ CSSOM.CSSMediaRule.prototype.type = 4;
471
+ Object.defineProperties(CSSOM.CSSMediaRule.prototype, {
472
+ "conditionText": {
473
+ get: function() {
474
+ return this.media.mediaText;
475
+ },
476
+ set: function(value) {
477
+ this.media.mediaText = value;
478
+ },
479
+ configurable: true,
480
+ enumerable: true
481
+ },
482
+ "cssText": {
483
+ get: function() {
484
+ var cssTexts = [];
485
+ for (var i = 0, length = this.cssRules.length; i < length; i++) {
486
+ cssTexts.push(this.cssRules[i].cssText);
487
+ }
488
+ return "@media " + this.media.mediaText + " {" + cssTexts.join("") + "}";
489
+ },
490
+ configurable: true,
491
+ enumerable: true
492
+ }
493
+ });
494
+ exports.CSSMediaRule = CSSOM.CSSMediaRule;
495
+ }
496
+ });
497
+
498
+ // node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/CSSSupportsRule.js
499
+ var require_CSSSupportsRule = __commonJS({
500
+ "node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/CSSSupportsRule.js"(exports) {
501
+ var CSSOM = {
502
+ CSSRule: require_CSSRule().CSSRule,
503
+ CSSGroupingRule: require_CSSGroupingRule().CSSGroupingRule,
504
+ CSSConditionRule: require_CSSConditionRule().CSSConditionRule
505
+ };
506
+ CSSOM.CSSSupportsRule = function CSSSupportsRule() {
507
+ CSSOM.CSSConditionRule.call(this);
508
+ };
509
+ CSSOM.CSSSupportsRule.prototype = new CSSOM.CSSConditionRule();
510
+ CSSOM.CSSSupportsRule.prototype.constructor = CSSOM.CSSSupportsRule;
511
+ CSSOM.CSSSupportsRule.prototype.type = 12;
512
+ Object.defineProperty(CSSOM.CSSSupportsRule.prototype, "cssText", {
513
+ get: function() {
514
+ var cssTexts = [];
515
+ for (var i = 0, length = this.cssRules.length; i < length; i++) {
516
+ cssTexts.push(this.cssRules[i].cssText);
517
+ }
518
+ return "@supports " + this.conditionText + " {" + cssTexts.join("") + "}";
519
+ }
520
+ });
521
+ exports.CSSSupportsRule = CSSOM.CSSSupportsRule;
522
+ }
523
+ });
524
+
525
+ // node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/CSSFontFaceRule.js
526
+ var require_CSSFontFaceRule = __commonJS({
527
+ "node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/CSSFontFaceRule.js"(exports) {
528
+ var CSSOM = {
529
+ CSSStyleDeclaration: require_CSSStyleDeclaration().CSSStyleDeclaration,
530
+ CSSRule: require_CSSRule().CSSRule
531
+ };
532
+ CSSOM.CSSFontFaceRule = function CSSFontFaceRule() {
533
+ CSSOM.CSSRule.call(this);
534
+ this.style = new CSSOM.CSSStyleDeclaration();
535
+ this.style.parentRule = this;
536
+ };
537
+ CSSOM.CSSFontFaceRule.prototype = new CSSOM.CSSRule();
538
+ CSSOM.CSSFontFaceRule.prototype.constructor = CSSOM.CSSFontFaceRule;
539
+ CSSOM.CSSFontFaceRule.prototype.type = 5;
540
+ Object.defineProperty(CSSOM.CSSFontFaceRule.prototype, "cssText", {
541
+ get: function() {
542
+ return "@font-face {" + this.style.cssText + "}";
543
+ }
544
+ });
545
+ exports.CSSFontFaceRule = CSSOM.CSSFontFaceRule;
546
+ }
547
+ });
548
+
549
+ // node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/CSSHostRule.js
550
+ var require_CSSHostRule = __commonJS({
551
+ "node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/CSSHostRule.js"(exports) {
552
+ var CSSOM = {
553
+ CSSRule: require_CSSRule().CSSRule
554
+ };
555
+ CSSOM.CSSHostRule = function CSSHostRule() {
556
+ CSSOM.CSSRule.call(this);
557
+ this.cssRules = [];
558
+ };
559
+ CSSOM.CSSHostRule.prototype = new CSSOM.CSSRule();
560
+ CSSOM.CSSHostRule.prototype.constructor = CSSOM.CSSHostRule;
561
+ CSSOM.CSSHostRule.prototype.type = 1001;
562
+ Object.defineProperty(CSSOM.CSSHostRule.prototype, "cssText", {
563
+ get: function() {
564
+ var cssTexts = [];
565
+ for (var i = 0, length = this.cssRules.length; i < length; i++) {
566
+ cssTexts.push(this.cssRules[i].cssText);
567
+ }
568
+ return "@host {" + cssTexts.join("") + "}";
569
+ }
570
+ });
571
+ exports.CSSHostRule = CSSOM.CSSHostRule;
572
+ }
573
+ });
574
+
575
+ // node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/CSSKeyframeRule.js
576
+ var require_CSSKeyframeRule = __commonJS({
577
+ "node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/CSSKeyframeRule.js"(exports) {
578
+ var CSSOM = {
579
+ CSSRule: require_CSSRule().CSSRule,
580
+ CSSStyleDeclaration: require_CSSStyleDeclaration().CSSStyleDeclaration
581
+ };
582
+ CSSOM.CSSKeyframeRule = function CSSKeyframeRule() {
583
+ CSSOM.CSSRule.call(this);
584
+ this.keyText = "";
585
+ this.style = new CSSOM.CSSStyleDeclaration();
586
+ this.style.parentRule = this;
587
+ };
588
+ CSSOM.CSSKeyframeRule.prototype = new CSSOM.CSSRule();
589
+ CSSOM.CSSKeyframeRule.prototype.constructor = CSSOM.CSSKeyframeRule;
590
+ CSSOM.CSSKeyframeRule.prototype.type = 8;
591
+ Object.defineProperty(CSSOM.CSSKeyframeRule.prototype, "cssText", {
592
+ get: function() {
593
+ return this.keyText + " {" + this.style.cssText + "} ";
594
+ }
595
+ });
596
+ exports.CSSKeyframeRule = CSSOM.CSSKeyframeRule;
597
+ }
598
+ });
599
+
600
+ // node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/CSSKeyframesRule.js
601
+ var require_CSSKeyframesRule = __commonJS({
602
+ "node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/CSSKeyframesRule.js"(exports) {
603
+ var CSSOM = {
604
+ CSSRule: require_CSSRule().CSSRule
605
+ };
606
+ CSSOM.CSSKeyframesRule = function CSSKeyframesRule() {
607
+ CSSOM.CSSRule.call(this);
608
+ this.name = "";
609
+ this.cssRules = [];
610
+ };
611
+ CSSOM.CSSKeyframesRule.prototype = new CSSOM.CSSRule();
612
+ CSSOM.CSSKeyframesRule.prototype.constructor = CSSOM.CSSKeyframesRule;
613
+ CSSOM.CSSKeyframesRule.prototype.type = 7;
614
+ Object.defineProperty(CSSOM.CSSKeyframesRule.prototype, "cssText", {
615
+ get: function() {
616
+ var cssTexts = [];
617
+ for (var i = 0, length = this.cssRules.length; i < length; i++) {
618
+ cssTexts.push(" " + this.cssRules[i].cssText);
619
+ }
620
+ return "@" + (this._vendorPrefix || "") + "keyframes " + this.name + " { \n" + cssTexts.join("\n") + "\n}";
621
+ }
622
+ });
623
+ exports.CSSKeyframesRule = CSSOM.CSSKeyframesRule;
624
+ }
625
+ });
626
+
627
+ // node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/CSSValue.js
628
+ var require_CSSValue = __commonJS({
629
+ "node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/CSSValue.js"(exports) {
630
+ var CSSOM = {};
631
+ CSSOM.CSSValue = function CSSValue() {
632
+ };
633
+ CSSOM.CSSValue.prototype = {
634
+ constructor: CSSOM.CSSValue,
635
+ // @see: http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSValue
636
+ set cssText(text) {
637
+ var name = this._getConstructorName();
638
+ throw new Error('DOMException: property "cssText" of "' + name + '" is readonly and can not be replaced with "' + text + '"!');
639
+ },
640
+ get cssText() {
641
+ var name = this._getConstructorName();
642
+ throw new Error('getter "cssText" of "' + name + '" is not implemented!');
643
+ },
644
+ _getConstructorName: function() {
645
+ var s = this.constructor.toString(), c = s.match(/function\s([^\(]+)/), name = c[1];
646
+ return name;
647
+ }
648
+ };
649
+ exports.CSSValue = CSSOM.CSSValue;
650
+ }
651
+ });
652
+
653
+ // node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/CSSValueExpression.js
654
+ var require_CSSValueExpression = __commonJS({
655
+ "node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/CSSValueExpression.js"(exports) {
656
+ var CSSOM = {
657
+ CSSValue: require_CSSValue().CSSValue
658
+ };
659
+ CSSOM.CSSValueExpression = function CSSValueExpression(token, idx) {
660
+ this._token = token;
661
+ this._idx = idx;
662
+ };
663
+ CSSOM.CSSValueExpression.prototype = new CSSOM.CSSValue();
664
+ CSSOM.CSSValueExpression.prototype.constructor = CSSOM.CSSValueExpression;
665
+ CSSOM.CSSValueExpression.prototype.parse = function() {
666
+ var token = this._token, idx = this._idx;
667
+ var character = "", expression = "", error = "", info, paren = [];
668
+ for (; ; ++idx) {
669
+ character = token.charAt(idx);
670
+ if (character === "") {
671
+ error = "css expression error: unfinished expression!";
672
+ break;
673
+ }
674
+ switch (character) {
675
+ case "(":
676
+ paren.push(character);
677
+ expression += character;
678
+ break;
679
+ case ")":
680
+ paren.pop(character);
681
+ expression += character;
682
+ break;
683
+ case "/":
684
+ if (info = this._parseJSComment(token, idx)) {
685
+ if (info.error) {
686
+ error = "css expression error: unfinished comment in expression!";
687
+ } else {
688
+ idx = info.idx;
689
+ }
690
+ } else if (info = this._parseJSRexExp(token, idx)) {
691
+ idx = info.idx;
692
+ expression += info.text;
693
+ } else {
694
+ expression += character;
695
+ }
696
+ break;
697
+ case "'":
698
+ case '"':
699
+ info = this._parseJSString(token, idx, character);
700
+ if (info) {
701
+ idx = info.idx;
702
+ expression += info.text;
703
+ } else {
704
+ expression += character;
705
+ }
706
+ break;
707
+ default:
708
+ expression += character;
709
+ break;
710
+ }
711
+ if (error) {
712
+ break;
713
+ }
714
+ if (paren.length === 0) {
715
+ break;
716
+ }
717
+ }
718
+ var ret;
719
+ if (error) {
720
+ ret = {
721
+ error
722
+ };
723
+ } else {
724
+ ret = {
725
+ idx,
726
+ expression
727
+ };
728
+ }
729
+ return ret;
730
+ };
731
+ CSSOM.CSSValueExpression.prototype._parseJSComment = function(token, idx) {
732
+ var nextChar = token.charAt(idx + 1), text;
733
+ if (nextChar === "/" || nextChar === "*") {
734
+ var startIdx = idx, endIdx, commentEndChar;
735
+ if (nextChar === "/") {
736
+ commentEndChar = "\n";
737
+ } else if (nextChar === "*") {
738
+ commentEndChar = "*/";
739
+ }
740
+ endIdx = token.indexOf(commentEndChar, startIdx + 1 + 1);
741
+ if (endIdx !== -1) {
742
+ endIdx = endIdx + commentEndChar.length - 1;
743
+ text = token.substring(idx, endIdx + 1);
744
+ return {
745
+ idx: endIdx,
746
+ text
747
+ };
748
+ } else {
749
+ var error = "css expression error: unfinished comment in expression!";
750
+ return {
751
+ error
752
+ };
753
+ }
754
+ } else {
755
+ return false;
756
+ }
757
+ };
758
+ CSSOM.CSSValueExpression.prototype._parseJSString = function(token, idx, sep) {
759
+ var endIdx = this._findMatchedIdx(token, idx, sep), text;
760
+ if (endIdx === -1) {
761
+ return false;
762
+ } else {
763
+ text = token.substring(idx, endIdx + sep.length);
764
+ return {
765
+ idx: endIdx,
766
+ text
767
+ };
768
+ }
769
+ };
770
+ CSSOM.CSSValueExpression.prototype._parseJSRexExp = function(token, idx) {
771
+ var before = token.substring(0, idx).replace(/\s+$/, ""), legalRegx = [
772
+ /^$/,
773
+ /\($/,
774
+ /\[$/,
775
+ /\!$/,
776
+ /\+$/,
777
+ /\-$/,
778
+ /\*$/,
779
+ /\/\s+/,
780
+ /\%$/,
781
+ /\=$/,
782
+ /\>$/,
783
+ /<$/,
784
+ /\&$/,
785
+ /\|$/,
786
+ /\^$/,
787
+ /\~$/,
788
+ /\?$/,
789
+ /\,$/,
790
+ /delete$/,
791
+ /in$/,
792
+ /instanceof$/,
793
+ /new$/,
794
+ /typeof$/,
795
+ /void$/
796
+ ];
797
+ var isLegal = legalRegx.some(function(reg) {
798
+ return reg.test(before);
799
+ });
800
+ if (!isLegal) {
801
+ return false;
802
+ } else {
803
+ var sep = "/";
804
+ return this._parseJSString(token, idx, sep);
805
+ }
806
+ };
807
+ CSSOM.CSSValueExpression.prototype._findMatchedIdx = function(token, idx, sep) {
808
+ var startIdx = idx, endIdx;
809
+ var NOT_FOUND = -1;
810
+ while (true) {
811
+ endIdx = token.indexOf(sep, startIdx + 1);
812
+ if (endIdx === -1) {
813
+ endIdx = NOT_FOUND;
814
+ break;
815
+ } else {
816
+ var text = token.substring(idx + 1, endIdx), matched = text.match(/\\+$/);
817
+ if (!matched || matched[0] % 2 === 0) {
818
+ break;
819
+ } else {
820
+ startIdx = endIdx;
821
+ }
822
+ }
823
+ }
824
+ var nextNewLineIdx = token.indexOf("\n", idx + 1);
825
+ if (nextNewLineIdx < endIdx) {
826
+ endIdx = NOT_FOUND;
827
+ }
828
+ return endIdx;
829
+ };
830
+ exports.CSSValueExpression = CSSOM.CSSValueExpression;
831
+ }
832
+ });
833
+
834
+ // node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/MatcherList.js
835
+ var require_MatcherList = __commonJS({
836
+ "node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/MatcherList.js"(exports) {
837
+ var CSSOM = {};
838
+ CSSOM.MatcherList = function MatcherList() {
839
+ this.length = 0;
840
+ };
841
+ CSSOM.MatcherList.prototype = {
842
+ constructor: CSSOM.MatcherList,
843
+ /**
844
+ * @return {string}
845
+ */
846
+ get matcherText() {
847
+ return Array.prototype.join.call(this, ", ");
848
+ },
849
+ /**
850
+ * @param {string} value
851
+ */
852
+ set matcherText(value) {
853
+ var values = value.split(",");
854
+ var length = this.length = values.length;
855
+ for (var i = 0; i < length; i++) {
856
+ this[i] = values[i].trim();
857
+ }
858
+ },
859
+ /**
860
+ * @param {string} matcher
861
+ */
862
+ appendMatcher: function(matcher) {
863
+ if (Array.prototype.indexOf.call(this, matcher) === -1) {
864
+ this[this.length] = matcher;
865
+ this.length++;
866
+ }
867
+ },
868
+ /**
869
+ * @param {string} matcher
870
+ */
871
+ deleteMatcher: function(matcher) {
872
+ var index = Array.prototype.indexOf.call(this, matcher);
873
+ if (index !== -1) {
874
+ Array.prototype.splice.call(this, index, 1);
875
+ }
876
+ }
877
+ };
878
+ exports.MatcherList = CSSOM.MatcherList;
879
+ }
880
+ });
881
+
882
+ // node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/CSSDocumentRule.js
883
+ var require_CSSDocumentRule = __commonJS({
884
+ "node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/CSSDocumentRule.js"(exports) {
885
+ var CSSOM = {
886
+ CSSRule: require_CSSRule().CSSRule,
887
+ MatcherList: require_MatcherList().MatcherList
888
+ };
889
+ CSSOM.CSSDocumentRule = function CSSDocumentRule() {
890
+ CSSOM.CSSRule.call(this);
891
+ this.matcher = new CSSOM.MatcherList();
892
+ this.cssRules = [];
893
+ };
894
+ CSSOM.CSSDocumentRule.prototype = new CSSOM.CSSRule();
895
+ CSSOM.CSSDocumentRule.prototype.constructor = CSSOM.CSSDocumentRule;
896
+ CSSOM.CSSDocumentRule.prototype.type = 10;
897
+ Object.defineProperty(CSSOM.CSSDocumentRule.prototype, "cssText", {
898
+ get: function() {
899
+ var cssTexts = [];
900
+ for (var i = 0, length = this.cssRules.length; i < length; i++) {
901
+ cssTexts.push(this.cssRules[i].cssText);
902
+ }
903
+ return "@-moz-document " + this.matcher.matcherText + " {" + cssTexts.join("") + "}";
904
+ }
905
+ });
906
+ exports.CSSDocumentRule = CSSOM.CSSDocumentRule;
907
+ }
908
+ });
909
+
910
+ // node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/parse.js
911
+ var require_parse = __commonJS({
912
+ "node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/parse.js"(exports) {
913
+ var CSSOM = {};
914
+ CSSOM.parse = function parse3(token) {
915
+ var i = 0;
916
+ var state = "before-selector";
917
+ var index;
918
+ var buffer = "";
919
+ var valueParenthesisDepth = 0;
920
+ var SIGNIFICANT_WHITESPACE = {
921
+ "selector": true,
922
+ "value": true,
923
+ "value-parenthesis": true,
924
+ "atRule": true,
925
+ "importRule-begin": true,
926
+ "importRule": true,
927
+ "atBlock": true,
928
+ "conditionBlock": true,
929
+ "documentRule-begin": true
930
+ };
931
+ var styleSheet = new CSSOM.CSSStyleSheet();
932
+ var currentScope = styleSheet;
933
+ var parentRule;
934
+ var ancestorRules = [];
935
+ var hasAncestors = false;
936
+ var prevScope;
937
+ var name, priority = "", styleRule, mediaRule, supportsRule, importRule, fontFaceRule, keyframesRule, documentRule, hostRule;
938
+ var atKeyframesRegExp = /@(-(?:\w+-)+)?keyframes/g;
939
+ var parseError = function(message) {
940
+ var lines = token.substring(0, i).split("\n");
941
+ var lineCount = lines.length;
942
+ var charCount = lines.pop().length + 1;
943
+ var error = new Error(message + " (line " + lineCount + ", char " + charCount + ")");
944
+ error.line = lineCount;
945
+ error["char"] = charCount;
946
+ error.styleSheet = styleSheet;
947
+ throw error;
948
+ };
949
+ for (var character; character = token.charAt(i); i++) {
950
+ switch (character) {
951
+ case " ":
952
+ case " ":
953
+ case "\r":
954
+ case "\n":
955
+ case "\f":
956
+ if (SIGNIFICANT_WHITESPACE[state]) {
957
+ buffer += character;
958
+ }
959
+ break;
960
+ // String
961
+ case '"':
962
+ index = i + 1;
963
+ do {
964
+ index = token.indexOf('"', index) + 1;
965
+ if (!index) {
966
+ parseError('Unmatched "');
967
+ }
968
+ } while (token[index - 2] === "\\");
969
+ buffer += token.slice(i, index);
970
+ i = index - 1;
971
+ switch (state) {
972
+ case "before-value":
973
+ state = "value";
974
+ break;
975
+ case "importRule-begin":
976
+ state = "importRule";
977
+ break;
978
+ }
979
+ break;
980
+ case "'":
981
+ index = i + 1;
982
+ do {
983
+ index = token.indexOf("'", index) + 1;
984
+ if (!index) {
985
+ parseError("Unmatched '");
986
+ }
987
+ } while (token[index - 2] === "\\");
988
+ buffer += token.slice(i, index);
989
+ i = index - 1;
990
+ switch (state) {
991
+ case "before-value":
992
+ state = "value";
993
+ break;
994
+ case "importRule-begin":
995
+ state = "importRule";
996
+ break;
997
+ }
998
+ break;
999
+ // Comment
1000
+ case "/":
1001
+ if (token.charAt(i + 1) === "*") {
1002
+ i += 2;
1003
+ index = token.indexOf("*/", i);
1004
+ if (index === -1) {
1005
+ parseError("Missing */");
1006
+ } else {
1007
+ i = index + 1;
1008
+ }
1009
+ } else {
1010
+ buffer += character;
1011
+ }
1012
+ if (state === "importRule-begin") {
1013
+ buffer += " ";
1014
+ state = "importRule";
1015
+ }
1016
+ break;
1017
+ // At-rule
1018
+ case "@":
1019
+ if (token.indexOf("@-moz-document", i) === i) {
1020
+ state = "documentRule-begin";
1021
+ documentRule = new CSSOM.CSSDocumentRule();
1022
+ documentRule.__starts = i;
1023
+ i += "-moz-document".length;
1024
+ buffer = "";
1025
+ break;
1026
+ } else if (token.indexOf("@media", i) === i) {
1027
+ state = "atBlock";
1028
+ mediaRule = new CSSOM.CSSMediaRule();
1029
+ mediaRule.__starts = i;
1030
+ i += "media".length;
1031
+ buffer = "";
1032
+ break;
1033
+ } else if (token.indexOf("@supports", i) === i) {
1034
+ state = "conditionBlock";
1035
+ supportsRule = new CSSOM.CSSSupportsRule();
1036
+ supportsRule.__starts = i;
1037
+ i += "supports".length;
1038
+ buffer = "";
1039
+ break;
1040
+ } else if (token.indexOf("@host", i) === i) {
1041
+ state = "hostRule-begin";
1042
+ i += "host".length;
1043
+ hostRule = new CSSOM.CSSHostRule();
1044
+ hostRule.__starts = i;
1045
+ buffer = "";
1046
+ break;
1047
+ } else if (token.indexOf("@import", i) === i) {
1048
+ state = "importRule-begin";
1049
+ i += "import".length;
1050
+ buffer += "@import";
1051
+ break;
1052
+ } else if (token.indexOf("@font-face", i) === i) {
1053
+ state = "fontFaceRule-begin";
1054
+ i += "font-face".length;
1055
+ fontFaceRule = new CSSOM.CSSFontFaceRule();
1056
+ fontFaceRule.__starts = i;
1057
+ buffer = "";
1058
+ break;
1059
+ } else {
1060
+ atKeyframesRegExp.lastIndex = i;
1061
+ var matchKeyframes = atKeyframesRegExp.exec(token);
1062
+ if (matchKeyframes && matchKeyframes.index === i) {
1063
+ state = "keyframesRule-begin";
1064
+ keyframesRule = new CSSOM.CSSKeyframesRule();
1065
+ keyframesRule.__starts = i;
1066
+ keyframesRule._vendorPrefix = matchKeyframes[1];
1067
+ i += matchKeyframes[0].length - 1;
1068
+ buffer = "";
1069
+ break;
1070
+ } else if (state === "selector") {
1071
+ state = "atRule";
1072
+ }
1073
+ }
1074
+ buffer += character;
1075
+ break;
1076
+ case "{":
1077
+ if (state === "selector" || state === "atRule") {
1078
+ styleRule.selectorText = buffer.trim();
1079
+ styleRule.style.__starts = i;
1080
+ buffer = "";
1081
+ state = "before-name";
1082
+ } else if (state === "atBlock") {
1083
+ mediaRule.media.mediaText = buffer.trim();
1084
+ if (parentRule) {
1085
+ ancestorRules.push(parentRule);
1086
+ }
1087
+ currentScope = parentRule = mediaRule;
1088
+ mediaRule.parentStyleSheet = styleSheet;
1089
+ buffer = "";
1090
+ state = "before-selector";
1091
+ } else if (state === "conditionBlock") {
1092
+ supportsRule.conditionText = buffer.trim();
1093
+ if (parentRule) {
1094
+ ancestorRules.push(parentRule);
1095
+ }
1096
+ currentScope = parentRule = supportsRule;
1097
+ supportsRule.parentStyleSheet = styleSheet;
1098
+ buffer = "";
1099
+ state = "before-selector";
1100
+ } else if (state === "hostRule-begin") {
1101
+ if (parentRule) {
1102
+ ancestorRules.push(parentRule);
1103
+ }
1104
+ currentScope = parentRule = hostRule;
1105
+ hostRule.parentStyleSheet = styleSheet;
1106
+ buffer = "";
1107
+ state = "before-selector";
1108
+ } else if (state === "fontFaceRule-begin") {
1109
+ if (parentRule) {
1110
+ fontFaceRule.parentRule = parentRule;
1111
+ }
1112
+ fontFaceRule.parentStyleSheet = styleSheet;
1113
+ styleRule = fontFaceRule;
1114
+ buffer = "";
1115
+ state = "before-name";
1116
+ } else if (state === "keyframesRule-begin") {
1117
+ keyframesRule.name = buffer.trim();
1118
+ if (parentRule) {
1119
+ ancestorRules.push(parentRule);
1120
+ keyframesRule.parentRule = parentRule;
1121
+ }
1122
+ keyframesRule.parentStyleSheet = styleSheet;
1123
+ currentScope = parentRule = keyframesRule;
1124
+ buffer = "";
1125
+ state = "keyframeRule-begin";
1126
+ } else if (state === "keyframeRule-begin") {
1127
+ styleRule = new CSSOM.CSSKeyframeRule();
1128
+ styleRule.keyText = buffer.trim();
1129
+ styleRule.__starts = i;
1130
+ buffer = "";
1131
+ state = "before-name";
1132
+ } else if (state === "documentRule-begin") {
1133
+ documentRule.matcher.matcherText = buffer.trim();
1134
+ if (parentRule) {
1135
+ ancestorRules.push(parentRule);
1136
+ documentRule.parentRule = parentRule;
1137
+ }
1138
+ currentScope = parentRule = documentRule;
1139
+ documentRule.parentStyleSheet = styleSheet;
1140
+ buffer = "";
1141
+ state = "before-selector";
1142
+ }
1143
+ break;
1144
+ case ":":
1145
+ if (state === "name") {
1146
+ name = buffer.trim();
1147
+ buffer = "";
1148
+ state = "before-value";
1149
+ } else {
1150
+ buffer += character;
1151
+ }
1152
+ break;
1153
+ case "(":
1154
+ if (state === "value") {
1155
+ if (buffer.trim() === "expression") {
1156
+ var info = new CSSOM.CSSValueExpression(token, i).parse();
1157
+ if (info.error) {
1158
+ parseError(info.error);
1159
+ } else {
1160
+ buffer += info.expression;
1161
+ i = info.idx;
1162
+ }
1163
+ } else {
1164
+ state = "value-parenthesis";
1165
+ valueParenthesisDepth = 1;
1166
+ buffer += character;
1167
+ }
1168
+ } else if (state === "value-parenthesis") {
1169
+ valueParenthesisDepth++;
1170
+ buffer += character;
1171
+ } else {
1172
+ buffer += character;
1173
+ }
1174
+ break;
1175
+ case ")":
1176
+ if (state === "value-parenthesis") {
1177
+ valueParenthesisDepth--;
1178
+ if (valueParenthesisDepth === 0) state = "value";
1179
+ }
1180
+ buffer += character;
1181
+ break;
1182
+ case "!":
1183
+ if (state === "value" && token.indexOf("!important", i) === i) {
1184
+ priority = "important";
1185
+ i += "important".length;
1186
+ } else {
1187
+ buffer += character;
1188
+ }
1189
+ break;
1190
+ case ";":
1191
+ switch (state) {
1192
+ case "value":
1193
+ styleRule.style.setProperty(name, buffer.trim(), priority);
1194
+ priority = "";
1195
+ buffer = "";
1196
+ state = "before-name";
1197
+ break;
1198
+ case "atRule":
1199
+ buffer = "";
1200
+ state = "before-selector";
1201
+ break;
1202
+ case "importRule":
1203
+ importRule = new CSSOM.CSSImportRule();
1204
+ importRule.parentStyleSheet = importRule.styleSheet.parentStyleSheet = styleSheet;
1205
+ importRule.cssText = buffer + character;
1206
+ styleSheet.cssRules.push(importRule);
1207
+ buffer = "";
1208
+ state = "before-selector";
1209
+ break;
1210
+ default:
1211
+ buffer += character;
1212
+ break;
1213
+ }
1214
+ break;
1215
+ case "}":
1216
+ switch (state) {
1217
+ case "value":
1218
+ styleRule.style.setProperty(name, buffer.trim(), priority);
1219
+ priority = "";
1220
+ /* falls through */
1221
+ case "before-name":
1222
+ case "name":
1223
+ styleRule.__ends = i + 1;
1224
+ if (parentRule) {
1225
+ styleRule.parentRule = parentRule;
1226
+ }
1227
+ styleRule.parentStyleSheet = styleSheet;
1228
+ currentScope.cssRules.push(styleRule);
1229
+ buffer = "";
1230
+ if (currentScope.constructor === CSSOM.CSSKeyframesRule) {
1231
+ state = "keyframeRule-begin";
1232
+ } else {
1233
+ state = "before-selector";
1234
+ }
1235
+ break;
1236
+ case "keyframeRule-begin":
1237
+ case "before-selector":
1238
+ case "selector":
1239
+ if (!parentRule) {
1240
+ parseError("Unexpected }");
1241
+ }
1242
+ hasAncestors = ancestorRules.length > 0;
1243
+ while (ancestorRules.length > 0) {
1244
+ parentRule = ancestorRules.pop();
1245
+ if (parentRule.constructor.name === "CSSMediaRule" || parentRule.constructor.name === "CSSSupportsRule") {
1246
+ prevScope = currentScope;
1247
+ currentScope = parentRule;
1248
+ currentScope.cssRules.push(prevScope);
1249
+ break;
1250
+ }
1251
+ if (ancestorRules.length === 0) {
1252
+ hasAncestors = false;
1253
+ }
1254
+ }
1255
+ if (!hasAncestors) {
1256
+ currentScope.__ends = i + 1;
1257
+ styleSheet.cssRules.push(currentScope);
1258
+ currentScope = styleSheet;
1259
+ parentRule = null;
1260
+ }
1261
+ buffer = "";
1262
+ state = "before-selector";
1263
+ break;
1264
+ }
1265
+ break;
1266
+ default:
1267
+ switch (state) {
1268
+ case "before-selector":
1269
+ state = "selector";
1270
+ styleRule = new CSSOM.CSSStyleRule();
1271
+ styleRule.__starts = i;
1272
+ break;
1273
+ case "before-name":
1274
+ state = "name";
1275
+ break;
1276
+ case "before-value":
1277
+ state = "value";
1278
+ break;
1279
+ case "importRule-begin":
1280
+ state = "importRule";
1281
+ break;
1282
+ }
1283
+ buffer += character;
1284
+ break;
1285
+ }
1286
+ }
1287
+ return styleSheet;
1288
+ };
1289
+ exports.parse = CSSOM.parse;
1290
+ CSSOM.CSSStyleSheet = require_CSSStyleSheet().CSSStyleSheet;
1291
+ CSSOM.CSSStyleRule = require_CSSStyleRule().CSSStyleRule;
1292
+ CSSOM.CSSImportRule = require_CSSImportRule().CSSImportRule;
1293
+ CSSOM.CSSGroupingRule = require_CSSGroupingRule().CSSGroupingRule;
1294
+ CSSOM.CSSMediaRule = require_CSSMediaRule().CSSMediaRule;
1295
+ CSSOM.CSSConditionRule = require_CSSConditionRule().CSSConditionRule;
1296
+ CSSOM.CSSSupportsRule = require_CSSSupportsRule().CSSSupportsRule;
1297
+ CSSOM.CSSFontFaceRule = require_CSSFontFaceRule().CSSFontFaceRule;
1298
+ CSSOM.CSSHostRule = require_CSSHostRule().CSSHostRule;
1299
+ CSSOM.CSSStyleDeclaration = require_CSSStyleDeclaration().CSSStyleDeclaration;
1300
+ CSSOM.CSSKeyframeRule = require_CSSKeyframeRule().CSSKeyframeRule;
1301
+ CSSOM.CSSKeyframesRule = require_CSSKeyframesRule().CSSKeyframesRule;
1302
+ CSSOM.CSSValueExpression = require_CSSValueExpression().CSSValueExpression;
1303
+ CSSOM.CSSDocumentRule = require_CSSDocumentRule().CSSDocumentRule;
1304
+ }
1305
+ });
1306
+
1307
+ // node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/CSSStyleDeclaration.js
1308
+ var require_CSSStyleDeclaration = __commonJS({
1309
+ "node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/CSSStyleDeclaration.js"(exports) {
1310
+ var CSSOM = {};
1311
+ CSSOM.CSSStyleDeclaration = function CSSStyleDeclaration() {
1312
+ this.length = 0;
1313
+ this.parentRule = null;
1314
+ this._importants = {};
1315
+ };
1316
+ CSSOM.CSSStyleDeclaration.prototype = {
1317
+ constructor: CSSOM.CSSStyleDeclaration,
1318
+ /**
1319
+ *
1320
+ * @param {string} name
1321
+ * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-getPropertyValue
1322
+ * @return {string} the value of the property if it has been explicitly set for this declaration block.
1323
+ * Returns the empty string if the property has not been set.
1324
+ */
1325
+ getPropertyValue: function(name) {
1326
+ return this[name] || "";
1327
+ },
1328
+ /**
1329
+ *
1330
+ * @param {string} name
1331
+ * @param {string} value
1332
+ * @param {string} [priority=null] "important" or null
1333
+ * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-setProperty
1334
+ */
1335
+ setProperty: function(name, value, priority) {
1336
+ if (this[name]) {
1337
+ var index = Array.prototype.indexOf.call(this, name);
1338
+ if (index < 0) {
1339
+ this[this.length] = name;
1340
+ this.length++;
1341
+ }
1342
+ } else {
1343
+ this[this.length] = name;
1344
+ this.length++;
1345
+ }
1346
+ this[name] = value + "";
1347
+ this._importants[name] = priority;
1348
+ },
1349
+ /**
1350
+ *
1351
+ * @param {string} name
1352
+ * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-removeProperty
1353
+ * @return {string} the value of the property if it has been explicitly set for this declaration block.
1354
+ * Returns the empty string if the property has not been set or the property name does not correspond to a known CSS property.
1355
+ */
1356
+ removeProperty: function(name) {
1357
+ if (!(name in this)) {
1358
+ return "";
1359
+ }
1360
+ var index = Array.prototype.indexOf.call(this, name);
1361
+ if (index < 0) {
1362
+ return "";
1363
+ }
1364
+ var prevValue = this[name];
1365
+ this[name] = "";
1366
+ Array.prototype.splice.call(this, index, 1);
1367
+ return prevValue;
1368
+ },
1369
+ getPropertyCSSValue: function() {
1370
+ },
1371
+ /**
1372
+ *
1373
+ * @param {String} name
1374
+ */
1375
+ getPropertyPriority: function(name) {
1376
+ return this._importants[name] || "";
1377
+ },
1378
+ /**
1379
+ * element.style.overflow = "auto"
1380
+ * element.style.getPropertyShorthand("overflow-x")
1381
+ * -> "overflow"
1382
+ */
1383
+ getPropertyShorthand: function() {
1384
+ },
1385
+ isPropertyImplicit: function() {
1386
+ },
1387
+ // Doesn't work in IE < 9
1388
+ get cssText() {
1389
+ var properties = [];
1390
+ for (var i = 0, length = this.length; i < length; ++i) {
1391
+ var name = this[i];
1392
+ var value = this.getPropertyValue(name);
1393
+ var priority = this.getPropertyPriority(name);
1394
+ if (priority) {
1395
+ priority = " !" + priority;
1396
+ }
1397
+ properties[i] = name + ": " + value + priority + ";";
1398
+ }
1399
+ return properties.join(" ");
1400
+ },
1401
+ set cssText(text) {
1402
+ var i, name;
1403
+ for (i = this.length; i--; ) {
1404
+ name = this[i];
1405
+ this[name] = "";
1406
+ }
1407
+ Array.prototype.splice.call(this, 0, this.length);
1408
+ this._importants = {};
1409
+ var dummyRule = CSSOM.parse("#bogus{" + text + "}").cssRules[0].style;
1410
+ var length = dummyRule.length;
1411
+ for (i = 0; i < length; ++i) {
1412
+ name = dummyRule[i];
1413
+ this.setProperty(dummyRule[i], dummyRule.getPropertyValue(name), dummyRule.getPropertyPriority(name));
1414
+ }
1415
+ }
1416
+ };
1417
+ exports.CSSStyleDeclaration = CSSOM.CSSStyleDeclaration;
1418
+ CSSOM.parse = require_parse().parse;
1419
+ }
1420
+ });
1421
+
1422
+ // node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/clone.js
1423
+ var require_clone = __commonJS({
1424
+ "node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/clone.js"(exports) {
1425
+ var CSSOM = {
1426
+ CSSStyleSheet: require_CSSStyleSheet().CSSStyleSheet,
1427
+ CSSRule: require_CSSRule().CSSRule,
1428
+ CSSStyleRule: require_CSSStyleRule().CSSStyleRule,
1429
+ CSSGroupingRule: require_CSSGroupingRule().CSSGroupingRule,
1430
+ CSSConditionRule: require_CSSConditionRule().CSSConditionRule,
1431
+ CSSMediaRule: require_CSSMediaRule().CSSMediaRule,
1432
+ CSSSupportsRule: require_CSSSupportsRule().CSSSupportsRule,
1433
+ CSSStyleDeclaration: require_CSSStyleDeclaration().CSSStyleDeclaration,
1434
+ CSSKeyframeRule: require_CSSKeyframeRule().CSSKeyframeRule,
1435
+ CSSKeyframesRule: require_CSSKeyframesRule().CSSKeyframesRule
1436
+ };
1437
+ CSSOM.clone = function clone(stylesheet) {
1438
+ var cloned = new CSSOM.CSSStyleSheet();
1439
+ var rules = stylesheet.cssRules;
1440
+ if (!rules) {
1441
+ return cloned;
1442
+ }
1443
+ for (var i = 0, rulesLength = rules.length; i < rulesLength; i++) {
1444
+ var rule = rules[i];
1445
+ var ruleClone = cloned.cssRules[i] = new rule.constructor();
1446
+ var style = rule.style;
1447
+ if (style) {
1448
+ var styleClone = ruleClone.style = new CSSOM.CSSStyleDeclaration();
1449
+ for (var j = 0, styleLength = style.length; j < styleLength; j++) {
1450
+ var name = styleClone[j] = style[j];
1451
+ styleClone[name] = style[name];
1452
+ styleClone._importants[name] = style.getPropertyPriority(name);
1453
+ }
1454
+ styleClone.length = style.length;
1455
+ }
1456
+ if (rule.hasOwnProperty("keyText")) {
1457
+ ruleClone.keyText = rule.keyText;
1458
+ }
1459
+ if (rule.hasOwnProperty("selectorText")) {
1460
+ ruleClone.selectorText = rule.selectorText;
1461
+ }
1462
+ if (rule.hasOwnProperty("mediaText")) {
1463
+ ruleClone.mediaText = rule.mediaText;
1464
+ }
1465
+ if (rule.hasOwnProperty("conditionText")) {
1466
+ ruleClone.conditionText = rule.conditionText;
1467
+ }
1468
+ if (rule.hasOwnProperty("cssRules")) {
1469
+ ruleClone.cssRules = clone(rule).cssRules;
1470
+ }
1471
+ }
1472
+ return cloned;
1473
+ };
1474
+ exports.clone = CSSOM.clone;
1475
+ }
1476
+ });
1477
+
1478
+ // node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/index.js
1479
+ var require_lib = __commonJS({
1480
+ "node_modules/.pnpm/cssom@0.5.0/node_modules/cssom/lib/index.js"(exports) {
1481
+ "use strict";
1482
+ exports.CSSStyleDeclaration = require_CSSStyleDeclaration().CSSStyleDeclaration;
1483
+ exports.CSSRule = require_CSSRule().CSSRule;
1484
+ exports.CSSGroupingRule = require_CSSGroupingRule().CSSGroupingRule;
1485
+ exports.CSSConditionRule = require_CSSConditionRule().CSSConditionRule;
1486
+ exports.CSSStyleRule = require_CSSStyleRule().CSSStyleRule;
1487
+ exports.MediaList = require_MediaList().MediaList;
1488
+ exports.CSSMediaRule = require_CSSMediaRule().CSSMediaRule;
1489
+ exports.CSSSupportsRule = require_CSSSupportsRule().CSSSupportsRule;
1490
+ exports.CSSImportRule = require_CSSImportRule().CSSImportRule;
1491
+ exports.CSSFontFaceRule = require_CSSFontFaceRule().CSSFontFaceRule;
1492
+ exports.CSSHostRule = require_CSSHostRule().CSSHostRule;
1493
+ exports.StyleSheet = require_StyleSheet().StyleSheet;
1494
+ exports.CSSStyleSheet = require_CSSStyleSheet().CSSStyleSheet;
1495
+ exports.CSSKeyframesRule = require_CSSKeyframesRule().CSSKeyframesRule;
1496
+ exports.CSSKeyframeRule = require_CSSKeyframeRule().CSSKeyframeRule;
1497
+ exports.MatcherList = require_MatcherList().MatcherList;
1498
+ exports.CSSDocumentRule = require_CSSDocumentRule().CSSDocumentRule;
1499
+ exports.CSSValue = require_CSSValue().CSSValue;
1500
+ exports.CSSValueExpression = require_CSSValueExpression().CSSValueExpression;
1501
+ exports.parse = require_parse().parse;
1502
+ exports.clone = require_clone().clone;
1503
+ }
1504
+ });
1505
+
1506
+ // node_modules/.pnpm/linkedom@0.18.13/node_modules/linkedom/commonjs/canvas-shim.cjs
1507
+ var require_canvas_shim = __commonJS({
1508
+ "node_modules/.pnpm/linkedom@0.18.13/node_modules/linkedom/commonjs/canvas-shim.cjs"(exports, module) {
1509
+ var Canvas = class {
1510
+ constructor(width, height) {
1511
+ this.width = width;
1512
+ this.height = height;
1513
+ }
1514
+ getContext() {
1515
+ return null;
1516
+ }
1517
+ toDataURL() {
1518
+ return "";
1519
+ }
1520
+ };
1521
+ module.exports = {
1522
+ createCanvas: (width, height) => new Canvas(width, height)
1523
+ };
1524
+ }
1525
+ });
1526
+
1527
+ // node_modules/.pnpm/linkedom@0.18.13/node_modules/linkedom/commonjs/canvas.cjs
1528
+ var require_canvas = __commonJS({
1529
+ "node_modules/.pnpm/linkedom@0.18.13/node_modules/linkedom/commonjs/canvas.cjs"(exports, module) {
1530
+ try {
1531
+ module.exports = __require("canvas");
1532
+ } catch (fallback) {
1533
+ module.exports = require_canvas_shim();
1534
+ }
1535
+ }
1536
+ });
1537
+
1538
+ // node_modules/.pnpm/boolbase@2.0.0/node_modules/boolbase/dist/index.js
1539
+ function trueFunc() {
1540
+ return true;
1541
+ }
1542
+ function falseFunc() {
1543
+ return false;
1544
+ }
1545
+ var init_dist = __esm({
1546
+ "node_modules/.pnpm/boolbase@2.0.0/node_modules/boolbase/dist/index.js"() {
1547
+ }
1548
+ });
1549
+
1550
+ // node_modules/.pnpm/css-what@8.0.0/node_modules/css-what/dist/types.js
1551
+ var SelectorType, AttributeAction;
1552
+ var init_types = __esm({
1553
+ "node_modules/.pnpm/css-what@8.0.0/node_modules/css-what/dist/types.js"() {
1554
+ (function(SelectorType2) {
1555
+ SelectorType2["Attribute"] = "attribute";
1556
+ SelectorType2["Pseudo"] = "pseudo";
1557
+ SelectorType2["PseudoElement"] = "pseudo-element";
1558
+ SelectorType2["Tag"] = "tag";
1559
+ SelectorType2["Universal"] = "universal";
1560
+ SelectorType2["Adjacent"] = "adjacent";
1561
+ SelectorType2["Child"] = "child";
1562
+ SelectorType2["Descendant"] = "descendant";
1563
+ SelectorType2["Parent"] = "parent";
1564
+ SelectorType2["Sibling"] = "sibling";
1565
+ SelectorType2["ColumnCombinator"] = "column-combinator";
1566
+ })(SelectorType || (SelectorType = {}));
1567
+ (function(AttributeAction2) {
1568
+ AttributeAction2["Any"] = "any";
1569
+ AttributeAction2["Element"] = "element";
1570
+ AttributeAction2["End"] = "end";
1571
+ AttributeAction2["Equals"] = "equals";
1572
+ AttributeAction2["Exists"] = "exists";
1573
+ AttributeAction2["Hyphen"] = "hyphen";
1574
+ AttributeAction2["Not"] = "not";
1575
+ AttributeAction2["Start"] = "start";
1576
+ })(AttributeAction || (AttributeAction = {}));
1577
+ }
1578
+ });
1579
+
1580
+ // node_modules/.pnpm/css-what@8.0.0/node_modules/css-what/dist/parse.js
1581
+ function isTraversal(selector) {
1582
+ switch (selector.type) {
1583
+ case SelectorType.Adjacent:
1584
+ case SelectorType.Child:
1585
+ case SelectorType.Descendant:
1586
+ case SelectorType.Parent:
1587
+ case SelectorType.Sibling:
1588
+ case SelectorType.ColumnCombinator: {
1589
+ return true;
1590
+ }
1591
+ case SelectorType.Attribute:
1592
+ case SelectorType.Pseudo:
1593
+ case SelectorType.PseudoElement:
1594
+ case SelectorType.Tag:
1595
+ case SelectorType.Universal: {
1596
+ return false;
1597
+ }
1598
+ }
1599
+ }
1600
+ function funescape(_, escaped, escapedWhitespace) {
1601
+ const high = Number.parseInt(escaped, 16) - 65536;
1602
+ return Number.isNaN(high) || escapedWhitespace ? escaped : high < 0 ? (
1603
+ // BMP codepoint
1604
+ String.fromCharCode(high + 65536)
1605
+ ) : (
1606
+ // Supplemental Plane codepoint (surrogate pair)
1607
+ String.fromCharCode(high >> 10 | 55296, high & 1023 | 56320)
1608
+ );
1609
+ }
1610
+ function unescapeCSS(cssString) {
1611
+ return cssString.replace(reEscape, funescape);
1612
+ }
1613
+ function isQuote(c) {
1614
+ return c === CharCode.SingleQuote || c === CharCode.DoubleQuote;
1615
+ }
1616
+ function isWhitespace(c) {
1617
+ return c === CharCode.Space || c === CharCode.Tab || c === CharCode.NewLine || c === CharCode.FormFeed || c === CharCode.CarriageReturn;
1618
+ }
1619
+ function parse(selector) {
1620
+ const subselects2 = [];
1621
+ const endIndex = parseSelector(subselects2, `${selector}`, 0);
1622
+ if (endIndex < selector.length) {
1623
+ throw new Error(`Unmatched selector: ${selector.slice(endIndex)}`);
1624
+ }
1625
+ return subselects2;
1626
+ }
1627
+ function parseSelector(subselects2, selector, selectorIndex) {
1628
+ let tokens = [];
1629
+ function getName2(offset) {
1630
+ const match = selector.slice(selectorIndex + offset).match(reName);
1631
+ if (!match) {
1632
+ throw new Error(`Expected name, found ${selector.slice(selectorIndex)}`);
1633
+ }
1634
+ const [name] = match;
1635
+ selectorIndex += offset + name.length;
1636
+ return unescapeCSS(name);
1637
+ }
1638
+ function stripWhitespace(offset) {
1639
+ selectorIndex += offset;
1640
+ while (selectorIndex < selector.length && isWhitespace(selector.charCodeAt(selectorIndex))) {
1641
+ selectorIndex++;
1642
+ }
1643
+ }
1644
+ function readValueWithParenthesis() {
1645
+ selectorIndex += 1;
1646
+ const start = selectorIndex;
1647
+ for (let counter = 1; selectorIndex < selector.length; selectorIndex++) {
1648
+ switch (selector.charCodeAt(selectorIndex)) {
1649
+ case CharCode.BackSlash: {
1650
+ selectorIndex += 1;
1651
+ break;
1652
+ }
1653
+ case CharCode.LeftParenthesis: {
1654
+ counter += 1;
1655
+ break;
1656
+ }
1657
+ case CharCode.RightParenthesis: {
1658
+ counter -= 1;
1659
+ if (counter === 0) {
1660
+ return unescapeCSS(selector.slice(start, selectorIndex++));
1661
+ }
1662
+ break;
1663
+ }
1664
+ }
1665
+ }
1666
+ throw new Error("Parenthesis not matched");
1667
+ }
1668
+ function ensureNotTraversal() {
1669
+ if (tokens.length > 0 && isTraversal(tokens[tokens.length - 1])) {
1670
+ throw new Error("Did not expect successive traversals.");
1671
+ }
1672
+ }
1673
+ function addTraversal(type) {
1674
+ if (tokens.length > 0 && tokens[tokens.length - 1].type === SelectorType.Descendant) {
1675
+ tokens[tokens.length - 1].type = type;
1676
+ return;
1677
+ }
1678
+ ensureNotTraversal();
1679
+ tokens.push({ type });
1680
+ }
1681
+ function addSpecialAttribute(name, action) {
1682
+ tokens.push({
1683
+ type: SelectorType.Attribute,
1684
+ name,
1685
+ action,
1686
+ value: getName2(1),
1687
+ namespace: null,
1688
+ ignoreCase: "quirks"
1689
+ });
1690
+ }
1691
+ function finalizeSubselector() {
1692
+ if (tokens.length > 0 && tokens[tokens.length - 1].type === SelectorType.Descendant) {
1693
+ tokens.pop();
1694
+ }
1695
+ if (tokens.length === 0) {
1696
+ throw new Error("Empty sub-selector");
1697
+ }
1698
+ subselects2.push(tokens);
1699
+ }
1700
+ stripWhitespace(0);
1701
+ if (selector.length === selectorIndex) {
1702
+ return selectorIndex;
1703
+ }
1704
+ loop: while (selectorIndex < selector.length) {
1705
+ const firstChar = selector.charCodeAt(selectorIndex);
1706
+ switch (firstChar) {
1707
+ // Whitespace
1708
+ case CharCode.Space:
1709
+ case CharCode.Tab:
1710
+ case CharCode.NewLine:
1711
+ case CharCode.FormFeed:
1712
+ case CharCode.CarriageReturn: {
1713
+ if (tokens.length === 0 || tokens[0].type !== SelectorType.Descendant) {
1714
+ ensureNotTraversal();
1715
+ tokens.push({ type: SelectorType.Descendant });
1716
+ }
1717
+ stripWhitespace(1);
1718
+ break;
1719
+ }
1720
+ // Traversals
1721
+ case CharCode.GreaterThan: {
1722
+ addTraversal(SelectorType.Child);
1723
+ stripWhitespace(1);
1724
+ break;
1725
+ }
1726
+ case CharCode.LessThan: {
1727
+ addTraversal(SelectorType.Parent);
1728
+ stripWhitespace(1);
1729
+ break;
1730
+ }
1731
+ case CharCode.Tilde: {
1732
+ addTraversal(SelectorType.Sibling);
1733
+ stripWhitespace(1);
1734
+ break;
1735
+ }
1736
+ case CharCode.Plus: {
1737
+ addTraversal(SelectorType.Adjacent);
1738
+ stripWhitespace(1);
1739
+ break;
1740
+ }
1741
+ // Special attribute selectors: .class, #id
1742
+ case CharCode.Period: {
1743
+ addSpecialAttribute("class", AttributeAction.Element);
1744
+ break;
1745
+ }
1746
+ case CharCode.Hash: {
1747
+ addSpecialAttribute("id", AttributeAction.Equals);
1748
+ break;
1749
+ }
1750
+ case CharCode.LeftSquareBracket: {
1751
+ stripWhitespace(1);
1752
+ let name;
1753
+ let namespace = null;
1754
+ if (selector.charCodeAt(selectorIndex) === CharCode.Pipe) {
1755
+ name = getName2(1);
1756
+ } else if (selector.startsWith("*|", selectorIndex)) {
1757
+ namespace = "*";
1758
+ name = getName2(2);
1759
+ } else {
1760
+ name = getName2(0);
1761
+ if (selector.charCodeAt(selectorIndex) === CharCode.Pipe && selector.charCodeAt(selectorIndex + 1) !== CharCode.Equal) {
1762
+ namespace = name;
1763
+ name = getName2(1);
1764
+ }
1765
+ }
1766
+ stripWhitespace(0);
1767
+ let action = AttributeAction.Exists;
1768
+ const possibleAction = actionTypes.get(selector.charCodeAt(selectorIndex));
1769
+ if (possibleAction) {
1770
+ action = possibleAction;
1771
+ if (selector.charCodeAt(selectorIndex + 1) !== CharCode.Equal) {
1772
+ throw new Error("Expected `=`");
1773
+ }
1774
+ stripWhitespace(2);
1775
+ } else if (selector.charCodeAt(selectorIndex) === CharCode.Equal) {
1776
+ action = AttributeAction.Equals;
1777
+ stripWhitespace(1);
1778
+ }
1779
+ let value = "";
1780
+ let ignoreCase = null;
1781
+ if (action !== "exists") {
1782
+ if (isQuote(selector.charCodeAt(selectorIndex))) {
1783
+ const quote = selector.charCodeAt(selectorIndex);
1784
+ selectorIndex += 1;
1785
+ const sectionStart = selectorIndex;
1786
+ while (selectorIndex < selector.length && selector.charCodeAt(selectorIndex) !== quote) {
1787
+ selectorIndex += // Skip next character if it is escaped
1788
+ selector.charCodeAt(selectorIndex) === CharCode.BackSlash ? 2 : 1;
1789
+ }
1790
+ if (selector.charCodeAt(selectorIndex) !== quote) {
1791
+ throw new Error("Attribute value didn't end");
1792
+ }
1793
+ value = unescapeCSS(selector.slice(sectionStart, selectorIndex));
1794
+ selectorIndex += 1;
1795
+ } else {
1796
+ const valueStart = selectorIndex;
1797
+ while (selectorIndex < selector.length && !isWhitespace(selector.charCodeAt(selectorIndex)) && selector.charCodeAt(selectorIndex) !== CharCode.RightSquareBracket) {
1798
+ selectorIndex += // Skip next character if it is escaped
1799
+ selector.charCodeAt(selectorIndex) === CharCode.BackSlash ? 2 : 1;
1800
+ }
1801
+ value = unescapeCSS(selector.slice(valueStart, selectorIndex));
1802
+ }
1803
+ stripWhitespace(0);
1804
+ switch (selector.charCodeAt(selectorIndex) | 32) {
1805
+ // If the forceIgnore flag is set (either `i` or `s`), use that value
1806
+ case CharCode.LowerI: {
1807
+ ignoreCase = true;
1808
+ stripWhitespace(1);
1809
+ break;
1810
+ }
1811
+ case CharCode.LowerS: {
1812
+ ignoreCase = false;
1813
+ stripWhitespace(1);
1814
+ break;
1815
+ }
1816
+ }
1817
+ }
1818
+ if (selector.charCodeAt(selectorIndex) !== CharCode.RightSquareBracket) {
1819
+ throw new Error("Attribute selector didn't terminate");
1820
+ }
1821
+ selectorIndex += 1;
1822
+ const attributeSelector = {
1823
+ type: SelectorType.Attribute,
1824
+ name,
1825
+ action,
1826
+ value,
1827
+ namespace,
1828
+ ignoreCase
1829
+ };
1830
+ tokens.push(attributeSelector);
1831
+ break;
1832
+ }
1833
+ case CharCode.Colon: {
1834
+ if (selector.charCodeAt(selectorIndex + 1) === CharCode.Colon) {
1835
+ tokens.push({
1836
+ type: SelectorType.PseudoElement,
1837
+ name: getName2(2).toLowerCase(),
1838
+ data: selector.charCodeAt(selectorIndex) === CharCode.LeftParenthesis ? readValueWithParenthesis() : null
1839
+ });
1840
+ break;
1841
+ }
1842
+ const name = getName2(1).toLowerCase();
1843
+ if (pseudosToPseudoElements.has(name)) {
1844
+ tokens.push({
1845
+ type: SelectorType.PseudoElement,
1846
+ name,
1847
+ data: null
1848
+ });
1849
+ break;
1850
+ }
1851
+ let data = null;
1852
+ if (selector.charCodeAt(selectorIndex) === CharCode.LeftParenthesis) {
1853
+ if (unpackPseudos.has(name)) {
1854
+ if (isQuote(selector.charCodeAt(selectorIndex + 1))) {
1855
+ throw new Error(`Pseudo-selector ${name} cannot be quoted`);
1856
+ }
1857
+ data = [];
1858
+ selectorIndex = parseSelector(data, selector, selectorIndex + 1);
1859
+ if (selector.charCodeAt(selectorIndex) !== CharCode.RightParenthesis) {
1860
+ throw new Error(`Missing closing parenthesis in :${name} (${selector})`);
1861
+ }
1862
+ selectorIndex += 1;
1863
+ } else {
1864
+ data = readValueWithParenthesis();
1865
+ if (stripQuotesFromPseudos.has(name)) {
1866
+ const quot = data.charCodeAt(0);
1867
+ if (quot === data.charCodeAt(data.length - 1) && isQuote(quot)) {
1868
+ data = data.slice(1, -1);
1869
+ }
1870
+ }
1871
+ data = unescapeCSS(data);
1872
+ }
1873
+ }
1874
+ tokens.push({ type: SelectorType.Pseudo, name, data });
1875
+ break;
1876
+ }
1877
+ case CharCode.Comma: {
1878
+ finalizeSubselector();
1879
+ tokens = [];
1880
+ stripWhitespace(1);
1881
+ break;
1882
+ }
1883
+ default: {
1884
+ if (selector.startsWith("/*", selectorIndex)) {
1885
+ const endIndex = selector.indexOf("*/", selectorIndex + 2);
1886
+ if (endIndex === -1) {
1887
+ throw new Error("Comment was not terminated");
1888
+ }
1889
+ selectorIndex = endIndex + 2;
1890
+ if (tokens.length === 0) {
1891
+ stripWhitespace(0);
1892
+ }
1893
+ break;
1894
+ }
1895
+ let namespace = null;
1896
+ let name;
1897
+ if (firstChar === CharCode.Asterisk) {
1898
+ selectorIndex += 1;
1899
+ name = "*";
1900
+ } else if (firstChar === CharCode.Pipe) {
1901
+ name = "";
1902
+ if (selector.charCodeAt(selectorIndex + 1) === CharCode.Pipe) {
1903
+ addTraversal(SelectorType.ColumnCombinator);
1904
+ stripWhitespace(2);
1905
+ break;
1906
+ }
1907
+ } else if (reName.test(selector.slice(selectorIndex))) {
1908
+ name = getName2(0);
1909
+ } else {
1910
+ break loop;
1911
+ }
1912
+ if (selector.charCodeAt(selectorIndex) === CharCode.Pipe && selector.charCodeAt(selectorIndex + 1) !== CharCode.Pipe) {
1913
+ namespace = name;
1914
+ if (selector.charCodeAt(selectorIndex + 1) === CharCode.Asterisk) {
1915
+ name = "*";
1916
+ selectorIndex += 2;
1917
+ } else {
1918
+ name = getName2(1);
1919
+ }
1920
+ }
1921
+ tokens.push(name === "*" ? { type: SelectorType.Universal, namespace } : { type: SelectorType.Tag, name, namespace });
1922
+ }
1923
+ }
1924
+ }
1925
+ finalizeSubselector();
1926
+ return selectorIndex;
1927
+ }
1928
+ var reName, reEscape, CharCode, actionTypes, unpackPseudos, pseudosToPseudoElements, stripQuotesFromPseudos;
1929
+ var init_parse = __esm({
1930
+ "node_modules/.pnpm/css-what@8.0.0/node_modules/css-what/dist/parse.js"() {
1931
+ init_types();
1932
+ reName = /^[^#\\]?(?:\\(?:[\da-f]{1,6}\s?|.)|[\w\u00B0-\uFFFF-])+/;
1933
+ reEscape = /\\([\da-f]{1,6}\s?|(\s)|.)/gi;
1934
+ (function(CharCode2) {
1935
+ CharCode2[CharCode2["LeftParenthesis"] = 40] = "LeftParenthesis";
1936
+ CharCode2[CharCode2["RightParenthesis"] = 41] = "RightParenthesis";
1937
+ CharCode2[CharCode2["LeftSquareBracket"] = 91] = "LeftSquareBracket";
1938
+ CharCode2[CharCode2["RightSquareBracket"] = 93] = "RightSquareBracket";
1939
+ CharCode2[CharCode2["Comma"] = 44] = "Comma";
1940
+ CharCode2[CharCode2["Period"] = 46] = "Period";
1941
+ CharCode2[CharCode2["Colon"] = 58] = "Colon";
1942
+ CharCode2[CharCode2["SingleQuote"] = 39] = "SingleQuote";
1943
+ CharCode2[CharCode2["DoubleQuote"] = 34] = "DoubleQuote";
1944
+ CharCode2[CharCode2["Plus"] = 43] = "Plus";
1945
+ CharCode2[CharCode2["Tilde"] = 126] = "Tilde";
1946
+ CharCode2[CharCode2["QuestionMark"] = 63] = "QuestionMark";
1947
+ CharCode2[CharCode2["ExclamationMark"] = 33] = "ExclamationMark";
1948
+ CharCode2[CharCode2["Slash"] = 47] = "Slash";
1949
+ CharCode2[CharCode2["Equal"] = 61] = "Equal";
1950
+ CharCode2[CharCode2["Dollar"] = 36] = "Dollar";
1951
+ CharCode2[CharCode2["Pipe"] = 124] = "Pipe";
1952
+ CharCode2[CharCode2["Circumflex"] = 94] = "Circumflex";
1953
+ CharCode2[CharCode2["Asterisk"] = 42] = "Asterisk";
1954
+ CharCode2[CharCode2["GreaterThan"] = 62] = "GreaterThan";
1955
+ CharCode2[CharCode2["LessThan"] = 60] = "LessThan";
1956
+ CharCode2[CharCode2["Hash"] = 35] = "Hash";
1957
+ CharCode2[CharCode2["LowerI"] = 105] = "LowerI";
1958
+ CharCode2[CharCode2["LowerS"] = 115] = "LowerS";
1959
+ CharCode2[CharCode2["BackSlash"] = 92] = "BackSlash";
1960
+ CharCode2[CharCode2["Space"] = 32] = "Space";
1961
+ CharCode2[CharCode2["Tab"] = 9] = "Tab";
1962
+ CharCode2[CharCode2["NewLine"] = 10] = "NewLine";
1963
+ CharCode2[CharCode2["FormFeed"] = 12] = "FormFeed";
1964
+ CharCode2[CharCode2["CarriageReturn"] = 13] = "CarriageReturn";
1965
+ })(CharCode || (CharCode = {}));
1966
+ actionTypes = /* @__PURE__ */ new Map([
1967
+ [CharCode.Tilde, AttributeAction.Element],
1968
+ [CharCode.Circumflex, AttributeAction.Start],
1969
+ [CharCode.Dollar, AttributeAction.End],
1970
+ [CharCode.Asterisk, AttributeAction.Any],
1971
+ [CharCode.ExclamationMark, AttributeAction.Not],
1972
+ [CharCode.Pipe, AttributeAction.Hyphen]
1973
+ ]);
1974
+ unpackPseudos = /* @__PURE__ */ new Set([
1975
+ "has",
1976
+ "not",
1977
+ "matches",
1978
+ "is",
1979
+ "where",
1980
+ "host",
1981
+ "host-context"
1982
+ ]);
1983
+ pseudosToPseudoElements = /* @__PURE__ */ new Set([
1984
+ "before",
1985
+ "after",
1986
+ "first-line",
1987
+ "first-letter"
1988
+ ]);
1989
+ stripQuotesFromPseudos = /* @__PURE__ */ new Set(["contains", "icontains"]);
1990
+ }
1991
+ });
1992
+
1993
+ // node_modules/.pnpm/css-what@8.0.0/node_modules/css-what/dist/index.js
1994
+ var init_dist2 = __esm({
1995
+ "node_modules/.pnpm/css-what@8.0.0/node_modules/css-what/dist/index.js"() {
1996
+ init_parse();
1997
+ init_types();
1998
+ }
1999
+ });
2000
+
2001
+ // node_modules/.pnpm/domelementtype@3.0.0/node_modules/domelementtype/dist/index.js
2002
+ function isTag(element) {
2003
+ return element.type === ElementType.Tag || element.type === ElementType.Script || element.type === ElementType.Style;
2004
+ }
2005
+ var ElementType, Root, Text, Directive, Comment, Script, Style, Tag, CDATA, Doctype;
2006
+ var init_dist3 = __esm({
2007
+ "node_modules/.pnpm/domelementtype@3.0.0/node_modules/domelementtype/dist/index.js"() {
2008
+ (function(ElementType2) {
2009
+ ElementType2["Root"] = "root";
2010
+ ElementType2["Text"] = "text";
2011
+ ElementType2["Directive"] = "directive";
2012
+ ElementType2["Comment"] = "comment";
2013
+ ElementType2["Script"] = "script";
2014
+ ElementType2["Style"] = "style";
2015
+ ElementType2["Tag"] = "tag";
2016
+ ElementType2["CDATA"] = "cdata";
2017
+ ElementType2["Doctype"] = "doctype";
2018
+ })(ElementType || (ElementType = {}));
2019
+ Root = ElementType.Root;
2020
+ Text = ElementType.Text;
2021
+ Directive = ElementType.Directive;
2022
+ Comment = ElementType.Comment;
2023
+ Script = ElementType.Script;
2024
+ Style = ElementType.Style;
2025
+ Tag = ElementType.Tag;
2026
+ CDATA = ElementType.CDATA;
2027
+ Doctype = ElementType.Doctype;
2028
+ }
2029
+ });
2030
+
2031
+ // node_modules/.pnpm/domhandler@6.0.1/node_modules/domhandler/dist/node.js
2032
+ function isTag2(node) {
2033
+ return isTag(node);
2034
+ }
2035
+ function isCDATA(node) {
2036
+ return node.type === ElementType.CDATA;
2037
+ }
2038
+ function isText(node) {
2039
+ return node.type === ElementType.Text;
2040
+ }
2041
+ function isComment(node) {
2042
+ return node.type === ElementType.Comment;
2043
+ }
2044
+ function hasChildren(node) {
2045
+ return Object.hasOwn(node, "children");
2046
+ }
2047
+ var init_node = __esm({
2048
+ "node_modules/.pnpm/domhandler@6.0.1/node_modules/domhandler/dist/node.js"() {
2049
+ init_dist3();
2050
+ }
2051
+ });
2052
+
2053
+ // node_modules/.pnpm/domhandler@6.0.1/node_modules/domhandler/dist/index.js
2054
+ var init_dist4 = __esm({
2055
+ "node_modules/.pnpm/domhandler@6.0.1/node_modules/domhandler/dist/index.js"() {
2056
+ init_node();
2057
+ }
2058
+ });
2059
+
2060
+ // node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/querying.js
2061
+ function filter(test, node, recurse = true, limit = Number.POSITIVE_INFINITY) {
2062
+ return find(test, Array.isArray(node) ? node : [node], recurse, limit);
2063
+ }
2064
+ function find(test, nodes, recurse, limit) {
2065
+ const result = [];
2066
+ const nodeStack = [Array.isArray(nodes) ? nodes : [nodes]];
2067
+ const indexStack = [0];
2068
+ for (; ; ) {
2069
+ if (indexStack[0] >= nodeStack[0].length) {
2070
+ if (indexStack.length === 1) {
2071
+ return result;
2072
+ }
2073
+ nodeStack.shift();
2074
+ indexStack.shift();
2075
+ continue;
2076
+ }
2077
+ const element = nodeStack[0][indexStack[0]++];
2078
+ if (test(element)) {
2079
+ result.push(element);
2080
+ if (--limit <= 0)
2081
+ return result;
2082
+ }
2083
+ if (recurse && hasChildren(element) && element.children.length > 0) {
2084
+ indexStack.unshift(0);
2085
+ nodeStack.unshift(element.children);
2086
+ }
2087
+ }
2088
+ }
2089
+ function findOne(test, nodes, recurse = true) {
2090
+ const searchedNodes = Array.isArray(nodes) ? nodes : [nodes];
2091
+ for (const node of searchedNodes) {
2092
+ if (isTag2(node) && test(node)) {
2093
+ return node;
2094
+ }
2095
+ if (recurse && hasChildren(node) && node.children.length > 0) {
2096
+ const found = findOne(test, node.children, true);
2097
+ if (found)
2098
+ return found;
2099
+ }
2100
+ }
2101
+ return null;
2102
+ }
2103
+ function existsOne(test, nodes) {
2104
+ return (Array.isArray(nodes) ? nodes : [nodes]).some((node) => isTag2(node) && test(node) || hasChildren(node) && existsOne(test, node.children));
2105
+ }
2106
+ function findAll(test, nodes) {
2107
+ const result = [];
2108
+ const nodeStack = [Array.isArray(nodes) ? nodes : [nodes]];
2109
+ const indexStack = [0];
2110
+ for (; ; ) {
2111
+ if (indexStack[0] >= nodeStack[0].length) {
2112
+ if (nodeStack.length === 1) {
2113
+ return result;
2114
+ }
2115
+ nodeStack.shift();
2116
+ indexStack.shift();
2117
+ continue;
2118
+ }
2119
+ const element = nodeStack[0][indexStack[0]++];
2120
+ if (isTag2(element) && test(element))
2121
+ result.push(element);
2122
+ if (hasChildren(element) && element.children.length > 0) {
2123
+ indexStack.unshift(0);
2124
+ nodeStack.unshift(element.children);
2125
+ }
2126
+ }
2127
+ }
2128
+ var init_querying = __esm({
2129
+ "node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/querying.js"() {
2130
+ init_dist4();
2131
+ }
2132
+ });
2133
+
2134
+ // node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/legacy.js
2135
+ function getAttribCheck(attrib, value) {
2136
+ if (typeof value === "function") {
2137
+ return (element) => isTag2(element) && value(element.attribs[attrib]);
2138
+ }
2139
+ return (element) => isTag2(element) && element.attribs[attrib] === value;
2140
+ }
2141
+ function combineFuncs(a, b) {
2142
+ return (element) => a(element) || b(element);
2143
+ }
2144
+ function compileTest(options) {
2145
+ const funcs = Object.keys(options).map((key) => {
2146
+ const value = options[key];
2147
+ return Object.hasOwn(Checks, key) ? Checks[key](value) : getAttribCheck(key, value);
2148
+ });
2149
+ return funcs.length === 0 ? null : funcs.reduce(combineFuncs);
2150
+ }
2151
+ function testElement(options, node) {
2152
+ const test = compileTest(options);
2153
+ return test ? test(node) : true;
2154
+ }
2155
+ function getElements(options, nodes, recurse, limit = Number.POSITIVE_INFINITY) {
2156
+ const test = compileTest(options);
2157
+ return test ? filter(test, nodes, recurse, limit) : [];
2158
+ }
2159
+ function getElementById(id, nodes, recurse = true) {
2160
+ if (!Array.isArray(nodes))
2161
+ nodes = [nodes];
2162
+ return findOne(getAttribCheck("id", id), nodes, recurse);
2163
+ }
2164
+ function getElementsByTagName(tagName, nodes, recurse = true, limit = Number.POSITIVE_INFINITY) {
2165
+ return filter(Checks["tag_name"](tagName), nodes, recurse, limit);
2166
+ }
2167
+ function getElementsByClassName(className, nodes, recurse = true, limit = Number.POSITIVE_INFINITY) {
2168
+ return filter(getAttribCheck("class", className), nodes, recurse, limit);
2169
+ }
2170
+ function getElementsByTagType(type, nodes, recurse = true, limit = Number.POSITIVE_INFINITY) {
2171
+ return filter(Checks["tag_type"](type), nodes, recurse, limit);
2172
+ }
2173
+ var Checks;
2174
+ var init_legacy = __esm({
2175
+ "node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/legacy.js"() {
2176
+ init_dist4();
2177
+ init_querying();
2178
+ Checks = {
2179
+ tag_name(name) {
2180
+ if (typeof name === "function") {
2181
+ return (element) => isTag2(element) && name(element.name);
2182
+ }
2183
+ if (name === "*") {
2184
+ return isTag2;
2185
+ }
2186
+ return (element) => isTag2(element) && element.name === name;
2187
+ },
2188
+ tag_type(type) {
2189
+ if (typeof type === "function") {
2190
+ return (element) => type(element.type);
2191
+ }
2192
+ return (element) => element.type === type;
2193
+ },
2194
+ tag_contains(data) {
2195
+ if (typeof data === "function") {
2196
+ return (element) => isText(element) && data(element.data);
2197
+ }
2198
+ return (element) => isText(element) && element.data === data;
2199
+ }
2200
+ };
2201
+ }
2202
+ });
2203
+
2204
+ // node_modules/.pnpm/entities@8.1.0/node_modules/entities/dist/escape.js
2205
+ function getEscape(char) {
2206
+ return char === 34 ? "&quot;" : char === 38 ? "&amp;" : char === 39 ? "&apos;" : char === 60 ? "&lt;" : char === 62 ? "&gt;" : "&nbsp;";
2207
+ }
2208
+ function isXmlEscapable(code) {
2209
+ return code >= 128 || code >= 32 && code < 64 && (XML_BITSET_VALUE >>> code & 1) === 1;
2210
+ }
2211
+ function encodeXML(input) {
2212
+ const { length } = input;
2213
+ let out;
2214
+ let last = 0;
2215
+ let index = 0;
2216
+ while (index < length) {
2217
+ const char = input.charCodeAt(index);
2218
+ if (!isXmlEscapable(char)) {
2219
+ const bound = Math.min(index + 32, length);
2220
+ let next = index + 1;
2221
+ while (next < bound && !isXmlEscapable(input.charCodeAt(next))) {
2222
+ next++;
2223
+ }
2224
+ if (next < bound) {
2225
+ index = next;
2226
+ continue;
2227
+ }
2228
+ if (next >= length)
2229
+ break;
2230
+ xmlEncodeRegex.lastIndex = next;
2231
+ if (!xmlEncodeRegex.test(input))
2232
+ break;
2233
+ index = xmlEncodeRegex.lastIndex - 1;
2234
+ continue;
2235
+ }
2236
+ if (out === void 0)
2237
+ out = input.substring(0, index);
2238
+ else if (last !== index)
2239
+ out += input.substring(last, index);
2240
+ if (char < 64) {
2241
+ out += getEscape(char);
2242
+ last = index += 1;
2243
+ continue;
2244
+ }
2245
+ const cp = input.codePointAt(index);
2246
+ out += `&#x${cp.toString(16)};`;
2247
+ if (cp !== char)
2248
+ index++;
2249
+ last = index += 1;
2250
+ }
2251
+ if (out === void 0)
2252
+ return input;
2253
+ if (last < length)
2254
+ out += input.substr(last);
2255
+ return out;
2256
+ }
2257
+ function escapeWithRegex(re, data) {
2258
+ re.lastIndex = 0;
2259
+ if (!re.test(data))
2260
+ return data;
2261
+ let out = "";
2262
+ let last = 0;
2263
+ do {
2264
+ const index = re.lastIndex - 1;
2265
+ if (last !== index)
2266
+ out += data.substring(last, index);
2267
+ const char = data.charCodeAt(index);
2268
+ out += getEscape(char);
2269
+ last = index + 1;
2270
+ } while (re.test(data));
2271
+ return out + data.substring(last);
2272
+ }
2273
+ function escapeAttribute(data) {
2274
+ return escapeWithRegex(attributeEscapeRegex, data);
2275
+ }
2276
+ function escapeText(data) {
2277
+ return escapeWithRegex(textEscapeRegex, data);
2278
+ }
2279
+ var XML_BITSET_VALUE, xmlEncodeRegex, attributeEscapeRegex, textEscapeRegex;
2280
+ var init_escape = __esm({
2281
+ "node_modules/.pnpm/entities@8.1.0/node_modules/entities/dist/escape.js"() {
2282
+ XML_BITSET_VALUE = 1342177476;
2283
+ xmlEncodeRegex = /["&'<>\u0080-\uFFFF]/g;
2284
+ attributeEscapeRegex = /["&\u{A0}]/gu;
2285
+ textEscapeRegex = /[&<>\u{A0}]/gu;
2286
+ }
2287
+ });
2288
+
2289
+ // node_modules/.pnpm/entities@8.1.0/node_modules/entities/dist/index.js
2290
+ var EntityLevel, EncodingMode;
2291
+ var init_dist5 = __esm({
2292
+ "node_modules/.pnpm/entities@8.1.0/node_modules/entities/dist/index.js"() {
2293
+ init_escape();
2294
+ (function(EntityLevel2) {
2295
+ EntityLevel2[EntityLevel2["XML"] = 0] = "XML";
2296
+ EntityLevel2[EntityLevel2["HTML"] = 1] = "HTML";
2297
+ })(EntityLevel || (EntityLevel = {}));
2298
+ (function(EncodingMode2) {
2299
+ EncodingMode2[EncodingMode2["UTF8"] = 0] = "UTF8";
2300
+ EncodingMode2[EncodingMode2["ASCII"] = 1] = "ASCII";
2301
+ EncodingMode2[EncodingMode2["Extensive"] = 2] = "Extensive";
2302
+ EncodingMode2[EncodingMode2["Attribute"] = 3] = "Attribute";
2303
+ EncodingMode2[EncodingMode2["Text"] = 4] = "Text";
2304
+ })(EncodingMode || (EncodingMode = {}));
2305
+ }
2306
+ });
2307
+
2308
+ // node_modules/.pnpm/dom-serializer@3.1.1/node_modules/dom-serializer/dist/foreign-names.js
2309
+ var elementNames, attributeNames;
2310
+ var init_foreign_names = __esm({
2311
+ "node_modules/.pnpm/dom-serializer@3.1.1/node_modules/dom-serializer/dist/foreign-names.js"() {
2312
+ elementNames = new Map("altGlyph altGlyphDef altGlyphItem animateColor animateMotion animateTransform clipPath feBlend feColorMatrix feComponentTransfer feComposite feConvolveMatrix feDiffuseLighting feDisplacementMap feDistantLight feDropShadow feFlood feFuncA feFuncB feFuncG feFuncR feGaussianBlur feImage feMerge feMergeNode feMorphology feOffset fePointLight feSpecularLighting feSpotLight feTile feTurbulence foreignObject glyphRef linearGradient radialGradient textPath".split(" ").map((name) => [name.toLowerCase(), name]));
2313
+ attributeNames = new Map("definitionURL attributeName attributeType baseFrequency baseProfile calcMode clipPathUnits diffuseConstant edgeMode filterUnits glyphRef gradientTransform gradientUnits kernelMatrix kernelUnitLength keyPoints keySplines keyTimes lengthAdjust limitingConeAngle markerHeight markerUnits markerWidth maskContentUnits maskUnits numOctaves pathLength patternContentUnits patternTransform patternUnits pointsAtX pointsAtY pointsAtZ preserveAlpha preserveAspectRatio primitiveUnits refX refY repeatCount repeatDur requiredExtensions requiredFeatures specularConstant specularExponent spreadMethod startOffset stdDeviation stitchTiles surfaceScale systemLanguage tableValues targetX targetY textLength viewBox viewTarget xChannelSelector yChannelSelector zoomAndPan".split(" ").map((name) => [name.toLowerCase(), name]));
2314
+ }
2315
+ });
2316
+
2317
+ // node_modules/.pnpm/dom-serializer@3.1.1/node_modules/dom-serializer/dist/index.js
2318
+ function render(node, options = {}) {
2319
+ const nodes = "length" in node ? node : [node];
2320
+ const xmlMode = options.xmlMode ?? false;
2321
+ let output = "";
2322
+ for (let index = 0; index < nodes.length; index++) {
2323
+ output += renderNode(nodes[index], options, xmlMode);
2324
+ }
2325
+ return output;
2326
+ }
2327
+ function renderChildren(children, options, xmlMode) {
2328
+ let output = "";
2329
+ for (let index = 0; index < children.length; index++) {
2330
+ output += renderNode(children[index], options, xmlMode);
2331
+ }
2332
+ return output;
2333
+ }
2334
+ function renderNode(node, options, xmlMode) {
2335
+ switch (node.type) {
2336
+ case Root: {
2337
+ return renderChildren(node.children, options, xmlMode);
2338
+ }
2339
+ case Directive: {
2340
+ return `<${node.data}>`;
2341
+ }
2342
+ case Comment: {
2343
+ return `<!--${node.data}-->`;
2344
+ }
2345
+ case CDATA: {
2346
+ return `<![CDATA[${node.children[0].data}]]>`;
2347
+ }
2348
+ case Script:
2349
+ case Style:
2350
+ case Tag: {
2351
+ return renderTag(node, options, xmlMode);
2352
+ }
2353
+ case Text: {
2354
+ const element = node;
2355
+ const data = element.data || "";
2356
+ if ((options.encodeEntities ?? options.decodeEntities) !== false && !(!xmlMode && element.parent && unencodedElements.has(element.parent.name))) {
2357
+ return xmlMode || options.encodeEntities !== "utf8" ? encodeXML(data) : escapeText(data);
2358
+ }
2359
+ return data;
2360
+ }
2361
+ }
2362
+ }
2363
+ function renderTag(element, options, xmlMode) {
2364
+ if (xmlMode === "foreign") {
2365
+ element.name = elementNames.get(element.name) ?? element.name;
2366
+ if (element.parent && foreignModeIntegrationPoints.has(element.parent.name)) {
2367
+ xmlMode = false;
2368
+ }
2369
+ }
2370
+ if (!xmlMode && foreignElements.has(element.name)) {
2371
+ xmlMode = "foreign";
2372
+ }
2373
+ const { name, children } = element;
2374
+ const isVoid = !xmlMode && voidElements.has(name);
2375
+ let tag = `<${name}${formatAttributes(element.attribs, options, xmlMode)}`;
2376
+ if (children.length === 0 && (xmlMode ? options.selfClosingTags !== false : options.selfClosingTags && isVoid)) {
2377
+ tag += xmlMode ? "/>" : " />";
2378
+ } else {
2379
+ tag += ">";
2380
+ if (children.length > 0) {
2381
+ tag += renderChildren(children, options, xmlMode);
2382
+ }
2383
+ if (!isVoid) {
2384
+ tag += `</${name}>`;
2385
+ }
2386
+ }
2387
+ return tag;
2388
+ }
2389
+ function replaceQuotes(value) {
2390
+ return value.replaceAll('"', "&quot;");
2391
+ }
2392
+ function formatAttributes(attributes, options, xmlMode) {
2393
+ if (!attributes)
2394
+ return "";
2395
+ const encode = (options.encodeEntities ?? options.decodeEntities) === false ? replaceQuotes : xmlMode || options.encodeEntities !== "utf8" ? encodeXML : escapeAttribute;
2396
+ const isForeign = xmlMode === "foreign";
2397
+ const showEmpty = !!(options.emptyAttrs ?? xmlMode);
2398
+ let result = "";
2399
+ for (const key in attributes) {
2400
+ if (!Object.hasOwn(attributes, key))
2401
+ continue;
2402
+ const value = attributes[key];
2403
+ const k = isForeign ? attributeNames.get(key) ?? key : key;
2404
+ result += !showEmpty && (value == null || value === "") ? ` ${k}` : ` ${k}="${encode(value == null ? "" : String(value))}"`;
2405
+ }
2406
+ return result;
2407
+ }
2408
+ var unencodedElements, voidElements, foreignElements, foreignModeIntegrationPoints, dist_default;
2409
+ var init_dist6 = __esm({
2410
+ "node_modules/.pnpm/dom-serializer@3.1.1/node_modules/dom-serializer/dist/index.js"() {
2411
+ init_dist3();
2412
+ init_dist5();
2413
+ init_foreign_names();
2414
+ unencodedElements = new Set("style script xmp iframe noembed noframes plaintext noscript".split(" "));
2415
+ voidElements = new Set("area base basefont br col command embed frame hr img input isindex keygen link meta param source track wbr".split(" "));
2416
+ foreignElements = /* @__PURE__ */ new Set(["svg", "math"]);
2417
+ foreignModeIntegrationPoints = new Set("mi mo mn ms mtext annotation-xml foreignObject desc title".split(" "));
2418
+ dist_default = render;
2419
+ }
2420
+ });
2421
+
2422
+ // node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/stringify.js
2423
+ function getOuterHTML(node, options) {
2424
+ return dist_default(node, options);
2425
+ }
2426
+ function getInnerHTML(node, options) {
2427
+ return hasChildren(node) ? node.children.map((node2) => getOuterHTML(node2, options)).join("") : "";
2428
+ }
2429
+ function getText(node) {
2430
+ if (Array.isArray(node))
2431
+ return node.map(getText).join("");
2432
+ if (isTag2(node))
2433
+ return node.name === "br" ? "\n" : getText(node.children);
2434
+ if (isCDATA(node))
2435
+ return getText(node.children);
2436
+ if (isText(node))
2437
+ return node.data;
2438
+ return "";
2439
+ }
2440
+ function textContent(node) {
2441
+ if (Array.isArray(node))
2442
+ return node.map(textContent).join("");
2443
+ if (hasChildren(node) && !isComment(node)) {
2444
+ return textContent(node.children);
2445
+ }
2446
+ if (isText(node))
2447
+ return node.data;
2448
+ return "";
2449
+ }
2450
+ function innerText(node) {
2451
+ if (Array.isArray(node))
2452
+ return node.map(innerText).join("");
2453
+ if (hasChildren(node) && (node.type === ElementType.Tag || isCDATA(node))) {
2454
+ return innerText(node.children);
2455
+ }
2456
+ if (isText(node))
2457
+ return node.data;
2458
+ return "";
2459
+ }
2460
+ var init_stringify = __esm({
2461
+ "node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/stringify.js"() {
2462
+ init_dist6();
2463
+ init_dist3();
2464
+ init_dist4();
2465
+ }
2466
+ });
2467
+
2468
+ // node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/feeds.js
2469
+ function getFeed(document) {
2470
+ const feedRoot = getOneElement(isValidFeed, document);
2471
+ return feedRoot ? feedRoot.name === "feed" ? getAtomFeed(feedRoot) : getRssFeed(feedRoot) : null;
2472
+ }
2473
+ function getAtomFeed(feedRoot) {
2474
+ const childs = feedRoot.children;
2475
+ const feed = {
2476
+ type: "atom",
2477
+ items: getElementsByTagName("entry", childs).map((item) => {
2478
+ const { children } = item;
2479
+ const entry = { media: getMediaElements(children) };
2480
+ addConditionally(entry, "id", "id", children);
2481
+ addConditionally(entry, "title", "title", children);
2482
+ const href2 = getOneElement("link", children)?.attribs["href"];
2483
+ if (href2) {
2484
+ entry.link = href2;
2485
+ }
2486
+ const description = fetch("summary", children) || fetch("content", children);
2487
+ if (description) {
2488
+ entry.description = description;
2489
+ }
2490
+ const pubDate = fetch("updated", children);
2491
+ if (pubDate) {
2492
+ entry.pubDate = new Date(pubDate);
2493
+ }
2494
+ return entry;
2495
+ })
2496
+ };
2497
+ addConditionally(feed, "id", "id", childs);
2498
+ addConditionally(feed, "title", "title", childs);
2499
+ const href = getOneElement("link", childs)?.attribs["href"];
2500
+ if (href) {
2501
+ feed.link = href;
2502
+ }
2503
+ addConditionally(feed, "description", "subtitle", childs);
2504
+ const updated = fetch("updated", childs);
2505
+ if (updated) {
2506
+ feed.updated = new Date(updated);
2507
+ }
2508
+ addConditionally(feed, "author", "email", childs, true);
2509
+ return feed;
2510
+ }
2511
+ function getRssFeed(feedRoot) {
2512
+ const childs = getOneElement("channel", feedRoot.children)?.children ?? [];
2513
+ const feed = {
2514
+ type: feedRoot.name.substr(0, 3),
2515
+ id: "",
2516
+ items: getElementsByTagName("item", feedRoot.children).map((item) => {
2517
+ const { children } = item;
2518
+ const entry = { media: getMediaElements(children) };
2519
+ addConditionally(entry, "id", "guid", children);
2520
+ addConditionally(entry, "title", "title", children);
2521
+ addConditionally(entry, "link", "link", children);
2522
+ addConditionally(entry, "description", "description", children);
2523
+ const pubDate = fetch("pubDate", children) || fetch("dc:date", children);
2524
+ if (pubDate)
2525
+ entry.pubDate = new Date(pubDate);
2526
+ return entry;
2527
+ })
2528
+ };
2529
+ addConditionally(feed, "title", "title", childs);
2530
+ addConditionally(feed, "link", "link", childs);
2531
+ addConditionally(feed, "description", "description", childs);
2532
+ const updated = fetch("lastBuildDate", childs);
2533
+ if (updated) {
2534
+ feed.updated = new Date(updated);
2535
+ }
2536
+ addConditionally(feed, "author", "managingEditor", childs, true);
2537
+ return feed;
2538
+ }
2539
+ function getMediaElements(where) {
2540
+ return getElementsByTagName("media:content", where).map((element) => {
2541
+ const { attribs } = element;
2542
+ const media = {
2543
+ medium: attribs["medium"],
2544
+ isDefault: !!attribs["isDefault"]
2545
+ };
2546
+ for (const attrib of MEDIA_KEYS_STRING) {
2547
+ if (attribs[attrib]) {
2548
+ media[attrib] = attribs[attrib];
2549
+ }
2550
+ }
2551
+ for (const attrib of MEDIA_KEYS_INT) {
2552
+ if (attribs[attrib]) {
2553
+ media[attrib] = Number.parseInt(attribs[attrib], 10);
2554
+ }
2555
+ }
2556
+ if (attribs["expression"]) {
2557
+ media.expression = attribs["expression"];
2558
+ }
2559
+ return media;
2560
+ });
2561
+ }
2562
+ function getOneElement(tagName, node) {
2563
+ return getElementsByTagName(tagName, node, true, 1)[0];
2564
+ }
2565
+ function fetch(tagName, where, recurse = false) {
2566
+ return textContent(getElementsByTagName(tagName, where, recurse, 1)).trim();
2567
+ }
2568
+ function addConditionally(object, property, tagName, where, recurse = false) {
2569
+ const value = fetch(tagName, where, recurse);
2570
+ if (value)
2571
+ object[property] = value;
2572
+ }
2573
+ function isValidFeed(value) {
2574
+ return value === "rss" || value === "feed" || value === "rdf:RDF";
2575
+ }
2576
+ var MEDIA_KEYS_STRING, MEDIA_KEYS_INT;
2577
+ var init_feeds = __esm({
2578
+ "node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/feeds.js"() {
2579
+ init_legacy();
2580
+ init_stringify();
2581
+ MEDIA_KEYS_STRING = ["url", "type", "lang"];
2582
+ MEDIA_KEYS_INT = [
2583
+ "fileSize",
2584
+ "bitrate",
2585
+ "framerate",
2586
+ "samplingrate",
2587
+ "channels",
2588
+ "duration",
2589
+ "height",
2590
+ "width"
2591
+ ];
2592
+ }
2593
+ });
2594
+
2595
+ // node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/helpers.js
2596
+ function removeSubsets(nodes) {
2597
+ let index = nodes.length;
2598
+ while (--index >= 0) {
2599
+ const node = nodes[index];
2600
+ if (index > 0 && nodes.lastIndexOf(node, index - 1) >= 0) {
2601
+ nodes.splice(index, 1);
2602
+ continue;
2603
+ }
2604
+ for (let ancestor = node.parent; ancestor; ancestor = ancestor.parent) {
2605
+ if (nodes.includes(ancestor)) {
2606
+ nodes.splice(index, 1);
2607
+ break;
2608
+ }
2609
+ }
2610
+ }
2611
+ return nodes;
2612
+ }
2613
+ function compareDocumentPosition(nodeA, nodeB) {
2614
+ const aParents = [];
2615
+ const bParents = [];
2616
+ if (nodeA === nodeB) {
2617
+ return 0;
2618
+ }
2619
+ let current = hasChildren(nodeA) ? nodeA : nodeA.parent;
2620
+ while (current) {
2621
+ aParents.unshift(current);
2622
+ current = current.parent;
2623
+ }
2624
+ current = hasChildren(nodeB) ? nodeB : nodeB.parent;
2625
+ while (current) {
2626
+ bParents.unshift(current);
2627
+ current = current.parent;
2628
+ }
2629
+ const maxIndex = Math.min(aParents.length, bParents.length);
2630
+ let index = 0;
2631
+ while (index < maxIndex && aParents[index] === bParents[index]) {
2632
+ index++;
2633
+ }
2634
+ if (index === 0) {
2635
+ return DocumentPosition.DISCONNECTED;
2636
+ }
2637
+ const sharedParent = aParents[index - 1];
2638
+ const siblings = sharedParent.children;
2639
+ const aSibling = aParents[index];
2640
+ const bSibling = bParents[index];
2641
+ if (siblings.indexOf(aSibling) > siblings.indexOf(bSibling)) {
2642
+ if (sharedParent === nodeB) {
2643
+ return DocumentPosition.FOLLOWING | DocumentPosition.CONTAINED_BY;
2644
+ }
2645
+ return DocumentPosition.FOLLOWING;
2646
+ }
2647
+ if (sharedParent === nodeA) {
2648
+ return DocumentPosition.PRECEDING | DocumentPosition.CONTAINS;
2649
+ }
2650
+ return DocumentPosition.PRECEDING;
2651
+ }
2652
+ function uniqueSort(nodes) {
2653
+ nodes = nodes.filter((node, index, array) => !array.includes(node, index + 1));
2654
+ nodes.sort((a, b) => {
2655
+ const relative = compareDocumentPosition(a, b);
2656
+ if (relative & DocumentPosition.PRECEDING) {
2657
+ return -1;
2658
+ }
2659
+ if (relative & DocumentPosition.FOLLOWING) {
2660
+ return 1;
2661
+ }
2662
+ return 0;
2663
+ });
2664
+ return nodes;
2665
+ }
2666
+ var DocumentPosition;
2667
+ var init_helpers = __esm({
2668
+ "node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/helpers.js"() {
2669
+ init_dist4();
2670
+ (function(DocumentPosition2) {
2671
+ DocumentPosition2[DocumentPosition2["DISCONNECTED"] = 1] = "DISCONNECTED";
2672
+ DocumentPosition2[DocumentPosition2["PRECEDING"] = 2] = "PRECEDING";
2673
+ DocumentPosition2[DocumentPosition2["FOLLOWING"] = 4] = "FOLLOWING";
2674
+ DocumentPosition2[DocumentPosition2["CONTAINS"] = 8] = "CONTAINS";
2675
+ DocumentPosition2[DocumentPosition2["CONTAINED_BY"] = 16] = "CONTAINED_BY";
2676
+ })(DocumentPosition || (DocumentPosition = {}));
2677
+ }
2678
+ });
2679
+
2680
+ // node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/manipulation.js
2681
+ function removeElement(element) {
2682
+ if (element.prev)
2683
+ element.prev.next = element.next;
2684
+ if (element.next)
2685
+ element.next.prev = element.prev;
2686
+ if (element.parent) {
2687
+ const childs = element.parent.children;
2688
+ const childsIndex = childs.lastIndexOf(element);
2689
+ if (childsIndex !== -1) {
2690
+ childs.splice(childsIndex, 1);
2691
+ }
2692
+ }
2693
+ element.next = null;
2694
+ element.prev = null;
2695
+ element.parent = null;
2696
+ }
2697
+ function replaceElement(element, replacement) {
2698
+ replacement.prev = element.prev;
2699
+ if (replacement.prev) {
2700
+ replacement.prev.next = replacement;
2701
+ }
2702
+ replacement.next = element.next;
2703
+ if (replacement.next) {
2704
+ replacement.next.prev = replacement;
2705
+ }
2706
+ replacement.parent = element.parent;
2707
+ if (replacement.parent) {
2708
+ const { children } = replacement.parent;
2709
+ const elementIndex = children.lastIndexOf(element);
2710
+ if (elementIndex === -1) {
2711
+ return;
2712
+ }
2713
+ children[elementIndex] = replacement;
2714
+ element.parent = null;
2715
+ }
2716
+ }
2717
+ function appendChild(parent, child) {
2718
+ removeElement(child);
2719
+ child.next = null;
2720
+ child.parent = parent;
2721
+ if (parent.children.push(child) > 1) {
2722
+ const sibling = parent.children[parent.children.length - 2];
2723
+ sibling.next = child;
2724
+ child.prev = sibling;
2725
+ } else {
2726
+ child.prev = null;
2727
+ }
2728
+ }
2729
+ function append(element, next) {
2730
+ removeElement(next);
2731
+ const { parent } = element;
2732
+ const currentNext = element.next;
2733
+ next.next = currentNext;
2734
+ next.prev = element;
2735
+ element.next = next;
2736
+ next.parent = parent;
2737
+ if (currentNext) {
2738
+ currentNext.prev = next;
2739
+ if (parent) {
2740
+ const childs = parent.children;
2741
+ childs.splice(childs.lastIndexOf(currentNext), 0, next);
2742
+ }
2743
+ } else if (parent) {
2744
+ parent.children.push(next);
2745
+ }
2746
+ }
2747
+ function prependChild(parent, child) {
2748
+ removeElement(child);
2749
+ child.parent = parent;
2750
+ child.prev = null;
2751
+ if (parent.children.unshift(child) === 1) {
2752
+ child.next = null;
2753
+ } else {
2754
+ const sibling = parent.children[1];
2755
+ sibling.prev = child;
2756
+ child.next = sibling;
2757
+ }
2758
+ }
2759
+ function prepend(element, previous) {
2760
+ removeElement(previous);
2761
+ const { parent } = element;
2762
+ if (parent) {
2763
+ const childs = parent.children;
2764
+ childs.splice(childs.indexOf(element), 0, previous);
2765
+ }
2766
+ if (element.prev) {
2767
+ element.prev.next = previous;
2768
+ }
2769
+ previous.parent = parent;
2770
+ previous.prev = element.prev;
2771
+ previous.next = element;
2772
+ element.prev = previous;
2773
+ }
2774
+ var init_manipulation = __esm({
2775
+ "node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/manipulation.js"() {
2776
+ }
2777
+ });
2778
+
2779
+ // node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/traversal.js
2780
+ function getChildren(element) {
2781
+ return hasChildren(element) ? element.children : [];
2782
+ }
2783
+ function getParent(element) {
2784
+ return element.parent || null;
2785
+ }
2786
+ function getSiblings(element) {
2787
+ const parent = getParent(element);
2788
+ if (parent != null)
2789
+ return getChildren(parent);
2790
+ const siblings = [element];
2791
+ let { prev, next } = element;
2792
+ while (prev != null) {
2793
+ siblings.unshift(prev);
2794
+ ({ prev } = prev);
2795
+ }
2796
+ while (next != null) {
2797
+ siblings.push(next);
2798
+ ({ next } = next);
2799
+ }
2800
+ return siblings;
2801
+ }
2802
+ function getAttributeValue(element, name) {
2803
+ const { attribs } = element;
2804
+ return attribs?.[name];
2805
+ }
2806
+ function hasAttrib(element, name) {
2807
+ const { attribs } = element;
2808
+ return attribs != null && Object.hasOwn(attribs, name) && attribs[name] != null;
2809
+ }
2810
+ function getName(element) {
2811
+ return element.name;
2812
+ }
2813
+ function nextElementSibling(element) {
2814
+ let { next } = element;
2815
+ while (next !== null && !isTag2(next))
2816
+ ({ next } = next);
2817
+ return next;
2818
+ }
2819
+ function prevElementSibling(element) {
2820
+ let { prev } = element;
2821
+ while (prev !== null && !isTag2(prev))
2822
+ ({ prev } = prev);
2823
+ return prev;
2824
+ }
2825
+ var init_traversal = __esm({
2826
+ "node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/traversal.js"() {
2827
+ init_dist4();
2828
+ }
2829
+ });
2830
+
2831
+ // node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/index.js
2832
+ var dist_exports2 = {};
2833
+ __export(dist_exports2, {
2834
+ DocumentPosition: () => DocumentPosition,
2835
+ append: () => append,
2836
+ appendChild: () => appendChild,
2837
+ compareDocumentPosition: () => compareDocumentPosition,
2838
+ existsOne: () => existsOne,
2839
+ filter: () => filter,
2840
+ find: () => find,
2841
+ findAll: () => findAll,
2842
+ findOne: () => findOne,
2843
+ getAttributeValue: () => getAttributeValue,
2844
+ getChildren: () => getChildren,
2845
+ getElementById: () => getElementById,
2846
+ getElements: () => getElements,
2847
+ getElementsByClassName: () => getElementsByClassName,
2848
+ getElementsByTagName: () => getElementsByTagName,
2849
+ getElementsByTagType: () => getElementsByTagType,
2850
+ getFeed: () => getFeed,
2851
+ getInnerHTML: () => getInnerHTML,
2852
+ getName: () => getName,
2853
+ getOuterHTML: () => getOuterHTML,
2854
+ getParent: () => getParent,
2855
+ getSiblings: () => getSiblings,
2856
+ getText: () => getText,
2857
+ hasAttrib: () => hasAttrib,
2858
+ innerText: () => innerText,
2859
+ nextElementSibling: () => nextElementSibling,
2860
+ prepend: () => prepend,
2861
+ prependChild: () => prependChild,
2862
+ prevElementSibling: () => prevElementSibling,
2863
+ removeElement: () => removeElement,
2864
+ removeSubsets: () => removeSubsets,
2865
+ replaceElement: () => replaceElement,
2866
+ testElement: () => testElement,
2867
+ textContent: () => textContent,
2868
+ uniqueSort: () => uniqueSort
2869
+ });
2870
+ var init_dist7 = __esm({
2871
+ "node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/index.js"() {
2872
+ init_feeds();
2873
+ init_helpers();
2874
+ init_legacy();
2875
+ init_manipulation();
2876
+ init_querying();
2877
+ init_stringify();
2878
+ init_traversal();
2879
+ }
2880
+ });
2881
+
2882
+ // node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/attributes.js
2883
+ function escapeRegex(value) {
2884
+ return value.replace(reChars, "\\$&");
2885
+ }
2886
+ function shouldIgnoreCase(selector, options) {
2887
+ return typeof selector.ignoreCase === "boolean" ? selector.ignoreCase : selector.ignoreCase === "quirks" ? !!options.quirksMode : !options.xmlMode && caseInsensitiveAttributes.has(selector.name);
2888
+ }
2889
+ var reChars, whitespaceRe, caseInsensitiveAttributes, attributeRules;
2890
+ var init_attributes = __esm({
2891
+ "node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/attributes.js"() {
2892
+ init_dist();
2893
+ reChars = /[-[\]{}()*+?.,\\^$|#\s]/g;
2894
+ whitespaceRe = /\s/;
2895
+ caseInsensitiveAttributes = /* @__PURE__ */ new Set([
2896
+ "accept",
2897
+ "accept-charset",
2898
+ "align",
2899
+ "alink",
2900
+ "axis",
2901
+ "bgcolor",
2902
+ "charset",
2903
+ "checked",
2904
+ "clear",
2905
+ "codetype",
2906
+ "color",
2907
+ "compact",
2908
+ "declare",
2909
+ "defer",
2910
+ "dir",
2911
+ "direction",
2912
+ "disabled",
2913
+ "enctype",
2914
+ "face",
2915
+ "frame",
2916
+ "hreflang",
2917
+ "http-equiv",
2918
+ "lang",
2919
+ "language",
2920
+ "link",
2921
+ "media",
2922
+ "method",
2923
+ "multiple",
2924
+ "nohref",
2925
+ "noresize",
2926
+ "noshade",
2927
+ "nowrap",
2928
+ "readonly",
2929
+ "rel",
2930
+ "rev",
2931
+ "rules",
2932
+ "scope",
2933
+ "scrolling",
2934
+ "selected",
2935
+ "shape",
2936
+ "target",
2937
+ "text",
2938
+ "type",
2939
+ "valign",
2940
+ "valuetype",
2941
+ "vlink"
2942
+ ]);
2943
+ attributeRules = {
2944
+ equals(next, data, options) {
2945
+ const { adapter } = options;
2946
+ const { name } = data;
2947
+ let { value } = data;
2948
+ if (shouldIgnoreCase(data, options)) {
2949
+ value = value.toLowerCase();
2950
+ return (element) => {
2951
+ const attribute = adapter.getAttributeValue(element, name);
2952
+ return attribute != null && attribute.length === value.length && attribute.toLowerCase() === value && next(element);
2953
+ };
2954
+ }
2955
+ return (element) => adapter.getAttributeValue(element, name) === value && next(element);
2956
+ },
2957
+ hyphen(next, data, options) {
2958
+ const { adapter } = options;
2959
+ const { name } = data;
2960
+ let { value } = data;
2961
+ const { length } = value;
2962
+ if (shouldIgnoreCase(data, options)) {
2963
+ value = value.toLowerCase();
2964
+ return function hyphenIC(element) {
2965
+ const attribute = adapter.getAttributeValue(element, name);
2966
+ return attribute != null && (attribute.length === length || attribute.charAt(length) === "-") && attribute.substr(0, length).toLowerCase() === value && next(element);
2967
+ };
2968
+ }
2969
+ return function hyphen(element) {
2970
+ const attribute = adapter.getAttributeValue(element, name);
2971
+ return attribute != null && (attribute.length === length || attribute.charAt(length) === "-") && attribute.substr(0, length) === value && next(element);
2972
+ };
2973
+ },
2974
+ element(next, data, options) {
2975
+ const { adapter } = options;
2976
+ const { name, value } = data;
2977
+ if (whitespaceRe.test(value)) {
2978
+ return falseFunc;
2979
+ }
2980
+ const regex = new RegExp(`(?:^|\\s)${escapeRegex(value)}(?:$|\\s)`, shouldIgnoreCase(data, options) ? "i" : "");
2981
+ return function element(node) {
2982
+ const attribute = adapter.getAttributeValue(node, name);
2983
+ return attribute != null && attribute.length >= value.length && regex.test(attribute) && next(node);
2984
+ };
2985
+ },
2986
+ exists(next, { name }, { adapter }) {
2987
+ return (element) => adapter.hasAttrib(element, name) && next(element);
2988
+ },
2989
+ start(next, data, options) {
2990
+ const { adapter } = options;
2991
+ const { name } = data;
2992
+ let { value } = data;
2993
+ const { length } = value;
2994
+ if (length === 0) {
2995
+ return falseFunc;
2996
+ }
2997
+ if (shouldIgnoreCase(data, options)) {
2998
+ value = value.toLowerCase();
2999
+ return (element) => {
3000
+ const attribute = adapter.getAttributeValue(element, name);
3001
+ return attribute != null && attribute.length >= length && attribute.substr(0, length).toLowerCase() === value && next(element);
3002
+ };
3003
+ }
3004
+ return (element) => !!adapter.getAttributeValue(element, name)?.startsWith(value) && next(element);
3005
+ },
3006
+ end(next, data, options) {
3007
+ const { adapter } = options;
3008
+ const { name } = data;
3009
+ let { value } = data;
3010
+ const length = -value.length;
3011
+ if (length === 0) {
3012
+ return falseFunc;
3013
+ }
3014
+ if (shouldIgnoreCase(data, options)) {
3015
+ value = value.toLowerCase();
3016
+ return (element) => adapter.getAttributeValue(element, name)?.substr(length).toLowerCase() === value && next(element);
3017
+ }
3018
+ return (element) => !!adapter.getAttributeValue(element, name)?.endsWith(value) && next(element);
3019
+ },
3020
+ any(next, data, options) {
3021
+ const { adapter } = options;
3022
+ const { name, value } = data;
3023
+ if (value === "") {
3024
+ return falseFunc;
3025
+ }
3026
+ if (shouldIgnoreCase(data, options)) {
3027
+ const regex = new RegExp(escapeRegex(value), "i");
3028
+ return function anyIC(element) {
3029
+ const attribute = adapter.getAttributeValue(element, name);
3030
+ return attribute != null && attribute.length >= value.length && regex.test(attribute) && next(element);
3031
+ };
3032
+ }
3033
+ return (element) => !!adapter.getAttributeValue(element, name)?.includes(value) && next(element);
3034
+ },
3035
+ not(next, data, options) {
3036
+ const { adapter } = options;
3037
+ const { name } = data;
3038
+ let { value } = data;
3039
+ if (value === "") {
3040
+ return (element) => !!adapter.getAttributeValue(element, name) && next(element);
3041
+ }
3042
+ if (shouldIgnoreCase(data, options)) {
3043
+ value = value.toLowerCase();
3044
+ return (element) => {
3045
+ const attribute = adapter.getAttributeValue(element, name);
3046
+ return (attribute == null || attribute.length !== value.length || attribute.toLowerCase() !== value) && next(element);
3047
+ };
3048
+ }
3049
+ return (element) => adapter.getAttributeValue(element, name) !== value && next(element);
3050
+ }
3051
+ };
3052
+ }
3053
+ });
3054
+
3055
+ // node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/helpers/querying.js
3056
+ function findAll2(query, nodes, options) {
3057
+ const { adapter, xmlMode = false } = options;
3058
+ const result = [];
3059
+ const nodeStack = [nodes];
3060
+ const indexStack = [0];
3061
+ for (; ; ) {
3062
+ if (indexStack[0] >= nodeStack[0].length) {
3063
+ if (nodeStack.length === 1) {
3064
+ return result;
3065
+ }
3066
+ nodeStack.shift();
3067
+ indexStack.shift();
3068
+ continue;
3069
+ }
3070
+ const element = nodeStack[0][indexStack[0]++];
3071
+ if (!adapter.isTag(element)) {
3072
+ continue;
3073
+ }
3074
+ if (query(element)) {
3075
+ result.push(element);
3076
+ }
3077
+ if (xmlMode || adapter.getName(element) !== "template") {
3078
+ const children = adapter.getChildren(element);
3079
+ if (children.length > 0) {
3080
+ nodeStack.unshift(children);
3081
+ indexStack.unshift(0);
3082
+ }
3083
+ }
3084
+ }
3085
+ }
3086
+ function findOne2(query, nodes, options) {
3087
+ const { adapter, xmlMode = false } = options;
3088
+ const nodeStack = [nodes];
3089
+ const indexStack = [0];
3090
+ for (; ; ) {
3091
+ if (indexStack[0] >= nodeStack[0].length) {
3092
+ if (nodeStack.length === 1) {
3093
+ return null;
3094
+ }
3095
+ nodeStack.shift();
3096
+ indexStack.shift();
3097
+ continue;
3098
+ }
3099
+ const element = nodeStack[0][indexStack[0]++];
3100
+ if (!adapter.isTag(element)) {
3101
+ continue;
3102
+ }
3103
+ if (query(element)) {
3104
+ return element;
3105
+ }
3106
+ if (xmlMode || adapter.getName(element) !== "template") {
3107
+ const children = adapter.getChildren(element);
3108
+ if (children.length > 0) {
3109
+ nodeStack.unshift(children);
3110
+ indexStack.unshift(0);
3111
+ }
3112
+ }
3113
+ }
3114
+ }
3115
+ function getNextSiblings(element, adapter) {
3116
+ const siblings = adapter.getSiblings(element);
3117
+ if (siblings.length <= 1) {
3118
+ return [];
3119
+ }
3120
+ const elementIndex = siblings.indexOf(element);
3121
+ if (elementIndex === -1 || elementIndex === siblings.length - 1) {
3122
+ return [];
3123
+ }
3124
+ return siblings.slice(elementIndex + 1).filter(adapter.isTag);
3125
+ }
3126
+ function getElementParent(node, adapter) {
3127
+ const parent = adapter.getParent(node);
3128
+ return parent != null && adapter.isTag(parent) ? parent : null;
3129
+ }
3130
+ var init_querying2 = __esm({
3131
+ "node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/helpers/querying.js"() {
3132
+ }
3133
+ });
3134
+
3135
+ // node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/pseudo-selectors/aliases.js
3136
+ var textControl, aliases;
3137
+ var init_aliases = __esm({
3138
+ "node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/pseudo-selectors/aliases.js"() {
3139
+ textControl = "input:is([type=text i],[type=search i],[type=url i],[type=tel i],[type=email i],[type=password i],[type=date i],[type=month i],[type=week i],[type=time i],[type=datetime-local i],[type=number i])";
3140
+ aliases = {
3141
+ // Links
3142
+ "any-link": ":is(a, area, link)[href]",
3143
+ link: ":any-link:not(:visited)",
3144
+ // Forms
3145
+ // https://html.spec.whatwg.org/multipage/scripting.html#disabled-elements
3146
+ disabled: `:is(
3147
+ :is(button, input, select, textarea, optgroup, option)[disabled],
3148
+ optgroup[disabled] > option,
3149
+ fieldset[disabled]:not(fieldset[disabled] legend:first-of-type *)
3150
+ )`,
3151
+ enabled: ":is(button, input, select, textarea, optgroup, option, fieldset):not(:disabled)",
3152
+ checked: ":is(:is(input[type=radio], input[type=checkbox])[checked], :selected)",
3153
+ required: ":is(input, select, textarea)[required]",
3154
+ optional: ":is(input, select, textarea):not([required])",
3155
+ "read-only": `[readonly]:is(textarea, ${textControl})`,
3156
+ "read-write": `:not([readonly]):is(textarea, ${textControl})`,
3157
+ // JQuery extensions
3158
+ /**
3159
+ * `:selected` matches option elements that have the `selected` attribute,
3160
+ * or are the first option element in a select element that does not have
3161
+ * the `multiple` attribute and does not have any option elements with the
3162
+ * `selected` attribute.
3163
+ * @see https://html.spec.whatwg.org/multipage/form-elements.html#concept-option-selectedness
3164
+ */
3165
+ selected: "option:is([selected], select:not([multiple]):not(:has(> option[selected])) > :first-of-type)",
3166
+ checkbox: "[type=checkbox]",
3167
+ file: "[type=file]",
3168
+ password: "[type=password]",
3169
+ radio: "[type=radio]",
3170
+ reset: "[type=reset]",
3171
+ image: "[type=image]",
3172
+ submit: "[type=submit]",
3173
+ parent: ":not(:empty)",
3174
+ header: ":is(h1, h2, h3, h4, h5, h6)",
3175
+ button: ":is(button, input[type=button])",
3176
+ input: ":is(input, textarea, select, button)",
3177
+ text: "input:is(:not([type!='']), [type=text])"
3178
+ };
3179
+ }
3180
+ });
3181
+
3182
+ // node_modules/.pnpm/nth-check@3.0.1/node_modules/nth-check/dist/compile.js
3183
+ function compile(parsed) {
3184
+ const a = parsed[0];
3185
+ const b = parsed[1] - 1;
3186
+ if (b < 0 && a <= 0)
3187
+ return falseFunc;
3188
+ if (a === -1)
3189
+ return (index) => index <= b;
3190
+ if (a === 0)
3191
+ return (index) => index === b;
3192
+ if (a === 1)
3193
+ return b < 0 ? trueFunc : (index) => index >= b;
3194
+ const absA = Math.abs(a);
3195
+ const bModulo = (b % absA + absA) % absA;
3196
+ return a > 1 ? (index) => index >= b && index % absA === bModulo : (index) => index <= b && index % absA === bModulo;
3197
+ }
3198
+ var init_compile = __esm({
3199
+ "node_modules/.pnpm/nth-check@3.0.1/node_modules/nth-check/dist/compile.js"() {
3200
+ init_dist();
3201
+ }
3202
+ });
3203
+
3204
+ // node_modules/.pnpm/nth-check@3.0.1/node_modules/nth-check/dist/parse.js
3205
+ function parse2(formula) {
3206
+ formula = formula.trim().toLowerCase();
3207
+ switch (formula) {
3208
+ case "even": {
3209
+ return [2, 0];
3210
+ }
3211
+ case "odd": {
3212
+ return [2, 1];
3213
+ }
3214
+ }
3215
+ let index = 0;
3216
+ let a = 0;
3217
+ let sign = readSign();
3218
+ let number = readNumber();
3219
+ if (index < formula.length && formula.charAt(index) === "n") {
3220
+ index++;
3221
+ a = sign * (number ?? 1);
3222
+ skipWhitespace();
3223
+ if (index < formula.length) {
3224
+ sign = readSign();
3225
+ skipWhitespace();
3226
+ number = readNumber();
3227
+ } else {
3228
+ sign = number = 0;
3229
+ }
3230
+ }
3231
+ if (number === null || index < formula.length) {
3232
+ throw new Error(`n-th rule couldn't be parsed ('${formula}')`);
3233
+ }
3234
+ return [a, sign * number];
3235
+ function readSign() {
3236
+ switch (formula.charAt(index)) {
3237
+ case "-": {
3238
+ index++;
3239
+ return -1;
3240
+ }
3241
+ case "+": {
3242
+ index++;
3243
+ break;
3244
+ }
3245
+ }
3246
+ return 1;
3247
+ }
3248
+ function readNumber() {
3249
+ const start = index;
3250
+ let value = 0;
3251
+ while (index < formula.length && formula.charCodeAt(index) >= ZERO && formula.charCodeAt(index) <= NINE) {
3252
+ value = value * 10 + (formula.charCodeAt(index) - ZERO);
3253
+ index++;
3254
+ }
3255
+ return index === start ? null : value;
3256
+ }
3257
+ function skipWhitespace() {
3258
+ while (index < formula.length && whitespace.has(formula.charCodeAt(index))) {
3259
+ index++;
3260
+ }
3261
+ }
3262
+ }
3263
+ var whitespace, ZERO, NINE;
3264
+ var init_parse2 = __esm({
3265
+ "node_modules/.pnpm/nth-check@3.0.1/node_modules/nth-check/dist/parse.js"() {
3266
+ whitespace = /* @__PURE__ */ new Set([9, 10, 12, 13, 32]);
3267
+ ZERO = "0".charCodeAt(0);
3268
+ NINE = "9".charCodeAt(0);
3269
+ }
3270
+ });
3271
+
3272
+ // node_modules/.pnpm/nth-check@3.0.1/node_modules/nth-check/dist/index.js
3273
+ function nthCheck(formula) {
3274
+ return compile(parse2(formula));
3275
+ }
3276
+ var init_dist8 = __esm({
3277
+ "node_modules/.pnpm/nth-check@3.0.1/node_modules/nth-check/dist/index.js"() {
3278
+ init_compile();
3279
+ init_parse2();
3280
+ }
3281
+ });
3282
+
3283
+ // node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/helpers/cache.js
3284
+ function cacheParentResults(next, { adapter, cacheResults }, matches) {
3285
+ if (cacheResults === false || typeof WeakMap === "undefined") {
3286
+ return (element) => next(element) && matches(element);
3287
+ }
3288
+ const resultCache = /* @__PURE__ */ new WeakMap();
3289
+ function addResultToCache(element) {
3290
+ const result = matches(element);
3291
+ resultCache.set(element, result);
3292
+ return result;
3293
+ }
3294
+ return function cachedMatcher(element) {
3295
+ if (!next(element)) {
3296
+ return false;
3297
+ }
3298
+ if (resultCache.has(element)) {
3299
+ return resultCache.get(element) ?? false;
3300
+ }
3301
+ let node = element;
3302
+ do {
3303
+ const parent = getElementParent(node, adapter);
3304
+ if (parent === null) {
3305
+ return addResultToCache(element);
3306
+ }
3307
+ node = parent;
3308
+ } while (!resultCache.has(node));
3309
+ return resultCache.get(node) ? addResultToCache(element) : false;
3310
+ };
3311
+ }
3312
+ var init_cache = __esm({
3313
+ "node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/helpers/cache.js"() {
3314
+ init_querying2();
3315
+ }
3316
+ });
3317
+
3318
+ // node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/helpers/options.js
3319
+ function copyOptions(options) {
3320
+ const { context: _, rootFunc: __, ...copied } = options;
3321
+ return copied;
3322
+ }
3323
+ var init_options = __esm({
3324
+ "node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/helpers/options.js"() {
3325
+ }
3326
+ });
3327
+
3328
+ // node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/pseudo-selectors/filters.js
3329
+ function extendedFilter(tag, range) {
3330
+ if (range[0] !== "*" && range[0] !== tag[0])
3331
+ return false;
3332
+ let tagIndex = 1;
3333
+ for (let rangeIndex = 1; rangeIndex < range.length; rangeIndex++) {
3334
+ if (range[rangeIndex] === "*")
3335
+ continue;
3336
+ while (tagIndex < tag.length && tag[tagIndex] !== range[rangeIndex]) {
3337
+ if (tag[tagIndex++].length <= 1)
3338
+ return false;
3339
+ }
3340
+ if (tagIndex >= tag.length)
3341
+ return false;
3342
+ tagIndex++;
3343
+ }
3344
+ return true;
3345
+ }
3346
+ function compileNth(reverse, ofType) {
3347
+ return function nth(next, rule, options, context, compileToken2) {
3348
+ const { adapter, equals } = options;
3349
+ const ofMatch = ofType ? null : rule.match(nthOfRegex);
3350
+ const nthCheck2 = nthCheck(ofMatch ? ofMatch[1].trim() : rule);
3351
+ if (nthCheck2 === falseFunc)
3352
+ return falseFunc;
3353
+ const ofSelector = ofMatch && compileToken2 ? compileToken2(parse(ofMatch[2].trim()), copyOptions(options), context) : void 0;
3354
+ if (ofSelector === falseFunc)
3355
+ return falseFunc;
3356
+ if (nthCheck2 === trueFunc && !ofSelector) {
3357
+ return (element) => getElementParent(element, adapter) !== null && next(element);
3358
+ }
3359
+ const shouldCount = ofSelector ? (_element, sibling) => ofSelector(sibling) : ofType ? (element, sibling) => adapter.getName(sibling) === adapter.getName(element) : trueFunc;
3360
+ if (reverse) {
3361
+ return function nthLast(element) {
3362
+ if (ofSelector && !ofSelector(element))
3363
+ return false;
3364
+ const siblings = adapter.getSiblings(element);
3365
+ let pos = 0;
3366
+ for (let index = siblings.length - 1; index >= 0; index--) {
3367
+ const sibling = siblings[index];
3368
+ if (equals(element, sibling))
3369
+ break;
3370
+ if (adapter.isTag(sibling) && shouldCount(element, sibling))
3371
+ pos++;
3372
+ }
3373
+ return nthCheck2(pos) && next(element);
3374
+ };
3375
+ }
3376
+ return function nth2(element) {
3377
+ if (ofSelector && !ofSelector(element))
3378
+ return false;
3379
+ const siblings = adapter.getSiblings(element);
3380
+ let pos = 0;
3381
+ for (const sibling of siblings) {
3382
+ if (equals(element, sibling))
3383
+ break;
3384
+ if (adapter.isTag(sibling) && shouldCount(element, sibling))
3385
+ pos++;
3386
+ }
3387
+ return nthCheck2(pos) && next(element);
3388
+ };
3389
+ };
3390
+ }
3391
+ function dynamicStatePseudo(name) {
3392
+ return function dynamicPseudo(next, _rule, { adapter }) {
3393
+ const filterFunction = adapter[name];
3394
+ if (typeof filterFunction !== "function") {
3395
+ return falseFunc;
3396
+ }
3397
+ return function active(element) {
3398
+ return filterFunction(element) && next(element);
3399
+ };
3400
+ };
3401
+ }
3402
+ var nthOfRegex, filters;
3403
+ var init_filters = __esm({
3404
+ "node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/pseudo-selectors/filters.js"() {
3405
+ init_dist();
3406
+ init_dist2();
3407
+ init_dist8();
3408
+ init_cache();
3409
+ init_options();
3410
+ init_querying2();
3411
+ nthOfRegex = /^(.+?)\s+of\s+(.+)$/is;
3412
+ filters = {
3413
+ contains(next, text, options) {
3414
+ const { getText: getText2 } = options.adapter;
3415
+ return cacheParentResults(next, options, (element) => getText2(element).includes(text));
3416
+ },
3417
+ icontains(next, text, options) {
3418
+ const itext = text.toLowerCase();
3419
+ const { getText: getText2 } = options.adapter;
3420
+ return cacheParentResults(next, options, (element) => getText2(element).toLowerCase().includes(itext));
3421
+ },
3422
+ // Location specific methods
3423
+ "nth-child": compileNth(false, false),
3424
+ "nth-last-child": compileNth(true, false),
3425
+ "nth-of-type": compileNth(false, true),
3426
+ "nth-last-of-type": compileNth(true, true),
3427
+ // TODO determine the actual root element
3428
+ root(next, _rule, { adapter }) {
3429
+ return (element) => getElementParent(element, adapter) === null && next(element);
3430
+ },
3431
+ scope(next, rule, options, context) {
3432
+ const { equals } = options;
3433
+ if (!context || context.length === 0) {
3434
+ return filters["root"](next, rule, options);
3435
+ }
3436
+ if (context.length === 1) {
3437
+ return (element) => equals(context[0], element) && next(element);
3438
+ }
3439
+ return (element) => context.includes(element) && next(element);
3440
+ },
3441
+ lang(next, code, { adapter }) {
3442
+ const ranges = code.split(",").map((r) => r.trim()).filter((r) => r.length > 0).map((r) => r.replace(/^['"]|['"]$/g, "").toLowerCase().split("-"));
3443
+ return function lang(element) {
3444
+ let node = element;
3445
+ while (node != null) {
3446
+ const value = adapter.getAttributeValue(node, "xml:lang") ?? adapter.getAttributeValue(node, "lang");
3447
+ if (value != null) {
3448
+ if (!value) {
3449
+ return ranges.some((r) => r[0] === "") && next(element);
3450
+ }
3451
+ const tag = value.toLowerCase().split("-");
3452
+ return ranges.some((r) => extendedFilter(tag, r)) && next(element);
3453
+ }
3454
+ const parent = adapter.getParent(node);
3455
+ node = parent != null && adapter.isTag(parent) ? parent : null;
3456
+ }
3457
+ return ranges.some((r) => r[0] === "") && next(element);
3458
+ };
3459
+ },
3460
+ hover: dynamicStatePseudo("isHovered"),
3461
+ visited: dynamicStatePseudo("isVisited"),
3462
+ active: dynamicStatePseudo("isActive")
3463
+ };
3464
+ }
3465
+ });
3466
+
3467
+ // node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/pseudo-selectors/pseudos.js
3468
+ function verifyPseudoArguments(pseudoClassCondition, name, subselect, argumentIndex) {
3469
+ if (subselect === null) {
3470
+ if (pseudoClassCondition.length > argumentIndex) {
3471
+ throw new Error(`Pseudo-class :${name} requires an argument`);
3472
+ }
3473
+ } else if (pseudoClassCondition.length === argumentIndex) {
3474
+ throw new Error(`Pseudo-class :${name} doesn't have any arguments`);
3475
+ }
3476
+ }
3477
+ var isDocumentWhiteSpace, pseudos;
3478
+ var init_pseudos = __esm({
3479
+ "node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/pseudo-selectors/pseudos.js"() {
3480
+ isDocumentWhiteSpace = /^[ \t\r\n]*$/;
3481
+ pseudos = {
3482
+ empty(element, { adapter }) {
3483
+ const children = adapter.getChildren(element);
3484
+ return (
3485
+ // First, make sure the tag does not have any element children.
3486
+ children.every((element2) => !adapter.isTag(element2)) && // Then, check that the text content is only whitespace.
3487
+ children.every((element2) => (
3488
+ // FIXME: `getText` call is potentially expensive.
3489
+ isDocumentWhiteSpace.test(adapter.getText(element2))
3490
+ ))
3491
+ );
3492
+ },
3493
+ "first-child"(element, { adapter, equals }) {
3494
+ if (adapter.prevElementSibling) {
3495
+ return adapter.prevElementSibling(element) == null;
3496
+ }
3497
+ const firstChild = adapter.getSiblings(element).find((sibling) => adapter.isTag(sibling));
3498
+ return firstChild != null && equals(element, firstChild);
3499
+ },
3500
+ "last-child"(element, { adapter, equals }) {
3501
+ const siblings = adapter.getSiblings(element);
3502
+ for (let index = siblings.length - 1; index >= 0; index--) {
3503
+ if (equals(element, siblings[index])) {
3504
+ return true;
3505
+ }
3506
+ if (adapter.isTag(siblings[index])) {
3507
+ break;
3508
+ }
3509
+ }
3510
+ return false;
3511
+ },
3512
+ "first-of-type"(element, { adapter, equals }) {
3513
+ const siblings = adapter.getSiblings(element);
3514
+ const elementName = adapter.getName(element);
3515
+ for (const currentSibling of siblings) {
3516
+ if (equals(element, currentSibling)) {
3517
+ return true;
3518
+ }
3519
+ if (adapter.isTag(currentSibling) && adapter.getName(currentSibling) === elementName) {
3520
+ break;
3521
+ }
3522
+ }
3523
+ return false;
3524
+ },
3525
+ "last-of-type"(element, { adapter, equals }) {
3526
+ const siblings = adapter.getSiblings(element);
3527
+ const elementName = adapter.getName(element);
3528
+ for (let index = siblings.length - 1; index >= 0; index--) {
3529
+ const currentSibling = siblings[index];
3530
+ if (equals(element, currentSibling)) {
3531
+ return true;
3532
+ }
3533
+ if (adapter.isTag(currentSibling) && adapter.getName(currentSibling) === elementName) {
3534
+ break;
3535
+ }
3536
+ }
3537
+ return false;
3538
+ },
3539
+ "only-of-type"(element, { adapter, equals }) {
3540
+ const elementName = adapter.getName(element);
3541
+ return adapter.getSiblings(element).every((sibling) => equals(element, sibling) || !adapter.isTag(sibling) || adapter.getName(sibling) !== elementName);
3542
+ },
3543
+ "only-child"(element, { adapter, equals }) {
3544
+ return adapter.getSiblings(element).every((sibling) => equals(element, sibling) || !adapter.isTag(sibling));
3545
+ }
3546
+ };
3547
+ }
3548
+ });
3549
+
3550
+ // node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/helpers/selectors.js
3551
+ function isTraversal2(token) {
3552
+ return token.type === "_flexibleDescendant" || isTraversal(token);
3553
+ }
3554
+ function sortRules(array) {
3555
+ const ratings = array.map(getQuality);
3556
+ for (let index = 1; index < array.length; index++) {
3557
+ const procNew = ratings[index];
3558
+ if (procNew < 0) {
3559
+ continue;
3560
+ }
3561
+ for (let currentIndex = index; currentIndex > 0 && procNew < ratings[currentIndex - 1]; currentIndex--) {
3562
+ const token = array[currentIndex];
3563
+ array[currentIndex] = array[currentIndex - 1];
3564
+ array[currentIndex - 1] = token;
3565
+ ratings[currentIndex] = ratings[currentIndex - 1];
3566
+ ratings[currentIndex - 1] = procNew;
3567
+ }
3568
+ }
3569
+ }
3570
+ function getAttributeQuality(token) {
3571
+ switch (token.action) {
3572
+ case AttributeAction.Exists: {
3573
+ return 10;
3574
+ }
3575
+ case AttributeAction.Equals: {
3576
+ return token.name === "id" ? 9 : 8;
3577
+ }
3578
+ case AttributeAction.Not: {
3579
+ return 7;
3580
+ }
3581
+ case AttributeAction.Start: {
3582
+ return 6;
3583
+ }
3584
+ case AttributeAction.End: {
3585
+ return 6;
3586
+ }
3587
+ case AttributeAction.Any: {
3588
+ return 5;
3589
+ }
3590
+ case AttributeAction.Hyphen: {
3591
+ return 4;
3592
+ }
3593
+ case AttributeAction.Element: {
3594
+ return 3;
3595
+ }
3596
+ }
3597
+ }
3598
+ function getQuality(token) {
3599
+ switch (token.type) {
3600
+ case SelectorType.Universal: {
3601
+ return 50;
3602
+ }
3603
+ case SelectorType.Tag: {
3604
+ return 30;
3605
+ }
3606
+ case SelectorType.Attribute: {
3607
+ return Math.floor(getAttributeQuality(token) / // `ignoreCase` adds some overhead, half the result if applicable.
3608
+ (token.ignoreCase ? 2 : 1));
3609
+ }
3610
+ case SelectorType.Pseudo: {
3611
+ return token.data ? token.name === "has" || token.name === "contains" || token.name === "icontains" ? (
3612
+ // Expensive in any case — run as late as possible.
3613
+ 0
3614
+ ) : Array.isArray(token.data) ? (
3615
+ // Eg. `:is`, `:not`
3616
+ Math.max(
3617
+ // If we have traversals, try to avoid executing this selector
3618
+ 0,
3619
+ Math.min(...token.data.map((d) => Math.min(...d.map(getQuality))))
3620
+ )
3621
+ ) : 2 : 3;
3622
+ }
3623
+ default: {
3624
+ return -1;
3625
+ }
3626
+ }
3627
+ }
3628
+ function includesScopePseudo(t) {
3629
+ return t.type === SelectorType.Pseudo && (t.name === "scope" || Array.isArray(t.data) && t.data.some((data) => data.some(includesScopePseudo)));
3630
+ }
3631
+ var init_selectors = __esm({
3632
+ "node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/helpers/selectors.js"() {
3633
+ init_dist2();
3634
+ }
3635
+ });
3636
+
3637
+ // node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/pseudo-selectors/subselects.js
3638
+ function hasDependsOnCurrentElement(selector) {
3639
+ return selector.some((sel) => sel.length > 0 && (isTraversal2(sel[0]) || sel.some(includesScopePseudo)));
3640
+ }
3641
+ var PLACEHOLDER_ELEMENT, is, subselects;
3642
+ var init_subselects = __esm({
3643
+ "node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/pseudo-selectors/subselects.js"() {
3644
+ init_dist();
3645
+ init_cache();
3646
+ init_options();
3647
+ init_querying2();
3648
+ init_selectors();
3649
+ PLACEHOLDER_ELEMENT = {};
3650
+ is = (next, token, options, context, compileToken2) => {
3651
+ const compiledToken = compileToken2(token, copyOptions(options), context);
3652
+ return compiledToken === trueFunc ? next : compiledToken === falseFunc ? falseFunc : (element) => compiledToken(element) && next(element);
3653
+ };
3654
+ subselects = {
3655
+ is,
3656
+ /**
3657
+ * `:matches` and `:where` are aliases for `:is`.
3658
+ */
3659
+ matches: is,
3660
+ where: is,
3661
+ not(next, token, options, context, compileToken2) {
3662
+ const compiledToken = compileToken2(token, copyOptions(options), context);
3663
+ return compiledToken === falseFunc ? next : compiledToken === trueFunc ? falseFunc : (element) => !compiledToken(element) && next(element);
3664
+ },
3665
+ has(next, subselect, options, _context, compileToken2) {
3666
+ const { adapter } = options;
3667
+ const copiedOptions = copyOptions(options);
3668
+ copiedOptions.relativeSelector = true;
3669
+ const context = subselect.some((s) => s.some(isTraversal2)) ? (
3670
+ // Used as a placeholder. Will be replaced with the actual element.
3671
+ [PLACEHOLDER_ELEMENT]
3672
+ ) : void 0;
3673
+ const skipCache = hasDependsOnCurrentElement(subselect);
3674
+ const compiled = compileToken2(subselect, copiedOptions, context);
3675
+ if (compiled === falseFunc) {
3676
+ return falseFunc;
3677
+ }
3678
+ if (context && compiled !== trueFunc) {
3679
+ return skipCache ? (element) => {
3680
+ if (!next(element)) {
3681
+ return false;
3682
+ }
3683
+ context[0] = element;
3684
+ const childs = adapter.getChildren(element);
3685
+ return findOne2(compiled, compiled.shouldTestNextSiblings ? [
3686
+ ...childs,
3687
+ ...getNextSiblings(element, adapter)
3688
+ ] : childs, options) !== null;
3689
+ } : cacheParentResults(next, options, (element) => {
3690
+ context[0] = element;
3691
+ return findOne2(compiled, adapter.getChildren(element), options) !== null;
3692
+ });
3693
+ }
3694
+ const hasOne = (element) => findOne2(compiled, adapter.getChildren(element), options) !== null;
3695
+ return skipCache ? (element) => next(element) && hasOne(element) : cacheParentResults(next, options, hasOne);
3696
+ }
3697
+ };
3698
+ }
3699
+ });
3700
+
3701
+ // node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/pseudo-selectors/index.js
3702
+ function compilePseudoSelector(next, selector, options, context, compileToken2) {
3703
+ const { name, data } = selector;
3704
+ if (Array.isArray(data)) {
3705
+ if (!(name in subselects)) {
3706
+ throw new Error(`Unknown pseudo-class :${name}(${data})`);
3707
+ }
3708
+ return subselects[name](next, data, options, context, compileToken2);
3709
+ }
3710
+ const userPseudo = options.pseudos?.[name];
3711
+ const stringPseudo = typeof userPseudo === "string" ? userPseudo : aliases[name];
3712
+ if (typeof stringPseudo === "string") {
3713
+ if (data != null) {
3714
+ throw new Error(`Pseudo ${name} doesn't have any arguments`);
3715
+ }
3716
+ const alias = parse(stringPseudo);
3717
+ return subselects["is"](next, alias, options, context, compileToken2);
3718
+ }
3719
+ if (typeof userPseudo === "function") {
3720
+ verifyPseudoArguments(userPseudo, name, data, 1);
3721
+ return (element) => userPseudo(element, data) && next(element);
3722
+ }
3723
+ if (name in filters) {
3724
+ return filters[name](next, data, options, context, compileToken2);
3725
+ }
3726
+ if (name in pseudos) {
3727
+ const pseudo = pseudos[name];
3728
+ verifyPseudoArguments(pseudo, name, data, 2);
3729
+ return (element) => pseudo(element, options, data) && next(element);
3730
+ }
3731
+ throw new Error(`Unknown pseudo-class :${name}`);
3732
+ }
3733
+ var init_pseudo_selectors = __esm({
3734
+ "node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/pseudo-selectors/index.js"() {
3735
+ init_dist2();
3736
+ init_aliases();
3737
+ init_filters();
3738
+ init_pseudos();
3739
+ init_subselects();
3740
+ }
3741
+ });
3742
+
3743
+ // node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/general.js
3744
+ function compileGeneralSelector(next, selector, options, context, compileToken2, hasExpensiveSubselector) {
3745
+ const { adapter, equals, cacheResults } = options;
3746
+ switch (selector.type) {
3747
+ case SelectorType.PseudoElement: {
3748
+ throw new Error("Pseudo-elements are not supported by css-select");
3749
+ }
3750
+ case SelectorType.ColumnCombinator: {
3751
+ throw new Error("Column combinators are not yet supported by css-select");
3752
+ }
3753
+ case SelectorType.Attribute: {
3754
+ if (selector.namespace != null) {
3755
+ throw new Error("Namespaced attributes are not yet supported by css-select");
3756
+ }
3757
+ if (!options.xmlMode || options.lowerCaseAttributeNames) {
3758
+ selector.name = selector.name.toLowerCase();
3759
+ }
3760
+ return attributeRules[selector.action](next, selector, options);
3761
+ }
3762
+ case SelectorType.Pseudo: {
3763
+ return compilePseudoSelector(next, selector, options, context, compileToken2);
3764
+ }
3765
+ // Tags
3766
+ case SelectorType.Tag: {
3767
+ if (selector.namespace != null) {
3768
+ throw new Error("Namespaced tag names are not yet supported by css-select");
3769
+ }
3770
+ let { name } = selector;
3771
+ if (!options.xmlMode || options.lowerCaseTags) {
3772
+ name = name.toLowerCase();
3773
+ }
3774
+ return function tag(element) {
3775
+ return adapter.getName(element) === name && next(element);
3776
+ };
3777
+ }
3778
+ // Traversal
3779
+ case SelectorType.Descendant: {
3780
+ if (!hasExpensiveSubselector || cacheResults === false || typeof WeakMap === "undefined") {
3781
+ return function descendant(element) {
3782
+ let current = element;
3783
+ while (current = getElementParent(current, adapter)) {
3784
+ if (next(current)) {
3785
+ return true;
3786
+ }
3787
+ }
3788
+ return false;
3789
+ };
3790
+ }
3791
+ const resultCache = /* @__PURE__ */ new WeakMap();
3792
+ return function cachedDescendant(element) {
3793
+ let current = element;
3794
+ let result;
3795
+ while (current = getElementParent(current, adapter)) {
3796
+ const cached = resultCache.get(current);
3797
+ if (cached === void 0) {
3798
+ result ??= { matches: false };
3799
+ result.matches = next(current);
3800
+ resultCache.set(current, result);
3801
+ if (result.matches) {
3802
+ return true;
3803
+ }
3804
+ } else {
3805
+ if (result) {
3806
+ result.matches = cached.matches;
3807
+ }
3808
+ return cached.matches;
3809
+ }
3810
+ }
3811
+ return false;
3812
+ };
3813
+ }
3814
+ case "_flexibleDescendant": {
3815
+ return function flexibleDescendant(element) {
3816
+ let current = element;
3817
+ do {
3818
+ if (next(current)) {
3819
+ return true;
3820
+ }
3821
+ current = getElementParent(current, adapter);
3822
+ } while (current);
3823
+ return false;
3824
+ };
3825
+ }
3826
+ case SelectorType.Parent: {
3827
+ return function parent(element) {
3828
+ return adapter.getChildren(element).some((element2) => adapter.isTag(element2) && next(element2));
3829
+ };
3830
+ }
3831
+ case SelectorType.Child: {
3832
+ return function child(element) {
3833
+ const parent = getElementParent(element, adapter);
3834
+ return parent !== null && next(parent);
3835
+ };
3836
+ }
3837
+ case SelectorType.Sibling: {
3838
+ return function sibling(element) {
3839
+ const siblings = adapter.getSiblings(element);
3840
+ for (const currentSibling of siblings) {
3841
+ if (equals(element, currentSibling)) {
3842
+ break;
3843
+ }
3844
+ if (adapter.isTag(currentSibling) && next(currentSibling)) {
3845
+ return true;
3846
+ }
3847
+ }
3848
+ return false;
3849
+ };
3850
+ }
3851
+ case SelectorType.Adjacent: {
3852
+ if (adapter.prevElementSibling) {
3853
+ return function adjacent(element) {
3854
+ const previous = adapter.prevElementSibling(element);
3855
+ return previous != null && next(previous);
3856
+ };
3857
+ }
3858
+ return function adjacent(element) {
3859
+ const siblings = adapter.getSiblings(element);
3860
+ let lastElement;
3861
+ for (const currentSibling of siblings) {
3862
+ if (equals(element, currentSibling)) {
3863
+ break;
3864
+ }
3865
+ if (adapter.isTag(currentSibling)) {
3866
+ lastElement = currentSibling;
3867
+ }
3868
+ }
3869
+ return !!lastElement && next(lastElement);
3870
+ };
3871
+ }
3872
+ case SelectorType.Universal: {
3873
+ if (selector.namespace != null && selector.namespace !== "*") {
3874
+ throw new Error("Namespaced universal selectors are not yet supported by css-select");
3875
+ }
3876
+ return next;
3877
+ }
3878
+ }
3879
+ }
3880
+ var init_general = __esm({
3881
+ "node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/general.js"() {
3882
+ init_dist2();
3883
+ init_attributes();
3884
+ init_querying2();
3885
+ init_pseudo_selectors();
3886
+ }
3887
+ });
3888
+
3889
+ // node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/compile.js
3890
+ function absolutize(token, { adapter }, context) {
3891
+ const hasContext = !!context?.every((element) => element === PLACEHOLDER_ELEMENT || adapter.isTag(element) && getElementParent(element, adapter) !== null);
3892
+ for (const t of token) {
3893
+ if (t.length > 0 && isTraversal2(t[0]) && t[0].type !== SelectorType.Descendant) {
3894
+ } else if (hasContext && !t.some(includesScopePseudo)) {
3895
+ t.unshift(DESCENDANT_TOKEN);
3896
+ } else {
3897
+ continue;
3898
+ }
3899
+ t.unshift(SCOPE_TOKEN);
3900
+ }
3901
+ }
3902
+ function compileToken(token, options, compilationContext) {
3903
+ for (const rules of token) {
3904
+ sortRules(rules);
3905
+ }
3906
+ const { context = compilationContext, rootFunc: rootFunction = trueFunc } = options;
3907
+ const isArrayContext = Array.isArray(context);
3908
+ const finalContext = context && (Array.isArray(context) ? context : [context]);
3909
+ if (options.relativeSelector !== false) {
3910
+ absolutize(token, options, finalContext);
3911
+ } else if (token.some((t) => t.length > 0 && isTraversal2(t[0]))) {
3912
+ throw new Error("Relative selectors are not allowed when the `relativeSelector` option is disabled");
3913
+ }
3914
+ let shouldTestNextSiblings = false;
3915
+ let query = falseFunc;
3916
+ combineLoop: for (const rules of token) {
3917
+ if (rules.length >= 2) {
3918
+ const [first, second] = rules;
3919
+ if (first.type !== SelectorType.Pseudo || first.name !== "scope") {
3920
+ } else if (isArrayContext && second.type === SelectorType.Descendant) {
3921
+ rules[1] = FLEXIBLE_DESCENDANT_TOKEN;
3922
+ } else if (second.type === SelectorType.Adjacent || second.type === SelectorType.Sibling) {
3923
+ shouldTestNextSiblings = true;
3924
+ }
3925
+ }
3926
+ let next = rootFunction;
3927
+ let hasExpensiveSubselector = false;
3928
+ for (const rule of rules) {
3929
+ next = compileGeneralSelector(next, rule, options, finalContext, compileToken, hasExpensiveSubselector);
3930
+ const quality = getQuality(rule);
3931
+ if (quality === 0) {
3932
+ hasExpensiveSubselector = true;
3933
+ }
3934
+ if (next === falseFunc) {
3935
+ continue combineLoop;
3936
+ }
3937
+ }
3938
+ if (next === rootFunction) {
3939
+ return rootFunction;
3940
+ }
3941
+ query = query === falseFunc ? next : or(query, next);
3942
+ }
3943
+ query.shouldTestNextSiblings = shouldTestNextSiblings;
3944
+ return query;
3945
+ }
3946
+ function or(a, b) {
3947
+ return (element) => a(element) || b(element);
3948
+ }
3949
+ var DESCENDANT_TOKEN, FLEXIBLE_DESCENDANT_TOKEN, SCOPE_TOKEN;
3950
+ var init_compile2 = __esm({
3951
+ "node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/compile.js"() {
3952
+ init_dist();
3953
+ init_dist2();
3954
+ init_general();
3955
+ init_querying2();
3956
+ init_selectors();
3957
+ init_subselects();
3958
+ DESCENDANT_TOKEN = { type: SelectorType.Descendant };
3959
+ FLEXIBLE_DESCENDANT_TOKEN = {
3960
+ type: "_flexibleDescendant"
3961
+ };
3962
+ SCOPE_TOKEN = {
3963
+ type: SelectorType.Pseudo,
3964
+ name: "scope",
3965
+ data: null
3966
+ };
3967
+ }
3968
+ });
3969
+
3970
+ // node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/index.js
3971
+ var dist_exports4 = {};
3972
+ __export(dist_exports4, {
3973
+ _compileUnsafe: () => _compileUnsafe,
3974
+ compile: () => compile2,
3975
+ default: () => dist_default2,
3976
+ is: () => is2,
3977
+ prepareContext: () => prepareContext,
3978
+ selectAll: () => selectAll,
3979
+ selectOne: () => selectOne
3980
+ });
3981
+ function convertOptionFormats(options) {
3982
+ const finalOptions = options ?? defaultOptions;
3983
+ finalOptions.adapter ??= defaultOptions.adapter;
3984
+ finalOptions.equals ??= finalOptions.adapter?.equals ?? defaultEquals;
3985
+ return finalOptions;
3986
+ }
3987
+ function compile2(selector, options, context) {
3988
+ const convertedOptions = convertOptionFormats(options);
3989
+ const next = _compileUnsafe(selector, convertedOptions, context);
3990
+ return next === falseFunc ? falseFunc : (element) => convertedOptions.adapter.isTag(element) && next(element);
3991
+ }
3992
+ function _compileUnsafe(selector, options, context) {
3993
+ return compileToken(typeof selector === "string" ? parse(selector) : selector, convertOptionFormats(options), context);
3994
+ }
3995
+ function getSelectorFunction(searchFunction) {
3996
+ return function select(query, elements, options) {
3997
+ const convertedOptions = convertOptionFormats(options);
3998
+ if (typeof query !== "function") {
3999
+ query = _compileUnsafe(query, convertedOptions, elements);
4000
+ }
4001
+ const filteredElements = prepareContext(elements, convertedOptions.adapter, query.shouldTestNextSiblings);
4002
+ return searchFunction(query, filteredElements, convertedOptions);
4003
+ };
4004
+ }
4005
+ function prepareContext(elements, adapter, shouldTestNextSiblings = false) {
4006
+ if (shouldTestNextSiblings) {
4007
+ elements = appendNextSiblings(elements, adapter);
4008
+ }
4009
+ return Array.isArray(elements) ? adapter.removeSubsets(elements) : adapter.getChildren(elements);
4010
+ }
4011
+ function appendNextSiblings(element, adapter) {
4012
+ const elements = Array.isArray(element) ? [...element] : [element];
4013
+ const elementsLength = elements.length;
4014
+ for (let index = 0; index < elementsLength; index++) {
4015
+ const nextSiblings = getNextSiblings(elements[index], adapter);
4016
+ elements.push(...nextSiblings);
4017
+ }
4018
+ return elements;
4019
+ }
4020
+ function is2(element, query, options) {
4021
+ return (typeof query === "function" ? query : compile2(query, options))(element);
4022
+ }
4023
+ var defaultEquals, defaultOptions, selectAll, selectOne, dist_default2;
4024
+ var init_dist9 = __esm({
4025
+ "node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/index.js"() {
4026
+ init_dist();
4027
+ init_dist2();
4028
+ init_dist4();
4029
+ init_dist7();
4030
+ init_compile2();
4031
+ init_querying2();
4032
+ defaultEquals = (a, b) => a === b;
4033
+ defaultOptions = {
4034
+ adapter: { ...dist_exports2, isTag: isTag2 },
4035
+ equals: defaultEquals
4036
+ };
4037
+ selectAll = getSelectorFunction((query, elements, options) => query === falseFunc || !elements || elements.length === 0 ? [] : findAll2(query, elements, options));
4038
+ selectOne = getSelectorFunction((query, elements, options) => query === falseFunc || !elements || elements.length === 0 ? null : findOne2(query, elements, options));
4039
+ dist_default2 = selectAll;
4040
+ }
4041
+ });
4042
+
4043
+ export {
4044
+ compile2 as compile,
4045
+ is2 as is,
4046
+ dist_exports4 as dist_exports,
4047
+ init_dist9 as init_dist,
4048
+ require_lib,
4049
+ require_canvas
4050
+ };