!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).diff={})}(this,function(e){"use strict";function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function t(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function M(e){return function(e){if(Array.isArray(e))return i(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return i(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var L={SET_ATTRIBUTE:0,REMOVE_ATTRIBUTE:1,NODE_VALUE:2,INSERT_BEFORE:3,REPLACE_CHILD:4,REMOVE_CHILD:5},p=new Map,H=new Map,g=new Map,d=new Set,P=new Set,v=new Set,D=new Set,l=new Set,r=new Set,s=Object.freeze({__proto__:null,StateCache:p,NodeCache:H,TransitionCache:g,MiddlewareCache:d,CreateTreeHookCache:P,CreateNodeHookCache:v,SyncTreeHookCache:D,ReleaseHookCache:l,ParserHookCache:r}),c=new Set,u=new Set,f=new Set,h={free:c,allocated:u,protected:f},m=c.values(),z={size:1e4,memory:h,fill:function(){for(var t=this,e=c.size;e<this.size;e++)c.add({rawNodeName:"",nodeName:"",nodeValue:"",nodeType:1,key:"",childNodes:[],attributes:{}});this.size<c.size&&c.forEach(function(e){c.size!==t.size&&c.delete(e)})},get:function(){var e=m.next(),t=e.value,r=void 0===t?{rawNodeName:"",nodeName:"",nodeValue:"",nodeType:1,key:"",childNodes:[],attributes:{}}:t;return e.done&&(m=c.values()),c.delete(r),u.add(r),r},protect:function(e){u.delete(e),f.add(e)},unprotect:function(e){f.has(e)?(f.delete(e),c.add(e)):u.has(e)&&(u.delete(e),c.add(e))}};z.fill();var B=Array.isArray,U=z.memory,F="#document-fragment",Y="#text";function $(r,e,t){var n=null;if(U.protected.has(r)||U.allocated.has(r))n=r;else if(!r||B(r)){var a=r?r.length:0;t=[];for(var o=0;o<a;o++)t.push(r[o]);n=$(F,null,t)}if(n)return n;var i="object"==typeof r,s=r;if(r&&i&&"ownerDocument"in s){var d;if(3===s.nodeType){var l=$(Y,s.nodeValue);return H.set(l,r),l}e={},t=[];var c=s.attributes;if(1===s.nodeType&&c&&c.length)for(var u=0;u<c.length;u++){var f=c[u],h=f.name,p=f.value;""===p&&h in s?e[h]=r[h]:e[h]=p}if((1===s.nodeType||11===s.nodeType)&&s.childNodes.length){t=[];for(var v=0;v<s.childNodes.length;v++){var m=s.childNodes[v];t.push($(m))}}return H.forEach(function(e,t){e===r&&(n=t)}),(n=n||$(s.nodeName,e,t)).attributes=e,n.childNodes.length=0,(d=n.childNodes).push.apply(d,M(t)),H.set(n,r),n}if(i){var g=r.rawNodeName,N=r.nodeName,y=r.nodeValue,b=r.attributes,T=r.childNodes,w=$(g||N,b||null,r.children||T);return y&&(w.nodeValue=y),w}for(var k=arguments.length,E=new Array(3<k?k-3:0),O=3;O<k;O++)E[O-3]=arguments[O];E.length&&(t=[t].concat(E)),n=z.get();var S=r===Y,_="string"==typeof r;n.nodeName=_?(n.rawNodeName=r,n.rawNodeName.toLowerCase()):(n.rawNodeName=r,F),n.nodeValue="",n.key="",n.childNodes.length=0,n.attributes={};var C=B(e)||"object"!=typeof e?e:t,x=B(C)?C:[C];if(S){var R=x.join("");return n.nodeType=3,n.nodeValue=String(R||""),n}if(n.nodeName===F?n.nodeType=11:n.nodeType="#comment"===r?8:1,C&&x.length)for(var I=0;I<x.length;I++){var A=x[I];if(B(A)){var V;(V=n.childNodes).push.apply(V,M(A))}else{if(!A)continue;var j;11===A.nodeType&&"string"==typeof A.rawNodeName?(j=n.childNodes).push.apply(j,M(A.childNodes)):A&&"object"==typeof A?n.childNodes.push($(A)):n.childNodes.push($(Y,null,A))}}return e&&"object"==typeof e&&!B(e)&&(n.attributes=e),"script"===n.nodeName&&n.attributes.src&&(n.key=String(n.attributes.src)),n.attributes&&"key"in n.attributes&&(n.key=String(n.attributes.key)),P.size&&P.forEach(function(e,t){(t=e(n))&&(n=$(t))}),n}var N="undefined"!=typeof process?process:{env:{NODE_ENV:"development"},argv:[]},w="__DIFFHTML__",j=/<!.*>/i,q=new RegExp("".concat(w,"([^_]*)__")),G={tags:[],attributes:{},children:{}},k=Object.assign,E=Array.isArray,J=["script","noscript","style","code","template"],K=["meta","img","link","input","area","br","hr","area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],Q={li:{li:!0},p:{p:!0,div:!0},td:{td:!0,th:!0},th:{td:!0,th:!0}},W={li:{ul:!0,ol:!0},a:{div:!0},b:{div:!0},i:{div:!0},p:{div:!0},td:{tr:!0,table:!0},th:{tr:!0,table:!0}},X=function(e,t,r){var n;if(!("childNodes"in e.attributes)){if(t&&!j.test(t)&&!q.test(t))return e.childNodes.push($("#text",t));for(var a=[],o=t.split(q),i=0;i<o.length;i++){var s=o[i];if(s)if(i%2==1){var d=r.children[s],l=s in r.children?d:$("#text","".concat(w).concat(s,"__"));if(!l)continue;var c=11===l.nodeType;"string"==typeof l.rawNodeName&&c?a.push.apply(a,M(l.childNodes)):a.push(l)}else j.test(s)||a.push($("#text",s))}(n=e.childNodes).push.apply(n,a)}},Z=function(e,t,r,n){var a,o=/\b([_a-z][_a-z0-9\-:]*)\s*(=\s*("([^"]+)"|'([^']+)'|(\S+)))?/gi;if(a=q.exec(e))return Z(r.tags[a[1]],t,r);for(var i,s={};i=o.exec(t||"");){var d="string"==typeof e,l=i[1],c=i[6]||i[5]||i[4],u=c||(d?i[1]:c||!0),f=String(u).match(q);if(f&&f.length)for(var h=String(u).split(q),p=q.exec(l),v=p?r.attributes[p[1]]:l,m=0;m<h.length;m++){var g=h[m];if(g)if(m%2==1){var N="object"==typeof v,y=r.attributes[g],b="".concat(w).concat(g,"__");s[v]?s[v]+=g in r.attributes?y:b:N?v&&!E(v)&&k(s,v):v&&(s[v]=g in r.attributes?y:b)}else s[v]?s[v]+=g:s[v]=g}else if(f=q.exec(l)){var T=r.attributes[f[1]];"object"!=typeof T||E(T)?s[T]="":k(s,T)}else s[l]="''"===u||'""'===u?"":u}return $(e,s,s.childNodes||[])};function y(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};r.parser||(r.parser={}),t||(t=G);var n=new Set(r.parser.rawElements?r.parser.rawElements:J),a=new Set(r.parser.selfClosingElements||K),o=/<!--[^]*?(?=-->)-->|<(\/?)([a-z\-\_][a-z0-9\-\_]*)\s*([^>]*?)(\/?)>/gi,i=$("#document-fragment",null,[]),s=[i],d=i,l=-1;if(!e.includes("<")&&e)return X(d,e,t),i;for(var c,u,f=0;c=o.exec(e);f++){-1<l&&l+c[0].length<o.lastIndex&&(u=e.slice(l,o.lastIndex-c[0].length))&&X(d,u,t);var h=o.lastIndex-c[0].length;if(-1===l&&0<h){var p=e.slice(0,h);p&&!j.exec(p)&&X(d,p,t)}if(l=o.lastIndex,"!"!==c[0][1]){var v=q.exec(c[2]),m=v&&t.tags[v[1]],g=m?m.name||m:c[2];if(!c[1]&&(!c[4]&&Q[d.rawNodeName]&&Q[d.rawNodeName][g]&&(s.pop(),d=s[s.length-1]),d=d.childNodes[d.childNodes.push(Z(c[2],c[3],t))-1],s.push(d),r.parser.strict||n.has(g))){var N="</".concat(g,">"),y=e.indexOf(N,o.lastIndex);if(n.has(g)){-1===y?l=o.lastIndex=e.length+1:(l=y+N.length,o.lastIndex=l,c[1]=" ");var b=e.slice(c.index+c[0].length,y);X(d,b,t)}}if(c[1]||c[4]||a.has(g))for(;d;){if("/"===c[4]&&v){s.pop(),d=s[s.length-1];break}if(m&&d.rawNodeName===g){s.pop(),d=s[s.length-1];break}if(d.rawNodeName===g){s.pop(),d=s[s.length-1];break}var T=W[d.rawNodeName];if(!T||!T[g])break;s.pop(),d=s[s.length-1]}}}var w=e.slice(-1===l?0:l);if(w&&X(d,w,t),i.childNodes.length&&"html"===i.childNodes[0].nodeName){var k={before:[],after:[]},E={after:[]},O=i.childNodes[0],S=!0,_=!0;if(O.childNodes=O.childNodes.filter(function(e){if("body"===e.nodeName||"head"===e.nodeName)return"head"===e.nodeName&&(S=!1),"body"===e.nodeName&&(_=!1),!0;1===e.nodeType&&(S&&_?k.before.push(e):!S&&_?k.after.push(e):_||E.after.push(e))}),O.childNodes[0]&&"head"===O.childNodes[0].nodeName){var C=O.childNodes[0].childNodes;C.unshift.apply(C,k.before),C.push.apply(C,k.after)}else{var x=$("head",null,[]);if(x){var R=x.childNodes;R.unshift.apply(R,k.before),R.push.apply(R,k.after),O.childNodes.unshift(x)}}if(O.childNodes[1]&&"body"===O.childNodes[1].nodeName){var I=O.childNodes[1].childNodes;I.push.apply(I,E.after)}else{var A=$("body",null,[]);if(A){var V=A.childNodes;V.push.apply(V,E.after),O.childNodes.push(A)}}}return i}var b=z.protect,T=z.unprotect,O=z.memory;function S(e){b(e);for(var t=0;t<e.childNodes.length;t++)S(e.childNodes[t]);return e}function _(e){T(e);for(var t=0;t<e.childNodes.length;t++)_(e.childNodes[t]);return H.delete(e),e}function C(){O.allocated.forEach(function(e){O.free.add(e),O.allocated.delete(e),H.delete(e)})}var x=Object.freeze({__proto__:null,protectVTree:S,unprotectVTree:_,gc:C}),R=new Map,I="diffHTML",A="diff_perf",V="undefined"!=typeof location,ee=N.argv,te=function(){};function re(a,e){var t=V&&location.search.includes(A),r=ee&&N.argv.includes(A);if(!(t||r))return te;var o=e;return function(e){var t=a.host;a&&t?e="".concat(t.constructor.name," ").concat(e):o&&"function"==typeof o.rawNodeName&&(e="".concat(o.rawNodeName.name," ").concat(e));var r="".concat(e,"-end");if(R.has(e)){var n=(performance.now()-R.get(e)).toFixed(3);R.delete(e),performance.mark(r),performance.measure("".concat(I," ").concat(e," (").concat(n,"ms)"),e,r)}else R.set(e,performance.now()),performance.mark(e)}}function ne(n){var a=n.state,o=a.isRendering;p.forEach(function(e){var t=e.activeTransaction&&e.activeTransaction.domNode,r=n.domNode;t&&t.contains&&r&&r.contains&&(t.contains(r)&&e.isRendering?(a=e,o=!0):r.contains(t)&&e.isRendering&&(a=e,o=!0))});var e=a,t=e.activeTransaction,r=e.nextTransaction;if(o){var i=n.tasks,s=r||t;(a.nextTransaction=n).abort();var d=s.promise||Promise.resolve();return n.promise=d.then(function(){return n.aborted=!1,n.state.isRendering=!0,n.state.activeTransaction=n,je.flow(n,i.slice(1))})}a.isRendering=!0,a.activeTransaction=n}function ae(e){var t=e.domNode,r=e.markup,n=e.state,a=e.state.measure,o=e.options.inner?"innerHTML":"outerHTML";if(a("should update"),"string"==typeof r&&t[o]===r)return e.abort(!0);"string"==typeof r&&(n.markup=r),a("should update")}function oe(e){var t=p.get(e);if(t&&(p.delete(e),t.oldTree&&!H.has(t.oldTree)&&(_(t.oldTree),l.forEach(function(e){return e(t.oldTree)}))),e){var r=e;if(r.childNodes&&r.childNodes.length)for(var n=0;n<r.childNodes.length;n++)oe(r.childNodes[n]);r.shadowRoot&&oe(r.shadowRoot),H.forEach(function(e,t){e===r&&(_(t),l.forEach(function(e){return e(t)}))})}}function ie(e){var t=e.state,r=e.domNode,n=e.markup,a=e.options,o=t.previousMarkup,i=a.inner,s=r.outerHTML;o===s&&t.oldTree&&s||(oe(r),t.oldTree=$(r),S(t.oldTree),p.set(r,t)),e.newTree||(e.newTree=$(n)),e.oldTree=t.oldTree;var d=e.oldTree,l=e.newTree;if(i&&d&&l){var c=d.nodeName,u=d.attributes,f="string"!=typeof l.rawNodeName,h=11===l.nodeType&&!f?l.childNodes:l;e.newTree=$(c,u,h)}}var se={},de=["old","new"],le="#text";function ce(r,n){var e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[],t=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{};r||(r=se),n||(n=se);var a=t.svgElements,o=void 0===a?new Set:a,i=(r.nodeName,11===n.nodeType||r.nodeType,r===se),s="svg"===n.nodeName||o.has(n),d=null;if(D.forEach(function(e){var t=e(r,n);t&&t===r?d=!0:t&&(n=t)}),d)return e;for(var l={old:new Map,new:new Map},c=0;c<de.length;c++){var u=l[de[c]],f=arguments[c],h=f&&f.childNodes;if(h&&h.length)for(var p=0;p<h.length;p++){var v=h[p];v.key&&u.set(v.key,v)}}var m=1===n.nodeType;if(n.nodeName===le){if(r.nodeName===le&&r.nodeValue!==n.nodeValue)return e.push(L.NODE_VALUE,r,n.nodeValue,r.nodeValue),r.nodeValue=n.nodeValue,e;if(i)return e.push(L.NODE_VALUE,n,n.nodeValue,null),e}if(m){var g=i?se:r.attributes,N=n.attributes;for(var y in N){var b=N[y];y in g&&g[y]===N[y]||(i||(g[y]=b),e.push(L.SET_ATTRIBUTE,i?n:r,y,b))}if(!i)for(var T in g)T in N||(e.push(L.REMOVE_ATTRIBUTE,r,T),delete g[T])}var w=n.childNodes||[];if(i){for(var k=0;k<w.length;k++)s&&o.add(w[k]),ce(null,w[k],e,t);return e}for(var E=r.childNodes,O=0;O<w.length;O++){var S=E&&E[O],_=w[O],C=_.key;if((s||"svg"===_.nodeName)&&o.add(_),S){var x=S.key,R=l.new.has(x),I=l.old.has(C);if(x||C){if(!R&&!I){E.splice(E.indexOf(S),1,_),ce(null,_,e,t),e.push(L.REPLACE_CHILD,_,S),O-=1;continue}if(!R){e.push(L.REMOVE_CHILD,S),E.splice(E.indexOf(S),1),O-=1;continue}if(C!==x){var A=_;C&&I?(A=l.old.get(C),E.splice(E.indexOf(A),1)):A=_,ce(null,A,e,t),e.push(L.INSERT_BEFORE,r,A,S),E.splice(O,0,A);continue}}if(S.nodeName===_.nodeName)ce(S,_,e,t);else{E[O]=_;var V=E.lastIndexOf(_);O<V&&E.splice(V,1),ce(null,_,e,t),e.push(L.REPLACE_CHILD,_,S)}}else E.push(_),ce(null,_,e,t),e.push(L.INSERT_BEFORE,r,_,null)}if(E.length!==w.length){for(var j=w.length;j<E.length;j++)e.push(L.REMOVE_CHILD,E[j]);E.length=w.length}return e}var ue="object"==typeof global?global:window||{},fe=Symbol.for("diffHTML"),he="http://www.w3.org/2000/svg",pe=ue.document||null;function ve(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:pe,r=2<arguments.length?arguments[2]:void 0,n=$(e),a=H.get(n);if(a)return a;var o=n.nodeName,i=n.rawNodeName,s=void 0===i?o:i,d=n.childNodes,l=void 0===d?[]:d;r=r||"svg"===o;var c=null;v.forEach(function(e,t){(t=e(n))&&(c=t)}),null===c&&(c="#text"===o?t.createTextNode(n.nodeValue||""):"#document-fragment"===o?t.createDocumentFragment():r?t.createElementNS(he,s):t.createElement(s));var u=c;H.set(n,u);for(var f=0;f<l.length;f++){var h=ve(l[f],t,r);u.appendChild(h)}return u}function me(e){var t=e.state,r=e.state.measure,n=e.oldTree,a=e.newTree,o=e.domNode;r("sync trees"),n&&a&&n.nodeName!==a.nodeName&&11!==a.nodeType?(e.patches=[L.REPLACE_CHILD,a,n],e.oldTree=t.oldTree=a,p.delete(o),p.set(ve(a),t)):e.patches=ce(n||null,a||null,[],t),r("sync trees")}var ge=["attached","detached","replaced","attributeChanged","textChanged"];function Ne(e,t){g.get(e).add(t)}function ye(e,t){if(!t&&e)g.get(e).clear();else if(e&&t)g.get(e).delete(t);else for(var r=0;r<ge.length;r++)g.get(ge[r]).clear()}function be(t){for(var e=g.get(t),r=[],n=arguments.length,a=new Array(1<n?n-1:0),o=1;o<n;o++)a[o-1]=arguments[o];var i=a[0],s=a.slice(1);return!e.size||"textChanged"!==t&&1!==i.nodeType||(e.forEach(function(e){var t=e.apply(void 0,[H.get(i)].concat(M(s)));"object"==typeof t&&t.then&&r.push(t)}),"attached"!==t&&"detached"!==t||i.childNodes.forEach(function(e){r.push.apply(r,M(be.apply(void 0,[t,e].concat(M(s)))))})),r}ge.forEach(function(e){return g.set(e,new Set)});var Te=ue.document?document.createElement("div"):null;function we(e){return Te&&e&&e.indexOf&&e.includes("&")?(Te.innerHTML=e,Te.textContent||""):e}var ke=Object.keys,Ee=new Set,Oe=new Set,Se=["class","checked","disabled","selected"],_e=function(e,t,r,n){var a="object"==typeof n&&n,o="function"==typeof n,i="symbol"==typeof n,s=0===r.indexOf("on")?r.toLowerCase():r,d=e.nodeName+"-"+s,l=t;if(Oe.has(d))t[s]=n;else if(!Ee.has(d))try{t[s]=n,Oe.add(d)}catch(e){Ee.add(d)}if(a||o||i){if(a&&"style"===s)for(var c=ke(n),u=0;u<c.length;u++)l.style[c[u]]=n[c[u]]}else{var f=null==n;s&&l.setAttribute(s,f?"":n)}},Ce=function(e,t){var r=0===t.indexOf("on");e.removeAttribute(t);var n=e.nodeName+"-"+t;if(Oe.has(n)){var a=e;r?a[t]=void 0:delete a[t],Se.includes(t)&&(e[t]=!1)}else if(!Ee.has(n))try{var o=e;r?o[t]=void 0:delete o[t],Se.includes(t)&&(e[t]=!1),Oe.add(n)}catch(e){Ee.add(n)}},xe=function(e,t){var r=e;t.includes("&")?r.nodeValue=we(t):r.nodeValue=t};function Re(e){var t=e.domNode,r=e.state,n=e.state.measure,a=e.patches,o=t.ownerDocument,i=e.promises||[];r.ownerDocument=o||document,n("patch node"),i.push.apply(i,M(function(f){for(var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},h=[],p=e.ownerDocument,t=e.svgElements,v=void 0===t?new Set:t,r=f.length,m=0;;){var n=f[m];if(m===r)break;switch(n){case L.SET_ATTRIBUTE:if("break"===function(){var e=f[m+1],t=f[m+2],r=we(f[m+3]);m+=4;var n=v.has(e),a=ve(e,p,n),o=a.getAttribute(t),i=be("attributeChanged",e,t,o,r);return S(e),i.length?(Promise.all(i).then(function(){return _e(e,a,t,r)}),h.push.apply(h,M(i))):_e(e,a,t,r),"break"}())break;case L.REMOVE_ATTRIBUTE:if("break"===function(){var e=f[m+1],t=f[m+2];m+=3;var r=v.has(e),n=ve(e,p,r),a=n.getAttribute(t),o=be("attributeChanged",e,t,a,null);return S(e),o.length?(Promise.all(o).then(function(){return Ce(n,t)}),h.push.apply(h,M(o))):Ce(n,t),"break"}())break;case L.NODE_VALUE:if("break"===function(){var e=f[m+1],t=f[m+2],r=f[m+3],n=v.has(e);m+=4;var a=ve(e,p,n);S(e);var o=be("textChanged",e,r,t);return o.length?(Promise.all(o).then(function(){return xe(a,t)}),h.push.apply(h,M(o))):xe(a,t),"break"}())break;case L.INSERT_BEFORE:var a=f[m+1],o=f[m+2],i=f[m+3];m+=4;var s=H.get(a);if(!s)break;var d=v.has(o);S(o);var l=i&&ve(i,p,d),c=ve(o,p,d);s.insertBefore(c,l||null),h.push.apply(h,M(be("attached",o)));break;case L.REPLACE_CHILD:if("break"===function(){var e=f[m+1],t=f[m+2];m+=3;var r=v.has(e),n=H.get(t),a=ve(e,p,r);if(!n||!n.parentNode)return"break";S(e);var o=g.get("attached").size,i=g.get("detached").size,s=g.get("replaced").size;if(!o&&!i&&!s)return n.parentNode&&(_(t),n.parentNode.replaceChild(a,n)),"break";n.parentNode&&n.parentNode.insertBefore(a,n);var d=be("attached",e),l=be("detached",t),c=be("replaced",t,a),u=[].concat(M(d),M(l),M(c));return u.length?(Promise.all(u).then(function(){n.parentNode&&n.parentNode.removeChild(n),_(t)}),h.push.apply(h,M(u))):(n.parentNode&&n.parentNode.removeChild(n),_(t)),"break"}())break;case L.REMOVE_CHILD:if("break"===function(){var e=f[m+1];m+=2;var t=H.get(e);if(!t||!t.parentNode)return"break";var r=be("detached",e);return r.length?(Promise.all(r).then(function(){t.parentNode&&t.parentNode.removeChild(t),_(e)}),h.push.apply(h,M(r))):(t.parentNode&&t.parentNode.removeChild(t),_(e)),"break"}())break}}return h}(a,r))),n("patch node"),e.promises=i}function Ie(e){var t=e.promises;return t&&t.length?e.promise=Promise.all(t).then(function(){return e.end()}):e.promise=Promise.resolve(e.end())}var Ae=[ne,ae,ie,me,Re,Ie],Ve={schedule:ne,shouldUpdate:ae,reconcileTrees:ie,syncTrees:me,patchNode:Re,endAsPromise:Ie},je=function(){function n(e,t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),a(this,"domNode",""),a(this,"markup",""),a(this,"oldTree",void 0),a(this,"newTree",void 0),a(this,"promise",void 0),a(this,"promises",void 0),a(this,"tasks",[]),a(this,"patches",[]),this.domNode=e,this.markup=t,this.options=r,this.state=p.get(e)||{measure:re(e,t),svgElements:new Set},r.tasks&&r.tasks.length&&(this.tasks=M(r.tasks)),this.endedCallbacks=new Set,p.set(e,this.state)}return t(n,null,[{key:"create",value:function(e,t,r){return new n(e,t,r)}},{key:"flow",value:function(e,t){for(var r=e,n=0;n<t.length;n++){if(e.aborted)return r;if(void 0!==(r=t[n](e))&&r!==e)return r}return r}},{key:"assert",value:function(e){}},{key:"invokeMiddleware",value:function(r){var n=r.tasks;d.forEach(function(e){var t=e(r);t&&n.push(t)})}}]),t(n,[{key:"start",value:function(){var e=this.state.measure,t=this.tasks,r=t.pop();return this.aborted=!1,n.invokeMiddleware(this),e("render"),r&&t.push(r),n.flow(this,t)}},{key:"abort",value:function(e){if(this.aborted=!0,e)return this.tasks[this.tasks.length-1](this)}},{key:"end",value:function(){var t=this,e=this.state,r=this.domNode,n=e.measure;return n("finalize"),this.completed=!0,n("finalize"),n("render"),e.previousMarkup="outerHTML"in r?r.outerHTML:"",e.svgElements.clear(),e.isRendering=!1,C(),this.endedCallbacks.forEach(function(e){return e(t)}),this.endedCallbacks.clear(),this}},{key:"onceEnded",value:function(e){this.endedCallbacks.add(e)}}]),n}();function Me(e){return e.replace(/[&<>]/g,function(e){return"&#".concat(e.charCodeAt(0),";")})}var Le=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach(function(e){a(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({decodeEntities:we,escape:Me,makeMeasure:re,memory:x,Pool:z,process:N,PATCH_TYPE:L,createNode:ve,syncTree:ce},s);function He(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return r.inner=!0,r.tasks=r.tasks||Ae,je.create(e,t,r).start()}function Pe(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return r.inner=!1,r.tasks=r.tasks||Ae,je.create(e,t,r).start()}var De=Array.isArray,ze=/(<|\/)/,Be=function(e){var t=e.shift();return"string"==typeof t?Me(we(t)):t};function Ue(e){for(var t=arguments.length,l=new Array(1<t?t-1:0),r=1;r<t;r++)l[r-1]=arguments[r];var n=$("#text","");if(!e)return n;if("string"==typeof e&&(e=[e]),1===e.length&&!l.length){var a=Ue.isStrict;if(Ue.isStrict=!1,!e[0])return n;var o=y(e[0],void 0,{parser:{strict:a}}).childNodes;return $(1===o.length?o[0]:o)}var c="",u={attributes:{},children:{},tags:{}};e.forEach(function(e,t){if(c+=e,l.length){var r=Be(l),n=c.trim().slice(-1),a=c.lastIndexOf(">")<c.lastIndexOf("<"),o=Boolean(n.match(ze)),i="string"==typeof r,s="object"==typeof r,d="".concat(w).concat(t,"__");o&&!i?(u.tags[t]=r,c+=d):a?(u.attributes[t]=r,c+=d):De(r)||s?(u.children[t]=$(r),c+=d):r&&(c+=r)}});var i=Ue.isStrict;Ue.isStrict=!1;var s=y(c,u,{parser:{strict:i}}).childNodes;return $(1===s.length?s[0]:s)}function Fe(e){var t="function"==typeof e,r=e.subscribe,n=e.unsubscribe,a=e.createTreeHook,o=e.createNodeHook,i=e.syncTreeHook,s=e.releaseHook;return t&&d.add(e),r&&r(Le),a&&P.add(a),o&&v.add(o),i&&D.add(i),s&&l.add(s),function(){t&&d.delete(e),n&&n(Le),P.delete(a),v.delete(o),D.delete(i),l.delete(s)}}Ue.isStrict=!1,Ue.strict=function(e){Ue.isStrict=!0;for(var t=arguments.length,r=new Array(1<t?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return Ue.apply(void 0,[e].concat(r))};var Ye="1.0.0-beta.17",$e=Object.assign;Ae.splice(Ae.indexOf(ie),0,function(e){var t=e.state,r=e.markup,n=e.options,a=t.measure,o=n.inner;if("string"==typeof r){a("parsing markup for new tree");var i=y(r,void 0,n).childNodes,s=$(o?i:i[0]||i);s&&(e.newTree=s),a("parsing markup for new tree")}}),$e(Le,{parse:y,defaultTasks:Ae,tasks:Ve,VERSION:Ye});var qe={};qe.VERSION=Ye,qe.addTransitionState=Ne,qe.removeTransitionState=ye,qe.release=oe,qe.createTree=$,qe.use=Fe,qe.outerHTML=Pe,qe.innerHTML=He,qe.html=Ue,qe.Internals=Le;var Ge=ue;if(fe in ue){var Je=Ge[fe];Ye!==Je.VERSION&&console.log("Tried to load ".concat(Ye," after ").concat(Je.VERSION)),$e(qe,Ge[fe])}else Ge[fe]=qe,Ge.devTools&&(Ge.unsubscribeDevTools=Fe(Ge.devTools(Le)));e.Internals=Le,e.VERSION=Ye,e.addTransitionState=Ne,e.createTree=$,e.default=qe,e.html=Ue,e.innerHTML=He,e.outerHTML=Pe,e.release=oe,e.removeTransitionState=ye,e.use=Fe,Object.defineProperty(e,"__esModule",{value:!0})});