1 line
28 KiB
JavaScript
1 line
28 KiB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):(e="undefined"!=typeof globalThis?globalThis:e||self,t(e.diff={}))}(this,function(e){"use strict";function t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function r(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?t(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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 o(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){return d(e)||f(e,t)||h(e,t)||m()}function c(e){return l(e)||u(e)||h(e)||v()}function l(e){if(Array.isArray(e))return p(e)}function d(e){if(Array.isArray(e))return e}function u(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function f(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o=[],i=!0,s=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){s=!0,a=e}finally{try{i||null==r.return||r.return()}finally{if(s)throw a}}return o}}function h(e,t){if(e){if("string"==typeof e)return p(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?p(e,t):void 0}}function p(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}function v(){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 m(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function g(e,t){var r=String(e);switch(t){case"boolean":return"false"!==r;case"string":return r;case"number":return fe(r,10);case"object":return he(r)}}function b(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:typeof t,n=arguments.length>3?arguments[3]:void 0,a=ue.location,o=ue.URLSearchParams,i=void 0!==o,s=void 0!==a,c=i&&s,l=de.env;if(n&&e in n)return n[e];var d="DIFF_".concat(e.replace(/[^a-zA-Z0-9]/,""));if(c){var u=new o(a.search),f=d.toLowerCase();if(u.has(f))return g(decodeURIComponent(String(u.get(f))),r)}var h=d.toUpperCase();return l&&h in de.env?g(de.env[h.toUpperCase()],r):t}function N(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=0;r<e.length;r++){var n=e[r];n&&n.rawNodeName===Oe?N(n.childNodes,t):n&&t.push(n)}return t}function y(e,t,n){var a=null;if(Se.protected.has(e)||Se.allocated.has(e))a=e;else if(!e||we(e)){var o=e?e.length:0;n=[];for(var i=0;i<o;i++){var s=e&&!e[i];s||e&&n.push(e[i])}a=y(Oe,null,n)}if(a)return a;var l="object"==typeof e,d=e;if(e&&l&&"ownerDocument"in d){if(d.nodeType===K.TEXT){var u=y(ke,d.nodeValue);return ne.set(u,d),u}t={},n=[];var f=d.attributes;if(d.nodeType===K.ELEMENT&&f&&f.length)for(var h=0;h<f.length;h++){var p=f[h],v=p.name,m=p.value;m===Q.STR&&v in d?t[v]=e[v]:t[v]=m}if(d.nodeType===K.ELEMENT||d.nodeType===K.FRAGMENT){n=[];for(var g=0;g<d.childNodes.length;g++){var b=d.childNodes[g];n.push(y(b))}}return ne.forEach(function(t,r){t===e&&(a=r)}),a=a||y(d.nodeName,t,n),a.attributes=r(r({},a.attributes),t),a.childNodes=n,ne.set(a,d),a}if(l){var T=e.rawNodeName,E=e.nodeName,w=e.nodeValue,S=e.attributes,O=e.childNodes,k=e.children,R=T||E,x=y(R,S||null,k||O);return w&&(x.nodeValue=w),x}for(var C=arguments.length,M=new Array(C>3?C-3:0),A=3;A<C;A++)M[A-3]=arguments[A];M.length&&(n=[n].concat(M)),a=Ee.get();var I=e===ke;"string"==typeof e?(a.rawNodeName=e,a.nodeName=a.rawNodeName.toLowerCase()):(a.rawNodeName=e,a.nodeName=Oe),a.nodeValue=Q.STR,a.key=Q.STR,a.childNodes.length=0,a.attributes={};var _=we(t)||"object"!=typeof t,D=_?t:n,L=N(we(D)?D:[D]);if(I){var j=L.join(Q.STR);return a.nodeType=K.TEXT,a.nodeValue=String(j),a}if(a.nodeName===Oe?a.nodeType=K.FRAGMENT:a.nodeType="#comment"===e?K.COMMENT:K.ELEMENT,D&&L.length&&(!t||!t.childNodes))for(var V=0;V<L.length;V++){var P=L[V];if(we(P)){var F;(F=a.childNodes).push.apply(F,c(P))}else{if(!P)continue;if(P.nodeType===K.FRAGMENT&&"string"==typeof P.rawNodeName){var H;(H=a.childNodes).push.apply(H,c(P.childNodes))}else P&&"object"==typeof P?a.childNodes.push(y(P)):a.childNodes.push(y(ke,null,P))}}if(t&&"object"==typeof t&&!we(t)&&(a.attributes=r({},t),t.childNodes)){var B="object"==typeof t.childNodes;a.childNodes.push(B?y(t.childNodes):y("#text",t.childNodes))}return"script"===a.nodeName&&a.attributes.src&&(a.key=String(a.attributes.src)),a.attributes&&"key"in a.attributes&&(a.key=String(a.attributes.key)),oe.size&&oe.forEach(function(e,t){(t=e(a))&&(a=y(t))}),a}function T(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r.parser||(r.parser={}),t||(t=Me);var n=new Set(b("rawElements",_e,"array",r.parser)),a=new Set(b("selfClosingElements",De,"array",r.parser)),o=/<!--[^]*?(?=-->)-->|<(\/?)([a-z\-\_][a-z0-9\-\_]*)\s*([^>]*?)(".*?"|'.*?')?(\/?)>/gi,i=y("#document-fragment",null,[]),c=[i],l=i,d=-1;if(!e.includes("<")&&e)return Ve(l,e,t),i;for(var u,f,h=0;u=o.exec(e);h++){var p=u,v=s(p,6),m=v[0],g=v[1],N=v[2],T=v[3],E=v[4],w=v[5];d>-1&&d+m.length<o.lastIndex&&(f=e.slice(d,o.lastIndex-m.length))&&Ve(l,f,t);var S=o.lastIndex-m.length;if(-1===d&&S>0){var O=e.slice(0,S);O&&!xe.exec(O)&&Ve(l,O,t)}if(d=o.lastIndex,"!"!==u[0][1]){var k=Ce.exec(N),R=k&&t.tags[k[1]],x=R?R.name||R:N,C=void 0;if(!g){!u[4]&&Le[l.rawNodeName]&&Le[l.rawNodeName][x]&&(c.pop(),l=c[c.length-1]);var M=T+(E||"");if(l=l.childNodes[l.childNodes.push(Pe(N,M,t))-1],c.push(l),r.parser.strict||n.has(x)){var A="</".concat(x,">"),I=e.indexOf(A,o.lastIndex);if(n.has(x)){-1===I?d=o.lastIndex=e.length+1:(d=I+A.length,o.lastIndex=d,C=!0);var _=e.slice(u.index+m.length,I);Ve(l,_,t)}}}if(C||g||w||a.has(x))for(;l;){if("/"===w&&k){c.pop(),l=c[c.length-1];break}if(R&&l.rawNodeName===x){c.pop(),l=c[c.length-1];break}if(l.rawNodeName===x){c.pop(),l=c[c.length-1];break}var D=je[l.rawNodeName];{if(!D||!D[x])break;c.pop(),l=c[c.length-1]}}}}var L=e.slice(-1===d?0:d);if(L&&Ve(l,L,t),i.childNodes.length&&"html"===i.childNodes[0].nodeName){var j={before:[],after:[]},V={after:[]},P=i.childNodes[0],F=!0,H=!0;if(P.childNodes=P.childNodes.filter(function(e){if("body"===e.nodeName||"head"===e.nodeName)return"head"===e.nodeName&&(F=!1),"body"===e.nodeName&&(H=!1),!0;e.nodeType===K.ELEMENT&&(F&&H?j.before.push(e):!F&&H?j.after.push(e):H||V.after.push(e))}),P.childNodes[0]&&"head"===P.childNodes[0].nodeName){var B=P.childNodes[0].childNodes;B.unshift.apply(B,j.before),B.push.apply(B,j.after)}else{var z=y("head",null,[]);if(z){var U=z.childNodes;U.unshift.apply(U,j.before),U.push.apply(U,j.after),P.childNodes.unshift(z)}}if(P.childNodes[1]&&"body"===P.childNodes[1].nodeName){var J=P.childNodes[1].childNodes;J.push.apply(J,V.after)}else{var G=y("body",null,[]);if(G){var X=G.childNodes;X.push.apply(X,V.after),P.childNodes.push(G)}}}return i}function E(e){var t=e.mount,r=e.input,n=r,a=Be++;return b("collectMetrics",!1)?function(e){e="[".concat(a,"] ").concat(e);var r=t.host;t&&r?e="".concat(r.constructor.name," ").concat(e):n&&"function"==typeof n.rawNodeName&&(e="".concat(n.rawNodeName.name," ").concat(e));var o="".concat(e,"-end");if(He.has(e)){var i=He.get(e)||0,s=(performance.now()-i).toFixed(3);He.delete(e),performance.mark(o),performance.measure("".concat(Fe," ").concat(e," (").concat(s,"ms)"),e,o)}else He.set(e,performance.now()),performance.mark(e)}:Q.FUN}function w(e){if(ze(e),e.childNodes.length)for(var t=0;t<e.childNodes.length;t++)w(e.childNodes[t])}function S(e){if(e.childNodes.length)for(var t=0;t<e.childNodes.length;t++)S(e.childNodes[t]);ne.delete(e),Ue(e)}function O(){Je.allocated.forEach(function(e){e.attributes={},e.childNodes.length=0,Je.free.add(e),Je.allocated.delete(e),ne.delete(e)})}function k(e){var t=e.state,r=e.state.isRendering;t.measure("schedule"),re.forEach(function(n){var a=n.activeTransaction&&n.activeTransaction.mount,o=e.mount;a&&o&&n.isRendering&&(a.contains&&a.contains(o)||o.contains&&o.contains(a)?(t=n,r=!0):a===o&&(t=n,r=!0))});var n=t,a=n.activeTransaction,o=n.nextTransaction;if(r){var i=e.tasks;t.nextTransaction=e,e.abort();var s=o&&o.promise||a.promise||Promise.resolve();return e.promise=s.then(function(){return e.aborted=!1,e.state.isRendering=!0,e.state.activeTransaction=e,t.measure("schedule"),pt.flow(e,i.slice(1))})}t.isRendering=!0,t.activeTransaction=e,t.measure("schedule")}function R(e){var t=e.mount,r=e.input,n=e.state.measure,a=e.config,o=a.inner?"innerHTML":"outerHTML";n("should update");var i=t;if("string"==typeof r&&i[o]===r)return e.abort(!0);n("should update")}function x(e){if(re.has(e)){var t=re.get(e),r=t.mutationObserver,n=t.oldTree;r&&r.disconnect(),n&&!ne.has(n)&&(ce.forEach(function(e){return e(n)}),S(n)),re.delete(e)}if(e){var a=e;if(a.childNodes&&a.childNodes.length)for(var o=0;o<a.childNodes.length;o++)x(a.childNodes[o]);a.shadowRoot&&x(a.shadowRoot),ne.forEach(function(e,t){e===a&&(ce.forEach(function(e){return e(t)}),S(t))}),$e(qe),qe=Ye(O)}}function C(e){var t=e.state,r=e.mount,n=e.input,a=e.config,o=a.inner,i=r;t.mutationObserver&&!t.isDirty?t.isDirty=Boolean(t.mutationObserver.takeRecords().length):t.mutationObserver||(t.isDirty=!1),!t.isDirty&&t.oldTree||(x(i),i.ownerDocument&&t.mutationObserver&&t.mutationObserver.observe(i,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),t.oldTree=y(i),w(t.oldTree),re.set(r,t));var s=t.oldTree,c=s.nodeName,l=s.attributes;e.newTree||(e.newTree=y(n));var d=e.newTree;if(!o&&d.nodeType===K.FRAGMENT&&t.oldTree.nodeType!==K.FRAGMENT){for(var u=[],f=0;f<d.childNodes.length;f++){var h=d.childNodes[f];h.nodeType===K.TEXT&&!h.nodeValue.trim()||u.push(h)}1===u.length?e.newTree=u[0]:u.length>1&&(e.newTree=y(d.childNodes))}e.oldTree=t.oldTree;var p=e.oldTree,v=e.newTree;if(o&&p&&v){var m="string"!=typeof v.rawNodeName,g=v.nodeType===K.FRAGMENT,b=g&&!m?v.childNodes:v;e.newTree=y(c,l,b)}}function M(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Q.OBJ,o=arguments.length>5?arguments[5]:void 0;e||(e=Q.OBJ),t||(t=Q.OBJ);var i=n.svgElements,s=void 0===i?new Set:i,c=e.nodeName,l=t.nodeName,d=e===Q.OBJ||o,u="svg"===l||s.has(t),f=null;if(se.size&&se.forEach(function(n){var o=n(e,t,a);o&&o===e?f=r:!1===o?f=!1:o&&(t=o)}),null!==f||!t)return f;if(l===Qe){if(c===Qe&&e.nodeValue!==t.nodeValue)return r.push(W.NODE_VALUE,e,t.nodeValue,e.nodeValue),e.nodeValue=t.nodeValue,r;if(d)return r.push(W.NODE_VALUE,t,t.nodeValue,null),r}var h=t.childNodes||[];if(t.nodeType===K.ELEMENT){var p=d?Q.OBJ:e.attributes,v=t.attributes||{};for(var m in v){var g=v[m];m in p&&p[m]===v[m]||(d||(p[m]=g),(e&&"script"===e.nodeName||"script"!==t.nodeName||"type"!==m)&&r.push(W.SET_ATTRIBUTE,d?t:e,m,g))}if(!d)for(var b in p)b in v||(r.push(W.REMOVE_ATTRIBUTE,e,b),delete p[b])}if(o){for(var N=0;N<h.length;N++)u&&s.add(h[N]),M(null,h[N],r,n,a,!0);return r}for(var y={old:new Map,new:new Map},T=0;T<Ke.length;T++){var E=Ke[T],w=y[E],S=arguments[T],O=S&&S.childNodes;if(O&&O.length)for(var k=0;k<O.length;k++){var R=O[k];R.key&&w.set(R.key,R)}}for(var x=e.childNodes||[],C=Ze(h.length,x.length),A=0;A<C;A++){var I=x&&x[A],_=h[A];if((u||_&&"svg"===_.nodeName)&&s.add(_),_)if(I){var D=_.key,L=I.key,j=y.new.has(L),V=y.old.has(D);if(L||D){if(!j&&!V){x.splice(x.indexOf(I),1,_),M(null,_,r,n,a,!0),r.push(W.REPLACE_CHILD,_,I),A-=1;continue}if(!j){r.push(W.REMOVE_CHILD,I),x.splice(x.indexOf(I),1),A-=1;continue}if(D!==L){var P=_;D&&V?(P=y.old.get(D),x.splice(x.indexOf(P),1)):P=_,M(null,P,r,n,a,!0),r.push(W.INSERT_BEFORE,e,P,I),x.splice(A,0,P);continue}}var F=I.nodeName===_.nodeName,H=M(I,_,r,n,a,!F);if(!1!==H){if(!F){x[A]=_;var B=x.lastIndexOf(_);B>A&&x.splice(B,1),r.push(W.REPLACE_CHILD,_,I)}}else h.splice(A,0,I),C+=1}else x.push(_),M(null,_,r,n,a,!0),r.push(W.INSERT_BEFORE,e,_,null);else!1===M(I,null,r,n,a,!0)&&h.splice(A,0,I)}if(x.length!==h.length){for(var z=h.length;z<x.length;z++)r.push(W.REMOVE_CHILD,x[z]);x.length=h.length}return r}function A(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ue.document,r=arguments.length>2?arguments[2]:void 0,n=y(e),a=ne.get(n);if(a)return a;var o=n.nodeName,i=n.rawNodeName,s=void 0===i?o:i,c=n.childNodes,l=void 0===c?[]:c;r=r||"svg"===o;var d=null,u=null;if(ie.forEach(function(e){(u=e(n))&&(d=u)}),!t)return d;var f=d;f||(f="#text"===o?t.createTextNode(n.nodeValue||Q.STR):"#document-fragment"===o?t.createDocumentFragment():r?t.createElementNS(We,s):t.createElement(s),"script"===o&&(f.type="no-execute")),ne.set(n,f);for(var h=0;h<l.length;h++){var p=A(l[h],t,r);f&&p&&f.appendChild(p)}return f}function I(e){var t=e.state,r=e.state.measure,n=e.oldTree,a=e.newTree,o=e.mount;if(r("sync trees"),n&&a&&n.nodeName!==a.nodeName&&a.nodeType!==K.FRAGMENT){e.patches=[W.REPLACE_CHILD,a,n],e.oldTree=t.oldTree=a;var i=A(a);re.delete(o),re.set(i,t),e.mount=i,"script"===a.nodeName&&t.scriptsToExecute.set(a,a.attributes.type||Q.STR)}else e.patches=M(n||null,a||null,[],t,e);r("sync trees")}function _(e,t){var r;null===(r=te.get(e))||void 0===r||r.add(t)}function D(e,t){if(!t&&e){var r;null===(r=te.get(e))||void 0===r||r.clear()}else if(e&&t){var n;null===(n=te.get(e))||void 0===n||n.delete(t)}else for(var a=0;a<ee.length;a++){var o;null===(o=te.get(ee[a]))||void 0===o||o.clear()}}function L(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var a=te.get(e),o=[];if(!a)return o;var i=r[0],s=i.nodeType===K.ELEMENT;return!a.size||"textChanged"!==e&&!s?o:(a.forEach(function(e){var t=r.map(function(e){return ne.get(e)||e}),n=e.apply(void 0,c(t));"object"==typeof n&&n.then&&o.push(n)}),"attached"!==e&&"detached"!==e||i.childNodes.forEach(function(t){o.push.apply(o,c(L.apply(void 0,[e,t].concat(c(r.slice(1))))))}),o)}function j(e){return et&&e&&e.indexOf&&e.includes("&")?(et.innerHTML=e,et.textContent||Q.STR):e}function V(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Q.OBJ,r=[],n=t.ownerDocument,a=t.svgElements,o=void 0===a?new Set:a,i=e.length,s=0;;){var l=e[s];if(s===i)break;switch(l){case W.REMOVE_ATTRIBUTE:case W.SET_ATTRIBUTE:if("break"===function(){var t=l===W.SET_ATTRIBUTE,a=e[s+1],i=e[s+2],d=t?j(e[s+3]):null;s+=t?4:3;var u=o.has(a),f=A(a,n,u),h=f.getAttribute(i),p=L("attributeChanged",a,i,h,d);w(a);var v=t?st:ct;return p.length?(Promise.all(p).then(function(){return v(a,f,i,d)}),r.push.apply(r,c(p))):v(a,f,i,d),"break"}())break;case W.NODE_VALUE:if("break"===function(){var t=e[s+1],a=e[s+2],i=e[s+3],l=o.has(t);s+=4;var d=A(t,n,l);w(t);var u=L("textChanged",t,i,a);return u.length?(Promise.all(u).then(function(){return lt(d,a)}),r.push.apply(r,c(u))):lt(d,a),"break"}())break;case W.INSERT_BEFORE:var d=e[s+1],u=e[s+2],f=e[s+3];if(s+=4,!ne.has(d)&&d!==rt)continue;var h=ne.get(d);if(d===rt){var p=ne.get(f);p&&(h=p.parentNode,f=p.nextSibling?p.nextSibling:null)}var v=o.has(u);w(u);var m=f&&A(f,n,v),g=A(u,n,v);h.insertBefore(g,m||null),r.push.apply(r,c(L("attached",u)));break;case W.REPLACE_CHILD:if("break"===function(){var t,a,i,l=e[s+1],d=e[s+2];s+=3;var u=o.has(l),f=ne.get(d),h=A(l,n,u);if(!f||!f.parentNode)return"break";w(l);var p=null===(t=te.get("attached"))||void 0===t?void 0:t.size,v=null===(a=te.get("detached"))||void 0===a?void 0:a.size,m=null===(i=te.get("replaced"))||void 0===i?void 0:i.size;if(!p&&!v&&!m)return f.parentNode.replaceChild(h,f),S(d),"break";f.parentNode.insertBefore(h,f);var g=[].concat(c(p&&L("attached",l)||Q.ARR),c(v&&L("detached",d)||Q.ARR),c(m&&L("replaced",d,l)||Q.ARR));return g.length?(Promise.all(g).then(function(){f.parentNode&&f.parentNode.removeChild(f),S(d)}),r.push.apply(r,c(g))):(f.parentNode.removeChild(f),S(d)),"break"}())break;case W.REMOVE_CHILD:if("break"===function(){var t=e[s+1];s+=2;var n=ne.get(t);if(!n||!n.parentNode)return"break";var a=L("detached",t);return a.length?(Promise.all(a).then(function(){n.parentNode&&n.parentNode.removeChild(n),S(t)}),r.push.apply(r,c(a))):(n.parentNode.removeChild(n),S(t)),"break"}())break}}return r}function P(e){var t=e.mount,r=e.state,n=e.patches,a=r.mutationObserver,o=r.measure,i=r.scriptsToExecute;o("patch node");var s=t.ownerDocument,l=e.promises||[];r.ownerDocument=s||ue.document,a&&a.disconnect();var d=function(e){"script"===e.nodeName&&i.set(e,e.attributes.type)};ie.add(d),r.ownerDocument&&l.push.apply(l,c(V(n,r))),ie.delete(d),e.promises=l,o("patch node")}function F(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())}function H(){return Boolean(dt&&"noModule"in dt)}function B(e){var t=e.state,r=e.input,n=e.config,a=t.measure;if("string"==typeof r){a("parsing input for new tree");var o=T(r,void 0,n),i=o.childNodes,s=y(i);s&&(e.newTree=s),a("parsing input for new tree")}}function z(e){return e.replace(/[&<>]/g,function(e){return"&#".concat(e.charCodeAt(0),";")})}function U(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Q.STR,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.inner=!0,r.executeScripts=!("executeScripts"in r)||r.executeScripts,r.tasks=r.tasks||ft,pt.create(e,t,r).start()}function J(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Q.STR,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.inner=!1,r.executeScripts=!("executeScripts"in r)||r.executeScripts,r.tasks=r.tasks||ft,pt.create(e,t,r).start()}function G(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=y(),n=new Set(t.tasks||ft);n.delete(ht.patchNode),n.delete(ht.endAsPromise),n.add(function(e){return q(e.oldTree)}),t.tasks=c(n),t.inner=!0;var a="";try{a=pt.create(r,e,t).start()}catch(e){throw x(r),e}return x(r),a}function X(e){var t=gt(e);return t.length?" "+t.map(function(t){var r=e[t],n=!r,a="object"==typeof r||"function"==typeof r;return!0===r?t:"".concat(t).concat(n||a?"":'="'.concat(String(r),'"'))}).join(" "):""}function q(e){var t="";if(!e)return t;var r=e.childNodes,n=e.nodeType,a=e.nodeName,o=e.nodeValue,i=e.attributes;if(11===n)for(var s=0;s<r.length;s++)t+=q(r[s]);else if(r.length||1!==n){if(3===n)t+=o;else if(r.length){var c=r.map(function(e){return"".concat(q(e))}).join("");t+="<".concat(a).concat(X(i),">").concat(c,"</").concat(a,">")}}else t+="<".concat(a).concat(X(i),"></").concat(a,">");return t}function Y(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var a=y("#text",Q.STR);if(!e)return a;if("string"==typeof e&&(e=[e]),1===e.length&&!r.length){if(!e[0])return a;var o=b("strict",!1,"boolean",{strict:Y[tt]});delete Y[tt];var i=T(e[0],void 0,{parser:{strict:o}}),s=i.childNodes;return y(1===s.length?s[0]:s)}var c=Q.STR,l={attributes:{},children:{},tags:{}};e.forEach(function(e,t){if(c+=e,r.length){var n=yt(r),a=c.trim().slice(-1),o=c.lastIndexOf(">")<c.lastIndexOf("<"),i=Boolean(a.match(Nt)),s="object"==typeof n,d="".concat(Re).concat(t,"__");i?(l.tags[t]=n,c+=d):o?(l.attributes[t]=n,c+=d):bt(n)||s?(l.children[t]=y(n),c+=d):n&&(c+=n)}});var d=b("strict",!1,"boolean",{strict:Y[tt]}),u=T(c,l,{parser:{strict:d}}),f=u.childNodes;return y(1===f.length?f[0]:f)}function $(e){Y[tt]=!0;try{for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return Y.apply(void 0,[e].concat(r))}catch(e){throw Y[tt]=!1,e}}function Z(e){var t="function"==typeof e,r=e.subscribe,n=e.unsubscribe,a=e.createTreeHook,o=e.createNodeHook,i=e.syncTreeHook,s=e.releaseHook,c=e.parseHook;return t&&ae.add(e),r&&r(mt),a&&oe.add(a),o&&ie.add(o),i&&se.add(i),s&&ce.add(s),c&&le.add(c),function(){t&&ae.delete(e),n&&n(mt),a&&oe.delete(a),o&&ie.delete(o),i&&se.delete(i),s&&ce.delete(s),c&&le.delete(c)}}var K={ELEMENT:1,ATTR:2,TEXT:3,COMMENT:8,FRAGMENT:11},Q={STR:"",NUM:1,OBJ:{},ARR:[],MAP:new Map,SET:new Set,DOM:{},FUN:function(){}},W={SET_ATTRIBUTE:0,REMOVE_ATTRIBUTE:1,NODE_VALUE:2,INSERT_BEFORE:3,REPLACE_CHILD:4,REMOVE_CHILD:5},ee=["attached","detached","replaced","attributeChanged","textChanged"],te=new Map([["attached",new Set],["detached",new Set],["replaced",new Set],["attributeChanged",new Set],["textChanged",new Set]]),re=new Map,ne=new Map,ae=new Set,oe=new Set,ie=new Set,se=new Set,ce=new Set,le=new Set,de="undefined"!=typeof process?process:{env:{NODE_ENV:"development"},argv:[]},ue="object"==typeof global?global:("object"==typeof window?window:self)||{},fe=Number.parseInt,he=JSON.parse,pe={collectMetrics:!0,executeScripts:!0},ve=b("initialPoolSize",5e3),me=new Set,ge=new Set,be=new Set,Ne=function(){return{rawNodeName:Q.STR,nodeName:Q.STR,nodeValue:Q.STR,nodeType:K.ELEMENT,key:Q.STR,childNodes:[],attributes:{}}},ye={free:me,allocated:ge,protected:be},Te=me.values(),Ee={size:ve,memory:ye,fill:function(){for(var e=this,t=me.size;t<this.size;t++)me.add(Ne());this.size<me.size&&me.forEach(function(t){me.size!==e.size&&me.delete(t)})},get:function(){var e=Te.next(),t=e.value,r=void 0===t?Ne():t;return e.done&&(Te=me.values()),me.delete(r),ge.add(r),r},protect:function(e){ge.delete(e),be.add(e)},unprotect:function(e){(be.has(e)||ge.has(e))&&(be.delete(e),ge.delete(e),me.add(e))}};Ee.fill();var we=Array.isArray,Se=Ee.memory,Oe="#document-fragment",ke="#text",Re="__DIFFHTML__",xe=/<!DOCTYPE.*>/i,Ce=new RegExp("".concat(Re,"([^_]*)__")),Me={tags:[],attributes:{},children:{}},Ae=Object.assign,Ie=Array.isArray,_e=["script","noscript","style","template"],De=["source","embed","param","track","input","meta","link","area","base","col","wbr","img","br","hr"],Le={li:{li:!0},p:{p:!0,div:!0},td:{td:!0,th:!0},th:{td:!0,th:!0}},je={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}},Ve=function(e,t,r){var n;if(!("childNodes"in e.attributes)){if(t&&!xe.test(t)&&!Ce.test(t))return e.childNodes.push(y("#text",t));for(var a=[],o=t.split(Ce),i=0;i<o.length;i++){var s=o[i];if(s)if(i%2==1){var l=r.children[s],d=s in r.children?l:y("#text","".concat(Re).concat(s,"__"));if(!d)continue;var u=d.nodeType===K.FRAGMENT;"string"==typeof d.rawNodeName&&u?a.push.apply(a,c(d.childNodes)):a.push(d)}else xe.test(s)||a.push(y("#text",s))}(n=e.childNodes).push.apply(n,a)}},Pe=function(e,t,r,n){var a=null,o=/([_@$#a-z][^\s\x00-\x1F"'>\/=\uFDD0-\uFDEF\uFFFE\uFFFF]*)\s*(=\s*("([^"]+)"|'([^']+)'|(\S+)))?/gi;if(a=Ce.exec(e))return Pe(r.tags[a[1]],t,r);for(var i,s={};i=o.exec(t||Q.STR);){var c="string"==typeof e,l=i[1],d=void 0;if(""===l){var u=t.match(Ce);d=u?u[0]:""}var f=i[6]||i[5]||i[4],h=d||f||(c?i[1]:f||!0),p="''"===h||'""'===h?Q.STR:h,v=String(p).match(Ce);if(v&&v.length)for(var m=String(p).split(Ce),g=Ce.exec(l),b=g?r.attributes[g[1]]:l,N=0;N<m.length;N++){var T=m[N];if(T)if(N%2==1){var E="object"==typeof b,w=T in r.attributes,S=r.attributes[T],O="".concat(Re).concat(T,"__");if(s[b])s[b]+=w?S:O;else if(E)b&&!Ie(b)&&Ae(s,b);else if(b){var k=w?S:O;s[b]=!f||k}}else s[b]?s[b]+=T:s[b]=T}else if(v=Ce.exec(l)){var R=r.attributes[v[1]];"object"!=typeof R||Ie(R)?s[R]=p:Ae(s,R)}else s[l]=void 0===f||p}return y(e,s,s.childNodes||[])},Fe="diffHTML",He=new Map,Be=0,ze=Ee.protect,Ue=Ee.unprotect,Je=Ee.memory,Ge=Object.freeze({__proto__:null,protectVTree:w,unprotectVTree:S,gc:O}),Xe="undefined"!=typeof requestIdleCallback,qe=-1,Ye=function(e){return(Xe?requestIdleCallback:setTimeout)(e)},$e=function(e){return(Xe?cancelIdleCallback:clearTimeout)(e)},Ze=Math.max,Ke=["old","new"],Qe="#text",We="http://www.w3.org/2000/svg",et=ue.document?document.createElement("div"):null,tt=Symbol.for("diff.strict"),rt=Symbol.for("diff.after"),nt=Symbol.for("diffHTML"),at=Object.keys,ot=new Set,it=new Set,st=function(e,t,r,n){var a="object"==typeof n&&n,o="function"==typeof n,i="symbol"==typeof n,s=0===r.indexOf("on"),c=t,l=s?r.toLowerCase():r,d="s-"+e.nodeName+"-"+l,u=t;if(it.has(d))c[l]=n;else if(!ot.has(d))try{c[l]=n,it.add(d)}catch(e){ot.add(d)}if(a||o||i){if(a&&"style"===l)for(var f=at(n),h=0;h<f.length;h++)u.style[f[h]]=n[f[h]]}else{var p=null===n||void 0===n||!0===n;u.setAttribute(l,p?Q.STR:n)}},ct=function(e,t,r){var n="r-"+e.nodeName+"-"+r,a=t;if(it.has(n))a[r]=void 0,delete a[r];else if(!ot.has(n))try{a[r]=void 0,delete a[r],it.add(n)}catch(e){ot.add(n)}t.removeAttribute(r)},lt=function(e,t){var r=e;t.includes("&")?r.nodeValue=j(t):r.nodeValue=t},dt=ue.document?document.createElement("script"):null,ut=Object.assign,ft=[k,R,C,I,P,F],ht={schedule:k,shouldUpdate:R,reconcileTrees:C,syncTrees:I,patchNode:P,endAsPromise:F},pt=function(){function e(t,r,a){n(this,e),i(this,"state",Q.OBJ),i(this,"mount",Q.OBJ),i(this,"input",Q.OBJ),i(this,"oldTree",void 0),i(this,"newTree",void 0),i(this,"promise",void 0),i(this,"promises",void 0),i(this,"tasks",[]),i(this,"patches",[]),this.mount=t,this.input=r,this.config=a;var o=!a.disableMutationObserver&&"MutationObserver"in(ue.window||Q.OBJ);this.state=re.get(t)||{measure:E(this),svgElements:new Set,scriptsToExecute:new Map,activeTransaction:this,mutationObserver:o&&new ue.window.MutationObserver(Q.FUN)},this.tasks=b("tasks",ft,void 0,a).slice(),this.endedCallbacks=new Set,re.set(t,this.state)}return o(e,[{key:"start",value:function(){var t=this.state.measure,r=this.tasks,n=r.pop();return t("render"),this.aborted=!1,e.invokeMiddleware(this),n&&r.push(n),e.flow(this,r)}},{key:"abort",value:function(e){if(this.aborted=!0,e)return this.tasks[this.tasks.length-1](this)}},{key:"end",value:function(){var e=this,t=this.state,r=this.config,n=this.mount,a=t.mutationObserver,o=t.measure,i=t.svgElements,s=t.scriptsToExecute,c=n;return o("finalize"),this.completed=!0,i.clear(),t.isRendering=!1,t.isDirty=!1,c.ownerDocument&&a?a.observe(c,{subtree:!0,childList:!0,attributes:!0,characterData:!0}):t.isDirty=!0,s.forEach(function(e,n){var a=ne.get(n);if(a.type=e,r.executeScripts&&(!H()||"nomodule"!==e)){var o=ut(a.ownerDocument.createElement("script"),a);for(var i in n.attributes){var s=n.attributes[i];o.setAttribute(i,s)}o.textContent=a.textContent,re.has(a)&&(x(a),re.set(o,t)),ne.set(n,o),a.parentNode&&a.parentNode.replaceChild(o,a)}}),s.clear(),this.endedCallbacks.forEach(function(t){return t(e)}),this.endedCallbacks.clear(),o("finalize"),o("render"),t.oldTree&&w(t.oldTree),this}},{key:"onceEnded",value:function(e){this.endedCallbacks.add(e)}}],[{key:"create",value:function(t,r,n){return new e(t,r,n)}},{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(e){var t=e.state.measure,r=e.tasks;ae.forEach(function(n){var a="invoke ".concat(n.name||"anon");t(a);var o=n(e);o&&r.push(o),t(a)})}}]),e}(),vt={StateCache:re,NodeCache:ne,TransitionCache:te,MiddlewareCache:ae,CreateTreeHookCache:oe,CreateNodeHookCache:ie,SyncTreeHookCache:se,ReleaseHookCache:ce,ParseHookCache:le},mt=r({decodeEntities:j,escape:z,makeMeasure:E,memory:Ge,Pool:Ee,process:de,PATCH_TYPE:W,globalConfig:pe,createNode:A,syncTree:M,Transaction:pt,defaultTasks:ft,tasks:ht},vt),gt=Object.keys,bt=Array.isArray,Nt=/(<|\/)/,yt=function(e){var t=e.shift();return"string"==typeof t?z(j(t)):t};delete Y[tt],Y.strict=$;ft.splice(ft.indexOf(C),0,B),mt.parse=T,mt.VERSION="1.0.0-beta.29";var Tt={};Tt.VERSION="1.0.0-beta.29",Tt.addTransitionState=_,Tt.removeTransitionState=D,Tt.release=x,Tt.createTree=y,Tt.use=Z,Tt.outerHTML=J,Tt.innerHTML=U,Tt.toString=G,Tt.html=Y,Tt.Internals=mt;var Et=ue;if(nt in ue){var wt=Et[nt];"1.0.0-beta.29"!==wt.VERSION&&console.log("Loaded ".concat("1.0.0-beta.29"," after ").concat(wt.VERSION))}Et[nt]=Tt,Et.devTools&&(Et.unsubscribeDevTools=Z(Et.devTools(mt))),e.Internals=mt,e.VERSION="1.0.0-beta.29",e.addTransitionState=_,e.createTree=y,e.default=Tt,e.html=Y,e.innerHTML=U,e.outerHTML=J,e.release=x,e.removeTransitionState=D,e.toString=G,e.use=Z,Object.defineProperty(e,"__esModule",{value:!0})}); |