import{__rest as t,__assign as r,__read as e}from"../../../../../node_modules/tslib/tslib.es6.js";import{invariant as n}from"../../../../../../hey-listen/dist/hey-listen.es.js";function a(t){return"string"==typeof t&&t.startsWith("var(--")}var i=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function o(t){var r=i.exec(t);if(!r)return[,];var n=e(r,3);return[n[1],n[2]]}function s(t,r,i){void 0===i&&(i=1),n(i<=4,'Max CSS variable fallback depth detected in property "'+t+'". This may indicate a circular fallback dependency.');var f=e(o(t),2),l=f[0],u=f[1];if(l){var c=window.getComputedStyle(r).getPropertyValue(l);return c?c.trim():a(u)?s(u,r,i+1):u}}function f(e,n,i){var o,f=t(n,[]),l=e.getInstance();if(!(l instanceof HTMLElement))return{target:f,transitionEnd:i};for(var u in i&&(i=r({},i)),e.forEachValue((function(t){var r=t.get();if(a(r)){var e=s(r,l);e&&t.set(e)}})),f){var c=f[u];if(a(c)){var v=s(c,l);v&&(f[u]=v,i&&(null!==(o=i[u])&&void 0!==o||(i[u]=c)))}}return{target:f,transitionEnd:i}}export{i as cssVariableRegex,o as parseCSSVariable,f as resolveCSSVariables};
//# sourceMappingURL=css-variables-conversion.js.map
