import { addWhitespaceAroundMathOperators } from './math-operators'
export function decodeArbitraryValue(input: string): string {
if (input.startsWith('url(')) {
return input
}
input = convertUnderscoresToWhitespace(input)
input = addWhitespaceAroundMathOperators(input)
return input
}
function convertUnderscoresToWhitespace(input: string) {
let output = ''
for (let i = 0; i < input.length; i++) {
let char = input[i]
if (char === '\\' && input[i + 1] === '_') {
output += '_'
i += 1
}
else if (char === '_') {
output += ' '
}
else {
output += char
}
}
return output
}