// https://github.com/yelouafi/petit-dom 0.2.4 !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e.petitDom=e.petitDom||{})}(this,function(e){"use strict";function n(e,n){for(var t=1,r=e.length-1;t<=r;){var o=Math.ceil((t+r)/2);ni)return u}else{if(t+a>r)return-1;u=-1,f=o}t++}return-1}function r(e,n){for(var t=0;t2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n.length-1,o=arguments[4];t<=r;){var i=n[t++];e.insertBefore(l(i),o)}}function u(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n.length-1,o=void 0;for(e.childNodes.length===r-t+1&&(e.textContent="",o=!0);t<=r;){var i=n[t++];o||e.removeChild(i._node),a(i)}}function a(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e._node;if(S(e))for(var t=0;t0)return o}function p(e,n,t,r){if(!0===t)e.setAttribute(n,"");else if(!1===t)e.removeAttribute(n);else{var o=r?M[n]:void 0;void 0!==o?e.setAttributeNS(o,n,t):e.setAttribute(n,t)}}function s(e,n,t){var r=n._node;if(n===e)return r;var o,f;if(null!=(o=n._text)&&null!=(f=e._text))o!==f&&(r.nodeValue=f);else if(n.type===e.type&&n.isSVG===e.isSVG){var u=n.type;if(b(u))u.patch(r,e.props,n.props,e.content,n.content);else if("function"==typeof u)if(b(u.prototype)){var p=n._data;p.patch(r,e.props,n.props,e.content,n.content),e._data=p}else if((u.shouldUpdate||i)(e.props,n.props,e.content,n.content)){var h=u(e.props,e.content);r=s(h,n._data,t),e._data=h}else e._data=n._data;else{if("string"!=typeof u)throw new Error("Unkown node type! "+u);var y=d(r,e.props,n.props,e.isSVG);c(r,e.content,n.content),null!=y&&v(r,e.props,n.props,y)}}else{r=l(e);var g=n._node;t&&(t.replaceChild(r,n._node),n._node=r),a(n,g)}return e._node=r,r}function c(e,n,t){S(n)||S(t)?S(n)&&S(t)?y(e,n,t):(u(e,t,0,t.length-1),f(e,n)):n!==t&&s(n,t,e)}function h(e,n){return null==e.key&&null==n.key||e.key===n.key}function y(e,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:n.length-1,v=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,d=arguments.length>6&&void 0!==arguments[6]?arguments[6]:r.length-1;if(n!==r){var p,c=g(n,r,o,i,v,d,h,e);if(o+=c,v+=c,c=_(n,r,o,i,v,d,h,e),i-=c,d-=c,!(o>i&&v>d)){if(o<=i&&v>d)return p=r[v],void f(e,n,o,i,p&&p._node);if(v<=d&&o>i)u(e,r,v,d);else{var y=d-v+1,k=i-o+1;if(c=-1,y=0){f(e,n,o,c-1,(p=r[v])._node);var x=c+y;for(o=c;ok&&(c=t(r,n,v,d,o,i,h))>=0){for(u(e,r,v,c-1),x=c+k,v=c;v3&&void 0!==arguments[3]?arguments[3]:0,d=arguments.length>4&&void 0!==arguments[4]?arguments[4]:n.length-1,p=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=d-v+1,c=(arguments.length>6&&void 0!==arguments[6]?arguments[6]:t.length-1)-p+1,y=s+c,g=[];e:for(r=0;r<=y;r++){if(r>50)return!0;for(a=r-1,f=r?g[r-1]:[0,0],u=g[r]=[],o=-r;o<=r;o+=2){for(i=(l=o===-r||o!==r&&f[a+o-1]=0;r--){for(;l>0&&i>0&&h(t[p+l-1],n[v+i-1]);)m[x--]=N,l--,i--;if(!r)break;a=r-1,f=r?g[r-1]:[0,0],(o=l-i)===-r||o!==r&&f[a+o-1]=0&&(_[a]=v,w[a]={newi:m,oldi:v,prev:w[a-1]});for(a=_.length-1;_[a]>f;)a--;for(var x=w[a],A=Array(y+h-a),S=i,V=f,b=A.length-1;x;){for(var G=x,C=G.newi,E=G.oldi;S>C;)A[b--]=B,S--;for(;V>E;)A[b--]=U,V--;A[b--]=N,S--,V--,x=x.prev}for(;S>=o;)A[b--]=B,S--;for(;V>=l;)A[b--]=U,V--;k(e,A,t,r,o,l,p)}var x={},A=[],S=Array.isArray,V=function(e){return e&&(null!=e._vnode||null!=e._text)},b=function(e){return e&&e.mount&&e.patch&&e.unmount},G="http://www.w3.org/2000/svg",C={selected:!0,value:!0,checked:!0,innerHTML:!0},E="http://www.w3.org/1999/xlink",M={show:E,actuate:E,href:E},N=2,B=4,U=8;e.h=function(e,n,t){var o,i,l,f=!1,u=arguments.length-2;if("string"!=typeof e){if(1===u)o=t;else if(u>1){for(i=Array(u),l=0;l1){for(i=Array(u),l=0;l