From 8f7d85b0c9cd92be86b924c0cf0ee52341869155 Mon Sep 17 00:00:00 2001 From: Gandalf-the-Bot Date: Wed, 14 Nov 2018 20:50:41 +0000 Subject: [PATCH] Bundled output for commit 638d72481cbdcffee98320a2e6c82e5d0b1fab26 [skip ci] --- README.md | 2 +- mithril.js | 5 ++++- mithril.min.js | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index eecaf727..8c652fb7 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ mithril.js [![NPM Version](https://img.shields.io/npm/v/mithril.svg)](https://ww ## What is Mithril? -A modern client-side Javascript framework for building Single Page Applications. It's small (8.93 KB gzipped), fast and provides routing and XHR utilities out of the box. +A modern client-side Javascript framework for building Single Page Applications. It's small (8.96 KB gzipped), fast and provides routing and XHR utilities out of the box. Mithril is used by companies like Vimeo and Nike, and open source platforms like Lichess 👍. diff --git a/mithril.js b/mithril.js index 268ea558..afeffa53 100644 --- a/mithril.js +++ b/mithril.js @@ -110,7 +110,10 @@ hyperscript.trust = function(html) { hyperscript.fragment = function(attrs1, children0) { return Vnode("[", attrs1.key, attrs1, Vnode.normalizeChildren(children0), undefined, undefined) } -var m = hyperscript +var m = function m() { return hyperscript.apply(this, arguments) } +m.m = hyperscript +m.trust = hyperscript.trust +m.fragment = hyperscript.fragment /** @constructor */ var PromisePolyfill = function(executor) { if (!(this instanceof PromisePolyfill)) throw new Error("Promise must be called with `new`") diff --git a/mithril.min.js b/mithril.min.js index bd0a4261..6001aa13 100644 --- a/mithril.min.js +++ b/mithril.min.js @@ -1 +1 @@ -!function(){"use strict";function e(e,t,n,r,o,l){return{tag:e,key:t,attrs:n,children:r,text:o,dom:l,domSize:void 0,state:void 0,events:void 0,instance:void 0}}e.normalize=function(t){return Array.isArray(t)?e("[",void 0,void 0,e.normalizeChildren(t),void 0,void 0):null!=t&&"object"!=typeof t?e("#",void 0,void 0,!1===t?"":t,void 0,void 0):t},e.normalizeChildren=function(t){for(var n=[],r=0;r0&&(i.className=l.join(" ")),n[e]={tag:o,attrs:i}}(l),a,e.normalizeChildren(i)):e(l,a.key,a,i)}l.trust=function(t){return null==t&&(t=""),e("<",void 0,void 0,t,void 0,void 0)},l.fragment=function(t,n){return e("[",t.key,t,e.normalizeChildren(n),void 0,void 0)};var i=l;if((a=function(e){if(!(this instanceof a))throw new Error("Promise must be called with `new`");if("function"!=typeof e)throw new TypeError("executor must be a function");var t=this,n=[],r=[],o=f(n,!0),l=f(r,!1),i=t._instance={resolvers:n,rejectors:r},u="function"==typeof setImmediate?setImmediate:setTimeout;function f(e,o){return function a(f){var c;try{if(!o||null==f||"object"!=typeof f&&"function"!=typeof f||"function"!=typeof(c=f.then))u(function(){o||0!==e.length||console.error("Possible unhandled promise rejection:",f);for(var t=0;t0||e(n)}}var r=n(l);try{e(n(o),r)}catch(e){r(e)}}s(e)}).prototype.then=function(e,t){var n,r,o=this._instance;function l(e,t,l,i){t.push(function(t){if("function"!=typeof e)l(t);else try{n(e(t))}catch(e){r&&r(e)}}),"function"==typeof o.retry&&i===o.state&&o.retry()}var i=new a(function(e,t){n=e,r=t});return l(e,o.resolvers,n,!0),l(t,o.rejectors,r,!1),i},a.prototype.catch=function(e){return this.then(null,e)},a.prototype.finally=function(e){return this.then(function(t){return a.resolve(e()).then(function(){return t})},function(t){return a.resolve(e()).then(function(){return a.reject(t)})})},a.resolve=function(e){return e instanceof a?e:new a(function(t){t(e)})},a.reject=function(e){return new a(function(t,n){n(e)})},a.all=function(e){return new a(function(t,n){var r=e.length,o=0,l=[];if(0===e.length)t([]);else for(var i=0;i=200&&l.status<300||304===l.status||f.test(n.url))t(d(n.type,e));else{var o=new Error(l.responseText);o.code=l.status,o.response=e,r(o)}}catch(e){r(e)}},o&&null!=n.data?l.send(n.data):l.send()});return!0===n.background?v:u(v)},jsonp:function(n,u){var f=o();n=l(n,u);var s=new t(function(t,o){var l=n.callbackName||"_mithril_"+Math.round(1e16*Math.random())+"_"+r++,u=e.document.createElement("script");e[l]=function(r){u.parentNode.removeChild(u),t(d(n.type,r)),delete e[l]},u.onerror=function(){u.parentNode.removeChild(u),o(new Error("JSONP request failed")),delete e[l]},null==n.data&&(n.data={}),n.url=i(n.url,n.data),n.data[n.callbackKey||"callback"]=l,u.src=a(n.url,n.data),e.document.documentElement.appendChild(u)});return!0===n.background?s:f(s)},setCompletionCallback:function(e){n=e}}}(window,a),c=function(t){var n,r=t.document,o={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"};function l(e){return e.attrs&&e.attrs.xmlns||o[e.tag]}function i(e,t){if(e.state!==t)throw new Error("`vnode.state` must not be modified")}function a(e){var t=e.state;try{return this.apply(t,arguments)}finally{i(e,t)}}function u(){try{return r.activeElement}catch(e){return null}}function f(e,t,n,r,o,l,i){for(var a=n;a'+t.children+"",i=i.firstChild):i.innerHTML=t.children,t.dom=i.firstChild,t.domSize=i.childNodes.length;for(var a,u=r.createDocumentFragment();a=i.firstChild;)u.appendChild(a);g(e,u,o)}function v(e,t,n,r,o,l){if(t!==n&&(null!=t||null!=n))if(null==t||0===t.length)f(e,n,0,n.length,r,o,l);else if(null==n||0===n.length)b(t,0,t.length);else{for(var i=0,a=0,u=null,c=null;a=a&&E>=i;)if(w=t[S],k=n[E],null==w)S--;else if(null==k)E--;else{if(w.key!==k.key)break;w!==k&&h(e,w,k,r,o,l),null!=k.dom&&(o=k.dom),S--,E--}for(;S>=a&&E>=i;)if(d=t[a],v=n[i],null==d)a++;else if(null==v)i++;else{if(d.key!==v.key)break;a++,i++,d!==v&&h(e,d,v,r,y(t,a,o),l)}for(;S>=a&&E>=i;){if(null==d)a++;else if(null==v)i++;else if(null==w)S--;else if(null==k)E--;else{if(i===E)break;if(d.key!==k.key||w.key!==v.key)break;C=y(t,a,o),g(e,m(w),C),w!==v&&h(e,w,v,r,C,l),++i<=--E&&g(e,m(d),o),d!==k&&h(e,d,k,r,o,l),null!=k.dom&&(o=k.dom),a++,S--}w=t[S],k=n[E],d=t[a],v=n[i]}for(;S>=a&&E>=i;){if(null==w)S--;else if(null==k)E--;else{if(w.key!==k.key)break;w!==k&&h(e,w,k,r,o,l),null!=k.dom&&(o=k.dom),S--,E--}w=t[S],k=n[E]}if(i>E)b(t,a,S+1);else if(a>S)f(e,n,i,E+1,r,o,l);else{var A,z,N=o,j=E-i+1,T=new Array(j),O=0,P=0,$=2147483647,I=0;for(P=0;P=i;P--)if(null==A&&(A=p(t,a,S+1)),null!=(k=n[P])){var R=A[k.key];null!=R&&($=R<$?R:-1,T[P-i]=R,w=t[R],t[R]=null,w!==k&&h(e,w,k,r,o,l),null!=k.dom&&(o=k.dom),I++)}if(o=N,I!==S-a+1&&b(t,a,S+1),0===I)f(e,n,i,E+1,r,o,l);else if(-1===$)for(O=(z=function(e){var t,n,r=e.slice(),o=[];o.push(0);for(var l=0,i=e.length;l0&&(r[l]=o[t-1]),o[t]=l)}}t=o.length,n=o[t-1];for(;t-- >0;)o[t]=n,n=r[n];return o}(T)).length-1,P=E;P>=i;P--)v=n[P],-1===T[P-i]?s(e,v,r,l,o):z[O]===P-i?O--:g(e,m(v),o),null!=v.dom&&(o=n[P].dom);else for(P=E;P>=i;P--)v=n[P],-1===T[P-i]&&s(e,v,r,l,o),null!=v.dom&&(o=n[P].dom)}}else{var L=t.lengthL&&b(t,i,t.length),n.length>L&&f(e,n,i,n.length,r,o,l)}}}function h(t,n,r,o,i,u){var f=n.tag;if(f===r.tag){if(r.state=n.state,r.events=n.events,function(e,t){var n,r;null!=e.attrs&&"function"==typeof e.attrs.onbeforeupdate&&(n=a.call(e.attrs.onbeforeupdate,e,t));"string"!=typeof e.tag&&"function"==typeof e.state.onbeforeupdate&&(r=a.call(e.state.onbeforeupdate,e,t));if(!(void 0===n&&void 0===r||n||r))return e.dom=t.dom,e.domSize=t.domSize,e.instance=t.instance,!0;return!1}(r,n))return;if("string"==typeof f)switch(null!=r.attrs&&T(r.attrs,r,o),f){case"#":!function(e,t){e.children.toString()!==t.children.toString()&&(e.dom.nodeValue=t.children);t.dom=e.dom}(n,r);break;case"<":!function(e,t,n,r,o){t.children!==n.children?(m(t),d(e,n,r,o)):(n.dom=t.dom,n.domSize=t.domSize)}(t,n,r,u,i);break;case"[":!function(e,t,n,r,o,l){v(e,t.children,n.children,r,o,l);var i=0,a=n.children;if(n.dom=null,null!=a){for(var u=0;u0){for(var o=e.dom;--t;)n.appendChild(o.nextSibling);n.insertBefore(o,n.firstChild)}return n}return e.dom}function y(e,t,n){for(;t-1||null!=e.attrs&&e.attrs.is||"href"!==t&&"list"!==t&&"form"!==t&&"width"!==t&&"height"!==t)&&t in e.dom}function A(e,t,n){if(null==t||null==n||"object"!=typeof t||"object"!=typeof n||n===t)if(t===n&&(e.style.cssText="",t=null),null==n)e.style.cssText="";else if("string"==typeof n)e.style.cssText=n;else for(var r in"string"==typeof t&&(e.style.cssText=""),n)e.style[r]=n[r];else{for(var r in n)n[r]!==t[r]&&(e.style[r]=n[r]);for(var r in t)r in n||(e.style[r]="")}}function z(){}function N(e,t,n){if(null!=e.events){if(e.events[t]===n)return;null==n||"function"!=typeof n&&"object"!=typeof n?(null!=e.events[t]&&e.dom.removeEventListener(t.slice(2),e.events,!1),e.events[t]=void 0):(null==e.events[t]&&e.dom.addEventListener(t.slice(2),e.events,!1),e.events[t]=n)}else null==n||"function"!=typeof n&&"object"!=typeof n||(e.events=new z,e.dom.addEventListener(t.slice(2),e.events,!1),e.events[t]=n)}function j(e,t,n){"function"==typeof e.oninit&&a.call(e.oninit,t),"function"==typeof e.oncreate&&n.push(a.bind(e.oncreate,t))}function T(e,t,n){"function"==typeof e.onupdate&&n.push(a.bind(e.onupdate,t))}return z.prototype=Object.create(null),z.prototype.handleEvent=function(e){var t,r=this["on"+e.type];"function"==typeof r?t=r.call(e.target,e):"function"==typeof r.handleEvent&&r.handleEvent(e),"function"==typeof n&&n.call(e.target,e),!1===t&&(e.preventDefault(),e.stopPropagation())},{render:function(t,n){if(!t)throw new Error("Ensure the DOM element being passed to m.route/m.mount/m.render is not undefined.");var r=[],o=u(),l=t.namespaceURI;null==t.vnodes&&(t.textContent=""),n=e.normalizeChildren(Array.isArray(n)?n:[n]),v(t,t.vnodes,n,r,null,"http://www.w3.org/1999/xhtml"===l?void 0:l),t.vnodes=n,null!=o&&u()!==o&&"function"==typeof o.focus&&o.focus();for(var i=0;i-1&&r.splice(t,2)}function i(){if(o)throw new Error("Nested m.redraw.sync() call");o=!0;for(var e=1;e-1&&u.pop();for(var s=0;s-1?r:o>-1?o:e.length;if(r>-1){var i=o>-1?o:e.length,a=p(e.slice(r+1,i));for(var u in a)t[u]=a[u]}if(o>-1){var f=p(e.slice(o+1));for(var u in f)n[u]=f[u]}return e.slice(0,l)}var i={prefix:"#!",getPath:function(){switch(i.prefix.charAt(0)){case"#":return o("hash").slice(i.prefix.length);case"?":return o("search").slice(i.prefix.length)+o("hash");default:return o("pathname").slice(i.prefix.length)+o("search")+o("hash")}},setPath:function(t,r,o){var a={},f={};if(t=l(t,a,f),null!=r){for(var s in r)a[s]=r[s];t=t.replace(/:([^\/]+)/g,function(e,t){return delete a[t],r[t]})}var c=u(a);c&&(t+="?"+c);var d=u(f);if(d&&(t+="#"+d),n){var v=o?o.state:null,h=o?o.title:null;e.onpopstate(),o&&o.replace?e.history.replaceState(v,h,i.prefix+t):e.history.pushState(v,h,i.prefix+t)}else e.location.href=i.prefix+t}};return i.defineRoutes=function(o,a,u){function f(){var t=i.getPath(),n={},r=l(t,n,n),f=e.history.state;if(null!=f)for(var s in f)n[s]=f[s];for(var c in o){var d=new RegExp("^"+c.replace(/:[^\/]+?\.{3}/g,"(.*?)").replace(/:[^\/]+/g,"([^\\/]+)")+"/?$");if(d.test(r))return void r.replace(d,function(){for(var e=c.match(/:[^\/]+/g)||[],r=[].slice.call(arguments,1,-2),l=0;l0&&(i.className=l.join(" ")),n[e]={tag:o,attrs:i}}(l),a,e.normalizeChildren(i)):e(l,a.key,a,i)}l.trust=function(t){return null==t&&(t=""),e("<",void 0,void 0,t,void 0,void 0)},l.fragment=function(t,n){return e("[",t.key,t,e.normalizeChildren(n),void 0,void 0)};var i=function(){return l.apply(this,arguments)};if(i.m=l,i.trust=l.trust,i.fragment=l.fragment,(a=function(e){if(!(this instanceof a))throw new Error("Promise must be called with `new`");if("function"!=typeof e)throw new TypeError("executor must be a function");var t=this,n=[],r=[],o=f(n,!0),l=f(r,!1),i=t._instance={resolvers:n,rejectors:r},u="function"==typeof setImmediate?setImmediate:setTimeout;function f(e,o){return function a(f){var c;try{if(!o||null==f||"object"!=typeof f&&"function"!=typeof f||"function"!=typeof(c=f.then))u(function(){o||0!==e.length||console.error("Possible unhandled promise rejection:",f);for(var t=0;t0||e(n)}}var r=n(l);try{e(n(o),r)}catch(e){r(e)}}s(e)}).prototype.then=function(e,t){var n,r,o=this._instance;function l(e,t,l,i){t.push(function(t){if("function"!=typeof e)l(t);else try{n(e(t))}catch(e){r&&r(e)}}),"function"==typeof o.retry&&i===o.state&&o.retry()}var i=new a(function(e,t){n=e,r=t});return l(e,o.resolvers,n,!0),l(t,o.rejectors,r,!1),i},a.prototype.catch=function(e){return this.then(null,e)},a.prototype.finally=function(e){return this.then(function(t){return a.resolve(e()).then(function(){return t})},function(t){return a.resolve(e()).then(function(){return a.reject(t)})})},a.resolve=function(e){return e instanceof a?e:new a(function(t){t(e)})},a.reject=function(e){return new a(function(t,n){n(e)})},a.all=function(e){return new a(function(t,n){var r=e.length,o=0,l=[];if(0===e.length)t([]);else for(var i=0;i=200&&l.status<300||304===l.status||f.test(n.url))t(d(n.type,e));else{var o=new Error(l.responseText);o.code=l.status,o.response=e,r(o)}}catch(e){r(e)}},o&&null!=n.data?l.send(n.data):l.send()});return!0===n.background?v:u(v)},jsonp:function(n,u){var f=o();n=l(n,u);var s=new t(function(t,o){var l=n.callbackName||"_mithril_"+Math.round(1e16*Math.random())+"_"+r++,u=e.document.createElement("script");e[l]=function(r){u.parentNode.removeChild(u),t(d(n.type,r)),delete e[l]},u.onerror=function(){u.parentNode.removeChild(u),o(new Error("JSONP request failed")),delete e[l]},null==n.data&&(n.data={}),n.url=i(n.url,n.data),n.data[n.callbackKey||"callback"]=l,u.src=a(n.url,n.data),e.document.documentElement.appendChild(u)});return!0===n.background?s:f(s)},setCompletionCallback:function(e){n=e}}}(window,a),c=function(t){var n,r=t.document,o={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"};function l(e){return e.attrs&&e.attrs.xmlns||o[e.tag]}function i(e,t){if(e.state!==t)throw new Error("`vnode.state` must not be modified")}function a(e){var t=e.state;try{return this.apply(t,arguments)}finally{i(e,t)}}function u(){try{return r.activeElement}catch(e){return null}}function f(e,t,n,r,o,l,i){for(var a=n;a'+t.children+"",i=i.firstChild):i.innerHTML=t.children,t.dom=i.firstChild,t.domSize=i.childNodes.length;for(var a,u=r.createDocumentFragment();a=i.firstChild;)u.appendChild(a);g(e,u,o)}function v(e,t,n,r,o,l){if(t!==n&&(null!=t||null!=n))if(null==t||0===t.length)f(e,n,0,n.length,r,o,l);else if(null==n||0===n.length)b(t,0,t.length);else{for(var i=0,a=0,u=null,c=null;a=a&&E>=i;)if(w=t[S],k=n[E],null==w)S--;else if(null==k)E--;else{if(w.key!==k.key)break;w!==k&&h(e,w,k,r,o,l),null!=k.dom&&(o=k.dom),S--,E--}for(;S>=a&&E>=i;)if(d=t[a],v=n[i],null==d)a++;else if(null==v)i++;else{if(d.key!==v.key)break;a++,i++,d!==v&&h(e,d,v,r,y(t,a,o),l)}for(;S>=a&&E>=i;){if(null==d)a++;else if(null==v)i++;else if(null==w)S--;else if(null==k)E--;else{if(i===E)break;if(d.key!==k.key||w.key!==v.key)break;C=y(t,a,o),g(e,m(w),C),w!==v&&h(e,w,v,r,C,l),++i<=--E&&g(e,m(d),o),d!==k&&h(e,d,k,r,o,l),null!=k.dom&&(o=k.dom),a++,S--}w=t[S],k=n[E],d=t[a],v=n[i]}for(;S>=a&&E>=i;){if(null==w)S--;else if(null==k)E--;else{if(w.key!==k.key)break;w!==k&&h(e,w,k,r,o,l),null!=k.dom&&(o=k.dom),S--,E--}w=t[S],k=n[E]}if(i>E)b(t,a,S+1);else if(a>S)f(e,n,i,E+1,r,o,l);else{var A,z,N=o,j=E-i+1,T=new Array(j),O=0,P=0,$=2147483647,I=0;for(P=0;P=i;P--)if(null==A&&(A=p(t,a,S+1)),null!=(k=n[P])){var R=A[k.key];null!=R&&($=R<$?R:-1,T[P-i]=R,w=t[R],t[R]=null,w!==k&&h(e,w,k,r,o,l),null!=k.dom&&(o=k.dom),I++)}if(o=N,I!==S-a+1&&b(t,a,S+1),0===I)f(e,n,i,E+1,r,o,l);else if(-1===$)for(O=(z=function(e){var t,n,r=e.slice(),o=[];o.push(0);for(var l=0,i=e.length;l0&&(r[l]=o[t-1]),o[t]=l)}}t=o.length,n=o[t-1];for(;t-- >0;)o[t]=n,n=r[n];return o}(T)).length-1,P=E;P>=i;P--)v=n[P],-1===T[P-i]?s(e,v,r,l,o):z[O]===P-i?O--:g(e,m(v),o),null!=v.dom&&(o=n[P].dom);else for(P=E;P>=i;P--)v=n[P],-1===T[P-i]&&s(e,v,r,l,o),null!=v.dom&&(o=n[P].dom)}}else{var L=t.lengthL&&b(t,i,t.length),n.length>L&&f(e,n,i,n.length,r,o,l)}}}function h(t,n,r,o,i,u){var f=n.tag;if(f===r.tag){if(r.state=n.state,r.events=n.events,function(e,t){var n,r;null!=e.attrs&&"function"==typeof e.attrs.onbeforeupdate&&(n=a.call(e.attrs.onbeforeupdate,e,t));"string"!=typeof e.tag&&"function"==typeof e.state.onbeforeupdate&&(r=a.call(e.state.onbeforeupdate,e,t));if(!(void 0===n&&void 0===r||n||r))return e.dom=t.dom,e.domSize=t.domSize,e.instance=t.instance,!0;return!1}(r,n))return;if("string"==typeof f)switch(null!=r.attrs&&T(r.attrs,r,o),f){case"#":!function(e,t){e.children.toString()!==t.children.toString()&&(e.dom.nodeValue=t.children);t.dom=e.dom}(n,r);break;case"<":!function(e,t,n,r,o){t.children!==n.children?(m(t),d(e,n,r,o)):(n.dom=t.dom,n.domSize=t.domSize)}(t,n,r,u,i);break;case"[":!function(e,t,n,r,o,l){v(e,t.children,n.children,r,o,l);var i=0,a=n.children;if(n.dom=null,null!=a){for(var u=0;u0){for(var o=e.dom;--t;)n.appendChild(o.nextSibling);n.insertBefore(o,n.firstChild)}return n}return e.dom}function y(e,t,n){for(;t-1||null!=e.attrs&&e.attrs.is||"href"!==t&&"list"!==t&&"form"!==t&&"width"!==t&&"height"!==t)&&t in e.dom}function A(e,t,n){if(null==t||null==n||"object"!=typeof t||"object"!=typeof n||n===t)if(t===n&&(e.style.cssText="",t=null),null==n)e.style.cssText="";else if("string"==typeof n)e.style.cssText=n;else for(var r in"string"==typeof t&&(e.style.cssText=""),n)e.style[r]=n[r];else{for(var r in n)n[r]!==t[r]&&(e.style[r]=n[r]);for(var r in t)r in n||(e.style[r]="")}}function z(){}function N(e,t,n){if(null!=e.events){if(e.events[t]===n)return;null==n||"function"!=typeof n&&"object"!=typeof n?(null!=e.events[t]&&e.dom.removeEventListener(t.slice(2),e.events,!1),e.events[t]=void 0):(null==e.events[t]&&e.dom.addEventListener(t.slice(2),e.events,!1),e.events[t]=n)}else null==n||"function"!=typeof n&&"object"!=typeof n||(e.events=new z,e.dom.addEventListener(t.slice(2),e.events,!1),e.events[t]=n)}function j(e,t,n){"function"==typeof e.oninit&&a.call(e.oninit,t),"function"==typeof e.oncreate&&n.push(a.bind(e.oncreate,t))}function T(e,t,n){"function"==typeof e.onupdate&&n.push(a.bind(e.onupdate,t))}return z.prototype=Object.create(null),z.prototype.handleEvent=function(e){var t,r=this["on"+e.type];"function"==typeof r?t=r.call(e.target,e):"function"==typeof r.handleEvent&&r.handleEvent(e),"function"==typeof n&&n.call(e.target,e),!1===t&&(e.preventDefault(),e.stopPropagation())},{render:function(t,n){if(!t)throw new Error("Ensure the DOM element being passed to m.route/m.mount/m.render is not undefined.");var r=[],o=u(),l=t.namespaceURI;null==t.vnodes&&(t.textContent=""),n=e.normalizeChildren(Array.isArray(n)?n:[n]),v(t,t.vnodes,n,r,null,"http://www.w3.org/1999/xhtml"===l?void 0:l),t.vnodes=n,null!=o&&u()!==o&&"function"==typeof o.focus&&o.focus();for(var i=0;i-1&&r.splice(t,2)}function i(){if(o)throw new Error("Nested m.redraw.sync() call");o=!0;for(var e=1;e-1&&u.pop();for(var s=0;s-1?r:o>-1?o:e.length;if(r>-1){var i=o>-1?o:e.length,a=p(e.slice(r+1,i));for(var u in a)t[u]=a[u]}if(o>-1){var f=p(e.slice(o+1));for(var u in f)n[u]=f[u]}return e.slice(0,l)}var i={prefix:"#!",getPath:function(){switch(i.prefix.charAt(0)){case"#":return o("hash").slice(i.prefix.length);case"?":return o("search").slice(i.prefix.length)+o("hash");default:return o("pathname").slice(i.prefix.length)+o("search")+o("hash")}},setPath:function(t,r,o){var a={},f={};if(t=l(t,a,f),null!=r){for(var s in r)a[s]=r[s];t=t.replace(/:([^\/]+)/g,function(e,t){return delete a[t],r[t]})}var c=u(a);c&&(t+="?"+c);var d=u(f);if(d&&(t+="#"+d),n){var v=o?o.state:null,h=o?o.title:null;e.onpopstate(),o&&o.replace?e.history.replaceState(v,h,i.prefix+t):e.history.pushState(v,h,i.prefix+t)}else e.location.href=i.prefix+t}};return i.defineRoutes=function(o,a,u){function f(){var t=i.getPath(),n={},r=l(t,n,n),f=e.history.state;if(null!=f)for(var s in f)n[s]=f[s];for(var c in o){var d=new RegExp("^"+c.replace(/:[^\/]+?\.{3}/g,"(.*?)").replace(/:[^\/]+/g,"([^\\/]+)")+"/?$");if(d.test(r))return void r.replace(d,function(){for(var e=c.match(/:[^\/]+/g)||[],r=[].slice.call(arguments,1,-2),l=0;l