define(["cilantro/rest/basext","jquery","underscore"],function(a,b,c){var d=a.extend({},{defargs:{target:null}}),e=d.extend({render:function(a,d){d=d?d:this.replace,d===!0&&this.target.html("");var e=[];if(this.bindData===!0)for(var f,g,h=0;h<a.length;h++)f=a[h],g=b(this.template(f)),g.data(f),e.push(g);else if(c.isArray(a)){var i=this;e=c.map(a,function(a){return c.isArray(a)?b(i.template({data:a})):b(i.template(a))})}else e=[b(this.template(a))];var j=this.target;return d==="prepend"?b.each(e.reverse(),function(){j.prepend(this)}):b.each(e,function(){j.append(this)}),this.target}},{defargs:{template:null,replace:!0,bindData:!1}});return{base:d,template:e}})