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 3.0.3 to 3.0.4

2

dist/cjs/js/finder.js

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

var j=Object.create;var U=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var B=Object.getPrototypeOf,G=Object.prototype.hasOwnProperty;var q=(T,a)=>{for(var e in a)U(T,e,{get:a[e],enumerable:!0})},I=(T,a,e,c)=>{if(a&&typeof a=="object"||typeof a=="function")for(let i of H(a))!G.call(T,i)&&i!==e&&U(T,i,{get:()=>a[i],enumerable:!(c=F(a,i))||c.enumerable});return T};var V=(T,a,e)=>(e=T!=null?j(B(T)):{},I(a||!T||!T.__esModule?U(e,"default",{value:T,enumerable:!0}):e,T)),X=T=>I(U({},"__esModule",{value:!0}),T);var K={};q(K,{Finder:()=>Y});module.exports=X(K);var z=V(require("is-potential-custom-element-name"),1),x=require("./dom-util.js"),R=require("./matcher.js"),v=require("./parser.js"),h=require("./constant.js");const C="next",O="prev",L="all",$="first",M="lineal",P="self",W=h.SHOW_DOCUMENT|h.SHOW_DOCUMENT_FRAGMENT|h.SHOW_ELEMENT;class Y{#a;#l;#t;#r;#e;#n;#b;#c;#s;#h;#o;#d;#i;#f;constructor(){this.#l=new WeakMap}_onError(a){if(!this.#b)if(a instanceof DOMException||this.#f&&a instanceof this.#f.DOMException)if(a.name===h.NOT_SUPPORTED_ERR)this.#i&&console.warn(a.message);else throw this.#f?new this.#f.DOMException(a.message,a.name):a;else throw a}_setup(a,e,c={}){const{noexcept:i,warn:t}=c;return this.#b=!!i,this.#i=!!t,this.#e=e,[this.#f,this.#t,this.#s]=(0,x.prepareDOMObjects)(e),this.#h=(0,x.isInShadowTree)(e),[this.#a,this.#n]=this._correspond(a),this.#c=new WeakMap,e}_correspond(a){const e=[];let c,i=this.#t&&this.#l.get(this.#t);if(i&&i.has(`${a}`)&&(c=i.get(a)),c){const t=c.length;for(let n=0;n<t;n++)c[n].dir=null,c[n].filtered=!1,c[n].find=!1,e[n]=[]}else{let t;try{t=(0,v.parseSelector)(a)}catch(f){this._onError(f)}const n=(0,v.walkAST)(t);c=[];let o=0;for(const[...f]of n){const l=[];let s=f.shift();if(s&&s.type!==h.COMBINATOR){const r=new Set;for(;s;){if(s.type===h.COMBINATOR){const[u]=f;if(u.type===h.COMBINATOR){const b=`Invalid selector ${a}`;throw new DOMException(b,h.SYNTAX_ERR)}l.push({combo:s,leaves:(0,v.sortAST)(r)}),r.clear()}else if(s){let{name:u}=s;u&&(Object.prototype.hasOwnProperty.call(u,"name")?(u=(0,v.unescapeSelector)(u.name),/[|:]/.test(u)&&(s.namespace=!0)):typeof u=="string"&&(u=(0,v.unescapeSelector)(u),/[|:]/.test(u)&&(s.namespace=!0))),r.add(s)}if(f.length)s=f.shift();else{l.push({combo:null,leaves:(0,v.sortAST)(r)}),r.clear();break}}}c.push({branch:l,dir:null,filtered:!1,find:!1}),e[o]=[],o++}this.#t&&(i||(i=new Map),i.set(`${a}`,c),this.#l.set(this.#t,i))}return[c,e]}_prepareTreeWalkers(a){return this.#d=this.#t.createTreeWalker(this.#s,W),this.#r=this.#t.createTreeWalker(a,W),this.#o=!1,[this.#d,this.#r]}_traverse(a={},e=this.#d){let c,i=e.currentNode;if(a.nodeType===h.ELEMENT_NODE&&i===a)c=i;else{if(i!==e.root)for(;i&&!(i===e.root||a.nodeType===h.ELEMENT_NODE&&i===a);)i=e.parentNode();if(a.nodeType===h.ELEMENT_NODE)for(;i;){if(i===a){c=i;break}i=e.nextNode()}else c=i}return c??null}_collectNthChild(a,e,c){const{a:i,b:t,reverse:n,selector:o}=a,{parentNode:f}=e;let l=new Set,s;if(o&&(this.#l.has(o)?s=this.#l.get(o):(s=(0,v.walkAST)(o),this.#l.set(o,s))),f){const r=this.#t.createTreeWalker(f,W);let u=0,b=r.firstChild();for(;b;)u++,b=r.nextSibling();b=this._traverse(f,r);const k=new Set;if(s)for(b=this._traverse(f,r),b=r.firstChild();b;){let p;for(const g of s)if(p=this._matchLeaves(g,b,c),!p)break;p&&k.add(b),b=r.nextSibling()}if(i===0){if(t>0&&t<=u){if(k.size){let p=0;for(b=this._traverse(f,r),n?b=r.lastChild():b=r.firstChild();b;){if(k.has(b)){if(p===t-1){l.add(b);break}p++}n?b=r.previousSibling():b=r.nextSibling()}}else if(!o){let p=0;for(b=this._traverse(f,r),n?b=r.lastChild():b=r.firstChild();b;){if(p===t-1){l.add(b);break}n?b=r.previousSibling():b=r.nextSibling(),p++}}}}else{let p=t-1;if(i>0)for(;p<0;)p+=i;if(p>=0&&p<u){let g=0,N=i>0?0:t-1;for(b=this._traverse(f,r),n?b=r.lastChild():b=r.firstChild();b&&(b&&p>=0&&p<u);)k.size?k.has(b)&&(N===p&&(l.add(b),p+=i),i>0?N++:N--):g===p&&(o||l.add(b),p+=i),n?b=r.previousSibling():b=r.nextSibling(),g++}}if(n&&l.size>1){const p=[...l];l=new Set(p.reverse())}}else if(e===this.#s&&i+t===1)if(s){let r;for(const u of s)if(r=this._matchLeaves(u,e,c),r)break;r&&l.add(e)}else l.add(e);return l}_collectNthOfType(a,e){const{a:c,b:i,reverse:t}=a,{localName:n,parentNode:o,prefix:f}=e;let l=new Set;if(o){const s=this.#t.createTreeWalker(o,W);let r=0,u=s.firstChild();for(;u;)r++,u=s.nextSibling();if(c===0){if(i>0&&i<=r){let b=0;for(u=this._traverse(o,s),t?u=s.lastChild():u=s.firstChild();u;){const{localName:k,prefix:p}=u;if(k===n&&p===f){if(b===i-1){l.add(u);break}b++}t?u=s.previousSibling():u=s.nextSibling()}}}else{let b=i-1;if(c>0)for(;b<0;)b+=c;if(b>=0&&b<r){let k=c>0?0:i-1;for(u=this._traverse(o,s),t?u=s.lastChild():u=s.firstChild();u;){const{localName:p,prefix:g}=u;if(p===n&&g===f){if(k===b&&(l.add(u),b+=c),b<0||b>=r)break;c>0?k++:k--}t?u=s.previousSibling():u=s.nextSibling()}}}if(t&&l.size>1){const b=[...l];l=new Set(b.reverse())}}else e===this.#s&&c+i===1&&l.add(e);return l}_matchAnPlusB(a,e,c,i){const{nth:{a:t,b:n,name:o},selector:f}=a,l=(0,v.unescapeSelector)(o),s=new Map;l?(l==="even"?(s.set("a",2),s.set("b",0)):l==="odd"&&(s.set("a",2),s.set("b",1)),c.indexOf("last")>-1&&s.set("reverse",!0)):(typeof t=="string"&&/-?\d+/.test(t)?s.set("a",t*1):s.set("a",0),typeof n=="string"&&/-?\d+/.test(n)?s.set("b",n*1):s.set("b",0),c.indexOf("last")>-1&&s.set("reverse",!0));let r=new Set;if(s.has("a")&&s.has("b")){if(/^nth-(?:last-)?child$/.test(c)){f&&s.set("selector",f);const u=Object.fromEntries(s),b=this._collectNthChild(u,e,i);b.size&&(r=b)}else if(/^nth-(?:last-)?of-type$/.test(c)){const u=Object.fromEntries(s),b=this._collectNthOfType(u,e);b.size&&(r=b)}}return r}_matchDirectionPseudoClass(a,e){const c=(0,v.unescapeSelector)(a.name),i=(0,x.getDirectionality)(e);let t;return c===i&&(t=e),t??null}_matchLanguagePseudoClass(a,e){const c=(0,v.unescapeSelector)(a.name);let i;if(c==="*")if(e.hasAttribute("lang"))e.getAttribute("lang")&&(i=e);else{let t=e.parentNode;for(;t&&t.nodeType===h.ELEMENT_NODE;){if(t.hasAttribute("lang")){t.getAttribute("lang")&&(i=e);break}t=t.parentNode}}else if(c){const t=`(?:-${h.ALPHA_NUM})*`;if(new RegExp(`^(?:\\*-)?${h.ALPHA_NUM}${t}$`,"i").test(c)){let o;if(c.indexOf("-")>-1){const[f,l,...s]=c.split("-");let r;f==="*"?r=`${h.ALPHA_NUM}${t}`:r=`${f}${t}`;const u=`-${l}${t}`,b=s.length;let k="";if(b)for(let p=0;p<b;p++)k+=`-${s[p]}${t}`;o=new RegExp(`^${r}${u}${k}$`,"i")}else o=new RegExp(`^${c}${t}$`,"i");if(e.hasAttribute("lang"))o.test(e.getAttribute("lang"))&&(i=e);else{let f=e.parentNode;for(;f&&f.nodeType===h.ELEMENT_NODE;){if(f.hasAttribute("lang")){const l=f.getAttribute("lang");o.test(l)&&(i=e);break}f=f.parentNode}}}}return i??null}_matchHasPseudoFunc(a,e,c={}){let i;if(Array.isArray(a)&&a.length){const[t]=a,{type:n}=t;let o;n===h.COMBINATOR?o=a.shift():o={name:" ",type:h.COMBINATOR};const f=[];for(;a.length;){const[r]=a,{type:u}=r;if(u===h.COMBINATOR)break;f.push(a.shift())}const l={combo:o,leaves:f};c.dir=C;const s=this._matchCombinator(l,e,c);if(s.size)if(a.length){for(const r of s)if(i=this._matchHasPseudoFunc(Object.assign([],a),r,c),i)break}else i=!0}return!!i}_matchLogicalPseudoFunc(a,e,c={}){const{astName:i="",branches:t=[],selector:n="",twigBranches:o=[]}=a;let f;if(i==="has")if(n.includes(":has("))f=null;else{let l;for(const s of t)if(l=this._matchHasPseudoFunc(Object.assign([],s),e,c),l)break;l&&(f=e)}else{const l=/^(?:is|where)$/.test(i);c.forgive=l;const s=o.length;let r;for(let u=0;u<s;u++){const b=o[u],k=b.length-1,{leaves:p}=b[k];if(r=this._matchLeaves(p,e,c),r&&k>0){let g=new Set([e]);for(let N=k-1;N>=0;N--){const S=b[N],d=[];c.dir=O;for(const m of g){const w=this._matchCombinator(S,m,c);w.size&&d.push(...w)}if(d.length)N===0?r=!0:g=new Set(d);else{r=!1;break}}}if(r)break}i==="not"?r||(f=e):r&&(f=e)}return f??null}_matchPseudoClassSelector(a,e,c={}){const{children:i}=a,{localName:t,parentNode:n}=e,{forgive:o,warn:f=this.#i}=c,l=(0,v.unescapeSelector)(a.name);let s=new Set;if(h.REG_LOGICAL_PSEUDO.test(l)){let r;if(this.#l.has(a))r=this.#l.get(a);else{const b=(0,v.walkAST)(a),k=[],p=[];for(const[...g]of b){for(const m of g){const w=(0,v.generateCSS)(m);k.push(w)}const N=[],S=new Set;let d=g.shift();for(;d;)if(d.type===h.COMBINATOR?(N.push({combo:d,leaves:[...S]}),S.clear()):d&&S.add(d),g.length)d=g.shift();else{N.push({combo:null,leaves:[...S]}),S.clear();break}p.push(N)}r={astName:l,branches:b,twigBranches:p,selector:k.join(",")},this.#l.set(a,r)}const u=this._matchLogicalPseudoFunc(r,e,c);u&&s.add(u)}else if(Array.isArray(i)){const[r]=i;if(/^nth-(?:last-)?(?:child|of-type)$/.test(l)){const u=this._matchAnPlusB(r,e,l,c);u.size&&(s=u)}else if(l==="dir"){const u=this._matchDirectionPseudoClass(r,e);u&&s.add(u)}else if(l==="lang"){const u=this._matchLanguagePseudoClass(r,e);u&&s.add(u)}else switch(l){case"current":case"nth-col":case"nth-last-col":{if(f){const u=`Unsupported pseudo-class :${l}()`;throw new DOMException(u,h.NOT_SUPPORTED_ERR)}break}case"host":case"host-context":break;default:if(!o){const u=`Unknown pseudo-class :${l}()`;throw new DOMException(u,h.SYNTAX_ERR)}}}else{const r=/^a(?:rea)?$/,u=/^(?:(?:fieldse|inpu|selec)t|button|opt(?:group|ion)|textarea)$/,b=/^(?:(?:inpu|selec)t|button|form|textarea)$/,k=/^d(?:etails|ialog)$/,p=/^(?:checkbox|radio)$/,g=/^(?:date(?:time-local)?|month|time|week)$/,N=/(?:(?:rang|tim)e|date(?:time-local)?|month|number|week)$/,S=/^(?:(?:emai|te|ur)l|number|password|search|text)$/;switch(l){case"any-link":case"link":{r.test(t)&&e.hasAttribute("href")&&s.add(e);break}case"local-link":{if(r.test(t)&&e.hasAttribute("href")){const{href:d,origin:m,pathname:w}=new URL(this.#t.URL),_=new URL(e.getAttribute("href"),d);_.origin===m&&_.pathname===w&&s.add(e)}break}case"visited":break;case"target":{const{hash:d}=new URL(this.#t.URL);e.id&&d===`#${e.id}`&&this.#t.contains(e)&&s.add(e);break}case"target-within":{const{hash:d}=new URL(this.#t.URL);if(d){const m=d.replace(/^#/,"");let w=this.#t.getElementById(m);for(;w;){if(w===e){s.add(e);break}w=w.parentNode}}break}case"scope":{this.#e.nodeType===h.ELEMENT_NODE?e===this.#e&&s.add(e):e===this.#t.documentElement&&s.add(e);break}case"focus":{if(e===this.#t.activeElement){let d=!0,m=e;for(;m;){if(m.hasAttribute("hidden")){d=!1;break}else if(m.hasAttribute("style")){const{display:w,visibility:_}=m.style;if(d=!(w==="none"||_==="hidden"),!d)break}if(m.parentNode&&m.parentNode.nodeType===h.ELEMENT_NODE)m=m.parentNode;else break}d&&s.add(e)}break}case"focus-within":{let d,m=this.#t.activeElement;for(;m;){if(m===e){d=!0;break}m=m.parentNode}if(d){let w=!0,_=e;for(;_;){if(_.hasAttribute("hidden")){w=!1;break}else if(_.hasAttribute("style")){const{display:y,visibility:E}=_.style;if(w=!(y==="none"||E==="hidden"),!w)break}if(_.parentNode&&_.parentNode.nodeType===h.ELEMENT_NODE)_=_.parentNode;else break}w&&s.add(e)}break}case"open":{k.test(t)&&e.hasAttribute("open")&&s.add(e);break}case"closed":{k.test(t)&&!e.hasAttribute("open")&&s.add(e);break}case"disabled":{if(u.test(t)||(0,z.default)(t))if(e.disabled||e.hasAttribute("disabled"))s.add(e);else{let d=n;for(;d&&d.localName!=="fieldset";)d=d.parentNode;d&&n.localName!=="legend"&&d.hasAttribute("disabled")&&s.add(e)}break}case"enabled":{(u.test(t)||(0,z.default)(t))&&!(e.disabled&&e.hasAttribute("disabled"))&&s.add(e);break}case"read-only":{switch(t){case"textarea":{(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled"))&&s.add(e);break}case"input":{(!e.type||g.test(e.type)||S.test(e.type))&&(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled"))&&s.add(e);break}default:(0,x.isContentEditable)(e)||s.add(e)}break}case"read-write":{switch(t){case"textarea":{e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled")||s.add(e);break}case"input":{(!e.type||g.test(e.type)||S.test(e.type))&&!(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled"))&&s.add(e);break}default:(0,x.isContentEditable)(e)&&s.add(e)}break}case"placeholder-shown":{let d;t==="textarea"?d=e:t==="input"&&(e.hasAttribute("type")?S.test(e.getAttribute("type"))&&(d=e):d=e),d&&e.value===""&&e.hasAttribute("placeholder")&&e.getAttribute("placeholder").trim().length&&s.add(e);break}case"checked":{(e.checked&&t==="input"&&e.hasAttribute("type")&&p.test(e.getAttribute("type"))||e.selected&&t==="option")&&s.add(e);break}case"indeterminate":{if(e.indeterminate&&t==="input"&&e.type==="checkbox"||t==="progress"&&!e.hasAttribute("value"))s.add(e);else if(t==="input"&&e.type==="radio"&&!e.hasAttribute("checked")){const d=e.name;let m=e.parentNode;for(;m&&m.localName!=="form";)m=m.parentNode;m||(m=this.#t.documentElement);let w;const _=m.getElementsByTagName("input"),y=_.length;if(y)for(let E=0;E<y;E++){const A=_[E];if(A.getAttribute("type")==="radio"&&(d?A.getAttribute("name")===d&&(w=!!A.checked):A.hasAttribute("name")||(w=!!A.checked),w))break}w||s.add(e)}break}case"default":{const d=/^(?:button|reset)$/,m=/^(?:image|submit)$/;if(t==="button"&&!(e.hasAttribute("type")&&d.test(e.getAttribute("type")))||t==="input"&&e.hasAttribute("type")&&m.test(e.getAttribute("type"))){let w=e.parentNode;for(;w&&w.localName!=="form";)w=w.parentNode;if(w){const _=this.#t.createTreeWalker(w,h.SHOW_ELEMENT);let y=_.firstChild();for(;y;){const E=y.localName;let A;if(E==="button"?A=!(y.hasAttribute("type")&&d.test(y.getAttribute("type"))):E==="input"&&(A=y.hasAttribute("type")&&m.test(y.getAttribute("type"))),A){y===e&&s.add(e);break}y=_.nextNode()}}}else if(t==="input"&&e.hasAttribute("type")&&p.test(e.getAttribute("type"))&&(e.checked||e.hasAttribute("checked")))s.add(e);else if(t==="option"){let w=!1,_=n;for(;_&&_.localName!=="datalist";){if(_.localName==="select"){(_.multiple||_.hasAttribute("multiple"))&&(w=!0);break}_=_.parentNode}if(w)(e.selected||e.hasAttribute("selected"))&&s.add(e);else{const y=new Set,E=this.#t.createTreeWalker(n,h.SHOW_ELEMENT);let A=E.firstChild();for(;A;){if(A.selected||A.hasAttribute("selected")){y.add(A);break}A=E.nextSibling()}y.size&&y.has(e)&&s.add(e)}}break}case"valid":{if(b.test(t))e.checkValidity()&&s.add(e);else if(t==="fieldset"){let d;const m=this.#t.createTreeWalker(e,h.SHOW_ELEMENT);let w=m.firstChild();for(;w&&!(b.test(w.localName)&&(d=w.checkValidity(),!d));)w=m.nextNode();d&&s.add(e)}break}case"invalid":{if(b.test(t))e.checkValidity()||s.add(e);else if(t==="fieldset"){let d;const m=this.#t.createTreeWalker(e,h.SHOW_ELEMENT);let w=m.firstChild();for(;w&&!(b.test(w.localName)&&(d=w.checkValidity(),!d));)w=m.nextNode();d||s.add(e)}break}case"in-range":{t==="input"&&!(e.readonly||e.hasAttribute("readonly"))&&!(e.disabled||e.hasAttribute("disabled"))&&e.hasAttribute("type")&&N.test(e.getAttribute("type"))&&!(e.validity.rangeUnderflow||e.validity.rangeOverflow)&&(e.hasAttribute("min")||e.hasAttribute("max")||e.getAttribute("type")==="range")&&s.add(e);break}case"out-of-range":{t==="input"&&!(e.readonly||e.hasAttribute("readonly"))&&!(e.disabled||e.hasAttribute("disabled"))&&e.hasAttribute("type")&&N.test(e.getAttribute("type"))&&(e.validity.rangeUnderflow||e.validity.rangeOverflow)&&s.add(e);break}case"required":{let d;if(/^(?:select|textarea)$/.test(t))d=e;else if(t==="input")if(e.hasAttribute("type")){const m=e.getAttribute("type");(m==="file"||p.test(m)||g.test(m)||S.test(m))&&(d=e)}else d=e;d&&(e.required||e.hasAttribute("required"))&&s.add(e);break}case"optional":{let d;if(/^(?:select|textarea)$/.test(t))d=e;else if(t==="input")if(e.hasAttribute("type")){const m=e.getAttribute("type");(m==="file"||p.test(m)||g.test(m)||S.test(m))&&(d=e)}else d=e;d&&!(e.required||e.hasAttribute("required"))&&s.add(e);break}case"root":{e===this.#t.documentElement&&s.add(e);break}case"empty":{if(e.hasChildNodes()){let d;const m=this.#t.createTreeWalker(e,h.SHOW_ALL);let w=m.firstChild();for(;w&&(d=w.nodeType!==h.ELEMENT_NODE&&w.nodeType!==h.TEXT_NODE,!!d);)w=m.nextSibling();d&&s.add(e)}else s.add(e);break}case"first-child":{(n&&e===n.firstElementChild||e===this.#s)&&s.add(e);break}case"last-child":{(n&&e===n.lastElementChild||e===this.#s)&&s.add(e);break}case"only-child":{(n&&e===n.firstElementChild&&e===n.lastElementChild||e===this.#s)&&s.add(e);break}case"first-of-type":{if(n){const[d]=this._collectNthOfType({a:0,b:1},e);d&&s.add(d)}else e===this.#s&&s.add(e);break}case"last-of-type":{if(n){const[d]=this._collectNthOfType({a:0,b:1,reverse:!0},e);d&&s.add(d)}else e===this.#s&&s.add(e);break}case"only-of-type":{if(n){const[d]=this._collectNthOfType({a:0,b:1},e);if(d===e){const[m]=this._collectNthOfType({a:0,b:1,reverse:!0},e);m===e&&s.add(e)}}else e===this.#s&&s.add(e);break}case"host":case"host-context":break;case"after":case"before":case"first-letter":case"first-line":{if(f){const d=`Unsupported pseudo-element ::${l}`;throw new DOMException(d,h.NOT_SUPPORTED_ERR)}break}case"active":case"autofill":case"blank":case"buffering":case"current":case"defined":case"focus-visible":case"fullscreen":case"future":case"hover":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(f){const d=`Unsupported pseudo-class :${l}`;throw new DOMException(d,h.NOT_SUPPORTED_ERR)}break}default:if(l.startsWith("-webkit-")){if(f){const d=`Unsupported pseudo-class :${l}`;throw new DOMException(d,h.NOT_SUPPORTED_ERR)}}else if(!o){const d=`Unknown pseudo-class :${l}`;throw new DOMException(d,h.SYNTAX_ERR)}}}return s}_matchShadowHostPseudoClass(a,e){const{children:c}=a,i=(0,v.unescapeSelector)(a.name);let t;if(Array.isArray(c)){const[n]=(0,v.walkAST)(c[0]),[...o]=n,{host:f}=e;if(i==="host"){let l;for(const s of o){const{type:r}=s;if(r===h.COMBINATOR){const b=`Invalid selector ${(0,v.generateCSS)(a)}`;throw new DOMException(b,h.SYNTAX_ERR)}if(l=this._matchSelector(s,f).has(f),!l)break}l&&(t=e)}else if(i==="host-context"){let l,s=f;for(;s;){for(const r of o){const{type:u}=r;if(u===h.COMBINATOR){const k=`Invalid selector ${(0,v.generateCSS)(a)}`;throw new DOMException(k,h.SYNTAX_ERR)}if(l=this._matchSelector(r,s).has(s),!l)break}if(l)break;s=s.parentNode}l&&(t=e)}}else if(i==="host")t=e;else{const n=`Invalid selector :${i}`;throw new DOMException(n,h.SYNTAX_ERR)}return t??null}_matchSelector(a,e,c){const{type:i}=a,t=(0,v.unescapeSelector)(a.name);let n=new Set;if(e.nodeType===h.ELEMENT_NODE)switch(i){case h.SELECTOR_PSEUDO_CLASS:{const o=this._matchPseudoClassSelector(a,e,c);o.size&&(n=o);break}case h.SELECTOR_PSEUDO_ELEMENT:{(0,R.matchPseudoElementSelector)(t,c);break}default:{const o=(0,R.matchSelector)(a,e,c);o&&n.add(o)}}else if(this.#h&&i===h.SELECTOR_PSEUDO_CLASS&&e.nodeType===h.DOCUMENT_FRAGMENT_NODE){if(t!=="has"&&h.REG_LOGICAL_PSEUDO.test(t)){const o=this._matchPseudoClassSelector(a,e,c);o.size&&(n=o)}else if(h.REG_SHADOW_HOST.test(t)){const o=this._matchShadowHostPseudoClass(a,e,c);o&&n.add(o)}}return n}_matchLeaves(a,e,c){let i;if(this.#c.has(a)){const t=this.#c.get(a);if(t.has(e))i=t.get(e);else{for(const n of a)if(i=this._matchSelector(n,e,c).has(e),!i)break;t.set(e,i),this.#c.set(a,t)}}else{for(const n of a)if(i=this._matchSelector(n,e,c).has(e),!i)break;const t=new WeakMap;t.set(e,i),this.#c.set(a,t)}return!!i}_matchHTMLCollection(a,e={}){const{compound:c,filterLeaves:i}=e;let t=new Set;const n=a.length;if(n)if(c)for(let o=0;o<n;o++){const f=a[o];this._matchLeaves(i,f,e)&&t.add(f)}else{const o=[].slice.call(a);t=new Set(o)}return t}_findDescendantNodes(a,e,c){const[i,...t]=a,{type:n}=i,o=(0,v.unescapeSelector)(i.name),f=t.length>0;let l=new Set,s=!1;if(this.#h)s=!0;else switch(n){case h.SELECTOR_PSEUDO_ELEMENT:{(0,R.matchPseudoElementSelector)(o,c);break}case h.SELECTOR_ID:{if(this.#s.nodeType===h.ELEMENT_NODE)s=!0;else{const r=this.#s.getElementById(o);r&&r!==e&&e.contains(r)&&(f?this._matchLeaves(t,r,c)&&l.add(r):l.add(r))}break}case h.SELECTOR_CLASS:{const r=e.getElementsByClassName(o);l=this._matchHTMLCollection(r,{compound:f,filterLeaves:t});break}case h.SELECTOR_TYPE:{if(this.#t.contentType==="text/html"&&!/[*|]/.test(o)){const r=e.getElementsByTagName(o);l=this._matchHTMLCollection(r,{compound:f,filterLeaves:t})}else s=!0;break}default:s=!0}return{nodes:l,pending:s}}_matchCombinator(a,e,c={}){const{combo:i,leaves:t}=a,{name:n}=i,{dir:o}=c;let f=new Set;if(o===C)switch(n){case"+":{const l=e.nextElementSibling;l&&this._matchLeaves(t,l,c)&&f.add(l);break}case"~":{const{parentNode:l}=e;if(l){const s=this.#t.createTreeWalker(l,h.SHOW_ELEMENT);let r=this._traverse(e,s);for(r===e&&(r=s.nextSibling());r;)this._matchLeaves(t,r,c)&&f.add(r),r=s.nextSibling()}break}case">":{const l=this.#t.createTreeWalker(e,h.SHOW_ELEMENT);let s=l.firstChild();for(;s;)this._matchLeaves(t,s,c)&&f.add(s),s=l.nextSibling();break}case" ":default:{const{nodes:l,pending:s}=this._findDescendantNodes(t,e);if(l.size)f=l;else if(s){const r=this.#t.createTreeWalker(e,h.SHOW_ELEMENT);let u=r.nextNode();for(;u;)this._matchLeaves(t,u,c)&&f.add(u),u=r.nextNode()}}}else switch(n){case"+":{const l=e.previousElementSibling;l&&this._matchLeaves(t,l,c)&&f.add(l);break}case"~":{const l=this.#t.createTreeWalker(e.parentNode,h.SHOW_ELEMENT);let s=l.firstChild();for(;s&&s!==e;)this._matchLeaves(t,s,c)&&f.add(s),s=l.nextSibling();break}case">":{const l=e.parentNode;l&&this._matchLeaves(t,l,c)&&f.add(l);break}case" ":default:{const l=[];let s=e.parentNode;for(;s;)this._matchLeaves(t,s,c)&&l.push(s),s=s.parentNode;l.length&&(f=new Set(l.reverse()))}}return f}_findNode(a,e={}){const{node:c}=e;let i,t=this._traverse(c,this.#r);if(t)for(t.nodeType!==h.ELEMENT_NODE?t=this.#r.nextNode():t===c&&t!==this.#s&&(t=this.#r.nextNode());t;){let n;if(this.#e.nodeType===h.ELEMENT_NODE?t===this.#e?n=!0:n=this.#e.contains(t):n=!0,n&&this._matchLeaves(a,t,{warn:this.#i})){i=t;break}t=this.#r.nextNode()}return i??null}_matchSelf(a){const e=[];let c=!1;return this._matchLeaves(a,this.#e)&&(e.push(this.#e),c=!0),[e,c]}_findLineal(a,e={}){const{complex:c,compound:i,filterLeaves:t}=e,n=[];let o=!1,f=this._matchLeaves([a],this.#e);if(f&&!c&&(i?(f=this._matchLeaves(t,this.#e),f&&(n.push(this.#e),o=!0)):(n.push(this.#e),o=!0)),!f||c){f&&(n.push(this.#e),i||(o=!0));let l=this.#e.parentNode;for(;l&&(f=this._matchLeaves([a],l),f&&(n.push(l),i||(o=!0)),l.parentNode);)l=l.parentNode}return[n,o]}_findFirst(a){const e=[];let c=!1;const i=this._findNode(a,{node:this.#e});return i&&(e.push(i),c=!0),[e,c]}_findFromHTMLCollection(a,e={}){const{compound:c,filterLeaves:i}=e;let t=[],n=!1;const o=a.length;if(o)if(this.#e.nodeType===h.ELEMENT_NODE)for(let f=0;f<o;f++){const l=a[f];(l===this.#e||(0,x.isInclusive)(l,this.#e))&&(c?this._matchLeaves(i,l,{warn:this.#i})&&(t.push(l),n=!0):(t.push(l),n=!0))}else if(c)for(let f=0;f<o;f++){const l=a[f];this._matchLeaves(i,l,{warn:this.#i})&&(t.push(l),n=!0)}else t=[].slice.call(a),n=!0;return[t,n]}_findEntryNodes(a,e,c){const{leaves:i}=a,[t,...n]=i,{type:o}=t,f=(0,v.unescapeSelector)(t.name),l=n.length>0;let s=[],r=!1,u=!1;switch(o){case h.SELECTOR_PSEUDO_ELEMENT:{(0,R.matchPseudoElementSelector)(f,{warn:this.#i});break}case h.SELECTOR_ID:{if(e===P)[s,r]=this._matchSelf(i);else if(e===M)[s,r]=this._findLineal(t,{complex:c,compound:l,filterLeaves:n});else if(e===$&&this.#s.nodeType!==h.ELEMENT_NODE){const b=this.#s.getElementById(f);b&&(l?this._matchLeaves(n,b,{warn:this.#i})&&(s.push(b),r=!0):(s.push(b),r=!0))}else u=!0;break}case h.SELECTOR_CLASS:{if(e===P)[s,r]=this._matchSelf(i);else if(e===M)[s,r]=this._findLineal(t,{complex:c,compound:l,filterLeaves:n});else if(e===$)[s,r]=this._findFirst(i);else if(this.#s.nodeType===h.DOCUMENT_NODE){const b=this.#s.getElementsByClassName(f);[s,r]=this._findFromHTMLCollection(b,{compound:l,filterLeaves:n})}else u=!0;break}case h.SELECTOR_TYPE:{if(e===P)[s,r]=this._matchSelf(i);else if(e===M)[s,r]=this._findLineal(t,{complex:c,compound:l,filterLeaves:n});else if(this.#t.contentType==="text/html"&&this.#s.nodeType===h.DOCUMENT_NODE&&!/[*|]/.test(f)){const b=this.#s.getElementsByTagName(f);[s,r]=this._findFromHTMLCollection(b,{compound:l,filterLeaves:n})}else u=!0;break}default:if(e!==M&&h.REG_SHADOW_HOST.test(f)){if(this.#h&&this.#e.nodeType===h.DOCUMENT_FRAGMENT_NODE){const b=this._matchShadowHostPseudoClass(t,this.#e);b&&(s.push(b),r=!0)}}else e===P?[s,r]=this._matchSelf(i):e===M?[s,r]=this._findLineal(t,{complex:c,compound:l,filterLeaves:n}):e===$?[s,r]=this._findFirst(i):u=!0}return{compound:l,filtered:r,nodes:s,pending:u}}_getEntryTwig(a,e){const c=a.length,i=c>1,t=a[0];let n,o;if(i){const{combo:f,leaves:[{name:l,type:s}]}=t,r=a[c-1],{leaves:[{name:u,type:b}]}=r;if(b===h.SELECTOR_PSEUDO_ELEMENT||b===h.SELECTOR_ID)n=O,o=r;else if(s===h.SELECTOR_PSEUDO_ELEMENT||s===h.SELECTOR_ID)n=C,o=t;else if(e===L)if(l==="*"&&s===h.SELECTOR_TYPE)n=O,o=r;else if(u==="*"&&b===h.SELECTOR_TYPE)n=C,o=t;else if(c===2){const{name:k}=f;/^[+~]$/.test(k)?(n=O,o=r):(n=C,o=t)}else n=C,o=t;else if(u==="*"&&b===h.SELECTOR_TYPE)n=C,o=t;else if(l==="*"&&s===h.SELECTOR_TYPE)n=O,o=r;else{let k,p;for(const{combo:g,leaves:[N]}of a){const{type:S}=N,d=(0,v.unescapeSelector)(N.name);if(S===h.SELECTOR_PSEUDO_CLASS&&d==="dir"){k=!1;break}if(g&&!p){const{name:m}=g;/^[+~]$/.test(m)&&(k=!0,p=!0)}}k?(n=C,o=t):(n=O,o=r)}}else n=O,o=t;return{complex:i,dir:n,twig:o}}_collectNodes(a){const e=this.#a.values();if(a===L||a===$){const c=new Set;let i=0;for(const{branch:t}of e){const{complex:n,dir:o,twig:f}=this._getEntryTwig(t,a),{compound:l,filtered:s,nodes:r,pending:u}=this._findEntryNodes(f,a,n);r.length?(this.#a[i].find=!0,this.#n[i]=r):u&&c.add(new Map([["index",i],["twig",f]])),this.#a[i].dir=o,this.#a[i].filtered=s||!l,i++}if(c.size){let t,n;this.#e!==this.#s&&this.#e.nodeType===h.ELEMENT_NODE?(t=this.#e,n=this.#r):(t=this.#s,n=this.#d);let o=this._traverse(t,n);for(;o;){let f=!1;if(this.#e.nodeType===h.ELEMENT_NODE?o===this.#e?f=!0:f=this.#e.contains(o):f=!0,f)for(const l of c){const{leaves:s}=l.get("twig");if(this._matchLeaves(s,o,{warn:this.#i})){const u=l.get("index");this.#a[u].filtered=!0,this.#a[u].find=!0,this.#n[u].push(o)}}o=n.nextNode()}}}else{let c=0;for(const{branch:i}of e){const t=i[i.length-1],n=i.length>1,{compound:o,filtered:f,nodes:l}=this._findEntryNodes(t,a,n);l.length&&(this.#a[c].find=!0,this.#n[c]=l),this.#a[c].dir=O,this.#a[c].filtered=f||!o,c++}}return[this.#a,this.#n]}_matchNodes(a){const[...e]=this.#a,c=e.length;let i=new Set;for(let t=0;t<c;t++){const{branch:n,dir:o,filtered:f,find:l}=e[t],s=n.length;if(s&&l){const r=this.#n[t],u=r.length,b=s-1;if(b===0){const{leaves:[,...k]}=n[0];if((a===L||a===$)&&this.#e.nodeType===h.ELEMENT_NODE)for(let p=0;p<u;p++){const g=r[p];if(g!==this.#e&&this.#e.contains(g)&&(i.add(g),a!==L))break}else if(k.length)for(let p=0;p<u;p++){const g=r[p];if((f||this._matchLeaves(k,g,{warn:this.#i}))&&(i.add(g),a!==L))break}else if(a===L)if(i.size){const p=[...i];i=new Set([...p,...r]),this.#o=!0}else i=new Set([...r]);else{const[p]=[...r];i.add(p)}}else if(o===C){let{combo:k,leaves:p}=n[0],g;for(let N=0;N<u;N++){const S=r[N];let d=new Set([S]);for(let m=1;m<s;m++){const{combo:w,leaves:_}=n[m],y=[];for(const E of d){const A={combo:k,leaves:_},D=this._matchCombinator(A,E,{dir:o,warn:this.#i});D.size&&y.push(...D)}if(y.length)if(m===b){if(a===L){if(i.size){const E=[...i];i=new Set([...E,...y])}else i=new Set([...y]);this.#o=!0}else{const[E]=(0,x.sortNodes)(y);i.add(E)}g=!0}else k=w,d=new Set(y),g=!1;else{g=!1;break}}if(g&&a!==L)break}if(!g&&a===$){const[N]=[...r];let S=this._findNode(p,{node:N});for(;S;){let d=new Set([S]);for(let m=1;m<s;m++){const{combo:w,leaves:_}=n[m],y=[];for(const E of d){const A={combo:k,leaves:_},D=this._matchCombinator(A,E,{dir:o,warn:this.#i});D.size&&y.push(...D)}if(y.length)if(m===b){const[E]=(0,x.sortNodes)(y);i.add(E),g=!0}else k=w,d=new Set(y),g=!1;else{g=!1;break}}if(g)break;S=this._findNode(p,{node:S}),d=new Set([S])}}}else{const{leaves:k}=n[b];let p;for(let g=0;g<u;g++){const N=r[g];let S=new Set([N]);for(let d=b-1;d>=0;d--){const m=n[d],w=[];for(const _ of S){const y=this._matchCombinator(m,_,{dir:o,warn:this.#i});y.size&&w.push(...y)}if(w.length)d===0?(i.add(N),p=!0,a===L&&s>1&&i.size>1&&(this.#o=!0)):(S=new Set(w),p=!1);else{p=!1;break}}if(p&&a!==L)break}if(!p&&a===$){const[g]=[...r];let N=this._findNode(k,{node:g});for(;N;){let S=new Set([N]);for(let d=b-1;d>=0;d--){const m=n[d],w=[];for(const _ of S){const y=this._matchCombinator(m,_,{dir:o,warn:this.#i});y.size&&w.push(...y)}if(w.length)d===0?(i.add(N),p=!0):(S=new Set(w),p=!1);else{p=!1;break}}if(p)break;N=this._findNode(k,{node:N}),S=new Set([N])}}}}}return i}_find(a){return this._collectNodes(a),this._matchNodes(a)}matches(a,e,c){let i;try{if(this.#e=this._setup(a,e,c),e.nodeType!==h.ELEMENT_NODE){const n=`Unexpected node ${e.nodeName}`;throw new TypeError(n)}i=this._find(P).size}catch(t){this._onError(t)}return!!i}closest(a,e,c){let i;try{if(this.#e=this._setup(a,e,c),e.nodeType!==h.ELEMENT_NODE){const n=`Unexpected node ${e.nodeName}`;throw new TypeError(n)}const t=this._find(M);if(t.size){let n=this.#e;for(;n;){if(t.has(n)){i=n;break}n=n.parentNode}}}catch(t){this._onError(t)}return i??null}querySelector(a,e,c){let i;try{this.#e=this._setup(a,e,c),this._prepareTreeWalkers(e);const t=this._find($);t.delete(this.#e),t.size&&([i]=(0,x.sortNodes)(t))}catch(t){this._onError(t)}return i??null}querySelectorAll(a,e,c){let i;try{this.#e=this._setup(a,e,c),this._prepareTreeWalkers(e);const t=this._find(L);t.delete(this.#e),t.size&&(this.#o?i=(0,x.sortNodes)(t):i=[...t])}catch(t){this._onError(t)}return i??[]}}0&&(module.exports={Finder});
var j=Object.create;var U=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var B=Object.getPrototypeOf,G=Object.prototype.hasOwnProperty;var q=(T,a)=>{for(var e in a)U(T,e,{get:a[e],enumerable:!0})},I=(T,a,e,c)=>{if(a&&typeof a=="object"||typeof a=="function")for(let i of H(a))!G.call(T,i)&&i!==e&&U(T,i,{get:()=>a[i],enumerable:!(c=F(a,i))||c.enumerable});return T};var V=(T,a,e)=>(e=T!=null?j(B(T)):{},I(a||!T||!T.__esModule?U(e,"default",{value:T,enumerable:!0}):e,T)),X=T=>I(U({},"__esModule",{value:!0}),T);var K={};q(K,{Finder:()=>Y});module.exports=X(K);var z=V(require("is-potential-custom-element-name"),1),x=require("./dom-util.js"),R=require("./matcher.js"),v=require("./parser.js"),f=require("./constant.js");const C="next",O="prev",L="all",$="first",M="lineal",P="self",W=f.SHOW_DOCUMENT|f.SHOW_DOCUMENT_FRAGMENT|f.SHOW_ELEMENT;class Y{#a;#l;#t;#r;#e;#n;#b;#c;#s;#h;#o;#d;#i;#f;constructor(){this.#l=new WeakMap}_onError(a){if(!this.#b)if(a instanceof DOMException||this.#f&&a instanceof this.#f.DOMException)if(a.name===f.NOT_SUPPORTED_ERR)this.#i&&console.warn(a.message);else throw this.#f?new this.#f.DOMException(a.message,a.name):a;else throw a}_setup(a,e,c={}){const{noexcept:i,warn:t}=c;return this.#b=!!i,this.#i=!!t,this.#e=e,[this.#f,this.#t,this.#s]=(0,x.prepareDOMObjects)(e),this.#h=(0,x.isInShadowTree)(e),[this.#a,this.#n]=this._correspond(a),this.#c=new WeakMap,e}_correspond(a){const e=[];let c,i=this.#t&&this.#l.get(this.#t);if(i&&i.has(`${a}`)&&(c=i.get(a)),c){const t=c.length;for(let n=0;n<t;n++)c[n].dir=null,c[n].filtered=!1,c[n].find=!1,e[n]=[]}else{let t;try{t=(0,v.parseSelector)(a)}catch(h){this._onError(h)}const n=(0,v.walkAST)(t);c=[];let o=0;for(const[...h]of n){const l=[];let s=h.shift();if(s&&s.type!==f.COMBINATOR){const r=new Set;for(;s;){if(s.type===f.COMBINATOR){const[u]=h;if(u.type===f.COMBINATOR){const b=`Invalid selector ${a}`;throw new DOMException(b,f.SYNTAX_ERR)}l.push({combo:s,leaves:(0,v.sortAST)(r)}),r.clear()}else if(s){let{name:u}=s;u&&(Object.prototype.hasOwnProperty.call(u,"name")?(u=(0,v.unescapeSelector)(u.name),/[|:]/.test(u)&&(s.namespace=!0)):typeof u=="string"&&(u=(0,v.unescapeSelector)(u),/[|:]/.test(u)&&(s.namespace=!0))),r.add(s)}if(h.length)s=h.shift();else{l.push({combo:null,leaves:(0,v.sortAST)(r)}),r.clear();break}}}c.push({branch:l,dir:null,filtered:!1,find:!1}),e[o]=[],o++}this.#t&&(i||(i=new Map),i.set(`${a}`,c),this.#l.set(this.#t,i))}return[c,e]}_prepareTreeWalkers(a){return this.#d=this.#t.createTreeWalker(this.#s,W),this.#r=this.#t.createTreeWalker(a,W),this.#o=!1,[this.#d,this.#r]}_traverse(a={},e=this.#d){let c,i=e.currentNode;if(a.nodeType===f.ELEMENT_NODE&&i===a)c=i;else{if(i!==e.root)for(;i&&!(i===e.root||a.nodeType===f.ELEMENT_NODE&&i===a);)i=e.parentNode();if(a.nodeType===f.ELEMENT_NODE)for(;i;){if(i===a){c=i;break}i=e.nextNode()}else c=i}return c??null}_collectNthChild(a,e,c){const{a:i,b:t,reverse:n,selector:o}=a,{parentNode:h}=e;let l=new Set,s;if(o&&(this.#l.has(o)?s=this.#l.get(o):(s=(0,v.walkAST)(o),this.#l.set(o,s))),h){const r=this.#t.createTreeWalker(h,W);let u=0,b=r.firstChild();for(;b;)u++,b=r.nextSibling();b=this._traverse(h,r);const k=new Set;if(s)for(b=this._traverse(h,r),b=r.firstChild();b;){let p;for(const g of s)if(p=this._matchLeaves(g,b,c),!p)break;p&&k.add(b),b=r.nextSibling()}if(i===0){if(t>0&&t<=u){if(k.size){let p=0;for(b=this._traverse(h,r),n?b=r.lastChild():b=r.firstChild();b;){if(k.has(b)){if(p===t-1){l.add(b);break}p++}n?b=r.previousSibling():b=r.nextSibling()}}else if(!o){let p=0;for(b=this._traverse(h,r),n?b=r.lastChild():b=r.firstChild();b;){if(p===t-1){l.add(b);break}n?b=r.previousSibling():b=r.nextSibling(),p++}}}}else{let p=t-1;if(i>0)for(;p<0;)p+=i;if(p>=0&&p<u){let g=0,N=i>0?0:t-1;for(b=this._traverse(h,r),n?b=r.lastChild():b=r.firstChild();b&&(b&&p>=0&&p<u);)k.size?k.has(b)&&(N===p&&(l.add(b),p+=i),i>0?N++:N--):g===p&&(o||l.add(b),p+=i),n?b=r.previousSibling():b=r.nextSibling(),g++}}if(n&&l.size>1){const p=[...l];l=new Set(p.reverse())}}else if(e===this.#s&&i+t===1)if(s){let r;for(const u of s)if(r=this._matchLeaves(u,e,c),r)break;r&&l.add(e)}else l.add(e);return l}_collectNthOfType(a,e){const{a:c,b:i,reverse:t}=a,{localName:n,parentNode:o,prefix:h}=e;let l=new Set;if(o){const s=this.#t.createTreeWalker(o,W);let r=0,u=s.firstChild();for(;u;)r++,u=s.nextSibling();if(c===0){if(i>0&&i<=r){let b=0;for(u=this._traverse(o,s),t?u=s.lastChild():u=s.firstChild();u;){const{localName:k,prefix:p}=u;if(k===n&&p===h){if(b===i-1){l.add(u);break}b++}t?u=s.previousSibling():u=s.nextSibling()}}}else{let b=i-1;if(c>0)for(;b<0;)b+=c;if(b>=0&&b<r){let k=c>0?0:i-1;for(u=this._traverse(o,s),t?u=s.lastChild():u=s.firstChild();u;){const{localName:p,prefix:g}=u;if(p===n&&g===h){if(k===b&&(l.add(u),b+=c),b<0||b>=r)break;c>0?k++:k--}t?u=s.previousSibling():u=s.nextSibling()}}}if(t&&l.size>1){const b=[...l];l=new Set(b.reverse())}}else e===this.#s&&c+i===1&&l.add(e);return l}_matchAnPlusB(a,e,c,i){const{nth:{a:t,b:n,name:o},selector:h}=a,l=(0,v.unescapeSelector)(o),s=new Map;l?(l==="even"?(s.set("a",2),s.set("b",0)):l==="odd"&&(s.set("a",2),s.set("b",1)),c.indexOf("last")>-1&&s.set("reverse",!0)):(typeof t=="string"&&/-?\d+/.test(t)?s.set("a",t*1):s.set("a",0),typeof n=="string"&&/-?\d+/.test(n)?s.set("b",n*1):s.set("b",0),c.indexOf("last")>-1&&s.set("reverse",!0));let r=new Set;if(s.has("a")&&s.has("b")){if(/^nth-(?:last-)?child$/.test(c)){h&&s.set("selector",h);const u=Object.fromEntries(s),b=this._collectNthChild(u,e,i);b.size&&(r=b)}else if(/^nth-(?:last-)?of-type$/.test(c)){const u=Object.fromEntries(s),b=this._collectNthOfType(u,e);b.size&&(r=b)}}return r}_matchDirectionPseudoClass(a,e){const c=(0,v.unescapeSelector)(a.name),i=(0,x.getDirectionality)(e);let t;return c===i&&(t=e),t??null}_matchLanguagePseudoClass(a,e){const c=(0,v.unescapeSelector)(a.name);let i;if(c==="*")if(e.hasAttribute("lang"))e.getAttribute("lang")&&(i=e);else{let t=e.parentNode;for(;t&&t.nodeType===f.ELEMENT_NODE;){if(t.hasAttribute("lang")){t.getAttribute("lang")&&(i=e);break}t=t.parentNode}}else if(c){const t=`(?:-${f.ALPHA_NUM})*`;if(new RegExp(`^(?:\\*-)?${f.ALPHA_NUM}${t}$`,"i").test(c)){let o;if(c.indexOf("-")>-1){const[h,l,...s]=c.split("-");let r;h==="*"?r=`${f.ALPHA_NUM}${t}`:r=`${h}${t}`;const u=`-${l}${t}`,b=s.length;let k="";if(b)for(let p=0;p<b;p++)k+=`-${s[p]}${t}`;o=new RegExp(`^${r}${u}${k}$`,"i")}else o=new RegExp(`^${c}${t}$`,"i");if(e.hasAttribute("lang"))o.test(e.getAttribute("lang"))&&(i=e);else{let h=e.parentNode;for(;h&&h.nodeType===f.ELEMENT_NODE;){if(h.hasAttribute("lang")){const l=h.getAttribute("lang");o.test(l)&&(i=e);break}h=h.parentNode}}}}return i??null}_matchHasPseudoFunc(a,e,c={}){let i;if(Array.isArray(a)&&a.length){const[t]=a,{type:n}=t;let o;n===f.COMBINATOR?o=a.shift():o={name:" ",type:f.COMBINATOR};const h=[];for(;a.length;){const[r]=a,{type:u}=r;if(u===f.COMBINATOR)break;h.push(a.shift())}const l={combo:o,leaves:h};c.dir=C;const s=this._matchCombinator(l,e,c);if(s.size)if(a.length){for(const r of s)if(i=this._matchHasPseudoFunc(Object.assign([],a),r,c),i)break}else i=!0}return!!i}_matchLogicalPseudoFunc(a,e,c={}){const{astName:i="",branches:t=[],selector:n="",twigBranches:o=[]}=a;let h;if(i==="has")if(n.includes(":has("))h=null;else{let l;for(const s of t)if(l=this._matchHasPseudoFunc(Object.assign([],s),e,c),l)break;l&&(h=e)}else{const l=/^(?:is|where)$/.test(i);c.forgive=l;const s=o.length;let r;for(let u=0;u<s;u++){const b=o[u],k=b.length-1,{leaves:p}=b[k];if(r=this._matchLeaves(p,e,c),r&&k>0){let g=new Set([e]);for(let N=k-1;N>=0;N--){const S=b[N],d=[];c.dir=O;for(const m of g){const w=this._matchCombinator(S,m,c);w.size&&d.push(...w)}if(d.length)N===0?r=!0:g=new Set(d);else{r=!1;break}}}if(r)break}i==="not"?r||(h=e):r&&(h=e)}return h??null}_matchPseudoClassSelector(a,e,c={}){const{children:i}=a,{localName:t,parentNode:n}=e,{forgive:o,warn:h=this.#i}=c,l=(0,v.unescapeSelector)(a.name);let s=new Set;if(f.REG_LOGICAL_PSEUDO.test(l)){let r;if(this.#l.has(a))r=this.#l.get(a);else{const b=(0,v.walkAST)(a),k=[],p=[];for(const[...g]of b){for(const m of g){const w=(0,v.generateCSS)(m);k.push(w)}const N=[],S=new Set;let d=g.shift();for(;d;)if(d.type===f.COMBINATOR?(N.push({combo:d,leaves:[...S]}),S.clear()):d&&S.add(d),g.length)d=g.shift();else{N.push({combo:null,leaves:[...S]}),S.clear();break}p.push(N)}r={astName:l,branches:b,twigBranches:p,selector:k.join(",")},this.#l.set(a,r)}const u=this._matchLogicalPseudoFunc(r,e,c);u&&s.add(u)}else if(Array.isArray(i)){const[r]=i;if(/^nth-(?:last-)?(?:child|of-type)$/.test(l)){const u=this._matchAnPlusB(r,e,l,c);u.size&&(s=u)}else if(l==="dir"){const u=this._matchDirectionPseudoClass(r,e);u&&s.add(u)}else if(l==="lang"){const u=this._matchLanguagePseudoClass(r,e);u&&s.add(u)}else switch(l){case"current":case"nth-col":case"nth-last-col":{if(h){const u=`Unsupported pseudo-class :${l}()`;throw new DOMException(u,f.NOT_SUPPORTED_ERR)}break}case"host":case"host-context":break;default:if(!o){const u=`Unknown pseudo-class :${l}()`;throw new DOMException(u,f.SYNTAX_ERR)}}}else{const r=/^a(?:rea)?$/,u=/^(?:(?:fieldse|inpu|selec)t|button|opt(?:group|ion)|textarea)$/,b=/^(?:(?:inpu|selec)t|button|form|textarea)$/,k=/^d(?:etails|ialog)$/,p=/^(?:checkbox|radio)$/,g=/^(?:date(?:time-local)?|month|time|week)$/,N=/(?:(?:rang|tim)e|date(?:time-local)?|month|number|week)$/,S=/^(?:(?:emai|te|ur)l|number|password|search|text)$/;switch(l){case"any-link":case"link":{r.test(t)&&e.hasAttribute("href")&&s.add(e);break}case"local-link":{if(r.test(t)&&e.hasAttribute("href")){const{href:d,origin:m,pathname:w}=new URL(this.#t.URL),_=new URL(e.getAttribute("href"),d);_.origin===m&&_.pathname===w&&s.add(e)}break}case"visited":break;case"target":{const{hash:d}=new URL(this.#t.URL);e.id&&d===`#${e.id}`&&this.#t.contains(e)&&s.add(e);break}case"target-within":{const{hash:d}=new URL(this.#t.URL);if(d){const m=d.replace(/^#/,"");let w=this.#t.getElementById(m);for(;w;){if(w===e){s.add(e);break}w=w.parentNode}}break}case"scope":{this.#e.nodeType===f.ELEMENT_NODE?e===this.#e&&s.add(e):e===this.#t.documentElement&&s.add(e);break}case"focus":{if(e===this.#t.activeElement){let d=!0,m=e;for(;m;){if(m.hasAttribute("hidden")){d=!1;break}else if(m.hasAttribute("style")){const{display:w,visibility:_}=m.style;if(d=!(w==="none"||_==="hidden"),!d)break}if(m.parentNode&&m.parentNode.nodeType===f.ELEMENT_NODE)m=m.parentNode;else break}d&&s.add(e)}break}case"focus-within":{let d,m=this.#t.activeElement;for(;m;){if(m===e){d=!0;break}m=m.parentNode}if(d){let w=!0,_=e;for(;_;){if(_.hasAttribute("hidden")){w=!1;break}else if(_.hasAttribute("style")){const{display:y,visibility:E}=_.style;if(w=!(y==="none"||E==="hidden"),!w)break}if(_.parentNode&&_.parentNode.nodeType===f.ELEMENT_NODE)_=_.parentNode;else break}w&&s.add(e)}break}case"open":{k.test(t)&&e.hasAttribute("open")&&s.add(e);break}case"closed":{k.test(t)&&!e.hasAttribute("open")&&s.add(e);break}case"disabled":{if(u.test(t)||(0,z.default)(t))if(e.disabled||e.hasAttribute("disabled"))s.add(e);else{let d=n;for(;d&&d.localName!=="fieldset";)d=d.parentNode;d&&n.localName!=="legend"&&d.hasAttribute("disabled")&&s.add(e)}break}case"enabled":{(u.test(t)||(0,z.default)(t))&&!(e.disabled&&e.hasAttribute("disabled"))&&s.add(e);break}case"read-only":{switch(t){case"textarea":{(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled"))&&s.add(e);break}case"input":{(!e.type||g.test(e.type)||S.test(e.type))&&(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled"))&&s.add(e);break}default:(0,x.isContentEditable)(e)||s.add(e)}break}case"read-write":{switch(t){case"textarea":{e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled")||s.add(e);break}case"input":{(!e.type||g.test(e.type)||S.test(e.type))&&!(e.readonly||e.hasAttribute("readonly")||e.disabled||e.hasAttribute("disabled"))&&s.add(e);break}default:(0,x.isContentEditable)(e)&&s.add(e)}break}case"placeholder-shown":{let d;t==="textarea"?d=e:t==="input"&&(e.hasAttribute("type")?S.test(e.getAttribute("type"))&&(d=e):d=e),d&&e.value===""&&e.hasAttribute("placeholder")&&e.getAttribute("placeholder").trim().length&&s.add(e);break}case"checked":{(e.checked&&t==="input"&&e.hasAttribute("type")&&p.test(e.getAttribute("type"))||e.selected&&t==="option")&&s.add(e);break}case"indeterminate":{if(e.indeterminate&&t==="input"&&e.type==="checkbox"||t==="progress"&&!e.hasAttribute("value"))s.add(e);else if(t==="input"&&e.type==="radio"&&!e.hasAttribute("checked")){const d=e.name;let m=e.parentNode;for(;m&&m.localName!=="form";)m=m.parentNode;m||(m=this.#t.documentElement);let w;const _=m.getElementsByTagName("input"),y=_.length;if(y)for(let E=0;E<y;E++){const A=_[E];if(A.getAttribute("type")==="radio"&&(d?A.getAttribute("name")===d&&(w=!!A.checked):A.hasAttribute("name")||(w=!!A.checked),w))break}w||s.add(e)}break}case"default":{const d=/^(?:button|reset)$/,m=/^(?:image|submit)$/;if(t==="button"&&!(e.hasAttribute("type")&&d.test(e.getAttribute("type")))||t==="input"&&e.hasAttribute("type")&&m.test(e.getAttribute("type"))){let w=e.parentNode;for(;w&&w.localName!=="form";)w=w.parentNode;if(w){const _=this.#t.createTreeWalker(w,f.SHOW_ELEMENT);let y=_.firstChild();for(;y;){const E=y.localName;let A;if(E==="button"?A=!(y.hasAttribute("type")&&d.test(y.getAttribute("type"))):E==="input"&&(A=y.hasAttribute("type")&&m.test(y.getAttribute("type"))),A){y===e&&s.add(e);break}y=_.nextNode()}}}else if(t==="input"&&e.hasAttribute("type")&&p.test(e.getAttribute("type"))&&(e.checked||e.hasAttribute("checked")))s.add(e);else if(t==="option"){let w=!1,_=n;for(;_&&_.localName!=="datalist";){if(_.localName==="select"){(_.multiple||_.hasAttribute("multiple"))&&(w=!0);break}_=_.parentNode}if(w)(e.selected||e.hasAttribute("selected"))&&s.add(e);else{const y=new Set,E=this.#t.createTreeWalker(n,f.SHOW_ELEMENT);let A=E.firstChild();for(;A;){if(A.selected||A.hasAttribute("selected")){y.add(A);break}A=E.nextSibling()}y.size&&y.has(e)&&s.add(e)}}break}case"valid":{if(b.test(t))e.checkValidity()&&s.add(e);else if(t==="fieldset"){let d;const m=this.#t.createTreeWalker(e,f.SHOW_ELEMENT);let w=m.firstChild();for(;w&&!(b.test(w.localName)&&(d=w.checkValidity(),!d));)w=m.nextNode();d&&s.add(e)}break}case"invalid":{if(b.test(t))e.checkValidity()||s.add(e);else if(t==="fieldset"){let d;const m=this.#t.createTreeWalker(e,f.SHOW_ELEMENT);let w=m.firstChild();for(;w&&!(b.test(w.localName)&&(d=w.checkValidity(),!d));)w=m.nextNode();d||s.add(e)}break}case"in-range":{t==="input"&&!(e.readonly||e.hasAttribute("readonly"))&&!(e.disabled||e.hasAttribute("disabled"))&&e.hasAttribute("type")&&N.test(e.getAttribute("type"))&&!(e.validity.rangeUnderflow||e.validity.rangeOverflow)&&(e.hasAttribute("min")||e.hasAttribute("max")||e.getAttribute("type")==="range")&&s.add(e);break}case"out-of-range":{t==="input"&&!(e.readonly||e.hasAttribute("readonly"))&&!(e.disabled||e.hasAttribute("disabled"))&&e.hasAttribute("type")&&N.test(e.getAttribute("type"))&&(e.validity.rangeUnderflow||e.validity.rangeOverflow)&&s.add(e);break}case"required":{let d;if(/^(?:select|textarea)$/.test(t))d=e;else if(t==="input")if(e.hasAttribute("type")){const m=e.getAttribute("type");(m==="file"||p.test(m)||g.test(m)||S.test(m))&&(d=e)}else d=e;d&&(e.required||e.hasAttribute("required"))&&s.add(e);break}case"optional":{let d;if(/^(?:select|textarea)$/.test(t))d=e;else if(t==="input")if(e.hasAttribute("type")){const m=e.getAttribute("type");(m==="file"||p.test(m)||g.test(m)||S.test(m))&&(d=e)}else d=e;d&&!(e.required||e.hasAttribute("required"))&&s.add(e);break}case"root":{e===this.#t.documentElement&&s.add(e);break}case"empty":{if(e.hasChildNodes()){let d;const m=this.#t.createTreeWalker(e,f.SHOW_ALL);let w=m.firstChild();for(;w&&(d=w.nodeType!==f.ELEMENT_NODE&&w.nodeType!==f.TEXT_NODE,!!d);)w=m.nextSibling();d&&s.add(e)}else s.add(e);break}case"first-child":{(n&&e===n.firstElementChild||e===this.#s)&&s.add(e);break}case"last-child":{(n&&e===n.lastElementChild||e===this.#s)&&s.add(e);break}case"only-child":{(n&&e===n.firstElementChild&&e===n.lastElementChild||e===this.#s)&&s.add(e);break}case"first-of-type":{if(n){const[d]=this._collectNthOfType({a:0,b:1},e);d&&s.add(d)}else e===this.#s&&s.add(e);break}case"last-of-type":{if(n){const[d]=this._collectNthOfType({a:0,b:1,reverse:!0},e);d&&s.add(d)}else e===this.#s&&s.add(e);break}case"only-of-type":{if(n){const[d]=this._collectNthOfType({a:0,b:1},e);if(d===e){const[m]=this._collectNthOfType({a:0,b:1,reverse:!0},e);m===e&&s.add(e)}}else e===this.#s&&s.add(e);break}case"host":case"host-context":break;case"after":case"before":case"first-letter":case"first-line":{if(h){const d=`Unsupported pseudo-element ::${l}`;throw new DOMException(d,f.NOT_SUPPORTED_ERR)}break}case"active":case"autofill":case"blank":case"buffering":case"current":case"defined":case"focus-visible":case"fullscreen":case"future":case"hover":case"modal":case"muted":case"past":case"paused":case"picture-in-picture":case"playing":case"seeking":case"stalled":case"user-invalid":case"user-valid":case"volume-locked":case"-webkit-autofill":{if(h){const d=`Unsupported pseudo-class :${l}`;throw new DOMException(d,f.NOT_SUPPORTED_ERR)}break}default:if(l.startsWith("-webkit-")){if(h){const d=`Unsupported pseudo-class :${l}`;throw new DOMException(d,f.NOT_SUPPORTED_ERR)}}else if(!o){const d=`Unknown pseudo-class :${l}`;throw new DOMException(d,f.SYNTAX_ERR)}}}return s}_matchShadowHostPseudoClass(a,e){const{children:c}=a,i=(0,v.unescapeSelector)(a.name);let t;if(Array.isArray(c)){const[n]=(0,v.walkAST)(c[0]),[...o]=n,{host:h}=e;if(i==="host"){let l;for(const s of o){const{type:r}=s;if(r===f.COMBINATOR){const b=`Invalid selector ${(0,v.generateCSS)(a)}`;throw new DOMException(b,f.SYNTAX_ERR)}if(l=this._matchSelector(s,h).has(h),!l)break}l&&(t=e)}else if(i==="host-context"){let l,s=h;for(;s;){for(const r of o){const{type:u}=r;if(u===f.COMBINATOR){const k=`Invalid selector ${(0,v.generateCSS)(a)}`;throw new DOMException(k,f.SYNTAX_ERR)}if(l=this._matchSelector(r,s).has(s),!l)break}if(l)break;s=s.parentNode}l&&(t=e)}}else if(i==="host")t=e;else{const n=`Invalid selector :${i}`;throw new DOMException(n,f.SYNTAX_ERR)}return t??null}_matchSelector(a,e,c){const{type:i}=a,t=(0,v.unescapeSelector)(a.name);let n=new Set;if(e.nodeType===f.ELEMENT_NODE)switch(i){case f.SELECTOR_CLASS:{e.classList.contains(t)&&n.add(e);break}case f.SELECTOR_ID:{t===e.id&&n.add(e);break}case f.SELECTOR_PSEUDO_CLASS:{const o=this._matchPseudoClassSelector(a,e,c);o.size&&(n=o);break}case f.SELECTOR_PSEUDO_ELEMENT:{(0,R.matchPseudoElementSelector)(t,c);break}default:{const o=(0,R.matchSelector)(a,e,c);o&&n.add(o)}}else if(this.#h&&i===f.SELECTOR_PSEUDO_CLASS&&e.nodeType===f.DOCUMENT_FRAGMENT_NODE){if(t!=="has"&&f.REG_LOGICAL_PSEUDO.test(t)){const o=this._matchPseudoClassSelector(a,e,c);o.size&&(n=o)}else if(f.REG_SHADOW_HOST.test(t)){const o=this._matchShadowHostPseudoClass(a,e,c);o&&n.add(o)}}return n}_matchLeaves(a,e,c){let i;if(this.#c.has(a)){const t=this.#c.get(a);if(t.has(e))i=t.get(e);else{for(const n of a)if(i=this._matchSelector(n,e,c).has(e),!i)break;t.set(e,i),this.#c.set(a,t)}}else{for(const n of a)if(i=this._matchSelector(n,e,c).has(e),!i)break;const t=new WeakMap;t.set(e,i),this.#c.set(a,t)}return!!i}_matchHTMLCollection(a,e={}){const{compound:c,filterLeaves:i}=e;let t=new Set;const n=a.length;if(n)if(c)for(let o=0;o<n;o++){const h=a[o];this._matchLeaves(i,h,e)&&t.add(h)}else{const o=[].slice.call(a);t=new Set(o)}return t}_findDescendantNodes(a,e,c){const[i,...t]=a,{type:n}=i,o=(0,v.unescapeSelector)(i.name),h=t.length>0;let l=new Set,s=!1;if(this.#h)s=!0;else switch(n){case f.SELECTOR_PSEUDO_ELEMENT:{(0,R.matchPseudoElementSelector)(o,c);break}case f.SELECTOR_ID:{if(this.#s.nodeType===f.ELEMENT_NODE)s=!0;else{const r=this.#s.getElementById(o);r&&r!==e&&e.contains(r)&&(h?this._matchLeaves(t,r,c)&&l.add(r):l.add(r))}break}case f.SELECTOR_CLASS:{const r=e.getElementsByClassName(o);l=this._matchHTMLCollection(r,{compound:h,filterLeaves:t});break}case f.SELECTOR_TYPE:{if(this.#t.contentType==="text/html"&&!/[*|]/.test(o)){const r=e.getElementsByTagName(o);l=this._matchHTMLCollection(r,{compound:h,filterLeaves:t})}else s=!0;break}default:s=!0}return{nodes:l,pending:s}}_matchCombinator(a,e,c={}){const{combo:i,leaves:t}=a,{name:n}=i,{dir:o}=c;let h=new Set;if(o===C)switch(n){case"+":{const l=e.nextElementSibling;l&&this._matchLeaves(t,l,c)&&h.add(l);break}case"~":{const{parentNode:l}=e;if(l){const s=this.#t.createTreeWalker(l,f.SHOW_ELEMENT);let r=this._traverse(e,s);for(r===e&&(r=s.nextSibling());r;)this._matchLeaves(t,r,c)&&h.add(r),r=s.nextSibling()}break}case">":{const l=this.#t.createTreeWalker(e,f.SHOW_ELEMENT);let s=l.firstChild();for(;s;)this._matchLeaves(t,s,c)&&h.add(s),s=l.nextSibling();break}case" ":default:{const{nodes:l,pending:s}=this._findDescendantNodes(t,e);if(l.size)h=l;else if(s){const r=this.#t.createTreeWalker(e,f.SHOW_ELEMENT);let u=r.nextNode();for(;u;)this._matchLeaves(t,u,c)&&h.add(u),u=r.nextNode()}}}else switch(n){case"+":{const l=e.previousElementSibling;l&&this._matchLeaves(t,l,c)&&h.add(l);break}case"~":{const l=this.#t.createTreeWalker(e.parentNode,f.SHOW_ELEMENT);let s=l.firstChild();for(;s&&s!==e;)this._matchLeaves(t,s,c)&&h.add(s),s=l.nextSibling();break}case">":{const l=e.parentNode;l&&this._matchLeaves(t,l,c)&&h.add(l);break}case" ":default:{const l=[];let s=e.parentNode;for(;s;)this._matchLeaves(t,s,c)&&l.push(s),s=s.parentNode;l.length&&(h=new Set(l.reverse()))}}return h}_findNode(a,e={}){const{node:c}=e;let i,t=this._traverse(c,this.#r);if(t)for(t.nodeType!==f.ELEMENT_NODE?t=this.#r.nextNode():t===c&&t!==this.#s&&(t=this.#r.nextNode());t;){let n;if(this.#e.nodeType===f.ELEMENT_NODE?t===this.#e?n=!0:n=this.#e.contains(t):n=!0,n&&this._matchLeaves(a,t,{warn:this.#i})){i=t;break}t=this.#r.nextNode()}return i??null}_matchSelf(a){const e=[];let c=!1;return this._matchLeaves(a,this.#e)&&(e.push(this.#e),c=!0),[e,c]}_findLineal(a,e={}){const{complex:c,compound:i,filterLeaves:t}=e,n=[];let o=!1,h=this._matchLeaves([a],this.#e);if(h&&!c&&(i?(h=this._matchLeaves(t,this.#e),h&&(n.push(this.#e),o=!0)):(n.push(this.#e),o=!0)),!h||c){h&&(n.push(this.#e),i||(o=!0));let l=this.#e.parentNode;for(;l&&(h=this._matchLeaves([a],l),h&&(n.push(l),i||(o=!0)),l.parentNode);)l=l.parentNode}return[n,o]}_findFirst(a){const e=[];let c=!1;const i=this._findNode(a,{node:this.#e});return i&&(e.push(i),c=!0),[e,c]}_findFromHTMLCollection(a,e={}){const{compound:c,filterLeaves:i}=e;let t=[],n=!1;const o=a.length;if(o)if(this.#e.nodeType===f.ELEMENT_NODE)for(let h=0;h<o;h++){const l=a[h];(l===this.#e||(0,x.isInclusive)(l,this.#e))&&(c?this._matchLeaves(i,l,{warn:this.#i})&&(t.push(l),n=!0):(t.push(l),n=!0))}else if(c)for(let h=0;h<o;h++){const l=a[h];this._matchLeaves(i,l,{warn:this.#i})&&(t.push(l),n=!0)}else t=[].slice.call(a),n=!0;return[t,n]}_findEntryNodes(a,e,c){const{leaves:i}=a,[t,...n]=i,{type:o}=t,h=(0,v.unescapeSelector)(t.name),l=n.length>0;let s=[],r=!1,u=!1;switch(o){case f.SELECTOR_PSEUDO_ELEMENT:{(0,R.matchPseudoElementSelector)(h,{warn:this.#i});break}case f.SELECTOR_ID:{if(e===P)[s,r]=this._matchSelf(i);else if(e===M)[s,r]=this._findLineal(t,{complex:c,compound:l,filterLeaves:n});else if(e===$&&this.#s.nodeType!==f.ELEMENT_NODE){const b=this.#s.getElementById(h);b&&(l?this._matchLeaves(n,b,{warn:this.#i})&&(s.push(b),r=!0):(s.push(b),r=!0))}else u=!0;break}case f.SELECTOR_CLASS:{if(e===P)[s,r]=this._matchSelf(i);else if(e===M)[s,r]=this._findLineal(t,{complex:c,compound:l,filterLeaves:n});else if(e===$)[s,r]=this._findFirst(i);else if(this.#s.nodeType===f.DOCUMENT_NODE){const b=this.#s.getElementsByClassName(h);[s,r]=this._findFromHTMLCollection(b,{compound:l,filterLeaves:n})}else u=!0;break}case f.SELECTOR_TYPE:{if(e===P)[s,r]=this._matchSelf(i);else if(e===M)[s,r]=this._findLineal(t,{complex:c,compound:l,filterLeaves:n});else if(this.#t.contentType==="text/html"&&this.#s.nodeType===f.DOCUMENT_NODE&&!/[*|]/.test(h)){const b=this.#s.getElementsByTagName(h);[s,r]=this._findFromHTMLCollection(b,{compound:l,filterLeaves:n})}else u=!0;break}default:if(e!==M&&f.REG_SHADOW_HOST.test(h)){if(this.#h&&this.#e.nodeType===f.DOCUMENT_FRAGMENT_NODE){const b=this._matchShadowHostPseudoClass(t,this.#e);b&&(s.push(b),r=!0)}}else e===P?[s,r]=this._matchSelf(i):e===M?[s,r]=this._findLineal(t,{complex:c,compound:l,filterLeaves:n}):e===$?[s,r]=this._findFirst(i):u=!0}return{compound:l,filtered:r,nodes:s,pending:u}}_getEntryTwig(a,e){const c=a.length,i=c>1,t=a[0];let n,o;if(i){const{combo:h,leaves:[{name:l,type:s}]}=t,r=a[c-1],{leaves:[{name:u,type:b}]}=r;if(b===f.SELECTOR_PSEUDO_ELEMENT||b===f.SELECTOR_ID)n=O,o=r;else if(s===f.SELECTOR_PSEUDO_ELEMENT||s===f.SELECTOR_ID)n=C,o=t;else if(e===L)if(l==="*"&&s===f.SELECTOR_TYPE)n=O,o=r;else if(u==="*"&&b===f.SELECTOR_TYPE)n=C,o=t;else if(c===2){const{name:k}=h;/^[+~]$/.test(k)?(n=O,o=r):(n=C,o=t)}else n=C,o=t;else if(u==="*"&&b===f.SELECTOR_TYPE)n=C,o=t;else if(l==="*"&&s===f.SELECTOR_TYPE)n=O,o=r;else{let k,p;for(const{combo:g,leaves:[N]}of a){const{type:S}=N,d=(0,v.unescapeSelector)(N.name);if(S===f.SELECTOR_PSEUDO_CLASS&&d==="dir"){k=!1;break}if(g&&!p){const{name:m}=g;/^[+~]$/.test(m)&&(k=!0,p=!0)}}k?(n=C,o=t):(n=O,o=r)}}else n=O,o=t;return{complex:i,dir:n,twig:o}}_collectNodes(a){const e=this.#a.values();if(a===L||a===$){const c=new Set;let i=0;for(const{branch:t}of e){const{complex:n,dir:o,twig:h}=this._getEntryTwig(t,a),{compound:l,filtered:s,nodes:r,pending:u}=this._findEntryNodes(h,a,n);r.length?(this.#a[i].find=!0,this.#n[i]=r):u&&c.add(new Map([["index",i],["twig",h]])),this.#a[i].dir=o,this.#a[i].filtered=s||!l,i++}if(c.size){let t,n;this.#e!==this.#s&&this.#e.nodeType===f.ELEMENT_NODE?(t=this.#e,n=this.#r):(t=this.#s,n=this.#d);let o=this._traverse(t,n);for(;o;){let h=!1;if(this.#e.nodeType===f.ELEMENT_NODE?o===this.#e?h=!0:h=this.#e.contains(o):h=!0,h)for(const l of c){const{leaves:s}=l.get("twig");if(this._matchLeaves(s,o,{warn:this.#i})){const u=l.get("index");this.#a[u].filtered=!0,this.#a[u].find=!0,this.#n[u].push(o)}}o=n.nextNode()}}}else{let c=0;for(const{branch:i}of e){const t=i[i.length-1],n=i.length>1,{compound:o,filtered:h,nodes:l}=this._findEntryNodes(t,a,n);l.length&&(this.#a[c].find=!0,this.#n[c]=l),this.#a[c].dir=O,this.#a[c].filtered=h||!o,c++}}return[this.#a,this.#n]}_matchNodes(a){const[...e]=this.#a,c=e.length;let i=new Set;for(let t=0;t<c;t++){const{branch:n,dir:o,filtered:h,find:l}=e[t],s=n.length;if(s&&l){const r=this.#n[t],u=r.length,b=s-1;if(b===0){const{leaves:[,...k]}=n[0];if((a===L||a===$)&&this.#e.nodeType===f.ELEMENT_NODE)for(let p=0;p<u;p++){const g=r[p];if(g!==this.#e&&this.#e.contains(g)&&(i.add(g),a!==L))break}else if(k.length)for(let p=0;p<u;p++){const g=r[p];if((h||this._matchLeaves(k,g,{warn:this.#i}))&&(i.add(g),a!==L))break}else if(a===L)if(i.size){const p=[...i];i=new Set([...p,...r]),this.#o=!0}else i=new Set([...r]);else{const[p]=[...r];i.add(p)}}else if(o===C){let{combo:k,leaves:p}=n[0],g;for(let N=0;N<u;N++){const S=r[N];let d=new Set([S]);for(let m=1;m<s;m++){const{combo:w,leaves:_}=n[m],y=[];for(const E of d){const A={combo:k,leaves:_},D=this._matchCombinator(A,E,{dir:o,warn:this.#i});D.size&&y.push(...D)}if(y.length)if(m===b){if(a===L){if(i.size){const E=[...i];i=new Set([...E,...y])}else i=new Set([...y]);this.#o=!0}else{const[E]=(0,x.sortNodes)(y);i.add(E)}g=!0}else k=w,d=new Set(y),g=!1;else{g=!1;break}}if(g&&a!==L)break}if(!g&&a===$){const[N]=[...r];let S=this._findNode(p,{node:N});for(;S;){let d=new Set([S]);for(let m=1;m<s;m++){const{combo:w,leaves:_}=n[m],y=[];for(const E of d){const A={combo:k,leaves:_},D=this._matchCombinator(A,E,{dir:o,warn:this.#i});D.size&&y.push(...D)}if(y.length)if(m===b){const[E]=(0,x.sortNodes)(y);i.add(E),g=!0}else k=w,d=new Set(y),g=!1;else{g=!1;break}}if(g)break;S=this._findNode(p,{node:S}),d=new Set([S])}}}else{const{leaves:k}=n[b];let p;for(let g=0;g<u;g++){const N=r[g];let S=new Set([N]);for(let d=b-1;d>=0;d--){const m=n[d],w=[];for(const _ of S){const y=this._matchCombinator(m,_,{dir:o,warn:this.#i});y.size&&w.push(...y)}if(w.length)d===0?(i.add(N),p=!0,a===L&&s>1&&i.size>1&&(this.#o=!0)):(S=new Set(w),p=!1);else{p=!1;break}}if(p&&a!==L)break}if(!p&&a===$){const[g]=[...r];let N=this._findNode(k,{node:g});for(;N;){let S=new Set([N]);for(let d=b-1;d>=0;d--){const m=n[d],w=[];for(const _ of S){const y=this._matchCombinator(m,_,{dir:o,warn:this.#i});y.size&&w.push(...y)}if(w.length)d===0?(i.add(N),p=!0):(S=new Set(w),p=!1);else{p=!1;break}}if(p)break;N=this._findNode(k,{node:N}),S=new Set([N])}}}}}return i}_find(a){return this._collectNodes(a),this._matchNodes(a)}matches(a,e,c){let i;try{if(this.#e=this._setup(a,e,c),e.nodeType!==f.ELEMENT_NODE){const n=`Unexpected node ${e.nodeName}`;throw new TypeError(n)}i=this._find(P).size}catch(t){this._onError(t)}return!!i}closest(a,e,c){let i;try{if(this.#e=this._setup(a,e,c),e.nodeType!==f.ELEMENT_NODE){const n=`Unexpected node ${e.nodeName}`;throw new TypeError(n)}const t=this._find(M);if(t.size){let n=this.#e;for(;n;){if(t.has(n)){i=n;break}n=n.parentNode}}}catch(t){this._onError(t)}return i??null}querySelector(a,e,c){let i;try{this.#e=this._setup(a,e,c),this._prepareTreeWalkers(e);const t=this._find($);t.delete(this.#e),t.size&&([i]=(0,x.sortNodes)(t))}catch(t){this._onError(t)}return i??null}querySelectorAll(a,e,c){let i;try{this.#e=this._setup(a,e,c),this._prepareTreeWalkers(e);const t=this._find(L);t.delete(this.#e),t.size&&(this.#o?i=(0,x.sortNodes)(t):i=[...t])}catch(t){this._onError(t)}return i??[]}}0&&(module.exports={Finder});
//# sourceMappingURL=finder.js.map

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

var y=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var N=(t,e)=>{for(var c in e)y(t,c,{get:e[c],enumerable:!0})},_=(t,e,c,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of D(e))!C.call(t,r)&&r!==c&&y(t,r,{get:()=>e[r],enumerable:!(i=$(e,r))||i.enumerable});return t};var v=t=>_(y({},"__esModule",{value:!0}),t);var U={};N(U,{_matchAttributeSelector:()=>k,_matchClassSelector:()=>O,_matchIDSelector:()=>S,_matchTypeSelector:()=>L,matchPseudoElementSelector:()=>P,matchSelector:()=>R});module.exports=v(U);var T=require("./dom-util.js"),d=require("./parser.js"),a=require("./constant.js");const k=(t,e)=>{const{flags:c,matcher:i,name:r,value:h}=t;if(typeof c=="string"&&!/^[is]$/i.test(c)){const n=`Invalid selector ${(0,d.generateCSS)(t)}`;throw new DOMException(n,a.SYNTAX_ERR)}const{attributes:x}=e;let w;if(x&&x.length){const g=e.ownerDocument.contentType;let n;g==="text/html"?typeof c=="string"&&/^s$/i.test(c)?n=!1:n=!0:typeof c=="string"&&/^i$/i.test(c)?n=!0:n=!1;let u=(0,d.unescapeSelector)(r.name);n&&(u=u.toLowerCase());const f=new Set;if(u.indexOf("|")>-1){const{prefix:p,localName:m}=(0,d.parseAstName)(u);for(const s of x){let{name:o,value:l}=s;switch(n&&(o=o.toLowerCase(),l=l.toLowerCase()),p){case"":{m===o&&f.add(l);break}case"*":{o.indexOf(":")>-1?o.endsWith(`:${m}`)&&f.add(l):m===o&&f.add(l);break}default:if(o.indexOf(":")>-1){const[b,E]=o.split(":");if(b==="xml"&&E==="lang")continue;p===b&&m===E&&(0,T.isNamespaceDeclared)(p,e)&&f.add(l)}}}}else for(let{name:p,value:m}of x)if(n&&(p=p.toLowerCase(),m=m.toLowerCase()),p.indexOf(":")>-1){const[s,o]=p.split(":");if(s==="xml"&&o==="lang")continue;u===o&&f.add(m)}else u===p&&f.add(m);if(f.size){const{name:p,value:m}=h??{};let s;switch(p?n?s=p.toLowerCase():s=p:m?n?s=m.toLowerCase():s=m:m===""&&(s=m),i){case"=":{typeof s=="string"&&f.has(s)&&(w=e);break}case"~=":{if(s&&typeof s=="string"){for(const o of f)if(new Set(o.split(/\s+/)).has(s)){w=e;break}}break}case"|=":{if(s&&typeof s=="string"){let o;for(const l of f)if(l===s||l.startsWith(`${s}-`)){o=l;break}o&&(w=e)}break}case"^=":{if(s&&typeof s=="string"){let o;for(const l of f)if(l.startsWith(`${s}`)){o=l;break}o&&(w=e)}break}case"$=":{if(s&&typeof s=="string"){let o;for(const l of f)if(l.endsWith(`${s}`)){o=l;break}o&&(w=e)}break}case"*=":{if(s&&typeof s=="string"){let o;for(const l of f)if(l.includes(`${s}`)){o=l;break}o&&(w=e)}break}case null:default:w=e}}}return w??null},O=(t,e)=>{const c=(0,d.unescapeSelector)(t.name);let i;return e.classList.contains(c)&&(i=e),i??null},S=(t,e)=>{const c=(0,d.unescapeSelector)(t.name);let i;return c===e.id&&(i=e),i??null},L=(t,e,c={})=>{const i=(0,d.unescapeSelector)(t.name),{localName:r,namespaceURI:h,prefix:x}=e,{forgive:w}=c;let{prefix:g,localName:n}=(0,d.parseAstName)(i,e);e.ownerDocument.contentType==="text/html"&&(g=g.toLowerCase(),n=n.toLowerCase());let u,f;r.indexOf(":")>-1?[u,f]=r.split(":"):(u=x||"",f=r);let p;switch(g){case"":{u===""&&h===null&&(n==="*"||n===f)&&(p=e);break}case"*":{(n==="*"||n===f)&&(p=e);break}default:if((0,T.isNamespaceDeclared)(g,e))g===u&&(n==="*"||n===f)&&(p=e);else if(!w){const s=`Undeclared namespace ${g}`;throw new DOMException(s,a.SYNTAX_ERR)}}return p??null},R=(t,e,c)=>{if(!t||!t.type){const h=`Unexpected node ${Object.prototype.toString.call(t).slice(a.TYPE_FROM,a.TYPE_TO)}`;throw new TypeError(h)}else if(!e||!e.nodeType){const h=`Unexpected node ${Object.prototype.toString.call(e).slice(a.TYPE_FROM,a.TYPE_TO)}`;throw new TypeError(h)}else if(e.nodeType!==a.ELEMENT_NODE){const r=`Unexpected node ${e.nodeName}`;throw new TypeError(r)}let i;switch(t.type){case a.SELECTOR_ATTR:{i=k(t,e);break}case a.SELECTOR_CLASS:{i=O(t,e);break}case a.SELECTOR_ID:{i=S(t,e);break}case a.SELECTOR_TYPE:default:i=L(t,e,c)}return i},P=(t,e={})=>{if(!t||typeof t!="string"){const h=`Unexpected type ${Object.prototype.toString.call(t).slice(a.TYPE_FROM,a.TYPE_TO)}`;throw new TypeError(h)}const{forgive:c,warn:i}=e;switch(t){case"after":case"backdrop":case"before":case"cue":case"cue-region":case"first-letter":case"first-line":case"file-selector-button":case"marker":case"placeholder":case"selection":case"target-text":{if(i){const r=`Unsupported pseudo-element ::${t}`;throw new DOMException(r,a.NOT_SUPPORTED_ERR)}break}case"part":case"slotted":{if(i){const r=`Unsupported pseudo-element ::${t}()`;throw new DOMException(r,a.NOT_SUPPORTED_ERR)}break}default:if(t.startsWith("-webkit-")){if(i){const r=`Unsupported pseudo-element ::${t}`;throw new DOMException(r,a.NOT_SUPPORTED_ERR)}}else if(!c){const r=`Unknown pseudo-element ::${t}`;throw new DOMException(r,a.SYNTAX_ERR)}}};0&&(module.exports={_matchAttributeSelector,_matchClassSelector,_matchIDSelector,_matchTypeSelector,matchPseudoElementSelector,matchSelector});
var y=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var D=(t,e)=>{for(var f in e)y(t,f,{get:e[f],enumerable:!0})},v=(t,e,f,m)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of L(e))!S.call(t,o)&&o!==f&&y(t,o,{get:()=>e[o],enumerable:!(m=$(e,o))||m.enumerable});return t};var C=t=>v(y({},"__esModule",{value:!0}),t);var U={};D(U,{_matchAttributeSelector:()=>k,_matchTypeSelector:()=>O,matchPseudoElementSelector:()=>P,matchSelector:()=>N});module.exports=C(U);var T=require("./dom-util.js"),h=require("./parser.js"),i=require("./constant.js");const k=(t,e)=>{const{flags:f,matcher:m,name:o,value:w}=t;if(typeof f=="string"&&!/^[is]$/i.test(f)){const r=`Invalid selector ${(0,h.generateCSS)(t)}`;throw new DOMException(r,i.SYNTAX_ERR)}const{attributes:x}=e;let d;if(x&&x.length){const g=e.ownerDocument.contentType;let r;g==="text/html"?typeof f=="string"&&/^s$/i.test(f)?r=!1:r=!0:typeof f=="string"&&/^i$/i.test(f)?r=!0:r=!1;let u=(0,h.unescapeSelector)(o.name);r&&(u=u.toLowerCase());const n=new Set;if(u.indexOf("|")>-1){const{prefix:l,localName:p}=(0,h.parseAstName)(u);for(const s of x){let{name:a,value:c}=s;switch(r&&(a=a.toLowerCase(),c=c.toLowerCase()),l){case"":{p===a&&n.add(c);break}case"*":{a.indexOf(":")>-1?a.endsWith(`:${p}`)&&n.add(c):p===a&&n.add(c);break}default:if(a.indexOf(":")>-1){const[b,E]=a.split(":");if(b==="xml"&&E==="lang")continue;l===b&&p===E&&(0,T.isNamespaceDeclared)(l,e)&&n.add(c)}}}}else for(let{name:l,value:p}of x)if(r&&(l=l.toLowerCase(),p=p.toLowerCase()),l.indexOf(":")>-1){const[s,a]=l.split(":");if(s==="xml"&&a==="lang")continue;u===a&&n.add(p)}else u===l&&n.add(p);if(n.size){const{name:l,value:p}=w??{};let s;switch(l?r?s=l.toLowerCase():s=l:p?r?s=p.toLowerCase():s=p:p===""&&(s=p),m){case"=":{typeof s=="string"&&n.has(s)&&(d=e);break}case"~=":{if(s&&typeof s=="string"){for(const a of n)if(new Set(a.split(/\s+/)).has(s)){d=e;break}}break}case"|=":{if(s&&typeof s=="string"){let a;for(const c of n)if(c===s||c.startsWith(`${s}-`)){a=c;break}a&&(d=e)}break}case"^=":{if(s&&typeof s=="string"){let a;for(const c of n)if(c.startsWith(`${s}`)){a=c;break}a&&(d=e)}break}case"$=":{if(s&&typeof s=="string"){let a;for(const c of n)if(c.endsWith(`${s}`)){a=c;break}a&&(d=e)}break}case"*=":{if(s&&typeof s=="string"){let a;for(const c of n)if(c.includes(`${s}`)){a=c;break}a&&(d=e)}break}case null:default:d=e}}}return d??null},O=(t,e,f={})=>{const m=(0,h.unescapeSelector)(t.name),{localName:o,namespaceURI:w,prefix:x}=e,{forgive:d}=f;let{prefix:g,localName:r}=(0,h.parseAstName)(m,e);e.ownerDocument.contentType==="text/html"&&(g=g.toLowerCase(),r=r.toLowerCase());let u,n;o.indexOf(":")>-1?[u,n]=o.split(":"):(u=x||"",n=o);let l;switch(g){case"":{u===""&&w===null&&(r==="*"||r===n)&&(l=e);break}case"*":{(r==="*"||r===n)&&(l=e);break}default:if((0,T.isNamespaceDeclared)(g,e))g===u&&(r==="*"||r===n)&&(l=e);else if(!d){const s=`Undeclared namespace ${g}`;throw new DOMException(s,i.SYNTAX_ERR)}}return l??null},N=(t,e,f)=>{if(!t||!t.type){const w=`Unexpected node ${Object.prototype.toString.call(t).slice(i.TYPE_FROM,i.TYPE_TO)}`;throw new TypeError(w)}else if(!e||!e.nodeType){const w=`Unexpected node ${Object.prototype.toString.call(e).slice(i.TYPE_FROM,i.TYPE_TO)}`;throw new TypeError(w)}else if(e.nodeType!==i.ELEMENT_NODE){const o=`Unexpected node ${e.nodeName}`;throw new TypeError(o)}let m;switch(t.type){case i.SELECTOR_ATTR:{m=k(t,e);break}case i.SELECTOR_TYPE:default:m=O(t,e,f)}return m},P=(t,e={})=>{if(!t||typeof t!="string"){const w=`Unexpected type ${Object.prototype.toString.call(t).slice(i.TYPE_FROM,i.TYPE_TO)}`;throw new TypeError(w)}const{forgive:f,warn:m}=e;switch(t){case"after":case"backdrop":case"before":case"cue":case"cue-region":case"first-letter":case"first-line":case"file-selector-button":case"marker":case"placeholder":case"selection":case"target-text":{if(m){const o=`Unsupported pseudo-element ::${t}`;throw new DOMException(o,i.NOT_SUPPORTED_ERR)}break}case"part":case"slotted":{if(m){const o=`Unsupported pseudo-element ::${t}()`;throw new DOMException(o,i.NOT_SUPPORTED_ERR)}break}default:if(t.startsWith("-webkit-")){if(m){const o=`Unsupported pseudo-element ::${t}`;throw new DOMException(o,i.NOT_SUPPORTED_ERR)}}else if(!f){const o=`Unknown pseudo-element ::${t}`;throw new DOMException(o,i.SYNTAX_ERR)}}};0&&(module.exports={_matchAttributeSelector,_matchTypeSelector,matchPseudoElementSelector,matchSelector});
//# sourceMappingURL=matcher.js.map

@@ -62,3 +62,3 @@ {

},
"version": "3.0.3"
"version": "3.0.4"
}

@@ -14,4 +14,4 @@ /**

import {
ELEMENT_NODE, NOT_SUPPORTED_ERR, SELECTOR_ATTR, SELECTOR_CLASS, SELECTOR_ID,
SELECTOR_TYPE, SYNTAX_ERR, TYPE_FROM, TYPE_TO
ELEMENT_NODE, NOT_SUPPORTED_ERR, SELECTOR_ATTR, SELECTOR_TYPE, SYNTAX_ERR,
TYPE_FROM, TYPE_TO
} from './constant.js';

@@ -228,34 +228,2 @@

/**
* match class selector
* @private
* @param {object} ast - AST
* @param {object} node - Element node or structured clone
* @returns {?object} - matched node
*/
export const _matchClassSelector = (ast, node) => {
const astName = unescapeSelector(ast.name);
let res;
if (node.classList.contains(astName)) {
res = node;
}
return res ?? null;
};
/**
* match ID selector
* @private
* @param {object} ast - AST
* @param {object} node - Element node or structured clone
* @returns {?object} - matched node
*/
export const _matchIDSelector = (ast, node) => {
const astName = unescapeSelector(ast.name);
let res;
if (astName === node.id) {
res = node;
}
return res ?? null;
};
/**
* match type selector

@@ -348,10 +316,2 @@ * @private

}
case SELECTOR_CLASS: {
matched = _matchClassSelector(ast, node);
break;
}
case SELECTOR_ID: {
matched = _matchIDSelector(ast, node);
break;
}
case SELECTOR_TYPE:

@@ -358,0 +318,0 @@ default: {

export function _matchAttributeSelector(ast: object, node: object): object | null;
export function _matchClassSelector(ast: object, node: object): object | null;
export function _matchIDSelector(ast: object, node: object): object | null;
export function _matchTypeSelector(ast: object, node: object, opt?: {

@@ -5,0 +3,0 @@ forgive?: 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 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