import e from"postcss-value-parser";function hasFallback(e){const r=e.parent;if(!r)return!1;const t=e.prop.toLowerCase(),s=r.index(e);for(let e=0;e<s;e++){const s=r.nodes[e];if("decl"===s.type&&s.prop.toLowerCase()===t)return!0}return!1}const r=/rebeccapurple/i,t=/^rebeccapurple$/i,creator=s=>{const o=Object.assign({preserve:!1},s);return{postcssPlugin:"postcss-color-rebeccapurple",Declaration(s){if(!r.test(s.value))return;if(hasFallback(s))return;const a=e(s.value);a.walk((e=>{"word"===e.type&&t.test(e.value)&&(e.value="#639")}));const c=String(a);c!==s.value&&(s.cloneBefore({value:c}),o.preserve||s.remove())}}};creator.postcss=!0;export{creator as default};
