mirror of
https://github.com/discourse/discourse.git
synced 2024-12-14 00:23:58 +08:00
1 line
23 KiB
JavaScript
1 line
23 KiB
JavaScript
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):(e=e||self,t(e.diff={}))}(this,function(e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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 n(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),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(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 i(e){return s(e)||d(e)||c(e)||u()}function s(e){if(Array.isArray(e))return l(e)}function d(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function c(e,t){if(e){if("string"==typeof e)return l(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)?l(e,t):void 0}}function l(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 u(){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 f(e,t,r){var n=null;if(ae.protected.has(e)||ae.allocated.has(e))n=e;else if(!e||ne(e)){var a=e?e.length:0;r=[];for(var o=0;o<a;o++)r.push(e[o]);n=f(oe,null,r)}if(n)return n;var s="object"==typeof e,d=e;if(e&&s&&"ownerDocument"in d){var c;if(3===d.nodeType){var l=f(ie,d.nodeValue);return B.set(l,e),l}t={},r=[];var u=d.attributes;if(1===d.nodeType&&u&&u.length)for(var h=0;h<u.length;h++){var p=u[h],v=p.name,m=p.value;""===m&&v in d?t[v]=e[v]:t[v]=m}if((1===d.nodeType||11===d.nodeType)&&d.childNodes.length){r=[];for(var g=0;g<d.childNodes.length;g++){var N=d.childNodes[g];r.push(f(N))}}return B.forEach(function(t,r){t===e&&(n=r)}),n=n||f(d.nodeName,t,r),n.attributes=t,n.childNodes.length=0,(c=n.childNodes).push.apply(c,i(r)),B.set(n,e),n}if(s){var y=e.rawNodeName,b=e.nodeName,T=e.nodeValue,E=e.attributes,w=e.childNodes,k=e.children,S=y||b,O=f(S,E||null,k||w);return T&&(O.nodeValue=T),O}for(var x=arguments.length,_=new Array(x>3?x-3:0),C=3;C<x;C++)_[C-3]=arguments[C];_.length&&(r=[r].concat(_)),n=re.get();var A=e===ie;"string"==typeof e?(n.rawNodeName=e,n.nodeName=n.rawNodeName.toLowerCase()):(n.rawNodeName=e,n.nodeName=oe),n.nodeValue="",n.key="",n.childNodes.length=0,n.attributes={};var R=ne(t)||"object"!=typeof t,I=R?t:r,j=ne(I)?I:[I];if(A){var M=j.join("");return n.nodeType=3,n.nodeValue=String(M||""),n}if(n.nodeName===oe?n.nodeType=11:n.nodeType="#comment"===e?8:1,I&&j.length)for(var V=0;V<j.length;V++){var L=j[V];if(ne(L)){var H;(H=n.childNodes).push.apply(H,i(L))}else{if(!L)continue;if(11===L.nodeType&&"string"==typeof L.rawNodeName){var P;(P=n.childNodes).push.apply(P,i(L.childNodes))}else L&&"object"==typeof L?n.childNodes.push(f(L)):n.childNodes.push(f(ie,null,L))}}return t&&"object"==typeof t&&!ne(t)&&(n.attributes=t),"script"===n.nodeName&&n.attributes.src&&(n.key=String(n.attributes.src)),n.attributes&&"key"in n.attributes&&(n.key=String(n.attributes.key)),Y.size&&Y.forEach(function(e,t){(t=e(n))&&(n=f(t))}),n}function h(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r.parser||(r.parser={}),t||(t=ue);var n=new Set(r.parser.rawElements?r.parser.rawElements:pe),a=new Set(r.parser.selfClosingElements||ve),o=/<!--[^]*?(?=-->)-->|<(\/?)([a-z\-\_][a-z0-9\-\_]*)\s*([^>]*?)(\/?)>/gi,i=f("#document-fragment",null,[]),s=[i],d=i,c=-1;if(!e.includes("<")&&e)return Ne(d,e,t),i;for(var l,u,h=0;l=o.exec(e);h++){c>-1&&c+l[0].length<o.lastIndex&&(u=e.slice(c,o.lastIndex-l[0].length))&&Ne(d,u,t);var p=o.lastIndex-l[0].length;if(-1==
|