import{isString as t,isRegExp as e}from"../../utils/validateTypes.mjs";import{isAtRule as s}from"../../utils/typeGuards.mjs";import r from"../../utils/isStandardSyntaxAtRule.mjs";import i from"../../utils/isStandardSyntaxRule.mjs";import o from"../../utils/optionsMatches.mjs";import a from"../../utils/report.mjs";import m from"../../utils/ruleMessages.mjs";import l from"../../utils/validateOptions.mjs";const n="no-invalid-position-at-import-rule",u=m(n,{rejected:"Unexpected invalid position @import rule"}),p=(m,p)=>(d,f)=>{if(!l(f,n,{actual:m},{actual:p,possible:{ignoreAtRules:[t,e]},optional:!0}))return;let j=!1;d.walk(t=>{const e="name"in t&&t.name&&t.name.toLowerCase()||"";s(t)&&"charset"!==e&&"import"!==e&&"layer"!==e&&!o(p,"ignoreAtRules",t.name)&&r(t)||"rule"===t.type&&i(t)?j=!0:s(t)&&"import"===e&&j&&a({message:u.rejected,messageArgs:[],node:t,result:f,ruleName:n,word:t.toString()})})};p.ruleName=n,p.messages=u,p.meta={url:"https://stylelint.io/user-guide/rules/no-invalid-position-at-import-rule"};export{p as default};