(function(e){vart=function(){functiont(){this.yy={}}vare={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,IfInstruction:22,Instruction:23,Helper:24,Property:25,"=":26,"!":27,":":28,"-":29,VIEW:30,COLLECTION:31,UNLESS:32,IN:33,IDENTIFIER:34,IF:35,ElseInstruction:36,ELSE:37,"@":38,$accept:0,$end:1},terminals_:{2:"error",7:"#",8:".",9:"[",10:"]",12:"WHITESPACE",14:"INDENT",16:"OUTDENT",19:"STRING_LITERAL",21:"TERMINATOR",26:"=",27:"!",28:":",29:"-",30:"VIEW",31:"COLLECTION",32:"UNLESS",33:"IN",34:"IDENTIFIER",35:"IF",37:"ELSE",38:"@"},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],[20,1],[20,1],[11,1],[11,3],[25,3],[25,3],[25,4],[25,4],[25,3],[25,3],[23,5],[23,5],[23,5],[23,5],[23,4],[24,3],[24,3],[24,4],[22,5],[22,4],[22,2],[36,6],[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){vara=o.length-1;switch(s){case1:this.$=null;break;case2:returnthis.$;case3:this.$={name:o[a],classes:[]};break;case4:this.$={name:o[a-2],id:o[a],classes:[]};break;case5:this.$={name:"div",id:o[a],classes:[]};break;case6:this.$={name:"div",classes:[o[a]]};break;case7:this.$=function(){returno[a-2].classes.push(o[a]),o[a-2]}();break;case8:this.$={name:o[a].name,id:o[a].id,classes:o[a].classes,properties:[],children:[],type:"element"};break;case9:this.$=o[a-2];break;case10:this.$=function(){returno[a-3].properties=o[a-1],o[a-3]}();break;case11:this.$=function(){returno[a-2].children=o[a-2].children.concat(o[a]),o[a-2]}();break;case12:this.$=function(){returno[a-3].children=o[a-3].children.concat(o[a-1]),o[a-3]}();break;case13:this.$=[o[a]];break;case14:this.$=o[a-2].concat(o[a]);break;case15:this.$={type:"text",value:o[a],bound:!0};break;case16:this.$={type:"text",value:o[a],bound:!1};break;case17:this.$=[].concat(o[a]);break;case18:this.$=o[a-2].concat(o[a]);break;case19:this.$=o[a];break;case20:this.$=o[a];break;case21:this.$=o[a];break;case22:this.$=o[a];break;case23:this.$=o[a];break;case24:this.$=[o[a]];break;case25:this.$=o[a-2].concat(o[a]);break;case26:this.$={name:o[a-2],value:o[a],bound:!0,scope:"attribute"};break;case27:this.$={name:o[a-2],value:o[a],bound:!0,scope:"attribute"};break;case28:this.$={name:o[a-3],value:o[a-1],bound:!0,scope:"attribute",preventDefault:!0};break;case29:this.$={name:o[a-3],value:o[a-1],bound:!0,scope:"attribute",preventDefault:!0};break;case30:this.$={name:o[a-2],value:o[a],bound:!1,scope:"attribute"};break;case31:this.$=function(){returno[a].scope=o[a-2],o[a]}();break;case32:this.$={children:[],type:"view",argument:o[a]};break;case33:this.$={children:[],type:"collection",argument:o[a]};break;case34:this.$={children:[],type:"unless",argument:o[a]};break;case35:this.$={children:[],type:"in",argument:o[a]};break;case36:this.$=function(){returno[a-3].children=o[a-1],o[a-3]}();break;case37:this.$={command:o[a],arguments:[],children:[],type:"helper"};break;case38:this.$=function(){returno[a-2].arguments.push(o[a]),o[a-2]}();break;case39:this.$=function(){returno[a-3].children=o[a-1],o[a-3]}();break;case40:this.$={children:[],type:"if",argument:o[a]};break;case41:this.$=function(){returno[a-3].children=o[a-1],o[a-3]}();break;case42:this.$=function(){returno[a-1]["else"]=o[a],o[a-1]}();break;case43:this.$={arguments:[],children:o[a-1],type:"else"};break;case44:this.$=o[a];break;case45:this.$=o[a];break;case46:this.$=o[a];break;case47:this.$=o[a];break;case48:this.$=o[a];break;case49:this.$=o[a];break;case50:this.$=o[a];break;case51:this.$=function(){}()}},table:[{1:[2,1],3:1,4:2,5:3,6:4,7:[1,5],8:[1,6],30:[1,7],31:[1,8],32:[1,10],33:[1,11],34:[1,12],35:[1,9]},{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,30:[1,7],31:[1,8],32:[1,10],33:[1,11],34:[1,12],35:[1,9]},{6:19,30:[1,7],31:[1,8],32:[1,10],33:[1,11],34:[1,12],35:[1,9]},{1:[2,44],7:[2,44],8:[2,44],9:[2,44],10:[2,44],12:[2,44],14:[2,44],16:[2,44],21:[2,44],26:[2,44],27:[2,44],28:[2,44],29:[2,44]},{1:[2,45],7:[2,45],8:[2,45],9:[2,45],10:[2,45],12:[2,45],14:[2,45],16:[2,45],21:[2,45],26:[2,45],27:[2,45],28:[2,45],29:[2,45]},{1:[2,46],7:[2,46],8:[2,46],9:[2,46],10:[2,46],12:[2,46],14:[2,46],16:[2,46],21:[2,46],26:[2,46],27:[2,46],28:[2,46],29:[2,46]},{1:[2,47],7:[2,47],8:[2,47],9:[2,47],10:[2,47],12:[2,47],14:[2,47],16:[2,47],21:[2,47],26:[2,47],27:[2,47],28:[2,47],29:[2,47]},{1:[2,48],7:[2,48],8:[2,48],9:[2,48],10:[2,48],12:[2,48],14:[2,48],16:[2,48],21:[2,48],26:[2,48],27:[2,48],28:[2,48],29:[2,48]},{1:[2,49],7:[2,49],8:[2,49],9:[2,49],10:[2,49],12:[2,49],14:[2,49],16:[2,49],21:[2,49],26:[2,49],27:[2,49],28:[2,49],29:[2,49]},{6:23,10:[1,20],11:21,25:22,30:[1,7],31:[1,8],32:[1,10],33:[1,11],34:[1,12],35:[1,9]},{13:24,18:25,19:[1,26],38:[1,27]},{4:30,5:3,6:4,7:[1,5],8:[1,6],13:36,15:28,17:34,18:25,19:[1,26],20:29,22:31,23:32,24:33,29:[1,35],30:[1,7],31:[1,8],32:[1,10],33:[1,11],34:[1,12],35:[1,9],38:[1,27]},{6:37,30:[1,7],31:[1,8],32:[1,10],33:[1,11],34:[1,12],35:[1,9]},{6:38,30:[1,7],31:[1,8],32:[1,10],33:[1,11],34:[1,12],35:[1,9]},{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,39],12:[1,40]},{10:[2,24],12:[2,24]},{26:[1,41],28:[1,42]},{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,51],6:43,9:[2,51],10:[2,51],12:[2,51],14:[2,51],16:[2,51],21:[2,51],27:[2,51],29:[2,51],30:[1,7],31:[1,8],32:[1,10],33:[1,11],34:[1,12],35:[1,9]},{16:[1,44],21:[1,45]},{16:[2,17],21:[2,17]},{9:[1,13],12:[1,14],14:[1,15],16:[2,19],21:[2,19]},{14:[1,46],16:[2,20],21:[2,20],29:[1,48],36:47},{14:[1,49],16:[2,21],21:[2,21]},{12:[1,50],14:[1,51],16:[2,22],21:[2,22]},{12:[1,52],16:[2,23],21:[2,23]},{12:[1,53]},{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,25:54,30:[1,7],31:[1,8],32:[1,10],33:[1,11],34:[1,12],35:[1,9]},{6:55,18:56,19:[1,57],30:[1,7],31:[1,8],32:[1,10],33:[1,11],34:[1,12],35:[1,9],38:[1,27]},{6:23,25:58,30:[1,7],31:[1,8],32:[1,10],33:[1,11],34:[1,12],35:[1,9]},{1:[2,50],9:[2,50],10:[2,50],12:[2,50],14:[2,50],16:[2,50],21:[2,50],27:[2,50],29:[2,50]},{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:36,17:34,18:25,19:[1,26],20:59,22:31,23:32,24:33,29:[1,35],30:[1,7],31:[1,8],32:[1,10],33:[1,11],34:[1,12],35:[1,9],38:[1,27]},{4:30,5:3,6:4,7:[1,5],8:[1,6],13:36,15:60,17:34,18:25,19:[1,26],20:29,22:31,23:32,24:33,29:[1,35],30:[1,7],31:[1,8],32:[1,10],33:[1,11],34:[1,12],35:[1,9],38:[1,27]},{14:[2,42],16:[2,42],21:[2,42],29:[2,42]},{12:[1,61]},{4:30,5:3,6:4,7:[1,5],8:[1,6],13:36,15:62,17:34,18:25,19:[1,26],20:29,22:31,23:32,24:33,29:[1,35],30:[1,7],31:[1,8],32:[1,10],33:[1,11],34:[1,12],35:[1,9],38:[1,27]},{13:63,18:25,19:[1,26],38:[1,27]},{4:30,5:3,6:4,7:[1,5],8:[1,6],13:36,15:64,17:34,18:25,19:[1,26],20:29,22:31,23:32,24:33,29:[1,35],30:[1,7],31:[1,8],32:[1,10],33:[1,11],34:[1,12],35:[1,9],38:[1,27]},{13:65,18:25,19:[1,26],38:[1,27]},{30:[1,67],31:[1,68],32:[1,69],33:[1,70],34:[1,71],35:[1,66]},{10:[2,25],12:[2,25]},{10:[2,26],12:[2,26],27:[1,72]},{10:[2,27],12:[2,27],27:[1,73]},{10:[2,30],12:[2,30]},{10:[2,31],12:[2,31]},{16:[2,18],21:[2,18]},{16:[1,74],21:[1,45]},{37:[1,75]},{16:[1,76],21:[1,45]},{12:[2,38],14:[2,38],16:[2,38],21:[2,38]},{16:[1,77],21:[1,45]},{12:[2,14],16:[2,14],21:[2,14]},{12:[1,78]},{12:[1,79]},{12:[1,80]},{12:[1,81]},{12:[1,82]},{12:[2,37],14:[2,37],16:[2,37],21:[2,37]},{10:[2,28],12:[2,28]},{10:[2,29],12:[2,29]},{14:[2,41],16:[2,41],21:[2,41],29:[2,41]},{14:[1,83]},{14:[2,36],16:[2,36],21:[2,36]},{12:[2,39],14:[2,39],16:[2,39],21:[2,39]},{18:84,38:[1,27]},{19:[1,85]},{18:86,38:[1,27]},{18:87,38:[1,27]},{18:88,38:[1,27]},{4:30,5:3,6:4,7:[1,5],8:[1,6],13:36,15:89,17:34,18:25,19:[1,26],20:29,22:31,23:32,24:33,29:[1,35],30:[1,7],31:[1,8],32:[1,10],33:[1,11],34:[1,12],35:[1,9],38:[1,27]},{14:[2,40],16:[2,40],21:[2,40],29:[2,40]},{14:[2,32],16:[2,32],21:[2,32]},{14:[2,33],16:[2,33],21:[2,33]},{14:[2,34],16:[2,34],21:[2,34]},{14:[2,35],16:[2,35],21:[2,35]},{16:[1,90],21:[1,45]},{14:[2,43],16:[2,43],21:[2,43],29:[2,43]}],defaultActions:{},parseError:function(t,n){thrownewError(t)},parse:function(t){functionv(e){r.length=r.length-2*e,i.length=i.length-e,s.length=s.length-e}functionm(){vare;returne=n.lexer.lex()||1,typeofe!="number"&&(e=n.symbols_[e]||e),e}varn=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,typeofthis.lexer.yylloc=="undefined"&&(this.lexer.yylloc={});varp=this.lexer.yylloc;s.push(p);vard=this.lexer.options&&this.lexer.options.ranges;typeofthis.yy.parseError=="function"&&(this.parseError=this.yy.parseError);varg,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||typeofg=="undefined")g=m();w=o[b]&&o[b][g]}if(typeofw=="undefined"||!w.length||!w[0])varL="";if(w[0]instanceofArray&&w.length>1)thrownewError("Parse Error: multiple actions possible at state: "+b+", token: "+g);switch(w[0]){case1: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;case2: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(typeofS!="undefined")returnS;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;case3:return!0}}return!0}};returnt.prototype=e,e.Parser=t,newt}();typeofrequire!="undefined"&&typeofexports!="undefined"&&(exports.parser=t,exports.Parser=t.Parser,exports.parse=function(){returnt.parse.apply(t,arguments)},exports.main=function(t){if(!t[1])thrownewError("Usage: "+t[0]+" FILE");varn,r;returntypeofprocess!="undefined"?n=require("fs").readFileSync(require("path").resolve(t[1]),"utf8"):n=require("file").path(require("file").cwd()).join(t[1]).read({charset:"utf-8"}),exports.parser.parse(n)},typeofmodule!="undefined"&&require.main===module&&exports.main(typeofprocess!="undefined"?process.argv.slice(1):require("system").args));varn,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M,_,D,P,H,B,j,F,I,q,R,U,z={}.hasOwnProperty,W=[].slice,X=function(e,t){functionr(){this.constructor=e}for(varnint)z.call(t,n)&&(e[n]=t[n]);returnr.prototype=t.prototype,e.prototype=newr,e.__super__=t.prototype,e},V=[].indexOf||function(e){for(vart=0,n=this.length;t<n;t++)if(tinthis&&this[t]===e)returnt;return-1};R={async:!1},C=Object.defineProperty,A=function(e,t,n){varr,i,s;n==null&&(n=!0),s=[];for(rint){if(!z.call(t,r))continue;i=t[r],n?s.push(e[r]=i):s.push(C(e,r,{value:i,configurable:!0}))}returns},O=function(e,t){returne[t+"_property"]?e[t+"_property"].format():e[t]},P=function(e){returnObject.prototype.toString.call(e)==="[object Array]"},j=function(e,t){varn;returnn={},n[e]=t,n},q=function(e){vart,n,r,i;if(e&&typeofe.toJSON=="function")returne.toJSON();if(P(e)){i=[];for(n=0,r=e.length;n<r;n++)t=e[n],i.push(q(t));returni}returne},x=function(e){returne.slice(0,1).toUpperCase()+e.slice(1)},I=function(e,t,n){if(!e[t]||e[t].indexOf(n)===-1)returne.hasOwnProperty(t)?e[t].push(n):e[t]?C(e,t,{value:[n].concat(e[t])}):C(e,t,{value:[n]})},F=function(e,t,n){varr;if(e[t]&&(r=e[t].indexOf(n))!==-1)returne.hasOwnProperty(t)||C(e,t,{value:[].concat(e[t])}),e[t].splice(r,1)},a=function(){functione(e,t,n){this.object=e,this.name=t,this.options=n,this.prop="_s_"+this.name+"_listeners",this.queueName="_s_"+t+"_queue",this.async="async"inthis.options?this.options.async:R.async}returne.prototype.trigger=function(){vare,t,n=this;returne=1<=arguments.length?W.call(arguments,0):[],this.queue.push(e),this.async?(t=this.queue).timeout||(t.timeout=setTimeout(function(){returnn.resolve()},0)):this.resolve()},e.prototype.bind=function(e){returnthis.options.bind&&this.options.bind.call(this.object,e),I(this.object,this.prop,e)},e.prototype.one=function(e){vart,n=this;returnt=function(e){returnn.unbind(e)},this.bind(function(){returnt(arguments.callee),e.apply(this,arguments)})},e.prototype.unbind=function(e){F(this.object,this.prop,e);if(this.options.unbind)returnthis.options.unbind.call(this.object,e)},e.prototype.resolve=function(){vare,t,n,r,i,s=this;t=function(e){if(s.object[s.prop])returns.object[s.prop].forEach(function(t){returnt.apply(s.object,e)})};if(this.options.optimize)t(this.options.optimize(this.queue));else{i=this.queue;for(n=0,r=i.length;n<r;n++)e=i[n],t(e)}returnthis.queue=[]},C(e.prototype,"listeners",{get:function(){returnthis.object[this.prop]}}),C(e.prototype,"queue",{get:function(){returnthis.object.hasOwnProperty(this.queueName)||(this.queue=[]),this.object[this.queueName]},set:function(e){returnC(this.object,this.queueName,{value:e,configurable:!0})}}),e}(),k=function(e,t,n){returnn==null&&(n={}),C(e,t,{configurable:!0,get:function(){returnnewa(this,t,n)}})},i={_identityMap:{},get:function(e,t){varn,r;n=e.uniqueId();if(n&&t)return(r=this._identityMap[n])!=null?r[t]:void0},set:function(e,t,n){varr,i;r=e.uniqueId();if(r&&t)return(i=this._identityMap)[r]||(i[r]={}),this._identityMap[r][t]=n},unset:function(e,t){varn,r;n=e.uniqueId();if(n&&t)return(r=this._identityMap)[n]||(r[n]={}),deletethis._identityMap[n][t]}},H=function(e){return(""+e).match(/^\d+$/)},s=function(){functioni(e){vart,n,r,i;e==null&&(e=[]);for(t=r=0,i=e.length;r<i;t=++r)n=e[t],this[t]=n;this.length=(e!=null?e.length:void0)||0}vare,t,n,r;k(i.prototype,"change_set"),k(i.prototype,"change_add"),k(i.prototype,"change_update"),k(i.prototype,"change_insert"),k(i.prototype,"change_delete"),k(i.prototype,"change"),i.prototype.get=function(e){returnthis[e]},i.prototype.set=function(e,t){returnthis[e]=t,H(e)&&(this.length=Math.max(this.length,e+1)),this.change_set.trigger(e,t),this.change.trigger(this),t},i.prototype.update=function(e){vart,n,r,i,s,o;n=this.clone();for(tinthis)i=this[t],H(t)&&deletethis[t];for(t=s=0,o=e.length;s<o;t=++s)r=e[t],this[t]=r;returnthis.length=(e!=null?e.length:void0)||0,this.change_update.trigger(n,this),this.change.trigger(this),e},i.prototype.sortBy=function(e){returnthis.sort(function(t,n){returnt[e]<n[e]?-1:1})},i.prototype.includes=function(e){returnthis.indexOf(e)>=0},i.prototype.find=function(e){vart,n,r;for(n=0,r=this.length;n<r;n++){t=this[n];if(e(t))returnt}},i.prototype.insertAt=function(e,t){returnArray.prototype.splice.call(this,e,0,t),this.change_insert.trigger(e,t),this.change.trigger(this),t},i.prototype.deleteAt=function(e){vart;returnt=this[e],Array.prototype.splice.call(this,e,1),this.change_delete.trigger(e,t),this.change.trigger(this),t},i.prototype["delete"]=function(e){vart;t=this.indexOf(e);if(t!==-1)returnthis.deleteAt(t)},i.prototype.first=function(){returnthis[0]},i.prototype.last=function(){returnthis[this.length-1]},i.prototype.toArray=function(){vare,t,n;e=[];for(tinthis)n=this[t],H(t)&&(e[t]=n);returne},i.prototype.clone=function(){returnnewi(this.toArray())},i.prototype.push=function(e){returnthis[this.length++]=e,this.change_add.trigger(e),this.change.trigger(this),e},i.prototype.pop=function(){returnthis.deleteAt(this.length-1)},i.prototype.unshift=function(e){returnthis.insertAt(0,e)},i.prototype.shift=function(){returnthis.deleteAt(0)},i.prototype.splice=function(){vare,t,n,r,s;returns=arguments[0],e=arguments[1],n=3<=arguments.length?W.call(arguments,2):[],r=this.clone(),t=Array.prototype.splice.apply(this,[s,e].concat(W.call(n))),this.change_update.trigger(r,this),this.change.trigger(this),newi(t)},i.prototype.sort=function(e){vart;returnt=this.clone(),Array.prototype.sort.call(this,e),this.change_update.trigger(t,this),this.change.trigger(this),this},i.prototype.reverse=function(){vare;returne=this.clone(),Array.prototype.reverse.call(this),this.change_update.trigger(e,this),this.change.trigger(this),this},r=["forEach","indexOf","lastIndexOf","join","every","some","reduce","reduceRight"];for(t=0,n=r.length;t<n;t++)e=r[t],i.prototype[e]=Array.prototype[e];returni.prototype.map=function(){vare;returne=1<=arguments.length?W.call(arguments,0):[],newi(Array.prototype.map.apply(this,e))},i.prototype.filter=function(){vare;returne=1<=arguments.length?W.call(arguments,0):[],newi(Array.prototype.filter.apply(this,e))},i.prototype.slice=function(){vare,t;returne=1<=arguments.length?W.call(arguments,0):[],newi((t=this.toArray()).slice.apply(t,e))},i.prototype.concat=function(){vare,t,n;returnt=1<=arguments.length?W.call(arguments,0):[],t=function(){varn,r,s;s=[];for(n=0,r=t.length;n<r;n++)e=t[n],einstanceofi?s.push(e.toArray()):s.push(e);returns}(),newi((n=this.toArray()).concat.apply(n,t))},i.prototype.toString=function(){returnthis.toArray().toString()},i.prototype.toLocaleString=function(){returnthis.toArray().toLocaleString()},i.prototype.toJSON=function(){returnq(this.toArray())},i}(),n=function(e){functiont(e,n,r){vari=this;this.owner=e,this.options=n,this._convert.apply(this,W.call(r).concat([function(){vare;returne=1<=arguments.length?W.call(arguments,0):[],t.__super__.constructor.call(i,e)}]))}returnX(t,e),t.prototype.set=function(e,n){varr=this;returnthis._convert(n,function(n){returnt.__super__.set.call(r,e,n)})},t.prototype.push=function(e){varn=this;returnthis._convert(e,function(e){returnt.__super__.push.call(n,e)})},t.prototype.update=function(e){varn=this;returnthis._convert.apply(this,W.call(e).concat([function(){vare;returne=1<=arguments.length?W.call(arguments,0):[],t.__super__.update.call(n,e)}]))},t.prototype.splice=function(){vare,n,r,i=this;returnr=arguments[0],e=arguments[1],n=3<=arguments.length?W.call(arguments,2):[],this._convert.apply(this,W.call(n).concat([function(){varn;returnn=1<=arguments.length?W.call(arguments,0):[],t.__super__.splice.apply(i,[r,e].concat(W.call(n)))}]))},t.prototype.insertAt=function(e,n){varr=this;returnthis._convert(n,function(n){returnt.__super__.insertAt.call(r,e,n)})},t.prototype._convert=function(){vare,t,n,r,i,s,o;n=2<=arguments.length?W.call(arguments,0,i=arguments.length-1):(i=0,[]),e=arguments[i++],n=function(){vare,r,i;i=[];for(e=0,r=n.length;e<r;e++)t=n[e],(t!=null?t.constructor:void0)===Object&&this.options.as?i.push(t=new(this.options.as())(t)):i.push(t);returni}.call(this),r=e.apply(null,n);for(s=0,o=n.length;s<o;s++)t=n[s],this.options.inverseOf&&t[this.options.inverseOf]!==this.owner&&(t[this.options.inverseOf]=this.owner);returnr},t}(s),_={},U=function(e,t){varn,r,i,s,o,u,a,f;f=[];for(u=0,a=t.length;u<a;u++)r=t[u],_.hasOwnProperty(r)?f.push(function(){vart,u,a,f,l,c,h;a=_[r],h=[];for(t=0,u=a.length;t<u;t++)f=a[t],r=f.name,o=f.type,i=f.object,s=f.subname,n=f.dependency,o==="singular"?e===i[r]?h.push((l=i[n+"_property"])!=null?typeofl.trigger=="function"?l.trigger(i):void0:void0):h.push(void0):o==="collection"?V.call(i[r],e)>=0?h.push((c=i[n+"_property"])!=null?typeofc.trigger=="function"?c.trigger(i):void0:void0):h.push(void0):h.push(void0);returnh}()):f.push(void0);returnf},y=function(){functione(e,t){varn,r,i;this.name=e,A(this,t),this.dependencies=[],this.localDependencies=[],this.globalDependencies=[];if(this.dependsOn){i=[].concat(this.dependsOn);for(n=0,r=i.length;n<r;n++)e=i[n],this.addDependency(e)}this.async="async"int?t.async:R.async,this.eventOptions={async:this.async,bind:function(){returnthis[e]},optimize:function(e){returne[e.length-1]}}}returne.prototype.addDependency=function(e){vart,n,r,i;if(this.dependencies.indexOf(e)===-1){this.dependencies.push(e),e.match(/\./)?(n="singular",r=e.split("."),e=r[0],t=r[1]):e.match(/:/)&&(n="collection",i=e.split(":"),e=i[0],t=i[1]),this.localDependencies.push(e),this.localDependencies.indexOf(e)===-1&&this.localDependencies.push(e);if(n)returnthis.globalDependencies.push({subname:t,name:e,type:n})}},e}(),g=function(){functione(e,t){this.definition=e,this.object=t,this.name=this.definition.name,this.valueName="_s_"+this.name+"_val",this.event=newa(this.object,this.name+"_change",this.definition.eventOptions)}returne.prototype.set=function(e){returntypeofe=="function"?this.definition.get=e:(this.definition.set?this.definition.set.call(this.object,e):C(this.object,this.valueName,{value:e,configurable:!0}),this.trigger())},e.prototype.get=function(){vare,t,n=this;returnthis.registerGlobal(),this.definition.get?(e=function(e){returnn.definition.addDependency(e)},"dependsOn"inthis.definition||this.object._s_property_access.bind(e),t=this.definition.get.call(this.object),"dependsOn"inthis.definition||this.object._s_property_access.unbind(e)):t=this.object[this.valueName],this.object._s_property_access.trigger(this.name),t},e.prototype.format=function(){returntypeofthis.definition.format=="function"?this.definition.format.call(this.object,this.get()):this.get()},e.prototype.registerGlobal=function(){vare,t,n,r,i,s,o,u;if(!this.object["_s_glb_"+this.name]){C(this.object,"_s_glb_"+this.name,{value:!0,configurable:!0}),s=this.definition.globalDependencies,u=[];for(r=0,i=s.length;r<i;r++)o=s[r],e=o.name,n=o.type,t=o.subname,_[t]||(_[t]=[]),u.push(_[t].push({object:this.object,subname:t,name:e,type:n,dependency:this.name}));returnu}},e.prototype.trigger=function(){vare,t,n,r,i,s,o,u;n=[this.name].concat(this.dependents),e={};for(i=0,s=n.length;i<s;i++)t=n[i],e[t]=this.object[t];(o=this.object.changed)!=null&&typeofo.trigger=="function"&&o.trigger(e),U(this.object,n),u=[];for(tine){if(!z.call(e,t))continue;r=e[t],u.push(this.object[t+"_property"].event.trigger(r))}returnu},e.prototype.bind=function(e){returnthis.event.bind(e)},e.prototype.unbind=function(e){returnthis.event.unbind(e)},e.prototype.one=function(e){returnthis.event.one(e)},C(e.prototype,"dependents",{get:function(){vare,t,n=this;returne=[],t=function(r){vari,s,o,u,a,f;u=n.object._s_properties,f=[];for(s=0,o=u.length;s<o;s++)i=u[s],(a=i.name,V.call(e,a)<0)&&V.call(i.localDependencies,r)>=0?(e.push(i.name),f.push(t(i.name))):f.push(void0);returnf},t(this.name),e}}),C(e.prototype,"listeners",{get:function(){returnthis.event.listeners}}),e}(),L=function(e,t,n){varr;n==null&&(n={}),r=newy(t,n),I(e,"_s_properties",r),k(e,"_s_property_access"),C(e,t,{get:function(){returnthis[t+"_property"].get()},set:function(e){returnthis[t+"_property"].set(e)},configurable:!0,enumerable:"enumerable"inn?n.enumerable:!0}),C(e,t+"_property",{get:function(){returnnewg(r,this)},configurable:!0}),typeofn.serialize=="string"&&L(e,n.serialize,{get:function(){returnthis[t]},set:function(e){returnthis[t]=e},configurable:!0});if("value"inn)returne[t]=n.value},D=1,d=function(){functione(e){vart;if(this.constructor.identityMap&&(e!=null?e.id:void0)){t=i.get(this.constructor,e.id);if(t)returnt.set(e),t;i.set(this.constructor,e.id,this)}this.set(e)}returnk(e.prototype,"saved"),k(e.prototype,"changed",{optimize:function(e){vart,n,r,i;n={};for(r=0,i=e.length;r<i;r++)t=e[r],A(n,t[0]);return[n]}}),e.belongsTo=function(){vare;return(e=this.prototype).belongsTo.apply(e,arguments)},e.hasMany=function(){vare;return(e=this.prototype).hasMany.apply(e,arguments)},e.identityMap=!0,e.find=function(e){returni.get(this,e)||newthis({id:e})},e.extend=function(e){vart;returnt=function(t){functionn(){vart;t=n.__super__.constructor.apply(this,arguments);if(t)returnt;e&&e.apply(this,arguments)}returnX(n,t),n}(this)},e.property=function(){vare,t,n,r,i,s,o;t=2<=arguments.length?W.call(arguments,0,r=arguments.length-1):(r=0,[]),n=arguments[r++],typeofn=="string"&&(t.push(n),n={}),o=[];for(i=0,s=t.length;i<s;i++)e=t[i],o.push(L(this.prototype,e,n));returno},e.properties=function(){vare,t,n,r,i;t=1<=arguments.length?W.call(arguments,0):[],i=[];for(n=0,r=t.length;n<r;n++)e=t[n],i.push(this.property(e));returni},e.delegate=function(){vare,t,n,r,i=this;returne=2<=arguments.length?W.call(arguments,0,r=arguments.length-1):(r=0,[]),t=arguments[r++],n=t.to,e.forEach(function(e){varr;returnr=e,t.prefix===!0?r=n+x(e):t.prefix&&(r=t.prefix+x(e)),t.suffix===!0?r+=x(n):t.suffix&&(r+=t.suffix),i.property(r,{dependsOn:""+n+"."+e,get:function(){vart;return(t=this[n])!=null?t[e]:void0},set:function(t){varr;return(r=this[n])!=null?r[e]=t:void0}})})},e.collection=function(e,t){returnt==null&&(t={}),A(t,{get:function(){vart,n=this;returnt="_s_"+e+"_val",this[t]||(this[t]=news([]),this[t].change.bind(function(){returnn[e+"_property"].trigger()})),this[t]},set:function(t){returnthis[e].update(t)}}),this.property(e,t),this.property(e+"Count",{get:function(){returnthis[e].length},dependsOn:e})},e.belongsTo=function(e,t){returnt==null&&(t={}),A(t,{set:function(n){varr,i;i="_s_"+e+"_val",n&&n.constructor===Object&&t.as&&(n=new(t.as())(n)),r=this[i],this[i]=n;if(t.inverseOf&&!n[t.inverseOf].includes(this))returnr&&r[t.inverseOf]["delete"](this),n[t.inverseOf].push(this)}}),this.property(e,t),this.property(e+"Id",{get:function(){vart;return(t=this[e])!=null?t.id:void0},set:function(n){if(n!=null)returnthis[e]=t.as().find(n)},dependsOn:e,serialize:t.serializeId})},e.hasMany=function(e,t){returnt==null&&(t={}),A(t,{get:function(){varr,i=this;returnr="_s_"+e+"_val",this[r]||(this[r]=newn(this,t,[]),this[r].change.bind(function(){returni[e+"_property"].trigger()})),this[r]},set:function(t){returnthis[e].update(t)}}),this.property(e,t),this.property(e+"Ids",{get:function(){return(news(this[e])).map(function(e){returne!=null?e.id:void0})},set:function(n){varr,i;returni=function(){vare,i,s;s=[];for(e=0,i=n.length;e<i;e++)r=n[e],s.push(t.as().find(r));returns}(),this[e].update(i)},dependsOn:e,serialize:t.serializeIds}),this.property(e+"Count",{get:function(){returnthis[e].length},dependsOn:e})},e.selection=function(e,t){returnt==null&&(t={}),this.property(e,{get:function(){returnthis[t.from].filter(function(e){returne[t.filter]})},dependsOn:""+t.from+":"+t.filter}),this.property(e+"Count",{get:function(){returnthis[e].length},dependsOn:e})},e.uniqueId=function(){if(!this._uniqueId||this._uniqueGen!==this)this._uniqueId=D+=1,this._uniqueGen=this;returnthis._uniqueId},e.property("id",{serialize:!0,set:function(e){returni.unset(this.constructor,this.id),i.set(this.constructor,e,this),C(this,"_s_id_val",{value:e,configurable:!0})},get:function(){returnthis._s_id_val}}),e.prototype.set=function(e){vart,n,r;r=[];for(tine){if(!z.call(e,t))continue;n=e[t],tinthis||L(this,t),r.push(this[t]=n)}returnr},e.prototype.save=function(){returnthis.saved.trigger()},e.prototype.toJSON=function(){vare,t,n,r,i,s,o,u;n={},o=this._s_properties;for(i=0,s=o.length;i<s;i++)t=o[i],typeoft.serialize=="string"?n[t.serialize]=q(this[t.name]):typeoft.serialize=="function"?(u=t.serialize.call(this),e=u[0],r=u[1],n[e]=q(r)):t.serialize&&(n[t.name]=q(this[t.name]));returnn},e.prototype.toString=function(){returnJSON.stringify(this.toJSON())},e}(),f=/^[a-zA-Z][a-zA-Z0-9\-_]*/,c=/^[\[\]=\:\-!#\.@]/,b=/^"((?:\\.|[^"])*)"/,p=/^(?:\r?\n[^\r\n\S]*)+/,S=/^[^\r\n\S]+/,r=/^\s*\/\/[^\n]*/,l=["IF","ELSE","COLLECTION","IN","VIEW","UNLESS"],h=function(){functione(){}returne.prototype.tokenize=function(e,t){varn;t==null&&(t={}),this.code=e.replace(/^\s*/,"").replace(/\s*$/,""),this.line=t.line||0,this.indent=0,this.indents=[],this.ends=[],this.tokens=[],this.i=0;while(this.chunk=this.code.slice(this.i))this.i+=this.identifierToken()||this.commentToken()||this.whitespaceToken()||this.lineToken()||this.stringToken()||this.literalToken();while(n=this.ends.pop())n==="OUTDENT"?this.token("OUTDENT"):this.error("missing "+n);while(this.tokens[0][0]==="TERMINATOR")this.tokens.shift();while(this.tokens[this.tokens.length-1][0]==="TERMINATOR")this.tokens.pop();returnthis.tokens},e.prototype.commentToken=function(){vare;return(e=r.exec(this.chunk))?e[0].length:0},e.prototype.whitespaceToken=function(){vare;return(e=S.exec(this.chunk))?(this.token("WHITESPACE",e[0].length),e[0].length):0},e.prototype.token=function(e,t){returnthis.tokens.push([e,t,this.line])},e.prototype.identifierToken=function(){vare,t;return(e=f.exec(this.chunk))?(t=e[0].toUpperCase(),t==="ELSE"&&this.last(this.tokens,2)[0]==="TERMINATOR"&&this.tokens.splice(this.tokens.length-3,1),V.call(l,t)>=0?this.token(t,e[0]):this.token("IDENTIFIER",e[0]),e[0].length):0},e.prototype.stringToken=function(){vare;return(e=b.exec(this.chunk))?(this.token("STRING_LITERAL",e[1]),e[0].length):0},e.prototype.lineToken=function(){vare,t,n,r,i;if(!(n=p.exec(this.chunk)))return0;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();elseif(i>this.indent)this.token("INDENT"),this.indents.push(e),this.ends.push("OUTDENT");else{while(e<0)this.ends.pop(),e+=this.indents.pop(),this.token("OUTDENT");this.token("TERMINATOR","\n")}returnthis.indent=i,t.length},e.prototype.literalToken=function(){vare;return(e=c.exec(this.chunk))?(this.token(e[0]),1):this.error("Unexpected token '"+this.chunk.charAt(0)+"'")},e.prototype.newlineToken=function(){if(this.tag()!=="TERMINATOR")returnthis.token("TERMINATOR","\n")},e.prototype.tag=function(e,t){varn;return(n=this.last(this.tokens,e))&&(t?n[0]=t:n[0])},e.prototype.value=function(e,t){varn;return(n=this.last(this.tokens,e))&&(t?n[1]=t:n[1])},e.prototype.error=function(e){vart;throwt=this.code.slice(Math.max(0,this.i-10),Math.min(this.code.length,this.i+10)),SyntaxError(""+e+" on line "+(this.line+1)+" near "+JSON.stringify(t))},e.prototype.count=function(e,t){varn,r;n=r=0;if(!t.length)return1/0;while(r=1+e.indexOf(t,r))n++;returnn},e.prototype.last=function(e,t){returne[e.length-(t||0)-1]},e}(),v=function(){functione(e,t){this.ast=e,this.element=t,this.children=news([]),this.boundClasses=news([])}returnk(e.prototype,"load"),k(e.prototype,"unload"),e.prototype.append=function(e){returne.appendChild(this.element)},e.prototype.insertAfter=function(e){returne.parentNode.insertBefore(this.element,e.nextSibling)},e.prototype.remove=function(){vare;returnthis.unbindEvents(),(e=this.element.parentNode)!=null?e.removeChild(this.element):void0},e.prototype.lastElement=function(){returnthis.element},e.prototype.nodes=function(){returnthis.children},e.prototype.bindEvent=function(e,t){if(e)returnthis.boundEvents||(this.boundEvents=[]),this.boundEvents.push({event:e,fun:t}),e.bind(t)},e.prototype.unbindEvents=function(){vare,t,n,r,i,s,o,u,a,f,l;this.unload.trigger(),u=this.nodes();for(r=0,s=u.length;r<s;r++)n=u[r],n.unbindEvents();if(this.boundEvents){a=this.boundEvents,l=[];for(i=0,o=a.length;i<o;i++)f=a[i],e=f.event,t=f.fun,l.push(e.unbind(t));returnl}},e.prototype.updateClass=function(){vare;returne=this.ast.classes,this.attributeClasses&&(e=e.concat(this.attributeClasses)),this.boundClasses.length&&(e=e.concat(this.boundClasses.toArray())),e.length?this.element.className=e.join(""):this.element.removeAttribute("class")},e}(),u=function(e){functiont(e){this.ast=e,this.anchor=w.document.createTextNode(""),this.nodeSets=news([])}returnX(t,e),t.prototype.nodes=function(){vare,t,n,r,i,s,o,u;t=[],u=this.nodeSets;for(r=0,s=u.length;r<s;r++){n=u[r];for(i=0,o=n.length;i<o;i++)e=n[i],t.push(e)}returnt},t.prototype.rebuild=function(){vare,t,n,r,i,s;if(this.anchor.parentNode){e=this.anchor,i=this.nodes(),s=[];for(n=0,r=i.length;n<r;n++)t=i[n],t.insertAfter(e),s.push(e=t.lastElement());returns}},t.prototype.replace=function(e){vart;returnthis.clear(),this.nodeSets.update(function(){varn,r,i;i=[];for(n=0,r=e.length;n<r;n++)t=e[n],i.push(news(t));returni}()),this.rebuild()},t.prototype.appendNodeSet=function(e){returnthis.insertNodeSet(this.nodeSets.length,e)},t.prototype.deleteNodeSet=function(e){vart,n,r,i;i=this.nodeSets[e];for(n=0,r=i.length;n<r;n++)t=i[n],t.remove();returnthis.nodeSets.deleteAt(e)},t.prototype.insertNodeSet=function(e,t){varn,r,i,o,u,a;n=((u=this.nodeSets[e-1])!=null?(a=u.last())!=null?a.lastElement():void0:void0)||this.anchor;for(i=0,o=t.length;i<o;i++)r=t[i],r.insertAfter(n),n=r.lastElement();returnthis.nodeSets.insertAt(e,news(t))},t.prototype.clear=function(){vare,t,n,r;r=this.nodes();for(t=0,n=r.length;t<n;t++)e=r[t],e.remove();returnthis.nodeSets.update([])},t.prototype.remove=function(){returnthis.unbindEvents(),this.clear(),this.anchor.parentNode.removeChild(this.anchor)},t.prototype.append=function(e){returne.appendChild(this.anchor),this.rebuild()},t.prototype.insertAfter=function(e){returne.parentNode.insertBefore(this.anchor,e.nextSibling),this.rebuild()},t.prototype.lastElement=function(){vare,t;return((e=this.nodeSets.last())!=null?(t=e.last())!=null?t.lastElement():void0:void0)||this.anchor},t}(v),M=function(e,t){returne.bound&&e.value?O(t,e.value):e.value!=null?e.value:t},m={style:function(e,t,n,r){vari;i=function(){returnt.element.style[e.name]=M(e,n)},i();if(e.bound)returnt.bindEvent(n[""+e.value+"_property"],i)},event:function(e,t,n,r){returnt.element.addEventListener(e.name,function(i){returne.preventDefault&&i.preventDefault(),r[e.value](t.element,n,i)})},"class":function(e,t,n,r){vari;returni=function(){returnn[e.value]?t.boundClasses.push(e.name):t.boundClasses["delete"](e.name),t.updateClass()},i(),t.bindEvent(n[""+e.value+"_property"],i)},binding:function(e,t,n,r){vari,s,o,u,a;returns=t.element,(a=t.ast.name)==="input"||a==="textarea"||a==="select"||function(){throwSyntaxError("invalid node type "+t.ast.name+" for two way binding")}(),e.value||function(){throwSyntaxError("cannot bind to whole model, please specify an attribute to bind to")}(),i=function(){returnn[e.value]=s.type==="checkbox"?s.checked:s.type==="radio"?s.checked?s.getAttribute("value"):void0:s.value},u=function(){vart;t=n[e.value];if(s.type==="checkbox")returns.checked=!!t;if(s.type==="radio"){if(t===s.getAttribute("value"))returns.checked=!0}else{t===void0&&(t="");if(s.value!==t)returns.value=t}},u(),t.bindEvent(n[""+e.value+"_property"],u),e.name==="binding"?(o=function(e){if(s.form===(e.target||e.srcElement))returni()},w.document.addEventListener("submit",o,!0),t.unload.bind(function(){returnw.document.removeEventListener("submit",o,!0)})):s.addEventListener(e.name,i)},attribute:function(e,t,n,r){vari,s;returne.name==="binding"?m.binding(e,t,n,r):(i=t.element,s=function(){varr;returnr=M(e,n),e.name==="value"?i.value=r||"":t.ast.name==="input"&&e.name==="checked"?i.checked=!!r:e.name==="class"?(t.attributeClasses=r,t.updateClass()):r===void0?i.removeAttribute(e.name):(r===0&&(r="0"),i.setAttribute(e.name,r))},e.bound&&t.bindEvent(n[""+e.value+"_property"],s),s())},on:function(e,t,n,r){vari;if((i=e.name)==="load"||i==="unload")returnt[e.name].bind(function(){returnr[e.value](t.element,n)});thrownewSyntaxError("unkown lifecycle event '"+e.name+"'")}},o={element:function(e,t,n){varr,i,s,o,u,a,f,l,c,h,p,d,g;o=w.document.createElement(e.name),u=newv(e,o),e.id&&o.setAttribute("id",e.id),((p=e.classes)!=null?p.length:void0)&&o.setAttribute("class",e.classes.join("")),d=e.children;for(f=0,c=d.length;f<c;f++)i=d[f],s=T(i,t,n),s.append(o),u.children.push(s);g=e.properties;for(l=0,h=g.length;l<h;l++){a=g[l],r=m[a.scope];if(!r)throwSyntaxError(""+a.scope+" is not a valid scope");r(a,u,t,n)}returnu.load.trigger(),u},view:function(e,t,n){varr,i;returnr=w.controllerFor(e.argument),r||(i=!0,r=n),w._views[e.argument].node(t,r,n,i)},helper:function(e,t,n){varr,i,s,o,a,f,l,c,h;s=newu(e),a=function(t,n){varr,i,s,o,u,a;t==null&&(t=t),n==null&&(n=n),i=w.document.createDocumentFragment(),a=e.children;for(o=0,u=a.length;o<u;o++)r=a[o],s=T(r,t,n),s.append(i);returni},o=w.Helpers[e.command]||function(){throwSyntaxError("no helper "+e.command+" defined")}(),i={render:a,model:t,controller:n},f=function(){varn,r,u;returnn=e.arguments.map(function(e){returne.bound?t[e.value]:e.value}),u=function(){vart,s,u,a;u=B(o.apply(i,n)),a=[];for(t=0,s=u.length;t<s;t++)r=u[t],a.push(newv(e,r));returna}(),s.replace([u])},h=e.arguments;for(l=0,c=h.length;l<c;l++)r=h[l],r.bound===!0&&s.bindEvent(t[""+r.value+"_property"],f);returnf(),s},text:function(e,t,n){varr,i,s;returnr=function(){varn;returnn=M(e,t),n===0&&(n="0"),n||""},s=w.document.createTextNode(r()),i=newv(e,s),e.bound&&i.bindEvent(t[""+e.value+"_property"],function(){returns.nodeValue=r()}),i},collection:function(e,t,n){varr,i,s,o,u=this;returni=function(t){returnN(e.children,t,n)},o=function(e,t){varn;returne.replace(function(){vare,r,s;s=[];for(e=0,r=t.length;e<r;e++)n=t[e],s.push(i(n));returns}())},s=this.bound(e,t,n,o),r=t[e.argument],s.bindEvent(r.change_set,function(){vare;returns.replace(function(){vart,n,s;s=[];for(t=0,n=r.length;t<n;t++)e=r[t],s.push(i(e));returns}())}),s.bindEvent(r.change_update,function(){vare;returns.replace(function(){vart,n,s;s=[];for(t=0,n=r.length;t<n;t++)e=r[t],s.push(i(e));returns}())}),s.bindEvent(r.change_add,function(e){returns.appendNodeSet(i(e))}),s.bindEvent(r.change_insert,function(e,t){returns.insertNodeSet(e,i(t))}),s.bindEvent(r.change_delete,function(e){returns.deleteNodeSet(e)}),s},"in":function(e,t,n){returnthis.bound(e,t,n,function(t,r){returnr?t.replace([N(e.children,r,n)]):t.clear()})},"if":function(e,t,n){returnthis.bound(e,t,n,function(r,i){returni?r.replace([N(e.children,t,n)]):e["else"]?r.replace([N(e["else"].children,t,n)]):r.clear()})},unless:function(e,t,n){returnthis.bound(e,t,n,function(r,i){vars,o;returni?r.clear():(o=function(){varr,i,o,u;o=e.children,u=[];for(r=0,i=o.length;r<i;r++)s=o[r],u.push(T(s,t,n));returnu}(),r.replace([o]))})},bound:function(e,t,n,r){vari,s;returni=newu(e),s=function(){varn;returnn=t[e.argument],r(i,n)},s(),i.bindEvent(t[""+e.argument+"_property"],s),i}},B=function(e){vart;returne?(t=function(e,t){varn,r,i,s,o;if(typeoft=="string"){r=w.document.createElement("div"),r.innerHTML=t,o=r.children;for(i=0,s=o.length;i<s;i++)n=o[i],e.push(n)}elsee.push(t);returne},[].concat(e).reduce(t,[])):[]},T=function(e,t,n){returno[e.type](e,t,n)},N=function(e,t,n){varr,i,s,o;o=[];for(i=0,s=e.length;i<s;i++)r=e[i],o.push(T(r,t,n));returno},t.lexer={lex:function(){vare,t;returnt=this.tokens[this.pos++]||[""],e=t[0],this.yytext=t[1],this.yylineno=t[2],e},setInput:function(e){returnthis.tokens=e,this.pos=0},upcomingInput:function(){return""}},E=function(){functione(e,t){this.name=e,this.view=t}returne.prototype.parse=function(){if(typeofthis.view!="string")returnthis.view;try{returnthis.view=t.parse((newh).tokenize(this.view))}catch(e){throwthis.name&&(e.message="In view '"+this.name+"': "+e.message),e}},e.prototype.render=function(){vare;returne=1<=arguments.length?W.call(arguments,0):[],this.node.apply(this,e).element},e.prototype.node=function(e,t,n,r){vari;returnthis.name&&(t||(t=w.controllerFor(this.name,e))),t||(t={}),typeoft=="function"&&(t=newt(e,n)),i=T(this.parse(),e,t),r||typeoft.loaded=="function"&&t.loaded(i.element,e),i},e}(),w=function(e){vart,n,r;n=Object.create(e);for(tine)r=e[t],L(n,t,{value:r});returnn},A(w,{VERSION:"0.4.0",_views:{},_controllers:{},document:typeofwindow!="undefined"&&window!==null?window.document:void0,format:O,defineProperty:L,defineEvent:k,asyncEvents:!1,view:function(e,t){returnt?this._views[e]=newE(e,t):newE(void0,e)},render:function(e,t,n,r,i){returnthis._views[e].render(t,n,r,i)},controller:function(e,t){returnthis._controllers[e]=t},controllerFor:function(e){returnthis._controllers[e]},clearIdentityMap:function(){returni._identityMap={}},clearLocalStorage:function(){returni._storage.clear()},clearCache:function(){vare,t,n,r,i;w.clearIdentityMap(),w.clearLocalStorage(),i=[];for(e=n=0,r=_.length;n<r;e=++n)t=_[e],i.push(delete_[e]);returni},unregisterAll:function(){returnw._views={},w._controllers={}},Model:d,Collection:s,Cache:i,View:E,Helpers:{}}),C(w,"async",{get:function(){returnR.async},set:function(e){returnR.async=e}}),e.Serenade=w})(this)
(function(e){vart=function(){functiont(){this.yy={}}vare={trace:function(){},yy:{},symbols_:{error:2,Root:3,ChildList:4,ElementIdentifier:5,AnyIdentifier:6,"#":7,".":8,Element:9,"[":10,"]":11,PropertyList:12,WHITESPACE:13,Text:14,INDENT:15,OUTDENT:16,TextList:17,Bound:18,STRING_LITERAL:19,Child:20,TERMINATOR:21,IfInstruction:22,Instruction:23,Helper:24,Property:25,"=":26,"!":27,":":28,"-":29,VIEW:30,COLLECTION:31,UNLESS:32,IN:33,IDENTIFIER:34,IF:35,ElseInstruction:36,ELSE:37,"@":38,$accept:0,$end:1},terminals_:{2:"error",7:"#",8:".",10:"[",11:"]",13:"WHITESPACE",15:"INDENT",16:"OUTDENT",19:"STRING_LITERAL",21:"TERMINATOR",26:"=",27:"!",28:":",29:"-",30:"VIEW",31:"COLLECTION",32:"UNLESS",33:"IN",34:"IDENTIFIER",35:"IF",37:"ELSE",38:"@"},productions_:[0,[3,0],[3,1],[5,1],[5,3],[5,2],[5,2],[5,3],[9,1],[9,3],[9,4],[9,3],[9,4],[17,1],[17,3],[14,1],[14,1],[4,1],[4,3],[20,1],[20,1],[20,1],[20,1],[20,1],[12,1],[12,3],[25,3],[25,3],[25,4],[25,4],[25,3],[25,3],[23,5],[23,5],[23,5],[23,5],[23,4],[24,3],[24,3],[24,4],[22,5],[22,4],[22,2],[36,6],[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){vara=o.length-1;switch(s){case1:this.$=null;break;case2:returnthis.$;case3:this.$={name:o[a],classes:[]};break;case4:this.$={name:o[a-2],id:o[a],classes:[]};break;case5:this.$={name:"div",id:o[a],classes:[]};break;case6:this.$={name:"div",classes:[o[a]]};break;case7:this.$=function(){returno[a-2].classes.push(o[a]),o[a-2]}();break;case8:this.$={name:o[a].name,id:o[a].id,classes:o[a].classes,properties:[],children:[],type:"element"};break;case9:this.$=o[a-2];break;case10:this.$=function(){returno[a-3].properties=o[a-1],o[a-3]}();break;case11:this.$=function(){returno[a-2].children=o[a-2].children.concat(o[a]),o[a-2]}();break;case12:this.$=function(){returno[a-3].children=o[a-3].children.concat(o[a-1]),o[a-3]}();break;case13:this.$=[o[a]];break;case14:this.$=o[a-2].concat(o[a]);break;case15:this.$={type:"text",value:o[a],bound:!0};break;case16:this.$={type:"text",value:o[a],bound:!1};break;case17:this.$=[].concat(o[a]);break;case18:this.$=o[a-2].concat(o[a]);break;case19:this.$=o[a];break;case20:this.$=o[a];break;case21:this.$=o[a];break;case22:this.$=o[a];break;case23:this.$=o[a];break;case24:this.$=[o[a]];break;case25:this.$=o[a-2].concat(o[a]);break;case26:this.$={name:o[a-2],value:o[a],bound:!0,scope:"attribute"};break;case27:this.$={name:o[a-2],value:o[a],bound:!0,scope:"attribute"};break;case28:this.$={name:o[a-3],value:o[a-1],bound:!0,scope:"attribute",preventDefault:!0};break;case29:this.$={name:o[a-3],value:o[a-1],bound:!0,scope:"attribute",preventDefault:!0};break;case30:this.$={name:o[a-2],value:o[a],bound:!1,scope:"attribute"};break;case31:this.$=function(){returno[a].scope=o[a-2],o[a]}();break;case32:this.$={children:[],type:"view",argument:o[a]};break;case33:this.$={children:[],type:"collection",argument:o[a]};break;case34:this.$={children:[],type:"unless",argument:o[a]};break;case35:this.$={children:[],type:"in",argument:o[a]};break;case36:this.$=function(){returno[a-3].children=o[a-1],o[a-3]}();break;case37:this.$={command:o[a],arguments:[],children:[],type:"helper"};break;case38:this.$=function(){returno[a-2].arguments.push(o[a]),o[a-2]}();break;case39:this.$=function(){returno[a-3].children=o[a-1],o[a-3]}();break;case40:this.$={children:[],type:"if",argument:o[a]};break;case41:this.$=function(){returno[a-3].children=o[a-1],o[a-3]}();break;case42:this.$=function(){returno[a-1]["else"]=o[a],o[a-1]}();break;case43:this.$={arguments:[],children:o[a-1],type:"else"};break;case44:this.$=o[a];break;case45:this.$=o[a];break;case46:this.$=o[a];break;case47:this.$=o[a];break;case48:this.$=o[a];break;case49:this.$=o[a];break;case50:this.$=o[a];break;case51:this.$=function(){}()}},table:[{1:[2,1],3:1,4:2,5:9,6:12,7:[1,13],8:[1,14],9:4,14:11,17:8,18:15,19:[1,16],20:3,22:5,23:6,24:7,29:[1,10],30:[1,17],31:[1,18],32:[1,20],33:[1,21],34:[1,22],35:[1,19],38:[1,23]},{1:[3]},{1:[2,2],21:[1,24]},{1:[2,17],16:[2,17],21:[2,17]},{1:[2,19],10:[1,25],13:[1,26],15:[1,27],16:[2,19],21:[2,19]},{1:[2,20],15:[1,28],16:[2,20],21:[2,20],29:[1,30],36:29},{1:[2,21],15:[1,31],16:[2,21],21:[2,21]},{1:[2,22],13:[1,32],15:[1,33],16:[2,22],21:[2,22]},{1:[2,23],13:[1,34],16:[2,23],21:[2,23]},{1:[2,8],8:[1,35],10:[2,8],13:[2,8],15:[2,8],16:[2,8],21:[2,8]},{13:[1,36]},{1:[2,13],13:[2,13],16:[2,13],21:[2,13]},{1:[2,3],7:[1,37],8:[2,3],10:[2,3],13:[2,3],15:[2,3],16:[2,3],21:[2,3]},{6:38,30:[1,17],31:[1,18],32:[1,20],33:[1,21],34:[1,22],35:[1,19]},{6:39,30:[1,17],31:[1,18],32:[1,20],33:[1,21],34:[1,22],35:[1,19]},{1:[2,15],10:[2,15],13:[2,15],15:[2,15],16:[2,15],21:[2,15]},{1:[2,16],10:[2,16],13:[2,16],15:[2,16],16:[2,16],21:[2,16]},{1:[2,44],7:[2,44],8:[2,44],10:[2,44],11:[2,44],13:[2,44],15:[2,44],16:[2,44],21:[2,44],26:[2,44],27:[2,44],28:[2,44],29:[2,44]},{1:[2,45],7:[2,45],8:[2,45],10:[2,45],11:[2,45],13:[2,45],15:[2,45],16:[2,45],21:[2,45],26:[2,45],27:[2,45],28:[2,45],29:[2,45]},{1:[2,46],7:[2,46],8:[2,46],10:[2,46],11:[2,46],13:[2,46],15:[2,46],16:[2,46],21:[2,46],26:[2,46],27:[2,46],28:[2,46],29:[2,46]},{1:[2,47],7:[2,47],8:[2,47],10:[2,47],11:[2,47],13:[2,47],15:[2,47],16:[2,47],21:[2,47],26:[2,47],27:[2,47],28:[2,47],29:[2,47]},{1:[2,48],7:[2,48],8:[2,48],10:[2,48],11:[2,48],13:[2,48],15:[2,48],16:[2,48],21:[2,48],26:[2,48],27:[2,48],28:[2,48],29:[2,48]},{1:[2,49],7:[2,49],8:[2,49],10:[2,49],11:[2,49],13:[2,49],15:[2,49],16:[2,49],21:[2,49],26:[2,49],27:[2,49],28:[2,49],29:[2,49]},{1:[2,51],6:40,10:[2,51],11:[2,51],13:[2,51],15:[2,51],16:[2,51],21:[2,51],27:[2,51],29:[2,51],30:[1,17],31:[1,18],32:[1,20],33:[1,21],34:[1,22],35:[1,19]},{5:9,6:12,7:[1,13],8:[1,14],9:4,14:11,17:8,18:15,19:[1,16],20:41,22:5,23:6,24:7,29:[1,10],30:[1,17],31:[1,18],32:[1,20],33:[1,21],34:[1,22],35:[1,19],38:[1,23]},{6:45,11:[1,42],12:43,25:44,30:[1,17],31:[1,18],32:[1,20],33:[1,21],34:[1,22],35:[1,19]},{14:46,18:15,19:[1,16],38:[1,23]},{4:47,5:9,6:12,7:[1,13],8:[1,14],9:4,14:11,17:8,18:15,19:[1,16],20:3,22:5,23:6,24:7,29:[1,10],30:[1,17],31:[1,18],32:[1,20],33:[1,21],34:[1,22],35:[1,19],38:[1,23]},{4:48,5:9,6:12,7:[1,13],8:[1,14],9:4,14:11,17:8,18:15,19:[1,16],20:3,22:5,23:6,24:7,29:[1,10],30:[1,17],31:[1,18],32:[1,20],33:[1,21],34:[1,22],35:[1,19],38:[1,23]},{1:[2,42],15:[2,42],16:[2,42],21:[2,42],29:[2,42]},{13:[1,49]},{4:50,5:9,6:12,7:[1,13],8:[1,14],9:4,14:11,17:8,18:15,19:[1,16],20:3,22:5,23:6,24:7,29:[1,10],30:[1,17],31:[1,18],32:[1,20],33:[1,21],34:[1,22],35:[1,19],38:[1,23]},{14:51,18:15,19:[1,16],38:[1,23]},{4:52,5:9,6:12,7:[1,13],8:[1,14],9:4,14:11,17:8,18:15,19:[1,16],20:3,22:5,23:6,24:7,29:[1,10],30:[1,17],31:[1,18],32:[1,20],33:[1,21],34:[1,22],35:[1,19],38:[1,23]},{14:53,18:15,19:[1,16],38:[1,23]},{6:54,30:[1,17],31:[1,18],32:[1,20],33:[1,21],34:[1,22],35:[1,19]},{30:[1,56],31:[1,57],32:[1,58],33:[1,59],34:[1,60],35:[1,55]},{6:61,30:[1,17],31:[1,18],32:[1,20],33:[1,21],34:[1,22],35:[1,19]},{1:[2,5],8:[2,5],10:[2,5],13:[2,5],15:[2,5],16:[2,5],21:[2,5]},{1:[2,6],8:[2,6],10:[2,6],13:[2,6],15:[2,6],16:[2,6],21:[2,6]},{1:[2,50],10:[2,50],11:[2,50],13:[2,50],15:[2,50],16:[2,50],21:[2,50],27:[2,50],29:[2,50]},{1:[2,18],16:[2,18],21:[2,18]},{1:[2,9],10:[2,9],13:[2,9],15:[2,9],16:[2,9],21:[2,9]},{11:[1,62],13:[1,63]},{11:[2,24],13:[2,24]},{26:[1,64],28:[1,65]},{1:[2,11],10:[2,11],13:[2,11],15:[2,11],16:[2,11],21:[2,11]},{16:[1,66],21:[1,24]},{16:[1,67],21:[1,24]},{37:[1,68]},{16:[1,69],21:[1,24]},{1:[2,38],13:[2,38],15:[2,38],16:[2,38],21:[2,38]},{16:[1,70],21:[1,24]},{1:[2,14],13:[2,14],16:[2,14],21:[2,14]},{1:[2,7],8:[2,7],10:[2,7],13:[2,7],15:[2,7],16:[2,7],21:[2,7]},{13:[1,71]},{13:[1,72]},{13:[1,73]},{13:[1,74]},{13:[1,75]},{1:[2,37],13:[2,37],15:[2,37],16:[2,37],21:[2,37]},{1:[2,4],8:[2,4],10:[2,4],13:[2,4],15:[2,4],16:[2,4],21:[2,4]},{1:[2,10],10:[2,10],13:[2,10],15:[2,10],16:[2,10],21:[2,10]},{6:45,25:76,30:[1,17],31:[1,18],32:[1,20],33:[1,21],34:[1,22],35:[1,19]},{6:77,18:78,19:[1,79],30:[1,17],31:[1,18],32:[1,20],33:[1,21],34:[1,22],35:[1,19],38:[1,23]},{6:45,25:80,30:[1,17],31:[1,18],32:[1,20],33:[1,21],34:[1,22],35:[1,19]},{1:[2,12],10:[2,12],13:[2,12],15:[2,12],16:[2,12],21:[2,12]},{1:[2,41],15:[2,41],16:[2,41],21:[2,41],29:[2,41]},{15:[1,81]},{1:[2,36],15:[2,36],16:[2,36],21:[2,36]},{1:[2,39],13:[2,39],15:[2,39],16:[2,39],21:[2,39]},{18:82,38:[1,23]},{19:[1,83]},{18:84,38:[1,23]},{18:85,38:[1,23]},{18:86,38:[1,23]},{11:[2,25],13:[2,25]},{11:[2,26],13:[2,26],27:[1,87]},{11:[2,27],13:[2,27],27:[1,88]},{11:[2,30],13:[2,30]},{11:[2,31],13:[2,31]},{4:89,5:9,6:12,7:[1,13],8:[1,14],9:4,14:11,17:8,18:15,19:[1,16],20:3,22:5,23:6,24:7,29:[1,10],30:[1,17],31:[1,18],32:[1,20],33:[1,21],34:[1,22],35:[1,19],38:[1,23]},{1:[2,40],15:[2,40],16:[2,40],21:[2,40],29:[2,40]},{1:[2,32],15:[2,32],16:[2,32],21:[2,32]},{1:[2,33],15:[2,33],16:[2,33],21:[2,33]},{1:[2,34],15:[2,34],16:[2,34],21:[2,34]},{1:[2,35],15:[2,35],16:[2,35],21:[2,35]},{11:[2,28],13:[2,28]},{11:[2,29],13:[2,29]},{16:[1,90],21:[1,24]},{1:[2,43],15:[2,43],16:[2,43],21:[2,43],29:[2,43]}],defaultActions:{},parseError:function(t,n){thrownewError(t)},parse:function(t){functionv(e){r.length=r.length-2*e,i.length=i.length-e,s.length=s.length-e}functionm(){vare;returne=n.lexer.lex()||1,typeofe!="number"&&(e=n.symbols_[e]||e),e}varn=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,typeofthis.lexer.yylloc=="undefined"&&(this.lexer.yylloc={});varp=this.lexer.yylloc;s.push(p);vard=this.lexer.options&&this.lexer.options.ranges;typeofthis.yy.parseError=="function"&&(this.parseError=this.yy.parseError);varg,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||typeofg=="undefined")g=m();w=o[b]&&o[b][g]}if(typeofw=="undefined"||!w.length||!w[0])varL="";if(w[0]instanceofArray&&w.length>1)thrownewError("Parse Error: multiple actions possible at state: "+b+", token: "+g);switch(w[0]){case1: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;case2: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(typeofS!="undefined")returnS;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;case3:return!0}}return!0}};returnt.prototype=e,e.Parser=t,newt}();typeofrequire!="undefined"&&typeofexports!="undefined"&&(exports.parser=t,exports.Parser=t.Parser,exports.parse=function(){returnt.parse.apply(t,arguments)},exports.main=function(t){if(!t[1])thrownewError("Usage: "+t[0]+" FILE");varn,r;returntypeofprocess!="undefined"?n=require("fs").readFileSync(require("path").resolve(t[1]),"utf8"):n=require("file").path(require("file").cwd()).join(t[1]).read({charset:"utf-8"}),exports.parser.parse(n)},typeofmodule!="undefined"&&require.main===module&&exports.main(typeofprocess!="undefined"?process.argv.slice(1):require("system").args));varn,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M,_,D,P,H,B,j,F,I,q,R,U,z,W,X,V={}.hasOwnProperty,$=[].slice,J=function(e,t){functionr(){this.constructor=e}for(varnint)V.call(t,n)&&(e[n]=t[n]);returnr.prototype=t.prototype,e.prototype=newr,e.__super__=t.prototype,e},K=[].indexOf||function(e){for(vart=0,n=this.length;t<n;t++)if(tinthis&&this[t]===e)returnt;return-1};W={async:!1},k=Object.defineProperty,A=function(e,t){returnk(e,t,{get:function(){vare;returnthis.hasOwnProperty("_"+t)||(e=tinObject.getPrototypeOf(this)?Object.create(Object.getPrototypeOf(this)[t]):{},k(this,"_"+t,{configurable:!0,writable:!0,value:e})),this["_"+t]}})},M=function(e,t,n){varr,i;n==null&&(n=!0);for(rint){if(!V.call(t,r))continue;i=t[r],n?e[r]=i:k(e,r,{value:i,configurable:!0})}returne},T=function(e,t,n){if(e[t]!==n)returne[t]=n},F=function(e,t,n){returnn==null&&(n=!0),M(M({},e,n),t,n)},_=function(e,t){returne[t+"_property"]?e[t+"_property"].format():e[t]},B=function(e){returnObject.prototype.toString.call(e)==="[object Array]"},q=function(e,t){varn;returnn={},n[e]=t,n},z=function(e){vart,n,r,i;if(e&&typeofe.toJSON=="function")returne.toJSON();if(B(e)){i=[];for(n=0,r=e.length;n<r;n++)t=e[n],i.push(z(t));returni}returne},N=function(e){returne.slice(0,1).toUpperCase()+e.slice(1)},U=function(e,t,n){if(!e[t]||e[t].indexOf(n)===-1)returne.hasOwnProperty(t)?e[t].push(n):e[t]?k(e,t,{value:[n].concat(e[t])}):k(e,t,{value:[n]})},R=function(e,t,n){varr;if(e[t]&&(r=e[t].indexOf(n))!==-1)returne.hasOwnProperty(t)||k(e,t,{value:[].concat(e[t])}),e[t].splice(r,1)},f=function(){functione(e,t,n){this.object=e,this.name=t,this.options=n}returnk(e.prototype,"async",{get:function(){return"async"inthis.options?this.options.async:W.async}}),e.prototype.trigger=function(){vare,t,n=this;returne=1<=arguments.length?$.call(arguments,0):[],this.queue.push(e),this.async?(t=this.queue).timeout||(t.timeout=setTimeout(function(){returnn.resolve()},0)):this.resolve()},e.prototype.bind=function(e){returnthis.options.bind&&this.options.bind.call(this.object,e),U(this.object._s,"listeners_"+this.name,e)},e.prototype.one=function(e){vart,n=this;returnt=function(e){returnn.unbind(e)},this.bind(function(){returnt(arguments.callee),e.apply(this,arguments)})},e.prototype.unbind=function(e){R(this.object._s,"listeners_"+this.name,e);if(this.options.unbind)returnthis.options.unbind.call(this.object,e)},e.prototype.resolve=function(){vare,t,n,r,i,s=this;t=function(e){if(s.listeners)returns.listeners.forEach(function(t){returnt.apply(s.object,e)})};if(this.options.optimize)t(this.options.optimize(this.queue));else{i=this.queue;for(n=0,r=i.length;n<r;n++)e=i[n],t(e)}returnthis.queue=[]},k(e.prototype,"listeners",{get:function(){returnthis.object._s["listeners_"+this.name]}}),k(e.prototype,"queue",{get:function(){returnthis.object._s.hasOwnProperty("queue_"+this.name)||(this.queue=[]),this.object._s["queue_"+this.name]},set:function(e){returnthis.object._s["queue_"+this.name]=e}}),e}(),L=function(e,t,n){returnn==null&&(n={}),"_s"ine||A(e,"_s"),k(e,t,{configurable:!0,get:function(){returnnewf(this,t,n)}})},i={_identityMap:{},get:function(e,t){varn,r;n=e.uniqueId();if(n&&t)return(r=this._identityMap[n])!=null?r[t]:void0},set:function(e,t,n){varr,i;r=e.uniqueId();if(r&&t)return(i=this._identityMap)[r]||(i[r]={}),this._identityMap[r][t]=n},unset:function(e,t){varn,r;n=e.uniqueId();if(n&&t)return(r=this._identityMap)[n]||(r[n]={}),deletethis._identityMap[n][t]}},j=function(e){return(""+e).match(/^\d+$/)},s=function(){functioni(e){vart,n,r,i;e==null&&(e=[]);for(t=r=0,i=e.length;r<i;t=++r)n=e[t],this[t]=n;this.length=(e!=null?e.length:void0)||0}vare,t,n,r;L(i.prototype,"change_set"),L(i.prototype,"change_add"),L(i.prototype,"change_update"),L(i.prototype,"change_insert"),L(i.prototype,"change_delete"),L(i.prototype,"change"),i.prototype.get=function(e){returnthis[e]},i.prototype.set=function(e,t){returnthis[e]=t,j(e)&&(this.length=Math.max(this.length,e+1)),this.change_set.trigger(e,t),this.change.trigger(this),t},i.prototype.update=function(e){vart,n,r,i,s,o;n=this.clone();for(tinthis)i=this[t],j(t)&&deletethis[t];for(t=s=0,o=e.length;s<o;t=++s)r=e[t],this[t]=r;returnthis.length=(e!=null?e.length:void0)||0,this.change_update.trigger(n,this),this.change.trigger(this),e},i.prototype.sortBy=function(e){returnthis.sort(function(t,n){returnt[e]<n[e]?-1:1})},i.prototype.includes=function(e){returnthis.indexOf(e)>=0},i.prototype.find=function(e){vart,n,r;for(n=0,r=this.length;n<r;n++){t=this[n];if(e(t))returnt}},i.prototype.insertAt=function(e,t){returnArray.prototype.splice.call(this,e,0,t),this.change_insert.trigger(e,t),this.change.trigger(this),t},i.prototype.deleteAt=function(e){vart;returnt=this[e],Array.prototype.splice.call(this,e,1),this.change_delete.trigger(e,t),this.change.trigger(this),t},i.prototype["delete"]=function(e){vart;t=this.indexOf(e);if(t!==-1)returnthis.deleteAt(t)},k(i.prototype,"first",{get:function(){returnthis[0]}}),k(i.prototype,"last",{get:function(){returnthis[this.length-1]}}),i.prototype.toArray=function(){vare,t,n;e=[];for(tinthis)n=this[t],j(t)&&(e[t]=n);returne},i.prototype.clone=function(){returnnewi(this.toArray())},i.prototype.push=function(e){returnthis[this.length++]=e,this.change_add.trigger(e),this.change.trigger(this),e},i.prototype.pop=function(){returnthis.deleteAt(this.length-1)},i.prototype.unshift=function(e){returnthis.insertAt(0,e)},i.prototype.shift=function(){returnthis.deleteAt(0)},i.prototype.splice=function(){vare,t,n,r,s;returns=arguments[0],e=arguments[1],n=3<=arguments.length?$.call(arguments,2):[],r=this.clone(),t=Array.prototype.splice.apply(this,[s,e].concat($.call(n))),this.change_update.trigger(r,this),this.change.trigger(this),newi(t)},i.prototype.sort=function(e){vart;returnt=this.clone(),Array.prototype.sort.call(this,e),this.change_update.trigger(t,this),this.change.trigger(this),this},i.prototype.reverse=function(){vare;returne=this.clone(),Array.prototype.reverse.call(this),this.change_update.trigger(e,this),this.change.trigger(this),this},r=["forEach","indexOf","lastIndexOf","join","every","some","reduce","reduceRight"];for(t=0,n=r.length;t<n;t++)e=r[t],i.prototype[e]=Array.prototype[e];returni.prototype.map=function(){vare;returne=1<=arguments.length?$.call(arguments,0):[],newi(Array.prototype.map.apply(this,e))},i.prototype.filter=function(){vare;returne=1<=arguments.length?$.call(arguments,0):[],newi(Array.prototype.filter.apply(this,e))},i.prototype.slice=function(){vare,t;returne=1<=arguments.length?$.call(arguments,0):[],newi((t=this.toArray()).slice.apply(t,e))},i.prototype.concat=function(){vare,t,n;returnt=1<=arguments.length?$.call(arguments,0):[],t=function(){varn,r,s;s=[];for(n=0,r=t.length;n<r;n++)e=t[n],einstanceofi?s.push(e.toArray()):s.push(e);returns}(),newi((n=this.toArray()).concat.apply(n,t))},i.prototype.toString=function(){returnthis.toArray().toString()},i.prototype.toLocaleString=function(){returnthis.toArray().toLocaleString()},i.prototype.toJSON=function(){returnz(this.toArray())},i}(),n=function(e){functiont(e,n,r){vari=this;this.owner=e,this.options=n,this._convert.apply(this,$.call(r).concat([function(){vare;returne=1<=arguments.length?$.call(arguments,0):[],t.__super__.constructor.call(i,e)}]))}returnJ(t,e),t.prototype.set=function(e,n){varr=this;returnthis._convert(n,function(n){returnt.__super__.set.call(r,e,n)})},t.prototype.push=function(e){varn=this;returnthis._convert(e,function(e){returnt.__super__.push.call(n,e)})},t.prototype.update=function(e){varn=this;returnthis._convert.apply(this,$.call(e).concat([function(){vare;returne=1<=arguments.length?$.call(arguments,0):[],t.__super__.update.call(n,e)}]))},t.prototype.splice=function(){vare,n,r,i=this;returnr=arguments[0],e=arguments[1],n=3<=arguments.length?$.call(arguments,2):[],this._convert.apply(this,$.call(n).concat([function(){varn;returnn=1<=arguments.length?$.call(arguments,0):[],t.__super__.splice.apply(i,[r,e].concat($.call(n)))}]))},t.prototype.insertAt=function(e,n){varr=this;returnthis._convert(n,function(n){returnt.__super__.insertAt.call(r,e,n)})},t.prototype._convert=function(){vare,t,n,r,i,s,o;n=2<=arguments.length?$.call(arguments,0,i=arguments.length-1):(i=0,[]),e=arguments[i++],n=function(){vare,r,i;i=[];for(e=0,r=n.length;e<r;e++)t=n[e],(t!=null?t.constructor:void0)===Object&&this.options.as?i.push(t=new(this.options.as())(t)):i.push(t);returni}.call(this),r=e.apply(null,n);for(s=0,o=n.length;s<o;s++)t=n[s],this.options.inverseOf&&t[this.options.inverseOf]!==this.owner&&(t[this.options.inverseOf]=this.owner);returnr},t}(s),P={},X=function(e,t){varn,r,i,s,o,u,a,f;f=[];for(u=0,a=t.length;u<a;u++)r=t[u],P.hasOwnProperty(r)?f.push(function(){vart,u,a,f,l,c,h;a=P[r],h=[];for(t=0,u=a.length;t<u;t++)f=a[t],r=f.name,o=f.type,i=f.object,s=f.subname,n=f.dependency,o==="singular"?e===i[r]?h.push((l=i[n+"_property"])!=null?typeofl.trigger=="function"?l.trigger(i):void0:void0):h.push(void0):o==="collection"?K.call(i[r],e)>=0?h.push((c=i[n+"_property"])!=null?typeofc.trigger=="function"?c.trigger(i):void0:void0):h.push(void0):h.push(void0);returnh}()):f.push(void0);returnf},b=function(){functione(e,t){varn,r,i;this.name=e,M(this,t),this.dependencies=[],this.localDependencies=[],this.globalDependencies=[];if(this.dependsOn){i=[].concat(this.dependsOn);for(n=0,r=i.length;n<r;n++)e=i[n],this.addDependency(e)}}returnk(e.prototype,"eventOptions",{get:function(){vare;returne=this.name,{async:this.async!=null?this.async:W.async,bind:function(){returnthis[e]},optimize:function(e){returne[e.length-1]}}}}),e.prototype.addDependency=function(e){vart,n,r,i;if(this.dependencies.indexOf(e)===-1){this.dependencies.push(e),e.match(/\./)?(n="singular",r=e.split("."),e=r[0],t=r[1]):e.match(/:/)&&(n="collection",i=e.split(":"),e=i[0],t=i[1]),this.localDependencies.push(e),this.localDependencies.indexOf(e)===-1&&this.localDependencies.push(e);if(n)returnthis.globalDependencies.push({subname:t,name:e,type:n})}},e}(),y=function(){functione(e,t){this.definition=e,this.object=t,this.name=this.definition.name,this.valueName="val_"+this.name,this.event=newf(this.object,this.name+"_change",this.definition.eventOptions)}returne.prototype.set=function(e){vart;returntypeofe=="function"?this.definition.get=e:(this.definition.changed&&(t=this.get()),this.definition.set?this.definition.set.call(this.object,e):k(this.object._s,this.valueName,{value:e,configurable:!0}),this.trigger())},e.prototype.get=function(){vare,t,n=this;returnthis.registerGlobal(),this.definition.get&&!(this.definition.cache&&this.valueNameinthis.object._s)?(e=function(e){returnn.definition.addDependency(e)},"dependsOn"inthis.definition||this.object._s.property_access.bind(e),t=this.definition.get.call(this.object),this.definition.cache&&(this.object._s[this.valueName]=t),"dependsOn"inthis.definition||this.object._s.property_access.unbind(e)):t=this.object._s[this.valueName],this.object._s.property_access.trigger(this.name),t},e.prototype.format=function(){returntypeofthis.definition.format=="function"?this.definition.format.call(this.object,this.get()):this.get()},e.prototype.registerGlobal=function(){vare,t,n,r,i,s,o,u;if(!this.object._s["glb_"+this.name]){this.object._s["glb_"+this.name]=!0,s=this.definition.globalDependencies,u=[];for(r=0,i=s.length;r<i;r++)o=s[r],e=o.name,n=o.type,t=o.subname,P[t]||(P[t]=[]),u.push(P[t].push({object:this.object,subname:t,name:e,type:n,dependency:this.name}));returnu}},e.prototype.trigger=function(){vare,t,n,r,i,s,o,u;this.clearCache();if(this.hasChanged()){r=this.get(),e={},o=this.dependents;for(i=0,s=o.length;i<s;i++)t=o[i],t!==this.name&&(e[t]=this.object[t]);this.event.trigger(r);for(tine){if(!V.call(e,t))continue;r=e[t],n=this.object[t+"_property"],n.clearCache(),n.hasChanged()&&n.event.trigger(r)}returne[this.name]=r,(u=this.object.changed)!=null&&typeofu.trigger=="function"&&u.trigger(e),X(this.object,Object.keys(e))}},e.prototype.bind=function(e){returnthis.event.bind(e)},e.prototype.unbind=function(e){returnthis.event.unbind(e)},e.prototype.one=function(e){returnthis.event.one(e)},k(e.prototype,"dependents",{get:function(){vare,t,n=this;returne=[],t=function(r){vari,s,o,u,a,f;u=n.object._s.properties,f=[];for(s=0,o=u.length;s<o;s++)i=u[s],(a=i.name,K.call(e,a)<0)&&K.call(i.localDependencies,r)>=0?(e.push(i.name),f.push(t(i.name))):f.push(void0);returnf},t(this.name),e}}),k(e.prototype,"listeners",{get:function(){returnthis.event.listeners}}),e.prototype.clearCache=function(){if(this.definition.cache&&this.definition.get)returndeletethis.object._s[this.valueName]},e.prototype.hasChanged=function(){vare,t,n;returnthis.definition.changed===!1?!1:this.definition.changed?(n=this.get(),t="old_val_"+this.name,e=this.object._s.hasOwnProperty(t)?this.definition.changed.call(this.object,this.object._s[t],n):!0,this.object._s[t]=n,e):!0},e}(),O=function(e,t,n){varr;n==null&&(n={}),r=newb(t,n),"_s"ine||A(e,"_s"),U(e._s,"properties",r),L(e._s,"property_access"),k(e,t,{get:function(){returnthis[t+"_property"].get()},set:function(e){returnthis[t+"_property"].set(e)},configurable:!0,enumerable:"enumerable"inn?n.enumerable:!0}),k(e,t+"_property",{get:function(){returnnewy(r,this)},configurable:!0}),typeofn.serialize=="string"&&O(e,n.serialize,{get:function(){returnthis[t]},set:function(e){returnthis[t]=e},configurable:!0});if("value"inn)returne[t]=n.value},H=1,v=function(){functione(e){vart;if(this.constructor.identityMap&&(e!=null?e.id:void0)){t=i.get(this.constructor,e.id);if(t)returnt.set(e),t;i.set(this.constructor,e.id,this)}this.set(e)}returne.identityMap=!0,e.find=function(e){returni.get(this,e)||newthis({id:e})},e.extend=function(e){vart;returnt=function(t){functionn(){vart;t=n.__super__.constructor.apply(this,arguments);if(t)returnt;e&&e.apply(this,arguments)}returnJ(n,t),n}(this)},e.property=function(){vare,t,n,r,i,s,o;t=2<=arguments.length?$.call(arguments,0,r=arguments.length-1):(r=0,[]),n=arguments[r++],typeofn=="string"&&(t.push(n),n={}),o=[];for(i=0,s=t.length;i<s;i++)e=t[i],o.push(O(this.prototype,e,n));returno},e.event=function(e,t){returnL(this.prototype,e,t)},e.delegate=function(){vare,t,n,r,i=this;returne=2<=arguments.length?$.call(arguments,0,r=arguments.length-1):(r=0,[]),t=arguments[r++],n=t.to,e.forEach(function(e){varr,s;returnr=e,t.prefix===!0?r=n+N(e):t.prefix&&(r=t.prefix+N(e)),t.suffix===!0?r+=N(n):t.suffix&&(r+=t.suffix),s=F(t,{dependsOn:t.dependsOn||""+n+"."+e,get:function(){vart;return(t=this[n])!=null?t[e]:void0},set:function(t){varr;return(r=this[n])!=null?r[e]=t:void0}}),i.property(r,s)})},e.collection=function(e,t){varn;returnt==null&&(t={}),n=F(t,{get:function(){vart,n=this;returnt="val_"+e,this._s[t]||(this._s[t]=news([]),this._s[t].change.bind(function(){returnn[e+"_property"].trigger()})),this._s[t]},set:function(t){returnthis[e].update(t)}}),this.property(e,n),this.property(e+"Count",{get:function(){returnthis[e].length},dependsOn:e})},e.belongsTo=function(e,t){varn;returnt==null&&(t={}),n=F(t,{set:function(n){varr,i;i="val_"+e,n&&n.constructor===Object&&t.as&&(n=new(t.as())(n)),r=this._s[i],this._s[i]=n;if(t.inverseOf&&!n[t.inverseOf].includes(this))returnr&&r[t.inverseOf]["delete"](this),n[t.inverseOf].push(this)}}),this.property(e,n),this.property(e+"Id",{get:function(){vart;return(t=this[e])!=null?t.id:void0},set:function(n){if(n!=null)returnthis[e]=t.as().find(n)},dependsOn:e,serialize:t.serializeId})},e.hasMany=function(e,t){varr;returnt==null&&(t={}),r=F(t,{get:function(){varr,i=this;returnr="val_"+e,this._s[r]||(this._s[r]=newn(this,t,[]),this._s[r].change.bind(function(){returni[e+"_property"].trigger()})),this._s[r]},set:function(t){returnthis[e].update(t)}}),this.property(e,r),this.property(e+"Ids",{get:function(){return(news(this[e])).map(function(e){returne!=null?e.id:void0})},set:function(n){varr,i;returni=function(){vare,i,s;s=[];for(e=0,i=n.length;e<i;e++)r=n[e],s.push(t.as().find(r));returns}(),this[e].update(i)},dependsOn:e,serialize:t.serializeIds}),this.property(e+"Count",{get:function(){returnthis[e].length},dependsOn:e})},e.selection=function(e,t){varn;returnt==null&&(t={}),n=F(t,{get:function(){returnthis[t.from].filter(function(e){returne[t.filter]})},dependsOn:""+t.from+":"+t.filter}),this.property(e,n),this.property(e+"Count",{get:function(){returnthis[e].length},dependsOn:e})},e.uniqueId=function(){if(!this._uniqueId||this._uniqueGen!==this)this._uniqueId=H+=1,this._uniqueGen=this;returnthis._uniqueId},e.property("id",{serialize:!0,set:function(e){returni.unset(this.constructor,this.id),i.set(this.constructor,e,this),this._s.val_id=e},get:function(){returnthis._s.val_id}}),e.event("saved"),e.event("changed",{optimize:function(e){vart,n,r,i;n={};for(r=0,i=e.length;r<i;r++)t=e[r],M(n,t[0]);return[n]}}),e.prototype.set=function(e){vart,n,r;r=[];for(tine){if(!V.call(e,t))continue;n=e[t],tinthis||O(this,t),r.push(this[t]=n)}returnr},e.prototype.save=function(){returnthis.saved.trigger()},e.prototype.toJSON=function(){vare,t,n,r,i,s,o,u;n={},o=this._s.properties;for(i=0,s=o.length;i<s;i++)t=o[i],typeoft.serialize=="string"?n[t.serialize]=z(this[t.name]):typeoft.serialize=="function"?(u=t.serialize.call(this),e=u[0],r=u[1],n[e]=z(r)):t.serialize&&(n[t.name]=z(this[t.name]));returnn},e.prototype.toString=function(){returnJSON.stringify(this.toJSON())},e}(),l=/^[a-zA-Z][a-zA-Z0-9\-_]*/,h=/^[\[\]=\:\-!#\.@]/,w=/^"((?:\\.|[^"])*)"/,d=/^(?:\r?\n[^\r\n\S]*)+/,x=/^[^\r\n\S]+/,r=/^\s*\/\/[^\n]*/,c=["IF","ELSE","COLLECTION","IN","VIEW","UNLESS"],p=function(){functione(){}returne.prototype.tokenize=function(e,t){varn;t==null&&(t={}),this.code=e.replace(/^\s*/,"").replace(/\s*$/,""),this.line=t.line||0,this.indent=0,this.indents=[],this.ends=[],this.tokens=[],this.i=0;while(this.chunk=this.code.slice(this.i))this.i+=this.identifierToken()||this.commentToken()||this.whitespaceToken()||this.lineToken()||this.stringToken()||this.literalToken();while(n=this.ends.pop())n==="OUTDENT"?this.token("OUTDENT"):this.error("missing "+n);while(this.tokens[0][0]==="TERMINATOR")this.tokens.shift();while(this.tokens[this.tokens.length-1][0]==="TERMINATOR")this.tokens.pop();returnthis.tokens},e.prototype.commentToken=function(){vare;return(e=r.exec(this.chunk))?e[0].length:0},e.prototype.whitespaceToken=function(){vare;return(e=x.exec(this.chunk))?(this.token("WHITESPACE",e[0].length),e[0].length):0},e.prototype.token=function(e,t){returnthis.tokens.push([e,t,this.line])},e.prototype.identifierToken=function(){vare,t;return(e=l.exec(this.chunk))?(t=e[0].toUpperCase(),t==="ELSE"&&this.last(this.tokens,2)[0]==="TERMINATOR"&&this.tokens.splice(this.tokens.length-3,1),K.call(c,t)>=0?this.token(t,e[0]):this.token("IDENTIFIER",e[0]),e[0].length):0},e.prototype.stringToken=function(){vare;return(e=w.exec(this.chunk))?(this.token("STRING_LITERAL",e[1]),e[0].length):0},e.prototype.lineToken=function(){vare,t,n,r,i;if(!(n=d.exec(this.chunk)))return0;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();elseif(i>this.indent)this.token("INDENT"),this.indents.push(e),this.ends.push("OUTDENT");else{while(e<0)this.ends.pop(),e+=this.indents.pop(),this.token("OUTDENT");this.token("TERMINATOR","\n")}returnthis.indent=i,t.length},e.prototype.literalToken=function(){vare;return(e=h.exec(this.chunk))?(this.token(e[0]),1):this.error("Unexpected token '"+this.chunk.charAt(0)+"'")},e.prototype.newlineToken=function(){if(this.tag()!=="TERMINATOR")returnthis.token("TERMINATOR","\n")},e.prototype.tag=function(e,t){varn;return(n=this.last(this.tokens,e))&&(t?n[0]=t:n[0])},e.prototype.value=function(e,t){varn;return(n=this.last(this.tokens,e))&&(t?n[1]=t:n[1])},e.prototype.error=function(e){vart;throwt=this.code.slice(Math.max(0,this.i-10),Math.min(this.code.length,this.i+10)),SyntaxError(""+e+" on line "+(this.line+1)+" near "+JSON.stringify(t))},e.prototype.count=function(e,t){varn,r;n=r=0;if(!t.length)return1/0;while(r=1+e.indexOf(t,r))n++;returnn},e.prototype.last=function(e,t){returne[e.length-(t||0)-1]},e}(),m=function(){functione(e,t){this.ast=e,this.element=t,this.children=news([]),this.boundClasses=news([])}returnL(e.prototype,"load"),L(e.prototype,"unload"),e.prototype.append=function(e){returne.appendChild(this.element)},e.prototype.insertAfter=function(e){returne.parentNode.insertBefore(this.element,e.nextSibling)},e.prototype.remove=function(){vare;returnthis.unbindEvents(),(e=this.element.parentNode)!=null?e.removeChild(this.element):void0},k(e.prototype,"lastElement",{configurable:!0,get:function(){returnthis.element}}),e.prototype.nodes=function(){returnthis.children},e.prototype.bindEvent=function(e,t){if(e)returnthis.boundEvents||(this.boundEvents=[]),this.boundEvents.push({event:e,fun:t}),e.bind(t)},e.prototype.unbindEvents=function(){vare,t,n,r,i,s,o,u,a,f,l;this.unload.trigger(),u=this.nodes();for(r=0,s=u.length;r<s;r++)n=u[r],n.unbindEvents();if(this.boundEvents){a=this.boundEvents,l=[];for(i=0,o=a.length;i<o;i++)f=a[i],e=f.event,t=f.fun,l.push(e.unbind(t));returnl}},e.prototype.updateClass=function(){vare;returne=this.ast.classes,this.attributeClasses&&(e=e.concat(this.attributeClasses)),this.boundClasses.length&&(e=e.concat(this.boundClasses.toArray())),e.sort(),e.length?T(this.element,"className",e.join("")):this.element.removeAttribute("class")},e}(),a=function(e){functiont(e){this.ast=e,this.anchor=E.document.createTextNode(""),this.nodeSets=news([])}returnJ(t,e),t.prototype.nodes=function(){vare,t,n,r,i,s,o,u;t=[],u=this.nodeSets;for(r=0,s=u.length;r<s;r++){n=u[r];for(i=0,o=n.length;i<o;i++)e=n[i],t.push(e)}returnt},t.prototype.rebuild=function(){vare,t,n,r,i,s;if(this.anchor.parentNode){e=this.anchor,i=this.nodes(),s=[];for(n=0,r=i.length;n<r;n++)t=i[n],t.insertAfter(e),s.push(e=t.lastElement);returns}},t.prototype.replace=function(e){vart;returnthis.clear(),this.nodeSets.update(function(){varn,r,i;i=[];for(n=0,r=e.length;n<r;n++)t=e[n],i.push(news(t));returni}()),this.rebuild()},t.prototype.appendNodeSet=function(e){returnthis.insertNodeSet(this.nodeSets.length,e)},t.prototype.deleteNodeSet=function(e){vart,n,r,i;i=this.nodeSets[e];for(n=0,r=i.length;n<r;n++)t=i[n],t.remove();returnthis.nodeSets.deleteAt(e)},t.prototype.insertNodeSet=function(e,t){varn,r,i,o,u,a;n=((u=this.nodeSets[e-1])!=null?(a=u.last)!=null?a.lastElement:void0:void0)||this.anchor;for(i=0,o=t.length;i<o;i++)r=t[i],r.insertAfter(n),n=r.lastElement;returnthis.nodeSets.insertAt(e,news(t))},t.prototype.clear=function(){vare,t,n,r;r=this.nodes();for(t=0,n=r.length;t<n;t++)e=r[t],e.remove();returnthis.nodeSets.update([])},t.prototype.remove=function(){returnthis.unbindEvents(),this.clear(),this.anchor.parentNode.removeChild(this.anchor)},t.prototype.append=function(e){returne.appendChild(this.anchor),this.rebuild()},t.prototype.insertAfter=function(e){returne.parentNode.insertBefore(this.anchor,e.nextSibling),this.rebuild()},k(t.prototype,"lastElement",{configurable:!0,get:function(){vare,t;return((e=this.nodeSets.last)!=null?(t=e.last)!=null?t.lastElement:void0:void0)||this.anchor}}),t}(m),D=function(e,t){returne.bound&&e.value?_(t,e.value):e.value!=null?e.value:t},g={style:function(e,t,n,r){vari;i=function(){returnT(t.element.style,e.name,D(e,n))},i();if(e.bound)returnt.bindEvent(n[""+e.value+"_property"],i)},event:function(e,t,n,r){returnt.element.addEventListener(e.name,function(i){returne.preventDefault&&i.preventDefault(),r[e.value](t.element,n,i)})},"class":function(e,t,n,r){vari;returni=function(){returnn[e.value]?t.boundClasses.includes(e.name)||t.boundClasses.push(e.name):t.boundClasses["delete"](e.name),t.updateClass()},i(),t.bindEvent(n[""+e.value+"_property"],i)},binding:function(e,t,n,r){vari,s,o,u,a;returns=t.element,(a=t.ast.name)==="input"||a==="textarea"||a==="select"||function(){throwSyntaxError("invalid node type "+t.ast.name+" for two way binding")}(),e.value||function(){throwSyntaxError("cannot bind to whole model, please specify an attribute to bind to")}(),i=function(){returnn[e.value]=s.type==="checkbox"?s.checked:s.type==="radio"?s.checked?s.getAttribute("value"):void0:s.value},u=function(){vart;t=n[e.value];if(s.type==="checkbox")returns.checked=!!t;if(s.type!=="radio")returnt===void0&&(t=""),T(s,"value",t);if(t===s.getAttribute("value"))returns.checked=!0},u(),t.bindEvent(n[""+e.value+"_property"],u),e.name==="binding"?(o=function(e){if(s.form===(e.target||e.srcElement))returni()},E.document.addEventListener("submit",o,!0),t.unload.bind(function(){returnE.document.removeEventListener("submit",o,!0)})):s.addEventListener(e.name,i)},attribute:function(e,t,n,r){vari,s;returne.name==="binding"?g.binding(e,t,n,r):(i=t.element,s=function(){varr;r=D(e,n);if(e.name==="value")returnT(i,"value",r||"");if(t.ast.name==="input"&&e.name==="checked")returnT(i,"checked",!!r);if(e.name==="class")returnt.attributeClasses=r,t.updateClass();if(r===void0){if(i.hasAttribute(e.name))returni.removeAttribute(e.name)}else{r===0&&(r="0");if(i.getAttribute(e.name)!==r)returni.setAttribute(e.name,r)}},e.bound&&t.bindEvent(n[""+e.value+"_property"],s),s())},on:function(e,t,n,r){vari;if((i=e.name)==="load"||i==="unload")returnt[e.name].bind(function(){returnr[e.value](t.element,n)});thrownewSyntaxError("unkown lifecycle event '"+e.name+"'")}},o={element:function(e,t,n){varr,i,s,o,u,a,f,l,c,h,p,d;s=E.document.createElement(e.name),o=newm(e,s),e.id&&s.setAttribute("id",e.id),((h=e.classes)!=null?h.length:void0)&&s.setAttribute("class",e.classes.join("")),o.children=C(e.children,t,n),p=o.children;for(a=0,l=p.length;a<l;a++)i=p[a],i.append(s);d=e.properties;for(f=0,c=d.length;f<c;f++){u=d[f],r=g[u.scope];if(!r)throwSyntaxError(""+u.scope+" is not a valid scope");r(u,o,t,n)}returno.load.trigger(),o},view:function(e,t,n){varr,i,s;returnr=E.controllerFor(e.argument),r||(s=!0,r=n),i=newa(e),i.replace([E._views[e.argument].nodes(t,r,n,s)]),i},helper:function(e,t,n){varr,i,s,o,u,f,l,c,h;s=newa(e),u=function(t,n){varr,i,s,o,u;t==null&&(t=t),n==null&&(n=n),s=E.document.createDocumentFragment(),i=C(e.children,t,n);for(o=0,u=i.length;o<u;o++)r=i[o],r.append(s);returns},o=E.Helpers[e.command]||function(){throwSyntaxError("no helper "+e.command+" defined")}(),i={render:u,model:t,controller:n},f=function(){varn,r,u;returnn=e.arguments.map(function(e){returne.bound?t[e.value]:e.value}),u=function(){vart,s,u,a;u=I(o.apply(i,n)),a=[];for(t=0,s=u.length;t<s;t++)r=u[t],a.push(newm(e,r));returna}(),s.replace([u])},h=e.arguments;for(l=0,c=h.length;l<c;l++)r=h[l],r.bound===!0&&s.bindEvent(t[""+r.value+"_property"],f);returnf(),s},text:function(e,t,n){varr,i,s;returnr=function(){varn;returnn=D(e,t),n===0&&(n="0"),n||""},s=E.document.createTextNode(r()),i=newm(e,s),e.bound&&i.bindEvent(t[""+e.value+"_property"],function(){returnT(s,"nodeValue",r())}),i},collection:function(e,t,n){varr,i,s,o,u=this;returni=function(t){returnC(e.children,t,n)},o=function(e,t){varn;returne.replace(function(){vare,r,s;s=[];for(e=0,r=t.length;e<r;e++)n=t[e],s.push(i(n));returns}())},s=this.bound(e,t,n,o),r=t[e.argument],s.bindEvent(r.change_set,function(){vare;returns.replace(function(){vart,n,s;s=[];for(t=0,n=r.length;t<n;t++)e=r[t],s.push(i(e));returns}())}),s.bindEvent(r.change_update,function(){vare;returns.replace(function(){vart,n,s;s=[];for(t=0,n=r.length;t<n;t++)e=r[t],s.push(i(e));returns}())}),s.bindEvent(r.change_add,function(e){returns.appendNodeSet(i(e))}),s.bindEvent(r.change_insert,function(e,t){returns.insertNodeSet(e,i(t))}),s.bindEvent(r.change_delete,function(e){returns.deleteNodeSet(e)}),s},"in":function(e,t,n){returnthis.bound(e,t,n,function(t,r){returnr?t.replace([C(e.children,r,n)]):t.clear()})},"if":function(e,t,n){returnthis.bound(e,t,n,function(r,i){returni?r.replace([C(e.children,t,n)]):e["else"]?r.replace([C(e["else"].children,t,n)]):r.clear()})},unless:function(e,t,n){returnthis.bound(e,t,n,function(r,i){vars;returni?r.clear():(s=C(e.children,t,n),r.replace([s]))})},bound:function(e,t,n,r){vari,s,o;returni=newa(e),s={},o=function(){varn;returnn=t[e.argument],n!==s&&r(i,n),s=n},o(),i.bindEvent(t[""+e.argument+"_property"],o),i}},I=function(e){vart;returne?(t=function(e,t){varn,r,i,s,o,u,a,f;if(typeoft=="string"){r=E.document.createElement("div"),r.innerHTML=t,a=r.children;for(i=0,o=a.length;i<o;i++)n=a[i],e.push(n)}elseif(t.nodeName==="#document-fragment"){f=t.childNodes;for(s=0,u=f.length;s<u;s++)n=f[s],e.push(n)}elsee.push(t);returne},[].concat(e).reduce(t,[])):[]},C=function(e,t,n){varr,i,s,u;u=[];for(i=0,s=e.length;i<s;i++)r=e[i],u.push(o[r.type](r,t,n));returnu},t.lexer={lex:function(){vare,t;returnt=this.tokens[this.pos++]||[""],e=t[0],this.yytext=t[1],this.yylineno=t[2],e},setInput:function(e){returnthis.tokens=e,this.pos=0},upcomingInput:function(){return""}},u=function(){functione(e){this.nodes=e}returne.prototype.remove=function(){vare,t,n,r,i;r=this.nodes,i=[];for(t=0,n=r.length;t<n;t++)e=r[t],i.push(e.remove());returni},k(e.prototype,"fragment",{enumerable:!0,get:function(){vare,t,n,r,i;e=E.document.createDocumentFragment(),i=this.nodes;for(n=0,r=i.length;n<r;n++)t=i[n],t.append(e);returne}}),e}(),S=function(){functione(e,t){this.name=e,this.view=t}returne.prototype.parse=function(){if(typeofthis.view!="string")returnthis.view;try{returnthis.view=t.parse((newp).tokenize(this.view))}catch(e){throwthis.name&&(e.message="In view '"+this.name+"': "+e.message),e}},e.prototype.render=function(){vare;returne=1<=arguments.length?$.call(arguments,0):[],this.compile.apply(this,e).fragment},e.prototype.nodes=function(e,t,n,r){vari;returnthis.name&&(t||(t=E.controllerFor(this.name,e))),t||(t={}),typeoft=="function"&&(t=newt(e,n)),i=C(this.parse(),e,t),r||typeoft.loaded=="function"&&t.loaded.apply(t,$.call(i.map(function(e){returne.element})).concat([e])),i},e.prototype.compile=function(){vare;returne=1<=arguments.length?$.call(arguments,0):[],newu(this.nodes.apply(this,e))},e}(),E=function(e){vart,n,r;n=Object.create(e);for(tine)r=e[t],O(n,t,{value:r});returnn},M(E,{VERSION:"0.4.1",_views:{},_controllers:{},document:typeofwindow!="undefined"&&window!==null?window.document:void0,format:_,defineProperty:O,defineEvent:L,asyncEvents:!1,view:function(e,t){returnt?this._views[e]=newS(e,t):newS(void0,e)},render:function(e,t,n,r,i){returnthis._views[e].render(t,n,r,i)},controller:function(e,t){returnthis._controllers[e]=t},controllerFor:function(e){returnthis._controllers[e]},clearIdentityMap:function(){returni._identityMap={}},clearCache:function(){vare,t,n,r,i;E.clearIdentityMap(),i=[];for(e=n=0,r=P.length;n<r;e=++n)t=P[e],i.push(deleteP[e]);returni},unregisterAll:function(){returnE._views={},E._controllers={}},Model:v,Collection:s,Cache:i,View:S,Helpers:{}}),k(E,"async",{get:function(){returnW.async},set:function(e){returnW.async=e}}),e.Serenade=E})(this)
The Serenade.js app has a couple of dependencies which will be necessary if you wish to re-compile the source files.
Running `npm install` from this directory will give you [Serenade.js](http://serenadejs.org/) and [CoffeeScript](http://coffeescript.org/).
### Serenade.js
The latest release of Serenade.js is included in the `js/lib/` folder. The only way to upgrade is either by downloading the source from [their website](http://serenadejs.org/), or by compiling it yourself.
If you wish to compile it yourself, instructions are be available at [Serenade's website](http://serenadejs.org/development.html).
### CoffeeScript
The source code for the TodoMVC app was written in CoffeeScript. If you would like to re-compile the code, follow these instructions.
If you already have CoffeeScript globally installed, just run:
coffee -co js/ js/
If you don't have CoffeeScript globally installed, you may either install it globally...
npm install -g coffee-script
coffee -co js/ js/
...or if you wish to install it just for the purposes of this app...
cd to todomvc/labs/architecture-examples/serenadejs