// Generated by CoffeeScript 1.3.3 /* knockback-inspector.js 0.1.3 (c) 2012 Kevin Malakoff. Knockback-Inspector.js is freely distributable under the MIT license. See the following for full license details: https://github.com/kmalakoff/knockback-inspector/blob/master/LICENSE Dependencies: Knockout.js, Underscore.js, Backbone.js, and Knockback.js. */(function(){var e,t,n,r,i,s={}.hasOwnProperty,o=function(e,t){function r(){this.constructor=e}for(var n in t)s.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e};if(typeof require!="undefined")try{i=require("lodash")}catch(u){i=require("underscore")}else i=this._;i&&i.hasOwnProperty("_")&&(i=i._),e=!window.Backbone&&typeof require!="undefined"?require("backbone"):window.Backbone,r=!window.ko&&typeof require!="undefined"?require("knockout"):window.ko,t=!window.kb&&typeof require!="undefined"?require("knockback"):window.kb,n=this.kbi=typeof exports!="undefined"?exports:{},this.kbi.VERSION="0.1.3",n.TemplateSource=function(){function e(e,t){this.template_generator=e,this.binding_context=t!=null?t:{}}return e.prototype.data=function(e,t){return arguments.length===1?this.binding_context[e]:this.binding_context[e]=t},e.prototype.text=function(){if(arguments.length>0)throw"kbi.TemplateSource: unexpected writing to template source";return this.template_generator.viewText(this.binding_context)},e}(),n.TemplateEngine=function(e){function t(){this.allowTemplateRewriting=!1,this.generators={kbi_model_node:n.ModelNodeViewGenerator,kbi_collection_node:n.CollectionNodeViewGenerator}}return o(t,e),t.prototype.generator=function(e,t){return arguments.length===1?this.generators[e]:this.generators[e]=t},t.prototype.makeTemplateSource=function(e){return this.generators.hasOwnProperty(e)?new n.TemplateSource(new this.generators[e](e)):t.__super__.makeTemplateSource.apply(this,arguments)},t.prototype.renderTemplateSource=function(e,n,r){var i,s;for(i in n)s=n[i],e.data(i,s);return t.__super__.renderTemplateSource.apply(this,arguments)},t}(r.nativeTemplateEngine),n.FetchedModel=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return o(t,e),t.prototype.parse=function(e){var t,r,s,o,u;t={};for(s in e)u=e[s],i.isObject(u)?(o=new n.FetchedModel,t[s]=o.set(o.parse(u))):i.isArray(u)?(r=new n.FetchedCollection,t[s]=r.reset(r.parse(u))):t[s]=u;return t},t}(e.Model),n.FetchedCollection=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return o(t,e),t.prototype.model=n.FetchedModel,t.prototype.parse=function(e){var t;return t=e.results?e.results:e,i.map(e.results,function(e){var t;return t=new n.FetchedModel,t.set(t.parse(e))})},t}(e.Collection),n.NodeViewModel=function(){function e(e,n,s){var o;this.name=e,this.opened=r.observable(n),this.node=r.utils.unwrapObservable(s),this.node instanceof t.ViewModel&&(o=t.utils.wrappedModel(this.node),this.attribute_names=r.observableArray(o?i.keys(o.attributes):[])),this}return e.prototype.attributeType=function(e){var n;return n=this.node[e],r.utils.unwrapObservable(n)instanceof t.ViewModel?"model":t.utils.observableInstanceOf(n,t.CollectionAttributeConnector)?"collection":"simple"},e}(),n.nodeViewModel=n.nvm=function(e,t,r){return new n.NodeViewModel(e,t,r)},n.CollectionNodeViewGenerator=function(){function e(e){this.template_name=e}return e.prototype.viewText=function(e){return""+this.nodeStart(e)+"\n"+this.nodeManipulator(e)+"\n \n \n "+this.modelNode(e)+"\n \n \n"+this.nodeEnd(e)},e.prototype.nodeStart=function(e){return"
  • "},e.prototype.nodeManipulator=function(e){return"
    \n \n \n
    "},e.prototype.modelNode=function(e){return""+n.ViewHTML.modelTree("'['+$index()+']'",!1,"$data")},e.prototype.nodeEnd=function(e){return"
  • "},e}(),n.ModelNodeViewGenerator=function(){function e(e){this.template_name=e}return e.prototype.viewText=function(e){return""+this.nodeStart(e)+"\n"+this.nodeManipulator(e)+"\n \n \n \n "+this.attributeEditor(e)+"\n \n\n \n "+this.modelTree(e)+"\n \n\n \n "+this.modelTree(e)+"\n \n\n \n \n"+this.nodeEnd(e)},e.prototype.nodeStart=function(e){return"
  • "},e.prototype.nodeManipulator=function(e){return"
    \n \n \n
    "},e.prototype.attributeEditor=function(e){return"
    \n \n \n
    "},e.prototype.modelTree=function(e){return""+n.ViewHTML.modelTree("$data",!1,"$parent.node[$data]")},e.prototype.collectionTree=function(e){return""+n.ViewHTML.collectionTree("$data+'[]'",!0,"$parent.node[$data]")},e.prototype.nodeEnd=function(e){return"
  • "},e}(),n.ViewHTML=function(){function e(){}return e.modelTree=function(e,t,n){return"'},e.collectionTree=function(e){return"'},e}()}).call(this);