inline Date.now, remove redundant comment

This commit is contained in:
Leo Horie 2016-07-30 14:55:34 -04:00
parent 917d474804
commit 9bd0cd73fc
3 changed files with 22 additions and 27 deletions

View file

@ -1,16 +1,12 @@
"use strict"
var ts = Date.now || function() {
return new Date().getTime()
}
module.exports = function(callback) {
//60fps translates to 16.6ms, round it down since setTimeout requires int
var time = 16
var last = 0, pending = null
var timeout = typeof requestAnimationFrame === "function" ? requestAnimationFrame : setTimeout
return function(synchronous) {
var now = ts()
var now = Date.now()
if (synchronous === true || last === 0 || now - last >= time) {
last = now
callback()
@ -19,7 +15,7 @@ module.exports = function(callback) {
pending = timeout(function() {
pending = null
callback()
last = ts()
last = Date.now()
}, time - (now - last))
}
}

View file

@ -74,7 +74,6 @@ module.exports = function(input, output, options) {
function fixCollisions(code) {
for (var variable in usedVariables) {
var collision = new RegExp("([^\\.])\\b" + variable + "\\b(?![\"'`])", "g")
// var collision = new RegExp("([^\\.])" + variable + "\\b(?![\"'`])", "g")
var exported = new RegExp("module\\.exports\\s*=\\s*" + variable)
if (collision.test(code) && !exported.test(code) && !globals[variable.match(/[^\.]+/)]) {
var fixed = variable + usedVariables[variable]++

40
mithril.min.js vendored
View file

@ -1,4 +1,4 @@
(function(){function y(){function a(){0<arguments.length&&I(a,arguments[0],void 0);return a._state.value}N(a,arguments);0<arguments.length&&I(a,arguments[0],void 0);return a}function N(a,b){a.constructor=y;a._state={id:aa++,value:void 0,error:void 0,state:0,derive:void 0,recover:void 0,deps:{},parents:[],errorStream:void 0,endStream:void 0};a.map=ba;a.ap=ca;a.of=y;a.valueOf=O;a.toJSON=da;a.toString=O;a.run=ea;a["catch"]=fa;Object.defineProperties(a,{error:{get:function(){if(!a._state.errorStream){var b=
new function(){(function(){function y(){function a(){0<arguments.length&&I(a,arguments[0],void 0);return a._state.value}N(a,arguments);0<arguments.length&&I(a,arguments[0],void 0);return a}function N(a,b){a.constructor=y;a._state={id:aa++,value:void 0,error:void 0,state:0,derive:void 0,recover:void 0,deps:{},parents:[],errorStream:void 0,endStream:void 0};a.map=ba;a.ap=ca;a.of=y;a.valueOf=O;a.toJSON=da;a.toString=O;a.run=ea;a["catch"]=fa;Object.defineProperties(a,{error:{get:function(){if(!a._state.errorStream){var b=
function(){0<arguments.length&&I(a,void 0,arguments[0]);return a._state.error};N(b,[]);D(b,[a],P,P);a._state.errorStream=b}return a._state.errorStream}},end:{get:function(){if(!a._state.endStream){var b=y();b.map(function(d){!0===d&&(Q(a),Q(b));return d});a._state.endStream=b}return a._state.endStream}}})}function I(a,b,h){E(a,b,h);for(var d in a._state.deps)R(a._state.deps[d],!1);a._state.changed=!1;for(var g in a._state.deps)a._state.deps[g]._state.changed=!1}function E(a,b,h){h=S(b,h);if(void 0!==
h&&"function"===typeof a._state.recover)try{var d=a._state.recover();if(d===F)return;a._state.value=d;a._state.error=void 0}catch(g){a._state.value=void 0,a._state.error=g,T(a,g)}else a._state.value=b,a._state.error=h;a._state.changed=!0;2!==a._state.state&&(a._state.state=1)}function R(a,b){var h=a._state,d=h.parents;if(0<d.length&&d.filter(ga).length===d.length&&(b||0<d.filter(U).length))if(d=d.filter(V),0<d.length)E(a,void 0,d[0]._state.error);else try{var g=h.derive();g!==F&&E(a,g,void 0)}catch(k){E(a,
void 0,k),T(a,k)}}function S(a,b){null!=a&&a.constructor===y&&(b=void 0!==a._state.error?a._state.error:S(a._state.value,a._state.error));return b}function T(a,b){0===Object.keys(a._state.deps).length&&setTimeout(function(){0===Object.keys(a._state.deps).length&&console.error(b)},0)}function ea(a){var b=y(),h=this;return D(b,[h],function(){return W(b,a(h()))},void 0)}function fa(a){var b=y(),h=this;return D(b,[h],function(){return h._state.value},function(){return W(b,a(h._state.error))})}function G(a,
@ -18,23 +18,23 @@ f.events=c.events;var r;var z;null!=f.attrs&&"function"===typeof f.attrs.onbefor
c.dom;break;case "<":c.children!==f.children?(m(c),n(a,d(f),e)):f.dom=c.dom;break;case "[":g(a,c.children,f.children,b,e,v);c=0;b=f.children;f.dom=null;if(null!=b){for(var l=0;l<b.length;l++)a=b[l],null!=a&&null!=a.dom&&(null==f.dom&&(f.dom=a.dom),c+=a.domSize||1);1!==c&&(f.domSize=c)}break;default:a=v;e=f.dom=c.dom;switch(f.tag){case "svg":a="http://www.w3.org/2000/svg";break;case "math":a="http://www.w3.org/1998/Math/MathML"}"textarea"===f.tag&&(null==f.attrs&&(f.attrs={}),null!=f.text&&(f.attrs.value=
f.text));p=c.attrs;v=f.attrs;q=a;if(null!=v)for(l in v)A(f,l,p&&p[l],v[l],q);if(null!=p)for(l in p)null!=v&&l in v||"key"!==l&&f.dom.removeAttribute(l);null!=c.text&&null!=f.text&&""!==f.text?c.text.toString()!==f.text.toString()&&(c.dom.firstChild.nodeValue=f.text):(null!=c.text&&(c.children=[u("#",void 0,void 0,c.text,void 0,c.dom.firstChild)]),null!=f.text&&(f.children=[u("#",void 0,void 0,f.text,void 0,void 0)]),g(e,c.children,f.children,b,null,a))}else f.instance=u.normalize(f.tag.view.call(f.state,
f)),y(f.tag,f,b,p),null!=f.instance?(null==c.instance?n(a,h(f.instance,b,v),e):k(a,c.instance,f.instance,b,e,p,v),f.dom=f.instance.dom,f.domSize=f.instance.domSize):null!=c.instance?(B(a,c.instance,null,!1),f.dom=void 0,f.domSize=0):(f.dom=c.dom,f.domSize=c.domSize)}else B(a,c,null,!1),n(a,h(f,b,void 0),e)}function m(a){var c=a.domSize;if(null!=c||null==a.dom){var f=x.createDocumentFragment();if(0<c){for(a=a.dom;--c;)f.appendChild(a.nextSibling);f.insertBefore(a,f.firstChild)}return f}return a.dom}
function e(a,c,f){for(;c<a.length;c++)if(null!=a[c]&&null!=a[c].dom)return a[c].dom;return f}function n(a,c,f){f&&f.parentNode?a.insertBefore(c,f):a.appendChild(c)}function v(a,c,f,b,e){for(;f<b;f++){var g=c[f];null!=g&&(g.skip?g.skip=void 0:B(a,g,e,!1))}}function B(a,c,f,b){if(!1===b){var e=0,g=0;b=function(){++g===e&&B(a,c,f,!0)};c.attrs&&c.attrs.onbeforeremove&&(e++,c.attrs.onbeforeremove.call(c,c,b));"string"!==typeof c.tag&&c.tag.onbeforeremove&&(e++,c.tag.onbeforeremove.call(c,c,b));if(0<e)return}p(c);
if(c.dom){b=c.domSize||1;if(1<b)for(var d=c.dom;--b;)a.removeChild(d.nextSibling);null!=c.dom.parentNode&&a.removeChild(c.dom);null==f||null!=c.domSize||z(c.attrs)||"string"!==typeof c.tag||(f.pool?f.pool.push(c):f.pool=[c])}}function p(a){a.attrs&&a.attrs.onremove&&a.attrs.onremove.call(a.state,a);"string"!==typeof a.tag&&a.tag.onremove&&a.tag.onremove.call(a.state,a);if(null!=a.instance)p(a.instance);else if(a=a.children,a instanceof Array)for(var c=0;c<a.length;c++){var b=a[c];null!=b&&p(b)}}function A(a,
c,b,e,g){var d=a.dom;if("key"!==c&&(b!==e||"value"===c||"checked"===c||"selectedIndex"===c||"selected"===c&&a.dom===x.activeElement||"object"===typeof e)&&"undefined"!==typeof e&&"oninit"!==c&&"oncreate"!==c&&"onupdate"!==c&&"onremove"!==c&&"onbeforeremove"!==c&&"onbeforeupdate"!==c){var n=c.indexOf(":");if(-1<n&&"xlink"===c.substr(0,n))d.setAttributeNS("http://www.w3.org/1999/xlink",c.slice(n+1),e);else if("o"===c[0]&&"n"===c[1]&&"function"===typeof e)r(a,c,e);else if("style"===c)if(a=b,a===e&&(d.style=
"",a=null),null==e)d.style="";else if("string"===typeof e)d.style=e;else{"string"===typeof a&&(d.style="");for(var h in e)d.style[h]=e[h];if(null!=a&&"string"!==typeof a)for(h in a)h in e||(d.style[h]="")}else if(c in d&&"href"!==c&&"list"!==c&&"form"!==c&&void 0===g){if("input"!==a.tag||"value"!==c||a.dom.value!==e||a.dom!==x.activeElement)d[c]=e}else"boolean"===typeof e?e?d.setAttribute(c,""):d.removeAttribute(c):d.setAttribute("className"===c?"class":c,e)}}function z(a){return null!=a&&(a.oncreate||
a.onupdate||a.onbeforeremove||a.onremove)}function r(a,c,b){var e=a.dom,d=function(a){var c=b.call(e,a);"function"===typeof D&&D.call(e,a);return c};if(c in e)e[c]=d;else{var g=c.slice(2);void 0===a.events&&(a.events={});null!=a.events[c]&&e.removeEventListener(g,a.events[c],!1);a.events[c]=d;e.addEventListener(g,a.events[c],!1)}}function l(a,c,b){"function"===typeof a.oninit&&a.oninit.call(c.state,c);"function"===typeof a.oncreate&&b.push(a.oncreate.bind(c.state,c))}function y(a,c,b,e){e?l(a,c,b):
"function"===typeof a.onupdate&&b.push(a.onupdate.bind(c.state,c))}function C(a){if(a instanceof Array){for(var c=[],b=0;b<a.length;b++)c[b]=a[b];return c}if("object"===typeof a){c={};for(b in a)c[b]=a[b];return c}return a}var x=a.document,ja=x.createDocumentFragment(),D;return{render:function(a,c){var b=[],e=x.activeElement;null==a.vnodes&&(a.vnodes=[]);c instanceof Array||(c=[c]);g(a,a.vnodes,u.normalizeChildren(c),b,null,void 0);a.vnodes=c;for(var d=0;d<b.length;d++)b[d]();x.activeElement!==e&&
e.focus()},setEventCallback:function(a){return D=a}}}(window),L=function(a){function b(a,d){if(d instanceof Array)for(var m=0;m<d.length;m++)b(a+"["+m+"]",d[m]);else if("[object Object]"===Object.prototype.toString.call(d))for(m in d)b(a+"["+m+"]",d[m]);else h.push(encodeURIComponent(a)+(null!=d&&""!==d?"="+encodeURIComponent(d):""))}if("[object Object]"!==Object.prototype.toString.call(a))return"";var h=[],d;for(d in a)b(d,a[d]);return h.join("&")},M=function(a){function b(a,b){if(null==b)return a;
function e(a,c,f){for(;c<a.length;c++)if(null!=a[c]&&null!=a[c].dom)return a[c].dom;return f}function n(a,c,f){f&&f.parentNode?a.insertBefore(c,f):a.appendChild(c)}function v(a,c,f,b,e){for(;f<b;f++){var g=c[f];null!=g&&(g.skip?g.skip=void 0:B(a,g,e,!1))}}function B(a,c,f,b){if(!1===b){var e=0,g=0;b=function(){++g===e&&B(a,c,f,!0)};c.attrs&&c.attrs.onbeforeremove&&(e++,c.attrs.onbeforeremove.call(c.state,c,b));"string"!==typeof c.tag&&c.tag.onbeforeremove&&(e++,c.tag.onbeforeremove.call(c.state,c,
b));if(0<e)return}p(c);if(c.dom){b=c.domSize||1;if(1<b)for(var d=c.dom;--b;)a.removeChild(d.nextSibling);null!=c.dom.parentNode&&a.removeChild(c.dom);null==f||null!=c.domSize||z(c.attrs)||"string"!==typeof c.tag||(f.pool?f.pool.push(c):f.pool=[c])}}function p(a){a.attrs&&a.attrs.onremove&&a.attrs.onremove.call(a.state,a);"string"!==typeof a.tag&&a.tag.onremove&&a.tag.onremove.call(a.state,a);if(null!=a.instance)p(a.instance);else if(a=a.children,a instanceof Array)for(var c=0;c<a.length;c++){var b=
a[c];null!=b&&p(b)}}function A(a,c,b,e,g){var d=a.dom;if("key"!==c&&(b!==e||"value"===c||"checked"===c||"selectedIndex"===c||"selected"===c&&a.dom===x.activeElement||"object"===typeof e)&&"undefined"!==typeof e&&"oninit"!==c&&"oncreate"!==c&&"onupdate"!==c&&"onremove"!==c&&"onbeforeremove"!==c&&"onbeforeupdate"!==c){var n=c.indexOf(":");if(-1<n&&"xlink"===c.substr(0,n))d.setAttributeNS("http://www.w3.org/1999/xlink",c.slice(n+1),e);else if("o"===c[0]&&"n"===c[1]&&"function"===typeof e)r(a,c,e);else if("style"===
c)if(a=b,a===e&&(d.style="",a=null),null==e)d.style="";else if("string"===typeof e)d.style=e;else{"string"===typeof a&&(d.style="");for(var h in e)d.style[h]=e[h];if(null!=a&&"string"!==typeof a)for(h in a)h in e||(d.style[h]="")}else if(c in d&&"href"!==c&&"list"!==c&&"form"!==c&&void 0===g){if("input"!==a.tag||"value"!==c||a.dom.value!==e||a.dom!==x.activeElement)d[c]=e}else"boolean"===typeof e?e?d.setAttribute(c,""):d.removeAttribute(c):d.setAttribute("className"===c?"class":c,e)}}function z(a){return null!=
a&&(a.oncreate||a.onupdate||a.onbeforeremove||a.onremove)}function r(a,c,b){var e=a.dom,d=function(a){var c=b.call(e,a);"function"===typeof D&&D.call(e,a);return c};if(c in e)e[c]=d;else{var g=c.slice(2);void 0===a.events&&(a.events={});null!=a.events[c]&&e.removeEventListener(g,a.events[c],!1);a.events[c]=d;e.addEventListener(g,a.events[c],!1)}}function l(a,c,b){"function"===typeof a.oninit&&a.oninit.call(c.state,c);"function"===typeof a.oncreate&&b.push(a.oncreate.bind(c.state,c))}function y(a,
c,b,e){e?l(a,c,b):"function"===typeof a.onupdate&&b.push(a.onupdate.bind(c.state,c))}function C(a){if(a instanceof Array){for(var c=[],b=0;b<a.length;b++)c[b]=a[b];return c}if("object"===typeof a){c={};for(b in a)c[b]=a[b];return c}return a}var x=a.document,ja=x.createDocumentFragment(),D;return{render:function(a,c){var b=[],e=x.activeElement;null==a.vnodes&&(a.vnodes=[]);c instanceof Array||(c=[c]);g(a,a.vnodes,u.normalizeChildren(c),b,null,void 0);a.vnodes=c;for(var d=0;d<b.length;d++)b[d]();x.activeElement!==
e&&e.focus()},setEventCallback:function(a){return D=a}}}(window),L=function(a){function b(a,d){if(d instanceof Array)for(var m=0;m<d.length;m++)b(a+"["+m+"]",d[m]);else if("[object Object]"===Object.prototype.toString.call(d))for(m in d)b(a+"["+m+"]",d[m]);else h.push(encodeURIComponent(a)+(null!=d&&""!==d?"="+encodeURIComponent(d):""))}if("[object Object]"!==Object.prototype.toString.call(a))return"";var h=[],d;for(d in a)b(d,a[d]);return h.join("&")},M=function(a){function b(a,b){if(null==b)return a;
for(var d=a.match(/:[^\/]+/gi)||[],g=0;g<d.length;g++){var h=d[g].slice(1);null!=b[h]&&(a=a.replace(d[g],b[h]),delete b[h])}return a}function h(a,b){var d=L(b);if(""!==d){var g=0>a.indexOf("?")?"?":"&";a+=g+d}return a}function d(a){try{return""!==a?JSON.parse(a):null}catch(b){throw Error(a);}}function g(a){return a.responseText}var k=0,m;return{xhr:function(e){var n=C.stream();void 0!==e.initialValue&&n(e.initialValue);var v="boolean"===typeof e.useBody?e.useBody:"GET"!==e.method&&"TRACE"!==e.method;
"function"!==typeof e.serialize&&(e.serialize=e.data instanceof FormData?function(a){return a}:JSON.stringify);"function"!==typeof e.deserialize&&(e.deserialize=d);"function"!==typeof e.extract&&(e.extract=g);e.url=b(e.url,e.data);v?e.data=e.serialize(e.data):e.url=h(e.url,e.data);var k=new a.XMLHttpRequest;k.open(e.method,e.url,"boolean"===typeof e.async?e.async:!0,"string"===typeof e.user?e.user:void 0,"string"===typeof e.password?e.password:void 0);e.serialize===JSON.stringify&&v&&k.setRequestHeader("Content-Type",
"application/json; charset=utf-8");e.deserialize===d&&k.setRequestHeader("Accept","application/json, text/*");"function"===typeof e.config&&(k=e.config(k,e)||k);k.onreadystatechange=function(){if(4===k.readyState){try{var a=e.deserialize(e.extract(k,e));if(200<=k.status&&300>k.status){if("function"===typeof e.type)if(a instanceof Array)for(var b=0;b<a.length;b++)a[b]=new e.type(a[b]);else a=new e.type(a);n(a)}else{var b=Error(k.responseText),d;for(d in a)b[d]=a[d];n.error(b)}}catch(g){n.error(g)}"function"===
typeof m&&m()}};v?k.send(e.data):k.send();return n},jsonp:function(e){var d=C.stream(),g=e.callbackName||"_mithril_"+Math.round(1E16*Math.random())+"_"+k++,l=a.document.createElement("script");a[g]=function(b){l.parentNode.removeChild(l);d(b);"function"===typeof m&&m();delete a[g]};l.onerror=function(){l.parentNode.removeChild(l);d.error(Error("JSONP request failed"));"function"===typeof m&&m();delete a[g]};null==e.data&&(e.data={});e.url=b(e.url,e.data);e.data[e.callbackKey||"callback"]=g;l.src=
h(e.url,e.data);a.document.documentElement.appendChild(l);return d},setCompletionCallback:function(a){m=a}}}(window),H=function(){var a=[];return{subscribe:a.push.bind(a),unsubscribe:function(b){b=a.indexOf(b);-1<b&&a.splice(b,1)},publish:function(){for(var b=0;b<a.length;b++)a[b].apply(this,arguments)}}}();M.setCompletionCallback(H.publish);var Y=function(a){if(""===a||null==a)return{};"?"===a.charAt(0)&&(a=a.slice(1));a=a.split("&");for(var b={},h={},d=0;d<a.length;d++){var g=a[d].split("="),k=
decodeURIComponent(g[0]),g=2===g.length?decodeURIComponent(g[1]):"",m=Number(g);""!==g&&!isNaN(m)||"NaN"===g?g=m:"true"===g?g=!0:"false"===g?g=!1:(m=new Date(g),isNaN(m.getTime())||(g=m));var m=k.split(/\]\[?|\[/),e=b;-1<k.indexOf("[")&&m.pop();for(var n=0;n<m.length;n++){var k=m[n],v=m[n+1],v=""==v||!isNaN(parseInt(v,10)),l=n===m.length-1;""===k&&(k=m.slice(0,n).join(),null==h[k]&&(h[k]=0),k=h[k]++);null==e[k]&&(e[k]=l?g:v?[]:{});e=e[k]}}return b},ka=function(a){function b(b){var e=a.location[b].replace(/(?:%[a-f89][a-f0-9])+/gim,
decodeURIComponent);"pathname"===b&&"/"!==e[0]&&(e="/"+e);return e}function h(a,b,e){var d=a.indexOf("?"),g=a.indexOf("#"),h=-1<d?d:-1<g?g:a.length;if(-1<d){var d=Y(a.slice(d+1,-1<g?g:a.length)),k;for(k in d)b[k]=d[k]}if(-1<g)for(k in b=Y(a.slice(g+1)),b)e[k]=b[k];return a.slice(0,h)}function d(){switch(e.charAt(0)){case "#":return b("hash").slice(e.length);case "?":return b("search").slice(e.length)+b("hash");default:return b("pathname").slice(e.length)+b("search")+b("hash")}}function g(b,d,g){var m=
{},l={};b=h(b,m,l);if(null!=d){for(var z in d)m[z]=d[z];b=b.replace(/:([^\/]+)/g,function(a,b){delete m[b];return d[b]})}(z=L(m))&&(b+="?"+z);(l=L(l))&&(b+="#"+l);k?(g&&g.replace?a.history.replaceState(null,null,e+b):a.history.pushState(null,null,e+b),a.onpopstate()):a.location.href=e+b}var k="function"===typeof a.history.pushState&&"file:"!==a.location.protocol,m="function"===typeof setImmediate?setImmediate:setTimeout,e="#!";return{setPrefix:function(a){e=a},getPath:d,setPath:g,defineRoutes:function(b,
g,l){function p(){var a=d(),e={},k=h(a,e,e);m(function(){for(var d in b){var h=new RegExp("^"+d.replace(/:[^\/]+?\.{3}/g,"(.*?)").replace(/:[^\/]+/g,"([^\\/]+)")+"/?$");if(h.test(k)){k.replace(h,function(){for(var h=d.match(/:[^\/]+/g)||[],k=[].slice.call(arguments,1,-2),l=0;l<h.length;l++)e[h[l].replace(/:|\./g,"")]=decodeURIComponent(k[l]);g(b[d],e,a,d)});return}}l(a,e)})}k?a.onpopstate=p:"#"===e.charAt(0)&&(a.onhashchange=p);p();return p},link:function(a){a.dom.setAttribute("href",e+a.attrs.href);
a.dom.onclick=function(b){b.preventDefault();b.redraw=!1;g(a.attrs.href,void 0,void 0)}}}},la=function(a){var b=0,h=null,d="function"===typeof requestAnimationFrame?requestAnimationFrame:setTimeout;return function(g){var k=(new Date).getTime();!0===g||0===b||16<=k-b?(b=k,a()):null===h&&(h=d(function(){h=null;a();b=(new Date).getTime()},16-(k-b)))}},Z=function(a,b,h,d){d=la(d);null!=b&&b.setEventCallback(function(a){!1!==a.redraw&&h.publish()});null!=h&&(a.redraw&&h.unsubscribe(a.redraw),h.subscribe(d));
return a.redraw=d};l.route=function(a,b,h){var d=ka(a);a=function(a,k,l){var e=null,n=null;l=d.defineRoutes(l,function(d,h,k,l){if("function"!==typeof d.view){"function"!==typeof d.render&&(d.render=function(a){return a});var m=function(k){e=l;n=k;b.render(a,d.render(u(k,null,h,void 0,void 0,void 0)))};"function"!==typeof d.resolve&&(d.resolve=function(){m(n)});l!==e?d.resolve(m,h,k,l):m(n)}else b.render(a,u(d,null,h,void 0,void 0,void 0))},function(){d.setPath(k,null,{replace:!0})});Z(a,b,h,l)};
a.link=d.link;a.prefix=d.setPrefix;a.set=d.setPath;a.get=d.getPath;return a}(window,K,H);l.mount=function(a,b){return function(h,d){Z(h,a,b,function(){a.render(h,{tag:d})})()}}(K,H);l.trust=function(a){return u("<",void 0,void 0,a,void 0,void 0)};l.withAttr=function(a,b,h){return function(d){return b.call(h||this,a in d.currentTarget?d.currentTarget[a]:d.currentTarget.getAttribute(a))}};l.prop=C.stream;l.prop.combine=C.combine;l.prop.reject=C.reject;l.prop.merge=C.merge;l.prop.HALT=C.HALT;l.render=
K.render;l.redraw=H.publish;l.request=M.xhr;l.jsonp=M.jsonp;l.version="1.0.0";window.m=l})();
"function"!==typeof e.serialize&&(e.serialize="undefined"!==typeof FormData&&e.data instanceof FormData?function(a){return a}:JSON.stringify);"function"!==typeof e.deserialize&&(e.deserialize=d);"function"!==typeof e.extract&&(e.extract=g);e.url=b(e.url,e.data);v?e.data=e.serialize(e.data):e.url=h(e.url,e.data);var k=new a.XMLHttpRequest;k.open(e.method,e.url,"boolean"===typeof e.async?e.async:!0,"string"===typeof e.user?e.user:void 0,"string"===typeof e.password?e.password:void 0);e.serialize===
JSON.stringify&&v&&k.setRequestHeader("Content-Type","application/json; charset=utf-8");e.deserialize===d&&k.setRequestHeader("Accept","application/json, text/*");"function"===typeof e.config&&(k=e.config(k,e)||k);k.onreadystatechange=function(){if(4===k.readyState){try{var a=e.deserialize(e.extract(k,e));if(200<=k.status&&300>k.status){if("function"===typeof e.type)if(a instanceof Array)for(var b=0;b<a.length;b++)a[b]=new e.type(a[b]);else a=new e.type(a);n(a)}else{var b=Error(k.responseText),d;
for(d in a)b[d]=a[d];n.error(b)}}catch(g){n.error(g)}"function"===typeof m&&m()}};v?k.send(e.data):k.send();return n},jsonp:function(e){var d=C.stream(),g=e.callbackName||"_mithril_"+Math.round(1E16*Math.random())+"_"+k++,l=a.document.createElement("script");a[g]=function(b){l.parentNode.removeChild(l);d(b);"function"===typeof m&&m();delete a[g]};l.onerror=function(){l.parentNode.removeChild(l);d.error(Error("JSONP request failed"));"function"===typeof m&&m();delete a[g]};null==e.data&&(e.data={});
e.url=b(e.url,e.data);e.data[e.callbackKey||"callback"]=g;l.src=h(e.url,e.data);a.document.documentElement.appendChild(l);return d},setCompletionCallback:function(a){m=a}}}(window),H=function(){var a=[];return{subscribe:a.push.bind(a),unsubscribe:function(b){b=a.indexOf(b);-1<b&&a.splice(b,1)},publish:function(){for(var b=0;b<a.length;b++)a[b].apply(this,arguments)}}}();M.setCompletionCallback(H.publish);var Y=function(a){if(""===a||null==a)return{};"?"===a.charAt(0)&&(a=a.slice(1));a=a.split("&");
for(var b={},h={},d=0;d<a.length;d++){var g=a[d].split("="),k=decodeURIComponent(g[0]),g=2===g.length?decodeURIComponent(g[1]):"",m=Number(g);""!==g&&!isNaN(m)||"NaN"===g?g=m:"true"===g?g=!0:"false"===g?g=!1:(m=new Date(g),isNaN(m.getTime())||(g=m));var m=k.split(/\]\[?|\[/),e=b;-1<k.indexOf("[")&&m.pop();for(var n=0;n<m.length;n++){var k=m[n],v=m[n+1],v=""==v||!isNaN(parseInt(v,10)),l=n===m.length-1;""===k&&(k=m.slice(0,n).join(),null==h[k]&&(h[k]=0),k=h[k]++);null==e[k]&&(e[k]=l?g:v?[]:{});e=e[k]}}return b},
ka=function(a){function b(b){var e=a.location[b].replace(/(?:%[a-f89][a-f0-9])+/gim,decodeURIComponent);"pathname"===b&&"/"!==e[0]&&(e="/"+e);return e}function h(a,b,e){var d=a.indexOf("?"),g=a.indexOf("#"),h=-1<d?d:-1<g?g:a.length;if(-1<d){var d=Y(a.slice(d+1,-1<g?g:a.length)),k;for(k in d)b[k]=d[k]}if(-1<g)for(k in b=Y(a.slice(g+1)),b)e[k]=b[k];return a.slice(0,h)}function d(){switch(e.charAt(0)){case "#":return b("hash").slice(e.length);case "?":return b("search").slice(e.length)+b("hash");default:return b("pathname").slice(e.length)+
b("search")+b("hash")}}function g(b,d,g){var m={},l={};b=h(b,m,l);if(null!=d){for(var z in d)m[z]=d[z];b=b.replace(/:([^\/]+)/g,function(a,b){delete m[b];return d[b]})}(z=L(m))&&(b+="?"+z);(l=L(l))&&(b+="#"+l);k?(g&&g.replace?a.history.replaceState(null,null,e+b):a.history.pushState(null,null,e+b),a.onpopstate()):a.location.href=e+b}var k="function"===typeof a.history.pushState&&"file:"!==a.location.protocol,m="function"===typeof setImmediate?setImmediate:setTimeout,e="#!";return{setPrefix:function(a){e=
a},getPath:d,setPath:g,defineRoutes:function(b,g,l){function p(){var a=d(),e={},k=h(a,e,e);m(function(){for(var d in b){var h=new RegExp("^"+d.replace(/:[^\/]+?\.{3}/g,"(.*?)").replace(/:[^\/]+/g,"([^\\/]+)")+"/?$");if(h.test(k)){k.replace(h,function(){for(var h=d.match(/:[^\/]+/g)||[],k=[].slice.call(arguments,1,-2),l=0;l<h.length;l++)e[h[l].replace(/:|\./g,"")]=decodeURIComponent(k[l]);g(b[d],e,a,d)});return}}l(a,e)})}k?a.onpopstate=p:"#"===e.charAt(0)&&(a.onhashchange=p);p();return p},link:function(a){a.dom.setAttribute("href",
e+a.attrs.href);a.dom.onclick=function(b){b.preventDefault();b.redraw=!1;g(a.attrs.href,void 0,void 0)}}}},la=function(a){var b=0,h=null,d="function"===typeof requestAnimationFrame?requestAnimationFrame:setTimeout;return function(g){var k=(new Date).getTime();!0===g||0===b||16<=k-b?(b=k,a()):null===h&&(h=d(function(){h=null;a();b=(new Date).getTime()},16-(k-b)))}},Z=function(a,b,h,d){d=la(d);null!=b&&b.setEventCallback(function(a){!1!==a.redraw&&h.publish()});null!=h&&(a.redraw&&h.unsubscribe(a.redraw),
h.subscribe(d));return a.redraw=d};l.route=function(a,b,h){var d=ka(a);a=function(a,k,l){var e=null,n=null;l=d.defineRoutes(l,function(d,h,k,l){if("function"!==typeof d.view){"function"!==typeof d.render&&(d.render=function(a){return a});var m=function(k){e=l;n=k;b.render(a,d.render(u(k,null,h,void 0,void 0,void 0)))};"function"!==typeof d.resolve&&(d.resolve=function(){m(n)});l!==e?d.resolve(m,h,k,l):m(n)}else b.render(a,u(d,null,h,void 0,void 0,void 0))},function(){d.setPath(k,null,{replace:!0})});
Z(a,b,h,l)};a.link=d.link;a.prefix=d.setPrefix;a.set=d.setPath;a.get=d.getPath;return a}(window,K,H);l.mount=function(a,b){return function(h,d){Z(h,a,b,function(){a.render(h,{tag:d})})()}}(K,H);l.trust=function(a){return u("<",void 0,void 0,a,void 0,void 0)};l.withAttr=function(a,b,h){return function(d){return b.call(h||this,a in d.currentTarget?d.currentTarget[a]:d.currentTarget.getAttribute(a))}};l.prop=C.stream;l.prop.combine=C.combine;l.prop.reject=C.reject;l.prop.merge=C.merge;l.prop.HALT=C.HALT;
l.render=K.render;l.redraw=H.publish;l.request=M.xhr;l.jsonp=M.jsonp;l.version="1.0.0";window.m=l})()};