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

@asamuzakjp/dom-selector

Package Overview
Dependencies
Maintainers
1
Versions
191
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@asamuzakjp/dom-selector - npm Package Compare versions

Comparing version 5.2.0 to 5.2.1

2

dist/cjs/js/constant.js

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

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

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

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

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

var C=Object.create;var c=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var R=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var M=(e,t)=>{for(var r in t)c(e,r,{get:t[r],enumerable:!0})},w=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of _(t))!I.call(e,s)&&s!==r&&c(e,s,{get:()=>t[s],enumerable:!(i=U(t,s))||i.enumerable});return e};var y=(e,t,r)=>(r=e!=null?C(R(e)):{},w(t||!e||!e.__esModule?c(r,"default",{value:e,enumerable:!0}):r,e)),k=e=>w(c({},"__esModule",{value:!0}),e);var W={};M(W,{filterSelector:()=>A,getDirectionality:()=>m,getNamespaceURI:()=>D,getSlottedTextContent:()=>u,getType:()=>p,initNwsapi:()=>G,isContentEditable:()=>O,isCustomElement:()=>S,isInShadowTree:()=>g,isNamespaceDeclared:()=>v,isPreceding:()=>$,resolveContent:()=>L,sortNodes:()=>F,traverseNode:()=>P});module.exports=k(W);var d=y(require("@asamuzakjp/nwsapi"),1),h=y(require("bidi-js"),1),T=y(require("is-potential-custom-element-name"),1),o=require("./constant.js");const p=e=>Object.prototype.toString.call(e).slice(o.TYPE_FROM,o.TYPE_TO),L=e=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${p(e)}`);let t,r;switch(e.nodeType){case o.DOCUMENT_NODE:{t=e,r=e;break}case o.DOCUMENT_FRAGMENT_NODE:{t=e.ownerDocument,r=e;break}case o.ELEMENT_NODE:{t=e.ownerDocument;let s=e;for(;s&&s.parentNode;)s=s.parentNode;r=s;break}default:throw new TypeError(`Unexpected node ${e.nodeName}`)}const i=t.createTreeWalker(r,o.WALKER_FILTER);return[t,r,i]},P=(e,t)=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${p(e)}`);let r;if(t?.currentNode){let i=t.currentNode;if(i===e)r=i;else if(i.contains(e))for(i=t.nextNode();i;){if(i===e){r=i;break}i=t.nextNode()}else{if(i!==t.root)for(;i&&!(i===t.root||i===e);)i=t.parentNode();if(e.nodeType===o.ELEMENT_NODE)for(;i;){if(i===e){r=i;break}i=t.nextNode()}else r=i}}return r??null},S=(e,t={})=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${p(e)}`);let r;if(e.nodeType===o.ELEMENT_NODE){const{localName:i,ownerDocument:s}=e,{formAssociated:a}=t,n=s.defaultView;let l;const f=e.getAttribute("is");f?l=(0,T.default)(f)&&n.customElements.get(f):l=(0,T.default)(i)&&n.customElements.get(i),l&&(a?r=l.formAssociated:r=!0)}return!!r},g=e=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${p(e)}`);let t;if(e.nodeType===o.ELEMENT_NODE||e.nodeType===o.DOCUMENT_FRAGMENT_NODE){let r=e;for(;r;){const{host:i,mode:s,nodeType:a,parentNode:n}=r;if(i&&s&&a===o.DOCUMENT_FRAGMENT_NODE&&o.REG_SHADOW_MODE.test(s)){t=!0;break}r=n}}return!!t},u=e=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${p(e)}`);let t;if(e.localName==="slot"&&g(e)){const r=e.assignedNodes();if(r.length){for(const i of r)if(t=i.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===o.ELEMENT_NODE){const{dir:r,localName:i,parentNode:s}=e,{getEmbeddingLevels:a}=(0,h.default)();if(o.REG_DIR.test(r))t=r;else if(r==="auto"){let n;switch(i){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 f of l){const{dir:E,localName:x,nodeType:N,textContent:b}=f;if(N===o.TEXT_NODE?n=b.trim():N===o.ELEMENT_NODE&&!/^(?:bdi|script|style|textarea)$/.test(x)&&(!E||!o.REG_DIR.test(E))&&(x==="slot"?n=u(f):n=b.trim()),n)break}}}if(n){const{paragraphs:[{level:l}]}=a(n);l%2===1?t="rtl":t="ltr"}if(!t)if(s){const{nodeType:l}=s;l===o.ELEMENT_NODE?t=m(s):(l===o.DOCUMENT_NODE||l===o.DOCUMENT_FRAGMENT_NODE)&&(t="ltr")}else t="ltr"}else if(i==="bdi"){const n=e.textContent.trim();if(n){const{paragraphs:[{level:l}]}=a(n);l%2===1?t="rtl":t="ltr"}t||s||(t="ltr")}else if(i==="input"&&e.type==="tel")t="ltr";else if(s){if(i==="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}=s;n===o.ELEMENT_NODE?t=m(s):(n===o.DOCUMENT_NODE||n===o.DOCUMENT_FRAGMENT_NODE)&&(t="ltr")}}else t="ltr"}return t??null},O=e=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${p(e)}`);let t;if(e.nodeType===o.ELEMENT_NODE){if(typeof e.isContentEditable=="boolean")t=e.isContentEditable;else if(e.ownerDocument.designMode==="on")t=!0;else if(e.hasAttribute("contenteditable")){const r=e.getAttribute("contenteditable");if(r===""||/^(?:plaintext-only|true)$/.test(r))t=!0;else if(r==="inherit"){let i=e.parentNode;for(;i;){if(O(i)){t=!0;break}i=i.parentNode}}}}return!!t},D=(e,t)=>{if(typeof e!="string")throw new TypeError(`Unexpected type ${p(e)}`);if(!t?.nodeType)throw new TypeError(`Unexpected type ${p(t)}`);let r;if(e&&t.nodeType===o.ELEMENT_NODE){const{attributes:i}=t;for(const s of i){const{name:a,namespaceURI:n,prefix:l,value:f}=s;if(a===`xmlns:${e}`){r=f;break}else if(l===e){r=n;break}}}return r??null},v=(e="",t={})=>{let r;if(e&&typeof e=="string"&&t.nodeType===o.ELEMENT_NODE&&(r=t.lookupNamespaceURI(e),!r)){const i=t.ownerDocument.documentElement;let s=t;for(;s&&(r=D(e,s),!(r||s===i));)s=s.parentNode}return!!r},$=(e,t)=>{if(e?.nodeType){if(!t?.nodeType)throw new TypeError(`Unexpected type ${p(t)}`)}else throw new TypeError(`Unexpected type ${p(e)}`);let r;if(e.nodeType===o.ELEMENT_NODE&&t.nodeType===o.ELEMENT_NODE){const i=t.compareDocumentPosition(e);r=i&o.DOCUMENT_POSITION_PRECEDING||i&o.DOCUMENT_POSITION_CONTAINS}return!!r},F=(e=[])=>{const t=[...e];return t.length>1&&t.sort((r,i)=>{let s;return $(i,r)?s=1:s=-1,s}),t},G=(e,t)=>{if(!e?.DOMException)throw new TypeError(`Unexpected global object ${p(e)}`);t?.nodeType!==o.DOCUMENT_NODE&&(t=e.document);const r=(0,d.default)({document:t,DOMException:e.DOMException});return r.configure({LOGERRORS:!1}),r},A=(e,t={})=>{if(!e||typeof e!="string")return!1;if(e.includes("[")){const r=e.lastIndexOf("[");if(e.substring(r).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(":")){let r;if(/:(?:is|not)\(/.test(e)){const{complex:i}=t;i?r=o.REG_FILTER_COMPLEX:r=o.REG_FILTER_COMPOUND}else r=o.REG_FILTER_SIMPLE;if(r.test(e))return!1}return!0};0&&(module.exports={filterSelector,getDirectionality,getNamespaceURI,getSlottedTextContent,getType,initNwsapi,isContentEditable,isCustomElement,isInShadowTree,isNamespaceDeclared,isPreceding,resolveContent,sortNodes,traverseNode});
var $=Object.create;var c=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var R=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var k=(e,t)=>{for(var r in t)c(e,r,{get:t[r],enumerable:!0})},w=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of U(t))!I.call(e,o)&&o!==r&&c(e,o,{get:()=>t[o],enumerable:!(i=C(t,o))||i.enumerable});return e};var y=(e,t,r)=>(r=e!=null?$(R(e)):{},w(t||!e||!e.__esModule?c(r,"default",{value:e,enumerable:!0}):r,e)),M=e=>w(c({},"__esModule",{value:!0}),e);var Y={};k(Y,{filterSelector:()=>W,getDirectionality:()=>m,getNamespaceURI:()=>D,getSlottedTextContent:()=>u,getType:()=>p,initNwsapi:()=>V,isContentEditable:()=>E,isCustomElement:()=>S,isFocusVisible:()=>v,isFocusable:()=>F,isInShadowTree:()=>O,isNamespaceDeclared:()=>G,isPreceding:()=>_,resolveContent:()=>P,sortNodes:()=>A,traverseNode:()=>L});module.exports=M(Y);var h=y(require("@asamuzakjp/nwsapi"),1),g=y(require("bidi-js"),1),T=y(require("is-potential-custom-element-name"),1),s=require("./constant.js");const p=e=>Object.prototype.toString.call(e).slice(s.TYPE_FROM,s.TYPE_TO),P=e=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${p(e)}`);let t,r;switch(e.nodeType){case s.DOCUMENT_NODE:{t=e,r=e;break}case s.DOCUMENT_FRAGMENT_NODE:{t=e.ownerDocument,r=e;break}case s.ELEMENT_NODE:{t=e.ownerDocument;let o=e;for(;o&&o.parentNode;)o=o.parentNode;r=o;break}default:throw new TypeError(`Unexpected node ${e.nodeName}`)}const i=t.createTreeWalker(r,s.WALKER_FILTER);return[t,r,i]},L=(e,t)=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${p(e)}`);let r;if(t?.currentNode){let i=t.currentNode;if(i===e)r=i;else if(i.contains(e))for(i=t.nextNode();i;){if(i===e){r=i;break}i=t.nextNode()}else{if(i!==t.root)for(;i&&!(i===t.root||i===e);)i=t.parentNode();if(e.nodeType===s.ELEMENT_NODE)for(;i;){if(i===e){r=i;break}i=t.nextNode()}else r=i}}return r??null},S=(e,t={})=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${p(e)}`);let r;if(e.nodeType===s.ELEMENT_NODE){const{localName:i,ownerDocument:o}=e,{formAssociated:a}=t,n=o.defaultView;let l;const f=e.getAttribute("is");f?l=(0,T.default)(f)&&n.customElements.get(f):l=(0,T.default)(i)&&n.customElements.get(i),l&&(a?r=l.formAssociated:r=!0)}return!!r},O=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 r=e;for(;r;){const{host:i,mode:o,nodeType:a,parentNode:n}=r;if(i&&o&&a===s.DOCUMENT_FRAGMENT_NODE&&s.REG_SHADOW_MODE.test(o)){t=!0;break}r=n}}return!!t},u=e=>{if(!e?.nodeType)throw new TypeError(`Unexpected type ${p(e)}`);let t;if(e.localName==="slot"&&O(e)){const r=e.assignedNodes();if(r.length){for(const i of r)if(t=i.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:r,localName:i,parentNode:o}=e,{getEmbeddingLevels:a}=(0,g.default)();if(s.REG_DIR.test(r))t=r;else if(r==="auto"){let n;switch(i){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 f of l){const{dir:d,localName:x,nodeType:N,textContent:b}=f;if(N===s.TEXT_NODE?n=b.trim():N===s.ELEMENT_NODE&&!/^(?:bdi|script|style|textarea)$/.test(x)&&(!d||!s.REG_DIR.test(d))&&(x==="slot"?n=u(f):n=b.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(i==="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(i==="input"&&e.type==="tel")t="ltr";else if(o){if(i==="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},E=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 r=e.getAttribute("contenteditable");if(r===""||/^(?:plaintext-only|true)$/.test(r))t=!0;else if(r==="inherit"){let i=e.parentNode;for(;i;){if(E(i)){t=!0;break}i=i.parentNode}}}}return!!t},v=e=>{let t;if(e?.nodeType===s.ELEMENT_NODE){const{localName:r,type:i}=e;switch(r){case"input":{(!i||s.REG_TYPE_INPUT.test(i))&&(t=!0);break}case"textarea":{t=!0;break}default:t=E(e)}}return!!t},F=e=>{let t;if(e?.nodeType===s.ELEMENT_NODE){const r=e.ownerDocument.defaultView;let i=e;for(t=!0;i;){if(i.disabled||i.hasAttribute("disabled"))return!1;(i.hidden||i.hasAttribute("hidden"))&&(t=!1);const{contentVisibility:o,display:a,visibility:n}=r.getComputedStyle(i);if(a==="none"||/^(?:collapse|hidden)$/.test(n)||o==="hidden"?t=!1:t=!0,t&&i?.parentNode?.nodeType===s.ELEMENT_NODE)i=i.parentNode;else break}}return!!t},D=(e,t)=>{if(typeof e!="string")throw new TypeError(`Unexpected type ${p(e)}`);if(!t?.nodeType)throw new TypeError(`Unexpected type ${p(t)}`);let r;if(e&&t.nodeType===s.ELEMENT_NODE){const{attributes:i}=t;for(const o of i){const{name:a,namespaceURI:n,prefix:l,value:f}=o;if(a===`xmlns:${e}`){r=f;break}else if(l===e){r=n;break}}}return r??null},G=(e="",t={})=>{let r;if(e&&typeof e=="string"&&t.nodeType===s.ELEMENT_NODE&&(r=t.lookupNamespaceURI(e),!r)){const i=t.ownerDocument.documentElement;let o=t;for(;o&&(r=D(e,o),!(r||o===i));)o=o.parentNode}return!!r},_=(e,t)=>{if(e?.nodeType){if(!t?.nodeType)throw new TypeError(`Unexpected type ${p(t)}`)}else throw new TypeError(`Unexpected type ${p(e)}`);let r;if(e.nodeType===s.ELEMENT_NODE&&t.nodeType===s.ELEMENT_NODE){const i=t.compareDocumentPosition(e);r=i&s.DOCUMENT_POSITION_PRECEDING||i&s.DOCUMENT_POSITION_CONTAINS}return!!r},A=(e=[])=>{const t=[...e];return t.length>1&&t.sort((r,i)=>{let o;return _(i,r)?o=1:o=-1,o}),t},V=(e,t)=>{if(!e?.DOMException)throw new TypeError(`Unexpected global object ${p(e)}`);t?.nodeType!==s.DOCUMENT_NODE&&(t=e.document);const r=(0,h.default)({document:t,DOMException:e.DOMException});return r.configure({LOGERRORS:!1}),r},W=(e,t={})=>{if(!e||typeof e!="string")return!1;if(e.includes("[")){const r=e.lastIndexOf("[");if(e.substring(r).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(":")){let r;if(/:(?:is|not)\(/.test(e)){const{complex:i}=t;i?r=s.REG_FILTER_COMPLEX:r=s.REG_FILTER_COMPOUND}else r=s.REG_FILTER_SIMPLE;if(r.test(e))return!1}return!0};0&&(module.exports={filterSelector,getDirectionality,getNamespaceURI,getSlottedTextContent,getType,initNwsapi,isContentEditable,isCustomElement,isFocusVisible,isFocusable,isInShadowTree,isNamespaceDeclared,isPreceding,resolveContent,sortNodes,traverseNode});
//# sourceMappingURL=utility.js.map

@@ -63,3 +63,3 @@ {

},
"version": "5.2.0"
"version": "5.2.1"
}

@@ -410,14 +410,18 @@ /**

while (refNode) {
if (refNode.disabled || refNode.hasAttribute('disabled') ||
refNode.hidden || refNode.hasAttribute('hidden')) {
if (refNode.disabled || refNode.hasAttribute('disabled')) {
return false;
}
if (refNode.hidden || refNode.hasAttribute('hidden')) {
res = false;
break;
}
const {
contentVisibility, display, visibility
} = window.getComputedStyle(refNode);
if (display === 'none' || /^(?:collapse|hidden)$/.test(visibility) ||
contentVisibility === 'hidden') {
res = false;
} else {
const { display, visibility } = window.getComputedStyle(refNode);
res = !(display === 'none' || visibility === 'hidden');
if (!res) {
break;
}
res = true;
}
if (refNode.parentNode && refNode.parentNode.nodeType === ELEMENT_NODE) {
if (res && refNode?.parentNode?.nodeType === ELEMENT_NODE) {
refNode = refNode.parentNode;

@@ -424,0 +428,0 @@ } else {

@@ -90,3 +90,3 @@ export const AN_PLUS_B: "AnPlusB";

export const REG_TYPE_CHECK: RegExp;
export const REG_TYPE_DATE: RegExp;
export const REG_TYPE_INPUT: RegExp;
export const REG_TYPE_RANGE: RegExp;

@@ -93,0 +93,0 @@ export const REG_TYPE_RESET: RegExp;

@@ -9,2 +9,3 @@ export class Finder {

}): object;
private _registerEventListeners;
private _setEvent;

@@ -11,0 +12,0 @@ private _correspond;

@@ -9,2 +9,4 @@ export function getType(o: any): string;

export function isContentEditable(node: object): boolean;
export function isFocusVisible(node: object): boolean;
export function isFocusable(node: object): boolean;
export function getNamespaceURI(ns: string, node: any[]): string | null;

@@ -11,0 +13,0 @@ export function isNamespaceDeclared(ns?: string, node?: object): boolean;

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

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