import e from"../../../../../_virtual/index19.mjs";import{declarationValueIndex as t,atRuleParamIndex as r}from"../../utils/nodeFieldIndices.mjs";import{propertyRegexes as s,atRuleRegexes as a}from"../../utils/regexes.mjs";import{isRegExp as n,isString as o}from"../../utils/validateTypes.mjs";import{basicKeywords as i}from"../../reference/keywords.mjs";import m from"../../utils/isStandardSyntaxAtRule.mjs";import l from"../../utils/isStandardSyntaxDeclaration.mjs";import u from"../../utils/isStandardSyntaxValue.mjs";import d from"../../utils/report.mjs";import p from"../../utils/ruleMessages.mjs";import c from"../../utils/validateOptions.mjs";const f="container-name-pattern",x=p(f,{expected:(e,t)=>`Expected "${e}" to match pattern "${t}"`}),w=new Set(["and","or","none","not"]),g=p=>(g,j)=>{if(!c(j,f,{actual:p,possible:[n,o]}))return;const y=o(p)?new RegExp(p):p,S=j.stylelint.config?.languageOptions?.syntax?.cssWideKeywords??[],h=new Set([...i,...S]);function v(e,t,r){d({result:j,ruleName:f,message:x.expected,messageArgs:[t,p],node:r,index:e,endIndex:e+t.length})}g.walkDecls(s.containerNameAndShorthandName,r=>{if(!l(r))return;const s=e(r.value);let a=!1;s.walk(({sourceIndex:e,type:s,value:n})=>{if(!a){if("div"===s&&"/"===n&&(a=!0),"word"!==s)return!1;h.has(n.toLowerCase())||u(n)&&(y.test(n)||v(t(r)+e,n,r))}})}),g.walkAtRules(a.containerName,t=>{if(!m(t))return;const{params:s}=t;e(s).walk(({sourceIndex:e,type:s,value:a})=>{if("word"!==s)return!1;w.has(a.toLowerCase())||y.test(a)||v(r(t)+e,a,t)})})};g.ruleName=f,g.messages=x,g.meta={url:"https://stylelint.io/user-guide/rules/container-name-pattern"};export{g as default};