import{isString as e,isRegExp as t}from"../../utils/validateTypes.mjs";import r from"../../utils/isStandardSyntaxAtRule.mjs";import{atRuleParamIndex as s}from"../../utils/nodeFieldIndices.mjs";import i from"../../utils/getLexer.mjs";import l from"../../utils/optionsMatches.mjs";import o from"../../utils/report.mjs";import a from"../../utils/ruleMessages.mjs";import u from"../../utils/validateOptions.mjs";const m="at-rule-prelude-no-invalid",n=a(m,{rejected:(e,t)=>`Unexpected invalid prelude "${t}" for at-rule "${e}"`}),d=(a,d,p)=>(f,c)=>{u(c,m,{actual:a},{actual:d,possible:{ignoreAtRules:[e,t]},optional:!0})&&f.walkAtRules(e=>{if(!r(e))return;const{name:t,params:a}=e;if(l(d,"ignoreAtRules",t))return;const u=i(p),{error:f}=u.matchAtrulePrelude(t,a);if(!f)return;if("SyntaxMatchError"!==f.name)return;const g=`@${t}`,j=s(e),x=j+a.length;o({message:n.rejected,messageArgs:[g,a],node:e,index:j,endIndex:x,ruleName:m,result:c})})};d.ruleName=m,d.messages=n,d.meta={url:"https://stylelint.io/user-guide/rules/at-rule-prelude-no-invalid"};export{d as default};