     if modules
       React.createElement Aui.Module, { modules }, element
     else element
-  classify parent
+  classify element
 
 ## string[] `Aui.modules`
 # A whitelist of jQuery modules

  componentDidMount: -> @callModules @props.children.props
  componentWillReceiveProps: (props) -> @callModules props.children.props
  callModules: (props) ->
    for own module, args of props
      if (Array.isArray args) and (typeof jQuery.fn[module] is 'function') and (module in Aui.module)
        $element = jQuery React.findDOMNode @
        console.log $element[0]
        ($element)[module] args...
    return

window?.Aui = Aui
module?.exports = Aui

unless jQuery? then console.warn "Aui: window.jQuery not found, Modules and Semantic-UI will be disabled."
unless jQuery?.site?.settings?.modules? then console.warn 'Aui: No Semantic-UI window.jQuery.site.settings.modules found, Semantic will be disabled.'

## mixin Aui.Mixin
# Aui class is the main wrapper class
# it recursively goes through all it's children,
# finding props that === true or are on the `Aui.modules` list,
# and merges them into the className of each element.
AuiMixin =
  componentWillMount: ->
    render = @render
    @render = ->
      element = render?.apply? @, arguments
      if React.isValidElement element
        Aui.classify element, @props
      else
        Aui.classify (Aui.warning 'Aui.Mixin: Child is not a React.isValidElement', element), @props

## class <Aui/>
# A tag that applies the Aui.Mixin
Aui = React.createClass
  mixins: [AuiMixin]
  render: -> @props.children
Aui.Aui = Aui
Aui.Mixin = Aui.AuiMixin = AuiMixin

## function Aui.warning (string, element)
# console.warn a warning message
# returns the element wrapped in a warning span
Aui.warning = (message, element) ->
  console.warn message, element
  React.DOM.span { 'data-warning': message }, element

## object Aui.defaults
# The default options Aui uses when no options or props are passed in.
