Browse Source

Update mithril to version 1.1.0

simov 8 years ago
parent
commit
35b48c3395
1 changed files with 44 additions and 42 deletions
  1. 44 42
      vendor/mithril.min.js

+ 44 - 42
vendor/mithril.min.js

@@ -1,42 +1,44 @@
-new function(){function u(b,e,n,f,k,h){return{tag:b,key:e,attrs:n,children:f,text:k,dom:h,domSize:void 0,state:{},events:void 0,instance:void 0,skip:!1}}function x(b){if(null==b||"string"!==typeof b&&null==b.view)throw Error("The selector must be either a string or a component.");if("string"===typeof b&&void 0===F[b]){for(var e,n,f=[],k={};e=O.exec(b);){var h=e[1],m=e[2];""===h&&""!==m?n=m:"#"===h?k.id=m:"."===h?f.push(m):"["===e[3][0]&&((h=e[6])&&(h=h.replace(/\\(["'])/g,"$1").replace(/\\\\/g,"\\")),
-k[e[4]]=h||!0)}0<f.length&&(k.className=f.join(" "));F[b]=function(b,g){var e=!1,w,h,f=b.className||b["class"],m;for(m in k)b[m]=k[m];void 0!==f&&(void 0!==b["class"]&&(b["class"]=void 0,b.className=f),void 0!==k.className&&(b.className=k.className+" "+f));for(m in b)if("key"!==m){e=!0;break}g instanceof Array&&1==g.length&&null!=g[0]&&"#"===g[0].tag?h=g[0].children:w=g;return u(n||"div",b.key,e?b:void 0,w,h,void 0)}}var t;null!=arguments[1]&&("object"!==typeof arguments[1]||void 0!==arguments[1].tag||
-arguments[1]instanceof Array)?f=1:(t=arguments[1],f=2);if(arguments.length===f+1)e=arguments[f]instanceof Array?arguments[f]:[arguments[f]];else for(e=[];f<arguments.length;f++)e.push(arguments[f]);return"string"===typeof b?F[b](t||{},u.normalizeChildren(e)):u(b,t&&t.key,t||{},u.normalizeChildren(e),void 0,void 0)}u.normalize=function(b){return b instanceof Array?u("[",void 0,void 0,u.normalizeChildren(b),void 0,void 0):null!=b&&"object"!==typeof b?u("#",void 0,void 0,b,void 0,void 0):b};u.normalizeChildren=
-function(b){for(var e=0;e<b.length;e++)b[e]=u.normalize(b[e]);return b};var O=/(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g,F={};x.trust=function(b){return u("<",void 0,void 0,b,void 0,void 0)};x.fragment=function(b,e){return u("[",b.key,b,u.normalizeChildren(e),void 0,void 0)};var M=function(b){function e(){function a(){0<arguments.length&&arguments[0]!==v&&f(a,arguments[0],void 0);return a._state.value}n(a);0<arguments.length&&arguments[0]!==v&&f(a,arguments[0],
-void 0);return a}function n(a){a.constructor=e;a._state={id:P++,value:void 0,error:void 0,state:0,derive:void 0,recover:void 0,deps:{},parents:[],errorStream:void 0,endStream:void 0};a.map=u;a.ap=x;a.of=e;a.valueOf=q;a.toJSON=G;a.toString=q;a.run=l;a["catch"]=w;Object.defineProperties(a,{error:{get:function(){if(!a._state.errorStream){var c=function(){0<arguments.length&&arguments[0]!==v&&f(a,void 0,arguments[0]);return a._state.error};n(c);A(c,[a],K,K);a._state.errorStream=c}return a._state.errorStream}},
-end:{get:function(){if(!a._state.endStream){var c=e();c.map(function(d){!0===d&&(z(a),z(c));return d});a._state.endStream=c}return a._state.endStream}}})}function f(a,c,d){k(a,c,d);for(var g in a._state.deps)m(a._state.deps[g],!1);a._state.changed=!1;for(var b in a._state.deps)a._state.deps[b]._state.changed=!1}function k(a,c,d){d=p(c,d);if(void 0!==d&&"function"===typeof a._state.recover){if(!t(a,h,!0))return}else h(a,c,d);a._state.changed=!0;2!==a._state.state&&(a._state.state=1)}function h(a,c,
-d){a._state.value=c;a._state.error=d}function m(d,g){var b=d._state.parents;0<b.length&&b.filter(c).length===b.length&&(g||0<b.filter(a).length)&&(b=b.filter(L),0<b.length?k(d,void 0,b[0]._state.error):t(d,k,!1))}function t(a,c,d){try{var b=d?a._state.recover():a._state.derive();if(b===v)return!1;c(a,b,void 0)}catch(e){c(a,void 0,null!=e.__error?e.__error:e),null==e.__error&&g(a,e)}return!0}function p(a,c){null!=a&&a.constructor===e&&(c=void 0!==a._state.error?a._state.error:p(a._state.value,a._state.error));
-return c}function g(a,c){0===Object.keys(a._state.deps).length&&setTimeout(function(){0===Object.keys(a._state.deps).length&&b(c)},0)}function l(a){var c=e(),d=this;return A(c,[d],function(){return B(c,a(d()))},void 0)}function w(a){var c=e(),d=this;return A(c,[d],function(){return d._state.value},function(){return B(c,a(d._state.error))})}function r(c,d){if(d.length>d.filter(D).length)throw Error("Ensure that each item passed to m.prop.combine/m.prop.merge is a stream");return A(e(),d,function(){var b=
-d.filter(L);if(0<b.length)throw{__error:b[0]._state.error};return c.apply(this,d.concat([d.filter(a)]))},void 0)}function B(a,c){if(null!=c&&c.constructor===e){var d=c,b=function(){k(a,d._state.value,d._state.error);for(var c in a._state.deps)m(a._state.deps[c],!1)};d.map(b)["catch"](function(a){b();throw{__error:a};});if(0===d._state.state)return v;if(d._state.error)throw{__error:d._state.error};c=d._state.value}return c}function A(a,c,b,g){var e=a._state;e.derive=b;e.recover=g;e.parents=c.filter(d);
-C(a,e.parents);m(a,!0);return a}function C(a,c){for(var d=0;d<c.length;d++)c[d]._state.deps[a._state.id]=a,C(a,c[d]._state.parents)}function z(a){for(var c=0;c<a._state.parents.length;c++)delete a._state.parents[c]._state.deps[a._state.id];for(var d in a._state.deps){var c=a._state.deps[d],b=c._state.parents.indexOf(a);-1<b&&c._state.parents.splice(b,1)}a._state.state=2;a._state.deps={}}function u(a){return r(function(c){return a(c())},[this])}function x(a){return r(function(a,c){return a()(c())},
-[this,a])}function q(){return this._state.value}function G(){return null!=this._state.value&&"function"===typeof this._state.value.toJSON?this._state.value.toJSON():this._state.value}function D(a){return a._state}function c(a){return 1===a._state.state}function a(a){return a._state.changed}function d(a){return 2!==a._state.state}function L(a){return a._state.error}var P=0,K=function(){},v={};e.merge=function(a){return r(function(){return a.map(function(a){return a()})},a)};e.combine=r;e.reject=function(a){var c=
-e();c.error(a);return c};e.HALT=v;return e}(console.log.bind(console)),E=function(b){function e(b,f){if(f instanceof Array)for(var m=0;m<f.length;m++)e(b+"["+m+"]",f[m]);else if("[object Object]"===Object.prototype.toString.call(f))for(m in f)e(b+"["+m+"]",f[m]);else n.push(encodeURIComponent(b)+(null!=f&&""!==f?"="+encodeURIComponent(f):""))}if("[object Object]"!==Object.prototype.toString.call(b))return"";var n=[],f;for(f in b)e(f,b[f]);return n.join("&")},H=function(b,e){function n(b,e){if(null==
-e)return b;for(var f=b.match(/:[^\/]+/gi)||[],h=0;h<f.length;h++){var m=f[h].slice(1);null!=e[m]&&(b=b.replace(f[h],e[m]),delete e[m])}return b}function f(b,e){var f=E(e);if(""!==f){var h=0>b.indexOf("?")?"?":"&";b+=h+f}return b}function k(b){try{return""!==b?JSON.parse(b):null}catch(e){throw Error(b);}}function h(b){return b.responseText}function m(b,e){if("function"===typeof b)if(e instanceof Array)for(var f=0;f<e.length;f++)e[f]=new b(e[f]);else return new b(e);return e}var t=0,p;return{request:function(g){var l=
-e();void 0!==g.initialValue&&l(g.initialValue);var w="boolean"===typeof g.useBody?g.useBody:"GET"!==g.method&&"TRACE"!==g.method;"function"!==typeof g.serialize&&(g.serialize="undefined"!==typeof FormData&&g.data instanceof FormData?function(b){return b}:JSON.stringify);"function"!==typeof g.deserialize&&(g.deserialize=k);"function"!==typeof g.extract&&(g.extract=h);g.url=n(g.url,g.data);w?g.data=g.serialize(g.data):g.url=f(g.url,g.data);var r=new b.XMLHttpRequest;r.open(g.method,g.url,"boolean"===
-typeof g.async?g.async:!0,"string"===typeof g.user?g.user:void 0,"string"===typeof g.password?g.password:void 0);g.serialize===JSON.stringify&&w&&r.setRequestHeader("Content-Type","application/json; charset=utf-8");g.deserialize===k&&r.setRequestHeader("Accept","application/json, text/*");"function"===typeof g.config&&(r=g.config(r,g)||r);r.onreadystatechange=function(){if(4===r.readyState){try{var b=g.extract!==h?g.extract(r,g):g.deserialize(g.extract(r,g));if(200<=r.status&&300>r.status||304===
-r.status)l(m(g.type,b));else{var e=Error(r.responseText),f;for(f in b)e[f]=b[f];l.error(e)}}catch(w){l.error(w)}"function"===typeof p&&p()}};w?r.send(g.data):r.send();return l},jsonp:function(g){var h=e();void 0!==g.initialValue&&h(g.initialValue);var w=g.callbackName||"_mithril_"+Math.round(1E16*Math.random())+"_"+t++,k=b.document.createElement("script");b[w]=function(e){k.parentNode.removeChild(k);h(m(g.type,e));"function"===typeof p&&p();delete b[w]};k.onerror=function(){k.parentNode.removeChild(k);
-h.error(Error("JSONP request failed"));"function"===typeof p&&p();delete b[w]};null==g.data&&(g.data={});g.url=n(g.url,g.data);g.data[g.callbackKey||"callback"]=w;k.src=f(g.url,g.data);b.document.documentElement.appendChild(k);return h},setCompletionCallback:function(b){p=b}}}(window,M),I=function(){var b=[];return{subscribe:b.push.bind(b),unsubscribe:function(e){e=b.indexOf(e);-1<e&&b.splice(e,1)},publish:function(){for(var e=0;e<b.length;e++)b[e].apply(this,arguments)}}}();H.setCompletionCallback(I.publish);
-var N=function(b){function e(c,a,d,b,e,g,f){for(;d<b;d++){var h=a[d];null!=h&&p(c,n(h,e,f),g)}}function n(c,a,d){var b=c.tag;null!=c.attrs&&z(c.attrs,c,a);if("string"===typeof b)switch(b){case "#":return c.dom=q.createTextNode(c.children);case "<":return f(c);case "[":var g=q.createDocumentFragment();null!=c.children&&(b=c.children,e(g,b,0,b.length,a,null,d));c.dom=g.firstChild;c.domSize=g.childNodes.length;return g;default:var h=c.tag;switch(c.tag){case "svg":d="http://www.w3.org/2000/svg";break;
-case "math":d="http://www.w3.org/1998/Math/MathML"}var v=(b=c.attrs)&&b.is,h=d?v?q.createElementNS(d,h,{is:v}):q.createElementNS(d,h):v?q.createElement(h,{is:v}):q.createElement(h);c.dom=h;if(null!=b)for(g in v=d,b)B(c,g,null,b[g],v);null!=c.text&&(""!==c.text?h.textContent=c.text:c.children=[u("#",void 0,void 0,c.text,void 0,void 0)]);null!=c.children&&(g=c.children,e(h,g,0,g.length,a,null,d),a=c.attrs,"select"===c.tag&&null!=a&&("value"in a&&B(c,"value",null,a.value,void 0),"selectedIndex"in a&&
-B(c,"selectedIndex",null,a.selectedIndex,void 0)));return h}else{c.state||(c.state={});Q(c.state,c.tag);z(c.tag,c,a);c.instance=u.normalize(c.tag.view.call(c.state,c));if(null!=c.instance){if(c.instance===c)throw Error("A view cannot return the vnode it received as arguments");a=n(c.instance,a,d);c.dom=c.instance.dom;c.domSize=null!=c.dom?c.instance.domSize:0;c=a}else c.domSize=0,c=G;return c}}function f(c){var a={caption:"table",thead:"table",tbody:"table",tfoot:"table",tr:"tbody",th:"tr",td:"tr",
-colgroup:"table",col:"colgroup"}[(c.children.match(/^\s*?<(\w+)/im)||[])[1]]||"div",a=q.createElement(a);a.innerHTML=c.children;c.dom=a.firstChild;c.domSize=a.childNodes.length;c=q.createDocumentFragment();for(var d;d=a.firstChild;)c.appendChild(d);return c}function k(c,a,d,b,f,k){if(a!==d&&(null!=a||null!=d))if(null==a)e(c,d,0,d.length,b,f,void 0);else if(null==d)g(c,a,0,a.length,d);else{var v;a:{if(null!=a.pool&&Math.abs(a.pool.length-d.length)<=Math.abs(a.length-d.length)&&(v=d[0]&&d[0].children&&
-d[0].children.length||0,Math.abs((a.pool[0]&&a.pool[0].children&&a.pool[0].children.length||0)-v)<=Math.abs((a[0]&&a[0].children&&a[0].children.length||0)-v))){v=!0;break a}v=!1}v&&(a=a.concat(a.pool));if(a.length===d.length&&null!=d[0]&&null==d[0].key)for(var l=0;l<a.length;l++)a[l]===d[l]||null==a[l]&&null==d[l]||(null==a[l]?p(c,n(d[l],b,k),t(a,l+1,f)):null==d[l]?g(c,a,l,l+1,d):h(c,a[l],d[l],b,t(a,l+1,f),v,k),v&&a[l].tag===d[l].tag&&p(c,m(a[l]),t(a,l+1,f)));else{for(var w=l=0,r=a.length-1,A=d.length-
-1,B;r>=l&&A>=w;){var y=a[l],q=d[w];if(y!==q||v)if(null!=y&&null!=q&&y.key===q.key)l++,w++,h(c,y,q,b,t(a,l,f),v,k),v&&y.tag===q.tag&&p(c,m(y),f);else if(y=a[r],y!==q||v)if(null!=y&&null!=q&&y.key===q.key)h(c,y,q,b,t(a,r+1,f),v,k),(v||w<A)&&p(c,m(y),t(a,l,f)),r--,w++;else break;else r--,w++;else l++,w++}for(;r>=l&&A>=w;){y=a[r];q=d[A];if(y!==q||v)if(null!=y&&null!=q&&y.key===q.key)h(c,y,q,b,t(a,r+1,f),v,k),v&&y.tag===q.tag&&p(c,m(y),f),null!=y.dom&&(f=y.dom),r--;else{if(!B){B=a;var y=r,u={},x;for(x=
-0;x<y;x++){var C=B[x];null!=C&&(C=C.key,null!=C&&(u[C]=x))}B=u}null!=q&&(y=B[q.key],null!=y?(u=a[y],h(c,u,q,b,t(a,r+1,f),v,k),p(c,m(u),f),a[y].skip=!0,null!=u.dom&&(f=u.dom)):(q=n(q,b,void 0),p(c,q,f),f=q))}else r--;A--;if(A<w)break}e(c,d,w,A+1,b,f,k);g(c,a,l,r+1,d)}}}function h(c,a,d,b,e,g,l){var r=a.tag;if(r===d.tag){d.state=a.state;d.events=a.events;var q;var t;null!=d.attrs&&"function"===typeof d.attrs.onbeforeupdate&&(q=d.attrs.onbeforeupdate.call(d.state,d,a));"string"!==typeof d.tag&&"function"===
-typeof d.tag.onbeforeupdate&&(t=d.tag.onbeforeupdate.call(d.state,d,a));void 0===q&&void 0===t||q||t?q=!1:(d.dom=a.dom,d.domSize=a.domSize,d.instance=a.instance,q=!0);if(!q)if(null!=d.attrs&&x(d.attrs,d,b,g),"string"===typeof r)switch(r){case "#":a.children.toString()!==d.children.toString()&&(a.dom.nodeValue=d.children);d.dom=a.dom;break;case "<":a.children!==d.children?(m(a),p(c,f(d),e)):(d.dom=a.dom,d.domSize=a.domSize);break;case "[":k(c,a.children,d.children,b,e,l);a=0;b=d.children;d.dom=null;
-if(null!=b){for(var z=0;z<b.length;z++)c=b[z],null!=c&&null!=c.dom&&(null==d.dom&&(d.dom=c.dom),a+=c.domSize||1);1!==a&&(d.domSize=a)}break;default:c=l;e=d.dom=a.dom;switch(d.tag){case "svg":c="http://www.w3.org/2000/svg";break;case "math":c="http://www.w3.org/1998/Math/MathML"}"textarea"===d.tag&&(null==d.attrs&&(d.attrs={}),null!=d.text&&(d.attrs.value=d.text));g=a.attrs;l=d.attrs;r=c;if(null!=l)for(z in l)B(d,z,g&&g[z],l[z],r);if(null!=g)for(z in g)null!=l&&z in l||("className"===z&&(z="class"),
-"o"!==z[0]||"n"!==z[1]||A(z)?"key"!==z&&d.dom.removeAttribute(z):C(d,z,void 0));null!=a.text&&null!=d.text&&""!==d.text?a.text.toString()!==d.text.toString()&&(a.dom.firstChild.nodeValue=d.text):(null!=a.text&&(a.children=[u("#",void 0,void 0,a.text,void 0,a.dom.firstChild)]),null!=d.text&&(d.children=[u("#",void 0,void 0,d.text,void 0,void 0)]),k(e,a.children,d.children,b,null,c))}else d.instance=u.normalize(d.tag.view.call(d.state,d)),x(d.tag,d,b,g),null!=d.instance?(null==a.instance?p(c,n(d.instance,
-b,l),e):h(c,a.instance,d.instance,b,e,g,l),d.dom=d.instance.dom,d.domSize=d.instance.domSize):null!=a.instance?(w(c,a.instance,null),d.dom=void 0,d.domSize=0):(d.dom=a.dom,d.domSize=a.domSize)}else w(c,a,null),p(c,n(d,b,void 0),e)}function m(c){var a=c.domSize;if(null!=a||null==c.dom){var d=q.createDocumentFragment();if(0<a){for(c=c.dom;--a;)d.appendChild(c.nextSibling);d.insertBefore(c,d.firstChild)}return d}return c.dom}function t(c,a,d){for(;a<c.length;a++)if(null!=c[a]&&null!=c[a].dom)return c[a].dom;
-return d}function p(c,a,d){d&&d.parentNode?c.insertBefore(a,d):c.appendChild(a)}function g(c,a,d,b,e){for(;d<b;d++){var g=a[d];null!=g&&(g.skip?g.skip=!1:w(c,g,e))}}function l(c){var a=!1;return function(){a||(a=!0,c())}}function w(c,a,d){function b(){if(++g===e&&(r(a),a.dom)){var f=a.domSize||1;if(1<f)for(var l=a.dom;--f;)c.removeChild(l.nextSibling);null!=a.dom.parentNode&&c.removeChild(a.dom);if(f=null!=d&&null==a.domSize)f=a.attrs,f=!(null!=f&&(f.oncreate||f.onupdate||f.onbeforeremove||f.onremove));
-f&&"string"===typeof a.tag&&(d.pool?d.pool.push(a):d.pool=[a])}}var e=1,g=0;a.attrs&&a.attrs.onbeforeremove&&(e++,a.attrs.onbeforeremove.call(a.state,a,l(b)));"string"!==typeof a.tag&&a.tag.onbeforeremove&&(e++,a.tag.onbeforeremove.call(a.state,a,l(b)));b()}function r(c){c.attrs&&c.attrs.onremove&&c.attrs.onremove.call(c.state,c);"string"!==typeof c.tag&&c.tag.onremove&&c.tag.onremove.call(c.state,c);if(null!=c.instance)r(c.instance);else if(c=c.children,c instanceof Array)for(var a=0;a<c.length;a++){var d=
-c[a];null!=d&&r(d)}}function B(c,a,d,b,e){var f=c.dom;if("key"!==a&&(d!==b||"value"===a||"checked"===a||"selectedIndex"===a||"selected"===a&&c.dom===q.activeElement||"object"===typeof b)&&"undefined"!==typeof b&&!A(a)){var g=a.indexOf(":");if(-1<g&&"xlink"===a.substr(0,g))f.setAttributeNS("http://www.w3.org/1999/xlink",a.slice(g+1),b);else if("o"===a[0]&&"n"===a[1]&&"function"===typeof b)C(c,a,b);else if("style"===a)if(c=d,c===b&&(f.style.cssText="",c=null),null==b)f.style.cssText="";else if("string"===
-typeof b)f.style.cssText=b;else{"string"===typeof c&&(f.style.cssText="");for(var l in b)f.style[l]=b[l];if(null!=c&&"string"!==typeof c)for(l in c)l in b||(f.style[l]="")}else if(a in f&&"href"!==a&&"list"!==a&&"form"!==a&&"width"!==a&&"height"!==a&&void 0===e){if("input"!==c.tag||"value"!==a||c.dom.value!==b||c.dom!==q.activeElement)f[a]=b}else"boolean"===typeof b?b?f.setAttribute(a,""):f.removeAttribute(a):f.setAttribute("className"===a?"class":a,b)}}function A(c){return"oninit"===c||"oncreate"===
-c||"onupdate"===c||"onremove"===c||"onbeforeremove"===c||"onbeforeupdate"===c}function C(c,a,b){var e=c.dom,f=function(a){var c=b.call(e,a);"function"===typeof D&&D.call(e,a);return c};if(a in e)e[a]=f;else{var g=a.slice(2);void 0===c.events&&(c.events={});null!=c.events[a]&&e.removeEventListener(g,c.events[a],!1);"function"===typeof b&&(c.events[a]=f,e.addEventListener(g,c.events[a],!1))}}function z(c,a,b){"function"===typeof c.oninit&&c.oninit.call(a.state,a);"function"===typeof c.oncreate&&b.push(c.oncreate.bind(a.state,
-a))}function x(c,a,b,e){e?z(c,a,b):"function"===typeof c.onupdate&&b.push(c.onupdate.bind(a.state,a))}function Q(c,a){Object.keys(a).forEach(function(b){c[b]=a[b]})}var q=b.document,G=q.createDocumentFragment(),D;return{render:function(c,a){if(!c)throw Error("Ensure the DOM element being passed to m.route/m.mount/m.render is not undefined.");var b=[],e=q.activeElement;null==c.vnodes&&(c.textContent="");a instanceof Array||(a=[a]);k(c,c.vnodes,u.normalizeChildren(a),b,null,void 0);c.vnodes=a;for(var f=
-0;f<b.length;f++)b[f]();q.activeElement!==e&&e.focus()},setEventCallback:function(c){return D=c}}}(window),R=function(b){var e=0,n=null,f="function"===typeof requestAnimationFrame?requestAnimationFrame:setTimeout;return function(k){var h=Date.now();!0===k||0===e||16<=h-e?(e=h,b()):null===n&&(n=f(function(){n=null;b();e=Date.now()},16-(h-e)))}},S=function(b,e,n,f){f=R(f);null!=e&&e.setEventCallback(function(b){!1!==b.redraw&&n.publish()});null!=n&&(b.redraw&&n.unsubscribe(b.redraw),n.subscribe(f));
-return b.redraw=f};x.mount=function(b,e){return function(n,f){null===f?(b.render(n,[]),e.unsubscribe(n.redraw),delete n.redraw):S(n,b,e,function(){b.render(n,u(f,void 0,void 0,void 0,void 0,void 0))})()}}(N,I);var J=function(b){if(""===b||null==b)return{};"?"===b.charAt(0)&&(b=b.slice(1));b=b.split("&");for(var e={},n={},f=0;f<b.length;f++){var k=b[f].split("="),h=decodeURIComponent(k[0]),k=2===k.length?decodeURIComponent(k[1]):"",m=Number(k);""!==k&&!isNaN(m)||"NaN"===k?k=m:"true"===k?k=!0:"false"===
-k&&(k=!1);var m=h.split(/\]\[?|\[/),t=e;-1<h.indexOf("[")&&m.pop();for(var p=0;p<m.length;p++){var h=m[p],g=m[p+1],g=""==g||!isNaN(parseInt(g,10)),l=p===m.length-1;""===h&&(h=m.slice(0,p).join(),null==n[h]&&(n[h]=0),h=n[h]++);null==t[h]&&(t[h]=l?k:g?[]:{});t=t[h]}}return e},T=function(b){function e(e){var f=b.location[e].replace(/(?:%[a-f89][a-f0-9])+/gim,decodeURIComponent);"pathname"===e&&"/"!==f[0]&&(f="/"+f);return f}function n(b){return function(){null==g&&(g=t(function(){g=null;b()}))}}function f(b,
-e,f){var g=b.indexOf("?"),h=b.indexOf("#"),k=-1<g?g:-1<h?h:b.length;if(-1<g){var g=J(b.slice(g+1,-1<h?h:b.length)),m;for(m in g)e[m]=g[m]}if(-1<h)for(m in e=J(b.slice(h+1)),e)f[m]=e[m];return b.slice(0,k)}function k(){switch(p.charAt(0)){case "#":return e("hash").slice(p.length);case "?":return e("search").slice(p.length)+e("hash");default:return e("pathname").slice(p.length)+e("search")+e("hash")}}function h(e,g,h){var k={},n={};e=f(e,k,n);if(null!=g){for(var t in g)k[t]=g[t];e=e.replace(/:([^\/]+)/g,
-function(b,e){delete k[e];return g[e]})}(t=E(k))&&(e+="?"+t);(n=E(n))&&(e+="#"+n);m?(h&&h.replace?b.history.replaceState(null,null,p+e):b.history.pushState(null,null,p+e),b.onpopstate()):b.location.href=p+e}var m="function"===typeof b.history.pushState,t="function"===typeof setImmediate?setImmediate:setTimeout,p="#!",g;return{setPrefix:function(b){p=b},getPath:k,setPath:h,defineRoutes:function(e,g,h){function t(){var b=k(),m={},n=f(b,m,m),p;for(p in e){var u=new RegExp("^"+p.replace(/:[^\/]+?\.{3}/g,
-"(.*?)").replace(/:[^\/]+/g,"([^\\/]+)")+"/?$");if(u.test(n)){n.replace(u,function(){for(var f=p.match(/:[^\/]+/g)||[],h=[].slice.call(arguments,1,-2),k=0;k<f.length;k++)m[f[k].replace(/:|\./g,"")]=decodeURIComponent(h[k]);g(e[p],m,b,p)});return}}h(b,m)}m?b.onpopstate=n(t):"#"===p.charAt(0)&&(b.onhashchange=t);t();return t},link:function(b){b.dom.setAttribute("href",p+b.attrs.href);b.dom.onclick=function(b){b.preventDefault();b.redraw=!1;b=this.getAttribute("href");0===b.indexOf(p)&&(b=b.slice(p.length));
-h(b,void 0,void 0)}}}};x.route=function(b,e){function n(b){return b}var f=T(b),k,h,m,t,p,g={view:function(){return[m(u(h,null,t,void 0,void 0,void 0))]}},l=function(b,l,u){h="div";m=n;t=null;e(b,g);f.defineRoutes(u,function(e,f,g){var l="function"!==typeof e.view,r=n,q=k=function(n){q===k&&(k=null,h=null!=n?n:l?"div":e,m=r,t=f,p=g,b.redraw(!0))},u=function(){q()};l&&("function"===typeof e.render&&(r=e.render.bind(e)),"function"===typeof e.onmatch&&(u=e.onmatch));u.call(e,q,f,g)},function(){f.setPath(l,
-null,{replace:!0})})};l.link=f.link;l.prefix=f.setPrefix;l.set=f.setPath;l.get=function(){return p};return l}(window,x.mount);x.withAttr=function(b,e,n){return function(f){return e.call(n||this,b in f.currentTarget?f.currentTarget[b]:f.currentTarget.getAttribute(b))}};x.prop=M;x.render=N.render;x.redraw=I.publish;x.request=H.request;x.jsonp=H.jsonp;x.parseQueryString=J;x.buildQueryString=E;x.version="1.0.0";"undefined"!==typeof module?module.exports=x:window.m=x};
+// https://cdnjs.cloudflare.com/ajax/libs/mithril/1.1.0/mithril.min.js
+(function(){function B(b,d,f,g,e,n){return{tag:b,key:d,attrs:f,children:g,text:e,dom:n,domSize:void 0,state:void 0,_state:void 0,events:void 0,instance:void 0,skip:!1}}function C(b){var d=arguments[1],f=2,g;if(null==b||"string"!==typeof b&&"function"!==typeof b&&"function"!==typeof b.view)throw Error("The selector must be either a string or a component.");if("string"===typeof b){var e;if(!(e=M[b])){g="div";for(var n=[],k={};e=P.exec(b);){var q=e[1],m=e[2];""===q&&""!==m?g=m:"#"===q?k.id=m:"."===q?
+n.push(m):"["===e[3][0]&&((q=e[6])&&(q=q.replace(/\\(["'])/g,"$1").replace(/\\\\/g,"\\")),"class"===e[4]?n.push(q):k[e[4]]=q||!0)}0<n.length&&(k.className=n.join(" "));e=M[b]={tag:g,attrs:k}}}if(!d)d={};else if("object"!==typeof d||null!=d.tag||Array.isArray(d))d={},f=1;if(arguments.length===f+1)g=arguments[f],Array.isArray(g)||(g=[g]);else for(g=[];f<arguments.length;)g.push(arguments[f++]);f=B.normalizeChildren(g);if("string"===typeof b){g=!1;var l,u,n=d.className||d["class"],a;for(a in e.attrs)N.call(e.attrs,
+a)&&(d[a]=e.attrs[a]);null!=n&&(null!=d["class"]&&(d["class"]=void 0,d.className=n),null!=e.attrs.className&&(d.className=e.attrs.className+" "+n));for(a in d)if(N.call(d,a)&&"key"!==a){g=!0;break}Array.isArray(f)&&1===f.length&&null!=f[0]&&"#"===f[0].tag?u=f[0].children:l=f;return B(e.tag,d.key,g?d:void 0,l,u)}return B(b,d.key,d,f)}function Q(b){var d=0,f=null,g="function"===typeof requestAnimationFrame?requestAnimationFrame:setTimeout;return function(){var e=Date.now();0===d||16<=e-d?(d=e,b()):
+null===f&&(f=g(function(){f=null;b();d=Date.now()},16-(e-d)))}}B.normalize=function(b){return Array.isArray(b)?B("[",void 0,void 0,B.normalizeChildren(b),void 0,void 0):null!=b&&"object"!==typeof b?B("#",void 0,void 0,!1===b?"":b,void 0,void 0):b};B.normalizeChildren=function(b){for(var d=0;d<b.length;d++)b[d]=B.normalize(b[d]);return b};var P=/(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g,M={},N={}.hasOwnProperty;C.trust=function(b){null==b&&(b="");return B("<",void 0,
+void 0,b,void 0,void 0)};C.fragment=function(b,d){return B("[",b.key,b,B.normalizeChildren(d),void 0,void 0)};var x=function(b){function d(b,a){return function r(d){var k;try{if(!a||null==d||"object"!==typeof d&&"function"!==typeof d||"function"!==typeof(k=d.then))l(function(){a||0!==b.length||console.error("Possible unhandled promise rejection:",d);for(var f=0;f<b.length;f++)b[f](d);e.length=0;n.length=0;m.state=a;m.retry=function(){r(d)}});else{if(d===g)throw new TypeError("Promise can't be resolved w/ itself");
+f(k.bind(d))}}catch(R){q(R)}}}function f(b){function a(a){return function(b){0<d++||a(b)}}var d=0,e=a(q);try{b(a(k),e)}catch(A){e(A)}}if(!(this instanceof x))throw Error("Promise must be called with `new`");if("function"!==typeof b)throw new TypeError("executor must be a function");var g=this,e=[],n=[],k=d(e,!0),q=d(n,!1),m=g._instance={resolvers:e,rejectors:n},l="function"===typeof setImmediate?setImmediate:setTimeout;f(b)};x.prototype.then=function(b,d){function f(b,d,f,k){d.push(function(a){if("function"!==
+typeof b)f(a);else try{e(b(a))}catch(w){n&&n(w)}});"function"===typeof g.retry&&k===g.state&&g.retry()}var g=this._instance,e,n,k=new x(function(b,d){e=b;n=d});f(b,g.resolvers,e,!0);f(d,g.rejectors,n,!1);return k};x.prototype["catch"]=function(b){return this.then(null,b)};x.resolve=function(b){return b instanceof x?b:new x(function(d){d(b)})};x.reject=function(b){return new x(function(d,f){f(b)})};x.all=function(b){return new x(function(d,f){var g=b.length,e=0,n=[];if(0===b.length)d([]);else for(var k=
+0;k<b.length;k++)(function(k){function m(b){e++;n[k]=b;e===g&&d(n)}null==b[k]||"object"!==typeof b[k]&&"function"!==typeof b[k]||"function"!==typeof b[k].then?m(b[k]):b[k].then(m,f)})(k)})};x.race=function(b){return new x(function(d,f){for(var g=0;g<b.length;g++)b[g].then(d,f)})};"undefined"!==typeof window?("undefined"===typeof window.Promise&&(window.Promise=x),x=window.Promise):"undefined"!==typeof global&&("undefined"===typeof global.Promise&&(global.Promise=x),x=global.Promise);var F=function(b){function d(b,
+g){if(Array.isArray(g))for(var e=0;e<g.length;e++)d(b+"["+e+"]",g[e]);else if("[object Object]"===Object.prototype.toString.call(g))for(e in g)d(b+"["+e+"]",g[e]);else f.push(encodeURIComponent(b)+(null!=g&&""!==g?"="+encodeURIComponent(g):""))}if("[object Object]"!==Object.prototype.toString.call(b))return"";var f=[],g;for(g in b)d(g,b[g]);return f.join("&")},S=/^file:\/\//i,K=function(b,d){function f(){function a(){0===--b&&"function"===typeof u&&u()}var b=0;return function A(d){var e=d.then;d.then=
+function(){b++;var f=e.apply(d,arguments);f.then(a,function(d){a();if(0===b)throw d;});return A(f)};return d}}function g(a,b){if("string"===typeof a){var d=a;a=b||{};null==a.url&&(a.url=d)}return a}function e(a,b){if(null==b)return a;for(var d=a.match(/:[^\/]+/gi)||[],e=0;e<d.length;e++){var f=d[e].slice(1);null!=b[f]&&(a=a.replace(d[e],b[f]))}return a}function n(a,b){var d=F(b);if(""!==d){var e=0>a.indexOf("?")?"?":"&";a+=e+d}return a}function k(a){try{return""!==a?JSON.parse(a):null}catch(w){throw Error(a);
+}}function q(a){return a.responseText}function m(a,b){if("function"===typeof a)if(Array.isArray(b))for(var d=0;d<b.length;d++)b[d]=new a(b[d]);else return new a(b);return b}var l=0,u;return{request:function(a,l){var u=f();a=g(a,l);var w=new d(function(d,f){null==a.method&&(a.method="GET");a.method=a.method.toUpperCase();var g="GET"===a.method||"TRACE"===a.method?!1:"boolean"===typeof a.useBody?a.useBody:!0;"function"!==typeof a.serialize&&(a.serialize="undefined"!==typeof FormData&&a.data instanceof
+FormData?function(h){return h}:JSON.stringify);"function"!==typeof a.deserialize&&(a.deserialize=k);"function"!==typeof a.extract&&(a.extract=q);a.url=e(a.url,a.data);g?a.data=a.serialize(a.data):a.url=n(a.url,a.data);var l=new b.XMLHttpRequest,u=!1,w=l.abort;l.abort=function(){u=!0;w.call(l)};l.open(a.method,a.url,"boolean"===typeof a.async?a.async:!0,"string"===typeof a.user?a.user:void 0,"string"===typeof a.password?a.password:void 0);a.serialize===JSON.stringify&&g&&l.setRequestHeader("Content-Type",
+"application/json; charset=utf-8");a.deserialize===k&&l.setRequestHeader("Accept","application/json, text/*");a.withCredentials&&(l.withCredentials=a.withCredentials);for(var r in a.headers)({}).hasOwnProperty.call(a.headers,r)&&l.setRequestHeader(r,a.headers[r]);"function"===typeof a.config&&(l=a.config(l,a)||l);l.onreadystatechange=function(){if(!u&&4===l.readyState)try{var h=a.extract!==q?a.extract(l,a):a.deserialize(a.extract(l,a));if(200<=l.status&&300>l.status||304===l.status||S.test(a.url))d(m(a.type,
+h));else{var c=Error(l.responseText),p;for(p in h)c[p]=h[p];f(c)}}catch(v){f(v)}};g&&null!=a.data?l.send(a.data):l.send()});return!0===a.background?w:u(w)},jsonp:function(a,k){var u=f();a=g(a,k);var q=new d(function(d,f){var g=a.callbackName||"_mithril_"+Math.round(1E16*Math.random())+"_"+l++,k=b.document.createElement("script");b[g]=function(e){k.parentNode.removeChild(k);d(m(a.type,e));delete b[g]};k.onerror=function(){k.parentNode.removeChild(k);f(Error("JSONP request failed"));delete b[g]};null==
+a.data&&(a.data={});a.url=e(a.url,a.data);a.data[a.callbackKey||"callback"]=g;k.src=n(a.url,a.data);b.document.documentElement.appendChild(k)});return!0===a.background?q:u(q)},setCompletionCallback:function(a){u=a}}}(window,x),O=function(b){function d(h,c,p,a,b,d,e){for(;p<a;p++){var v=c[p];null!=v&&f(h,v,b,e,d)}}function f(h,c,p,a,b){var v=c.tag;if("string"===typeof v)switch(c.state={},null!=c.attrs&&C(c.attrs,c,p),v){case "#":return c.dom=D.createTextNode(c.children),l(h,c.dom,b),c.dom;case "<":return g(h,
+c,b);case "[":var k=D.createDocumentFragment();null!=c.children&&(v=c.children,d(k,v,0,v.length,p,null,a));c.dom=k.firstChild;c.domSize=k.childNodes.length;l(h,k,b);return k;default:var m=c.tag;switch(c.tag){case "svg":a="http://www.w3.org/2000/svg";break;case "math":a="http://www.w3.org/1998/Math/MathML"}var t=(v=c.attrs)&&v.is,m=a?t?D.createElementNS(a,m,{is:t}):D.createElementNS(a,m):t?D.createElement(m,{is:t}):D.createElement(m);c.dom=m;if(null!=v)for(k in t=a,v)A(c,k,null,v[k],t);l(h,m,b);null!=
+c.attrs&&null!=c.attrs.contenteditable?u(c):(null!=c.text&&(""!==c.text?m.textContent=c.text:c.children=[B("#",void 0,void 0,c.text,void 0,void 0)]),null!=c.children&&(h=c.children,d(m,h,0,h.length,p,null,a),h=c.attrs,"select"===c.tag&&null!=h&&("value"in h&&A(c,"value",null,h.value,void 0),"selectedIndex"in h&&A(c,"selectedIndex",null,h.selectedIndex,void 0))));return m}else return e(c,p),null!=c.instance?(p=f(h,c.instance,p,a,b),c.dom=c.instance.dom,c.domSize=null!=c.dom?c.instance.domSize:0,l(h,
+p,b),c=p):(c.domSize=0,c=J),c}function g(h,c,p){var a={caption:"table",thead:"table",tbody:"table",tfoot:"table",tr:"tbody",th:"tr",td:"tr",colgroup:"table",col:"colgroup"}[(c.children.match(/^\s*?<(\w+)/im)||[])[1]]||"div",a=D.createElement(a);a.innerHTML=c.children;c.dom=a.firstChild;c.domSize=a.childNodes.length;c=D.createDocumentFragment();for(var b;b=a.firstChild;)c.appendChild(b);l(h,c,p);return c}function e(h,c){var a;if("function"===typeof h.tag.view){h.state=Object.create(h.tag);a=h.state.view;
+if(null!=a.$$reentrantLock$$)return J;a.$$reentrantLock$$=!0}else{h.state=void 0;a=h.tag;if(null!=a.$$reentrantLock$$)return J;a.$$reentrantLock$$=!0;h.state=null!=h.tag.prototype&&"function"===typeof h.tag.prototype.view?new h.tag(h):h.tag(h)}h._state=h.state;null!=h.attrs&&C(h.attrs,h,c);C(h._state,h,c);h.instance=B.normalize(h._state.view.call(h.state,h));if(h.instance===h)throw Error("A view cannot return the vnode it received as argument");a.$$reentrantLock$$=null}function n(h,c,p,b,e,g,n){if(c!==
+p&&(null!=c||null!=p))if(null==c)d(h,p,0,p.length,e,g,void 0);else if(null==p)a(c,0,c.length,p);else{if(c.length===p.length){for(var v=!1,t=0;t<p.length;t++)if(null!=p[t]&&null!=c[t]){v=null==p[t].key&&null==c[t].key;break}if(v){for(t=0;t<c.length;t++)c[t]!==p[t]&&(null==c[t]&&null!=p[t]?f(h,p[t],e,n,m(c,t+1,g)):null==p[t]?a(c,t,t+1,p):k(h,c[t],p[t],e,m(c,t+1,g),b,n));return}}if(!b)a:{if(null!=c.pool&&Math.abs(c.pool.length-p.length)<=Math.abs(c.length-p.length)&&(b=p[0]&&p[0].children&&p[0].children.length||
+0,Math.abs((c.pool[0]&&c.pool[0].children&&c.pool[0].children.length||0)-b)<=Math.abs((c[0]&&c[0].children&&c[0].children.length||0)-b))){b=!0;break a}b=!1}if(b){var u=c.pool;c=c.concat(c.pool)}for(var t=v=0,w=c.length-1,y=p.length-1,G;w>=v&&y>=t;){var r=c[v],z=p[t];if(r!==z||b)if(null==r)v++;else if(null==z)t++;else if(r.key===z.key){var A=null!=u&&v>=c.length-u.length||null==u&&b;v++;t++;k(h,r,z,e,m(c,v,g),A,n);b&&r.tag===z.tag&&l(h,q(r),g)}else if(r=c[w],r!==z||b)if(null==r)w--;else if(null==z)t++;
+else if(r.key===z.key)A=null!=u&&w>=c.length-u.length||null==u&&b,k(h,r,z,e,m(c,w+1,g),A,n),(b||t<y)&&l(h,q(r),m(c,v,g)),w--,t++;else break;else w--,t++;else v++,t++}for(;w>=v&&y>=t;){r=c[w];z=p[y];if(r!==z||b)if(null==r)w--;else{if(null!=z)if(r.key===z.key)A=null!=u&&w>=c.length-u.length||null==u&&b,k(h,r,z,e,m(c,w+1,g),A,n),b&&r.tag===z.tag&&l(h,q(r),g),null!=r.dom&&(g=r.dom),w--;else{if(!G){G=c;var r=w,A={},E;for(E=0;E<r;E++){var x=G[E];null!=x&&(x=x.key,null!=x&&(A[x]=E))}G=A}null!=z&&(r=G[z.key],
+null!=r?(A=c[r],k(h,A,z,e,m(c,w+1,g),b,n),l(h,q(A),g),c[r].skip=!0,null!=A.dom&&(g=A.dom)):g=f(h,z,e,void 0,g))}y--}else w--,y--;if(y<t)break}d(h,p,t,y+1,e,g,n);a(c,v,w+1,p)}}function k(h,c,a,b,d,m,l){var p=c.tag;if(p===a.tag){a.state=c.state;a._state=c._state;a.events=c.events;var v;if(v=!m){var r,z;null!=a.attrs&&"function"===typeof a.attrs.onbeforeupdate&&(r=a.attrs.onbeforeupdate.call(a.state,a,c));"string"!==typeof a.tag&&"function"===typeof a._state.onbeforeupdate&&(z=a._state.onbeforeupdate.call(a.state,
+a,c));void 0===r&&void 0===z||r||z?v=!1:(a.dom=c.dom,a.domSize=c.domSize,a.instance=c.instance,v=!0)}if(!v)if("string"===typeof p)switch(null!=a.attrs&&(m?(a.state={},C(a.attrs,a,b)):I(a.attrs,a,b)),p){case "#":c.children.toString()!==a.children.toString()&&(c.dom.nodeValue=a.children);a.dom=c.dom;break;case "<":c.children!==a.children?(q(c),g(h,a,d)):(a.dom=c.dom,a.domSize=c.domSize);break;case "[":n(h,c.children,a.children,m,b,d,l);c=0;b=a.children;a.dom=null;if(null!=b){for(m=0;m<b.length;m++){var y=
+b[m];null!=y&&null!=y.dom&&(null==a.dom&&(a.dom=y.dom),c+=y.domSize||1)}1!==c&&(a.domSize=c)}break;default:h=l;d=a.dom=c.dom;switch(a.tag){case "svg":h="http://www.w3.org/2000/svg";break;case "math":h="http://www.w3.org/1998/Math/MathML"}"textarea"===a.tag&&(null==a.attrs&&(a.attrs={}),null!=a.text&&(a.attrs.value=a.text,a.text=void 0));l=c.attrs;p=a.attrs;v=h;if(null!=p)for(y in p)A(a,y,l&&l[y],p[y],v);if(null!=l)for(y in l)null!=p&&y in p||("className"===y&&(y="class"),"o"!==y[0]||"n"!==y[1]||E(y)?
+"key"!==y&&a.dom.removeAttribute(y):x(a,y,void 0));null!=a.attrs&&null!=a.attrs.contenteditable?u(a):null!=c.text&&null!=a.text&&""!==a.text?c.text.toString()!==a.text.toString()&&(c.dom.firstChild.nodeValue=a.text):(null!=c.text&&(c.children=[B("#",void 0,void 0,c.text,void 0,c.dom.firstChild)]),null!=a.text&&(a.children=[B("#",void 0,void 0,a.text,void 0,void 0)]),n(d,c.children,a.children,m,b,null,h))}else{if(m)e(a,b);else{a.instance=B.normalize(a._state.view.call(a.state,a));if(a.instance===a)throw Error("A view cannot return the vnode it received as argument");
+null!=a.attrs&&I(a.attrs,a,b);I(a._state,a,b)}null!=a.instance?(null==c.instance?f(h,a.instance,b,l,d):k(h,c.instance,a.instance,b,d,m,l),a.dom=a.instance.dom,a.domSize=a.instance.domSize):null!=c.instance?(w(c.instance,null),a.dom=void 0,a.domSize=0):(a.dom=c.dom,a.domSize=c.domSize)}}else w(c,null),f(h,a,b,l,d)}function q(a){var c=a.domSize;if(null!=c||null==a.dom){var b=D.createDocumentFragment();if(0<c){for(a=a.dom;--c;)b.appendChild(a.nextSibling);b.insertBefore(a,b.firstChild)}return b}return a.dom}
+function m(a,c,b){for(;c<a.length;c++)if(null!=a[c]&&null!=a[c].dom)return a[c].dom;return b}function l(a,c,b){b&&b.parentNode?a.insertBefore(c,b):a.appendChild(c)}function u(a){var c=a.children;if(null!=c&&1===c.length&&"<"===c[0].tag)c=c[0].children,a.dom.innerHTML!==c&&(a.dom.innerHTML=c);else if(null!=a.text||null!=c&&0!==c.length)throw Error("Child node of a contenteditable must be trusted");}function a(a,c,b,d){for(;c<b;c++){var h=a[c];null!=h&&(h.skip?h.skip=!1:w(h,d))}}function w(a,c){function b(){if(++d===
+h&&(r(a),a.dom)){var b=a.domSize||1;if(1<b)for(var e=a.dom;--b;){var g=e.nextSibling,f=g.parentNode;null!=f&&f.removeChild(g)}b=a.dom;e=b.parentNode;null!=e&&e.removeChild(b);if(b=null!=c&&null==a.domSize)b=a.attrs,b=!(null!=b&&(b.oncreate||b.onupdate||b.onbeforeremove||b.onremove));b&&"string"===typeof a.tag&&(c.pool?c.pool.push(a):c.pool=[a])}}var h=1,d=0;if(a.attrs&&"function"===typeof a.attrs.onbeforeremove){var e=a.attrs.onbeforeremove.call(a.state,a);null!=e&&"function"===typeof e.then&&(h++,
+e.then(b,b))}"string"!==typeof a.tag&&"function"===typeof a._state.onbeforeremove&&(e=a._state.onbeforeremove.call(a.state,a),null!=e&&"function"===typeof e.then&&(h++,e.then(b,b)));b()}function r(a){a.attrs&&"function"===typeof a.attrs.onremove&&a.attrs.onremove.call(a.state,a);"string"!==typeof a.tag&&"function"===typeof a._state.onremove&&a._state.onremove.call(a.state,a);if(null!=a.instance)r(a.instance);else if(a=a.children,Array.isArray(a))for(var c=0;c<a.length;c++){var b=a[c];null!=b&&r(b)}}
+function A(a,c,b,d,e){var h=a.dom;if("key"!==c&&"is"!==c&&(b!==d||"value"===c||"checked"===c||"selectedIndex"===c||"selected"===c&&a.dom===D.activeElement||"object"===typeof d)&&"undefined"!==typeof d&&!E(c)){var g=c.indexOf(":");if(-1<g&&"xlink"===c.substr(0,g))h.setAttributeNS("http://www.w3.org/1999/xlink",c.slice(g+1),d);else if("o"===c[0]&&"n"===c[1]&&"function"===typeof d)x(a,c,d);else if("style"===c)if(a=b,a===d&&(h.style.cssText="",a=null),null==d)h.style.cssText="";else if("string"===typeof d)h.style.cssText=
+d;else{"string"===typeof a&&(h.style.cssText="");for(var f in d)h.style[f]=d[f];if(null!=a&&"string"!==typeof a)for(f in a)f in d||(h.style[f]="")}else c in h&&"href"!==c&&"list"!==c&&"form"!==c&&"width"!==c&&"height"!==c&&void 0===e&&!(a.attrs.is||-1<a.tag.indexOf("-"))?"input"===a.tag&&"value"===c&&a.dom.value==d&&a.dom===D.activeElement||"select"===a.tag&&"value"===c&&a.dom.value==d&&a.dom===D.activeElement||"option"===a.tag&&"value"===c&&a.dom.value==d||("input"===a.tag&&"type"===c?h.setAttribute(c,
+d):h[c]=d):"boolean"===typeof d?d?h.setAttribute(c,""):h.removeAttribute(c):h.setAttribute("className"===c?"class":c,d)}}function E(a){return"oninit"===a||"oncreate"===a||"onupdate"===a||"onremove"===a||"onbeforeremove"===a||"onbeforeupdate"===a}function x(a,c,b){var d=a.dom,e="function"!==typeof F?b:function(a){var c=b.call(d,a);F.call(d,a);return c};if(c in d)d[c]="function"===typeof b?e:null;else{var h=c.slice(2);void 0===a.events&&(a.events={});a.events[c]!==e&&(null!=a.events[c]&&d.removeEventListener(h,
+a.events[c],!1),"function"===typeof b&&(a.events[c]=e,d.addEventListener(h,a.events[c],!1)))}}function C(a,b,d){"function"===typeof a.oninit&&a.oninit.call(b.state,b);"function"===typeof a.oncreate&&d.push(a.oncreate.bind(b.state,b))}function I(a,b,d){"function"===typeof a.onupdate&&d.push(a.onupdate.bind(b.state,b))}var D=b.document,J=D.createDocumentFragment(),F;return{render:function(a,b){if(!a)throw Error("Ensure the DOM element being passed to m.route/m.mount/m.render is not undefined.");var c=
+[],d=D.activeElement;null==a.vnodes&&(a.textContent="");Array.isArray(b)||(b=[b]);n(a,a.vnodes,B.normalizeChildren(b),!1,c,null,void 0);a.vnodes=b;for(var e=0;e<c.length;e++)c[e]();D.activeElement!==d&&d.focus()},setEventCallback:function(a){return F=a}}},H=function(b){function d(b){b=g.indexOf(b);-1<b&&g.splice(b,2)}function f(){for(var b=1;b<g.length;b+=2)g[b]()}b=O(b);b.setEventCallback(function(b){!1!==b.redraw&&f()});var g=[];return{subscribe:function(b,f){d(b);g.push(b,Q(f))},unsubscribe:d,
+redraw:f,render:b.render}}(window);K.setCompletionCallback(H.redraw);C.mount=function(b){return function(d,f){if(null===f)b.render(d,[]),b.unsubscribe(d);else{if(null==f.view&&"function"!==typeof f)throw Error("m.mount(element, component) expects a component, not a vnode");b.subscribe(d,function(){b.render(d,B(f))});b.redraw()}}}(H);var T=x,L=function(b){if(""===b||null==b)return{};"?"===b.charAt(0)&&(b=b.slice(1));b=b.split("&");for(var d={},f={},g=0;g<b.length;g++){var e=b[g].split("="),n=decodeURIComponent(e[0]),
+e=2===e.length?decodeURIComponent(e[1]):"";"true"===e?e=!0:"false"===e&&(e=!1);var k=n.split(/\]\[?|\[/),q=d;-1<n.indexOf("[")&&k.pop();for(var m=0;m<k.length;m++){var n=k[m],l=k[m+1],l=""==l||!isNaN(parseInt(l,10)),u=m===k.length-1;""===n&&(n=k.slice(0,m).join(),null==f[n]&&(f[n]=0),n=f[n]++);null==q[n]&&(q[n]=u?e:l?[]:{});q=q[n]}}return d},U=function(b){function d(d){var e=b.location[d].replace(/(?:%[a-f89][a-f0-9])+/gim,decodeURIComponent);"pathname"===d&&"/"!==e[0]&&(e="/"+e);return e}function f(b){return function(){null==
+k&&(k=n(function(){k=null;b()}))}}function g(b,d,e){var a=b.indexOf("?"),g=b.indexOf("#"),f=-1<a?a:-1<g?g:b.length;if(-1<a){var a=L(b.slice(a+1,-1<g?g:b.length)),k;for(k in a)d[k]=a[k]}if(-1<g)for(k in d=L(b.slice(g+1)),d)e[k]=d[k];return b.slice(0,f)}var e="function"===typeof b.history.pushState,n="function"===typeof setImmediate?setImmediate:setTimeout,k,q={prefix:"#!",getPath:function(){switch(q.prefix.charAt(0)){case "#":return d("hash").slice(q.prefix.length);case "?":return d("search").slice(q.prefix.length)+
+d("hash");default:return d("pathname").slice(q.prefix.length)+d("search")+d("hash")}},setPath:function(d,f,k){var a={},l={};d=g(d,a,l);if(null!=f){for(var m in f)a[m]=f[m];d=d.replace(/:([^\/]+)/g,function(b,d){delete a[d];return f[d]})}(m=F(a))&&(d+="?"+m);(l=F(l))&&(d+="#"+l);e?(l=k?k.state:null,m=k?k.title:null,b.onpopstate(),k&&k.replace?b.history.replaceState(l,m,q.prefix+d):b.history.pushState(l,m,q.prefix+d)):b.location.href=q.prefix+d},defineRoutes:function(d,k,n){function a(){var a=q.getPath(),
+e={},f=g(a,e,e),l=b.history.state;if(null!=l)for(var m in l)e[m]=l[m];for(var u in d)if(l=new RegExp("^"+u.replace(/:[^\/]+?\.{3}/g,"(.*?)").replace(/:[^\/]+/g,"([^\\/]+)")+"/?$"),l.test(f)){f.replace(l,function(){for(var b=u.match(/:[^\/]+/g)||[],g=[].slice.call(arguments,1,-2),f=0;f<b.length;f++)e[b[f].replace(/:|\./g,"")]=decodeURIComponent(g[f]);k(d[u],e,a,u)});return}n(a,e)}e?b.onpopstate=f(a):"#"===q.prefix.charAt(0)&&(b.onhashchange=a);a()}};return q};C.route=function(b,d){var f=U(b),g=function(b){return b},
+e,n,k,q,m,l=function(b,a,l){if(null==b)throw Error("Ensure the DOM element that was passed to `m.route` is not undefined");var u=function(){null!=e&&d.render(b,e(B(n,k.key,k)))},w=function(b){if(b!==a)f.setPath(a,null,{replace:!0});else throw Error("Could not resolve default route "+a);};f.defineRoutes(l,function(a,b,d){var f=m=function(a,l){f===m&&(n=null==l||"function"!==typeof l.view&&"function"!==typeof l?"div":l,k=b,q=d,m=null,e=(a.render||g).bind(a),u())};a.view||"function"===typeof a?f({},
+a):a.onmatch?T.resolve(a.onmatch(b,d)).then(function(b){f(a,b)},w):f(a,"div")},w);d.subscribe(b,u)};l.set=function(b,a,d){null!=m&&(d={replace:!0});m=null;f.setPath(b,a,d)};l.get=function(){return q};l.prefix=function(b){f.prefix=b};l.link=function(b){b.dom.setAttribute("href",f.prefix+b.attrs.href);b.dom.onclick=function(a){a.ctrlKey||a.metaKey||a.shiftKey||2===a.which||(a.preventDefault(),a.redraw=!1,a=this.getAttribute("href"),0===a.indexOf(f.prefix)&&(a=a.slice(f.prefix.length)),l.set(a,void 0,
+void 0))}};l.param=function(b){return"undefined"!==typeof k&&"undefined"!==typeof b?k[b]:k};return l}(window,H);C.withAttr=function(b,d,f){return function(g){d.call(f||this,b in g.currentTarget?g.currentTarget[b]:g.currentTarget.getAttribute(b))}};var V=O(window);C.render=V.render;C.redraw=H.redraw;C.request=K.request;C.jsonp=K.jsonp;C.parseQueryString=L;C.buildQueryString=F;C.version="1.1.0";C.vnode=B;"undefined"!==typeof module?module.exports=C:window.m=C})();