/**
 * Serenade.js JavaScript Framework v0.2.1
 * http://github.com/elabs/serenade.js
 *
 * Copyright 2011, Jonas Nicklas, Elabs AB
 * Released under the MIT License
 */
(function(){var e=this,t=function(){function t(e){return t[e]}return t["./events"]=new function(){var e=this;(function(){var t=[].slice;e.Events={bind:function(e,t){var n,r,i,s,o;r=e.split(" "),n=this.hasOwnProperty("_callbacks")&&this._callbacks||(this._callbacks={});for(s=0,o=r.length;s<o;s++)i=r[s],n[i]||(n[i]=[]),n[i].push(t);return this},one:function(e,t){return this.bind(e,function(){return this.unbind(e,arguments.callee),t.apply(this,arguments)})},trigger:function(){var e,n,r,i,s,o,u;e=1<=arguments.length?t.call(arguments,0):[],r=e.shift(),i=this.hasOwnProperty("_callbacks")&&((u=this._callbacks)!=null?u[r]:void 0);if(!i)return!1;for(s=0,o=i.length;s<o;s++)n=i[s],n.apply(this,e);return!0},unbind:function(e,t){var n,r,i,s,o,u;if(!e)return this._callbacks={},this;i=(u=this._callbacks)!=null?u[e]:void 0;if(!i)return this;if(!t)return delete this._callbacks[e],this;for(r=s=0,o=i.length;s<o;r=++s){n=i[r];if(n!==t)continue;i=i.slice(),i.splice(r,1),this._callbacks[e]=i;break}return this}}}).call(this)},t["./helpers"]=new function(){var e=this;(function(){var t,n={}.hasOwnProperty;t={extend:function(e,t){var r,i,s;s=[];for(r in t){if(!n.call(t,r))continue;i=t[r],s.push(e[r]=i)}return s},get:function(e,t,n){return typeof (e!=null?e.get:void 0)=="function"?e.get(t,n):e!=null?e[t]:void 0},set:function(e,t,n){return(e!=null?e.set:void 0)?e.set(t,n):e[t]=n},isArray:function(e){return Object.prototype.toString.call(e)==="[object Array]"},indexOf:function(e,t){var n,r,i,s;if(typeof Array.prototype.indexOf=="function")return Array.prototype.indexOf.call(e,t);for(n=i=0,s=e.length;i<s;n=++i){r=e[n];if(r===t)return n}return-1},pairToObject:function(e,t){var n;return n={},n[e]=t,n},serializeObject:function(e){var n,r,i,s;if(e&&typeof e.serialize=="function")return e.serialize();if(t.isArray(e)){s=[];for(r=0,i=e.length;r<i;r++)n=e[r],s.push(t.serializeObject(n));return s}return e},getFunctionName:function(e){var t,n,r;return t=e.modelName,t||(t=e.name),t||(t=(n=e.toString().match(/\[object (.+?)\]/))!=null?n[1]:void 0),t||(t=(r=e.toString().match(/function (.+?)\(\)/))!=null?r[1]:void 0),t},preventDefault:function(e){return e.preventDefault?e.preventDefault():e.returnValue=!1}},t.extend(e,t)}).call(this)},t["./cache"]=new function(){var e=this;(function(){var n,r,i,s;s=t("./helpers"),i=s.serializeObject,r=s.getFunctionName,n={_storage:typeof window!="undefined"&&window!==null?window.localStorage:void 0,_identityMap:{},get:function(e,t){var n,i;n=r(e);if(n&&t)return((i=this._identityMap[n])!=null?i[t]:void 0)||this.retrieve(e,t)},set:function(e,t,n){var i,s;i=r(e);if(i&&t)return(s=this._identityMap)[i]||(s[i]={}),this._identityMap[i][t]=n},store:function(e,t,n){var s;s=r(e);if(s&&t&&typeof JSON!="undefined"&&JSON!==null)return this._storage.setItem(""+s+"_"+t,JSON.stringify(i(n)))},retrieve:function(e,t){var n,i;i=r(e);if(i&&t&&e.localStorage&&typeof JSON!="undefined"&&JSON!==null){n=this._storage.getItem(""+i+"_"+t);if(n)return new e(JSON.parse(n),!0)}}},e.Cache=n}).call(this)},t["./collection"]=new function(){var e=this;(function(){var n,r,i,s,o,u,a,f,l=[].slice;n=t("./events").Events,f=t("./helpers"),o=f.indexOf,r=f.extend,a=f.serializeObject,i=f.get,u=function(e){return e.match(/^\d+$/)},s=function(e){var t,n,r;return n=function(){var n;n=[];for(t in e)r=e[t],u(t)&&n.push(parseInt(t,10));return n}(),n.length?Math.max.apply(Math,n)+1:0},e.Collection=function(){function e(e){var t,n,r,i;for(t=r=0,i=e.length;r<i;t=++r)n=e[t],this[t]=n;this.length=s(this)}return r(e.prototype,n),e.prototype.get=function(e){return this[e]},e.prototype.set=function(e,t){return this[e]=t,this.length=s(this),this.trigger("change:"+e,t),this.trigger("set",e,t),this.trigger("change",this),t},e.prototype.push=function(e){return this[this.length]=e,this.length=s(this),this.trigger("add",e),this.trigger("change",this),e},e.prototype.pop=function(){return this.deleteAt(this.length-1)},e.prototype.unshift=function(e){return this.insertAt(0,e)},e.prototype.shift=function(){return this.deleteAt(0)},e.prototype.update=function(e){var t,n,r,i,o,a;n=this.clone();for(t in this)i=this[t],u(t)&&delete this[t];for(t=o=0,a=e.length;o<a;t=++o)r=e[t],this[t]=r;return this.length=s(this),this.trigger("update",n,this),this.trigger("change",this),e},e.prototype.splice=function(){var t,n,r,i,o;return o=arguments[0],t=arguments[1],r=3<=arguments.length?l.call(arguments,2):[],i=this.clone(),n=Array.prototype.splice.apply(this,[o,t].concat(l.call(r))),this.length=s(this),this.trigger("update",i,this),this.trigger("change",this),new e(n)},e.prototype.sort=function(e){var t;return t=this.clone(),Array.prototype.sort.call(this,e),this.trigger("update",t,this),this.trigger("change",this),this},e.prototype.sortBy=function(e){return this.sort(function(t,n){return i(t,e)<i(n,e)?-1:1})},e.prototype.reverse=function(){var e;return e=this.clone(),Array.prototype.reverse.call(this),this.trigger("update",e,this),this.trigger("change",this),this},e.prototype.forEach=function(e){return typeof Array.prototype.forEach=="function"?Array.prototype.forEach.call(this,e):(this.map(e),void 0)},e.prototype.map=function(t){var n,r;return typeof Array.prototype.map=="function"?new e(Array.prototype.map.call(this,t)):new e(function(){var e,i,s;s=[];for(r=e=0,i=this.length;e<i;r=++e)n=this[r],s.push(t(n,r));return s}.call(this))},e.prototype.indexOf=function(e){return o(this,e)},e.prototype.lastIndexOf=function(e){var t,n,r;return typeof Array.prototype.lastIndexOf=="function"?Array.prototype.lastIndexOf.call(this,e):(r=function(){var r,i,s;s=[];for(t=r=0,i=this.length;r<i;t=++r)n=this[t],n===e&&s.push(t);return s}.call(this).pop(),r!=null?r:-1)},e.prototype.includes=function(e){return this.indexOf(e)>=0},e.prototype.find=function(e){var t,n,r;for(n=0,r=this.length;n<r;n++){t=this[n];if(e(t))return t}},e.prototype.insertAt=function(e,t){return Array.prototype.splice.call(this,e,0,t),this.length=s(this),this.trigger("insert",e,t),this.trigger("change",this),t},e.prototype.deleteAt=function(e){var t;return t=this[e],Array.prototype.splice.call(this,e,1),this.length=s(this),this.trigger("delete",e,t),this.trigger("change",this),t},e.prototype["delete"]=function(e){var t;t=this.indexOf(e);if(t!==-1)return this.deleteAt(t)},e.prototype.serialize=function(){return a(this.toArray())},e.prototype.filter=function(t){var n;return typeof Array.prototype.filter=="function"?new e(Array.prototype.filter.call(this,t)):new e(function(){var e,r,i;i=[];for(e=0,r=this.length;e<r;e++)n=this[e],t(n)&&i.push(n);return i}.call(this))},e.prototype.join=function(){var e;return e=1<=arguments.length?l.call(arguments,0):[],Array.prototype.join.apply(this,e)},e.prototype.toString=function(){return this.toArray().toString()},e.prototype.toLocaleString=function(){return this.toArray().toLocaleString()},e.prototype.concat=function(){var t,n;return t=1<=arguments.length?l.call(arguments,0):[],new e((n=this.toArray()).concat.apply(n,t))},e.prototype.slice=function(){var t,n;return t=1<=arguments.length?l.call(arguments,0):[],new e((n=this.toArray()).slice.apply(n,t))},e.prototype.every=function(e){var t,n,r;if(typeof Array.prototype.every=="function")return Array.prototype.every.call(this,e);for(n=0,r=this.length;n<r;n++){t=this[n];if(!e(t))return!1}return!0},e.prototype.some=function(e){var t,n,r;if(typeof Array.prototype.some=="function")return Array.prototype.some.call(this,e);for(n=0,r=this.length;n<r;n++){t=this[n];if(e(t))return!0}return!1},e.prototype.reduce=function(e,t){var n,r,i,s,o;if(typeof Array.prototype.reduce=="function")return Array.prototype.reduce.apply(this,arguments);n=t?t:this[0];for(r=s=0,o=this.length;s<o;r=++s){i=this[r];if(t||r!==0)n=e(n,i,r,this)}return n},e.prototype.reduceRight=function(e,t){var n,r,i,s,o,u;if(typeof Array.prototype.reduceRight=="function")return Array.prototype.reduceRight.apply(this,arguments);s=this.toArray().reverse(),n=t?t:s[0];for(r=o=0,u=s.length;o<u;r=++o){i=s[r];if(t||r!==0)n=e(n,i,s.length-r-1,this)}return n},e.prototype.first=function(){return this[0]},e.prototype.last=function(){return this[this.length-1]},e.prototype.toArray=function(){var e,t,n;e=[];for(t in this)n=this[t],u(t)&&(e[t]=n);return e},e.prototype.toJSON=function(){return this.serialize()},e.prototype.clone=function(){return new e(this.toArray())},e.prototype._useDefer=!0,e}()}).call(this)},t["./association_collection"]=new function(){var e=this;(function(){var n,r,i={}.hasOwnProperty,s=function(e,t){function r(){this.constructor=e}for(var n in t)i.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e};r=t("./collection").Collection,n=function(e){function t(e,n){var r;this.ctor=e,t.__super__.constructor.call(this,function(){var e,t,i;i=[];for(e=0,t=n.length;e<t;e++)r=n[e],i.push(this._convert(r));return i}.call(this))}return s(t,e),t.prototype.set=function(e,n){return t.__super__.set.call(this,e,this._convert(n))},t.prototype.push=function(e){return t.__super__.push.call(this,this._convert(e))},t.prototype.update=function(e){var n;return t.__super__.update.call(this,function(){var t,r,i;i=[];for(t=0,r=e.length;t<r;t++)n=e[t],i.push(this._convert(n));return i}.call(this))},t.prototype._convert=function(e){return e.constructor===Object&&this.ctor?new(this.ctor())(e):e},t}(r),e.AssociationCollection=n}).call(this)},t["./properties"]=new function(){var e=this;(function(){var n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E=[].indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(t in this&&this[t]===e)return t;return-1},S={}.hasOwnProperty;i=t("./collection").Collection,n=t("./association_collection").AssociationCollection,s=t("./events").Events,w=t("./helpers"),d=w.indexOf,v=w.pairToObject,g=w.serializeObject,c=w.extend,h=w.get,m="_prop_",l=/^_prop_/,f=Object.defineProperties,p={},a=function(e,t,n){var r,i,s,o,u,a,f,l;if(!e["_glb_"+t]){e["_glb_"+t]=!0,l=[];for(o=0,u=n.length;o<u;o++)r=n[o],r.match(/\./)?(s="singular",a=r.split("."),r=a[0],i=a[1]):r.match(/:/)&&(s="collection",f=r.split(":"),r=f[0],i=f[1]),i?(p[i]||(p[i]=[]),l.push(p[i].push({object:e,dependency:t,subname:i,name:r,type:s}))):l.push(void 0);return l}},u=function(e,t,n){var r,i,s,o,u,a,f;n=[].concat(n),f=[];for(s=0,o=n.length;s<o;s++)r=n[s],r.match(/[:\.]/)&&(a=r.split(/[:\.]/),r=a[0],i=a[1]),e[u="_dep_"+r]||(e[u]=[]),d(e["_dep_"+r],t)===-1?f.push(e["_dep_"+r].push(t)):f.push(void 0);return f},b=function(e,t){var n,r,i,s,o;o=[];for(i=0,s=t.length;i<s;i++)r=t[i],p[r]?o.push(function(){var t,i,s,o;s=p[r],o=[];for(t=0,i=s.length;t<i;t++)n=s[t],n.type==="singular"?e===n.object.get(n.name)?o.push(y(n.object,[n.dependency])):o.push(void 0):n.type==="collection"?E.call(n.object.get(n.name),e)>=0?o.push(y(n.object,[n.dependency])):o.push(void 0):o.push(void 0);return o}()):o.push(void 0);return o},y=function(e,t){var n,r,i,s,o,u,a,f,l;r=function(n){var i,s,o,u,a;i=e["_dep_"+n];if(i){a=[];for(o=0,u=i.length;o<u;o++)s=i[o],d(t,s)===-1?(t.push(s),a.push(r(s))):a.push(void 0);return a}};for(o=0,a=t.length;o<a;o++)i=t[o],r(i);n={};for(u=0,f=t.length;u<f;u++)i=t[u],n[i]=e.get(i);e.trigger("change",n),b(e,t),l=[];for(i in n){if(!S.call(n,i))continue;s=n[i],l.push(e.trigger("change:"+i,s))}return l},o={property:function(e,t){t==null&&(t={}),this[m+e]=t,this[m+e].name=e,this.hasOwnProperty(e)&&this.set(e,this[e]),t.dependsOn&&u(this,e,t.dependsOn),f&&Object.defineProperty(this,e,{get:function(){return o.get.call(this,e)},set:function(t){return o.set.call(this,e,t)},configurable:!0});if(typeof t.serialize=="string")return this.property(t.serialize,{get:function(){return this.get(e)},set:function(t){return this.set(e,t)},configurable:!0})},collection:function(e,t){return t==null&&(t={}),c(t,{get:function(){var t=this;return this.attributes[e]||(this.attributes[e]=new i([]),this.attributes[e].bind("change",function(){return y(t,[e])})),this.attributes[e]},set:function(t){return this.get(e).update(t)}}),this.property(e,t)},set:function(e,t){var n,r,i;typeof e=="string"&&(e=v(e,t)),r=[];for(n in e)t=e[n],r.push(n),this.attributes||(this.attributes={}),this[m+n]||o.property.call(this,n),((i=this[m+n])!=null?i.set:void 0)?this[m+n].set.call(this,t):this.attributes[n]=t;return y(this,r)},get:function(e,t){var n,r,i,s,o,u;return((i=this[m+e])!=null?i.dependsOn:void 0)&&a(this,e,[].concat(this[m+e].dependsOn)),this.attributes||(this.attributes={}),r=((s=this[m+e])!=null?s.get:void 0)?this[m+e].get.call(this):((o=this[m+e])!=null?o.hasOwnProperty("default"):void 0)&&!this.attributes.hasOwnProperty(e)?this[m+e]["default"]:this.attributes[e],n=(u=this[m+e])!=null?u.format:void 0,t&&typeof n=="function"?n.call(this,r):r},serialize:function(){var e,t,n,r,i,s;r={};for(t in this)n=this[t],t.match(l)&&(typeof n.serialize=="string"?r[n.serialize]=g(this.get(n.name)):typeof n.serialize=="function"?(s=n.serialize.call(this),e=s[0],i=s[1],r[e]=g(i)):n.serialize&&(r[n.name]=g(this.get(n.name))));return r}},c(o,s),r={belongsTo:function(e,t){return t==null&&(t={}),c(t,{set:function(n){return n.constructor===Object&&t.as&&(n=new(t.as())(n)),this.attributes[e]=n}}),this.property(e,t),this.property(e+"Id",{get:function(){return h(this.get(e),"id")},set:function(n){if(n!=null)return this.set(e,t.as().find(n))},dependsOn:e,serialize:t.serializeId})},hasMany:function(e,t){return t==null&&(t={}),c(t,{get:function(){var r=this;return this.attributes[e]||(this.attributes[e]=new n(t.as,[]),this.attributes[e].bind("change",function(){return y(r,[e])})),this.attributes[e]},set:function(t){return this.get(e).update(t)}}),this.property(e,t),this.property(e+"Ids",{get:function(){return(new i(this.get(e))).map(function(e){return h(e,"id")})},set:function(n){var r,i;return i=function(){var e,i,s;s=[];for(e=0,i=n.length;e<i;e++)r=n[e],s.push(t.as().find(r));return s}(),this.get(e).update(i)},dependsOn:e,serialize:t.serializeIds})}},e.Properties=o,e.Associations=r,e.globalDependencies=p}).call(this)},t["./model"]=new function(){var e=this;(function(){var n,r,i,s,o,u,a={}.hasOwnProperty,f=function(e,t){function r(){this.constructor=e}for(var n in t)a.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e};r=t("./cache").Cache,u=t("./properties"),n=u.Associations,s=u.Properties,o=t("./helpers").extend,i=function(){function e(e,t){var n,i=this;t==null&&(t=!1);if(!t)if(e!=null?e.id:void 0){n=r.get(this.constructor,e.id);if(n)return n.set(e),n;r.set(this.constructor,e.id,this)}this.constructor.localStorage&&(this.bind("saved",function(){return r.store(i.constructor,i.get("id"),i)}),this.constructor.localStorage!=="save"&&this.bind("change",function(){return r.store(i.constructor,i.get("id"),i)})),this.set(e)}return o(e.prototype,s),o(e.prototype,n),e.property=function(){var e;return(e=this.prototype).property.apply(e,arguments)},e.collection=function(){var e;return(e=this.prototype).collection.apply(e,arguments)},e.belongsTo=function(){var e;return(e=this.prototype).belongsTo.apply(e,arguments)},e.hasMany=function(){var e;return(e=this.prototype).hasMany.apply(e,arguments)},e.find=function(e){return r.get(this,e)||new this({id:e})},e.property("id",{serialize:!0}),e.extend=function(e,t){var n;return n=function(n){function r(){var e;e=r.__super__.constructor.apply(this,arguments);if(e)return e;t&&t.apply(this,arguments)}return f(r,n),r.modelName=e,r}(this)},e.prototype.save=function(){return this.trigger("saved")},e}(),e.Model=i}).call(this)},t["./serenade"]=new function(){var n=this;(function(){var r,i,s,o,u,a;r=t("./cache").Cache,o=t("./helpers").extend,a=t("./properties"),i=a.Properties,u=a.globalDependencies,s=function(t){return this===e?new s(t):(this.set(t),this)},o(s.prototype,i),o(s,{VERSION:"0.2.1",_views:{},_controllers:{},document:typeof window!="undefined"&&window!==null?window.document:void 0,view:function(e,n){var r;return r=t("./view").View,n?this._views[e]=new r(e,n):new r(void 0,e)},render:function(e,t,n,r,i){return this._views[e].render(t,n,r,i)},controller:function(e,t){return this._controllers[e]=t},controllerFor:function(e){return this._controllers[e]},clearIdentityMap:function(){return r._identityMap={}},clearLocalStorage:function(){return r._storage.clear()},clearCache:function(){var e,t,n,r,i;s.clearIdentityMap(),s.clearLocalStorage(),i=[];for(e=n=0,r=u.length;n<r;e=++n)t=u[e],i.push(delete u[e]);return i},unregisterAll:function(){return s._views={},s._controllers={}},bindEvent:function(e,t,n){return typeof e.addEventListener=="function"?e.addEventListener(t,n,!1):e.attachEvent("on"+t,n)},useJQuery:function(){return this.bindEvent=function(e,t,n){return jQuery(e).bind(t,n)}},Events:t("./events").Events,Model:t("./model").Model,Collection:t("./collection").Collection,Helpers:{}}),n.Serenade=s,n.compile=function(){var e,n,r;return e=t("jsdom").jsdom(null,null,{}),n=t("fs"),r=e.createWindow(),s.document=e,function(t){var r,i,o,u;return o=t.model,u=t.filename.split("/").reverse()[0].replace(/\.serenade$/,""),s.view(u,n.readFileSync(t.filename).toString()),r=s.render(u,o,{}),e.body.appendChild(r),i=e.body.innerHTML,t.doctype!==!1&&(i="<!DOCTYPE html>\n"+i),i}}}).call(this)},t["./lexer"]=new function(){var e=this;(function(){var t,n,r,i,s,o,u,a,f=[].indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(t in this&&this[t]===e)return t;return-1};n=/^[a-zA-Z][a-zA-Z0-9\-_]*/,i=/^[\[\]=\:\-!#\.@]/,u=/^"((?:\\.|[^"])*)"/,o=/^(?:\r?\n[^\r\n\S]*)+/,a=/^[^\r\n\S]+/,t=/^\s*\/\/[^\n]*/,r=["IF","COLLECTION","IN","VIEW","UNLESS"],s=function(){function e(){}return e.prototype.tokenize=function(e,t){var n,r;t==null&&(t={}),this.code=e.replace(/^\s*/,"").replace(/\s*$/,""),this.line=t.line||0,this.indent=0,this.indents=[],this.ends=[],this.tokens=[],n=0;while(this.chunk=this.code.slice(n))n+=this.identifierToken()||this.commentToken()||this.whitespaceToken()||this.lineToken()||this.stringToken()||this.literalToken();while(r=this.ends.pop())r==="OUTDENT"?this.token("OUTDENT"):this.error("missing "+r);while(this.tokens[0][0]==="TERMINATOR")this.tokens.shift();while(this.tokens[this.tokens.length-1][0]==="TERMINATOR")this.tokens.pop();return this.tokens},e.prototype.commentToken=function(){var e;return(e=t.exec(this.chunk))?e[0].length:0},e.prototype.whitespaceToken=function(){var e;return(e=a.exec(this.chunk))?(this.token("WHITESPACE",e[0].length),e[0].length):0},e.prototype.token=function(e,t){return this.tokens.push([e,t,this.line])},e.prototype.identifierToken=function(){var e,t;return(e=n.exec(this.chunk))?(t=e[0].toUpperCase(),f.call(r,t)>=0?this.token(t,e[0]):this.token("IDENTIFIER",e[0]),e[0].length):0},e.prototype.stringToken=function(){var e;return(e=u.exec(this.chunk))?(this.token("STRING_LITERAL",e[1]),e[0].length):0},e.prototype.lineToken=function(){var e,t,n,r,i;if(!(n=o.exec(this.chunk)))return 0;t=n[0],this.line+=this.count(t,"\n"),r=this.last(this.tokens,1),i=t.length-1-t.lastIndexOf("\n"),e=i-this.indent;if(i===this.indent)this.newlineToken();else if(i>this.indent)this.token("INDENT"),this.indents.push(e),this.ends.push("OUTDENT");else{while(e<0)this.last(this.ends)!=="OUTDENT"&&this.error("Should be an OUTDENT, yo"),this.ends.pop(),e+=this.indents.pop(),this.token("OUTDENT");this.token("TERMINATOR","\n")}return this.indent=i,t.length},e.prototype.literalToken=function(){var e;return(e=i.exec(this.chunk))?(this.token(e[0]),1):this.error("WUT??? is '"+this.chunk.charAt(0)+"'")},e.prototype.newlineToken=function(){if(this.tag()!=="TERMINATOR")return this.token("TERMINATOR","\n")},e.prototype.tag=function(e,t){var n;return(n=this.last(this.tokens,e))&&(t?n[0]=t:n[0])},e.prototype.value=function(e,t){var n;return(n=this.last(this.tokens,e))&&(t?n[1]=t:n[1])},e.prototype.error=function(e){throw SyntaxError(""+e+" on line "+(this.line+1))},e.prototype.count=function(e,t){var n,r;n=r=0;if(!t.length)return 1/0;while(r=1+e.indexOf(t,r))n++;return n},e.prototype.last=function(e,t){return e[e.length-(t||0)-1]},e}(),e.Lexer=s}).call(this)},t["./node"]=new function(){var e=this;(function(){var n,r;r=t("./serenade").Serenade,n=function(){function e(e,t){this.ast=e,this.element=t}return e.prototype.append=function(e){return e.appendChild(this.element)},e.prototype.insertAfter=function(e){return e.parentNode.insertBefore(this.element,e.nextSibling)},e.prototype.remove=function(){var e;return(e=this.element.parentNode)!=null?e.removeChild(this.element):void 0},e.prototype.lastElement=function(){return this.element},e}(),e.Node=n}).call(this)},t["./dynamic_node"]=new function(){var e=this;(function(){var n,r,i;i=t("./serenade").Serenade,n=t("./collection").Collection,r=function(){function e(e){this.ast=e,this.anchor=i.document.createTextNode(""),this.nodeSets=new n([])}return e.prototype.eachNode=function(e){var t,n,r,i,s,o;s=this.nodeSets,o=[];for(r=0,i=s.length;r<i;r++)n=s[r],o.push(function(){var r,i,s;s=[];for(r=0,i=n.length;r<i;r++)t=n[r],s.push(e(t));return s}());return o},e.prototype.rebuild=function(){var e;if(this.anchor.parentNode)return e=this.anchor,this.eachNode(function(t){return t.insertAfter(e),e=t.lastElement()})},e.prototype.replace=function(e){var t;return this.clear(),this.nodeSets.update(function(){var r,i,s;s=[];for(r=0,i=e.length;r<i;r++)t=e[r],s.push(new n(t));return s}()),this.rebuild()},e.prototype.appendNodeSet=function(e){return this.insertNodeSet(this.nodeSets.length,e)},e.prototype.deleteNodeSet=function(e){var t,n,r,i;i=this.nodeSets[e];for(n=0,r=i.length;n<r;n++)t=i[n],t.remove();return this.nodeSets.deleteAt(e)},e.prototype.insertNodeSet=function(e,t){var r,i,s,o,u,a;r=((u=this.nodeSets[e-1])!=null?(a=u.last())!=null?a.lastElement():void 0:void 0)||this.anchor;for(s=0,o=t.length;s<o;s++)i=t[s],i.insertAfter(r),r=i.lastElement();return this.nodeSets.insertAt(e,new n(t))},e.prototype.clear=function(){return this.eachNode(function(e){return e.remove()})},e.prototype.remove=function(){return this.clear(),this.anchor.parentNode.removeChild(this.anchor)},e.prototype.append=function(e){return e.appendChild(this.anchor),this.rebuild()},e.prototype.insertAfter=function(e){return e.parentNode.insertBefore(this.anchor,e.nextSibling),this.rebuild()},e.prototype.lastElement=function(){var e,t;return((e=this.nodeSets.last())!=null?(t=e.last())!=null?t.lastElement():void 0:void 0)||this.anchor},e}(),e.DynamicNode=r}).call(this)},t["./compile"]=new function(){var e=this;(function(){var n,r,i,s,o,u,a,f,l,c,h,p;u=t("./serenade").Serenade,n=t("./collection").Collection,s=t("./node").Node,i=t("./dynamic_node").DynamicNode,p=t("./helpers"),f=p.get,h=p.set,c=p.preventDefault,l=function(e,t){return e.bound&&e.value?f(t,e.value,!0):e.value!=null?e.value:t},o={style:function(e,t,n,r){var i;i=function(){return t.element.style[e.name]=l(e,n)},i();if(e.bound)return typeof n.bind=="function"?n.bind("change:"+e.value,i):void 0},event:function(e,t,n,r){var i=this;return u.bindEvent(t.element,e.name,function(i){return e.preventDefault&&c(i),r[e.value](n,t.element,i)})},binding:function(e,t,n,r){var i,s,o,a,l=this;return s=t.element,(a=t.ast.name)==="input"||a==="textarea"||a==="select"||function(){throw SyntaxError("invalid node type "+t.ast.name+" for two way binding")}(),e.value||function(){throw SyntaxError("cannot bind to whole model, please specify an attribute to bind to")}(),i=function(){var t,r,i,o,u;if(s.type==="checkbox")return h(n,e.value,s.checked);if(s.type!=="radio"){if(s.type==="select-multiple"){r=[],u=s.options;for(i=0,o=u.length;i<o;i++)t=u[i],t.selected&&r.push(t.value);return h(n,e.value,r)}return h(n,e.value,s.value)}if(s.checked)return h(n,e.value,s.getAttribute("value"))},o=function(){var t,r,i,o,u,a,l,c,h,p;if(s.type==="checkbox")return i=f(n,e.value),s.checked=!!i;if(s.type!=="radio"){if(s.type==="select-multiple"){i=f(n,e.value),o={};for(u=0,l=i.length;u<l;u++)r=i[u],o[r]=!0;h=s.options,p=[];for(a=0,c=h.length;a<c;a++)t=h[a],p.push(t.selected=o[t.value]!=null);return p}return i=f(n,e.value),i===void 0&&(i=""),s.value=i}i=f(n,e.value);if(i===s.getAttribute("value"))return s.checked=!0},o(),typeof n.bind=="function"&&n.bind("change:"+e.value,o),e.name==="binding"?u.bindEvent(u.document,"submit",function(e){if(s.form===(e.target||e.srcElement))return i()}):u.bindEvent(s,e.name,i)},attribute:function(e,t,n,r){var i,s;return e.name==="binding"?o.binding(e,t,n,r):(i=t.element,s=function(){var r,s;return s=l(e,n),e.name==="value"?i.value=s||"":t.ast.name==="input"&&e.name==="checked"?i.checked=!!s:e.name==="class"?(r=t.ast.classes,s!==void 0&&(r=r.concat(s)),r.length?i.className=r.join(" "):(i.className="",i.removeAttribute(e.name))):s===void 0?i.removeAttribute(e.name):(s===0&&(s="0"),i.setAttribute(e.name,s))},e.bound&&typeof n.bind=="function"&&n.bind("change:"+e.value,s),s())}},r={element:function(e,t,n){var r,i,f,l,c,h,p,d,v,m,g,y;f=u.document.createElement(e.name),l=new s(e,f),e.id&&f.setAttribute("id",e.id),((m=e.classes)!=null?m.length:void 0)&&f.setAttribute("class",e.classes.join(" ")),g=e.children;for(h=0,d=g.length;h<d;h++)i=g[h],a(i,t,n).append(f);y=e.properties;for(p=0,v=y.length;p<v;p++){c=y[p],r=o[c.scope];if(!r)throw SyntaxError(""+c.scope+" is not a valid scope");r(c,l,t,n)}return l},view:function(e,t,n){var r,i,o;return r=u.controllerFor(e.arguments[0]),r||(o=!0,r=n),i=u.render(e.arguments[0],t,r,n,o),new s(e,i)},helper:function(e,t,n){var r,i,o,f;return f=function(t,n){var r,i,s,o,f,l;t==null&&(t=t),n==null&&(n=n),i=u.document.createDocumentFragment(),l=e.children;for(o=0,f=l.length;o<f;o++)r=l[o],s=a(r,t,n),s.append(i);return i},o=u.Helpers[e.command]||function(){throw SyntaxError("no helper "+e.command+" defined")}(),r={render:f,model:t,controller:n},i=o.apply(r,e.arguments),new s(e,i)},text:function(e,t,n){var r,i;return r=function(){var n;return n=l(e,t),n===0&&(n="0"),n||""},i=u.document.createTextNode(r()),e.bound&&typeof t.bind=="function"&&t.bind("change:"+e.value,function(){return i.nodeValue=r()}),new s(e,i)},collection:function(e,t,n){var r,s,o,u,l=this;return s=function(t){var r,i,s,o,u;o=e.children,u=[];for(i=0,s=o.length;i<s;i++)r=o[i],u.push(a(r,t,n));return u},o=new i(e),r=f(t,e.arguments[0]),typeof r.bind=="function"&&(r.bind("set",function(){var e;return o.replace(function(){var t,n,i;i=[];for(t=0,n=r.length;t<n;t++)e=r[t],i.push(s(e));return i}())}),r.bind("update",function(){var e;return o.replace(function(){var t,n,i;i=[];for(t=0,n=r.length;t<n;t++)e=r[t],i.push(s(e));return i}())}),r.bind("add",function(e){return o.appendNodeSet(s(e))}),r.bind("insert",function(e,t){return o.insertNodeSet(e,s(t))}),r.bind("delete",function(e){return o.deleteNodeSet(e)})),o.replace(function(){var e,t,n;n=[];for(e=0,t=r.length;e<t;e++)u=r[e],n.push(s(u));return n}()),o},"in":function(e,t,n){return r.bound(e,t,n,function(t,r){var i,s;return r?(s=function(){var t,s,o,u;o=e.children,u=[];for(t=0,s=o.length;t<s;t++)i=o[t],u.push(a(i,r,n));return u}(),t.replace([s])):t.clear()})},"if":function(e,t,n){return r.bound(e,t,n,function(r,i){var s,o;return i?(o=function(){var r,i,o,u;o=e.children,u=[];for(r=0,i=o.length;r<i;r++)s=o[r],u.push(a(s,t,n));return u}(),r.replace([o])):r.clear()})},unless:function(e,t,n){return r.bound(e,t,n,function(r,i){var s,o;return i?r.clear():(o=function(){var r,i,o,u;o=e.children,u=[];for(r=0,i=o.length;r<i;r++)s=o[r],u.push(a(s,t,n));return u}(),r.replace([o]))})},bound:function(e,t,n,r){var s,o;return s=new i(e),o=function(){var n;return n=f(t,e.arguments[0]),r(s,n)},o(),typeof t.bind=="function"&&t.bind("change:"+e.arguments[0],o),s}},a=function(e,t,n){var i;i=r[e.type];if(i)return i(e,t,n);throw SyntaxError("unknown type '"+e.type+"'")},e.compile=a}).call(this)},t["./parser"]=new function(){var e=this,n=function(){function t(){this.yy={}}var e={trace:function(){},yy:{},symbols_:{error:2,Root:3,Element:4,ElementIdentifier:5,AnyIdentifier:6,"#":7,".":8,"[":9,"]":10,PropertyList:11,WHITESPACE:12,Text:13,INDENT:14,ChildList:15,OUTDENT:16,TextList:17,Bound:18,STRING_LITERAL:19,Child:20,TERMINATOR:21,Instruction:22,Property:23,"=":24,"!":25,":":26,"-":27,VIEW:28,COLLECTION:29,IF:30,UNLESS:31,IN:32,IDENTIFIER:33,"@":34,$accept:0,$end:1},terminals_:{2:"error",7:"#",8:".",9:"[",10:"]",12:"WHITESPACE",14:"INDENT",16:"OUTDENT",19:"STRING_LITERAL",21:"TERMINATOR",24:"=",25:"!",26:":",27:"-",28:"VIEW",29:"COLLECTION",30:"IF",31:"UNLESS",32:"IN",33:"IDENTIFIER",34:"@"},productions_:[0,[3,0],[3,1],[5,1],[5,3],[5,2],[5,2],[5,3],[4,1],[4,3],[4,4],[4,3],[4,4],[17,1],[17,3],[13,1],[13,1],[15,1],[15,3],[20,1],[20,1],[20,1],[11,1],[11,3],[23,3],[23,3],[23,4],[23,4],[23,3],[23,3],[22,3],[22,3],[22,3],[22,3],[22,3],[22,3],[22,3],[22,4],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[18,2],[18,1]],performAction:function(t,n,r,i,s,o,u){var a=o.length-1;switch(s){case 1:this.$=null;break;case 2:return this.$;case 3:this.$={name:o[a],classes:[]};break;case 4:this.$={name:o[a-2],id:o[a],classes:[]};break;case 5:this.$={name:"div",id:o[a],classes:[]};break;case 6:this.$={name:"div",classes:[o[a]]};break;case 7:this.$=function(){return o[a-2].classes.push(o[a]),o[a-2]}();break;case 8:this.$={name:o[a].name,id:o[a].id,classes:o[a].classes,properties:[],children:[],type:"element"};break;case 9:this.$=o[a-2];break;case 10:this.$=function(){return o[a-3].properties=o[a-1],o[a-3]}();break;case 11:this.$=function(){return o[a-2].children=o[a-2].children.concat(o[a]),o[a-2]}();break;case 12:this.$=function(){return o[a-3].children=o[a-3].children.concat(o[a-1]),o[a-3]}();break;case 13:this.$=[o[a]];break;case 14:this.$=o[a-2].concat(o[a]);break;case 15:this.$={type:"text",value:o[a],bound:!0};break;case 16:this.$={type:"text",value:o[a],bound:!1};break;case 17:this.$=[].concat(o[a]);break;case 18:this.$=o[a-2].concat(o[a]);break;case 19:this.$=o[a];break;case 20:this.$=o[a];break;case 21:this.$=o[a];break;case 22:this.$=[o[a]];break;case 23:this.$=o[a-2].concat(o[a]);break;case 24:this.$={name:o[a-2],value:o[a],bound:!0,scope:"attribute"};break;case 25:this.$={name:o[a-2],value:o[a],bound:!0,scope:"attribute"};break;case 26:this.$={name:o[a-3],value:o[a-1],bound:!0,scope:"attribute",preventDefault:!0};break;case 27:this.$={name:o[a-3],value:o[a-1],bound:!0,scope:"attribute",preventDefault:!0};break;case 28:this.$={name:o[a-2],value:o[a],bound:!1,scope:"attribute"};break;case 29:this.$=function(){return o[a].scope=o[a-2],o[a]}();break;case 30:this.$={arguments:[],children:[],type:"view"};break;case 31:this.$={arguments:[],children:[],type:"collection"};break;case 32:this.$={arguments:[],children:[],type:"if"};break;case 33:this.$={arguments:[],children:[],type:"unless"};break;case 34:this.$={arguments:[],children:[],type:"in"};break;case 35:this.$={command:o[a],arguments:[],children:[],type:"helper"};break;case 36:this.$=function(){return o[a-2].arguments.push(o[a].value),o[a-2]}();break;case 37:this.$=function(){return o[a-3].children=o[a-1],o[a-3]}();break;case 38:this.$=o[a];break;case 39:this.$=o[a];break;case 40:this.$=o[a];break;case 41:this.$=o[a];break;case 42:this.$=o[a];break;case 43:this.$=o[a];break;case 44:this.$=o[a];break;case 45:this.$=function(){}()}},table:[{1:[2,1],3:1,4:2,5:3,6:4,7:[1,5],8:[1,6],28:[1,7],29:[1,8],30:[1,9],31:[1,10],32:[1,11],33:[1,12]},{1:[3]},{1:[2,2],9:[1,13],12:[1,14],14:[1,15]},{1:[2,8],8:[1,16],9:[2,8],12:[2,8],14:[2,8],16:[2,8],21:[2,8]},{1:[2,3],7:[1,17],8:[2,3],9:[2,3],12:[2,3],14:[2,3],16:[2,3],21:[2,3]},{6:18,28:[1,7],29:[1,8],30:[1,9],31:[1,10],32:[1,11],33:[1,12]},{6:19,28:[1,7],29:[1,8],30:[1,9],31:[1,10],32:[1,11],33:[1,12]},{1:[2,38],7:[2,38],8:[2,38],9:[2,38],10:[2,38],12:[2,38],14:[2,38],16:[2,38],21:[2,38],24:[2,38],25:[2,38],26:[2,38]},{1:[2,39],7:[2,39],8:[2,39],9:[2,39],10:[2,39],12:[2,39],14:[2,39],16:[2,39],21:[2,39],24:[2,39],25:[2,39],26:[2,39]},{1:[2,40],7:[2,40],8:[2,40],9:[2,40],10:[2,40],12:[2,40],14:[2,40],16:[2,40],21:[2,40],24:[2,40],25:[2,40],26:[2,40]},{1:[2,41],7:[2,41],8:[2,41],9:[2,41],10:[2,41],12:[2,41],14:[2,41],16:[2,41],21:[2,41],24:[2,41],25:[2,41],26:[2,41]},{1:[2,42],7:[2,42],8:[2,42],9:[2,42],10:[2,42],12:[2,42],14:[2,42],16:[2,42],21:[2,42],24:[2,42],25:[2,42],26:[2,42]},{1:[2,43],7:[2,43],8:[2,43],9:[2,43],10:[2,43],12:[2,43],14:[2,43],16:[2,43],21:[2,43],24:[2,43],25:[2,43],26:[2,43]},{6:23,10:[1,20],11:21,23:22,28:[1,7],29:[1,8],30:[1,9],31:[1,10],32:[1,11],33:[1,12]},{13:24,18:25,19:[1,26],34:[1,27]},{4:30,5:3,6:4,7:[1,5],8:[1,6],13:34,15:28,17:32,18:25,19:[1,26],20:29,22:31,27:[1,33],28:[1,7],29:[1,8],30:[1,9],31:[1,10],32:[1,11],33:[1,12],34:[1,27]},{6:35,28:[1,7],29:[1,8],30:[1,9],31:[1,10],32:[1,11],33:[1,12]},{6:36,28:[1,7],29:[1,8],30:[1,9],31:[1,10],32:[1,11],33:[1,12]},{1:[2,5],8:[2,5],9:[2,5],12:[2,5],14:[2,5],16:[2,5],21:[2,5]},{1:[2,6],8:[2,6],9:[2,6],12:[2,6],14:[2,6],16:[2,6],21:[2,6]},{1:[2,9],9:[2,9],12:[2,9],14:[2,9],16:[2,9],21:[2,9]},{10:[1,37],12:[1,38]},{10:[2,22],12:[2,22]},{24:[1,39],26:[1,40]},{1:[2,11],9:[2,11],12:[2,11],14:[2,11],16:[2,11],21:[2,11]},{1:[2,15],9:[2,15],12:[2,15],14:[2,15],16:[2,15],21:[2,15]},{1:[2,16],9:[2,16],12:[2,16],14:[2,16],16:[2,16],21:[2,16]},{1:[2,45],6:41,9:[2,45],10:[2,45],12:[2,45],14:[2,45],16:[2,45],21:[2,45],25:[2,45],28:[1,7],29:[1,8],30:[1,9],31:[1,10],32:[1,11],33:[1,12]},{16:[1,42],21:[1,43]},{16:[2,17],21:[2,17]},{9:[1,13],12:[1,14],14:[1,15],16:[2,19],21:[2,19]},{12:[1,44],14:[1,45],16:[2,20],21:[2,20]},{12:[1,46],16:[2,21],21:[2,21]},{12:[1,47]},{12:[2,13],16:[2,13],21:[2,13]},{1:[2,7],8:[2,7],9:[2,7],12:[2,7],14:[2,7],16:[2,7],21:[2,7]},{1:[2,4],8:[2,4],9:[2,4],12:[2,4],14:[2,4],16:[2,4],21:[2,4]},{1:[2,10],9:[2,10],12:[2,10],14:[2,10],16:[2,10],21:[2,10]},{6:23,23:48,28:[1,7],29:[1,8],30:[1,9],31:[1,10],32:[1,11],33:[1,12]},{6:49,18:50,19:[1,51],28:[1,7],29:[1,8],30:[1,9],31:[1,10],32:[1,11],33:[1,12],34:[1,27]},{6:23,23:52,28:[1,7],29:[1,8],30:[1,9],31:[1,10],32:[1,11],33:[1,12]},{1:[2,44],9:[2,44],10:[2,44],12:[2,44],14:[2,44],16:[2,44],21:[2,44],25:[2,44]},{1:[2,12],9:[2,12],12:[2,12],14:[2,12],16:[2,12],21:[2,12]},{4:30,5:3,6:4,7:[1,5],8:[1,6],13:34,17:32,18:25,19:[1,26],20:53,22:31,27:[1,33],28:[1,7],29:[1,8],30:[1,9],31:[1,10],32:[1,11],33:[1,12],34:[1,27]},{13:54,18:25,19:[1,26],34:[1,27]},{4:30,5:3,6:4,7:[1,5],8:[1,6],13:34,15:55,17:32,18:25,19:[1,26],20:29,22:31,27:[1,33],28:[1,7],29:[1,8],30:[1,9],31:[1,10],32:[1,11],33:[1,12],34:[1,27]},{13:56,18:25,19:[1,26],34:[1,27]},{28:[1,57],29:[1,58],30:[1,59],31:[1,60],32:[1,61],33:[1,62]},{10:[2,23],12:[2,23]},{10:[2,24],12:[2,24],25:[1,63]},{10:[2,25],12:[2,25],25:[1,64]},{10:[2,28],12:[2,28]},{10:[2,29],12:[2,29]},{16:[2,18],21:[2,18]},{12:[2,36],14:[2,36],16:[2,36],21:[2,36]},{16:[1,65],21:[1,43]},{12:[2,14],16:[2,14],21:[2,14]},{12:[2,30],14:[2,30],16:[2,30],21:[2,30]},{12:[2,31],14:[2,31],16:[2,31],21:[2,31]},{12:[2,32],14:[2,32],16:[2,32],21:[2,32]},{12:[2,33],14:[2,33],16:[2,33],21:[2,33]},{12:[2,34],14:[2,34],16:[2,34],21:[2,34]},{12:[2,35],14:[2,35],16:[2,35],21:[2,35]},{10:[2,26],12:[2,26]},{10:[2,27],12:[2,27]},{12:[2,37],14:[2,37],16:[2,37],21:[2,37]}],defaultActions:{},parseError:function(t,n){throw new Error(t)},parse:function(t){function v(e){r.length=r.length-2*e,i.length=i.length-e,s.length=s.length-e}function m(){var e;return e=n.lexer.lex()||1,typeof e!="number"&&(e=n.symbols_[e]||e),e}var n=this,r=[0],i=[null],s=[],o=this.table,u="",a=0,f=0,l=0,c=2,h=1;this.lexer.setInput(t),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,typeof this.lexer.yylloc=="undefined"&&(this.lexer.yylloc={});var p=this.lexer.yylloc;s.push(p);var d=this.lexer.options&&this.lexer.options.ranges;typeof this.yy.parseError=="function"&&(this.parseError=this.yy.parseError);var g,y,b,w,E,S,x={},T,N,C,k;for(;;){b=r[r.length-1];if(this.defaultActions[b])w=this.defaultActions[b];else{if(g===null||typeof g=="undefined")g=m();w=o[b]&&o[b][g]}if(typeof w=="undefined"||!w.length||!w[0])var L="";if(w[0]instanceof Array&&w.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+g);switch(w[0]){case 1:r.push(g),i.push(this.lexer.yytext),s.push(this.lexer.yylloc),r.push(w[1]),g=null,y?(g=y,y=null):(f=this.lexer.yyleng,u=this.lexer.yytext,a=this.lexer.yylineno,p=this.lexer.yylloc,l>0&&l--);break;case 2:N=this.productions_[w[1]][1],x.$=i[i.length-N],x._$={first_line:s[s.length-(N||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(N||1)].first_column,last_column:s[s.length-1].last_column},d&&(x._$.range=[s[s.length-(N||1)].range[0],s[s.length-1].range[1]]),S=this.performAction.call(x,u,f,a,this.yy,w[1],i,s);if(typeof S!="undefined")return S;N&&(r=r.slice(0,-1*N*2),i=i.slice(0,-1*N),s=s.slice(0,-1*N)),r.push(this.productions_[w[1]][0]),i.push(x.$),s.push(x._$),C=o[r[r.length-2]][r[r.length-1]],r.push(C);break;case 3:return!0}}return!0}};return t.prototype=e,e.Parser=t,new t}();typeof t!="undefined"&&typeof e!="undefined"&&(e.parser=n,e.Parser=n.Parser,e.parse=function(){return n.parse.apply(n,arguments)},e.main=function(r){if(!r[1])throw new Error("Usage: "+r[0]+" FILE");var i,s;return typeof process!="undefined"?i=t("fs").readFileSync(t("path").resolve(r[1]),"utf8"):i=t("file").path(t("file").cwd()).join(r[1]).read({charset:"utf-8"}),e.parser.parse(i)},typeof module!="undefined"&&t.main===module&&e.main(typeof process!="undefined"?process.argv.slice(1):t("system").args))},t["./view"]=new function(){var e=this;(function(){var n,r,i,s,o;o=t("./parser").parser,n=t("./lexer").Lexer,s=t("./compile").compile,r=t("./serenade").Serenade,o.lexer={lex:function(){var e,t;return t=this.tokens[this.pos++]||[""],e=t[0],this.yytext=t[1],this.yylineno=t[2],e},setInput:function(e){return this.tokens=e,this.pos=0},upcomingInput:function(){return""}},i=function(){function e(e,t){this.name=e,this.view=t}return e.prototype.parse=function(){return typeof this.view=="string"?o.parse((new n).tokenize(this.view)):this.view},e.prototype.render=function(e,t,n,i){var o;return this.name&&(t||(t=r.controllerFor(this.name,e))),t||(t={}),typeof t=="function"&&(t=new t(e,n)),o=s(this.parse(),e,t),i||typeof t.loaded=="function"&&t.loaded(e,o.element),o.element},e}(),e.View=i}).call(this)},t["./serenade"].Serenade}();typeof define=="function"&&define.amd?define(function(){return t}):typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=t),exports.Serenade=t):e.Serenade=t})()