import e from"../../../../../_virtual/index19.mjs";import{fontWeightRelativeKeywords as t,fontWeightNonNumericKeywords as o}from"../../reference/keywords.mjs";import{assertString as i}from"../../utils/validateTypes.mjs";import{declarationValueIndex as r}from"../../utils/nodeFieldIndices.mjs";import s from"../../utils/getDeclarationValue.mjs";import n from"../../utils/isNumbery.mjs";import a from"../../utils/isStandardSyntaxValue.mjs";import l from"../../utils/isVariable.mjs";import m from"../../utils/optionsMatches.mjs";import u from"../../utils/report.mjs";import c from"../../utils/ruleMessages.mjs";import f from"../../utils/setDeclarationValue.mjs";import p from"../../utils/validateOptions.mjs";const d="font-weight-notation",g=c(d,{expected:e=>`Expected ${e} font-weight notation`,expectedWithActual:(e,t)=>`Expected "${e}" to be "${t}"`}),h=new Map([["normal","400"],["bold","700"]]),x=new Map([["400","normal"],["700","bold"]]),w=(c,w)=>(b,y)=>{if(!p(y,d,{actual:c,possible:["numeric","named-where-possible"]},{actual:w,possible:{ignore:["relative"]},optional:!0}))return;const A=m(w,"ignore","relative");function M(e,s,m){const p=s.value;if(!a(p))return;if(l(p))return;const w=p.toLowerCase();if(A&&t.has(w))return;const j=t=>()=>{s.value=t,f(e,m.toString())};if("numeric"===c){if(!n(w)&&o.has(w)){const e=h.get(w);return e?v(g.expectedWithActual,[p,e],s,j(e)):v(g.expected,["numeric"],s,void 0),!0}}else if("named-where-possible"===c&&n(w)&&x.has(w)){const e=x.get(w);i(e);const t=j(e);return v(g.expectedWithActual,[p,e],s,t),!0}function v(t,o,i,s){const n=r(e)+i.sourceIndex,a=n+i.value.length;u({ruleName:d,result:y,message:t,messageArgs:o,node:e,index:n,endIndex:a,fix:{apply:s,node:e}})}}b.walkDecls(/^font(-weight)?$/i,t=>{const o="font"===t.prop.toLowerCase(),i=e(s(t)),r=i.nodes,a=r.some((e,t,o)=>n(e.value)&&!j(o[t-1]));for(const[e,s]of r.entries()){if(!v(s,e,r))continue;const{value:n}=s;if(o){if("normal"===n.toLowerCase()&&a)continue;if(M(t,s,i))break}M(t,s,i)}})};function j(e){return void 0!==e&&"div"===e.type}function v(e,t,o){return"word"===e.type&&(!j(o[t-1])&&!j(o[t+1]))}w.ruleName=d,w.messages=g,w.meta={url:"https://stylelint.io/user-guide/rules/font-weight-notation",fixable:!0};export{w as default};