netscape-bookmark-parser 1.2.2 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,8 +1,4186 @@
1
- import { DOMParser } from "@b-fuze/deno-dom";
1
+ //#region node_modules/.pnpm/@jsr+b-fuze__deno-dom@0.1.56/node_modules/@jsr/b-fuze__deno-dom/build/deno-wasm/deno-wasm.js
2
+ function prepareExports(wasmImports) {
3
+ const { memory, __wbindgen_export_0, __wbindgen_malloc, __wbindgen_realloc, __wbindgen_free, parse_wasm, parse_frag_wasm } = wasmImports;
4
+ {
5
+ const table = __wbindgen_export_0;
6
+ const offset = table.grow(4);
7
+ table.set(0, void 0);
8
+ table.set(offset + 0, void 0);
9
+ table.set(offset + 1, null);
10
+ table.set(offset + 2, true);
11
+ table.set(offset + 3, false);
12
+ }
13
+ let WASM_VECTOR_LEN = 0;
14
+ let cachedUint8ArrayMemory0 = null;
15
+ function getUint8ArrayMemory0() {
16
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) cachedUint8ArrayMemory0 = new Uint8Array(memory.buffer);
17
+ return cachedUint8ArrayMemory0;
18
+ }
19
+ const cachedTextEncoder = typeof TextEncoder !== "undefined" ? new TextEncoder("utf-8") : { encode: () => {
20
+ throw Error("TextEncoder not available");
21
+ } };
22
+ const encodeString = function(arg, view) {
23
+ return cachedTextEncoder.encodeInto(arg, view);
24
+ };
25
+ function passStringToWasm0(arg, malloc, realloc) {
26
+ if (realloc === void 0) {
27
+ const buf = cachedTextEncoder.encode(arg);
28
+ const ptr = malloc(buf.length, 1) >>> 0;
29
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
30
+ WASM_VECTOR_LEN = buf.length;
31
+ return ptr;
32
+ }
33
+ let len = arg.length;
34
+ let ptr = malloc(len, 1) >>> 0;
35
+ const mem = getUint8ArrayMemory0();
36
+ let offset = 0;
37
+ for (; offset < len; offset++) {
38
+ const code = arg.charCodeAt(offset);
39
+ if (code > 127) break;
40
+ mem[ptr + offset] = code;
41
+ }
42
+ if (offset !== len) {
43
+ if (offset !== 0) arg = arg.slice(offset);
44
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
45
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
46
+ const ret = encodeString(arg, view);
47
+ offset += ret.written;
48
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
49
+ }
50
+ WASM_VECTOR_LEN = offset;
51
+ return ptr;
52
+ }
53
+ const cachedTextDecoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf-8", {
54
+ ignoreBOM: true,
55
+ fatal: true
56
+ }) : { decode: () => {
57
+ throw Error("TextDecoder not available");
58
+ } };
59
+ if (typeof TextDecoder !== "undefined") cachedTextDecoder.decode();
60
+ function getStringFromWasm0(ptr, len) {
61
+ ptr = ptr >>> 0;
62
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
63
+ }
64
+ /**
65
+ * @param {string} html
66
+ * @returns {string}
67
+ */
68
+ function parse(html) {
69
+ let deferred2_0;
70
+ let deferred2_1;
71
+ try {
72
+ const ptr0 = passStringToWasm0(html, __wbindgen_malloc, __wbindgen_realloc);
73
+ const ret = parse_wasm(ptr0, WASM_VECTOR_LEN);
74
+ deferred2_0 = ret[0];
75
+ deferred2_1 = ret[1];
76
+ return getStringFromWasm0(ret[0], ret[1]);
77
+ } finally {
78
+ __wbindgen_free(deferred2_0, deferred2_1, 1);
79
+ }
80
+ }
81
+ /**
82
+ * @param {string} html
83
+ * @param {string} context_local_name
84
+ * @returns {string}
85
+ */
86
+ function parse_frag(html, context_local_name) {
87
+ let deferred3_0;
88
+ let deferred3_1;
89
+ try {
90
+ const ptr0 = passStringToWasm0(html, __wbindgen_malloc, __wbindgen_realloc);
91
+ const len0 = WASM_VECTOR_LEN;
92
+ const ptr1 = passStringToWasm0(context_local_name, __wbindgen_malloc, __wbindgen_realloc);
93
+ const ret = parse_frag_wasm(ptr0, len0, ptr1, WASM_VECTOR_LEN);
94
+ deferred3_0 = ret[0];
95
+ deferred3_1 = ret[1];
96
+ return getStringFromWasm0(ret[0], ret[1]);
97
+ } finally {
98
+ __wbindgen_free(deferred3_0, deferred3_1, 1);
99
+ }
100
+ }
101
+ return {
102
+ parse,
103
+ parse_frag
104
+ };
105
+ }
106
+ //#endregion
107
+ //#region node_modules/.pnpm/@jsr+b-fuze__deno-dom@0.1.56/node_modules/@jsr/b-fuze__deno-dom/build/deno-wasm/deno-wasm-dynamic.js
108
+ function hasSuitableDenoVersion(version) {
109
+ const [major, minor] = version.split(".").map(Number);
110
+ return major >= 2 && minor >= 1;
111
+ }
112
+ const { parse: parse$1, parse_frag } = prepareExports(await (async () => {
113
+ let moduleImports;
114
+ if (typeof Deno === "object" && hasSuitableDenoVersion(Deno.version?.deno || "0.0.0")) moduleImports = await import("./deno-wasm_bg-Brhw7cJv.js");
115
+ else moduleImports = (await import("./deno-wasm_bg-wasm-BfK4r2Sm.js")).default;
116
+ const { parse, parse_frag, ...remappedImports } = moduleImports;
117
+ remappedImports.parse_wasm = parse;
118
+ remappedImports.parse_frag_wasm = parse_frag;
119
+ return remappedImports;
120
+ })());
121
+ //#endregion
122
+ //#region node_modules/.pnpm/@jsr+b-fuze__deno-dom@0.1.56/node_modules/@jsr/b-fuze__deno-dom/src/parser.js
123
+ /**
124
+ * Parser interface
125
+ */ let parse = (_html) => {
126
+ console.error("Error: deno-dom: No parser registered");
127
+ Deno.exit(1);
128
+ };
129
+ let parseFrag = (_html, _contextLocalName) => {
130
+ console.error("Error: deno-dom: No parser registered");
131
+ Deno.exit(1);
132
+ };
133
+ const originalParse = parse;
134
+ function register(func, fragFunc) {
135
+ if (parse !== originalParse) return;
136
+ parse = func;
137
+ parseFrag = fragFunc;
138
+ }
139
+ //#endregion
140
+ //#region node_modules/.pnpm/@jsr+b-fuze__deno-dom@0.1.56/node_modules/@jsr/b-fuze__deno-dom/src/constructor-lock.js
141
+ /**
142
+ * Used to enforce illegal constructors
143
+ */ const CTOR_KEY = Symbol("CTOR_KEY");
144
+ //#endregion
145
+ //#region node_modules/.pnpm/@jsr+b-fuze__deno-dom@0.1.56/node_modules/@jsr/b-fuze__deno-dom/src/dom/html-collection.js
146
+ const HTMLCollectionMutatorSym = Symbol("HTMLCollectionMutatorSym");
147
+ const HTMLCollectionClass = (() => {
148
+ class HTMLCollection extends Array {
149
+ forEach(cb, thisArg) {
150
+ super.forEach(cb, thisArg);
151
+ }
152
+ item(index) {
153
+ return this[index] ?? null;
154
+ }
155
+ [HTMLCollectionMutatorSym]() {
156
+ return {
157
+ push: Array.prototype.push.bind(this),
158
+ splice: Array.prototype.splice.bind(this),
159
+ indexOf: Array.prototype.indexOf.bind(this)
160
+ };
161
+ }
162
+ toString() {
163
+ return "[object HTMLCollection]";
164
+ }
165
+ }
166
+ return HTMLCollection;
167
+ })();
168
+ for (const staticMethod of [
169
+ "from",
170
+ "isArray",
171
+ "of"
172
+ ]) HTMLCollectionClass[staticMethod] = void 0;
173
+ for (const instanceMethod of [
174
+ "concat",
175
+ "copyWithin",
176
+ "every",
177
+ "fill",
178
+ "filter",
179
+ "find",
180
+ "findIndex",
181
+ "flat",
182
+ "flatMap",
183
+ "includes",
184
+ "indexOf",
185
+ "join",
186
+ "lastIndexOf",
187
+ "map",
188
+ "pop",
189
+ "push",
190
+ "reduce",
191
+ "reduceRight",
192
+ "reverse",
193
+ "shift",
194
+ "slice",
195
+ "some",
196
+ "sort",
197
+ "splice",
198
+ "toLocaleString",
199
+ "unshift",
200
+ "entries",
201
+ "forEach",
202
+ "keys",
203
+ "values"
204
+ ]) HTMLCollectionClass.prototype[instanceMethod] = void 0;
205
+ const HTMLCollection = HTMLCollectionClass;
206
+ //#endregion
207
+ //#region node_modules/.pnpm/@jsr+b-fuze__deno-dom@0.1.56/node_modules/@jsr/b-fuze__deno-dom/src/dom/node-list.js
208
+ const nodeListMutatorSym = Symbol("nodeListMutatorSym");
209
+ const nodeListCachedMutator = Symbol("nodeListCachedMutator");
210
+ const { push, splice, slice, indexOf, filter } = Array.prototype;
211
+ var NodeListMutatorImpl = class {
212
+ arrayInstance;
213
+ elementViews;
214
+ constructor(arrayInstance) {
215
+ this.arrayInstance = arrayInstance;
216
+ this.elementViews = [];
217
+ }
218
+ push(...items) {
219
+ for (const view of this.elementViews) for (const item of items) if (item.nodeType === Node.ELEMENT_NODE) push.call(view, item);
220
+ return push.call(this.arrayInstance, ...items);
221
+ }
222
+ splice(index, deleteCount = 0, ...items) {
223
+ for (const view of this.elementViews) {
224
+ const toDelete = filter.call(slice.call(this.arrayInstance, index, index + deleteCount), (item) => item.nodeType === Node.ELEMENT_NODE);
225
+ const toInsert = items.filter((item) => item.nodeType === Node.ELEMENT_NODE);
226
+ let elementViewSpliceIndex = -1;
227
+ for (let idx = index; idx < this.arrayInstance.length; idx++) {
228
+ const item = this.arrayInstance[idx];
229
+ if (item.nodeType === Node.ELEMENT_NODE) {
230
+ elementViewSpliceIndex = indexOf.call(view, item);
231
+ break;
232
+ }
233
+ }
234
+ if (elementViewSpliceIndex === -1) elementViewSpliceIndex = view.length;
235
+ if (toDelete.length) splice.call(view, elementViewSpliceIndex, toDelete.length);
236
+ splice.call(view, elementViewSpliceIndex, 0, ...toInsert);
237
+ }
238
+ return splice.call(this.arrayInstance, index, deleteCount, ...items);
239
+ }
240
+ indexOf(item, fromIndex = 0) {
241
+ return indexOf.call(this.arrayInstance, item, fromIndex);
242
+ }
243
+ indexOfElementsView(item, fromIndex = 0) {
244
+ return indexOf.call(this.elementsView(), item, fromIndex);
245
+ }
246
+ elementsView() {
247
+ let view = this.elementViews[0];
248
+ if (!view) {
249
+ view = new HTMLCollection();
250
+ this.elementViews.push(view);
251
+ push.call(view, ...filter.call(this.arrayInstance, (item) => item.nodeType === Node.ELEMENT_NODE));
252
+ }
253
+ return view;
254
+ }
255
+ };
256
+ const NodeListClass = (() => {
257
+ class NodeList extends Array {
258
+ forEach(cb, thisArg) {
259
+ super.forEach(cb, thisArg);
260
+ }
261
+ item(index) {
262
+ return this[index] ?? null;
263
+ }
264
+ [nodeListMutatorSym]() {
265
+ const cachedMutator = this[nodeListCachedMutator];
266
+ if (cachedMutator) return cachedMutator;
267
+ else {
268
+ const cachedMutator = new NodeListMutatorImpl(this);
269
+ this[nodeListCachedMutator] = cachedMutator;
270
+ return cachedMutator;
271
+ }
272
+ }
273
+ toString() {
274
+ return "[object NodeList]";
275
+ }
276
+ }
277
+ return NodeList;
278
+ })();
279
+ for (const staticMethod of [
280
+ "from",
281
+ "isArray",
282
+ "of"
283
+ ]) NodeListClass[staticMethod] = void 0;
284
+ for (const instanceMethod of [
285
+ "concat",
286
+ "copyWithin",
287
+ "every",
288
+ "fill",
289
+ "filter",
290
+ "find",
291
+ "findIndex",
292
+ "flat",
293
+ "flatMap",
294
+ "includes",
295
+ "indexOf",
296
+ "join",
297
+ "lastIndexOf",
298
+ "map",
299
+ "pop",
300
+ "push",
301
+ "reduce",
302
+ "reduceRight",
303
+ "reverse",
304
+ "shift",
305
+ "slice",
306
+ "some",
307
+ "sort",
308
+ "splice",
309
+ "toLocaleString",
310
+ "unshift"
311
+ ]) NodeListClass.prototype[instanceMethod] = void 0;
312
+ const NodeList = NodeListClass;
313
+ //#endregion
314
+ //#region node_modules/.pnpm/@jsr+b-fuze__deno-dom@0.1.56/node_modules/@jsr/b-fuze__deno-dom/src/dom/utils-types.js
315
+ /**
316
+ * Ugly solution to circular imports... FIXME: Make this better
317
+ */ var utils_types_default = {
318
+ Element: null,
319
+ Document: null,
320
+ DocumentFragment: null
321
+ };
322
+ //#endregion
323
+ //#region node_modules/.pnpm/@jsr+b-fuze__deno-dom@0.1.56/node_modules/@jsr/b-fuze__deno-dom/src/dom/utils.js
324
+ const upperCaseCharRe = /[A-Z]/;
325
+ const lowerCaseCharRe = /[a-z]/;
326
+ /**
327
+ * Convert JS property name to dataset attribute name without
328
+ * validation
329
+ */ function getDatasetHtmlAttrName(name) {
330
+ let attributeName = "data-";
331
+ for (const char of name) if (upperCaseCharRe.test(char)) attributeName += "-" + char.toLowerCase();
332
+ else attributeName += char;
333
+ return attributeName;
334
+ }
335
+ function getDatasetJavascriptName(name) {
336
+ let javascriptName = "";
337
+ let prevChar = "";
338
+ for (const char of name.slice(5)) if (prevChar === "-" && lowerCaseCharRe.test(char)) {
339
+ javascriptName += char.toUpperCase();
340
+ prevChar = "";
341
+ } else {
342
+ javascriptName += prevChar;
343
+ prevChar = char;
344
+ }
345
+ return javascriptName + prevChar;
346
+ }
347
+ function getElementsByClassName(element, classNames, search) {
348
+ for (const child of element.childNodes) if (child.nodeType === NodeType.ELEMENT_NODE) {
349
+ let matchesCount = 0;
350
+ for (const singleClassName of classNames) if (child.classList.contains(singleClassName)) matchesCount++;
351
+ if (matchesCount === classNames.length) search.push(child);
352
+ getElementsByClassName(child, classNames, search);
353
+ }
354
+ return search;
355
+ }
356
+ function getOuterHTMLOpeningTag(parentElement) {
357
+ return "<" + parentElement.localName + getElementAttributesString(parentElement) + ">";
358
+ }
359
+ const voidElements = /* @__PURE__ */ new Set([
360
+ "area",
361
+ "base",
362
+ "br",
363
+ "col",
364
+ "embed",
365
+ "hr",
366
+ "img",
367
+ "input",
368
+ "link",
369
+ "meta",
370
+ "param",
371
+ "source",
372
+ "track",
373
+ "wbr"
374
+ ]);
375
+ /**
376
+ * .innerHTML/.outerHTML implementation without recursion to avoid stack
377
+ * overflows
378
+ */ function getOuterOrInnerHtml(parentElement, asOuterHtml) {
379
+ let outerHTMLOpeningTag = "";
380
+ let outerHTMLClosingTag = "";
381
+ let innerHTML = "";
382
+ if (asOuterHtml) {
383
+ outerHTMLOpeningTag = getOuterHTMLOpeningTag(parentElement);
384
+ outerHTMLClosingTag = `</${parentElement.localName}>`;
385
+ if (voidElements.has(parentElement.localName)) return outerHTMLOpeningTag;
386
+ }
387
+ const childNodeDepth = [parentElement.localName === "template" ? parentElement.content.childNodes : parentElement.childNodes];
388
+ const indexDepth = [0];
389
+ const closingTagDepth = [outerHTMLClosingTag];
390
+ let depth = 0;
391
+ depthLoop: while (depth > -1) {
392
+ const child = childNodeDepth[depth][indexDepth[depth]];
393
+ if (child) switch (child.nodeType) {
394
+ case NodeType.ELEMENT_NODE: {
395
+ innerHTML += getOuterHTMLOpeningTag(child);
396
+ const childLocalName = child.localName;
397
+ if (!voidElements.has(childLocalName)) {
398
+ if (childLocalName === "template") childNodeDepth.push(child.content.childNodes);
399
+ else childNodeDepth.push(child.childNodes);
400
+ indexDepth.push(0);
401
+ closingTagDepth.push(`</${childLocalName}>`);
402
+ depth++;
403
+ continue depthLoop;
404
+ }
405
+ break;
406
+ }
407
+ case NodeType.COMMENT_NODE:
408
+ innerHTML += `<!--${child.data}-->`;
409
+ break;
410
+ case NodeType.TEXT_NODE: switch (child.parentNode.localName) {
411
+ case "style":
412
+ case "script":
413
+ case "xmp":
414
+ case "iframe":
415
+ case "noembed":
416
+ case "noframes":
417
+ case "plaintext":
418
+ innerHTML += child.data;
419
+ break;
420
+ case "noscript":
421
+ innerHTML += child.data;
422
+ break;
423
+ default: innerHTML += child.data.replace(/&/g, "&amp;").replace(/\xA0/g, "&nbsp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
424
+ }
425
+ }
426
+ else {
427
+ depth--;
428
+ indexDepth.pop();
429
+ childNodeDepth.pop();
430
+ innerHTML += closingTagDepth.pop();
431
+ }
432
+ indexDepth[depth]++;
433
+ }
434
+ return outerHTMLOpeningTag + innerHTML;
435
+ }
436
+ function getElementAttributesString(element) {
437
+ let out = "";
438
+ for (const attribute of element.getAttributeNames()) {
439
+ out += ` ${attribute}`;
440
+ out += `="${element.getAttribute(attribute).replace(/&/g, "&amp;").replace(/\xA0/g, "&nbsp;").replace(/"/g, "&quot;")}"`;
441
+ }
442
+ return out;
443
+ }
444
+ function insertBeforeAfter(node, nodes, before) {
445
+ const parentNode = node.parentNode;
446
+ const mutator = parentNode._getChildNodesMutator();
447
+ let viablePrevNextSibling = null;
448
+ {
449
+ const difference = before ? -1 : 1;
450
+ for (let i = mutator.indexOf(node) + difference; 0 <= i && i < parentNode.childNodes.length; i += difference) if (!nodes.includes(parentNode.childNodes[i])) {
451
+ viablePrevNextSibling = parentNode.childNodes[i];
452
+ break;
453
+ }
454
+ }
455
+ nodes = nodesAndTextNodes(nodes, parentNode);
456
+ let index;
457
+ if (viablePrevNextSibling) index = mutator.indexOf(viablePrevNextSibling) + (before ? 1 : 0);
458
+ else index = before ? 0 : parentNode.childNodes.length;
459
+ mutator.splice(index, 0, ...nodes);
460
+ }
461
+ function isDocumentFragment(node) {
462
+ let obj = node;
463
+ if (!(obj && typeof obj === "object")) return false;
464
+ while (true) switch (obj.constructor) {
465
+ case utils_types_default.DocumentFragment: return true;
466
+ case Node:
467
+ case utils_types_default.Element: return false;
468
+ case Object:
469
+ case null:
470
+ case void 0: return false;
471
+ default: obj = Reflect.getPrototypeOf(obj);
472
+ }
473
+ }
474
+ /**
475
+ * Sets the new parent for the children via _setParent() on all
476
+ * the child nodes and removes them from the DocumentFragment's
477
+ * childNode list.
478
+ *
479
+ * A helper function for appendChild, etc. It should be called
480
+ * _after_ the children are already pushed onto the new parent's
481
+ * childNodes.
482
+ */ function moveDocumentFragmentChildren(fragment, newParent) {
483
+ const childCount = fragment.childNodes.length;
484
+ for (const child of fragment.childNodes) child._setParent(newParent);
485
+ fragment._getChildNodesMutator().splice(0, childCount);
486
+ }
487
+ //#endregion
488
+ //#region node_modules/.pnpm/@jsr+b-fuze__deno-dom@0.1.56/node_modules/@jsr/b-fuze__deno-dom/src/dom/node.js
489
+ var NodeType = /*#__PURE__*/ function(NodeType) {
490
+ NodeType[NodeType["ELEMENT_NODE"] = 1] = "ELEMENT_NODE";
491
+ NodeType[NodeType["ATTRIBUTE_NODE"] = 2] = "ATTRIBUTE_NODE";
492
+ NodeType[NodeType["TEXT_NODE"] = 3] = "TEXT_NODE";
493
+ NodeType[NodeType["CDATA_SECTION_NODE"] = 4] = "CDATA_SECTION_NODE";
494
+ NodeType[NodeType["ENTITY_REFERENCE_NODE"] = 5] = "ENTITY_REFERENCE_NODE";
495
+ NodeType[NodeType["ENTITY_NODE"] = 6] = "ENTITY_NODE";
496
+ NodeType[NodeType["PROCESSING_INSTRUCTION_NODE"] = 7] = "PROCESSING_INSTRUCTION_NODE";
497
+ NodeType[NodeType["COMMENT_NODE"] = 8] = "COMMENT_NODE";
498
+ NodeType[NodeType["DOCUMENT_NODE"] = 9] = "DOCUMENT_NODE";
499
+ NodeType[NodeType["DOCUMENT_TYPE_NODE"] = 10] = "DOCUMENT_TYPE_NODE";
500
+ NodeType[NodeType["DOCUMENT_FRAGMENT_NODE"] = 11] = "DOCUMENT_FRAGMENT_NODE";
501
+ NodeType[NodeType["NOTATION_NODE"] = 12] = "NOTATION_NODE";
502
+ return NodeType;
503
+ }({});
504
+ /**
505
+ * Throws if any of the nodes are an ancestor
506
+ * of `parentNode`
507
+ */ function nodesAndTextNodes(nodes, parentNode) {
508
+ return nodes.flatMap((n) => {
509
+ if (isDocumentFragment(n)) {
510
+ const children = Array.from(n.childNodes);
511
+ moveDocumentFragmentChildren(n, parentNode);
512
+ return children;
513
+ } else {
514
+ const node = n instanceof Node ? n : new Text(String(n));
515
+ if (n === node && parentNode) parentNode._assertNotAncestor(node);
516
+ node._remove(true);
517
+ node._setParent(parentNode, true);
518
+ return [node];
519
+ }
520
+ });
521
+ }
522
+ var Node = class Node extends EventTarget {
523
+ nodeName;
524
+ nodeType;
525
+ #nodeValue;
526
+ parentNode;
527
+ #ownerDocument;
528
+ get parentElement() {
529
+ if (this.parentNode?.nodeType === NodeType.ELEMENT_NODE) return this.parentNode;
530
+ return null;
531
+ }
532
+ static ELEMENT_NODE = NodeType.ELEMENT_NODE;
533
+ static ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE;
534
+ static TEXT_NODE = NodeType.TEXT_NODE;
535
+ static CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE;
536
+ static ENTITY_REFERENCE_NODE = NodeType.ENTITY_REFERENCE_NODE;
537
+ static ENTITY_NODE = NodeType.ENTITY_NODE;
538
+ static PROCESSING_INSTRUCTION_NODE = NodeType.PROCESSING_INSTRUCTION_NODE;
539
+ static COMMENT_NODE = NodeType.COMMENT_NODE;
540
+ static DOCUMENT_NODE = NodeType.DOCUMENT_NODE;
541
+ static DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE;
542
+ static DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE;
543
+ static NOTATION_NODE = NodeType.NOTATION_NODE;
544
+ constructor(nodeName, nodeType, parentNode, key) {
545
+ if (key !== CTOR_KEY) throw new TypeError("Illegal constructor.");
546
+ super(), this.nodeName = nodeName, this.nodeType = nodeType, this.#nodeValue = null, this.parentNode = null, this.#ownerDocument = null, this.#childNodes = null;
547
+ this.#nodeValue = null;
548
+ if (parentNode) parentNode.appendChild(this);
549
+ }
550
+ #childNodes;
551
+ get childNodes() {
552
+ return this.#childNodes || (this.#childNodes = new NodeList());
553
+ }
554
+ _getChildNodesMutator() {
555
+ return this.childNodes[nodeListMutatorSym]();
556
+ }
557
+ _hasInitializedChildNodes() {
558
+ return Boolean(this.#childNodes);
559
+ }
560
+ /**
561
+ * Update ancestor chain & owner document for this child
562
+ * and all its children.
563
+ */ _setParent(newParent, force = false) {
564
+ const sameParent = this.parentNode === newParent;
565
+ const shouldUpdateParentAndAncestors = !sameParent || force;
566
+ if (shouldUpdateParentAndAncestors) {
567
+ this.parentNode = newParent;
568
+ if (newParent) {
569
+ if (!sameParent) this._setOwnerDocument(newParent.#ownerDocument);
570
+ }
571
+ if (this._hasInitializedChildNodes()) for (const child of this.childNodes) child._setParent(this, shouldUpdateParentAndAncestors);
572
+ }
573
+ }
574
+ _assertNotAncestor(child) {
575
+ if (child.contains(this)) throw new DOMException("The new child is an ancestor of the parent");
576
+ }
577
+ _setOwnerDocument(document) {
578
+ if (this.#ownerDocument !== document) {
579
+ this.#ownerDocument = document;
580
+ if (this._hasInitializedChildNodes()) for (const child of this.childNodes) child._setOwnerDocument(document);
581
+ }
582
+ }
583
+ contains(child) {
584
+ let node = child;
585
+ while (node) {
586
+ if (node === this) return true;
587
+ node = node.parentNode;
588
+ }
589
+ return false;
590
+ }
591
+ get ownerDocument() {
592
+ return this.#ownerDocument;
593
+ }
594
+ get nodeValue() {
595
+ return this.#nodeValue;
596
+ }
597
+ set nodeValue(value) {}
598
+ get textContent() {
599
+ let out = "";
600
+ for (const child of this.childNodes) switch (child.nodeType) {
601
+ case NodeType.TEXT_NODE:
602
+ out += child.nodeValue;
603
+ break;
604
+ case NodeType.ELEMENT_NODE: out += child.textContent;
605
+ }
606
+ return out;
607
+ }
608
+ set textContent(content) {
609
+ for (const child of this.childNodes) child._setParent(null);
610
+ this._getChildNodesMutator().splice(0, this.childNodes.length);
611
+ this.appendChild(new Text(content));
612
+ }
613
+ get firstChild() {
614
+ if (!this._hasInitializedChildNodes()) return null;
615
+ return this.childNodes[0] || null;
616
+ }
617
+ get lastChild() {
618
+ if (!this._hasInitializedChildNodes()) return null;
619
+ return this.childNodes[this.childNodes.length - 1] || null;
620
+ }
621
+ hasChildNodes() {
622
+ return this._hasInitializedChildNodes() && Boolean(this.childNodes.length);
623
+ }
624
+ cloneNode(deep = false) {
625
+ const copy = this._shallowClone();
626
+ copy._setOwnerDocument(this.ownerDocument);
627
+ if (deep && this._hasInitializedChildNodes()) for (const child of this.childNodes) copy.appendChild(child.cloneNode(true));
628
+ return copy;
629
+ }
630
+ _shallowClone() {
631
+ throw new Error("Illegal invocation");
632
+ }
633
+ _remove(skipSetParent = false) {
634
+ const parent = this.parentNode;
635
+ if (parent) {
636
+ const nodeList = parent._getChildNodesMutator();
637
+ const idx = nodeList.indexOf(this);
638
+ nodeList.splice(idx, 1);
639
+ if (!skipSetParent) this._setParent(null);
640
+ }
641
+ }
642
+ appendChild(child) {
643
+ if (isDocumentFragment(child)) {
644
+ this._getChildNodesMutator().push(...child.childNodes);
645
+ moveDocumentFragmentChildren(child, this);
646
+ return child;
647
+ } else return child._appendTo(this);
648
+ }
649
+ _appendTo(parentNode) {
650
+ parentNode._assertNotAncestor(this);
651
+ const oldParentNode = this.parentNode;
652
+ if (oldParentNode === parentNode) {
653
+ if (parentNode._getChildNodesMutator().indexOf(this) !== -1) return this;
654
+ } else if (oldParentNode) this._remove();
655
+ this._setParent(parentNode, true);
656
+ parentNode._getChildNodesMutator().push(this);
657
+ return this;
658
+ }
659
+ removeChild(child) {
660
+ if (child && typeof child === "object") {
661
+ if (child.parentNode === this) {
662
+ child._remove();
663
+ return child;
664
+ } else throw new DOMException("Node.removeChild: The node to be removed is not a child of this node");
665
+ } else throw new TypeError("Node.removeChild: Argument 1 is not an object.");
666
+ }
667
+ replaceChild(newChild, oldChild) {
668
+ if (oldChild.parentNode !== this) throw new Error("Old child's parent is not the current node.");
669
+ oldChild._replaceWith(newChild);
670
+ return oldChild;
671
+ }
672
+ insertBefore(newNode, refNode) {
673
+ this._assertNotAncestor(newNode);
674
+ const mutator = this._getChildNodesMutator();
675
+ if (refNode === null) {
676
+ this.appendChild(newNode);
677
+ return newNode;
678
+ }
679
+ const index = mutator.indexOf(refNode);
680
+ if (index === -1) throw new Error("DOMException: Child to insert before is not a child of this node");
681
+ if (isDocumentFragment(newNode)) {
682
+ mutator.splice(index, 0, ...newNode.childNodes);
683
+ moveDocumentFragmentChildren(newNode, this);
684
+ } else {
685
+ const oldParentNode = newNode.parentNode;
686
+ const oldMutator = oldParentNode?._getChildNodesMutator();
687
+ if (oldMutator) oldMutator.splice(oldMutator.indexOf(newNode), 1);
688
+ newNode._setParent(this, oldParentNode !== this);
689
+ mutator.splice(index, 0, newNode);
690
+ }
691
+ return newNode;
692
+ }
693
+ _replaceWith(...nodes) {
694
+ if (this.parentNode) {
695
+ const parentNode = this.parentNode;
696
+ const mutator = parentNode._getChildNodesMutator();
697
+ let viableNextSibling = null;
698
+ {
699
+ const thisIndex = mutator.indexOf(this);
700
+ for (let i = thisIndex + 1; i < parentNode.childNodes.length; i++) if (!nodes.includes(parentNode.childNodes[i])) {
701
+ viableNextSibling = parentNode.childNodes[i];
702
+ break;
703
+ }
704
+ }
705
+ nodes = nodesAndTextNodes(nodes, parentNode);
706
+ let index = viableNextSibling ? mutator.indexOf(viableNextSibling) : parentNode.childNodes.length;
707
+ let deleteNumber;
708
+ if (parentNode.childNodes[index - 1] === this) {
709
+ index--;
710
+ deleteNumber = 1;
711
+ } else deleteNumber = 0;
712
+ mutator.splice(index, deleteNumber, ...nodes);
713
+ this._setParent(null);
714
+ }
715
+ }
716
+ get nextSibling() {
717
+ const parent = this.parentNode;
718
+ if (!parent) return null;
719
+ const index = parent._getChildNodesMutator().indexOf(this);
720
+ return parent.childNodes[index + 1] || null;
721
+ }
722
+ get previousSibling() {
723
+ const parent = this.parentNode;
724
+ if (!parent) return null;
725
+ const index = parent._getChildNodesMutator().indexOf(this);
726
+ return parent.childNodes[index - 1] || null;
727
+ }
728
+ static DOCUMENT_POSITION_DISCONNECTED = 1;
729
+ static DOCUMENT_POSITION_PRECEDING = 2;
730
+ static DOCUMENT_POSITION_FOLLOWING = 4;
731
+ static DOCUMENT_POSITION_CONTAINS = 8;
732
+ static DOCUMENT_POSITION_CONTAINED_BY = 16;
733
+ static DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 32;
734
+ /**
735
+ * FIXME: Does not implement attribute node checks
736
+ * ref: https://dom.spec.whatwg.org/#dom-node-comparedocumentposition
737
+ * MDN: https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
738
+ */ compareDocumentPosition(other) {
739
+ if (other === this) return 0;
740
+ if (!(other instanceof Node)) throw new TypeError("Node.compareDocumentPosition: Argument 1 does not implement interface Node.");
741
+ let node1Root = other;
742
+ let node2Root = this;
743
+ const node1Hierarchy = [node1Root];
744
+ const node2Hierarchy = [node2Root];
745
+ while (node1Root.parentNode ?? node2Root.parentNode) {
746
+ node1Root = node1Root.parentNode ? (node1Hierarchy.push(node1Root.parentNode), node1Root.parentNode) : node1Root;
747
+ node2Root = node2Root.parentNode ? (node2Hierarchy.push(node2Root.parentNode), node2Root.parentNode) : node2Root;
748
+ }
749
+ if (node1Root !== node2Root) return Node.DOCUMENT_POSITION_DISCONNECTED | Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | Node.DOCUMENT_POSITION_PRECEDING;
750
+ const longerHierarchy = node1Hierarchy.length > node2Hierarchy.length ? node1Hierarchy : node2Hierarchy;
751
+ const shorterHierarchy = longerHierarchy === node1Hierarchy ? node2Hierarchy : node1Hierarchy;
752
+ if (longerHierarchy[longerHierarchy.length - shorterHierarchy.length] === shorterHierarchy[0]) return longerHierarchy === node1Hierarchy ? Node.DOCUMENT_POSITION_CONTAINED_BY | Node.DOCUMENT_POSITION_FOLLOWING : Node.DOCUMENT_POSITION_CONTAINS | Node.DOCUMENT_POSITION_PRECEDING;
753
+ const longerStart = longerHierarchy.length - shorterHierarchy.length;
754
+ for (let i = shorterHierarchy.length - 1; i >= 0; i--) {
755
+ const shorterHierarchyNode = shorterHierarchy[i];
756
+ const longerHierarchyNode = longerHierarchy[longerStart + i];
757
+ if (longerHierarchyNode !== shorterHierarchyNode) {
758
+ const siblings = shorterHierarchyNode.parentNode._getChildNodesMutator();
759
+ if (siblings.indexOf(shorterHierarchyNode) < siblings.indexOf(longerHierarchyNode)) {
760
+ if (shorterHierarchy === node1Hierarchy) return Node.DOCUMENT_POSITION_PRECEDING;
761
+ else return Node.DOCUMENT_POSITION_FOLLOWING;
762
+ } else if (longerHierarchy === node1Hierarchy) return Node.DOCUMENT_POSITION_PRECEDING;
763
+ else return Node.DOCUMENT_POSITION_FOLLOWING;
764
+ }
765
+ }
766
+ return Node.DOCUMENT_POSITION_FOLLOWING;
767
+ }
768
+ getRootNode(opts = {}) {
769
+ if (this.parentNode) return this.parentNode.getRootNode(opts);
770
+ if (opts.composed && this.host) return this.host.getRootNode(opts);
771
+ return this;
772
+ }
773
+ };
774
+ Node.prototype.ELEMENT_NODE = NodeType.ELEMENT_NODE;
775
+ Node.prototype.ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE;
776
+ Node.prototype.TEXT_NODE = NodeType.TEXT_NODE;
777
+ Node.prototype.CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE;
778
+ Node.prototype.ENTITY_REFERENCE_NODE = NodeType.ENTITY_REFERENCE_NODE;
779
+ Node.prototype.ENTITY_NODE = NodeType.ENTITY_NODE;
780
+ Node.prototype.PROCESSING_INSTRUCTION_NODE = NodeType.PROCESSING_INSTRUCTION_NODE;
781
+ Node.prototype.COMMENT_NODE = NodeType.COMMENT_NODE;
782
+ Node.prototype.DOCUMENT_NODE = NodeType.DOCUMENT_NODE;
783
+ Node.prototype.DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE;
784
+ Node.prototype.DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE;
785
+ Node.prototype.NOTATION_NODE = NodeType.NOTATION_NODE;
786
+ var CharacterData = class extends Node {
787
+ #nodeValue = "";
788
+ constructor(data, nodeName, nodeType, parentNode, key) {
789
+ super(nodeName, nodeType, parentNode, key);
790
+ this.#nodeValue = data;
791
+ }
792
+ get nodeValue() {
793
+ return this.#nodeValue;
794
+ }
795
+ set nodeValue(value) {
796
+ this.#nodeValue = String(value ?? "");
797
+ }
798
+ get data() {
799
+ return this.#nodeValue;
800
+ }
801
+ set data(value) {
802
+ this.nodeValue = value;
803
+ }
804
+ get textContent() {
805
+ return this.#nodeValue;
806
+ }
807
+ set textContent(value) {
808
+ this.nodeValue = value;
809
+ }
810
+ get length() {
811
+ return this.data.length;
812
+ }
813
+ before(...nodes) {
814
+ if (this.parentNode) insertBeforeAfter(this, nodes, true);
815
+ }
816
+ after(...nodes) {
817
+ if (this.parentNode) insertBeforeAfter(this, nodes, false);
818
+ }
819
+ remove() {
820
+ this._remove();
821
+ }
822
+ replaceWith(...nodes) {
823
+ this._replaceWith(...nodes);
824
+ }
825
+ };
826
+ var Text = class Text extends CharacterData {
827
+ constructor(text = "") {
828
+ super(String(text), "#text", NodeType.TEXT_NODE, null, CTOR_KEY);
829
+ }
830
+ _shallowClone() {
831
+ return new Text(this.textContent);
832
+ }
833
+ };
834
+ var Comment = class Comment extends CharacterData {
835
+ constructor(text = "") {
836
+ super(String(text), "#comment", NodeType.COMMENT_NODE, null, CTOR_KEY);
837
+ }
838
+ _shallowClone() {
839
+ return new Comment(this.textContent);
840
+ }
841
+ get textContent() {
842
+ return this.nodeValue;
843
+ }
844
+ };
845
+ //#endregion
846
+ //#region node_modules/.pnpm/@jsr+b-fuze__deno-dom@0.1.56/node_modules/@jsr/b-fuze__deno-dom/src/dom/string-cache.js
847
+ const upperCasedStringCache = /* @__PURE__ */ new Map();
848
+ const lowerCasedStringCache = /* @__PURE__ */ new Map();
849
+ function getUpperCase(string) {
850
+ return upperCasedStringCache.get(string) ?? upperCasedStringCache.set(string, string.toUpperCase()).get(string);
851
+ }
852
+ function getLowerCase(string) {
853
+ return lowerCasedStringCache.get(string) ?? lowerCasedStringCache.set(string, string.toLowerCase()).get(string);
854
+ }
855
+ //#endregion
856
+ //#region node_modules/.pnpm/@jsr+b-fuze__deno-dom@0.1.56/node_modules/@jsr/b-fuze__deno-dom/src/dom/element.js
857
+ var _computedKey;
858
+ var _computedKey1;
859
+ var _computedKey2;
860
+ _computedKey = Symbol.iterator;
861
+ var DOMTokenList = class DOMTokenList {
862
+ static #DOM_TOKEN_LIST_MIN_SET_SIZE = 32;
863
+ #_value = "";
864
+ get #value() {
865
+ return this.#_value;
866
+ }
867
+ set #value(value) {
868
+ this.#_value = value;
869
+ this.#onChange(value);
870
+ }
871
+ #set = [];
872
+ #onChange;
873
+ constructor(onChange, key) {
874
+ if (key !== CTOR_KEY) throw new TypeError("Illegal constructor");
875
+ this.#onChange = onChange;
876
+ }
877
+ static #invalidToken(token) {
878
+ return token === "" || /[\t\n\f\r ]/.test(token);
879
+ }
880
+ #setIndices() {
881
+ const classes = Array.from(this.#set);
882
+ for (let i = 0; i < classes.length; i++) this[i] = classes[i];
883
+ }
884
+ set value(input) {
885
+ this.#value = input;
886
+ this.#set = input.trim().split(/[\t\n\f\r\s]+/g).filter(Boolean);
887
+ if (this.#set.length > DOMTokenList.#DOM_TOKEN_LIST_MIN_SET_SIZE) this.#set = new Set(this.#set);
888
+ else {
889
+ const deduplicatedSet = [];
890
+ for (const element of this.#set) if (!deduplicatedSet.includes(element)) deduplicatedSet.push(element);
891
+ this.#set = deduplicatedSet;
892
+ }
893
+ this.#setIndices();
894
+ }
895
+ get value() {
896
+ return this.#_value;
897
+ }
898
+ get length() {
899
+ if (this.#set.constructor === Array) return this.#set.length;
900
+ else return this.#set.size;
901
+ }
902
+ *entries() {
903
+ const array = Array.from(this.#set);
904
+ for (let i = 0; i < array.length; i++) yield [i, array[i]];
905
+ }
906
+ *values() {
907
+ yield* this.#set.values();
908
+ }
909
+ *keys() {
910
+ const length = this.length;
911
+ for (let i = 0; i < length; i++) yield i;
912
+ }
913
+ *[_computedKey]() {
914
+ yield* this.#set.values();
915
+ }
916
+ item(index) {
917
+ index = Number(index);
918
+ if (Number.isNaN(index) || index === Infinity) index = 0;
919
+ return this[Math.trunc(index) % 2 ** 32] ?? null;
920
+ }
921
+ contains(element) {
922
+ if (this.#set.constructor === Array) return this.#set.includes(element);
923
+ else return this.#set.has(element);
924
+ }
925
+ #arrayAdd(element) {
926
+ const array = this.#set;
927
+ if (!array.includes(element)) {
928
+ this[array.length] = element;
929
+ array.push(element);
930
+ }
931
+ }
932
+ #setAdd(element) {
933
+ const set = this.#set;
934
+ const { size } = set;
935
+ set.add(element);
936
+ if (size < set.size) this[size] = element;
937
+ }
938
+ add(...elements) {
939
+ const method = (this.#set.constructor === Array ? this.#arrayAdd : this.#setAdd).bind(this);
940
+ for (const element of elements) {
941
+ if (DOMTokenList.#invalidToken(element)) throw new DOMException("Failed to execute 'add' on 'DOMTokenList': The token provided must not be empty.");
942
+ method(element);
943
+ }
944
+ this.#updateClassString();
945
+ }
946
+ #arrayRemove(element) {
947
+ const array = this.#set;
948
+ const index = array.indexOf(element);
949
+ if (index >= 0) array.splice(index, 1);
950
+ }
951
+ #setRemove(element) {
952
+ this.#set.delete(element);
953
+ }
954
+ remove(...elements) {
955
+ const method = (this.#set.constructor === Array ? this.#arrayRemove : this.#setRemove).bind(this);
956
+ const size = this.length;
957
+ for (const element of elements) {
958
+ if (DOMTokenList.#invalidToken(element)) throw new DOMException("Failed to execute 'remove' on 'DOMTokenList': The token provided must not be empty.");
959
+ method(element);
960
+ }
961
+ const newSize = this.length;
962
+ if (size !== newSize) {
963
+ for (let i = newSize; i < size; i++) delete this[i];
964
+ this.#setIndices();
965
+ }
966
+ this.#updateClassString();
967
+ }
968
+ replace(oldToken, newToken) {
969
+ const isArrayBacked = this.#set.constructor === Array;
970
+ const removeMethod = (isArrayBacked ? this.#arrayRemove : this.#setRemove).bind(this);
971
+ const addMethod = (isArrayBacked ? this.#arrayAdd : this.#setAdd).bind(this);
972
+ if ([oldToken, newToken].some((v) => DOMTokenList.#invalidToken(v))) throw new DOMException("Failed to execute 'replace' on 'DOMTokenList': The token provided must not be empty.");
973
+ if (!this.contains(oldToken)) return false;
974
+ if (this.contains(newToken)) this.remove(oldToken);
975
+ else {
976
+ removeMethod(oldToken);
977
+ addMethod(newToken);
978
+ this.#setIndices();
979
+ this.#updateClassString();
980
+ }
981
+ return true;
982
+ }
983
+ supports() {
984
+ throw new Error("Not implemented");
985
+ }
986
+ toggle(element, force) {
987
+ if (force !== void 0) {
988
+ const operation = force ? "add" : "remove";
989
+ this[operation](element);
990
+ return false;
991
+ } else {
992
+ const contains = this.contains(element);
993
+ const operation = contains ? "remove" : "add";
994
+ this[operation](element);
995
+ return !contains;
996
+ }
997
+ }
998
+ forEach(callback) {
999
+ for (const [i, value] of this.entries()) callback(value, i, this);
1000
+ }
1001
+ #updateClassString() {
1002
+ this.#value = Array.from(this.#set).join(" ");
1003
+ if (this.#set.constructor === Array && this.#set.length > DOMTokenList.#DOM_TOKEN_LIST_MIN_SET_SIZE) this.#set = new Set(this.#set);
1004
+ }
1005
+ };
1006
+ const initializeClassListSym = Symbol("initializeClassListSym");
1007
+ const domTokenListCurrentElementSym = Symbol("domTokenListCurrentElementSym");
1008
+ _computedKey1 = Symbol.iterator;
1009
+ /**
1010
+ * The purpose of this uninitialized DOMTokenList is to consume less memory
1011
+ * than the actual DOMTokenList class. By measurements of Deno v2.1.0 (V8 13.0.245.12-rusty)
1012
+ * this class consumes 48 bytes while the smallest DOMTokenList consumes 488
1013
+ * bytes
1014
+ */ var UninitializedDOMTokenList = class {
1015
+ [domTokenListCurrentElementSym];
1016
+ constructor(currentElement) {
1017
+ this[domTokenListCurrentElementSym] = currentElement;
1018
+ }
1019
+ #getInitialized() {
1020
+ const currentClassList = this[domTokenListCurrentElementSym].classList;
1021
+ if (currentClassList === this) return null;
1022
+ return currentClassList;
1023
+ }
1024
+ set value(input) {
1025
+ this[domTokenListCurrentElementSym][initializeClassListSym]();
1026
+ this[domTokenListCurrentElementSym].classList.value = String(input);
1027
+ }
1028
+ get value() {
1029
+ return this.#getInitialized()?.value ?? "";
1030
+ }
1031
+ get length() {
1032
+ return this.#getInitialized()?.length ?? 0;
1033
+ }
1034
+ *entries() {
1035
+ const initialized = this.#getInitialized();
1036
+ if (initialized) yield* initialized.entries();
1037
+ }
1038
+ *values() {
1039
+ const initialized = this.#getInitialized();
1040
+ if (initialized) yield* initialized.values();
1041
+ }
1042
+ *keys() {
1043
+ const initialized = this.#getInitialized();
1044
+ if (initialized) yield* initialized.keys();
1045
+ }
1046
+ *[_computedKey1]() {
1047
+ yield* this.values();
1048
+ }
1049
+ item(index) {
1050
+ return this.#getInitialized()?.item(index) ?? null;
1051
+ }
1052
+ contains(element) {
1053
+ return this.#getInitialized()?.contains(element) ?? false;
1054
+ }
1055
+ add(...elements) {
1056
+ this[domTokenListCurrentElementSym][initializeClassListSym]();
1057
+ this[domTokenListCurrentElementSym].classList.add(...elements);
1058
+ }
1059
+ remove(...elements) {
1060
+ this.#getInitialized()?.remove(...elements);
1061
+ }
1062
+ replace(oldToken, newToken) {
1063
+ return this.#getInitialized()?.replace(oldToken, newToken) ?? false;
1064
+ }
1065
+ supports() {
1066
+ throw new Error("Not implemented");
1067
+ }
1068
+ toggle(element, force) {
1069
+ if (force === false) return this.#getInitialized()?.toggle(element, force) ?? false;
1070
+ this[domTokenListCurrentElementSym][initializeClassListSym]();
1071
+ this[domTokenListCurrentElementSym].classList.add(element);
1072
+ return true;
1073
+ }
1074
+ forEach(callback) {
1075
+ this.#getInitialized()?.forEach(callback);
1076
+ }
1077
+ };
1078
+ const setNamedNodeMapOwnerElementSym = Symbol("setNamedNodeMapOwnerElementSym");
1079
+ const setAttrValueSym = Symbol("setAttrValueSym");
1080
+ var Attr = class Attr extends Node {
1081
+ #namedNodeMap = null;
1082
+ #name = "";
1083
+ #value = "";
1084
+ #ownerElement = null;
1085
+ constructor(map, name, value, key) {
1086
+ if (key !== CTOR_KEY) throw new TypeError("Illegal constructor");
1087
+ super(name, NodeType.ATTRIBUTE_NODE, null, CTOR_KEY);
1088
+ this.#name = name;
1089
+ this.#value = value;
1090
+ this.#namedNodeMap = map;
1091
+ }
1092
+ [setNamedNodeMapOwnerElementSym](ownerElement) {
1093
+ this.#ownerElement = ownerElement;
1094
+ this.#namedNodeMap = ownerElement?.attributes ?? null;
1095
+ if (ownerElement) this._setOwnerDocument(ownerElement.ownerDocument);
1096
+ }
1097
+ [setAttrValueSym](value) {
1098
+ this.#value = value;
1099
+ }
1100
+ _shallowClone() {
1101
+ const newAttr = new Attr(null, this.#name, this.#value, CTOR_KEY);
1102
+ newAttr._setOwnerDocument(this.ownerDocument);
1103
+ return newAttr;
1104
+ }
1105
+ cloneNode() {
1106
+ return super.cloneNode();
1107
+ }
1108
+ appendChild() {
1109
+ throw new DOMException("Cannot add children to an Attribute");
1110
+ }
1111
+ replaceChild() {
1112
+ throw new DOMException("Cannot add children to an Attribute");
1113
+ }
1114
+ insertBefore() {
1115
+ throw new DOMException("Cannot add children to an Attribute");
1116
+ }
1117
+ removeChild() {
1118
+ throw new DOMException("The node to be removed is not a child of this node");
1119
+ }
1120
+ get name() {
1121
+ return this.#name;
1122
+ }
1123
+ get localName() {
1124
+ return this.#name;
1125
+ }
1126
+ get value() {
1127
+ return this.#value;
1128
+ }
1129
+ set value(value) {
1130
+ this.#value = String(value);
1131
+ if (this.#namedNodeMap) this.#namedNodeMap[setNamedNodeMapValueSym](this.#name, this.#value, true);
1132
+ }
1133
+ get ownerElement() {
1134
+ return this.#ownerElement ?? null;
1135
+ }
1136
+ get specified() {
1137
+ return true;
1138
+ }
1139
+ get prefix() {
1140
+ return null;
1141
+ }
1142
+ };
1143
+ const setNamedNodeMapValueSym = Symbol("setNamedNodeMapValueSym");
1144
+ const getNamedNodeMapValueSym = Symbol("getNamedNodeMapValueSym");
1145
+ const getNamedNodeMapAttrNamesSym = Symbol("getNamedNodeMapAttrNamesSym");
1146
+ const getNamedNodeMapAttrNodeSym = Symbol("getNamedNodeMapAttrNodeSym");
1147
+ const removeNamedNodeMapAttrSym = Symbol("removeNamedNodeMapAttrSym");
1148
+ _computedKey2 = Symbol.iterator;
1149
+ var NamedNodeMap = class NamedNodeMap {
1150
+ static #indexedAttrAccess = function(map, index) {
1151
+ if (index + 1 > this.length) return;
1152
+ const attribute = Object.keys(map).filter((attribute) => map[attribute] !== void 0)[index]?.slice(1);
1153
+ return this[getNamedNodeMapAttrNodeSym](attribute);
1154
+ };
1155
+ #onAttrNodeChange;
1156
+ constructor(ownerElement, onAttrNodeChange, key) {
1157
+ if (key !== CTOR_KEY) throw new TypeError("Illegal constructor.");
1158
+ this.#ownerElement = ownerElement;
1159
+ this.#onAttrNodeChange = onAttrNodeChange;
1160
+ for (const attr of ownerElement.getAttributeNames()) this[setNamedNodeMapValueSym](attr, ownerElement.getAttribute(attr));
1161
+ }
1162
+ #attrNodeCache = {};
1163
+ #map = {};
1164
+ #length = 0;
1165
+ #capacity = 0;
1166
+ #ownerElement = null;
1167
+ [getNamedNodeMapAttrNodeSym](attribute) {
1168
+ const safeAttrName = "a" + attribute;
1169
+ let attrNode = this.#attrNodeCache[safeAttrName];
1170
+ if (!attrNode) {
1171
+ attrNode = this.#attrNodeCache[safeAttrName] = new Attr(this, attribute, this.#map[safeAttrName], CTOR_KEY);
1172
+ attrNode[setNamedNodeMapOwnerElementSym](this.#ownerElement);
1173
+ }
1174
+ return attrNode;
1175
+ }
1176
+ [getNamedNodeMapAttrNamesSym]() {
1177
+ const names = [];
1178
+ for (const [name, value] of Object.entries(this.#map)) if (value !== void 0) names.push(name.slice(1));
1179
+ return names;
1180
+ }
1181
+ [getNamedNodeMapValueSym](attribute) {
1182
+ const safeAttrName = "a" + attribute;
1183
+ return this.#map[safeAttrName];
1184
+ }
1185
+ [setNamedNodeMapValueSym](attribute, value, bubble = false) {
1186
+ const safeAttrName = "a" + attribute;
1187
+ if (this.#map[safeAttrName] === void 0) {
1188
+ this.#length++;
1189
+ if (this.#length > this.#capacity) {
1190
+ this.#capacity = this.#length;
1191
+ const index = this.#capacity - 1;
1192
+ Object.defineProperty(this, String(this.#capacity - 1), { get: NamedNodeMap.#indexedAttrAccess.bind(this, this.#map, index) });
1193
+ }
1194
+ } else if (this.#attrNodeCache[safeAttrName]) this.#attrNodeCache[safeAttrName][setAttrValueSym](value);
1195
+ this.#map[safeAttrName] = value;
1196
+ if (bubble) this.#onAttrNodeChange(attribute, value);
1197
+ }
1198
+ /**
1199
+ * Called when an attribute is removed from
1200
+ * an element
1201
+ */ [removeNamedNodeMapAttrSym](attribute) {
1202
+ const safeAttrName = "a" + attribute;
1203
+ if (this.#map[safeAttrName] !== void 0) {
1204
+ this.#length--;
1205
+ this.#map[safeAttrName] = void 0;
1206
+ this.#onAttrNodeChange(attribute, null);
1207
+ const attrNode = this.#attrNodeCache[safeAttrName];
1208
+ if (attrNode) {
1209
+ attrNode[setNamedNodeMapOwnerElementSym](null);
1210
+ this.#attrNodeCache[safeAttrName] = void 0;
1211
+ }
1212
+ }
1213
+ }
1214
+ *[_computedKey2]() {
1215
+ for (let i = 0; i < this.length; i++) yield this[i];
1216
+ }
1217
+ get length() {
1218
+ return this.#length;
1219
+ }
1220
+ item(index) {
1221
+ if (index >= this.#length) return null;
1222
+ return this[index];
1223
+ }
1224
+ getNamedItem(attribute) {
1225
+ const safeAttrName = "a" + attribute;
1226
+ if (this.#map[safeAttrName] !== void 0) return this[getNamedNodeMapAttrNodeSym](attribute);
1227
+ return null;
1228
+ }
1229
+ setNamedItem(attrNode) {
1230
+ if (attrNode.ownerElement) throw new DOMException("Attribute already in use");
1231
+ const safeAttrName = "a" + attrNode.name;
1232
+ const previousAttr = this.#attrNodeCache[safeAttrName];
1233
+ if (previousAttr) {
1234
+ previousAttr[setNamedNodeMapOwnerElementSym](null);
1235
+ this.#map[safeAttrName] = void 0;
1236
+ }
1237
+ attrNode[setNamedNodeMapOwnerElementSym](this.#ownerElement);
1238
+ this.#attrNodeCache[safeAttrName] = attrNode;
1239
+ this[setNamedNodeMapValueSym](attrNode.name, attrNode.value, true);
1240
+ }
1241
+ removeNamedItem(attribute) {
1242
+ const safeAttrName = "a" + attribute;
1243
+ if (this.#map[safeAttrName] !== void 0) {
1244
+ const attrNode = this[getNamedNodeMapAttrNodeSym](attribute);
1245
+ this[removeNamedNodeMapAttrSym](attribute);
1246
+ return attrNode;
1247
+ }
1248
+ throw new DOMException("Node was not found");
1249
+ }
1250
+ };
1251
+ const XML_NAMESTART_CHAR_RE_SRC = ":A-Za-z_" + String.raw`\u{C0}-\u{D6}\u{D8}-\u{F6}\u{F8}-\u{2FF}\u{370}-\u{37D}` + String.raw`\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}` + String.raw`\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}`;
1252
+ const XML_NAME_CHAR_RE_SRC = XML_NAMESTART_CHAR_RE_SRC + String.raw`\u{B7}\u{0300}-\u{036F}\u{203F}-\u{2040}0-9.-`;
1253
+ new RegExp(`[${XML_NAMESTART_CHAR_RE_SRC}]`, "u");
1254
+ const xmlNameCharRe = new RegExp(`[${XML_NAME_CHAR_RE_SRC}]`, "u");
1255
+ var Element$1 = class Element$1 extends Node {
1256
+ #namedNodeMap = null;
1257
+ get attributes() {
1258
+ if (!this.#namedNodeMap) this.#namedNodeMap = new NamedNodeMap(this, (attribute, value) => {
1259
+ const isRemoved = value === null;
1260
+ if (value === null) value = "";
1261
+ switch (attribute) {
1262
+ case "class":
1263
+ if (isRemoved) this.#hasClassNameAttribute = -1;
1264
+ else if (this.#hasClassNameAttribute === -1) this.#hasClassNameAttribute = this.#hasIdAttribute + 1;
1265
+ this.#currentClassName = value;
1266
+ this.#classList.value = value;
1267
+ break;
1268
+ case "id":
1269
+ if (isRemoved) this.#hasIdAttribute = -1;
1270
+ else if (this.#hasIdAttribute === -1) this.#hasIdAttribute = this.#hasClassNameAttribute + 1;
1271
+ this.#currentId = value;
1272
+ }
1273
+ }, CTOR_KEY);
1274
+ return this.#namedNodeMap;
1275
+ }
1276
+ #datasetProxy = null;
1277
+ #currentId = "";
1278
+ #currentClassName = "";
1279
+ #hasIdAttribute = -1;
1280
+ #hasClassNameAttribute = -1;
1281
+ #classListInstance = new UninitializedDOMTokenList(this);
1282
+ get #classList() {
1283
+ return this.#classListInstance;
1284
+ }
1285
+ [initializeClassListSym]() {
1286
+ if (this.#classListInstance.constructor === DOMTokenList) return;
1287
+ this.#classListInstance = new DOMTokenList((className) => {
1288
+ if (this.#currentClassName !== className) {
1289
+ this.#currentClassName = className;
1290
+ if (this.#hasClassNameAttribute === -1) this.#hasClassNameAttribute = this.#hasIdAttribute + 1;
1291
+ if (this.#namedNodeMap && (this.hasAttribute("class") || className !== "")) this.attributes[setNamedNodeMapValueSym]("class", className);
1292
+ }
1293
+ }, CTOR_KEY);
1294
+ }
1295
+ constructor(tagName, parentNode, attributes, key) {
1296
+ super(tagName, NodeType.ELEMENT_NODE, parentNode, key);
1297
+ for (const attr of attributes) this.setAttribute(attr[0], attr[1]);
1298
+ this.nodeName = getUpperCase(tagName);
1299
+ }
1300
+ get tagName() {
1301
+ return this.nodeName;
1302
+ }
1303
+ get localName() {
1304
+ return getLowerCase(this.tagName);
1305
+ }
1306
+ _shallowClone() {
1307
+ const attributes = [];
1308
+ for (const attribute of this.getAttributeNames()) attributes.push([attribute, this.getAttribute(attribute)]);
1309
+ return new Element$1(this.nodeName, null, attributes, CTOR_KEY);
1310
+ }
1311
+ get childElementCount() {
1312
+ return this._getChildNodesMutator().elementsView().length;
1313
+ }
1314
+ get className() {
1315
+ return this.#currentClassName;
1316
+ }
1317
+ set className(className) {
1318
+ this.#classList.value = className;
1319
+ }
1320
+ get classList() {
1321
+ return this.#classList;
1322
+ }
1323
+ get outerHTML() {
1324
+ return getOuterOrInnerHtml(this, true);
1325
+ }
1326
+ set outerHTML(html) {
1327
+ if (this.parentNode) {
1328
+ const { parentElement, parentNode } = this;
1329
+ let contextLocalName = parentElement?.localName;
1330
+ switch (parentNode.nodeType) {
1331
+ case NodeType.DOCUMENT_NODE: throw new DOMException("Modifications are not allowed for this document");
1332
+ case NodeType.DOCUMENT_FRAGMENT_NODE: contextLocalName = "body";
1333
+ default: {
1334
+ const { childNodes: newChildNodes } = fragmentNodesFromString(html, contextLocalName).childNodes[0];
1335
+ const mutator = parentNode._getChildNodesMutator();
1336
+ const insertionIndex = mutator.indexOf(this);
1337
+ for (let i = newChildNodes.length - 1; i >= 0; i--) {
1338
+ const child = newChildNodes[i];
1339
+ mutator.splice(insertionIndex, 0, child);
1340
+ child._setParent(parentNode);
1341
+ child._setOwnerDocument(parentNode.ownerDocument);
1342
+ }
1343
+ this.remove();
1344
+ }
1345
+ }
1346
+ }
1347
+ }
1348
+ get innerHTML() {
1349
+ return getOuterOrInnerHtml(this, false);
1350
+ }
1351
+ set innerHTML(html) {
1352
+ for (const child of this.childNodes) child._setParent(null);
1353
+ const mutator = this._getChildNodesMutator();
1354
+ mutator.splice(0, this.childNodes.length);
1355
+ if (html.length) {
1356
+ const parsed = fragmentNodesFromString(html, this.localName);
1357
+ for (const child of parsed.childNodes[0].childNodes) mutator.push(child);
1358
+ for (const child of this.childNodes) {
1359
+ child._setParent(this);
1360
+ child._setOwnerDocument(this.ownerDocument);
1361
+ }
1362
+ }
1363
+ }
1364
+ get innerText() {
1365
+ return this.textContent;
1366
+ }
1367
+ set innerText(text) {
1368
+ this.textContent = text;
1369
+ }
1370
+ get children() {
1371
+ return this._getChildNodesMutator().elementsView();
1372
+ }
1373
+ get id() {
1374
+ return this.#currentId || "";
1375
+ }
1376
+ set id(id) {
1377
+ this.setAttribute("id", id);
1378
+ }
1379
+ get dataset() {
1380
+ if (this.#datasetProxy) return this.#datasetProxy;
1381
+ this.#datasetProxy = new Proxy({}, {
1382
+ get: (_target, property, _receiver) => {
1383
+ if (typeof property === "string") {
1384
+ const attributeName = getDatasetHtmlAttrName(property);
1385
+ return this.getAttribute(attributeName) ?? void 0;
1386
+ }
1387
+ },
1388
+ set: (_target, property, value, _receiver) => {
1389
+ if (typeof property === "string") {
1390
+ let attributeName = "data-";
1391
+ let prevChar = "";
1392
+ for (const char of property) {
1393
+ if (prevChar === "-" && lowerCaseCharRe.test(char)) throw new DOMException("An invalid or illegal string was specified");
1394
+ if (!xmlNameCharRe.test(char)) throw new DOMException("String contains an invalid character");
1395
+ if (upperCaseCharRe.test(char)) attributeName += "-";
1396
+ attributeName += char.toLowerCase();
1397
+ prevChar = char;
1398
+ }
1399
+ this.setAttribute(attributeName, String(value));
1400
+ }
1401
+ return true;
1402
+ },
1403
+ deleteProperty: (_target, property) => {
1404
+ if (typeof property === "string") {
1405
+ const attributeName = getDatasetHtmlAttrName(property);
1406
+ this.removeAttribute(attributeName);
1407
+ }
1408
+ return true;
1409
+ },
1410
+ ownKeys: (_target) => {
1411
+ return this.getAttributeNames().flatMap((attributeName) => {
1412
+ if (attributeName.startsWith?.("data-")) return [getDatasetJavascriptName(attributeName)];
1413
+ else return [];
1414
+ });
1415
+ },
1416
+ getOwnPropertyDescriptor: (_target, property) => {
1417
+ if (typeof property === "string") {
1418
+ const attributeName = getDatasetHtmlAttrName(property);
1419
+ if (this.hasAttribute(attributeName)) return {
1420
+ writable: true,
1421
+ enumerable: true,
1422
+ configurable: true
1423
+ };
1424
+ }
1425
+ },
1426
+ has: (_target, property) => {
1427
+ if (typeof property === "string") {
1428
+ const attributeName = getDatasetHtmlAttrName(property);
1429
+ return this.hasAttribute(attributeName);
1430
+ }
1431
+ return false;
1432
+ }
1433
+ });
1434
+ return this.#datasetProxy;
1435
+ }
1436
+ getAttributeNames() {
1437
+ if (!this.#namedNodeMap) {
1438
+ const attributes = [];
1439
+ const startWithClassAttr = Number(this.#hasIdAttribute > this.#hasClassNameAttribute);
1440
+ for (let i = 0; i < 2; i++) switch ((i + startWithClassAttr) % 2) {
1441
+ case 0:
1442
+ ~this.#hasIdAttribute && attributes.push("id");
1443
+ break;
1444
+ case 1: ~this.#hasClassNameAttribute && attributes.push("class");
1445
+ }
1446
+ return attributes;
1447
+ }
1448
+ return this.attributes[getNamedNodeMapAttrNamesSym]();
1449
+ }
1450
+ getAttribute(rawName) {
1451
+ const name = getLowerCase(String(rawName));
1452
+ switch (name) {
1453
+ case "id": if (~this.#hasIdAttribute) return this.#currentId;
1454
+ else return null;
1455
+ case "class": if (~this.#hasClassNameAttribute) return this.#currentClassName;
1456
+ else return null;
1457
+ }
1458
+ if (!this.#namedNodeMap) return null;
1459
+ return this.attributes[getNamedNodeMapValueSym](name) ?? null;
1460
+ }
1461
+ setAttribute(rawName, value) {
1462
+ const name = getLowerCase(String(rawName));
1463
+ const strValue = String(value);
1464
+ let isNormalAttribute = false;
1465
+ switch (name) {
1466
+ case "id":
1467
+ this.#currentId = strValue;
1468
+ if (this.#hasIdAttribute === -1) this.#hasIdAttribute = this.#hasClassNameAttribute + 1;
1469
+ break;
1470
+ case "class":
1471
+ this.#classList.value = strValue;
1472
+ if (this.#hasClassNameAttribute === -1) this.#hasClassNameAttribute = this.#hasIdAttribute + 1;
1473
+ break;
1474
+ default: isNormalAttribute = true;
1475
+ }
1476
+ if (this.#namedNodeMap || isNormalAttribute) this.attributes[setNamedNodeMapValueSym](name, strValue);
1477
+ }
1478
+ removeAttribute(rawName) {
1479
+ const name = getLowerCase(String(rawName));
1480
+ switch (name) {
1481
+ case "id":
1482
+ this.#currentId = "";
1483
+ this.#hasIdAttribute = -1;
1484
+ break;
1485
+ case "class":
1486
+ this.#classList.value = "";
1487
+ this.#hasClassNameAttribute = -1;
1488
+ }
1489
+ if (!this.#namedNodeMap) return;
1490
+ this.attributes[removeNamedNodeMapAttrSym](name);
1491
+ }
1492
+ toggleAttribute(rawName, force) {
1493
+ const name = getLowerCase(String(rawName));
1494
+ if (this.hasAttribute(name)) {
1495
+ if (force === void 0 || force === false) {
1496
+ this.removeAttribute(name);
1497
+ return false;
1498
+ }
1499
+ return true;
1500
+ }
1501
+ if (force === void 0 || force === true) {
1502
+ this.setAttribute(name, "");
1503
+ return true;
1504
+ }
1505
+ return false;
1506
+ }
1507
+ hasAttribute(rawName) {
1508
+ const name = getLowerCase(String(rawName));
1509
+ switch (name) {
1510
+ case "id": return Boolean(~this.#hasIdAttribute);
1511
+ case "class": return Boolean(~this.#hasClassNameAttribute);
1512
+ }
1513
+ if (!this.#namedNodeMap) return false;
1514
+ return this.attributes[getNamedNodeMapValueSym](name) !== void 0;
1515
+ }
1516
+ hasAttributeNS(_namespace, rawName) {
1517
+ const name = getLowerCase(String(rawName));
1518
+ switch (name) {
1519
+ case "id": return Boolean(~this.#hasIdAttribute);
1520
+ case "class": return Boolean(~this.#hasClassNameAttribute);
1521
+ }
1522
+ if (!this.#namedNodeMap) return false;
1523
+ return this.attributes[getNamedNodeMapValueSym](name) !== void 0;
1524
+ }
1525
+ /**
1526
+ * https://dom.spec.whatwg.org/#concept-element-attributes-get-by-name
1527
+ */ getAttributeNode(rawName) {
1528
+ const name = getLowerCase(String(rawName));
1529
+ return this.attributes.getNamedItem(name);
1530
+ }
1531
+ /**
1532
+ * https://dom.spec.whatwg.org/#concept-element-attributes-set
1533
+ */ setAttributeNode(attr) {
1534
+ if (attr?.constructor !== Attr) throw new TypeError("Element.setAttributeNode: Argument 1 does not implement interface Attr");
1535
+ const attrName = attr.localName;
1536
+ const oldAttr = this.attributes.getNamedItem(attrName);
1537
+ if (oldAttr === attr) return attr;
1538
+ this.attributes.setNamedItem(attr);
1539
+ return oldAttr;
1540
+ }
1541
+ replaceWith(...nodes) {
1542
+ this._replaceWith(...nodes);
1543
+ }
1544
+ remove() {
1545
+ this._remove();
1546
+ }
1547
+ append(...nodes) {
1548
+ this._getChildNodesMutator().push(...nodesAndTextNodes(nodes, this));
1549
+ }
1550
+ prepend(...nodes) {
1551
+ this._getChildNodesMutator().splice(0, 0, ...nodesAndTextNodes(nodes, this));
1552
+ }
1553
+ before(...nodes) {
1554
+ if (this.parentNode) insertBeforeAfter(this, nodes, true);
1555
+ }
1556
+ after(...nodes) {
1557
+ if (this.parentNode) insertBeforeAfter(this, nodes, false);
1558
+ }
1559
+ get firstElementChild() {
1560
+ return this._getChildNodesMutator().elementsView()[0] ?? null;
1561
+ }
1562
+ get lastElementChild() {
1563
+ const elements = this._getChildNodesMutator().elementsView();
1564
+ return elements[elements.length - 1] ?? null;
1565
+ }
1566
+ get nextElementSibling() {
1567
+ const parent = this.parentNode;
1568
+ if (!parent) return null;
1569
+ const mutator = parent._getChildNodesMutator();
1570
+ const index = mutator.indexOfElementsView(this);
1571
+ return mutator.elementsView()[index + 1] ?? null;
1572
+ }
1573
+ get previousElementSibling() {
1574
+ const parent = this.parentNode;
1575
+ if (!parent) return null;
1576
+ const mutator = parent._getChildNodesMutator();
1577
+ const index = mutator.indexOfElementsView(this);
1578
+ return mutator.elementsView()[index - 1] ?? null;
1579
+ }
1580
+ querySelector(selectors) {
1581
+ if (!this.ownerDocument) throw new Error("Element must have an owner document");
1582
+ return this.ownerDocument._nwapi.first(selectors, this);
1583
+ }
1584
+ querySelectorAll(selectors) {
1585
+ if (!this.ownerDocument) throw new Error("Element must have an owner document");
1586
+ const nodeList = new NodeList();
1587
+ const mutator = nodeList[nodeListMutatorSym]();
1588
+ for (const match of this.ownerDocument._nwapi.select(selectors, this)) mutator.push(match);
1589
+ return nodeList;
1590
+ }
1591
+ matches(selectorString) {
1592
+ return this.ownerDocument._nwapi.match(selectorString, this);
1593
+ }
1594
+ closest(selectorString) {
1595
+ const { match } = this.ownerDocument._nwapi;
1596
+ let el = this;
1597
+ do {
1598
+ if (match(selectorString, el)) return el;
1599
+ el = el.parentElement;
1600
+ } while (el !== null);
1601
+ return null;
1602
+ }
1603
+ getElementById(id) {
1604
+ if (!this._hasInitializedChildNodes()) return null;
1605
+ for (const child of this.childNodes) if (child.nodeType === NodeType.ELEMENT_NODE) {
1606
+ if (child.id === id) return child;
1607
+ const search = child.getElementById(id);
1608
+ if (search) return search;
1609
+ }
1610
+ return null;
1611
+ }
1612
+ getElementsByTagName(tagName) {
1613
+ if (!this._hasInitializedChildNodes()) return [];
1614
+ const fixCaseTagName = getUpperCase(tagName);
1615
+ if (fixCaseTagName === "*") return this._getElementsByTagNameWildcard([]);
1616
+ else return this._getElementsByTagName(fixCaseTagName, []);
1617
+ }
1618
+ _getElementsByTagNameWildcard(search) {
1619
+ if (!this._hasInitializedChildNodes()) return search;
1620
+ for (const child of this.childNodes) if (child.nodeType === NodeType.ELEMENT_NODE) {
1621
+ search.push(child);
1622
+ child._getElementsByTagNameWildcard(search);
1623
+ }
1624
+ return search;
1625
+ }
1626
+ _getElementsByTagName(tagName, search) {
1627
+ if (!this._hasInitializedChildNodes()) return search;
1628
+ for (const child of this.childNodes) if (child.nodeType === NodeType.ELEMENT_NODE) {
1629
+ if (child.tagName === tagName) search.push(child);
1630
+ child._getElementsByTagName(tagName, search);
1631
+ }
1632
+ return search;
1633
+ }
1634
+ getElementsByClassName(className) {
1635
+ if (!this._hasInitializedChildNodes()) return [];
1636
+ return getElementsByClassName(this, className.trim().split(/\s+/), []);
1637
+ }
1638
+ getElementsByTagNameNS(_namespace, localName) {
1639
+ if (!this._hasInitializedChildNodes()) return [];
1640
+ return this.getElementsByTagName(localName);
1641
+ }
1642
+ };
1643
+ utils_types_default.Element = Element$1;
1644
+ //#endregion
1645
+ //#region node_modules/.pnpm/@jsr+b-fuze__deno-dom@0.1.56/node_modules/@jsr/b-fuze__deno-dom/src/dom/selectors/custom-api.js
1646
+ /**
1647
+ * Symbols for using getElementsByTagName/ClassName on document-fragment
1648
+ */ const customByTagNameSym = Symbol();
1649
+ const customByClassNameSym = Symbol();
1650
+ //#endregion
1651
+ //#region node_modules/.pnpm/@jsr+b-fuze__deno-dom@0.1.56/node_modules/@jsr/b-fuze__deno-dom/src/dom/document-fragment.js
1652
+ var DocumentFragment$1 = class DocumentFragment$1 extends Node {
1653
+ constructor() {
1654
+ super("#document-fragment", NodeType.DOCUMENT_FRAGMENT_NODE, null, CTOR_KEY);
1655
+ }
1656
+ get childElementCount() {
1657
+ return this._getChildNodesMutator().elementsView().length;
1658
+ }
1659
+ get children() {
1660
+ return this._getChildNodesMutator().elementsView();
1661
+ }
1662
+ get firstElementChild() {
1663
+ return this._getChildNodesMutator().elementsView()[0] ?? null;
1664
+ }
1665
+ get lastElementChild() {
1666
+ const elements = this._getChildNodesMutator().elementsView();
1667
+ return elements[elements.length - 1] ?? null;
1668
+ }
1669
+ _shallowClone() {
1670
+ return new DocumentFragment$1();
1671
+ }
1672
+ append(...nodes) {
1673
+ this._getChildNodesMutator().push(...nodesAndTextNodes(nodes, this));
1674
+ }
1675
+ prepend(...nodes) {
1676
+ this._getChildNodesMutator().splice(0, 0, ...nodesAndTextNodes(nodes, this));
1677
+ }
1678
+ replaceChildren(...nodes) {
1679
+ const mutator = this._getChildNodesMutator();
1680
+ for (const child of this.childNodes) child._setParent(null);
1681
+ mutator.splice(0, this.childNodes.length);
1682
+ mutator.splice(0, 0, ...nodesAndTextNodes(nodes, this));
1683
+ }
1684
+ getElementById(id) {
1685
+ for (const child of this.childNodes) if (child.nodeType === NodeType.ELEMENT_NODE) {
1686
+ if (child.id === id) return child;
1687
+ const search = child.getElementById(id);
1688
+ if (search) return search;
1689
+ }
1690
+ return null;
1691
+ }
1692
+ querySelector(selectors) {
1693
+ if (!this.ownerDocument) throw new Error("DocumentFragment must have an owner document");
1694
+ return this.ownerDocument._nwapi.first(selectors, this);
1695
+ }
1696
+ querySelectorAll(selectors) {
1697
+ if (!this.ownerDocument) throw new Error("DocumentFragment must have an owner document");
1698
+ const nodeList = new NodeList();
1699
+ nodeList[nodeListMutatorSym]().push(...this.ownerDocument._nwapi.select(selectors, this));
1700
+ return nodeList;
1701
+ }
1702
+ };
1703
+ utils_types_default.DocumentFragment = DocumentFragment$1;
1704
+ function documentFragmentGetElementsByTagName(tagName) {
1705
+ const search = [];
1706
+ if (tagName === "*") return documentFragmentGetElementsByTagNameWildcard(this, search);
1707
+ for (const child of this.childNodes) if (child.nodeType === NodeType.ELEMENT_NODE) {
1708
+ if (child.tagName === tagName) search.push(child);
1709
+ child._getElementsByTagName(tagName, search);
1710
+ }
1711
+ return search;
1712
+ }
1713
+ function documentFragmentGetElementsByClassName(className) {
1714
+ return getElementsByClassName(this, className.trim().split(/\s+/), []);
1715
+ }
1716
+ function documentFragmentGetElementsByTagNameWildcard(fragment, search) {
1717
+ for (const child of fragment.childNodes) if (child.nodeType === NodeType.ELEMENT_NODE) {
1718
+ search.push(child);
1719
+ child._getElementsByTagNameWildcard(search);
1720
+ }
1721
+ return search;
1722
+ }
1723
+ DocumentFragment$1.prototype[customByTagNameSym] = documentFragmentGetElementsByTagName;
1724
+ DocumentFragment$1.prototype[customByClassNameSym] = documentFragmentGetElementsByClassName;
1725
+ //#endregion
1726
+ //#region node_modules/.pnpm/@jsr+b-fuze__deno-dom@0.1.56/node_modules/@jsr/b-fuze__deno-dom/src/dom/elements/html-template-element.js
1727
+ var HTMLTemplateElement = class HTMLTemplateElement extends Element$1 {
1728
+ /**
1729
+ * This blocks access to the .#contents property when the
1730
+ * super() constructor is running which invokes (our
1731
+ * overridden) _setParent() method. Without it, we get
1732
+ * the following error thrown:
1733
+ *
1734
+ * TypeError: Cannot read private member #content from
1735
+ * an object whose class did not declare it
1736
+ *
1737
+ * FIXME: Maybe find a cleaner way to do this
1738
+ */ __contentIsSet = false;
1739
+ #content = null;
1740
+ constructor(parentNode, attributes, key, content) {
1741
+ super("TEMPLATE", parentNode, attributes, key);
1742
+ this.#content = content;
1743
+ this.__contentIsSet = true;
1744
+ }
1745
+ get content() {
1746
+ return this.#content;
1747
+ }
1748
+ _setOwnerDocument(document) {
1749
+ super._setOwnerDocument(document);
1750
+ if (this.__contentIsSet) this.content._setOwnerDocument(document);
1751
+ }
1752
+ _shallowClone() {
1753
+ const frag = new DocumentFragment$1();
1754
+ const attributes = this.getAttributeNames().map((name) => [name, this.getAttribute(name)]);
1755
+ return new HTMLTemplateElement(null, attributes, CTOR_KEY, frag);
1756
+ }
1757
+ cloneNode(deep = false) {
1758
+ const newNode = super.cloneNode(deep);
1759
+ if (deep) {
1760
+ const destContent = newNode.content;
1761
+ for (const child of this.content.childNodes) destContent.appendChild(child.cloneNode(deep));
1762
+ }
1763
+ return newNode;
1764
+ }
1765
+ get innerHTML() {
1766
+ return getOuterOrInnerHtml(this, false);
1767
+ }
1768
+ set innerHTML(html) {
1769
+ const content = this.content;
1770
+ for (const child of content.childNodes) child._setParent(null);
1771
+ const mutator = content._getChildNodesMutator();
1772
+ mutator.splice(0, content.childNodes.length);
1773
+ if (html.length) {
1774
+ const parsed = fragmentNodesFromString(html, this.localName);
1775
+ mutator.push(...parsed.childNodes[0].childNodes);
1776
+ for (const child of content.childNodes) {
1777
+ child._setParent(content);
1778
+ child._setOwnerDocument(content.ownerDocument);
1779
+ }
1780
+ }
1781
+ }
1782
+ get outerHTML() {
1783
+ return `<template${getElementAttributesString(this)}>${this.innerHTML}</template>`;
1784
+ }
1785
+ };
1786
+ //#endregion
1787
+ //#region node_modules/.pnpm/@jsr+b-fuze__deno-dom@0.1.56/node_modules/@jsr/b-fuze__deno-dom/src/dom/selectors/nwsapi.js
1788
+ var nwsapi_default = (document) => {
1789
+ const NW = Factory({
1790
+ document,
1791
+ DOMException
1792
+ }, "null");
1793
+ NW.configure({
1794
+ IDS_DUPES: false,
1795
+ LOGERRORS: false
1796
+ });
1797
+ return NW;
1798
+ };
1799
+ function Factory(global, Export) {
1800
+ var version = "nwsapi-2.2.0", doc = global.document, root = doc.documentElement, slice = Array.prototype.slice, WSP = "[\\x20\\t\\r\\n\\f]", CFG = {
1801
+ operators: "[~*^$|]=|=",
1802
+ combinators: "[\\x20\\t>+~](?=[^>+~])"
1803
+ }, NOT = {
1804
+ double_enc: "(?=(?:[^\"]*[\"][^\"]*[\"])*[^\"]*$)",
1805
+ single_enc: "(?=(?:[^']*['][^']*['])*[^']*$)",
1806
+ parens_enc: "(?![^\\x28]*\\x29)",
1807
+ square_enc: "(?![^\\x5b]*\\x5d)"
1808
+ }, REX = {
1809
+ HasEscapes: RegExp("\\\\"),
1810
+ HexNumbers: RegExp("^[0-9a-fA-F]"),
1811
+ EscOrQuote: RegExp("^\\\\|[\\x22\\x27]"),
1812
+ RegExpChar: RegExp("(?:(?!\\\\)[\\\\^$.*+?()[\\]{}|\\/])", "g"),
1813
+ TrimSpaces: RegExp("[\\r\\n\\f]|^" + WSP + "+|" + WSP + "+$", "g"),
1814
+ CommaGroup: RegExp("(\\s*,\\s*)" + NOT.square_enc + NOT.parens_enc, "g"),
1815
+ SplitGroup: RegExp("((?:\\x28[^\\x29]*\\x29|\\[[^\\]]*\\]|\\\\.|[^,])+)", "g"),
1816
+ FixEscapes: RegExp("\\\\([0-9a-fA-F]{1,6}" + WSP + "?|.)|([\\x22\\x27])", "g"),
1817
+ CombineWSP: RegExp("[\\n\\r\\f\\x20]+" + NOT.single_enc + NOT.double_enc, "g"),
1818
+ TabCharWSP: RegExp("(\\x20?\\t+\\x20?)" + NOT.single_enc + NOT.double_enc, "g"),
1819
+ PseudosWSP: RegExp("\\s+([-+])\\s+" + NOT.square_enc, "g")
1820
+ }, STD = {
1821
+ combinator: RegExp("\\s?([>+~])\\s?", "g"),
1822
+ apimethods: RegExp("^(?:[a-z]+|\\*)\\|", "i"),
1823
+ namespaces: RegExp("(\\*|[a-z]+)\\|[-a-z]+", "i")
1824
+ }, GROUPS = {
1825
+ linguistic: "(dir|lang)\\x28\\s?([-\\w]{2,})\\s?(?:\\x29|$)",
1826
+ logicalsel: "(is|where|matches|not)\\x28\\s?([^()]*|[^\\x28]*\\x28[^\\x29]*\\x29)\\s?(?:\\x29|$)",
1827
+ treestruct: "(nth(?:-last)?(?:-child|-of-type))(?:\\x28\\s?(even|odd|(?:[-+]?\\d*)(?:n\\s?[-+]?\\s?\\d*)?)\\s?(?:\\x29|$))",
1828
+ locationpc: "(any-link|link|visited|target)\\b",
1829
+ useraction: "(hover|active|focus|focus-within)\\b",
1830
+ structural: "(root|empty|(?:(?:first|last|only)(?:-child|-of-type)))\\b",
1831
+ inputstate: "(enabled|disabled|read-only|read-write|placeholder-shown|default)\\b",
1832
+ inputvalue: "(checked|indeterminate|required|optional|valid|invalid|in-range|out-of-range)\\b",
1833
+ pseudo_sng: "(after|before|first-letter|first-line)\\b",
1834
+ pseudo_dbl: ":(after|before|first-letter|first-line|selection|placeholder|-webkit-[-a-zA-Z0-9]{2,})\\b"
1835
+ }, Patterns = {
1836
+ treestruct: RegExp("^:(?:" + GROUPS.treestruct + ")(.*)", "i"),
1837
+ structural: RegExp("^:(?:" + GROUPS.structural + ")(.*)", "i"),
1838
+ linguistic: RegExp("^:(?:" + GROUPS.linguistic + ")(.*)", "i"),
1839
+ useraction: RegExp("^:(?:" + GROUPS.useraction + ")(.*)", "i"),
1840
+ inputstate: RegExp("^:(?:" + GROUPS.inputstate + ")(.*)", "i"),
1841
+ inputvalue: RegExp("^:(?:" + GROUPS.inputvalue + ")(.*)", "i"),
1842
+ locationpc: RegExp("^:(?:" + GROUPS.locationpc + ")(.*)", "i"),
1843
+ logicalsel: RegExp("^:(?:" + GROUPS.logicalsel + ")(.*)", "i"),
1844
+ pseudo_dbl: RegExp("^:(?:" + GROUPS.pseudo_dbl + ")(.*)", "i"),
1845
+ pseudo_sng: RegExp("^:(?:" + GROUPS.pseudo_sng + ")(.*)", "i"),
1846
+ children: RegExp("^" + WSP + "?\\>" + WSP + "?(.*)"),
1847
+ adjacent: RegExp("^" + WSP + "?\\+" + WSP + "?(.*)"),
1848
+ relative: RegExp("^" + WSP + "?\\~" + WSP + "?(.*)"),
1849
+ ancestor: RegExp("^" + WSP + "+(.*)"),
1850
+ universal: RegExp("^\\*(.*)"),
1851
+ namespace: RegExp("^(\\w+|\\*)?\\|(.*)")
1852
+ }, RTL = RegExp("^[\\u0591-\\u08ff\\ufb1d-\\ufdfd\\ufe70-\\ufefc ]+$"), qsNotArgs = "Not enough arguments", qsInvalid = " is not a valid selector", reNthElem = RegExp("(:nth(?:-last)?-child)", "i"), reNthType = RegExp("(:nth(?:-last)?-of-type)", "i"), reOptimizer, reValidator, Config = {
1853
+ IDS_DUPES: true,
1854
+ MIXEDCASE: true,
1855
+ LOGERRORS: true,
1856
+ VERBOSITY: true
1857
+ }, NAMESPACE, QUIRKS_MODE, HTML_DOCUMENT, ATTR_STD_OPS = {
1858
+ "=": 1,
1859
+ "^=": 1,
1860
+ "$=": 1,
1861
+ "|=": 1,
1862
+ "*=": 1,
1863
+ "~=": 1
1864
+ }, HTML_TABLE = {
1865
+ "accept": 1,
1866
+ "accept-charset": 1,
1867
+ "align": 1,
1868
+ "alink": 1,
1869
+ "axis": 1,
1870
+ "bgcolor": 1,
1871
+ "charset": 1,
1872
+ "checked": 1,
1873
+ "clear": 1,
1874
+ "codetype": 1,
1875
+ "color": 1,
1876
+ "compact": 1,
1877
+ "declare": 1,
1878
+ "defer": 1,
1879
+ "dir": 1,
1880
+ "direction": 1,
1881
+ "disabled": 1,
1882
+ "enctype": 1,
1883
+ "face": 1,
1884
+ "frame": 1,
1885
+ "hreflang": 1,
1886
+ "http-equiv": 1,
1887
+ "lang": 1,
1888
+ "language": 1,
1889
+ "link": 1,
1890
+ "media": 1,
1891
+ "method": 1,
1892
+ "multiple": 1,
1893
+ "nohref": 1,
1894
+ "noresize": 1,
1895
+ "noshade": 1,
1896
+ "nowrap": 1,
1897
+ "readonly": 1,
1898
+ "rel": 1,
1899
+ "rev": 1,
1900
+ "rules": 1,
1901
+ "scope": 1,
1902
+ "scrolling": 1,
1903
+ "selected": 1,
1904
+ "shape": 1,
1905
+ "target": 1,
1906
+ "text": 1,
1907
+ "type": 1,
1908
+ "valign": 1,
1909
+ "valuetype": 1,
1910
+ "vlink": 1
1911
+ }, Combinators = {}, Selectors = {}, Operators = {
1912
+ "=": {
1913
+ p1: "^",
1914
+ p2: "$",
1915
+ p3: "true"
1916
+ },
1917
+ "^=": {
1918
+ p1: "^",
1919
+ p2: "",
1920
+ p3: "true"
1921
+ },
1922
+ "$=": {
1923
+ p1: "",
1924
+ p2: "$",
1925
+ p3: "true"
1926
+ },
1927
+ "*=": {
1928
+ p1: "",
1929
+ p2: "",
1930
+ p3: "true"
1931
+ },
1932
+ "|=": {
1933
+ p1: "^",
1934
+ p2: "(-|$)",
1935
+ p3: "true"
1936
+ },
1937
+ "~=": {
1938
+ p1: "(^|\\s)",
1939
+ p2: "(\\s|$)",
1940
+ p3: "true"
1941
+ }
1942
+ }, concatCall = function(nodes, callback) {
1943
+ var i = 0, l = nodes.length, list = Array(l);
1944
+ while (l > i) {
1945
+ if (false === callback(list[i] = nodes[i])) break;
1946
+ ++i;
1947
+ }
1948
+ return list;
1949
+ }, concatList = function(list, nodes) {
1950
+ var i = -1, l = nodes.length;
1951
+ while (l--) list[list.length] = nodes[++i];
1952
+ return list;
1953
+ }, documentOrder = function(a, b) {
1954
+ if (!hasDupes && a === b) {
1955
+ hasDupes = true;
1956
+ return 0;
1957
+ }
1958
+ return a.compareDocumentPosition(b) & 4 ? -1 : 1;
1959
+ }, hasDupes = false, unique = function(nodes) {
1960
+ var i = 0, j = -1, l = nodes.length + 1, list = [];
1961
+ while (--l) {
1962
+ if (nodes[i++] === nodes[i]) continue;
1963
+ list[++j] = nodes[i - 1];
1964
+ }
1965
+ hasDupes = false;
1966
+ return list;
1967
+ }, hasMixedCaseTagNames = function(context) {
1968
+ var ns, api = "getElementsByTagNameNS";
1969
+ context = context.ownerDocument || context;
1970
+ ns = context.documentElement.namespaceURI || "http://www.w3.org/1999/xhtml";
1971
+ return context[api]("*", "*").length - context[api](ns, "*").length > 0;
1972
+ }, switchContext = function(context, force) {
1973
+ var oldDoc = doc;
1974
+ doc = context.ownerDocument || context;
1975
+ if (force || oldDoc !== doc) {
1976
+ root = doc.documentElement;
1977
+ HTML_DOCUMENT = isHTML(doc);
1978
+ QUIRKS_MODE = HTML_DOCUMENT && doc.compatMode.indexOf("CSS") < 0;
1979
+ NAMESPACE = root && root.namespaceURI;
1980
+ Snapshot.doc = doc;
1981
+ Snapshot.root = root;
1982
+ }
1983
+ return Snapshot.from = context;
1984
+ }, codePointToUTF16 = function(codePoint) {
1985
+ if (codePoint < 1 || codePoint > 1114111 || codePoint > 55295 && codePoint < 57344) return "\\ufffd";
1986
+ if (codePoint < 65536) {
1987
+ var lowHex = "000" + codePoint.toString(16);
1988
+ return "\\u" + lowHex.substr(lowHex.length - 4);
1989
+ }
1990
+ return "\\u" + ((codePoint - 65536 >> 10) + 55296).toString(16) + "\\u" + ((codePoint - 65536) % 1024 + 56320).toString(16);
1991
+ }, stringFromCodePoint = function(codePoint) {
1992
+ if (codePoint < 1 || codePoint > 1114111 || codePoint > 55295 && codePoint < 57344) return "�";
1993
+ if (codePoint < 65536) return String.fromCharCode(codePoint);
1994
+ return String.fromCodePoint ? String.fromCodePoint(codePoint) : String.fromCharCode((codePoint - 65536 >> 10) + 55296, (codePoint - 65536) % 1024 + 56320);
1995
+ }, convertEscapes = function(str) {
1996
+ return REX.HasEscapes.test(str) ? str.replace(REX.FixEscapes, function(substring, p1, p2) {
1997
+ return p2 ? "\\" + p2 : REX.HexNumbers.test(p1) ? codePointToUTF16(parseInt(p1, 16)) : REX.EscOrQuote.test(p1) ? substring : p1;
1998
+ }) : str;
1999
+ }, unescapeIdentifier = function(str) {
2000
+ return REX.HasEscapes.test(str) ? str.replace(REX.FixEscapes, function(substring, p1, p2) {
2001
+ return p2 ? p2 : REX.HexNumbers.test(p1) ? stringFromCodePoint(parseInt(p1, 16)) : REX.EscOrQuote.test(p1) ? substring : p1;
2002
+ }) : str;
2003
+ }, method = {
2004
+ "#": "getElementById",
2005
+ "*": "getElementsByTagNameNS",
2006
+ ".": "getElementsByClassName"
2007
+ }, compat = {
2008
+ "#": function(c, n) {
2009
+ REX.HasEscapes.test(n) && (n = unescapeIdentifier(n));
2010
+ return function(e, f) {
2011
+ return byId(n, c);
2012
+ };
2013
+ },
2014
+ "*": function(c, n) {
2015
+ REX.HasEscapes.test(n) && (n = unescapeIdentifier(n));
2016
+ return function(e, f) {
2017
+ return byTag(n, c);
2018
+ };
2019
+ },
2020
+ ".": function(c, n) {
2021
+ REX.HasEscapes.test(n) && (n = unescapeIdentifier(n));
2022
+ return function(e, f) {
2023
+ return byClass(n, c);
2024
+ };
2025
+ }
2026
+ }, byIdRaw = function(id, context) {
2027
+ var node = context, nodes = [], next = node.firstElementChild;
2028
+ while (node = next) {
2029
+ node.id == id && (nodes[nodes.length] = node);
2030
+ if (next = node.firstElementChild || node.nextElementSibling) continue;
2031
+ while (!next && (node = node.parentElement) && node !== context) next = node.nextElementSibling;
2032
+ }
2033
+ return nodes;
2034
+ }, byId = function(id, context) {
2035
+ var e, nodes, api = method["#"];
2036
+ if (Config.IDS_DUPES === false) {
2037
+ if (api in context) return (e = context[api](id)) ? [e] : none;
2038
+ } else if ("all" in context) {
2039
+ if (e = context.all[id]) {
2040
+ if (e.nodeType == 1) return e.getAttribute("id") != id ? [] : [e];
2041
+ else if (id == "length") return (e = context[api](id)) ? [e] : none;
2042
+ for (i = 0, l = e.length, nodes = []; l > i; ++i) if (e[i].id == id) nodes[nodes.length] = e[i];
2043
+ return nodes && nodes.length ? nodes : [nodes];
2044
+ } else return none;
2045
+ }
2046
+ return byIdRaw(id, context);
2047
+ }, byTag = function(tag, context) {
2048
+ var e, nodes, api = method["*"];
2049
+ if (api in context) return slice.call(context[api]("*", tag));
2050
+ else {
2051
+ tag = tag.toLowerCase();
2052
+ if (e = context.firstElementChild) {
2053
+ if (!(e.nextElementSibling || tag == "*" || e.localName == tag)) return slice.call(e[api]("*", tag));
2054
+ else {
2055
+ nodes = [];
2056
+ do {
2057
+ if (tag == "*" || e.localName == tag) nodes[nodes.length] = e;
2058
+ concatList(nodes, e[api]("*", tag));
2059
+ } while (e = e.nextElementSibling);
2060
+ }
2061
+ } else nodes = none;
2062
+ }
2063
+ return nodes;
2064
+ }, byClass = function(cls, context) {
2065
+ var e, nodes, api = method["."], reCls;
2066
+ if (api in context) return slice.call(context[api](cls));
2067
+ else if (e = context.firstElementChild) {
2068
+ reCls = RegExp("(^|\\s)" + cls + "(\\s|$)", QUIRKS_MODE ? "i" : "");
2069
+ if (!(e.nextElementSibling || reCls.test(e.className))) return slice.call(e[api](cls));
2070
+ else {
2071
+ nodes = [];
2072
+ do {
2073
+ if (reCls.test(e.className)) nodes[nodes.length] = e;
2074
+ concatList(nodes, e[api](cls));
2075
+ } while (e = e.nextElementSibling);
2076
+ }
2077
+ } else nodes = none;
2078
+ return nodes;
2079
+ }, hasAttributeNS = function(e, name) {
2080
+ var i, l, attr = e.getAttributeNames();
2081
+ name = RegExp(":?" + name + "$", HTML_DOCUMENT ? "i" : "");
2082
+ for (i = 0, l = attr.length; l > i; ++i) if (name.test(attr[i])) return true;
2083
+ return false;
2084
+ }, nthElement = (function() {
2085
+ var idx = 0, len = 0, set = 0, parent = void 0, parents = Array(), nodes = Array();
2086
+ return function(element, dir) {
2087
+ if (dir == 2) {
2088
+ idx = 0;
2089
+ len = 0;
2090
+ set = 0;
2091
+ nodes.length = 0;
2092
+ parents.length = 0;
2093
+ parent = void 0;
2094
+ return -1;
2095
+ }
2096
+ var e, i, j, k, l;
2097
+ if (parent === element.parentElement) {
2098
+ i = set;
2099
+ j = idx;
2100
+ l = len;
2101
+ } else {
2102
+ l = parents.length;
2103
+ parent = element.parentElement;
2104
+ for (i = -1, j = 0, k = l - 1; l > j; ++j, --k) {
2105
+ if (parents[j] === parent) {
2106
+ i = j;
2107
+ break;
2108
+ }
2109
+ if (parents[k] === parent) {
2110
+ i = k;
2111
+ break;
2112
+ }
2113
+ }
2114
+ if (i < 0) {
2115
+ parents[i = l] = parent;
2116
+ l = 0;
2117
+ nodes[i] = Array();
2118
+ e = parent && parent.firstElementChild || element;
2119
+ while (e) {
2120
+ nodes[i][l] = e;
2121
+ if (e === element) j = l;
2122
+ e = e.nextElementSibling;
2123
+ ++l;
2124
+ }
2125
+ set = i;
2126
+ idx = 0;
2127
+ len = l;
2128
+ if (l < 2) return l;
2129
+ } else {
2130
+ l = nodes[i].length;
2131
+ set = i;
2132
+ }
2133
+ }
2134
+ if (element !== nodes[i][j] && element !== nodes[i][j = 0]) for (j = 0, e = nodes[i], k = l - 1; l > j; ++j, --k) {
2135
+ if (e[j] === element) break;
2136
+ if (e[k] === element) {
2137
+ j = k;
2138
+ break;
2139
+ }
2140
+ }
2141
+ idx = j + 1;
2142
+ len = l;
2143
+ return dir ? l - j : idx;
2144
+ };
2145
+ })(), nthOfType = (function() {
2146
+ var idx = 0, len = 0, set = 0, parent = void 0, parents = Array(), nodes = Array();
2147
+ return function(element, dir) {
2148
+ if (dir == 2) {
2149
+ idx = 0;
2150
+ len = 0;
2151
+ set = 0;
2152
+ nodes.length = 0;
2153
+ parents.length = 0;
2154
+ parent = void 0;
2155
+ return -1;
2156
+ }
2157
+ var e, i, j, k, l, name = element.localName;
2158
+ if (nodes[set] && nodes[set][name] && parent === element.parentElement) {
2159
+ i = set;
2160
+ j = idx;
2161
+ l = len;
2162
+ } else {
2163
+ l = parents.length;
2164
+ parent = element.parentElement;
2165
+ for (i = -1, j = 0, k = l - 1; l > j; ++j, --k) {
2166
+ if (parents[j] === parent) {
2167
+ i = j;
2168
+ break;
2169
+ }
2170
+ if (parents[k] === parent) {
2171
+ i = k;
2172
+ break;
2173
+ }
2174
+ }
2175
+ if (i < 0 || !nodes[i][name]) {
2176
+ parents[i = l] = parent;
2177
+ nodes[i] || (nodes[i] = Object());
2178
+ l = 0;
2179
+ nodes[i][name] = Array();
2180
+ e = parent && parent.firstElementChild || element;
2181
+ while (e) {
2182
+ if (e === element) j = l;
2183
+ if (e.localName == name) {
2184
+ nodes[i][name][l] = e;
2185
+ ++l;
2186
+ }
2187
+ e = e.nextElementSibling;
2188
+ }
2189
+ set = i;
2190
+ idx = j;
2191
+ len = l;
2192
+ if (l < 2) return l;
2193
+ } else {
2194
+ l = nodes[i][name].length;
2195
+ set = i;
2196
+ }
2197
+ }
2198
+ if (element !== nodes[i][name][j] && element !== nodes[i][name][j = 0]) for (j = 0, e = nodes[i][name], k = l - 1; l > j; ++j, --k) {
2199
+ if (e[j] === element) break;
2200
+ if (e[k] === element) {
2201
+ j = k;
2202
+ break;
2203
+ }
2204
+ }
2205
+ idx = j + 1;
2206
+ len = l;
2207
+ return dir ? l - j : idx;
2208
+ };
2209
+ })(), isHTML = function(node) {
2210
+ var doc = node.ownerDocument || node;
2211
+ return doc.nodeType == 9 && "contentType" in doc ? doc.contentType.indexOf("/html") > 0 : doc.createElement("DiV").localName == "div";
2212
+ }, configure = function(option, clear) {
2213
+ if (typeof option == "string") return !!Config[option];
2214
+ if (typeof option != "object") return Config;
2215
+ for (var i in option) Config[i] = !!option[i];
2216
+ if (clear) {
2217
+ matchResolvers = {};
2218
+ selectResolvers = {};
2219
+ }
2220
+ setIdentifierSyntax();
2221
+ return true;
2222
+ }, emit = function(message, proto) {
2223
+ var err;
2224
+ if (Config.VERBOSITY) {
2225
+ if (proto) err = new proto(message);
2226
+ else err = new global.DOMException(message, "SyntaxError");
2227
+ throw err;
2228
+ }
2229
+ if (Config.LOGERRORS && console && console.log) console.log(message);
2230
+ }, initialize = function(doc) {
2231
+ setIdentifierSyntax();
2232
+ lastContext = switchContext(doc, true);
2233
+ }, setIdentifierSyntax = function() {
2234
+ var identifier = "(?=[^0-9])(?:-{2}|[a-zA-Z0-9-_]|[^\\x00-\\x9f]|\\\\[^\\r\\n\\f0-9a-fA-F]|\\\\[0-9a-fA-F]{1,6}(?:\\r\\n|\\s)?|\\\\.)+", pseudonames = "[-\\w]+", pseudoparms = "(?:[-+]?\\d*)(?:n\\s?[-+]?\\s?\\d*)", attrparser = identifier + "|\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*(?:\"|$)|'[^'\\\\]*(?:\\\\.[^'\\\\]*)*(?:'|$)", attrvalues = "([\\x22\\x27]?)((?!\\3)*|(?:\\\\?.)*?)(?:\\3|$)", attributes = "\\[(?:\\*\\|)?" + WSP + "?(" + identifier + "(?::" + identifier + ")?)" + WSP + "?(?:(" + CFG.operators + ")" + WSP + "?(?:" + attrparser + "))?" + WSP + "?(i)?" + WSP + "?(?:\\]|$)", attrmatcher = attributes.replace(attrparser, attrvalues), pseudoclass = "(?:\\x28" + WSP + "*(?:" + pseudoparms + "?)?|(?:\\*|\\|)|(?:(?::" + pseudonames + "(?:\\x28" + pseudoparms + "?(?:\\x29|$))?|)|(?:[.#]?" + identifier + ")|(?:" + attributes + "))+|(?:" + WSP + "?," + WSP + "?)|(?:" + WSP + "?)|(?:\\x29|$))*", standardValidator = "(?=" + WSP + "?[^>+~(){}<>])(?:(?:\\*|\\|)|(?:[.#]?" + identifier + ")+|(?:" + attributes + ")+|(?:::?" + pseudonames + pseudoclass + ")|(?:" + WSP + "?" + CFG.combinators + WSP + "?)|(?:" + WSP + "?," + WSP + "?)|(?:" + WSP + "?))+";
2235
+ reOptimizer = RegExp("(?:([.:#*]?)(" + identifier + ")(?::[-\\w]+|\\[[^\\]]+(?:\\]|$)|\\x28[^\\x29]+(?:\\x29|$))*)$");
2236
+ reValidator = RegExp(standardValidator, "g");
2237
+ Patterns.id = RegExp("^#(" + identifier + ")(.*)");
2238
+ Patterns.tagName = RegExp("^(" + identifier + ")(.*)");
2239
+ Patterns.className = RegExp("^\\.(" + identifier + ")(.*)");
2240
+ Patterns.attribute = RegExp("^(?:" + attrmatcher + ")(.*)");
2241
+ }, F_INIT = "\"use strict\";return function Resolver(c,f,x,r)", S_HEAD = "var e,n,o,j=r.length-1,k=-1", M_HEAD = "var e,n,o", S_LOOP = "main:while((e=c[++k]))", N_LOOP = "main:while((e=c.item(++k)))", M_LOOP = "e=c;", S_BODY = "r[++j]=c[k];", N_BODY = "r[++j]=c.item(k);", M_BODY = "", S_TAIL = "continue main;", M_TAIL = "r=true;", S_TEST = "if(f(c[k])){break main;}", N_TEST = "if(f(c.item(k))){break main;}", M_TEST = "f(c);", S_VARS = [], M_VARS = [], compile = function(selector, mode, callback) {
2242
+ var factory, head = "", loop = "", macro = "", source = "", vars = "";
2243
+ switch (mode) {
2244
+ case true:
2245
+ if (selectLambdas[selector]) return selectLambdas[selector];
2246
+ macro = S_BODY + (callback ? S_TEST : "") + S_TAIL;
2247
+ head = S_HEAD;
2248
+ loop = S_LOOP;
2249
+ break;
2250
+ case false:
2251
+ if (matchLambdas[selector]) return matchLambdas[selector];
2252
+ macro = M_BODY + (callback ? M_TEST : "") + M_TAIL;
2253
+ head = M_HEAD;
2254
+ loop = M_LOOP;
2255
+ break;
2256
+ case null:
2257
+ if (selectLambdas[selector]) return selectLambdas[selector];
2258
+ macro = N_BODY + (callback ? N_TEST : "") + S_TAIL;
2259
+ head = S_HEAD;
2260
+ loop = N_LOOP;
2261
+ }
2262
+ source = compileSelector(selector, macro, mode, callback, false);
2263
+ loop += mode || mode === null ? "{" + source + "}" : source;
2264
+ if (mode || mode === null && selector.includes(":nth")) {
2265
+ loop += reNthElem.test(selector) ? "s.nthElement(null, 2);" : "";
2266
+ loop += reNthType.test(selector) ? "s.nthOfType(null, 2);" : "";
2267
+ }
2268
+ if (S_VARS[0] || M_VARS[0]) {
2269
+ vars = "," + (S_VARS.join(",") || M_VARS.join(","));
2270
+ S_VARS.length = 0;
2271
+ M_VARS.length = 0;
2272
+ }
2273
+ factory = Function("s", F_INIT + "{" + head + vars + ";" + loop + "return r;}")(Snapshot);
2274
+ return mode || mode === null ? selectLambdas[selector] = factory : matchLambdas[selector] = factory;
2275
+ }, compileSelector = function(expression, source, mode, callback, not) {
2276
+ var a, b, n, f, name, NS, N = not ? "!" : "", D = not ? "" : "!", compat, expr, match, result, status, symbol, test, type, selector = expression, selector_string = mode ? lastSelected : lastMatched, vars;
2277
+ selector = selector.replace(STD.combinator, "$1");
2278
+ while (selector) {
2279
+ symbol = STD.apimethods.test(selector) ? "|" : selector[0];
2280
+ switch (symbol) {
2281
+ case "*":
2282
+ match = selector.match(Patterns.universal);
2283
+ if (N == "!") source = "if(" + N + "true){" + source + "}";
2284
+ break;
2285
+ case "#":
2286
+ match = selector.match(Patterns.id);
2287
+ source = "if(" + N + "(/^" + match[1] + "$/.test(e.getAttribute(\"id\")))){" + source + "}";
2288
+ break;
2289
+ case ".":
2290
+ match = selector.match(Patterns.className);
2291
+ compat = (QUIRKS_MODE ? "i" : "") + ".test(e.getAttribute(\"class\"))";
2292
+ source = "if(" + N + "(/(^|\\s)" + match[1] + "(\\s|$)/" + compat + ")){" + source + "}";
2293
+ break;
2294
+ case /[_a-z]/i.test(symbol) ? symbol : void 0:
2295
+ match = selector.match(Patterns.tagName);
2296
+ source = "if(" + N + "(e.localName" + (Config.MIXEDCASE || hasMixedCaseTagNames(doc) ? "==\"" + match[1].toLowerCase() + "\"" : "==\"" + match[1].toUpperCase() + "\"") + ")){" + source + "}";
2297
+ break;
2298
+ case "|":
2299
+ match = selector.match(Patterns.namespace);
2300
+ if (match[1] == "*") source = "if(" + N + "true){" + source + "}";
2301
+ else if (!match[1]) source = "if(" + N + "(!e.namespaceURI)){" + source + "}";
2302
+ else if (typeof match[1] == "string" && root.prefix == match[1]) source = "if(" + N + "(e.namespaceURI==\"" + NAMESPACE + "\")){" + source + "}";
2303
+ else emit("'" + selector_string + "'" + qsInvalid);
2304
+ break;
2305
+ case "[":
2306
+ match = selector.match(Patterns.attribute);
2307
+ NS = match[0].match(STD.namespaces);
2308
+ name = match[1];
2309
+ expr = name.split(":");
2310
+ expr = expr.length == 2 ? expr[1] : expr[0];
2311
+ if (match[2] && !(test = Operators[match[2]])) {
2312
+ emit("'" + selector_string + "'" + qsInvalid);
2313
+ return "";
2314
+ }
2315
+ if (match[4] === "") test = match[2] == "~=" ? {
2316
+ p1: "^\\s",
2317
+ p2: "+$",
2318
+ p3: "true"
2319
+ } : match[2] in ATTR_STD_OPS && match[2] != "~=" ? {
2320
+ p1: "^",
2321
+ p2: "$",
2322
+ p3: "true"
2323
+ } : test;
2324
+ else if (match[2] == "~=" && match[4].includes(" ")) {
2325
+ source = "if(" + N + "false){" + source + "}";
2326
+ break;
2327
+ } else if (match[4]) match[4] = convertEscapes(match[4]).replace(REX.RegExpChar, "\\$&");
2328
+ type = match[5] == "i" || HTML_DOCUMENT && HTML_TABLE[expr.toLowerCase()] ? "i" : "";
2329
+ source = "if(" + N + "(" + (!match[2] ? NS ? "s.hasAttributeNS(e,\"" + name + "\")" : "e.hasAttribute&&e.hasAttribute(\"" + name + "\")" : !match[4] && ATTR_STD_OPS[match[2]] && match[2] != "~=" ? "e.getAttribute&&e.getAttribute(\"" + name + "\")==\"\"" : "(/" + test.p1 + match[4] + test.p2 + "/" + type + ").test(e.getAttribute&&e.getAttribute(\"" + name + "\"))==" + test.p3) + ")){" + source + "}";
2330
+ break;
2331
+ case "~":
2332
+ match = selector.match(Patterns.relative);
2333
+ source = "n=e;while((e=e.previousElementSibling)){" + source + "}e=n;";
2334
+ break;
2335
+ case "+":
2336
+ match = selector.match(Patterns.adjacent);
2337
+ source = "n=e;if((e=e.previousElementSibling)){" + source + "}e=n;";
2338
+ break;
2339
+ case " ":
2340
+ case " ":
2341
+ match = selector.match(Patterns.ancestor);
2342
+ source = "n=e;while((e=e.parentElement)){" + source + "}e=n;";
2343
+ break;
2344
+ case ">":
2345
+ match = selector.match(Patterns.children);
2346
+ source = "n=e;if((e=e.parentElement)){" + source + "}e=n;";
2347
+ break;
2348
+ case symbol in Combinators ? symbol : void 0:
2349
+ match[match.length - 1] = "*";
2350
+ source = Combinators[symbol](match) + source;
2351
+ break;
2352
+ case ":":
2353
+ if (match = selector.match(Patterns.structural)) {
2354
+ match[1] = match[1].toLowerCase();
2355
+ switch (match[1]) {
2356
+ case "root":
2357
+ source = "if(" + N + "(e===s.root)){" + source + (mode ? "break main;" : "") + "}";
2358
+ break;
2359
+ case "empty":
2360
+ source = "n=e.firstChild;while(n&&!(/1|3/).test(n.nodeType)){n=n.nextSibling}if(" + D + "n){" + source + "}";
2361
+ break;
2362
+ case "only-child":
2363
+ source = "if(" + N + "(!e.nextElementSibling&&!e.previousElementSibling)){" + source + "}";
2364
+ break;
2365
+ case "last-child":
2366
+ source = "if(" + N + "(!e.nextElementSibling)){" + source + "}";
2367
+ break;
2368
+ case "first-child":
2369
+ source = "if(" + N + "(!e.previousElementSibling)){" + source + "}";
2370
+ break;
2371
+ case "only-of-type":
2372
+ source = "o=e.localName;n=e;while((n=n.nextElementSibling)&&n.localName!=o);if(!n){n=e;while((n=n.previousElementSibling)&&n.localName!=o);}if(" + D + "n){" + source + "}";
2373
+ break;
2374
+ case "last-of-type":
2375
+ source = "n=e;o=e.localName;while((n=n.nextElementSibling)&&n.localName!=o);if(" + D + "n){" + source + "}";
2376
+ break;
2377
+ case "first-of-type":
2378
+ source = "n=e;o=e.localName;while((n=n.previousElementSibling)&&n.localName!=o);if(" + D + "n){" + source + "}";
2379
+ break;
2380
+ default: emit("'" + selector_string + "'" + qsInvalid);
2381
+ }
2382
+ } else if (match = selector.match(Patterns.treestruct)) {
2383
+ match[1] = match[1].toLowerCase();
2384
+ switch (match[1]) {
2385
+ case "nth-child":
2386
+ case "nth-of-type":
2387
+ case "nth-last-child":
2388
+ case "nth-last-of-type":
2389
+ expr = /-of-type/i.test(match[1]);
2390
+ if (match[1] && match[2]) {
2391
+ type = /last/i.test(match[1]);
2392
+ if (match[2] == "n") {
2393
+ source = "if(" + N + "true){" + source + "}";
2394
+ break;
2395
+ } else if (match[2] == "1") {
2396
+ test = type ? "next" : "previous";
2397
+ source = expr ? "n=e;o=e.localName;while((n=n." + test + "ElementSibling)&&n.localName!=o);if(" + D + "n){" + source + "}" : "if(" + N + "!e." + test + "ElementSibling){" + source + "}";
2398
+ break;
2399
+ } else if (match[2] == "even" || match[2] == "2n0" || match[2] == "2n+0" || match[2] == "2n") test = "n%2==0";
2400
+ else if (match[2] == "odd" || match[2] == "2n1" || match[2] == "2n+1") test = "n%2==1";
2401
+ else {
2402
+ f = /n/i.test(match[2]);
2403
+ n = match[2].split("n");
2404
+ a = parseInt(n[0], 10) || 0;
2405
+ b = parseInt(n[1], 10) || 0;
2406
+ if (n[0] == "-") a = -1;
2407
+ if (n[0] == "+") a = 1;
2408
+ test = (b ? "(n" + (b > 0 ? "-" : "+") + Math.abs(b) + ")" : "n") + "%" + a + "==0";
2409
+ test = a >= 1 ? f ? "n>" + (b - 1) + (Math.abs(a) != 1 ? "&&" + test : "") : "n==" + a : a <= -1 ? f ? "n<" + (b + 1) + (Math.abs(a) != 1 ? "&&" + test : "") : "n==" + a : a === 0 ? n[0] ? "n==" + b : "n>" + (b - 1) : "false";
2410
+ }
2411
+ expr = expr ? "OfType" : "Element";
2412
+ type = type ? "true" : "false";
2413
+ source = "n=s.nth" + expr + "(e," + type + ");if(" + N + "(" + test + ")){" + source + "}";
2414
+ } else emit("'" + selector_string + "'" + qsInvalid);
2415
+ break;
2416
+ default: emit("'" + selector_string + "'" + qsInvalid);
2417
+ }
2418
+ } else if (match = selector.match(Patterns.logicalsel)) {
2419
+ match[1] = match[1].toLowerCase();
2420
+ switch (match[1]) {
2421
+ case "is":
2422
+ case "where":
2423
+ case "matches":
2424
+ expr = match[2].replace(REX.CommaGroup, ",").replace(REX.TrimSpaces, "");
2425
+ source = "if(s.match(\"" + expr.replace(/\x22/g, "\\\"") + "\",e)){" + source + "}";
2426
+ break;
2427
+ case "not":
2428
+ expr = match[2].replace(REX.CommaGroup, ",").replace(REX.TrimSpaces, "");
2429
+ source = "if(!s.match(\"" + expr.replace(/\x22/g, "\\\"") + "\",e)){" + source + "}";
2430
+ break;
2431
+ default: emit("'" + selector_string + "'" + qsInvalid);
2432
+ }
2433
+ } else if (match = selector.match(Patterns.linguistic)) {
2434
+ match[1] = match[1].toLowerCase();
2435
+ switch (match[1]) {
2436
+ case "dir":
2437
+ source = "var p;if(" + N + "((/" + match[2] + "/i.test(e.dir))||(p=s.ancestor(\"[dir]\", e))&&(/" + match[2] + "/i.test(p.dir))||(e.dir==\"\"||e.dir==\"auto\")&&(" + (match[2] == "ltr" ? "!" : "") + RTL + ".test(e.textContent)))){" + source + "};";
2438
+ break;
2439
+ case "lang":
2440
+ expr = "(?:^|-)" + match[2] + "(?:-|$)";
2441
+ source = "var p;if(" + N + "((e.isConnected&&(e.lang==\"\"&&(p=s.ancestor(\"[lang]\",e)))&&(p.lang==\"" + match[2] + "\")||/" + expr + "/i.test(e.lang)))){" + source + "};";
2442
+ break;
2443
+ default: emit("'" + selector_string + "'" + qsInvalid);
2444
+ }
2445
+ } else if (match = selector.match(Patterns.locationpc)) {
2446
+ match[1] = match[1].toLowerCase();
2447
+ switch (match[1]) {
2448
+ case "any-link":
2449
+ source = "if(" + N + "(/^a|area$/i.test(e.localName)&&e.hasAttribute(\"href\")||e.visited)){" + source + "}";
2450
+ break;
2451
+ case "link":
2452
+ source = "if(" + N + "(/^a|area$/i.test(e.localName)&&e.hasAttribute(\"href\"))){" + source + "}";
2453
+ break;
2454
+ case "visited":
2455
+ source = "if(" + N + "(/^a|area$/i.test(e.localName)&&e.hasAttribute(\"href\")&&e.visited)){" + source + "}";
2456
+ break;
2457
+ case "target":
2458
+ source = "if(" + N + "((s.doc.compareDocumentPosition(e)&16)&&s.doc.location.hash&&e.id==s.doc.location.hash.slice(1))){" + source + "}";
2459
+ break;
2460
+ default: emit("'" + selector_string + "'" + qsInvalid);
2461
+ }
2462
+ } else if (match = selector.match(Patterns.useraction)) {
2463
+ match[1] = match[1].toLowerCase();
2464
+ switch (match[1]) {
2465
+ case "hover":
2466
+ source = "hasFocus" in doc && doc.hasFocus() ? "if(" + N + "(e===s.doc.hoverElement)){" + source + "}" : "if(" + D + "true){" + source + "}";
2467
+ break;
2468
+ case "active":
2469
+ source = "hasFocus" in doc && doc.hasFocus() ? "if(" + N + "(e===s.doc.activeElement)){" + source + "}" : "if(" + D + "true){" + source + "}";
2470
+ break;
2471
+ case "focus":
2472
+ source = "hasFocus" in doc ? "if(" + N + "(e===s.doc.activeElement&&s.doc.hasFocus()&&(e.type||e.href||typeof e.tabIndex==\"number\"))){" + source + "}" : "if(" + N + "(e===s.doc.activeElement&&(e.type||e.href))){" + source + "}";
2473
+ break;
2474
+ case "focus-within":
2475
+ source = "hasFocus" in doc ? "n=s.doc.activeElement;while(e){if(e===n||e.parentNode===n)break;}if(" + N + "(e===n&&s.doc.hasFocus()&&(e.type||e.href||typeof e.tabIndex==\"number\"))){" + source + "}" : source;
2476
+ break;
2477
+ default: emit("'" + selector_string + "'" + qsInvalid);
2478
+ }
2479
+ } else if (match = selector.match(Patterns.inputstate)) {
2480
+ match[1] = match[1].toLowerCase();
2481
+ switch (match[1]) {
2482
+ case "enabled":
2483
+ source = "if(" + N + "((\"form\" in e||/^optgroup$/i.test(e.localName))&&\"disabled\" in e &&e.disabled===false)){" + source + "}";
2484
+ break;
2485
+ case "disabled":
2486
+ source = "if(" + N + "((\"form\" in e||/^optgroup$/i.test(e.localName))&&\"disabled\" in e&&(e.disabled===true||(n=s.ancestor(\"fieldset\",e))&&(n=s.first(\"legend\",n))&&!n.contains(e)))){" + source + "}";
2487
+ break;
2488
+ case "read-only":
2489
+ source = "if(" + N + "((/^textarea$/i.test(e.localName)&&(e.readOnly||e.disabled))||(\"|password|text|\".includes(\"|\"+e.type+\"|\")&&e.readOnly))){" + source + "}";
2490
+ break;
2491
+ case "read-write":
2492
+ source = "if(" + N + "(((/^textarea$/i.test(e.localName)&&!e.readOnly&&!e.disabled)||(\"|password|text|\".includes(\"|\"+e.type+\"|\")&&!e.readOnly&&!e.disabled))||(e.hasAttribute(\"contenteditable\")||(s.doc.designMode==\"on\")))){" + source + "}";
2493
+ break;
2494
+ case "placeholder-shown":
2495
+ source = "if(" + N + "((/^input|textarea$/i.test(e.localName))&&e.hasAttribute(\"placeholder\")&&(\"|textarea|password|number|search|email|text|tel|url|\".includes(\"|\"+e.type+\"|\"))&&(!s.match(\":focus\",e)))){" + source + "}";
2496
+ break;
2497
+ case "default":
2498
+ source = "if(" + N + "(\"form\" in e && e.form)){var x=0;n=[];if(e.type==\"image\")n=e.form.getElementsByTagName(\"input\");if(e.type==\"submit\")n=e.form.elements;while(n[x]&&e!==n[x]){if(n[x].type==\"image\")break;if(n[x].type==\"submit\")break;x++;}}if(" + N + "(e.form&&(e===n[x]&&\"|image|submit|\".includes(\"|\"+e.type+\"|\"))||((/^option$/i.test(e.localName))&&e.defaultSelected)||((\"|radio|checkbox|\".includes(\"|\"+e.type+\"|\"))&&e.defaultChecked))){" + source + "}";
2499
+ break;
2500
+ default: emit("'" + selector_string + "'" + qsInvalid);
2501
+ }
2502
+ } else if (match = selector.match(Patterns.inputvalue)) {
2503
+ match[1] = match[1].toLowerCase();
2504
+ switch (match[1]) {
2505
+ case "checked":
2506
+ source = "if(" + N + "(/^input$/i.test(e.localName)&&(\"|radio|checkbox|\".includes(\"|\"+e.type+\"|\")&&e.checked)||(/^option$/i.test(e.localName)&&(e.selected||e.checked)))){" + source + "}";
2507
+ break;
2508
+ case "indeterminate":
2509
+ source = "if(" + N + "(/^progress$/i.test(e.localName)&&!e.hasAttribute(\"value\"))||(/^input$/i.test(e.localName)&&(\"checkbox\"==e.type&&e.indeterminate)||(\"radio\"==e.type&&e.name&&!s.first(\"input[name=\"+e.name+\"]:checked\",e.form)))){" + source + "}";
2510
+ break;
2511
+ case "required":
2512
+ source = "if(" + N + "(/^input|select|textarea$/i.test(e.localName)&&e.required)){" + source + "}";
2513
+ break;
2514
+ case "optional":
2515
+ source = "if(" + N + "(/^input|select|textarea$/i.test(e.localName)&&!e.required)){" + source + "}";
2516
+ break;
2517
+ case "invalid":
2518
+ source = "if(" + N + "(((/^form$/i.test(e.localName)&&!e.noValidate)||(e.willValidate&&!e.formNoValidate))&&!e.checkValidity())||(/^fieldset$/i.test(e.localName)&&s.first(\":invalid\",e))){" + source + "}";
2519
+ break;
2520
+ case "valid":
2521
+ source = "if(" + N + "(((/^form$/i.test(e.localName)&&!e.noValidate)||(e.willValidate&&!e.formNoValidate))&&e.checkValidity())||(/^fieldset$/i.test(e.localName)&&s.first(\":valid\",e))){" + source + "}";
2522
+ break;
2523
+ case "in-range":
2524
+ source = "if(" + N + "(/^input$/i.test(e.localName))&&(e.willValidate&&!e.formNoValidate)&&(!e.validity.rangeUnderflow&&!e.validity.rangeOverflow)&&(\"|date|datetime-local|month|number|range|time|week|\".includes(\"|\"+e.type+\"|\"))&&(\"range\"==e.type||e.getAttribute(\"min\")||e.getAttribute(\"max\"))){" + source + "}";
2525
+ break;
2526
+ case "out-of-range":
2527
+ source = "if(" + N + "(/^input$/i.test(e.localName))&&(e.willValidate&&!e.formNoValidate)&&(e.validity.rangeUnderflow||e.validity.rangeOverflow)&&(\"|date|datetime-local|month|number|range|time|week|\".includes(\"|\"+e.type+\"|\"))&&(\"range\"==e.type||e.getAttribute(\"min\")||e.getAttribute(\"max\"))){" + source + "}";
2528
+ break;
2529
+ default: emit("'" + selector_string + "'" + qsInvalid);
2530
+ }
2531
+ } else if (match = selector.match(Patterns.pseudo_sng)) source = "if(e.element&&e.type.toLowerCase()==\":" + match[0].toLowerCase() + "\"){e=e.element;" + source + "}";
2532
+ else if (match = selector.match(Patterns.pseudo_dbl)) source = "if(e.element&&e.type.toLowerCase()==\"" + match[0].toLowerCase() + "\"){e=e.element;" + source + "}";
2533
+ else {
2534
+ expr = false;
2535
+ status = false;
2536
+ for (expr in Selectors) if (match = selector.match(Selectors[expr].Expression)) {
2537
+ result = Selectors[expr].Callback(match, source, mode, callback);
2538
+ if ("match" in result) match = result.match;
2539
+ vars = result.modvar;
2540
+ if (mode) vars && S_VARS.indexOf(vars) < 0 && (S_VARS[S_VARS.length] = vars);
2541
+ else vars && M_VARS.indexOf(vars) < 0 && (M_VARS[M_VARS.length] = vars);
2542
+ source = result.source;
2543
+ status = result.status;
2544
+ if (status) break;
2545
+ }
2546
+ if (!status) {
2547
+ emit("unknown pseudo-class selector '" + selector + "'");
2548
+ return "";
2549
+ }
2550
+ if (!expr) {
2551
+ emit("unknown token in selector '" + selector + "'");
2552
+ return "";
2553
+ }
2554
+ }
2555
+ break;
2556
+ default: emit("'" + selector_string + "'" + qsInvalid);
2557
+ }
2558
+ if (!match) {
2559
+ emit("'" + selector_string + "'" + qsInvalid);
2560
+ return "";
2561
+ }
2562
+ selector = match.pop();
2563
+ }
2564
+ return source;
2565
+ }, makeref = function(selectors, element) {
2566
+ return selectors.replace(/:scope/gi, element.localName + (element.id ? "#" + element.id : "") + (element.className ? "." + element.classList[0] : ""));
2567
+ }, ancestor = function _closest(selectors, element, callback) {
2568
+ if (/:scope/i.test(selectors)) selectors = makeref(selectors, element);
2569
+ while (element) {
2570
+ if (match(selectors, element, callback)) break;
2571
+ element = element.parentElement;
2572
+ }
2573
+ return element;
2574
+ }, match_assert = function(f, element, callback) {
2575
+ for (var i = 0, l = f.length, r = false; l > i; ++i) f[i](element, callback, null, false) && (r = true);
2576
+ return r;
2577
+ }, match_collect = function(selectors, callback) {
2578
+ for (var i = 0, l = selectors.length, f = []; l > i; ++i) f[i] = compile(selectors[i], false, callback);
2579
+ return { factory: f };
2580
+ }, match = function _matches(selectors, element, callback) {
2581
+ var expressions, parsed;
2582
+ if (element && matchResolvers[selectors]) return match_assert(matchResolvers[selectors].factory, element, callback);
2583
+ lastMatched = selectors;
2584
+ if (arguments.length === 0) {
2585
+ emit(qsNotArgs, TypeError);
2586
+ return Config.VERBOSITY ? void 0 : false;
2587
+ } else if (arguments[0] === "") {
2588
+ emit("''" + qsInvalid);
2589
+ return Config.VERBOSITY ? void 0 : false;
2590
+ }
2591
+ if (typeof selectors != "string") selectors = "" + selectors;
2592
+ if (/:scope/i.test(selectors)) selectors = makeref(selectors, element);
2593
+ parsed = selectors.replace(/\x00|\\$/g, "�").replace(REX.CombineWSP, " ").replace(REX.PseudosWSP, "$1").replace(REX.TabCharWSP, " ").replace(REX.CommaGroup, ",").replace(REX.TrimSpaces, "");
2594
+ if ((expressions = parsed.match(reValidator)) && expressions.join("") == parsed) {
2595
+ expressions = parsed.match(REX.SplitGroup);
2596
+ if (parsed[parsed.length - 1] == ",") {
2597
+ emit(qsInvalid);
2598
+ return Config.VERBOSITY ? void 0 : false;
2599
+ }
2600
+ } else {
2601
+ emit("'" + selectors + "'" + qsInvalid);
2602
+ return Config.VERBOSITY ? void 0 : false;
2603
+ }
2604
+ matchResolvers[selectors] = match_collect(expressions, callback);
2605
+ return match_assert(matchResolvers[selectors].factory, element, callback);
2606
+ }, first = function _querySelector(selectors, context, callback) {
2607
+ if (arguments.length === 0) emit(qsNotArgs, TypeError);
2608
+ return select(selectors, context, typeof callback == "function" ? function firstMatch(element) {
2609
+ callback(element);
2610
+ return false;
2611
+ } : function firstMatch() {
2612
+ return false;
2613
+ })[0] || null;
2614
+ }, select = function _querySelectorAll(selectors, context, callback) {
2615
+ var expressions, nodes, parsed, resolver;
2616
+ context || (context = doc);
2617
+ if (selectors) {
2618
+ if (resolver = selectResolvers[selectors]) {
2619
+ if (resolver.context === context && resolver.callback === callback) {
2620
+ var f = resolver.factory, h = resolver.htmlset, n = resolver.nodeset, nodes = [];
2621
+ if (n.length > 1) {
2622
+ for (var i = 0, l = n.length, list; l > i; ++i) {
2623
+ list = compat[n[i][0]](context, n[i].slice(1))();
2624
+ if (f[i] !== null) f[i](list, callback, context, nodes);
2625
+ else nodes = nodes.concat(list);
2626
+ }
2627
+ if (l > 1 && nodes.length > 1) {
2628
+ nodes.sort(documentOrder);
2629
+ hasDupes && (nodes = unique(nodes));
2630
+ }
2631
+ } else if (f[0]) nodes = f[0](h[0](), callback, context, nodes);
2632
+ else nodes = h[0]();
2633
+ return typeof callback == "function" ? concatCall(nodes, callback) : nodes;
2634
+ }
2635
+ }
2636
+ }
2637
+ lastSelected = selectors;
2638
+ if (arguments.length === 0) {
2639
+ emit(qsNotArgs, TypeError);
2640
+ return Config.VERBOSITY ? void 0 : none;
2641
+ } else if (arguments[0] === "") {
2642
+ emit("''" + qsInvalid);
2643
+ return Config.VERBOSITY ? void 0 : none;
2644
+ } else if (lastContext !== context) lastContext = switchContext(context);
2645
+ if (typeof selectors != "string") selectors = "" + selectors;
2646
+ if (/:scope/i.test(selectors)) selectors = makeref(selectors, context);
2647
+ parsed = selectors.replace(/\x00|\\$/g, "�").replace(REX.CombineWSP, " ").replace(REX.PseudosWSP, "$1").replace(REX.TabCharWSP, " ").replace(REX.CommaGroup, ",").replace(REX.TrimSpaces, "");
2648
+ if ((expressions = parsed.match(reValidator)) && expressions.join("") == parsed) {
2649
+ expressions = parsed.match(REX.SplitGroup);
2650
+ if (parsed[parsed.length - 1] == ",") {
2651
+ emit(qsInvalid);
2652
+ return Config.VERBOSITY ? void 0 : false;
2653
+ }
2654
+ } else {
2655
+ emit("'" + selectors + "'" + qsInvalid);
2656
+ return Config.VERBOSITY ? void 0 : false;
2657
+ }
2658
+ selectResolvers[selectors] = collect(expressions, context, callback);
2659
+ nodes = selectResolvers[selectors].results;
2660
+ return typeof callback == "function" ? concatCall(nodes, callback) : nodes;
2661
+ }, optimize = function(selector, token) {
2662
+ var index = token.index, length = token[1].length + token[2].length;
2663
+ return selector.slice(0, index) + (" >+~".indexOf(selector.charAt(index - 1)) > -1 ? ":[".indexOf(selector.charAt(index + length + 1)) > -1 ? "*" : "" : "") + selector.slice(index + length - (token[1] == "*" ? 1 : 0));
2664
+ }, collect = function(selectors, context, callback) {
2665
+ var i, l, seen = {}, token = [
2666
+ "",
2667
+ "*",
2668
+ "*"
2669
+ ], optimized = selectors, factory = [], htmlset = [], nodeset = [], results = [], type;
2670
+ for (i = 0, l = selectors.length; l > i; ++i) {
2671
+ if (!seen[selectors[i]] && (seen[selectors[i]] = true)) {
2672
+ type = selectors[i].match(reOptimizer);
2673
+ if (type && type[1] != ":" && (token = type)) {
2674
+ token[1] || (token[1] = "*");
2675
+ optimized[i] = optimize(optimized[i], token);
2676
+ } else token = [
2677
+ "",
2678
+ "*",
2679
+ "*"
2680
+ ];
2681
+ }
2682
+ nodeset[i] = token[1] + token[2];
2683
+ htmlset[i] = compat[token[1]](context, token[2]);
2684
+ factory[i] = compile(optimized[i], true, null);
2685
+ factory[i] ? factory[i](htmlset[i](), callback, context, results) : result.concat(htmlset[i]());
2686
+ }
2687
+ if (l > 1) {
2688
+ results.sort(documentOrder);
2689
+ hasDupes && (results = unique(results));
2690
+ }
2691
+ return {
2692
+ callback,
2693
+ context,
2694
+ factory,
2695
+ htmlset,
2696
+ nodeset,
2697
+ results
2698
+ };
2699
+ }, _closest, _matches, _querySelector, _querySelectorAll, install = function(all) {
2700
+ _closest = Element.prototype.closest;
2701
+ _matches = Element.prototype.matches;
2702
+ _querySelector = Document.prototype.querySelector;
2703
+ _querySelectorAll = Document.prototype.querySelectorAll;
2704
+ Element.prototype.closest = function closest() {
2705
+ var ctor = Object.getPrototypeOf(this).__proto__.__proto__.constructor.name;
2706
+ if (!("nodeType" in this)) emit("'closest' called on an object that does not implement interface " + ctor + ".", TypeError);
2707
+ return arguments.length < 1 ? ancestor.apply(this, []) : arguments.length < 2 ? ancestor.apply(this, [arguments[0], this]) : ancestor.apply(this, [
2708
+ arguments[0],
2709
+ this,
2710
+ typeof arguments[1] == "function" ? arguments[1] : void 0
2711
+ ]);
2712
+ };
2713
+ Element.prototype.matches = function matches() {
2714
+ var ctor = Object.getPrototypeOf(this).__proto__.__proto__.constructor.name;
2715
+ if (!("nodeType" in this)) emit("'matches' called on an object that does not implement interface " + ctor + ".", TypeError);
2716
+ return arguments.length < 1 ? match.apply(this, []) : arguments.length < 2 ? match.apply(this, [arguments[0], this]) : match.apply(this, [
2717
+ arguments[0],
2718
+ this,
2719
+ typeof arguments[1] == "function" ? arguments[1] : void 0
2720
+ ]);
2721
+ };
2722
+ Element.prototype.querySelector = Document.prototype.querySelector = DocumentFragment.prototype.querySelector = function querySelector() {
2723
+ var ctor = Object.getPrototypeOf(this).__proto__.__proto__.constructor.name;
2724
+ if (!("nodeType" in this)) emit("'querySelector' called on an object that does not implement interface " + ctor + ".", TypeError);
2725
+ return arguments.length < 1 ? first.apply(this, []) : arguments.length < 2 ? first.apply(this, [arguments[0], this]) : first.apply(this, [
2726
+ arguments[0],
2727
+ this,
2728
+ typeof arguments[1] == "function" ? arguments[1] : void 0
2729
+ ]);
2730
+ };
2731
+ Element.prototype.querySelectorAll = Document.prototype.querySelectorAll = DocumentFragment.prototype.querySelectorAll = function querySelectorAll() {
2732
+ var ctor = Object.getPrototypeOf(this).__proto__.__proto__.constructor.name;
2733
+ if (!("nodeType" in this)) emit("'querySelectorAll' called on an object that does not implement interface " + ctor + ".", TypeError);
2734
+ return arguments.length < 1 ? select.apply(this, []) : arguments.length < 2 ? select.apply(this, [arguments[0], this]) : select.apply(this, [
2735
+ arguments[0],
2736
+ this,
2737
+ typeof arguments[1] == "function" ? arguments[1] : void 0
2738
+ ]);
2739
+ };
2740
+ if (all) document.addEventListener("load", function(e) {
2741
+ var c, d, r, s, t = e.target;
2742
+ if (/iframe/i.test(t.localName)) {
2743
+ c = "(" + Export + ")(this, " + Factory + ");";
2744
+ d = t.contentDocument;
2745
+ s = d.createElement("script");
2746
+ s.textContent = c + "NW.Dom.install()";
2747
+ r = d.documentElement;
2748
+ r.removeChild(r.insertBefore(s, r.firstChild));
2749
+ }
2750
+ }, true);
2751
+ }, uninstall = function() {
2752
+ Element.prototype.closest = _closest;
2753
+ Element.prototype.matches = _matches;
2754
+ Element.prototype.querySelector = Document.prototype.querySelector = DocumentFragment.prototype.querySelector = _querySelector;
2755
+ Element.prototype.querySelectorAll = Document.prototype.querySelectorAll = DocumentFragment.prototype.querySelectorAll = _querySelectorAll;
2756
+ }, none = Array(), lastContext, lastMatched, lastSelected, matchLambdas = {}, selectLambdas = {}, matchResolvers = {}, selectResolvers = {}, Snapshot = {
2757
+ doc,
2758
+ from: doc,
2759
+ root,
2760
+ byTag,
2761
+ first,
2762
+ match,
2763
+ ancestor,
2764
+ nthOfType,
2765
+ nthElement,
2766
+ hasAttributeNS
2767
+ }, Dom = {
2768
+ lastMatched,
2769
+ lastSelected,
2770
+ matchLambdas,
2771
+ selectLambdas,
2772
+ matchResolvers,
2773
+ selectResolvers,
2774
+ CFG,
2775
+ M_BODY,
2776
+ S_BODY,
2777
+ M_TEST,
2778
+ S_TEST,
2779
+ byId,
2780
+ byTag,
2781
+ byClass,
2782
+ match,
2783
+ first,
2784
+ select,
2785
+ closest: ancestor,
2786
+ compile,
2787
+ configure,
2788
+ emit,
2789
+ Config,
2790
+ Snapshot,
2791
+ Version: version,
2792
+ install,
2793
+ uninstall,
2794
+ Operators,
2795
+ Selectors,
2796
+ registerCombinator: function(combinator, resolver) {
2797
+ var i = 0, l = combinator.length, symbol;
2798
+ for (; l > i; ++i) if (combinator[i] != "=") {
2799
+ symbol = combinator[i];
2800
+ break;
2801
+ }
2802
+ if (CFG.combinators.indexOf(symbol) < 0) {
2803
+ CFG.combinators = CFG.combinators.replace("](", symbol + "](");
2804
+ CFG.combinators = CFG.combinators.replace("])", symbol + "])");
2805
+ Combinators[combinator] = resolver;
2806
+ setIdentifierSyntax();
2807
+ } else console.warn("Warning: the '" + combinator + "' combinator is already registered.");
2808
+ },
2809
+ registerOperator: function(operator, resolver) {
2810
+ var i = 0, l = operator.length, symbol;
2811
+ for (; l > i; ++i) if (operator[i] != "=") {
2812
+ symbol = operator[i];
2813
+ break;
2814
+ }
2815
+ if (CFG.operators.indexOf(symbol) < 0 && !Operators[operator]) {
2816
+ CFG.operators = CFG.operators.replace("]=", symbol + "]=");
2817
+ Operators[operator] = resolver;
2818
+ setIdentifierSyntax();
2819
+ } else console.warn("Warning: the '" + operator + "' operator is already registered.");
2820
+ },
2821
+ registerSelector: function(name, rexp, func) {
2822
+ Selectors[name] || (Selectors[name] = {
2823
+ Expression: rexp,
2824
+ Callback: func
2825
+ });
2826
+ }
2827
+ };
2828
+ initialize(doc);
2829
+ return Dom;
2830
+ }
2831
+ //#endregion
2832
+ //#region node_modules/.pnpm/@jsr+b-fuze__deno-dom@0.1.56/node_modules/@jsr/b-fuze__deno-dom/src/dom/selectors/nwsapi-types.js
2833
+ const DOM$1 = nwsapi_default;
2834
+ //#endregion
2835
+ //#region node_modules/.pnpm/@jsr+b-fuze__deno-dom@0.1.56/node_modules/@jsr/b-fuze__deno-dom/src/dom/selectors/sizzle.js
2836
+ /*!
2837
+ * Sizzle CSS Selector Engine v2.3.7-pre
2838
+ * https://sizzlejs.com/
2839
+ *
2840
+ * Copyright JS Foundation and other contributors
2841
+ * Released under the MIT license
2842
+ * https://js.foundation/
2843
+ *
2844
+ * Date: 2022-04-02
2845
+ *
2846
+ * git commit hash for Deno DOM: ede0e97563c8473b8cfa4045c7c2cd6129ecc1aa
2847
+ */
2848
+ var sizzle_default = (document) => {
2849
+ const sizzleWindow = { document };
2850
+ SetupSizzle(sizzleWindow);
2851
+ const { Sizzle } = sizzleWindow;
2852
+ return {
2853
+ first(selectors, context) {
2854
+ return Sizzle(selectors, context)[0] ?? null;
2855
+ },
2856
+ select(selectors, context) {
2857
+ return Sizzle(selectors, context);
2858
+ },
2859
+ match(selectors, context) {
2860
+ return Sizzle.matchesSelector(context, selectors);
2861
+ }
2862
+ };
2863
+ };
2864
+ function SetupSizzle(window) {
2865
+ var i, support, Expr, getText, isXML, tokenize, compile, select, outermostContext, sortInput, hasDuplicate, setDocument, document, docElem, documentIsHTML, rbuggyQSA, rbuggyMatches, matches, contains, expando = "sizzle" + 1 * /* @__PURE__ */ new Date(), preferredDoc = window.document, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), nonnativeSelectorCache = createCache(), sortOrder = function(a, b) {
2866
+ if (a === b) hasDuplicate = true;
2867
+ return 0;
2868
+ }, hasOwn = {}.hasOwnProperty, arr = [], pop = arr.pop, pushNative = arr.push, push = arr.push, slice = arr.slice, indexOf = function(list, elem) {
2869
+ var i = 0, len = list.length;
2870
+ for (; i < len; i++) if (list[i] === elem) return i;
2871
+ return -1;
2872
+ }, booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", whitespace = "[\\x20\\t\\r\\n\\f]", identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + "*([*^$|!~]?=)" + whitespace + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]", pseudos = ":(" + identifier + ")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|.*)\\)|)", rwhitespace = new RegExp(whitespace + "+", "g"), rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"), rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"), rcombinators = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"), rdescend = new RegExp(whitespace + "|>"), rpseudo = new RegExp(pseudos), ridentifier = new RegExp("^" + identifier + "$"), matchExpr = {
2873
+ ID: new RegExp("^#(" + identifier + ")"),
2874
+ CLASS: new RegExp("^\\.(" + identifier + ")"),
2875
+ TAG: new RegExp("^(" + identifier + "|[*])"),
2876
+ ATTR: new RegExp("^" + attributes),
2877
+ PSEUDO: new RegExp("^" + pseudos),
2878
+ CHILD: new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"),
2879
+ bool: new RegExp("^(?:" + booleans + ")$", "i"),
2880
+ needsContext: new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i")
2881
+ }, rhtml = /HTML$/i, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, rnative = /^[^{]+\{\s*\[native \w/, rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rsibling = /[+~]/, runescape = new RegExp("\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g"), funescape = function(escape, nonHex) {
2882
+ var high = "0x" + escape.slice(1) - 65536;
2883
+ return nonHex ? nonHex : high < 0 ? String.fromCharCode(high + 65536) : String.fromCharCode(high >> 10 | 55296, high & 1023 | 56320);
2884
+ }, rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, fcssescape = function(ch, asCodePoint) {
2885
+ if (asCodePoint) {
2886
+ if (ch === "\0") return "�";
2887
+ return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " ";
2888
+ }
2889
+ return "\\" + ch;
2890
+ }, unloadHandler = function() {
2891
+ setDocument();
2892
+ }, inDisabledFieldset = addCombinator(function(elem) {
2893
+ return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
2894
+ }, {
2895
+ dir: "parentNode",
2896
+ next: "legend"
2897
+ });
2898
+ try {
2899
+ push.apply(arr = slice.call(preferredDoc.childNodes), preferredDoc.childNodes);
2900
+ arr[preferredDoc.childNodes.length].nodeType;
2901
+ } catch (e) {
2902
+ push = { apply: arr.length ? function(target, els) {
2903
+ pushNative.apply(target, slice.call(els));
2904
+ } : function(target, els) {
2905
+ var j = target.length, i = 0;
2906
+ while (target[j++] = els[i++]);
2907
+ target.length = j - 1;
2908
+ } };
2909
+ }
2910
+ function Sizzle(selector, context, results, seed) {
2911
+ var m, i, elem, nid, match, groups, newSelector, newContext = context && context.ownerDocument, nodeType = context ? context.nodeType : 9;
2912
+ results = results || [];
2913
+ if (typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) return results;
2914
+ if (!seed) {
2915
+ setDocument(context);
2916
+ context = context || document;
2917
+ if (documentIsHTML) {
2918
+ if (nodeType !== 11 && (match = rquickExpr.exec(selector))) {
2919
+ if (m = match[1]) {
2920
+ if (nodeType === 9) {
2921
+ if (elem = context.getElementById(m)) {
2922
+ if (elem.id === m) {
2923
+ results.push(elem);
2924
+ return results;
2925
+ }
2926
+ } else return results;
2927
+ } else if (newContext && (elem = newContext.getElementById(m)) && contains(context, elem) && elem.id === m) {
2928
+ results.push(elem);
2929
+ return results;
2930
+ }
2931
+ } else if (match[2]) {
2932
+ push.apply(results, context.getElementsByTagName(selector));
2933
+ return results;
2934
+ } else if ((m = match[3]) && support.getElementsByClassName && context.getElementsByClassName) {
2935
+ push.apply(results, context.getElementsByClassName(m));
2936
+ return results;
2937
+ }
2938
+ }
2939
+ if (support.qsa && !nonnativeSelectorCache[selector + " "] && (!rbuggyQSA || !rbuggyQSA.test(selector)) && (nodeType !== 1 || context.nodeName.toLowerCase() !== "object")) {
2940
+ newSelector = selector;
2941
+ newContext = context;
2942
+ if (nodeType === 1 && (rdescend.test(selector) || rcombinators.test(selector))) {
2943
+ newContext = rsibling.test(selector) && testContext(context.parentNode) || context;
2944
+ if (newContext !== context || !support.scope) {
2945
+ if (nid = context.getAttribute("id")) nid = nid.replace(rcssescape, fcssescape);
2946
+ else context.setAttribute("id", nid = expando);
2947
+ }
2948
+ groups = tokenize(selector);
2949
+ i = groups.length;
2950
+ while (i--) groups[i] = (nid ? "#" + nid : ":scope") + " " + toSelector(groups[i]);
2951
+ newSelector = groups.join(",");
2952
+ }
2953
+ try {
2954
+ push.apply(results, newContext.querySelectorAll(newSelector));
2955
+ return results;
2956
+ } catch (qsaError) {
2957
+ nonnativeSelectorCache(selector, true);
2958
+ } finally {
2959
+ if (nid === expando) context.removeAttribute("id");
2960
+ }
2961
+ }
2962
+ }
2963
+ }
2964
+ return select(selector.replace(rtrim, "$1"), context, results, seed);
2965
+ }
2966
+ /**
2967
+ * Create key-value caches of limited size
2968
+ * @returns {function(string, object)} Returns the Object data after storing it on itself with
2969
+ * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
2970
+ * deleting the oldest entry
2971
+ */
2972
+ function createCache() {
2973
+ var keys = [];
2974
+ function cache(key, value) {
2975
+ if (keys.push(key + " ") > Expr.cacheLength) delete cache[keys.shift()];
2976
+ return cache[key + " "] = value;
2977
+ }
2978
+ return cache;
2979
+ }
2980
+ /**
2981
+ * Mark a function for special use by Sizzle
2982
+ * @param {Function} fn The function to mark
2983
+ */
2984
+ function markFunction(fn) {
2985
+ fn[expando] = true;
2986
+ return fn;
2987
+ }
2988
+ /**
2989
+ * Support testing using an element
2990
+ * @param {Function} fn Passed the created element and returns a boolean result
2991
+ */
2992
+ function assert(fn) {
2993
+ return true;
2994
+ }
2995
+ /**
2996
+ * Adds the same handler for all of the specified attrs
2997
+ * @param {String} attrs Pipe-separated list of attributes
2998
+ * @param {Function} handler The method that will be applied
2999
+ */
3000
+ function addHandle(attrs, handler) {
3001
+ var arr = attrs.split("|"), i = arr.length;
3002
+ while (i--) Expr.attrHandle[arr[i]] = handler;
3003
+ }
3004
+ /**
3005
+ * Checks document order of two siblings
3006
+ * @param {Element} a
3007
+ * @param {Element} b
3008
+ * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
3009
+ */
3010
+ function siblingCheck(a, b) {
3011
+ var cur = b && a, diff = cur && a.nodeType === 1 && b.nodeType === 1 && a.sourceIndex - b.sourceIndex;
3012
+ if (diff) return diff;
3013
+ if (cur) {
3014
+ while (cur = cur.nextSibling) if (cur === b) return -1;
3015
+ }
3016
+ return a ? 1 : -1;
3017
+ }
3018
+ /**
3019
+ * Returns a function to use in pseudos for input types
3020
+ * @param {String} type
3021
+ */
3022
+ function createInputPseudo(type) {
3023
+ return function(elem) {
3024
+ return elem.nodeName.toLowerCase() === "input" && elem.type === type;
3025
+ };
3026
+ }
3027
+ /**
3028
+ * Returns a function to use in pseudos for buttons
3029
+ * @param {String} type
3030
+ */
3031
+ function createButtonPseudo(type) {
3032
+ return function(elem) {
3033
+ var name = elem.nodeName.toLowerCase();
3034
+ return (name === "input" || name === "button") && elem.type === type;
3035
+ };
3036
+ }
3037
+ /**
3038
+ * Returns a function to use in pseudos for :enabled/:disabled
3039
+ * @param {Boolean} disabled true for :disabled; false for :enabled
3040
+ */
3041
+ function createDisabledPseudo(disabled) {
3042
+ return function(elem) {
3043
+ if ("form" in elem) {
3044
+ if (elem.parentNode && elem.disabled === false) {
3045
+ if ("label" in elem) {
3046
+ if ("label" in elem.parentNode) return elem.parentNode.disabled === disabled;
3047
+ else return elem.disabled === disabled;
3048
+ }
3049
+ return elem.isDisabled === disabled || elem.isDisabled !== !disabled && inDisabledFieldset(elem) === disabled;
3050
+ }
3051
+ return elem.disabled === disabled;
3052
+ } else if ("label" in elem) return elem.disabled === disabled;
3053
+ return false;
3054
+ };
3055
+ }
3056
+ /**
3057
+ * Returns a function to use in pseudos for positionals
3058
+ * @param {Function} fn
3059
+ */
3060
+ function createPositionalPseudo(fn) {
3061
+ return markFunction(function(argument) {
3062
+ argument = +argument;
3063
+ return markFunction(function(seed, matches) {
3064
+ var j, matchIndexes = fn([], seed.length, argument), i = matchIndexes.length;
3065
+ while (i--) if (seed[j = matchIndexes[i]]) seed[j] = !(matches[j] = seed[j]);
3066
+ });
3067
+ });
3068
+ }
3069
+ /**
3070
+ * Checks a node for validity as a Sizzle context
3071
+ * @param {Element|Object=} context
3072
+ * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
3073
+ */
3074
+ function testContext(context) {
3075
+ return context && typeof context.getElementsByTagName !== "undefined" && context;
3076
+ }
3077
+ support = Sizzle.support = {};
3078
+ /**
3079
+ * Detects XML nodes
3080
+ * @param {Element|Object} elem An element or a document
3081
+ * @returns {Boolean} True iff elem is a non-HTML XML node
3082
+ */
3083
+ isXML = Sizzle.isXML = function(elem) {
3084
+ var namespace = elem && elem.namespaceURI, docElem = elem && (elem.ownerDocument || elem).documentElement;
3085
+ return !rhtml.test(namespace || docElem && docElem.nodeName || "HTML");
3086
+ };
3087
+ /**
3088
+ * Sets document-related variables once based on the current document
3089
+ * @param {Element|Object} [doc] An element or document object to use to set the document
3090
+ * @returns {Object} Returns the current document
3091
+ */
3092
+ setDocument = Sizzle.setDocument = function(node) {
3093
+ var hasCompare, subWindow, doc = node ? node.ownerDocument || node : preferredDoc;
3094
+ if (doc == document || doc.nodeType !== 9 || !doc.documentElement) return document;
3095
+ document = doc;
3096
+ docElem = document.documentElement;
3097
+ documentIsHTML = !isXML(document);
3098
+ if (preferredDoc != document && (subWindow = document.defaultView) && subWindow.top !== subWindow) {
3099
+ if (subWindow.addEventListener) subWindow.addEventListener("unload", unloadHandler, false);
3100
+ else if (subWindow.attachEvent) subWindow.attachEvent("onunload", unloadHandler);
3101
+ }
3102
+ support.scope = assert(function(el) {
3103
+ docElem.appendChild(el).appendChild(document.createElement("div"));
3104
+ return typeof el.querySelectorAll !== "undefined" && !el.querySelectorAll(":scope fieldset div").length;
3105
+ });
3106
+ support.attributes = assert(function(el) {
3107
+ el.className = "i";
3108
+ return !el.getAttribute("className");
3109
+ });
3110
+ support.getElementsByTagName = assert(function(el) {
3111
+ el.appendChild(document.createComment(""));
3112
+ return !el.getElementsByTagName("*").length;
3113
+ });
3114
+ support.getElementsByClassName = rnative.test(document.getElementsByClassName);
3115
+ support.getById = assert(function(el) {
3116
+ docElem.appendChild(el).id = expando;
3117
+ return !document.getElementsByName || !document.getElementsByName(expando).length;
3118
+ });
3119
+ if (support.getById) {
3120
+ Expr.filter["ID"] = function(id) {
3121
+ var attrId = id.replace(runescape, funescape);
3122
+ return function(elem) {
3123
+ return elem.getAttribute("id") === attrId;
3124
+ };
3125
+ };
3126
+ Expr.find["ID"] = function(id, context) {
3127
+ if (typeof context.getElementById !== "undefined" && documentIsHTML) {
3128
+ var elem = context.getElementById(id);
3129
+ return elem ? [elem] : [];
3130
+ }
3131
+ };
3132
+ } else {
3133
+ Expr.filter["ID"] = function(id) {
3134
+ var attrId = id.replace(runescape, funescape);
3135
+ return function(elem) {
3136
+ var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
3137
+ return node && node.value === attrId;
3138
+ };
3139
+ };
3140
+ Expr.find["ID"] = function(id, context) {
3141
+ if (typeof context.getElementById !== "undefined" && documentIsHTML) {
3142
+ var node, i, elems, elem = context.getElementById(id);
3143
+ if (elem) {
3144
+ node = elem.getAttributeNode("id");
3145
+ if (node && node.value === id) return [elem];
3146
+ elems = context.getElementsByName(id);
3147
+ i = 0;
3148
+ while (elem = elems[i++]) {
3149
+ node = elem.getAttributeNode("id");
3150
+ if (node && node.value === id) return [elem];
3151
+ }
3152
+ }
3153
+ return [];
3154
+ }
3155
+ };
3156
+ }
3157
+ Expr.find["TAG"] = support.getElementsByTagName ? function(tag, context) {
3158
+ if (typeof context.getElementsByTagName !== "undefined") return context.getElementsByTagName(tag);
3159
+ else if (context[customByTagNameSym]) return context[customByTagNameSym](tag);
3160
+ else if (support.qsa) return context.querySelectorAll(tag);
3161
+ } : function(tag, context) {
3162
+ var elem, tmp = [], i = 0, results = context.getElementsByTagName(tag);
3163
+ if (tag === "*") {
3164
+ while (elem = results[i++]) if (elem.nodeType === 1) tmp.push(elem);
3165
+ return tmp;
3166
+ }
3167
+ return results;
3168
+ };
3169
+ Expr.find["CLASS"] = support.getElementsByClassName && function(className, context) {
3170
+ if (typeof context.getElementsByClassName !== "undefined" && documentIsHTML) return context.getElementsByClassName(className);
3171
+ else if (context[customByClassNameSym]) return context[customByClassNameSym](className);
3172
+ };
3173
+ rbuggyMatches = [];
3174
+ rbuggyQSA = [];
3175
+ if (support.qsa = rnative.test(document.querySelectorAll)) {}
3176
+ if (support.matchesSelector = rnative.test(matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector));
3177
+ rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));
3178
+ rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join("|"));
3179
+ hasCompare = rnative.test(docElem.compareDocumentPosition);
3180
+ contains = hasCompare || rnative.test(docElem.contains) ? function(a, b) {
3181
+ var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode;
3182
+ return a === bup || !!(bup && bup.nodeType === 1 && (adown.contains ? adown.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16));
3183
+ } : function(a, b) {
3184
+ if (b) {
3185
+ while (b = b.parentNode) if (b === a) return true;
3186
+ }
3187
+ return false;
3188
+ };
3189
+ sortOrder = hasCompare ? function(a, b) {
3190
+ if (a === b) {
3191
+ hasDuplicate = true;
3192
+ return 0;
3193
+ }
3194
+ var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
3195
+ if (compare) return compare;
3196
+ compare = (a.ownerDocument || a) == (b.ownerDocument || b) ? a.compareDocumentPosition(b) : 1;
3197
+ if (compare & 1 || !support.sortDetached && b.compareDocumentPosition(a) === compare) {
3198
+ if (a == document || a.ownerDocument == preferredDoc && contains(preferredDoc, a)) return -1;
3199
+ if (b == document || b.ownerDocument == preferredDoc && contains(preferredDoc, b)) return 1;
3200
+ return sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0;
3201
+ }
3202
+ return compare & 4 ? -1 : 1;
3203
+ } : function(a, b) {
3204
+ if (a === b) {
3205
+ hasDuplicate = true;
3206
+ return 0;
3207
+ }
3208
+ var cur, i = 0, aup = a.parentNode, bup = b.parentNode, ap = [a], bp = [b];
3209
+ if (!aup || !bup) return a == document ? -1 : b == document ? 1 : aup ? -1 : bup ? 1 : sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0;
3210
+ else if (aup === bup) return siblingCheck(a, b);
3211
+ cur = a;
3212
+ while (cur = cur.parentNode) ap.unshift(cur);
3213
+ cur = b;
3214
+ while (cur = cur.parentNode) bp.unshift(cur);
3215
+ while (ap[i] === bp[i]) i++;
3216
+ return i ? siblingCheck(ap[i], bp[i]) : ap[i] == preferredDoc ? -1 : bp[i] == preferredDoc ? 1 : 0;
3217
+ };
3218
+ return document;
3219
+ };
3220
+ Sizzle.matches = function(expr, elements) {
3221
+ return Sizzle(expr, null, null, elements);
3222
+ };
3223
+ Sizzle.matchesSelector = function(elem, expr) {
3224
+ setDocument(elem);
3225
+ if (support.matchesSelector && documentIsHTML && !nonnativeSelectorCache[expr + " "] && (!rbuggyMatches || !rbuggyMatches.test(expr)) && (!rbuggyQSA || !rbuggyQSA.test(expr))) try {
3226
+ var ret = matches.call(elem, expr);
3227
+ if (ret || support.disconnectedMatch || elem.document && elem.document.nodeType !== 11) return ret;
3228
+ } catch (e) {
3229
+ nonnativeSelectorCache(expr, true);
3230
+ }
3231
+ return Sizzle(expr, document, null, [elem]).length > 0;
3232
+ };
3233
+ Sizzle.contains = function(context, elem) {
3234
+ if ((context.ownerDocument || context) != document) setDocument(context);
3235
+ return contains(context, elem);
3236
+ };
3237
+ Sizzle.attr = function(elem, name) {
3238
+ if ((elem.ownerDocument || elem) != document) setDocument(elem);
3239
+ var fn = Expr.attrHandle[name.toLowerCase()], val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : void 0;
3240
+ return val !== void 0 ? val : support.attributes || !documentIsHTML ? elem.getAttribute(name) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
3241
+ };
3242
+ Sizzle.escape = function(sel) {
3243
+ return (sel + "").replace(rcssescape, fcssescape);
3244
+ };
3245
+ Sizzle.error = function(msg) {
3246
+ throw new DOMException(`'${msg}' is not a valid selector`);
3247
+ };
3248
+ /**
3249
+ * Document sorting and removing duplicates
3250
+ * @param {ArrayLike} results
3251
+ */
3252
+ Sizzle.uniqueSort = function(results) {
3253
+ var elem, duplicates = [], j = 0, i = 0;
3254
+ hasDuplicate = !support.detectDuplicates;
3255
+ sortInput = !support.sortStable && results.slice(0);
3256
+ results.sort(sortOrder);
3257
+ if (hasDuplicate) {
3258
+ while (elem = results[i++]) if (elem === results[i]) j = duplicates.push(i);
3259
+ while (j--) results.splice(duplicates[j], 1);
3260
+ }
3261
+ sortInput = null;
3262
+ return results;
3263
+ };
3264
+ /**
3265
+ * Utility function for retrieving the text value of an array of DOM nodes
3266
+ * @param {Array|Element} elem
3267
+ */
3268
+ getText = Sizzle.getText = function(elem) {
3269
+ var node, ret = "", i = 0, nodeType = elem.nodeType;
3270
+ if (!nodeType) while (node = elem[i++]) ret += getText(node);
3271
+ else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {
3272
+ if (typeof elem.textContent === "string") return elem.textContent;
3273
+ else for (elem = elem.firstChild; elem; elem = elem.nextSibling) ret += getText(elem);
3274
+ } else if (nodeType === 3 || nodeType === 4) return elem.nodeValue;
3275
+ return ret;
3276
+ };
3277
+ Expr = Sizzle.selectors = {
3278
+ cacheLength: 50,
3279
+ createPseudo: markFunction,
3280
+ match: matchExpr,
3281
+ attrHandle: {},
3282
+ find: {},
3283
+ relative: {
3284
+ ">": {
3285
+ dir: "parentNode",
3286
+ first: true
3287
+ },
3288
+ " ": { dir: "parentNode" },
3289
+ "+": {
3290
+ dir: "previousSibling",
3291
+ first: true
3292
+ },
3293
+ "~": { dir: "previousSibling" }
3294
+ },
3295
+ preFilter: {
3296
+ ATTR: function(match) {
3297
+ match[1] = match[1].replace(runescape, funescape);
3298
+ match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape);
3299
+ if (match[2] === "~=") match[3] = " " + match[3] + " ";
3300
+ return match.slice(0, 4);
3301
+ },
3302
+ CHILD: function(match) {
3303
+ match[1] = match[1].toLowerCase();
3304
+ if (match[1].slice(0, 3) === "nth") {
3305
+ if (!match[3]) Sizzle.error(match[0]);
3306
+ match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd"));
3307
+ match[5] = +(match[7] + match[8] || match[3] === "odd");
3308
+ } else if (match[3]) Sizzle.error(match[0]);
3309
+ return match;
3310
+ },
3311
+ PSEUDO: function(match) {
3312
+ var excess, unquoted = !match[6] && match[2];
3313
+ if (matchExpr["CHILD"].test(match[0])) return null;
3314
+ if (match[3]) match[2] = match[4] || match[5] || "";
3315
+ else if (unquoted && rpseudo.test(unquoted) && (excess = tokenize(unquoted, true)) && (excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) {
3316
+ match[0] = match[0].slice(0, excess);
3317
+ match[2] = unquoted.slice(0, excess);
3318
+ }
3319
+ return match.slice(0, 3);
3320
+ }
3321
+ },
3322
+ filter: {
3323
+ TAG: function(nodeNameSelector) {
3324
+ var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
3325
+ return nodeNameSelector === "*" ? function() {
3326
+ return true;
3327
+ } : function(elem) {
3328
+ return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
3329
+ };
3330
+ },
3331
+ CLASS: function(className) {
3332
+ var pattern = classCache[className + " "];
3333
+ return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function(elem) {
3334
+ return pattern.test(typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "");
3335
+ });
3336
+ },
3337
+ ATTR: function(name, operator, check) {
3338
+ return function(elem) {
3339
+ var result = Sizzle.attr(elem, name);
3340
+ if (result == null) return operator === "!=";
3341
+ if (!operator) return true;
3342
+ result += "";
3343
+ return operator === "=" ? result === check : operator === "!=" ? result !== check : operator === "^=" ? check && result.indexOf(check) === 0 : operator === "*=" ? check && result.indexOf(check) > -1 : operator === "$=" ? check && result.slice(-check.length) === check : operator === "~=" ? (" " + result.replace(rwhitespace, " ") + " ").indexOf(check) > -1 : operator === "|=" ? result === check || result.slice(0, check.length + 1) === check + "-" : false;
3344
+ };
3345
+ },
3346
+ CHILD: function(type, what, _argument, first, last) {
3347
+ var simple = type.slice(0, 3) !== "nth", forward = type.slice(-4) !== "last", ofType = what === "of-type";
3348
+ return first === 1 && last === 0 ? function(elem) {
3349
+ return !!elem.parentNode;
3350
+ } : function(elem, _context, xml) {
3351
+ var cache, uniqueCache, outerCache, node, nodeIndex, start, dir = simple !== forward ? "nextSibling" : "previousSibling", parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), useCache = !xml && !ofType, diff = false;
3352
+ if (parent) {
3353
+ if (simple) {
3354
+ while (dir) {
3355
+ node = elem;
3356
+ while (node = node[dir]) if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) return false;
3357
+ start = dir = type === "only" && !start && "nextSibling";
3358
+ }
3359
+ return true;
3360
+ }
3361
+ start = [forward ? parent.firstChild : parent.lastChild];
3362
+ if (forward && useCache) {
3363
+ node = parent;
3364
+ outerCache = node[expando] || (node[expando] = {});
3365
+ uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
3366
+ cache = uniqueCache[type] || [];
3367
+ nodeIndex = cache[0] === dirruns && cache[1];
3368
+ diff = nodeIndex && cache[2];
3369
+ node = nodeIndex && parent.childNodes[nodeIndex];
3370
+ while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) if (node.nodeType === 1 && ++diff && node === elem) {
3371
+ uniqueCache[type] = [
3372
+ dirruns,
3373
+ nodeIndex,
3374
+ diff
3375
+ ];
3376
+ break;
3377
+ }
3378
+ } else {
3379
+ if (useCache) {
3380
+ node = elem;
3381
+ outerCache = node[expando] || (node[expando] = {});
3382
+ uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
3383
+ cache = uniqueCache[type] || [];
3384
+ nodeIndex = cache[0] === dirruns && cache[1];
3385
+ diff = nodeIndex;
3386
+ }
3387
+ if (diff === false) {
3388
+ while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) {
3389
+ if (useCache) {
3390
+ outerCache = node[expando] || (node[expando] = {});
3391
+ uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
3392
+ uniqueCache[type] = [dirruns, diff];
3393
+ }
3394
+ if (node === elem) break;
3395
+ }
3396
+ }
3397
+ }
3398
+ diff -= last;
3399
+ return diff === first || diff % first === 0 && diff / first >= 0;
3400
+ }
3401
+ };
3402
+ },
3403
+ PSEUDO: function(pseudo, argument) {
3404
+ var args, fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle.error("unsupported pseudo: " + pseudo);
3405
+ if (fn[expando]) return fn(argument);
3406
+ if (fn.length > 1) {
3407
+ args = [
3408
+ pseudo,
3409
+ pseudo,
3410
+ "",
3411
+ argument
3412
+ ];
3413
+ return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function(seed, matches) {
3414
+ var idx, matched = fn(seed, argument), i = matched.length;
3415
+ while (i--) {
3416
+ idx = indexOf(seed, matched[i]);
3417
+ seed[idx] = !(matches[idx] = matched[i]);
3418
+ }
3419
+ }) : function(elem) {
3420
+ return fn(elem, 0, args);
3421
+ };
3422
+ }
3423
+ return fn;
3424
+ }
3425
+ },
3426
+ pseudos: {
3427
+ not: markFunction(function(selector) {
3428
+ var input = [], results = [], matcher = compile(selector.replace(rtrim, "$1"));
3429
+ return matcher[expando] ? markFunction(function(seed, matches, _context, xml) {
3430
+ var elem, unmatched = matcher(seed, null, xml, []), i = seed.length;
3431
+ while (i--) if (elem = unmatched[i]) seed[i] = !(matches[i] = elem);
3432
+ }) : function(elem, _context, xml) {
3433
+ input[0] = elem;
3434
+ matcher(input, null, xml, results);
3435
+ input[0] = null;
3436
+ return !results.pop();
3437
+ };
3438
+ }),
3439
+ has: markFunction(function(selector) {
3440
+ return function(elem) {
3441
+ return Sizzle(selector, elem).length > 0;
3442
+ };
3443
+ }),
3444
+ contains: markFunction(function(text) {
3445
+ text = text.replace(runescape, funescape);
3446
+ return function(elem) {
3447
+ return (elem.textContent || getText(elem)).indexOf(text) > -1;
3448
+ };
3449
+ }),
3450
+ lang: markFunction(function(lang) {
3451
+ if (!ridentifier.test(lang || "")) Sizzle.error("unsupported lang: " + lang);
3452
+ lang = lang.replace(runescape, funescape).toLowerCase();
3453
+ return function(elem) {
3454
+ var elemLang;
3455
+ do
3456
+ if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) {
3457
+ elemLang = elemLang.toLowerCase();
3458
+ return elemLang === lang || elemLang.indexOf(lang + "-") === 0;
3459
+ }
3460
+ while ((elem = elem.parentNode) && elem.nodeType === 1);
3461
+ return false;
3462
+ };
3463
+ }),
3464
+ target: function(elem) {
3465
+ var hash = window.location && window.location.hash;
3466
+ return hash && hash.slice(1) === elem.id;
3467
+ },
3468
+ root: function(elem) {
3469
+ return elem === docElem;
3470
+ },
3471
+ focus: function(elem) {
3472
+ return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
3473
+ },
3474
+ enabled: createDisabledPseudo(false),
3475
+ disabled: createDisabledPseudo(true),
3476
+ checked: function(elem) {
3477
+ var nodeName = elem.nodeName.toLowerCase();
3478
+ return nodeName === "input" && !!elem.checked || nodeName === "option" && !!elem.selected;
3479
+ },
3480
+ selected: function(elem) {
3481
+ if (elem.parentNode) elem.parentNode.selectedIndex;
3482
+ return elem.selected === true;
3483
+ },
3484
+ empty: function(elem) {
3485
+ for (elem = elem.firstChild; elem; elem = elem.nextSibling) if (elem.nodeType < 6) return false;
3486
+ return true;
3487
+ },
3488
+ parent: function(elem) {
3489
+ return !Expr.pseudos["empty"](elem);
3490
+ },
3491
+ header: function(elem) {
3492
+ return rheader.test(elem.nodeName);
3493
+ },
3494
+ input: function(elem) {
3495
+ return rinputs.test(elem.nodeName);
3496
+ },
3497
+ button: function(elem) {
3498
+ var name = elem.nodeName.toLowerCase();
3499
+ return name === "input" && elem.type === "button" || name === "button";
3500
+ },
3501
+ text: function(elem) {
3502
+ var attr;
3503
+ return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && ((attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text");
3504
+ },
3505
+ first: createPositionalPseudo(function() {
3506
+ return [0];
3507
+ }),
3508
+ last: createPositionalPseudo(function(_matchIndexes, length) {
3509
+ return [length - 1];
3510
+ }),
3511
+ eq: createPositionalPseudo(function(_matchIndexes, length, argument) {
3512
+ return [argument < 0 ? argument + length : argument];
3513
+ }),
3514
+ even: createPositionalPseudo(function(matchIndexes, length) {
3515
+ var i = 0;
3516
+ for (; i < length; i += 2) matchIndexes.push(i);
3517
+ return matchIndexes;
3518
+ }),
3519
+ odd: createPositionalPseudo(function(matchIndexes, length) {
3520
+ var i = 1;
3521
+ for (; i < length; i += 2) matchIndexes.push(i);
3522
+ return matchIndexes;
3523
+ }),
3524
+ lt: createPositionalPseudo(function(matchIndexes, length, argument) {
3525
+ var i = argument < 0 ? argument + length : argument > length ? length : argument;
3526
+ for (; --i >= 0;) matchIndexes.push(i);
3527
+ return matchIndexes;
3528
+ }),
3529
+ gt: createPositionalPseudo(function(matchIndexes, length, argument) {
3530
+ var i = argument < 0 ? argument + length : argument;
3531
+ for (; ++i < length;) matchIndexes.push(i);
3532
+ return matchIndexes;
3533
+ })
3534
+ }
3535
+ };
3536
+ Expr.pseudos["nth"] = Expr.pseudos["eq"];
3537
+ for (i in {
3538
+ radio: true,
3539
+ checkbox: true,
3540
+ file: true,
3541
+ password: true,
3542
+ image: true
3543
+ }) Expr.pseudos[i] = createInputPseudo(i);
3544
+ for (i in {
3545
+ submit: true,
3546
+ reset: true
3547
+ }) Expr.pseudos[i] = createButtonPseudo(i);
3548
+ function setFilters() {}
3549
+ setFilters.prototype = Expr.filters = Expr.pseudos;
3550
+ Expr.setFilters = new setFilters();
3551
+ tokenize = Sizzle.tokenize = function(selector, parseOnly) {
3552
+ var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[selector + " "];
3553
+ if (cached) return parseOnly ? 0 : cached.slice(0);
3554
+ soFar = selector;
3555
+ groups = [];
3556
+ preFilters = Expr.preFilter;
3557
+ while (soFar) {
3558
+ if (!matched || (match = rcomma.exec(soFar))) {
3559
+ if (match) soFar = soFar.slice(match[0].length) || soFar;
3560
+ groups.push(tokens = []);
3561
+ }
3562
+ matched = false;
3563
+ if (match = rcombinators.exec(soFar)) {
3564
+ matched = match.shift();
3565
+ tokens.push({
3566
+ value: matched,
3567
+ type: match[0].replace(rtrim, " ")
3568
+ });
3569
+ soFar = soFar.slice(matched.length);
3570
+ }
3571
+ for (type in Expr.filter) if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) {
3572
+ matched = match.shift();
3573
+ tokens.push({
3574
+ value: matched,
3575
+ type,
3576
+ matches: match
3577
+ });
3578
+ soFar = soFar.slice(matched.length);
3579
+ }
3580
+ if (!matched) break;
3581
+ }
3582
+ return parseOnly ? soFar.length : soFar ? Sizzle.error(selector) : tokenCache(selector, groups).slice(0);
3583
+ };
3584
+ function toSelector(tokens) {
3585
+ var i = 0, len = tokens.length, selector = "";
3586
+ for (; i < len; i++) selector += tokens[i].value;
3587
+ return selector;
3588
+ }
3589
+ function addCombinator(matcher, combinator, base) {
3590
+ var dir = combinator.dir, skip = combinator.next, key = skip || dir, checkNonElements = base && key === "parentNode", doneName = done++;
3591
+ return combinator.first ? function(elem, context, xml) {
3592
+ while (elem = elem[dir]) if (elem.nodeType === 1 || checkNonElements) return matcher(elem, context, xml);
3593
+ return false;
3594
+ } : function(elem, context, xml) {
3595
+ var oldCache, uniqueCache, outerCache, newCache = [dirruns, doneName];
3596
+ if (xml) {
3597
+ while (elem = elem[dir]) if (elem.nodeType === 1 || checkNonElements) {
3598
+ if (matcher(elem, context, xml)) return true;
3599
+ }
3600
+ } else while (elem = elem[dir]) if (elem.nodeType === 1 || checkNonElements) {
3601
+ outerCache = elem[expando] || (elem[expando] = {});
3602
+ uniqueCache = outerCache[elem.uniqueID] || (outerCache[elem.uniqueID] = {});
3603
+ if (skip && skip === elem.nodeName.toLowerCase()) elem = elem[dir] || elem;
3604
+ else if ((oldCache = uniqueCache[key]) && oldCache[0] === dirruns && oldCache[1] === doneName) return newCache[2] = oldCache[2];
3605
+ else {
3606
+ uniqueCache[key] = newCache;
3607
+ if (newCache[2] = matcher(elem, context, xml)) return true;
3608
+ }
3609
+ }
3610
+ return false;
3611
+ };
3612
+ }
3613
+ function elementMatcher(matchers) {
3614
+ return matchers.length > 1 ? function(elem, context, xml) {
3615
+ var i = matchers.length;
3616
+ while (i--) if (!matchers[i](elem, context, xml)) return false;
3617
+ return true;
3618
+ } : matchers[0];
3619
+ }
3620
+ function multipleContexts(selector, contexts, results) {
3621
+ var i = 0, len = contexts.length;
3622
+ for (; i < len; i++) Sizzle(selector, contexts[i], results);
3623
+ return results;
3624
+ }
3625
+ function condense(unmatched, map, filter, context, xml) {
3626
+ var elem, newUnmatched = [], i = 0, len = unmatched.length, mapped = map != null;
3627
+ for (; i < len; i++) if (elem = unmatched[i]) {
3628
+ if (!filter || filter(elem, context, xml)) {
3629
+ newUnmatched.push(elem);
3630
+ if (mapped) map.push(i);
3631
+ }
3632
+ }
3633
+ return newUnmatched;
3634
+ }
3635
+ function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
3636
+ if (postFilter && !postFilter[expando]) postFilter = setMatcher(postFilter);
3637
+ if (postFinder && !postFinder[expando]) postFinder = setMatcher(postFinder, postSelector);
3638
+ return markFunction(function(seed, results, context, xml) {
3639
+ var temp, i, elem, preMap = [], postMap = [], preexisting = results.length, elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []), matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems, matcherOut = matcher ? postFinder || (seed ? preFilter : preexisting || postFilter) ? [] : results : matcherIn;
3640
+ if (matcher) matcher(matcherIn, matcherOut, context, xml);
3641
+ if (postFilter) {
3642
+ temp = condense(matcherOut, postMap);
3643
+ postFilter(temp, [], context, xml);
3644
+ i = temp.length;
3645
+ while (i--) if (elem = temp[i]) matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem);
3646
+ }
3647
+ if (seed) {
3648
+ if (postFinder || preFilter) {
3649
+ if (postFinder) {
3650
+ temp = [];
3651
+ i = matcherOut.length;
3652
+ while (i--) if (elem = matcherOut[i]) temp.push(matcherIn[i] = elem);
3653
+ postFinder(null, matcherOut = [], temp, xml);
3654
+ }
3655
+ i = matcherOut.length;
3656
+ while (i--) if ((elem = matcherOut[i]) && (temp = postFinder ? indexOf(seed, elem) : preMap[i]) > -1) seed[temp] = !(results[temp] = elem);
3657
+ }
3658
+ } else {
3659
+ matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut);
3660
+ if (postFinder) postFinder(null, results, matcherOut, xml);
3661
+ else push.apply(results, matcherOut);
3662
+ }
3663
+ });
3664
+ }
3665
+ function matcherFromTokens(tokens) {
3666
+ var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[tokens[0].type], implicitRelative = leadingRelative || Expr.relative[" "], i = leadingRelative ? 1 : 0, matchContext = addCombinator(function(elem) {
3667
+ return elem === checkContext;
3668
+ }, implicitRelative, true), matchAnyContext = addCombinator(function(elem) {
3669
+ return indexOf(checkContext, elem) > -1;
3670
+ }, implicitRelative, true), matchers = [function(elem, context, xml) {
3671
+ var ret = !leadingRelative && (xml || context !== outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));
3672
+ checkContext = null;
3673
+ return ret;
3674
+ }];
3675
+ for (; i < len; i++) if (matcher = Expr.relative[tokens[i].type]) matchers = [addCombinator(elementMatcher(matchers), matcher)];
3676
+ else {
3677
+ matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);
3678
+ if (matcher[expando]) {
3679
+ j = ++i;
3680
+ for (; j < len; j++) if (Expr.relative[tokens[j].type]) break;
3681
+ return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector(tokens.slice(0, i - 1).concat({ value: tokens[i - 2].type === " " ? "*" : "" })).replace(rtrim, "$1"), matcher, i < j && matcherFromTokens(tokens.slice(i, j)), j < len && matcherFromTokens(tokens = tokens.slice(j)), j < len && toSelector(tokens));
3682
+ }
3683
+ matchers.push(matcher);
3684
+ }
3685
+ return elementMatcher(matchers);
3686
+ }
3687
+ function matcherFromGroupMatchers(elementMatchers, setMatchers) {
3688
+ var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function(seed, context, xml, results, outermost) {
3689
+ var elem, j, matcher, matchedCount = 0, i = "0", unmatched = seed && [], setMatched = [], contextBackup = outermostContext, elems = seed || byElement && Expr.find["TAG"]("*", outermost), dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || .1, len = elems.length;
3690
+ if (outermost) outermostContext = context == document || context || outermost;
3691
+ for (; i !== len && (elem = elems[i]) != null; i++) {
3692
+ if (byElement && elem) {
3693
+ j = 0;
3694
+ if (!context && elem.ownerDocument != document) {
3695
+ setDocument(elem);
3696
+ xml = !documentIsHTML;
3697
+ }
3698
+ while (matcher = elementMatchers[j++]) if (matcher(elem, context || document, xml)) {
3699
+ results.push(elem);
3700
+ break;
3701
+ }
3702
+ if (outermost) dirruns = dirrunsUnique;
3703
+ }
3704
+ if (bySet) {
3705
+ if (elem = !matcher && elem) matchedCount--;
3706
+ if (seed) unmatched.push(elem);
3707
+ }
3708
+ }
3709
+ matchedCount += i;
3710
+ if (bySet && i !== matchedCount) {
3711
+ j = 0;
3712
+ while (matcher = setMatchers[j++]) matcher(unmatched, setMatched, context, xml);
3713
+ if (seed) {
3714
+ if (matchedCount > 0) {
3715
+ while (i--) if (!(unmatched[i] || setMatched[i])) setMatched[i] = pop.call(results);
3716
+ }
3717
+ setMatched = condense(setMatched);
3718
+ }
3719
+ push.apply(results, setMatched);
3720
+ if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) Sizzle.uniqueSort(results);
3721
+ }
3722
+ if (outermost) {
3723
+ dirruns = dirrunsUnique;
3724
+ outermostContext = contextBackup;
3725
+ }
3726
+ return unmatched;
3727
+ };
3728
+ return bySet ? markFunction(superMatcher) : superMatcher;
3729
+ }
3730
+ compile = Sizzle.compile = function(selector, match) {
3731
+ var i, setMatchers = [], elementMatchers = [], cached = compilerCache[selector + " "];
3732
+ if (!cached) {
3733
+ if (!match) match = tokenize(selector);
3734
+ i = match.length;
3735
+ while (i--) {
3736
+ cached = matcherFromTokens(match[i]);
3737
+ if (cached[expando]) setMatchers.push(cached);
3738
+ else elementMatchers.push(cached);
3739
+ }
3740
+ cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));
3741
+ cached.selector = selector;
3742
+ }
3743
+ return cached;
3744
+ };
3745
+ /**
3746
+ * A low-level selection function that works with Sizzle's compiled
3747
+ * selector functions
3748
+ * @param {String|Function} selector A selector or a pre-compiled
3749
+ * selector function built with Sizzle.compile
3750
+ * @param {Element} context
3751
+ * @param {Array} [results]
3752
+ * @param {Array} [seed] A set of elements to match against
3753
+ */
3754
+ select = Sizzle.select = function(selector, context, results, seed) {
3755
+ var i, tokens, token, type, find, compiled = typeof selector === "function" && selector, match = !seed && tokenize(selector = compiled.selector || selector);
3756
+ results = results || [];
3757
+ if (match.length === 1) {
3758
+ tokens = match[0] = match[0].slice(0);
3759
+ if (tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {
3760
+ context = (Expr.find["ID"](token.matches[0].replace(runescape, funescape), context) || [])[0];
3761
+ if (!context) return results;
3762
+ else if (compiled) context = context.parentNode;
3763
+ selector = selector.slice(tokens.shift().value.length);
3764
+ }
3765
+ i = matchExpr["needsContext"].test(selector) ? 0 : tokens.length;
3766
+ while (i--) {
3767
+ token = tokens[i];
3768
+ if (Expr.relative[type = token.type]) break;
3769
+ if (find = Expr.find[type]) {
3770
+ if (seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) || context)) {
3771
+ tokens.splice(i, 1);
3772
+ selector = seed.length && toSelector(tokens);
3773
+ if (!selector) {
3774
+ push.apply(results, seed);
3775
+ return results;
3776
+ }
3777
+ break;
3778
+ }
3779
+ }
3780
+ }
3781
+ }
3782
+ (compiled || compile(selector, match))(seed, context, !documentIsHTML, results, !context || rsibling.test(selector) && testContext(context.parentNode) || context);
3783
+ return results;
3784
+ };
3785
+ support.sortStable = expando.split("").sort(sortOrder).join("") === expando;
3786
+ support.detectDuplicates = !!hasDuplicate;
3787
+ setDocument();
3788
+ support.sortDetached = assert(function(el) {
3789
+ return el.compareDocumentPosition(document.createElement("fieldset")) & 1;
3790
+ });
3791
+ if (!assert(function(el) {
3792
+ el.innerHTML = "<a href='#'></a>";
3793
+ return el.firstChild.getAttribute("href") === "#";
3794
+ })) addHandle("type|href|height|width", function(elem, name, isXML) {
3795
+ if (!isXML) return elem.getAttribute(name, name.toLowerCase() === "type" ? 1 : 2);
3796
+ });
3797
+ if (!support.attributes || !assert(function(el) {
3798
+ el.innerHTML = "<input/>";
3799
+ el.firstChild.setAttribute("value", "");
3800
+ return el.firstChild.getAttribute("value") === "";
3801
+ })) addHandle("value", function(elem, _name, isXML) {
3802
+ if (!isXML && elem.nodeName.toLowerCase() === "input") return elem.defaultValue;
3803
+ });
3804
+ if (!assert(function(el) {
3805
+ return el.getAttribute("disabled") == null;
3806
+ })) addHandle(booleans, function(elem, name, isXML) {
3807
+ var val;
3808
+ if (!isXML) return elem[name] === true ? name.toLowerCase() : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
3809
+ });
3810
+ var _sizzle = window.Sizzle;
3811
+ Sizzle.noConflict = function() {
3812
+ if (window.Sizzle === Sizzle) window.Sizzle = _sizzle;
3813
+ return Sizzle;
3814
+ };
3815
+ if (typeof define === "function" && define.amd) define(function() {
3816
+ return Sizzle;
3817
+ });
3818
+ else if (typeof module !== "undefined" && module.exports) module.exports = Sizzle;
3819
+ else window.Sizzle = Sizzle;
3820
+ }
3821
+ //#endregion
3822
+ //#region node_modules/.pnpm/@jsr+b-fuze__deno-dom@0.1.56/node_modules/@jsr/b-fuze__deno-dom/src/dom/selectors/sizzle-types.js
3823
+ const DOM = sizzle_default;
3824
+ //#endregion
3825
+ //#region node_modules/.pnpm/@jsr+b-fuze__deno-dom@0.1.56/node_modules/@jsr/b-fuze__deno-dom/src/dom/selectors/selectors.js
3826
+ let codeGenerationAllowed = null;
3827
+ function getSelectorEngine() {
3828
+ if (codeGenerationAllowed === null) try {
3829
+ new Function("");
3830
+ codeGenerationAllowed = true;
3831
+ } catch (e) {
3832
+ codeGenerationAllowed = false;
3833
+ }
3834
+ if (codeGenerationAllowed) return DOM$1;
3835
+ else return DOM;
3836
+ }
3837
+ //#endregion
3838
+ //#region node_modules/.pnpm/@jsr+b-fuze__deno-dom@0.1.56/node_modules/@jsr/b-fuze__deno-dom/src/dom/document.js
3839
+ var DOMImplementation = class {
3840
+ constructor(key) {
3841
+ if (key !== CTOR_KEY) throw new TypeError("Illegal constructor.");
3842
+ }
3843
+ createDocument() {
3844
+ throw new Error("Unimplemented");
3845
+ }
3846
+ createHTMLDocument(titleStr) {
3847
+ titleStr += "";
3848
+ const doc = new HTMLDocument(CTOR_KEY);
3849
+ const docType = new DocumentType("html", "", "", CTOR_KEY);
3850
+ doc.appendChild(docType);
3851
+ const html = new Element$1("html", doc, [], CTOR_KEY);
3852
+ html._setOwnerDocument(doc);
3853
+ const head = new Element$1("head", html, [], CTOR_KEY);
3854
+ const body = new Element$1("body", html, [], CTOR_KEY);
3855
+ const title = new Element$1("title", head, [], CTOR_KEY);
3856
+ const titleText = new Text(titleStr);
3857
+ title.appendChild(titleText);
3858
+ doc.head = head;
3859
+ doc.body = body;
3860
+ return doc;
3861
+ }
3862
+ createDocumentType(qualifiedName, publicId, systemId) {
3863
+ return new DocumentType(qualifiedName, publicId, systemId, CTOR_KEY);
3864
+ }
3865
+ };
3866
+ var DocumentType = class DocumentType extends Node {
3867
+ #qualifiedName = "";
3868
+ #publicId = "";
3869
+ #systemId = "";
3870
+ constructor(name, publicId, systemId, key) {
3871
+ super("html", NodeType.DOCUMENT_TYPE_NODE, null, key);
3872
+ this.#qualifiedName = name;
3873
+ this.#publicId = publicId;
3874
+ this.#systemId = systemId;
3875
+ }
3876
+ get name() {
3877
+ return this.#qualifiedName;
3878
+ }
3879
+ get publicId() {
3880
+ return this.#publicId;
3881
+ }
3882
+ get systemId() {
3883
+ return this.#systemId;
3884
+ }
3885
+ _shallowClone() {
3886
+ return new DocumentType(this.#qualifiedName, this.#publicId, this.#systemId, CTOR_KEY);
3887
+ }
3888
+ };
3889
+ var Document$1 = class Document$1 extends Node {
3890
+ head = null;
3891
+ body = null;
3892
+ implementation;
3893
+ #documentURI = "about:blank";
3894
+ #nwapi = null;
3895
+ constructor() {
3896
+ super("#document", NodeType.DOCUMENT_NODE, null, CTOR_KEY);
3897
+ this.implementation = new DOMImplementation(CTOR_KEY);
3898
+ }
3899
+ _shallowClone() {
3900
+ return new Document$1();
3901
+ }
3902
+ get _nwapi() {
3903
+ return this.#nwapi || (this.#nwapi = getSelectorEngine()(this));
3904
+ }
3905
+ get documentURI() {
3906
+ return this.#documentURI;
3907
+ }
3908
+ get title() {
3909
+ return this.querySelector("title")?.textContent || "";
3910
+ }
3911
+ set title(value) {
3912
+ let titleElement = this.querySelector("title");
3913
+ if (!titleElement) {
3914
+ const { head } = this;
3915
+ if (!head) return;
3916
+ titleElement = this.createElement("title");
3917
+ head.appendChild(titleElement);
3918
+ }
3919
+ titleElement.textContent = value;
3920
+ }
3921
+ get cookie() {
3922
+ return "";
3923
+ }
3924
+ set cookie(newCookie) {}
3925
+ get visibilityState() {
3926
+ return "visible";
3927
+ }
3928
+ get hidden() {
3929
+ return false;
3930
+ }
3931
+ get compatMode() {
3932
+ return "CSS1Compat";
3933
+ }
3934
+ get documentElement() {
3935
+ for (const node of this.childNodes) if (node.nodeType === NodeType.ELEMENT_NODE) return node;
3936
+ return null;
3937
+ }
3938
+ get doctype() {
3939
+ for (const node of this.childNodes) if (node.nodeType === NodeType.DOCUMENT_TYPE_NODE) return node;
3940
+ return null;
3941
+ }
3942
+ get childElementCount() {
3943
+ let count = 0;
3944
+ for (const { nodeType } of this.childNodes) if (nodeType === NodeType.ELEMENT_NODE) count++;
3945
+ return count;
3946
+ }
3947
+ appendChild(child) {
3948
+ super.appendChild(child);
3949
+ child._setOwnerDocument(this);
3950
+ return child;
3951
+ }
3952
+ createElement(tagName, options) {
3953
+ tagName = getUpperCase(tagName);
3954
+ switch (tagName) {
3955
+ case "TEMPLATE": {
3956
+ const frag = new DocumentFragment$1();
3957
+ const elm = new HTMLTemplateElement(null, [], CTOR_KEY, frag);
3958
+ elm._setOwnerDocument(this);
3959
+ return elm;
3960
+ }
3961
+ default: {
3962
+ const elm = new Element$1(tagName, null, [], CTOR_KEY);
3963
+ elm._setOwnerDocument(this);
3964
+ return elm;
3965
+ }
3966
+ }
3967
+ }
3968
+ createElementNS(namespace, qualifiedName, options) {
3969
+ if (namespace === "http://www.w3.org/1999/xhtml") return this.createElement(qualifiedName, options);
3970
+ else throw new Error(`createElementNS: "${namespace}" namespace unimplemented`);
3971
+ }
3972
+ createTextNode(data) {
3973
+ return new Text(data);
3974
+ }
3975
+ createComment(data) {
3976
+ return new Comment(data);
3977
+ }
3978
+ createDocumentFragment() {
3979
+ const fragment = new DocumentFragment$1();
3980
+ fragment._setOwnerDocument(this);
3981
+ return fragment;
3982
+ }
3983
+ importNode(node, deep = false) {
3984
+ const copy = node.cloneNode(deep);
3985
+ copy._setOwnerDocument(this);
3986
+ return copy;
3987
+ }
3988
+ adoptNode(node) {
3989
+ if (node instanceof Document$1) throw new DOMException("Adopting a Document node is not supported.", "NotSupportedError");
3990
+ node._setParent(null);
3991
+ node._setOwnerDocument(this);
3992
+ return node;
3993
+ }
3994
+ cloneNode(deep) {
3995
+ const doc = super.cloneNode(deep);
3996
+ for (const child of doc.documentElement?.childNodes || []) switch (child.nodeName) {
3997
+ case "BODY":
3998
+ doc.body = child;
3999
+ break;
4000
+ case "HEAD": doc.head = child;
4001
+ }
4002
+ return doc;
4003
+ }
4004
+ querySelector(selectors) {
4005
+ return this._nwapi.first(selectors, this);
4006
+ }
4007
+ querySelectorAll(selectors) {
4008
+ const nodeList = new NodeList();
4009
+ const mutator = nodeList[nodeListMutatorSym]();
4010
+ for (const match of this._nwapi.select(selectors, this)) mutator.push(match);
4011
+ return nodeList;
4012
+ }
4013
+ getElementById(id) {
4014
+ if (!this._hasInitializedChildNodes()) return null;
4015
+ for (const child of this.childNodes) if (child.nodeType === NodeType.ELEMENT_NODE) {
4016
+ if (child.id === id) return child;
4017
+ const search = child.getElementById(id);
4018
+ if (search) return search;
4019
+ }
4020
+ return null;
4021
+ }
4022
+ getElementsByTagName(tagName) {
4023
+ if (tagName === "*") return this.documentElement ? this._getElementsByTagNameWildcard(this.documentElement, []) : [];
4024
+ else return this._getElementsByTagName(getUpperCase(tagName), []);
4025
+ }
4026
+ _getElementsByTagNameWildcard(node, search) {
4027
+ for (const child of this.childNodes) if (child.nodeType === NodeType.ELEMENT_NODE) {
4028
+ search.push(child);
4029
+ child._getElementsByTagNameWildcard(search);
4030
+ }
4031
+ return search;
4032
+ }
4033
+ _getElementsByTagName(tagName, search) {
4034
+ for (const child of this.childNodes) if (child.nodeType === NodeType.ELEMENT_NODE) {
4035
+ if (child.tagName === tagName) search.push(child);
4036
+ child._getElementsByTagName(tagName, search);
4037
+ }
4038
+ return search;
4039
+ }
4040
+ getElementsByTagNameNS(_namespace, localName) {
4041
+ return this.getElementsByTagName(localName);
4042
+ }
4043
+ getElementsByClassName(className) {
4044
+ return getElementsByClassName(this, className.trim().split(/\s+/), []);
4045
+ }
4046
+ hasFocus() {
4047
+ return true;
4048
+ }
4049
+ };
4050
+ var HTMLDocument = class HTMLDocument extends Document$1 {
4051
+ constructor(key) {
4052
+ if (key !== CTOR_KEY) throw new TypeError("Illegal constructor.");
4053
+ super();
4054
+ }
4055
+ _shallowClone() {
4056
+ return new HTMLDocument(CTOR_KEY);
4057
+ }
4058
+ };
4059
+ utils_types_default.Document = Document$1;
4060
+ //#endregion
4061
+ //#region node_modules/.pnpm/@jsr+b-fuze__deno-dom@0.1.56/node_modules/@jsr/b-fuze__deno-dom/src/deserialize.js
4062
+ function nodesFromString(html) {
4063
+ return nodeFromArray(JSON.parse(parse(html)), null);
4064
+ }
4065
+ function fragmentNodesFromString(html, contextLocalName) {
4066
+ return nodeFromArray(JSON.parse(parseFrag(html, contextLocalName)), null);
4067
+ }
4068
+ function nodeFromArray(data, parentNode) {
4069
+ if (data[1] === "template") {
4070
+ const content = nodeFromArray(data[3], null);
4071
+ const contentFrag = new DocumentFragment$1();
4072
+ const fragMutator = contentFrag._getChildNodesMutator();
4073
+ for (const child of content.childNodes) {
4074
+ fragMutator.push(child);
4075
+ child._setParent(contentFrag);
4076
+ }
4077
+ return new HTMLTemplateElement(parentNode, data[2], CTOR_KEY, contentFrag);
4078
+ }
4079
+ const elm = new Element$1(data[1], parentNode, data[2], CTOR_KEY);
4080
+ const childNodes = elm._getChildNodesMutator();
4081
+ let childNode;
4082
+ for (const child of data.slice(3)) switch (child[0]) {
4083
+ case NodeType.TEXT_NODE:
4084
+ childNode = new Text(child[1]);
4085
+ childNode.parentNode = elm;
4086
+ childNodes.push(childNode);
4087
+ break;
4088
+ case NodeType.COMMENT_NODE:
4089
+ childNode = new Comment(child[1]);
4090
+ childNode.parentNode = elm;
4091
+ childNodes.push(childNode);
4092
+ break;
4093
+ case NodeType.DOCUMENT_NODE:
4094
+ case NodeType.ELEMENT_NODE:
4095
+ nodeFromArray(child, elm);
4096
+ break;
4097
+ case NodeType.DOCUMENT_TYPE_NODE:
4098
+ childNode = new DocumentType(child[1], child[2], child[3], CTOR_KEY);
4099
+ childNode.parentNode = elm;
4100
+ childNodes.push(childNode);
4101
+ }
4102
+ return elm;
4103
+ }
4104
+ //#endregion
4105
+ //#region node_modules/.pnpm/@jsr+b-fuze__deno-dom@0.1.56/node_modules/@jsr/b-fuze__deno-dom/src/dom/dom-parser.js
4106
+ var DOMParser$1 = class {
4107
+ parseFromString(source, mimeType) {
4108
+ if (mimeType !== "text/html") throw new Error(`DOMParser: "${mimeType}" unimplemented`);
4109
+ const doc = new HTMLDocument(CTOR_KEY);
4110
+ const fakeDoc = nodesFromString(String(source));
4111
+ let htmlNode = null;
4112
+ let hasDoctype = false;
4113
+ for (const child of [...fakeDoc.childNodes]) {
4114
+ doc.appendChild(child);
4115
+ if (child instanceof DocumentType) hasDoctype = true;
4116
+ else if (child.nodeName === "HTML") htmlNode = child;
4117
+ }
4118
+ if (!hasDoctype) {
4119
+ const docType = new DocumentType("html", "", "", CTOR_KEY);
4120
+ if (doc.childNodes.length === 0) doc.appendChild(docType);
4121
+ else doc.insertBefore(docType, doc.childNodes[0]);
4122
+ }
4123
+ if (htmlNode) for (const child of htmlNode.childNodes) switch (child.tagName) {
4124
+ case "HEAD":
4125
+ doc.head = child;
4126
+ break;
4127
+ case "BODY": doc.body = child;
4128
+ }
4129
+ return doc;
4130
+ }
4131
+ };
4132
+ //#endregion
4133
+ //#region node_modules/.pnpm/@jsr+b-fuze__deno-dom@0.1.56/node_modules/@jsr/b-fuze__deno-dom/src/api.js
4134
+ const oldHasInstance = Array[Symbol.hasInstance];
4135
+ Object.defineProperty(Array, Symbol.hasInstance, {
4136
+ value(value) {
4137
+ switch (value?.constructor) {
4138
+ case HTMLCollection:
4139
+ case NodeList: return false;
4140
+ default: return oldHasInstance.call(this, value);
4141
+ }
4142
+ },
4143
+ configurable: true
4144
+ });
4145
+ const oldIsArray = Array.isArray;
4146
+ Object.defineProperty(Array, "isArray", {
4147
+ value: (value) => {
4148
+ switch (value?.constructor) {
4149
+ case HTMLCollection:
4150
+ case NodeList: return false;
4151
+ default: return oldIsArray.call(Array, value);
4152
+ }
4153
+ },
4154
+ configurable: true
4155
+ });
4156
+ //#endregion
4157
+ //#region node_modules/.pnpm/@jsr+b-fuze__deno-dom@0.1.56/node_modules/@jsr/b-fuze__deno-dom/deno-dom-wasm.js
4158
+ /**
4159
+ * @module
4160
+ *
4161
+ * This module exposes the Deno DOM API with the WASM (Web Assembly) backend
4162
+ *
4163
+ * @example
4164
+ * ```typescript
4165
+ * import { DOMParser, Element } from "jsr:@b-fuze/deno-dom";
4166
+ *
4167
+ * const doc = new DOMParser().parseFromString(
4168
+ * `
4169
+ * <h1>Hello World!</h1>
4170
+ * <p>Hello from <a href="https://deno.land/">Deno!</a></p>
4171
+ * `,
4172
+ * "text/html",
4173
+ * );
4174
+ *
4175
+ * const p = doc.querySelector("p")!;
4176
+ * console.log(p.textContent); // "Hello from Deno!"
4177
+ * ```
4178
+ */ register(parse$1, parse_frag);
4179
+ //#endregion
2
4180
  //#region src/dom.ts
3
- let DOMParser$1 = globalThis.DOMParser;
4181
+ let DOMParser = globalThis.DOMParser;
4
4182
  const setDOMParser = (parser) => {
5
- DOMParser$1 = parser;
4183
+ DOMParser = parser;
6
4184
  };
7
4185
  //#endregion
8
4186
  //#region src/node-dom.ts
@@ -12,7 +4190,7 @@ const setDOMParser = (parser) => {
12
4190
  * This software is released under the MIT License.
13
4191
  * https://opensource.org/licenses/MIT
14
4192
  */
15
- setDOMParser(DOMParser);
4193
+ setDOMParser(DOMParser$1);
16
4194
  //#endregion
17
4195
  //#region src/BookmarksTree/BookmarksTree.ts
18
4196
  /**
@@ -149,7 +4327,7 @@ var BookmarksTree = class BookmarksTree extends Map {
149
4327
  * ```
150
4328
  */
151
4329
  toDOM() {
152
- return new DOMParser$1().parseFromString(this.HTMLString, "text/html");
4330
+ return new DOMParser().parseFromString(this.HTMLString, "text/html");
153
4331
  }
154
4332
  /**
155
4333
  * Gets the BookmarksTree as an HTML string in Netscape Bookmark format
@@ -285,7 +4463,7 @@ var BookmarksParser = class {
285
4463
  * ```
286
4464
  */
287
4465
  static parseFromHTMLString(htmlString) {
288
- const dom = new DOMParser$1().parseFromString(htmlString, "text/html");
4466
+ const dom = new DOMParser().parseFromString(htmlString, "text/html");
289
4467
  return BookmarksTree.fromDOM(dom);
290
4468
  }
291
4469
  /**