function removeNestedCalc(value) {
    if (value.indexOf("calc(") >= 0) {
        var tokens = value.split(/([\(\)])/);
        var depth = 0;
        for (var i = 0; i < tokens.length; i++) {
            var token = tokens[i];
            switch (token) {
                case "(":
                    depth++;
                    break;
                case ")":
                    depth--;
                    break;
                default:
                    if (depth && token[0] === "0") {
                        tokens[i] = token.replace(/^0[a-z%]+ \+ /, "");
                    }
                    break;
            }
        }
        return tokens.join("").replace(/(?:calc)?\(([0-9\.]+[a-z%]+)\)/g, "$1");
    }
    return value;
}
Remove nested `calc(0px + *)` or `calc(* + (0px + *))` correctly.