!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;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r/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)-->|<(\/?)([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"),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]/g,function(e){return"&#".concat(e.charCodeAt(0),";")})}var Le=function(t){for(var e=1;e")