/* @flow */
import isPlainObject from 'isobject'

function addImportantToValue(value: any): any {
  if (
    typeof value === 'number' ||
    (typeof value === 'string' &&
      value.toLowerCase().indexOf('!important') === -1)
  ) {
    return `${value}!important`
  }

  return value
}

function isAnimation(style: Object): boolean {
  const styleNames = Object.getOwnPropertyNames(style)
  let isAnimationItem = false

  for (let i = 0; i < styleNames.length; i++) {
    const property = styleNames[i].toString()

    isAnimationItem =
      property === 'to' ||
      property.includes('from') ||
      property.includes('animation') ||
      property.includes('%')
  }

  return isAnimationItem
}

function addImportant(style: Object): Object {
  if (!isAnimation(style)) {
    for (const property in style) {
      const value = style[property]

      if (isPlainObject(value)) {
        style[property] = addImportant(value)
      } else if (Array.isArray(value)) {
        style[property] = value.map(addImportantToValue)
      } else {
        style[property] = addImportantToValue(value)
      }
    }
  }

  return style
}

export default () => addImportant

@@ -844,22 +844,135 @@
 operty%5D%0A
-%0A
      
+ if (property === 'className') %7B%0A        // this is a fixed classname, not a style rule - leave as is%0A      %7D else
  if (isP

check for className property