import{isRule as e,isAtRule as t}from"../../utils/typeGuards.mjs";import{isString as s,isRegExp as i}from"../../utils/validateTypes.mjs";import o from"../../utils/findNodeUpToRoot.mjs";import r from"../../utils/isInDocument.mjs";import a from"../../utils/isStandardSyntaxDeclaration.mjs";import{nestingSupportedAtKeywords as m}from"../../reference/atKeywords.mjs";import n from"../../utils/optionsMatches.mjs";import l from"../../utils/report.mjs";import u from"../../utils/ruleMessages.mjs";import p from"../../utils/validateOptions.mjs";const d="no-invalid-position-declaration",f=u(d,{rejected:"Unexpected invalid position declaration"}),c=(u,c)=>(j,g)=>{if(!p(g,d,{actual:u,possible:[!0]},{actual:c,possible:{ignoreAtRules:[s,i]},optional:!0}))return;j.walkDecls(s=>{if(r(s))return;if(!a(s))return;const{parent:i}=s;if(i&&!e(i)){if(t(i)){const r=i.name.toLowerCase();if(!m.has(r))return;if(o(s,s=>e(s)||(e=>t(e)&&n(c,"ignoreAtRules",e.name))(s)))return}l({message:f.rejected,messageArgs:[],node:s,result:g,ruleName:d})}})};c.ruleName=d,c.messages=f,c.meta={url:"https://stylelint.io/user-guide/rules/no-invalid-position-declaration"};export{c as default};