diff --git a/dist/dist/converse-no-dependencies.js b/dist/dist/converse-no-dependencies.js new file mode 100644 index 0000000..06bacad --- /dev/null +++ b/dist/dist/converse-no-dependencies.js @@ -0,0 +1,135303 @@ +/******/ (() => { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ 5246: +/***/ (function(module, exports, __webpack_require__) { + +var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { + "@babel/helpers - typeof"; + + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }, _typeof(obj); +} +(function (global, factory) { + ( false ? 0 : _typeof(exports)) === 'object' && "object" !== 'undefined' ? factory(exports, __webpack_require__(4038)) : true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, __webpack_require__(4038)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), + __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? + (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : 0; +})(this, function (exports, localforage) { + 'use strict'; + + localforage = 'default' in localforage ? localforage['default'] : localforage; + function getSerializerPromise(localForageInstance) { + if (getSerializerPromise.result) { + return getSerializerPromise.result; + } + if (!localForageInstance || typeof localForageInstance.getSerializer !== 'function') { + return Promise.reject(new Error('localforage.getSerializer() was not available! ' + 'localforage v1.4+ is required!')); + } + getSerializerPromise.result = localForageInstance.getSerializer(); + return getSerializerPromise.result; + } + function executeCallback(promise, callback) { + if (callback) { + promise.then(function (result) { + callback(null, result); + }, function (error) { + callback(error); + }); + } + return promise; + } + function getItemKeyValue(key, callback) { + var localforageInstance = this; + var promise = localforageInstance.getItem(key).then(function (value) { + return { + key: key, + value: value + }; + }); + executeCallback(promise, callback); + return promise; + } + function getItemsGeneric(keys /*, callback*/) { + var localforageInstance = this; + var promise = new Promise(function (resolve, reject) { + var itemPromises = []; + for (var i = 0, len = keys.length; i < len; i++) { + itemPromises.push(getItemKeyValue.call(localforageInstance, keys[i])); + } + Promise.all(itemPromises).then(function (keyValuePairs) { + var result = {}; + for (var i = 0, len = keyValuePairs.length; i < len; i++) { + var keyValuePair = keyValuePairs[i]; + result[keyValuePair.key] = keyValuePair.value; + } + resolve(result); + }).catch(reject); + }); + return promise; + } + function getAllItemsUsingIterate() { + var localforageInstance = this; + var accumulator = {}; + return localforageInstance.iterate(function (value, key /*, iterationNumber*/) { + accumulator[key] = value; + }).then(function () { + return accumulator; + }); + } + function getIDBKeyRange() { + /* global IDBKeyRange, webkitIDBKeyRange, mozIDBKeyRange */ + if (typeof IDBKeyRange !== 'undefined') { + return IDBKeyRange; + } + if (typeof webkitIDBKeyRange !== 'undefined') { + return webkitIDBKeyRange; + } + if (typeof mozIDBKeyRange !== 'undefined') { + return mozIDBKeyRange; + } + } + var idbKeyRange = getIDBKeyRange(); + function getItemsIndexedDB(keys /*, callback*/) { + keys = keys.slice(); + var localforageInstance = this; + function comparer(a, b) { + return a < b ? -1 : a > b ? 1 : 0; + } + var promise = new Promise(function (resolve, reject) { + localforageInstance.ready().then(function () { + // Thanks https://hacks.mozilla.org/2014/06/breaking-the-borders-of-indexeddb/ + var dbInfo = localforageInstance._dbInfo; + var store = dbInfo.db.transaction(dbInfo.storeName, 'readonly').objectStore(dbInfo.storeName); + var set = keys.sort(comparer); + var keyRangeValue = idbKeyRange.bound(keys[0], keys[keys.length - 1], false, false); + var req; + if ('getAll' in store) { + req = store.getAll(keyRangeValue); + req.onsuccess = function () { + var value = req.result; + if (value === undefined) { + value = null; + } + resolve(value); + }; + } else { + req = store.openCursor(keyRangeValue); + var result = {}; + var i = 0; + req.onsuccess = function () /*event*/{ + var cursor = req.result; // event.target.result; + + if (!cursor) { + resolve(result); + return; + } + var key = cursor.key; + while (key > set[i]) { + i++; // The cursor has passed beyond this key. Check next. + + if (i === set.length) { + // There is no next. Stop searching. + resolve(result); + return; + } + } + if (key === set[i]) { + // The current cursor value should be included and we should continue + // a single step in case next item has the same key or possibly our + // next key in set. + var value = cursor.value; + if (value === undefined) { + value = null; + } + result[key] = value; + // onfound(cursor.value); + cursor.continue(); + } else { + // cursor.key not yet at set[i]. Forward cursor to the next key to hunt for. + cursor.continue(set[i]); + } + }; + } + req.onerror = function () /*event*/{ + reject(req.error); + }; + }).catch(reject); + }); + return promise; + } + function getItemsWebsql(keys /*, callback*/) { + var localforageInstance = this; + var promise = new Promise(function (resolve, reject) { + localforageInstance.ready().then(function () { + return getSerializerPromise(localforageInstance); + }).then(function (serializer) { + var dbInfo = localforageInstance._dbInfo; + dbInfo.db.transaction(function (t) { + var queryParts = new Array(keys.length); + for (var i = 0, len = keys.length; i < len; i++) { + queryParts[i] = '?'; + } + t.executeSql('SELECT * FROM ' + dbInfo.storeName + ' WHERE (key IN (' + queryParts.join(',') + '))', keys, function (t, results) { + var result = {}; + var rows = results.rows; + for (var i = 0, len = rows.length; i < len; i++) { + var item = rows.item(i); + var value = item.value; + + // Check to see if this is serialized content we need to + // unpack. + if (value) { + value = serializer.deserialize(value); + } + result[item.key] = value; + } + resolve(result); + }, function (t, error) { + reject(error); + }); + }); + }).catch(reject); + }); + return promise; + } + function localforageGetItems(keys, callback) { + var localforageInstance = this; + var promise; + if (!arguments.length || keys === null) { + promise = getAllItemsUsingIterate.apply(localforageInstance); + } else { + var currentDriver = localforageInstance.driver(); + if (currentDriver === localforageInstance.INDEXEDDB) { + promise = getItemsIndexedDB.apply(localforageInstance, arguments); + } else if (currentDriver === localforageInstance.WEBSQL) { + promise = getItemsWebsql.apply(localforageInstance, arguments); + } else { + promise = getItemsGeneric.apply(localforageInstance, arguments); + } + } + executeCallback(promise, callback); + return promise; + } + function extendPrototype(localforage$$1) { + var localforagePrototype = Object.getPrototypeOf(localforage$$1); + if (localforagePrototype) { + localforagePrototype.getItems = localforageGetItems; + localforagePrototype.getItems.indexedDB = function () { + return getItemsIndexedDB.apply(this, arguments); + }; + localforagePrototype.getItems.websql = function () { + return getItemsWebsql.apply(this, arguments); + }; + localforagePrototype.getItems.generic = function () { + return getItemsGeneric.apply(this, arguments); + }; + } + } + var extendPrototypeResult = extendPrototype(localforage); + exports.localforageGetItems = localforageGetItems; + exports.extendPrototype = extendPrototype; + exports.extendPrototypeResult = extendPrototypeResult; + exports.getItemsGeneric = getItemsGeneric; + Object.defineProperty(exports, '__esModule', { + value: true + }); +}); + +/***/ }), + +/***/ 3208: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var atob = __webpack_require__(2740); +var btoa = __webpack_require__(1485); +module.exports = { + atob: atob, + btoa: btoa +}; + +/***/ }), + +/***/ 2740: +/***/ ((module) => { + +"use strict"; + + +/** + * Implementation of atob() according to the HTML and Infra specs, except that + * instead of throwing INVALID_CHARACTER_ERR we return null. + */ +function atob(data) { + if (arguments.length === 0) { + throw new TypeError("1 argument required, but only 0 present."); + } + + // Web IDL requires DOMStrings to just be converted using ECMAScript + // ToString, which in our case amounts to using a template literal. + data = "".concat(data); + // "Remove all ASCII whitespace from data." + data = data.replace(/[ \t\n\f\r]/g, ""); + // "If data's length divides by 4 leaving no remainder, then: if data ends + // with one or two U+003D (=) code points, then remove them from data." + if (data.length % 4 === 0) { + data = data.replace(/==?$/, ""); + } + // "If data's length divides by 4 leaving a remainder of 1, then return + // failure." + // + // "If data contains a code point that is not one of + // + // U+002B (+) + // U+002F (/) + // ASCII alphanumeric + // + // then return failure." + if (data.length % 4 === 1 || /[^+/0-9A-Za-z]/.test(data)) { + return null; + } + // "Let output be an empty byte sequence." + var output = ""; + // "Let buffer be an empty buffer that can have bits appended to it." + // + // We append bits via left-shift and or. accumulatedBits is used to track + // when we've gotten to 24 bits. + var buffer = 0; + var accumulatedBits = 0; + // "Let position be a position variable for data, initially pointing at the + // start of data." + // + // "While position does not point past the end of data:" + for (var i = 0; i < data.length; i++) { + // "Find the code point pointed to by position in the second column of + // Table 1: The Base 64 Alphabet of RFC 4648. Let n be the number given in + // the first cell of the same row. + // + // "Append to buffer the six bits corresponding to n, most significant bit + // first." + // + // atobLookup() implements the table from RFC 4648. + buffer <<= 6; + buffer |= atobLookup(data[i]); + accumulatedBits += 6; + // "If buffer has accumulated 24 bits, interpret them as three 8-bit + // big-endian numbers. Append three bytes with values equal to those + // numbers to output, in the same order, and then empty buffer." + if (accumulatedBits === 24) { + output += String.fromCharCode((buffer & 0xff0000) >> 16); + output += String.fromCharCode((buffer & 0xff00) >> 8); + output += String.fromCharCode(buffer & 0xff); + buffer = accumulatedBits = 0; + } + // "Advance position by 1." + } + // "If buffer is not empty, it contains either 12 or 18 bits. If it contains + // 12 bits, then discard the last four and interpret the remaining eight as + // an 8-bit big-endian number. If it contains 18 bits, then discard the last + // two and interpret the remaining 16 as two 8-bit big-endian numbers. Append + // the one or two bytes with values equal to those one or two numbers to + // output, in the same order." + if (accumulatedBits === 12) { + buffer >>= 4; + output += String.fromCharCode(buffer); + } else if (accumulatedBits === 18) { + buffer >>= 2; + output += String.fromCharCode((buffer & 0xff00) >> 8); + output += String.fromCharCode(buffer & 0xff); + } + // "Return output." + return output; +} +/** + * A lookup table for atob(), which converts an ASCII character to the + * corresponding six-bit number. + */ + +var keystr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +function atobLookup(chr) { + var index = keystr.indexOf(chr); + // Throw exception if character is not in the lookup string; should not be hit in tests + return index < 0 ? undefined : index; +} +module.exports = atob; + +/***/ }), + +/***/ 1485: +/***/ ((module) => { + +"use strict"; + + +/** + * btoa() as defined by the HTML and Infra specs, which mostly just references + * RFC 4648. + */ +function btoa(s) { + if (arguments.length === 0) { + throw new TypeError("1 argument required, but only 0 present."); + } + var i; + // String conversion as required by Web IDL. + s = "".concat(s); + // "The btoa() method must throw an "InvalidCharacterError" DOMException if + // data contains any character whose code point is greater than U+00FF." + for (i = 0; i < s.length; i++) { + if (s.charCodeAt(i) > 255) { + return null; + } + } + var out = ""; + for (i = 0; i < s.length; i += 3) { + var groupsOfSix = [undefined, undefined, undefined, undefined]; + groupsOfSix[0] = s.charCodeAt(i) >> 2; + groupsOfSix[1] = (s.charCodeAt(i) & 0x03) << 4; + if (s.length > i + 1) { + groupsOfSix[1] |= s.charCodeAt(i + 1) >> 4; + groupsOfSix[2] = (s.charCodeAt(i + 1) & 0x0f) << 2; + } + if (s.length > i + 2) { + groupsOfSix[2] |= s.charCodeAt(i + 2) >> 6; + groupsOfSix[3] = s.charCodeAt(i + 2) & 0x3f; + } + for (var j = 0; j < groupsOfSix.length; j++) { + if (typeof groupsOfSix[j] === "undefined") { + out += "="; + } else { + out += btoaLookup(groupsOfSix[j]); + } + } + } + return out; +} + +/** + * Lookup table for btoa(), which converts a six-bit number into the + * corresponding ASCII character. + */ +var keystr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +function btoaLookup(index) { + if (index >= 0 && index < 64) { + return keystr[index]; + } + + // Throw INVALID_CHARACTER_ERR exception here -- won't be hit in the tests. + return undefined; +} +module.exports = btoa; + +/***/ }), + +/***/ 5542: +/***/ ((module, exports, __webpack_require__) => { + +/* module decorator */ module = __webpack_require__.nmd(module); +var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { + "@babel/helpers - typeof"; + + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }, _typeof(obj); +} +!function (t, e) { + "object" == ( false ? 0 : _typeof(exports)) && "object" == ( false ? 0 : _typeof(module)) ? module.exports = e() : true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (e), + __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? + (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : 0; +}(window, function () { + return function (t) { + var e = {}; + function r(n) { + if (e[n]) return e[n].exports; + var i = e[n] = { + i: n, + l: !1, + exports: {} + }; + return t[n].call(i.exports, i, i.exports, r), i.l = !0, i.exports; + } + return r.m = t, r.c = e, r.d = function (t, e, n) { + r.o(t, e) || Object.defineProperty(t, e, { + configurable: !1, + enumerable: !0, + get: n + }); + }, r.r = function (t) { + Object.defineProperty(t, "__esModule", { + value: !0 + }); + }, r.n = function (t) { + var e = t && t.__esModule ? function () { + return t.default; + } : function () { + return t; + }; + return r.d(e, "a", e), e; + }, r.o = function (t, e) { + return Object.prototype.hasOwnProperty.call(t, e); + }, r.p = "", r(r.s = 7); + }([function (t, e, r) { + "use strict"; + + Object.defineProperty(e, "__esModule", { + value: !0 + }); + e.loadImageElement = function (t, e) { + return new Promise(function (r, n) { + t.addEventListener("load", function () { + r(t); + }, !1), t.addEventListener("error", function (t) { + n(t); + }, !1), t.src = e; + }); + }, e.resize = function (t, e, r, n) { + if (!r && !n) return { + currentWidth: t, + currentHeight: e + }; + var i = t / e, + o = void 0, + a = void 0; + return i > r / n ? a = (o = Math.min(t, r)) / i : o = (a = Math.min(e, n)) * i, { + width: o, + height: a + }; + }; + }, function (t, e, r) { + "use strict"; + + Object.defineProperty(e, "__esModule", { + value: !0 + }); + e.base64ToFile = function (t) { + for (var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "image/jpeg", r = window.atob(t), n = [], i = 0; i < r.length; i++) n[i] = r.charCodeAt(i); + return new window.Blob([new Uint8Array(n)], { + type: e + }); + }, e.imageToCanvas = function (t, e, r, n) { + var i = document.createElement("canvas"), + o = i.getContext("2d"); + if (i.width = e, i.height = r, !n || n > 8) return o.drawImage(t, 0, 0, i.width, i.height), i; + switch (n > 4 && (i.width = r, i.height = e), n) { + case 2: + o.translate(e, 0), o.scale(-1, 1); + break; + case 3: + o.translate(e, r), o.rotate(Math.PI); + break; + case 4: + o.translate(0, r), o.scale(1, -1); + break; + case 5: + o.rotate(.5 * Math.PI), o.scale(1, -1); + break; + case 6: + o.rotate(.5 * Math.PI), o.translate(0, -r); + break; + case 7: + o.rotate(.5 * Math.PI), o.translate(e, -r), o.scale(-1, 1); + break; + case 8: + o.rotate(-.5 * Math.PI), o.translate(-e, 0); + } + return n > 4 ? o.drawImage(t, 0, 0, i.height, i.width) : o.drawImage(t, 0, 0, i.width, i.height), i; + }, e.canvasToBlob = function (t, e) { + return new Promise(function (r, n) { + t.toBlob(function (t) { + r(t); + }, "image/jpeg", e); + }); + }, e.size = function (t) { + return { + kB: .001 * t, + MB: 1e-6 * t + }; + }, e.blobToBase64 = function (t) { + return new Promise(function (e, r) { + var n = new window.FileReader(); + n.addEventListener("load", function (t) { + e(t.target.result); + }, !1), n.addEventListener("error", function (t) { + r(t); + }, !1), n.readAsDataURL(t); + }); + }; + }, function (t, e, r) { + t.exports = r(6); + }, function (t, e, r) { + "use strict"; + + Object.defineProperty(e, "__esModule", { + value: !0 + }); + e.extractOrientation = function (t) { + return new Promise(function (e, r) { + var n = new window.FileReader(); + n.onload = function (t) { + var r = new DataView(t.target.result); + 65496 !== r.getUint16(0, !1) && e(-2); + for (var n = r.byteLength, i = 2; i < n;) { + var o = r.getUint16(i, !1); + if (i += 2, 65505 === o) { + 1165519206 !== r.getUint32(i += 2, !1) && e(-1); + var a = 18761 === r.getUint16(i += 6, !1); + i += r.getUint32(i + 4, a); + var u = r.getUint16(i, a); + i += 2; + for (var s = 0; s < u; s++) 274 === r.getUint16(i + 12 * s, a) && e(r.getUint16(i + 12 * s + 8, a)); + } else { + if (65280 != (65280 & o)) break; + i += r.getUint16(i, !1); + } + } + e(-1); + }, n.readAsArrayBuffer(t.slice(0, 65536)); + }); + }; + }, function (t, e, r) { + "use strict"; + + Object.defineProperty(e, "__esModule", { + value: !0 + }); + var n, + i = r(2), + o = (n = i) && n.__esModule ? n : { + default: n + }, + a = function () { + function t(t, e) { + for (var r = 0; r < e.length; r++) { + var n = e[r]; + n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n); + } + } + return function (e, r, n) { + return r && t(e.prototype, r), n && t(e, n), e; + }; + }(), + u = r(3), + s = r(0), + c = r(1); + function f(t) { + return function () { + var e = t.apply(this, arguments); + return new Promise(function (t, r) { + return function n(i, o) { + try { + var a = e[i](o), + u = a.value; + } catch (t) { + return void r(t); + } + if (!a.done) return Promise.resolve(u).then(function (t) { + n("next", t); + }, function (t) { + n("throw", t); + }); + t(u); + }("next"); + }); + }; + } + var l = function () { + function t(e) { + !function (t, e) { + if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function"); + }(this, t), this.data = e, this.name = e.name, this.type = e.type, this.size = e.size; + } + return a(t, [{ + key: "setData", + value: function value(t) { + this.data = t, this.size = t.size, this.type = t.type; + } + }, { + key: "_calculateOrientation", + value: function () { + var t = f(o.default.mark(function t() { + var e; + return o.default.wrap(function (t) { + for (;;) switch (t.prev = t.next) { + case 0: + return t.next = 2, (0, u.extractOrientation)(this.data); + case 2: + e = t.sent, this.orientation = e; + case 4: + case "end": + return t.stop(); + } + }, t, this); + })); + return function () { + return t.apply(this, arguments); + }; + }() + }, { + key: "load", + value: function () { + var t = f(o.default.mark(function t() { + var e, r; + return o.default.wrap(function (t) { + for (;;) switch (t.prev = t.next) { + case 0: + return t.next = 2, this._calculateOrientation(); + case 2: + return e = URL.createObjectURL(this.data), r = new window.Image(), t.next = 6, (0, s.loadImageElement)(r, e); + case 6: + URL.revokeObjectURL(e), this._img = r, this.width = r.naturalWidth, this.height = r.naturalHeight; + case 10: + case "end": + return t.stop(); + } + }, t, this); + })); + return function () { + return t.apply(this, arguments); + }; + }() + }, { + key: "getCanvas", + value: function value(t, e, r) { + return void 0 !== r ? (0, c.imageToCanvas)(this._img, t, e, r) : (0, c.imageToCanvas)(this._img, t, e, this.orientation); + } + }]), t; + }(); + e.default = l, t.exports = e.default; + }, function (t, e) { + !function (e) { + "use strict"; + + var r, + n = Object.prototype, + i = n.hasOwnProperty, + o = "function" == typeof Symbol ? Symbol : {}, + a = o.iterator || "@@iterator", + u = o.asyncIterator || "@@asyncIterator", + s = o.toStringTag || "@@toStringTag", + c = "object" == _typeof(t), + f = e.regeneratorRuntime; + if (f) c && (t.exports = f);else { + (f = e.regeneratorRuntime = c ? t.exports : {}).wrap = w; + var l = "suspendedStart", + h = "suspendedYield", + p = "executing", + d = "completed", + A = {}, + v = {}; + v[a] = function () { + return this; + }; + var y = Object.getPrototypeOf, + g = y && y(y(z([]))); + g && g !== n && i.call(g, a) && (v = g); + var m = B.prototype = x.prototype = Object.create(v); + b.prototype = m.constructor = B, B.constructor = b, B[s] = b.displayName = "GeneratorFunction", f.isGeneratorFunction = function (t) { + var e = "function" == typeof t && t.constructor; + return !!e && (e === b || "GeneratorFunction" === (e.displayName || e.name)); + }, f.mark = function (t) { + return Object.setPrototypeOf ? Object.setPrototypeOf(t, B) : (t.__proto__ = B, s in t || (t[s] = "GeneratorFunction")), t.prototype = Object.create(m), t; + }, f.awrap = function (t) { + return { + __await: t + }; + }, Q(_.prototype), _.prototype[u] = function () { + return this; + }, f.AsyncIterator = _, f.async = function (t, e, r, n) { + var i = new _(w(t, e, r, n)); + return f.isGeneratorFunction(e) ? i : i.next().then(function (t) { + return t.done ? t.value : i.next(); + }); + }, Q(m), m[s] = "Generator", m[a] = function () { + return this; + }, m.toString = function () { + return "[object Generator]"; + }, f.keys = function (t) { + var e = []; + for (var r in t) e.push(r); + return e.reverse(), function r() { + for (; e.length;) { + var n = e.pop(); + if (n in t) return r.value = n, r.done = !1, r; + } + return r.done = !0, r; + }; + }, f.values = z, O.prototype = { + constructor: O, + reset: function reset(t) { + if (this.prev = 0, this.next = 0, this.sent = this._sent = r, this.done = !1, this.delegate = null, this.method = "next", this.arg = r, this.tryEntries.forEach(P), !t) for (var e in this) "t" === e.charAt(0) && i.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = r); + }, + stop: function stop() { + this.done = !0; + var t = this.tryEntries[0].completion; + if ("throw" === t.type) throw t.arg; + return this.rval; + }, + dispatchException: function dispatchException(t) { + if (this.done) throw t; + var e = this; + function n(n, i) { + return u.type = "throw", u.arg = t, e.next = n, i && (e.method = "next", e.arg = r), !!i; + } + for (var o = this.tryEntries.length - 1; o >= 0; --o) { + var a = this.tryEntries[o], + u = a.completion; + if ("root" === a.tryLoc) return n("end"); + if (a.tryLoc <= this.prev) { + var s = i.call(a, "catchLoc"), + c = i.call(a, "finallyLoc"); + if (s && c) { + if (this.prev < a.catchLoc) return n(a.catchLoc, !0); + if (this.prev < a.finallyLoc) return n(a.finallyLoc); + } else if (s) { + if (this.prev < a.catchLoc) return n(a.catchLoc, !0); + } else { + if (!c) throw new Error("try statement without catch or finally"); + if (this.prev < a.finallyLoc) return n(a.finallyLoc); + } + } + } + }, + abrupt: function abrupt(t, e) { + for (var r = this.tryEntries.length - 1; r >= 0; --r) { + var n = this.tryEntries[r]; + if (n.tryLoc <= this.prev && i.call(n, "finallyLoc") && this.prev < n.finallyLoc) { + var o = n; + break; + } + } + o && ("break" === t || "continue" === t) && o.tryLoc <= e && e <= o.finallyLoc && (o = null); + var a = o ? o.completion : {}; + return a.type = t, a.arg = e, o ? (this.method = "next", this.next = o.finallyLoc, A) : this.complete(a); + }, + complete: function complete(t, e) { + if ("throw" === t.type) throw t.arg; + return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), A; + }, + finish: function finish(t) { + for (var e = this.tryEntries.length - 1; e >= 0; --e) { + var r = this.tryEntries[e]; + if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), P(r), A; + } + }, + catch: function _catch(t) { + for (var e = this.tryEntries.length - 1; e >= 0; --e) { + var r = this.tryEntries[e]; + if (r.tryLoc === t) { + var n = r.completion; + if ("throw" === n.type) { + var i = n.arg; + P(r); + } + return i; + } + } + throw new Error("illegal catch attempt"); + }, + delegateYield: function delegateYield(t, e, n) { + return this.delegate = { + iterator: z(t), + resultName: e, + nextLoc: n + }, "next" === this.method && (this.arg = r), A; + } + }; + } + function w(t, e, r, n) { + var i = e && e.prototype instanceof x ? e : x, + o = Object.create(i.prototype), + a = new O(n || []); + return o._invoke = function (t, e, r) { + var n = l; + return function (i, o) { + if (n === p) throw new Error("Generator is already running"); + if (n === d) { + if ("throw" === i) throw o; + return j(); + } + for (r.method = i, r.arg = o;;) { + var a = r.delegate; + if (a) { + var u = k(a, r); + if (u) { + if (u === A) continue; + return u; + } + } + if ("next" === r.method) r.sent = r._sent = r.arg;else if ("throw" === r.method) { + if (n === l) throw n = d, r.arg; + r.dispatchException(r.arg); + } else "return" === r.method && r.abrupt("return", r.arg); + n = p; + var s = E(t, e, r); + if ("normal" === s.type) { + if (n = r.done ? d : h, s.arg === A) continue; + return { + value: s.arg, + done: r.done + }; + } + "throw" === s.type && (n = d, r.method = "throw", r.arg = s.arg); + } + }; + }(t, r, a), o; + } + function E(t, e, r) { + try { + return { + type: "normal", + arg: t.call(e, r) + }; + } catch (t) { + return { + type: "throw", + arg: t + }; + } + } + function x() {} + function b() {} + function B() {} + function Q(t) { + ["next", "throw", "return"].forEach(function (e) { + t[e] = function (t) { + return this._invoke(e, t); + }; + }); + } + function _(t) { + var e; + this._invoke = function (r, n) { + function o() { + return new Promise(function (e, o) { + !function e(r, n, o, a) { + var u = E(t[r], t, n); + if ("throw" !== u.type) { + var s = u.arg, + c = s.value; + return c && "object" == _typeof(c) && i.call(c, "__await") ? Promise.resolve(c.__await).then(function (t) { + e("next", t, o, a); + }, function (t) { + e("throw", t, o, a); + }) : Promise.resolve(c).then(function (t) { + s.value = t, o(s); + }, a); + } + a(u.arg); + }(r, n, e, o); + }); + } + return e = e ? e.then(o, o) : o(); + }; + } + function k(t, e) { + var n = t.iterator[e.method]; + if (n === r) { + if (e.delegate = null, "throw" === e.method) { + if (t.iterator.return && (e.method = "return", e.arg = r, k(t, e), "throw" === e.method)) return A; + e.method = "throw", e.arg = new TypeError("The iterator does not provide a 'throw' method"); + } + return A; + } + var i = E(n, t.iterator, e.arg); + if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, A; + var o = i.arg; + return o ? o.done ? (e[t.resultName] = o.value, e.next = t.nextLoc, "return" !== e.method && (e.method = "next", e.arg = r), e.delegate = null, A) : o : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, A); + } + function L(t) { + var e = { + tryLoc: t[0] + }; + 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); + } + function P(t) { + var e = t.completion || {}; + e.type = "normal", delete e.arg, t.completion = e; + } + function O(t) { + this.tryEntries = [{ + tryLoc: "root" + }], t.forEach(L, this), this.reset(!0); + } + function z(t) { + if (t) { + var e = t[a]; + if (e) return e.call(t); + if ("function" == typeof t.next) return t; + if (!isNaN(t.length)) { + var n = -1, + o = function e() { + for (; ++n < t.length;) if (i.call(t, n)) return e.value = t[n], e.done = !1, e; + return e.value = r, e.done = !0, e; + }; + return o.next = o; + } + } + return { + next: j + }; + } + function j() { + return { + value: r, + done: !0 + }; + } + }(function () { + return this; + }() || Function("return this")()); + }, function (t, e, r) { + var n = function () { + return this; + }() || Function("return this")(), + i = n.regeneratorRuntime && Object.getOwnPropertyNames(n).indexOf("regeneratorRuntime") >= 0, + o = i && n.regeneratorRuntime; + if (n.regeneratorRuntime = void 0, t.exports = r(5), i) n.regeneratorRuntime = o;else try { + delete n.regeneratorRuntime; + } catch (t) { + n.regeneratorRuntime = void 0; + } + }, function (t, e, r) { + "use strict"; + + Object.defineProperty(e, "__esModule", { + value: !0 + }); + var n = s(r(2)), + i = function () { + function t(t, e) { + for (var r = 0; r < e.length; r++) { + var n = e[r]; + n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n); + } + } + return function (e, r, n) { + return r && t(e.prototype, r), n && t(e, n), e; + }; + }(), + o = function (t) { + if (t && t.__esModule) return t; + var e = {}; + if (null != t) for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && (e[r] = t[r]); + return e.default = t, e; + }(r(1)), + a = r(0), + u = s(r(4)); + function s(t) { + return t && t.__esModule ? t : { + default: t + }; + } + function c(t) { + return function () { + var e = t.apply(this, arguments); + return new Promise(function (t, r) { + return function n(i, o) { + try { + var a = e[i](o), + u = a.value; + } catch (t) { + return void r(t); + } + if (!a.done) return Promise.resolve(u).then(function (t) { + n("next", t); + }, function (t) { + n("throw", t); + }); + t(u); + }("next"); + }); + }; + } + var f = function () { + function t() { + var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; + !function (t, e) { + if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function"); + }(this, t), this.setOptions(e); + } + return i(t, [{ + key: "setOptions", + value: function value(t) { + var e = { + targetSize: 1 / 0, + quality: .75, + minQuality: .5, + qualityStepSize: .1, + maxWidth: 1920, + maxHeight: 1920, + resize: !0, + throwIfSizeNotReached: !1, + autoRotate: !0 + }, + r = new Proxy(t, { + get: function get(t, r) { + return r in t ? t[r] : e[r]; + } + }); + this.options = r; + } + }, { + key: "_compressFile", + value: function () { + var t = c(n.default.mark(function t(e) { + var r, i; + return n.default.wrap(function (t) { + for (;;) switch (t.prev = t.next) { + case 0: + return r = new u.default(e), (i = {}).start = window.performance.now(), i.quality = this.options.quality, i.startType = r.type, t.next = 7, r.load(); + case 7: + return t.next = 9, this._compressImage(r, i); + case 9: + return t.abrupt("return", t.sent); + case 10: + case "end": + return t.stop(); + } + }, t, this); + })); + return function (e) { + return t.apply(this, arguments); + }; + }() + }, { + key: "_compressImage", + value: function () { + var t = c(n.default.mark(function t(e, r) { + var i, u, s, c, f; + return n.default.wrap(function (t) { + for (;;) switch (t.prev = t.next) { + case 0: + return r.startWidth = e.width, r.startHeight = e.height, i = void 0, u = void 0, this.options.resize ? (s = (0, a.resize)(e.width, e.height, this.options.maxWidth, this.options.maxHeight), i = s.width, u = s.height) : (i = e.width, u = e.height), r.endWidth = i, r.endHeight = u, c = this.doAutoRotation ? void 0 : 1, f = e.getCanvas(i, u, c), r.iterations = 0, r.startSizeMB = o.size(e.size).MB, t.next = 12, this._loopCompression(f, e, r); + case 12: + return r.endSizeMB = o.size(e.size).MB, r.sizeReducedInPercent = (r.startSizeMB - r.endSizeMB) / r.startSizeMB * 100, r.end = window.performance.now(), r.elapsedTimeInSeconds = (r.end - r.start) / 1e3, r.endType = e.type, t.abrupt("return", { + photo: e, + info: r + }); + case 18: + case "end": + return t.stop(); + } + }, t, this); + })); + return function (e, r) { + return t.apply(this, arguments); + }; + }() + }, { + key: "_loopCompression", + value: function () { + var t = c(n.default.mark(function t(e, r, i) { + var a; + return n.default.wrap(function (t) { + for (;;) switch (t.prev = t.next) { + case 0: + return i.iterations++, t.t0 = r, t.next = 4, o.canvasToBlob(e, i.quality); + case 4: + if (t.t1 = t.sent, t.t0.setData.call(t.t0, t.t1), 1 == i.iterations && (r.width = i.endWidth, r.height = i.endHeight), !(o.size(r.size).MB > this.options.targetSize)) { + t.next = 24; + break; + } + if (!(i.quality.toFixed(10) - .1 < this.options.minQuality)) { + t.next = 18; + break; + } + if (a = "Couldn't compress image to target size while maintaining quality.\n Target size: " + this.options.targetSize + "\n Actual size: " + o.size(r.size).MB, this.options.throwIfSizeNotReached) { + t.next = 14; + break; + } + console.error(a), t.next = 15; + break; + case 14: + throw new Error(a); + case 15: + return t.abrupt("return"); + case 18: + return i.quality -= this.options.qualityStepSize, t.next = 21, this._loopCompression(e, r, i); + case 21: + return t.abrupt("return", t.sent); + case 22: + t.next = 25; + break; + case 24: + return t.abrupt("return"); + case 25: + case "end": + return t.stop(); + } + }, t, this); + })); + return function (e, r, n) { + return t.apply(this, arguments); + }; + }() + }, { + key: "setAutoRotate", + value: function () { + var e = c(n.default.mark(function e() { + var r; + return n.default.wrap(function (e) { + for (;;) switch (e.prev = e.next) { + case 0: + return e.next = 2, t.automaticRotationFeatureTest(); + case 2: + r = e.sent, this.doAutoRotation = this.options.autoRotate && !r; + case 4: + case "end": + return e.stop(); + } + }, e, this); + })); + return function () { + return e.apply(this, arguments); + }; + }() + }, { + key: "compress", + value: function () { + var t = c(n.default.mark(function t(e) { + var r = this; + return n.default.wrap(function (t) { + for (;;) switch (t.prev = t.next) { + case 0: + return t.next = 2, this.setAutoRotate(); + case 2: + return t.abrupt("return", Promise.all(e.map(function (t) { + return r._compressFile(t); + }))); + case 3: + case "end": + return t.stop(); + } + }, t, this); + })); + return function (e) { + return t.apply(this, arguments); + }; + }() + }], [{ + key: "blobToBase64", + value: function () { + var t = c(n.default.mark(function t() { + var e = arguments; + return n.default.wrap(function (t) { + for (;;) switch (t.prev = t.next) { + case 0: + return t.next = 2, o.blobToBase64.apply(o, e); + case 2: + return t.abrupt("return", t.sent); + case 3: + case "end": + return t.stop(); + } + }, t, this); + })); + return function () { + return t.apply(this, arguments); + }; + }() + }, { + key: "loadImageElement", + value: function () { + var t = c(n.default.mark(function t() { + var e = arguments; + return n.default.wrap(function (t) { + for (;;) switch (t.prev = t.next) { + case 0: + return t.next = 2, a.loadImageElement.apply(void 0, e); + case 2: + return t.abrupt("return", t.sent); + case 3: + case "end": + return t.stop(); + } + }, t, this); + })); + return function () { + return t.apply(this, arguments); + }; + }() + }, { + key: "automaticRotationFeatureTest", + value: function value() { + return new Promise(function (t) { + var e = new Image(); + e.onload = function () { + var r = 1 === e.width && 2 === e.height; + t(r); + }, e.src = "data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q=="; + }); + } + }]), t; + }(); + e.default = f, t.exports = e.default; + }]); +}); + +/***/ }), + +/***/ 2977: +/***/ ((module) => { + +"use strict"; + + +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +module.exports = function (cssWithMappingToString) { + var list = []; + + // return the list of modules as css string + list.toString = function toString() { + return this.map(function (item) { + var content = ""; + var needLayer = typeof item[5] !== "undefined"; + if (item[4]) { + content += "@supports (".concat(item[4], ") {"); + } + if (item[2]) { + content += "@media ".concat(item[2], " {"); + } + if (needLayer) { + content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {"); + } + content += cssWithMappingToString(item); + if (needLayer) { + content += "}"; + } + if (item[2]) { + content += "}"; + } + if (item[4]) { + content += "}"; + } + return content; + }).join(""); + }; + + // import a list of modules into the list + list.i = function i(modules, media, dedupe, supports, layer) { + if (typeof modules === "string") { + modules = [[null, modules, undefined]]; + } + var alreadyImportedModules = {}; + if (dedupe) { + for (var k = 0; k < this.length; k++) { + var id = this[k][0]; + if (id != null) { + alreadyImportedModules[id] = true; + } + } + } + for (var _k = 0; _k < modules.length; _k++) { + var item = [].concat(modules[_k]); + if (dedupe && alreadyImportedModules[item[0]]) { + continue; + } + if (typeof layer !== "undefined") { + if (typeof item[5] === "undefined") { + item[5] = layer; + } else { + item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}"); + item[5] = layer; + } + } + if (media) { + if (!item[2]) { + item[2] = media; + } else { + item[1] = "@media ".concat(item[2], " {").concat(item[1], "}"); + item[2] = media; + } + } + if (supports) { + if (!item[4]) { + item[4] = "".concat(supports); + } else { + item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}"); + item[4] = supports; + } + } + list.push(item); + } + }; + return list; +}; + +/***/ }), + +/***/ 8539: +/***/ ((module) => { + +"use strict"; + + +module.exports = function (item) { + var content = item[1]; + var cssMapping = item[3]; + if (!cssMapping) { + return content; + } + if (typeof btoa === "function") { + var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(cssMapping)))); + var data = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(base64); + var sourceMapping = "/*# ".concat(data, " */"); + return [content].concat([sourceMapping]).join("\n"); + } + return [content].join("\n"); +}; + +/***/ }), + +/***/ 4735: +/***/ (function(module, exports, __webpack_require__) { + +var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { + "@babel/helpers - typeof"; + + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }, _typeof(obj); +} +!function (t, e) { + "object" == ( false ? 0 : _typeof(exports)) && "undefined" != "object" ? module.exports = e() : true ? !(__WEBPACK_AMD_DEFINE_FACTORY__ = (e), + __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? + (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : + __WEBPACK_AMD_DEFINE_FACTORY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : 0; +}(this, function () { + "use strict"; + + var t = 1e3, + e = 6e4, + n = 36e5, + r = "millisecond", + i = "second", + s = "minute", + u = "hour", + a = "day", + o = "week", + f = "month", + h = "quarter", + c = "year", + d = "date", + l = "Invalid Date", + $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, + y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, + M = { + name: "en", + weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), + months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), + ordinal: function ordinal(t) { + var e = ["th", "st", "nd", "rd"], + n = t % 100; + return "[" + t + (e[(n - 20) % 10] || e[n] || e[0]) + "]"; + } + }, + m = function m(t, e, n) { + var r = String(t); + return !r || r.length >= e ? t : "" + Array(e + 1 - r.length).join(n) + t; + }, + v = { + s: m, + z: function z(t) { + var e = -t.utcOffset(), + n = Math.abs(e), + r = Math.floor(n / 60), + i = n % 60; + return (e <= 0 ? "+" : "-") + m(r, 2, "0") + ":" + m(i, 2, "0"); + }, + m: function t(e, n) { + if (e.date() < n.date()) return -t(n, e); + var r = 12 * (n.year() - e.year()) + (n.month() - e.month()), + i = e.clone().add(r, f), + s = n - i < 0, + u = e.clone().add(r + (s ? -1 : 1), f); + return +(-(r + (n - i) / (s ? i - u : u - i)) || 0); + }, + a: function a(t) { + return t < 0 ? Math.ceil(t) || 0 : Math.floor(t); + }, + p: function p(t) { + return { + M: f, + y: c, + w: o, + d: a, + D: d, + h: u, + m: s, + s: i, + ms: r, + Q: h + }[t] || String(t || "").toLowerCase().replace(/s$/, ""); + }, + u: function u(t) { + return void 0 === t; + } + }, + g = "en", + D = {}; + D[g] = M; + var p = function p(t) { + return t instanceof _; + }, + S = function t(e, n, r) { + var i; + if (!e) return g; + if ("string" == typeof e) { + var s = e.toLowerCase(); + D[s] && (i = s), n && (D[s] = n, i = s); + var u = e.split("-"); + if (!i && u.length > 1) return t(u[0]); + } else { + var a = e.name; + D[a] = e, i = a; + } + return !r && i && (g = i), i || !r && g; + }, + w = function w(t, e) { + if (p(t)) return t.clone(); + var n = "object" == _typeof(e) ? e : {}; + return n.date = t, n.args = arguments, new _(n); + }, + O = v; + O.l = S, O.i = p, O.w = function (t, e) { + return w(t, { + locale: e.$L, + utc: e.$u, + x: e.$x, + $offset: e.$offset + }); + }; + var _ = function () { + function M(t) { + this.$L = S(t.locale, null, !0), this.parse(t); + } + var m = M.prototype; + return m.parse = function (t) { + this.$d = function (t) { + var e = t.date, + n = t.utc; + if (null === e) return new Date(NaN); + if (O.u(e)) return new Date(); + if (e instanceof Date) return new Date(e); + if ("string" == typeof e && !/Z$/i.test(e)) { + var r = e.match($); + if (r) { + var i = r[2] - 1 || 0, + s = (r[7] || "0").substring(0, 3); + return n ? new Date(Date.UTC(r[1], i, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, s)) : new Date(r[1], i, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, s); + } + } + return new Date(e); + }(t), this.$x = t.x || {}, this.init(); + }, m.init = function () { + var t = this.$d; + this.$y = t.getFullYear(), this.$M = t.getMonth(), this.$D = t.getDate(), this.$W = t.getDay(), this.$H = t.getHours(), this.$m = t.getMinutes(), this.$s = t.getSeconds(), this.$ms = t.getMilliseconds(); + }, m.$utils = function () { + return O; + }, m.isValid = function () { + return !(this.$d.toString() === l); + }, m.isSame = function (t, e) { + var n = w(t); + return this.startOf(e) <= n && n <= this.endOf(e); + }, m.isAfter = function (t, e) { + return w(t) < this.startOf(e); + }, m.isBefore = function (t, e) { + return this.endOf(e) < w(t); + }, m.$g = function (t, e, n) { + return O.u(t) ? this[e] : this.set(n, t); + }, m.unix = function () { + return Math.floor(this.valueOf() / 1e3); + }, m.valueOf = function () { + return this.$d.getTime(); + }, m.startOf = function (t, e) { + var n = this, + r = !!O.u(e) || e, + h = O.p(t), + l = function l(t, e) { + var i = O.w(n.$u ? Date.UTC(n.$y, e, t) : new Date(n.$y, e, t), n); + return r ? i : i.endOf(a); + }, + $ = function $(t, e) { + return O.w(n.toDate()[t].apply(n.toDate("s"), (r ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e)), n); + }, + y = this.$W, + M = this.$M, + m = this.$D, + v = "set" + (this.$u ? "UTC" : ""); + switch (h) { + case c: + return r ? l(1, 0) : l(31, 11); + case f: + return r ? l(1, M) : l(0, M + 1); + case o: + var g = this.$locale().weekStart || 0, + D = (y < g ? y + 7 : y) - g; + return l(r ? m - D : m + (6 - D), M); + case a: + case d: + return $(v + "Hours", 0); + case u: + return $(v + "Minutes", 1); + case s: + return $(v + "Seconds", 2); + case i: + return $(v + "Milliseconds", 3); + default: + return this.clone(); + } + }, m.endOf = function (t) { + return this.startOf(t, !1); + }, m.$set = function (t, e) { + var n, + o = O.p(t), + h = "set" + (this.$u ? "UTC" : ""), + l = (n = {}, n[a] = h + "Date", n[d] = h + "Date", n[f] = h + "Month", n[c] = h + "FullYear", n[u] = h + "Hours", n[s] = h + "Minutes", n[i] = h + "Seconds", n[r] = h + "Milliseconds", n)[o], + $ = o === a ? this.$D + (e - this.$W) : e; + if (o === f || o === c) { + var y = this.clone().set(d, 1); + y.$d[l]($), y.init(), this.$d = y.set(d, Math.min(this.$D, y.daysInMonth())).$d; + } else l && this.$d[l]($); + return this.init(), this; + }, m.set = function (t, e) { + return this.clone().$set(t, e); + }, m.get = function (t) { + return this[O.p(t)](); + }, m.add = function (r, h) { + var d, + l = this; + r = Number(r); + var $ = O.p(h), + y = function y(t) { + var e = w(l); + return O.w(e.date(e.date() + Math.round(t * r)), l); + }; + if ($ === f) return this.set(f, this.$M + r); + if ($ === c) return this.set(c, this.$y + r); + if ($ === a) return y(1); + if ($ === o) return y(7); + var M = (d = {}, d[s] = e, d[u] = n, d[i] = t, d)[$] || 1, + m = this.$d.getTime() + r * M; + return O.w(m, this); + }, m.subtract = function (t, e) { + return this.add(-1 * t, e); + }, m.format = function (t) { + var e = this, + n = this.$locale(); + if (!this.isValid()) return n.invalidDate || l; + var r = t || "YYYY-MM-DDTHH:mm:ssZ", + i = O.z(this), + s = this.$H, + u = this.$m, + a = this.$M, + o = n.weekdays, + f = n.months, + h = function h(t, n, i, s) { + return t && (t[n] || t(e, r)) || i[n].slice(0, s); + }, + c = function c(t) { + return O.s(s % 12 || 12, t, "0"); + }, + d = n.meridiem || function (t, e, n) { + var r = t < 12 ? "AM" : "PM"; + return n ? r.toLowerCase() : r; + }, + $ = { + YY: String(this.$y).slice(-2), + YYYY: O.s(this.$y, 4, "0"), + M: a + 1, + MM: O.s(a + 1, 2, "0"), + MMM: h(n.monthsShort, a, f, 3), + MMMM: h(f, a), + D: this.$D, + DD: O.s(this.$D, 2, "0"), + d: String(this.$W), + dd: h(n.weekdaysMin, this.$W, o, 2), + ddd: h(n.weekdaysShort, this.$W, o, 3), + dddd: o[this.$W], + H: String(s), + HH: O.s(s, 2, "0"), + h: c(1), + hh: c(2), + a: d(s, u, !0), + A: d(s, u, !1), + m: String(u), + mm: O.s(u, 2, "0"), + s: String(this.$s), + ss: O.s(this.$s, 2, "0"), + SSS: O.s(this.$ms, 3, "0"), + Z: i + }; + return r.replace(y, function (t, e) { + return e || $[t] || i.replace(":", ""); + }); + }, m.utcOffset = function () { + return 15 * -Math.round(this.$d.getTimezoneOffset() / 15); + }, m.diff = function (r, d, l) { + var $, + y = O.p(d), + M = w(r), + m = (M.utcOffset() - this.utcOffset()) * e, + v = this - M, + g = O.m(this, M); + return g = ($ = {}, $[c] = g / 12, $[f] = g, $[h] = g / 3, $[o] = (v - m) / 6048e5, $[a] = (v - m) / 864e5, $[u] = v / n, $[s] = v / e, $[i] = v / t, $)[y] || v, l ? g : O.a(g); + }, m.daysInMonth = function () { + return this.endOf(f).$D; + }, m.$locale = function () { + return D[this.$L]; + }, m.locale = function (t, e) { + if (!t) return this.$L; + var n = this.clone(), + r = S(t, e, !0); + return r && (n.$L = r), n; + }, m.clone = function () { + return O.w(this.$d, this); + }, m.toDate = function () { + return new Date(this.valueOf()); + }, m.toJSON = function () { + return this.isValid() ? this.toISOString() : null; + }, m.toISOString = function () { + return this.$d.toISOString(); + }, m.toString = function () { + return this.$d.toUTCString(); + }, M; + }(), + T = _.prototype; + return w.prototype = T, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", f], ["$y", c], ["$D", d]].forEach(function (t) { + T[t[1]] = function (e) { + return this.$g(e, t[0], t[1]); + }; + }), w.extend = function (t, e) { + return t.$i || (t(e, _, w), t.$i = !0), w; + }, w.locale = S, w.isDayjs = p, w.unix = function (t) { + return w(1e3 * t); + }, w.en = D[g], w.Ls = D, w.p = {}, w; +}); + +/***/ }), + +/***/ 4289: +/***/ (function(module, exports, __webpack_require__) { + +var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { + "@babel/helpers - typeof"; + + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }, _typeof(obj); +} +!function (e, t) { + "object" == ( false ? 0 : _typeof(exports)) && "undefined" != "object" ? module.exports = t() : true ? !(__WEBPACK_AMD_DEFINE_FACTORY__ = (t), + __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? + (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : + __WEBPACK_AMD_DEFINE_FACTORY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : 0; +}(this, function () { + "use strict"; + + return function (e, t) { + var r = t.prototype, + n = r.format; + r.format = function (e) { + var t = this, + r = this.$locale(); + if (!this.isValid()) return n.bind(this)(e); + var s = this.$utils(), + a = (e || "YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g, function (e) { + switch (e) { + case "Q": + return Math.ceil((t.$M + 1) / 3); + case "Do": + return r.ordinal(t.$D); + case "gggg": + return t.weekYear(); + case "GGGG": + return t.isoWeekYear(); + case "wo": + return r.ordinal(t.week(), "W"); + case "w": + case "ww": + return s.s(t.week(), "w" === e ? 1 : 2, "0"); + case "W": + case "WW": + return s.s(t.isoWeek(), "W" === e ? 1 : 2, "0"); + case "k": + case "kk": + return s.s(String(0 === t.$H ? 24 : t.$H), "k" === e ? 1 : 2, "0"); + case "X": + return Math.floor(t.$d.getTime() / 1e3); + case "x": + return t.$d.getTime(); + case "z": + return "[" + t.offsetName() + "]"; + case "zzz": + return "[" + t.offsetName("long") + "]"; + default: + return e; + } + }); + return n.bind(this)(a); + }; + }; +}); + +/***/ }), + +/***/ 1754: +/***/ (function(module, exports, __webpack_require__) { + +var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof2(obj) { + "@babel/helpers - typeof"; + + return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }, _typeof2(obj); +} +/*! @license DOMPurify 2.4.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.4.5/LICENSE */ + +(function (global, factory) { + ( false ? 0 : _typeof2(exports)) === 'object' && "object" !== 'undefined' ? module.exports = factory() : true ? !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory), + __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? + (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : + __WEBPACK_AMD_DEFINE_FACTORY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : (0); +})(this, function () { + 'use strict'; + + function _typeof(obj) { + "@babel/helpers - typeof"; + + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }, _typeof(obj); + } + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + return _setPrototypeOf(o, p); + } + function _isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + return true; + } catch (e) { + return false; + } + } + function _construct(Parent, args, Class) { + if (_isNativeReflectConstruct()) { + _construct = Reflect.construct; + } else { + _construct = function _construct(Parent, args, Class) { + var a = [null]; + a.push.apply(a, args); + var Constructor = Function.bind.apply(Parent, a); + var instance = new Constructor(); + if (Class) _setPrototypeOf(instance, Class.prototype); + return instance; + }; + } + return _construct.apply(null, arguments); + } + function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); + } + function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) return _arrayLikeToArray(arr); + } + function _iterableToArray(iter) { + if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); + } + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + return arr2; + } + function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + var hasOwnProperty = Object.hasOwnProperty, + setPrototypeOf = Object.setPrototypeOf, + isFrozen = Object.isFrozen, + getPrototypeOf = Object.getPrototypeOf, + getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; + var freeze = Object.freeze, + seal = Object.seal, + create = Object.create; // eslint-disable-line import/no-mutable-exports + + var _ref = typeof Reflect !== 'undefined' && Reflect, + apply = _ref.apply, + construct = _ref.construct; + if (!apply) { + apply = function apply(fun, thisValue, args) { + return fun.apply(thisValue, args); + }; + } + if (!freeze) { + freeze = function freeze(x) { + return x; + }; + } + if (!seal) { + seal = function seal(x) { + return x; + }; + } + if (!construct) { + construct = function construct(Func, args) { + return _construct(Func, _toConsumableArray(args)); + }; + } + var arrayForEach = unapply(Array.prototype.forEach); + var arrayPop = unapply(Array.prototype.pop); + var arrayPush = unapply(Array.prototype.push); + var stringToLowerCase = unapply(String.prototype.toLowerCase); + var stringToString = unapply(String.prototype.toString); + var stringMatch = unapply(String.prototype.match); + var stringReplace = unapply(String.prototype.replace); + var stringIndexOf = unapply(String.prototype.indexOf); + var stringTrim = unapply(String.prototype.trim); + var regExpTest = unapply(RegExp.prototype.test); + var typeErrorCreate = unconstruct(TypeError); + function unapply(func) { + return function (thisArg) { + for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + return apply(func, thisArg, args); + }; + } + function unconstruct(func) { + return function () { + for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + args[_key2] = arguments[_key2]; + } + return construct(func, args); + }; + } + /* Add properties to a lookup table */ + + function addToSet(set, array, transformCaseFunc) { + transformCaseFunc = transformCaseFunc ? transformCaseFunc : stringToLowerCase; + if (setPrototypeOf) { + // Make 'in' and truthy checks like Boolean(set.constructor) + // independent of any properties defined on Object.prototype. + // Prevent prototype setters from intercepting set as a this value. + setPrototypeOf(set, null); + } + var l = array.length; + while (l--) { + var element = array[l]; + if (typeof element === 'string') { + var lcElement = transformCaseFunc(element); + if (lcElement !== element) { + // Config presets (e.g. tags.js, attrs.js) are immutable. + if (!isFrozen(array)) { + array[l] = lcElement; + } + element = lcElement; + } + } + set[element] = true; + } + return set; + } + /* Shallow clone an object */ + + function clone(object) { + var newObject = create(null); + var property; + for (property in object) { + if (apply(hasOwnProperty, object, [property]) === true) { + newObject[property] = object[property]; + } + } + return newObject; + } + /* IE10 doesn't support __lookupGetter__ so lets' + * simulate it. It also automatically checks + * if the prop is function or getter and behaves + * accordingly. */ + + function lookupGetter(object, prop) { + while (object !== null) { + var desc = getOwnPropertyDescriptor(object, prop); + if (desc) { + if (desc.get) { + return unapply(desc.get); + } + if (typeof desc.value === 'function') { + return unapply(desc.value); + } + } + object = getPrototypeOf(object); + } + function fallbackValue(element) { + console.warn('fallback value for', element); + return null; + } + return fallbackValue; + } + var html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']); // SVG + + var svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']); + var svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']); // List of SVG elements that are disallowed by default. + // We still need to know them so that we can do namespace + // checks properly in case one wants to add them to + // allow-list. + + var svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'fedropshadow', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']); + var mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover']); // Similarly to SVG, we want to know all MathML elements, + // even those that we disallow by default. + + var mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']); + var text = freeze(['#text']); + var html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns', 'slot']); + var svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']); + var mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']); + var xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']); + var MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode + + var ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm); + var TMPLIT_EXPR = seal(/\${[\w\W]*}/gm); + var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape + + var ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape + + var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape + ); + + var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i); + var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex + ); + + var DOCTYPE_NAME = seal(/^html$/i); + var getGlobal = function getGlobal() { + return typeof window === 'undefined' ? null : window; + }; + /** + * Creates a no-op policy for internal use only. + * Don't export this function outside this module! + * @param {?TrustedTypePolicyFactory} trustedTypes The policy factory. + * @param {Document} document The document object (to determine policy name suffix) + * @return {?TrustedTypePolicy} The policy created (or null, if Trusted Types + * are not supported). + */ + + var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, document) { + if (_typeof(trustedTypes) !== 'object' || typeof trustedTypes.createPolicy !== 'function') { + return null; + } // Allow the callers to control the unique policy name + // by adding a data-tt-policy-suffix to the script element with the DOMPurify. + // Policy creation with duplicate names throws in Trusted Types. + + var suffix = null; + var ATTR_NAME = 'data-tt-policy-suffix'; + if (document.currentScript && document.currentScript.hasAttribute(ATTR_NAME)) { + suffix = document.currentScript.getAttribute(ATTR_NAME); + } + var policyName = 'dompurify' + (suffix ? '#' + suffix : ''); + try { + return trustedTypes.createPolicy(policyName, { + createHTML: function createHTML(html) { + return html; + }, + createScriptURL: function createScriptURL(scriptUrl) { + return scriptUrl; + } + }); + } catch (_) { + // Policy creation failed (most likely another DOMPurify script has + // already run). Skip creating the policy, as this will only cause errors + // if TT are enforced. + console.warn('TrustedTypes policy ' + policyName + ' could not be created.'); + return null; + } + }; + function createDOMPurify() { + var window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal(); + var DOMPurify = function DOMPurify(root) { + return createDOMPurify(root); + }; + /** + * Version label, exposed for easier checks + * if DOMPurify is up to date or not + */ + + DOMPurify.version = '2.4.5'; + /** + * Array of elements that DOMPurify removed during sanitation. + * Empty if nothing was removed. + */ + + DOMPurify.removed = []; + if (!window || !window.document || window.document.nodeType !== 9) { + // Not running in a browser, provide a factory function + // so that you can pass your own Window + DOMPurify.isSupported = false; + return DOMPurify; + } + var originalDocument = window.document; + var document = window.document; + var DocumentFragment = window.DocumentFragment, + HTMLTemplateElement = window.HTMLTemplateElement, + Node = window.Node, + Element = window.Element, + NodeFilter = window.NodeFilter, + _window$NamedNodeMap = window.NamedNodeMap, + NamedNodeMap = _window$NamedNodeMap === void 0 ? window.NamedNodeMap || window.MozNamedAttrMap : _window$NamedNodeMap, + HTMLFormElement = window.HTMLFormElement, + DOMParser = window.DOMParser, + trustedTypes = window.trustedTypes; + var ElementPrototype = Element.prototype; + var cloneNode = lookupGetter(ElementPrototype, 'cloneNode'); + var getNextSibling = lookupGetter(ElementPrototype, 'nextSibling'); + var getChildNodes = lookupGetter(ElementPrototype, 'childNodes'); + var getParentNode = lookupGetter(ElementPrototype, 'parentNode'); // As per issue #47, the web-components registry is inherited by a + // new document created via createHTMLDocument. As per the spec + // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries) + // a new empty registry is used when creating a template contents owner + // document, so we use that as our parent document to ensure nothing + // is inherited. + + if (typeof HTMLTemplateElement === 'function') { + var template = document.createElement('template'); + if (template.content && template.content.ownerDocument) { + document = template.content.ownerDocument; + } + } + var trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, originalDocument); + var emptyHTML = trustedTypesPolicy ? trustedTypesPolicy.createHTML('') : ''; + var _document = document, + implementation = _document.implementation, + createNodeIterator = _document.createNodeIterator, + createDocumentFragment = _document.createDocumentFragment, + getElementsByTagName = _document.getElementsByTagName; + var importNode = originalDocument.importNode; + var documentMode = {}; + try { + documentMode = clone(document).documentMode ? document.documentMode : {}; + } catch (_) {} + var hooks = {}; + /** + * Expose whether this browser supports running the full DOMPurify. + */ + + DOMPurify.isSupported = typeof getParentNode === 'function' && implementation && typeof implementation.createHTMLDocument !== 'undefined' && documentMode !== 9; + var MUSTACHE_EXPR$1 = MUSTACHE_EXPR, + ERB_EXPR$1 = ERB_EXPR, + TMPLIT_EXPR$1 = TMPLIT_EXPR, + DATA_ATTR$1 = DATA_ATTR, + ARIA_ATTR$1 = ARIA_ATTR, + IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA, + ATTR_WHITESPACE$1 = ATTR_WHITESPACE; + var IS_ALLOWED_URI$1 = IS_ALLOWED_URI; + /** + * We consider the elements and attributes below to be safe. Ideally + * don't add any new ones but feel free to remove unwanted ones. + */ + + /* allowed element names */ + + var ALLOWED_TAGS = null; + var DEFAULT_ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray(html$1), _toConsumableArray(svg$1), _toConsumableArray(svgFilters), _toConsumableArray(mathMl$1), _toConsumableArray(text))); + /* Allowed attribute names */ + + var ALLOWED_ATTR = null; + var DEFAULT_ALLOWED_ATTR = addToSet({}, [].concat(_toConsumableArray(html), _toConsumableArray(svg), _toConsumableArray(mathMl), _toConsumableArray(xml))); + /* + * Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements. + * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements) + * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list) + * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`. + */ + + var CUSTOM_ELEMENT_HANDLING = Object.seal(Object.create(null, { + tagNameCheck: { + writable: true, + configurable: false, + enumerable: true, + value: null + }, + attributeNameCheck: { + writable: true, + configurable: false, + enumerable: true, + value: null + }, + allowCustomizedBuiltInElements: { + writable: true, + configurable: false, + enumerable: true, + value: false + } + })); + /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */ + + var FORBID_TAGS = null; + /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */ + + var FORBID_ATTR = null; + /* Decide if ARIA attributes are okay */ + + var ALLOW_ARIA_ATTR = true; + /* Decide if custom data attributes are okay */ + + var ALLOW_DATA_ATTR = true; + /* Decide if unknown protocols are okay */ + + var ALLOW_UNKNOWN_PROTOCOLS = false; + /* Decide if self-closing tags in attributes are allowed. + * Usually removed due to a mXSS issue in jQuery 3.0 */ + + var ALLOW_SELF_CLOSE_IN_ATTR = true; + /* Output should be safe for common template engines. + * This means, DOMPurify removes data attributes, mustaches and ERB + */ + + var SAFE_FOR_TEMPLATES = false; + /* Decide if document with ... should be returned */ + + var WHOLE_DOCUMENT = false; + /* Track whether config is already set on this instance of DOMPurify. */ + + var SET_CONFIG = false; + /* Decide if all elements (e.g. style, script) must be children of + * document.body. By default, browsers might move them to document.head */ + + var FORCE_BODY = false; + /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html + * string (or a TrustedHTML object if Trusted Types are supported). + * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead + */ + + var RETURN_DOM = false; + /* Decide if a DOM `DocumentFragment` should be returned, instead of a html + * string (or a TrustedHTML object if Trusted Types are supported) */ + + var RETURN_DOM_FRAGMENT = false; + /* Try to return a Trusted Type object instead of a string, return a string in + * case Trusted Types are not supported */ + + var RETURN_TRUSTED_TYPE = false; + /* Output should be free from DOM clobbering attacks? + * This sanitizes markups named with colliding, clobberable built-in DOM APIs. + */ + + var SANITIZE_DOM = true; + /* Achieve full DOM Clobbering protection by isolating the namespace of named + * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules. + * + * HTML/DOM spec rules that enable DOM Clobbering: + * - Named Access on Window (§7.3.3) + * - DOM Tree Accessors (§3.1.5) + * - Form Element Parent-Child Relations (§4.10.3) + * - Iframe srcdoc / Nested WindowProxies (§4.8.5) + * - HTMLCollection (§4.2.10.2) + * + * Namespace isolation is implemented by prefixing `id` and `name` attributes + * with a constant string, i.e., `user-content-` + */ + + var SANITIZE_NAMED_PROPS = false; + var SANITIZE_NAMED_PROPS_PREFIX = 'user-content-'; + /* Keep element content when removing element? */ + + var KEEP_CONTENT = true; + /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead + * of importing it into a new Document and returning a sanitized copy */ + + var IN_PLACE = false; + /* Allow usage of profiles like html, svg and mathMl */ + + var USE_PROFILES = {}; + /* Tags to ignore content of when KEEP_CONTENT is true */ + + var FORBID_CONTENTS = null; + var DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']); + /* Tags that are safe for data: URIs */ + + var DATA_URI_TAGS = null; + var DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']); + /* Attributes safe for values like "javascript:" */ + + var URI_SAFE_ATTRIBUTES = null; + var DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']); + var MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML'; + var SVG_NAMESPACE = 'http://www.w3.org/2000/svg'; + var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml'; + /* Document namespace */ + + var NAMESPACE = HTML_NAMESPACE; + var IS_EMPTY_INPUT = false; + /* Allowed XHTML+XML namespaces */ + + var ALLOWED_NAMESPACES = null; + var DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString); + /* Parsing of strict XHTML documents */ + + var PARSER_MEDIA_TYPE; + var SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html']; + var DEFAULT_PARSER_MEDIA_TYPE = 'text/html'; + var transformCaseFunc; + /* Keep a reference to config to pass to hooks */ + + var CONFIG = null; + /* Ideally, do not touch anything below this line */ + + /* ______________________________________________ */ + + var formElement = document.createElement('form'); + var isRegexOrFunction = function isRegexOrFunction(testValue) { + return testValue instanceof RegExp || testValue instanceof Function; + }; + /** + * _parseConfig + * + * @param {Object} cfg optional config literal + */ + // eslint-disable-next-line complexity + + var _parseConfig = function _parseConfig(cfg) { + if (CONFIG && CONFIG === cfg) { + return; + } + /* Shield configuration object from tampering */ + + if (!cfg || _typeof(cfg) !== 'object') { + cfg = {}; + } + /* Shield configuration object from prototype pollution */ + + cfg = clone(cfg); + PARSER_MEDIA_TYPE = + // eslint-disable-next-line unicorn/prefer-includes + SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE; // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is. + + transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase; + /* Set configuration parameters */ + + ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS; + ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR; + ALLOWED_NAMESPACES = 'ALLOWED_NAMESPACES' in cfg ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES; + URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), + // eslint-disable-line indent + cfg.ADD_URI_SAFE_ATTR, + // eslint-disable-line indent + transformCaseFunc // eslint-disable-line indent + ) // eslint-disable-line indent + : DEFAULT_URI_SAFE_ATTRIBUTES; + DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS), + // eslint-disable-line indent + cfg.ADD_DATA_URI_TAGS, + // eslint-disable-line indent + transformCaseFunc // eslint-disable-line indent + ) // eslint-disable-line indent + : DEFAULT_DATA_URI_TAGS; + FORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS; + FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {}; + FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {}; + USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false; + ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true + + ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true + + ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false + + ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true + + SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false + + WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false + + RETURN_DOM = cfg.RETURN_DOM || false; // Default false + + RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false + + RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false + + FORCE_BODY = cfg.FORCE_BODY || false; // Default false + + SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true + + SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false + + KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true + + IN_PLACE = cfg.IN_PLACE || false; // Default false + + IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI$1; + NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE; + CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {}; + if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) { + CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck; + } + if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) { + CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck; + } + if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') { + CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements; + } + if (SAFE_FOR_TEMPLATES) { + ALLOW_DATA_ATTR = false; + } + if (RETURN_DOM_FRAGMENT) { + RETURN_DOM = true; + } + /* Parse profile info */ + + if (USE_PROFILES) { + ALLOWED_TAGS = addToSet({}, _toConsumableArray(text)); + ALLOWED_ATTR = []; + if (USE_PROFILES.html === true) { + addToSet(ALLOWED_TAGS, html$1); + addToSet(ALLOWED_ATTR, html); + } + if (USE_PROFILES.svg === true) { + addToSet(ALLOWED_TAGS, svg$1); + addToSet(ALLOWED_ATTR, svg); + addToSet(ALLOWED_ATTR, xml); + } + if (USE_PROFILES.svgFilters === true) { + addToSet(ALLOWED_TAGS, svgFilters); + addToSet(ALLOWED_ATTR, svg); + addToSet(ALLOWED_ATTR, xml); + } + if (USE_PROFILES.mathMl === true) { + addToSet(ALLOWED_TAGS, mathMl$1); + addToSet(ALLOWED_ATTR, mathMl); + addToSet(ALLOWED_ATTR, xml); + } + } + /* Merge configuration parameters */ + + if (cfg.ADD_TAGS) { + if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) { + ALLOWED_TAGS = clone(ALLOWED_TAGS); + } + addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc); + } + if (cfg.ADD_ATTR) { + if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) { + ALLOWED_ATTR = clone(ALLOWED_ATTR); + } + addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc); + } + if (cfg.ADD_URI_SAFE_ATTR) { + addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc); + } + if (cfg.FORBID_CONTENTS) { + if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) { + FORBID_CONTENTS = clone(FORBID_CONTENTS); + } + addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc); + } + /* Add #text in case KEEP_CONTENT is set to true */ + + if (KEEP_CONTENT) { + ALLOWED_TAGS['#text'] = true; + } + /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */ + + if (WHOLE_DOCUMENT) { + addToSet(ALLOWED_TAGS, ['html', 'head', 'body']); + } + /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */ + + if (ALLOWED_TAGS.table) { + addToSet(ALLOWED_TAGS, ['tbody']); + delete FORBID_TAGS.tbody; + } // Prevent further manipulation of configuration. + // Not available in IE8, Safari 5, etc. + + if (freeze) { + freeze(cfg); + } + CONFIG = cfg; + }; + var MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']); + var HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'desc', 'title', 'annotation-xml']); // Certain elements are allowed in both SVG and HTML + // namespace. We need to specify them explicitly + // so that they don't get erroneously deleted from + // HTML namespace. + + var COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']); + /* Keep track of all possible SVG and MathML tags + * so that we can perform the namespace checks + * correctly. */ + + var ALL_SVG_TAGS = addToSet({}, svg$1); + addToSet(ALL_SVG_TAGS, svgFilters); + addToSet(ALL_SVG_TAGS, svgDisallowed); + var ALL_MATHML_TAGS = addToSet({}, mathMl$1); + addToSet(ALL_MATHML_TAGS, mathMlDisallowed); + /** + * + * + * @param {Element} element a DOM element whose namespace is being checked + * @returns {boolean} Return false if the element has a + * namespace that a spec-compliant parser would never + * return. Return true otherwise. + */ + + var _checkValidNamespace = function _checkValidNamespace(element) { + var parent = getParentNode(element); // In JSDOM, if we're inside shadow DOM, then parentNode + // can be null. We just simulate parent in this case. + + if (!parent || !parent.tagName) { + parent = { + namespaceURI: NAMESPACE, + tagName: 'template' + }; + } + var tagName = stringToLowerCase(element.tagName); + var parentTagName = stringToLowerCase(parent.tagName); + if (!ALLOWED_NAMESPACES[element.namespaceURI]) { + return false; + } + if (element.namespaceURI === SVG_NAMESPACE) { + // The only way to switch from HTML namespace to SVG + // is via . If it happens via any other tag, then + // it should be killed. + if (parent.namespaceURI === HTML_NAMESPACE) { + return tagName === 'svg'; + } // The only way to switch from MathML to SVG is via` + // svg if parent is either or MathML + // text integration points. + + if (parent.namespaceURI === MATHML_NAMESPACE) { + return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]); + } // We only allow elements that are defined in SVG + // spec. All others are disallowed in SVG namespace. + + return Boolean(ALL_SVG_TAGS[tagName]); + } + if (element.namespaceURI === MATHML_NAMESPACE) { + // The only way to switch from HTML namespace to MathML + // is via . If it happens via any other tag, then + // it should be killed. + if (parent.namespaceURI === HTML_NAMESPACE) { + return tagName === 'math'; + } // The only way to switch from SVG to MathML is via + // and HTML integration points + + if (parent.namespaceURI === SVG_NAMESPACE) { + return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName]; + } // We only allow elements that are defined in MathML + // spec. All others are disallowed in MathML namespace. + + return Boolean(ALL_MATHML_TAGS[tagName]); + } + if (element.namespaceURI === HTML_NAMESPACE) { + // The only way to switch from SVG to HTML is via + // HTML integration points, and from MathML to HTML + // is via MathML text integration points + if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) { + return false; + } + if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) { + return false; + } // We disallow tags that are specific for MathML + // or SVG and should never appear in HTML namespace + + return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]); + } // For XHTML and XML documents that support custom namespaces + + if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) { + return true; + } // The code should never reach this place (this means + // that the element somehow got namespace that is not + // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES). + // Return false just in case. + + return false; + }; + /** + * _forceRemove + * + * @param {Node} node a DOM node + */ + + var _forceRemove = function _forceRemove(node) { + arrayPush(DOMPurify.removed, { + element: node + }); + try { + // eslint-disable-next-line unicorn/prefer-dom-node-remove + node.parentNode.removeChild(node); + } catch (_) { + try { + node.outerHTML = emptyHTML; + } catch (_) { + node.remove(); + } + } + }; + /** + * _removeAttribute + * + * @param {String} name an Attribute name + * @param {Node} node a DOM node + */ + + var _removeAttribute = function _removeAttribute(name, node) { + try { + arrayPush(DOMPurify.removed, { + attribute: node.getAttributeNode(name), + from: node + }); + } catch (_) { + arrayPush(DOMPurify.removed, { + attribute: null, + from: node + }); + } + node.removeAttribute(name); // We void attribute values for unremovable "is"" attributes + + if (name === 'is' && !ALLOWED_ATTR[name]) { + if (RETURN_DOM || RETURN_DOM_FRAGMENT) { + try { + _forceRemove(node); + } catch (_) {} + } else { + try { + node.setAttribute(name, ''); + } catch (_) {} + } + } + }; + /** + * _initDocument + * + * @param {String} dirty a string of dirty markup + * @return {Document} a DOM, filled with the dirty markup + */ + + var _initDocument = function _initDocument(dirty) { + /* Create a HTML document */ + var doc; + var leadingWhitespace; + if (FORCE_BODY) { + dirty = '' + dirty; + } else { + /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */ + var matches = stringMatch(dirty, /^[\r\n\t ]+/); + leadingWhitespace = matches && matches[0]; + } + if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) { + // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict) + dirty = '' + dirty + ''; + } + var dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty; + /* + * Use the DOMParser API by default, fallback later if needs be + * DOMParser not work for svg when has multiple root element. + */ + + if (NAMESPACE === HTML_NAMESPACE) { + try { + doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE); + } catch (_) {} + } + /* Use createHTMLDocument in case DOMParser is not available */ + + if (!doc || !doc.documentElement) { + doc = implementation.createDocument(NAMESPACE, 'template', null); + try { + doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload; + } catch (_) {// Syntax error if dirtyPayload is invalid xml + } + } + var body = doc.body || doc.documentElement; + if (dirty && leadingWhitespace) { + body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null); + } + /* Work on whole document or just its body */ + + if (NAMESPACE === HTML_NAMESPACE) { + return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0]; + } + return WHOLE_DOCUMENT ? doc.documentElement : body; + }; + /** + * _createIterator + * + * @param {Document} root document/fragment to create iterator for + * @return {Iterator} iterator instance + */ + + var _createIterator = function _createIterator(root) { + return createNodeIterator.call(root.ownerDocument || root, root, + // eslint-disable-next-line no-bitwise + NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null, false); + }; + /** + * _isClobbered + * + * @param {Node} elm element to check for clobbering attacks + * @return {Boolean} true if clobbered, false if safe + */ + + var _isClobbered = function _isClobbered(elm) { + return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function' || typeof elm.hasChildNodes !== 'function'); + }; + /** + * _isNode + * + * @param {Node} obj object to check whether it's a DOM node + * @return {Boolean} true is object is a DOM node + */ + + var _isNode = function _isNode(object) { + return _typeof(Node) === 'object' ? object instanceof Node : object && _typeof(object) === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'; + }; + /** + * _executeHook + * Execute user configurable hooks + * + * @param {String} entryPoint Name of the hook's entry point + * @param {Node} currentNode node to work on with the hook + * @param {Object} data additional hook parameters + */ + + var _executeHook = function _executeHook(entryPoint, currentNode, data) { + if (!hooks[entryPoint]) { + return; + } + arrayForEach(hooks[entryPoint], function (hook) { + hook.call(DOMPurify, currentNode, data, CONFIG); + }); + }; + /** + * _sanitizeElements + * + * @protect nodeName + * @protect textContent + * @protect removeChild + * + * @param {Node} currentNode to check for permission to exist + * @return {Boolean} true if node was killed, false if left alive + */ + + var _sanitizeElements = function _sanitizeElements(currentNode) { + var content; + /* Execute a hook if present */ + + _executeHook('beforeSanitizeElements', currentNode, null); + /* Check if element is clobbered or can clobber */ + + if (_isClobbered(currentNode)) { + _forceRemove(currentNode); + return true; + } + /* Check if tagname contains Unicode */ + + if (regExpTest(/[\u0080-\uFFFF]/, currentNode.nodeName)) { + _forceRemove(currentNode); + return true; + } + /* Now let's check the element's type and name */ + + var tagName = transformCaseFunc(currentNode.nodeName); + /* Execute a hook if present */ + + _executeHook('uponSanitizeElement', currentNode, { + tagName: tagName, + allowedTags: ALLOWED_TAGS + }); + /* Detect mXSS attempts abusing namespace confusion */ + + if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && (!_isNode(currentNode.content) || !_isNode(currentNode.content.firstElementChild)) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) { + _forceRemove(currentNode); + return true; + } + /* Mitigate a problem with templates inside select */ + + if (tagName === 'select' && regExpTest(/