import e from"../../../../../_virtual/index19.mjs";import{atRuleParamIndex as t,declarationValueIndex as r}from"../../utils/nodeFieldIndices.mjs";import{isString as s,isRegExp as i}from"../../utils/validateTypes.mjs";import{atRuleRegexes as o}from"../../utils/regexes.mjs";import l from"../../utils/getDimension.mjs";import n from"../../utils/optionsMatches.mjs";import m from"../../utils/report.mjs";import u from"../../utils/ruleMessages.mjs";import a from"../../utils/validateObjectWithArrayProps.mjs";import p from"../../utils/validateOptions.mjs";const d="unit-allowed-list",c=u(d,{rejected:e=>`Unexpected unit "${e}"`}),f=(u,f)=>(g,j)=>{if(!p(j,d,{actual:u,possible:[s]},{optional:!0,actual:f,possible:{ignoreFunctions:[s,i],ignoreProperties:[a(s,i)]}}))return;const w=[u].flat();function x(t,r,s){r=r.replaceAll("*",","),e(r).walk(e=>{if("function"===e.type){const t=e.value.toLowerCase();if("url"===t)return!1;if(n(f,"ignoreFunctions",t))return!1}const{number:r,unit:i}=l(e);if(!r||!i||w.includes(i.toLowerCase()))return;if("prop"in t&&f&&n(f.ignoreProperties,i.toLowerCase(),t.prop))return;const o=s(t);m({index:o+e.sourceIndex+r.length,endIndex:o+e.sourceEndIndex,message:c.rejected,messageArgs:[i],node:t,result:j,ruleName:d})})}g.walkAtRules(o.mediaName,e=>x(e,e.params,t)),g.walkDecls(e=>x(e,e.value,r))};f.primaryOptionArray=!0,f.ruleName=d,f.messages=c,f.meta={url:"https://stylelint.io/user-guide/rules/unit-allowed-list"};export{f as default};