UNPKG

todomvc

Version:

> Helping you select an MV\* framework

10 lines (9 loc) 42.9 kB
/** * Serenade.js JavaScript Framework v0.4.1 * Revision: ae7d321b18 * http://github.com/elabs/serenade.js * * Copyright 2011, Jonas Nicklas, Elabs AB * Released under the MIT License */ (function(e){var t=function(){function t(){this.yy={}}var e={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){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];break;case 24:this.$=[o[a]];break;case 25:this.$=o[a-2].concat(o[a]);break;case 26:this.$={name:o[a-2],value:o[a],bound:!0,scope:"attribute"};break;case 27:this.$={name:o[a-2],value:o[a],bound:!0,scope:"attribute"};break;case 28:this.$={name:o[a-3],value:o[a-1],bound:!0,scope:"attribute",preventDefault:!0};break;case 29:this.$={name:o[a-3],value:o[a-1],bound:!0,scope:"attribute",preventDefault:!0};break;case 30:this.$={name:o[a-2],value:o[a],bound:!1,scope:"attribute"};break;case 31:this.$=function(){return o[a].scope=o[a-2],o[a]}();break;case 32:this.$={children:[],type:"view",argument:o[a]};break;case 33:this.$={children:[],type:"collection",argument:o[a]};break;case 34:this.$={children:[],type:"unless",argument:o[a]};break;case 35:this.$={children:[],type:"in",argument:o[a]};break;case 36:this.$=function(){return o[a-3].children=o[a-1],o[a-3]}();break;case 37:this.$={command:o[a],arguments:[],children:[],type:"helper"};break;case 38:this.$=function(){return o[a-2].arguments.push(o[a]),o[a-2]}();break;case 39:this.$=function(){return o[a-3].children=o[a-1],o[a-3]}();break;case 40:this.$={children:[],type:"if",argument:o[a]};break;case 41:this.$=function(){return o[a-3].children=o[a-1],o[a-3]}();break;case 42:this.$=function(){return o[a-1]["else"]=o[a],o[a-1]}();break;case 43:this.$={arguments:[],children:o[a-1],type:"else"};break;case 44:this.$=o[a];break;case 45:this.$=o[a];break;case 46:this.$=o[a];break;case 47:this.$=o[a];break;case 48:this.$=o[a];break;case 49:this.$=o[a];break;case 50:this.$=o[a];break;case 51: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){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 require!="undefined"&&typeof exports!="undefined"&&(exports.parser=t,exports.Parser=t.Parser,exports.parse=function(){return t.parse.apply(t,arguments)},exports.main=function(t){if(!t[1])throw new Error("Usage: "+t[0]+" FILE");var n,r;return typeof process!="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)},typeof module!="undefined"&&require.main===module&&exports.main(typeof process!="undefined"?process.argv.slice(1):require("system").args));var n,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){function r(){this.constructor=e}for(var n in t)V.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e},K=[].indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(t in this&&this[t]===e)return t;return-1};W={async:!1},k=Object.defineProperty,A=function(e,t){return k(e,t,{get:function(){var e;return this.hasOwnProperty("_"+t)||(e=t in Object.getPrototypeOf(this)?Object.create(Object.getPrototypeOf(this)[t]):{},k(this,"_"+t,{configurable:!0,writable:!0,value:e})),this["_"+t]}})},M=function(e,t,n){var r,i;n==null&&(n=!0);for(r in t){if(!V.call(t,r))continue;i=t[r],n?e[r]=i:k(e,r,{value:i,configurable:!0})}return e},T=function(e,t,n){if(e[t]!==n)return e[t]=n},F=function(e,t,n){return n==null&&(n=!0),M(M({},e,n),t,n)},_=function(e,t){return e[t+"_property"]?e[t+"_property"].format():e[t]},B=function(e){return Object.prototype.toString.call(e)==="[object Array]"},q=function(e,t){var n;return n={},n[e]=t,n},z=function(e){var t,n,r,i;if(e&&typeof e.toJSON=="function")return e.toJSON();if(B(e)){i=[];for(n=0,r=e.length;n<r;n++)t=e[n],i.push(z(t));return i}return e},N=function(e){return e.slice(0,1).toUpperCase()+e.slice(1)},U=function(e,t,n){if(!e[t]||e[t].indexOf(n)===-1)return e.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){var r;if(e[t]&&(r=e[t].indexOf(n))!==-1)return e.hasOwnProperty(t)||k(e,t,{value:[].concat(e[t])}),e[t].splice(r,1)},f=function(){function e(e,t,n){this.object=e,this.name=t,this.options=n}return k(e.prototype,"async",{get:function(){return"async"in this.options?this.options.async:W.async}}),e.prototype.trigger=function(){var e,t,n=this;return e=1<=arguments.length?$.call(arguments,0):[],this.queue.push(e),this.async?(t=this.queue).timeout||(t.timeout=setTimeout(function(){return n.resolve()},0)):this.resolve()},e.prototype.bind=function(e){return this.options.bind&&this.options.bind.call(this.object,e),U(this.object._s,"listeners_"+this.name,e)},e.prototype.one=function(e){var t,n=this;return t=function(e){return n.unbind(e)},this.bind(function(){return t(arguments.callee),e.apply(this,arguments)})},e.prototype.unbind=function(e){R(this.object._s,"listeners_"+this.name,e);if(this.options.unbind)return this.options.unbind.call(this.object,e)},e.prototype.resolve=function(){var e,t,n,r,i,s=this;t=function(e){if(s.listeners)return s.listeners.forEach(function(t){return t.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)}return this.queue=[]},k(e.prototype,"listeners",{get:function(){return this.object._s["listeners_"+this.name]}}),k(e.prototype,"queue",{get:function(){return this.object._s.hasOwnProperty("queue_"+this.name)||(this.queue=[]),this.object._s["queue_"+this.name]},set:function(e){return this.object._s["queue_"+this.name]=e}}),e}(),L=function(e,t,n){return n==null&&(n={}),"_s"in e||A(e,"_s"),k(e,t,{configurable:!0,get:function(){return new f(this,t,n)}})},i={_identityMap:{},get:function(e,t){var n,r;n=e.uniqueId();if(n&&t)return(r=this._identityMap[n])!=null?r[t]:void 0},set:function(e,t,n){var r,i;r=e.uniqueId();if(r&&t)return(i=this._identityMap)[r]||(i[r]={}),this._identityMap[r][t]=n},unset:function(e,t){var n,r;n=e.uniqueId();if(n&&t)return(r=this._identityMap)[n]||(r[n]={}),delete this._identityMap[n][t]}},j=function(e){return(""+e).match(/^\d+$/)},s=function(){function i(e){var t,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:void 0)||0}var e,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){return this[e]},i.prototype.set=function(e,t){return this[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){var t,n,r,i,s,o;n=this.clone();for(t in this)i=this[t],j(t)&&delete this[t];for(t=s=0,o=e.length;s<o;t=++s)r=e[t],this[t]=r;return this.length=(e!=null?e.length:void 0)||0,this.change_update.trigger(n,this),this.change.trigger(this),e},i.prototype.sortBy=function(e){return this.sort(function(t,n){return t[e]<n[e]?-1:1})},i.prototype.includes=function(e){return this.indexOf(e)>=0},i.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}},i.prototype.insertAt=function(e,t){return Array.prototype.splice.call(this,e,0,t),this.change_insert.trigger(e,t),this.change.trigger(this),t},i.prototype.deleteAt=function(e){var t;return t=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){var t;t=this.indexOf(e);if(t!==-1)return this.deleteAt(t)},k(i.prototype,"first",{get:function(){return this[0]}}),k(i.prototype,"last",{get:function(){return this[this.length-1]}}),i.prototype.toArray=function(){var e,t,n;e=[];for(t in this)n=this[t],j(t)&&(e[t]=n);return e},i.prototype.clone=function(){return new i(this.toArray())},i.prototype.push=function(e){return this[this.length++]=e,this.change_add.trigger(e),this.change.trigger(this),e},i.prototype.pop=function(){return this.deleteAt(this.length-1)},i.prototype.unshift=function(e){return this.insertAt(0,e)},i.prototype.shift=function(){return this.deleteAt(0)},i.prototype.splice=function(){var e,t,n,r,s;return s=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),new i(t)},i.prototype.sort=function(e){var t;return t=this.clone(),Array.prototype.sort.call(this,e),this.change_update.trigger(t,this),this.change.trigger(this),this},i.prototype.reverse=function(){var e;return e=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];return i.prototype.map=function(){var e;return e=1<=arguments.length?$.call(arguments,0):[],new i(Array.prototype.map.apply(this,e))},i.prototype.filter=function(){var e;return e=1<=arguments.length?$.call(arguments,0):[],new i(Array.prototype.filter.apply(this,e))},i.prototype.slice=function(){var e,t;return e=1<=arguments.length?$.call(arguments,0):[],new i((t=this.toArray()).slice.apply(t,e))},i.prototype.concat=function(){var e,t,n;return t=1<=arguments.length?$.call(arguments,0):[],t=function(){var n,r,s;s=[];for(n=0,r=t.length;n<r;n++)e=t[n],e instanceof i?s.push(e.toArray()):s.push(e);return s}(),new i((n=this.toArray()).concat.apply(n,t))},i.prototype.toString=function(){return this.toArray().toString()},i.prototype.toLocaleString=function(){return this.toArray().toLocaleString()},i.prototype.toJSON=function(){return z(this.toArray())},i}(),n=function(e){function t(e,n,r){var i=this;this.owner=e,this.options=n,this._convert.apply(this,$.call(r).concat([function(){var e;return e=1<=arguments.length?$.call(arguments,0):[],t.__super__.constructor.call(i,e)}]))}return J(t,e),t.prototype.set=function(e,n){var r=this;return this._convert(n,function(n){return t.__super__.set.call(r,e,n)})},t.prototype.push=function(e){var n=this;return this._convert(e,function(e){return t.__super__.push.call(n,e)})},t.prototype.update=function(e){var n=this;return this._convert.apply(this,$.call(e).concat([function(){var e;return e=1<=arguments.length?$.call(arguments,0):[],t.__super__.update.call(n,e)}]))},t.prototype.splice=function(){var e,n,r,i=this;return r=arguments[0],e=arguments[1],n=3<=arguments.length?$.call(arguments,2):[],this._convert.apply(this,$.call(n).concat([function(){var n;return n=1<=arguments.length?$.call(arguments,0):[],t.__super__.splice.apply(i,[r,e].concat($.call(n)))}]))},t.prototype.insertAt=function(e,n){var r=this;return this._convert(n,function(n){return t.__super__.insertAt.call(r,e,n)})},t.prototype._convert=function(){var e,t,n,r,i,s,o;n=2<=arguments.length?$.call(arguments,0,i=arguments.length-1):(i=0,[]),e=arguments[i++],n=function(){var e,r,i;i=[];for(e=0,r=n.length;e<r;e++)t=n[e],(t!=null?t.constructor:void 0)===Object&&this.options.as?i.push(t=new(this.options.as())(t)):i.push(t);return i}.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);return r},t}(s),P={},X=function(e,t){var n,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(){var t,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?typeof l.trigger=="function"?l.trigger(i):void 0:void 0):h.push(void 0):o==="collection"?K.call(i[r],e)>=0?h.push((c=i[n+"_property"])!=null?typeof c.trigger=="function"?c.trigger(i):void 0:void 0):h.push(void 0):h.push(void 0);return h}()):f.push(void 0);return f},b=function(){function e(e,t){var n,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)}}return k(e.prototype,"eventOptions",{get:function(){var e;return e=this.name,{async:this.async!=null?this.async:W.async,bind:function(){return this[e]},optimize:function(e){return e[e.length-1]}}}}),e.prototype.addDependency=function(e){var t,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)return this.globalDependencies.push({subname:t,name:e,type:n})}},e}(),y=function(){function e(e,t){this.definition=e,this.object=t,this.name=this.definition.name,this.valueName="val_"+this.name,this.event=new f(this.object,this.name+"_change",this.definition.eventOptions)}return e.prototype.set=function(e){var t;return typeof e=="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(){var e,t,n=this;return this.registerGlobal(),this.definition.get&&!(this.definition.cache&&this.valueName in this.object._s)?(e=function(e){return n.definition.addDependency(e)},"dependsOn"in this.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"in this.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(){return typeof this.definition.format=="function"?this.definition.format.call(this.object,this.get()):this.get()},e.prototype.registerGlobal=function(){var e,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}));return u}},e.prototype.trigger=function(){var e,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(t in e){if(!V.call(e,t))continue;r=e[t],n=this.object[t+"_property"],n.clearCache(),n.hasChanged()&&n.event.trigger(r)}return e[this.name]=r,(u=this.object.changed)!=null&&typeof u.trigger=="function"&&u.trigger(e),X(this.object,Object.keys(e))}},e.prototype.bind=function(e){return this.event.bind(e)},e.prototype.unbind=function(e){return this.event.unbind(e)},e.prototype.one=function(e){return this.event.one(e)},k(e.prototype,"dependents",{get:function(){var e,t,n=this;return e=[],t=function(r){var i,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(void 0);return f},t(this.name),e}}),k(e.prototype,"listeners",{get:function(){return this.event.listeners}}),e.prototype.clearCache=function(){if(this.definition.cache&&this.definition.get)return delete this.object._s[this.valueName]},e.prototype.hasChanged=function(){var e,t,n;return this.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){var r;n==null&&(n={}),r=new b(t,n),"_s"in e||A(e,"_s"),U(e._s,"properties",r),L(e._s,"property_access"),k(e,t,{get:function(){return this[t+"_property"].get()},set:function(e){return this[t+"_property"].set(e)},configurable:!0,enumerable:"enumerable"in n?n.enumerable:!0}),k(e,t+"_property",{get:function(){return new y(r,this)},configurable:!0}),typeof n.serialize=="string"&&O(e,n.serialize,{get:function(){return this[t]},set:function(e){return this[t]=e},configurable:!0});if("value"in n)return e[t]=n.value},H=1,v=function(){function e(e){var t;if(this.constructor.identityMap&&(e!=null?e.id:void 0)){t=i.get(this.constructor,e.id);if(t)return t.set(e),t;i.set(this.constructor,e.id,this)}this.set(e)}return e.identityMap=!0,e.find=function(e){return i.get(this,e)||new this({id:e})},e.extend=function(e){var t;return t=function(t){function n(){var t;t=n.__super__.constructor.apply(this,arguments);if(t)return t;e&&e.apply(this,arguments)}return J(n,t),n}(this)},e.property=function(){var e,t,n,r,i,s,o;t=2<=arguments.length?$.call(arguments,0,r=arguments.length-1):(r=0,[]),n=arguments[r++],typeof n=="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));return o},e.event=function(e,t){return L(this.prototype,e,t)},e.delegate=function(){var e,t,n,r,i=this;return e=2<=arguments.length?$.call(arguments,0,r=arguments.length-1):(r=0,[]),t=arguments[r++],n=t.to,e.forEach(function(e){var r,s;return r=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(){var t;return(t=this[n])!=null?t[e]:void 0},set:function(t){var r;return(r=this[n])!=null?r[e]=t:void 0}}),i.property(r,s)})},e.collection=function(e,t){var n;return t==null&&(t={}),n=F(t,{get:function(){var t,n=this;return t="val_"+e,this._s[t]||(this._s[t]=new s([]),this._s[t].change.bind(function(){return n[e+"_property"].trigger()})),this._s[t]},set:function(t){return this[e].update(t)}}),this.property(e,n),this.property(e+"Count",{get:function(){return this[e].length},dependsOn:e})},e.belongsTo=function(e,t){var n;return t==null&&(t={}),n=F(t,{set:function(n){var r,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))return r&&r[t.inverseOf]["delete"](this),n[t.inverseOf].push(this)}}),this.property(e,n),this.property(e+"Id",{get:function(){var t;return(t=this[e])!=null?t.id:void 0},set:function(n){if(n!=null)return this[e]=t.as().find(n)},dependsOn:e,serialize:t.serializeId})},e.hasMany=function(e,t){var r;return t==null&&(t={}),r=F(t,{get:function(){var r,i=this;return r="val_"+e,this._s[r]||(this._s[r]=new n(this,t,[]),this._s[r].change.bind(function(){return i[e+"_property"].trigger()})),this._s[r]},set:function(t){return this[e].update(t)}}),this.property(e,r),this.property(e+"Ids",{get:function(){return(new s(this[e])).map(function(e){return e!=null?e.id:void 0})},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[e].update(i)},dependsOn:e,serialize:t.serializeIds}),this.property(e+"Count",{get:function(){return this[e].length},dependsOn:e})},e.selection=function(e,t){var n;return t==null&&(t={}),n=F(t,{get:function(){return this[t.from].filter(function(e){return e[t.filter]})},dependsOn:""+t.from+":"+t.filter}),this.property(e,n),this.property(e+"Count",{get:function(){return this[e].length},dependsOn:e})},e.uniqueId=function(){if(!this._uniqueId||this._uniqueGen!==this)this._uniqueId=H+=1,this._uniqueGen=this;return this._uniqueId},e.property("id",{serialize:!0,set:function(e){return i.unset(this.constructor,this.id),i.set(this.constructor,e,this),this._s.val_id=e},get:function(){return this._s.val_id}}),e.event("saved"),e.event("changed",{optimize:function(e){var t,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){var t,n,r;r=[];for(t in e){if(!V.call(e,t))continue;n=e[t],t in this||O(this,t),r.push(this[t]=n)}return r},e.prototype.save=function(){return this.saved.trigger()},e.prototype.toJSON=function(){var e,t,n,r,i,s,o,u;n={},o=this._s.properties;for(i=0,s=o.length;i<s;i++)t=o[i],typeof t.serialize=="string"?n[t.serialize]=z(this[t.name]):typeof t.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]));return n},e.prototype.toString=function(){return JSON.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(){function e(){}return e.prototype.tokenize=function(e,t){var n;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();return this.tokens},e.prototype.commentToken=function(){var e;return(e=r.exec(this.chunk))?e[0].length:0},e.prototype.whitespaceToken=function(){var e;return(e=x.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=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(){var e;return(e=w.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=d.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.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=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")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){var t;throw t=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){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}(),m=function(){function e(e,t){this.ast=e,this.element=t,this.children=new s([]),this.boundClasses=new s([])}return L(e.prototype,"load"),L(e.prototype,"unload"),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 this.unbindEvents(),(e=this.element.parentNode)!=null?e.removeChild(this.element):void 0},k(e.prototype,"lastElement",{configurable:!0,get:function(){return this.element}}),e.prototype.nodes=function(){return this.children},e.prototype.bindEvent=function(e,t){if(e)return this.boundEvents||(this.boundEvents=[]),this.boundEvents.push({event:e,fun:t}),e.bind(t)},e.prototype.unbindEvents=function(){var e,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));return l}},e.prototype.updateClass=function(){var e;return e=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){function t(e){this.ast=e,this.anchor=E.document.createTextNode(""),this.nodeSets=new s([])}return J(t,e),t.prototype.nodes=function(){var e,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)}return t},t.prototype.rebuild=function(){var e,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);return s}},t.prototype.replace=function(e){var t;return this.clear(),this.nodeSets.update(function(){var n,r,i;i=[];for(n=0,r=e.length;n<r;n++)t=e[n],i.push(new s(t));return i}()),this.rebuild()},t.prototype.appendNodeSet=function(e){return this.insertNodeSet(this.nodeSets.length,e)},t.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)},t.prototype.insertNodeSet=function(e,t){var n,r,i,o,u,a;n=((u=this.nodeSets[e-1])!=null?(a=u.last)!=null?a.lastElement:void 0:void 0)||this.anchor;for(i=0,o=t.length;i<o;i++)r=t[i],r.insertAfter(n),n=r.lastElement;return this.nodeSets.insertAt(e,new s(t))},t.prototype.clear=function(){var e,t,n,r;r=this.nodes();for(t=0,n=r.length;t<n;t++)e=r[t],e.remove();return this.nodeSets.update([])},t.prototype.remove=function(){return this.unbindEvents(),this.clear(),this.anchor.parentNode.removeChild(this.anchor)},t.prototype.append=function(e){return e.appendChild(this.anchor),this.rebuild()},t.prototype.insertAfter=function(e){return e.parentNode.insertBefore(this.anchor,e.nextSibling),this.rebuild()},k(t.prototype,"lastElement",{configurable:!0,get:function(){var e,t;return((e=this.nodeSets.last)!=null?(t=e.last)!=null?t.lastElement:void 0:void 0)||this.anchor}}),t}(m),D=function(e,t){return e.bound&&e.value?_(t,e.value):e.value!=null?e.value:t},g={style:function(e,t,n,r){var i;i=function(){return T(t.element.style,e.name,D(e,n))},i();if(e.bound)return t.bindEvent(n[""+e.value+"_property"],i)},event:function(e,t,n,r){return t.element.addEventListener(e.name,function(i){return e.preventDefault&&i.preventDefault(),r[e.value](t.element,n,i)})},"class":function(e,t,n,r){var i;return i=function(){return n[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){var i,s,o,u,a;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(){return n[e.value]=s.type==="checkbox"?s.checked:s.type==="radio"?s.checked?s.getAttribute("value"):void 0:s.value},u=function(){var t;t=n[e.value];if(s.type==="checkbox")return s.checked=!!t;if(s.type!=="radio")return t===void 0&&(t=""),T(s,"value",t);if(t===s.getAttribute("value"))return s.checked=!0},u(),t.bindEvent(n[""+e.value+"_property"],u),e.name==="binding"?(o=function(e){if(s.form===(e.target||e.srcElement))return i()},E.document.addEventListener("submit",o,!0),t.unload.bind(function(){return E.document.removeEventListener("submit",o,!0)})):s.addEventListener(e.name,i)},attribute:function(e,t,n,r){var i,s;return e.name==="binding"?g.binding(e,t,n,r):(i=t.element,s=function(){var r;r=D(e,n);if(e.name==="value")return T(i,"value",r||"");if(t.ast.name==="input"&&e.name==="checked")return T(i,"checked",!!r);if(e.name==="class")return t.attributeClasses=r,t.updateClass();if(r===void 0){if(i.hasAttribute(e.name))return i.removeAttribute(e.name)}else{r===0&&(r="0");if(i.getAttribute(e.name)!==r)return i.setAttribute(e.name,r)}},e.bound&&t.bindEvent(n[""+e.value+"_property"],s),s())},on:function(e,t,n,r){var i;if((i=e.name)==="load"||i==="unload")return t[e.name].bind(function(){return r[e.value](t.element,n)});throw new SyntaxError("unkown lifecycle event '"+e.name+"'")}},o={element:function(e,t,n){var r,i,s,o,u,a,f,l,c,h,p,d;s=E.document.createElement(e.name),o=new m(e,s),e.id&&s.setAttribute("id",e.id),((h=e.classes)!=null?h.length:void 0)&&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)throw SyntaxError(""+u.scope+" is not a valid scope");r(u,o,t,n)}return o.load.trigger(),o},view:function(e,t,n){var r,i,s;return r=E.controllerFor(e.argument),r||(s=!0,r=n),i=new a(e),i.replace([E._views[e.argument].nodes(t,r,n,s)]),i},helper:function(e,t,n){var r,i,s,o,u,f,l,c,h;s=new a(e),u=function(t,n){var r,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);return s},o=E.Helpers[e.command]||function(){throw SyntaxError("no helper "+e.command+" defined")}(),i={render:u,model:t,controller:n},f=function(){var n,r,u;return n=e.arguments.map(function(e){return e.bound?t[e.value]:e.value}),u=function(){var t,s,u,a;u=I(o.apply(i,n)),a=[];for(t=0,s=u.length;t<s;t++)r=u[t],a.push(new m(e,r));return a}(),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);return f(),s},text:function(e,t,n){var r,i,s;return r=function(){var n;return n=D(e,t),n===0&&(n="0"),n||""},s=E.document.createTextNode(r()),i=new m(e,s),e.bound&&i.bindEvent(t[""+e.value+"_property"],function(){return T(s,"nodeValue",r())}),i},collection:function(e,t,n){var r,i,s,o,u=this;return i=function(t){return C(e.children,t,n)},o=function(e,t){var n;return e.replace(function(){var e,r,s;s=[];for(e=0,r=t.length;e<r;e++)n=t[e],s.push(i(n));return s}())},s=this.bound(e,t,n,o),r=t[e.argument],s.bindEvent(r.change_set,function(){var e;return s.replace(function(){var t,n,s;s=[];for(t=0,n=r.length;t<n;t++)e=r[t],s.push(i(e));return s}())}),s.bindEvent(r.change_update,function(){var e;return s.replace(function(){var t,n,s;s=[];for(t=0,n=r.length;t<n;t++)e=r[t],s.push(i(e));return s}())}),s.bindEvent(r.change_add,function(e){return s.appendNodeSet(i(e))}),s.bindEvent(r.change_insert,function(e,t){return s.insertNodeSet(e,i(t))}),s.bindEvent(r.change_delete,function(e){return s.deleteNodeSet(e)}),s},"in":function(e,t,n){return this.bound(e,t,n,function(t,r){return r?t.replace([C(e.children,r,n)]):t.clear()})},"if":function(e,t,n){return this.bound(e,t,n,function(r,i){return i?r.replace([C(e.children,t,n)]):e["else"]?r.replace([C(e["else"].children,t,n)]):r.clear()})},unless:function(e,t,n){return this.bound(e,t,n,function(r,i){var s;return i?r.clear():(s=C(e.children,t,n),r.replace([s]))})},bound:function(e,t,n,r){var i,s,o;return i=new a(e),s={},o=function(){var n;return n=t[e.argument],n!==s&&r(i,n),s=n},o(),i.bindEvent(t[""+e.argument+"_property"],o),i}},I=function(e){var t;return e?(t=function(e,t){var n,r,i,s,o,u,a,f;if(typeof t=="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)}else if(t.nodeName==="#document-fragment"){f=t.childNodes;for(s=0,u=f.length;s<u;s++)n=f[s],e.push(n)}else e.push(t);return e},[].concat(e).reduce(t,[])):[]},C=function(e,t,n){var r,i,s,u;u=[];for(i=0,s=e.length;i<s;i++)r=e[i],u.push(o[r.type](r,t,n));return u},t.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""}},u=function(){function e(e){this.nodes=e}return e.prototype.remove=function(){var e,t,n,r,i;r=this.nodes,i=[];for(t=0,n=r.length;t<n;t++)e=r[t],i.push(e.remove());return i},k(e.prototype,"fragment",{enumerable:!0,get:function(){var e,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);return e}}),e}(),S=function(){function e(e,t){this.name=e,this.view=t}return e.prototype.parse=function(){if(typeof this.view!="string")return this.view;try{return this.view=t.parse((new p).tokenize(this.view))}catch(e){throw this.name&&(e.message="In view '"+this.name+"': "+e.message),e}},e.prototype.render=function(){var e;return e=1<=arguments.length?$.call(arguments,0):[],this.compile.apply(this,e).fragment},e.prototype.nodes=function(e,t,n,r){var i;return this.name&&(t||(t=E.controllerFor(this.name,e))),t||(t={}),typeof t=="function"&&(t=new t(e,n)),i=C(this.parse(),e,t),r||typeof t.loaded=="function"&&t.loaded.apply(t,$.call(i.map(function(e){return e.element})).concat([e])),i},e.prototype.compile=function(){var e;return e=1<=arguments.length?$.call(arguments,0):[],new u(this.nodes.apply(this,e))},e}(),E=function(e){var t,n,r;n=Object.create(e);for(t in e)r=e[t],O(n,t,{value:r});return n},M(E,{VERSION:"0.4.1",_views:{},_controllers:{},document:typeof window!="undefined"&&window!==null?window.document:void 0,format:_,defineProperty:O,defineEvent:L,asyncEvents:!1,view:function(e,t){return t?this._views[e]=new S(e,t):new S(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 i._identityMap={}},clearCache:function(){var e,t,n,r,i;E.clearIdentityMap(),i=[];for(e=n=0,r=P.length;n<r;e=++n)t=P[e],i.push(delete P[e]);return i},unregisterAll:function(){return E._views={},E._controllers={}},Model:v,Collection:s,Cache:i,View:S,Helpers:{}}),k(E,"async",{get:function(){return W.async},set:function(e){return W.async=e}}),e.Serenade=E})(this)