// Generated by LiveScript 1.2.0
(function(){
  var toString$ = {}.toString;
  module.exports = function(subject){
    this.subject = subject;
    return {
      clazz: function(){
        return camelCase(this.findClass() || '');
      },
      findClass: function(){
        var res;
        return res = (function(){
          switch (toString$.call(this.subject).slice(8, -1)) {
          case 'Object':
            return this.objectClass();
          case 'String':
            return this.subject();
          }
        }.call(this));
      },
      instance: function(){
        return this._instance || (this._instance = this.getInstance() || {});
      },
      getInstance: function(){
        if (this.oneKey()) {
          return this.outerValue();
        } else {
          return this.subject;
        }
      },
      outerValue: function(){
        return this.subject[this.firstKey()];
      },
      oneKey: function(){
        return Object.keys(this.subject).length === 1;
      },
      objectClass: function(){
        if (this.oneKey()) {
          return this.outerClass();
        } else {
          return this.innerClass();
        }
      },
      firstKey: function(){
        return Object.keys(this.subject)[0];
      },
      outerClass: function(){
        return this.firstKey();
      },
      innerClass: function(){
        return this.constructorName() || this.className();
      },
      className: function(){
        var i$, ref$, len$, key;
        for (i$ = 0, len$ = (ref$ = classKeys).length; i$ < len$; ++i$) {
          key = ref$[i$];
          if (this.subject[key]) {
            return true;
          }
        }
        return false;
      },
      constructorName: function(){
        if (!this.subject.constructor) {
          return;
        }
        if (this.subject.constructor.displayName) {
          return this.subject.constructor.displayName;
        }
      },
      classKeys: require('./globals').classKeys
    };
  };
}).call(this);
