import e from"../../../../../_virtual/index13.mjs";import{__require as t}from"../../utils/namespace.mjs";import{__require as r}from"../../utils/parseSelector.mjs";import{__require as n}from"../../utils/ruleUrl.mjs";var i,s;function o(){if(s)return i;s=1;const{utils:o}=e,a=t(),p=r(),u=n(),l=a("selector-nest-combinators"),c=o.ruleMessages(l,{expectedInterpolation:"Expected interpolation to be in a nested form",expected:(e,t)=>`Expected combinator "${e}" of type "${t}" to be in a nested form`,rejected:"Unexpected nesting found in selector"}),f={url:u(l)};function m(e){return(t,r)=>{if(!o.validateOptions(r,l,{actual:e,possible:["always","never"]}))return;const n=["attribute","class","id","pseudo","tag","universal"],i=/#{.+?}$/;t.walkRules(t=>{if(!t.parent||"atrule"!==t.parent.type||"keyframes"!==t.parent.name){if("string"==typeof t.selector){if(":"===t.selector.slice(-1))return}p(t.selector,r,t,s=>{s.walk(s=>{if("}"!==s.value){if("always"===e){if("selector"===s.type)return;if(s.parent&&"selector"===s.parent.type&&s.parent.parent&&"pseudo"===s.parent.parent.type)return;if(!s.prev())return;if(s.next()&&function(e){do{if("nesting"===(e=e.next()).type)return!0}while(e.next());return!1}(s))return;if("combinator"===s.type){if(s.next()&&!n.includes(s.next().type))return;if(!n.includes(s.prev().type))return}if(n.includes(s.type)&&!n.includes(s.prev().type))return;if("combinator"!==s.type&&!n.includes(s.type))return;const e=i.test(t.selector);if("combinator"!==s.type&&e)return;let a;return a=e?c.expectedInterpolation:c.expected(s.value,s.type),void o.report({ruleName:l,result:r,node:t,message:a,word:s.toString()})}if("never"!==e);else{if("root"===t.parent.type||"atrule"===t.parent.type)return;if("selector"!==s.type)return;o.report({ruleName:l,result:r,node:t,message:c.rejected,word:s.toString()})}}})})}})}}return m.ruleName=l,m.messages=c,m.meta=f,i=m}export{o as __require};