import{__require as e}from"../../../../postcss-value-parser/lib/index.mjs";import t from"../../../../../_virtual/index13.mjs";import{__require as r}from"../../utils/namespace.mjs";import{__require as n}from"../../utils/ruleUrl.mjs";import{__require as u}from"../../utils/validateTypes.mjs";var s,a;function i(){if(a)return s;a=1;const i=e(),{utils:l}=t,o=r(),c=n(),p=u(),m=o("dollar-variable-no-missing-interpolation"),f=l.ruleMessages(m,{rejected:(e,t)=>`Expected variable ${t} to be interpolated when using it with ${e}`}),d={url:c(m),fixable:!0},v=/([a-zA-Z0-9_-]+\.)?\$[a-zA-Z0-9_-]+/g,g=["animation","animation-name","counter-reset","counter-increment","list-style-type","will-change"],w=["counter-style","keyframes","supports"];function _(e){return"atrule"===e}function h(e){return e.prop&&e.prop.startsWith("--")}function x(e,t){let r=0,n=!1;for(let u=0;u<t;u++)"#"===e[u]&&"{"===e[u+1]?(r++,n=!0,u++):"}"===e[u]&&(r--,0===r&&(n=!1));return n&&r>0}function y(e){let t=e;const r=[...e.matchAll(v)];for(let n=r.length-1;n>=0;n--){const u=r[n],s=u[0],a=u.index;x(e,a)||(t=t.slice(0,a)+`#{${s}}`+t.slice(a+s.length))}return t}function $(e){return new RegExp(`(${e.join("|")})`)}function j(e,t,r,n){return function(e){return _(e.type)&&"supports"===e.name}(e)||function(e){return g.includes(e.prop)}(e)?r.includes(t):(function(e){return _(e.type)&&w.includes(e.name)}(e)||!!h(e))&&n.includes(t)}function k(e,t,r,n,u,s){if(r.has(e))return;let a=null;i(t).walk(r=>{const{value:s}=r;!function(e){return"word"!==e.type||!e.value}(r)&&j(e,s,n,u)&&(x(t,t.indexOf("$"))||a||(a=s))}),a&&(r.add(e),function(e,t,r){const{name:n,prop:u,type:s}=e,a=_(s)?`@${n}`:u;l.report({ruleName:m,result:r,node:e,message:f.rejected(a,t),word:t,fix:()=>{"atrule"===s?e.params=y(e.params):e.value=y(e.value)}})}(e,a,s))}function V(e){return(t,r)=>{if(!l.validateOptions(r,m,{actual:e}))return;const{stringValuedVars:n,allVars:u}=function(e){const t=[],r=[];function n(e){e.walkDecls(e=>{const{prop:n,value:u}=e;!r.includes(u)&&h(e)&&p.isDollarVar(u)?r.push(u):function(e){return e&&"$"===e[0]}(n)&&!r.includes(n)&&(function(e){return/^(["']).*(["'])$/.test(e)}(u)&&t.push(n),r.push(n))})}return n(e),e.walkRules(n),{stringValuedVars:t,allVars:r}}(t);if(0===u.length)return;const s=new Set;t.walkDecls($(g),e=>{k(e,e.value,s,n,u,r)}),t.walkAtRules($(w),e=>{k(e,e.params,s,n,u,r)}),t.walkDecls(e=>{h(e)&&k(e,e.value,s,n,u,r)})}}return V.ruleName=m,V.messages=f,V.meta=d,s=V}export{i as __require};