import t from"../../../../../_virtual/index19.mjs";import{atRuleParamIndex as e,declarationValueIndex as r}from"../../utils/nodeFieldIndices.mjs";import{isValueFunction as i,isValueWord as o}from"../../utils/typeGuards.mjs";import{isString as n,isRegExp as s}from"../../utils/validateTypes.mjs";import u from"../../utils/getAtRuleParams.mjs";import l from"../../utils/getDeclarationValue.mjs";import m from"../../utils/isCustomProperty.mjs";import a from"../../utils/isMathFunction.mjs";import f from"../../utils/isStandardSyntaxAtRule.mjs";import c from"../../utils/isStandardSyntaxDeclaration.mjs";import{lengthUnits as p}from"../../reference/units.mjs";import d from"../../utils/optionsMatches.mjs";import g from"../../utils/report.mjs";import j from"../../utils/ruleMessages.mjs";import h from"../../utils/setAtRuleParams.mjs";import x from"../../utils/setDeclarationValue.mjs";import w from"../../utils/validateOptions.mjs";const y="length-zero-no-unit",v=j(y,{rejected:"Unexpected unit"}),A=(j,A)=>(C,R)=>{function S(e,r,n,s){const{value:u,sourceIndex:l}=n;if(a(n))return!1;if(i(n)&&d(A,"ignoreFunctions",u))return!1;if(!o(n))return;const m=t.unit(u);if(!1===m)return;const{number:f,unit:c}=m;if(!function(t){return 0===Number.parseFloat(t)}(f))return;if(function(t){return""===t}(c))return;if(!function(t){return p.has(t.toLowerCase())}(c))return;if(function(t){return"fr"===t.toLowerCase()}(c))return;const j=r+l+f.length,w=j+c.length;g({index:j,endIndex:w,message:v.rejected,messageArgs:[],node:e,result:R,ruleName:y,fix:{apply:()=>{switch(n.value=f.startsWith(".")?f.slice(1):f,e.type){case"atrule":h(e,s.toString());break;case"decl":x(e,s.toString())}},node:e}})}w(R,y,{actual:j},{actual:A,possible:{ignore:["custom-properties"],ignoreFunctions:[n,s],ignorePreludeOfAtRules:[n,s]},optional:!0})&&(C.walkAtRules(function(r){if(!f(r))return;if(d(A,"ignorePreludeOfAtRules",r.name))return;const i=e(r),o=t(u(r));o.walk(t=>S(r,i,t,o))}),C.walkDecls(function(e){const{prop:i}=e;if(!c(e))return;if(function(t){return"line-height"===t.toLowerCase()}(i))return;if(function(t){return"flex"===t.toLowerCase()}(i))return;if(d(A,"ignore","custom-properties")&&m(i))return;const o=r(e),n=t(l(e));n.walk((t,r,i)=>{if(!function({prop:t},e,r){const i=e[r-1];return"font"===t.toLowerCase()&&i&&"div"===i.type&&"/"===i.value}(e,i,r))return S(e,o,t,n)})}))};A.ruleName=y,A.messages=v,A.meta={url:"https://stylelint.io/user-guide/rules/length-zero-no-unit",fixable:!0};export{A as default};