Bundled output for commit 3f5cabc5c5 [skip ci]
This commit is contained in:
parent
3f5cabc5c5
commit
4ca2b362f7
3 changed files with 99 additions and 92 deletions
|
|
@ -18,7 +18,7 @@ mithril.js [](https://ww
|
|||
|
||||
## What is Mithril?
|
||||
|
||||
A modern client-side Javascript framework for building Single Page Applications. It's small (<!-- size -->8.71 KB<!-- /size --> 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 (<!-- size -->8.86 KB<!-- /size --> 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 👍.
|
||||
|
||||
|
|
|
|||
94
mithril.js
94
mithril.js
|
|
@ -507,7 +507,7 @@ var coreRenderer = function($window) {
|
|||
setAttrs(vnode, attrs2, ns)
|
||||
}
|
||||
insertNode(parent, element, nextSibling)
|
||||
if (vnode.attrs != null && vnode.attrs.contenteditable != null) {
|
||||
if (attrs2 != null && attrs2.contenteditable != null) {
|
||||
setContentEditable(vnode)
|
||||
}
|
||||
else {
|
||||
|
|
@ -518,7 +518,7 @@ var coreRenderer = function($window) {
|
|||
if (vnode.children != null) {
|
||||
var children1 = vnode.children
|
||||
createNodes(element, children1, 0, children1.length, hooks, null, ns)
|
||||
setLateAttrs(vnode)
|
||||
if (vnode.tag === "select" && attrs2 != null) setLateSelectAttrs(vnode, attrs2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -940,9 +940,7 @@ var coreRenderer = function($window) {
|
|||
u = 0
|
||||
v = result.length - 1
|
||||
while (u < v) {
|
||||
/*eslint-disable no-bitwise*/
|
||||
var c = ((u + v) / 2) | 0
|
||||
/*eslint-enable no-bitwise*/
|
||||
var c = ((u + v) / 2) | 0 // eslint-disable-line no-bitwise
|
||||
if (a[result[c]] < a[i]) {
|
||||
u = c + 1
|
||||
}
|
||||
|
|
@ -1064,66 +1062,74 @@ var coreRenderer = function($window) {
|
|||
}
|
||||
}
|
||||
function setAttr(vnode, key2, old, value, ns) {
|
||||
if (key2 === "key" || key2 === "is" || isLifecycleMethod(key2)) return
|
||||
if (key2 === "key" || key2 === "is" || value == null || isLifecycleMethod(key2) || (old === value && !isFormAttribute(vnode, key2)) && typeof value !== "object") return
|
||||
if (key2[0] === "o" && key2[1] === "n") return updateEvent(vnode, key2, value)
|
||||
if (typeof value === "undefined" && key2 === "value" && old !== value) {
|
||||
vnode.dom.value = ""
|
||||
return
|
||||
}
|
||||
if ((old === value && !isFormAttribute(vnode, key2)) && typeof value !== "object" || value === undefined) return
|
||||
var element = vnode.dom
|
||||
if (key2.slice(0, 6) === "xlink:") element.setAttributeNS("http://www.w3.org/1999/xlink", key2, value)
|
||||
else if (key2 === "style") updateStyle(element, old, value)
|
||||
else if (key2 in element && !isAttribute(key2) && ns === undefined && !isCustomElement(vnode)) {
|
||||
if (key2.slice(0, 6) === "xlink:") vnode.dom.setAttributeNS("http://www.w3.org/1999/xlink", key2.slice(6), value)
|
||||
else if (key2 === "style") updateStyle(vnode.dom, old, value)
|
||||
else if (key2 in vnode.dom && !isAttribute(key2) && ns === undefined && !isCustomElement(vnode.tag, vnode.attrs)) {
|
||||
if (key2 === "value") {
|
||||
var normalized = "" + value // eslint-disable-line no-implicit-coercion
|
||||
//setting input[value] to same value by typing on focused element moves cursor to end in Chrome
|
||||
if ((vnode.tag === "input" || vnode.tag === "textarea") && vnode.dom.value === normalized && vnode.dom === $doc.activeElement) return
|
||||
//setting select[value] to same value while having select open blinks select dropdown in Chrome
|
||||
if (vnode.tag === "select") {
|
||||
if (value === null) {
|
||||
if (vnode.dom.selectedIndex === -1 && vnode.dom === $doc.activeElement) return
|
||||
} else {
|
||||
if (old !== null && vnode.dom.value === normalized && vnode.dom === $doc.activeElement) return
|
||||
}
|
||||
}
|
||||
if (vnode.tag === "select" && old !== null && vnode.dom.value === normalized) return
|
||||
//setting option[value] to same value while having select open blinks select dropdown in Chrome
|
||||
if (vnode.tag === "option" && old != null && vnode.dom.value === normalized) return
|
||||
if (vnode.tag === "option" && old !== null && vnode.dom.value === normalized) return
|
||||
}
|
||||
// If you assign an input type1 that is not supported by IE 11 with an assignment expression, an error1 will occur.
|
||||
if (vnode.tag === "input" && key2 === "type") {
|
||||
element.setAttribute(key2, value)
|
||||
return
|
||||
}
|
||||
element[key2] = value
|
||||
}
|
||||
else {
|
||||
if (vnode.tag === "input" && key2 === "type") vnode.dom.setAttribute(key2, value)
|
||||
else vnode.dom[key2] = value
|
||||
} else {
|
||||
if (typeof value === "boolean") {
|
||||
if (value) element.setAttribute(key2, "")
|
||||
else element.removeAttribute(key2)
|
||||
if (value) vnode.dom.setAttribute(key2, "")
|
||||
else vnode.dom.removeAttribute(key2)
|
||||
}
|
||||
else element.setAttribute(key2 === "className" ? "class" : key2, value)
|
||||
else vnode.dom.setAttribute(key2 === "className" ? "class" : key2, value)
|
||||
}
|
||||
}
|
||||
function setLateAttrs(vnode) {
|
||||
var attrs2 = vnode.attrs
|
||||
if (vnode.tag === "select" && attrs2 != null) {
|
||||
if ("value" in attrs2) setAttr(vnode, "value", null, attrs2.value, undefined)
|
||||
if ("selectedIndex" in attrs2) setAttr(vnode, "selectedIndex", null, attrs2.selectedIndex, undefined)
|
||||
function removeAttr(vnode, key2, old, ns) {
|
||||
if (key2 === "key" || key2 === "is" || old == null || isLifecycleMethod(key2)) return
|
||||
if (key2[0] === "o" && key2[1] === "n" && !isLifecycleMethod(key2)) updateEvent(vnode, key2, undefined)
|
||||
else if (key2 === "style") updateStyle(vnode.dom, old, null)
|
||||
else if (
|
||||
key2 in vnode.dom && !isAttribute(key2)
|
||||
&& key2 !== "className"
|
||||
&& !(vnode.tag === "option" && key2 === "value")
|
||||
&& !(vnode.tag === "input" && key2 === "type")
|
||||
&& ns === undefined
|
||||
&& !isCustomElement(vnode.tag, vnode.attrs || {})
|
||||
) {
|
||||
vnode.dom[key2] = null
|
||||
} else {
|
||||
var nsLastIndex = key2.indexOf(":")
|
||||
if (nsLastIndex !== -1) key2 = key2.slice(nsLastIndex + 1)
|
||||
if (old !== false) vnode.dom.removeAttribute(key2 === "className" ? "class" : key2)
|
||||
}
|
||||
}
|
||||
function setLateSelectAttrs(vnode, attrs2) {
|
||||
if ("value" in attrs2) {
|
||||
if(attrs2.value === null) {
|
||||
if (vnode.dom.selectedIndex !== -1) vnode.dom.value = null
|
||||
} else {
|
||||
var normalized = "" + attrs2.value // eslint-disable-line no-implicit-coercion
|
||||
if (vnode.dom.value !== normalized || vnode.dom.selectedIndex === -1) {
|
||||
vnode.dom.value = normalized
|
||||
}
|
||||
}
|
||||
}
|
||||
if ("selectedIndex" in attrs2) setAttr(vnode, "selectedIndex", null, attrs2.selectedIndex, undefined)
|
||||
}
|
||||
function updateAttrs(vnode, old, attrs2, ns) {
|
||||
if (attrs2 != null) {
|
||||
for (var key2 in attrs2) {
|
||||
setAttr(vnode, key2, old && old[key2], attrs2[key2], ns)
|
||||
}
|
||||
}
|
||||
var val
|
||||
if (old != null) {
|
||||
for (var key2 in old) {
|
||||
if (attrs2 == null || !(key2 in attrs2)) {
|
||||
if (key2 === "className") key2 = "class"
|
||||
if (key2[0] === "o" && key2[1] === "n" && !isLifecycleMethod(key2)) updateEvent(vnode, key2, undefined)
|
||||
else if (key2 !== "key") vnode.dom.removeAttribute(key2)
|
||||
if (((val = old[key2]) != null) && (attrs2 == null || attrs2[key2] == null)) {
|
||||
removeAttr(vnode, key2, val, ns)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1137,8 +1143,8 @@ var coreRenderer = function($window) {
|
|||
function isAttribute(attr) {
|
||||
return attr === "href" || attr === "list" || attr === "form" || attr === "width" || attr === "height"// || attr === "type"
|
||||
}
|
||||
function isCustomElement(vnode){
|
||||
return vnode.attrs.is || vnode.tag.indexOf("-") > -1
|
||||
function isCustomElement(tag, attrs2){
|
||||
return attrs2.is || tag.indexOf("-") > -1
|
||||
}
|
||||
//style
|
||||
function updateStyle(element, old, style) {
|
||||
|
|
|
|||
95
mithril.min.js
vendored
95
mithril.min.js
vendored
|
|
@ -1,47 +1,48 @@
|
|||
(function(){function z(a,d,e,f,v,l){return{tag:a,key:d,attrs:e,children:f,text:v,dom:l,domSize:void 0,state:void 0,events:void 0,instance:void 0}}function Q(a){for(var d in a)if(H.call(a,d))return!1;return!0}function w(a){if(null==a||"string"!==typeof a&&"function"!==typeof a&&"function"!==typeof a.view)throw Error("The selector must be either a string or a component.");var d=arguments[1],e=2;if(null==d)d={};else if("object"!==typeof d||null!=d.tag||Array.isArray(d))d={},e=1;if(arguments.length===
|
||||
e+1){var f=arguments[e];Array.isArray(f)||(f=[f])}else for(f=[];e<arguments.length;)f.push(arguments[e++]);if("string"===typeof a){if(!(e=R[a])){for(var v="div",l=[],h={};e=V.exec(a);){var n=e[1],t=e[2];""===n&&""!==t?v=t:"#"===n?h.id=t:"."===n?l.push(t):"["===e[3][0]&&((n=e[6])&&(n=n.replace(/\\(["'])/g,"$1").replace(/\\\\/g,"\\")),"class"===e[4]?l.push(n):h[e[4]]=""===n?n:n||!0)}0<l.length&&(h.className=l.join(" "));e=R[a]={tag:v,attrs:h}}f=z.normalizeChildren(f);v=!1;var g,C;l=d.className||d["class"];
|
||||
if(!Q(e.attrs)&&!Q(d)){h={};for(var c in d)H.call(d,c)&&(h[c]=d[c]);d=h}for(c in e.attrs)H.call(e.attrs,c)&&(d[c]=e.attrs[c]);void 0!==l&&(void 0!==d["class"]&&(d["class"]=void 0,d.className=l),null!=e.attrs.className&&(d.className=e.attrs.className+" "+l));for(c in d)if(H.call(d,c)&&"key"!==c){v=!0;break}Array.isArray(f)&&1===f.length&&null!=f[0]&&"#"===f[0].tag?C=f[0].children:g=f;return z(e.tag,d.key,v?d:void 0,g,C)}return z(a,d.key,d,f)}function W(a){var d=0,e=null,f="function"===typeof requestAnimationFrame?
|
||||
requestAnimationFrame:setTimeout;return function(){var v=Date.now()-d;null===e&&(e=f(function(){e=null;a();d=Date.now()},16-v))}}z.normalize=function(a){return Array.isArray(a)?z("[",void 0,void 0,z.normalizeChildren(a),void 0,void 0):null!=a&&"object"!==typeof a?z("#",void 0,void 0,!1===a?"":a,void 0,void 0):a};z.normalizeChildren=function(a){for(var d=[],e=0;e<a.length;e++)d[e]=z.normalize(a[e]);return d};var V=/(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g,R={},
|
||||
H={}.hasOwnProperty;w.trust=function(a){null==a&&(a="");return z("<",void 0,void 0,a,void 0,void 0)};w.fragment=function(a,d){return z("[",a.key,a,z.normalizeChildren(d),void 0,void 0)};var k=function(a){function d(a,c){return function K(d){var E;try{if(!c||null==d||"object"!==typeof d&&"function"!==typeof d||"function"!==typeof(E=d.then))g(function(){c||0!==a.length||console.error("Possible unhandled promise rejection:",d);for(var e=0;e<a.length;e++)a[e](d);v.length=0;l.length=0;t.state=c;t.retry=
|
||||
function(){K(d)}});else{if(d===f)throw new TypeError("Promise can't be resolved w/ itself");e(E.bind(d))}}catch(X){n(X)}}}function e(a){function c(c){return function(a){0<d++||c(a)}}var d=0,e=c(n);try{a(c(h),e)}catch(K){e(K)}}if(!(this instanceof k))throw Error("Promise must be called with `new`");if("function"!==typeof a)throw new TypeError("executor must be a function");var f=this,v=[],l=[],h=d(v,!0),n=d(l,!1),t=f._instance={resolvers:v,rejectors:l},g="function"===typeof setImmediate?setImmediate:
|
||||
setTimeout;e(a)};k.prototype.then=function(a,d){function e(a,d,e,h){d.push(function(c){if("function"!==typeof a)e(c);else try{v(a(c))}catch(D){l&&l(D)}});"function"===typeof f.retry&&h===f.state&&f.retry()}var f=this._instance,v,l,h=new k(function(a,d){v=a;l=d});e(a,f.resolvers,v,!0);e(d,f.rejectors,l,!1);return h};k.prototype["catch"]=function(a){return this.then(null,a)};k.prototype["finally"]=function(a){return this.then(function(d){return k.resolve(a()).then(function(){return d})},function(d){return k.resolve(a()).then(function(){return k.reject(d)})})};
|
||||
k.resolve=function(a){return a instanceof k?a:new k(function(d){d(a)})};k.reject=function(a){return new k(function(d,e){e(a)})};k.all=function(a){return new k(function(d,e){var f=a.length,v=0,l=[];if(0===a.length)d([]);else for(var h=0;h<a.length;h++)(function(n){function t(a){v++;l[n]=a;v===f&&d(l)}null==a[n]||"object"!==typeof a[n]&&"function"!==typeof a[n]||"function"!==typeof a[n].then?t(a[n]):a[n].then(t,e)})(h)})};k.race=function(a){return new k(function(d,e){for(var f=0;f<a.length;f++)a[f].then(d,
|
||||
e)})};"undefined"!==typeof window?("undefined"===typeof window.Promise?window.Promise=k:window.Promise.prototype["finally"]||(window.Promise.prototype["finally"]=k.prototype["finally"]),k=window.Promise):"undefined"!==typeof global&&("undefined"===typeof global.Promise?global.Promise=k:global.Promise.prototype["finally"]||(global.Promise.prototype["finally"]=k.prototype["finally"]),k=global.Promise);var I=function(a){function d(a,f){if(Array.isArray(f))for(var h=0;h<f.length;h++)d(a+"["+h+"]",f[h]);
|
||||
else if("[object Object]"===Object.prototype.toString.call(f))for(h in f)d(a+"["+h+"]",f[h]);else e.push(encodeURIComponent(a)+(null!=f&&""!==f?"="+encodeURIComponent(f):""))}if("[object Object]"!==Object.prototype.toString.call(a))return"";var e=[],f;for(f in a)d(f,a[f]);return e.join("&")},Y=/^file:\/\//i,O=function(a,d){function e(){function c(){0===--a&&"function"===typeof C&&C()}var a=0;return function G(d){var e=d.then;d.then=function(){a++;var f=e.apply(d,arguments);f.then(c,function(d){c();
|
||||
if(0===a)throw d;});return G(f)};return d}}function f(c,a){if("string"===typeof c){var d=c;c=a||{};null==c.url&&(c.url=d)}return c}function v(c,a){if(null==a)return c;for(var d=c.match(/:[^\/]+/gi)||[],e=0;e<d.length;e++){var f=d[e].slice(1);null!=a[f]&&(c=c.replace(d[e],a[f]))}return c}function l(c,a){var d=I(a);if(""!==d){var e=0>c.indexOf("?")?"?":"&";c+=e+d}return c}function h(c){try{return""!==c?JSON.parse(c):null}catch(D){throw Error(c);}}function n(c){return c.responseText}function t(c,a){if("function"===
|
||||
typeof c)if(Array.isArray(a))for(var d=0;d<a.length;d++)a[d]=new c(a[d]);else return new c(a);return a}var g=0,C;return{request:function(c,g){var E=e();c=f(c,g);var D=new d(function(d,e){null==c.method&&(c.method="GET");c.method=c.method.toUpperCase();var f="GET"===c.method||"TRACE"===c.method?!1:"boolean"===typeof c.useBody?c.useBody:!0;"function"!==typeof c.serialize&&(c.serialize="undefined"!==typeof FormData&&c.data instanceof FormData?function(c){return c}:JSON.stringify);"function"!==typeof c.deserialize&&
|
||||
(c.deserialize=h);"function"!==typeof c.extract&&(c.extract=n);c.url=v(c.url,c.data);f?c.data=c.serialize(c.data):c.url=l(c.url,c.data);var g=new a.XMLHttpRequest,E=!1,D=g.abort;g.abort=function(){E=!0;D.call(g)};g.open(c.method,c.url,"boolean"===typeof c.async?c.async:!0,"string"===typeof c.user?c.user:void 0,"string"===typeof c.password?c.password:void 0);c.serialize!==JSON.stringify||!f||c.headers&&c.headers.hasOwnProperty("Content-Type")||g.setRequestHeader("Content-Type","application/json; charset=utf-8");
|
||||
c.deserialize!==h||c.headers&&c.headers.hasOwnProperty("Accept")||g.setRequestHeader("Accept","application/json, text/*");c.withCredentials&&(g.withCredentials=c.withCredentials);c.timeout&&(g.timeout=c.timeout);for(var C in c.headers)({}).hasOwnProperty.call(c.headers,C)&&g.setRequestHeader(C,c.headers[C]);"function"===typeof c.config&&(g=c.config(g,c)||g);g.onreadystatechange=function(){if(!E&&4===g.readyState)try{var a=c.extract!==n?c.extract(g,c):c.deserialize(c.extract(g,c));if(c.extract!==n||
|
||||
200<=g.status&&300>g.status||304===g.status||Y.test(c.url))d(t(c.type,a));else{var f=Error(g.responseText);f.code=g.status;f.response=a;e(f)}}catch(Z){e(Z)}};f&&null!=c.data?g.send(c.data):g.send()});return!0===c.background?D:E(D)},jsonp:function(c,n){var h=e();c=f(c,n);var D=new d(function(d,e){var f=c.callbackName||"_mithril_"+Math.round(1E16*Math.random())+"_"+g++,n=a.document.createElement("script");a[f]=function(e){n.parentNode.removeChild(n);d(t(c.type,e));delete a[f]};n.onerror=function(){n.parentNode.removeChild(n);
|
||||
e(Error("JSONP request failed"));delete a[f]};null==c.data&&(c.data={});c.url=v(c.url,c.data);c.data[c.callbackKey||"callback"]=f;n.src=l(c.url,c.data);a.document.documentElement.appendChild(n)});return!0===c.background?D:h(D)},setCompletionCallback:function(c){C=c}}}(window,k),U=function(a){function d(p,b){if(p.state!==b)throw Error("`vnode.state` must not be modified");}function e(p){var b=p.state;try{return this.apply(b,arguments)}finally{d(p,b)}}function f(p,b,c,a,d,e,f){for(;c<a;c++){var m=b[c];
|
||||
null!=m&&v(p,m,d,f,e)}}function v(p,b,m,a,d){var t=b.tag;if("string"===typeof t)switch(b.state={},null!=b.attrs&&M(b.attrs,b,m),t){case "#":b.dom=A.createTextNode(b.children);C(p,b.dom,d);break;case "<":l(p,b,a,d);break;case "[":var F=A.createDocumentFragment();null!=b.children&&(t=b.children,f(F,t,0,t.length,m,null,a));b.dom=F.firstChild;b.domSize=F.childNodes.length;C(p,F,d);break;default:var g=b.tag,r=(t=b.attrs)&&t.is;g=(a=b.attrs&&b.attrs.xmlns||T[b.tag]||a)?r?A.createElementNS(a,g,{is:r}):A.createElementNS(a,
|
||||
g):r?A.createElement(g,{is:r}):A.createElement(g);b.dom=g;if(null!=t)for(F in r=a,t)G(b,F,null,t[F],r);C(p,g,d);null!=b.attrs&&null!=b.attrs.contenteditable?c(b):(null!=b.text&&(""!==b.text?g.textContent=b.text:b.children=[z("#",void 0,void 0,b.text,void 0,void 0)]),null!=b.children&&(p=b.children,f(g,p,0,p.length,m,null,a),m=b.attrs,"select"===b.tag&&null!=m&&("value"in m&&G(b,"value",null,m.value,void 0),"selectedIndex"in m&&G(b,"selectedIndex",null,m.selectedIndex,void 0))))}else{a:{if("function"===
|
||||
typeof b.tag.view){b.state=Object.create(b.tag);F=b.state.view;if(null!=F.$$reentrantLock$$)break a;F.$$reentrantLock$$=!0}else{b.state=void 0;F=b.tag;if(null!=F.$$reentrantLock$$)break a;F.$$reentrantLock$$=!0;b.state=null!=b.tag.prototype&&"function"===typeof b.tag.prototype.view?new b.tag(b):b.tag(b)}null!=b.attrs&&M(b.attrs,b,m);M(b.state,b,m);b.instance=z.normalize(e.call(b.state.view,b));if(b.instance===b)throw Error("A view cannot return the vnode it received as argument");F.$$reentrantLock$$=
|
||||
null}null!=b.instance?(v(p,b.instance,m,a,d),b.dom=b.instance.dom,b.domSize=null!=b.dom?b.instance.domSize:0):b.domSize=0}}function l(c,b,m,a){var p=b.children.match(/^\s*?<(\w+)/im)||[];p=A.createElement(I[p[1]]||"div");"http://www.w3.org/2000/svg"===m?(p.innerHTML='<svg xmlns="http://www.w3.org/2000/svg">'+b.children+"</svg>",p=p.firstChild):p.innerHTML=b.children;b.dom=p.firstChild;b.domSize=p.childNodes.length;for(b=A.createDocumentFragment();m=p.firstChild;)b.appendChild(m);C(c,b,a)}function h(p,
|
||||
b,c,a,d,e){if(b!==c&&(null!=b||null!=c))if(null==b||0===b.length)f(p,c,0,c.length,a,d,e);else if(null==c||0===c.length)D(b,0,b.length);else{for(var m=0,r=0,h=null,q=null;r<b.length;r++)if(null!=b[r]){h=null!=b[r].key;break}for(;m<c.length;m++)if(null!=c[m]){q=null!=c[m].key;break}if(null!==q||null!=h)if(h!==q)D(b,r,b.length),f(p,c,m,c.length,a,d,e);else if(q){q=b.length-1;h=c.length-1;for(var l,x,u,k,y,B;q>=r&&h>=m;)if(k=b[q],y=c[h],null==k)q--;else if(null==y)h--;else if(k.key===y.key)k!==y&&n(p,
|
||||
k,y,a,d,e),null!=y.dom&&(d=y.dom),q--,h--;else break;for(;q>=r&&h>=m;)if(x=b[r],u=c[m],null==x)r++;else if(null==u)m++;else if(x.key===u.key)r++,m++,x!==u&&n(p,x,u,a,g(b,r,d),e);else break;for(;q>=r&&h>=m;){if(null==x)r++;else if(null==u)m++;else if(null==k)q--;else if(null==y)h--;else if(m===h)break;else{if(x.key!==y.key||k.key!==u.key)break;B=g(b,r,d);C(p,t(k),B);k!==u&&n(p,k,u,a,B,e);++m<=--h&&C(p,t(x),d);x!==y&&n(p,x,y,a,d,e);null!=y.dom&&(d=y.dom);r++;q--}k=b[q];y=c[h];x=b[r];u=c[m]}for(;q>=
|
||||
r&&h>=m;){if(null==k)q--;else if(null==y)h--;else if(k.key===y.key)k!==y&&n(p,k,y,a,d,e),null!=y.dom&&(d=y.dom),q--,h--;else break;k=b[q];y=c[h]}if(m>h)D(b,r,q+1);else if(r>q)f(p,c,m,h+1,a,d,e);else{u=d;k=h-m+1;x=Array(k);var A=2147483647,z=0;for(B=0;B<k;B++)x[B]=-1;for(B=h;B>=m;B--){if(null==l){l=b;k=r;y=q+1;for(var w={};k<y;k++){var G=l[k];null!=G&&(G=G.key,null!=G&&(w[G]=k))}l=w}y=c[B];null!=y&&(w=l[y.key],null!=w&&(A=w<A?w:-1,x[B-m]=w,k=b[w],b[w]=null,k!==y&&n(p,k,y,a,d,e),null!=y.dom&&(d=y.dom),
|
||||
z++))}d=u;z!==q-r+1&&D(b,r,q+1);if(0===z)f(p,c,m,h+1,a,d,e);else if(-1===A){r=x.slice();b=[];b.push(0);q=0;for(B=x.length;q<B;++q)if(-1!==x[q])if(u=b[b.length-1],x[u]<x[q])r[q]=u,b.push(q);else{u=0;for(A=b.length-1;u<A;)z=(u+A)/2|0,x[b[z]]<x[q]?u=z+1:A=z;x[q]<x[b[u]]&&(0<u&&(r[q]=b[u-1]),b[u]=q)}u=b.length;for(A=b[u-1];0<u--;)b[u]=A,A=r[A];r=b.length-1;for(B=h;B>=m;B--)u=c[B],-1===x[B-m]?v(p,u,a,e,d):b[r]===B-m?r--:C(p,t(u),d),null!=u.dom&&(d=c[B].dom)}else for(B=h;B>=m;B--)u=c[B],-1===x[B-m]&&v(p,
|
||||
u,a,e,d),null!=u.dom&&(d=c[B].dom)}}else{h=b.length<c.length?b.length:c.length;for(m=m<r?m:r;m<h;m++)x=b[m],u=c[m],x===u||null==x&&null==u||(null==x?v(p,u,a,e,g(b,m+1,d)):null==u?E(x):n(p,x,u,a,g(b,m+1,d),e));b.length>h&&D(b,m,b.length);c.length>h&&f(p,c,m,c.length,a,d,e)}}}function n(p,b,a,d,f,g){var m=b.tag;if(m===a.tag){a.state=b.state;a.events=b.events;var r;var k;null!=a.attrs&&"function"===typeof a.attrs.onbeforeupdate&&(r=e.call(a.attrs.onbeforeupdate,a,b));"string"!==typeof a.tag&&"function"===
|
||||
typeof a.state.onbeforeupdate&&(k=e.call(a.state.onbeforeupdate,a,b));void 0===r&&void 0===k||r||k?r=!1:(a.dom=b.dom,a.domSize=b.domSize,a.instance=b.instance,r=!0);if(!r)if("string"===typeof m)switch(null!=a.attrs&&N(a.attrs,a,d),m){case "#":b.children.toString()!==a.children.toString()&&(b.dom.nodeValue=a.children);a.dom=b.dom;break;case "<":b.children!==a.children?(t(b),l(p,a,g,f)):(a.dom=b.dom,a.domSize=b.domSize);break;case "[":h(p,b.children,a.children,d,f,g);b=0;d=a.children;a.dom=null;if(null!=
|
||||
d){for(var q=0;q<d.length;q++)g=d[q],null!=g&&null!=g.dom&&(null==a.dom&&(a.dom=g.dom),b+=g.domSize||1);1!==b&&(a.domSize=b)}break;default:p=a.dom=b.dom;g=a.attrs&&a.attrs.xmlns||T[a.tag]||g;"textarea"===a.tag&&(null==a.attrs&&(a.attrs={}),null!=a.text&&(a.attrs.value=a.text,a.text=void 0));f=b.attrs;m=a.attrs;r=g;if(null!=m)for(q in m)G(a,q,f&&f[q],m[q],r);if(null!=f)for(q in f)null!=m&&q in m||("className"===q&&(q="class"),"o"!==q[0]||"n"!==q[1]||w(q)?"key"!==q&&a.dom.removeAttribute(q):S(a,q,void 0));
|
||||
null!=a.attrs&&null!=a.attrs.contenteditable?c(a):null!=b.text&&null!=a.text&&""!==a.text?b.text.toString()!==a.text.toString()&&(b.dom.firstChild.nodeValue=a.text):(null!=b.text&&(b.children=[z("#",void 0,void 0,b.text,void 0,b.dom.firstChild)]),null!=a.text&&(a.children=[z("#",void 0,void 0,a.text,void 0,void 0)]),h(p,b.children,a.children,d,null,g))}else{a.instance=z.normalize(e.call(a.state.view,a));if(a.instance===a)throw Error("A view cannot return the vnode it received as argument");null!=
|
||||
a.attrs&&N(a.attrs,a,d);N(a.state,a,d);null!=a.instance?(null==b.instance?v(p,a.instance,d,g,f):n(p,b.instance,a.instance,d,f,g),a.dom=a.instance.dom,a.domSize=a.instance.domSize):null!=b.instance?(E(b.instance),a.dom=void 0,a.domSize=0):(a.dom=b.dom,a.domSize=b.domSize)}}else E(b),v(p,a,d,g,f)}function t(a){var b=a.domSize;if(null!=b||null==a.dom){var c=A.createDocumentFragment();if(0<b){for(a=a.dom;--b;)c.appendChild(a.nextSibling);c.insertBefore(a,c.firstChild)}return c}return a.dom}function g(a,
|
||||
b,c){for(;b<a.length;b++)if(null!=a[b]&&null!=a[b].dom)return a[b].dom;return c}function C(a,b,c){null!=c?a.insertBefore(b,c):a.appendChild(b)}function c(a){var b=a.children;if(null!=b&&1===b.length&&"<"===b[0].tag)b=b[0].children,a.dom.innerHTML!==b&&(a.dom.innerHTML=b);else if(null!=a.text||null!=b&&0!==b.length)throw Error("Child node of a contenteditable must be trusted");}function D(a,b,c){for(;b<c;b++){var d=a[b];null!=d&&E(d)}}function E(a){function b(){if(++p===c&&(d(a,f),k(a),a.dom)){var b=
|
||||
a.domSize||1;if(1<b)for(var e=a.dom;--b;){var g=e.nextSibling,m=g.parentNode;null!=m&&m.removeChild(g)}b=a.dom;e=b.parentNode;null!=e&&e.removeChild(b)}}var c=1,p=0,f=a.state;if(a.attrs&&"function"===typeof a.attrs.onbeforeremove){var g=e.call(a.attrs.onbeforeremove,a);null!=g&&"function"===typeof g.then&&(c++,g.then(b,b))}"string"!==typeof a.tag&&"function"===typeof a.state.onbeforeremove&&(g=e.call(a.state.onbeforeremove,a),null!=g&&"function"===typeof g.then&&(c++,g.then(b,b)));b()}function k(a){a.attrs&&
|
||||
"function"===typeof a.attrs.onremove&&e.call(a.attrs.onremove,a);if("string"!==typeof a.tag)"function"===typeof a.state.onremove&&e.call(a.state.onremove,a),null!=a.instance&&k(a.instance);else if(a=a.children,Array.isArray(a))for(var b=0;b<a.length;b++){var c=a[b];null!=c&&k(c)}}function G(a,b,c,d,e){if("key"!==b&&"is"!==b&&!w(b)){if("o"===b[0]&&"n"===b[1])return S(a,b,d);if("undefined"===typeof d&&"value"===b&&c!==d)a.dom.value="";else if((c!==d||"value"===b||"checked"===b||"selectedIndex"===b||
|
||||
"selected"===b&&a.dom===A.activeElement||"option"===a.tag&&a.dom.parentNode===A.activeElement||"object"===typeof d)&&void 0!==d){var f=a.dom;if("xlink:"===b.slice(0,6))f.setAttributeNS("http://www.w3.org/1999/xlink",b,d);else if("style"===b)if(a=c,null!=a&&null!=d&&"object"===typeof a&&"object"===typeof d&&d!==a){for(var g in d)d[g]!==a[g]&&(f.style[g]=d[g]);for(g in a)g in d||(f.style[g]="")}else if(a===d&&(f.style.cssText="",a=null),null==d)f.style.cssText="";else if("string"===typeof d)f.style.cssText=
|
||||
d;else for(g in"string"===typeof a&&(f.style.cssText=""),d)f.style[g]=d[g];else if(b in f&&"href"!==b&&"list"!==b&&"form"!==b&&"width"!==b&&"height"!==b&&void 0===e&&!(a.attrs.is||-1<a.tag.indexOf("-"))){if("value"===b){g=""+d;if(("input"===a.tag||"textarea"===a.tag)&&a.dom.value===g&&a.dom===A.activeElement)return;if("select"===a.tag)if(null===d){if(-1===a.dom.selectedIndex&&a.dom===A.activeElement)return}else if(null!==c&&a.dom.value===g&&a.dom===A.activeElement)return;if("option"===a.tag&&null!=
|
||||
c&&a.dom.value===g)return}"input"===a.tag&&"type"===b?f.setAttribute(b,d):f[b]=d}else"boolean"===typeof d?d?f.setAttribute(b,""):f.removeAttribute(b):f.setAttribute("className"===b?"class":b,d)}}}function w(a){return"oninit"===a||"oncreate"===a||"onupdate"===a||"onremove"===a||"onbeforeremove"===a||"onbeforeupdate"===a}function L(){}function S(a,b,c){null!=a.events?a.events[b]!==c&&(null==c||"function"!==typeof c&&"object"!==typeof c?(null!=a.events[b]&&a.dom.removeEventListener(b.slice(2),a.events,
|
||||
!1),a.events[b]=void 0):(null==a.events[b]&&a.dom.addEventListener(b.slice(2),a.events,!1),a.events[b]=c)):null==c||"function"!==typeof c&&"object"!==typeof c||(a.events=new L,a.dom.addEventListener(b.slice(2),a.events,!1),a.events[b]=c)}function M(a,b,c){"function"===typeof a.oninit&&e.call(a.oninit,b);"function"===typeof a.oncreate&&c.push(e.bind(a.oncreate,b))}function N(a,b,c){"function"===typeof a.onupdate&&c.push(e.bind(a.onupdate,b))}var A=a.document;A.createDocumentFragment();var T={svg:"http://www.w3.org/2000/svg",
|
||||
math:"http://www.w3.org/1998/Math/MathML"},H,I={caption:"table",thead:"table",tbody:"table",tfoot:"table",tr:"tbody",th:"tr",td:"tr",colgroup:"table",col:"colgroup"};L.prototype=Object.create(null);L.prototype.handleEvent=function(a){var b=this["on"+a.type];"function"===typeof b?b.call(a.target,a):"function"===typeof b.handleEvent&&b.handleEvent(a);"function"===typeof H&&H.call(a.target,a)};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=A.activeElement,e=a.namespaceURI;null==a.vnodes&&(a.textContent="");Array.isArray(b)||(b=[b]);h(a,a.vnodes,z.normalizeChildren(b),c,null,"http://www.w3.org/1999/xhtml"===e?void 0:e);a.vnodes=b;null!=d&&A.activeElement!==d&&d.focus();for(d=0;d<c.length;d++)c[d]()},setEventCallback:function(a){return H=a}}},J=function(a,d){function e(a){a=l.indexOf(a);-1<a&&l.splice(a,2)}function f(){if(h)throw Error("Nested m.redraw.sync() call");h=!0;for(var a=1;a<l.length;a+=2)try{l[a]()}catch(g){"undefined"!==
|
||||
typeof console&&console.error(g)}h=!1}var k=U(a);k.setEventCallback(function(a){!1===a.redraw?a.redraw=void 0:n()});var l=[],h=!1,n=(d||W)(f);n.sync=f;return{subscribe:function(a,d){e(a);l.push(a,d)},unsubscribe:e,redraw:n,render:k.render}}(window);O.setCompletionCallback(J.redraw);w.mount=function(a){return function(d,e){if(null===e)a.render(d,[]),a.unsubscribe(d);else{if(null==e.view&&"function"!==typeof e)throw Error("m.mount(element, component) expects a component, not a vnode");var f=function(){a.render(d,
|
||||
z(e))};a.subscribe(d,f);f()}}}(J);var aa=k,P=function(a){if(""===a||null==a)return{};"?"===a.charAt(0)&&(a=a.slice(1));a=a.split("&");for(var d={},e={},f=0;f<a.length;f++){var k=a[f].split("="),l=decodeURIComponent(k[0]);k=2===k.length?decodeURIComponent(k[1]):"";"true"===k?k=!0:"false"===k&&(k=!1);var h=l.split(/\]\[?|\[/),n=d;-1<l.indexOf("[")&&h.pop();for(var t=0;t<h.length;t++){l=h[t];var g=h[t+1];g=""==g||!isNaN(parseInt(g,10));var C=t===h.length-1;""===l&&(l=h.slice(0,t).join(),null==e[l]&&
|
||||
(e[l]=0),l=e[l]++);null==n[l]&&(n[l]=C?k:g?[]:{});n=n[l]}}return d},ba=function(a){function d(d){var e=a.location[d].replace(/(?:%[a-f89][a-f0-9])+/gim,decodeURIComponent);"pathname"===d&&"/"!==e[0]&&(e="/"+e);return e}function e(a){return function(){null==h&&(h=l(function(){h=null;a()}))}}function f(a,d,e){var c=a.indexOf("?"),f=a.indexOf("#"),g=-1<c?c:-1<f?f:a.length;if(-1<c){c=P(a.slice(c+1,-1<f?f:a.length));for(var h in c)d[h]=c[h]}if(-1<f)for(h in d=P(a.slice(f+1)),d)e[h]=d[h];return a.slice(0,
|
||||
g)}var k="function"===typeof a.history.pushState,l="function"===typeof setImmediate?setImmediate:setTimeout,h,n={prefix:"#!",getPath:function(){switch(n.prefix.charAt(0)){case "#":return d("hash").slice(n.prefix.length);case "?":return d("search").slice(n.prefix.length)+d("hash");default:return d("pathname").slice(n.prefix.length)+d("search")+d("hash")}},setPath:function(d,e,h){var c={},g={};d=f(d,c,g);if(null!=e){for(var l in e)c[l]=e[l];d=d.replace(/:([^\/]+)/g,function(a,d){delete c[d];return e[d]})}(l=
|
||||
I(c))&&(d+="?"+l);(g=I(g))&&(d+="#"+g);k?(g=h?h.state:null,l=h?h.title:null,a.onpopstate(),h&&h.replace?a.history.replaceState(g,l,n.prefix+d):a.history.pushState(g,l,n.prefix+d)):a.location.href=n.prefix+d},defineRoutes:function(d,g,h){function c(){var c=n.getPath(),e={},k=f(c,e,e),l=a.history.state;if(null!=l)for(var t in l)e[t]=l[t];for(var v in d)if(l=new RegExp("^"+v.replace(/:[^\/]+?\.{3}/g,"(.*?)").replace(/:[^\/]+/g,"([^\\/]+)")+"/?$"),l.test(k)){k.replace(l,function(){for(var a=v.match(/:[^\/]+/g)||
|
||||
[],f=[].slice.call(arguments,1,-2),h=0;h<a.length;h++)e[a[h].replace(/:|\./g,"")]=decodeURIComponent(f[h]);g(d[v],e,c,v)});return}h(c,e)}k?a.onpopstate=e(c):"#"===n.prefix.charAt(0)&&(a.onhashchange=c);c()}};return n};w.route=function(a,d){var e=ba(a),f=function(a){return a},k,l,h,n,t,g=function(a,g,v){function c(){null!=k&&d.render(a,k(z(l,h.key,h)))}if(null==a)throw Error("Ensure the DOM element that was passed to `m.route` is not undefined");var w=function(){c();w=d.redraw};d.subscribe(a,c);var E=
|
||||
function(a){if(a!==g)e.setPath(g,null,{replace:!0});else throw Error("Could not resolve default route "+g);};e.defineRoutes(v,function(a,c,d){var e=t=function(a,g){e===t&&(l=null==g||"function"!==typeof g.view&&"function"!==typeof g?"div":g,h=c,n=d,t=null,k=(a.render||f).bind(a),w())};a.view||"function"===typeof a?e({},a):a.onmatch?aa.resolve(a.onmatch(c,d)).then(function(c){e(a,c)},E):e(a,"div")},E)};g.set=function(a,d,f){null!=t&&(f=f||{},f.replace=!0);t=null;e.setPath(a,d,f)};g.get=function(){return n};
|
||||
g.prefix=function(a){e.prefix=a};var w=function(a,d){d.dom.setAttribute("href",e.prefix+d.attrs.href);d.dom.onclick=function(c){c.ctrlKey||c.metaKey||c.shiftKey||2===c.which||(c.preventDefault(),c.redraw=!1,c=this.getAttribute("href"),0===c.indexOf(e.prefix)&&(c=c.slice(e.prefix.length)),g.set(c,void 0,a))}};g.link=function(a){return null==a.tag?w.bind(w,a):w({},a)};g.param=function(a){return"undefined"!==typeof h&&"undefined"!==typeof a?h[a]:h};return g}(window,J);w.withAttr=function(a,d,e){return function(f){d.call(e||
|
||||
this,a in f.currentTarget?f.currentTarget[a]:f.currentTarget.getAttribute(a))}};var ca=U(window);w.render=ca.render;w.redraw=J.redraw;w.request=O.request;w.jsonp=O.jsonp;w.parseQueryString=P;w.buildQueryString=I;w.version="1.1.3";w.vnode=z;w.PromisePolyfill=k;"undefined"!==typeof module?module.exports=w:window.m=w})();
|
||||
(function(){function z(a,d,e,g,q,k){return{tag:a,key:d,attrs:e,children:g,text:q,dom:k,domSize:void 0,state:void 0,events:void 0,instance:void 0}}function Q(a){for(var d in a)if(I.call(a,d))return!1;return!0}function w(a){if(null==a||"string"!==typeof a&&"function"!==typeof a&&"function"!==typeof a.view)throw Error("The selector must be either a string or a component.");var d=arguments[1],e=2;if(null==d)d={};else if("object"!==typeof d||null!=d.tag||Array.isArray(d))d={},e=1;if(arguments.length===
|
||||
e+1){var g=arguments[e];Array.isArray(g)||(g=[g])}else for(g=[];e<arguments.length;)g.push(arguments[e++]);if("string"===typeof a){if(!(e=R[a])){for(var q="div",k=[],h={};e=W.exec(a);){var n=e[1],m=e[2];""===n&&""!==m?q=m:"#"===n?h.id=m:"."===n?k.push(m):"["===e[3][0]&&((n=e[6])&&(n=n.replace(/\\(["'])/g,"$1").replace(/\\\\/g,"\\")),"class"===e[4]?k.push(n):h[e[4]]=""===n?n:n||!0)}0<k.length&&(h.className=k.join(" "));e=R[a]={tag:q,attrs:h}}g=z.normalizeChildren(g);q=!1;var l,C;k=d.className||d["class"];
|
||||
if(!Q(e.attrs)&&!Q(d)){h={};for(var c in d)I.call(d,c)&&(h[c]=d[c]);d=h}for(c in e.attrs)I.call(e.attrs,c)&&(d[c]=e.attrs[c]);void 0!==k&&(void 0!==d["class"]&&(d["class"]=void 0,d.className=k),null!=e.attrs.className&&(d.className=e.attrs.className+" "+k));for(c in d)if(I.call(d,c)&&"key"!==c){q=!0;break}Array.isArray(g)&&1===g.length&&null!=g[0]&&"#"===g[0].tag?C=g[0].children:l=g;return z(e.tag,d.key,q?d:void 0,l,C)}return z(a,d.key,d,g)}function X(a){var d=0,e=null,g="function"===typeof requestAnimationFrame?
|
||||
requestAnimationFrame:setTimeout;return function(){var q=Date.now()-d;null===e&&(e=g(function(){e=null;a();d=Date.now()},16-q))}}z.normalize=function(a){return Array.isArray(a)?z("[",void 0,void 0,z.normalizeChildren(a),void 0,void 0):null!=a&&"object"!==typeof a?z("#",void 0,void 0,!1===a?"":a,void 0,void 0):a};z.normalizeChildren=function(a){for(var d=[],e=0;e<a.length;e++)d[e]=z.normalize(a[e]);return d};var W=/(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g,R={},
|
||||
I={}.hasOwnProperty;w.trust=function(a){null==a&&(a="");return z("<",void 0,void 0,a,void 0,void 0)};w.fragment=function(a,d){return z("[",a.key,a,z.normalizeChildren(d),void 0,void 0)};var p=function(a){function d(a,c){return function K(d){var E;try{if(!c||null==d||"object"!==typeof d&&"function"!==typeof d||"function"!==typeof(E=d.then))l(function(){c||0!==a.length||console.error("Possible unhandled promise rejection:",d);for(var e=0;e<a.length;e++)a[e](d);q.length=0;k.length=0;m.state=c;m.retry=
|
||||
function(){K(d)}});else{if(d===g)throw new TypeError("Promise can't be resolved w/ itself");e(E.bind(d))}}catch(Y){n(Y)}}}function e(a){function c(c){return function(a){0<d++||c(a)}}var d=0,e=c(n);try{a(c(h),e)}catch(K){e(K)}}if(!(this instanceof p))throw Error("Promise must be called with `new`");if("function"!==typeof a)throw new TypeError("executor must be a function");var g=this,q=[],k=[],h=d(q,!0),n=d(k,!1),m=g._instance={resolvers:q,rejectors:k},l="function"===typeof setImmediate?setImmediate:
|
||||
setTimeout;e(a)};p.prototype.then=function(a,d){function e(a,d,e,h){d.push(function(c){if("function"!==typeof a)e(c);else try{q(a(c))}catch(x){k&&k(x)}});"function"===typeof g.retry&&h===g.state&&g.retry()}var g=this._instance,q,k,h=new p(function(a,d){q=a;k=d});e(a,g.resolvers,q,!0);e(d,g.rejectors,k,!1);return h};p.prototype["catch"]=function(a){return this.then(null,a)};p.prototype["finally"]=function(a){return this.then(function(d){return p.resolve(a()).then(function(){return d})},function(d){return p.resolve(a()).then(function(){return p.reject(d)})})};
|
||||
p.resolve=function(a){return a instanceof p?a:new p(function(d){d(a)})};p.reject=function(a){return new p(function(d,e){e(a)})};p.all=function(a){return new p(function(d,e){var g=a.length,q=0,k=[];if(0===a.length)d([]);else for(var h=0;h<a.length;h++)(function(n){function m(a){q++;k[n]=a;q===g&&d(k)}null==a[n]||"object"!==typeof a[n]&&"function"!==typeof a[n]||"function"!==typeof a[n].then?m(a[n]):a[n].then(m,e)})(h)})};p.race=function(a){return new p(function(d,e){for(var g=0;g<a.length;g++)a[g].then(d,
|
||||
e)})};"undefined"!==typeof window?("undefined"===typeof window.Promise?window.Promise=p:window.Promise.prototype["finally"]||(window.Promise.prototype["finally"]=p.prototype["finally"]),p=window.Promise):"undefined"!==typeof global&&("undefined"===typeof global.Promise?global.Promise=p:global.Promise.prototype["finally"]||(global.Promise.prototype["finally"]=p.prototype["finally"]),p=global.Promise);var H=function(a){function d(a,g){if(Array.isArray(g))for(var h=0;h<g.length;h++)d(a+"["+h+"]",g[h]);
|
||||
else if("[object Object]"===Object.prototype.toString.call(g))for(h in g)d(a+"["+h+"]",g[h]);else e.push(encodeURIComponent(a)+(null!=g&&""!==g?"="+encodeURIComponent(g):""))}if("[object Object]"!==Object.prototype.toString.call(a))return"";var e=[],g;for(g in a)d(g,a[g]);return e.join("&")},Z=/^file:\/\//i,O=function(a,d){function e(){function c(){0===--a&&"function"===typeof C&&C()}var a=0;return function F(d){var e=d.then;d.then=function(){a++;var g=e.apply(d,arguments);g.then(c,function(d){c();
|
||||
if(0===a)throw d;});return F(g)};return d}}function g(c,a){if("string"===typeof c){var d=c;c=a||{};null==c.url&&(c.url=d)}return c}function q(c,a){if(null==a)return c;for(var d=c.match(/:[^\/]+/gi)||[],e=0;e<d.length;e++){var g=d[e].slice(1);null!=a[g]&&(c=c.replace(d[e],a[g]))}return c}function k(c,a){var d=H(a);if(""!==d){var e=0>c.indexOf("?")?"?":"&";c+=e+d}return c}function h(c){try{return""!==c?JSON.parse(c):null}catch(x){throw Error(c);}}function n(c){return c.responseText}function m(c,a){if("function"===
|
||||
typeof c)if(Array.isArray(a))for(var d=0;d<a.length;d++)a[d]=new c(a[d]);else return new c(a);return a}var l=0,C;return{request:function(c,l){var E=e();c=g(c,l);var x=new d(function(d,e){null==c.method&&(c.method="GET");c.method=c.method.toUpperCase();var g="GET"===c.method||"TRACE"===c.method?!1:"boolean"===typeof c.useBody?c.useBody:!0;"function"!==typeof c.serialize&&(c.serialize="undefined"!==typeof FormData&&c.data instanceof FormData?function(c){return c}:JSON.stringify);"function"!==typeof c.deserialize&&
|
||||
(c.deserialize=h);"function"!==typeof c.extract&&(c.extract=n);c.url=q(c.url,c.data);g?c.data=c.serialize(c.data):c.url=k(c.url,c.data);var l=new a.XMLHttpRequest,E=!1,x=l.abort;l.abort=function(){E=!0;x.call(l)};l.open(c.method,c.url,"boolean"===typeof c.async?c.async:!0,"string"===typeof c.user?c.user:void 0,"string"===typeof c.password?c.password:void 0);c.serialize!==JSON.stringify||!g||c.headers&&c.headers.hasOwnProperty("Content-Type")||l.setRequestHeader("Content-Type","application/json; charset=utf-8");
|
||||
c.deserialize!==h||c.headers&&c.headers.hasOwnProperty("Accept")||l.setRequestHeader("Accept","application/json, text/*");c.withCredentials&&(l.withCredentials=c.withCredentials);c.timeout&&(l.timeout=c.timeout);for(var C in c.headers)({}).hasOwnProperty.call(c.headers,C)&&l.setRequestHeader(C,c.headers[C]);"function"===typeof c.config&&(l=c.config(l,c)||l);l.onreadystatechange=function(){if(!E&&4===l.readyState)try{var a=c.extract!==n?c.extract(l,c):c.deserialize(c.extract(l,c));if(c.extract!==n||
|
||||
200<=l.status&&300>l.status||304===l.status||Z.test(c.url))d(m(c.type,a));else{var g=Error(l.responseText);g.code=l.status;g.response=a;e(g)}}catch(aa){e(aa)}};g&&null!=c.data?l.send(c.data):l.send()});return!0===c.background?x:E(x)},jsonp:function(c,n){var h=e();c=g(c,n);var x=new d(function(d,e){var g=c.callbackName||"_mithril_"+Math.round(1E16*Math.random())+"_"+l++,n=a.document.createElement("script");a[g]=function(e){n.parentNode.removeChild(n);d(m(c.type,e));delete a[g]};n.onerror=function(){n.parentNode.removeChild(n);
|
||||
e(Error("JSONP request failed"));delete a[g]};null==c.data&&(c.data={});c.url=q(c.url,c.data);c.data[c.callbackKey||"callback"]=g;n.src=k(c.url,c.data);a.document.documentElement.appendChild(n)});return!0===c.background?x:h(x)},setCompletionCallback:function(c){C=c}}}(window,p),V=function(a){function d(t,b){if(t.state!==b)throw Error("`vnode.state` must not be modified");}function e(t){var b=t.state;try{return this.apply(b,arguments)}finally{d(t,b)}}function g(t,b,f,c,a,d,e){for(;f<c;f++){var g=b[f];
|
||||
null!=g&&q(t,g,a,e,d)}}function q(t,b,f,a,d){var m=b.tag;if("string"===typeof m)switch(b.state={},null!=b.attrs&&N(b.attrs,b,f),m){case "#":b.dom=D.createTextNode(b.children);C(t,b.dom,d);break;case "<":k(t,b,a,d);break;case "[":m=D.createDocumentFragment();if(null!=b.children){var l=b.children;g(m,l,0,l.length,f,null,a)}b.dom=m.firstChild;b.domSize=m.childNodes.length;C(t,m,d);break;default:var n=b.tag,v=(m=b.attrs)&&m.is;n=(a=b.attrs&&b.attrs.xmlns||I[b.tag]||a)?v?D.createElementNS(a,n,{is:v}):
|
||||
D.createElementNS(a,n):v?D.createElement(n,{is:v}):D.createElement(n);b.dom=n;if(null!=m)for(l in v=a,m)F(b,l,null,m[l],v);C(t,n,d);if(null!=m&&null!=m.contenteditable)c(b);else if(null!=b.text&&(""!==b.text?n.textContent=b.text:b.children=[z("#",void 0,void 0,b.text,void 0,void 0)]),null!=b.children&&(t=b.children,g(n,t,0,t.length,f,null,a),"select"===b.tag&&null!=m)){if("value"in m)if(null===m.value)-1!==b.dom.selectedIndex&&(b.dom.value=null);else if(f=""+m.value,b.dom.value!==f||-1===b.dom.selectedIndex)b.dom.value=
|
||||
f;"selectedIndex"in m&&F(b,"selectedIndex",null,m.selectedIndex,void 0)}}else{a:{if("function"===typeof b.tag.view){b.state=Object.create(b.tag);m=b.state.view;if(null!=m.$$reentrantLock$$)break a;m.$$reentrantLock$$=!0}else{b.state=void 0;m=b.tag;if(null!=m.$$reentrantLock$$)break a;m.$$reentrantLock$$=!0;b.state=null!=b.tag.prototype&&"function"===typeof b.tag.prototype.view?new b.tag(b):b.tag(b)}null!=b.attrs&&N(b.attrs,b,f);N(b.state,b,f);b.instance=z.normalize(e.call(b.state.view,b));if(b.instance===
|
||||
b)throw Error("A view cannot return the vnode it received as argument");m.$$reentrantLock$$=null}null!=b.instance?(q(t,b.instance,f,a,d),b.dom=b.instance.dom,b.domSize=null!=b.dom?b.instance.domSize:0):b.domSize=0}}function k(t,b,f,c){var a=b.children.match(/^\s*?<(\w+)/im)||[];a=D.createElement(J[a[1]]||"div");"http://www.w3.org/2000/svg"===f?(a.innerHTML='<svg xmlns="http://www.w3.org/2000/svg">'+b.children+"</svg>",a=a.firstChild):a.innerHTML=b.children;b.dom=a.firstChild;b.domSize=a.childNodes.length;
|
||||
for(b=D.createDocumentFragment();f=a.firstChild;)b.appendChild(f);C(t,b,c)}function h(t,b,f,c,a,d){if(b!==f&&(null!=b||null!=f))if(null==b||0===b.length)g(t,f,0,f.length,c,a,d);else if(null==f||0===f.length)x(b,0,b.length);else{for(var e=0,h=0,v=null,k=null;h<b.length;h++)if(null!=b[h]){v=null!=b[h].key;break}for(;e<f.length;e++)if(null!=f[e]){k=null!=f[e].key;break}if(null!==k||null!=v)if(v!==k)x(b,h,b.length),g(t,f,e,f.length,c,a,d);else if(k){k=b.length-1;v=f.length-1;for(var p,r,u,A,y,B;k>=h&&
|
||||
v>=e;)if(A=b[k],y=f[v],null==A)k--;else if(null==y)v--;else if(A.key===y.key)A!==y&&n(t,A,y,c,a,d),null!=y.dom&&(a=y.dom),k--,v--;else break;for(;k>=h&&v>=e;)if(r=b[h],u=f[e],null==r)h++;else if(null==u)e++;else if(r.key===u.key)h++,e++,r!==u&&n(t,r,u,c,l(b,h,a),d);else break;for(;k>=h&&v>=e;){if(null==r)h++;else if(null==u)e++;else if(null==A)k--;else if(null==y)v--;else if(e===v)break;else{if(r.key!==y.key||A.key!==u.key)break;B=l(b,h,a);C(t,m(A),B);A!==u&&n(t,A,u,c,B,d);++e<=--v&&C(t,m(r),a);r!==
|
||||
y&&n(t,r,y,c,a,d);null!=y.dom&&(a=y.dom);h++;k--}A=b[k];y=f[v];r=b[h];u=f[e]}for(;k>=h&&v>=e;){if(null==A)k--;else if(null==y)v--;else if(A.key===y.key)A!==y&&n(t,A,y,c,a,d),null!=y.dom&&(a=y.dom),k--,v--;else break;A=b[k];y=f[v]}if(e>v)x(b,h,k+1);else if(h>k)g(t,f,e,v+1,c,a,d);else{u=a;A=v-e+1;r=Array(A);var G=2147483647,z=0;for(B=0;B<A;B++)r[B]=-1;for(B=v;B>=e;B--){if(null==p){p=b;A=h;y=k+1;for(var w={};A<y;A++){var F=p[A];null!=F&&(F=F.key,null!=F&&(w[F]=A))}p=w}y=f[B];null!=y&&(w=p[y.key],null!=
|
||||
w&&(G=w<G?w:-1,r[B-e]=w,A=b[w],b[w]=null,A!==y&&n(t,A,y,c,a,d),null!=y.dom&&(a=y.dom),z++))}a=u;z!==k-h+1&&x(b,h,k+1);if(0===z)g(t,f,e,v+1,c,a,d);else if(-1===G){h=r.slice();b=[];b.push(0);k=0;for(B=r.length;k<B;++k)if(-1!==r[k])if(u=b[b.length-1],r[u]<r[k])h[k]=u,b.push(k);else{u=0;for(G=b.length-1;u<G;)z=(u+G)/2|0,r[b[z]]<r[k]?u=z+1:G=z;r[k]<r[b[u]]&&(0<u&&(h[k]=b[u-1]),b[u]=k)}u=b.length;for(G=b[u-1];0<u--;)b[u]=G,G=h[G];h=b.length-1;for(B=v;B>=e;B--)u=f[B],-1===r[B-e]?q(t,u,c,d,a):b[h]===B-e?
|
||||
h--:C(t,m(u),a),null!=u.dom&&(a=f[B].dom)}else for(B=v;B>=e;B--)u=f[B],-1===r[B-e]&&q(t,u,c,d,a),null!=u.dom&&(a=f[B].dom)}}else{v=b.length<f.length?b.length:f.length;for(e=e<h?e:h;e<v;e++)r=b[e],u=f[e],r===u||null==r&&null==u||(null==r?q(t,u,c,d,l(b,e+1,a)):null==u?E(r):n(t,r,u,c,l(b,e+1,a),d));b.length>v&&x(b,e,b.length);f.length>v&&g(t,f,e,f.length,c,a,d)}}}function n(a,b,f,d,g,l){var t=b.tag;if(t===f.tag){f.state=b.state;f.events=b.events;var v;var x;null!=f.attrs&&"function"===typeof f.attrs.onbeforeupdate&&
|
||||
(v=e.call(f.attrs.onbeforeupdate,f,b));"string"!==typeof f.tag&&"function"===typeof f.state.onbeforeupdate&&(x=e.call(f.state.onbeforeupdate,f,b));void 0===v&&void 0===x||v||x?v=!1:(f.dom=b.dom,f.domSize=b.domSize,f.instance=b.instance,v=!0);if(!v)if("string"===typeof t)switch(null!=f.attrs&&L(f.attrs,f,d),t){case "#":b.children.toString()!==f.children.toString()&&(b.dom.nodeValue=f.children);f.dom=b.dom;break;case "<":b.children!==f.children?(m(b),k(a,f,l,g)):(f.dom=b.dom,f.domSize=b.domSize);break;
|
||||
case "[":h(a,b.children,f.children,d,g,l);b=0;d=f.children;f.dom=null;if(null!=d){for(var p=0;p<d.length;p++)a=d[p],null!=a&&null!=a.dom&&(null==f.dom&&(f.dom=a.dom),b+=a.domSize||1);1!==b&&(f.domSize=b)}break;default:a=f.dom=b.dom;l=f.attrs&&f.attrs.xmlns||I[f.tag]||l;"textarea"===f.tag&&(null==f.attrs&&(f.attrs={}),null!=f.text&&(f.attrs.value=f.text,f.text=void 0));g=b.attrs;t=f.attrs;v=l;if(null!=t)for(p in t)F(f,p,g&&g[p],t[p],v);var C;if(null!=g)for(p in g)if(null!=(C=g[p])&&(null==t||null==
|
||||
t[p])){x=f;var r=p,u=v;"key"===r||"is"===r||null==C||w(r)||("o"!==r[0]||"n"!==r[1]||w(r)?"style"===r?T(x.dom,C,null):((u=!(r in x.dom)||S(r)||"className"===r||"option"===x.tag&&"value"===r||"input"===x.tag&&"type"===r||void 0!==u)||(u=(x.attrs||{}).is||-1<x.tag.indexOf("-")),u?(u=r.indexOf(":"),-1!==u&&(r=r.slice(u+1)),!1!==C&&x.dom.removeAttribute("className"===r?"class":r)):x.dom[r]=null):U(x,r,void 0))}null!=f.attrs&&null!=f.attrs.contenteditable?c(f):null!=b.text&&null!=f.text&&""!==f.text?b.text.toString()!==
|
||||
f.text.toString()&&(b.dom.firstChild.nodeValue=f.text):(null!=b.text&&(b.children=[z("#",void 0,void 0,b.text,void 0,b.dom.firstChild)]),null!=f.text&&(f.children=[z("#",void 0,void 0,f.text,void 0,void 0)]),h(a,b.children,f.children,d,null,l))}else{f.instance=z.normalize(e.call(f.state.view,f));if(f.instance===f)throw Error("A view cannot return the vnode it received as argument");null!=f.attrs&&L(f.attrs,f,d);L(f.state,f,d);null!=f.instance?(null==b.instance?q(a,f.instance,d,l,g):n(a,b.instance,
|
||||
f.instance,d,g,l),f.dom=f.instance.dom,f.domSize=f.instance.domSize):null!=b.instance?(E(b.instance),f.dom=void 0,f.domSize=0):(f.dom=b.dom,f.domSize=b.domSize)}}else E(b),q(a,f,d,l,g)}function m(a){var b=a.domSize;if(null!=b||null==a.dom){var c=D.createDocumentFragment();if(0<b){for(a=a.dom;--b;)c.appendChild(a.nextSibling);c.insertBefore(a,c.firstChild)}return c}return a.dom}function l(a,b,c){for(;b<a.length;b++)if(null!=a[b]&&null!=a[b].dom)return a[b].dom;return c}function C(a,b,c){null!=c?a.insertBefore(b,
|
||||
c):a.appendChild(b)}function c(a){var b=a.children;if(null!=b&&1===b.length&&"<"===b[0].tag)b=b[0].children,a.dom.innerHTML!==b&&(a.dom.innerHTML=b);else if(null!=a.text||null!=b&&0!==b.length)throw Error("Child node of a contenteditable must be trusted");}function x(a,b,c){for(;b<c;b++){var f=a[b];null!=f&&E(f)}}function E(a){function b(){if(++t===c&&(d(a,g),p(a),a.dom)){var b=a.domSize||1;if(1<b)for(var f=a.dom;--b;){var e=f.nextSibling,m=e.parentNode;null!=m&&m.removeChild(e)}b=a.dom;f=b.parentNode;
|
||||
null!=f&&f.removeChild(b)}}var c=1,t=0,g=a.state;if(a.attrs&&"function"===typeof a.attrs.onbeforeremove){var m=e.call(a.attrs.onbeforeremove,a);null!=m&&"function"===typeof m.then&&(c++,m.then(b,b))}"string"!==typeof a.tag&&"function"===typeof a.state.onbeforeremove&&(m=e.call(a.state.onbeforeremove,a),null!=m&&"function"===typeof m.then&&(c++,m.then(b,b)));b()}function p(a){a.attrs&&"function"===typeof a.attrs.onremove&&e.call(a.attrs.onremove,a);if("string"!==typeof a.tag)"function"===typeof a.state.onremove&&
|
||||
e.call(a.state.onremove,a),null!=a.instance&&p(a.instance);else if(a=a.children,Array.isArray(a))for(var b=0;b<a.length;b++){var c=a[b];null!=c&&p(c)}}function F(a,b,c,d,e){if("key"!==b&&"is"!==b&&null!=d&&!w(b)&&(c!==d||"value"===b||"checked"===b||"selectedIndex"===b||"selected"===b&&a.dom===D.activeElement||"option"===a.tag&&a.dom.parentNode===D.activeElement||"object"===typeof d)){if("o"===b[0]&&"n"===b[1])return U(a,b,d);if("xlink:"===b.slice(0,6))a.dom.setAttributeNS("http://www.w3.org/1999/xlink",
|
||||
b.slice(6),d);else if("style"===b)T(a.dom,c,d);else if(!(b in a.dom)||S(b)||void 0!==e||a.attrs.is||-1<a.tag.indexOf("-"))"boolean"===typeof d?d?a.dom.setAttribute(b,""):a.dom.removeAttribute(b):a.dom.setAttribute("className"===b?"class":b,d);else{if("value"===b&&(e=""+d,("input"===a.tag||"textarea"===a.tag)&&a.dom.value===e&&a.dom===D.activeElement||"select"===a.tag&&null!==c&&a.dom.value===e||"option"===a.tag&&null!==c&&a.dom.value===e))return;"input"===a.tag&&"type"===b?a.dom.setAttribute(b,d):
|
||||
a.dom[b]=d}}}function w(a){return"oninit"===a||"oncreate"===a||"onupdate"===a||"onremove"===a||"onbeforeremove"===a||"onbeforeupdate"===a}function S(a){return"href"===a||"list"===a||"form"===a||"width"===a||"height"===a}function T(a,b,c){if(null!=b&&null!=c&&"object"===typeof b&&"object"===typeof c&&c!==b){for(var d in c)c[d]!==b[d]&&(a.style[d]=c[d]);for(d in b)d in c||(a.style[d]="")}else if(b===c&&(a.style.cssText="",b=null),null==c)a.style.cssText="";else if("string"===typeof c)a.style.cssText=
|
||||
c;else for(d in"string"===typeof b&&(a.style.cssText=""),c)a.style[d]=c[d]}function M(){}function U(a,b,c){null!=a.events?a.events[b]!==c&&(null==c||"function"!==typeof c&&"object"!==typeof c?(null!=a.events[b]&&a.dom.removeEventListener(b.slice(2),a.events,!1),a.events[b]=void 0):(null==a.events[b]&&a.dom.addEventListener(b.slice(2),a.events,!1),a.events[b]=c)):null==c||"function"!==typeof c&&"object"!==typeof c||(a.events=new M,a.dom.addEventListener(b.slice(2),a.events,!1),a.events[b]=c)}function N(a,
|
||||
b,c){"function"===typeof a.oninit&&e.call(a.oninit,b);"function"===typeof a.oncreate&&c.push(e.bind(a.oncreate,b))}function L(a,b,c){"function"===typeof a.onupdate&&c.push(e.bind(a.onupdate,b))}var D=a.document;D.createDocumentFragment();var I={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"},H,J={caption:"table",thead:"table",tbody:"table",tfoot:"table",tr:"tbody",th:"tr",td:"tr",colgroup:"table",col:"colgroup"};M.prototype=Object.create(null);M.prototype.handleEvent=function(a){var b=
|
||||
this["on"+a.type];"function"===typeof b?b.call(a.target,a):"function"===typeof b.handleEvent&&b.handleEvent(a);"function"===typeof H&&H.call(a.target,a)};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,e=a.namespaceURI;null==a.vnodes&&(a.textContent="");Array.isArray(b)||(b=[b]);h(a,a.vnodes,z.normalizeChildren(b),c,null,"http://www.w3.org/1999/xhtml"===e?void 0:e);a.vnodes=b;null!=d&&D.activeElement!==
|
||||
d&&d.focus();for(d=0;d<c.length;d++)c[d]()},setEventCallback:function(a){return H=a}}},J=function(a,d){function e(a){a=k.indexOf(a);-1<a&&k.splice(a,2)}function g(){if(h)throw Error("Nested m.redraw.sync() call");h=!0;for(var a=1;a<k.length;a+=2)try{k[a]()}catch(l){"undefined"!==typeof console&&console.error(l)}h=!1}var q=V(a);q.setEventCallback(function(a){!1===a.redraw?a.redraw=void 0:n()});var k=[],h=!1,n=(d||X)(g);n.sync=g;return{subscribe:function(a,d){e(a);k.push(a,d)},unsubscribe:e,redraw:n,
|
||||
render:q.render}}(window);O.setCompletionCallback(J.redraw);w.mount=function(a){return function(d,e){if(null===e)a.render(d,[]),a.unsubscribe(d);else{if(null==e.view&&"function"!==typeof e)throw Error("m.mount(element, component) expects a component, not a vnode");var g=function(){a.render(d,z(e))};a.subscribe(d,g);g()}}}(J);var ba=p,P=function(a){if(""===a||null==a)return{};"?"===a.charAt(0)&&(a=a.slice(1));a=a.split("&");for(var d={},e={},g=0;g<a.length;g++){var q=a[g].split("="),k=decodeURIComponent(q[0]);
|
||||
q=2===q.length?decodeURIComponent(q[1]):"";"true"===q?q=!0:"false"===q&&(q=!1);var h=k.split(/\]\[?|\[/),n=d;-1<k.indexOf("[")&&h.pop();for(var m=0;m<h.length;m++){k=h[m];var l=h[m+1];l=""==l||!isNaN(parseInt(l,10));var p=m===h.length-1;""===k&&(k=h.slice(0,m).join(),null==e[k]&&(e[k]=0),k=e[k]++);null==n[k]&&(n[k]=p?q:l?[]:{});n=n[k]}}return d},ca=function(a){function d(d){var e=a.location[d].replace(/(?:%[a-f89][a-f0-9])+/gim,decodeURIComponent);"pathname"===d&&"/"!==e[0]&&(e="/"+e);return e}function e(a){return function(){null==
|
||||
h&&(h=k(function(){h=null;a()}))}}function g(a,d,e){var c=a.indexOf("?"),g=a.indexOf("#"),h=-1<c?c:-1<g?g:a.length;if(-1<c){c=P(a.slice(c+1,-1<g?g:a.length));for(var k in c)d[k]=c[k]}if(-1<g)for(k in d=P(a.slice(g+1)),d)e[k]=d[k];return a.slice(0,h)}var q="function"===typeof a.history.pushState,k="function"===typeof setImmediate?setImmediate:setTimeout,h,n={prefix:"#!",getPath:function(){switch(n.prefix.charAt(0)){case "#":return d("hash").slice(n.prefix.length);case "?":return d("search").slice(n.prefix.length)+
|
||||
d("hash");default:return d("pathname").slice(n.prefix.length)+d("search")+d("hash")}},setPath:function(d,e,k){var c={},h={};d=g(d,c,h);if(null!=e){for(var m in e)c[m]=e[m];d=d.replace(/:([^\/]+)/g,function(a,d){delete c[d];return e[d]})}(m=H(c))&&(d+="?"+m);(h=H(h))&&(d+="#"+h);q?(h=k?k.state:null,m=k?k.title:null,a.onpopstate(),k&&k.replace?a.history.replaceState(h,m,n.prefix+d):a.history.pushState(h,m,n.prefix+d)):a.location.href=n.prefix+d},defineRoutes:function(d,k,h){function c(){var c=n.getPath(),
|
||||
e={},m=g(c,e,e),l=a.history.state;if(null!=l)for(var q in l)e[q]=l[q];for(var p in d)if(l=new RegExp("^"+p.replace(/:[^\/]+?\.{3}/g,"(.*?)").replace(/:[^\/]+/g,"([^\\/]+)")+"/?$"),l.test(m)){m.replace(l,function(){for(var a=p.match(/:[^\/]+/g)||[],g=[].slice.call(arguments,1,-2),h=0;h<a.length;h++)e[a[h].replace(/:|\./g,"")]=decodeURIComponent(g[h]);k(d[p],e,c,p)});return}h(c,e)}q?a.onpopstate=e(c):"#"===n.prefix.charAt(0)&&(a.onhashchange=c);c()}};return n};w.route=function(a,d){var e=ca(a),g=function(a){return a},
|
||||
p,k,h,n,m,l=function(a,l,q){function c(){null!=p&&d.render(a,p(z(k,h.key,h)))}if(null==a)throw Error("Ensure the DOM element that was passed to `m.route` is not undefined");var x=function(){c();x=d.redraw};d.subscribe(a,c);var w=function(a){if(a!==l)e.setPath(l,null,{replace:!0});else throw Error("Could not resolve default route "+l);};e.defineRoutes(q,function(a,c,d){var e=m=function(a,l){e===m&&(k=null==l||"function"!==typeof l.view&&"function"!==typeof l?"div":l,h=c,n=d,m=null,p=(a.render||g).bind(a),
|
||||
x())};a.view||"function"===typeof a?e({},a):a.onmatch?ba.resolve(a.onmatch(c,d)).then(function(c){e(a,c)},w):e(a,"div")},w)};l.set=function(a,d,g){null!=m&&(g=g||{},g.replace=!0);m=null;e.setPath(a,d,g)};l.get=function(){return n};l.prefix=function(a){e.prefix=a};var w=function(a,d){d.dom.setAttribute("href",e.prefix+d.attrs.href);d.dom.onclick=function(c){c.ctrlKey||c.metaKey||c.shiftKey||2===c.which||(c.preventDefault(),c.redraw=!1,c=this.getAttribute("href"),0===c.indexOf(e.prefix)&&(c=c.slice(e.prefix.length)),
|
||||
l.set(c,void 0,a))}};l.link=function(a){return null==a.tag?w.bind(w,a):w({},a)};l.param=function(a){return"undefined"!==typeof h&&"undefined"!==typeof a?h[a]:h};return l}(window,J);w.withAttr=function(a,d,e){return function(g){d.call(e||this,a in g.currentTarget?g.currentTarget[a]:g.currentTarget.getAttribute(a))}};var da=V(window);w.render=da.render;w.redraw=J.redraw;w.request=O.request;w.jsonp=O.jsonp;w.parseQueryString=P;w.buildQueryString=H;w.version="1.1.3";w.vnode=z;w.PromisePolyfill=p;"undefined"!==
|
||||
typeof module?module.exports=w:window.m=w})();
|
||||
Loading…
Add table
Add a link
Reference in a new issue