import e from"../../../../_virtual/index19.mjs";import{basicKeywords as r,fontFamilyKeywords as t,fontShorthandKeywords as i,fontSizeKeywords as n}from"../reference/keywords.mjs";import{assert as s}from"./validateTypes.mjs";import a from"./isNumbery.mjs";import o from"./isStandardSyntaxValue.mjs";import u from"./isValidFontSize.mjs";import l from"./isVariable.mjs";const f=new Set(["word","string","space","div"]);const m=e=>"div"===e.type&&","===e.value;function p(p){const v=[],c=e(p),{nodes:d}=c;if(1===d.length&&d[0]&&r.has(d[0].value.toLowerCase()))return[d[0]];let y=!1,h=null;return c.walk((e,r,p)=>{if("function"===e.type)return!1;if(!f.has(e.type))return;const c=e.value.toLowerCase();if(!o(c))return;if(l(c))return;const d=t.has(c);if(!d&&i.has(c))return;if(!d&&u(e.value))return;const j=p[r+1],w=p[r-1],g=p[r-2],S=p.slice(0,r);if(d&&n.has(c)&&j&&!m(j)&&!S.find(m))return;if(w&&"/"===w.value&&g&&u(g.value))return;if(a(c))return;if(("space"===e.type||"div"===e.type&&","!==e.value)&&0!==v.length)return y=!0,void(h=e.value);if("space"===e.type||"div"===e.type)return;const x=e;if(y){const e=v[v.length-1];s(e),b=x,k=h,(V=e).value=V.value+k+b.value,y=!1,h=null}else v.push(x);var V,b,k}),v}export{p as default};