import{__require as e}from"../../../../postcss-value-parser/lib/index.mjs";import t from"../../../../../_virtual/index13.mjs";import{__require as r}from"../../utils/functions.mjs";import{__require as n}from"../../utils/namespace.mjs";import{__require as s}from"../../utils/validateTypes.mjs";import{__require as o}from"../../utils/ruleUrl.mjs";var i,u;function a(){if(u)return i;u=1;const a=e(),{utils:c}=t,{ALL_FUNCTIONS:l}=r(),m=n(),{isRegExp:p,isString:d}=s(),f=o(),w="function-no-unknown",_=m(w),v=c.ruleMessages(_,{rejected:e=>`Unexpected unknown function "${e}"`}),g={url:f(_)};function j(e){const t=e.match(/^(\w+)\.\w+$/);return t?t[1]:void 0}function k(e,t){return async(r,n)=>{if(!c.validateOptions(n,_,{actual:e},{actual:t,possible:{ignoreFunctions:[d,p]},optional:!0}))return;const s=t&&t.ignoreFunctions||[],o=l.concat(s),i=new Set(o),u=Object.assign({},t,{ignoreFunctions:o}),m=new Set;r.walkAtRules(/^use$/i,e=>{const{nodes:t}=a(e.params);m.add(function(e){if(function(e){const[t,r,n]=e.slice(-3);return"word"===t.type&&"as"===t.value&&"space"===r.type&&"word"===n.type}(e)){const[t]=e.slice(-1);return t.value}const[t]=e,r=t.value.split("/"),[n]=r.slice(-1);return n}(t))});const f=new Set;await c.checkAgainstRule({ruleName:w,ruleSettings:[e,u],root:r},e=>{const{node:t}=e;a(t.value).walk(r=>{const{type:s,value:o}=r;if("function"!==s||""===o.trim())return;const u=j(o);u&&m.has(u)||i.has(o)||(c.report({message:v.rejected(o),ruleName:_,result:n,node:t,word:o}),f.add(e))})}),0===f.size&&r.walkDecls(e=>{a(e.value).walk(t=>{const{type:r,value:s}=t;if("function"!==r||""===s.trim())return;const o=s.replace(/^#{/,""),u=j(o);u&&(m.has(u)||i.has(o)||c.report({message:v.rejected(o),ruleName:_,result:n,node:e,word:o}))})})}}return k.ruleName=_,k.messages=v,k.meta=g,i=k}export{a as __require};