Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@asamuzakjp/dom-selector

Package Overview
Dependencies
Maintainers
1
Versions
191
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@asamuzakjp/dom-selector - npm Package Compare versions

Comparing version 4.6.1 to 4.6.3

2

dist/cjs/js/constant.js

@@ -1,2 +0,2 @@

var $=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var w=(e,t)=>{for(var c in t)$(e,c,{get:t[c],enumerable:!0})},X=(e,t,c,P)=>{if(t&&typeof t=="object"||typeof t=="function")for(let E of f(t))!m.call(e,E)&&E!==c&&$(e,E,{get:()=>t[E],enumerable:!(P=H(t,E))||P.enumerable});return e};var g=e=>X($({},"__esModule",{value:!0}),e);var eo={};w(eo,{ALPHA_NUM:()=>T,ANB:()=>l,AN_PLUS_B:()=>h,BIT_01:()=>rt,BIT_02:()=>Et,BIT_04:()=>nt,BIT_08:()=>_t,BIT_16:()=>pt,BIT_32:()=>ct,BIT_FFFF:()=>xt,BIT_HYPHEN:()=>Ot,CHILD_IDX:()=>M,COMBINATOR:()=>b,COMBO_A:()=>O,COMBO_B:()=>C,COMPLEX_A:()=>L,COMPLEX_B:()=>A,COMPLEX_C:()=>G,COMPLEX_D:()=>D,COMPOUND:()=>s,COMPOUND_A:()=>N,COMPOUND_B:()=>S,COMPOUND_C:()=>I,COMPOUND_I:()=>B,DIGIT:()=>x,DOCUMENT_FRAGMENT_NODE:()=>St,DOCUMENT_NODE:()=>Nt,DOCUMENT_POSITION_CONTAINED_BY:()=>Dt,DOCUMENT_POSITION_CONTAINS:()=>Gt,DOCUMENT_POSITION_PRECEDING:()=>It,DUO:()=>$t,ELEMENT_NODE:()=>Lt,EMPTY:()=>W,HEX:()=>Tt,IDENTIFIER:()=>y,LANG_PART:()=>i,LOGICAL_COMPLEX_A:()=>F,LOGICAL_COMPLEX_B:()=>Y,LOGICAL_COMPOUND:()=>u,LOGICAL_KEY:()=>p,NESTED_LOGICAL_A:()=>a,NESTED_LOGICAL_B:()=>U,NESTED_LOGICAL_C:()=>d,NOT_SUPPORTED_ERR:()=>k,NTH:()=>K,N_TH:()=>_,PSEUDO_CLASSES:()=>n,RAW:()=>Z,REG_ANCHOR:()=>Ut,REG_CHILD_INDEXED:()=>dt,REG_COMPLEX:()=>Bt,REG_DIR:()=>Ft,REG_FORM:()=>Yt,REG_FORM_CTRL:()=>ut,REG_FORM_GROUP:()=>Ht,REG_FORM_VALID:()=>ft,REG_HEX:()=>mt,REG_INTERACT:()=>wt,REG_INVALID_SELECTOR:()=>Xt,REG_LANG:()=>gt,REG_LANG_QUOTED:()=>ht,REG_LOGICAL_COMPLEX_A:()=>bt,REG_LOGICAL_COMPLEX_B:()=>Wt,REG_LOGICAL_COMPOUND:()=>yt,REG_LOGICAL_EMPTY:()=>kt,REG_LOGICAL_KEY:()=>Kt,REG_LOGICAL_PSEUDO:()=>Zt,REG_SHADOW_HOST:()=>vt,REG_SHADOW_MODE:()=>zt,REG_SHADOW_PSEUDO:()=>Vt,REG_TYPE_CHECK:()=>Qt,REG_TYPE_DATE:()=>jt,REG_TYPE_RANGE:()=>qt,REG_TYPE_RESET:()=>Jt,REG_TYPE_SUBMIT:()=>to,REG_TYPE_TEXT:()=>oo,SELECTOR:()=>v,SELECTOR_ATTR:()=>z,SELECTOR_CLASS:()=>V,SELECTOR_ID:()=>Q,SELECTOR_LIST:()=>j,SELECTOR_PSEUDO_CLASS:()=>q,SELECTOR_PSEUDO_ELEMENT:()=>J,SELECTOR_TYPE:()=>tt,SHOW_ALL:()=>Pt,SHOW_DOCUMENT:()=>Mt,SHOW_DOCUMENT_FRAGMENT:()=>it,SHOW_ELEMENT:()=>lt,STRING:()=>ot,SUB_TYPE:()=>r,SYNTAX_ERR:()=>et,TAG_TYPE:()=>o,TAG_TYPE_I:()=>R,TEXT_NODE:()=>At,TYPE_FROM:()=>Rt,TYPE_TO:()=>Ct,U_FFFD:()=>st,WALKER_FILTER:()=>at});module.exports=g(eo);const h="AnPlusB",b="Combinator",W="__EMPTY__",y="Identifier",k="NotSupportedError",K="Nth",Z="Raw",v="Selector",z="AttributeSelector",V="ClassSelector",Q="IdSelector",j="SelectorList",q="PseudoClassSelector",J="PseudoElementSelector",tt="TypeSelector",ot="String",et="SyntaxError",st="\uFFFD",rt=1,Et=2,nt=4,_t=8,pt=16,ct=32,xt=65535,Ot=45,$t=2,Tt=16,Rt=8,Ct=-1,Lt=1,At=3,Nt=9,St=11,It=2,Gt=8,Dt=16,Pt=4294967295,Mt=256,it=1024,lt=1,at=1281,T="[A-Z\\d]+",M="(?:first|last|only)-(?:child|of-type)",x="(?:0|[1-9]\\d*)",i=`(?:-${T})*`,n=`(?:any-)?link|${M}|checked|empty|indeterminate|root|target|visited`,l=`[+-]?(?:${x}n?|n)|(?:[+-]?${x})?n\\s*[+-]\\s*${x}`,_=`nth-(?:last-)?(?:child|of-type)\\(\\s*(?:even|odd|${l})\\s*\\)`,r="\\[[^|\\]]+\\]|[#.:][\\w-]+",o="\\*|[A-Za-z][\\w-]*",R="\\*|[A-Z][\\w-]*",p="(?:is|not)",s=`(?:${o}|(?:${o})?(?:${r})+)`,O="\\s?[\\s>~+]\\s?",C="\\s?[~+]\\s?",L=`${s}(?:${O}${s})*`,A=`${s}(?:${C}${s})*`,a=`:is\\(\\s*${s}(?:\\s*,\\s*${s})*\\s*\\)`,U=`:is\\(\\s*${L}(?:\\s*,\\s*${L})*\\s*\\)`,d=`:is\\(\\s*${A}(?:\\s*,\\s*${A})*\\s*\\)`,N=`(?:${o}|(?:${o})?(?:${r}|${a})+)`,S=`(?:${o}|(?:${o})?(?:${r}|${U})+)`,I=`(?:${o}|(?:${o})?(?:${r}|${d})+)`,B=`(?:${R}|(?:${R})?(?:${r})+)`,G=`${S}(?:${O}${S})*`,D=`${I}(?:${C}${I})*`,F=`${p}\\(\\s*${G}(?:\\s*,\\s*${G})*\\s*\\)`,Y=`${p}\\(\\s*${D}(?:\\s*,\\s*${D})*\\s*\\)`,u=`${p}\\(\\s*${N}(?:\\s*,\\s*${N})*\\s*\\)`,Ut=/^a(?:rea)?$/,dt=new RegExp(`:(?!${n}|${_})`),Bt=new RegExp(`${O}${B}`,"i"),Ft=/^(?:ltr|rtl)$/,Yt=/^(?:(?:fieldse|inpu|selec)t|button|form|textarea)$/,ut=/^(?:button|fieldset|input|optgroup|option|select|textarea)$/,Ht=/^(?:fieldset|optgroup|select)$/,ft=/^(?:button|form|input|select|textarea)$/,mt=/^([\da-f]{1,6}\s?)/i,wt=/^(?:details|dialog)$/,Xt=/^$|^\s*>|,\s*$/,gt=new RegExp(`^(?:\\*-)?${T}${i}$`,"i"),ht=/(:lang\(\s*("[A-Za-z\d\-*]*")\s*\))/,bt=new RegExp(`:(?!${n}|${_}|${F})`),Wt=new RegExp(`:(?!${n}|${_}|${Y})`),yt=new RegExp(`:(?!${n}|${_}|${u})`),kt=/(:(is|where)\(\s*\))/,Kt=new RegExp(`:${p}\\(`),Zt=/^(?:has|is|not|where)$/,vt=/^host(?:-context)?$/,zt=/^(?:close|open)$/,Vt=/^part|slotted$/,Qt=/^(?:checkbox|radio)$/,jt=/^(?:date(?:time-local)?|month|time|week)$/,qt=/(?:date(?:time-local)?|month|number|range|time|week)$/,Jt=/^(?:button|reset)$/,to=/^(?:image|submit)$/,oo=/^(?:email|number|password|search|tel|text|url)$/;0&&(module.exports={ALPHA_NUM,ANB,AN_PLUS_B,BIT_01,BIT_02,BIT_04,BIT_08,BIT_16,BIT_32,BIT_FFFF,BIT_HYPHEN,CHILD_IDX,COMBINATOR,COMBO_A,COMBO_B,COMPLEX_A,COMPLEX_B,COMPLEX_C,COMPLEX_D,COMPOUND,COMPOUND_A,COMPOUND_B,COMPOUND_C,COMPOUND_I,DIGIT,DOCUMENT_FRAGMENT_NODE,DOCUMENT_NODE,DOCUMENT_POSITION_CONTAINED_BY,DOCUMENT_POSITION_CONTAINS,DOCUMENT_POSITION_PRECEDING,DUO,ELEMENT_NODE,EMPTY,HEX,IDENTIFIER,LANG_PART,LOGICAL_COMPLEX_A,LOGICAL_COMPLEX_B,LOGICAL_COMPOUND,LOGICAL_KEY,NESTED_LOGICAL_A,NESTED_LOGICAL_B,NESTED_LOGICAL_C,NOT_SUPPORTED_ERR,NTH,N_TH,PSEUDO_CLASSES,RAW,REG_ANCHOR,REG_CHILD_INDEXED,REG_COMPLEX,REG_DIR,REG_FORM,REG_FORM_CTRL,REG_FORM_GROUP,REG_FORM_VALID,REG_HEX,REG_INTERACT,REG_INVALID_SELECTOR,REG_LANG,REG_LANG_QUOTED,REG_LOGICAL_COMPLEX_A,REG_LOGICAL_COMPLEX_B,REG_LOGICAL_COMPOUND,REG_LOGICAL_EMPTY,REG_LOGICAL_KEY,REG_LOGICAL_PSEUDO,REG_SHADOW_HOST,REG_SHADOW_MODE,REG_SHADOW_PSEUDO,REG_TYPE_CHECK,REG_TYPE_DATE,REG_TYPE_RANGE,REG_TYPE_RESET,REG_TYPE_SUBMIT,REG_TYPE_TEXT,SELECTOR,SELECTOR_ATTR,SELECTOR_CLASS,SELECTOR_ID,SELECTOR_LIST,SELECTOR_PSEUDO_CLASS,SELECTOR_PSEUDO_ELEMENT,SELECTOR_TYPE,SHOW_ALL,SHOW_DOCUMENT,SHOW_DOCUMENT_FRAGMENT,SHOW_ELEMENT,STRING,SUB_TYPE,SYNTAX_ERR,TAG_TYPE,TAG_TYPE_I,TEXT_NODE,TYPE_FROM,TYPE_TO,U_FFFD,WALKER_FILTER});
var T=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var Y=(o,t)=>{for(var n in t)T(o,n,{get:t[n],enumerable:!0})},u=(o,t,n,I)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of U(t))!d.call(o,s)&&s!==n&&T(o,s,{get:()=>t[s],enumerable:!(I=F(t,s))||I.enumerable});return o};var H=o=>u(T({},"__esModule",{value:!0}),o);var Vt={};Y(Vt,{ALPHA_NUM:()=>R,ANB:()=>D,AN_PLUS_B:()=>B,BIT_01:()=>q,BIT_02:()=>J,BIT_04:()=>tt,BIT_08:()=>ot,BIT_16:()=>et,BIT_32:()=>st,BIT_FFFF:()=>rt,BIT_HYPHEN:()=>Et,CHILD_IDX:()=>A,COMBINATOR:()=>m,COMBO:()=>O,COMPLEX:()=>L,COMPLEX_L:()=>N,COMPOUND:()=>E,COMPOUND_A:()=>C,COMPOUND_B:()=>S,COMPOUND_I:()=>l,DIGIT:()=>c,DOCUMENT_FRAGMENT_NODE:()=>Rt,DOCUMENT_NODE:()=>Tt,DOCUMENT_POSITION_CONTAINED_BY:()=>Ct,DOCUMENT_POSITION_CONTAINS:()=>Lt,DOCUMENT_POSITION_PRECEDING:()=>$t,DUO:()=>nt,ELEMENT_NODE:()=>xt,EMPTY:()=>w,HEX:()=>ct,IDENTIFIER:()=>g,LANG_PART:()=>G,LOGICAL_COMPLEX:()=>a,LOGICAL_COMPOUND:()=>M,LOGICAL_KEY:()=>x,NESTED_LOGICAL_A:()=>P,NESTED_LOGICAL_B:()=>i,NOT_SUPPORTED_ERR:()=>h,NTH:()=>X,N_TH:()=>_,PSEUDO_CLASSES:()=>p,RAW:()=>b,REG_ANCHOR:()=>Dt,REG_CHILD_INDEXED:()=>Pt,REG_COMPLEX:()=>it,REG_DIR:()=>lt,REG_FORM:()=>at,REG_FORM_CTRL:()=>Mt,REG_FORM_GROUP:()=>Ft,REG_FORM_VALID:()=>Ut,REG_HEX:()=>dt,REG_INTERACT:()=>Yt,REG_INVALID_SELECTOR:()=>ut,REG_LANG:()=>Ht,REG_LANG_QUOTED:()=>Bt,REG_LOGICAL_COMPLEX:()=>mt,REG_LOGICAL_COMPOUND:()=>wt,REG_LOGICAL_EMPTY:()=>gt,REG_LOGICAL_KEY:()=>ht,REG_LOGICAL_PSEUDO:()=>Xt,REG_SHADOW_HOST:()=>bt,REG_SHADOW_MODE:()=>ft,REG_SHADOW_PSEUDO:()=>Wt,REG_TYPE_CHECK:()=>yt,REG_TYPE_DATE:()=>kt,REG_TYPE_RANGE:()=>Kt,REG_TYPE_RESET:()=>Zt,REG_TYPE_SUBMIT:()=>vt,REG_TYPE_TEXT:()=>zt,SELECTOR:()=>f,SELECTOR_ATTR:()=>W,SELECTOR_CLASS:()=>y,SELECTOR_ID:()=>k,SELECTOR_LIST:()=>K,SELECTOR_PSEUDO_CLASS:()=>Z,SELECTOR_PSEUDO_ELEMENT:()=>v,SELECTOR_TYPE:()=>z,SHOW_ALL:()=>St,SHOW_DOCUMENT:()=>Nt,SHOW_DOCUMENT_FRAGMENT:()=>It,SHOW_ELEMENT:()=>At,STRING:()=>V,SUB_TYPE:()=>r,SYNTAX_ERR:()=>Q,TAG_TYPE:()=>e,TAG_TYPE_I:()=>$,TEXT_NODE:()=>Ot,TYPE_FROM:()=>pt,TYPE_TO:()=>_t,U_FFFD:()=>j,WALKER_FILTER:()=>Gt});module.exports=H(Vt);const B="AnPlusB",m="Combinator",w="__EMPTY__",g="Identifier",h="NotSupportedError",X="Nth",b="Raw",f="Selector",W="AttributeSelector",y="ClassSelector",k="IdSelector",K="SelectorList",Z="PseudoClassSelector",v="PseudoElementSelector",z="TypeSelector",V="String",Q="SyntaxError",j="\uFFFD",q=1,J=2,tt=4,ot=8,et=16,st=32,rt=65535,Et=45,nt=2,ct=16,pt=8,_t=-1,xt=1,Ot=3,Tt=9,Rt=11,$t=2,Lt=8,Ct=16,St=4294967295,Nt=256,It=1024,At=1,Gt=1281,R="[A-Z\\d]+",A="(?:first|last|only)-(?:child|of-type)",c="(?:0|[1-9]\\d*)",G=`(?:-${R})*`,p=`(?:any-)?link|${A}|checked|empty|indeterminate|root|target|visited`,D=`[+-]?(?:${c}n?|n)|(?:[+-]?${c})?n\\s*[+-]\\s*${c}`,_=`nth-(?:last-)?(?:child|of-type)\\(\\s*(?:even|odd|${D})\\s*\\)`,r="\\[[^|\\]]+\\]|[#.:][\\w-]+",e="\\*|[A-Za-z][\\w-]*",$="\\*|[A-Z][\\w-]*",x="(?:is|not)",E=`(?:${e}|(?:${e})?(?:${r})+)`,O="\\s?[\\s>~+]\\s?",L=`${E}(?:${O}${E})*`,P=`:is\\(\\s*${E}(?:\\s*,\\s*${E})*\\s*\\)`,i=`:is\\(\\s*${L}(?:\\s*,\\s*${L})*\\s*\\)`,C=`(?:${e}|(?:${e})?(?:${r}|${P})+)`,S=`(?:${e}|(?:${e})?(?:${r}|${i})+)`,l=`(?:${$}|(?:${$})?(?:${r})+)`,N=`${S}(?:${O}${S})*`,a=`${x}\\(\\s*${N}(?:\\s*,\\s*${N})*\\s*\\)`,M=`${x}\\(\\s*${C}(?:\\s*,\\s*${C})*\\s*\\)`,Dt=/^a(?:rea)?$/,Pt=new RegExp(`:(?!${p}|${_})`),it=new RegExp(`${O}${l}`,"i"),lt=/^(?:ltr|rtl)$/,at=/^(?:(?:fieldse|inpu|selec)t|button|form|textarea)$/,Mt=/^(?:button|fieldset|input|optgroup|option|select|textarea)$/,Ft=/^(?:fieldset|optgroup|select)$/,Ut=/^(?:button|form|input|select|textarea)$/,dt=/^([\da-f]{1,6}\s?)/i,Yt=/^(?:details|dialog)$/,ut=/^$|^\s*>|,\s*$/,Ht=new RegExp(`^(?:\\*-)?${R}${G}$`,"i"),Bt=/(:lang\(\s*("[A-Za-z\d\-*]*")\s*\))/,mt=new RegExp(`:(?!${p}|${_}|${a})`),wt=new RegExp(`:(?!${p}|${_}|${M})`),gt=/(:(is|where)\(\s*\))/,ht=new RegExp(`:${x}\\(`),Xt=/^(?:has|is|not|where)$/,bt=/^host(?:-context)?$/,ft=/^(?:close|open)$/,Wt=/^part|slotted$/,yt=/^(?:checkbox|radio)$/,kt=/^(?:date(?:time-local)?|month|time|week)$/,Kt=/(?:date(?:time-local)?|month|number|range|time|week)$/,Zt=/^(?:button|reset)$/,vt=/^(?:image|submit)$/,zt=/^(?:email|number|password|search|tel|text|url)$/;0&&(module.exports={ALPHA_NUM,ANB,AN_PLUS_B,BIT_01,BIT_02,BIT_04,BIT_08,BIT_16,BIT_32,BIT_FFFF,BIT_HYPHEN,CHILD_IDX,COMBINATOR,COMBO,COMPLEX,COMPLEX_L,COMPOUND,COMPOUND_A,COMPOUND_B,COMPOUND_I,DIGIT,DOCUMENT_FRAGMENT_NODE,DOCUMENT_NODE,DOCUMENT_POSITION_CONTAINED_BY,DOCUMENT_POSITION_CONTAINS,DOCUMENT_POSITION_PRECEDING,DUO,ELEMENT_NODE,EMPTY,HEX,IDENTIFIER,LANG_PART,LOGICAL_COMPLEX,LOGICAL_COMPOUND,LOGICAL_KEY,NESTED_LOGICAL_A,NESTED_LOGICAL_B,NOT_SUPPORTED_ERR,NTH,N_TH,PSEUDO_CLASSES,RAW,REG_ANCHOR,REG_CHILD_INDEXED,REG_COMPLEX,REG_DIR,REG_FORM,REG_FORM_CTRL,REG_FORM_GROUP,REG_FORM_VALID,REG_HEX,REG_INTERACT,REG_INVALID_SELECTOR,REG_LANG,REG_LANG_QUOTED,REG_LOGICAL_COMPLEX,REG_LOGICAL_COMPOUND,REG_LOGICAL_EMPTY,REG_LOGICAL_KEY,REG_LOGICAL_PSEUDO,REG_SHADOW_HOST,REG_SHADOW_MODE,REG_SHADOW_PSEUDO,REG_TYPE_CHECK,REG_TYPE_DATE,REG_TYPE_RANGE,REG_TYPE_RESET,REG_TYPE_SUBMIT,REG_TYPE_TEXT,SELECTOR,SELECTOR_ATTR,SELECTOR_CLASS,SELECTOR_ID,SELECTOR_LIST,SELECTOR_PSEUDO_CLASS,SELECTOR_PSEUDO_ELEMENT,SELECTOR_TYPE,SHOW_ALL,SHOW_DOCUMENT,SHOW_DOCUMENT_FRAGMENT,SHOW_ELEMENT,STRING,SUB_TYPE,SYNTAX_ERR,TAG_TYPE,TAG_TYPE_I,TEXT_NODE,TYPE_FROM,TYPE_TO,U_FFFD,WALKER_FILTER});
//# sourceMappingURL=constant.js.map

@@ -1,2 +0,2 @@

var z=Object.create;var M=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var B=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty;var Y=(g,l)=>{for(var e in l)M(g,e,{get:l[e],enumerable:!0})},P=(g,l,e,h)=>{if(l&&typeof l=="object"||typeof l=="function")for(let r of W(l))!j.call(g,r)&&r!==e&&M(g,r,{get:()=>l[r],enumerable:!(h=H(l,r))||h.enumerable});return g};var q=(g,l,e)=>(e=g!=null?z(B(g)):{},P(l||!g||!g.__esModule?M(e,"default",{value:g,enumerable:!0}):e,g)),V=g=>P(M({},"__esModule",{value:!0}),g);var K={};Y(K,{Finder:()=>X});module.exports=V(K);var I=q(require("@asamuzakjp/nwsapi"),1),_=require("./dom-util.js"),O=require("./matcher.js"),y=require("./parser.js"),c=require("./constant.js");const x="next",S="prev",L="all",E="first",C="lineal",R="self";class X{#a;#c;#s;#h;#w;#r;#m;#e;#d;#k;#f;#o;#_;#t;#u;#b;#n;#p;#i;#l;constructor(l,e){this.#l=l,this.#r=e??l.document,this.#c=new WeakMap,this.#h=new WeakMap,this.#_=new WeakMap,this._initNwsapi()}_onError(l){if(!this.#k)if(l instanceof DOMException||l instanceof this.#l.DOMException)if(l.name===c.NOT_SUPPORTED_ERR)this.#i&&console.warn(l.message);else throw new this.#l.DOMException(l.message,l.name);else throw l}_setup(l,e,h={}){const{event:r,noexcept:a,warn:f}=h;return this.#k=!!a,this.#i=!!f,this.#m=this._setEvent(r),this.#e=e,[this.#s,this.#t,this.#n]=(0,_.resolveContent)(e),this.#u=(0,_.isInShadowTree)(e),[this.#a,this.#d]=this._correspond(l),this.#p=new WeakMap,e}_initNwsapi(){return this.#f=(0,I.default)({DOMException:this.#l.DOMException,document:this.#r}),this.#f.configure({LOGERRORS:!1}),this.#f}_setEvent(l){return l instanceof this.#l.KeyboardEvent||l instanceof this.#l.MouseEvent?l:null}_correspond(l){const e=[];this.#w=!1;let h;if(this.#h.has(this.#s)){const r=this.#h.get(this.#s);if(r&&r.has(`${l}`)){const a=r.get(`${l}`);this.#w=a.descendant,h=a.ast}}if(h){const r=h.length;for(let a=0;a<r;a++)h[a].collected=!1,h[a].dir=null,h[a].filtered=!1,h[a].find=!1,e[a]=[]}else{let r;try{r=(0,y.parseSelector)(l)}catch(t){this._onError(t)}const{branches:a,info:{hasHasPseudoFunc:f,hasHyphenSepAttr:n}}=(0,y.walkAST)(r);let u;f||n?u=!1:u=!0;let d=!1,i=0;h=[];for(const[...t]of a){const s=[];let o=t.shift();if(o&&o.type!==c.COMBINATOR){const m=new Set;for(;o;){if(o.type===c.COMBINATOR){const[b]=t;if(b.type===c.COMBINATOR){const w=`Invalid selector ${l}`;throw new DOMException(w,c.SYNTAX_ERR)}const p=o.name;/^[\s>]$/.test(p)&&(d=!0),s.push({combo:o,leaves:(0,y.sortAST)(m)}),m.clear()}else if(o){let{name:b}=o;b&&typeof b=="string"&&(b=(0,y.unescapeSelector)(b),typeof b=="string"&&b!==o.name&&(o.name=b),/[|:]/.test(b)&&(o.namespace=!0)),m.add(o)}if(t.length)o=t.shift();else{s.push({combo:null,leaves:(0,y.sortAST)(m)}),m.clear();break}}}h.push({branch:s,collected:!1,dir:null,filtered:!1,find:!1}),e[i]=[],i++}if(u){let t;this.#h.has(this.#s)?t=this.#h.get(this.#s):t=new Map,t.set(`${l}`,{ast:h,descendant:d}),this.#h.set(this.#s,t)}this.#w=d}return[h,e]}_createTreeWalker(l){let e;return this.#p.has(l)?e=this.#p.get(l):(e=this.#r.createTreeWalker(l,c.WALKER_FILTER),this.#p.set(l,e)),e}_prepareQuerySelectorWalker(){return this.#o=this._createTreeWalker(this.#e),this.#b=!1,this.#o}_collectNthChild(l,e,h){const{a:r,b:a,reverse:f,selector:n}=l,{parentNode:u}=e,d=new Set;let i;if(n)if(this.#c.has(n))i=this.#c.get(n);else{const{branches:t}=(0,y.walkAST)(n);i=t,this.#c.set(n,i)}if(u){const t=this.#n;let s=(0,_.traverseNode)(u,t);s=t.firstChild();let o=0;for(;s;)o++,s=t.nextSibling();s=(0,_.traverseNode)(u,t);const m=new Set;if(i)for(s=t.firstChild();s;){let b;for(const p of i)if(b=this._matchLeaves(p,s,h),!b)break;b&&m.add(s),s=t.nextSibling()}if(r===0){if(a>0&&a<=o){if(m.size){s=(0,_.traverseNode)(u,t),f?s=t.lastChild():s=t.firstChild();let b=0;for(;s;){if(m.has(s)){if(b===a-1){d.add(s);break}b++}f?s=t.previousSibling():s=t.nextSibling()}}else if(!n){s=(0,_.traverseNode)(u,t),f?s=t.lastChild():s=t.firstChild();let b=0;for(;s;){if(b===a-1){d.add(s);break}f?s=t.previousSibling():s=t.nextSibling(),b++}}}}else{let b=a-1;if(r>0)for(;b<0;)b+=r;if(b>=0&&b<o){s=(0,_.traverseNode)(u,t),f?s=t.lastChild():s=t.firstChild();let p=0,w=r>0?0:a-1;for(;s&&(s&&b>=0&&b<o);)m.size?m.has(s)&&(w===b&&(d.add(s),b+=r),r>0?w++:w--):p===b&&(n||d.add(s),b+=r),f?s=t.previousSibling():s=t.nextSibling(),p++}}if(f&&d.size>1){const b=[...d];return new Set(b.reverse())}}else if(e===this.#t&&r+a===1)if(i){let t;for(const s of i)if(t=this._matchLeaves(s,e,h),t)break;t&&d.add(e)}else d.add(e);return d}_collectNthOfType(l,e){const{a:h,b:r,reverse:a}=l,{localName:f,parentNode:n,prefix:u}=e,d=new Set;if(n){const i=this.#n;let t=(0,_.traverseNode)(n,i);t=i.firstChild();let s=0;for(;t;)s++,t=i.nextSibling();if(h===0){if(r>0&&r<=s){t=(0,_.traverseNode)(n,i),a?t=i.lastChild():t=i.firstChild();let o=0;for(;t;){const{localName:m,prefix:b}=t;if(m===f&&b===u){if(o===r-1){d.add(t);break}o++}a?t=i.previousSibling():t=i.nextSibling()}}}else{let o=r-1;if(h>0)for(;o<0;)o+=h;if(o>=0&&o<s){t=(0,_.traverseNode)(n,i),a?t=i.lastChild():t=i.firstChild();let m=h>0?0:r-1;for(;t;){const{localName:b,prefix:p}=t;if(b===f&&p===u){if(m===o&&(d.add(t),o+=h),o<0||o>=s)break;h>0?m++:m--}a?t=i.previousSibling():t=i.nextSibling()}}}if(a&&d.size>1){const o=[...d];return new Set(o.reverse())}}else e===this.#t&&h+r===1&&d.add(e);return d}_matchAnPlusB(l,e,h,r){const{nth:{a,b:f,name:n},selector:u}=l,d=new Map;if(n?(n==="even"?(d.set("a",2),d.set("b",0)):n==="odd"&&(d.set("a",2),d.set("b",1)),h.indexOf("last")>-1&&d.set("reverse",!0)):(typeof a=="string"&&/-?\d+/.test(a)?d.set("a",a*1):d.set("a",0),typeof f=="string"&&/-?\d+/.test(f)?d.set("b",f*1):d.set("b",0),h.indexOf("last")>-1&&d.set("reverse",!0)),/^nth-(?:last-)?child$/.test(h)){u&&d.set("selector",u);const i=Object.fromEntries(d);return this._collectNthChild(i,e,r)}else if(/^nth-(?:last-)?of-type$/.test(h)){const i=Object.fromEntries(d);return this._collectNthOfType(i,e)}return new Set}_matchHasPseudoFunc(l,e,h={}){let r;if(Array.isArray(l)&&l.length){const a=l.map(s=>s),[f]=a,{type:n}=f;let u;n===c.COMBINATOR?u=a.shift():u={name:" ",type:c.COMBINATOR};const d=[];for(;a.length;){const[s]=a,{type:o}=s;if(o===c.COMBINATOR)break;d.push(a.shift())}const i={combo:u,leaves:d};h.dir=x;const t=this._matchCombinator(i,e,h);if(t.size)if(a.length){for(const s of t)if(r=this._matchHasPseudoFunc(a,s,h),r)break}else r=!0}return!!r}_matchLogicalPseudoFunc(l,e,h={}){const{astName:r="",branches:a=[],selector:f="",twigBranches:n=[]}=l;let u;if(r==="has")if(f.includes(":has("))u=null;else{let d;for(const i of a)if(d=this._matchHasPseudoFunc(i,e,h),d)break;d&&(u=e)}else{const d=/^(?:is|where)$/.test(r);h.forgive=d;const i=n.length;let t;for(let s=0;s<i;s++){const o=n[s],m=o.length-1,{leaves:b}=o[m];if(t=this._matchLeaves(b,e,h),t&&m>0){let p=new Set([e]);for(let w=m-1;w>=0;w--){const k=o[w],N=[];h.dir=S;for(const A of p){const v=this._matchCombinator(k,A,h);v.size&&N.push(...v)}if(N.length)w===0?t=!0:p=new Set(N);else{t=!1;break}}}if(t)break}r==="not"?t||(u=e):t&&(u=e)}return u??null}_matchPseudoClassSelector(l,e,h={}){const{children:r,name:a}=l,{localName:f,parentNode:n}=e,{forgive:u,warn:d=this.#i}=h,i=new Set;if(c.REG_LOGICAL_PSEUDO.test(a)){let t;if(this.#c.has(l))t=this.#c.get(l);else{const{branches:o}=(0,y.walkAST)(l),m=[],b=[];for(const[...p]of o){for(const A of p){const v=(0,y.generateCSS)(A);m.push(v)}const w=[],k=new Set;let N=p.shift();for(;N;)if(N.type===c.COMBINATOR?(w.push({combo:N,leaves:[...k]}),k.clear()):N&&k.add(N),p.length)N=p.shift();else{w.push({combo:null,leaves:[...k]}),k.clear();break}b.push(w)}t={astName:a,branches:o,twigBranches:b,selector:m.join(",")},this.#c.set(l,t)}const s=this._matchLogicalPseudoFunc(t,e,h);s&&i.add(s)}else if(Array.isArray(r))if(/^nth-(?:last-)?(?:child|of-type)$/.test(a)){const[t]=r;return this._matchAnPlusB(t,e,a,h)}else switch(a){case"dir":case"lang":{const t=O.matcher.matchSelector(l,e);t&&i.add(t);break}case"state":{if((0,_.isCustomElement)(e)){const[{value:t}]=r;t&&e[t]&&i.add(e)}break}case"current":case"nth-col":case"nth-last-col":{if(d){const t=`Unsupported pseudo-class :${a}()`;throw new DOMException(t,c.NOT_SUPPORTED_ERR)}break}case"host":case"host-context":break;case"contains":{if(d){const t=`Unknown pseudo-class :${a}()`;throw new DOMException(t,c.NOT_SUPPORTED_ERR)}break}default:if(!u){const t=`Unknown pseudo-class :${a}()`;throw new DOMException(t,c.SYNTAX_ERR)}}else switch(a){case"any-link":case"link":{c.REG_ANCHOR.test(f)&&e.hasAttribute("href")&&i.add(e);break}case"local-link":{if(c.REG_ANCHOR.test(f)&&e.hasAttribute("href")){const{href:t,origin:s,pathname:o}=new URL(this.#s.URL),m=new URL(e.getAttribute("href"),t);m.origin===s&&m.pathname===o&&i.add(e)}break}case"visited":break;case"hover":{const{target:t,type:s}=this.#m??{};(s==="mouseover"||s==="pointerover")&&e.contains(t)&&i.add(e);break}case"active":{const{buttons:t,target:s,type:o}=this.#m??{};(o==="mousedown"||o==="pointerdown")&&t&c.BIT_01&&e.contains(s)&&i.add(e);break}case"target":{const{hash:t}=new URL(this.#s.URL);e.id&&t===`#${e.id}`&&this.#s.contains(e)&&i.add(e);break}case"target-within":{const{hash:t}=new URL(this.#s.URL);if(t){const s=t.replace(/^#/,"");let o=this.#s.getElementById(s);for(;o;){if(o===e){i.add(e);break}o=o.parentNode}}break}case"scope":{this.#e.nodeType===c.ELEMENT_NODE?!this.#u&&e===this.#e&&i.add(e):e===this.#s.documentElement&&i.add(e);break}case"focus":case"focus-visible":{const{target:t,type:s}=this.#m??{};if(e===this.#s.activeElement&&e.tabIndex>=0&&(a==="focus"||s==="keydown"&&e.contains(t))){let o=e,m=!0;for(;o;){if(o.disabled||o.hasAttribute("disabled")||o.hidden||o.hasAttribute("hidden")){m=!1;break}else{const{display:b,visibility:p}=this.#l.getComputedStyle(o);if(m=!(b==="none"||p==="hidden"),!m)break}if(o.parentNode&&o.parentNode.nodeType===c.ELEMENT_NODE)o=o.parentNode;else break}m&&i.add(e)}break}case"focus-within":{let t,s=this.#s.activeElement;if(s.tabIndex>=0)for(;s;){if(s===e){t=!0;break}s=s.parentNode}if(t){let o=e,m=!0;for(;o;){if(o.disabled||o.hasAttribute("disabled")||o.hidden||o.hasAttribute("hidden")){m=!1;break}else{const{display:b,visibility:p}=this.#l.getComputedStyle(o);if(m=!(b==="none"||p==="hidden"),!m)break}if(o.parentNode&&o.parentNode.nodeType===c.ELEMENT_NODE)o=o.parentNode;else break}m&&i.add(e)}break}case"open":{c.REG_INTERACT.test(f)&&e.hasAttribute("open")&&i.add(e);break}case"closed":{c.REG_INTERACT.test(f)&&!e.hasAttribute("open")&&i.add(e);break}case"disabled":{if(c.REG_FORM_CTRL.test(f)||(0,_.isCustomElement)(e,{formAssociated:!0}))if(e.disabled||e.hasAttribute("disabled"))i.add(e);else{let t=n;for(;t;){if(c.REG_FORM_GROUP.test(t.localName))if(t.localName==="fieldset"){if(t.disabled&&t.hasAttribute("disabled"))break}else break;t=t.parentNode}t&&n.localName!=="legend"&&(t.disabled||t.hasAttribute("disabled"))&&i.add(e)}break}case"enabled":{(c.REG_FORM_CTRL.test(f)||(0,_.isCustomElement)(e,{formAssociated:!0}))&&!(e.disabled&&e.hasAttribute("disabled"))&&i.add(e);break}case"read-only":{switch(f){case"textarea":{(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled"))&&i.add(e);break}case"input":{(!e.type||c.REG_TYPE_DATE.test(e.type)||c.REG_TYPE_TEXT.test(e.type))&&(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled"))&&i.add(e);break}default:(0,_.isContentEditable)(e)||i.add(e)}break}case"read-write":{switch(f){case"textarea":{e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled")||i.add(e);break}case"input":{(!e.type||c.REG_TYPE_DATE.test(e.type)||c.REG_TYPE_TEXT.test(e.type))&&!(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled"))&&i.add(e);break}default:(0,_.isContentEditable)(e)&&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;f==="textarea"?s=e:f==="input"&&(e.hasAttribute("type")?c.REG_TYPE_TEXT.test(e.getAttribute("type"))&&(s=e):s=e),s&&e.value===""&&i.add(e)}break}case"checked":{(e.checked&&f==="input"&&e.hasAttribute("type")&&c.REG_TYPE_CHECK.test(e.getAttribute("type"))||e.selected&&f==="option")&&i.add(e);break}case"indeterminate":{if(e.indeterminate&&f==="input"&&e.type==="checkbox"||f==="progress"&&!e.hasAttribute("value"))i.add(e);else if(f==="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.#s.documentElement);const o=s.getElementsByTagName("input"),m=o.length;let b;for(let p=0;p<m;p++){const w=o[p];if(w.getAttribute("type")==="radio"&&(t?w.getAttribute("name")===t&&(b=!!w.checked):w.hasAttribute("name")||(b=!!w.checked),b))break}b||i.add(e)}break}case"default":{if(f==="button"&&!(e.hasAttribute("type")&&c.REG_TYPE_RESET.test(e.getAttribute("type")))||f==="input"&&e.hasAttribute("type")&&c.REG_TYPE_SUBMIT.test(e.getAttribute("type"))){let t=e.parentNode;for(;t&&t.localName!=="form";)t=t.parentNode;if(t){const s=this.#n;let o=(0,_.traverseNode)(t,s);for(o=s.firstChild();o&&t.contains(o);){const m=o.localName;let b;if(m==="button"?b=!(o.hasAttribute("type")&&c.REG_TYPE_RESET.test(o.getAttribute("type"))):m==="input"&&(b=o.hasAttribute("type")&&c.REG_TYPE_SUBMIT.test(o.getAttribute("type"))),b){o===e&&i.add(e);break}o=s.nextNode()}}}else if(f==="input"&&e.hasAttribute("type")&&c.REG_TYPE_CHECK.test(e.getAttribute("type"))&&(e.checked||e.hasAttribute("checked")))i.add(e);else if(f==="option"){let t=n,s=!1;for(;t&&t.localName!=="datalist";){if(t.localName==="select"){(t.multiple||t.hasAttribute("multiple"))&&(s=!0);break}t=t.parentNode}if(s)(e.selected||e.hasAttribute("selected"))&&i.add(e);else{const o=new Set,m=this.#n;let b=(0,_.traverseNode)(n,m);for(b=m.firstChild();b;){if(b.selected||b.hasAttribute("selected")){o.add(b);break}b=m.nextSibling()}o.size&&o.has(e)&&i.add(e)}}break}case"valid":{if(c.REG_FORM_VALID.test(f))e.checkValidity()&&(e.maxLength>=0?e.maxLength>=e.value.length&&i.add(e):i.add(e));else if(f==="fieldset"){const t=this.#n;let s=(0,_.traverseNode)(e,t);s=t.firstChild();let o;if(!s)o=!0;else for(;s&&e.contains(s)&&!(c.REG_FORM_VALID.test(s.localName)&&(s.checkValidity()?s.maxLength>=0?o=s.maxLength>=s.value.length:o=!0:o=!1,!o));)s=t.nextNode();o&&i.add(e)}break}case"invalid":{if(c.REG_FORM_VALID.test(f))e.checkValidity()?e.maxLength>=0&&e.maxLength<e.value.length&&i.add(e):i.add(e);else if(f==="fieldset"){const t=this.#n;let s=(0,_.traverseNode)(e,t);s=t.firstChild();let o;if(!s)o=!0;else for(;s&&e.contains(s)&&!(c.REG_FORM_VALID.test(s.localName)&&(s.checkValidity()?s.maxLength>=0?o=s.maxLength>=s.value.length:o=!0:o=!1,!o));)s=t.nextNode();o||i.add(e)}break}case"in-range":{f==="input"&&!(e.readonly||e.hasAttribute("readonly"))&&!(e.disabled||e.hasAttribute("disabled"))&&e.hasAttribute("type")&&c.REG_TYPE_RANGE.test(e.getAttribute("type"))&&!(e.validity.rangeUnderflow||e.validity.rangeOverflow)&&(e.hasAttribute("min")||e.hasAttribute("max")||e.getAttribute("type")==="range")&&i.add(e);break}case"out-of-range":{f==="input"&&!(e.readonly||e.hasAttribute("readonly"))&&!(e.disabled||e.hasAttribute("disabled"))&&e.hasAttribute("type")&&c.REG_TYPE_RANGE.test(e.getAttribute("type"))&&(e.validity.rangeUnderflow||e.validity.rangeOverflow)&&i.add(e);break}case"required":{let t;if(/^(?:select|textarea)$/.test(f))t=e;else if(f==="input")if(e.hasAttribute("type")){const s=e.getAttribute("type");(s==="file"||c.REG_TYPE_CHECK.test(s)||c.REG_TYPE_DATE.test(s)||c.REG_TYPE_TEXT.test(s))&&(t=e)}else t=e;t&&(e.required||e.hasAttribute("required"))&&i.add(e);break}case"optional":{let t;if(/^(?:select|textarea)$/.test(f))t=e;else if(f==="input")if(e.hasAttribute("type")){const s=e.getAttribute("type");(s==="file"||c.REG_TYPE_CHECK.test(s)||c.REG_TYPE_DATE.test(s)||c.REG_TYPE_TEXT.test(s))&&(t=e)}else t=e;t&&!(e.required||e.hasAttribute("required"))&&i.add(e);break}case"root":{e===this.#s.documentElement&&i.add(e);break}case"empty":{if(e.hasChildNodes()){const t=this.#r.createTreeWalker(e,c.SHOW_ALL);let s=t.firstChild(),o;for(;s&&(o=s.nodeType!==c.ELEMENT_NODE&&s.nodeType!==c.TEXT_NODE,!!o);)s=t.nextSibling();o&&i.add(e)}else i.add(e);break}case"first-child":{(n&&e===n.firstElementChild||e===this.#t)&&i.add(e);break}case"last-child":{(n&&e===n.lastElementChild||e===this.#t)&&i.add(e);break}case"only-child":{(n&&e===n.firstElementChild&&e===n.lastElementChild||e===this.#t)&&i.add(e);break}case"first-of-type":{if(n){const[t]=this._collectNthOfType({a:0,b:1},e);t&&i.add(t)}else e===this.#t&&i.add(e);break}case"last-of-type":{if(n){const[t]=this._collectNthOfType({a:0,b:1,reverse:!0},e);t&&i.add(t)}else e===this.#t&&i.add(e);break}case"only-of-type":{if(n){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.#t&&i.add(e);break}case"defined":{e.hasAttribute("is")||f.includes("-")?(0,_.isCustomElement)(e)&&i.add(e):(e instanceof this.#l.HTMLElement||e instanceof this.#l.SVGElement)&&i.add(e);break}case"popover-open":{if(e.popover){const{display:t}=this.#l.getComputedStyle(e);t!=="none"&&i.add(e)}break}case"host":case"host-context":break;case"after":case"before":case"first-letter":case"first-line":{if(d){const t=`Unsupported pseudo-element ::${a}`;throw new DOMException(t,c.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(d){const t=`Unsupported pseudo-class :${a}`;throw new DOMException(t,c.NOT_SUPPORTED_ERR)}break}default:if(a.startsWith("-webkit-")){if(d){const t=`Unsupported pseudo-class :${a}`;throw new DOMException(t,c.NOT_SUPPORTED_ERR)}}else if(!u){const t=`Unknown pseudo-class :${a}`;throw new DOMException(t,c.SYNTAX_ERR)}}return i}_matchShadowHostPseudoClass(l,e){const{children:h,name:r}=l;let a;if(Array.isArray(h)){const{branches:f}=(0,y.walkAST)(h[0]),[n]=f,[...u]=n,{host:d}=e;if(r==="host"){let i;for(const t of u){const{type:s}=t;if(s===c.COMBINATOR){const m=`Invalid selector ${(0,y.generateCSS)(l)}`;throw new DOMException(m,c.SYNTAX_ERR)}if(i=this._matchSelector(t,d).has(d),!i)break}i&&(a=e)}else if(r==="host-context"){let i=d,t;for(;i;){for(const s of u){const{type:o}=s;if(o===c.COMBINATOR){const b=`Invalid selector ${(0,y.generateCSS)(l)}`;throw new DOMException(b,c.SYNTAX_ERR)}if(t=this._matchSelector(s,i).has(i),!t)break}if(t)break;i=i.parentNode}t&&(a=e)}}else if(r==="host")a=e;else{const f=`Invalid selector :${r}`;throw new DOMException(f,c.SYNTAX_ERR)}return a??null}_matchSelector(l,e,h){const{type:r}=l,a=new Set;if(l.name===c.EMPTY)return a;const f=(0,y.unescapeSelector)(l.name);if(typeof f=="string"&&f!==l.name&&(l.name=f),e.nodeType===c.ELEMENT_NODE)switch(r){case c.SELECTOR_PSEUDO_ELEMENT:{O.matcher.matchPseudoElementSelector(f,h);break}case c.SELECTOR_ID:{e.id===f&&a.add(e);break}case c.SELECTOR_CLASS:{e.classList.contains(f)&&a.add(e);break}case c.SELECTOR_PSEUDO_CLASS:return this._matchPseudoClassSelector(l,e,h);default:{const n=O.matcher.matchSelector(l,e,h);n&&a.add(n)}}else if(this.#u&&r===c.SELECTOR_PSEUDO_CLASS&&e.nodeType===c.DOCUMENT_FRAGMENT_NODE){if(f!=="has"&&c.REG_LOGICAL_PSEUDO.test(f))return this._matchPseudoClassSelector(l,e,h);if(c.REG_SHADOW_HOST.test(f)){const n=this._matchShadowHostPseudoClass(l,e,h);n&&a.add(n)}}return a}_matchLeaves(l,e,h){const{attributes:r,localName:a,nodeType:f}=e;let n=this.#_.get(l),u;if(n&&n.has(e)){const{attr:d,matched:i}=n.get(e);r?.length===d&&(u=i)}if(typeof u!="boolean"){let d;f===c.ELEMENT_NODE&&c.REG_FORM.test(a)?d=!1:d=!0;for(const i of l){const{name:t,type:s}=i;if(s===c.SELECTOR_PSEUDO_CLASS&&t==="dir"&&(d=!1),u=this._matchSelector(i,e,h).has(e),!u)break}d&&(n||(n=new WeakMap),n.set(e,{attr:r?.length,matched:u}),this.#_.set(l,n))}return!!u}_matchHTMLCollection(l,e={}){const{compound:h,filterLeaves:r}=e,a=new Set,f=l.length;if(f)if(h)for(let n=0;n<f;n++){const u=l[n];this._matchLeaves(r,u,e)&&a.add(u)}else{const n=[].slice.call(l);return new Set(n)}return a}_findDescendantNodes(l,e,h){const[r,...a]=l,f=a.length>0,{type:n}=r,u=(0,y.unescapeSelector)(r.name);typeof u=="string"&&u!==r.name&&(r.name=u);let d=new Set,i=!1;if(this.#u)i=!0;else switch(n){case c.SELECTOR_PSEUDO_ELEMENT:{O.matcher.matchPseudoElementSelector(u,h);break}case c.SELECTOR_ID:{if(this.#t.nodeType===c.ELEMENT_NODE)i=!0;else{const t=this.#t.getElementById(u);t&&t!==e&&e.contains(t)&&(f?this._matchLeaves(a,t,h)&&d.add(t):d.add(t))}break}case c.SELECTOR_CLASS:{const t=e.getElementsByClassName(u);d=this._matchHTMLCollection(t,{compound:f,filterLeaves:a});break}case c.SELECTOR_TYPE:{if(this.#s.contentType==="text/html"&&!/[*|]/.test(u)){const t=e.getElementsByTagName(u);d=this._matchHTMLCollection(t,{compound:f,filterLeaves:a})}else i=!0;break}default:i=!0}return{nodes:d,pending:i}}_matchCombinator(l,e,h={}){const{combo:r,leaves:a}=l,{name:f}=r,{parentNode:n}=e,{dir:u}=h,d=new Set;if(u===x)switch(f){case"+":{const i=e.nextElementSibling;i&&this._matchLeaves(a,i,h)&&d.add(i);break}case"~":{if(n){const i=this._createTreeWalker(n);let t=(0,_.traverseNode)(e,i);for(t=i.nextSibling();t;)this._matchLeaves(a,t,h)&&d.add(t),t=i.nextSibling()}break}case">":{const i=this._createTreeWalker(e);let t=(0,_.traverseNode)(e,i);for(t=i.firstChild();t;)this._matchLeaves(a,t,h)&&d.add(t),t=i.nextSibling();break}case" ":default:{const{nodes:i,pending:t}=this._findDescendantNodes(a,e);if(i.size)return i;if(t){const s=this._createTreeWalker(e);let o=(0,_.traverseNode)(e,s);for(o=s.nextNode();o&&e.contains(o);)this._matchLeaves(a,o,h)&&d.add(o),o=s.nextNode()}}}else switch(f){case"+":{const i=e.previousElementSibling;i&&this._matchLeaves(a,i,h)&&d.add(i);break}case"~":{if(n){const i=this._createTreeWalker(n);let t=(0,_.traverseNode)(n,i);for(t=i.firstChild();t&&t!==e;)this._matchLeaves(a,t,h)&&d.add(t),t=i.nextSibling()}break}case">":{n&&this._matchLeaves(a,n,h)&&d.add(n);break}case" ":default:{const i=[];let t=n;for(;t;)this._matchLeaves(a,t,h)&&i.push(t),t=t.parentNode;if(i.length)return new Set(i.reverse())}}return d}_findNode(l,e){const{node:h}=e;let r=(0,_.traverseNode)(h,this.#o),a;if(r)for(r.nodeType!==c.ELEMENT_NODE?r=this.#o.nextNode():r===h&&r!==this.#t&&(r=this.#o.nextNode());r;){if(this._matchLeaves(l,r,{warn:this.#i})){a=r;break}r=this.#o.nextNode()}return a??null}_matchSelf(l){const e=[],h=this._matchLeaves(l,this.#e,{warn:this.#i});let r=!1;return h&&(e.push(this.#e),r=!0),[e,r]}_findLineal(l,e={}){const{complex:h}=e,r=[];let a=this._matchLeaves(l,this.#e,{warn:this.#i}),f=!1;if(a&&(r.push(this.#e),f=!0),!a||h){let n=this.#e.parentNode;for(;n&&(a=this._matchLeaves(l,n,{warn:this.#i}),a&&(r.push(n),f=!0),n.parentNode);)n=n.parentNode}return[r,f]}_findFirst(l){const e=[],h=this._findNode(l,{node:this.#e});let r=!1;return h&&(e.push(h),r=!0),[e,r]}_findFromHTMLCollection(l,e={}){const{complex:h,compound:r,filterLeaves:a,targetType:f}=e;let n=[],u=!1,d=!1;const i=l.length;if(i)if(this.#e.nodeType===c.ELEMENT_NODE)for(let t=0;t<i;t++){const s=l[t];if(s!==this.#e&&(this.#e.contains(s)||s.contains(this.#e))){if(r){if(this._matchLeaves(a,s,{warn:this.#i})&&(n.push(s),u=!0,f===E))break}else if(n.push(s),u=!0,f===E)break}}else if(h)if(r)for(let t=0;t<i;t++){const s=l[t];if(this._matchLeaves(a,s,{warn:this.#i})&&(n.push(s),u=!0,f===E))break}else n=[].slice.call(l),u=!0,d=!0;else if(r)for(let t=0;t<i;t++){const s=l[t];if(this._matchLeaves(a,s,{warn:this.#i})&&(n.push(s),u=!0,f===E))break}else n=[].slice.call(l),u=!0,d=!0;return[n,u,d]}_findEntryNodes(l,e,h){const{leaves:r}=l,[a,...f]=r,n=f.length>0,{name:u,type:d}=a;let i=[],t=!1,s=!1,o=!1;switch(d){case c.SELECTOR_PSEUDO_ELEMENT:{O.matcher.matchPseudoElementSelector(u,{warn:this.#i});break}case c.SELECTOR_ID:{if(e===R)[i,s]=this._matchSelf(r);else if(e===C)[i,s]=this._findLineal(r,{complex:h});else if(e===E&&this.#t.nodeType!==c.ELEMENT_NODE){const m=this.#t.getElementById(u);m&&(n?this._matchLeaves(f,m,{warn:this.#i})&&(i.push(m),s=!0):(i.push(m),s=!0))}else e===E?[i,s]=this._findFirst(r):o=!0;break}case c.SELECTOR_CLASS:{if(e===R)[i,s]=this._matchSelf(r);else if(e===C)[i,s]=this._findLineal(r,{complex:h});else if(this.#t.nodeType===c.DOCUMENT_NODE){const m=this.#t.getElementsByClassName(u);m.length&&([i,s,t]=this._findFromHTMLCollection(m,{complex:h,compound:n,filterLeaves:f,targetType:e}))}else e===E?[i,s]=this._findFirst(r):o=!0;break}case c.SELECTOR_TYPE:{if(e===R)[i,s]=this._matchSelf(r);else if(e===C)[i,s]=this._findLineal(r,{complex:h});else if(this.#s.contentType==="text/html"&&this.#t.nodeType===c.DOCUMENT_NODE&&!/[*|]/.test(u)){const m=this.#t.getElementsByTagName(u);m.length&&([i,s,t]=this._findFromHTMLCollection(m,{complex:h,compound:n,filterLeaves:f,targetType:e}))}else e===E?[i,s]=this._findFirst(r):o=!0;break}default:if(e!==C&&c.REG_SHADOW_HOST.test(u)){if(this.#u&&this.#e.nodeType===c.DOCUMENT_FRAGMENT_NODE){const m=this._matchShadowHostPseudoClass(a,this.#e);m&&(i.push(m),s=!0)}}else e===R?[i,s]=this._matchSelf(r):e===C?[i,s]=this._findLineal(r,{complex:h}):e===E?[i,s]=this._findFirst(r):o=!0}return{collected:t,compound:n,filtered:s,nodes:i,pending:o}}_collectNodes(l){const e=this.#a.values();if(l===L||l===E){const h=new Set;let r=0;for(const{branch:a}of e){const f=a.length,n=f>1,u=a[0];let d,i;if(n){const{combo:p,leaves:[{name:w,type:k}]}=u,N=a[f-1],{leaves:[{name:A,type:v}]}=N;if(v===c.SELECTOR_PSEUDO_ELEMENT||v===c.SELECTOR_ID)d=S,i=N;else if(k===c.SELECTOR_PSEUDO_ELEMENT||k===c.SELECTOR_ID)d=x,i=u;else if(l===L)if(w==="*"&&k===c.SELECTOR_TYPE)d=S,i=N;else if(A==="*"&&v===c.SELECTOR_TYPE)d=x,i=u;else if(f===2){const{name:T}=p;/^[+~]$/.test(T)?(d=S,i=N):(d=x,i=u)}else d=x,i=u;else if(A==="*"&&v===c.SELECTOR_TYPE)d=x,i=u;else if(w==="*"&&k===c.SELECTOR_TYPE)d=S,i=N;else{let T;for(const{combo:D,leaves:[U]}of a){const{name:$,type:G}=U;if(G===c.SELECTOR_PSEUDO_CLASS&&$==="dir"){T=!1;break}if(!T&&D){const{name:F}=D;/^[+~]$/.test(F)&&(T=!0)}}T?(d=x,i=u):(d=S,i=N)}}else d=S,i=u;const{collected:t,compound:s,filtered:o,nodes:m,pending:b}=this._findEntryNodes(i,l,n);m.length?(this.#a[r].find=!0,this.#d[r]=m):b&&h.add(new Map([["index",r],["twig",i]])),this.#a[r].collected=t,this.#a[r].dir=d,this.#a[r].filtered=o||!s,r++}if(h.size){let a,f;this.#e!==this.#t&&this.#e.nodeType===c.ELEMENT_NODE?(a=this.#e,f=this.#o):(a=this.#t,f=this.#n);let n=(0,_.traverseNode)(a,f);for(;n;){let u=!1;if(this.#e.nodeType===c.ELEMENT_NODE?n===this.#e?u=!0:u=this.#e.contains(n):u=!0,u)for(const d of h){const{leaves:i}=d.get("twig");if(this._matchLeaves(i,n,{warn:this.#i})){const s=d.get("index");this.#a[s].filtered=!0,this.#a[s].find=!0,this.#d[s].push(n)}}n!==f.currentNode&&(n=(0,_.traverseNode)(n,f)),n=f.nextNode()}}}else{let h=0;for(const{branch:r}of e){const a=r[r.length-1],f=r.length>1,{compound:n,filtered:u,nodes:d}=this._findEntryNodes(a,l,f);d.length&&(this.#a[h].find=!0,this.#d[h]=d),this.#a[h].dir=S,this.#a[h].filtered=u||!n,h++}}return[this.#a,this.#d]}_getCombinedNodes(l,e,h){const r=[];for(const a of e){const f=this._matchCombinator(l,a,{dir:h,warn:this.#i});f.size&&r.push(...f)}return r.length?new Set(r):new Set}_matchNodeNext(l,e,h){const{combo:r,index:a}=h,{combo:f,leaves:n}=l[a],u={combo:r,leaves:n},d=this._getCombinedNodes(u,e,x);let i;if(d.size)if(a===l.length-1){const[t]=(0,_.sortNodes)(d);i=t}else i=this._matchNodeNext(l,d,{combo:f,index:a+1});return i??null}_matchNodePrev(l,e,h){const{index:r}=h,a=l[r],f=new Set([e]),n=this._getCombinedNodes(a,f,S);let u;if(n.size){if(r===0)u=e;else for(const d of n)if(this._matchNodePrev(l,d,{index:r-1}))return e}return u??null}_find(l){(l===L||l===E)&&this._prepareQuerySelectorWalker();const[[...e],h]=this._collectNodes(l),r=e.length;let a=new Set;for(let f=0;f<r;f++){const{branch:n,collected:u,dir:d,find:i}=e[f],t=n.length;if(t&&i){const s=h[f],o=s.length,m=t-1;if(m===0)if((l===L||l===E)&&this.#e.nodeType===c.ELEMENT_NODE)for(let b=0;b<o;b++){const p=s[b];if(p!==this.#e&&this.#e.contains(p)&&(a.add(p),l!==L))break}else if(l===L)if(a.size){const b=[...a];a=new Set([...b,...s]),this.#b=!0}else a=new Set(s);else{const[b]=s;a.add(b)}else if(l===L)if(d===x){let{combo:b}=n[0];for(const p of s){let w=new Set([p]);for(let k=1;k<t;k++){const{combo:N,leaves:A}=n[k],v={combo:b,leaves:A};if(w=this._getCombinedNodes(v,w,d),w.size)if(k===m)if(a.size){const T=[...a];a=new Set([...T,...w]),this.#b=!0}else a=w;else b=N;else break}}}else for(const b of s){let p=new Set([b]);for(let w=m-1;w>=0;w--){const k=n[w];if(p=this._getCombinedNodes(k,p,d),p.size)w===0&&(a.add(b),t>1&&a.size>1&&(this.#b=!0));else break}}else if(l===E&&d===x){const{combo:b}=n[0];let p;for(const w of s)if(p=this._matchNodeNext(n,new Set([w]),{combo:b,index:1}),p){a.add(p);break}if(!p&&!u){const{leaves:w}=n[0],[k]=s;let N=this._findNode(w,{node:k});for(;N;){if(p=this._matchNodeNext(n,new Set([N]),{combo:b,index:1}),p){a.add(p);break}N=this._findNode(w,{node:N})}}}else{let b;for(const p of s)if(b=this._matchNodePrev(n,p,{index:m-1}),b){a.add(p);break}if(!b&&!u&&l===E){const{leaves:p}=n[m],[w]=s;let k=this._findNode(p,{node:w});for(;k;){if(b=this._matchNodePrev(n,k,{index:m-1}),b){a.add(k);break}k=this._findNode(p,{node:k})}}}}}return a}matches(l,e,h){let r;try{if(e?.nodeType!==c.ELEMENT_NODE){const n=`Unexpected node ${e?.nodeName}`;throw new TypeError(n)}const a=e.ownerDocument;if(a===this.#r&&a.contentType==="text/html"){const n={complex:c.REG_COMPLEX.test(l),descendant:!0};if((0,y.filterSelector)(l,n))return this.#f.match(l,e)}this._setup(l,e,h),r=this._find(R).size}catch(a){this._onError(a)}return!!r}closest(l,e,h){let r;try{if(e?.nodeType!==c.ELEMENT_NODE){const n=`Unexpected node ${e?.nodeName}`;throw new TypeError(n)}const a=e.ownerDocument;if(a===this.#r&&a.contentType==="text/html"){const n={complex:c.REG_COMPLEX.test(l),descendant:!0};if((0,y.filterSelector)(l,n))return this.#f.closest(l,e)}this._setup(l,e,h);const f=this._find(C);if(f.size){let n=this.#e;for(;n;){if(f.has(n)){r=n;break}n=n.parentNode}}}catch(a){this._onError(a)}return r??null}querySelector(l,e,h){let r;try{(0,_.verifyNode)(e);let a;if(e.nodeType===c.DOCUMENT_NODE?a=e:a=e.ownerDocument,a===this.#r&&a.contentType==="text/html"&&(0,y.filterSelector)(l,{complex:!1,descendant:!1}))return this.#f.first(l,e);this._setup(l,e,h);const f=this._find(E);f.delete(this.#e),f.size&&([r]=(0,_.sortNodes)(f))}catch(a){this._onError(a)}return r??null}querySelectorAll(l,e,h){let r;try{(0,_.verifyNode)(e);let a;if(e.nodeType===c.DOCUMENT_NODE?a=e:a=e.ownerDocument,a===this.#r&&a.contentType==="text/html"&&(0,y.filterSelector)(l,{complex:!1,descendant:!0}))return this.#f.select(l,e);this._setup(l,e,h);const f=this._find(L);f.delete(this.#e),f.size&&(this.#b?r=(0,_.sortNodes)(f):r=[...f])}catch(a){this._onError(a)}return r??[]}}0&&(module.exports={Finder});
var z=Object.create;var M=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var B=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty;var q=(g,l)=>{for(var e in l)M(g,e,{get:l[e],enumerable:!0})},D=(g,l,e,h)=>{if(l&&typeof l=="object"||typeof l=="function")for(let c of W(l))!j.call(g,c)&&c!==e&&M(g,c,{get:()=>l[c],enumerable:!(h=H(l,c))||h.enumerable});return g};var Y=(g,l,e)=>(e=g!=null?z(B(g)):{},D(l||!g||!g.__esModule?M(e,"default",{value:g,enumerable:!0}):e,g)),V=g=>D(M({},"__esModule",{value:!0}),g);var K={};q(K,{Finder:()=>X});module.exports=V(K);var I=Y(require("@asamuzakjp/nwsapi"),1),_=require("./dom-util.js"),O=require("./matcher.js"),y=require("./parser.js"),n=require("./constant.js");const x="next",S="prev",L="all",E="first",C="lineal",R="self";class X{#a;#c;#s;#o;#w;#r;#b;#e;#f;#k;#h;#m;#_;#t;#d;#u;#n;#p;#i;#l;constructor(l,e){this.#l=l,this.#r=e??l.document,this.#c=new WeakMap,this.#o=new WeakMap,this.#_=new WeakMap,this.#h=this._initNwsapi(l,e)}_onError(l){if(!this.#k)if(l instanceof DOMException||l instanceof this.#l.DOMException)if(l.name===n.NOT_SUPPORTED_ERR)this.#i&&console.warn(l.message);else throw new this.#l.DOMException(l.message,l.name);else throw l}_setup(l,e,h={}){const{event:c,noexcept:a,warn:o}=h;return this.#k=!!a,this.#i=!!o,this.#b=this._setEvent(c),this.#e=e,[this.#s,this.#t,this.#n]=(0,_.resolveContent)(e),this.#d=(0,_.isInShadowTree)(e),[this.#a,this.#f]=this._correspond(l),this.#p=new WeakMap,e}_initNwsapi(){const l=(0,I.default)({DOMException:this.#l.DOMException,document:this.#r});return l.configure({LOGERRORS:!1}),l}_setEvent(l){return l instanceof this.#l.KeyboardEvent||l instanceof this.#l.MouseEvent?l:null}_correspond(l){const e=[];this.#w=!1;let h;if(this.#o.has(this.#s)){const c=this.#o.get(this.#s);if(c&&c.has(`${l}`)){const a=c.get(`${l}`);this.#w=a.descendant,h=a.ast}}if(h){const c=h.length;for(let a=0;a<c;a++)h[a].collected=!1,h[a].dir=null,h[a].filtered=!1,h[a].find=!1,e[a]=[]}else{let c;try{c=(0,y.parseSelector)(l)}catch(f){this._onError(f)}const{branches:a,info:{hasHasPseudoFunc:o,hasHyphenSepAttr:r,hasNthChildOfSelector:b,hasPseudoFunc:d}}=(0,y.walkAST)(c);let i;o||r||b&&d?i=!1:i=!0;let t=!1,s=0;h=[];for(const[...f]of a){const m=[];let u=f.shift();if(u&&u.type!==n.COMBINATOR){const p=new Set;for(;u;){if(u.type===n.COMBINATOR){const[w]=f;if(w.type===n.COMBINATOR){const N=`Invalid selector ${l}`;throw new DOMException(N,n.SYNTAX_ERR)}const k=u.name;/^[\s>]$/.test(k)&&(t=!0),m.push({combo:u,leaves:(0,y.sortAST)(p)}),p.clear()}else if(u){let{name:w}=u;w&&typeof w=="string"&&(w=(0,y.unescapeSelector)(w),typeof w=="string"&&w!==u.name&&(u.name=w),/[|:]/.test(w)&&(u.namespace=!0)),p.add(u)}if(f.length)u=f.shift();else{m.push({combo:null,leaves:(0,y.sortAST)(p)}),p.clear();break}}}h.push({branch:m,collected:!1,dir:null,filtered:!1,find:!1}),e[s]=[],s++}if(i){let f;this.#o.has(this.#s)?f=this.#o.get(this.#s):f=new Map,f.set(`${l}`,{ast:h,descendant:t}),this.#o.set(this.#s,f)}this.#w=t}return[h,e]}_createTreeWalker(l){let e;return this.#p.has(l)?e=this.#p.get(l):(e=this.#r.createTreeWalker(l,n.WALKER_FILTER),this.#p.set(l,e)),e}_prepareQuerySelectorWalker(){return this.#m=this._createTreeWalker(this.#e),this.#u=!1,this.#m}_collectNthChild(l,e,h){const{a:c,b:a,reverse:o,selector:r}=l,{parentNode:b}=e,d=new Set;let i;if(r)if(this.#c.has(r))i=this.#c.get(r);else{const{branches:t}=(0,y.walkAST)(r);i=t,this.#c.set(r,i)}if(b){const t=this.#n;let s=(0,_.traverseNode)(b,t);s=t.firstChild();let f=0;for(;s;)f++,s=t.nextSibling();const m=new Set;if(i)for(s=(0,_.traverseNode)(b,t),s=t.firstChild();s;){const{display:u,visibility:p}=this.#l.getComputedStyle(s);if(u!=="none"&&p!=="hidden"){let w;for(const k of i)if(w=this._matchLeaves(k,s,h),!w)break;w&&m.add(s)}s=t.nextSibling()}if(c===0){if(a>0&&a<=f){if(m.size){s=(0,_.traverseNode)(b,t),o?s=t.lastChild():s=t.firstChild();let u=0;for(;s;){if(m.has(s)){if(u===a-1){d.add(s);break}u++}o?s=t.previousSibling():s=t.nextSibling()}}else if(!r){s=(0,_.traverseNode)(b,t),o?s=t.lastChild():s=t.firstChild();let u=0;for(;s;){if(u===a-1){d.add(s);break}o?s=t.previousSibling():s=t.nextSibling(),u++}}}}else{let u=a-1;if(c>0)for(;u<0;)u+=c;if(u>=0&&u<f){s=(0,_.traverseNode)(b,t),o?s=t.lastChild():s=t.firstChild();let p=0,w=c>0?0:a-1;for(;s&&(s&&u>=0&&u<f);)m.size?m.has(s)&&(w===u&&(d.add(s),u+=c),c>0?w++:w--):p===u&&(r||d.add(s),u+=c),o?s=t.previousSibling():s=t.nextSibling(),p++}}if(o&&d.size>1){const u=[...d];return new Set(u.reverse())}}else if(e===this.#t&&c+a===1)if(i){let t;for(const s of i)if(t=this._matchLeaves(s,e,h),t)break;t&&d.add(e)}else d.add(e);return d}_collectNthOfType(l,e){const{a:h,b:c,reverse:a}=l,{localName:o,parentNode:r,prefix:b}=e,d=new Set;if(r){const i=this.#n;let t=(0,_.traverseNode)(r,i);t=i.firstChild();let s=0;for(;t;)s++,t=i.nextSibling();if(h===0){if(c>0&&c<=s){t=(0,_.traverseNode)(r,i),a?t=i.lastChild():t=i.firstChild();let f=0;for(;t;){const{localName:m,prefix:u}=t;if(m===o&&u===b){if(f===c-1){d.add(t);break}f++}a?t=i.previousSibling():t=i.nextSibling()}}}else{let f=c-1;if(h>0)for(;f<0;)f+=h;if(f>=0&&f<s){t=(0,_.traverseNode)(r,i),a?t=i.lastChild():t=i.firstChild();let m=h>0?0:c-1;for(;t;){const{localName:u,prefix:p}=t;if(u===o&&p===b){if(m===f&&(d.add(t),f+=h),f<0||f>=s)break;h>0?m++:m--}a?t=i.previousSibling():t=i.nextSibling()}}}if(a&&d.size>1){const f=[...d];return new Set(f.reverse())}}else e===this.#t&&h+c===1&&d.add(e);return d}_matchAnPlusB(l,e,h,c){const{nth:{a,b:o,name:r},selector:b}=l,d=new Map;if(r?(r==="even"?(d.set("a",2),d.set("b",0)):r==="odd"&&(d.set("a",2),d.set("b",1)),h.indexOf("last")>-1&&d.set("reverse",!0)):(typeof a=="string"&&/-?\d+/.test(a)?d.set("a",a*1):d.set("a",0),typeof o=="string"&&/-?\d+/.test(o)?d.set("b",o*1):d.set("b",0),h.indexOf("last")>-1&&d.set("reverse",!0)),/^nth-(?:last-)?child$/.test(h)){b&&d.set("selector",b);const i=Object.fromEntries(d);return this._collectNthChild(i,e,c)}else if(/^nth-(?:last-)?of-type$/.test(h)){const i=Object.fromEntries(d);return this._collectNthOfType(i,e)}return new Set}_matchHasPseudoFunc(l,e,h={}){let c;if(Array.isArray(l)&&l.length){const a=l.map(s=>s),[o]=a,{type:r}=o;let b;r===n.COMBINATOR?b=a.shift():b={name:" ",type:n.COMBINATOR};const d=[];for(;a.length;){const[s]=a,{type:f}=s;if(f===n.COMBINATOR)break;d.push(a.shift())}const i={combo:b,leaves:d};h.dir=x;const t=this._matchCombinator(i,e,h);if(t.size)if(a.length){for(const s of t)if(c=this._matchHasPseudoFunc(a,s,h),c)break}else c=!0}return!!c}_matchLogicalPseudoFunc(l,e,h={}){const{astName:c="",branches:a=[],selector:o="",twigBranches:r=[]}=l;let b;if(c==="has")if(o.includes(":has("))b=null;else{let d;for(const i of a)if(d=this._matchHasPseudoFunc(i,e,h),d)break;d&&(b=e)}else{const d=/^(?:is|where)$/.test(c);h.forgive=d;const i=r.length;let t;for(let s=0;s<i;s++){const f=r[s],m=f.length-1,{leaves:u}=f[m];if(t=this._matchLeaves(u,e,h),t&&m>0){let p=new Set([e]);for(let w=m-1;w>=0;w--){const k=f[w],N=[];h.dir=S;for(const A of p){const v=this._matchCombinator(k,A,h);v.size&&N.push(...v)}if(N.length)w===0?t=!0:p=new Set(N);else{t=!1;break}}}if(t)break}c==="not"?t||(b=e):t&&(b=e)}return b??null}_matchPseudoClassSelector(l,e,h={}){const{children:c,name:a}=l,{localName:o,parentNode:r}=e,{forgive:b,warn:d=this.#i}=h,i=new Set;if(n.REG_LOGICAL_PSEUDO.test(a)){let t;if(this.#c.has(l))t=this.#c.get(l);else{const{branches:f}=(0,y.walkAST)(l),m=[],u=[];for(const[...p]of f){for(const A of p){const v=(0,y.generateCSS)(A);m.push(v)}const w=[],k=new Set;let N=p.shift();for(;N;)if(N.type===n.COMBINATOR?(w.push({combo:N,leaves:[...k]}),k.clear()):N&&k.add(N),p.length)N=p.shift();else{w.push({combo:null,leaves:[...k]}),k.clear();break}u.push(w)}t={astName:a,branches:f,twigBranches:u,selector:m.join(",")},this.#c.set(l,t)}const s=this._matchLogicalPseudoFunc(t,e,h);s&&i.add(s)}else if(Array.isArray(c))if(/^nth-(?:last-)?(?:child|of-type)$/.test(a)){const[t]=c;return this._matchAnPlusB(t,e,a,h)}else switch(a){case"dir":case"lang":{const t=O.matcher.matchSelector(l,e);t&&i.add(t);break}case"state":{if((0,_.isCustomElement)(e)){const[{value:t}]=c;t&&e[t]&&i.add(e)}break}case"current":case"nth-col":case"nth-last-col":{if(d){const t=`Unsupported pseudo-class :${a}()`;throw new DOMException(t,n.NOT_SUPPORTED_ERR)}break}case"host":case"host-context":break;case"contains":{if(d){const t=`Unknown pseudo-class :${a}()`;throw new DOMException(t,n.NOT_SUPPORTED_ERR)}break}default:if(!b){const t=`Unknown pseudo-class :${a}()`;throw new DOMException(t,n.SYNTAX_ERR)}}else switch(a){case"any-link":case"link":{n.REG_ANCHOR.test(o)&&e.hasAttribute("href")&&i.add(e);break}case"local-link":{if(n.REG_ANCHOR.test(o)&&e.hasAttribute("href")){const{href:t,origin:s,pathname:f}=new URL(this.#s.URL),m=new URL(e.getAttribute("href"),t);m.origin===s&&m.pathname===f&&i.add(e)}break}case"visited":break;case"hover":{const{target:t,type:s}=this.#b??{};(s==="mouseover"||s==="pointerover")&&e.contains(t)&&i.add(e);break}case"active":{const{buttons:t,target:s,type:f}=this.#b??{};(f==="mousedown"||f==="pointerdown")&&t&n.BIT_01&&e.contains(s)&&i.add(e);break}case"target":{const{hash:t}=new URL(this.#s.URL);e.id&&t===`#${e.id}`&&this.#s.contains(e)&&i.add(e);break}case"target-within":{const{hash:t}=new URL(this.#s.URL);if(t){const s=t.replace(/^#/,"");let f=this.#s.getElementById(s);for(;f;){if(f===e){i.add(e);break}f=f.parentNode}}break}case"scope":{this.#e.nodeType===n.ELEMENT_NODE?!this.#d&&e===this.#e&&i.add(e):e===this.#s.documentElement&&i.add(e);break}case"focus":case"focus-visible":{const{target:t,type:s}=this.#b??{};if(e===this.#s.activeElement&&e.tabIndex>=0&&(a==="focus"||s==="keydown"&&e.contains(t))){let f=e,m=!0;for(;f;){if(f.disabled||f.hasAttribute("disabled")||f.hidden||f.hasAttribute("hidden")){m=!1;break}else{const{display:u,visibility:p}=this.#l.getComputedStyle(f);if(m=!(u==="none"||p==="hidden"),!m)break}if(f.parentNode&&f.parentNode.nodeType===n.ELEMENT_NODE)f=f.parentNode;else break}m&&i.add(e)}break}case"focus-within":{let t,s=this.#s.activeElement;if(s.tabIndex>=0)for(;s;){if(s===e){t=!0;break}s=s.parentNode}if(t){let f=e,m=!0;for(;f;){if(f.disabled||f.hasAttribute("disabled")||f.hidden||f.hasAttribute("hidden")){m=!1;break}else{const{display:u,visibility:p}=this.#l.getComputedStyle(f);if(m=!(u==="none"||p==="hidden"),!m)break}if(f.parentNode&&f.parentNode.nodeType===n.ELEMENT_NODE)f=f.parentNode;else break}m&&i.add(e)}break}case"open":{n.REG_INTERACT.test(o)&&e.hasAttribute("open")&&i.add(e);break}case"closed":{n.REG_INTERACT.test(o)&&!e.hasAttribute("open")&&i.add(e);break}case"disabled":{if(n.REG_FORM_CTRL.test(o)||(0,_.isCustomElement)(e,{formAssociated:!0}))if(e.disabled||e.hasAttribute("disabled"))i.add(e);else{let t=r;for(;t;){if(n.REG_FORM_GROUP.test(t.localName))if(t.localName==="fieldset"){if(t.disabled&&t.hasAttribute("disabled"))break}else break;t=t.parentNode}t&&r.localName!=="legend"&&(t.disabled||t.hasAttribute("disabled"))&&i.add(e)}break}case"enabled":{(n.REG_FORM_CTRL.test(o)||(0,_.isCustomElement)(e,{formAssociated:!0}))&&!(e.disabled&&e.hasAttribute("disabled"))&&i.add(e);break}case"read-only":{switch(o){case"textarea":{(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled"))&&i.add(e);break}case"input":{(!e.type||n.REG_TYPE_DATE.test(e.type)||n.REG_TYPE_TEXT.test(e.type))&&(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled"))&&i.add(e);break}default:(0,_.isContentEditable)(e)||i.add(e)}break}case"read-write":{switch(o){case"textarea":{e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled")||i.add(e);break}case"input":{(!e.type||n.REG_TYPE_DATE.test(e.type)||n.REG_TYPE_TEXT.test(e.type))&&!(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled"))&&i.add(e);break}default:(0,_.isContentEditable)(e)&&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;o==="textarea"?s=e:o==="input"&&(e.hasAttribute("type")?n.REG_TYPE_TEXT.test(e.getAttribute("type"))&&(s=e):s=e),s&&e.value===""&&i.add(e)}break}case"checked":{(e.checked&&o==="input"&&e.hasAttribute("type")&&n.REG_TYPE_CHECK.test(e.getAttribute("type"))||e.selected&&o==="option")&&i.add(e);break}case"indeterminate":{if(e.indeterminate&&o==="input"&&e.type==="checkbox"||o==="progress"&&!e.hasAttribute("value"))i.add(e);else if(o==="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.#s.documentElement);const f=s.getElementsByTagName("input"),m=f.length;let u;for(let p=0;p<m;p++){const w=f[p];if(w.getAttribute("type")==="radio"&&(t?w.getAttribute("name")===t&&(u=!!w.checked):w.hasAttribute("name")||(u=!!w.checked),u))break}u||i.add(e)}break}case"default":{if(o==="button"&&!(e.hasAttribute("type")&&n.REG_TYPE_RESET.test(e.getAttribute("type")))||o==="input"&&e.hasAttribute("type")&&n.REG_TYPE_SUBMIT.test(e.getAttribute("type"))){let t=e.parentNode;for(;t&&t.localName!=="form";)t=t.parentNode;if(t){const s=this.#n;let f=(0,_.traverseNode)(t,s);for(f=s.firstChild();f&&t.contains(f);){const m=f.localName;let u;if(m==="button"?u=!(f.hasAttribute("type")&&n.REG_TYPE_RESET.test(f.getAttribute("type"))):m==="input"&&(u=f.hasAttribute("type")&&n.REG_TYPE_SUBMIT.test(f.getAttribute("type"))),u){f===e&&i.add(e);break}f=s.nextNode()}}}else if(o==="input"&&e.hasAttribute("type")&&n.REG_TYPE_CHECK.test(e.getAttribute("type"))&&(e.checked||e.hasAttribute("checked")))i.add(e);else if(o==="option"){let t=r,s=!1;for(;t&&t.localName!=="datalist";){if(t.localName==="select"){(t.multiple||t.hasAttribute("multiple"))&&(s=!0);break}t=t.parentNode}if(s)(e.selected||e.hasAttribute("selected"))&&i.add(e);else{const f=new Set,m=this.#n;let u=(0,_.traverseNode)(r,m);for(u=m.firstChild();u;){if(u.selected||u.hasAttribute("selected")){f.add(u);break}u=m.nextSibling()}f.size&&f.has(e)&&i.add(e)}}break}case"valid":{if(n.REG_FORM_VALID.test(o))e.checkValidity()&&(e.maxLength>=0?e.maxLength>=e.value.length&&i.add(e):i.add(e));else if(o==="fieldset"){const t=this.#n;let s=(0,_.traverseNode)(e,t);s=t.firstChild();let f;if(!s)f=!0;else for(;s&&e.contains(s)&&!(n.REG_FORM_VALID.test(s.localName)&&(s.checkValidity()?s.maxLength>=0?f=s.maxLength>=s.value.length:f=!0:f=!1,!f));)s=t.nextNode();f&&i.add(e)}break}case"invalid":{if(n.REG_FORM_VALID.test(o))e.checkValidity()?e.maxLength>=0&&e.maxLength<e.value.length&&i.add(e):i.add(e);else if(o==="fieldset"){const t=this.#n;let s=(0,_.traverseNode)(e,t);s=t.firstChild();let f;if(!s)f=!0;else for(;s&&e.contains(s)&&!(n.REG_FORM_VALID.test(s.localName)&&(s.checkValidity()?s.maxLength>=0?f=s.maxLength>=s.value.length:f=!0:f=!1,!f));)s=t.nextNode();f||i.add(e)}break}case"in-range":{o==="input"&&!(e.readonly||e.hasAttribute("readonly"))&&!(e.disabled||e.hasAttribute("disabled"))&&e.hasAttribute("type")&&n.REG_TYPE_RANGE.test(e.getAttribute("type"))&&!(e.validity.rangeUnderflow||e.validity.rangeOverflow)&&(e.hasAttribute("min")||e.hasAttribute("max")||e.getAttribute("type")==="range")&&i.add(e);break}case"out-of-range":{o==="input"&&!(e.readonly||e.hasAttribute("readonly"))&&!(e.disabled||e.hasAttribute("disabled"))&&e.hasAttribute("type")&&n.REG_TYPE_RANGE.test(e.getAttribute("type"))&&(e.validity.rangeUnderflow||e.validity.rangeOverflow)&&i.add(e);break}case"required":{let t;if(/^(?:select|textarea)$/.test(o))t=e;else if(o==="input")if(e.hasAttribute("type")){const s=e.getAttribute("type");(s==="file"||n.REG_TYPE_CHECK.test(s)||n.REG_TYPE_DATE.test(s)||n.REG_TYPE_TEXT.test(s))&&(t=e)}else t=e;t&&(e.required||e.hasAttribute("required"))&&i.add(e);break}case"optional":{let t;if(/^(?:select|textarea)$/.test(o))t=e;else if(o==="input")if(e.hasAttribute("type")){const s=e.getAttribute("type");(s==="file"||n.REG_TYPE_CHECK.test(s)||n.REG_TYPE_DATE.test(s)||n.REG_TYPE_TEXT.test(s))&&(t=e)}else t=e;t&&!(e.required||e.hasAttribute("required"))&&i.add(e);break}case"root":{e===this.#s.documentElement&&i.add(e);break}case"empty":{if(e.hasChildNodes()){const t=this.#r.createTreeWalker(e,n.SHOW_ALL);let s=t.firstChild(),f;for(;s&&(f=s.nodeType!==n.ELEMENT_NODE&&s.nodeType!==n.TEXT_NODE,!!f);)s=t.nextSibling();f&&i.add(e)}else i.add(e);break}case"first-child":{(r&&e===r.firstElementChild||e===this.#t)&&i.add(e);break}case"last-child":{(r&&e===r.lastElementChild||e===this.#t)&&i.add(e);break}case"only-child":{(r&&e===r.firstElementChild&&e===r.lastElementChild||e===this.#t)&&i.add(e);break}case"first-of-type":{if(r){const[t]=this._collectNthOfType({a:0,b:1},e);t&&i.add(t)}else e===this.#t&&i.add(e);break}case"last-of-type":{if(r){const[t]=this._collectNthOfType({a:0,b:1,reverse:!0},e);t&&i.add(t)}else e===this.#t&&i.add(e);break}case"only-of-type":{if(r){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.#t&&i.add(e);break}case"defined":{e.hasAttribute("is")||o.includes("-")?(0,_.isCustomElement)(e)&&i.add(e):(e instanceof this.#l.HTMLElement||e instanceof this.#l.SVGElement)&&i.add(e);break}case"popover-open":{if(e.popover){const{display:t}=this.#l.getComputedStyle(e);t!=="none"&&i.add(e)}break}case"host":case"host-context":break;case"after":case"before":case"first-letter":case"first-line":{if(d){const t=`Unsupported pseudo-element ::${a}`;throw new DOMException(t,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(d){const t=`Unsupported pseudo-class :${a}`;throw new DOMException(t,n.NOT_SUPPORTED_ERR)}break}default:if(a.startsWith("-webkit-")){if(d){const t=`Unsupported pseudo-class :${a}`;throw new DOMException(t,n.NOT_SUPPORTED_ERR)}}else if(!b){const t=`Unknown pseudo-class :${a}`;throw new DOMException(t,n.SYNTAX_ERR)}}return i}_matchShadowHostPseudoClass(l,e){const{children:h,name:c}=l;let a;if(Array.isArray(h)){const{branches:o}=(0,y.walkAST)(h[0]),[r]=o,[...b]=r,{host:d}=e;if(c==="host"){let i;for(const t of b){const{type:s}=t;if(s===n.COMBINATOR){const m=`Invalid selector ${(0,y.generateCSS)(l)}`;throw new DOMException(m,n.SYNTAX_ERR)}if(i=this._matchSelector(t,d).has(d),!i)break}i&&(a=e)}else if(c==="host-context"){let i=d,t;for(;i;){for(const s of b){const{type:f}=s;if(f===n.COMBINATOR){const u=`Invalid selector ${(0,y.generateCSS)(l)}`;throw new DOMException(u,n.SYNTAX_ERR)}if(t=this._matchSelector(s,i).has(i),!t)break}if(t)break;i=i.parentNode}t&&(a=e)}}else if(c==="host")a=e;else{const o=`Invalid selector :${c}`;throw new DOMException(o,n.SYNTAX_ERR)}return a??null}_matchSelector(l,e,h){const{type:c}=l,a=new Set;if(l.name===n.EMPTY)return a;const o=(0,y.unescapeSelector)(l.name);if(typeof o=="string"&&o!==l.name&&(l.name=o),e.nodeType===n.ELEMENT_NODE)switch(c){case n.SELECTOR_PSEUDO_ELEMENT:{O.matcher.matchPseudoElementSelector(o,h);break}case n.SELECTOR_ID:{e.id===o&&a.add(e);break}case n.SELECTOR_CLASS:{e.classList.contains(o)&&a.add(e);break}case n.SELECTOR_PSEUDO_CLASS:return this._matchPseudoClassSelector(l,e,h);default:{const r=O.matcher.matchSelector(l,e,h);r&&a.add(r)}}else if(this.#d&&c===n.SELECTOR_PSEUDO_CLASS&&e.nodeType===n.DOCUMENT_FRAGMENT_NODE){if(o!=="has"&&n.REG_LOGICAL_PSEUDO.test(o))return this._matchPseudoClassSelector(l,e,h);if(n.REG_SHADOW_HOST.test(o)){const r=this._matchShadowHostPseudoClass(l,e,h);r&&a.add(r)}}return a}_matchLeaves(l,e,h){const{attributes:c,localName:a,nodeType:o}=e;let r=this.#_.get(l),b;if(r&&r.has(e)){const{attr:d,matched:i}=r.get(e);c?.length===d&&(b=i)}if(typeof b!="boolean"){let d;o===n.ELEMENT_NODE&&n.REG_FORM.test(a)?d=!1:d=!0;for(const i of l){const{name:t,type:s}=i;if(s===n.SELECTOR_PSEUDO_CLASS&&t==="dir"&&(d=!1),b=this._matchSelector(i,e,h).has(e),!b)break}d&&(r||(r=new WeakMap),r.set(e,{attr:c?.length,matched:b}),this.#_.set(l,r))}return!!b}_matchHTMLCollection(l,e={}){const{compound:h,filterLeaves:c}=e,a=new Set,o=l.length;if(o)if(h)for(let r=0;r<o;r++){const b=l[r];this._matchLeaves(c,b,e)&&a.add(b)}else{const r=[].slice.call(l);return new Set(r)}return a}_findDescendantNodes(l,e,h){const[c,...a]=l,o=a.length>0,{type:r}=c,b=(0,y.unescapeSelector)(c.name);typeof b=="string"&&b!==c.name&&(c.name=b);let d=new Set,i=!1;if(this.#d)i=!0;else switch(r){case n.SELECTOR_PSEUDO_ELEMENT:{O.matcher.matchPseudoElementSelector(b,h);break}case n.SELECTOR_ID:{if(this.#t.nodeType===n.ELEMENT_NODE)i=!0;else{const t=this.#t.getElementById(b);t&&t!==e&&e.contains(t)&&(o?this._matchLeaves(a,t,h)&&d.add(t):d.add(t))}break}case n.SELECTOR_CLASS:{const t=e.getElementsByClassName(b);d=this._matchHTMLCollection(t,{compound:o,filterLeaves:a});break}case n.SELECTOR_TYPE:{if(this.#s.contentType==="text/html"&&!/[*|]/.test(b)){const t=e.getElementsByTagName(b);d=this._matchHTMLCollection(t,{compound:o,filterLeaves:a})}else i=!0;break}default:i=!0}return{nodes:d,pending:i}}_matchCombinator(l,e,h={}){const{combo:c,leaves:a}=l,{name:o}=c,{parentNode:r}=e,{dir:b}=h,d=new Set;if(b===x)switch(o){case"+":{const i=e.nextElementSibling;i&&this._matchLeaves(a,i,h)&&d.add(i);break}case"~":{if(r){const i=this._createTreeWalker(r);let t=(0,_.traverseNode)(e,i);for(t=i.nextSibling();t;)this._matchLeaves(a,t,h)&&d.add(t),t=i.nextSibling()}break}case">":{const i=this._createTreeWalker(e);let t=(0,_.traverseNode)(e,i);for(t=i.firstChild();t;)this._matchLeaves(a,t,h)&&d.add(t),t=i.nextSibling();break}case" ":default:{const{nodes:i,pending:t}=this._findDescendantNodes(a,e);if(i.size)return i;if(t){const s=this._createTreeWalker(e);let f=(0,_.traverseNode)(e,s);for(f=s.nextNode();f&&e.contains(f);)this._matchLeaves(a,f,h)&&d.add(f),f=s.nextNode()}}}else switch(o){case"+":{const i=e.previousElementSibling;i&&this._matchLeaves(a,i,h)&&d.add(i);break}case"~":{if(r){const i=this._createTreeWalker(r);let t=(0,_.traverseNode)(r,i);for(t=i.firstChild();t&&t!==e;)this._matchLeaves(a,t,h)&&d.add(t),t=i.nextSibling()}break}case">":{r&&this._matchLeaves(a,r,h)&&d.add(r);break}case" ":default:{const i=[];let t=r;for(;t;)this._matchLeaves(a,t,h)&&i.push(t),t=t.parentNode;if(i.length)return new Set(i.reverse())}}return d}_findNode(l,e){const{node:h}=e,c=this.#m;let a=(0,_.traverseNode)(h,c),o;if(a)for((a.nodeType!==n.ELEMENT_NODE||a===h&&a!==this.#t)&&(a=c.nextNode());a;){if(this._matchLeaves(l,a,{warn:this.#i})){o=a;break}a=c.nextNode()}return o??null}_matchSelf(l){const e=[],h=this._matchLeaves(l,this.#e,{warn:this.#i});let c=!1;return h&&(e.push(this.#e),c=!0),[e,c]}_findLineal(l,e={}){const{complex:h}=e,c=[];let a=this._matchLeaves(l,this.#e,{warn:this.#i}),o=!1;if(a&&(c.push(this.#e),o=!0),!a||h){let r=this.#e.parentNode;for(;r&&(a=this._matchLeaves(l,r,{warn:this.#i}),a&&(c.push(r),o=!0),r.parentNode);)r=r.parentNode}return[c,o]}_findFirst(l){const e=[],h=this._findNode(l,{node:this.#e});let c=!1;return h&&(e.push(h),c=!0),[e,c]}_findFromHTMLCollection(l,e={}){const{complex:h,compound:c,filterLeaves:a,targetType:o}=e;let r=[],b=!1,d=!1;const i=l.length;if(i)if(this.#e.nodeType===n.ELEMENT_NODE)for(let t=0;t<i;t++){const s=l[t];if(s!==this.#e&&(this.#e.contains(s)||s.contains(this.#e))){if(c){if(this._matchLeaves(a,s,{warn:this.#i})&&(r.push(s),b=!0,o===E))break}else if(r.push(s),b=!0,o===E)break}}else if(h)if(c)for(let t=0;t<i;t++){const s=l[t];if(this._matchLeaves(a,s,{warn:this.#i})&&(r.push(s),b=!0,o===E))break}else r=[].slice.call(l),b=!0,d=!0;else if(c)for(let t=0;t<i;t++){const s=l[t];if(this._matchLeaves(a,s,{warn:this.#i})&&(r.push(s),b=!0,o===E))break}else r=[].slice.call(l),b=!0,d=!0;return[r,b,d]}_findEntryNodes(l,e,h){const{leaves:c}=l,[a,...o]=c,r=o.length>0,{name:b,type:d}=a;let i=[],t=!1,s=!1,f=!1;switch(d){case n.SELECTOR_PSEUDO_ELEMENT:{O.matcher.matchPseudoElementSelector(b,{warn:this.#i});break}case n.SELECTOR_ID:{if(e===R)[i,s]=this._matchSelf(c);else if(e===C)[i,s]=this._findLineal(c,{complex:h});else if(e===E&&this.#t.nodeType!==n.ELEMENT_NODE){const m=this.#t.getElementById(b);m&&(r?this._matchLeaves(o,m,{warn:this.#i})&&(i.push(m),s=!0):(i.push(m),s=!0))}else e===E?[i,s]=this._findFirst(c):f=!0;break}case n.SELECTOR_CLASS:{if(e===R)[i,s]=this._matchSelf(c);else if(e===C)[i,s]=this._findLineal(c,{complex:h});else if(this.#t.nodeType===n.DOCUMENT_NODE){const m=this.#t.getElementsByClassName(b);m.length&&([i,s,t]=this._findFromHTMLCollection(m,{complex:h,compound:r,filterLeaves:o,targetType:e}))}else e===E?[i,s]=this._findFirst(c):f=!0;break}case n.SELECTOR_TYPE:{if(e===R)[i,s]=this._matchSelf(c);else if(e===C)[i,s]=this._findLineal(c,{complex:h});else if(this.#s.contentType==="text/html"&&this.#t.nodeType===n.DOCUMENT_NODE&&!/[*|]/.test(b)){const m=this.#t.getElementsByTagName(b);m.length&&([i,s,t]=this._findFromHTMLCollection(m,{complex:h,compound:r,filterLeaves:o,targetType:e}))}else e===E?[i,s]=this._findFirst(c):f=!0;break}default:if(e!==C&&n.REG_SHADOW_HOST.test(b)){if(this.#d&&this.#e.nodeType===n.DOCUMENT_FRAGMENT_NODE){const m=this._matchShadowHostPseudoClass(a,this.#e);m&&(i.push(m),s=!0)}}else e===R?[i,s]=this._matchSelf(c):e===C?[i,s]=this._findLineal(c,{complex:h}):e===E?[i,s]=this._findFirst(c):f=!0}return{collected:t,compound:r,filtered:s,nodes:i,pending:f}}_collectNodes(l){const e=this.#a.values();if(l===L||l===E){const h=new Set;let c=0;for(const{branch:a}of e){const o=a.length,r=o>1,b=a[0];let d,i;if(r){const{combo:p,leaves:[{name:w,type:k}]}=b,N=a[o-1],{leaves:[{name:A,type:v}]}=N;if(v===n.SELECTOR_PSEUDO_ELEMENT||v===n.SELECTOR_ID)d=S,i=N;else if(k===n.SELECTOR_PSEUDO_ELEMENT||k===n.SELECTOR_ID)d=x,i=b;else if(l===L)if(w==="*"&&k===n.SELECTOR_TYPE)d=S,i=N;else if(A==="*"&&v===n.SELECTOR_TYPE)d=x,i=b;else if(o===2){const{name:T}=p;/^[+~]$/.test(T)?(d=S,i=N):(d=x,i=b)}else d=x,i=b;else if(A==="*"&&v===n.SELECTOR_TYPE)d=x,i=b;else if(w==="*"&&k===n.SELECTOR_TYPE)d=S,i=N;else{let T;for(const{combo:P,leaves:[U]}of a){const{name:$,type:G}=U;if(G===n.SELECTOR_PSEUDO_CLASS&&$==="dir"){T=!1;break}if(!T&&P){const{name:F}=P;/^[+~]$/.test(F)&&(T=!0)}}T?(d=x,i=b):(d=S,i=N)}}else d=S,i=b;const{collected:t,compound:s,filtered:f,nodes:m,pending:u}=this._findEntryNodes(i,l,r);m.length?(this.#a[c].find=!0,this.#f[c]=m):u&&h.add(new Map([["index",c],["twig",i]])),this.#a[c].collected=t,this.#a[c].dir=d,this.#a[c].filtered=f||!s,c++}if(h.size){let a,o;this.#e!==this.#t&&this.#e.nodeType===n.ELEMENT_NODE?(a=this.#e,o=this.#m):(a=this.#t,o=this.#n);let r=(0,_.traverseNode)(a,o);for(;r;){let b=!1;if(this.#e.nodeType===n.ELEMENT_NODE?r===this.#e?b=!0:b=this.#e.contains(r):b=!0,b)for(const d of h){const{leaves:i}=d.get("twig");if(this._matchLeaves(i,r,{warn:this.#i})){const s=d.get("index");this.#a[s].filtered=!0,this.#a[s].find=!0,this.#f[s].push(r)}}r!==o.currentNode&&(r=(0,_.traverseNode)(r,o)),r=o.nextNode()}}}else{let h=0;for(const{branch:c}of e){const a=c[c.length-1],o=c.length>1,{compound:r,filtered:b,nodes:d}=this._findEntryNodes(a,l,o);d.length&&(this.#a[h].find=!0,this.#f[h]=d),this.#a[h].dir=S,this.#a[h].filtered=b||!r,h++}}return[this.#a,this.#f]}_getCombinedNodes(l,e,h){const c=[];for(const a of e){const o=this._matchCombinator(l,a,{dir:h,warn:this.#i});o.size&&c.push(...o)}return c.length?new Set(c):new Set}_matchNodeNext(l,e,h){const{combo:c,index:a}=h,{combo:o,leaves:r}=l[a],b={combo:c,leaves:r},d=this._getCombinedNodes(b,e,x);let i;if(d.size)if(a===l.length-1){const[t]=(0,_.sortNodes)(d);i=t}else i=this._matchNodeNext(l,d,{combo:o,index:a+1});return i??null}_matchNodePrev(l,e,h){const{index:c}=h,a=l[c],o=new Set([e]),r=this._getCombinedNodes(a,o,S);let b;if(r.size){if(c===0)b=e;else for(const d of r)if(this._matchNodePrev(l,d,{index:c-1}))return e}return b??null}_find(l){(l===L||l===E)&&this._prepareQuerySelectorWalker();const[[...e],h]=this._collectNodes(l),c=e.length;let a=new Set;for(let o=0;o<c;o++){const{branch:r,collected:b,dir:d,find:i}=e[o],t=r.length;if(t&&i){const s=h[o],f=s.length,m=t-1;if(m===0)if((l===L||l===E)&&this.#e.nodeType===n.ELEMENT_NODE)for(let u=0;u<f;u++){const p=s[u];if(p!==this.#e&&this.#e.contains(p)&&(a.add(p),l!==L))break}else if(l===L)if(a.size){const u=[...a];a=new Set([...u,...s]),this.#u=!0}else a=new Set(s);else{const[u]=s;a.add(u)}else if(l===L)if(d===x){let{combo:u}=r[0];for(const p of s){let w=new Set([p]);for(let k=1;k<t;k++){const{combo:N,leaves:A}=r[k],v={combo:u,leaves:A};if(w=this._getCombinedNodes(v,w,d),w.size)if(k===m)if(a.size){const T=[...a];a=new Set([...T,...w]),this.#u=!0}else a=w;else u=N;else break}}}else for(const u of s){let p=new Set([u]);for(let w=m-1;w>=0;w--){const k=r[w];if(p=this._getCombinedNodes(k,p,d),p.size)w===0&&(a.add(u),t>1&&a.size>1&&(this.#u=!0));else break}}else if(l===E&&d===x){const{combo:u}=r[0];let p;for(const w of s)if(p=this._matchNodeNext(r,new Set([w]),{combo:u,index:1}),p){a.add(p);break}if(!p&&!b){const{leaves:w}=r[0],[k]=s;let N=this._findNode(w,{node:k});for(;N;){if(p=this._matchNodeNext(r,new Set([N]),{combo:u,index:1}),p){a.add(p);break}N=this._findNode(w,{node:N})}}}else{let u;for(const p of s)if(u=this._matchNodePrev(r,p,{index:m-1}),u){a.add(p);break}if(!u&&!b&&l===E){const{leaves:p}=r[m],[w]=s;let k=this._findNode(p,{node:w});for(;k;){if(u=this._matchNodePrev(r,k,{index:m-1}),u){a.add(k);break}k=this._findNode(p,{node:k})}}}}}return a}matches(l,e,h){let c;try{if(e?.nodeType!==n.ELEMENT_NODE){const r=`Unexpected node ${e?.nodeName}`;throw new TypeError(r)}const a=e.ownerDocument;if(a===this.#r&&a.contentType==="text/html"){const r={complex:n.REG_COMPLEX.test(l),descendant:!0};if((0,y.filterSelector)(l,r))return this.#h.match(l,e)}this._setup(l,e,h),c=this._find(R).size}catch(a){this._onError(a)}return!!c}closest(l,e,h){let c;try{if(e?.nodeType!==n.ELEMENT_NODE){const r=`Unexpected node ${e?.nodeName}`;throw new TypeError(r)}const a=e.ownerDocument;if(a===this.#r&&a.contentType==="text/html"){const r={complex:n.REG_COMPLEX.test(l),descendant:!0};if((0,y.filterSelector)(l,r))return this.#h.closest(l,e)}this._setup(l,e,h);const o=this._find(C);if(o.size){let r=this.#e;for(;r;){if(o.has(r)){c=r;break}r=r.parentNode}}}catch(a){this._onError(a)}return c??null}querySelector(l,e,h){let c;try{(0,_.verifyNode)(e);let a;if(e.nodeType===n.DOCUMENT_NODE?a=e:a=e.ownerDocument,a===this.#r&&a.contentType==="text/html"&&(0,y.filterSelector)(l,{complex:!1,descendant:!1}))return this.#h.first(l,e);this._setup(l,e,h);const o=this._find(E);o.delete(this.#e),o.size&&([c]=(0,_.sortNodes)(o))}catch(a){this._onError(a)}return c??null}querySelectorAll(l,e,h){let c;try{(0,_.verifyNode)(e);let a;if(e.nodeType===n.DOCUMENT_NODE?a=e:a=e.ownerDocument,a===this.#r&&a.contentType==="text/html"&&(0,y.filterSelector)(l,{complex:!1,descendant:!0,qsa:!0}))return this.#h.select(l,e);this._setup(l,e,h);const o=this._find(L);o.delete(this.#e),o.size&&(this.#u?c=(0,_.sortNodes)(o):c=[...o])}catch(a){this._onError(a)}return c??[]}}0&&(module.exports={Finder});
//# sourceMappingURL=finder.js.map

@@ -1,3 +0,3 @@

var h=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var L=(s,t)=>{for(var r in t)h(s,r,{get:t[r],enumerable:!0})},I=(s,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of x(t))!S.call(s,n)&&n!==r&&h(s,n,{get:()=>t[n],enumerable:!(i=_(t,n))||i.enumerable});return s};var T=s=>I(h({},"__esModule",{value:!0}),s);var A={};L(A,{filterSelector:()=>C,generateCSS:()=>O.generate,parseAstName:()=>y,parseSelector:()=>u,preprocess:()=>g,sortAST:()=>w,unescapeSelector:()=>$,walkAST:()=>m});module.exports=T(A);var E=require("css-tree"),e=require("./constant.js"),O=require("css-tree");const $=(s="")=>{if(typeof s=="string"&&s.indexOf("\\",0)>=0){const t=s.split("\\"),r=t.length;for(let i=1;i<r;i++){let n=t[i];if(n===""&&i===r-1)n=e.U_FFFD;else{const o=e.REG_HEX.exec(n);if(o){const[,a]=o;let l;try{const f=parseInt("D800",e.HEX),p=parseInt("DFFF",e.HEX),d=parseInt(a,e.HEX);d===0||d>=f&&d<=p?l=e.U_FFFD:l=String.fromCodePoint(d)}catch{l=e.U_FFFD}let c="";n.length>a.length&&(c=n.substring(a.length)),n=`${l}${c}`}else/^[\n\r\f]/.test(n)&&(n="\\"+n)}t[i]=n}s=t.join("")}return s},g=(...s)=>{if(!s.length)throw new TypeError("1 argument required, but only 0 present.");let[t]=s;if(typeof t=="string"){let r=0;for(;r>=0&&(r=t.indexOf("#",r),!(r<0));){const i=t.substring(0,r+1);let n=t.substring(r+1);if(/^\d$/.test(n.substring(0,1)))throw new DOMException(`Invalid selector ${t}`,e.SYNTAX_ERR);const o=n.codePointAt(0);if(o===e.BIT_HYPHEN){if(/^\d$/.test(n.substring(1,2)))throw new DOMException(`Invalid selector ${t}`,e.SYNTAX_ERR)}else if(o>e.BIT_FFFF){const a=`\\${o.toString(e.HEX)} `;n.length===e.DUO?n=a:n=`${a}${n.substring(e.DUO)}`}t=`${i}${n}`,r++}t=t.replace(/\f|\r\n?/g,`
`).replace(/[\0\uD800-\uDFFF]|\\$/g,e.U_FFFD)}else if(t==null)t=Object.prototype.toString.call(t).slice(e.TYPE_FROM,e.TYPE_TO).toLowerCase();else if(Array.isArray(t))t=t.join(",");else if(Object.prototype.hasOwnProperty.call(t,"toString"))t=t.toString();else throw new DOMException(`Invalid selector ${t}`,e.SYNTAX_ERR);return t},u=s=>{if(s=g(s),e.REG_INVALID_SELECTOR.test(s))throw new DOMException(`Invalid selector ${s}`,e.SYNTAX_ERR);let t;try{const r=(0,E.parse)(s,{context:"selectorList",parseCustomProperty:!0});t=(0,E.toPlainObject)(r)}catch(r){const{message:i}=r;if(i==="Identifier is expected"&&e.REG_LANG_QUOTED.test(s)){const[,n,o]=e.REG_LANG_QUOTED.exec(s),a=o.replaceAll("*","\\*").replace(/^"/,"").replace(/"$/,"");let l=n.replace(o,a);l===":lang()"&&(l=`:lang(${e.EMPTY})`),t=u(s.replace(n,l))}else if(/^(?:Identifier|Selector) is expected$/.test(i)&&e.REG_LOGICAL_EMPTY.test(s)){const[,n,o]=e.REG_LOGICAL_EMPTY.exec(s);t=u(s.replace(n,`:${o}(${e.EMPTY})`))}else if(/^(?:"\]"|Attribute selector [()\s,=~^$*|]+) is expected$/.test(i)&&!s.endsWith("]")){const n=s.lastIndexOf("["),o=s.substring(n);o.includes('"')?o.match(/"/g).length%2?t=u(`${s}"]`):t=u(`${s}]`):t=u(`${s}]`)}else if(i==='")" is expected'&&!s.endsWith(")"))t=u(`${s})`);else throw new DOMException(i,e.SYNTAX_ERR)}return t},m=(s={})=>{const t=new Set,r=new Map;return(0,E.walk)(s,{enter:n=>{n.type===e.SELECTOR?t.add(n.children):n.type===e.SELECTOR_PSEUDO_CLASS?(r.set("hasPseudo",!0),e.REG_LOGICAL_PSEUDO.test(n.name)&&(r.set("hasPseudoFunc",!0),n.name==="has"&&r.set("hasHasPseudoFunc",!0))):n.type===e.SELECTOR_PSEUDO_ELEMENT?(r.set("hasPseudo",!0),e.REG_SHADOW_PSEUDO.test(n.name)&&r.set("hasPseudoFunc",!0)):n.type===e.SELECTOR_ATTR&&n.matcher==="|="&&r.set("hasHyphenSepAttr",!0)}}),r.get("hasPseudoFunc")&&(0,E.findAll)(s,(n,o,a)=>{if(a){if(n.type===e.SELECTOR_PSEUDO_CLASS&&e.REG_LOGICAL_PSEUDO.test(n.name)){const l=a.filter(c=>{const{name:f,type:p}=c;return p===e.SELECTOR_PSEUDO_CLASS&&e.REG_LOGICAL_PSEUDO.test(f)});for(const{children:c}of l)for(const{children:f}of c)for(const{children:p}of f)t.has(p)&&t.delete(p)}else if(n.type===e.SELECTOR_PSEUDO_ELEMENT&&e.REG_SHADOW_PSEUDO.test(n.name)){const l=a.filter(c=>{const{name:f,type:p}=c;return p===e.SELECTOR_PSEUDO_ELEMENT&&e.REG_SHADOW_PSEUDO.test(f)});for(const{children:c}of l)for(const{children:f}of c)t.has(f)&&t.delete(f)}}}),{branches:[...t],info:Object.fromEntries(r)}},w=s=>{const t=[...s];if(t.length>1){const r=new Map([[e.SELECTOR_PSEUDO_ELEMENT,e.BIT_01],[e.SELECTOR_ID,e.BIT_02],[e.SELECTOR_CLASS,e.BIT_04],[e.SELECTOR_TYPE,e.BIT_08],[e.SELECTOR_ATTR,e.BIT_16],[e.SELECTOR_PSEUDO_CLASS,e.BIT_32]]);t.sort((i,n)=>{const{type:o}=i,{type:a}=n,l=r.get(o),c=r.get(a);let f;return l===c?f=0:l>c?f=1:f=-1,f})}return t},y=s=>{let t,r;if(s&&typeof s=="string")s.indexOf("|")>-1?[t,r]=s.split("|"):(t="*",r=s);else throw new DOMException(`Invalid selector ${s}`,e.SYNTAX_ERR);return{prefix:t,localName:r}},C=(s,t={})=>{if(!s||typeof s!="string")return!1;if(s.includes("[")){const r=s.lastIndexOf("[");if(s.substring(r).lastIndexOf("]")<0)return!1}if(/\||::|\[\s*[\w$*=^|~-]+(?:(?:"[\w$*=^|~\s'-]+"|'[\w$*=^|~\s"-]+')?(?:\s+[\w$*=^|~-]+)+|"[^"\]]{1,255}|'[^'\]]{1,255})\s*\]/.test(s))return!1;if(s.includes(":")){let r;if(e.REG_LOGICAL_KEY.test(s)){if(e.REG_LOGICAL_EMPTY.test(s))return!1;const{complex:i,descendant:n}=t;i&&n?r=e.REG_LOGICAL_COMPLEX_A:i?r=e.REG_LOGICAL_COMPLEX_B:r=e.REG_LOGICAL_COMPOUND}else r=e.REG_CHILD_INDEXED;if(r.test(s))return!1}return!0};0&&(module.exports={filterSelector,generateCSS,parseAstName,parseSelector,preprocess,sortAST,unescapeSelector,walkAST});
var d=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var I=(s,t)=>{for(var r in t)d(s,r,{get:t[r],enumerable:!0})},L=(s,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of x(t))!S.call(s,n)&&n!==r&&d(s,n,{get:()=>t[n],enumerable:!(i=_(t,n))||i.enumerable});return s};var T=s=>L(d({},"__esModule",{value:!0}),s);var A={};I(A,{filterSelector:()=>C,generateCSS:()=>O.generate,parseAstName:()=>w,parseSelector:()=>E,preprocess:()=>g,sortAST:()=>m,unescapeSelector:()=>y,walkAST:()=>$});module.exports=T(A);var h=require("css-tree"),e=require("./constant.js"),O=require("css-tree");const y=(s="")=>{if(typeof s=="string"&&s.indexOf("\\",0)>=0){const t=s.split("\\"),r=t.length;for(let i=1;i<r;i++){let n=t[i];if(n===""&&i===r-1)n=e.U_FFFD;else{const f=e.REG_HEX.exec(n);if(f){const[,a]=f;let l;try{const o=parseInt("D800",e.HEX),p=parseInt("DFFF",e.HEX),u=parseInt(a,e.HEX);u===0||u>=o&&u<=p?l=e.U_FFFD:l=String.fromCodePoint(u)}catch{l=e.U_FFFD}let c="";n.length>a.length&&(c=n.substring(a.length)),n=`${l}${c}`}else/^[\n\r\f]/.test(n)&&(n="\\"+n)}t[i]=n}s=t.join("")}return s},g=(...s)=>{if(!s.length)throw new TypeError("1 argument required, but only 0 present.");let[t]=s;if(typeof t=="string"){let r=0;for(;r>=0&&(r=t.indexOf("#",r),!(r<0));){const i=t.substring(0,r+1);let n=t.substring(r+1);if(/^\d$/.test(n.substring(0,1)))throw new DOMException(`Invalid selector ${t}`,e.SYNTAX_ERR);const f=n.codePointAt(0);if(f===e.BIT_HYPHEN){if(/^\d$/.test(n.substring(1,2)))throw new DOMException(`Invalid selector ${t}`,e.SYNTAX_ERR)}else if(f>e.BIT_FFFF){const a=`\\${f.toString(e.HEX)} `;n.length===e.DUO?n=a:n=`${a}${n.substring(e.DUO)}`}t=`${i}${n}`,r++}t=t.replace(/\f|\r\n?/g,`
`).replace(/[\0\uD800-\uDFFF]|\\$/g,e.U_FFFD)}else if(t==null)t=Object.prototype.toString.call(t).slice(e.TYPE_FROM,e.TYPE_TO).toLowerCase();else if(Array.isArray(t))t=t.join(",");else if(Object.prototype.hasOwnProperty.call(t,"toString"))t=t.toString();else throw new DOMException(`Invalid selector ${t}`,e.SYNTAX_ERR);return t},E=s=>{if(s=g(s),e.REG_INVALID_SELECTOR.test(s))throw new DOMException(`Invalid selector ${s}`,e.SYNTAX_ERR);let t;try{const r=(0,h.parse)(s,{context:"selectorList",parseCustomProperty:!0});t=(0,h.toPlainObject)(r)}catch(r){const{message:i}=r;if(i==="Identifier is expected"&&e.REG_LANG_QUOTED.test(s)){const[,n,f]=e.REG_LANG_QUOTED.exec(s),a=f.replaceAll("*","\\*").replace(/^"/,"").replace(/"$/,"");let l=n.replace(f,a);l===":lang()"&&(l=`:lang(${e.EMPTY})`),t=E(s.replace(n,l))}else if(/^(?:Identifier|Selector) is expected$/.test(i)&&e.REG_LOGICAL_EMPTY.test(s)){const[,n,f]=e.REG_LOGICAL_EMPTY.exec(s);t=E(s.replace(n,`:${f}(${e.EMPTY})`))}else if(/^(?:"\]"|Attribute selector [()\s,=~^$*|]+) is expected$/.test(i)&&!s.endsWith("]")){const n=s.lastIndexOf("["),f=s.substring(n);f.includes('"')?f.match(/"/g).length%2?t=E(`${s}"]`):t=E(`${s}]`):t=E(`${s}]`)}else if(i==='")" is expected'&&!s.endsWith(")"))t=E(`${s})`);else throw new DOMException(i,e.SYNTAX_ERR)}return t},$=(s={})=>{const t=new Set,r=new Map;return(0,h.walk)(s,{enter:n=>{n.type===e.SELECTOR?t.add(n.children):n.type===e.SELECTOR_PSEUDO_CLASS?(r.set("hasPseudo",!0),e.REG_LOGICAL_PSEUDO.test(n.name)&&(r.set("hasPseudoFunc",!0),n.name==="has"&&r.set("hasHasPseudoFunc",!0))):n.type===e.SELECTOR_PSEUDO_ELEMENT?(r.set("hasPseudo",!0),e.REG_SHADOW_PSEUDO.test(n.name)&&r.set("hasPseudoFunc",!0)):n.type===e.SELECTOR_ATTR&&n.matcher==="|="?r.set("hasHyphenSepAttr",!0):n.type===e.NTH&&n.selector&&r.set("hasNthChildOfSelector",!0)}}),r.get("hasPseudoFunc")&&(0,h.findAll)(s,(n,f,a)=>{if(a){if(n.type===e.SELECTOR_PSEUDO_CLASS&&e.REG_LOGICAL_PSEUDO.test(n.name)){const l=a.filter(c=>{const{name:o,type:p}=c;return p===e.SELECTOR_PSEUDO_CLASS&&e.REG_LOGICAL_PSEUDO.test(o)});for(const{children:c}of l)for(const{children:o}of c)for(const{children:p}of o)t.has(p)&&t.delete(p)}else if(n.type===e.SELECTOR_PSEUDO_ELEMENT&&e.REG_SHADOW_PSEUDO.test(n.name)){const l=a.filter(c=>{const{name:o,type:p}=c;return p===e.SELECTOR_PSEUDO_ELEMENT&&e.REG_SHADOW_PSEUDO.test(o)});for(const{children:c}of l)for(const{children:o}of c)t.has(o)&&t.delete(o)}else if(n.type===e.NTH&&n.selector){const l=a.filter(c=>{const{selector:o,type:p}=c;return p===e.NTH&&o});for(const{selector:c}of l){const{children:o}=c;for(const{children:p}of o)t.has(p)&&t.delete(p)}}}}),{branches:[...t],info:Object.fromEntries(r)}},m=s=>{const t=[...s];if(t.length>1){const r=new Map([[e.SELECTOR_PSEUDO_ELEMENT,e.BIT_01],[e.SELECTOR_ID,e.BIT_02],[e.SELECTOR_CLASS,e.BIT_04],[e.SELECTOR_TYPE,e.BIT_08],[e.SELECTOR_ATTR,e.BIT_16],[e.SELECTOR_PSEUDO_CLASS,e.BIT_32]]);t.sort((i,n)=>{const{type:f}=i,{type:a}=n,l=r.get(f),c=r.get(a);let o;return l===c?o=0:l>c?o=1:o=-1,o})}return t},w=s=>{let t,r;if(s&&typeof s=="string")s.indexOf("|")>-1?[t,r]=s.split("|"):(t="*",r=s);else throw new DOMException(`Invalid selector ${s}`,e.SYNTAX_ERR);return{prefix:t,localName:r}},C=(s,t={})=>{if(!s||typeof s!="string")return!1;if(s.includes("[")){const r=s.lastIndexOf("[");if(s.substring(r).lastIndexOf("]")<0)return!1}if(/\||::|\[\s*[\w$*=^|~-]+(?:(?:"[\w$*=^|~\s'-]+"|'[\w$*=^|~\s"-]+')?(?:\s+[\w$*=^|~-]+)+|"[^"\]]{1,255}|'[^'\]]{1,255})\s*\]/.test(s))return!1;if(s.includes(":")){let r;if(e.REG_LOGICAL_KEY.test(s)){if(e.REG_LOGICAL_EMPTY.test(s))return!1;const{complex:i,descendant:n,qsa:f}=t;i&&n||f?r=e.REG_LOGICAL_COMPLEX:r=e.REG_LOGICAL_COMPOUND}else r=e.REG_CHILD_INDEXED;if(r.test(s))return!1}return!0};0&&(module.exports={filterSelector,generateCSS,parseAstName,parseSelector,preprocess,sortAST,unescapeSelector,walkAST});
//# sourceMappingURL=parser.js.map

@@ -41,3 +41,3 @@ {

"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsdoc": "^48.5.2",
"eslint-plugin-jsdoc": "^48.7.0",
"eslint-plugin-regexp": "^2.6.0",

@@ -64,3 +64,3 @@ "eslint-plugin-unicorn": "^54.0.0",

},
"version": "4.6.1"
"version": "4.6.3"
}

@@ -167,10 +167,10 @@ # DOM Selector

|E:nth&#8209;last&#8209;col(n)|Unsupported| |
|E:popover-open|✓| |
|E:host|✓| |
|E:host(s)|✓| |
|E:host&#8209;context(s)|✓| |
|E:popover-open|✓| |
|E:state(v)|✓|*1|
|E:host(:state(v))|✓|*1|
*1: `ElementInternals.states`, i.e. `CustomStateSet`, is not implemented in jsdom, so you need to patch yourself.
*1: `ElementInternals.states`, i.e. `CustomStateSet`, is not implemented in jsdom, so you need to apply a patch in the custom element constructor.

@@ -177,0 +177,0 @@ ``` javascript

@@ -49,3 +49,3 @@ /**

/* NodeFilter */
export const SHOW_ALL = 0xffffffff;
export const SHOW_ALL = 0xFFFFFFFF;
export const SHOW_DOCUMENT = 0x100;

@@ -73,15 +73,11 @@ export const SHOW_DOCUMENT_FRAGMENT = 0x400;

export const TAG_TYPE_I = '\\*|[A-Z][\\w-]*';
// LOGICAL_KEY: excludes :has()
// LOGICAL_KEY: :has() and :where() are excluded
export const LOGICAL_KEY = '(?:is|not)';
export const COMPOUND = `(?:${TAG_TYPE}|(?:${TAG_TYPE})?(?:${SUB_TYPE})+)`;
export const COMBO_A = '\\s?[\\s>~+]\\s?';
export const COMBO_B = '\\s?[~+]\\s?';
export const COMPLEX_A = `${COMPOUND}(?:${COMBO_A}${COMPOUND})*`;
export const COMPLEX_B = `${COMPOUND}(?:${COMBO_B}${COMPOUND})*`;
export const COMBO = '\\s?[\\s>~+]\\s?';
export const COMPLEX = `${COMPOUND}(?:${COMBO}${COMPOUND})*`;
export const NESTED_LOGICAL_A =
`:is\\(\\s*${COMPOUND}(?:\\s*,\\s*${COMPOUND})*\\s*\\)`;
export const NESTED_LOGICAL_B =
`:is\\(\\s*${COMPLEX_A}(?:\\s*,\\s*${COMPLEX_A})*\\s*\\)`;
export const NESTED_LOGICAL_C =
`:is\\(\\s*${COMPLEX_B}(?:\\s*,\\s*${COMPLEX_B})*\\s*\\)`;
`:is\\(\\s*${COMPLEX}(?:\\s*,\\s*${COMPLEX})*\\s*\\)`;
export const COMPOUND_A =

@@ -91,12 +87,7 @@ `(?:${TAG_TYPE}|(?:${TAG_TYPE})?(?:${SUB_TYPE}|${NESTED_LOGICAL_A})+)`;

`(?:${TAG_TYPE}|(?:${TAG_TYPE})?(?:${SUB_TYPE}|${NESTED_LOGICAL_B})+)`;
export const COMPOUND_C =
`(?:${TAG_TYPE}|(?:${TAG_TYPE})?(?:${SUB_TYPE}|${NESTED_LOGICAL_C})+)`;
export const COMPOUND_I =
`(?:${TAG_TYPE_I}|(?:${TAG_TYPE_I})?(?:${SUB_TYPE})+)`;
export const COMPLEX_C = `${COMPOUND_B}(?:${COMBO_A}${COMPOUND_B})*`;
export const COMPLEX_D = `${COMPOUND_C}(?:${COMBO_B}${COMPOUND_C})*`;
export const LOGICAL_COMPLEX_A =
`${LOGICAL_KEY}\\(\\s*${COMPLEX_C}(?:\\s*,\\s*${COMPLEX_C})*\\s*\\)`;
export const LOGICAL_COMPLEX_B =
`${LOGICAL_KEY}\\(\\s*${COMPLEX_D}(?:\\s*,\\s*${COMPLEX_D})*\\s*\\)`;
export const COMPLEX_L = `${COMPOUND_B}(?:${COMBO}${COMPOUND_B})*`;
export const LOGICAL_COMPLEX =
`${LOGICAL_KEY}\\(\\s*${COMPLEX_L}(?:\\s*,\\s*${COMPLEX_L})*\\s*\\)`;
export const LOGICAL_COMPOUND =

@@ -108,3 +99,3 @@ `${LOGICAL_KEY}\\(\\s*${COMPOUND_A}(?:\\s*,\\s*${COMPOUND_A})*\\s*\\)`;

export const REG_CHILD_INDEXED = new RegExp(`:(?!${PSEUDO_CLASSES}|${N_TH})`);
export const REG_COMPLEX = new RegExp(`${COMBO_A}${COMPOUND_I}`, 'i');
export const REG_COMPLEX = new RegExp(`${COMBO}${COMPOUND_I}`, 'i');
export const REG_DIR = /^(?:ltr|rtl)$/;

@@ -121,6 +112,4 @@ export const REG_FORM = /^(?:(?:fieldse|inpu|selec)t|button|form|textarea)$/;

export const REG_LANG_QUOTED = /(:lang\(\s*("[A-Za-z\d\-*]*")\s*\))/;
export const REG_LOGICAL_COMPLEX_A =
new RegExp(`:(?!${PSEUDO_CLASSES}|${N_TH}|${LOGICAL_COMPLEX_A})`);
export const REG_LOGICAL_COMPLEX_B =
new RegExp(`:(?!${PSEUDO_CLASSES}|${N_TH}|${LOGICAL_COMPLEX_B})`);
export const REG_LOGICAL_COMPLEX =
new RegExp(`:(?!${PSEUDO_CLASSES}|${N_TH}|${LOGICAL_COMPLEX})`);
export const REG_LOGICAL_COMPOUND =

@@ -127,0 +116,0 @@ new RegExp(`:(?!${PSEUDO_CLASSES}|${N_TH}|${LOGICAL_COMPOUND})`);

@@ -11,8 +11,7 @@ /**

BIT_01, BIT_02, BIT_04, BIT_08, BIT_16, BIT_32, BIT_FFFF, BIT_HYPHEN,
DUO, EMPTY, HEX, REG_CHILD_INDEXED, REG_HEX, REG_INVALID_SELECTOR,
REG_LANG_QUOTED, REG_LOGICAL_COMPLEX_A, REG_LOGICAL_COMPLEX_B,
REG_LOGICAL_COMPOUND, REG_LOGICAL_EMPTY, REG_LOGICAL_KEY, REG_LOGICAL_PSEUDO,
REG_SHADOW_PSEUDO, SELECTOR, SELECTOR_ATTR, SELECTOR_CLASS, SELECTOR_ID,
SELECTOR_PSEUDO_CLASS, SELECTOR_PSEUDO_ELEMENT, SELECTOR_TYPE, SYNTAX_ERR,
TYPE_FROM, TYPE_TO, U_FFFD
DUO, EMPTY, HEX, NTH, REG_CHILD_INDEXED, REG_HEX, REG_INVALID_SELECTOR,
REG_LANG_QUOTED, REG_LOGICAL_COMPLEX, REG_LOGICAL_COMPOUND,
REG_LOGICAL_EMPTY, REG_LOGICAL_KEY, REG_LOGICAL_PSEUDO, REG_SHADOW_PSEUDO,
SELECTOR, SELECTOR_ATTR, SELECTOR_CLASS, SELECTOR_ID, SELECTOR_PSEUDO_CLASS,
SELECTOR_PSEUDO_ELEMENT, SELECTOR_TYPE, SYNTAX_ERR, TYPE_FROM, TYPE_TO, U_FFFD
} from './constant.js';

@@ -209,2 +208,4 @@

info.set('hasHyphenSepAttr', true);
} else if (node.type === NTH && node.selector) {
info.set('hasNthChildOfSelector', true);
}

@@ -252,2 +253,17 @@ }

}
} else if (node.type === NTH && node.selector) {
const itemList = list.filter(i => {
const { selector, type } = i;
const res = type === NTH && selector;
return res;
});
for (const { selector } of itemList) {
const { children } = selector;
// Selector
for (const { children: grandChildren } of children) {
if (branches.has(grandChildren)) {
branches.delete(grandChildren);
}
}
}
}

@@ -355,7 +371,5 @@ }

}
const { complex, descendant } = opt;
if (complex && descendant) {
reg = REG_LOGICAL_COMPLEX_A;
} else if (complex) {
reg = REG_LOGICAL_COMPLEX_B;
const { complex, descendant, qsa } = opt;
if ((complex && descendant) || qsa) {
reg = REG_LOGICAL_COMPLEX;
} else {

@@ -362,0 +376,0 @@ reg = REG_LOGICAL_COMPOUND;

@@ -55,17 +55,11 @@ export const AN_PLUS_B: "AnPlusB";

export const COMPOUND: "(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+)+)";
export const COMBO_A: "\\s?[\\s>~+]\\s?";
export const COMBO_B: "\\s?[~+]\\s?";
export const COMPLEX_A: "(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+)+)(?:\\s?[\\s>~+]\\s?(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+)+))*";
export const COMPLEX_B: "(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+)+)(?:\\s?[~+]\\s?(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+)+))*";
export const COMBO: "\\s?[\\s>~+]\\s?";
export const COMPLEX: "(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+)+)(?:\\s?[\\s>~+]\\s?(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+)+))*";
export const NESTED_LOGICAL_A: ":is\\(\\s*(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+)+)(?:\\s*,\\s*(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+)+))*\\s*\\)";
export const NESTED_LOGICAL_B: ":is\\(\\s*(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+)+)(?:\\s?[\\s>~+]\\s?(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+)+))*(?:\\s*,\\s*(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+)+)(?:\\s?[\\s>~+]\\s?(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+)+))*)*\\s*\\)";
export const NESTED_LOGICAL_C: ":is\\(\\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z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+|:is\\(\\s*(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+)+)(?:\\s*,\\s*(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+)+))*\\s*\\))+)(?:\\s*,\\s*(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+|:is\\(\\s*(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+)+)(?:\\s*,\\s*(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+)+))*\\s*\\))+))*\\s*\\)";

@@ -85,4 +79,3 @@ export const REG_ANCHOR: RegExp;

export const REG_LANG_QUOTED: RegExp;
export const REG_LOGICAL_COMPLEX_A: RegExp;
export const REG_LOGICAL_COMPLEX_B: RegExp;
export const REG_LOGICAL_COMPLEX: RegExp;
export const REG_LOGICAL_COMPOUND: RegExp;

@@ -89,0 +82,0 @@ export const REG_LOGICAL_EMPTY: RegExp;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc