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