import{isString as e,isRegExp as t}from"../../utils/validateTypes.mjs";import r from"../../utils/getRuleSelector.mjs";import s from"../../utils/isKeyframeSelector.mjs";import o from"../../utils/isStandardSyntaxRule.mjs";import l from"../../utils/isStandardSyntaxTypeSelector.mjs";import{mixedCaseSvgTypeSelectors as i}from"../../reference/selectors.mjs";import a from"../../utils/optionsMatches.mjs";import m from"../../utils/parseSelector.mjs";import u from"../../utils/report.mjs";import p from"../../utils/ruleMessages.mjs";import n from"../../utils/validateOptions.mjs";const c="selector-type-case",f=p(c,{expected:(e,t)=>`Expected "${e}" to be "${t}"`}),d=/(?:[^.#[:a-z-]|^)[a-z]/i,g=/[A-Z]/,j=/[a-z]/,x=(p,x)=>(y,S)=>{n(S,c,{actual:p,possible:["lower","upper"]},{actual:x,possible:{ignoreTypes:[e,t]},optional:!0})&&y.walkRules(e=>{const t=e.selector;if(!d.test(t))return;if("lower"===p&&!g.test(t))return;if("upper"===p&&!j.test(t))return;if(!o(e))return;if(e.selectors.some(s))return;const n=m(r(e),S,e);n&&n.walkTags(t=>{if(!l(t))return;if(i.has(t.value))return;if(a(x,"ignoreTypes",t.value))return;const r=t.sourceIndex,s=t.value,o="lower"===p?s.toLowerCase():s.toUpperCase();if(s===o)return;const m=r,d=r+s.length;u({message:f.expected,messageArgs:[s,o],node:e,index:m,endIndex:d,ruleName:c,result:S,fix:{apply:()=>{t.value=o,e.selector=n.toString()},node:e}})})})};x.ruleName=c,x.messages=f,x.meta={url:"https://stylelint.io/user-guide/rules/selector-type-case",fixable:!0};export{x as default};