@asamuzakjp/dom-selector 6.3.2 → 6.3.4

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/README.md CHANGED
@@ -291,47 +291,47 @@ See [benchmark](https://github.com/asamuzaK/domSelector/actions/workflows/benchm
291
291
 
292
292
  |Selector|jsdom v25.0.1 (nwsapi)|happy-dom|linkeDom|patched-jsdom (dom-selector)|Result|
293
293
  |:-----------|:-----------|:-----------|:-----------|:-----------|:-----------|
294
- |simple selector:<br>`matches('.content')`|116,283 ops/sec ±6.10%|352,497 ops/sec ±2.07%|8,165 ops/sec ±0.82%|116,887 ops/sec ±0.60%|happydom is the fastest and 3.0 times faster than patched-jsdom. patched-jsdom is 1.0 times faster than jsdom.|
295
- |compound selector:<br>`matches('p.content[id]:is(:last-child, :only-child)')`|105,845 ops/sec ±1.79%|331,734 ops/sec ±4.02%|7,846 ops/sec ±0.97%|86,644 ops/sec ±0.19%|happydom is the fastest and 3.8 times faster than patched-jsdom. jsdom is 1.2 times faster than patched-jsdom.|
296
- |compound selector:<br>`matches('p.content[id]:is(:invalid-nth-child, :only-child)')`|F|341,380 ops/sec ±2.72%|F|44,663 ops/sec ±1.77%|happydom is the fastest and 7.6 times faster than patched-jsdom.|
297
- |compound selector:<br>`matches('p.content[id]:not(:is(.foo, .bar))')`|103,273 ops/sec ±0.35%|347,609 ops/sec ±0.57%|7,707 ops/sec ±0.73%|84,748 ops/sec ±0.66%|happydom is the fastest and 4.1 times faster than patched-jsdom. jsdom is 1.2 times faster than patched-jsdom.|
298
- |complex selector:<br>`matches('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner > .content')`|67,766 ops/sec ±0.51%|F|5,090 ops/sec ±0.91%|61,711 ops/sec ±0.48%|jsdom is the fastest and 1.1 times faster than patched-jsdom.|
299
- |complex selector:<br>`matches('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner:has(> .content)')`|F|F|4,976 ops/sec ±0.59%|14,990 ops/sec ±1.10%|patched-jsdom is the fastest.|
300
- |complex selector within logical pseudo-class:<br>`matches(':is(.box > .content, .block > .content)')`|95,327 ops/sec ±0.61%|F|5,312 ops/sec ±0.53%|85,778 ops/sec ±0.66%|jsdom is the fastest and 1.1 times faster than patched-jsdom.|
301
- |nested and chained :not() selector:<br>`matches('p:not(:is(:not(.content))):not(.foo)')`|F|F|4,819 ops/sec ±11.64%|83,653 ops/sec ±1.44%|patched-jsdom is the fastest.|
294
+ |simple selector:<br>`matches('.content')`|117,468 ops/sec ±4.45%|349,037 ops/sec ±2.71%|7,986 ops/sec ±0.83%|121,277 ops/sec ±0.58%|happydom is the fastest and 2.9 times faster than patched-jsdom. patched-jsdom is 1.0 times faster than jsdom.|
295
+ |compound selector:<br>`matches('p.content[id]:is(:last-child, :only-child)')`|109,103 ops/sec ±1.81%|323,742 ops/sec ±16.05%|7,826 ops/sec ±0.70%|89,905 ops/sec ±0.25%|happydom is the fastest and 3.6 times faster than patched-jsdom. jsdom is 1.2 times faster than patched-jsdom.|
296
+ |compound selector:<br>`matches('p.content[id]:is(:invalid-nth-child, :only-child)')`|F|350,215 ops/sec ±2.68%|F|44,510 ops/sec ±0.33%|happydom is the fastest and 7.9 times faster than patched-jsdom.|
297
+ |compound selector:<br>`matches('p.content[id]:not(:is(.foo, .bar))')`|106,858 ops/sec ±0.43%|352,297 ops/sec ±0.17%|7,639 ops/sec ±0.61%|87,013 ops/sec ±0.63%|happydom is the fastest and 4.0 times faster than patched-jsdom. jsdom is 1.2 times faster than patched-jsdom.|
298
+ |complex selector:<br>`matches('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner > .content')`|70,868 ops/sec ±0.57%|F|4,876 ops/sec ±0.49%|64,719 ops/sec ±0.36%|jsdom is the fastest and 1.1 times faster than patched-jsdom.|
299
+ |complex selector:<br>`matches('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner:has(> .content)')`|F|F|4,752 ops/sec ±0.54%|15,398 ops/sec ±3.41%|patched-jsdom is the fastest.|
300
+ |complex selector within logical pseudo-class:<br>`matches(':is(.box > .content, .block > .content)')`|99,626 ops/sec ±0.63%|F|5,129 ops/sec ±0.45%|95,577 ops/sec ±0.65%|jsdom is the fastest and 1.0 times faster than patched-jsdom.|
301
+ |nested and chained :not() selector:<br>`matches('p:not(:is(:not(.content))):not(.foo)')`|F|F|4,701 ops/sec ±13.49%|82,153 ops/sec ±0.68%|patched-jsdom is the fastest.|
302
302
 
303
303
  ### closest()
304
304
 
305
305
  |Selector|jsdom v25.0.1 (nwsapi)|happy-dom|linkeDom|patched-jsdom (dom-selector)|Result|
306
306
  |:-----------|:-----------|:-----------|:-----------|:-----------|:-----------|
307
- |simple selector:<br>`closest('.container')`|91,669 ops/sec ±0.71%|250,234 ops/sec ±39.44%|8,164 ops/sec ±0.64%|89,613 ops/sec ±0.67%|happydom is the fastest and 2.8 times faster than patched-jsdom. jsdom is 1.0 times faster than patched-jsdom.|
308
- |compound selector:<br>`closest('div.container[id]:not(.foo, .box)')`|64,840 ops/sec ±0.44%|F|7,587 ops/sec ±0.85%|56,065 ops/sec ±0.62%|jsdom is the fastest and 1.2 times faster than patched-jsdom.|
309
- |complex selector:<br>`closest('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner > .content')`|63,753 ops/sec ±0.35%|F|5,105 ops/sec ±0.33%|60,020 ops/sec ±0.95%|jsdom is the fastest and 1.1 times faster than patched-jsdom.|
310
- |complex selector:<br>`closest('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner:has(> .content)')`|F|F|4,978 ops/sec ±0.76%|12,812 ops/sec ±0.63%|patched-jsdom is the fastest.|
311
- |complex selector within logical pseudo-class:<br>`closest(':is(.container > .content, .container > .box)')`|73,570 ops/sec ±0.64%|297,918 ops/sec ±0.63%|5,296 ops/sec ±0.54%|71,004 ops/sec ±0.51%|happydom is the fastest and 4.2 times faster than patched-jsdom. jsdom is 1.0 times faster than patched-jsdom.|
312
- |nested and chained :not() selector:<br>`closest('div:not(:is(:not(.container))):not(.box)')`|F|F|7,487 ops/sec ±0.87%|71,354 ops/sec ±0.77%|patched-jsdom is the fastest.|
307
+ |simple selector:<br>`closest('.container')`|93,212 ops/sec ±0.46%|263,009 ops/sec ±30.00%|7,996 ops/sec ±0.64%|91,205 ops/sec ±0.35%|happydom is the fastest and 2.9 times faster than patched-jsdom. jsdom is 1.0 times faster than patched-jsdom.|
308
+ |compound selector:<br>`closest('div.container[id]:not(.foo, .box)')`|64,257 ops/sec ±0.27%|F|7,412 ops/sec ±0.84%|55,072 ops/sec ±0.33%|jsdom is the fastest and 1.2 times faster than patched-jsdom.|
309
+ |complex selector:<br>`closest('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner > .content')`|65,291 ops/sec ±0.22%|F|4,890 ops/sec ±0.41%|58,028 ops/sec ±0.64%|jsdom is the fastest and 1.1 times faster than patched-jsdom.|
310
+ |complex selector:<br>`closest('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner:has(> .content)')`|F|F|4,703 ops/sec ±1.06%|13,256 ops/sec ±0.48%|patched-jsdom is the fastest.|
311
+ |complex selector within logical pseudo-class:<br>`closest(':is(.container > .content, .container > .box)')`|75,927 ops/sec ±0.36%|307,805 ops/sec ±0.48%|5,108 ops/sec ±0.41%|69,864 ops/sec ±0.18%|happydom is the fastest and 4.4 times faster than patched-jsdom. jsdom is 1.1 times faster than patched-jsdom.|
312
+ |nested and chained :not() selector:<br>`closest('div:not(:is(:not(.container))):not(.box)')`|F|F|7,399 ops/sec ±0.61%|70,308 ops/sec ±0.48%|patched-jsdom is the fastest.|
313
313
 
314
314
  ### querySelector()
315
315
 
316
316
  |Selector|jsdom v25.0.1 (nwsapi)|happy-dom|linkeDom|patched-jsdom (dom-selector)|Result|
317
317
  |:-----------|:-----------|:-----------|:-----------|:-----------|:-----------|
318
- |simple selector:<br>`querySelector('.content')`|22,631 ops/sec ±1.24%|188,606 ops/sec ±59.77%|9,588 ops/sec ±0.83%|76,778 ops/sec ±0.84%|happydom is the fastest and 2.5 times faster than patched-jsdom. patched-jsdom is 3.4 times faster than jsdom.|
319
- |compound selector:<br>`querySelector('p.content[id]:is(:last-child, :only-child)')`|8,735 ops/sec ±0.49%|328,299 ops/sec ±0.56%|9,302 ops/sec ±0.67%|36,679 ops/sec ±0.91%|happydom is the fastest and 9.0 times faster than patched-jsdom. patched-jsdom is 4.2 times faster than jsdom.|
320
- |complex selector:<br>`querySelector('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner > .content')`|199 ops/sec ±0.95%|F|1,220 ops/sec ±0.76%|609 ops/sec ±0.53%|linkedom is the fastest and 2.0 times faster than patched-jsdom. patched-jsdom is 3.1 times faster than jsdom.|
321
- |complex selector:<br>`querySelector('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner:has(> .content)')`|F|F|1,489 ops/sec ±0.58%|445 ops/sec ±0.55%|linkedom is the fastest and 3.3 times faster than patched-jsdom.|
322
- |complex selector within logical pseudo-class:<br>`querySelector(':is(.box > .content, .block > .content)')`|2,980 ops/sec ±0.79%|F|8,954 ops/sec ±0.70%|71,533 ops/sec ±0.63%|patched-jsdom is the fastest. patched-jsdom is 24.0 times faster than jsdom.|
323
- |nested and chained :not() selector:<br>`querySelector('p:not(:is(:not(.content))):not(.foo)')`|F|F|9,045 ops/sec ±0.74%|67,579 ops/sec ±0.63%|patched-jsdom is the fastest.|
318
+ |simple selector:<br>`querySelector('.content')`|22,886 ops/sec ±0.82%|193,155 ops/sec ±54.70%|9,439 ops/sec ±0.63%|78,132 ops/sec ±0.17%|happydom is the fastest and 2.5 times faster than patched-jsdom. patched-jsdom is 3.4 times faster than jsdom.|
319
+ |compound selector:<br>`querySelector('p.content[id]:is(:last-child, :only-child)')`|8,542 ops/sec ±0.62%|336,066 ops/sec ±0.67%|9,046 ops/sec ±0.77%|35,397 ops/sec ±1.69%|happydom is the fastest and 9.5 times faster than patched-jsdom. patched-jsdom is 4.1 times faster than jsdom.|
320
+ |complex selector:<br>`querySelector('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner > .content')`|204 ops/sec ±0.44%|F|1,186 ops/sec ±0.50%|626 ops/sec ±0.57%|linkedom is the fastest and 1.9 times faster than patched-jsdom. patched-jsdom is 3.1 times faster than jsdom.|
321
+ |complex selector:<br>`querySelector('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner:has(> .content)')`|F|F|1,476 ops/sec ±0.74%|453 ops/sec ±0.78%|linkedom is the fastest and 3.3 times faster than patched-jsdom.|
322
+ |complex selector within logical pseudo-class:<br>`querySelector(':is(.box > .content, .block > .content)')`|3,144 ops/sec ±0.45%|F|8,766 ops/sec ±0.78%|77,257 ops/sec ±0.50%|patched-jsdom is the fastest. patched-jsdom is 24.6 times faster than jsdom.|
323
+ |nested and chained :not() selector:<br>`querySelector('p:not(:is(:not(.content))):not(.foo)')`|F|F|8,972 ops/sec ±0.70%|70,248 ops/sec ±0.39%|patched-jsdom is the fastest.|
324
324
 
325
325
  ### querySelectorAll()
326
326
 
327
327
  |Selector|jsdom v25.0.1 (nwsapi)|happy-dom|linkeDom|patched-jsdom (dom-selector)|Result|
328
328
  |:-----------|:-----------|:-----------|:-----------|:-----------|:-----------|
329
- |simple selector:<br>`querySelectorAll('.content')`|1,309 ops/sec ±0.65%|490 ops/sec ±39.19%|1,094 ops/sec ±0.63%|1,316 ops/sec ±1.08%|patched-jsdom is the fastest. patched-jsdom is 1.0 times faster than jsdom.|
330
- |compound selector:<br>`querySelectorAll('p.content[id]:is(:last-child, :only-child)')`|680 ops/sec ±0.58%|433 ops/sec ±46.81%|1,068 ops/sec ±0.70%|647 ops/sec ±0.61%|linkedom is the fastest and 1.7 times faster than patched-jsdom. jsdom is 1.1 times faster than patched-jsdom.|
331
- |complex selector:<br>`querySelectorAll('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner > .content')`|182 ops/sec ±1.53%|F|389 ops/sec ±0.67%|198 ops/sec ±0.88%|linkedom is the fastest and 2.0 times faster than patched-jsdom. patched-jsdom is 1.1 times faster than jsdom.|
332
- |complex selector:<br>`querySelectorAll('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner:has(> .content)')`|F|F|424 ops/sec ±0.45%|173 ops/sec ±0.45%|linkedom is the fastest and 2.4 times faster than patched-jsdom.|
333
- |complex selector within logical pseudo-class:<br>`querySelectorAll(':is(.box > .content, .block > .content)')`|267 ops/sec ±0.62%|F|467 ops/sec ±0.49%|829 ops/sec ±1.16%|patched-jsdom is the fastest. patched-jsdom is 3.1 times faster than jsdom.|
334
- |nested and chained :not() selector:<br>`querySelectorAll('p:not(:is(:not(.content))):not(.foo)')`|F|F|1,151 ops/sec ±0.27%|1,338 ops/sec ±0.69%|patched-jsdom is the fastest.|
329
+ |simple selector:<br>`querySelectorAll('.content')`|1,292 ops/sec ±0.58%|494 ops/sec ±44.77%|1,091 ops/sec ±0.72%|1,226 ops/sec ±0.45%|jsdom is the fastest and 1.1 times faster than patched-jsdom.|
330
+ |compound selector:<br>`querySelectorAll('p.content[id]:is(:last-child, :only-child)')`|688 ops/sec ±0.91%|455 ops/sec ±42.98%|1,096 ops/sec ±0.90%|656 ops/sec ±0.50%|linkedom is the fastest and 1.7 times faster than patched-jsdom. jsdom is 1.0 times faster than patched-jsdom.|
331
+ |complex selector:<br>`querySelectorAll('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner > .content')`|206 ops/sec ±0.58%|F|393 ops/sec ±0.62%|209 ops/sec ±0.58%|linkedom is the fastest and 1.9 times faster than patched-jsdom. patched-jsdom is 1.0 times faster than jsdom.|
332
+ |complex selector:<br>`querySelectorAll('.box:first-child ~ .box:nth-of-type(4n+1) + .box[id] .block.inner:has(> .content)')`|F|F|421 ops/sec ±0.83%|186 ops/sec ±0.49%|linkedom is the fastest and 2.3 times faster than patched-jsdom.|
333
+ |complex selector within logical pseudo-class:<br>`querySelectorAll(':is(.box > .content, .block > .content)')`|288 ops/sec ±0.64%|F|471 ops/sec ±0.71%|796 ops/sec ±2.11%|patched-jsdom is the fastest. patched-jsdom is 2.8 times faster than jsdom.|
334
+ |nested and chained :not() selector:<br>`querySelectorAll('p:not(:is(:not(.content))):not(.foo)')`|F|F|1,108 ops/sec ±0.45%|1,316 ops/sec ±0.48%|patched-jsdom is the fastest.|
335
335
 
336
336
 
337
337
  ## Acknowledgments
package/dist/cjs/index.js CHANGED
@@ -3,5 +3,5 @@ var f=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var T=Object.g
3
3
  * @license MIT
4
4
  * @copyright asamuzaK (Kazz)
5
5
  * @see {@link https://github.com/asamuzaK/domSelector/blob/main/LICENSE}
6
- */const E=new RegExp(`${r.COMPOUND_I}${r.COMBO}${r.COMPOUND_I}`,"i"),m=new RegExp(`${r.COMPOUND_I}${r.DESCEND}${r.COMPOUND_I}`,"i"),l=new RegExp(`^${r.TAG_ID_CLASS}$`);class ${#t;#s;#e;#r;constructor(t,e){this.#t=t,this.#s=e??t.document,this.#e=new y.Finder(t),this.#r=(0,o.initNwsapi)(t,e)}matches(t,e,i){if(e?.nodeType){if(e.nodeType!==r.ELEMENT_NODE){const s=new this.#t.TypeError(`Unexpected node ${e.nodeName}`);this.#e.onError(s,i)}}else{const s=new this.#t.TypeError(`Unexpected type ${(0,o.getType)(e)}`);this.#e.onError(s,i)}const n=e.ownerDocument;if(n===this.#s&&n.contentType==="text/html"){const s={complex:E.test(t),compound:!1,descend:!1,simple:!1,target:r.TARGET_SELF};if((0,o.filterSelector)(t,s))try{return this.#r.match(t,e)}catch{}}let h;try{this.#e.setup(t,e,i),h=this.#e.find(r.TARGET_SELF).size}catch(s){this.#e.onError(s,i)}return!!h}closest(t,e,i){if(e?.nodeType){if(e.nodeType!==r.ELEMENT_NODE){const s=new this.#t.TypeError(`Unexpected node ${e.nodeName}`);this.#e.onError(s,i)}}else{const s=new this.#t.TypeError(`Unexpected type ${(0,o.getType)(e)}`);this.#e.onError(s,i)}const n=e.ownerDocument;if(n===this.#s&&n.contentType==="text/html"){const s={complex:E.test(t),compound:!1,descend:!1,simple:!1,target:r.TARGET_LINEAL};if((0,o.filterSelector)(t,s))try{return this.#r.closest(t,e)}catch{}}let h;try{this.#e.setup(t,e,i);const s=this.#e.find(r.TARGET_LINEAL);if(s.size){let c=e;for(;c;){if(s.has(c)){h=c;break}c=c.parentNode}}}catch(s){this.#e.onError(s,i)}return h??null}querySelector(t,e,i){if(!e?.nodeType){const s=new this.#t.TypeError(`Unexpected type ${(0,o.getType)(e)}`);this.#e.onError(s,i)}let n;if(e.nodeType===r.DOCUMENT_NODE?n=e:n=e.ownerDocument,n===this.#s&&n.contentType==="text/html"){const s={complex:!1,compound:!(l.test(t)||E.test(t)),descend:m.test(t),simple:l.test(t),target:r.TARGET_FIRST};if((0,o.filterSelector)(t,s))try{return this.#r.first(t,e)}catch{}}let h;try{this.#e.setup(t,e,i);const s=this.#e.find(r.TARGET_FIRST);s.size&&([h]=s)}catch(s){this.#e.onError(s,i)}return h??null}querySelectorAll(t,e,i){if(!e?.nodeType){const s=new this.#t.TypeError(`Unexpected type ${(0,o.getType)(e)}`);this.#e.onError(s,i)}let n;if(e.nodeType===r.DOCUMENT_NODE?n=e:n=e.ownerDocument,n===this.#s&&n.contentType==="text/html"){const s={complex:!1,compound:!1,descend:m.test(t),simple:l.test(t),target:r.TARGET_ALL};if((0,o.filterSelector)(t,s))try{return this.#r.select(t,e)}catch{}}let h;try{this.#e.setup(t,e,i);const s=this.#e.find(r.TARGET_ALL);s.size&&(h=[...s])}catch(s){this.#e.onError(s,i)}return h??[]}}0&&(module.exports={DOMSelector});
6
+ */const E=new RegExp(`${r.COMPOUND_I}${r.COMBO}${r.COMPOUND_I}`,"i"),l=new RegExp(`${r.COMPOUND_I}${r.DESCEND}${r.COMPOUND_I}`,"i"),m=new RegExp(`^${r.TAG_ID_CLASS}$`);class ${#t;#s;#e;#r;constructor(t,e){this.#t=t,this.#s=e??t.document,this.#e=new y.Finder(t),this.#r=(0,o.initNwsapi)(t,e)}matches(t,e,i){if(e?.nodeType){if(e.nodeType!==r.ELEMENT_NODE){const s=new this.#t.TypeError(`Unexpected node ${e.nodeName}`);this.#e.onError(s,i)}}else{const s=new this.#t.TypeError(`Unexpected type ${(0,o.getType)(e)}`);this.#e.onError(s,i)}const n=e.ownerDocument;if(n===this.#s&&n.contentType==="text/html"){const s={complex:E.test(t),compound:!1,descend:!1,simple:!1,target:r.TARGET_SELF};if((0,o.filterSelector)(t,s))try{return this.#r.match(t,e)}catch{}}let h;try{this.#e.setup(t,e,i),h=this.#e.find(r.TARGET_SELF).size}catch(s){this.#e.onError(s,i)}return!!h}closest(t,e,i){if(e?.nodeType){if(e.nodeType!==r.ELEMENT_NODE){const s=new this.#t.TypeError(`Unexpected node ${e.nodeName}`);this.#e.onError(s,i)}}else{const s=new this.#t.TypeError(`Unexpected type ${(0,o.getType)(e)}`);this.#e.onError(s,i)}const n=e.ownerDocument;if(n===this.#s&&n.contentType==="text/html"){const s={complex:E.test(t),compound:!1,descend:!1,simple:!1,target:r.TARGET_LINEAL};if((0,o.filterSelector)(t,s))try{return this.#r.closest(t,e)}catch{}}let h;try{this.#e.setup(t,e,i);const s=this.#e.find(r.TARGET_LINEAL);if(s.size){let c=e;for(;c;){if(s.has(c)){h=c;break}c=c.parentNode}}}catch(s){this.#e.onError(s,i)}return h??null}querySelector(t,e,i){if(!e?.nodeType){const s=new this.#t.TypeError(`Unexpected type ${(0,o.getType)(e)}`);this.#e.onError(s,i)}let n;if(e.nodeType===r.DOCUMENT_NODE?n=e:n=e.ownerDocument,n===this.#s&&n.contentType==="text/html"){const s={complex:!1,compound:!(m.test(t)||E.test(t)),descend:l.test(t),simple:m.test(t),target:r.TARGET_FIRST};if((0,o.filterSelector)(t,s))try{return this.#r.first(t,e)}catch{}}let h;try{this.#e.setup(t,e,i);const s=this.#e.find(r.TARGET_FIRST);s.size&&([h]=s)}catch(s){this.#e.onError(s,i)}return h??null}querySelectorAll(t,e,i){if(!e?.nodeType){const s=new this.#t.TypeError(`Unexpected type ${(0,o.getType)(e)}`);this.#e.onError(s,i)}let n;if(e.nodeType===r.DOCUMENT_NODE?n=e:n=e.ownerDocument,n===this.#s&&n.contentType==="text/html"){const s={complex:!1,compound:!1,descend:l.test(t),simple:!1,target:r.TARGET_ALL};if((0,o.filterSelector)(t,s))try{return this.#r.select(t,e)}catch{}}let h;try{this.#e.setup(t,e,i);const s=this.#e.find(r.TARGET_ALL);s.size&&(h=[...s])}catch(s){this.#e.onError(s,i)}return h??[]}}0&&(module.exports={DOMSelector});
7
7
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.js"],
4
- "sourcesContent": ["/*!\n * DOM Selector - A CSS selector engine.\n * @license MIT\n * @copyright asamuzaK (Kazz)\n * @see {@link https://github.com/asamuzaK/domSelector/blob/main/LICENSE}\n */\n\n/* import */\nimport { Finder } from './js/finder.js';\nimport { filterSelector, getType, initNwsapi } from './js/utility.js';\n\n/* constants */\nimport {\n COMBO, COMPOUND_I, DESCEND, DOCUMENT_NODE, ELEMENT_NODE, TAG_ID_CLASS,\n TARGET_ALL, TARGET_FIRST, TARGET_LINEAL, TARGET_SELF\n} from './js/constant.js';\nconst REG_COMPLEX = new RegExp(`${COMPOUND_I}${COMBO}${COMPOUND_I}`, 'i');\nconst REG_DESCEND = new RegExp(`${COMPOUND_I}${DESCEND}${COMPOUND_I}`, 'i');\nconst REG_SIMPLE = new RegExp(`^${TAG_ID_CLASS}$`);\n\n/* DOMSelector */\nexport class DOMSelector {\n /* private fields */\n #window;\n #document;\n #finder;\n #nwsapi;\n\n /**\n * construct\n * @param {object} window - window\n * @param {object} document - document\n */\n constructor(window, document) {\n this.#window = window;\n this.#document = document ?? window.document;\n this.#finder = new Finder(window);\n this.#nwsapi = initNwsapi(window, document);\n }\n\n /**\n * matches\n * @param {string} selector - CSS selector\n * @param {object} node - Element node\n * @param {object} opt - options\n * @returns {boolean} - `true` if matched `false` otherwise\n */\n matches(selector, node, opt) {\n if (!node?.nodeType) {\n const e = new this.#window.TypeError(`Unexpected type ${getType(node)}`);\n this.#finder.onError(e, opt);\n } else if (node.nodeType !== ELEMENT_NODE) {\n const e = new this.#window.TypeError(`Unexpected node ${node.nodeName}`);\n this.#finder.onError(e, opt);\n }\n const document = node.ownerDocument;\n if (document === this.#document && document.contentType === 'text/html') {\n const filterOpt = {\n complex: REG_COMPLEX.test(selector),\n compound: false,\n descend: false,\n simple: false,\n target: TARGET_SELF\n };\n if (filterSelector(selector, filterOpt)) {\n try {\n const res = this.#nwsapi.match(selector, node);\n return res;\n } catch (e) {\n // fall through\n }\n }\n }\n let res;\n try {\n this.#finder.setup(selector, node, opt);\n const nodes = this.#finder.find(TARGET_SELF);\n res = nodes.size;\n } catch (e) {\n this.#finder.onError(e, opt);\n }\n return !!res;\n }\n\n /**\n * closest\n * @param {string} selector - CSS selector\n * @param {object} node - Element node\n * @param {object} opt - options\n * @returns {?object} - matched node\n */\n closest(selector, node, opt) {\n if (!node?.nodeType) {\n const e = new this.#window.TypeError(`Unexpected type ${getType(node)}`);\n this.#finder.onError(e, opt);\n } else if (node.nodeType !== ELEMENT_NODE) {\n const e = new this.#window.TypeError(`Unexpected node ${node.nodeName}`);\n this.#finder.onError(e, opt);\n }\n const document = node.ownerDocument;\n if (document === this.#document && document.contentType === 'text/html') {\n const filterOpt = {\n complex: REG_COMPLEX.test(selector),\n compound: false,\n descend: false,\n simple: false,\n target: TARGET_LINEAL\n };\n if (filterSelector(selector, filterOpt)) {\n try {\n const res = this.#nwsapi.closest(selector, node);\n return res;\n } catch (e) {\n // fall through\n }\n }\n }\n let res;\n try {\n this.#finder.setup(selector, node, opt);\n const nodes = this.#finder.find(TARGET_LINEAL);\n if (nodes.size) {\n let refNode = node;\n while (refNode) {\n if (nodes.has(refNode)) {\n res = refNode;\n break;\n }\n refNode = refNode.parentNode;\n }\n }\n } catch (e) {\n this.#finder.onError(e, opt);\n }\n return res ?? null;\n }\n\n /**\n * query selector\n * @param {string} selector - CSS selector\n * @param {object} node - Document, DocumentFragment, Element node\n * @param {object} opt - options\n * @returns {?object} - matched node\n */\n querySelector(selector, node, opt) {\n if (!node?.nodeType) {\n const e = new this.#window.TypeError(`Unexpected type ${getType(node)}`);\n this.#finder.onError(e, opt);\n }\n let document;\n if (node.nodeType === DOCUMENT_NODE) {\n document = node;\n } else {\n document = node.ownerDocument;\n }\n if (document === this.#document && document.contentType === 'text/html') {\n const filterOpt = {\n complex: false,\n compound: !(REG_SIMPLE.test(selector) || REG_COMPLEX.test(selector)),\n descend: REG_DESCEND.test(selector),\n simple: REG_SIMPLE.test(selector),\n target: TARGET_FIRST\n };\n if (filterSelector(selector, filterOpt)) {\n try {\n const res = this.#nwsapi.first(selector, node);\n return res;\n } catch (e) {\n // fall through\n }\n }\n }\n let res;\n try {\n this.#finder.setup(selector, node, opt);\n const nodes = this.#finder.find(TARGET_FIRST);\n if (nodes.size) {\n [res] = nodes;\n }\n } catch (e) {\n this.#finder.onError(e, opt);\n }\n return res ?? null;\n }\n\n /**\n * query selector all\n * NOTE: returns Array, not NodeList\n * @param {string} selector - CSS selector\n * @param {object} node - Document, DocumentFragment, Element node\n * @param {object} opt - options\n * @returns {Array.<object|undefined>} - collection of matched nodes\n */\n querySelectorAll(selector, node, opt) {\n if (!node?.nodeType) {\n const e = new this.#window.TypeError(`Unexpected type ${getType(node)}`);\n this.#finder.onError(e, opt);\n }\n let document;\n if (node.nodeType === DOCUMENT_NODE) {\n document = node;\n } else {\n document = node.ownerDocument;\n }\n if (document === this.#document && document.contentType === 'text/html') {\n const filterOpt = {\n complex: false,\n compound: false,\n descend: REG_DESCEND.test(selector),\n simple: REG_SIMPLE.test(selector),\n target: TARGET_ALL\n };\n if (filterSelector(selector, filterOpt)) {\n try {\n const res = this.#nwsapi.select(selector, node);\n return res;\n } catch (e) {\n // fall through\n }\n }\n }\n let res;\n try {\n this.#finder.setup(selector, node, opt);\n const nodes = this.#finder.find(TARGET_ALL);\n if (nodes.size) {\n res = [...nodes];\n }\n } catch (e) {\n this.#finder.onError(e, opt);\n }\n return res ?? [];\n }\n}\n"],
5
- "mappings": "4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,IAAA,eAAAC,EAAAH,GAQA,IAAAI,EAAuB,0BACvBC,EAAoD,2BAGpDC,EAGO,4BAfP;AAAA;AAAA;AAAA;AAAA;AAAA,GAgBA,MAAMC,EAAc,IAAI,OAAO,GAAG,YAAU,GAAG,OAAK,GAAG,YAAU,GAAI,GAAG,EAClEC,EAAc,IAAI,OAAO,GAAG,YAAU,GAAG,SAAO,GAAG,YAAU,GAAI,GAAG,EACpEC,EAAa,IAAI,OAAO,IAAI,cAAY,GAAG,EAG1C,MAAMP,CAAY,CAEvBQ,GACAC,GACAC,GACAC,GAOA,YAAYC,EAAQC,EAAU,CAC5B,KAAKL,GAAUI,EACf,KAAKH,GAAYI,GAAYD,EAAO,SACpC,KAAKF,GAAU,IAAI,SAAOE,CAAM,EAChC,KAAKD,MAAU,cAAWC,EAAQC,CAAQ,CAC5C,CASA,QAAQC,EAAUC,EAAMC,EAAK,CAC3B,GAAKD,GAAM,UAGJ,GAAIA,EAAK,WAAa,eAAc,CACzC,MAAME,EAAI,IAAI,KAAKT,GAAQ,UAAU,mBAAmBO,EAAK,QAAQ,EAAE,EACvE,KAAKL,GAAQ,QAAQO,EAAGD,CAAG,CAC7B,MANqB,CACnB,MAAMC,EAAI,IAAI,KAAKT,GAAQ,UAAU,sBAAmB,WAAQO,CAAI,CAAC,EAAE,EACvE,KAAKL,GAAQ,QAAQO,EAAGD,CAAG,CAC7B,CAIA,MAAMH,EAAWE,EAAK,cACtB,GAAIF,IAAa,KAAKJ,IAAaI,EAAS,cAAgB,YAAa,CACvE,MAAMK,EAAY,CAChB,QAASb,EAAY,KAAKS,CAAQ,EAClC,SAAU,GACV,QAAS,GACT,OAAQ,GACR,O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dF,IAAa,KAAKJ,IAAaI,EAAS,cAAgB,YAAa,CACvE,MAAMK,EAAY,CAChB,QAAS,GACT,SAAU,GACV,QAASZ,EAAY,KAAKQ,CAAQ,EAClC,OAAQP,EAAW,KAAKO,CAAQ,EAChC,OAAQ,YACV,EACA,MAAI,kBAAeA,EAAUI,CAAS,EACpC,GAAI,CAEF,OADY,KAAKP,GAAQ,OAAOG,EAAUC,CAAI,CAEhD,MAAY,CAEZ,CAEJ,CACA,IAAII,EACJ,GAAI,CACF,KAAKT,GAAQ,MAAMI,EAAUC,EAAMC,CAAG,EACtC,MAAMI,EAAQ,KAAKV,GAAQ,KAAK,YAAU,EACtCU,EAAM,OACRD,EAAM,CAAC,GAAGC,CAAK,EAEnB,OAASH,EAAG,CACV,KAAKP,GAAQ,QAAQO,EAAGD,CAAG,CAC7B,CACA,OAAOG,GAAO,CAAC,CACjB,CACF",
4
+ "sourcesContent": ["/*!\n * DOM Selector - A CSS selector engine.\n * @license MIT\n * @copyright asamuzaK (Kazz)\n * @see {@link https://github.com/asamuzaK/domSelector/blob/main/LICENSE}\n */\n\n/* import */\nimport { Finder } from './js/finder.js';\nimport { filterSelector, getType, initNwsapi } from './js/utility.js';\n\n/* constants */\nimport {\n COMBO, COMPOUND_I, DESCEND, DOCUMENT_NODE, ELEMENT_NODE, TAG_ID_CLASS,\n TARGET_ALL, TARGET_FIRST, TARGET_LINEAL, TARGET_SELF\n} from './js/constant.js';\nconst REG_COMPLEX = new RegExp(`${COMPOUND_I}${COMBO}${COMPOUND_I}`, 'i');\nconst REG_DESCEND = new RegExp(`${COMPOUND_I}${DESCEND}${COMPOUND_I}`, 'i');\nconst REG_SIMPLE = new RegExp(`^${TAG_ID_CLASS}$`);\n\n/* DOMSelector */\nexport class DOMSelector {\n /* private fields */\n #window;\n #document;\n #finder;\n #nwsapi;\n\n /**\n * construct\n * @param {object} window - window\n * @param {object} document - document\n */\n constructor(window, document) {\n this.#window = window;\n this.#document = document ?? window.document;\n this.#finder = new Finder(window);\n this.#nwsapi = initNwsapi(window, document);\n }\n\n /**\n * matches\n * @param {string} selector - CSS selector\n * @param {object} node - Element node\n * @param {object} opt - options\n * @returns {boolean} - `true` if matched `false` otherwise\n */\n matches(selector, node, opt) {\n if (!node?.nodeType) {\n const e = new this.#window.TypeError(`Unexpected type ${getType(node)}`);\n this.#finder.onError(e, opt);\n } else if (node.nodeType !== ELEMENT_NODE) {\n const e = new this.#window.TypeError(`Unexpected node ${node.nodeName}`);\n this.#finder.onError(e, opt);\n }\n const document = node.ownerDocument;\n if (document === this.#document && document.contentType === 'text/html') {\n const filterOpt = {\n complex: REG_COMPLEX.test(selector),\n compound: false,\n descend: false,\n simple: false,\n target: TARGET_SELF\n };\n if (filterSelector(selector, filterOpt)) {\n try {\n const res = this.#nwsapi.match(selector, node);\n return res;\n } catch (e) {\n // fall through\n }\n }\n }\n let res;\n try {\n this.#finder.setup(selector, node, opt);\n const nodes = this.#finder.find(TARGET_SELF);\n res = nodes.size;\n } catch (e) {\n this.#finder.onError(e, opt);\n }\n return !!res;\n }\n\n /**\n * closest\n * @param {string} selector - CSS selector\n * @param {object} node - Element node\n * @param {object} opt - options\n * @returns {?object} - matched node\n */\n closest(selector, node, opt) {\n if (!node?.nodeType) {\n const e = new this.#window.TypeError(`Unexpected type ${getType(node)}`);\n this.#finder.onError(e, opt);\n } else if (node.nodeType !== ELEMENT_NODE) {\n const e = new this.#window.TypeError(`Unexpected node ${node.nodeName}`);\n this.#finder.onError(e, opt);\n }\n const document = node.ownerDocument;\n if (document === this.#document && document.contentType === 'text/html') {\n const filterOpt = {\n complex: REG_COMPLEX.test(selector),\n compound: false,\n descend: false,\n simple: false,\n target: TARGET_LINEAL\n };\n if (filterSelector(selector, filterOpt)) {\n try {\n const res = this.#nwsapi.closest(selector, node);\n return res;\n } catch (e) {\n // fall through\n }\n }\n }\n let res;\n try {\n this.#finder.setup(selector, node, opt);\n const nodes = this.#finder.find(TARGET_LINEAL);\n if (nodes.size) {\n let refNode = node;\n while (refNode) {\n if (nodes.has(refNode)) {\n res = refNode;\n break;\n }\n refNode = refNode.parentNode;\n }\n }\n } catch (e) {\n this.#finder.onError(e, opt);\n }\n return res ?? null;\n }\n\n /**\n * query selector\n * @param {string} selector - CSS selector\n * @param {object} node - Document, DocumentFragment, Element node\n * @param {object} opt - options\n * @returns {?object} - matched node\n */\n querySelector(selector, node, opt) {\n if (!node?.nodeType) {\n const e = new this.#window.TypeError(`Unexpected type ${getType(node)}`);\n this.#finder.onError(e, opt);\n }\n let document;\n if (node.nodeType === DOCUMENT_NODE) {\n document = node;\n } else {\n document = node.ownerDocument;\n }\n if (document === this.#document && document.contentType === 'text/html') {\n const filterOpt = {\n complex: false,\n compound: !(REG_SIMPLE.test(selector) || REG_COMPLEX.test(selector)),\n descend: REG_DESCEND.test(selector),\n simple: REG_SIMPLE.test(selector),\n target: TARGET_FIRST\n };\n if (filterSelector(selector, filterOpt)) {\n try {\n const res = this.#nwsapi.first(selector, node);\n return res;\n } catch (e) {\n // fall through\n }\n }\n }\n let res;\n try {\n this.#finder.setup(selector, node, opt);\n const nodes = this.#finder.find(TARGET_FIRST);\n if (nodes.size) {\n [res] = nodes;\n }\n } catch (e) {\n this.#finder.onError(e, opt);\n }\n return res ?? null;\n }\n\n /**\n * query selector all\n * NOTE: returns Array, not NodeList\n * @param {string} selector - CSS selector\n * @param {object} node - Document, DocumentFragment, Element node\n * @param {object} opt - options\n * @returns {Array.<object|undefined>} - collection of matched nodes\n */\n querySelectorAll(selector, node, opt) {\n if (!node?.nodeType) {\n const e = new this.#window.TypeError(`Unexpected type ${getType(node)}`);\n this.#finder.onError(e, opt);\n }\n let document;\n if (node.nodeType === DOCUMENT_NODE) {\n document = node;\n } else {\n document = node.ownerDocument;\n }\n if (document === this.#document && document.contentType === 'text/html') {\n const filterOpt = {\n complex: false,\n compound: false,\n descend: REG_DESCEND.test(selector),\n simple: false,\n target: TARGET_ALL\n };\n if (filterSelector(selector, filterOpt)) {\n try {\n const res = this.#nwsapi.select(selector, node);\n return res;\n } catch (e) {\n // fall through\n }\n }\n }\n let res;\n try {\n this.#finder.setup(selector, node, opt);\n const nodes = this.#finder.find(TARGET_ALL);\n if (nodes.size) {\n res = [...nodes];\n }\n } catch (e) {\n this.#finder.onError(e, opt);\n }\n return res ?? [];\n }\n}\n"],
5
+ "mappings": "4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,IAAA,eAAAC,EAAAH,GAQA,IAAAI,EAAuB,0BACvBC,EAAoD,2BAGpDC,EAGO,4BAfP;AAAA;AAAA;AAAA;AAAA;AAAA,GAgBA,MAAMC,EAAc,IAAI,OAAO,GAAG,YAAU,GAAG,OAAK,GAAG,YAAU,GAAI,GAAG,EAClEC,EAAc,IAAI,OAAO,GAAG,YAAU,GAAG,SAAO,GAAG,YAAU,GAAI,GAAG,EACpEC,EAAa,IAAI,OAAO,IAAI,cAAY,GAAG,EAG1C,MAAMP,CAAY,CAEvBQ,GACAC,GACAC,GACAC,GAOA,YAAYC,EAAQC,EAAU,CAC5B,KAAKL,GAAUI,EACf,KAAKH,GAAYI,GAAYD,EAAO,SACpC,KAAKF,GAAU,IAAI,SAAOE,CAAM,EAChC,KAAKD,MAAU,cAAWC,EAAQC,CAAQ,CAC5C,CASA,QAAQC,EAAUC,EAAMC,EAAK,CAC3B,GAAKD,GAAM,UAGJ,GAAIA,EAAK,WAAa,eAAc,CACzC,MAAME,EAAI,IAAI,KAAKT,GAAQ,UAAU,mBAAmBO,EAAK,QAAQ,EAAE,EACvE,KAAKL,GAAQ,QAAQO,EAAGD,CAAG,CAC7B,MANqB,CACnB,MAAMC,EAAI,IAAI,KAAKT,GAAQ,UAAU,sBAAmB,WAAQO,CAAI,CAAC,EAAE,EACvE,KAAKL,GAAQ,QAAQO,EAAGD,CAAG,CAC7B,CAIA,MAAMH,EAAWE,EAAK,cACtB,GAAIF,IAAa,KAAKJ,IAAaI,EAAS,cAAgB,YAAa,CACvE,MAAMK,EAAY,CAChB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IH,EAMJ,GALIE,EAAK,WAAa,gBACpBF,EAAWE,EAEXF,EAAWE,EAAK,cAEdF,IAAa,KAAKJ,IAAaI,EAAS,cAAgB,YAAa,CACvE,MAAMK,EAAY,CAChB,QAAS,GACT,SAAU,GACV,QAASZ,EAAY,KAAKQ,CAAQ,EAClC,OAAQ,GACR,OAAQ,YACV,EACA,MAAI,kBAAeA,EAAUI,CAAS,EACpC,GAAI,CAEF,OADY,KAAKP,GAAQ,OAAOG,EAAUC,CAAI,CAEhD,MAAY,CAEZ,CAEJ,CACA,IAAII,EACJ,GAAI,CACF,KAAKT,GAAQ,MAAMI,EAAUC,EAAMC,CAAG,EACtC,MAAMI,EAAQ,KAAKV,GAAQ,KAAK,YAAU,EACtCU,EAAM,OACRD,EAAM,CAAC,GAAGC,CAAK,EAEnB,OAASH,EAAG,CACV,KAAKP,GAAQ,QAAQO,EAAGD,CAAG,CAC7B,CACA,OAAOG,GAAO,CAAC,CACjB,CACF",
6
6
  "names": ["src_exports", "__export", "DOMSelector", "__toCommonJS", "import_finder", "import_utility", "import_constant", "REG_COMPLEX", "REG_DESCEND", "REG_SIMPLE", "#window", "#document", "#finder", "#nwsapi", "window", "document", "selector", "node", "opt", "e", "filterOpt", "res", "nodes", "refNode"]
7
7
  }
@@ -1,2 +1,2 @@
1
- var p=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var F=(o,t)=>{for(var n in t)p(o,n,{get:t[n],enumerable:!0})},M=(o,t,n,L)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of a(t))!i.call(o,r)&&r!==n&&p(o,r,{get:()=>t[r],enumerable:!(L=R(t,r))||L.enumerable});return o};var U=o=>M(p({},"__esModule",{value:!0}),o);var Yt={};F(Yt,{ALPHA_NUM:()=>I,ANB:()=>C,ATTR_SELECTOR:()=>b,BIT_01:()=>g,BIT_02:()=>Z,BIT_04:()=>v,BIT_08:()=>q,BIT_16:()=>J,BIT_32:()=>Q,BIT_FFFF:()=>V,CHILD_IDX:()=>A,CLASS_SELECTOR:()=>d,COMBINATOR:()=>G,COMBO:()=>T,COMPLEX:()=>_,COMPLEX_L:()=>S,COMPOUND:()=>c,COMPOUND_A:()=>O,COMPOUND_B:()=>N,COMPOUND_I:()=>$t,DESCEND:()=>Pt,DIGIT:()=>x,DOCUMENT_FRAGMENT_NODE:()=>pt,DOCUMENT_NODE:()=>xt,DOCUMENT_POSITION_CONTAINED_BY:()=>_t,DOCUMENT_POSITION_CONTAINS:()=>Tt,DOCUMENT_POSITION_PRECEDING:()=>Et,DUO:()=>tt,ELEMENT_NODE:()=>ct,HEX:()=>ot,HYPHEN:()=>et,IDENT:()=>Y,ID_SELECTOR:()=>f,KEY_FORM_FOCUS:()=>it,KEY_INPUT_BUTTON:()=>Ft,KEY_INPUT_DATE:()=>P,KEY_INPUT_EDIT:()=>Mt,KEY_INPUT_LTR:()=>Ut,KEY_INPUT_TEXT:()=>$,KEY_LOGICAL:()=>bt,KEY_MODIFIER:()=>dt,KEY_SHADOW_HOST:()=>Gt,LANG_PART:()=>At,LOGICAL_COMPLEX:()=>Rt,LOGICAL_COMPOUND:()=>at,NESTED_LOGICAL_A:()=>l,NESTED_LOGICAL_B:()=>D,NOT_SUPPORTED_ERR:()=>m,NTH:()=>B,N_TH:()=>lt,OPERATOR:()=>h,PSEUDO_CLASS:()=>Ct,PS_CLASS_SELECTOR:()=>H,PS_ELEMENT_SELECTOR:()=>u,SELECTOR:()=>y,SHOW_ALL:()=>Ot,SHOW_DOCUMENT:()=>Nt,SHOW_DOCUMENT_FRAGMENT:()=>St,SHOW_ELEMENT:()=>Lt,STRING:()=>z,SUB_TYPE:()=>s,SYNTAX_ERR:()=>K,TAG_ID_CLASS:()=>Dt,TAG_TYPE:()=>e,TAG_TYPE_I:()=>E,TARGET_ALL:()=>j,TARGET_FIRST:()=>k,TARGET_LINEAL:()=>w,TARGET_SELF:()=>X,TEXT_NODE:()=>nt,TYPE_FROM:()=>rt,TYPE_SELECTOR:()=>W,TYPE_TO:()=>st,WALKER_FILTER:()=>It});module.exports=U(Yt);const b="AttributeSelector",d="ClassSelector",G="Combinator",Y="Identifier",f="IdSelector",m="NotSupportedError",B="Nth",h="Operator",H="PseudoClassSelector",u="PseudoElementSelector",y="Selector",z="String",K="SyntaxError",j="all",k="first",w="lineal",X="self",W="TypeSelector",g=1,Z=2,v=4,q=8,J=16,Q=32,V=65535,tt=2,ot=16,et=45,rt=8,st=-1,ct=1,nt=3,xt=9,pt=11,Et=2,Tt=8,_t=16,Ot=4294967295,Nt=256,St=1024,Lt=1,It=1281,I="[A-Z\\d]+",A="(?:first|last|only)-(?:child|of-type)",x="(?:0|[1-9]\\d*)",At=`(?:-${I})*`,Ct=`(?:any-)?link|${A}|checked|empty|indeterminate|read-(?:only|write)|root|target`,C=`[+-]?(?:${x}n?|n)|(?:[+-]?${x})?n\\s*[+-]\\s*${x}`,lt=`nth-(?:last-)?(?:child|of-type)\\(\\s*(?:even|odd|${C})\\s*\\)`,s="\\[[^|\\]]+\\]|[#.:][\\w-]+",Dt="(?:[A-Za-z][\\w-]*|[#.][\\w-]+)",e="\\*|[A-Za-z][\\w-]*",E="\\*|[A-Z][\\w-]*",c=`(?:${e}|(?:${e})?(?:${s})+)`,T="\\s?[\\s>~+]\\s?",_=`${c}(?:${T}${c})*`,Pt="\\s?[\\s>]\\s?",l=`:is\\(\\s*${c}(?:\\s*,\\s*${c})*\\s*\\)`,D=`:is\\(\\s*${_}(?:\\s*,\\s*${_})*\\s*\\)`,O=`(?:${e}|(?:${e})?(?:${s}|${l})+)`,N=`(?:${e}|(?:${e})?(?:${s}|${D})+)`,$t=`(?:${E}|(?:${E})?(?:${s})+)`,S=`${N}(?:${T}${N})*`,Rt=`(?:is|not)\\(\\s*${S}(?:\\s*,\\s*${S})*\\s*\\)`,at=`(?:is|not)\\(\\s*${O}(?:\\s*,\\s*${O})*\\s*\\)`,it=Object.freeze(["button","input","select","textarea"]),Ft=Object.freeze(["button","reset","submit"]),P=Object.freeze(["date","datetime-local","month","time","week"]),$=Object.freeze(["email","password","search","tel","text","url"]),Mt=Object.freeze([...P,...$,"number"]),Ut=Object.freeze(["checkbox","color","date","image","number","range","radio","time"]),bt=Object.freeze(["has","is","not","where"]),dt=Object.freeze(["Alt","AltGraph","CapsLock","Control","Fn","FnLock","Hyper","Meta","NumLock","ScrollLock","Shift","Super","Symbol","SymbolLock"]),Gt=Object.freeze(["host","host-context"]);0&&(module.exports={ALPHA_NUM,ANB,ATTR_SELECTOR,BIT_01,BIT_02,BIT_04,BIT_08,BIT_16,BIT_32,BIT_FFFF,CHILD_IDX,CLASS_SELECTOR,COMBINATOR,COMBO,COMPLEX,COMPLEX_L,COMPOUND,COMPOUND_A,COMPOUND_B,COMPOUND_I,DESCEND,DIGIT,DOCUMENT_FRAGMENT_NODE,DOCUMENT_NODE,DOCUMENT_POSITION_CONTAINED_BY,DOCUMENT_POSITION_CONTAINS,DOCUMENT_POSITION_PRECEDING,DUO,ELEMENT_NODE,HEX,HYPHEN,IDENT,ID_SELECTOR,KEY_FORM_FOCUS,KEY_INPUT_BUTTON,KEY_INPUT_DATE,KEY_INPUT_EDIT,KEY_INPUT_LTR,KEY_INPUT_TEXT,KEY_LOGICAL,KEY_MODIFIER,KEY_SHADOW_HOST,LANG_PART,LOGICAL_COMPLEX,LOGICAL_COMPOUND,NESTED_LOGICAL_A,NESTED_LOGICAL_B,NOT_SUPPORTED_ERR,NTH,N_TH,OPERATOR,PSEUDO_CLASS,PS_CLASS_SELECTOR,PS_ELEMENT_SELECTOR,SELECTOR,SHOW_ALL,SHOW_DOCUMENT,SHOW_DOCUMENT_FRAGMENT,SHOW_ELEMENT,STRING,SUB_TYPE,SYNTAX_ERR,TAG_ID_CLASS,TAG_TYPE,TAG_TYPE_I,TARGET_ALL,TARGET_FIRST,TARGET_LINEAL,TARGET_SELF,TEXT_NODE,TYPE_FROM,TYPE_SELECTOR,TYPE_TO,WALKER_FILTER});
1
+ var x=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var d=(o,t)=>{for(var c in t)x(o,c,{get:t[c],enumerable:!0})},F=(o,t,c,L)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of $(t))!R.call(o,r)&&r!==c&&x(o,r,{get:()=>t[r],enumerable:!(L=P(t,r))||L.enumerable});return o};var M=o=>F(x({},"__esModule",{value:!0}),o);var ft={};d(ft,{ALPHA_NUM:()=>A,ANB:()=>l,ATTR_SELECTOR:()=>U,BIT_01:()=>W,BIT_02:()=>Z,BIT_04:()=>v,BIT_08:()=>q,BIT_16:()=>J,BIT_32:()=>Q,BIT_FFFF:()=>V,CHILD_IDX:()=>I,CLASS_SELECTOR:()=>b,COMBINATOR:()=>G,COMBO:()=>T,COMPLEX:()=>_,COMPLEX_L:()=>N,COMPOUND:()=>n,COMPOUND_A:()=>O,COMPOUND_B:()=>S,COMPOUND_I:()=>Dt,DESCEND:()=>it,DIGIT:()=>p,DOCUMENT_FRAGMENT_NODE:()=>xt,DOCUMENT_NODE:()=>pt,DOCUMENT_POSITION_CONTAINED_BY:()=>_t,DOCUMENT_POSITION_CONTAINS:()=>Tt,DOCUMENT_POSITION_PRECEDING:()=>Et,DUO:()=>tt,ELEMENT_NODE:()=>nt,HEX:()=>ot,HYPHEN:()=>et,IDENT:()=>Y,ID_SELECTOR:()=>f,KEY_FORM_FOCUS:()=>Rt,KEY_INPUT_BUTTON:()=>dt,KEY_INPUT_DATE:()=>i,KEY_INPUT_EDIT:()=>Ft,KEY_INPUT_LTR:()=>Mt,KEY_INPUT_TEXT:()=>D,KEY_LOGICAL:()=>Ut,KEY_MODIFIER:()=>bt,KEY_PS_STATE:()=>Gt,KEY_SHADOW_HOST:()=>Yt,LANG_PART:()=>It,LOGICAL_COMPLEX:()=>Pt,LOGICAL_COMPOUND:()=>$t,NESTED_LOGICAL_A:()=>C,NESTED_LOGICAL_B:()=>a,NOT_SUPPORTED_ERR:()=>h,NTH:()=>m,N_TH:()=>Ct,OPERATOR:()=>B,PSEUDO_CLASS:()=>lt,PS_CLASS_SELECTOR:()=>u,PS_ELEMENT_SELECTOR:()=>H,SELECTOR:()=>y,SHOW_ALL:()=>Ot,SHOW_DOCUMENT:()=>St,SHOW_DOCUMENT_FRAGMENT:()=>Nt,SHOW_ELEMENT:()=>Lt,STRING:()=>z,SUB_TYPE:()=>s,SYNTAX_ERR:()=>w,TAG_ID_CLASS:()=>at,TAG_TYPE:()=>e,TAG_TYPE_I:()=>E,TARGET_ALL:()=>K,TARGET_FIRST:()=>j,TARGET_LINEAL:()=>k,TARGET_SELF:()=>X,TEXT_NODE:()=>ct,TYPE_FROM:()=>rt,TYPE_SELECTOR:()=>g,TYPE_TO:()=>st,WALKER_FILTER:()=>At});module.exports=M(ft);const U="AttributeSelector",b="ClassSelector",G="Combinator",Y="Identifier",f="IdSelector",h="NotSupportedError",m="Nth",B="Operator",u="PseudoClassSelector",H="PseudoElementSelector",y="Selector",z="String",w="SyntaxError",K="all",j="first",k="lineal",X="self",g="TypeSelector",W=1,Z=2,v=4,q=8,J=16,Q=32,V=65535,tt=2,ot=16,et=45,rt=8,st=-1,nt=1,ct=3,pt=9,xt=11,Et=2,Tt=8,_t=16,Ot=4294967295,St=256,Nt=1024,Lt=1,At=1281,A="[A-Z\\d]+",I="(?:first|last|only)-(?:child|of-type)",p="(?:0|[1-9]\\d*)",It=`(?:-${A})*`,lt=`(?:any-)?link|${I}|checked|empty|indeterminate|read-(?:only|write)|root|target`,l=`[+-]?(?:${p}n?|n)|(?:[+-]?${p})?n\\s*[+-]\\s*${p}`,Ct=`nth-(?:last-)?(?:child|of-type)\\(\\s*(?:even|odd|${l})\\s*\\)`,s="\\[[^|\\]]+\\]|[#.:][\\w-]+",at="(?:[A-Za-z][\\w-]*|[#.][\\w-]+)",e="\\*|[A-Za-z][\\w-]*",E="\\*|[A-Z][\\w-]*",n=`(?:${e}|(?:${e})?(?:${s})+)`,T="\\s?[\\s>~+]\\s?",_=`${n}(?:${T}${n})*`,it="\\s?[\\s>]\\s?",C=`:is\\(\\s*${n}(?:\\s*,\\s*${n})*\\s*\\)`,a=`:is\\(\\s*${_}(?:\\s*,\\s*${_})*\\s*\\)`,O=`(?:${e}|(?:${e})?(?:${s}|${C})+)`,S=`(?:${e}|(?:${e})?(?:${s}|${a})+)`,Dt=`(?:${E}|(?:${E})?(?:${s})+)`,N=`${S}(?:${T}${S})*`,Pt=`(?:is|not)\\(\\s*${N}(?:\\s*,\\s*${N})*\\s*\\)`,$t=`(?:is|not)\\(\\s*${O}(?:\\s*,\\s*${O})*\\s*\\)`,Rt=Object.freeze(["button","input","select","textarea"]),dt=Object.freeze(["button","reset","submit"]),i=Object.freeze(["date","datetime-local","month","time","week"]),D=Object.freeze(["email","password","search","tel","text","url"]),Ft=Object.freeze([...i,...D,"number"]),Mt=Object.freeze(["checkbox","color","date","image","number","range","radio","time"]),Ut=Object.freeze(["has","is","not","where"]),bt=Object.freeze(["Alt","AltGraph","CapsLock","Control","Fn","FnLock","Hyper","Meta","NumLock","ScrollLock","Shift","Super","Symbol","SymbolLock"]),Gt=Object.freeze(["enabled","disabled","valid","invalid","in-range","out-of-range","checked","indeterminate","read-only","read-write","open","closed","placeholder-shown"]),Yt=Object.freeze(["host","host-context"]);0&&(module.exports={ALPHA_NUM,ANB,ATTR_SELECTOR,BIT_01,BIT_02,BIT_04,BIT_08,BIT_16,BIT_32,BIT_FFFF,CHILD_IDX,CLASS_SELECTOR,COMBINATOR,COMBO,COMPLEX,COMPLEX_L,COMPOUND,COMPOUND_A,COMPOUND_B,COMPOUND_I,DESCEND,DIGIT,DOCUMENT_FRAGMENT_NODE,DOCUMENT_NODE,DOCUMENT_POSITION_CONTAINED_BY,DOCUMENT_POSITION_CONTAINS,DOCUMENT_POSITION_PRECEDING,DUO,ELEMENT_NODE,HEX,HYPHEN,IDENT,ID_SELECTOR,KEY_FORM_FOCUS,KEY_INPUT_BUTTON,KEY_INPUT_DATE,KEY_INPUT_EDIT,KEY_INPUT_LTR,KEY_INPUT_TEXT,KEY_LOGICAL,KEY_MODIFIER,KEY_PS_STATE,KEY_SHADOW_HOST,LANG_PART,LOGICAL_COMPLEX,LOGICAL_COMPOUND,NESTED_LOGICAL_A,NESTED_LOGICAL_B,NOT_SUPPORTED_ERR,NTH,N_TH,OPERATOR,PSEUDO_CLASS,PS_CLASS_SELECTOR,PS_ELEMENT_SELECTOR,SELECTOR,SHOW_ALL,SHOW_DOCUMENT,SHOW_DOCUMENT_FRAGMENT,SHOW_ELEMENT,STRING,SUB_TYPE,SYNTAX_ERR,TAG_ID_CLASS,TAG_TYPE,TAG_TYPE_I,TARGET_ALL,TARGET_FIRST,TARGET_LINEAL,TARGET_SELF,TEXT_NODE,TYPE_FROM,TYPE_SELECTOR,TYPE_TO,WALKER_FILTER});
2
2
  //# sourceMappingURL=constant.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/js/constant.js"],
4
- "sourcesContent": ["/**\n * constant.js\n */\n\n/* string */\nexport const ATTR_SELECTOR = 'AttributeSelector';\nexport const CLASS_SELECTOR = 'ClassSelector';\nexport const COMBINATOR = 'Combinator';\nexport const IDENT = 'Identifier';\nexport const ID_SELECTOR = 'IdSelector';\nexport const NOT_SUPPORTED_ERR = 'NotSupportedError';\nexport const NTH = 'Nth';\nexport const OPERATOR = 'Operator';\nexport const PS_CLASS_SELECTOR = 'PseudoClassSelector';\nexport const PS_ELEMENT_SELECTOR = 'PseudoElementSelector';\nexport const SELECTOR = 'Selector';\nexport const STRING = 'String';\nexport const SYNTAX_ERR = 'SyntaxError';\nexport const TARGET_ALL = 'all';\nexport const TARGET_FIRST = 'first';\nexport const TARGET_LINEAL = 'lineal';\nexport const TARGET_SELF = 'self';\nexport const TYPE_SELECTOR = 'TypeSelector';\n\n/* numeric */\nexport const BIT_01 = 1;\nexport const BIT_02 = 2;\nexport const BIT_04 = 4;\nexport const BIT_08 = 8;\nexport const BIT_16 = 0x10;\nexport const BIT_32 = 0x20;\nexport const BIT_FFFF = 0xFFFF;\nexport const DUO = 2;\nexport const HEX = 16;\nexport const HYPHEN = 0x2D;\nexport const TYPE_FROM = 8;\nexport const TYPE_TO = -1;\n\n/* Node */\nexport const ELEMENT_NODE = 1;\nexport const TEXT_NODE = 3;\nexport const DOCUMENT_NODE = 9;\nexport const DOCUMENT_FRAGMENT_NODE = 11;\nexport const DOCUMENT_POSITION_PRECEDING = 2;\nexport const DOCUMENT_POSITION_CONTAINS = 8;\nexport const DOCUMENT_POSITION_CONTAINED_BY = 0x10;\n\n/* NodeFilter */\nexport const SHOW_ALL = 0xFFFFFFFF;\nexport const SHOW_DOCUMENT = 0x100;\nexport const SHOW_DOCUMENT_FRAGMENT = 0x400;\nexport const SHOW_ELEMENT = 1;\nexport const WALKER_FILTER = 0x501;\n\n/* selectors */\nexport const ALPHA_NUM = '[A-Z\\\\d]+';\nexport const CHILD_IDX = '(?:first|last|only)-(?:child|of-type)';\nexport const DIGIT = '(?:0|[1-9]\\\\d*)';\nexport const LANG_PART = `(?:-${ALPHA_NUM})*`;\nexport const PSEUDO_CLASS = `(?:any-)?link|${CHILD_IDX}|checked|empty|indeterminate|read-(?:only|write)|root|target`;\nexport const ANB =\n `[+-]?(?:${DIGIT}n?|n)|(?:[+-]?${DIGIT})?n\\\\s*[+-]\\\\s*${DIGIT}`;\n// N_TH: excludes An+B with selector list, e.g. :nth-child(2n+1 of .foo)\nexport const N_TH =\n `nth-(?:last-)?(?:child|of-type)\\\\(\\\\s*(?:even|odd|${ANB})\\\\s*\\\\)`;\n// SUB_TYPE: attr, id, class, pseudo-class, note that [foo|=bar] is excluded\nexport const SUB_TYPE = '\\\\[[^|\\\\]]+\\\\]|[#.:][\\\\w-]+';\n// TAG_TYPE: *, tag\nexport const TAG_ID_CLASS = '(?:[A-Za-z][\\\\w-]*|[#.][\\\\w-]+)';\nexport const TAG_TYPE = '\\\\*|[A-Za-z][\\\\w-]*';\nexport const TAG_TYPE_I = '\\\\*|[A-Z][\\\\w-]*';\nexport const COMPOUND = `(?:${TAG_TYPE}|(?:${TAG_TYPE})?(?:${SUB_TYPE})+)`;\nexport const COMBO = '\\\\s?[\\\\s>~+]\\\\s?';\nexport const COMPLEX = `${COMPOUND}(?:${COMBO}${COMPOUND})*`;\nexport const DESCEND = '\\\\s?[\\\\s>]\\\\s?';\nexport const NESTED_LOGICAL_A =\n `:is\\\\(\\\\s*${COMPOUND}(?:\\\\s*,\\\\s*${COMPOUND})*\\\\s*\\\\)`;\nexport const NESTED_LOGICAL_B =\n `:is\\\\(\\\\s*${COMPLEX}(?:\\\\s*,\\\\s*${COMPLEX})*\\\\s*\\\\)`;\nexport const COMPOUND_A =\n `(?:${TAG_TYPE}|(?:${TAG_TYPE})?(?:${SUB_TYPE}|${NESTED_LOGICAL_A})+)`;\nexport const COMPOUND_B =\n `(?:${TAG_TYPE}|(?:${TAG_TYPE})?(?:${SUB_TYPE}|${NESTED_LOGICAL_B})+)`;\nexport const COMPOUND_I =\n `(?:${TAG_TYPE_I}|(?:${TAG_TYPE_I})?(?:${SUB_TYPE})+)`;\nexport const COMPLEX_L = `${COMPOUND_B}(?:${COMBO}${COMPOUND_B})*`;\nexport const LOGICAL_COMPLEX =\n `(?:is|not)\\\\(\\\\s*${COMPLEX_L}(?:\\\\s*,\\\\s*${COMPLEX_L})*\\\\s*\\\\)`;\nexport const LOGICAL_COMPOUND =\n `(?:is|not)\\\\(\\\\s*${COMPOUND_A}(?:\\\\s*,\\\\s*${COMPOUND_A})*\\\\s*\\\\)`;\n\n/* array */\nexport const KEY_FORM_FOCUS =\n Object.freeze(['button', 'input', 'select', 'textarea']);\nexport const KEY_INPUT_BUTTON = Object.freeze(['button', 'reset', 'submit']);\nexport const KEY_INPUT_DATE =\n Object.freeze(['date', 'datetime-local', 'month', 'time', 'week']);\nexport const KEY_INPUT_TEXT =\n Object.freeze(['email', 'password', 'search', 'tel', 'text', 'url']);\nexport const KEY_INPUT_EDIT =\n Object.freeze([...KEY_INPUT_DATE, ...KEY_INPUT_TEXT, 'number']);\nexport const KEY_INPUT_LTR = Object.freeze([\n 'checkbox', 'color', 'date', 'image', 'number', 'range', 'radio', 'time'\n]);\nexport const KEY_LOGICAL = Object.freeze(['has', 'is', 'not', 'where']);\nexport const KEY_MODIFIER = Object.freeze([\n 'Alt', 'AltGraph', 'CapsLock', 'Control', 'Fn', 'FnLock', 'Hyper', 'Meta',\n 'NumLock', 'ScrollLock', 'Shift', 'Super', 'Symbol', 'SymbolLock'\n]);\nexport const KEY_SHADOW_HOST = Object.freeze(['host', 'host-context']);\n"],
5
- "mappings": "4ZAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,eAAAE,EAAA,QAAAC,EAAA,kBAAAC,EAAA,WAAAC,EAAA,WAAAC,EAAA,WAAAC,EAAA,WAAAC,EAAA,WAAAC,EAAA,WAAAC,EAAA,aAAAC,EAAA,cAAAC,EAAA,mBAAAC,EAAA,eAAAC,EAAA,UAAAC,EAAA,YAAAC,EAAA,cAAAC,EAAA,aAAAC,EAAA,eAAAC,EAAA,eAAAC,EAAA,eAAAC,GAAA,YAAAC,GAAA,UAAAC,EAAA,2BAAAC,GAAA,kBAAAC,GAAA,mCAAAC,GAAA,+BAAAC,GAAA,gCAAAC,GAAA,QAAAC,GAAA,iBAAAC,GAAA,QAAAC,GAAA,WAAAC,GAAA,UAAAC,EAAA,gBAAAC,EAAA,mBAAAC,GAAA,qBAAAC,GAAA,mBAAAC,EAAA,mBAAAC,GAAA,kBAAAC,GAAA,mBAAAC,EAAA,gBAAAC,GAAA,iBAAAC,GAAA,oBAAAC,GAAA,cAAAC,GAAA,oBAAAC,GAAA,qBAAAC,GAAA,qBAAAC,EAAA,qBAAAC,EAAA,sBAAAC,EAAA,QAAAC,EAAA,SAAAC,GAAA,aAAAC,EAAA,iBAAAC,GAAA,sBAAAC,EAAA,wBAAAC,EAAA,aAAAC,EAAA,aAAAC,GAAA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BINATOR", "COMBO", "COMPLEX", "COMPLEX_L", "COMPOUND", "COMPOUND_A", "COMPOUND_B", "COMPOUND_I", "DESCEND", "DIGIT", "DOCUMENT_FRAGMENT_NODE", "DOCUMENT_NODE", "DOCUMENT_POSITION_CONTAINED_BY", "DOCUMENT_POSITION_CONTAINS", "DOCUMENT_POSITION_PRECEDING", "DUO", "ELEMENT_NODE", "HEX", "HYPHEN", "IDENT", "ID_SELECTOR", "KEY_FORM_FOCUS", "KEY_INPUT_BUTTON", "KEY_INPUT_DATE", "KEY_INPUT_EDIT", "KEY_INPUT_LTR", "KEY_INPUT_TEXT", "KEY_LOGICAL", "KEY_MODIFIER", "KEY_SHADOW_HOST", "LANG_PART", "LOGICAL_COMPLEX", "LOGICAL_COMPOUND", "NESTED_LOGICAL_A", "NESTED_LOGICAL_B", "NOT_SUPPORTED_ERR", "NTH", "N_TH", "OPERATOR", "PSEUDO_CLASS", "PS_CLASS_SELECTOR", "PS_ELEMENT_SELECTOR", "SELECTOR", "SHOW_ALL", "SHOW_DOCUMENT", "SHOW_DOCUMENT_FRAGMENT", "SHOW_ELEMENT", "STRING", "SUB_TYPE", "SYNTAX_ERR", "TAG_ID_CLASS", "TAG_TYPE", "TAG_TYPE_I", "TARGET_ALL", "TARGET_FIRST", "TARGET_LINEAL", "TARGET_SELF", "TEXT_NODE", "TYPE_FROM", "TYPE_SELECTOR", "TYPE_TO", "WALKER_FILTER", "__toCommonJS"]
4
+ "sourcesContent": ["/**\n * constant.js\n */\n\n/* string */\nexport const ATTR_SELECTOR = 'AttributeSelector';\nexport const CLASS_SELECTOR = 'ClassSelector';\nexport const COMBINATOR = 'Combinator';\nexport const IDENT = 'Identifier';\nexport const ID_SELECTOR = 'IdSelector';\nexport const NOT_SUPPORTED_ERR = 'NotSupportedError';\nexport const NTH = 'Nth';\nexport const OPERATOR = 'Operator';\nexport const PS_CLASS_SELECTOR = 'PseudoClassSelector';\nexport const PS_ELEMENT_SELECTOR = 'PseudoElementSelector';\nexport const SELECTOR = 'Selector';\nexport const STRING = 'String';\nexport const SYNTAX_ERR = 'SyntaxError';\nexport const TARGET_ALL = 'all';\nexport const TARGET_FIRST = 'first';\nexport const TARGET_LINEAL = 'lineal';\nexport const TARGET_SELF = 'self';\nexport const TYPE_SELECTOR = 'TypeSelector';\n\n/* numeric */\nexport const BIT_01 = 1;\nexport const BIT_02 = 2;\nexport const BIT_04 = 4;\nexport const BIT_08 = 8;\nexport const BIT_16 = 0x10;\nexport const BIT_32 = 0x20;\nexport const BIT_FFFF = 0xFFFF;\nexport const DUO = 2;\nexport const HEX = 16;\nexport const HYPHEN = 0x2D;\nexport const TYPE_FROM = 8;\nexport const TYPE_TO = -1;\n\n/* Node */\nexport const ELEMENT_NODE = 1;\nexport const TEXT_NODE = 3;\nexport const DOCUMENT_NODE = 9;\nexport const DOCUMENT_FRAGMENT_NODE = 11;\nexport const DOCUMENT_POSITION_PRECEDING = 2;\nexport const DOCUMENT_POSITION_CONTAINS = 8;\nexport const DOCUMENT_POSITION_CONTAINED_BY = 0x10;\n\n/* NodeFilter */\nexport const SHOW_ALL = 0xFFFFFFFF;\nexport const SHOW_DOCUMENT = 0x100;\nexport const SHOW_DOCUMENT_FRAGMENT = 0x400;\nexport const SHOW_ELEMENT = 1;\nexport const WALKER_FILTER = 0x501;\n\n/* selectors */\nexport const ALPHA_NUM = '[A-Z\\\\d]+';\nexport const CHILD_IDX = '(?:first|last|only)-(?:child|of-type)';\nexport const DIGIT = '(?:0|[1-9]\\\\d*)';\nexport const LANG_PART = `(?:-${ALPHA_NUM})*`;\nexport const PSEUDO_CLASS = `(?:any-)?link|${CHILD_IDX}|checked|empty|indeterminate|read-(?:only|write)|root|target`;\nexport const ANB =\n `[+-]?(?:${DIGIT}n?|n)|(?:[+-]?${DIGIT})?n\\\\s*[+-]\\\\s*${DIGIT}`;\n// N_TH: excludes An+B with selector list, e.g. :nth-child(2n+1 of .foo)\nexport const N_TH =\n `nth-(?:last-)?(?:child|of-type)\\\\(\\\\s*(?:even|odd|${ANB})\\\\s*\\\\)`;\n// SUB_TYPE: attr, id, class, pseudo-class, note that [foo|=bar] is excluded\nexport const SUB_TYPE = '\\\\[[^|\\\\]]+\\\\]|[#.:][\\\\w-]+';\n// TAG_TYPE: *, tag\nexport const TAG_ID_CLASS = '(?:[A-Za-z][\\\\w-]*|[#.][\\\\w-]+)';\nexport const TAG_TYPE = '\\\\*|[A-Za-z][\\\\w-]*';\nexport const TAG_TYPE_I = '\\\\*|[A-Z][\\\\w-]*';\nexport const COMPOUND = `(?:${TAG_TYPE}|(?:${TAG_TYPE})?(?:${SUB_TYPE})+)`;\nexport const COMBO = '\\\\s?[\\\\s>~+]\\\\s?';\nexport const COMPLEX = `${COMPOUND}(?:${COMBO}${COMPOUND})*`;\nexport const DESCEND = '\\\\s?[\\\\s>]\\\\s?';\nexport const NESTED_LOGICAL_A =\n `:is\\\\(\\\\s*${COMPOUND}(?:\\\\s*,\\\\s*${COMPOUND})*\\\\s*\\\\)`;\nexport const NESTED_LOGICAL_B =\n `:is\\\\(\\\\s*${COMPLEX}(?:\\\\s*,\\\\s*${COMPLEX})*\\\\s*\\\\)`;\nexport const COMPOUND_A =\n `(?:${TAG_TYPE}|(?:${TAG_TYPE})?(?:${SUB_TYPE}|${NESTED_LOGICAL_A})+)`;\nexport const COMPOUND_B =\n `(?:${TAG_TYPE}|(?:${TAG_TYPE})?(?:${SUB_TYPE}|${NESTED_LOGICAL_B})+)`;\nexport const COMPOUND_I =\n `(?:${TAG_TYPE_I}|(?:${TAG_TYPE_I})?(?:${SUB_TYPE})+)`;\nexport const COMPLEX_L = `${COMPOUND_B}(?:${COMBO}${COMPOUND_B})*`;\nexport const LOGICAL_COMPLEX =\n `(?:is|not)\\\\(\\\\s*${COMPLEX_L}(?:\\\\s*,\\\\s*${COMPLEX_L})*\\\\s*\\\\)`;\nexport const LOGICAL_COMPOUND =\n `(?:is|not)\\\\(\\\\s*${COMPOUND_A}(?:\\\\s*,\\\\s*${COMPOUND_A})*\\\\s*\\\\)`;\n\n/* array */\nexport const KEY_FORM_FOCUS =\n Object.freeze(['button', 'input', 'select', 'textarea']);\nexport const KEY_INPUT_BUTTON = Object.freeze(['button', 'reset', 'submit']);\nexport const KEY_INPUT_DATE =\n Object.freeze(['date', 'datetime-local', 'month', 'time', 'week']);\nexport const KEY_INPUT_TEXT =\n Object.freeze(['email', 'password', 'search', 'tel', 'text', 'url']);\nexport const KEY_INPUT_EDIT =\n Object.freeze([...KEY_INPUT_DATE, ...KEY_INPUT_TEXT, 'number']);\nexport const KEY_INPUT_LTR = Object.freeze([\n 'checkbox', 'color', 'date', 'image', 'number', 'range', 'radio', 'time'\n]);\nexport const KEY_LOGICAL = Object.freeze(['has', 'is', 'not', 'where']);\nexport const KEY_MODIFIER = Object.freeze([\n 'Alt', 'AltGraph', 'CapsLock', 'Control', 'Fn', 'FnLock', 'Hyper', 'Meta',\n 'NumLock', 'ScrollLock', 'Shift', 'Super', 'Symbol', 'SymbolLock'\n]);\nexport const KEY_PS_STATE = Object.freeze([\n 'enabled', 'disabled', 'valid', 'invalid', 'in-range', 'out-of-range',\n 'checked', 'indeterminate', 'read-only', 'read-write', 'open', 'closed',\n 'placeholder-shown'\n]);\nexport const KEY_SHADOW_HOST = Object.freeze(['host', 'host-context']);\n"],
5
+ "mappings": "4ZAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,eAAAE,EAAA,QAAAC,EAAA,kBAAAC,EAAA,WAAAC,EAAA,WAAAC,EAAA,WAAAC,EAAA,WAAAC,EAAA,WAAAC,EAAA,WAAAC,EAAA,aAAAC,EAAA,cAAAC,EAAA,mBAAAC,EAAA,eAAAC,EAAA,UAAAC,EAAA,YAAAC,EAAA,cAAAC,EAAA,aAAAC,EAAA,eAAAC,EAAA,eAAAC,EAAA,eAAAC,GAAA,YAAAC,GAAA,UAAAC,EAAA,2BAAAC,GAAA,kBAAAC,GAAA,mCAAAC,GAAA,+BAAAC,GAAA,gCAAAC,GAAA,QAAAC,G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SAAU,QAAS,QAAS,MACpE,CAAC,EACYE,GAAc,OAAO,OAAO,CAAC,MAAO,KAAM,MAAO,OAAO,CAAC,EACzDC,GAAe,OAAO,OAAO,CACxC,MAAO,WAAY,WAAY,UAAW,KAAM,SAAU,QAAS,OACnE,UAAW,aAAc,QAAS,QAAS,SAAU,YACvD,CAAC,EACYC,GAAe,OAAO,OAAO,CACxC,UAAW,WAAY,QAAS,UAAW,WAAY,eACvD,UAAW,gBAAiB,YAAa,aAAc,OAAQ,SAC/D,mBACF,CAAC,EACYC,GAAkB,OAAO,OAAO,CAAC,OAAQ,cAAc,CAAC",
6
+ "names": ["constant_exports", "__export", "ALPHA_NUM", "ANB", "ATTR_SELECTOR", "BIT_01", "BIT_02", "BIT_04", "BIT_08", "BIT_16", "BIT_32", "BIT_FFFF", "CHILD_IDX", "CLASS_SELECTOR", "COMBINATOR", "COMBO", "COMPLEX", "COMPLEX_L", "COMPOUND", "COMPOUND_A", "COMPOUND_B", "COMPOUND_I", "DESCEND", "DIGIT", "DOCUMENT_FRAGMENT_NODE", "DOCUMENT_NODE", "DOCUMENT_POSITION_CONTAINED_BY", "DOCUMENT_POSITION_CONTAINS", "DOCUMENT_POSITION_PRECEDING", "DUO", "ELEMENT_NODE", "HEX", "HYPHEN", "IDENT", "ID_SELECTOR", "KEY_FORM_FOCUS", "KEY_INPUT_BUTTON", "KEY_INPUT_DATE", "KEY_INPUT_EDIT", "KEY_INPUT_LTR", "KEY_INPUT_TEXT", "KEY_LOGICAL", "KEY_MODIFIER", "KEY_PS_STATE", "KEY_SHADOW_HOST", "LANG_PART", "LOGICAL_COMPLEX", "LOGICAL_COMPOUND", "NESTED_LOGICAL_A", "NESTED_LOGICAL_B", "NOT_SUPPORTED_ERR", "NTH", "N_TH", "OPERATOR", "PSEUDO_CLASS", "PS_CLASS_SELECTOR", "PS_ELEMENT_SELECTOR", "SELECTOR", "SHOW_ALL", "SHOW_DOCUMENT", "SHOW_DOCUMENT_FRAGMENT", "SHOW_ELEMENT", "STRING", "SUB_TYPE", "SYNTAX_ERR", "TAG_ID_CLASS", "TAG_TYPE", "TAG_TYPE_I", "TARGET_ALL", "TARGET_FIRST", "TARGET_LINEAL", "TARGET_SELF", "TEXT_NODE", "TYPE_FROM", "TYPE_SELECTOR", "TYPE_TO", "WALKER_FILTER", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- var C=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var M=(E,c)=>{for(var e in c)C(E,e,{get:c[e],enumerable:!0})},D=(E,c,e,o)=>{if(c&&typeof c=="object"||typeof c=="function")for(let l of R(c))!I.call(E,l)&&l!==e&&C(E,l,{get:()=>c[l],enumerable:!(o=O(c,l))||o.enumerable});return E};var P=E=>D(C({},"__esModule",{value:!0}),E);var U={};M(U,{Finder:()=>W});module.exports=P(U);var g=require("./matcher.js"),_=require("./parser.js"),N=require("./utility.js"),n=require("./constant.js");const S="next",x="prev";class W{#i;#n;#w;#t;#f;#c;#u;#o;#b;#r;#e;#d;#_;#m;#k;#s;#y;#h;#N;#p;#a;#l;constructor(c){this.#l=c,this.#n=new WeakMap,this.#f=new WeakMap,this.#b=new WeakMap,this.#k=new WeakMap,this.#c=null,this.#u=null,this.#r=null,this._registerEventListeners()}onError(c,e){if(!(e?.noexcept??this.#_))if(c instanceof DOMException||c instanceof this.#l.DOMException)if(c.name===n.NOT_SUPPORTED_ERR)this.#a&&console.warn(c.message);else throw new this.#l.DOMException(c.message,c.name);else throw c.name in this.#l?new this.#l[c.name](c.message):c}setup(c,e,o={}){const{noexcept:l,warn:a}=o;return this.#_=!!l,this.#a=!!a,this.#e=e,[this.#t,this.#s,this.#h]=(0,N.resolveContent)(e),this.#y=c,[this.#i,this.#d]=this._correspond(c),this.#b=new WeakMap,this.#p=new WeakMap,this.#N=null,this}_registerEventListeners(){const c={capture:!0,passive:!0},e=[],o=["focus","focusin"];for(const r of o)e.push(this.#l.addEventListener(r,f=>{this.#u=f},c));const l=["keydown","keyup"];for(const r of l)e.push(this.#l.addEventListener(r,f=>{const{key:b}=f;n.KEY_MODIFIER.includes(b)||(this.#c=f)},c));const a=["mouseover","mousedown","mouseup","click","mouseout"];for(const r of a)e.push(this.#l.addEventListener(r,f=>{this.#c=f},c));return e}_correspond(c){const e=[];this.#w=!1,this.#o=!1;let o;if(this.#f.has(this.#t)){const l=this.#f.get(this.#t);if(l&&l.has(`${c}`)){const a=l.get(`${c}`);o=a.ast,this.#w=a.descendant,this.#o=a.invalidate}}if(o){const l=o.length;for(let a=0;a<l;a++)o[a].dir=null,o[a].filtered=!1,o[a].find=!1,e[a]=[]}else{let l;try{l=(0,_.parseSelector)(c)}catch(m){this.onError(m)}const{branches:a,info:r}=(0,_.walkAST)(l),{hasHasPseudoFunc:f,hasLogicalPseudoFunc:b,hasNthChildOfSelector:h}=r;let i=f||!!(b&&h),t=!1,s=0;o=[];for(const[...m]of a){const u=[];let p=m.shift();if(p&&p.type!==n.COMBINATOR){const w=new Set;for(;p;){let k=p.name;if(p.type===n.COMBINATOR){const[y]=m;if(y.type===n.COMBINATOR)throw new DOMException(`Invalid selector ${c}`,n.SYNTAX_ERR);k==="+"||k==="~"?i=!0:t=!0,u.push({combo:p,leaves:(0,_.sortAST)(w)}),w.clear()}else p&&(k&&typeof k=="string"&&(k=(0,_.unescapeSelector)(k),typeof k=="string"&&k!==p.name&&(p.name=k),/[|:]/.test(k)&&(p.namespace=!0)),w.add(p));if(m.length)p=m.shift();else{u.push({combo:null,leaves:(0,_.sortAST)(w)}),w.clear();break}}}o.push({branch:u,dir:null,filtered:!1,find:!1}),e[s]=[],s++}let d;this.#f.has(this.#t)?d=this.#f.get(this.#t):d=new Map,d.set(`${c}`,{ast:o,descendant:t,invalidate:i}),this.#f.set(this.#t,d),this.#w=t,this.#o=i}return[o,e]}_createTreeWalker(c,e={}){const{force:o=!1,whatToShow:l=n.WALKER_FILTER}=e;let a;return o?a=this.#t.createTreeWalker(c,l):this.#p.has(c)?a=this.#p.get(c):(a=this.#t.createTreeWalker(c,l),this.#p.set(c,a)),a}_prepareQuerySelectorWalker(){return this.#m=this._createTreeWalker(this.#e),this.#m}_collectNthChild(c,e,o){const{a:l,b:a,reverse:r,selector:f}=c,{parentNode:b}=e,h=new Set;let i;if(f){if(this.#n.has(f))i=this.#n.get(f);else{const{branches:s}=(0,_.walkAST)(f);i=s,this.#o||this.#n.set(f,i)}const{branches:t}=(0,_.walkAST)(f);i=t}if(b){const t=this._createTreeWalker(b,{force:!0});let s=t.firstChild();const d=new Set;let m=0;if(i)for(;s;){if((0,N.isVisible)(s)){let u;for(const p of i)if(u=this._matchLeaves(p,s,o),!u)break;u&&d.add(s)}m++,s=t.nextSibling()}else for(;s;)m++,s=t.nextSibling();if(l===0){if(a>0&&a<=m){if(d.size){s=(0,N.traverseNode)(b,t),r?s=t.lastChild():s=t.firstChild();let u=0;for(;s;){if(d.has(s)){if(u===a-1){h.add(s);break}u++}r?s=t.previousSibling():s=t.nextSibling()}}else if(!f){s=(0,N.traverseNode)(b,t),r?s=t.lastChild():s=t.firstChild();let u=0;for(;s;){if(u===a-1){h.add(s);break}r?s=t.previousSibling():s=t.nextSibling(),u++}}}}else{let u=a-1;if(l>0)for(;u<0;)u+=l;if(u>=0&&u<m){s=(0,N.traverseNode)(b,t),r?s=t.lastChild():s=t.firstChild();let p=0,w=l>0?0:a-1;for(;s&&(s&&u>=0&&u<m);)d.size?d.has(s)&&(w===u&&(h.add(s),u+=l),l>0?w++:w--):p===u&&(f||h.add(s),u+=l),r?s=t.previousSibling():s=t.nextSibling(),p++}}if(r&&h.size>1){const u=[...h];return new Set(u.reverse())}}else if(e===this.#s&&l+a===1)if(i){let t;for(const s of i)if(t=this._matchLeaves(s,e,o),t)break;t&&h.add(e)}else h.add(e);return h}_collectNthOfType(c,e){const{a:o,b:l,reverse:a}=c,{localName:r,namespaceURI:f,parentNode:b,prefix:h}=e,i=new Set;if(b){const t=this._createTreeWalker(b);let s=(0,N.traverseNode)(b,t);s=t.firstChild();let d=0;for(;s;)d++,s=t.nextSibling();if(o===0){if(l>0&&l<=d){s=(0,N.traverseNode)(b,t),a?s=t.lastChild():s=t.firstChild();let m=0;for(;s;){const{localName:u,namespaceURI:p,prefix:w}=s;if(u===r&&w===h&&p===f){if(m===l-1){i.add(s);break}m++}a?s=t.previousSibling():s=t.nextSibling()}}}else{let m=l-1;if(o>0)for(;m<0;)m+=o;if(m>=0&&m<d){s=(0,N.traverseNode)(b,t),a?s=t.lastChild():s=t.firstChild();let u=o>0?0:l-1;for(;s;){const{localName:p,namespaceURI:w,prefix:k}=s;if(p===r&&k===h&&w===f){if(u===m&&(i.add(s),m+=o),m<0||m>=d)break;o>0?u++:u--}a?s=t.previousSibling():s=t.nextSibling()}}}if(a&&i.size>1){const m=[...i];return new Set(m.reverse())}}else e===this.#s&&o+l===1&&i.add(e);return i}_matchAnPlusB(c,e,o,l){const{nth:{a,b:r,name:f},selector:b}=c,h=new Map;if(f?(f==="even"?(h.set("a",2),h.set("b",0)):f==="odd"&&(h.set("a",2),h.set("b",1)),o.indexOf("last")>-1&&h.set("reverse",!0)):(typeof a=="string"&&/-?\d+/.test(a)?h.set("a",a*1):h.set("a",0),typeof r=="string"&&/-?\d+/.test(r)?h.set("b",r*1):h.set("b",0),o.indexOf("last")>-1&&h.set("reverse",!0)),o==="nth-child"||o==="nth-last-child"){b&&h.set("selector",b);const i=Object.fromEntries(h);return this._collectNthChild(i,e,l)}else if(o==="nth-of-type"||o==="nth-last-of-type"){const i=Object.fromEntries(h);return this._collectNthOfType(i,e)}return new Set}_matchHasPseudoFunc(c,e,o){if(Array.isArray(c)&&c.length){const l=[...c],[a]=l,{type:r}=a;let f;r===n.COMBINATOR?f=l.shift():f={name:" ",type:n.COMBINATOR};const b=[];for(;l.length;){const[t]=l,{type:s}=t;if(s===n.COMBINATOR)break;b.push(l.shift())}const h={combo:f,leaves:b};o.dir=S;const i=this._matchCombinator(h,e,o);if(i.size){if(l.length){let t=!1;for(const s of i)if(t=this._matchHasPseudoFunc(l,s,o),t)break;return t}return!0}}return!1}_matchLogicalPseudoFunc(c,e,o){const{astName:l,branches:a,twigBranches:r}=c,f=(o.isShadowRoot||this.#h)&&e.nodeType===n.DOCUMENT_FRAGMENT_NODE;if(l==="has"){let b;for(const h of a)if(b=this._matchHasPseudoFunc(h,e,o),b)break;if(b)if(f){if(this.#N)return e}else return e}else{if(f){let i;for(const t of a)if(t.length>1){i=!0;break}else if(l==="not"){const[{type:s}]=t;if(s!==n.PS_CLASS_SELECTOR){i=!0;break}}if(i)return null}o.forgive=l==="is"||l==="where";const b=r.length;let h;for(let i=0;i<b;i++){const t=r[i],s=t.length-1,{leaves:d}=t[s];if(h=this._matchLeaves(d,e,o),h&&s>0){let m=new Set([e]);for(let u=s-1;u>=0;u--){const p=t[u],w=[];o.dir=x;for(const k of m){const y=this._matchCombinator(p,k,o);y.size&&w.push(...y)}if(w.length)u===0?h=!0:m=new Set(w);else{h=!1;break}}}if(h)break}if(l==="not")return h?null:e;if(h)return e}return null}_matchPseudoClassSelector(c,e,o){const{children:l,name:a}=c,{localName:r,parentNode:f}=e,{forgive:b,warn:h=this.#a}=o,i=new Set;if(Array.isArray(l)&&n.KEY_LOGICAL.includes(a)){if(!l.length&&a!=="is"&&a!=="where"){const d=(0,_.generateCSS)(c);throw new DOMException(`Invalid selector ${d}`,n.SYNTAX_ERR)}let t;if(this.#n.has(c))t=this.#n.get(c);else{const{branches:d}=(0,_.walkAST)(c);if(a==="has"){let m;for(const u of l){const p=(0,_.findAST)(u,w=>n.KEY_LOGICAL.includes(w.name)&&(0,_.findAST)(w,k=>k.name==="has")?w:null);if(p){const w=p.name;if(w==="is"||w==="where"){m=!0;break}else{const k=(0,_.generateCSS)(c);throw new DOMException(`Invalid selector ${k}`,n.SYNTAX_ERR)}}}if(m)return i;t={astName:a,branches:d}}else{const m=[];for(const[...u]of d){const p=[],w=new Set;let k=u.shift();for(;k;)if(k.type===n.COMBINATOR?(p.push({combo:k,leaves:[...w]}),w.clear()):k&&w.add(k),u.length)k=u.shift();else{p.push({combo:null,leaves:[...w]}),w.clear();break}m.push(p)}t={astName:a,branches:d,twigBranches:m},this.#o||this.#n.set(c,t)}}const s=this._matchLogicalPseudoFunc(t,e,o);s&&i.add(s)}else if(Array.isArray(l))if(/^nth-(?:last-)?(?:child|of-type)$/.test(a)){if(l.length!==1){const d=(0,_.generateCSS)(c);throw new DOMException(`Invalid selector ${d}`,n.SYNTAX_ERR)}const[t]=l;return this._matchAnPlusB(t,e,a,o)}else switch(a){case"dir":{if(l.length!==1){const d=(0,_.generateCSS)(c);throw new DOMException(`Invalid selector ${d}`,n.SYNTAX_ERR)}const[t]=l;(0,g.matchDirectionPseudoClass)(t,e)&&i.add(e);break}case"lang":{if(!l.length){const s=(0,_.generateCSS)(c);throw new DOMException(`Invalid selector ${s}`,n.SYNTAX_ERR)}let t;for(const s of l)if(t=(0,g.matchLanguagePseudoClass)(s,e),t)break;t&&i.add(e);break}case"state":{if((0,N.isCustomElement)(e)){const[{value:t}]=l;if(t)if(e[t])i.add(e);else for(const s in e){const d=e[s];if(d instanceof this.#l.ElementInternals){d?.states?.has(t)&&i.add(e);break}}}break}case"current":case"nth-col":case"nth-last-col":{if(h)throw new DOMException(`Unsupported pseudo-class :${a}()`,n.NOT_SUPPORTED_ERR);break}case"host":case"host-context":break;case"contains":{if(h)throw new DOMException(`Unknown pseudo-class :${a}()`,n.NOT_SUPPORTED_ERR);break}default:if(!b)throw new DOMException(`Unknown pseudo-class :${a}()`,n.SYNTAX_ERR)}else switch(a){case"any-link":case"link":{(r==="a"||r==="area")&&e.hasAttribute("href")&&i.add(e);break}case"local-link":{if((r==="a"||r==="area")&&e.hasAttribute("href")){const{href:t,origin:s,pathname:d}=new URL(this.#t.URL),m=new URL(e.getAttribute("href"),t);m.origin===s&&m.pathname===d&&i.add(e)}break}case"visited":break;case"hover":{const{target:t,type:s}=this.#c??{};/^(?:click|mouse(?:down|over|up))$/.test(s)&&e.contains(t)&&i.add(e);break}case"active":{const{buttons:t,target:s,type:d}=this.#c??{};d==="mousedown"&&t&n.BIT_01&&e.contains(s)&&i.add(e);break}case"target":{const{hash:t}=new URL(this.#t.URL);e.id&&t===`#${e.id}`&&this.#t.contains(e)&&i.add(e);break}case"target-within":{const{hash:t}=new URL(this.#t.URL);if(t){const s=t.replace(/^#/,"");let d=this.#t.getElementById(s);for(;d;){if(d===e){i.add(e);break}d=d.parentNode}}break}case"scope":{this.#e.nodeType===n.ELEMENT_NODE?!this.#h&&e===this.#e&&i.add(e):e===this.#t.documentElement&&i.add(e);break}case"focus":{e===this.#t.activeElement&&(0,N.isFocusableArea)(e)&&i.add(e);break}case"focus-visible":{if(e===this.#t.activeElement&&(0,N.isFocusableArea)(e)){let t;if((0,N.isFocusVisible)(e))t=!0;else if(this.#u){const{relatedTarget:s,target:d}=this.#u;if(d===e)if((0,N.isFocusVisible)(s))t=!0;else if(this.#c){const{key:m,target:u,type:p}=this.#c;u===s?(this.#r===null||d===this.#r)&&(t=!0):m==="Tab"?(p==="keydown"&&u!==e||p==="keyup"&&u===e)&&(u===d?(this.#r===null||u===this.#r&&s===null)&&(t=!0):t=!0):m&&(p==="keydown"||p==="keyup")&&u===e&&(t=!0)}else(s===null||s===this.#r)&&(t=!0)}t?(this.#r=e,i.add(e)):this.#r===e&&(this.#r=null)}break}case"focus-within":{let t,s=this.#t.activeElement;if((0,N.isFocusableArea)(s))for(;s;){if(s===e){t=!0;break}s=s.parentNode}t&&i.add(e);break}case"open":case"closed":{(r==="details"||r==="dialog")&&(e.hasAttribute("open")?a==="open"&&i.add(e):a==="closed"&&i.add(e));break}case"disabled":case"enabled":{if([...n.KEY_FORM_FOCUS,"fieldset","optgroup","option"].includes(r)||(0,N.isCustomElement)(e,{formAssociated:!0})){let s;if(e.disabled||e.hasAttribute("disabled"))s=!0;else if(e.localName==="option")f.localName==="optgroup"&&(f.disabled||f.hasAttribute("disabled"))&&(s=!0);else if(e.localName!=="optgroup"){let d=f;for(;d;)if(d.localName==="fieldset"&&(d.disabled||d.hasAttribute("disabled"))){let m=d.firstElementChild;for(;m&&m.localName!=="legend";)m=m.nextElementSibling;m&&m.contains(e)||(s=!0);break}else{if(d.localName==="form")break;if(d.parentNode?.nodeType===n.ELEMENT_NODE){if(d.parentNode.localName==="form")break;d=d.parentNode}else break}}s?a==="disabled"&&i.add(e):a==="enabled"&&i.add(e)}break}case"read-only":case"read-write":{let t,s;switch(r){case"textarea":{e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled")?t=!0:s=!0;break}case"input":{(!e.type||n.KEY_INPUT_EDIT.includes(e.type))&&(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled")?t=!0:s=!0);break}default:(0,N.isContentEditable)(e)?s=!0:t=!0}t?a==="read-only"&&i.add(e):a==="read-write"&&s&&i.add(e);break}case"placeholder-shown":{let t;if(e.placeholder?t=e.placeholder:e.hasAttribute("placeholder")&&(t=e.getAttribute("placeholder")),typeof t=="string"&&!/[\r\n]/.test(t)){let s;r==="textarea"?s=e:r==="input"&&(e.hasAttribute("type")?[...n.KEY_INPUT_TEXT,"number"].includes(e.getAttribute("type"))&&(s=e):s=e),s&&e.value===""&&i.add(e)}break}case"checked":{const t=e.getAttribute("type");(e.checked&&r==="input"&&(t==="checkbox"||t==="radio")||e.selected&&r==="option")&&i.add(e);break}case"indeterminate":{if(e.indeterminate&&r==="input"&&e.type==="checkbox"||r==="progress"&&!e.hasAttribute("value"))i.add(e);else if(r==="input"&&e.type==="radio"&&!e.hasAttribute("checked")){const t=e.name;let s=e.parentNode;for(;s&&s.localName!=="form";)s=s.parentNode;s||(s=this.#t.documentElement);const d=this._createTreeWalker(s);let m=(0,N.traverseNode)(s,d);m=d.firstChild();let u;for(;m&&!(m.localName==="input"&&m.getAttribute("type")==="radio"&&(m.hasAttribute("name")?m.getAttribute("name")===t&&(u=!!m.checked):u=!!m.checked,u));)m=d.nextNode();u||i.add(e)}break}case"default":{const t=["checkbox","radio"],s=["button","reset"],d=["image","submit"],m=e.getAttribute("type");if(r==="button"&&!(e.hasAttribute("type")&&s.includes(m))||r==="input"&&e.hasAttribute("type")&&d.includes(m)){let u=e.parentNode;for(;u&&u.localName!=="form";)u=u.parentNode;if(u){const p=this._createTreeWalker(u);let w=(0,N.traverseNode)(u,p);for(w=p.firstChild();w;){const k=w.localName,y=w.getAttribute("type");let v;if(k==="button"?v=!(w.hasAttribute("type")&&s.includes(y)):k==="input"&&(v=w.hasAttribute("type")&&d.includes(y)),v){w===e&&i.add(e);break}w=p.nextNode()}}}else(r==="input"&&e.hasAttribute("type")&&t.includes(m)&&e.hasAttribute("checked")||r==="option"&&e.hasAttribute("selected"))&&i.add(e);break}case"valid":case"invalid":{const t=[...n.KEY_FORM_FOCUS,"form"];if(t.includes(r)){let s;e.checkValidity()&&(e.maxLength>=0?e.maxLength>=e.value.length&&(s=!0):s=!0),s?a==="valid"&&i.add(e):a==="invalid"&&i.add(e)}else if(r==="fieldset"){const s=this._createTreeWalker(e);let d=(0,N.traverseNode)(e,s);d=s.firstChild();let m;if(!d)m=!0;else for(;d&&!(t.includes(d.localName)&&(d.checkValidity()?d.maxLength>=0?m=d.maxLength>=d.value.length:m=!0:m=!1,!m));)d=s.nextNode();m?a==="valid"&&i.add(e):a==="invalid"&&i.add(e)}break}case"in-range":case"out-of-range":{const t=[...n.KEY_INPUT_DATE,"number","range"],s=e.getAttribute("type");if(r==="input"&&!(e.readonly||e.hasAttribute("readonly"))&&!(e.disabled||e.hasAttribute("disabled"))&&t.includes(s)){const d=e.validity.rangeUnderflow||e.validity.rangeOverflow;(a==="out-of-range"&&d||a==="in-range"&&!d&&(e.hasAttribute("min")||e.hasAttribute("max")||s==="range"))&&i.add(e)}break}case"required":case"optional":{let t;if(r==="select"||r==="textarea")t=e;else if(r==="input")if(e.hasAttribute("type")){const s=[...n.KEY_INPUT_EDIT,"checkbox","file","radio"],d=e.getAttribute("type");s.includes(d)&&(t=e)}else t=e;t&&(e.required||e.hasAttribute("required")?a==="required"&&i.add(e):a==="optional"&&i.add(e));break}case"root":{e===this.#t.documentElement&&i.add(e);break}case"empty":{if(e.hasChildNodes()){const t=this._createTreeWalker(e,{force:!0,whatToShow:n.SHOW_ALL});let s=t.firstChild(),d;for(;s&&(d=s.nodeType!==n.ELEMENT_NODE&&s.nodeType!==n.TEXT_NODE,!!d);)s=t.nextSibling();d&&i.add(e)}else i.add(e);break}case"first-child":{(f&&e===f.firstElementChild||e===this.#s)&&i.add(e);break}case"last-child":{(f&&e===f.lastElementChild||e===this.#s)&&i.add(e);break}case"only-child":{(f&&e===f.firstElementChild&&e===f.lastElementChild||e===this.#s)&&i.add(e);break}case"first-of-type":{if(f){const[t]=this._collectNthOfType({a:0,b:1},e);t&&i.add(t)}else e===this.#s&&i.add(e);break}case"last-of-type":{if(f){const[t]=this._collectNthOfType({a:0,b:1,reverse:!0},e);t&&i.add(t)}else e===this.#s&&i.add(e);break}case"only-of-type":{if(f){const[t]=this._collectNthOfType({a:0,b:1},e);if(t===e){const[s]=this._collectNthOfType({a:0,b:1,reverse:!0},e);s===e&&i.add(e)}}else e===this.#s&&i.add(e);break}case"defined":{e.hasAttribute("is")||r.includes("-")?(0,N.isCustomElement)(e)&&i.add(e):(e instanceof this.#l.HTMLElement||e instanceof this.#l.SVGElement)&&i.add(e);break}case"popover-open":{e.popover&&(0,N.isVisible)(e)&&i.add(e);break}case"host":case"host-context":break;case"after":case"before":case"first-letter":case"first-line":{if(h)throw new DOMException(`Unsupported pseudo-element ::${a}`,n.NOT_SUPPORTED_ERR);break}case"autofill":case"blank":case"buffering":case"current":case"fullscreen":case"future":case"modal":case"muted":case"past":case"paused":case"picture-in-picture":case"playing":case"seeking":case"stalled":case"user-invalid":case"user-valid":case"volume-locked":case"-webkit-autofill":{if(h)throw new DOMException(`Unsupported pseudo-class :${a}`,n.NOT_SUPPORTED_ERR);break}default:if(a.startsWith("-webkit-")){if(h)throw new DOMException(`Unsupported pseudo-class :${a}`,n.NOT_SUPPORTED_ERR)}else if(!b)throw new DOMException(`Unknown pseudo-class :${a}`,n.SYNTAX_ERR)}return i}_matchShadowHostPseudoClass(c,e){const{children:o,name:l}=c;if(Array.isArray(o)){if(o.length!==1){const h=(0,_.generateCSS)(c);throw new DOMException(`Invalid selector ${h}`,n.SYNTAX_ERR)}const{branches:a}=(0,_.walkAST)(o[0]),[r]=a,[...f]=r,{host:b}=e;if(l==="host"){let h;for(const i of f){const{type:t}=i;if(t===n.COMBINATOR){const s=(0,_.generateCSS)(c);throw new DOMException(`Invalid selector ${s}`,n.SYNTAX_ERR)}if(h=this._matchSelector(i,b).has(b),!h)break}return h?e:null}else if(l==="host-context"){let h=b,i;for(;h;){for(const t of f){const{type:s}=t;if(s===n.COMBINATOR){const d=(0,_.generateCSS)(c);throw new DOMException(`Invalid selector ${d}`,n.SYNTAX_ERR)}if(i=this._matchSelector(t,h).has(h),!i)break}if(i)break;h=h.parentNode}return i?e:null}throw new DOMException(`Invalid selector :${l}`,n.SYNTAX_ERR)}else{if(l==="host")return e;throw new DOMException(`Invalid selector :${l}`,n.SYNTAX_ERR)}}_matchSelector(c,e,o={}){const{type:l}=c,a=(0,_.unescapeSelector)(c.name),r=new Set;if(e.nodeType===n.ELEMENT_NODE)switch(l){case n.ATTR_SELECTOR:{(0,g.matchAttributeSelector)(c,e)&&r.add(e);break}case n.ID_SELECTOR:{e.id===a&&r.add(e);break}case n.CLASS_SELECTOR:{e.classList.contains(a)&&r.add(e);break}case n.PS_CLASS_SELECTOR:return this._matchPseudoClassSelector(c,e,o);case n.TYPE_SELECTOR:{(0,g.matchTypeSelector)(c,e,o)&&r.add(e);break}case n.PS_ELEMENT_SELECTOR:default:(0,g.matchPseudoElementSelector)(a,l,o)}else if(this.#h&&l===n.PS_CLASS_SELECTOR&&e.nodeType===n.DOCUMENT_FRAGMENT_NODE){if(n.KEY_LOGICAL.includes(a))return o.isShadowRoot=!0,this._matchPseudoClassSelector(c,e,o);if(a==="host"||a==="host-context"){const f=this._matchShadowHostPseudoClass(c,e,o);f&&(this.#N=!0,r.add(f))}}return r}_matchLeaves(c,e,o){let l;if(this.#o?l=this.#b.get(c):l=this.#k.get(c),l&&l.has(e)){const{matched:a}=l.get(e);return a}else{let a=!0;const r=[...n.KEY_FORM_FOCUS,"fieldset","form"],f=["any-link","defined","dir","link"];e.nodeType===n.ELEMENT_NODE&&r.includes(e.localName)&&(a=!1);let b;for(const h of c){switch(h.type){case n.ATTR_SELECTOR:case n.ID_SELECTOR:{a=!1;break}case n.PS_CLASS_SELECTOR:{f.includes(h.name)&&(a=!1);break}default:}if(b=this._matchSelector(h,e,o).has(e),!b)break}return a&&(l||(l=new WeakMap),l.set(e,{matched:b}),this.#o?this.#b.set(c,l):this.#k.set(c,l)),b}}_findDescendantNodes(c,e,o){const[l,...a]=c,r=a.length>0,{type:f}=l,b=(0,_.unescapeSelector)(l.name),h=new Set;let i=!1;if(this.#h||e.nodeType!==n.ELEMENT_NODE)i=!0;else switch(f){case n.PS_ELEMENT_SELECTOR:{(0,g.matchPseudoElementSelector)(b,f,o);break}case n.ID_SELECTOR:{if(this.#s.nodeType===n.ELEMENT_NODE)i=!0;else{const t=this.#s.getElementById(b);t&&t!==e&&e.contains(t)&&(r?this._matchLeaves(a,t,o)&&h.add(t):h.add(t))}break}default:i=!0}if(i){const t=this._createTreeWalker(e);let s=(0,N.traverseNode)(e,t);for(s=t.firstChild();s;)this._matchLeaves(c,s,o)&&h.add(s),s=t.nextNode()}return h}_matchCombinator(c,e,o){const{combo:l,leaves:a}=c,{name:r}=l,{parentNode:f}=e,{dir:b}=o,h=new Set;if(b===S)switch(r){case"+":{const i=e.nextElementSibling;i&&this._matchLeaves(a,i,o)&&h.add(i);break}case"~":{if(f){let i=e.nextElementSibling;for(;i;)this._matchLeaves(a,i,o)&&h.add(i),i=i.nextElementSibling}break}case">":{let i=e.firstElementChild;for(;i;)this._matchLeaves(a,i,o)&&h.add(i),i=i.nextElementSibling;break}case" ":default:{const i=this._findDescendantNodes(a,e,o);if(i.size)return i}}else switch(r){case"+":{const i=e.previousElementSibling;i&&this._matchLeaves(a,i,o)&&h.add(i);break}case"~":{if(f){let i=f.firstElementChild;for(;i&&i!==e;)this._matchLeaves(a,i,o)&&h.add(i),i=i.nextElementSibling}break}case">":{f&&this._matchLeaves(a,f,o)&&h.add(f);break}case" ":default:{const i=[];let t=f;for(;t;)this._matchLeaves(a,t,o)&&i.push(t),t=t.parentNode;if(i.length)return new Set(i.reverse())}}return h}_findWalker(c,e,o={}){const{force:l,targetType:a}=o,r=this.#m,f=[];let b=(0,N.traverseNode)(e,r,!!l);if(b)for((b.nodeType!==n.ELEMENT_NODE||b===e&&b!==this.#s)&&(b=r.nextNode());b&&!(this._matchLeaves(c,b,{warn:this.#a})&&(f.push(b),a!==n.TARGET_ALL));)b=r.nextNode();return f}_matchSelf(c){const e=[];let o=!1;return this._matchLeaves(c,this.#e,{warn:this.#a})&&(e.push(this.#e),o=!0),[e,o]}_findLineal(c,e){const{complex:o}=e,l=[];let a=!1,r=this._matchLeaves(c,this.#e,{warn:this.#a});if(r&&(l.push(this.#e),a=!0),!r||o){let f=this.#e.parentNode;for(;f&&(r=this._matchLeaves(c,f,{warn:this.#a}),r&&(l.push(f),a=!0),f.parentNode);)f=f.parentNode}return[l,a]}_findEntryNodes(c,e,o){const{leaves:l}=c,[a,...r]=l,f=r.length>0,{name:b,type:h}=a;let i=[],t=!1,s=!1;switch(h){case n.PS_ELEMENT_SELECTOR:{(0,g.matchPseudoElementSelector)(b,h,{warn:this.#a});break}case n.ID_SELECTOR:{if(e===n.TARGET_SELF)[i,t]=this._matchSelf(l);else if(e===n.TARGET_LINEAL)[i,t]=this._findLineal(l,{complex:o});else if(e===n.TARGET_FIRST&&this.#s.nodeType!==n.ELEMENT_NODE){const d=this.#s.getElementById(b);d&&(f?this._matchLeaves(r,d,{warn:this.#a})&&(i.push(d),t=!0):(i.push(d),t=!0))}else i=this._findWalker(l,this.#e,{targetType:e}),i.length&&(t=!0);break}case n.CLASS_SELECTOR:{e===n.TARGET_SELF?[i,t]=this._matchSelf(l):e===n.TARGET_LINEAL?[i,t]=this._findLineal(l,{complex:o}):(i=this._findWalker(l,this.#e,{targetType:e}),i.length&&(t=!0));break}case n.TYPE_SELECTOR:{e===n.TARGET_SELF?[i,t]=this._matchSelf(l):e===n.TARGET_LINEAL?[i,t]=this._findLineal(l,{complex:o}):(i=this._findWalker(l,this.#e,{targetType:e}),i.length&&(t=!0));break}default:if(e!==n.TARGET_LINEAL&&(b==="host"||b==="host-context")){let d;if(this.#h&&this.#e.nodeType===n.DOCUMENT_FRAGMENT_NODE?d=this._matchShadowHostPseudoClass(a,this.#e):f&&this.#e.nodeType===n.ELEMENT_NODE&&(d=this._matchShadowHostPseudoClass(a,this.#e.shadowRoot)),d){let m;if(f){for(const u of r)if(/^host(?:-context)?$/.test(u.name)?m=this._matchShadowHostPseudoClass(u,d)===d:u.name==="has"?m=this._matchPseudoClassSelector(u,d,{}).has(d):m=!1,!m)break}else m=!0;m&&(i.push(d),t=!0)}}else e===n.TARGET_SELF?[i,t]=this._matchSelf(l):e===n.TARGET_LINEAL?[i,t]=this._findLineal(l,{complex:o}):e===n.TARGET_FIRST?(i=this._findWalker(l,this.#e,{targetType:e}),i.length&&(t=!0)):s=!0}return{compound:f,filtered:t,nodes:i,pending:s}}_collectNodes(c){const e=this.#i.values();if(c===n.TARGET_ALL||c===n.TARGET_FIRST){const o=new Set;let l=0;for(const{branch:a}of e){const r=a.length,f=r>1,b=a[0];let h,i;if(f){const{combo:u,leaves:[{name:p,type:w}]}=b,k=a[r-1],{leaves:[{name:y,type:v}]}=k;if(h=S,i=b,this.#y.includes(":scope")||v===n.PS_ELEMENT_SELECTOR||v===n.ID_SELECTOR)h=x,i=k;else if(p==="*"&&w===n.TYPE_SELECTOR)h=x,i=k;else if(y==="*"&&v===n.TYPE_SELECTOR)h=S,i=b;else if(r===2){const{name:L}=u;(L==="+"||L==="~")&&(h=x,i=k)}}else h=x,i=b;const{compound:t,filtered:s,nodes:d,pending:m}=this._findEntryNodes(i,c,f);d.length?(this.#i[l].find=!0,this.#d[l]=d):m&&o.add(new Map([["index",l],["twig",i]])),this.#i[l].dir=h,this.#i[l].filtered=s||!t,l++}if(o.size){let a,r;this.#e!==this.#s&&this.#e.nodeType===n.ELEMENT_NODE?(a=this.#e,r=this.#m):(a=this.#s,r=this._createTreeWalker(a));let f=(0,N.traverseNode)(a,r);for(;f;){let b=!1;if(this.#e.nodeType===n.ELEMENT_NODE?f===this.#e?b=!0:b=this.#e.contains(f):b=!0,b)for(const h of o){const{leaves:i}=h.get("twig");if(this._matchLeaves(i,f,{warn:this.#a})){const s=h.get("index");this.#i[s].filtered=!0,this.#i[s].find=!0,this.#d[s].push(f)}}f!==r.currentNode&&(f=(0,N.traverseNode)(f,r)),f=r.nextNode()}}}else{let o=0;for(const{branch:l}of e){const a=l[l.length-1],r=l.length>1,{compound:f,filtered:b,nodes:h}=this._findEntryNodes(a,c,r);h.length&&(this.#i[o].find=!0,this.#d[o]=h),this.#i[o].dir=x,this.#i[o].filtered=b||!f,o++}}return[this.#i,this.#d]}_getCombinedNodes(c,e,o){const l=[];for(const a of e){const r=this._matchCombinator(c,a,{dir:o,warn:this.#a});r.size&&l.push(...r)}return l.length?new Set(l):new Set}_matchNodeNext(c,e,o){const{combo:l,index:a}=o,{combo:r,leaves:f}=c[a],b={combo:l,leaves:f},h=this._getCombinedNodes(b,e,S);if(h.size)if(a===c.length-1){const[i]=(0,N.sortNodes)(h);return i}else return this._matchNodeNext(c,h,{combo:r,index:a+1});return null}_matchNodePrev(c,e,o){const{index:l}=o,a=c[l],r=new Set([e]),f=this._getCombinedNodes(a,r,x);if(f.size){if(l===0)return e;{let b;for(const h of f)if(b=this._matchNodePrev(c,h,{index:l-1}),b)break;if(b)return e}}return null}find(c){(c===n.TARGET_ALL||c===n.TARGET_FIRST)&&this._prepareQuerySelectorWalker();const[[...e],o]=this._collectNodes(c),l=e.length;let a,r=new Set;for(let f=0;f<l;f++){const{branch:b,dir:h,find:i}=e[f],t=b.length;if(t&&i){const s=o[f],d=s.length,m=t-1;if(m===0)if((c===n.TARGET_ALL||c===n.TARGET_FIRST)&&this.#e.nodeType===n.ELEMENT_NODE)for(let u=0;u<d;u++){const p=s[u];if(p!==this.#e&&this.#e.contains(p)&&(r.add(p),c===n.TARGET_FIRST))break}else if(c===n.TARGET_ALL)if(r.size){const u=[...r];r=new Set([...u,...s]),a=!0}else r=new Set(s);else{const[u]=s;r.add(u)}else if(c===n.TARGET_ALL)if(h===S){const{combo:u}=b[0];let p=u;for(const w of s){let k=new Set([w]);for(let y=1;y<t;y++){const{combo:v,leaves:L}=b[y],A={combo:p,leaves:L};if(k=this._getCombinedNodes(A,k,h),k.size)if(y===m)if(r.size){const T=[...r];r=new Set([...T,...k]),a=!0,p=u}else r=k,p=u;else p=v;else break}}}else for(const u of s){let p=new Set([u]);for(let w=m-1;w>=0;w--){const k=b[w];if(p=this._getCombinedNodes(k,p,h),p.size)w===0&&(r.add(u),t>1&&r.size>1&&(a=!0));else break}}else if(c===n.TARGET_FIRST&&h===S){const{combo:u}=b[0];let p;for(const w of s)if(p=this._matchNodeNext(b,new Set([w]),{combo:u,index:1}),p){r.add(p);break}if(!p){const{leaves:w}=b[0],[k]=s;let[y]=this._findWalker(w,k,{targetType:c});for(;y;){if(p=this._matchNodeNext(b,new Set([y]),{combo:u,index:1}),p){r.add(p);break}[y]=this._findWalker(w,y,{targetType:c,force:!0})}}}else{let u;for(const p of s)if(u=this._matchNodePrev(b,p,{index:m-1}),u){r.add(p);break}if(!u&&c===n.TARGET_FIRST){const{leaves:p}=b[m],[w]=s;let[k]=this._findWalker(p,w,{targetType:c});for(;k;){if(u=this._matchNodePrev(b,k,{index:m-1}),u){r.add(k);break}[k]=this._findWalker(p,k,{targetType:c,force:!0})}}}}}return c===n.TARGET_FIRST?(r.delete(this.#e),r.size>1&&(r=new Set((0,N.sortNodes)(r)))):c===n.TARGET_ALL&&(r.delete(this.#e),a&&r.size>1&&(r=new Set((0,N.sortNodes)(r)))),r}}0&&(module.exports={Finder});
1
+ var L=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var M=(E,c)=>{for(var e in c)L(E,e,{get:c[e],enumerable:!0})},P=(E,c,e,o)=>{if(c&&typeof c=="object"||typeof c=="function")for(let l of R(c))!I.call(E,l)&&l!==e&&L(E,l,{get:()=>c[l],enumerable:!(o=O(c,l))||o.enumerable});return E};var D=E=>P(L({},"__esModule",{value:!0}),E);var U={};M(U,{Finder:()=>W});module.exports=D(U);var g=require("./matcher.js"),y=require("./parser.js"),N=require("./utility.js"),n=require("./constant.js");const S="next",x="prev";class W{#i;#n;#w;#t;#f;#c;#u;#o;#b;#r;#e;#d;#_;#m;#k;#s;#y;#h;#N;#p;#a;#l;constructor(c){this.#l=c,this.#n=new WeakMap,this.#f=new WeakMap,this.#b=new WeakMap,this.#k=new WeakMap,this.#c=null,this.#u=null,this.#r=null,this._registerEventListeners()}onError(c,e){if(!(e?.noexcept??this.#_))if(c instanceof DOMException||c instanceof this.#l.DOMException)if(c.name===n.NOT_SUPPORTED_ERR)this.#a&&console.warn(c.message);else throw new this.#l.DOMException(c.message,c.name);else throw c.name in this.#l?new this.#l[c.name](c.message):c}setup(c,e,o={}){const{noexcept:l,warn:a}=o;return this.#_=!!l,this.#a=!!a,this.#e=e,[this.#t,this.#s,this.#h]=(0,N.resolveContent)(e),this.#y=c,[this.#i,this.#d]=this._correspond(c),this.#b=new WeakMap,this.#p=new WeakMap,this.#N=null,this}_registerEventListeners(){const c={capture:!0,passive:!0},e=[],o=["focus","focusin"];for(const r of o)e.push(this.#l.addEventListener(r,f=>{this.#u=f},c));const l=["keydown","keyup"];for(const r of l)e.push(this.#l.addEventListener(r,f=>{const{key:b}=f;n.KEY_MODIFIER.includes(b)||(this.#c=f)},c));const a=["mouseover","mousedown","mouseup","click","mouseout"];for(const r of a)e.push(this.#l.addEventListener(r,f=>{this.#c=f},c));return e}_correspond(c){const e=[];this.#w=!1,this.#o=!1;let o;if(this.#f.has(this.#t)){const l=this.#f.get(this.#t);if(l&&l.has(`${c}`)){const a=l.get(`${c}`);o=a.ast,this.#w=a.descendant,this.#o=a.invalidate}}if(o){const l=o.length;for(let a=0;a<l;a++)o[a].dir=null,o[a].filtered=!1,o[a].find=!1,e[a]=[]}else{let l;try{l=(0,y.parseSelector)(c)}catch(u){this.onError(u)}const{branches:a,info:r}=(0,y.walkAST)(l),{hasHasPseudoFunc:f,hasLogicalPseudoFunc:b,hasNthChildOfSelector:h,hasStatePseudoClass:i}=r;let t=f||i||!!(b&&h),s=!1,d=0;o=[];for(const[...u]of a){const w=[];let p=u.shift();if(p&&p.type!==n.COMBINATOR){const k=new Set;for(;p;){let _=p.name;if(p.type===n.COMBINATOR){const[v]=u;if(v.type===n.COMBINATOR)throw new DOMException(`Invalid selector ${c}`,n.SYNTAX_ERR);_==="+"||_==="~"?t=!0:s=!0,w.push({combo:p,leaves:(0,y.sortAST)(k)}),k.clear()}else p&&(_&&typeof _=="string"&&(_=(0,y.unescapeSelector)(_),typeof _=="string"&&_!==p.name&&(p.name=_),/[|:]/.test(_)&&(p.namespace=!0)),k.add(p));if(u.length)p=u.shift();else{w.push({combo:null,leaves:(0,y.sortAST)(k)}),k.clear();break}}}o.push({branch:w,dir:null,filtered:!1,find:!1}),e[d]=[],d++}let m;this.#f.has(this.#t)?m=this.#f.get(this.#t):m=new Map,m.set(`${c}`,{ast:o,descendant:s,invalidate:t}),this.#f.set(this.#t,m),this.#w=s,this.#o=t}return[o,e]}_createTreeWalker(c,e={}){const{force:o=!1,whatToShow:l=n.WALKER_FILTER}=e;let a;return o?a=this.#t.createTreeWalker(c,l):this.#p.has(c)?a=this.#p.get(c):(a=this.#t.createTreeWalker(c,l),this.#p.set(c,a)),a}_prepareQuerySelectorWalker(){return this.#m=this._createTreeWalker(this.#e),this.#m}_collectNthChild(c,e,o){const{a:l,b:a,reverse:r,selector:f}=c,{parentNode:b}=e,h=new Set;let i;if(f){if(this.#n.has(f))i=this.#n.get(f);else{const{branches:s}=(0,y.walkAST)(f);i=s,this.#o||this.#n.set(f,i)}const{branches:t}=(0,y.walkAST)(f);i=t}if(b){const t=this._createTreeWalker(b,{force:!0});let s=t.firstChild();const d=new Set;let m=0;if(i)for(;s;){if((0,N.isVisible)(s)){let u;for(const w of i)if(u=this._matchLeaves(w,s,o),!u)break;u&&d.add(s)}m++,s=t.nextSibling()}else for(;s;)m++,s=t.nextSibling();if(l===0){if(a>0&&a<=m){if(d.size){s=(0,N.traverseNode)(b,t),r?s=t.lastChild():s=t.firstChild();let u=0;for(;s;){if(d.has(s)){if(u===a-1){h.add(s);break}u++}r?s=t.previousSibling():s=t.nextSibling()}}else if(!f){s=(0,N.traverseNode)(b,t),r?s=t.lastChild():s=t.firstChild();let u=0;for(;s;){if(u===a-1){h.add(s);break}r?s=t.previousSibling():s=t.nextSibling(),u++}}}}else{let u=a-1;if(l>0)for(;u<0;)u+=l;if(u>=0&&u<m){s=(0,N.traverseNode)(b,t),r?s=t.lastChild():s=t.firstChild();let w=0,p=l>0?0:a-1;for(;s&&(s&&u>=0&&u<m);)d.size?d.has(s)&&(p===u&&(h.add(s),u+=l),l>0?p++:p--):w===u&&(f||h.add(s),u+=l),r?s=t.previousSibling():s=t.nextSibling(),w++}}if(r&&h.size>1){const u=[...h];return new Set(u.reverse())}}else if(e===this.#s&&l+a===1)if(i){let t;for(const s of i)if(t=this._matchLeaves(s,e,o),t)break;t&&h.add(e)}else h.add(e);return h}_collectNthOfType(c,e){const{a:o,b:l,reverse:a}=c,{localName:r,namespaceURI:f,parentNode:b,prefix:h}=e,i=new Set;if(b){const t=this._createTreeWalker(b);let s=(0,N.traverseNode)(b,t);s=t.firstChild();let d=0;for(;s;)d++,s=t.nextSibling();if(o===0){if(l>0&&l<=d){s=(0,N.traverseNode)(b,t),a?s=t.lastChild():s=t.firstChild();let m=0;for(;s;){const{localName:u,namespaceURI:w,prefix:p}=s;if(u===r&&p===h&&w===f){if(m===l-1){i.add(s);break}m++}a?s=t.previousSibling():s=t.nextSibling()}}}else{let m=l-1;if(o>0)for(;m<0;)m+=o;if(m>=0&&m<d){s=(0,N.traverseNode)(b,t),a?s=t.lastChild():s=t.firstChild();let u=o>0?0:l-1;for(;s;){const{localName:w,namespaceURI:p,prefix:k}=s;if(w===r&&k===h&&p===f){if(u===m&&(i.add(s),m+=o),m<0||m>=d)break;o>0?u++:u--}a?s=t.previousSibling():s=t.nextSibling()}}}if(a&&i.size>1){const m=[...i];return new Set(m.reverse())}}else e===this.#s&&o+l===1&&i.add(e);return i}_matchAnPlusB(c,e,o,l){const{nth:{a,b:r,name:f},selector:b}=c,h=new Map;if(f?(f==="even"?(h.set("a",2),h.set("b",0)):f==="odd"&&(h.set("a",2),h.set("b",1)),o.indexOf("last")>-1&&h.set("reverse",!0)):(typeof a=="string"&&/-?\d+/.test(a)?h.set("a",a*1):h.set("a",0),typeof r=="string"&&/-?\d+/.test(r)?h.set("b",r*1):h.set("b",0),o.indexOf("last")>-1&&h.set("reverse",!0)),o==="nth-child"||o==="nth-last-child"){b&&h.set("selector",b);const i=Object.fromEntries(h);return this._collectNthChild(i,e,l)}else if(o==="nth-of-type"||o==="nth-last-of-type"){const i=Object.fromEntries(h);return this._collectNthOfType(i,e)}return new Set}_matchHasPseudoFunc(c,e,o){if(Array.isArray(c)&&c.length){const l=[...c],[a]=l,{type:r}=a;let f;r===n.COMBINATOR?f=l.shift():f={name:" ",type:n.COMBINATOR};const b=[];for(;l.length;){const[t]=l,{type:s}=t;if(s===n.COMBINATOR)break;b.push(l.shift())}const h={combo:f,leaves:b};o.dir=S;const i=this._matchCombinator(h,e,o);if(i.size){if(l.length){let t=!1;for(const s of i)if(t=this._matchHasPseudoFunc(l,s,o),t)break;return t}return!0}}return!1}_matchLogicalPseudoFunc(c,e,o){const{astName:l,branches:a,twigBranches:r}=c,f=(o.isShadowRoot||this.#h)&&e.nodeType===n.DOCUMENT_FRAGMENT_NODE;if(l==="has"){let b;for(const h of a)if(b=this._matchHasPseudoFunc(h,e,o),b)break;if(b)if(f){if(this.#N)return e}else return e}else{if(f){let i;for(const t of a)if(t.length>1){i=!0;break}else if(l==="not"){const[{type:s}]=t;if(s!==n.PS_CLASS_SELECTOR){i=!0;break}}if(i)return null}o.forgive=l==="is"||l==="where";const b=r.length;let h;for(let i=0;i<b;i++){const t=r[i],s=t.length-1,{leaves:d}=t[s];if(h=this._matchLeaves(d,e,o),h&&s>0){let m=new Set([e]);for(let u=s-1;u>=0;u--){const w=t[u],p=[];o.dir=x;for(const k of m){const _=this._matchCombinator(w,k,o);_.size&&p.push(..._)}if(p.length)u===0?h=!0:m=new Set(p);else{h=!1;break}}}if(h)break}if(l==="not")return h?null:e;if(h)return e}return null}_matchPseudoClassSelector(c,e,o){const{children:l,name:a}=c,{localName:r,parentNode:f}=e,{forgive:b,warn:h=this.#a}=o,i=new Set;if(Array.isArray(l)&&n.KEY_LOGICAL.includes(a)){if(!l.length&&a!=="is"&&a!=="where"){const d=(0,y.generateCSS)(c);throw new DOMException(`Invalid selector ${d}`,n.SYNTAX_ERR)}let t;if(this.#n.has(c))t=this.#n.get(c);else{const{branches:d}=(0,y.walkAST)(c);if(a==="has"){let m;for(const u of l){const w=(0,y.findAST)(u,p=>n.KEY_LOGICAL.includes(p.name)&&(0,y.findAST)(p,k=>k.name==="has")?p:null);if(w){const p=w.name;if(p==="is"||p==="where"){m=!0;break}else{const k=(0,y.generateCSS)(c);throw new DOMException(`Invalid selector ${k}`,n.SYNTAX_ERR)}}}if(m)return i;t={astName:a,branches:d}}else{const m=[];for(const[...u]of d){const w=[],p=new Set;let k=u.shift();for(;k;)if(k.type===n.COMBINATOR?(w.push({combo:k,leaves:[...p]}),p.clear()):k&&p.add(k),u.length)k=u.shift();else{w.push({combo:null,leaves:[...p]}),p.clear();break}m.push(w)}t={astName:a,branches:d,twigBranches:m},this.#o||this.#n.set(c,t)}}const s=this._matchLogicalPseudoFunc(t,e,o);s&&i.add(s)}else if(Array.isArray(l))if(/^nth-(?:last-)?(?:child|of-type)$/.test(a)){if(l.length!==1){const d=(0,y.generateCSS)(c);throw new DOMException(`Invalid selector ${d}`,n.SYNTAX_ERR)}const[t]=l;return this._matchAnPlusB(t,e,a,o)}else switch(a){case"dir":{if(l.length!==1){const d=(0,y.generateCSS)(c);throw new DOMException(`Invalid selector ${d}`,n.SYNTAX_ERR)}const[t]=l;(0,g.matchDirectionPseudoClass)(t,e)&&i.add(e);break}case"lang":{if(!l.length){const s=(0,y.generateCSS)(c);throw new DOMException(`Invalid selector ${s}`,n.SYNTAX_ERR)}let t;for(const s of l)if(t=(0,g.matchLanguagePseudoClass)(s,e),t)break;t&&i.add(e);break}case"state":{if((0,N.isCustomElement)(e)){const[{value:t}]=l;if(t)if(e[t])i.add(e);else for(const s in e){const d=e[s];if(d instanceof this.#l.ElementInternals){d?.states?.has(t)&&i.add(e);break}}}break}case"current":case"nth-col":case"nth-last-col":{if(h)throw new DOMException(`Unsupported pseudo-class :${a}()`,n.NOT_SUPPORTED_ERR);break}case"host":case"host-context":break;case"contains":{if(h)throw new DOMException(`Unknown pseudo-class :${a}()`,n.NOT_SUPPORTED_ERR);break}default:if(!b)throw new DOMException(`Unknown pseudo-class :${a}()`,n.SYNTAX_ERR)}else switch(a){case"any-link":case"link":{(r==="a"||r==="area")&&e.hasAttribute("href")&&i.add(e);break}case"local-link":{if((r==="a"||r==="area")&&e.hasAttribute("href")){const{href:t,origin:s,pathname:d}=new URL(this.#t.URL),m=new URL(e.getAttribute("href"),t);m.origin===s&&m.pathname===d&&i.add(e)}break}case"visited":break;case"hover":{const{target:t,type:s}=this.#c??{};/^(?:click|mouse(?:down|over|up))$/.test(s)&&e.contains(t)&&i.add(e);break}case"active":{const{buttons:t,target:s,type:d}=this.#c??{};d==="mousedown"&&t&n.BIT_01&&e.contains(s)&&i.add(e);break}case"target":{const{hash:t}=new URL(this.#t.URL);e.id&&t===`#${e.id}`&&this.#t.contains(e)&&i.add(e);break}case"target-within":{const{hash:t}=new URL(this.#t.URL);if(t){const s=t.replace(/^#/,"");let d=this.#t.getElementById(s);for(;d;){if(d===e){i.add(e);break}d=d.parentNode}}break}case"scope":{this.#e.nodeType===n.ELEMENT_NODE?!this.#h&&e===this.#e&&i.add(e):e===this.#t.documentElement&&i.add(e);break}case"focus":{e===this.#t.activeElement&&(0,N.isFocusableArea)(e)&&i.add(e);break}case"focus-visible":{if(e===this.#t.activeElement&&(0,N.isFocusableArea)(e)){let t;if((0,N.isFocusVisible)(e))t=!0;else if(this.#u){const{relatedTarget:s,target:d}=this.#u;if(d===e)if((0,N.isFocusVisible)(s))t=!0;else if(this.#c){const{key:m,target:u,type:w}=this.#c;u===s?(this.#r===null||d===this.#r)&&(t=!0):m==="Tab"?(w==="keydown"&&u!==e||w==="keyup"&&u===e)&&(u===d?(this.#r===null||u===this.#r&&s===null)&&(t=!0):t=!0):m&&(w==="keydown"||w==="keyup")&&u===e&&(t=!0)}else(s===null||s===this.#r)&&(t=!0)}t?(this.#r=e,i.add(e)):this.#r===e&&(this.#r=null)}break}case"focus-within":{let t,s=this.#t.activeElement;if((0,N.isFocusableArea)(s))for(;s;){if(s===e){t=!0;break}s=s.parentNode}t&&i.add(e);break}case"open":case"closed":{(r==="details"||r==="dialog")&&(e.hasAttribute("open")?a==="open"&&i.add(e):a==="closed"&&i.add(e));break}case"disabled":case"enabled":{if([...n.KEY_FORM_FOCUS,"fieldset","optgroup","option"].includes(r)||(0,N.isCustomElement)(e,{formAssociated:!0})){let s;if(e.disabled||e.hasAttribute("disabled"))s=!0;else if(e.localName==="option")f.localName==="optgroup"&&(f.disabled||f.hasAttribute("disabled"))&&(s=!0);else if(e.localName!=="optgroup"){let d=f;for(;d;)if(d.localName==="fieldset"&&(d.disabled||d.hasAttribute("disabled"))){let m=d.firstElementChild;for(;m&&m.localName!=="legend";)m=m.nextElementSibling;m&&m.contains(e)||(s=!0);break}else{if(d.localName==="form")break;if(d.parentNode?.nodeType===n.ELEMENT_NODE){if(d.parentNode.localName==="form")break;d=d.parentNode}else break}}s?a==="disabled"&&i.add(e):a==="enabled"&&i.add(e)}break}case"read-only":case"read-write":{let t,s;switch(r){case"textarea":{e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled")?t=!0:s=!0;break}case"input":{(!e.type||n.KEY_INPUT_EDIT.includes(e.type))&&(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled")?t=!0:s=!0);break}default:(0,N.isContentEditable)(e)?s=!0:t=!0}t?a==="read-only"&&i.add(e):a==="read-write"&&s&&i.add(e);break}case"placeholder-shown":{let t;if(e.placeholder?t=e.placeholder:e.hasAttribute("placeholder")&&(t=e.getAttribute("placeholder")),typeof t=="string"&&!/[\r\n]/.test(t)){let s;r==="textarea"?s=e:r==="input"&&(e.hasAttribute("type")?[...n.KEY_INPUT_TEXT,"number"].includes(e.getAttribute("type"))&&(s=e):s=e),s&&e.value===""&&i.add(e)}break}case"checked":{const t=e.getAttribute("type");(e.checked&&r==="input"&&(t==="checkbox"||t==="radio")||e.selected&&r==="option")&&i.add(e);break}case"indeterminate":{if(e.indeterminate&&r==="input"&&e.type==="checkbox"||r==="progress"&&!e.hasAttribute("value"))i.add(e);else if(r==="input"&&e.type==="radio"&&!e.hasAttribute("checked")){const t=e.name;let s=e.parentNode;for(;s&&s.localName!=="form";)s=s.parentNode;s||(s=this.#t.documentElement);const d=this._createTreeWalker(s);let m=(0,N.traverseNode)(s,d);m=d.firstChild();let u;for(;m&&!(m.localName==="input"&&m.getAttribute("type")==="radio"&&(m.hasAttribute("name")?m.getAttribute("name")===t&&(u=!!m.checked):u=!!m.checked,u));)m=d.nextNode();u||i.add(e)}break}case"default":{const t=["checkbox","radio"],s=["button","reset"],d=["image","submit"],m=e.getAttribute("type");if(r==="button"&&!(e.hasAttribute("type")&&s.includes(m))||r==="input"&&e.hasAttribute("type")&&d.includes(m)){let u=e.parentNode;for(;u&&u.localName!=="form";)u=u.parentNode;if(u){const w=this._createTreeWalker(u);let p=(0,N.traverseNode)(u,w);for(p=w.firstChild();p;){const k=p.localName,_=p.getAttribute("type");let v;if(k==="button"?v=!(p.hasAttribute("type")&&s.includes(_)):k==="input"&&(v=p.hasAttribute("type")&&d.includes(_)),v){p===e&&i.add(e);break}p=w.nextNode()}}}else(r==="input"&&e.hasAttribute("type")&&t.includes(m)&&e.hasAttribute("checked")||r==="option"&&e.hasAttribute("selected"))&&i.add(e);break}case"valid":case"invalid":{const t=[...n.KEY_FORM_FOCUS,"form"];if(t.includes(r)){let s;e.checkValidity()&&(e.maxLength>=0?e.maxLength>=e.value.length&&(s=!0):s=!0),s?a==="valid"&&i.add(e):a==="invalid"&&i.add(e)}else if(r==="fieldset"){const s=this._createTreeWalker(e);let d=(0,N.traverseNode)(e,s);d=s.firstChild();let m;if(!d)m=!0;else for(;d&&!(t.includes(d.localName)&&(d.checkValidity()?d.maxLength>=0?m=d.maxLength>=d.value.length:m=!0:m=!1,!m));)d=s.nextNode();m?a==="valid"&&i.add(e):a==="invalid"&&i.add(e)}break}case"in-range":case"out-of-range":{const t=[...n.KEY_INPUT_DATE,"number","range"],s=e.getAttribute("type");if(r==="input"&&!(e.readonly||e.hasAttribute("readonly"))&&!(e.disabled||e.hasAttribute("disabled"))&&t.includes(s)){const d=e.validity.rangeUnderflow||e.validity.rangeOverflow;(a==="out-of-range"&&d||a==="in-range"&&!d&&(e.hasAttribute("min")||e.hasAttribute("max")||s==="range"))&&i.add(e)}break}case"required":case"optional":{let t;if(r==="select"||r==="textarea")t=e;else if(r==="input")if(e.hasAttribute("type")){const s=[...n.KEY_INPUT_EDIT,"checkbox","file","radio"],d=e.getAttribute("type");s.includes(d)&&(t=e)}else t=e;t&&(e.required||e.hasAttribute("required")?a==="required"&&i.add(e):a==="optional"&&i.add(e));break}case"root":{e===this.#t.documentElement&&i.add(e);break}case"empty":{if(e.hasChildNodes()){const t=this._createTreeWalker(e,{force:!0,whatToShow:n.SHOW_ALL});let s=t.firstChild(),d;for(;s&&(d=s.nodeType!==n.ELEMENT_NODE&&s.nodeType!==n.TEXT_NODE,!!d);)s=t.nextSibling();d&&i.add(e)}else i.add(e);break}case"first-child":{(f&&e===f.firstElementChild||e===this.#s)&&i.add(e);break}case"last-child":{(f&&e===f.lastElementChild||e===this.#s)&&i.add(e);break}case"only-child":{(f&&e===f.firstElementChild&&e===f.lastElementChild||e===this.#s)&&i.add(e);break}case"first-of-type":{if(f){const[t]=this._collectNthOfType({a:0,b:1},e);t&&i.add(t)}else e===this.#s&&i.add(e);break}case"last-of-type":{if(f){const[t]=this._collectNthOfType({a:0,b:1,reverse:!0},e);t&&i.add(t)}else e===this.#s&&i.add(e);break}case"only-of-type":{if(f){const[t]=this._collectNthOfType({a:0,b:1},e);if(t===e){const[s]=this._collectNthOfType({a:0,b:1,reverse:!0},e);s===e&&i.add(e)}}else e===this.#s&&i.add(e);break}case"defined":{e.hasAttribute("is")||r.includes("-")?(0,N.isCustomElement)(e)&&i.add(e):(e instanceof this.#l.HTMLElement||e instanceof this.#l.SVGElement)&&i.add(e);break}case"popover-open":{e.popover&&(0,N.isVisible)(e)&&i.add(e);break}case"host":case"host-context":break;case"after":case"before":case"first-letter":case"first-line":{if(h)throw new DOMException(`Unsupported pseudo-element ::${a}`,n.NOT_SUPPORTED_ERR);break}case"autofill":case"blank":case"buffering":case"current":case"fullscreen":case"future":case"modal":case"muted":case"past":case"paused":case"picture-in-picture":case"playing":case"seeking":case"stalled":case"user-invalid":case"user-valid":case"volume-locked":case"-webkit-autofill":{if(h)throw new DOMException(`Unsupported pseudo-class :${a}`,n.NOT_SUPPORTED_ERR);break}default:if(a.startsWith("-webkit-")){if(h)throw new DOMException(`Unsupported pseudo-class :${a}`,n.NOT_SUPPORTED_ERR)}else if(!b)throw new DOMException(`Unknown pseudo-class :${a}`,n.SYNTAX_ERR)}return i}_matchShadowHostPseudoClass(c,e){const{children:o,name:l}=c;if(Array.isArray(o)){if(o.length!==1){const h=(0,y.generateCSS)(c);throw new DOMException(`Invalid selector ${h}`,n.SYNTAX_ERR)}const{branches:a}=(0,y.walkAST)(o[0]),[r]=a,[...f]=r,{host:b}=e;if(l==="host"){let h;for(const i of f){const{type:t}=i;if(t===n.COMBINATOR){const s=(0,y.generateCSS)(c);throw new DOMException(`Invalid selector ${s}`,n.SYNTAX_ERR)}if(h=this._matchSelector(i,b).has(b),!h)break}return h?e:null}else if(l==="host-context"){let h=b,i;for(;h;){for(const t of f){const{type:s}=t;if(s===n.COMBINATOR){const d=(0,y.generateCSS)(c);throw new DOMException(`Invalid selector ${d}`,n.SYNTAX_ERR)}if(i=this._matchSelector(t,h).has(h),!i)break}if(i)break;h=h.parentNode}return i?e:null}throw new DOMException(`Invalid selector :${l}`,n.SYNTAX_ERR)}else{if(l==="host")return e;throw new DOMException(`Invalid selector :${l}`,n.SYNTAX_ERR)}}_matchSelector(c,e,o={}){const{type:l}=c,a=(0,y.unescapeSelector)(c.name),r=new Set;if(e.nodeType===n.ELEMENT_NODE)switch(l){case n.ATTR_SELECTOR:{(0,g.matchAttributeSelector)(c,e)&&r.add(e);break}case n.ID_SELECTOR:{e.id===a&&r.add(e);break}case n.CLASS_SELECTOR:{e.classList.contains(a)&&r.add(e);break}case n.PS_CLASS_SELECTOR:return this._matchPseudoClassSelector(c,e,o);case n.TYPE_SELECTOR:{(0,g.matchTypeSelector)(c,e,o)&&r.add(e);break}case n.PS_ELEMENT_SELECTOR:default:(0,g.matchPseudoElementSelector)(a,l,o)}else if(this.#h&&l===n.PS_CLASS_SELECTOR&&e.nodeType===n.DOCUMENT_FRAGMENT_NODE){if(n.KEY_LOGICAL.includes(a))return o.isShadowRoot=!0,this._matchPseudoClassSelector(c,e,o);if(a==="host"||a==="host-context"){const f=this._matchShadowHostPseudoClass(c,e,o);f&&(this.#N=!0,r.add(f))}}return r}_matchLeaves(c,e,o){let l;if(this.#o?l=this.#b.get(c):l=this.#k.get(c),l&&l.has(e)){const{matched:a}=l.get(e);return a}else{let a=!0;const r=[...n.KEY_FORM_FOCUS,"fieldset","form"],f=["any-link","defined","dir","link"];e.nodeType===n.ELEMENT_NODE&&r.includes(e.localName)&&(a=!1);let b;for(const h of c){switch(h.type){case n.ATTR_SELECTOR:case n.ID_SELECTOR:{a=!1;break}case n.PS_CLASS_SELECTOR:{f.includes(h.name)&&(a=!1);break}default:}if(b=this._matchSelector(h,e,o).has(e),!b)break}return a&&(l||(l=new WeakMap),l.set(e,{matched:b}),this.#o?this.#b.set(c,l):this.#k.set(c,l)),b}}_findDescendantNodes(c,e,o){const[l,...a]=c,r=a.length>0,{type:f}=l,b=(0,y.unescapeSelector)(l.name),h=new Set;let i=!1;if(this.#h||e.nodeType!==n.ELEMENT_NODE)i=!0;else switch(f){case n.PS_ELEMENT_SELECTOR:{(0,g.matchPseudoElementSelector)(b,f,o);break}case n.ID_SELECTOR:{if(this.#s.nodeType===n.ELEMENT_NODE)i=!0;else{const t=this.#s.getElementById(b);t&&t!==e&&e.contains(t)&&(r?this._matchLeaves(a,t,o)&&h.add(t):h.add(t))}break}default:i=!0}if(i){const t=this._createTreeWalker(e);let s=(0,N.traverseNode)(e,t);for(s=t.firstChild();s;)this._matchLeaves(c,s,o)&&h.add(s),s=t.nextNode()}return h}_matchCombinator(c,e,o){const{combo:l,leaves:a}=c,{name:r}=l,{parentNode:f}=e,{dir:b}=o,h=new Set;if(b===S)switch(r){case"+":{const i=e.nextElementSibling;i&&this._matchLeaves(a,i,o)&&h.add(i);break}case"~":{if(f){let i=e.nextElementSibling;for(;i;)this._matchLeaves(a,i,o)&&h.add(i),i=i.nextElementSibling}break}case">":{let i=e.firstElementChild;for(;i;)this._matchLeaves(a,i,o)&&h.add(i),i=i.nextElementSibling;break}case" ":default:{const i=this._findDescendantNodes(a,e,o);if(i.size)return i}}else switch(r){case"+":{const i=e.previousElementSibling;i&&this._matchLeaves(a,i,o)&&h.add(i);break}case"~":{if(f){let i=f.firstElementChild;for(;i&&i!==e;)this._matchLeaves(a,i,o)&&h.add(i),i=i.nextElementSibling}break}case">":{f&&this._matchLeaves(a,f,o)&&h.add(f);break}case" ":default:{const i=[];let t=f;for(;t;)this._matchLeaves(a,t,o)&&i.push(t),t=t.parentNode;if(i.length)return new Set(i.reverse())}}return h}_findWalker(c,e,o={}){const{force:l,targetType:a}=o,r=this.#m,f=[];let b=(0,N.traverseNode)(e,r,!!l);if(b)for((b.nodeType!==n.ELEMENT_NODE||b===e&&b!==this.#s)&&(b=r.nextNode());b&&!(this._matchLeaves(c,b,{warn:this.#a})&&(f.push(b),a!==n.TARGET_ALL));)b=r.nextNode();return f}_matchSelf(c){const e=[];let o=!1;return this._matchLeaves(c,this.#e,{warn:this.#a})&&(e.push(this.#e),o=!0),[e,o]}_findLineal(c,e){const{complex:o}=e,l=[];let a=!1,r=this._matchLeaves(c,this.#e,{warn:this.#a});if(r&&(l.push(this.#e),a=!0),!r||o){let f=this.#e.parentNode;for(;f&&(r=this._matchLeaves(c,f,{warn:this.#a}),r&&(l.push(f),a=!0),f.parentNode);)f=f.parentNode}return[l,a]}_findEntryNodes(c,e,o){const{leaves:l}=c,[a,...r]=l,f=r.length>0,{name:b,type:h}=a;let i=[],t=!1,s=!1;switch(h){case n.PS_ELEMENT_SELECTOR:{(0,g.matchPseudoElementSelector)(b,h,{warn:this.#a});break}case n.ID_SELECTOR:{if(e===n.TARGET_SELF)[i,t]=this._matchSelf(l);else if(e===n.TARGET_LINEAL)[i,t]=this._findLineal(l,{complex:o});else if(e===n.TARGET_FIRST&&this.#s.nodeType!==n.ELEMENT_NODE){const d=this.#s.getElementById(b);d&&(f?this._matchLeaves(r,d,{warn:this.#a})&&(i.push(d),t=!0):(i.push(d),t=!0))}else i=this._findWalker(l,this.#e,{targetType:e}),i.length&&(t=!0);break}case n.CLASS_SELECTOR:{e===n.TARGET_SELF?[i,t]=this._matchSelf(l):e===n.TARGET_LINEAL?[i,t]=this._findLineal(l,{complex:o}):(i=this._findWalker(l,this.#e,{targetType:e}),i.length&&(t=!0));break}case n.TYPE_SELECTOR:{e===n.TARGET_SELF?[i,t]=this._matchSelf(l):e===n.TARGET_LINEAL?[i,t]=this._findLineal(l,{complex:o}):(i=this._findWalker(l,this.#e,{targetType:e}),i.length&&(t=!0));break}default:if(e!==n.TARGET_LINEAL&&(b==="host"||b==="host-context")){let d;if(this.#h&&this.#e.nodeType===n.DOCUMENT_FRAGMENT_NODE?d=this._matchShadowHostPseudoClass(a,this.#e):f&&this.#e.nodeType===n.ELEMENT_NODE&&(d=this._matchShadowHostPseudoClass(a,this.#e.shadowRoot)),d){let m;if(f){for(const u of r)if(/^host(?:-context)?$/.test(u.name)?m=this._matchShadowHostPseudoClass(u,d)===d:u.name==="has"?m=this._matchPseudoClassSelector(u,d,{}).has(d):m=!1,!m)break}else m=!0;m&&(i.push(d),t=!0)}}else e===n.TARGET_SELF?[i,t]=this._matchSelf(l):e===n.TARGET_LINEAL?[i,t]=this._findLineal(l,{complex:o}):e===n.TARGET_FIRST?(i=this._findWalker(l,this.#e,{targetType:e}),i.length&&(t=!0)):s=!0}return{compound:f,filtered:t,nodes:i,pending:s}}_collectNodes(c){const e=this.#i.values();if(c===n.TARGET_ALL||c===n.TARGET_FIRST){const o=new Set;let l=0;for(const{branch:a}of e){const r=a.length,f=r>1,b=a[0];let h,i;if(f){const{combo:u,leaves:[{name:w,type:p}]}=b,k=a[r-1],{leaves:[{name:_,type:v}]}=k;if(h=S,i=b,this.#y.includes(":scope")||v===n.PS_ELEMENT_SELECTOR||v===n.ID_SELECTOR)h=x,i=k;else if(w==="*"&&p===n.TYPE_SELECTOR)h=x,i=k;else if(_==="*"&&v===n.TYPE_SELECTOR)h=S,i=b;else if(r===2){const{name:C}=u;(C==="+"||C==="~")&&(h=x,i=k)}}else h=x,i=b;const{compound:t,filtered:s,nodes:d,pending:m}=this._findEntryNodes(i,c,f);d.length?(this.#i[l].find=!0,this.#d[l]=d):m&&o.add(new Map([["index",l],["twig",i]])),this.#i[l].dir=h,this.#i[l].filtered=s||!t,l++}if(o.size){let a,r;this.#e!==this.#s&&this.#e.nodeType===n.ELEMENT_NODE?(a=this.#e,r=this.#m):(a=this.#s,r=this._createTreeWalker(a));let f=(0,N.traverseNode)(a,r);for(;f;){let b=!1;if(this.#e.nodeType===n.ELEMENT_NODE?f===this.#e?b=!0:b=this.#e.contains(f):b=!0,b)for(const h of o){const{leaves:i}=h.get("twig");if(this._matchLeaves(i,f,{warn:this.#a})){const s=h.get("index");this.#i[s].filtered=!0,this.#i[s].find=!0,this.#d[s].push(f)}}f!==r.currentNode&&(f=(0,N.traverseNode)(f,r)),f=r.nextNode()}}}else{let o=0;for(const{branch:l}of e){const a=l[l.length-1],r=l.length>1,{compound:f,filtered:b,nodes:h}=this._findEntryNodes(a,c,r);h.length&&(this.#i[o].find=!0,this.#d[o]=h),this.#i[o].dir=x,this.#i[o].filtered=b||!f,o++}}return[this.#i,this.#d]}_getCombinedNodes(c,e,o){const l=[];for(const a of e){const r=this._matchCombinator(c,a,{dir:o,warn:this.#a});r.size&&l.push(...r)}return l.length?new Set(l):new Set}_matchNodeNext(c,e,o){const{combo:l,index:a}=o,{combo:r,leaves:f}=c[a],b={combo:l,leaves:f},h=this._getCombinedNodes(b,e,S);if(h.size)if(a===c.length-1){const[i]=(0,N.sortNodes)(h);return i}else return this._matchNodeNext(c,h,{combo:r,index:a+1});return null}_matchNodePrev(c,e,o){const{index:l}=o,a=c[l],r=new Set([e]),f=this._getCombinedNodes(a,r,x);if(f.size){if(l===0)return e;{let b;for(const h of f)if(b=this._matchNodePrev(c,h,{index:l-1}),b)break;if(b)return e}}return null}find(c){(c===n.TARGET_ALL||c===n.TARGET_FIRST)&&this._prepareQuerySelectorWalker();const[[...e],o]=this._collectNodes(c),l=e.length;let a,r=new Set;for(let f=0;f<l;f++){const{branch:b,dir:h,find:i}=e[f],t=b.length;if(t&&i){const s=o[f],d=s.length,m=t-1;if(m===0)if((c===n.TARGET_ALL||c===n.TARGET_FIRST)&&this.#e.nodeType===n.ELEMENT_NODE)for(let u=0;u<d;u++){const w=s[u];if(w!==this.#e&&this.#e.contains(w)&&(r.add(w),c===n.TARGET_FIRST))break}else if(c===n.TARGET_ALL)if(r.size){const u=[...r];r=new Set([...u,...s]),a=!0}else r=new Set(s);else{const[u]=s;r.add(u)}else if(c===n.TARGET_ALL)if(h===S){const{combo:u}=b[0];let w=u;for(const p of s){let k=new Set([p]);for(let _=1;_<t;_++){const{combo:v,leaves:C}=b[_],A={combo:w,leaves:C};if(k=this._getCombinedNodes(A,k,h),k.size)if(_===m)if(r.size){const T=[...r];r=new Set([...T,...k]),a=!0,w=u}else r=k,w=u;else w=v;else break}}}else for(const u of s){let w=new Set([u]);for(let p=m-1;p>=0;p--){const k=b[p];if(w=this._getCombinedNodes(k,w,h),w.size)p===0&&(r.add(u),t>1&&r.size>1&&(a=!0));else break}}else if(c===n.TARGET_FIRST&&h===S){const{combo:u}=b[0];let w;for(const p of s)if(w=this._matchNodeNext(b,new Set([p]),{combo:u,index:1}),w){r.add(w);break}if(!w){const{leaves:p}=b[0],[k]=s;let[_]=this._findWalker(p,k,{targetType:c});for(;_;){if(w=this._matchNodeNext(b,new Set([_]),{combo:u,index:1}),w){r.add(w);break}[_]=this._findWalker(p,_,{targetType:c,force:!0})}}}else{let u;for(const w of s)if(u=this._matchNodePrev(b,w,{index:m-1}),u){r.add(w);break}if(!u&&c===n.TARGET_FIRST){const{leaves:w}=b[m],[p]=s;let[k]=this._findWalker(w,p,{targetType:c});for(;k;){if(u=this._matchNodePrev(b,k,{index:m-1}),u){r.add(k);break}[k]=this._findWalker(w,k,{targetType:c,force:!0})}}}}}return c===n.TARGET_FIRST?(r.delete(this.#e),r.size>1&&(r=new Set((0,N.sortNodes)(r)))):c===n.TARGET_ALL&&(r.delete(this.#e),a&&r.size>1&&(r=new Set((0,N.sortNodes)(r)))),r}}0&&(module.exports={Finder});
2
2
  //# sourceMappingURL=finder.js.map