import e from"../../../../../_virtual/index20.mjs";import t from"../../utils/flattenNestedSelectorsForRule.mjs";import s from"../../utils/getStrippedSelectorSource.mjs";import r from"../../utils/isNonNegativeInteger.mjs";import o from"../../utils/isStandardSyntaxRule.mjs";import{isString as i}from"../../utils/validateTypes.mjs";import l from"../../utils/optionsMatches.mjs";import m from"../../utils/report.mjs";import a from"../../utils/ruleMessages.mjs";import n from"../../utils/validateOptions.mjs";const{isSelector:u}=e,p="selector-max-universal",c=a(p,{expected:(e,t)=>`Expected "${e}" to have no more than ${t} universal ${1===t?"selector":"selectors"}`}),d=(e,a)=>(d,f)=>{n(f,p,{actual:e,possible:r},{actual:a,possible:{ignoreAfterCombinators:[i]},optional:!0})&&d.walkRules(r=>{o(r)&&t(r,f).forEach(({selector:t,resolvedSelectors:o})=>{o.walk(o=>{u(o)&&function(t,r,o){if(t.reduce((e,t)=>{const s=t.prev(),r=s&&s.value;return"universal"===t.type&&(l(a,"ignoreAfterCombinators",r)||(e+=1)),e},0)>e){const{index:t,endIndex:i,selector:l}=s(r);m({ruleName:p,result:f,node:o,message:c.expected,messageArgs:[l,e],index:t,endIndex:i})}}(o,t,r)})})})};d.ruleName=p,d.messages=c,d.meta={url:"https://stylelint.io/user-guide/rules/selector-max-universal"};export{d as default};