import e from"../../../../../_virtual/index19.mjs";import{declarationValueIndex as t}from"../../utils/nodeFieldIndices.mjs";import r from"../../utils/functionArgumentsSearch.mjs";import n from"../../utils/isStandardSyntaxValue.mjs";import i from"../../utils/report.mjs";import s from"../../utils/ruleMessages.mjs";import o from"../../utils/validateOptions.mjs";import a from"../../utils/vendor.mjs";const u="function-linear-gradient-no-nonstandard-direction",d=s(u,{rejected:"Unexpected nonstandard direction"}),m="(?:-webkit-|-moz-|-o-|-ms-)?linear-gradient",l=new RegExp(`${m}\\(`,"i"),c=new RegExp(`^${m}$`,"i"),f=/top|left|bottom|right/i,g=new RegExp(`^to (${f.source})(?: (${f.source}))?$`,"i"),p=new RegExp(`^(${f.source})(?: (${f.source}))?$`,"i"),x=/[\d.]/,j=/^[\d.]+(?:deg|grad|rad|turn)$/,$=/\bin\b/i;const h=s=>(m,h)=>{o(h,u,{actual:s})&&m.walkDecls(s=>{l.test(s.value)&&e(s.value).walk(o=>{"function"===o.type&&r(e.stringify(o).toLowerCase(),c,(e,r)=>{const m=e.split(","),l=(m[0]||"").trim();if(!n(l))return;if(l.startsWith("var("))return;if($.test(l))return;if(x.test(l.charAt(0))){if(j.test(l))return;return void c()}if(!f.test(l))return;function c(){const e=t(s)+o.sourceIndex+r,n=e+(m[0]||"").trimEnd().length;i({message:d.rejected,messageArgs:[],node:s,index:e,endIndex:n,result:h,ruleName:u})}(function(e,t){const r=t?g:p,n=e.match(r);return!!n&&(2===n.length||3===n.length&&n[1]!==n[2])})(l,!a.prefix(o.value))||c()})})})};h.ruleName=u,h.messages=d,h.meta={url:"https://stylelint.io/user-guide/rules/function-linear-gradient-no-nonstandard-direction"};export{h as default};