(function(){'use strict';var q;{const a={},b={},d={},c=document.documentElement||document.body.parentNode,e="ontouchstart"in window,g=!e&&window.PointerEvent&&navigator.maxTouchPoints;let n;function u(k,h){h||(h=k.type);const l=k.target;let m=l;var f=l["_event_"+h];if(f)m=l["_root_"+h];else{for(;m!==c;){"click"===h&&n&&(f=m.getAttribute("tap"));f||(f=m.getAttribute(h));if(f){var p=f.indexOf(":");if(-1!==p){const D=f.substring(0,p);p=f.substring(p+1);f=0;for(m=m.parentElement;m!==c;){if(m.hasAttribute(p)){f=D;break}m=m.parentElement}}break}m=
m.parentElement}if(!f)return;l["_event_"+h]=f;l["_root_"+h]=m}h=b[f];f=d[f];h&&(!1!==f.cancel&&k.preventDefault(),h(m,k,l));!1!==f.stop&&k.stopPropagation()}w.route=w.prototype.g=function(k,h,l){b[k]=h;d[k]=l||{};return this};w.dispatch=function(k,h,l,m){b[k].call(this,h,l,m);return this};let t,r,x;if(e||g){function k(f){l(f,f.touches)}function h(f){let p=t,D=r;l(f,f.changedTouches);50>Math.abs(t-p)&&50>Math.abs(r-D)&&u.call(this,f,"tap")}function l(f,p){p&&(f=p[0]);t=f.clientX;r=f.clientY}const m=
{passive:!1,capture:!0};x=function(f){v(f,g?"pointerdown":"touchstart",k,m);v(f,g?"pointerup":"touchend",h,m)}}w.listen=w.prototype.D=function(k,h){a[k]||(v(1,k,u,h),a[k]=1);return this};w.unlisten=function(k,h){a[k]&&(v(0,k,u,h),a[k]=0);return this};function v(k,h,l,m){if("tap"===h){if(e||g){x(k);return}n=!0;h="click"}window[(k?"add":"remove")+"EventListener"](h,l,m||!1)}};let y={};const z={};function w(a,b,d){if(!(this instanceof w))return new w(a,b,d);a.nodeType||(d=b,b=a,a=null);a?this.mount(a):(this.f=this.b=null,this.length=0);a=b;"string"===typeof a?a=z[a]:(d||!a||a.n||(d=a,a=null),a?a.n&&A(a):a=z[this.l]);d||(d=this.C||{});this.F=!1!==d.reuse;this.state=d.state||y;this.cache=!1!==d.cache;this.C=d;b=a.n;this.l!==b&&(this.l=b,this.o=a.d,this.A=this.m=null,this.u=!1!==d.prefetch&&B(this,a),C(this))}var A=w.register=function(a,b){b||(b=a,a=b.n);z[a]=b;return w};
w.prototype.mount=function(a){if(this.f!==a){this.f=a;C(this);var b;if(!(b=a._dom)){{b=a.children;let d=b.length;const c=Array(d);for(let e=0,g;e<d;e++)g=b[e],c[e]=g;b=c}b=a._dom=b}this.b=b;this.length=this.b.length}return this};w.prototype.index=function(a){return this.b.indexOf(a)};var F=w.once=function(a,b,d,c,e){const g=new w(a,b);"function"===typeof c&&(e=c,c=null);if(e){const n=e;e=function(){E(g);n()}}g.render(d,c,e);e||E(g);return w};
function C(a){if(a.f){const b=a.f._tpl;b!==a.l&&(a.f._tpl=a.l,b&&a.remove(0,a.length))}}q=w.prototype;q.create=function(a,b,d){let c,e;c=e=this.u||(this.u=B(this,z[this.l]));this.apply(c,a,b,d);e&&(c=c.cloneNode(!0));return c};q.apply=function(a,b,d,c){if(!this.o)return this.A(a._path||G(this,a),a._cache||(a._cache={}),b,c,d),this};
q.render=function(a,b){let d=this.length;if(!a&&this.o)return this.b[0]||this.add(),this;let c=a.length;if("undefined"===typeof c)a=[a],c=1;else if(!c)return this.remove(0,d);this.F||(this.remove(0,d,c),d=0);let e=d<c?d:c,g=0;if(g<e)for(;g<e;g++)this.update(this.b[g],a[g],b,g);if(g<c)for(;g<c;g++)this.add(a[g],b);else c<d&&this.remove(c,d-c);return this};
q.add=function(a,b,d,c){if(!c)if("number"===typeof b){d=b;b=null;var e=1}else if(d||0===d)e=1;d=c||e?d:this.length;a=this.create(a,b,d);if(e){this.f.insertBefore(a,this.b[d]);c=this.b;e=this.length-1;b=a||c[e];a&&e++;if(e<d)for(;e<d;e++)c[e]=c[e+1];else for(;e>d;e--)c[e]=c[e-1];c[d]=b;this.length++}else c?this.f.replaceChild(a,c):(this.f.appendChild(a),this.length++),this.b[d]=a;return this};q.clear=function(){this.length&&this.remove(0,this.length);return this};
function E(a){a.B();a.length=0;a.b=a.f=a.l=a.m=a.A=a.u=null}q.append=function(a,b,d){let c;"number"===typeof b?(d=b,b=null,c=1):c=d||0===d;const e=a.length;for(let g=0;g<e;g++)this.add(a[g],b,c?d++:null);return this};
q.remove=function(a,b,d){let c=this.length;a&&("object"===typeof a?a=this.index(a):0>a&&(a=c+a-1));if(!c||a>=c)return this;b?0>b&&(a-=b+1,0>a&&(a=0),b*=-1):b=1;!a&&b>=c?(a=this.b,b=a.length,this.f.textContent="",this.f._dom=this.b=d?Array(d):[],c=0):(a=this.b.splice(a,b),c-=b);this.length=c;for(let e=0,g;e<b;e++)g=a[e],c&&this.f.removeChild(g);return this};q.replace=function(a,b,d,c){"undefined"===typeof c&&("number"===typeof a?(c=a,a=this.b[c]):c=this.index(a));this.add(b,d,c,a);return this};
q.update=function(a,b,d,c){"undefined"===typeof c&&("number"===typeof a?(c=a,a=this.b[a]):c=this.index(a));return this.apply(a,b,d,c)};function G(a,b){const d=a.m.length,c={},e=Array(d);for(let r=0,x;r<d;r++){x=a.m[r];var g=r,n;if(!(n=c[x])){n=b;var u=x,t=c;for(let v=0,k=u.length,h="";v<k;v++){const l=u[v];h+=l;t[h]?n=t[h]:(">"===l?n=n.firstElementChild:"+"===l?n=n.nextElementSibling:"|"===l&&(n=n.firstChild),t[h]=n)}}e[g]=n}return b._path=e}let H;
function B(a,b,d,c,e){const g=document.createElement(b.t||"div");d||(d=0,c="&",H="",a.m=[],g._path=e=[],a.cache&&(g._cache={}));var n=b.s;let u=b.i;var t=b.x,r=b.h;const x=b.a,v=b.e;var k=b.c,h=b.j;b=a.m.length;let l=0,m="";h&&(m+=";"+h,-1<m.indexOf("self")&&(l=2));k&&("object"===typeof k?(k=""+k[0],m+=a.cache?";v="+k+";if(s._class"+b+"!==v){s._class"+b+"=v;self.className=v}":k?";self.className="+k:"",l++):g.className=k);if(x||v){let f;x&&(f=Object.keys(x));v&&(k=Object.keys(v),f=f?f.concat(k):k);
for(k=0;k<f.length;k++){h=f[k];let p;x&&"undefined"!==typeof(p=x[h])||(p=v[h],a.D(h));"object"===typeof p?(p=""+p[0],m+=a.cache?";v="+p+";if(s['_attr_"+h+b+"']!==v){s['_attr_"+h+b+"']=v;self[v||v===0?'setAttribute':'removeAttribute']('"+h+"',v)}":p?";v="+p+";self[v||v===0?'setAttribute':'removeAttribute']('"+h+"',v)":"",l++):g.setAttribute(h,p)}}n&&("string"===typeof n?g.style.cssText=n:n.length&&(n=n[0],m+=a.cache?";v="+n+";if(s._css"+b+"!==v){s._css"+b+"=v;(self._style||(self._style=self.style)).cssText=v}":
n?";self.style.cssText="+n:"",l++));if(!u)if(t){let f;if(n="object"===typeof t)f=!1,t=""+t[0];r=document.createTextNode(t);n&&(l&&b++,a.m[b]=c+"|",e[b]=r,I(l,a.cache&&!f?";v="+t+";if(s._text"+b+"!==v){s._text"+b+"=v;self.nodeValue=v}":t?";self.nodeValue="+t:"",b),l&&b--);g.appendChild(r)}else r&&("object"===typeof r?(r=""+r[0],m+=a.cache?";v="+r+";if(s._html"+b+"!==v){s._html"+b+"=v;self.innerHTML=v}":r?";self.innerHTML="+r:"",l++):g.innerHTML=r);l?(a.m[b]=c,e[b]=g,a.o=0,I(l,m,b)):m&&(H+=m);if(u)if(u.length){t=
">";for(let f=0,p;f<u.length;f++)f&&(t+="+"),p=u[f],g.appendChild(B(a,p,d+f+1,c+t,e))}else g.appendChild(B(a,u,d+1,c+">",e));d||a.o||!H||(a.A=Function("p","s","data","index","view",'"use strict";var self,v'+H));return g}function I(a,b,d){H=1<a?H+(";self=p["+d+"]"+b):H+b.replace(/self/g,"p["+d+"]")}w.prototype.B=function(a){a?"object"===typeof a&&(a=a.n):a=this.l;a&&(z[a]=null);return this};w.unregister=w.unload=w.prototype.B;const J="pretty large big small tall short long handsome plain quaint clean elegant easy angry crazy helpful mushy odd unsightly adorable important inexpensive cheap expensive fancy".split(" "),K="red yellow blue green pink brown purple brown white black orange".split(" "),L="table chair house bbq desk car pony cookie sandwich burger pizza mouse keyboard".split(" "),M=J.length,N=K.length,O=L.length;let P=1;
function Q(a){const b=Array(a);for(let d=0;d<a;d++)b[d]={id:P++,label:J[Math.random()*M|0]+" "+K[Math.random()*N|0]+" "+L[Math.random()*O|0]};return b};F(document.getElementById("main"),{i:[{i:{i:[{i:{t:"h1",x:'Mikado-"non-keyed"'},c:"col-md-6"},{i:{i:[{i:{t:"button",a:{type:"button",id:"run"},c:"btn btn-primary btn-block",e:{click:"run"},x:"Create 1,000 rows"},c:"col-sm-6 smallpad"},{i:{t:"button",a:{type:"button",id:"runlots"},c:"btn btn-primary btn-block",e:{click:"runlots"},x:"Create 10,000 rows"},c:"col-sm-6 smallpad"},{i:{t:"button",a:{type:"button",id:"add"},c:"btn btn-primary btn-block",e:{click:"add"},x:"Append 1,000 rows"},c:"col-sm-6 smallpad"},
{i:{t:"button",a:{type:"button",id:"update"},c:"btn btn-primary btn-block",e:{click:"update"},x:"Update every 10th row"},c:"col-sm-6 smallpad"},{i:{t:"button",a:{type:"button",id:"clear"},c:"btn btn-primary btn-block",e:{click:"clear"},x:"Clear"},c:"col-sm-6 smallpad"},{i:{t:"button",a:{type:"button",id:"swaprows"},c:"btn btn-primary btn-block",e:{click:"swaprows"},x:"Swap Rows"},c:"col-sm-6 smallpad"}],c:"row"},c:"col-md-6"}],c:"row"},c:"jumbotron"},{t:"table",i:{t:"tbody",a:{id:"tbody"}},c:"table table-hover table-striped test-data"},
{t:"span",a:{"aria-hidden":"true"},c:"preloadicon glyphicon glyphicon-remove"}],c:"container",d:!0,n:"app",v:"0.7.58"});let R=[];
const S=(new w(document.getElementById("tbody"),{t:"tr",a:{root:""},i:[{t:"td",c:"col-md-1",x:["data.id"]},{t:"td",i:{t:"a",c:"lbl",e:{click:"select:root"},x:["data.label"]},c:"col-md-4"},{t:"td",i:{t:"a",i:{t:"span",a:{"aria-hidden":"true"},c:"remove glyphicon glyphicon-remove"},c:"remove",e:{click:"remove:root"}},c:"col-md-1"},{t:"td",c:"col-md-6"}],c:["(view === index ? 'danger' : '')"],d:!1,n:"item",v:"0.7.58"})).g("run",()=>S.render(R=Q(1E3))).g("runlots",()=>S.render(Q(1E4))).g("add",()=>S.append(Q(1E3))).g("update",
()=>{for(let a=0;a<R.length;a+=10)R[a].label+=" !!!",S.update(a,R[a])}).g("clear",()=>S.clear()).g("swaprows",()=>{const a=R[998];S.update(998,R[998]=R[1]);S.update(1,R[1]=a)}).g("remove",a=>S.remove(a)).g("select",a=>{let b=S.selected;b&&S.update(b,R[b]);S.update(b=S.selected=S.index(a),R[b],b)});}).call(this);
