import{RULE_NAME_ALL as e}from"./constants.mjs";import s from"./utils/optionsMatches.mjs";import t from"./utils/putIfAbsent.mjs";import o from"./utils/reportCommentProblem.mjs";import n from"./validateDisableSettings.mjs";function i(i){const[d,a]=n(i,"reportNeedlessDisables");if(!a)return;const{disabledRanges:f,disabledRanges:{[e]:l=[]},disabledWarnings:c=[]}=i.stylelint,m=new Map;for(const e of c){const s=e.rule,o=f[s];if(o)for(const n of o)r(e,n)&&t(m,n.node,()=>new Set).add(s);for(const o of l)r(e,o)&&t(m,o.node,()=>new Set).add(s)}const p=new Set(l.map(e=>e.node));for(const[t,n]of Object.entries(f))for(const r of n){const n=r.node;if(t!==e&&p.has(n))continue;if(d===s(a,"except",t))continue;const f=m.get(n)||new Set;(t===e?0!==f.size:f.has(t))||o({rule:"--report-needless-disables",message:`Needless disable for "${t}"`,severity:a.severity,node:n,postcssResult:i})}}function r(e,s){const t=e.line;return s.start<=t&&(void 0!==s.end&&s.end>=t||void 0===s.end)}export{i as default};