var u=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var R=(e,t)=>{for(var r in t)u(e,r,{get:t[r],enumerable:!0})},S=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of v(t))!w.call(e,n)&&n!==r&&u(e,n,{get:()=>t[n],enumerable:!(o=x(t,n))||o.enumerable});return e};var C=e=>S(u({},"__esModule",{value:!0}),e);var W={};R(W,{parseConicGradient:()=>O,parseLinearGradient:()=>E,parseRadialGradient:()=>z});module.exports=C(W);function c(e,t=","){let r=[],o=0,n=0;t=new RegExp(t);for(let i=0;ie.endsWith(t))?{type:"angular",value:l(e)}:null}var k=new Set(["closest-corner","closest-side","farthest-corner","farthest-side"]),L=new Set(["center","left","top","right","bottom"]);function h(e){return k.has(e)}function y(e){return L.has(e)}function K(e){let t=Array(2).fill("");for(let r=0;r<2;r++)e[r]?t[r]=e[r]:t[r]="center";return t}function z(e){if(!/(repeating-)?radial-gradient/.test(e))throw new SyntaxError(`could not find syntax for this item: ${e}`);let[,t,r]=e.match(/(repeating-)?radial-gradient\((.+)\)/),o={shape:"ellipse",repeating:!!t,size:[{type:"keyword",value:"farthest-corner"}],position:{x:{type:"keyword",value:"center"},y:{type:"keyword",value:"center"}},stops:[]},n=c(r);if(G(n[0]))return{...o,stops:g(n)};let i=n[0].split("at").map(f=>f.trim()),p=((i[0]||"").match(/(circle|ellipse)/)||[])[1],a=(i[0]||"").match(/(-?\d+\.?\d*(vw|vh|px|em|rem|%|rad|grad|turn|deg)?|closest-corner|closest-side|farthest-corner|farthest-side)/g)||[],s=K((i[1]||"").split(" "));return p?o.shape=p:a.length===1&&!h(a[0])?o.shape="circle":o.shape="ellipse",a.length===0&&a.push("farthest-corner"),o.size=a.map(f=>h(f)?{type:"keyword",value:f}:{type:"length",value:l(f)}),o.position.x=y(s[0])?{type:"keyword",value:s[0]}:{type:"length",value:l(s[0])},o.position.y=y(s[1])?{type:"keyword",value:s[1]}:{type:"length",value:l(s[1])},(p||a.length>0||i[1])&&n.shift(),{...o,stops:g(n)}}function G(e){return/(circle|ellipse|at)/.test(e)?!1:/^(rgba?|hwb|hsl|lab|lch|oklab|color|#|[a-zA-Z]+)/.test(e)}var j=new Set(["from","in","at"]);function O(e){if(!/(repeating-)?conic-gradient/.test(e))throw new SyntaxError(`could not find syntax for this item: ${e}`);let[,t,r]=e.match(/(repeating-)?conic-gradient\((.+)\)/),o={angle:"0deg",repeating:!!t,position:"center",stops:[]},n=c(r).map(s=>s.trim()),i=c(n[0],/\s+/),p="",a=0;for(let s=0,f=i.length;s0&&Object.assign(o,m(p,i,a,s)),p=i[s],a=s+1);return p&&(Object.assign(o,m(p,i,a,i.length)),n.shift()),{...o,stops:g(n)}}function m(e,t,r,o){switch(e){case"from":return{angle:t.slice(r,o).join(" ")};case"at":return{position:t.slice(r,o).join(" ")};case"in":{let[n,...i]=t.slice(r,o);return{color:{space:n,method:i.length>0?i.join(" "):void 0}}}}}0&&(module.exports={parseConicGradient,parseLinearGradient,parseRadialGradient}); //# sourceMappingURL=index.cjs.map