"use strict";var e=require("postcss-selector-parser");const s=[" ",">","~",":","+","@","#","(",")"];function isValidReplacement(e){let n=!0;for(let t=0,l=s.length;t-1&&(n=!1);return n}const n="js-blank-pseudo",t=":blank",creator=s=>{const l=Object.assign({preserve:!0,replaceWith:"[blank]",disablePolyfillReadyClass:!1},s),r=e().astSync(l.replaceWith);return isValidReplacement(l.replaceWith)?{postcssPlugin:"css-blank-pseudo",prepare(){const s=new WeakSet;return{Rule(o,{result:a}){if(s.has(o))return;if(!o.selector.toLowerCase().includes(t))return;const i=o.selectors.flatMap((s=>{if(!s.toLowerCase().includes(t))return[s];let i;try{i=e().astSync(s)}catch(e){return o.warn(a,`Failed to parse selector : "${s}" with message: "${e.message}"`),[s]}if(void 0===i)return[s];let c=!1;if(i.walkPseudos((e=>{e.value.toLowerCase()===t&&(e.nodes&&e.nodes.length||(c=!0,e.replaceWith(r.clone({}))))})),!c)return[s];const d=i.clone();if(!l.disablePolyfillReadyClass){var u,p,f,g,m;if(null!=(u=i.nodes)&&null!=(p=u[0])&&null!=(f=p.nodes)&&f.length)for(let s=0;s{e.warn(s,`${l.replaceWith} is not a valid replacement since it can't be applied to single elements.`)}}};creator.postcss=!0,module.exports=creator;