"use strict";var e=require("@csstools/postcss-progressive-custom-properties"),o=require("@csstools/utilities"),t=require("@csstools/css-parser-algorithms"),i=require("@csstools/css-tokenizer"),n=require("@csstools/css-color-parser");const s=/(?:repeating-)?(?:linear|radial|conic)-gradient\(/i,r=/\bin\b/i,a={test:e=>s.test(e)&&r.test(e)},l=/^(repeating-)?(linear|radial|conic)-gradient$/i;function interpolateColorsInColorStopsList(e,o,s,r=!1){const a=[],l=[];for(let r=0;r0&&N.some((e=>!t.isCommentNode(e)))&&N.push(new t.TokenNode([i.TokenType.Comma,",",-1,-1,void 0]),new t.WhitespaceNode([[i.TokenType.Whitespace," ",-1,-1,void 0]])),trim([...N,...trim(g)])}function trim(e){let o=0,i=e.length-1;for(let i=0;i=0;o--)if(!t.isWhitespaceNode(e[o])){i=o;break}return e.slice(o,i+1)}const basePlugin=e=>({postcssPlugin:"postcss-gradients-interpolation-method",Declaration(n){if(!a.test(n.value))return;if(o.hasFallback(n))return;if(o.hasSupportsAtRuleAncestor(n,a))return;const s=i.tokenize({css:n.value}),r=t.stringify(t.replaceComponentValues(t.parseCommaSeparatedListOfComponentValues(s),(e=>{if(!t.isFunctionNode(e))return;const o=modifyGradientFunctionComponentValues(e);o&&(e.value=o)})));if(r===n.value)return;const l=t.stringify(t.replaceComponentValues(t.parseCommaSeparatedListOfComponentValues(s),(e=>{if(!t.isFunctionNode(e))return;const o=modifyGradientFunctionComponentValues(e,!0);o&&(e.value=o)})));n.cloneBefore({value:r}),r!==l&&n.cloneBefore({value:l}),e?.preserve||n.remove()}});basePlugin.postcss=!0;const postcssPlugin=o=>{const t=Object.assign({enableProgressiveCustomProperties:!0,preserve:!0},o);return t.enableProgressiveCustomProperties?{postcssPlugin:"postcss-gradients-interpolation-method",plugins:[e(),basePlugin(t)]}:basePlugin(t)};postcssPlugin.postcss=!0,module.exports=postcssPlugin;