import e from"../../../../../_virtual/index19.mjs";import{atRuleRegexes as t}from"../../utils/regexes.mjs";import{declarationValueIndex as r}from"../../utils/nodeFieldIndices.mjs";import n from"../../utils/isVarFunction.mjs";import s from"../../utils/report.mjs";import o from"../../utils/ruleMessages.mjs";import i from"../../utils/validateOptions.mjs";const a="custom-property-no-missing-var-function",l=o(a,{rejected:e=>`Unexpected missing var function for "${e}"`}),u=new Set(["animation","animation-name","container-name","counter-increment","counter-reset","counter-set","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","list-style","list-style-type","transition","transition-property","view-transition-name","will-change"]),m=o=>(m,d)=>{if(!i(d,a,{actual:o}))return;const p=new Set;function f(e,t){if("function"===e.type){const r=e.value.toLowerCase();let s=e.nodes;if("var"===r)s=e.nodes.slice(1);else if("running"===r){const[t]=e.nodes;if(!(t&&n(t)))return;s=t.nodes.slice(1)}else if("style"===r){let r=!1;return void e.nodes.forEach(e=>{"div"===e.type&&":"===e.value?r=!0:!r&&c(e)||r&&f(e,t)})}return void s.forEach(e=>f(e,t))}if(!c(e))return;const o=e.value.replace(/;+$/,"");if(!p.has(o))return;const i=r(t)+e.sourceIndex,u=i+o.length;s({message:l.rejected,messageArgs:[o],node:t,index:i,endIndex:u,result:d,ruleName:a})}m.walkAtRules(t.propertyName,({params:e})=>{p.add(e)}),m.walkDecls(/^--/,({prop:e})=>{p.add(e)}),m.walkDecls(t=>{const{prop:r,value:n}=t;n.includes("--")&&(u.has(r.toLowerCase())||e(n).nodes.forEach(e=>{f(e,t)}))})};function c({type:e,value:t}){return"word"===e&&t.startsWith("--")}m.ruleName=a,m.messages=l,m.meta={url:"https://stylelint.io/user-guide/rules/custom-property-no-missing-var-function"};export{m as default};