/* Mithril v0.1.13 http://github.com/lhorie/mithril.js (c) Leo Horie License: MIT */ Mithril=m=new function a(b){function c(){var a=arguments,b="[object Object]"==v.call(a[1]),c=b?a[1]:{},d="class"in c?"class":"className",e=u[a[0]];if(void 0===e){u[a[0]]=e={tag:"div",attrs:{}};for(var f,g=[];f=w.exec(a[0]);)if(""==f[1])e.tag=f[2];else if("#"==f[1])e.attrs.id=f[2];else if("."==f[1])g.push(f[2]);else if("["==f[3][0]){var i=x.exec(f[3]);e.attrs[i[1]]=i[3]||!0}g.length>0&&(e.attrs[d]=g.join(" "))}e=h(e),e.attrs=h(e.attrs),e.children=b?a[2]:a[1];for(var j in c)e.attrs[j]=j==d?(e.attrs[j]||"")+" "+c[j]:c[j];return e}function d(a,c,h,i,j,k,l,m){if((null===h||void 0===h)&&(h=""),"retain"!==h.subtree){var n=v.call(i),o=v.call(h);if(n!=o&&(null!==i&&void 0!==i&&f(i.nodes),i=new h.constructor,i.nodes=[]),"[object Array]"==o){for(var p=[],q=i.length===h.length,r=0,s=0,t=0;s-1?new h.constructor(h):h,i.nodes=[w];else if(i.valueOf()!==h.valueOf()||j===!0){if(!l||l!==b.document.activeElement)if(h.$trusted){var y=i.nodes[0],p=[y];if(y){for(;y=y.nextSibling;)p.push(y);f(p),w=g(a,k,h)}else a.innerHTML=h}else w=i.nodes[0],"textarea"===c?a.value=h:l?l.innerHTML=h:(a.insertBefore(w,a.childNodes[k]||null),w.nodeValue=h);i=new h.constructor(h),i.nodes=[w]}else i.nodes.intact=!0}return i}}function e(a,c,d,e,f){for(var g in d){var h=d[g],j=e[g];if(!(g in e)||j!==h||a===b.document.activeElement){if(e[g]=h,"config"===g)continue;if("function"==typeof h&&0==g.indexOf("on"))a[g]=i(h,a);else if("style"===g&&"object"==typeof h){for(var k in h)(void 0===j||j[k]!==h[k])&&(a.style[k]=h[k]);for(var k in j)k in h||(a.style[k]="")}else void 0!==f?"href"===g?a.setAttributeNS("http://www.w3.org/1999/xlink","href",h):"className"===g?a.setAttribute("class",h):a.setAttribute(g,h):"value"===g&&"input"===c?a.value!==h&&(a.value=h):g in a&&"list"!=g&&"style"!=g?a[g]=h:a.setAttribute(g,h)}}return e}function f(a){for(var b=a.length-1;b>-1;b--)a[b].parentNode.removeChild(a[b]);a.length=0}function g(a,b,c){var d=a.childNodes[b];return d?d.insertAdjacentHTML("beforebegin",c):a.insertAdjacentHTML("beforeend",c),d?d.previousSibling:a.firstChild}function h(a){var b={};for(var c in a)b[c]=a[c];return b}function i(a,b){return function(d){c.startComputation();try{return a.call(b,d)}finally{c.endComputation()}}}function j(){for(var a=0;a0&&("GET"==a.method?a.url=a.url+(a.url.indexOf("?")<0?"?":"&")+p(b):a.data=c(b)),a}function r(a,b){var c=a.match(/:[a-z]\w+/gi);if(c&&b)for(var d=0;de?z.push(a)-1:e,g=a==b.document||a==b.document.documentElement?y:a;A[f]=d(g,null,c,A[f],!1,0,null,void 0)},c.trust=function(a){return a=new String(a),a.$trusted=!0,a};var B=[],C=[],D=[],E=0,F=0,G=0,H=null;c.module=function(a,b){c.startComputation();var d=B.indexOf(a);0>d&&(d=B.length),B[d]=a,C[d]=b,D[d]&&"function"==typeof D[d].onunload&&D[d].onunload(),D[d]=new b.controller,c.endComputation()},c.redraw=function(){if(E=b.performance&&b.performance.now?b.performance.now():(new b.Date).getTime(),E-F>16)j();else{var a=b.cancelAnimationFrame||b.clearTimeout,c=b.requestAnimationFrame||b.setTimeout;a(G),G=c(j,0)}};var I=0;c.startComputation=function(){I++},c.endComputation=function(){I=Math.max(I-1,0),0==I&&c.redraw()},c.withAttr=function(a,b){return function(c){b(a in c.currentTarget?c.currentTarget[a]:c.currentTarget.getAttribute(a))}};var J,K={pathname:"",hash:"#",search:"?"},L=function(){},M={};return c.route=function(){if(0===arguments.length)return J;if(3===arguments.length){J=b.location[c.route.mode].slice(K[c.route.mode].length);var a=arguments[0],d=arguments[1],e=arguments[2];L=function(b){var f=b.slice(K[c.route.mode].length);k(a,e,f)||c.route(d,!0)};var f="hash"==c.route.mode?"onhashchange":"onpopstate";b[f]=function(){L(b.location[c.route.mode])},H=m,b[f]()}else if(arguments[0].addEventListener){var g=arguments[0],h=arguments[1];g.href.indexOf(K[c.route.mode])<0&&(g.href=location.pathname+K[c.route.mode]+g.pathname),h||(g.removeEventListener("click",l),g.addEventListener("click",l))}else if("string"==typeof arguments[0]){J=arguments[0];var i=arguments[1]===!0;b.history.pushState?(H=function(){b.history[i?"replaceState":"pushState"](null,b.document.title,K[c.route.mode]+J),m()},L(K[c.route.mode]+J)):b.location[c.route.mode]=J}},c.route.param=function(a){return M[a]},c.route.mode="search",c.prop=function(a){var b=function(){return arguments.length&&(a=arguments[0]),a};return b.toJSON=function(){return a},b},c.deferred=function(){var a,b,d=[],e=[],f={resolve:function(b){void 0===a&&(a=b);for(var c=0;c