New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@asamuzakjp/dom-selector

Package Overview
Dependencies
Maintainers
1
Versions
194
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 5.4.0 to 6.0.0

2

dist/cjs/js/constant.js

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

var x=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var F=(o,t)=>{for(var c in t)x(o,c,{get:t[c],enumerable:!0})},i=(o,t,c,L)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of l(t))!M.call(o,s)&&s!==c&&x(o,s,{get:()=>t[s],enumerable:!(L=R(t,s))||L.enumerable});return o};var a=o=>i(x({},"__esModule",{value:!0}),o);var Mt={};F(Mt,{ALPHA_NUM:()=>$,ANB:()=>A,ATTR_SELECTOR:()=>G,BIT_01:()=>v,BIT_02:()=>K,BIT_04:()=>g,BIT_08:()=>z,BIT_16:()=>j,BIT_32:()=>q,BIT_FFFF:()=>J,CHILD_IDX:()=>I,CLASS_SELECTOR:()=>U,COMBINATOR:()=>d,COMBO:()=>T,COMPLEX:()=>_,COMPLEX_L:()=>S,COMPOUND:()=>n,COMPOUND_A:()=>O,COMPOUND_B:()=>N,COMPOUND_I:()=>At,DESCEND:()=>It,DIGIT:()=>E,DOCUMENT_FRAGMENT_NODE:()=>ct,DOCUMENT_NODE:()=>nt,DOCUMENT_POSITION_CONTAINED_BY:()=>pt,DOCUMENT_POSITION_CONTAINS:()=>xt,DOCUMENT_POSITION_PRECEDING:()=>Et,DUO:()=>Q,ELEMENT_NODE:()=>st,EMPTY:()=>B,HEX:()=>V,HYPHEN:()=>tt,IDENT:()=>Y,ID_SELECTOR:()=>H,KEY_IS_NOT:()=>C,LANG_PART:()=>Ct,LOGICAL_COMPLEX:()=>Pt,LOGICAL_COMPOUND:()=>Dt,NESTED_LOGICAL_A:()=>P,NESTED_LOGICAL_B:()=>D,NOT_SUPPORTED_ERR:()=>h,NTH:()=>m,N_TH:()=>$t,PSEUDO_CLASS:()=>Lt,PS_CLASS_SELECTOR:()=>y,PS_ELEMENT_SELECTOR:()=>X,REG_INPUT_TYPE:()=>lt,REG_LOGICAL:()=>Rt,SELECTOR:()=>f,SHOW_ALL:()=>Tt,SHOW_DOCUMENT:()=>_t,SHOW_DOCUMENT_FRAGMENT:()=>Ot,SHOW_ELEMENT:()=>Nt,SUB_TYPE:()=>r,SYNTAX_ERR:()=>u,TAG_TYPE:()=>e,TAG_TYPE_I:()=>p,TARGET_ALL:()=>w,TARGET_FIRST:()=>W,TARGET_LINEAL:()=>b,TARGET_SELF:()=>k,TEXT_NODE:()=>rt,TYPE_FROM:()=>ot,TYPE_SELECTOR:()=>Z,TYPE_TO:()=>et,WALKER_FILTER:()=>St});module.exports=a(Mt);const G="AttributeSelector",U="ClassSelector",d="Combinator",B="__EMPTY__",Y="Identifier",H="IdSelector",h="NotSupportedError",m="Nth",y="PseudoClassSelector",X="PseudoElementSelector",f="Selector",u="SyntaxError",w="all",W="first",b="lineal",k="self",Z="TypeSelector",v=1,K=2,g=4,z=8,j=16,q=32,J=65535,Q=2,V=16,tt=45,ot=8,et=-1,st=1,rt=3,nt=9,ct=11,Et=2,xt=8,pt=16,Tt=4294967295,_t=256,Ot=1024,Nt=1,St=1281,$="[A-Z\\d]+",I="(?:first|last|only)-(?:child|of-type)",E="(?:0|[1-9]\\d*)",Ct=`(?:-${$})*`,Lt=`(?:any-)?link|${I}|checked|empty|indeterminate|root|target|visited`,A=`[+-]?(?:${E}n?|n)|(?:[+-]?${E})?n\\s*[+-]\\s*${E}`,$t=`nth-(?:last-)?(?:child|of-type)\\(\\s*(?:even|odd|${A})\\s*\\)`,r="\\[[^|\\]]+\\]|[#.:][\\w-]+",e="\\*|[A-Za-z][\\w-]*",p="\\*|[A-Z][\\w-]*",n=`(?:${e}|(?:${e})?(?:${r})+)`,T="\\s?[\\s>~+]\\s?",_=`${n}(?:${T}${n})*`,It="\\s?[\\s>]\\s?",P=`:is\\(\\s*${n}(?:\\s*,\\s*${n})*\\s*\\)`,D=`:is\\(\\s*${_}(?:\\s*,\\s*${_})*\\s*\\)`,O=`(?:${e}|(?:${e})?(?:${r}|${P})+)`,N=`(?:${e}|(?:${e})?(?:${r}|${D})+)`,At=`(?:${p}|(?:${p})?(?:${r})+)`,S=`${N}(?:${T}${N})*`,C="(?:is|not)",Pt=`${C}\\(\\s*${S}(?:\\s*,\\s*${S})*\\s*\\)`,Dt=`${C}\\(\\s*${O}(?:\\s*,\\s*${O})*\\s*\\)`,Rt=/^(?:has|is|not|where)$/,lt=/^(?:date(?:time-local)?|email|month|number|password|search|tel|text|time|url|week)$/;0&&(module.exports={ALPHA_NUM,ANB,ATTR_SELECTOR,BIT_01,BIT_02,BIT_04,BIT_08,BIT_16,BIT_32,BIT_FFFF,CHILD_IDX,CLASS_SELECTOR,COMBINATOR,COMBO,COMPLEX,COMPLEX_L,COMPOUND,COMPOUND_A,COMPOUND_B,COMPOUND_I,DESCEND,DIGIT,DOCUMENT_FRAGMENT_NODE,DOCUMENT_NODE,DOCUMENT_POSITION_CONTAINED_BY,DOCUMENT_POSITION_CONTAINS,DOCUMENT_POSITION_PRECEDING,DUO,ELEMENT_NODE,EMPTY,HEX,HYPHEN,IDENT,ID_SELECTOR,KEY_IS_NOT,LANG_PART,LOGICAL_COMPLEX,LOGICAL_COMPOUND,NESTED_LOGICAL_A,NESTED_LOGICAL_B,NOT_SUPPORTED_ERR,NTH,N_TH,PSEUDO_CLASS,PS_CLASS_SELECTOR,PS_ELEMENT_SELECTOR,REG_INPUT_TYPE,REG_LOGICAL,SELECTOR,SHOW_ALL,SHOW_DOCUMENT,SHOW_DOCUMENT_FRAGMENT,SHOW_ELEMENT,SUB_TYPE,SYNTAX_ERR,TAG_TYPE,TAG_TYPE_I,TARGET_ALL,TARGET_FIRST,TARGET_LINEAL,TARGET_SELF,TEXT_NODE,TYPE_FROM,TYPE_SELECTOR,TYPE_TO,WALKER_FILTER});
var x=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var a=(o,t)=>{for(var c in t)x(o,c,{get:t[c],enumerable:!0})},F=(o,t,c,C)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of i(t))!M.call(o,s)&&s!==c&&x(o,s,{get:()=>t[s],enumerable:!(C=R(t,s))||C.enumerable});return o};var U=o=>F(x({},"__esModule",{value:!0}),o);var Ut={};a(Ut,{ALPHA_NUM:()=>I,ANB:()=>A,ATTR_SELECTOR:()=>d,BIT_01:()=>k,BIT_02:()=>g,BIT_04:()=>Z,BIT_08:()=>v,BIT_16:()=>q,BIT_32:()=>J,BIT_FFFF:()=>Q,CHILD_IDX:()=>L,CLASS_SELECTOR:()=>Y,COMBINATOR:()=>G,COMBO:()=>p,COMPLEX:()=>_,COMPLEX_L:()=>S,COMPOUND:()=>n,COMPOUND_A:()=>O,COMPOUND_B:()=>N,COMPOUND_I:()=>$t,DESCEND:()=>Pt,DIGIT:()=>E,DOCUMENT_FRAGMENT_NODE:()=>Et,DOCUMENT_NODE:()=>ct,DOCUMENT_POSITION_CONTAINED_BY:()=>pt,DOCUMENT_POSITION_CONTAINS:()=>Tt,DOCUMENT_POSITION_PRECEDING:()=>xt,DUO:()=>V,ELEMENT_NODE:()=>rt,EMPTY:()=>b,HEX:()=>tt,HYPHEN:()=>ot,IDENT:()=>B,ID_SELECTOR:()=>f,KEY_FORM_FOCUS:()=>Rt,KEY_INPUT_BUTTON:()=>it,KEY_INPUT_DATE:()=>D,KEY_INPUT_EDIT:()=>Mt,KEY_INPUT_LTR:()=>at,KEY_INPUT_TEXT:()=>l,KEY_LOGICAL:()=>Ft,LANG_PART:()=>It,LOGICAL_COMPLEX:()=>Dt,LOGICAL_COMPOUND:()=>lt,NESTED_LOGICAL_A:()=>P,NESTED_LOGICAL_B:()=>$,NOT_SUPPORTED_ERR:()=>m,NTH:()=>u,N_TH:()=>At,PSEUDO_CLASS:()=>Lt,PS_CLASS_SELECTOR:()=>H,PS_ELEMENT_SELECTOR:()=>h,SELECTOR:()=>z,SHOW_ALL:()=>_t,SHOW_DOCUMENT:()=>Ot,SHOW_DOCUMENT_FRAGMENT:()=>Nt,SHOW_ELEMENT:()=>St,SUB_TYPE:()=>r,SYNTAX_ERR:()=>K,TAG_TYPE:()=>e,TAG_TYPE_I:()=>T,TARGET_ALL:()=>X,TARGET_FIRST:()=>j,TARGET_LINEAL:()=>y,TARGET_SELF:()=>w,TEXT_NODE:()=>nt,TYPE_FROM:()=>et,TYPE_SELECTOR:()=>W,TYPE_TO:()=>st,WALKER_FILTER:()=>Ct});module.exports=U(Ut);const d="AttributeSelector",Y="ClassSelector",G="Combinator",b="__EMPTY__",B="Identifier",f="IdSelector",m="NotSupportedError",u="Nth",H="PseudoClassSelector",h="PseudoElementSelector",z="Selector",K="SyntaxError",X="all",j="first",y="lineal",w="self",W="TypeSelector",k=1,g=2,Z=4,v=8,q=16,J=32,Q=65535,V=2,tt=16,ot=45,et=8,st=-1,rt=1,nt=3,ct=9,Et=11,xt=2,Tt=8,pt=16,_t=4294967295,Ot=256,Nt=1024,St=1,Ct=1281,I="[A-Z\\d]+",L="(?:first|last|only)-(?:child|of-type)",E="(?:0|[1-9]\\d*)",It=`(?:-${I})*`,Lt=`(?:any-)?link|${L}|checked|empty|indeterminate|root|target|visited`,A=`[+-]?(?:${E}n?|n)|(?:[+-]?${E})?n\\s*[+-]\\s*${E}`,At=`nth-(?:last-)?(?:child|of-type)\\(\\s*(?:even|odd|${A})\\s*\\)`,r="\\[[^|\\]]+\\]|[#.:][\\w-]+",e="\\*|[A-Za-z][\\w-]*",T="\\*|[A-Z][\\w-]*",n=`(?:${e}|(?:${e})?(?:${r})+)`,p="\\s?[\\s>~+]\\s?",_=`${n}(?:${p}${n})*`,Pt="\\s?[\\s>]\\s?",P=`:is\\(\\s*${n}(?:\\s*,\\s*${n})*\\s*\\)`,$=`:is\\(\\s*${_}(?:\\s*,\\s*${_})*\\s*\\)`,O=`(?:${e}|(?:${e})?(?:${r}|${P})+)`,N=`(?:${e}|(?:${e})?(?:${r}|${$})+)`,$t=`(?:${T}|(?:${T})?(?:${r})+)`,S=`${N}(?:${p}${N})*`,Dt=`(?:is|not)\\(\\s*${S}(?:\\s*,\\s*${S})*\\s*\\)`,lt=`(?:is|not)\\(\\s*${O}(?:\\s*,\\s*${O})*\\s*\\)`,Rt=Object.freeze(["button","input","select","textarea"]),it=Object.freeze(["button","reset","submit"]),D=Object.freeze(["date","datetime-local","month","time","week"]),l=Object.freeze(["email","password","search","tel","text","url"]),Mt=Object.freeze([...D,...l,"number"]),at=Object.freeze(["checkbox","color","date","image","number","range","radio","time"]),Ft=Object.freeze(["has","is","not","where"]);0&&(module.exports={ALPHA_NUM,ANB,ATTR_SELECTOR,BIT_01,BIT_02,BIT_04,BIT_08,BIT_16,BIT_32,BIT_FFFF,CHILD_IDX,CLASS_SELECTOR,COMBINATOR,COMBO,COMPLEX,COMPLEX_L,COMPOUND,COMPOUND_A,COMPOUND_B,COMPOUND_I,DESCEND,DIGIT,DOCUMENT_FRAGMENT_NODE,DOCUMENT_NODE,DOCUMENT_POSITION_CONTAINED_BY,DOCUMENT_POSITION_CONTAINS,DOCUMENT_POSITION_PRECEDING,DUO,ELEMENT_NODE,EMPTY,HEX,HYPHEN,IDENT,ID_SELECTOR,KEY_FORM_FOCUS,KEY_INPUT_BUTTON,KEY_INPUT_DATE,KEY_INPUT_EDIT,KEY_INPUT_LTR,KEY_INPUT_TEXT,KEY_LOGICAL,LANG_PART,LOGICAL_COMPLEX,LOGICAL_COMPOUND,NESTED_LOGICAL_A,NESTED_LOGICAL_B,NOT_SUPPORTED_ERR,NTH,N_TH,PSEUDO_CLASS,PS_CLASS_SELECTOR,PS_ELEMENT_SELECTOR,SELECTOR,SHOW_ALL,SHOW_DOCUMENT,SHOW_DOCUMENT_FRAGMENT,SHOW_ELEMENT,SUB_TYPE,SYNTAX_ERR,TAG_TYPE,TAG_TYPE_I,TARGET_ALL,TARGET_FIRST,TARGET_LINEAL,TARGET_SELF,TEXT_NODE,TYPE_FROM,TYPE_SELECTOR,TYPE_TO,WALKER_FILTER});
//# sourceMappingURL=constant.js.map

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

var A=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var B=(x,n)=>{for(var e in n)A(x,e,{get:n[e],enumerable:!0})},Y=(x,n,e,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of H(n))!z.call(x,r)&&r!==e&&A(x,r,{get:()=>n[r],enumerable:!(o=G(n,r))||o.enumerable});return x};var j=x=>Y(A({},"__esModule",{value:!0}),x);var Z={};B(Z,{Finder:()=>J});module.exports=j(Z);var P=require("./matcher.js"),g=require("./parser.js"),_=require("./utility.js"),c=require("./constant.js");const v="next",S="prev",V="Tab",R=/^a(?:rea)?$/,K=/^(?:button|fieldset|input|optgroup|option|select|textarea)$/,O=/^(?:button|form|input|select|textarea)$/,q=/^(?:details|dialog)$/,M=/^host(?:-context)?$/,C=/^(?:checkbox|radio)$/,X=/^(?:date(?:time-local)?|month|number|range|time|week)$/,I=/^(?:button|reset)$/,$=/^(?:image|submit)$/,Q=/^(?:email|number|password|search|tel|text|url)$/;class J{#l;#r;#w;#t;#f;#n;#k;#c;#b;#h;#e;#d;#g;#m;#_;#s;#u;#N;#o;#p;#i;#a;constructor(n){this.#a=n,this.#h=new P.Matcher,this.#r=new WeakMap,this.#f=new WeakMap,this.#b=new WeakMap,this.#_=new WeakMap,this.#n=null,this.#k=null,this._registerEventListeners()}onError(n,e){if(!(e?.noexcept??this.#g))if(n instanceof DOMException||n instanceof this.#a.DOMException)if(n.name===c.NOT_SUPPORTED_ERR)this.#i&&console.warn(n.message);else throw new this.#a.DOMException(n.message,n.name);else throw n.name in this.#a?new this.#a[n.name](n.message):n}setup(n,e,o={}){const{event:r,noexcept:a,warn:l}=o;return this.#g=!!a,this.#i=!!l,this.#e=e,[this.#t,this.#s,this.#o]=(0,_.resolveContent)(e),this.#u=(0,_.isInShadowTree)(e),[this.#l,this.#d]=this._correspond(n),this.#b=new WeakMap,this.#p=new WeakMap,this.#N=null,this._setEvent(r),this}_registerEventListeners(){const n={capture:!0,passive:!0},e=[],o=["mouseover","mousedown","mouseup","mouseout"];for(const a of o)e.push(this.#a.addEventListener(a,l=>{this.#n=l},n));const r=["keydown","keyup"];for(const a of r)e.push(this.#a.addEventListener(a,l=>{l.key===V&&(this.#n=l)},n));return e.push(this.#a.addEventListener("focusin",a=>{this.#k=a},n)),e}_setEvent(n){return(n instanceof this.#a.KeyboardEvent||n instanceof this.#a.MouseEvent)&&(this.#n=n),this.#n}_correspond(n){const e=[];this.#w=!1,this.#c=!1;let o;if(this.#f.has(this.#t)){const r=this.#f.get(this.#t);if(r&&r.has(`${n}`)){const a=r.get(`${n}`);o=a.ast,this.#w=a.descendant,this.#c=a.invalidate}}if(o){const r=o.length;for(let a=0;a<r;a++)o[a].collected=!1,o[a].dir=null,o[a].filtered=!1,o[a].find=!1,e[a]=[]}else{let r;try{r=(0,g.parseSelector)(n)}catch(b){this.onError(b)}const{branches:a,info:l}=(0,g.walkAST)(r),{hasHasPseudoFunc:f,hasLogicalPseudoFunc:u,hasNthChildOfSelector:d}=l;let i=f||!!(u&&d),t=!1,s=0;o=[];for(const[...b]of a){const p=[];let m=b.shift();if(m&&m.type!==c.COMBINATOR){const w=new Set;for(;m;){if(m.type===c.COMBINATOR){const[k]=b;if(k.type===c.COMBINATOR)throw new DOMException(`Invalid selector ${n}`,c.SYNTAX_ERR);const N=m.name;/^[\s>]$/.test(N)?t=!0:i=!0,p.push({combo:m,leaves:(0,g.sortAST)(w)}),w.clear()}else if(m){let{name:k}=m;k&&typeof k=="string"&&(k=(0,g.unescapeSelector)(k),typeof k=="string"&&k!==m.name&&(m.name=k),/[|:]/.test(k)&&(m.namespace=!0)),w.add(m)}if(b.length)m=b.shift();else{p.push({combo:null,leaves:(0,g.sortAST)(w)}),w.clear();break}}}o.push({branch:p,collected:!1,dir:null,filtered:!1,find:!1}),e[s]=[],s++}let h;this.#f.has(this.#t)?h=this.#f.get(this.#t):h=new Map,h.set(`${n}`,{ast:o,descendant:t,invalidate:i}),this.#f.set(this.#t,h),this.#w=t,this.#c=i}return[o,e]}_createTreeWalker(n){let e;return this.#p.has(n)?e=this.#p.get(n):(e=this.#t.createTreeWalker(n,c.WALKER_FILTER),this.#p.set(n,e)),e}_prepareQuerySelectorWalker(){return this.#m=this._createTreeWalker(this.#e),this.#m}_collectNthChild(n,e,o){const{a:r,b:a,reverse:l,selector:f}=n,{parentNode:u}=e,d=new Set;let i;if(f){if(this.#r.has(f))i=this.#r.get(f);else{const{branches:s}=(0,g.walkAST)(f);i=s,this.#c||this.#r.set(f,i)}const{branches:t}=(0,g.walkAST)(f);i=t}if(u){const t=this.#o;let s=(0,_.traverseNode)(u,t);s=t.firstChild();let h=0;for(;s;)h++,s=t.nextSibling();const b=new Set;if(i)for(s=(0,_.traverseNode)(u,t),s=t.firstChild();s;){if((0,_.isVisible)(s)){let p;for(const m of i)if(p=this._matchLeaves(m,s,o),!p)break;p&&b.add(s)}s=t.nextSibling()}if(r===0){if(a>0&&a<=h){if(b.size){s=(0,_.traverseNode)(u,t),l?s=t.lastChild():s=t.firstChild();let p=0;for(;s;){if(b.has(s)){if(p===a-1){d.add(s);break}p++}l?s=t.previousSibling():s=t.nextSibling()}}else if(!f){s=(0,_.traverseNode)(u,t),l?s=t.lastChild():s=t.firstChild();let p=0;for(;s;){if(p===a-1){d.add(s);break}l?s=t.previousSibling():s=t.nextSibling(),p++}}}}else{let p=a-1;if(r>0)for(;p<0;)p+=r;if(p>=0&&p<h){s=(0,_.traverseNode)(u,t),l?s=t.lastChild():s=t.firstChild();let m=0,w=r>0?0:a-1;for(;s&&(s&&p>=0&&p<h);)b.size?b.has(s)&&(w===p&&(d.add(s),p+=r),r>0?w++:w--):m===p&&(f||d.add(s),p+=r),l?s=t.previousSibling():s=t.nextSibling(),m++}}if(l&&d.size>1){const p=[...d];return new Set(p.reverse())}}else if(e===this.#s&&r+a===1)if(i){let t;for(const s of i)if(t=this._matchLeaves(s,e,o),t)break;t&&d.add(e)}else d.add(e);return d}_collectNthOfType(n,e){const{a:o,b:r,reverse:a}=n,{localName:l,namespaceURI:f,parentNode:u,prefix:d}=e,i=new Set;if(u){const t=this.#o;let s=(0,_.traverseNode)(u,t);s=t.firstChild();let h=0;for(;s;)h++,s=t.nextSibling();if(o===0){if(r>0&&r<=h){s=(0,_.traverseNode)(u,t),a?s=t.lastChild():s=t.firstChild();let b=0;for(;s;){const{localName:p,namespaceURI:m,prefix:w}=s;if(p===l&&w===d&&m===f){if(b===r-1){i.add(s);break}b++}a?s=t.previousSibling():s=t.nextSibling()}}}else{let b=r-1;if(o>0)for(;b<0;)b+=o;if(b>=0&&b<h){s=(0,_.traverseNode)(u,t),a?s=t.lastChild():s=t.firstChild();let p=o>0?0:r-1;for(;s;){const{localName:m,namespaceURI:w,prefix:k}=s;if(m===l&&k===d&&w===f){if(p===b&&(i.add(s),b+=o),b<0||b>=h)break;o>0?p++:p--}a?s=t.previousSibling():s=t.nextSibling()}}}if(a&&i.size>1){const b=[...i];return new Set(b.reverse())}}else e===this.#s&&o+r===1&&i.add(e);return i}_matchAnPlusB(n,e,o,r){const{nth:{a,b:l,name:f},selector:u}=n,d=new Map;if(f?(f==="even"?(d.set("a",2),d.set("b",0)):f==="odd"&&(d.set("a",2),d.set("b",1)),o.indexOf("last")>-1&&d.set("reverse",!0)):(typeof a=="string"&&/-?\d+/.test(a)?d.set("a",a*1):d.set("a",0),typeof l=="string"&&/-?\d+/.test(l)?d.set("b",l*1):d.set("b",0),o.indexOf("last")>-1&&d.set("reverse",!0)),/^nth-(?:last-)?child$/.test(o)){u&&d.set("selector",u);const i=Object.fromEntries(d);return this._collectNthChild(i,e,r)}else if(/^nth-(?:last-)?of-type$/.test(o)){const i=Object.fromEntries(d);return this._collectNthOfType(i,e)}return new Set}_matchHasPseudoFunc(n,e,o){let r;if(Array.isArray(n)&&n.length){const a=n.map(s=>s),[l]=a,{type:f}=l;let u;f===c.COMBINATOR?u=a.shift():u={name:" ",type:c.COMBINATOR};const d=[];for(;a.length;){const[s]=a,{type:h}=s;if(h===c.COMBINATOR)break;d.push(a.shift())}const i={combo:u,leaves:d};o.dir=v;const t=this._matchCombinator(i,e,o);if(t.size)if(a.length){for(const s of t)if(r=this._matchHasPseudoFunc(a,s,o),r)break}else r=!0}return!!r}_matchLogicalPseudoFunc(n,e,o){const{astName:r,branches:a,twigBranches:l}=n,{isShadowRoot:f}=o;let u;if(r==="has"){let d;for(const i of a)if(d=this._matchHasPseudoFunc(i,e,o),d)break;d&&(f?this.#N&&(u=e):u=e)}else{if(f){for(const s of a)if(s.length>1)return null}const d=/^(?:is|where)$/.test(r);o.forgive=d;const i=l.length;let t;for(let s=0;s<i;s++){const h=l[s],b=h.length-1,{leaves:p}=h[b];if(t=this._matchLeaves(p,e,o),t&&b>0){let m=new Set([e]);for(let w=b-1;w>=0;w--){const k=h[w],N=[];o.dir=S;for(const E of m){const y=this._matchCombinator(k,E,o);y.size&&N.push(...y)}if(N.length)w===0?t=!0:m=new Set(N);else{t=!1;break}}}if(t)break}r==="not"?t||(u=e):t&&(u=e)}return u??null}_matchPseudoClassSelector(n,e,o){const{children:r,name:a}=n,{localName:l,parentNode:f}=e,{forgive:u,warn:d=this.#i}=o,i=new Set;if(c.REG_LOGICAL.test(a)){let t;if(this.#r.has(n))t=this.#r.get(n);else{const{branches:h}=(0,g.walkAST)(n);if(a==="has"){for(const b of r){const p=(0,g.findAST)(b,m=>c.REG_LOGICAL.test(m.name)&&(0,g.findAST)(m,w=>w.name==="has")?m:null);if(p){if(/^(?:is|where)$/.test(p.name))return i;{const m=(0,g.generateCSS)(n);throw new DOMException(`Invalid selector ${m}`,c.SYNTAX_ERR)}}}t={astName:a,branches:h}}else{const b=[];for(const[...p]of h){const m=[],w=new Set;let k=p.shift();for(;k;)if(k.type===c.COMBINATOR?(m.push({combo:k,leaves:[...w]}),w.clear()):k&&w.add(k),p.length)k=p.shift();else{m.push({combo:null,leaves:[...w]}),w.clear();break}b.push(m)}t={astName:a,branches:h,twigBranches:b},this.#c||this.#r.set(n,t)}}const s=this._matchLogicalPseudoFunc(t,e,o);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,o)}else switch(a){case"dir":case"lang":{const t=this.#h.matchSelector(n,e,o,!0);t&&i.add(t);break}case"state":{if((0,_.isCustomElement)(e)){const[{value:t}]=r;if(t)if(e[t])i.add(e);else for(const s in e){const h=e[s];if(h instanceof this.#a.ElementInternals){h?.states?.has(t)&&i.add(e);break}}}break}case"current":case"nth-col":case"nth-last-col":{if(d)throw new DOMException(`Unsupported pseudo-class :${a}()`,c.NOT_SUPPORTED_ERR);break}case"host":case"host-context":break;case"contains":{if(d)throw new DOMException(`Unknown pseudo-class :${a}()`,c.NOT_SUPPORTED_ERR);break}default:if(!u)throw new DOMException(`Unknown pseudo-class :${a}()`,c.SYNTAX_ERR)}else switch(a){case"any-link":case"link":{R.test(l)&&e.hasAttribute("href")&&i.add(e);break}case"local-link":{if(R.test(l)&&e.hasAttribute("href")){const{href:t,origin:s,pathname:h}=new URL(this.#t.URL),b=new URL(e.getAttribute("href"),t);b.origin===s&&b.pathname===h&&i.add(e)}break}case"visited":break;case"hover":{const{target:t,type:s}=this.#n??{};/^(?:mouse|pointer)(?:down|over|up)$/.test(s)&&e.contains(t)&&i.add(e);break}case"active":{const{buttons:t,target:s,type:h}=this.#n??{};/(?:mouse|pointer)down/.test(h)&&t&c.BIT_01&&e.contains(s)&&i.add(e);break}case"target":{const{hash:t}=new URL(this.#t.URL);e.id&&t===`#${e.id}`&&this.#t.contains(e)&&i.add(e);break}case"target-within":{const{hash:t}=new URL(this.#t.URL);if(t){const s=t.replace(/^#/,"");let h=this.#t.getElementById(s);for(;h;){if(h===e){i.add(e);break}h=h.parentNode}}break}case"scope":{this.#e.nodeType===c.ELEMENT_NODE?!this.#u&&e===this.#e&&i.add(e):e===this.#t.documentElement&&i.add(e);break}case"focus":{e===this.#t.activeElement&&e.tabIndex>=0&&(0,_.isFocusable)(e)&&i.add(e);break}case"focus-visible":{if(e===this.#t.activeElement&&e.tabIndex>=0){let t;if((0,_.isFocusVisible)(e))t=!0;else{const{target:s,type:h}=this.#n??{},{target:b,relatedTarget:p}=this.#k??{};(/^key(?:down|up)$/.test(h)&&e.contains(s)||p&&(0,_.isFocusVisible)(p)&&e.contains(b))&&(t=!0)}t&&(0,_.isFocusable)(e)&&i.add(e)}break}case"focus-within":{let t,s=this.#t.activeElement;if(s.tabIndex>=0)for(;s;){if(s===e){t=!0;break}s=s.parentNode}t&&(0,_.isFocusable)(e)&&i.add(e);break}case"open":case"closed":{q.test(l)&&(e.hasAttribute("open")?a==="open"&&i.add(e):a==="closed"&&i.add(e));break}case"disabled":case"enabled":{if(K.test(l)||(0,_.isCustomElement)(e,{formAssociated:!0})){let t;if(e.disabled||e.hasAttribute("disabled"))t=!0;else if(e.localName==="option")f.localName==="optgroup"&&(f.disabled||f.hasAttribute("disabled"))&&(t=!0);else if(e.localName!=="optgroup"){let s=f;for(;s;)if(s.localName==="fieldset"&&(s.disabled||s.hasAttribute("disabled"))){const h=this.#o;let b=(0,_.traverseNode)(s,h);for(b=h.firstChild();b&&b.localName!=="legend";)b=h.nextSibling();b&&b.contains(e)||(t=!0);break}else{if(s.localName==="form")break;if(s.parentNode?.nodeType===c.ELEMENT_NODE){if(s.parentNode.localName==="form")break;s=s.parentNode}else break}}t?a==="disabled"&&i.add(e):a==="enabled"&&i.add(e)}break}case"read-only":case"read-write":{let t,s;switch(l){case"textarea":{e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled")?t=!0:s=!0;break}case"input":{(!e.type||c.REG_INPUT_TYPE.test(e.type))&&(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled")?t=!0:s=!0);break}default:(0,_.isContentEditable)(e)?s=!0:t=!0}t?a==="read-only"&&i.add(e):a==="read-write"&&s&&i.add(e);break}case"placeholder-shown":{let t;if(e.placeholder?t=e.placeholder:e.hasAttribute("placeholder")&&(t=e.getAttribute("placeholder")),typeof t=="string"&&!/[\r\n]/.test(t)){let s;l==="textarea"?s=e:l==="input"&&(e.hasAttribute("type")?Q.test(e.getAttribute("type"))&&(s=e):s=e),s&&e.value===""&&i.add(e)}break}case"checked":{(e.checked&&l==="input"&&e.hasAttribute("type")&&C.test(e.getAttribute("type"))||e.selected&&l==="option")&&i.add(e);break}case"indeterminate":{if(e.indeterminate&&l==="input"&&e.type==="checkbox"||l==="progress"&&!e.hasAttribute("value"))i.add(e);else if(l==="input"&&e.type==="radio"&&!e.hasAttribute("checked")){const t=e.name;let s=e.parentNode;for(;s&&s.localName!=="form";)s=s.parentNode;s||(s=this.#t.documentElement);const h=s.getElementsByTagName("input"),b=h.length;let p;for(let m=0;m<b;m++){const w=h[m];if(w.getAttribute("type")==="radio"&&(t?w.getAttribute("name")===t&&(p=!!w.checked):w.hasAttribute("name")||(p=!!w.checked),p))break}p||i.add(e)}break}case"default":{if(l==="button"&&!(e.hasAttribute("type")&&I.test(e.getAttribute("type")))||l==="input"&&e.hasAttribute("type")&&$.test(e.getAttribute("type"))){let t=e.parentNode;for(;t&&t.localName!=="form";)t=t.parentNode;if(t){const s=this.#o;let h=(0,_.traverseNode)(t,s);for(h=s.firstChild();h&&t.contains(h);){const b=h.localName;let p;if(b==="button"?p=!(h.hasAttribute("type")&&I.test(h.getAttribute("type"))):b==="input"&&(p=h.hasAttribute("type")&&$.test(h.getAttribute("type"))),p){h===e&&i.add(e);break}h=s.nextNode()}}}else(l==="input"&&e.hasAttribute("type")&&C.test(e.getAttribute("type"))&&e.hasAttribute("checked")||l==="option"&&e.hasAttribute("selected"))&&i.add(e);break}case"valid":case"invalid":{if(O.test(l)){let t;e.checkValidity()&&(e.maxLength>=0?e.maxLength>=e.value.length&&(t=!0):t=!0),t?a==="valid"&&i.add(e):a==="invalid"&&i.add(e)}else if(l==="fieldset"){const t=this.#o;let s=(0,_.traverseNode)(e,t);s=t.firstChild();let h;if(!s)h=!0;else for(;s&&e.contains(s)&&!(O.test(s.localName)&&(s.checkValidity()?s.maxLength>=0?h=s.maxLength>=s.value.length:h=!0:h=!1,!h));)s=t.nextNode();h?a==="valid"&&i.add(e):a==="invalid"&&i.add(e)}break}case"in-range":case"out-of-range":{if(l==="input"&&!(e.readonly||e.hasAttribute("readonly"))&&!(e.disabled||e.hasAttribute("disabled"))&&e.hasAttribute("type")&&X.test(e.getAttribute("type"))){let t;!(e.validity.rangeUnderflow||e.validity.rangeOverflow)&&(e.hasAttribute("min")||e.hasAttribute("max")||e.getAttribute("type")==="range")&&(t=!0),t?a==="in-range"&&i.add(e):a==="out-of-range"&&i.add(e)}break}case"required":case"optional":{let t;if(/^(?:select|textarea)$/.test(l))t=e;else if(l==="input")if(e.hasAttribute("type")){const s=e.getAttribute("type");(s==="file"||C.test(s)||c.REG_INPUT_TYPE.test(s))&&(t=e)}else t=e;t&&(e.required||e.hasAttribute("required")?a==="required"&&i.add(e):a==="optional"&&i.add(e));break}case"root":{e===this.#t.documentElement&&i.add(e);break}case"empty":{if(e.hasChildNodes()){const t=this.#t.createTreeWalker(e,c.SHOW_ALL);let s=t.firstChild(),h;for(;s&&(h=s.nodeType!==c.ELEMENT_NODE&&s.nodeType!==c.TEXT_NODE,!!h);)s=t.nextSibling();h&&i.add(e)}else i.add(e);break}case"first-child":{(f&&e===f.firstElementChild||e===this.#s)&&i.add(e);break}case"last-child":{(f&&e===f.lastElementChild||e===this.#s)&&i.add(e);break}case"only-child":{(f&&e===f.firstElementChild&&e===f.lastElementChild||e===this.#s)&&i.add(e);break}case"first-of-type":{if(f){const[t]=this._collectNthOfType({a:0,b:1},e);t&&i.add(t)}else e===this.#s&&i.add(e);break}case"last-of-type":{if(f){const[t]=this._collectNthOfType({a:0,b:1,reverse:!0},e);t&&i.add(t)}else e===this.#s&&i.add(e);break}case"only-of-type":{if(f){const[t]=this._collectNthOfType({a:0,b:1},e);if(t===e){const[s]=this._collectNthOfType({a:0,b:1,reverse:!0},e);s===e&&i.add(e)}}else e===this.#s&&i.add(e);break}case"defined":{e.hasAttribute("is")||l.includes("-")?(0,_.isCustomElement)(e)&&i.add(e):(e instanceof this.#a.HTMLElement||e instanceof this.#a.SVGElement)&&i.add(e);break}case"popover-open":{e.popover&&(0,_.isVisible)(e)&&i.add(e);break}case"host":case"host-context":break;case"after":case"before":case"first-letter":case"first-line":{if(d)throw new DOMException(`Unsupported pseudo-element ::${a}`,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)throw new DOMException(`Unsupported pseudo-class :${a}`,c.NOT_SUPPORTED_ERR);break}default:if(a.startsWith("-webkit-")){if(d)throw new DOMException(`Unsupported pseudo-class :${a}`,c.NOT_SUPPORTED_ERR)}else if(!u)throw new DOMException(`Unknown pseudo-class :${a}`,c.SYNTAX_ERR)}return i}_matchShadowHostPseudoClass(n,e){const{children:o,name:r}=n;let a;if(Array.isArray(o)){const{branches:l}=(0,g.walkAST)(o[0]),[f]=l,[...u]=f,{host:d}=e;if(r==="host"){let i;for(const t of u){const{type:s}=t;if(s===c.COMBINATOR){const h=(0,g.generateCSS)(n);throw new DOMException(`Invalid selector ${h}`,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:h}=s;if(h===c.COMBINATOR){const b=(0,g.generateCSS)(n);throw new DOMException(`Invalid selector ${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 throw new DOMException(`Invalid selector :${r}`,c.SYNTAX_ERR);return a??null}_matchSelector(n,e,o={}){const{type:r}=n,a=new Set;if(n.name===c.EMPTY)return a;const l=(0,g.unescapeSelector)(n.name);if(typeof l=="string"&&l!==n.name&&(n.name=l),e.nodeType===c.ELEMENT_NODE)switch(r){case c.PS_ELEMENT_SELECTOR:{this.#h.matchPseudoElementSelector(l,o);break}case c.ID_SELECTOR:{e.id===l&&a.add(e);break}case c.CLASS_SELECTOR:{e.classList.contains(l)&&a.add(e);break}case c.PS_CLASS_SELECTOR:return this._matchPseudoClassSelector(n,e,o);default:{const f=this.#h.matchSelector(n,e,o,!0);f&&a.add(f)}}else if(this.#u&&r===c.PS_CLASS_SELECTOR&&e.nodeType===c.DOCUMENT_FRAGMENT_NODE){if(c.REG_LOGICAL.test(l))return o.isShadowRoot=!0,this._matchPseudoClassSelector(n,e,o);if(M.test(l)){const f=this._matchShadowHostPseudoClass(n,e,o);f&&(this.#N=!0,a.add(f))}}return a}_matchLeaves(n,e,o){let r,a;if(this.#c?a=this.#b.get(n):a=this.#_.get(n),a&&a.has(e)){const{matched:l}=a.get(e);r=l}if(typeof r!="boolean"){let l=!0;e.nodeType===c.ELEMENT_NODE&&/^(?:button|fieldset|form|input|select|textarea)$/.test(e.localName)&&(l=!1);for(const f of n){switch(f.type){case c.ATTR_SELECTOR:case c.ID_SELECTOR:{l=!1;break}case c.PS_CLASS_SELECTOR:{/^(?:(?:any-)?link|defined|dir)$/.test(f.name)&&(l=!1);break}default:}if(r=this._matchSelector(f,e,o).has(e),!r)break}l&&(a||(a=new WeakMap),a.set(e,{matched:r}),this.#c?this.#b.set(n,a):this.#_.set(n,a))}return!!r}_matchHTMLCollection(n,e){const{compound:o,filterLeaves:r}=e,a=new Set,l=n.length;if(l)if(o)for(let f=0;f<l;f++){const u=n[f];this._matchLeaves(r,u,e)&&a.add(u)}else{const f=[].slice.call(n);return new Set(f)}return a}_findDescendantNodes(n,e,o){const[r,...a]=n,l=a.length>0,{type:f}=r,u=(0,g.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(f){case c.PS_ELEMENT_SELECTOR:{this.#h.matchPseudoElementSelector(u,o);break}case c.ID_SELECTOR:{if(this.#s.nodeType===c.ELEMENT_NODE)i=!0;else{const t=this.#s.getElementById(u);t&&t!==e&&e.contains(t)&&(l?this._matchLeaves(a,t,o)&&d.add(t):d.add(t))}break}case c.CLASS_SELECTOR:{const t=e.getElementsByClassName(u);d=this._matchHTMLCollection(t,{compound:l,filterLeaves:a});break}case c.TYPE_SELECTOR:{if(this.#t.contentType==="text/html"&&!/[*|]/.test(u)){const t=e.getElementsByTagName(u);d=this._matchHTMLCollection(t,{compound:l,filterLeaves:a})}else i=!0;break}default:i=!0}return{nodes:d,pending:i}}_matchCombinator(n,e,o){const{combo:r,leaves:a}=n,{name:l}=r,{parentNode:f}=e,{dir:u}=o,d=new Set;if(u===v)switch(l){case"+":{const i=e.nextElementSibling;i&&this._matchLeaves(a,i,o)&&d.add(i);break}case"~":{if(f){const i=this._createTreeWalker(f);let t=(0,_.traverseNode)(e,i);for(t=i.nextSibling();t;)this._matchLeaves(a,t,o)&&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,o)&&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 h=(0,_.traverseNode)(e,s);for(h=s.nextNode();h&&e.contains(h);)this._matchLeaves(a,h,o)&&d.add(h),h=s.nextNode()}}}else switch(l){case"+":{const i=e.previousElementSibling;i&&this._matchLeaves(a,i,o)&&d.add(i);break}case"~":{if(f){const i=this._createTreeWalker(f);let t=(0,_.traverseNode)(f,i);for(t=i.firstChild();t&&t!==e;)this._matchLeaves(a,t,o)&&d.add(t),t=i.nextSibling()}break}case">":{f&&this._matchLeaves(a,f,o)&&d.add(f);break}case" ":default:{const i=[];let t=f;for(;t;)this._matchLeaves(a,t,o)&&i.push(t),t=t.parentNode;if(i.length)return new Set(i.reverse())}}return d}_findNode(n,e){const o=this.#m;let r=(0,_.traverseNode)(e,o),a;if(r)for((r.nodeType!==c.ELEMENT_NODE||r===e&&r!==this.#s)&&(r=o.nextNode());r;){if(this._matchLeaves(n,r,{warn:this.#i})){a=r;break}r=o.nextNode()}return a??null}_matchSelf(n){const e=[],o=this._matchLeaves(n,this.#e,{warn:this.#i});let r=!1;return o&&(e.push(this.#e),r=!0),[e,r]}_findLineal(n,e){const{complex:o}=e,r=[];let a=this._matchLeaves(n,this.#e,{warn:this.#i}),l=!1;if(a&&(r.push(this.#e),l=!0),!a||o){let f=this.#e.parentNode;for(;f&&(a=this._matchLeaves(n,f,{warn:this.#i}),a&&(r.push(f),l=!0),f.parentNode);)f=f.parentNode}return[r,l]}_findFirst(n){const e=[],o=this._findNode(n,this.#e);let r=!1;return o&&(e.push(o),r=!0),[e,r]}_findFromHTMLCollection(n,e){const{complex:o,compound:r,filterLeaves:a,targetType:l}=e;let f=[],u=!1,d=!1;const i=n.length;if(i)if(this.#e.nodeType===c.ELEMENT_NODE)for(let t=0;t<i;t++){const s=n[t];if(s!==this.#e&&(this.#e.contains(s)||s.contains(this.#e))){if(r){if(this._matchLeaves(a,s,{warn:this.#i})&&(f.push(s),u=!0,l===c.TARGET_FIRST))break}else if(f.push(s),u=!0,l===c.TARGET_FIRST)break}}else if(o)if(r)for(let t=0;t<i;t++){const s=n[t];if(this._matchLeaves(a,s,{warn:this.#i})&&(f.push(s),u=!0,l===c.TARGET_FIRST))break}else f=[].slice.call(n),u=!0,d=!0;else if(r)for(let t=0;t<i;t++){const s=n[t];if(this._matchLeaves(a,s,{warn:this.#i})&&(f.push(s),u=!0,l===c.TARGET_FIRST))break}else f=[].slice.call(n),u=!0,d=!0;return[f,u,d]}_findEntryNodes(n,e,o){const{leaves:r}=n,[a,...l]=r,f=l.length>0,{name:u,type:d}=a;let i=[],t=!1,s=!1,h=!1;switch(d){case c.PS_ELEMENT_SELECTOR:{this.#h.matchPseudoElementSelector(u,{warn:this.#i});break}case c.ID_SELECTOR:{if(e===c.TARGET_SELF)[i,s]=this._matchSelf(r);else if(e===c.TARGET_LINEAL)[i,s]=this._findLineal(r,{complex:o});else if(e===c.TARGET_FIRST&&this.#s.nodeType!==c.ELEMENT_NODE){const b=this.#s.getElementById(u);b&&(f?this._matchLeaves(l,b,{warn:this.#i})&&(i.push(b),s=!0):(i.push(b),s=!0))}else e===c.TARGET_FIRST?[i,s]=this._findFirst(r):h=!0;break}case c.CLASS_SELECTOR:{if(e===c.TARGET_SELF)[i,s]=this._matchSelf(r);else if(e===c.TARGET_LINEAL)[i,s]=this._findLineal(r,{complex:o});else if(this.#s.nodeType===c.DOCUMENT_NODE){const b=this.#s.getElementsByClassName(u);b.length&&([i,s,t]=this._findFromHTMLCollection(b,{complex:o,compound:f,filterLeaves:l,targetType:e}))}else e===c.TARGET_FIRST?[i,s]=this._findFirst(r):h=!0;break}case c.TYPE_SELECTOR:{if(e===c.TARGET_SELF)[i,s]=this._matchSelf(r);else if(e===c.TARGET_LINEAL)[i,s]=this._findLineal(r,{complex:o});else if(this.#t.contentType==="text/html"&&this.#s.nodeType===c.DOCUMENT_NODE&&!/[*|]/.test(u)){const b=this.#s.getElementsByTagName(u);b.length&&([i,s,t]=this._findFromHTMLCollection(b,{complex:o,compound:f,filterLeaves:l,targetType:e}))}else e===c.TARGET_FIRST?[i,s]=this._findFirst(r):h=!0;break}default:if(e!==c.TARGET_LINEAL&&M.test(u)){if(this.#u&&this.#e.nodeType===c.DOCUMENT_FRAGMENT_NODE){const b=this._matchShadowHostPseudoClass(a,this.#e);b&&(i.push(b),s=!0)}}else e===c.TARGET_SELF?[i,s]=this._matchSelf(r):e===c.TARGET_LINEAL?[i,s]=this._findLineal(r,{complex:o}):e===c.TARGET_FIRST?[i,s]=this._findFirst(r):h=!0}return{collected:t,compound:f,filtered:s,nodes:i,pending:h}}_collectNodes(n){const e=this.#l.values();if(n===c.TARGET_ALL||n===c.TARGET_FIRST){const o=new Set;let r=0;for(const{branch:a}of e){const l=a.length,f=l>1,u=a[0];let d,i;if(f){const{combo:m,leaves:[{name:w,type:k}]}=u,N=a[l-1],{leaves:[{name:E,type:y}]}=N;if(y===c.PS_ELEMENT_SELECTOR||y===c.ID_SELECTOR)d=S,i=N;else if(k===c.PS_ELEMENT_SELECTOR||k===c.ID_SELECTOR)d=v,i=u;else if(n===c.TARGET_ALL)if(w==="*"&&k===c.TYPE_SELECTOR)d=S,i=N;else if(E==="*"&&y===c.TYPE_SELECTOR)d=v,i=u;else if(l===2){const{name:L}=m;/^[+~]$/.test(L)?(d=S,i=N):(d=v,i=u)}else d=v,i=u;else if(E==="*"&&y===c.TYPE_SELECTOR)d=v,i=u;else if(w==="*"&&k===c.TYPE_SELECTOR)d=S,i=N;else{let L;for(const{combo:T,leaves:[D]}of a){const{name:U,type:F}=D;if(F===c.PS_CLASS_SELECTOR&&U==="dir"){L=!1;break}if(!L&&T){const{name:W}=T;/^[+~]$/.test(W)&&(L=!0)}}L?(d=v,i=u):(d=S,i=N)}}else d=S,i=u;const{collected:t,compound:s,filtered:h,nodes:b,pending:p}=this._findEntryNodes(i,n,f);b.length?(this.#l[r].find=!0,this.#d[r]=b):p&&o.add(new Map([["index",r],["twig",i]])),this.#l[r].collected=t,this.#l[r].dir=d,this.#l[r].filtered=h||!s,r++}if(o.size){let a,l;this.#e!==this.#s&&this.#e.nodeType===c.ELEMENT_NODE?(a=this.#e,l=this.#m):(a=this.#s,l=this.#o);let f=(0,_.traverseNode)(a,l);for(;f;){let u=!1;if(this.#e.nodeType===c.ELEMENT_NODE?f===this.#e?u=!0:u=this.#e.contains(f):u=!0,u)for(const d of o){const{leaves:i}=d.get("twig");if(this._matchLeaves(i,f,{warn:this.#i})){const s=d.get("index");this.#l[s].filtered=!0,this.#l[s].find=!0,this.#d[s].push(f)}}f!==l.currentNode&&(f=(0,_.traverseNode)(f,l)),f=l.nextNode()}}}else{let o=0;for(const{branch:r}of e){const a=r[r.length-1],l=r.length>1,{compound:f,filtered:u,nodes:d}=this._findEntryNodes(a,n,l);d.length&&(this.#l[o].find=!0,this.#d[o]=d),this.#l[o].dir=S,this.#l[o].filtered=u||!f,o++}}return[this.#l,this.#d]}_getCombinedNodes(n,e,o){const r=[];for(const a of e){const l=this._matchCombinator(n,a,{dir:o,warn:this.#i});l.size&&r.push(...l)}return r.length?new Set(r):new Set}_matchNodeNext(n,e,o){const{combo:r,index:a}=o,{combo:l,leaves:f}=n[a],u={combo:r,leaves:f},d=this._getCombinedNodes(u,e,v);let i;if(d.size)if(a===n.length-1){const[t]=(0,_.sortNodes)(d);i=t}else i=this._matchNodeNext(n,d,{combo:l,index:a+1});return i??null}_matchNodePrev(n,e,o){const{index:r}=o,a=n[r],l=new Set([e]),f=this._getCombinedNodes(a,l,S);let u;if(f.size){if(r===0)u=e;else for(const d of f)if(this._matchNodePrev(n,d,{index:r-1}))return e}return u??null}find(n){(n===c.TARGET_ALL||n===c.TARGET_FIRST)&&this._prepareQuerySelectorWalker();const[[...e],o]=this._collectNodes(n),r=e.length;let a,l=new Set;for(let f=0;f<r;f++){const{branch:u,collected:d,dir:i,find:t}=e[f],s=u.length;if(s&&t){const h=o[f],b=h.length,p=s-1;if(p===0)if((n===c.TARGET_ALL||n===c.TARGET_FIRST)&&this.#e.nodeType===c.ELEMENT_NODE)for(let m=0;m<b;m++){const w=h[m];if(w!==this.#e&&this.#e.contains(w)&&(l.add(w),n!==c.TARGET_ALL))break}else if(n===c.TARGET_ALL)if(l.size){const m=[...l];l=new Set([...m,...h]),a=!0}else l=new Set(h);else{const[m]=h;l.add(m)}else if(n===c.TARGET_ALL)if(i===v){let{combo:m}=u[0];for(const w of h){let k=new Set([w]);for(let N=1;N<s;N++){const{combo:E,leaves:y}=u[N],L={combo:m,leaves:y};if(k=this._getCombinedNodes(L,k,i),k.size)if(N===p)if(l.size){const T=[...l];l=new Set([...T,...k]),a=!0}else l=k;else m=E;else break}}}else for(const m of h){let w=new Set([m]);for(let k=p-1;k>=0;k--){const N=u[k];if(w=this._getCombinedNodes(N,w,i),w.size)k===0&&(l.add(m),s>1&&l.size>1&&(a=!0));else break}}else if(n===c.TARGET_FIRST&&i===v){const{combo:m}=u[0];let w;for(const k of h)if(w=this._matchNodeNext(u,new Set([k]),{combo:m,index:1}),w){l.add(w);break}if(!w&&!d){const{leaves:k}=u[0],[N]=h;let E=this._findNode(k,N);for(;E;){if(w=this._matchNodeNext(u,new Set([E]),{combo:m,index:1}),w){l.add(w);break}E=this._findNode(k,E)}}}else{let m;for(const w of h)if(m=this._matchNodePrev(u,w,{index:p-1}),m){l.add(w);break}if(!m&&!d&&n===c.TARGET_FIRST){const{leaves:w}=u[p],[k]=h;let N=this._findNode(w,k);for(;N;){if(m=this._matchNodePrev(u,N,{index:p-1}),m){l.add(N);break}N=this._findNode(w,N)}}}}}return n===c.TARGET_FIRST?(l.delete(this.#e),l.size>1&&(l=new Set((0,_.sortNodes)(l)))):n===c.TARGET_ALL&&(l.delete(this.#e),a&&l.size>1&&(l=new Set((0,_.sortNodes)(l)))),l}}0&&(module.exports={Finder});
var C=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var F=(x,r)=>{for(var e in r)C(x,e,{get:r[e],enumerable:!0})},W=(x,r,e,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of D(r))!U.call(x,n)&&n!==e&&C(x,n,{get:()=>r[n],enumerable:!(o=P(r,n))||o.enumerable});return x};var z=x=>W(C({},"__esModule",{value:!0}),x);var H={};F(H,{Finder:()=>$});module.exports=z(H);var O=require("./matcher.js"),g=require("./parser.js"),N=require("./utility.js"),c=require("./constant.js");const v="next",S="prev";class ${#l;#r;#w;#t;#f;#n;#k;#c;#b;#h;#e;#d;#g;#m;#N;#s;#u;#_;#o;#p;#i;#a;constructor(r){this.#a=r,this.#h=new O.Matcher,this.#r=new WeakMap,this.#f=new WeakMap,this.#b=new WeakMap,this.#N=new WeakMap,this.#n=null,this.#k=null,this._registerEventListeners()}onError(r,e){if(!(e?.noexcept??this.#g))if(r instanceof DOMException||r instanceof this.#a.DOMException)if(r.name===c.NOT_SUPPORTED_ERR)this.#i&&console.warn(r.message);else throw new this.#a.DOMException(r.message,r.name);else throw r.name in this.#a?new this.#a[r.name](r.message):r}setup(r,e,o={}){const{event:n,noexcept:a,warn:l}=o;return this.#g=!!a,this.#i=!!l,this.#e=e,[this.#t,this.#s,this.#o]=(0,N.resolveContent)(e),this.#u=(0,N.isInShadowTree)(e),[this.#l,this.#d]=this._correspond(r),this.#b=new WeakMap,this.#p=new WeakMap,this.#_=null,this._setEvent(n),this}_registerEventListeners(){const r={capture:!0,passive:!0},e=[],o=["mouseover","mousedown","mouseup","mouseout"];for(const a of o)e.push(this.#a.addEventListener(a,l=>{this.#n=l},r));const n=["keydown","keyup"];for(const a of n)e.push(this.#a.addEventListener(a,l=>{l.key==="Tab"&&(this.#n=l)},r));return e.push(this.#a.addEventListener("focusin",a=>{this.#k=a},r)),e}_setEvent(r){return(r instanceof this.#a.KeyboardEvent||r instanceof this.#a.MouseEvent)&&(this.#n=r),this.#n}_correspond(r){const e=[];this.#w=!1,this.#c=!1;let o;if(this.#f.has(this.#t)){const n=this.#f.get(this.#t);if(n&&n.has(`${r}`)){const a=n.get(`${r}`);o=a.ast,this.#w=a.descendant,this.#c=a.invalidate}}if(o){const n=o.length;for(let a=0;a<n;a++)o[a].collected=!1,o[a].dir=null,o[a].filtered=!1,o[a].find=!1,e[a]=[]}else{let n;try{n=(0,g.parseSelector)(r)}catch(b){this.onError(b)}const{branches:a,info:l}=(0,g.walkAST)(n),{hasHasPseudoFunc:f,hasLogicalPseudoFunc:u,hasNthChildOfSelector:d}=l;let i=f||!!(u&&d),t=!1,s=0;o=[];for(const[...b]of a){const m=[];let p=b.shift();if(p&&p.type!==c.COMBINATOR){const w=new Set;for(;p;){let k=p.name;if(p.type===c.COMBINATOR){const[_]=b;if(_.type===c.COMBINATOR)throw new DOMException(`Invalid selector ${r}`,c.SYNTAX_ERR);k==="+"||k==="~"?i=!0:t=!0,m.push({combo:p,leaves:(0,g.sortAST)(w)}),w.clear()}else p&&(k&&typeof k=="string"&&(k=(0,g.unescapeSelector)(k),typeof k=="string"&&k!==p.name&&(p.name=k),/[|:]/.test(k)&&(p.namespace=!0)),w.add(p));if(b.length)p=b.shift();else{m.push({combo:null,leaves:(0,g.sortAST)(w)}),w.clear();break}}}o.push({branch:m,collected:!1,dir:null,filtered:!1,find:!1}),e[s]=[],s++}let h;this.#f.has(this.#t)?h=this.#f.get(this.#t):h=new Map,h.set(`${r}`,{ast:o,descendant:t,invalidate:i}),this.#f.set(this.#t,h),this.#w=t,this.#c=i}return[o,e]}_createTreeWalker(r){let e;return this.#p.has(r)?e=this.#p.get(r):(e=this.#t.createTreeWalker(r,c.WALKER_FILTER),this.#p.set(r,e)),e}_prepareQuerySelectorWalker(){return this.#m=this._createTreeWalker(this.#e),this.#m}_collectNthChild(r,e,o){const{a:n,b:a,reverse:l,selector:f}=r,{parentNode:u}=e,d=new Set;let i;if(f){if(this.#r.has(f))i=this.#r.get(f);else{const{branches:s}=(0,g.walkAST)(f);i=s,this.#c||this.#r.set(f,i)}const{branches:t}=(0,g.walkAST)(f);i=t}if(u){const t=this.#o;let s=(0,N.traverseNode)(u,t);s=t.firstChild();let h=0;for(;s;)h++,s=t.nextSibling();const b=new Set;if(i)for(s=(0,N.traverseNode)(u,t),s=t.firstChild();s;){if((0,N.isVisible)(s)){let m;for(const p of i)if(m=this._matchLeaves(p,s,o),!m)break;m&&b.add(s)}s=t.nextSibling()}if(n===0){if(a>0&&a<=h){if(b.size){s=(0,N.traverseNode)(u,t),l?s=t.lastChild():s=t.firstChild();let m=0;for(;s;){if(b.has(s)){if(m===a-1){d.add(s);break}m++}l?s=t.previousSibling():s=t.nextSibling()}}else if(!f){s=(0,N.traverseNode)(u,t),l?s=t.lastChild():s=t.firstChild();let m=0;for(;s;){if(m===a-1){d.add(s);break}l?s=t.previousSibling():s=t.nextSibling(),m++}}}}else{let m=a-1;if(n>0)for(;m<0;)m+=n;if(m>=0&&m<h){s=(0,N.traverseNode)(u,t),l?s=t.lastChild():s=t.firstChild();let p=0,w=n>0?0:a-1;for(;s&&(s&&m>=0&&m<h);)b.size?b.has(s)&&(w===m&&(d.add(s),m+=n),n>0?w++:w--):p===m&&(f||d.add(s),m+=n),l?s=t.previousSibling():s=t.nextSibling(),p++}}if(l&&d.size>1){const m=[...d];return new Set(m.reverse())}}else if(e===this.#s&&n+a===1)if(i){let t;for(const s of i)if(t=this._matchLeaves(s,e,o),t)break;t&&d.add(e)}else d.add(e);return d}_collectNthOfType(r,e){const{a:o,b:n,reverse:a}=r,{localName:l,namespaceURI:f,parentNode:u,prefix:d}=e,i=new Set;if(u){const t=this.#o;let s=(0,N.traverseNode)(u,t);s=t.firstChild();let h=0;for(;s;)h++,s=t.nextSibling();if(o===0){if(n>0&&n<=h){s=(0,N.traverseNode)(u,t),a?s=t.lastChild():s=t.firstChild();let b=0;for(;s;){const{localName:m,namespaceURI:p,prefix:w}=s;if(m===l&&w===d&&p===f){if(b===n-1){i.add(s);break}b++}a?s=t.previousSibling():s=t.nextSibling()}}}else{let b=n-1;if(o>0)for(;b<0;)b+=o;if(b>=0&&b<h){s=(0,N.traverseNode)(u,t),a?s=t.lastChild():s=t.firstChild();let m=o>0?0:n-1;for(;s;){const{localName:p,namespaceURI:w,prefix:k}=s;if(p===l&&k===d&&w===f){if(m===b&&(i.add(s),b+=o),b<0||b>=h)break;o>0?m++:m--}a?s=t.previousSibling():s=t.nextSibling()}}}if(a&&i.size>1){const b=[...i];return new Set(b.reverse())}}else e===this.#s&&o+n===1&&i.add(e);return i}_matchAnPlusB(r,e,o,n){const{nth:{a,b:l,name:f},selector:u}=r,d=new Map;if(f?(f==="even"?(d.set("a",2),d.set("b",0)):f==="odd"&&(d.set("a",2),d.set("b",1)),o.indexOf("last")>-1&&d.set("reverse",!0)):(typeof a=="string"&&/-?\d+/.test(a)?d.set("a",a*1):d.set("a",0),typeof l=="string"&&/-?\d+/.test(l)?d.set("b",l*1):d.set("b",0),o.indexOf("last")>-1&&d.set("reverse",!0)),o==="nth-child"||o==="nth-last-child"){u&&d.set("selector",u);const i=Object.fromEntries(d);return this._collectNthChild(i,e,n)}else if(o==="nth-of-type"||o==="nth-last-of-type"){const i=Object.fromEntries(d);return this._collectNthOfType(i,e)}return new Set}_matchHasPseudoFunc(r,e,o){let n;if(Array.isArray(r)&&r.length){const a=[...r],[l]=a,{type:f}=l;let u;f===c.COMBINATOR?u=a.shift():u={name:" ",type:c.COMBINATOR};const d=[];for(;a.length;){const[s]=a,{type:h}=s;if(h===c.COMBINATOR)break;d.push(a.shift())}const i={combo:u,leaves:d};o.dir=v;const t=this._matchCombinator(i,e,o);if(t.size)if(a.length){for(const s of t)if(n=this._matchHasPseudoFunc(a,s,o),n)break}else n=!0}return!!n}_matchLogicalPseudoFunc(r,e,o){const{astName:n,branches:a,twigBranches:l}=r,{isShadowRoot:f}=o;let u;if(n==="has"){let d;for(const i of a)if(d=this._matchHasPseudoFunc(i,e,o),d)break;if(d)if(f){if(this.#_)return e}else return e}else{if(f){for(const t of a)if(t.length>1)return null}o.forgive=n==="is"||n==="where";const d=l.length;let i;for(let t=0;t<d;t++){const s=l[t],h=s.length-1,{leaves:b}=s[h];if(i=this._matchLeaves(b,e,o),i&&h>0){let m=new Set([e]);for(let p=h-1;p>=0;p--){const w=s[p],k=[];o.dir=S;for(const _ of m){const y=this._matchCombinator(w,_,o);y.size&&k.push(...y)}if(k.length)p===0?i=!0:m=new Set(k);else{i=!1;break}}}if(i)break}if(n==="not"){if(!i)return e}else if(i)return e}return u??null}_matchPseudoClassSelector(r,e,o){const{children:n,name:a}=r,{localName:l,parentNode:f}=e,{forgive:u,warn:d=this.#i}=o,i=new Set;if(c.KEY_LOGICAL.includes(a)){let t;if(this.#r.has(r))t=this.#r.get(r);else{const{branches:h}=(0,g.walkAST)(r);if(a==="has"){for(const b of n){const m=(0,g.findAST)(b,p=>c.KEY_LOGICAL.includes(p.name)&&(0,g.findAST)(p,w=>w.name==="has")?p:null);if(m){const p=m.name;if(p==="is"||p==="where")return i;{const w=(0,g.generateCSS)(r);throw new DOMException(`Invalid selector ${w}`,c.SYNTAX_ERR)}}}t={astName:a,branches:h}}else{const b=[];for(const[...m]of h){const p=[],w=new Set;let k=m.shift();for(;k;)if(k.type===c.COMBINATOR?(p.push({combo:k,leaves:[...w]}),w.clear()):k&&w.add(k),m.length)k=m.shift();else{p.push({combo:null,leaves:[...w]}),w.clear();break}b.push(p)}t={astName:a,branches:h,twigBranches:b},this.#c||this.#r.set(r,t)}}const s=this._matchLogicalPseudoFunc(t,e,o);s&&i.add(s)}else if(Array.isArray(n))if(/^nth-(?:last-)?(?:child|of-type)$/.test(a)){const[t]=n;return this._matchAnPlusB(t,e,a,o)}else switch(a){case"dir":case"lang":{const t=this.#h.matchSelector(r,e,o,!0);t&&i.add(t);break}case"state":{if((0,N.isCustomElement)(e)){const[{value:t}]=n;if(t)if(e[t])i.add(e);else for(const s in e){const h=e[s];if(h instanceof this.#a.ElementInternals){h?.states?.has(t)&&i.add(e);break}}}break}case"current":case"nth-col":case"nth-last-col":{if(d)throw new DOMException(`Unsupported pseudo-class :${a}()`,c.NOT_SUPPORTED_ERR);break}case"host":case"host-context":break;case"contains":{if(d)throw new DOMException(`Unknown pseudo-class :${a}()`,c.NOT_SUPPORTED_ERR);break}default:if(!u)throw new DOMException(`Unknown pseudo-class :${a}()`,c.SYNTAX_ERR)}else switch(a){case"any-link":case"link":{(l==="a"||l==="area")&&e.hasAttribute("href")&&i.add(e);break}case"local-link":{if((l==="a"||l==="area")&&e.hasAttribute("href")){const{href:t,origin:s,pathname:h}=new URL(this.#t.URL),b=new URL(e.getAttribute("href"),t);b.origin===s&&b.pathname===h&&i.add(e)}break}case"visited":break;case"hover":{const{target:t,type:s}=this.#n??{};["mousedown","mouseover","mouseup"].includes(s)&&e.contains(t)&&i.add(e);break}case"active":{const{buttons:t,target:s,type:h}=this.#n??{};h==="mousedown"&&t&c.BIT_01&&e.contains(s)&&i.add(e);break}case"target":{const{hash:t}=new URL(this.#t.URL);e.id&&t===`#${e.id}`&&this.#t.contains(e)&&i.add(e);break}case"target-within":{const{hash:t}=new URL(this.#t.URL);if(t){const s=t.replace(/^#/,"");let h=this.#t.getElementById(s);for(;h;){if(h===e){i.add(e);break}h=h.parentNode}}break}case"scope":{this.#e.nodeType===c.ELEMENT_NODE?!this.#u&&e===this.#e&&i.add(e):e===this.#t.documentElement&&i.add(e);break}case"focus":{e===this.#t.activeElement&&(0,N.isFocusableArea)(e)&&i.add(e);break}case"focus-visible":{if(e===this.#t.activeElement&&(0,N.isFocusableArea)(e)){let t;if((0,N.isFocusVisible)(e))t=!0;else{const{target:s,type:h}=this.#n??{},{target:b,relatedTarget:m}=this.#k??{};((h==="keydown"||h==="keyup")&&e.contains(s)||m&&(0,N.isFocusVisible)(m)&&e.contains(b))&&(t=!0)}t&&i.add(e)}break}case"focus-within":{let t,s=this.#t.activeElement;if((0,N.isFocusableArea)(s))for(;s;){if(s===e){t=!0;break}s=s.parentNode}t&&i.add(e);break}case"open":case"closed":{(l==="details"||l==="dialog")&&(e.hasAttribute("open")?a==="open"&&i.add(e):a==="closed"&&i.add(e));break}case"disabled":case"enabled":{if([...c.KEY_FORM_FOCUS,"fieldset","optgroup","option"].includes(l)||(0,N.isCustomElement)(e,{formAssociated:!0})){let s;if(e.disabled||e.hasAttribute("disabled"))s=!0;else if(e.localName==="option")f.localName==="optgroup"&&(f.disabled||f.hasAttribute("disabled"))&&(s=!0);else if(e.localName!=="optgroup"){let h=f;for(;h;)if(h.localName==="fieldset"&&(h.disabled||h.hasAttribute("disabled"))){const b=this.#o;let m=(0,N.traverseNode)(h,b);for(m=b.firstChild();m&&m.localName!=="legend";)m=b.nextSibling();m&&m.contains(e)||(s=!0);break}else{if(h.localName==="form")break;if(h.parentNode?.nodeType===c.ELEMENT_NODE){if(h.parentNode.localName==="form")break;h=h.parentNode}else break}}s?a==="disabled"&&i.add(e):a==="enabled"&&i.add(e)}break}case"read-only":case"read-write":{let t,s;switch(l){case"textarea":{e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled")?t=!0:s=!0;break}case"input":{(!e.type||c.KEY_INPUT_EDIT.includes(e.type))&&(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled")?t=!0:s=!0);break}default:(0,N.isContentEditable)(e)?s=!0:t=!0}t?a==="read-only"&&i.add(e):a==="read-write"&&s&&i.add(e);break}case"placeholder-shown":{let t;if(e.placeholder?t=e.placeholder:e.hasAttribute("placeholder")&&(t=e.getAttribute("placeholder")),typeof t=="string"&&!/[\r\n]/.test(t)){let s;l==="textarea"?s=e:l==="input"&&(e.hasAttribute("type")?[...c.KEY_INPUT_TEXT,"number"].includes(e.getAttribute("type"))&&(s=e):s=e),s&&e.value===""&&i.add(e)}break}case"checked":{const t=e.getAttribute("type");(e.checked&&l==="input"&&(t==="checkbox"||t==="radio")||e.selected&&l==="option")&&i.add(e);break}case"indeterminate":{if(e.indeterminate&&l==="input"&&e.type==="checkbox"||l==="progress"&&!e.hasAttribute("value"))i.add(e);else if(l==="input"&&e.type==="radio"&&!e.hasAttribute("checked")){const t=e.name;let s=e.parentNode;for(;s&&s.localName!=="form";)s=s.parentNode;s||(s=this.#t.documentElement);const h=s.getElementsByTagName("input"),b=h.length;let m;for(let p=0;p<b;p++){const w=h[p];if(w.getAttribute("type")==="radio"&&(t?w.getAttribute("name")===t&&(m=!!w.checked):w.hasAttribute("name")||(m=!!w.checked),m))break}m||i.add(e)}break}case"default":{const t=["checkbox","radio"],s=["button","reset"],h=["image","submit"],b=e.getAttribute("type");if(l==="button"&&!(e.hasAttribute("type")&&s.includes(b))||l==="input"&&e.hasAttribute("type")&&h.includes(b)){let m=e.parentNode;for(;m&&m.localName!=="form";)m=m.parentNode;if(m){const p=this.#o;let w=(0,N.traverseNode)(m,p);for(w=p.firstChild();w&&m.contains(w);){const k=w.localName,_=w.getAttribute("type");let y;if(k==="button"?y=!(w.hasAttribute("type")&&s.includes(_)):k==="input"&&(y=w.hasAttribute("type")&&h.includes(_)),y){w===e&&i.add(e);break}w=p.nextNode()}}}else(l==="input"&&e.hasAttribute("type")&&t.includes(b)&&e.hasAttribute("checked")||l==="option"&&e.hasAttribute("selected"))&&i.add(e);break}case"valid":case"invalid":{const t=[...c.KEY_FORM_FOCUS,"form"];if(t.includes(l)){let s;e.checkValidity()&&(e.maxLength>=0?e.maxLength>=e.value.length&&(s=!0):s=!0),s?a==="valid"&&i.add(e):a==="invalid"&&i.add(e)}else if(l==="fieldset"){const s=this.#o;let h=(0,N.traverseNode)(e,s);h=s.firstChild();let b;if(!h)b=!0;else for(;h&&e.contains(h)&&!(t.includes(h.localName)&&(h.checkValidity()?h.maxLength>=0?b=h.maxLength>=h.value.length:b=!0:b=!1,!b));)h=s.nextNode();b?a==="valid"&&i.add(e):a==="invalid"&&i.add(e)}break}case"in-range":case"out-of-range":{const t=[...c.KEY_INPUT_DATE,"number","range"],s=e.getAttribute("type");if(l==="input"&&!(e.readonly||e.hasAttribute("readonly"))&&!(e.disabled||e.hasAttribute("disabled"))&&t.includes(s)){const h=e.validity.rangeUnderflow||e.validity.rangeOverflow;(a==="out-of-range"&&h||a==="in-range"&&!h&&(e.hasAttribute("min")||e.hasAttribute("max")||s==="range"))&&i.add(e)}break}case"required":case"optional":{let t;if(l==="select"||l==="textarea")t=e;else if(l==="input")if(e.hasAttribute("type")){const s=[...c.KEY_INPUT_EDIT,"checkbox","file","radio"],h=e.getAttribute("type");s.includes(h)&&(t=e)}else t=e;t&&(e.required||e.hasAttribute("required")?a==="required"&&i.add(e):a==="optional"&&i.add(e));break}case"root":{e===this.#t.documentElement&&i.add(e);break}case"empty":{if(e.hasChildNodes()){const t=this.#t.createTreeWalker(e,c.SHOW_ALL);let s=t.firstChild(),h;for(;s&&(h=s.nodeType!==c.ELEMENT_NODE&&s.nodeType!==c.TEXT_NODE,!!h);)s=t.nextSibling();h&&i.add(e)}else i.add(e);break}case"first-child":{(f&&e===f.firstElementChild||e===this.#s)&&i.add(e);break}case"last-child":{(f&&e===f.lastElementChild||e===this.#s)&&i.add(e);break}case"only-child":{(f&&e===f.firstElementChild&&e===f.lastElementChild||e===this.#s)&&i.add(e);break}case"first-of-type":{if(f){const[t]=this._collectNthOfType({a:0,b:1},e);t&&i.add(t)}else e===this.#s&&i.add(e);break}case"last-of-type":{if(f){const[t]=this._collectNthOfType({a:0,b:1,reverse:!0},e);t&&i.add(t)}else e===this.#s&&i.add(e);break}case"only-of-type":{if(f){const[t]=this._collectNthOfType({a:0,b:1},e);if(t===e){const[s]=this._collectNthOfType({a:0,b:1,reverse:!0},e);s===e&&i.add(e)}}else e===this.#s&&i.add(e);break}case"defined":{e.hasAttribute("is")||l.includes("-")?(0,N.isCustomElement)(e)&&i.add(e):(e instanceof this.#a.HTMLElement||e instanceof this.#a.SVGElement)&&i.add(e);break}case"popover-open":{e.popover&&(0,N.isVisible)(e)&&i.add(e);break}case"host":case"host-context":break;case"after":case"before":case"first-letter":case"first-line":{if(d)throw new DOMException(`Unsupported pseudo-element ::${a}`,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)throw new DOMException(`Unsupported pseudo-class :${a}`,c.NOT_SUPPORTED_ERR);break}default:if(a.startsWith("-webkit-")){if(d)throw new DOMException(`Unsupported pseudo-class :${a}`,c.NOT_SUPPORTED_ERR)}else if(!u)throw new DOMException(`Unknown pseudo-class :${a}`,c.SYNTAX_ERR)}return i}_matchShadowHostPseudoClass(r,e){const{children:o,name:n}=r;let a;if(Array.isArray(o)){const{branches:l}=(0,g.walkAST)(o[0]),[f]=l,[...u]=f,{host:d}=e;if(n==="host"){let i;for(const t of u){const{type:s}=t;if(s===c.COMBINATOR){const h=(0,g.generateCSS)(r);throw new DOMException(`Invalid selector ${h}`,c.SYNTAX_ERR)}if(i=this._matchSelector(t,d).has(d),!i)break}if(i)return e}else if(n==="host-context"){let i=d,t;for(;i;){for(const s of u){const{type:h}=s;if(h===c.COMBINATOR){const b=(0,g.generateCSS)(r);throw new DOMException(`Invalid selector ${b}`,c.SYNTAX_ERR)}if(t=this._matchSelector(s,i).has(i),!t)break}if(t)break;i=i.parentNode}if(t)return e}}else{if(n==="host")return e;throw new DOMException(`Invalid selector :${n}`,c.SYNTAX_ERR)}return a??null}_matchSelector(r,e,o={}){const{type:n}=r,a=new Set;if(r.name===c.EMPTY)return a;const l=(0,g.unescapeSelector)(r.name);if(typeof l=="string"&&l!==r.name&&(r.name=l),e.nodeType===c.ELEMENT_NODE)switch(n){case c.PS_ELEMENT_SELECTOR:{this.#h.matchPseudoElementSelector(l,o);break}case c.ID_SELECTOR:{e.id===l&&a.add(e);break}case c.CLASS_SELECTOR:{e.classList.contains(l)&&a.add(e);break}case c.PS_CLASS_SELECTOR:return this._matchPseudoClassSelector(r,e,o);default:{const f=this.#h.matchSelector(r,e,o,!0);f&&a.add(f)}}else if(this.#u&&n===c.PS_CLASS_SELECTOR&&e.nodeType===c.DOCUMENT_FRAGMENT_NODE){if(c.KEY_LOGICAL.includes(l))return o.isShadowRoot=!0,this._matchPseudoClassSelector(r,e,o);if(l==="host"||l==="host-context"){const f=this._matchShadowHostPseudoClass(r,e,o);f&&(this.#_=!0,a.add(f))}}return a}_matchLeaves(r,e,o){let n,a;if(this.#c?a=this.#b.get(r):a=this.#N.get(r),a&&a.has(e)){const{matched:l}=a.get(e);n=l}if(typeof n!="boolean"){let l=!0;const f=[...c.KEY_FORM_FOCUS,"fieldset","form"],u=["any-link","defined","dir","link"];e.nodeType===c.ELEMENT_NODE&&f.includes(e.localName)&&(l=!1);for(const d of r){switch(d.type){case c.ATTR_SELECTOR:case c.ID_SELECTOR:{l=!1;break}case c.PS_CLASS_SELECTOR:{u.includes(d.name)&&(l=!1);break}default:}if(n=this._matchSelector(d,e,o).has(e),!n)break}l&&(a||(a=new WeakMap),a.set(e,{matched:n}),this.#c?this.#b.set(r,a):this.#N.set(r,a))}return!!n}_matchHTMLCollection(r,e){const{compound:o,filterLeaves:n}=e,a=new Set,l=r.length;if(l)if(o)for(let f=0;f<l;f++){const u=r[f];this._matchLeaves(n,u,e)&&a.add(u)}else{const f=[].slice.call(r);return new Set(f)}return a}_findDescendantNodes(r,e,o){const[n,...a]=r,l=a.length>0,{type:f}=n,u=(0,g.unescapeSelector)(n.name);typeof u=="string"&&u!==n.name&&(n.name=u);let d=new Set,i=!1;if(this.#u)i=!0;else switch(f){case c.PS_ELEMENT_SELECTOR:{this.#h.matchPseudoElementSelector(u,o);break}case c.ID_SELECTOR:{if(this.#s.nodeType===c.ELEMENT_NODE)i=!0;else{const t=this.#s.getElementById(u);t&&t!==e&&e.contains(t)&&(l?this._matchLeaves(a,t,o)&&d.add(t):d.add(t))}break}case c.CLASS_SELECTOR:{const t=e.getElementsByClassName(u);d=this._matchHTMLCollection(t,{compound:l,filterLeaves:a});break}case c.TYPE_SELECTOR:{if(this.#t.contentType==="text/html"&&!/[*|]/.test(u)){const t=e.getElementsByTagName(u);d=this._matchHTMLCollection(t,{compound:l,filterLeaves:a})}else i=!0;break}default:i=!0}return{nodes:d,pending:i}}_matchCombinator(r,e,o){const{combo:n,leaves:a}=r,{name:l}=n,{parentNode:f}=e,{dir:u}=o,d=new Set;if(u===v)switch(l){case"+":{const i=e.nextElementSibling;i&&this._matchLeaves(a,i,o)&&d.add(i);break}case"~":{if(f){const i=this._createTreeWalker(f);let t=(0,N.traverseNode)(e,i);for(t=i.nextSibling();t;)this._matchLeaves(a,t,o)&&d.add(t),t=i.nextSibling()}break}case">":{const i=this._createTreeWalker(e);let t=(0,N.traverseNode)(e,i);for(t=i.firstChild();t;)this._matchLeaves(a,t,o)&&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 h=(0,N.traverseNode)(e,s);for(h=s.nextNode();h&&e.contains(h);)this._matchLeaves(a,h,o)&&d.add(h),h=s.nextNode()}}}else switch(l){case"+":{const i=e.previousElementSibling;i&&this._matchLeaves(a,i,o)&&d.add(i);break}case"~":{if(f){const i=this._createTreeWalker(f);let t=(0,N.traverseNode)(f,i);for(t=i.firstChild();t&&t!==e;)this._matchLeaves(a,t,o)&&d.add(t),t=i.nextSibling()}break}case">":{f&&this._matchLeaves(a,f,o)&&d.add(f);break}case" ":default:{const i=[];let t=f;for(;t;)this._matchLeaves(a,t,o)&&i.push(t),t=t.parentNode;if(i.length)return new Set(i.reverse())}}return d}_findNode(r,e){const o=this.#m;let n=(0,N.traverseNode)(e,o),a;if(n)for((n.nodeType!==c.ELEMENT_NODE||n===e&&n!==this.#s)&&(n=o.nextNode());n;){if(this._matchLeaves(r,n,{warn:this.#i})){a=n;break}n=o.nextNode()}return a??null}_matchSelf(r){const e=[],o=this._matchLeaves(r,this.#e,{warn:this.#i});let n=!1;return o&&(e.push(this.#e),n=!0),[e,n]}_findLineal(r,e){const{complex:o}=e,n=[];let a=this._matchLeaves(r,this.#e,{warn:this.#i}),l=!1;if(a&&(n.push(this.#e),l=!0),!a||o){let f=this.#e.parentNode;for(;f&&(a=this._matchLeaves(r,f,{warn:this.#i}),a&&(n.push(f),l=!0),f.parentNode);)f=f.parentNode}return[n,l]}_findFirst(r){const e=[],o=this._findNode(r,this.#e);let n=!1;return o&&(e.push(o),n=!0),[e,n]}_findFromHTMLCollection(r,e){const{complex:o,compound:n,filterLeaves:a,targetType:l}=e;let f=[],u=!1,d=!1;const i=r.length;if(i)if(this.#e.nodeType===c.ELEMENT_NODE)for(let t=0;t<i;t++){const s=r[t];if(s!==this.#e&&(this.#e.contains(s)||s.contains(this.#e))){if(n){if(this._matchLeaves(a,s,{warn:this.#i})&&(f.push(s),u=!0,l===c.TARGET_FIRST))break}else if(f.push(s),u=!0,l===c.TARGET_FIRST)break}}else if(o)if(n)for(let t=0;t<i;t++){const s=r[t];if(this._matchLeaves(a,s,{warn:this.#i})&&(f.push(s),u=!0,l===c.TARGET_FIRST))break}else f=[].slice.call(r),u=!0,d=!0;else if(n)for(let t=0;t<i;t++){const s=r[t];if(this._matchLeaves(a,s,{warn:this.#i})&&(f.push(s),u=!0,l===c.TARGET_FIRST))break}else f=[].slice.call(r),u=!0,d=!0;return[f,u,d]}_findEntryNodes(r,e,o){const{leaves:n}=r,[a,...l]=n,f=l.length>0,{name:u,type:d}=a;let i=[],t=!1,s=!1,h=!1;switch(d){case c.PS_ELEMENT_SELECTOR:{this.#h.matchPseudoElementSelector(u,{warn:this.#i});break}case c.ID_SELECTOR:{if(e===c.TARGET_SELF)[i,s]=this._matchSelf(n);else if(e===c.TARGET_LINEAL)[i,s]=this._findLineal(n,{complex:o});else if(e===c.TARGET_FIRST&&this.#s.nodeType!==c.ELEMENT_NODE){const b=this.#s.getElementById(u);b&&(f?this._matchLeaves(l,b,{warn:this.#i})&&(i.push(b),s=!0):(i.push(b),s=!0))}else e===c.TARGET_FIRST?[i,s]=this._findFirst(n):h=!0;break}case c.CLASS_SELECTOR:{if(e===c.TARGET_SELF)[i,s]=this._matchSelf(n);else if(e===c.TARGET_LINEAL)[i,s]=this._findLineal(n,{complex:o});else if(this.#s.nodeType===c.DOCUMENT_NODE){const b=this.#s.getElementsByClassName(u);b.length&&([i,s,t]=this._findFromHTMLCollection(b,{complex:o,compound:f,filterLeaves:l,targetType:e}))}else e===c.TARGET_FIRST?[i,s]=this._findFirst(n):h=!0;break}case c.TYPE_SELECTOR:{if(e===c.TARGET_SELF)[i,s]=this._matchSelf(n);else if(e===c.TARGET_LINEAL)[i,s]=this._findLineal(n,{complex:o});else if(this.#t.contentType==="text/html"&&this.#s.nodeType===c.DOCUMENT_NODE&&!/[*|]/.test(u)){const b=this.#s.getElementsByTagName(u);b.length&&([i,s,t]=this._findFromHTMLCollection(b,{complex:o,compound:f,filterLeaves:l,targetType:e}))}else e===c.TARGET_FIRST?[i,s]=this._findFirst(n):h=!0;break}default:if(e!==c.TARGET_LINEAL&&(u==="host"||u==="host-context")){if(this.#u&&this.#e.nodeType===c.DOCUMENT_FRAGMENT_NODE){const b=this._matchShadowHostPseudoClass(a,this.#e);b&&(i.push(b),s=!0)}}else e===c.TARGET_SELF?[i,s]=this._matchSelf(n):e===c.TARGET_LINEAL?[i,s]=this._findLineal(n,{complex:o}):e===c.TARGET_FIRST?[i,s]=this._findFirst(n):h=!0}return{collected:t,compound:f,filtered:s,nodes:i,pending:h}}_collectNodes(r){const e=this.#l.values();if(r===c.TARGET_ALL||r===c.TARGET_FIRST){const o=new Set;let n=0;for(const{branch:a}of e){const l=a.length,f=l>1,u=a[0];let d,i;if(f){const{combo:p,leaves:[{name:w,type:k}]}=u,_=a[l-1],{leaves:[{name:y,type:L}]}=_;if(L===c.PS_ELEMENT_SELECTOR||L===c.ID_SELECTOR)d=S,i=_;else if(k===c.PS_ELEMENT_SELECTOR||k===c.ID_SELECTOR)d=v,i=u;else if(r===c.TARGET_ALL)if(w==="*"&&k===c.TYPE_SELECTOR)d=S,i=_;else if(y==="*"&&L===c.TYPE_SELECTOR)d=v,i=u;else if(l===2){const{name:E}=p;E==="+"||E==="~"?(d=S,i=_):(d=v,i=u)}else d=v,i=u;else if(w==="*"&&k===c.TYPE_SELECTOR)d=S,i=_;else if(y==="*"&&L===c.TYPE_SELECTOR)d=v,i=u;else{let E;for(const{combo:T,leaves:[M]}of a){const{name:R,type:I}=M;if(I===c.PS_CLASS_SELECTOR&&R==="dir"){E=!1;break}if(!E&&T){const{name:A}=T;(A==="+"||A==="~")&&(E=!0)}}E?(d=v,i=u):(d=S,i=_)}}else d=S,i=u;const{collected:t,compound:s,filtered:h,nodes:b,pending:m}=this._findEntryNodes(i,r,f);b.length?(this.#l[n].find=!0,this.#d[n]=b):m&&o.add(new Map([["index",n],["twig",i]])),this.#l[n].collected=t,this.#l[n].dir=d,this.#l[n].filtered=h||!s,n++}if(o.size){let a,l;this.#e!==this.#s&&this.#e.nodeType===c.ELEMENT_NODE?(a=this.#e,l=this.#m):(a=this.#s,l=this.#o);let f=(0,N.traverseNode)(a,l);for(;f;){let u=!1;if(this.#e.nodeType===c.ELEMENT_NODE?f===this.#e?u=!0:u=this.#e.contains(f):u=!0,u)for(const d of o){const{leaves:i}=d.get("twig");if(this._matchLeaves(i,f,{warn:this.#i})){const s=d.get("index");this.#l[s].filtered=!0,this.#l[s].find=!0,this.#d[s].push(f)}}f!==l.currentNode&&(f=(0,N.traverseNode)(f,l)),f=l.nextNode()}}}else{let o=0;for(const{branch:n}of e){const a=n[n.length-1],l=n.length>1,{compound:f,filtered:u,nodes:d}=this._findEntryNodes(a,r,l);d.length&&(this.#l[o].find=!0,this.#d[o]=d),this.#l[o].dir=S,this.#l[o].filtered=u||!f,o++}}return[this.#l,this.#d]}_getCombinedNodes(r,e,o){const n=[];for(const a of e){const l=this._matchCombinator(r,a,{dir:o,warn:this.#i});l.size&&n.push(...l)}return n.length?new Set(n):new Set}_matchNodeNext(r,e,o){const{combo:n,index:a}=o,{combo:l,leaves:f}=r[a],u={combo:n,leaves:f},d=this._getCombinedNodes(u,e,v);let i;if(d.size)if(a===r.length-1){const[t]=(0,N.sortNodes)(d);i=t}else i=this._matchNodeNext(r,d,{combo:l,index:a+1});return i??null}_matchNodePrev(r,e,o){const{index:n}=o,a=r[n],l=new Set([e]),f=this._getCombinedNodes(a,l,S);let u;if(f.size){if(n===0)u=e;else for(const d of f)if(this._matchNodePrev(r,d,{index:n-1}))return e}return u??null}find(r){(r===c.TARGET_ALL||r===c.TARGET_FIRST)&&this._prepareQuerySelectorWalker();const[[...e],o]=this._collectNodes(r),n=e.length;let a,l=new Set;for(let f=0;f<n;f++){const{branch:u,collected:d,dir:i,find:t}=e[f],s=u.length;if(s&&t){const h=o[f],b=h.length,m=s-1;if(m===0)if((r===c.TARGET_ALL||r===c.TARGET_FIRST)&&this.#e.nodeType===c.ELEMENT_NODE)for(let p=0;p<b;p++){const w=h[p];if(w!==this.#e&&this.#e.contains(w)&&(l.add(w),r===c.TARGET_FIRST))break}else if(r===c.TARGET_ALL)if(l.size){const p=[...l];l=new Set([...p,...h]),a=!0}else l=new Set(h);else{const[p]=h;l.add(p)}else if(r===c.TARGET_ALL)if(i===v){let{combo:p}=u[0];for(const w of h){let k=new Set([w]);for(let _=1;_<s;_++){const{combo:y,leaves:L}=u[_],E={combo:p,leaves:L};if(k=this._getCombinedNodes(E,k,i),k.size)if(_===m)if(l.size){const T=[...l];l=new Set([...T,...k]),a=!0}else l=k;else p=y;else break}}}else for(const p of h){let w=new Set([p]);for(let k=m-1;k>=0;k--){const _=u[k];if(w=this._getCombinedNodes(_,w,i),w.size)k===0&&(l.add(p),s>1&&l.size>1&&(a=!0));else break}}else if(r===c.TARGET_FIRST&&i===v){const{combo:p}=u[0];let w;for(const k of h)if(w=this._matchNodeNext(u,new Set([k]),{combo:p,index:1}),w){l.add(w);break}if(!w&&!d){const{leaves:k}=u[0],[_]=h;let y=this._findNode(k,_);for(;y;){if(w=this._matchNodeNext(u,new Set([y]),{combo:p,index:1}),w){l.add(w);break}y=this._findNode(k,y)}}}else{let p;for(const w of h)if(p=this._matchNodePrev(u,w,{index:m-1}),p){l.add(w);break}if(!p&&!d&&r===c.TARGET_FIRST){const{leaves:w}=u[m],[k]=h;let _=this._findNode(w,k);for(;_;){if(p=this._matchNodePrev(u,_,{index:m-1}),p){l.add(_);break}_=this._findNode(w,_)}}}}}return r===c.TARGET_FIRST?(l.delete(this.#e),l.size>1&&(l=new Set((0,N.sortNodes)(l)))):r===c.TARGET_ALL&&(l.delete(this.#e),a&&l.size>1&&(l=new Set((0,N.sortNodes)(l)))),l}}0&&(module.exports={Finder});
//# sourceMappingURL=finder.js.map

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

var S=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var L=(s,e)=>{for(var r in e)S(s,r,{get:e[r],enumerable:!0})},b=(s,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of y(e))!_.call(s,n)&&n!==r&&S(s,n,{get:()=>e[n],enumerable:!(o=w(e,n))||o.enumerable});return s};var A=s=>b(S({},"__esModule",{value:!0}),s);var P={};L(P,{findAST:()=>E.find,generateCSS:()=>E.generate,parseAstName:()=>D,parseSelector:()=>g,preprocess:()=>T,sortAST:()=>F,unescapeSelector:()=>I,walkAST:()=>C});module.exports=A(P);var d=require("css-tree"),O=require("./utility.js"),t=require("./constant.js"),E=require("css-tree");const $=/(:lang\(\s*("[A-Za-z\d\-*]*")\s*\))/,m=/(:(is|where)\(\s*\))/,x=/^part|slotted$/,u="\uFFFD",I=(s="")=>{if(typeof s=="string"&&s.indexOf("\\",0)>=0){const e=s.split("\\"),r=e.length;for(let o=1;o<r;o++){let n=e[o];if(n===""&&o===r-1)n=u;else{const c=/^([\da-f]{1,6}\s?)/i.exec(n);if(c){const[,f]=c;let a;try{const i=parseInt("D800",t.HEX),p=parseInt("DFFF",t.HEX),h=parseInt(f,t.HEX);h===0||h>=i&&h<=p?a=u:a=String.fromCodePoint(h)}catch{a=u}let l="";n.length>f.length&&(l=n.substring(f.length)),n=`${a}${l}`}else/^[\n\r\f]/.test(n)&&(n="\\"+n)}e[o]=n}s=e.join("")}return s},T=(...s)=>{if(!s.length)throw new TypeError("1 argument required, but only 0 present.");let[e]=s;if(typeof e=="string"){let r=0;for(;r>=0&&(r=e.indexOf("#",r),!(r<0));){const o=e.substring(0,r+1);let n=e.substring(r+1);if(/^\d$/.test(n.substring(0,1)))throw new DOMException(`Invalid selector ${e}`,t.SYNTAX_ERR);const c=n.codePointAt(0);if(c===t.HYPHEN){if(/^\d$/.test(n.substring(1,2)))throw new DOMException(`Invalid selector ${e}`,t.SYNTAX_ERR)}else if(c>t.BIT_FFFF){const f=`\\${c.toString(t.HEX)} `;n.length===t.DUO?n=f:n=`${f}${n.substring(t.DUO)}`}e=`${o}${n}`,r++}e=e.replace(/\f|\r\n?/g,`
`).replace(/[\0\uD800-\uDFFF]|\\$/g,u)}else if(e==null)e=(0,O.getType)(e).toLowerCase();else if(Array.isArray(e))e=e.join(",");else if(Object.prototype.hasOwnProperty.call(e,"toString"))e=e.toString();else throw new DOMException(`Invalid selector ${e}`,t.SYNTAX_ERR);return e},g=s=>{if(s=T(s),/^$|^\s*>|,\s*$/.test(s))throw new DOMException(`Invalid selector ${s}`,t.SYNTAX_ERR);let e;try{const r=(0,d.parse)(s,{context:"selectorList",parseCustomProperty:!0});e=(0,d.toPlainObject)(r)}catch(r){const{message:o}=r;if(o==="Identifier is expected"&&$.test(s)){const[,n,c]=$.exec(s),f=c.replaceAll("*","\\*").replace(/^"/,"").replace(/"$/,"");let a=n.replace(c,f);a===":lang()"&&(a=`:lang(${t.EMPTY})`),e=g(s.replace(n,a))}else if(/^(?:Identifier|Selector) is expected$/.test(o)&&m.test(s)){const[,n,c]=m.exec(s);e=g(s.replace(n,`:${c}(${t.EMPTY})`))}else if(/^(?:"\]"|Attribute selector [()\s,=~^$*|]+) is expected$/.test(o)&&!s.endsWith("]")){const n=s.lastIndexOf("["),c=s.substring(n);c.includes('"')?c.match(/"/g).length%2?e=g(`${s}"]`):e=g(`${s}]`):e=g(`${s}]`)}else if(o==='")" is expected'&&!s.endsWith(")"))e=g(`${s})`);else throw new DOMException(o,t.SYNTAX_ERR)}return e},C=(s={})=>{const e=new Set,r=new Map;return(0,d.walk)(s,{enter:n=>{switch(n.type){case t.SELECTOR:{e.add(n.children);break}case t.PS_CLASS_SELECTOR:{t.REG_LOGICAL.test(n.name)&&(r.set("hasNestedSelector",!0),r.set("hasLogicalPseudoFunc",!0),n.name==="has"&&r.set("hasHasPseudoFunc",!0));break}case t.PS_ELEMENT_SELECTOR:{x.test(n.name)&&r.set("hasNestedSelector",!0);break}case t.NTH:{n.selector&&(r.set("hasNestedSelector",!0),r.set("hasNthChildOfSelector",!0));break}default:}}}),r.get("hasNestedSelector")&&(0,d.findAll)(s,(n,c,f)=>{if(f){if(n.type===t.PS_CLASS_SELECTOR&&t.REG_LOGICAL.test(n.name)){const a=f.filter(l=>{const{name:i,type:p}=l;return p===t.PS_CLASS_SELECTOR&&t.REG_LOGICAL.test(i)});for(const{children:l}of a)for(const{children:i}of l)for(const{children:p}of i)e.has(p)&&e.delete(p)}else if(n.type===t.PS_ELEMENT_SELECTOR&&x.test(n.name)){const a=f.filter(l=>{const{name:i,type:p}=l;return p===t.PS_ELEMENT_SELECTOR&&x.test(i)});for(const{children:l}of a)for(const{children:i}of l)e.has(i)&&e.delete(i)}else if(n.type===t.NTH&&n.selector){const a=f.filter(l=>{const{selector:i,type:p}=l;return p===t.NTH&&i});for(const{selector:l}of a){const{children:i}=l;for(const{children:p}of i)e.has(p)&&e.delete(p)}}}}),{branches:[...e],info:Object.fromEntries(r)}},F=s=>{const e=[...s];if(e.length>1){const r=new Map([[t.PS_ELEMENT_SELECTOR,t.BIT_01],[t.ID_SELECTOR,t.BIT_02],[t.CLASS_SELECTOR,t.BIT_04],[t.TYPE_SELECTOR,t.BIT_08],[t.ATTR_SELECTOR,t.BIT_16],[t.PS_CLASS_SELECTOR,t.BIT_32]]);e.sort((o,n)=>{const{type:c}=o,{type:f}=n,a=r.get(c),l=r.get(f);let i;return a===l?i=0:a>l?i=1:i=-1,i})}return e},D=s=>{let e,r;if(s&&typeof s=="string")s.indexOf("|")>-1?[e,r]=s.split("|"):(e="*",r=s);else throw new DOMException(`Invalid selector ${s}`,t.SYNTAX_ERR);return{prefix:e,localName:r}};0&&(module.exports={findAST,generateCSS,parseAstName,parseSelector,preprocess,sortAST,unescapeSelector,walkAST});
var S=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var L=(s,e)=>{for(var r in e)S(s,r,{get:e[r],enumerable:!0})},b=(s,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of y(e))!_.call(s,n)&&n!==r&&S(s,n,{get:()=>e[n],enumerable:!(o=w(e,n))||o.enumerable});return s};var A=s=>b(S({},"__esModule",{value:!0}),s);var P={};L(P,{findAST:()=>E.find,generateCSS:()=>E.generate,parseAstName:()=>D,parseSelector:()=>h,preprocess:()=>T,sortAST:()=>F,unescapeSelector:()=>I,walkAST:()=>C});module.exports=A(P);var d=require("css-tree"),O=require("./utility.js"),t=require("./constant.js"),E=require("css-tree");const $=/(:lang\(\s*("[A-Za-z\d\-*]*")\s*\))/,m=/(:(is|where)\(\s*\))/,x=/^part|slotted$/,g="\uFFFD",I=(s="")=>{if(typeof s=="string"&&s.indexOf("\\",0)>=0){const e=s.split("\\"),r=e.length;for(let o=1;o<r;o++){let n=e[o];if(n===""&&o===r-1)n=g;else{const c=/^([\da-f]{1,6}\s?)/i.exec(n);if(c){const[,f]=c;let a;try{const i=parseInt("D800",t.HEX),p=parseInt("DFFF",t.HEX),u=parseInt(f,t.HEX);u===0||u>=i&&u<=p?a=g:a=String.fromCodePoint(u)}catch{a=g}let l="";n.length>f.length&&(l=n.substring(f.length)),n=`${a}${l}`}else/^[\n\r\f]/.test(n)&&(n="\\"+n)}e[o]=n}s=e.join("")}return s},T=(...s)=>{if(!s.length)throw new TypeError("1 argument required, but only 0 present.");let[e]=s;if(typeof e=="string"){let r=0;for(;r>=0&&(r=e.indexOf("#",r),!(r<0));){const o=e.substring(0,r+1);let n=e.substring(r+1);if(/^\d$/.test(n.substring(0,1)))throw new DOMException(`Invalid selector ${e}`,t.SYNTAX_ERR);const c=n.codePointAt(0);if(c===t.HYPHEN){if(/^\d$/.test(n.substring(1,2)))throw new DOMException(`Invalid selector ${e}`,t.SYNTAX_ERR)}else if(c>t.BIT_FFFF){const f=`\\${c.toString(t.HEX)} `;n.length===t.DUO?n=f:n=`${f}${n.substring(t.DUO)}`}e=`${o}${n}`,r++}e=e.replace(/\f|\r\n?/g,`
`).replace(/[\0\uD800-\uDFFF]|\\$/g,g)}else if(e==null)e=(0,O.getType)(e).toLowerCase();else if(Array.isArray(e))e=e.join(",");else if(Object.prototype.hasOwnProperty.call(e,"toString"))e=e.toString();else throw new DOMException(`Invalid selector ${e}`,t.SYNTAX_ERR);return e},h=s=>{if(s=T(s),/^$|^\s*>|,\s*$/.test(s))throw new DOMException(`Invalid selector ${s}`,t.SYNTAX_ERR);let e;try{const r=(0,d.parse)(s,{context:"selectorList",parseCustomProperty:!0});e=(0,d.toPlainObject)(r)}catch(r){const{message:o}=r;if(o==="Identifier is expected"&&$.test(s)){const[,n,c]=$.exec(s),f=c.replaceAll("*","\\*").replace(/^"/,"").replace(/"$/,"");let a=n.replace(c,f);a===":lang()"&&(a=`:lang(${t.EMPTY})`),e=h(s.replace(n,a))}else if(/^(?:Identifier|Selector) is expected$/.test(o)&&m.test(s)){const[,n,c]=m.exec(s);e=h(s.replace(n,`:${c}(${t.EMPTY})`))}else if(/^(?:"\]"|Attribute selector [()\s,=~^$*|]+) is expected$/.test(o)&&!s.endsWith("]")){const n=s.lastIndexOf("["),c=s.substring(n);c.includes('"')?c.match(/"/g).length%2?e=h(`${s}"]`):e=h(`${s}]`):e=h(`${s}]`)}else if(o==='")" is expected'&&!s.endsWith(")"))e=h(`${s})`);else throw new DOMException(o,t.SYNTAX_ERR)}return e},C=(s={})=>{const e=new Set,r=new Map;return(0,d.walk)(s,{enter:n=>{switch(n.type){case t.SELECTOR:{e.add(n.children);break}case t.PS_CLASS_SELECTOR:{t.KEY_LOGICAL.includes(n.name)&&(r.set("hasNestedSelector",!0),r.set("hasLogicalPseudoFunc",!0),n.name==="has"&&r.set("hasHasPseudoFunc",!0));break}case t.PS_ELEMENT_SELECTOR:{x.test(n.name)&&r.set("hasNestedSelector",!0);break}case t.NTH:{n.selector&&(r.set("hasNestedSelector",!0),r.set("hasNthChildOfSelector",!0));break}default:}}}),r.get("hasNestedSelector")&&(0,d.findAll)(s,(n,c,f)=>{if(f){if(n.type===t.PS_CLASS_SELECTOR&&t.KEY_LOGICAL.includes(n.name)){const a=f.filter(l=>{const{name:i,type:p}=l;return p===t.PS_CLASS_SELECTOR&&t.KEY_LOGICAL.includes(i)});for(const{children:l}of a)for(const{children:i}of l)for(const{children:p}of i)e.has(p)&&e.delete(p)}else if(n.type===t.PS_ELEMENT_SELECTOR&&x.test(n.name)){const a=f.filter(l=>{const{name:i,type:p}=l;return p===t.PS_ELEMENT_SELECTOR&&x.test(i)});for(const{children:l}of a)for(const{children:i}of l)e.has(i)&&e.delete(i)}else if(n.type===t.NTH&&n.selector){const a=f.filter(l=>{const{selector:i,type:p}=l;return p===t.NTH&&i});for(const{selector:l}of a){const{children:i}=l;for(const{children:p}of i)e.has(p)&&e.delete(p)}}}}),{branches:[...e],info:Object.fromEntries(r)}},F=s=>{const e=[...s];if(e.length>1){const r=new Map([[t.PS_ELEMENT_SELECTOR,t.BIT_01],[t.ID_SELECTOR,t.BIT_02],[t.CLASS_SELECTOR,t.BIT_04],[t.TYPE_SELECTOR,t.BIT_08],[t.ATTR_SELECTOR,t.BIT_16],[t.PS_CLASS_SELECTOR,t.BIT_32]]);e.sort((o,n)=>{const{type:c}=o,{type:f}=n,a=r.get(c),l=r.get(f);let i;return a===l?i=0:a>l?i=1:i=-1,i})}return e},D=s=>{let e,r;if(s&&typeof s=="string")s.indexOf("|")>-1?[e,r]=s.split("|"):(e="*",r=s);else throw new DOMException(`Invalid selector ${s}`,t.SYNTAX_ERR);return{prefix:e,localName:r}};0&&(module.exports={findAST,generateCSS,parseAstName,parseSelector,preprocess,sortAST,unescapeSelector,walkAST});
//# sourceMappingURL=parser.js.map

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

var D=Object.create;var f=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var L=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var R=(e,t)=>{for(var i in t)f(e,i,{get:t[i],enumerable:!0})},w=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of _(t))!I.call(e,o)&&o!==i&&f(e,o,{get:()=>t[o],enumerable:!(r=U(t,o))||r.enumerable});return e};var y=(e,t,i)=>(i=e!=null?D(L(e)):{},w(t||!e||!e.__esModule?f(i,"default",{value:e,enumerable:!0}):i,e)),k=e=>w(f({},"__esModule",{value:!0}),e);var K={};R(K,{filterSelector:()=>H,getDirectionality:()=>m,getNamespaceURI:()=>g,getSlottedTextContent:()=>u,getType:()=>p,initNwsapi:()=>j,isContentEditable:()=>x,isCustomElement:()=>G,isFocusVisible:()=>V,isFocusable:()=>W,isInShadowTree:()=>$,isNamespaceDeclared:()=>X,isPreceding:()=>C,isVisible:()=>F,resolveContent:()=>A,sortNodes:()=>Y,traverseNode:()=>S});module.exports=k(K);var h=y(require("@asamuzakjp/nwsapi"),1),O=y(require("bidi-js"),1),T=y(require("is-potential-custom-element-name"),1),s=require("./constant.js");const M=new RegExp(`:(?!${s.PSEUDO_CLASS}|${s.N_TH}|${s.LOGICAL_COMPLEX})`),P=new RegExp(`:(?!${s.PSEUDO_CLASS}|${s.N_TH}|${s.LOGICAL_COMPOUND})`),v=new RegExp(`:(?!${s.PSEUDO_CLASS}|${s.N_TH})`),p=e=>Object.prototype.toString.call(e).slice(s.TYPE_FROM,s.TYPE_TO),A=e=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${p(e)}`);let t,i;switch(e.nodeType){case s.DOCUMENT_NODE:{t=e,i=e;break}case s.DOCUMENT_FRAGMENT_NODE:{t=e.ownerDocument,i=e;break}case s.ELEMENT_NODE:{t=e.ownerDocument;let o=e;for(;o&&o.parentNode;)o=o.parentNode;i=o;break}default:throw new TypeError(`Unexpected node ${e.nodeName}`)}const r=t.createTreeWalker(i,s.WALKER_FILTER);return[t,i,r]},S=(e,t)=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${p(e)}`);let i;if(t?.currentNode){let r=t.currentNode;if(r===e)i=r;else if(r.contains(e))for(r=t.nextNode();r;){if(r===e){i=r;break}r=t.nextNode()}else{if(r!==t.root)for(;r&&!(r===t.root||r===e);)r=t.parentNode();if(e.nodeType===s.ELEMENT_NODE)for(;r;){if(r===e){i=r;break}r=t.nextNode()}else i=r}}return i??null},G=(e,t={})=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${p(e)}`);let i;if(e.nodeType===s.ELEMENT_NODE){const{localName:r,ownerDocument:o}=e,{formAssociated:a}=t,n=o.defaultView;let l;const c=e.getAttribute("is");c?l=(0,T.default)(c)&&n.customElements.get(c):l=(0,T.default)(r)&&n.customElements.get(r),l&&(a?i=l.formAssociated:i=!0)}return!!i},$=e=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${p(e)}`);let t;if(e.nodeType===s.ELEMENT_NODE||e.nodeType===s.DOCUMENT_FRAGMENT_NODE){let i=e;for(;i;){const{host:r,mode:o,nodeType:a,parentNode:n}=i;if(r&&o&&a===s.DOCUMENT_FRAGMENT_NODE&&/^(?:close|open)$/.test(o)){t=!0;break}i=n}}return!!t},u=e=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${p(e)}`);let t;if(e.localName==="slot"&&$(e)){const i=e.assignedNodes();if(i.length){for(const r of i)if(t=r.textContent.trim(),t)break}else t=e.textContent.trim()}return t??null},m=e=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${p(e)}`);let t;if(e.nodeType===s.ELEMENT_NODE){const{dir:i,localName:r,parentNode:o}=e,{getEmbeddingLevels:a}=(0,O.default)();if(/^(?:ltr|rtl)$/.test(i))t=i;else if(i==="auto"){let n;switch(r){case"input":{!e.type||/^(?:button|email|hidden|password|reset|search|submit|tel|text|url)$/.test(e.type)?n=e.value:/^(?:checkbox|color|date|image|number|radio|range|time)$/.test(e.type)&&(t="ltr");break}case"slot":{n=u(e);break}case"textarea":{n=e.value;break}default:{const l=[].slice.call(e.childNodes);for(const c of l){const{dir:d,localName:b,nodeType:E,textContent:N}=c;if(E===s.TEXT_NODE?n=N.trim():E===s.ELEMENT_NODE&&!/^(?:bdi|script|style|textarea)$/.test(b)&&(!d||!/^(?:ltr|rtl)$/.test(d))&&(b==="slot"?n=u(c):n=N.trim()),n)break}}}if(n){const{paragraphs:[{level:l}]}=a(n);l%2===1?t="rtl":t="ltr"}if(!t)if(o){const{nodeType:l}=o;l===s.ELEMENT_NODE?t=m(o):(l===s.DOCUMENT_NODE||l===s.DOCUMENT_FRAGMENT_NODE)&&(t="ltr")}else t="ltr"}else if(r==="bdi"){const n=e.textContent.trim();if(n){const{paragraphs:[{level:l}]}=a(n);l%2===1?t="rtl":t="ltr"}t||o||(t="ltr")}else if(r==="input"&&e.type==="tel")t="ltr";else if(o){if(r==="slot"){const n=u(e);if(n){const{paragraphs:[{level:l}]}=a(n);l%2===1?t="rtl":t="ltr"}}if(!t){const{nodeType:n}=o;n===s.ELEMENT_NODE?t=m(o):(n===s.DOCUMENT_NODE||n===s.DOCUMENT_FRAGMENT_NODE)&&(t="ltr")}}else t="ltr"}return t??null},x=e=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${p(e)}`);let t;if(e.nodeType===s.ELEMENT_NODE){if(typeof e.isContentEditable=="boolean")t=e.isContentEditable;else if(e.ownerDocument.designMode==="on")t=!0;else if(e.hasAttribute("contenteditable")){const i=e.getAttribute("contenteditable");if(i===""||/^(?:plaintext-only|true)$/.test(i))t=!0;else if(i==="inherit"){let r=e.parentNode;for(;r;){if(x(r)){t=!0;break}r=r.parentNode}}}}return!!t},F=e=>{let t;if(e?.nodeType===s.ELEMENT_NODE){const i=e.ownerDocument.defaultView,{display:r,visibility:o}=i.getComputedStyle(e);r!=="none"&&o==="visible"&&(t=!0)}return!!t},V=e=>{let t;if(e?.nodeType===s.ELEMENT_NODE){const{localName:i,type:r}=e;switch(i){case"input":{(!r||s.REG_INPUT_TYPE.test(r))&&(t=!0);break}case"textarea":{t=!0;break}default:t=x(e)}}return!!t},W=e=>{let t;if(e?.nodeType===s.ELEMENT_NODE){const i=e.ownerDocument.defaultView;let r=e;for(t=!0;r;){if(r.disabled||r.hasAttribute("disabled"))return!1;(r.hidden||r.hasAttribute("hidden"))&&(t=!1);const{contentVisibility:o,display:a,visibility:n}=i.getComputedStyle(r);if(a==="none"||n!=="visible"||o==="hidden"&&r!==e?t=!1:t=!0,t&&r?.parentNode?.nodeType===s.ELEMENT_NODE)r=r.parentNode;else break}}return!!t},g=(e,t)=>{if(typeof e!="string")throw new TypeError(`Unexpected type ${p(e)}`);if(!t?.nodeType)throw new TypeError(`Unexpected type ${p(t)}`);let i;if(e&&t.nodeType===s.ELEMENT_NODE){const{attributes:r}=t;for(const o of r){const{name:a,namespaceURI:n,prefix:l,value:c}=o;if(a===`xmlns:${e}`){i=c;break}else if(l===e){i=n;break}}}return i??null},X=(e="",t={})=>{let i;if(e&&typeof e=="string"&&t.nodeType===s.ELEMENT_NODE&&(i=t.lookupNamespaceURI(e),!i)){const r=t.ownerDocument.documentElement;let o=t;for(;o&&(i=g(e,o),!(i||o===r));)o=o.parentNode}return!!i},C=(e,t)=>{if(e?.nodeType){if(!t?.nodeType)throw new TypeError(`Unexpected type ${p(t)}`)}else throw new TypeError(`Unexpected type ${p(e)}`);let i;if(e.nodeType===s.ELEMENT_NODE&&t.nodeType===s.ELEMENT_NODE){const r=t.compareDocumentPosition(e);i=r&s.DOCUMENT_POSITION_PRECEDING||r&s.DOCUMENT_POSITION_CONTAINS}return!!i},Y=(e=[])=>{const t=[...e];return t.length>1&&t.sort((i,r)=>{let o;return C(r,i)?o=1:o=-1,o}),t},j=(e,t)=>{if(!e?.DOMException)throw new TypeError(`Unexpected global object ${p(e)}`);t?.nodeType!==s.DOCUMENT_NODE&&(t=e.document);const i=(0,h.default)({document:t,DOMException:e.DOMException});return i.configure({LOGERRORS:!1}),i},H=(e,t={})=>{if(!e||typeof e!="string")return!1;if(e.includes("[")){const i=e.lastIndexOf("[");if(e.substring(i).indexOf("]")<0)return!1}if(/[|\\]|::|[^\u0021-\u007F\s]|\[\s*[\w$*=^|~-]+(?:(?:"[\w$*=^|~\s'-]+"|'[\w$*=^|~\s"-]+')?(?:\s+[\w$*=^|~-]+)+|"[^"\]]{1,255}|'[^'\]]{1,255})\s*\]|:(?:is|where)\(\s*\)/.test(e))return!1;if(e.includes(":")){const{complex:i,descend:r}=t;return/:(?:is|not)\(/.test(e)?i?!M.test(e):!P.test(e):r?!1:!v.test(e)}return!0};0&&(module.exports={filterSelector,getDirectionality,getNamespaceURI,getSlottedTextContent,getType,initNwsapi,isContentEditable,isCustomElement,isFocusVisible,isFocusable,isInShadowTree,isNamespaceDeclared,isPreceding,isVisible,resolveContent,sortNodes,traverseNode});
var U=Object.create;var f=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var $=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var A=(e,t)=>{for(var i in t)f(e,i,{get:t[i],enumerable:!0})},E=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of I(t))!k.call(e,n)&&n!==i&&f(e,n,{get:()=>t[n],enumerable:!(r=_(t,n))||r.enumerable});return e};var T=(e,t,i)=>(i=e!=null?U($(e)):{},E(t||!e||!e.__esModule?f(i,"default",{value:e,enumerable:!0}):i,e)),L=e=>E(f({},"__esModule",{value:!0}),e);var q={};A(q,{filterSelector:()=>H,getDirectionality:()=>N,getNamespaceURI:()=>C,getSlottedTextContent:()=>p,getType:()=>c,initNwsapi:()=>j,isContentEditable:()=>y,isCustomElement:()=>G,isFocusVisible:()=>V,isFocusable:()=>Y,isFocusableArea:()=>K,isInShadowTree:()=>O,isNamespaceDeclared:()=>X,isPreceding:()=>D,isVisible:()=>F,resolveContent:()=>P,sortNodes:()=>W,traverseNode:()=>v});module.exports=L(q);var h=T(require("@asamuzakjp/nwsapi"),1),g=T(require("bidi-js"),1),d=T(require("is-potential-custom-element-name"),1),s=require("./constant.js");const R=new RegExp(`:(?!${s.PSEUDO_CLASS}|${s.N_TH}|${s.LOGICAL_COMPLEX})`),S=new RegExp(`:(?!${s.PSEUDO_CLASS}|${s.N_TH}|${s.LOGICAL_COMPOUND})`),M=new RegExp(`:(?!${s.PSEUDO_CLASS}|${s.N_TH})`),c=e=>Object.prototype.toString.call(e).slice(s.TYPE_FROM,s.TYPE_TO),P=e=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${c(e)}`);let t,i;switch(e.nodeType){case s.DOCUMENT_NODE:{t=e,i=e;break}case s.DOCUMENT_FRAGMENT_NODE:{t=e.ownerDocument,i=e;break}case s.ELEMENT_NODE:{t=e.ownerDocument;let n=e;for(;n&&n.parentNode;)n=n.parentNode;i=n;break}default:throw new TypeError(`Unexpected node ${e.nodeName}`)}const r=t.createTreeWalker(i,s.WALKER_FILTER);return[t,i,r]},v=(e,t)=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${c(e)}`);let i;if(t?.currentNode){let r=t.currentNode;if(r===e)return r;if(r.contains(e))for(r=t.nextNode();r;){if(r===e)return r;r=t.nextNode()}else{if(r!==t.root)for(;r&&!(r===t.root||r===e);)r=t.parentNode();if(e.nodeType===s.ELEMENT_NODE)for(;r;){if(r===e)return r;r=t.nextNode()}else i=r}}return i??null},G=(e,t={})=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${c(e)}`);let i;if(e.nodeType===s.ELEMENT_NODE){const{localName:r,ownerDocument:n}=e,{formAssociated:a}=t,l=n.defaultView;let o;const u=e.getAttribute("is");u?o=(0,d.default)(u)&&l.customElements.get(u):o=(0,d.default)(r)&&l.customElements.get(r),o&&(a?i=o.formAssociated:i=!0)}return!!i},O=e=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${c(e)}`);let t;if(e.nodeType===s.ELEMENT_NODE||e.nodeType===s.DOCUMENT_FRAGMENT_NODE){let i=e;for(;i;){const{host:r,mode:n,nodeType:a,parentNode:l}=i;if(r&&n&&a===s.DOCUMENT_FRAGMENT_NODE&&(n==="close"||n==="open")){t=!0;break}i=l}}return!!t},p=e=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${c(e)}`);let t;if(e.localName==="slot"&&O(e)){const i=e.assignedNodes();if(i.length){for(const r of i)if(t=r.textContent.trim(),t)break}else t=e.textContent.trim()}return t??null},N=e=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${c(e)}`);let t;if(e.nodeType===s.ELEMENT_NODE){const{dir:i,localName:r,parentNode:n}=e,{getEmbeddingLevels:a}=(0,g.default)();if(i==="ltr"||i==="rtl")return i;if(i==="auto"){let l;switch(r){case"input":{const o=[...s.KEY_INPUT_BUTTON,...s.KEY_INPUT_TEXT,"hidden"];if(!e.type||o.includes(e.type))l=e.value;else if(["checkbox","color","date","image","number","range","radio","time"].includes(e.type))return"ltr";break}case"slot":{l=p(e);break}case"textarea":{l=e.value;break}default:{const o=[].slice.call(e.childNodes);for(const u of o){const{dir:m,localName:b,nodeType:w,textContent:x}=u;if(w===s.TEXT_NODE?l=x.trim():w===s.ELEMENT_NODE&&!["bdi","script","style","textarea"].includes(b)&&(!m||m!=="ltr"&&m!=="rtl")&&(b==="slot"?l=p(u):l=x.trim()),l)break}}}if(l){const{paragraphs:[{level:o}]}=a(l);return o%2===1?"rtl":"ltr"}if(!t)if(n){const{nodeType:o}=n;if(o===s.ELEMENT_NODE)return N(n);if(o===s.DOCUMENT_NODE||o===s.DOCUMENT_FRAGMENT_NODE)return"ltr"}else return"ltr"}else if(r==="bdi"){const l=e.textContent.trim();if(l){const{paragraphs:[{level:o}]}=a(l);return o%2===1?"rtl":"ltr"}if(!(t||n))return"ltr"}else{if(r==="input"&&e.type==="tel")return"ltr";if(n){if(r==="slot"){const l=p(e);if(l){const{paragraphs:[{level:o}]}=a(l);return o%2===1?"rtl":"ltr"}}if(!t){const{nodeType:l}=n;if(l===s.ELEMENT_NODE)return N(n);if(l===s.DOCUMENT_NODE||l===s.DOCUMENT_FRAGMENT_NODE)return"ltr"}}else return"ltr"}}return t??null},y=e=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${c(e)}`);let t;if(e.nodeType===s.ELEMENT_NODE){if(typeof e.isContentEditable=="boolean")return e.isContentEditable;if(e.ownerDocument.designMode==="on")return!0;if(e.hasAttribute("contenteditable"))switch(e.getAttribute("contenteditable")){case"":case"true":return!0;case"plaintext-only":return!0;case"false":return!1;default:{let r=e.parentNode;for(;r;){if(y(r))return!0;r=r.parentNode}break}}}return!!t},F=e=>{let t;if(e?.nodeType===s.ELEMENT_NODE){const i=e.ownerDocument.defaultView,{display:r,visibility:n}=i.getComputedStyle(e);if(r!=="none"&&n==="visible")return!0}return!!t},V=e=>{let t;if(e?.nodeType===s.ELEMENT_NODE){const{localName:i,type:r}=e;switch(i){case"input":{if(!r||s.KEY_INPUT_EDIT.includes(r))return!0;break}case"textarea":return!0;default:return y(e)}}return!!t},K=e=>{if(e?.nodeType===s.ELEMENT_NODE){if(!e.isConnected)return!1;const t=e.ownerDocument.defaultView;if(e instanceof t.HTMLElement){if(Number.isInteger(parseInt(e.getAttribute("tabindex")))||y(e))return!0;const{localName:i,parentNode:r}=e;switch(i){case"a":return!!(e.href||e.hasAttribute("href"));case"iframe":return!0;case"input":return!(e.disabled||e.hasAttribute("disabled")||e.hidden||e.hasAttribute("hidden"));case"summary":{if(r.localName==="details"){let n=r.firstElementChild;for(;n;){if(n.localName==="summary")return e===n;n=n.nextElementSibling}}return!1}default:return!!(new Set(["button","select","textarea"]).has(i)&&!(e.disabled||e.hasAttribute("disabled")))}}else if(e instanceof t.SVGElement){if(Number.isInteger(parseInt(e.getAttributeNS(null,"tabindex")))){const i=new Set(["clipPath","defs","desc","linearGradient","marker","mask","metadata","pattern","radialGradient","script","style","symbol","title"]),r="http://www.w3.org/2000/svg";let n,a=e;for(;a.namespaceURI===r&&(n=i.has(a.localName),!n);)if(a?.parentNode?.namespaceURI===r)a=a.parentNode;else break;return!n}if(e.localName==="a"&&(e.href||e.hasAttributeNS(null,"href")))return!0}}return!1},Y=e=>{let t;if(e?.nodeType===s.ELEMENT_NODE){const i=e.ownerDocument.defaultView;let r=e;for(t=!0;r;){if(r.disabled||r.hasAttribute("disabled"))return!1;(r.hidden||r.hasAttribute("hidden"))&&(t=!1);const{contentVisibility:n,display:a,visibility:l}=i.getComputedStyle(r);if(a==="none"||l!=="visible"||n==="hidden"&&r!==e?t=!1:t=!0,t&&r?.parentNode?.nodeType===s.ELEMENT_NODE)r=r.parentNode;else break}}return!!t},C=(e,t)=>{if(typeof e!="string")throw new TypeError(`Unexpected type ${c(e)}`);if(!t?.nodeType)throw new TypeError(`Unexpected type ${c(t)}`);let i;if(e&&t.nodeType===s.ELEMENT_NODE){const{attributes:r}=t;for(const n of r){const{name:a,namespaceURI:l,prefix:o,value:u}=n;if(a===`xmlns:${e}`)return u;if(o===e)return l}}return i??null},X=(e="",t={})=>{let i;if(e&&typeof e=="string"&&t.nodeType===s.ELEMENT_NODE&&(i=t.lookupNamespaceURI(e),!i)){const r=t.ownerDocument.documentElement;let n=t;for(;n&&(i=C(e,n),!(i||n===r));)n=n.parentNode}return!!i},D=(e,t)=>{if(e?.nodeType){if(!t?.nodeType)throw new TypeError(`Unexpected type ${c(t)}`)}else throw new TypeError(`Unexpected type ${c(e)}`);let i;if(e.nodeType===s.ELEMENT_NODE&&t.nodeType===s.ELEMENT_NODE){const r=t.compareDocumentPosition(e);i=r&s.DOCUMENT_POSITION_PRECEDING||r&s.DOCUMENT_POSITION_CONTAINS}return!!i},W=(e=[])=>{const t=[...e];return t.length>1&&t.sort((i,r)=>{let n;return D(r,i)?n=1:n=-1,n}),t},j=(e,t)=>{if(!e?.DOMException)throw new TypeError(`Unexpected global object ${c(e)}`);t?.nodeType!==s.DOCUMENT_NODE&&(t=e.document);const i=(0,h.default)({document:t,DOMException:e.DOMException});return i.configure({LOGERRORS:!1}),i},H=(e,t={})=>{if(!e||typeof e!="string")return!1;if(e.includes("[")){const i=e.lastIndexOf("[");if(e.substring(i).indexOf("]")<0)return!1}if(/[|\\]|::|[^\u0021-\u007F\s]|\[\s*[\w$*=^|~-]+(?:(?:"[\w$*=^|~\s'-]+"|'[\w$*=^|~\s"-]+')?(?:\s+[\w$*=^|~-]+)+|"[^"\]]{1,255}|'[^'\]]{1,255})\s*\]|:(?:is|where)\(\s*\)/.test(e))return!1;if(e.includes(":")){const{complex:i,descend:r}=t;return/:(?:is|not)\(/.test(e)?i?!R.test(e):!S.test(e):r?!1:!M.test(e)}return!0};0&&(module.exports={filterSelector,getDirectionality,getNamespaceURI,getSlottedTextContent,getType,initNwsapi,isContentEditable,isCustomElement,isFocusVisible,isFocusable,isFocusableArea,isInShadowTree,isNamespaceDeclared,isPreceding,isVisible,resolveContent,sortNodes,traverseNode});
//# sourceMappingURL=utility.js.map

@@ -40,3 +40,3 @@ {

"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-jsdoc": "^50.2.2",

@@ -67,3 +67,3 @@ "eslint-plugin-regexp": "^2.6.0",

},
"version": "5.4.0"
"version": "6.0.0"
}

@@ -86,11 +86,20 @@ /**

export const COMPLEX_L = `${COMPOUND_B}(?:${COMBO}${COMPOUND_B})*`;
export const KEY_IS_NOT = '(?:is|not)';
export const LOGICAL_COMPLEX =
`${KEY_IS_NOT}\\(\\s*${COMPLEX_L}(?:\\s*,\\s*${COMPLEX_L})*\\s*\\)`;
`(?:is|not)\\(\\s*${COMPLEX_L}(?:\\s*,\\s*${COMPLEX_L})*\\s*\\)`;
export const LOGICAL_COMPOUND =
`${KEY_IS_NOT}\\(\\s*${COMPOUND_A}(?:\\s*,\\s*${COMPOUND_A})*\\s*\\)`;
`(?:is|not)\\(\\s*${COMPOUND_A}(?:\\s*,\\s*${COMPOUND_A})*\\s*\\)`;
/* regexp */
export const REG_LOGICAL = /^(?:has|is|not|where)$/;
export const REG_INPUT_TYPE =
/^(?:date(?:time-local)?|email|month|number|password|search|tel|text|time|url|week)$/;
/* array */
export const KEY_FORM_FOCUS =
Object.freeze(['button', 'input', 'select', 'textarea']);
export const KEY_INPUT_BUTTON = Object.freeze(['button', 'reset', 'submit']);
export const KEY_INPUT_DATE =
Object.freeze(['date', 'datetime-local', 'month', 'time', 'week']);
export const KEY_INPUT_TEXT =
Object.freeze(['email', 'password', 'search', 'tel', 'text', 'url']);
export const KEY_INPUT_EDIT =
Object.freeze([...KEY_INPUT_DATE, ...KEY_INPUT_TEXT, 'number']);
export const KEY_INPUT_LTR = Object.freeze([
'checkbox', 'color', 'date', 'image', 'number', 'range', 'radio', 'time'
]);
export const KEY_LOGICAL = Object.freeze(['has', 'is', 'not', 'where']);

@@ -12,4 +12,4 @@ /**

ATTR_SELECTOR, BIT_01, BIT_02, BIT_04, BIT_08, BIT_16, BIT_32, BIT_FFFF,
CLASS_SELECTOR, DUO, EMPTY, HEX, HYPHEN, ID_SELECTOR, NTH, PS_CLASS_SELECTOR,
PS_ELEMENT_SELECTOR, REG_LOGICAL, SELECTOR, SYNTAX_ERR, TYPE_SELECTOR
CLASS_SELECTOR, DUO, EMPTY, HEX, HYPHEN, ID_SELECTOR, KEY_LOGICAL, NTH,
PS_CLASS_SELECTOR, PS_ELEMENT_SELECTOR, SELECTOR, SYNTAX_ERR, TYPE_SELECTOR
} from './constant.js';

@@ -198,3 +198,3 @@ const REG_LANG_QUOTED = /(:lang\(\s*("[A-Za-z\d\-*]*")\s*\))/;

case PS_CLASS_SELECTOR: {
if (REG_LOGICAL.test(node.name)) {
if (KEY_LOGICAL.includes(node.name)) {
info.set('hasNestedSelector', true);

@@ -229,7 +229,7 @@ info.set('hasLogicalPseudoFunc', true);

if (list) {
if (node.type === PS_CLASS_SELECTOR && REG_LOGICAL.test(node.name)) {
if (node.type === PS_CLASS_SELECTOR &&
KEY_LOGICAL.includes(node.name)) {
const itemList = list.filter(i => {
const { name, type } = i;
const res = type === PS_CLASS_SELECTOR && REG_LOGICAL.test(name);
return res;
return type === PS_CLASS_SELECTOR && KEY_LOGICAL.includes(name);
});

@@ -236,0 +236,0 @@ for (const { children } of itemList) {

@@ -13,5 +13,5 @@ /**

DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINS,
DOCUMENT_POSITION_PRECEDING, ELEMENT_NODE, N_TH, LOGICAL_COMPLEX,
LOGICAL_COMPOUND, PSEUDO_CLASS, REG_INPUT_TYPE, TEXT_NODE, TYPE_FROM,
TYPE_TO, WALKER_FILTER
DOCUMENT_POSITION_PRECEDING, ELEMENT_NODE, KEY_INPUT_BUTTON, KEY_INPUT_EDIT,
KEY_INPUT_TEXT, LOGICAL_COMPLEX, LOGICAL_COMPOUND, N_TH, PSEUDO_CLASS,
TEXT_NODE, TYPE_FROM, TYPE_TO, WALKER_FILTER
} from './constant.js';

@@ -94,3 +94,3 @@ const REG_LOGICAL_COMPLEX =

if (refNode === node) {
current = refNode;
return refNode;
} else if (refNode.contains(node)) {

@@ -100,4 +100,3 @@ refNode = walker.nextNode();

if (refNode === node) {
current = refNode;
break;
return refNode;
}

@@ -118,4 +117,3 @@ refNode = walker.nextNode();

if (refNode === node) {
current = refNode;
break;
return refNode;
}

@@ -183,3 +181,3 @@ refNode = walker.nextNode();

if (host && mode && nodeType === DOCUMENT_FRAGMENT_NODE &&
/^(?:close|open)$/.test(mode)) {
(mode === 'close' || mode === 'open')) {
bool = true;

@@ -234,4 +232,4 @@ break;

const { getEmbeddingLevels } = bidiFactory();
if (/^(?:ltr|rtl)$/.test(nodeDir)) {
res = nodeDir;
if (nodeDir === 'ltr' || nodeDir === 'rtl') {
return nodeDir;
} else if (nodeDir === 'auto') {

@@ -241,6 +239,13 @@ let text;

case 'input': {
if (!node.type || /^(?:button|email|hidden|password|reset|search|submit|tel|text|url)$/.test(node.type)) {
const valueKeys = [...KEY_INPUT_BUTTON, ...KEY_INPUT_TEXT, 'hidden'];
if (!node.type || valueKeys.includes(node.type)) {
text = node.value;
} else if (/^(?:checkbox|color|date|image|number|radio|range|time)$/.test(node.type)) {
res = 'ltr';
} else {
const ltrKeys = [
'checkbox', 'color', 'date', 'image', 'number', 'range', 'radio',
'time'
];
if (ltrKeys.includes(node.type)) {
return 'ltr';
}
}

@@ -267,4 +272,5 @@ break;

} else if (itemNodeType === ELEMENT_NODE) {
if (!/^(?:bdi|script|style|textarea)$/.test(itemLocalName) &&
(!itemDir || !/^(?:ltr|rtl)$/.test(itemDir))) {
const keys = ['bdi', 'script', 'style', 'textarea'];
if (!keys.includes(itemLocalName) &&
(!itemDir || (itemDir !== 'ltr' && itemDir !== 'rtl'))) {
if (itemLocalName === 'slot') {

@@ -286,6 +292,5 @@ text = getSlottedTextContent(item);

if (level % 2 === 1) {
res = 'rtl';
} else {
res = 'ltr';
return 'rtl';
}
return 'ltr';
}

@@ -296,9 +301,9 @@ if (!res) {

if (parentNodeType === ELEMENT_NODE) {
res = getDirectionality(parentNode);
return getDirectionality(parentNode);
} else if (parentNodeType === DOCUMENT_NODE ||
parentNodeType === DOCUMENT_FRAGMENT_NODE) {
res = 'ltr';
return 'ltr';
}
} else {
res = 'ltr';
return 'ltr';
}

@@ -311,12 +316,11 @@ }

if (level % 2 === 1) {
res = 'rtl';
} else {
res = 'ltr';
return 'rtl';
}
return 'ltr';
}
if (!(res || parentNode)) {
res = 'ltr';
return 'ltr';
}
} else if (localName === 'input' && node.type === 'tel') {
res = 'ltr';
return 'ltr';
} else if (parentNode) {

@@ -328,6 +332,5 @@ if (localName === 'slot') {

if (level % 2 === 1) {
res = 'rtl';
} else {
res = 'ltr';
return 'rtl';
}
return 'ltr';
}

@@ -338,10 +341,10 @@ }

if (parentNodeType === ELEMENT_NODE) {
res = getDirectionality(parentNode);
return getDirectionality(parentNode);
} else if (parentNodeType === DOCUMENT_NODE ||
parentNodeType === DOCUMENT_FRAGMENT_NODE) {
res = 'ltr';
return 'ltr';
}
}
} else {
res = 'ltr';
return 'ltr';
}

@@ -365,17 +368,29 @@ }

if (typeof node.isContentEditable === 'boolean') {
res = node.isContentEditable;
return node.isContentEditable;
} else if (node.ownerDocument.designMode === 'on') {
res = true;
return true;
} else if (node.hasAttribute('contenteditable')) {
const attr = node.getAttribute('contenteditable');
if (attr === '' || /^(?:plaintext-only|true)$/.test(attr)) {
res = true;
} else if (attr === 'inherit') {
let parent = node.parentNode;
while (parent) {
if (isContentEditable(parent)) {
res = true;
break;
switch (attr) {
case '':
case 'true': {
return true;
}
case 'plaintext-only': {
// FIXME: the element's raw text is editable,
// but rich text formatting is disabled
return true;
}
case 'false': {
return false;
}
default: {
let parent = node.parentNode;
while (parent) {
if (isContentEditable(parent)) {
return true;
}
parent = parent.parentNode;
}
parent = parent.parentNode;
break;
}

@@ -399,3 +414,3 @@ }

if (display !== 'none' && visibility === 'visible') {
res = true;
return true;
}

@@ -417,4 +432,4 @@ }

case 'input': {
if (!type || REG_INPUT_TYPE.test(type)) {
res = true;
if (!type || KEY_INPUT_EDIT.includes(type)) {
return true;
}

@@ -424,7 +439,6 @@ break;

case 'textarea': {
res = true;
break;
return true;
}
default: {
res = isContentEditable(node);
return isContentEditable(node);
}

@@ -437,4 +451,100 @@ }

/**
* is focusable area
* @param {object} node - Element node
* @returns {boolean} - result
*/
export const isFocusableArea = node => {
if (node?.nodeType === ELEMENT_NODE) {
if (!node.isConnected) {
return false;
}
const window = node.ownerDocument.defaultView;
if (node instanceof window.HTMLElement) {
if (Number.isInteger(parseInt(node.getAttribute('tabindex')))) {
return true;
}
if (isContentEditable(node)) {
return true;
}
const { localName, parentNode } = node;
switch (localName) {
case 'a': {
if (node.href || node.hasAttribute('href')) {
return true;
}
return false;
}
case 'iframe': {
return true;
}
case 'input': {
if (node.disabled || node.hasAttribute('disabled') ||
node.hidden || node.hasAttribute('hidden')) {
return false;
}
return true;
}
case 'summary': {
if (parentNode.localName === 'details') {
let child = parentNode.firstElementChild;
while (child) {
if (child.localName === 'summary') {
return node === child;
}
child = child.nextElementSibling;
}
}
return false;
}
default: {
const keys = new Set(['button', 'select', 'textarea']);
if (keys.has(localName) &&
!(node.disabled || node.hasAttribute('disabled'))) {
return true;
}
return false;
}
}
} else if (node instanceof window.SVGElement) {
if (Number.isInteger(parseInt(node.getAttributeNS(null, 'tabindex')))) {
const keys = new Set([
'clipPath', 'defs', 'desc', 'linearGradient', 'marker', 'mask',
'metadata', 'pattern', 'radialGradient', 'script', 'style', 'symbol',
'title'
]);
const ns = 'http://www.w3.org/2000/svg';
let bool;
let refNode = node;
while (refNode.namespaceURI === ns) {
bool = keys.has(refNode.localName);
if (bool) {
break;
}
if (refNode?.parentNode?.namespaceURI === ns) {
refNode = refNode.parentNode;
} else {
break;
}
}
if (bool) {
return false;
}
return true;
}
if (node.localName === 'a' &&
(node.href || node.hasAttributeNS(null, 'href'))) {
return true;
}
}
}
return false;
};
/**
* is focusable
* NOTE: workaround for jsdom issue: https://github.com/jsdom/jsdom/issues/3464
* NOTE: not applied, need fix in jsdom itself
* @see https://github.com/whatwg/html/pull/8392
* @see https://phabricator.services.mozilla.com/D156219
* @see https://github.com/jsdom/jsdom/issues/3029
* @see https://github.com/jsdom/jsdom/issues/3464
* @param {object} node - Element node

@@ -493,8 +603,7 @@ * @returns {boolean} - result

if (name === `xmlns:${ns}`) {
res = value;
break;
} else if (prefix === ns) {
res = namespaceURI;
break;
return value;
}
if (prefix === ns) {
return namespaceURI;
}
}

@@ -501,0 +610,0 @@ }

@@ -62,6 +62,10 @@ export const ATTR_SELECTOR: "AttributeSelector";

export const COMPLEX_L: "(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+|: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*\\))+)(?:\\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>~+]\\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 KEY_IS_NOT: "(?:is|not)";
export const LOGICAL_COMPLEX: "(?:is|not)\\(\\s*(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+|: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*\\))+)(?:\\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>~+]\\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*\\))+))*(?:\\s*,\\s*(?:\\*|[A-Za-z][\\w-]*|(?:\\*|[A-Za-z][\\w-]*)?(?:\\[[^|\\]]+\\]|[#.:][\\w-]+|: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*\\))+)(?:\\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>~+]\\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*\\))+))*)*\\s*\\)";
export const LOGICAL_COMPOUND: "(?:is|not)\\(\\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*,\\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*\\)";
export const REG_LOGICAL: RegExp;
export const REG_INPUT_TYPE: RegExp;
export const KEY_FORM_FOCUS: readonly string[];
export const KEY_INPUT_BUTTON: readonly string[];
export const KEY_INPUT_DATE: readonly string[];
export const KEY_INPUT_TEXT: readonly string[];
export const KEY_INPUT_EDIT: readonly string[];
export const KEY_INPUT_LTR: readonly string[];
export const KEY_LOGICAL: readonly string[];

@@ -11,2 +11,3 @@ export function getType(o: any): string;

export function isFocusVisible(node: object): boolean;
export function isFocusableArea(node: object): boolean;
export function isFocusable(node: object): boolean;

@@ -13,0 +14,0 @@ export function getNamespaceURI(ns: string, node: any[]): string | null;

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 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