diff --git a/src/conversejs/converse.min.js b/src/conversejs/converse.min.js new file mode 100644 index 0000000000000000000000000000000000000000..b57f4288d89cf861e24e225d0f7cf24ef540fc90 --- /dev/null +++ b/src/conversejs/converse.min.js @@ -0,0 +1,28181 @@ +function getDefaultExportFromCjs(x) { + return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x; +} +function createCommonjsModule(fn) { + var module = {exports: {}}; + return fn(module, module.exports), module.exports; +} +var __VIRTUAL_FILE = createCommonjsModule(function(module, exports) { + !function(e) { + function t(t2) { + for (var n2, i2, o2 = t2[0], s2 = t2[1], a2 = 0, l = []; a2 < o2.length; a2++) + i2 = o2[a2], Object.prototype.hasOwnProperty.call(r, i2) && r[i2] && l.push(r[i2][0]), r[i2] = 0; + for (n2 in s2) + Object.prototype.hasOwnProperty.call(s2, n2) && (e[n2] = s2[n2]); + for (c && c(t2); l.length; ) + l.shift()(); + } + var n = {}, r = {178: 0}; + function i(t2) { + if (n[t2]) + return n[t2].exports; + var r2 = n[t2] = {i: t2, l: false, exports: {}}; + return e[t2].call(r2.exports, r2, r2.exports, i), r2.l = true, r2.exports; + } + i.e = function(e2) { + var t2 = [], n2 = r[e2]; + if (n2 !== 0) + if (n2) + t2.push(n2[2]); + else { + var o2 = new Promise(function(t3, i2) { + n2 = r[e2] = [t3, i2]; + }); + t2.push(n2[2] = o2); + var s2, a2 = document.createElement("script"); + a2.charset = "utf-8", a2.timeout = 120, i.nc && a2.setAttribute("nonce", i.nc), a2.src = function(e3) { + return i.p + "" + ({0: "locales/dayjs/af", 1: "locales/dayjs/ar", 2: "locales/dayjs/ar-dz", 3: "locales/dayjs/ar-kw", 4: "locales/dayjs/ar-ly", 5: "locales/dayjs/ar-ma", 6: "locales/dayjs/ar-sa", 7: "locales/dayjs/ar-tn", 8: "locales/dayjs/az", 9: "locales/dayjs/be", 10: "locales/dayjs/bg", 11: "locales/dayjs/bi", 12: "locales/dayjs/bm", 13: "locales/dayjs/bn", 14: "locales/dayjs/bo", 15: "locales/dayjs/br", 16: "locales/dayjs/bs", 17: "locales/dayjs/ca", 18: "locales/dayjs/cs", 19: "locales/dayjs/cv", 20: "locales/dayjs/cy", 21: "locales/dayjs/da", 22: "locales/dayjs/de", 23: "locales/dayjs/de-at", 24: "locales/dayjs/de-ch", 25: "locales/dayjs/dv", 26: "locales/dayjs/el", 27: "locales/dayjs/en", 28: "locales/dayjs/en-SG", 29: "locales/dayjs/en-au", 30: "locales/dayjs/en-ca", 31: "locales/dayjs/en-gb", 32: "locales/dayjs/en-ie", 33: "locales/dayjs/en-il", 34: "locales/dayjs/en-in", 35: "locales/dayjs/en-nz", 36: "locales/dayjs/en-tt", 37: "locales/dayjs/eo", 38: "locales/dayjs/es", 39: "locales/dayjs/es-do", 40: "locales/dayjs/es-pr", 41: "locales/dayjs/es-us", 42: "locales/dayjs/et", 43: "locales/dayjs/eu", 44: "locales/dayjs/fa", 45: "locales/dayjs/fi", 46: "locales/dayjs/fo", 47: "locales/dayjs/fr", 48: "locales/dayjs/fr-ca", 49: "locales/dayjs/fr-ch", 50: "locales/dayjs/fy", 51: "locales/dayjs/ga", 52: "locales/dayjs/gd", 53: "locales/dayjs/gl", 54: "locales/dayjs/gom-latn", 55: "locales/dayjs/gu", 56: "locales/dayjs/he", 57: "locales/dayjs/hi", 58: "locales/dayjs/hr", 59: "locales/dayjs/ht", 60: "locales/dayjs/hu", 61: "locales/dayjs/hy-am", 62: "locales/dayjs/id", 63: "locales/dayjs/is", 64: "locales/dayjs/it", 65: "locales/dayjs/it-ch", 66: "locales/dayjs/ja", 67: "locales/dayjs/jv", 68: "locales/dayjs/ka", 69: "locales/dayjs/kk", 70: "locales/dayjs/km", 71: "locales/dayjs/kn", 72: "locales/dayjs/ko", 73: "locales/dayjs/ku", 74: "locales/dayjs/ky", 75: "locales/dayjs/lb", 76: "locales/dayjs/lo", 77: "locales/dayjs/lt", 78: "locales/dayjs/lv", 79: "locales/dayjs/me", 80: "locales/dayjs/mi", 81: "locales/dayjs/mk", 82: "locales/dayjs/ml", 83: "locales/dayjs/mn", 84: "locales/dayjs/mr", 85: "locales/dayjs/ms", 86: "locales/dayjs/ms-my", 87: "locales/dayjs/mt", 88: "locales/dayjs/my", 89: "locales/dayjs/nb", 90: "locales/dayjs/ne", 91: "locales/dayjs/nl", 92: "locales/dayjs/nl-be", 93: "locales/dayjs/nn", 94: "locales/dayjs/oc-lnc", 95: "locales/dayjs/pa-in", 96: "locales/dayjs/pl", 97: "locales/dayjs/pt", 98: "locales/dayjs/pt-br", 99: "locales/dayjs/ro", 100: "locales/dayjs/ru", 101: "locales/dayjs/rw", 102: "locales/dayjs/sd", 103: "locales/dayjs/se", 104: "locales/dayjs/si", 105: "locales/dayjs/sk", 106: "locales/dayjs/sl", 107: "locales/dayjs/sq", 108: "locales/dayjs/sr", 109: "locales/dayjs/sr-cyrl", 110: "locales/dayjs/ss", 111: "locales/dayjs/sv", 112: "locales/dayjs/sw", 113: "locales/dayjs/ta", 114: "locales/dayjs/te", 115: "locales/dayjs/tet", 116: "locales/dayjs/tg", 117: "locales/dayjs/th", 118: "locales/dayjs/tk", 119: "locales/dayjs/tl-ph", 120: "locales/dayjs/tlh", 121: "locales/dayjs/tr", 122: "locales/dayjs/tzl", 123: "locales/dayjs/tzm", 124: "locales/dayjs/tzm-latn", 125: "locales/dayjs/ug-cn", 126: "locales/dayjs/uk", 127: "locales/dayjs/ur", 128: "locales/dayjs/uz", 129: "locales/dayjs/uz-latn", 130: "locales/dayjs/vi", 131: "locales/dayjs/x-pseudo", 132: "locales/dayjs/yo", 133: "locales/dayjs/zh", 134: "locales/dayjs/zh-cn", 135: "locales/dayjs/zh-hk", 136: "locales/dayjs/zh-tw", 137: "emojis", 138: "icons", 139: "locales/af-LC_MESSAGES-converse-po", 140: "locales/ar-LC_MESSAGES-converse-po", 141: "locales/bg-LC_MESSAGES-converse-po", 142: "locales/ca-LC_MESSAGES-converse-po", 143: "locales/cs-LC_MESSAGES-converse-po", 144: "locales/da-LC_MESSAGES-converse-po", 145: "locales/dayjs/index-d-ts", 146: "locales/dayjs/types-d-ts", 147: "locales/de-LC_MESSAGES-converse-po", 148: "locales/eo-LC_MESSAGES-converse-po", 149: "locales/es-LC_MESSAGES-converse-po", 150: "locales/eu-LC_MESSAGES-converse-po", 151: "locales/fi-LC_MESSAGES-converse-po", 152: "locales/fr-LC_MESSAGES-converse-po", 153: "locales/gl-LC_MESSAGES-converse-po", 154: "locales/he-LC_MESSAGES-converse-po", 155: "locales/hi-LC_MESSAGES-converse-po", 156: "locales/hu-LC_MESSAGES-converse-po", 157: "locales/id-LC_MESSAGES-converse-po", 158: "locales/it-LC_MESSAGES-converse-po", 159: "locales/ja-LC_MESSAGES-converse-po", 160: "locales/lt-LC_MESSAGES-converse-po", 161: "locales/mr-LC_MESSAGES-converse-po", 162: "locales/nb-LC_MESSAGES-converse-po", 163: "locales/nl-LC_MESSAGES-converse-po", 164: "locales/nl_BE-LC_MESSAGES-converse-po", 165: "locales/oc-LC_MESSAGES-converse-po", 166: "locales/pl-LC_MESSAGES-converse-po", 167: "locales/pt-LC_MESSAGES-converse-po", 168: "locales/pt_BR-LC_MESSAGES-converse-po", 169: "locales/ro-LC_MESSAGES-converse-po", 170: "locales/ru-LC_MESSAGES-converse-po", 171: "locales/sv-LC_MESSAGES-converse-po", 172: "locales/th-LC_MESSAGES-converse-po", 173: "locales/tr-LC_MESSAGES-converse-po", 174: "locales/uk-LC_MESSAGES-converse-po", 175: "locales/vi-LC_MESSAGES-converse-po", 176: "locales/zh_CN-LC_MESSAGES-converse-po", 177: "locales/zh_TW-LC_MESSAGES-converse-po"}[e3] || e3) + ".js"; + }(e2); + var c2 = new Error(); + s2 = function(t3) { + a2.onerror = a2.onload = null, clearTimeout(l); + var n3 = r[e2]; + if (n3 !== 0) { + if (n3) { + var i2 = t3 && (t3.type === "load" ? "missing" : t3.type), o3 = t3 && t3.target && t3.target.src; + c2.message = "Loading chunk " + e2 + " failed.\n(" + i2 + ": " + o3 + ")", c2.name = "ChunkLoadError", c2.type = i2, c2.request = o3, n3[1](c2); + } + r[e2] = void 0; + } + }; + var l = setTimeout(function() { + s2({type: "timeout", target: a2}); + }, 12e4); + a2.onerror = a2.onload = s2, document.head.appendChild(a2); + } + return Promise.all(t2); + }, i.m = e, i.c = n, i.d = function(e2, t2, n2) { + i.o(e2, t2) || Object.defineProperty(e2, t2, {enumerable: true, get: n2}); + }, i.r = function(e2) { + typeof Symbol != "undefined" && Symbol.toStringTag && Object.defineProperty(e2, Symbol.toStringTag, {value: "Module"}), Object.defineProperty(e2, "__esModule", {value: true}); + }, i.t = function(e2, t2) { + if (1 & t2 && (e2 = i(e2)), 8 & t2) + return e2; + if (4 & t2 && typeof e2 == "object" && e2 && e2.__esModule) + return e2; + var n2 = Object.create(null); + if (i.r(n2), Object.defineProperty(n2, "default", {enumerable: true, value: e2}), 2 & t2 && typeof e2 != "string") + for (var r2 in e2) + i.d(n2, r2, function(t3) { + return e2[t3]; + }.bind(null, r2)); + return n2; + }, i.n = function(e2) { + var t2 = e2 && e2.__esModule ? function() { + return e2.default; + } : function() { + return e2; + }; + return i.d(t2, "a", t2), t2; + }, i.o = function(e2, t2) { + return Object.prototype.hasOwnProperty.call(e2, t2); + }, i.p = "/dist/", i.oe = function(e2) { + throw console.error(e2), e2; + }; + var o = window.webpackJsonp = window.webpackJsonp || [], s = o.push.bind(o); + o.push = t, o = o.slice(); + for (var a = 0; a < o.length; a++) + t(o[a]); + var c = s; + i(i.s = 326); + }([function(e, t, n) { + n.d(t, "a", function() { + return v; + }), n.d(t, "c", function() { + return _; + }), n.d(t, "b", function() { + return b; + }), n.d(t, "d", function() { + return y; + }), n.d(t, "e", function() { + return w; + }); + var r = n(15); + const i = function(e2, t2) { + const n2 = (65535 & e2) + (65535 & t2); + return (e2 >> 16) + (t2 >> 16) + (n2 >> 16) << 16 | 65535 & n2; + }, o = function(e2) { + if (typeof e2 != "string") + throw new Error("str2binl was passed a non-string"); + const t2 = []; + for (let n2 = 0; n2 < 8 * e2.length; n2 += 8) + t2[n2 >> 5] |= (255 & e2.charCodeAt(n2 / 8)) << n2 % 32; + return t2; + }, s = function(e2, t2, n2, r2, o2, s2) { + return i((a2 = i(i(t2, e2), i(r2, s2))) << (c2 = o2) | a2 >>> 32 - c2, n2); + var a2, c2; + }, a = function(e2, t2, n2, r2, i2, o2, a2) { + return s(t2 & n2 | ~t2 & r2, e2, t2, i2, o2, a2); + }, c = function(e2, t2, n2, r2, i2, o2, a2) { + return s(t2 & r2 | n2 & ~r2, e2, t2, i2, o2, a2); + }, l = function(e2, t2, n2, r2, i2, o2, a2) { + return s(t2 ^ n2 ^ r2, e2, t2, i2, o2, a2); + }, u = function(e2, t2, n2, r2, i2, o2, a2) { + return s(n2 ^ (t2 | ~r2), e2, t2, i2, o2, a2); + }, d = function(e2, t2) { + e2[t2 >> 5] |= 128 << t2 % 32, e2[14 + (t2 + 64 >>> 9 << 4)] = t2; + let n2, r2, o2, s2, d2 = 1732584193, h2 = -271733879, f2 = -1732584194, p2 = 271733878; + for (let t3 = 0; t3 < e2.length; t3 += 16) + n2 = d2, r2 = h2, o2 = f2, s2 = p2, d2 = a(d2, h2, f2, p2, e2[t3 + 0], 7, -680876936), p2 = a(p2, d2, h2, f2, e2[t3 + 1], 12, -389564586), f2 = a(f2, p2, d2, h2, e2[t3 + 2], 17, 606105819), h2 = a(h2, f2, p2, d2, e2[t3 + 3], 22, -1044525330), d2 = a(d2, h2, f2, p2, e2[t3 + 4], 7, -176418897), p2 = a(p2, d2, h2, f2, e2[t3 + 5], 12, 1200080426), f2 = a(f2, p2, d2, h2, e2[t3 + 6], 17, -1473231341), h2 = a(h2, f2, p2, d2, e2[t3 + 7], 22, -45705983), d2 = a(d2, h2, f2, p2, e2[t3 + 8], 7, 1770035416), p2 = a(p2, d2, h2, f2, e2[t3 + 9], 12, -1958414417), f2 = a(f2, p2, d2, h2, e2[t3 + 10], 17, -42063), h2 = a(h2, f2, p2, d2, e2[t3 + 11], 22, -1990404162), d2 = a(d2, h2, f2, p2, e2[t3 + 12], 7, 1804603682), p2 = a(p2, d2, h2, f2, e2[t3 + 13], 12, -40341101), f2 = a(f2, p2, d2, h2, e2[t3 + 14], 17, -1502002290), h2 = a(h2, f2, p2, d2, e2[t3 + 15], 22, 1236535329), d2 = c(d2, h2, f2, p2, e2[t3 + 1], 5, -165796510), p2 = c(p2, d2, h2, f2, e2[t3 + 6], 9, -1069501632), f2 = c(f2, p2, d2, h2, e2[t3 + 11], 14, 643717713), h2 = c(h2, f2, p2, d2, e2[t3 + 0], 20, -373897302), d2 = c(d2, h2, f2, p2, e2[t3 + 5], 5, -701558691), p2 = c(p2, d2, h2, f2, e2[t3 + 10], 9, 38016083), f2 = c(f2, p2, d2, h2, e2[t3 + 15], 14, -660478335), h2 = c(h2, f2, p2, d2, e2[t3 + 4], 20, -405537848), d2 = c(d2, h2, f2, p2, e2[t3 + 9], 5, 568446438), p2 = c(p2, d2, h2, f2, e2[t3 + 14], 9, -1019803690), f2 = c(f2, p2, d2, h2, e2[t3 + 3], 14, -187363961), h2 = c(h2, f2, p2, d2, e2[t3 + 8], 20, 1163531501), d2 = c(d2, h2, f2, p2, e2[t3 + 13], 5, -1444681467), p2 = c(p2, d2, h2, f2, e2[t3 + 2], 9, -51403784), f2 = c(f2, p2, d2, h2, e2[t3 + 7], 14, 1735328473), h2 = c(h2, f2, p2, d2, e2[t3 + 12], 20, -1926607734), d2 = l(d2, h2, f2, p2, e2[t3 + 5], 4, -378558), p2 = l(p2, d2, h2, f2, e2[t3 + 8], 11, -2022574463), f2 = l(f2, p2, d2, h2, e2[t3 + 11], 16, 1839030562), h2 = l(h2, f2, p2, d2, e2[t3 + 14], 23, -35309556), d2 = l(d2, h2, f2, p2, e2[t3 + 1], 4, -1530992060), p2 = l(p2, d2, h2, f2, e2[t3 + 4], 11, 1272893353), f2 = l(f2, p2, d2, h2, e2[t3 + 7], 16, -155497632), h2 = l(h2, f2, p2, d2, e2[t3 + 10], 23, -1094730640), d2 = l(d2, h2, f2, p2, e2[t3 + 13], 4, 681279174), p2 = l(p2, d2, h2, f2, e2[t3 + 0], 11, -358537222), f2 = l(f2, p2, d2, h2, e2[t3 + 3], 16, -722521979), h2 = l(h2, f2, p2, d2, e2[t3 + 6], 23, 76029189), d2 = l(d2, h2, f2, p2, e2[t3 + 9], 4, -640364487), p2 = l(p2, d2, h2, f2, e2[t3 + 12], 11, -421815835), f2 = l(f2, p2, d2, h2, e2[t3 + 15], 16, 530742520), h2 = l(h2, f2, p2, d2, e2[t3 + 2], 23, -995338651), d2 = u(d2, h2, f2, p2, e2[t3 + 0], 6, -198630844), p2 = u(p2, d2, h2, f2, e2[t3 + 7], 10, 1126891415), f2 = u(f2, p2, d2, h2, e2[t3 + 14], 15, -1416354905), h2 = u(h2, f2, p2, d2, e2[t3 + 5], 21, -57434055), d2 = u(d2, h2, f2, p2, e2[t3 + 12], 6, 1700485571), p2 = u(p2, d2, h2, f2, e2[t3 + 3], 10, -1894986606), f2 = u(f2, p2, d2, h2, e2[t3 + 10], 15, -1051523), h2 = u(h2, f2, p2, d2, e2[t3 + 1], 21, -2054922799), d2 = u(d2, h2, f2, p2, e2[t3 + 8], 6, 1873313359), p2 = u(p2, d2, h2, f2, e2[t3 + 15], 10, -30611744), f2 = u(f2, p2, d2, h2, e2[t3 + 6], 15, -1560198380), h2 = u(h2, f2, p2, d2, e2[t3 + 13], 21, 1309151649), d2 = u(d2, h2, f2, p2, e2[t3 + 4], 6, -145523070), p2 = u(p2, d2, h2, f2, e2[t3 + 11], 10, -1120210379), f2 = u(f2, p2, d2, h2, e2[t3 + 2], 15, 718787259), h2 = u(h2, f2, p2, d2, e2[t3 + 9], 21, -343485551), d2 = i(d2, n2), h2 = i(h2, r2), f2 = i(f2, o2), p2 = i(p2, s2); + return [d2, h2, f2, p2]; + }, h = {hexdigest: function(e2) { + return function(e3) { + let t2 = ""; + for (let n2 = 0; n2 < 4 * e3.length; n2++) + t2 += "0123456789abcdef".charAt(e3[n2 >> 2] >> n2 % 4 * 8 + 4 & 15) + "0123456789abcdef".charAt(e3[n2 >> 2] >> n2 % 4 * 8 & 15); + return t2; + }(d(o(e2), 8 * e2.length)); + }, hash: function(e2) { + return function(e3) { + let t2 = ""; + for (let n2 = 0; n2 < 32 * e3.length; n2 += 8) + t2 += String.fromCharCode(e3[n2 >> 5] >>> n2 % 32 & 255); + return t2; + }(d(o(e2), 8 * e2.length)); + }}; + var f = n(7); + const p = function(e2) { + var t2, n2, r2 = "", i2 = e2.length; + for (t2 = 0; t2 < i2; t2++) + (n2 = e2.charCodeAt(t2)) >= 0 && n2 <= 127 ? r2 += e2.charAt(t2) : n2 > 2047 ? (r2 += String.fromCharCode(224 | n2 >> 12 & 15), r2 += String.fromCharCode(128 | n2 >> 6 & 63), r2 += String.fromCharCode(128 | n2 >> 0 & 63)) : (r2 += String.fromCharCode(192 | n2 >> 6 & 31), r2 += String.fromCharCode(128 | n2 >> 0 & 63)); + return r2; + }, g = function(e2) { + e2 = e2 || {}; + for (const t2 in e2) + if (Object.prototype.hasOwnProperty.call(e2, t2)) { + let n2 = "", r2 = "", i2 = ""; + const o2 = e2[t2], s2 = typeof o2 == "object", a2 = escape(unescape(s2 ? o2.value : o2)); + s2 && (n2 = o2.expires ? ";expires=" + o2.expires : "", r2 = o2.domain ? ";domain=" + o2.domain : "", i2 = o2.path ? ";path=" + o2.path : ""), document.cookie = t2 + "=" + a2 + n2 + r2 + i2; + } + }; + var m = n(10); + function v(e2, t2) { + return new w.Builder(e2, t2); + } + function _(e2) { + return new w.Builder("message", e2); + } + function b(e2) { + return new w.Builder("iq", e2); + } + function y(e2) { + return new w.Builder("presence", e2); + } + const w = {VERSION: "1.3.6", NS: {HTTPBIND: "http://jabber.org/protocol/httpbind", BOSH: "urn:xmpp:xbosh", CLIENT: "jabber:client", AUTH: "jabber:iq:auth", ROSTER: "jabber:iq:roster", PROFILE: "jabber:iq:profile", DISCO_INFO: "http://jabber.org/protocol/disco#info", DISCO_ITEMS: "http://jabber.org/protocol/disco#items", MUC: "http://jabber.org/protocol/muc", SASL: "urn:ietf:params:xml:ns:xmpp-sasl", STREAM: "http://etherx.jabber.org/streams", FRAMING: "urn:ietf:params:xml:ns:xmpp-framing", BIND: "urn:ietf:params:xml:ns:xmpp-bind", SESSION: "urn:ietf:params:xml:ns:xmpp-session", VERSION: "jabber:iq:version", STANZAS: "urn:ietf:params:xml:ns:xmpp-stanzas", XHTML_IM: "http://jabber.org/protocol/xhtml-im", XHTML: "http://www.w3.org/1999/xhtml"}, XHTML: {tags: ["a", "blockquote", "br", "cite", "em", "img", "li", "ol", "p", "span", "strong", "ul", "body"], attributes: {a: ["href"], blockquote: ["style"], br: [], cite: ["style"], em: [], img: ["src", "alt", "style", "height", "width"], li: ["style"], ol: ["style"], p: ["style"], span: ["style"], strong: [], ul: ["style"], body: []}, css: ["background-color", "color", "font-family", "font-size", "font-style", "font-weight", "margin-left", "margin-right", "text-align", "text-decoration"], validTag(e2) { + for (let t2 = 0; t2 < w.XHTML.tags.length; t2++) + if (e2 === w.XHTML.tags[t2]) + return true; + return false; + }, validAttribute(e2, t2) { + if (w.XHTML.attributes[e2] !== void 0 && w.XHTML.attributes[e2].length > 0) { + for (let n2 = 0; n2 < w.XHTML.attributes[e2].length; n2++) + if (t2 === w.XHTML.attributes[e2][n2]) + return true; + } + return false; + }, validCSS(e2) { + for (let t2 = 0; t2 < w.XHTML.css.length; t2++) + if (e2 === w.XHTML.css[t2]) + return true; + return false; + }}, Status: {ERROR: 0, CONNECTING: 1, CONNFAIL: 2, AUTHENTICATING: 3, AUTHFAIL: 4, CONNECTED: 5, DISCONNECTED: 6, DISCONNECTING: 7, ATTACHED: 8, REDIRECT: 9, CONNTIMEOUT: 10, BINDREQUIRED: 11, ATTACHFAIL: 12}, ErrorCondition: {BAD_FORMAT: "bad-format", CONFLICT: "conflict", MISSING_JID_NODE: "x-strophe-bad-non-anon-jid", NO_AUTH_MECH: "no-auth-mech", UNKNOWN_REASON: "unknown"}, LogLevel: {DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3, FATAL: 4}, ElementType: {NORMAL: 1, TEXT: 3, CDATA: 4, FRAGMENT: 11}, TIMEOUT: 1.1, SECONDARY_TIMEOUT: 0.1, addNamespace(e2, t2) { + w.NS[e2] = t2; + }, forEachChild(e2, t2, n2) { + for (let r2 = 0; r2 < e2.childNodes.length; r2++) { + const i2 = e2.childNodes[r2]; + i2.nodeType !== w.ElementType.NORMAL || t2 && !this.isTagEqual(i2, t2) || n2(i2); + } + }, isTagEqual: (e2, t2) => e2.tagName === t2, _xmlGenerator: null, xmlGenerator: () => (w._xmlGenerator || (w._xmlGenerator = r.b()), w._xmlGenerator), xmlElement(e2) { + if (!e2) + return null; + const t2 = w.xmlGenerator().createElement(e2); + for (let e3 = 1; e3 < arguments.length; e3++) { + const n2 = arguments[e3]; + if (n2) { + if (typeof n2 == "string" || typeof n2 == "number") + t2.appendChild(w.xmlTextNode(n2)); + else if (typeof n2 == "object" && typeof n2.sort == "function") + for (let e4 = 0; e4 < n2.length; e4++) { + const r2 = n2[e4]; + typeof r2 == "object" && typeof r2.sort == "function" && r2[1] !== void 0 && r2[1] !== null && t2.setAttribute(r2[0], r2[1]); + } + else if (typeof n2 == "object") + for (const e4 in n2) + Object.prototype.hasOwnProperty.call(n2, e4) && n2[e4] !== void 0 && n2[e4] !== null && t2.setAttribute(e4, n2[e4]); + } + } + return t2; + }, xmlescape: (e2) => e2 = (e2 = (e2 = (e2 = (e2 = e2.replace(/\&/g, "&")).replace(/</g, "<")).replace(/>/g, ">")).replace(/'/g, "'")).replace(/"/g, """), xmlunescape: (e2) => e2 = (e2 = (e2 = (e2 = (e2 = e2.replace(/\&/g, "&")).replace(/</g, "<")).replace(/>/g, ">")).replace(/'/g, "'")).replace(/"/g, '"'), xmlTextNode: (e2) => w.xmlGenerator().createTextNode(e2), xmlHtmlNode(e2) { + let t2; + if (r.a) { + t2 = new r.a().parseFromString(e2, "text/xml"); + } else + t2 = new ActiveXObject("Microsoft.XMLDOM"), t2.async = "false", t2.loadXML(e2); + return t2; + }, getText(e2) { + if (!e2) + return null; + let t2 = ""; + e2.childNodes.length === 0 && e2.nodeType === w.ElementType.TEXT && (t2 += e2.nodeValue); + for (let n2 = 0; n2 < e2.childNodes.length; n2++) + e2.childNodes[n2].nodeType === w.ElementType.TEXT && (t2 += e2.childNodes[n2].nodeValue); + return w.xmlescape(t2); + }, copyElement(e2) { + let t2; + if (e2.nodeType === w.ElementType.NORMAL) { + t2 = w.xmlElement(e2.tagName); + for (let n2 = 0; n2 < e2.attributes.length; n2++) + t2.setAttribute(e2.attributes[n2].nodeName, e2.attributes[n2].value); + for (let n2 = 0; n2 < e2.childNodes.length; n2++) + t2.appendChild(w.copyElement(e2.childNodes[n2])); + } else + e2.nodeType === w.ElementType.TEXT && (t2 = w.xmlGenerator().createTextNode(e2.nodeValue)); + return t2; + }, createHtml(e2) { + let t2; + if (e2.nodeType === w.ElementType.NORMAL) { + const n2 = e2.nodeName.toLowerCase(); + if (w.XHTML.validTag(n2)) + try { + t2 = w.xmlElement(n2); + for (let r2 = 0; r2 < w.XHTML.attributes[n2].length; r2++) { + const i2 = w.XHTML.attributes[n2][r2]; + let o2 = e2.getAttribute(i2); + if (o2 != null && o2 !== "" && o2 !== false && o2 !== 0) + if (i2 === "style" && typeof o2 == "object" && o2.cssText !== void 0 && (o2 = o2.cssText), i2 === "style") { + const e3 = [], n3 = o2.split(";"); + for (let t3 = 0; t3 < n3.length; t3++) { + const r3 = n3[t3].split(":"), i3 = r3[0].replace(/^\s*/, "").replace(/\s*$/, "").toLowerCase(); + if (w.XHTML.validCSS(i3)) { + const t4 = r3[1].replace(/^\s*/, "").replace(/\s*$/, ""); + e3.push(i3 + ": " + t4); + } + } + e3.length > 0 && (o2 = e3.join("; "), t2.setAttribute(i2, o2)); + } else + t2.setAttribute(i2, o2); + } + for (let n3 = 0; n3 < e2.childNodes.length; n3++) + t2.appendChild(w.createHtml(e2.childNodes[n3])); + } catch (e3) { + t2 = w.xmlTextNode(""); + } + else { + t2 = w.xmlGenerator().createDocumentFragment(); + for (let n3 = 0; n3 < e2.childNodes.length; n3++) + t2.appendChild(w.createHtml(e2.childNodes[n3])); + } + } else if (e2.nodeType === w.ElementType.FRAGMENT) { + t2 = w.xmlGenerator().createDocumentFragment(); + for (let n2 = 0; n2 < e2.childNodes.length; n2++) + t2.appendChild(w.createHtml(e2.childNodes[n2])); + } else + e2.nodeType === w.ElementType.TEXT && (t2 = w.xmlTextNode(e2.nodeValue)); + return t2; + }, escapeNode: (e2) => typeof e2 != "string" ? e2 : e2.replace(/^\s+|\s+$/g, "").replace(/\\/g, "\\5c").replace(/ /g, "\\20").replace(/\"/g, "\\22").replace(/\&/g, "\\26").replace(/\'/g, "\\27").replace(/\//g, "\\2f").replace(/:/g, "\\3a").replace(/</g, "\\3c").replace(/>/g, "\\3e").replace(/@/g, "\\40"), unescapeNode: (e2) => typeof e2 != "string" ? e2 : e2.replace(/\\20/g, " ").replace(/\\22/g, '"').replace(/\\26/g, "&").replace(/\\27/g, "'").replace(/\\2f/g, "/").replace(/\\3a/g, ":").replace(/\\3c/g, "<").replace(/\\3e/g, ">").replace(/\\40/g, "@").replace(/\\5c/g, "\\"), getNodeFromJid: (e2) => e2.indexOf("@") < 0 ? null : e2.split("@")[0], getDomainFromJid(e2) { + const t2 = w.getBareJidFromJid(e2); + if (t2.indexOf("@") < 0) + return t2; + { + const e3 = t2.split("@"); + return e3.splice(0, 1), e3.join("@"); + } + }, getResourceFromJid(e2) { + if (!e2) + return null; + const t2 = e2.split("/"); + return t2.length < 2 ? null : (t2.splice(0, 1), t2.join("/")); + }, getBareJidFromJid: (e2) => e2 ? e2.split("/")[0] : null, _handleError(e2) { + e2.stack !== void 0 && w.fatal(e2.stack), e2.sourceURL ? w.fatal("error: " + this.handler + " " + e2.sourceURL + ":" + e2.line + " - " + e2.name + ": " + e2.message) : e2.fileName ? w.fatal("error: " + this.handler + " " + e2.fileName + ":" + e2.lineNumber + " - " + e2.name + ": " + e2.message) : w.fatal("error: " + e2.message); + }, log(e2, t2) { + e2 === this.LogLevel.FATAL && typeof window.console == "object" && typeof window.console.error == "function" && window.console.error(t2); + }, debug(e2) { + this.log(this.LogLevel.DEBUG, e2); + }, info(e2) { + this.log(this.LogLevel.INFO, e2); + }, warn(e2) { + this.log(this.LogLevel.WARN, e2); + }, error(e2) { + this.log(this.LogLevel.ERROR, e2); + }, fatal(e2) { + this.log(this.LogLevel.FATAL, e2); + }, serialize(e2) { + if (!e2) + return null; + typeof e2.tree == "function" && (e2 = e2.tree()); + const t2 = [...Array(e2.attributes.length).keys()].map((t3) => e2.attributes[t3].nodeName); + t2.sort(); + let n2 = t2.reduce((t3, n3) => "".concat(t3, " ").concat(n3, '="').concat(w.xmlescape(e2.attributes.getNamedItem(n3).value), '"'), "<".concat(e2.nodeName)); + if (e2.childNodes.length > 0) { + n2 += ">"; + for (let t3 = 0; t3 < e2.childNodes.length; t3++) { + const r2 = e2.childNodes[t3]; + switch (r2.nodeType) { + case w.ElementType.NORMAL: + n2 += w.serialize(r2); + break; + case w.ElementType.TEXT: + n2 += w.xmlescape(r2.nodeValue); + break; + case w.ElementType.CDATA: + n2 += "<![CDATA[" + r2.nodeValue + "]]>"; + } + } + n2 += "</" + e2.nodeName + ">"; + } else + n2 += "/>"; + return n2; + }, _requestId: 0, _connectionPlugins: {}, addConnectionPlugin(e2, t2) { + w._connectionPlugins[e2] = t2; + }, Builder: class { + constructor(e2, t2) { + e2 !== "presence" && e2 !== "message" && e2 !== "iq" || (t2 && !t2.xmlns ? t2.xmlns = w.NS.CLIENT : t2 || (t2 = {xmlns: w.NS.CLIENT})), this.nodeTree = w.xmlElement(e2, t2), this.node = this.nodeTree; + } + tree() { + return this.nodeTree; + } + toString() { + return w.serialize(this.nodeTree); + } + up() { + return this.node = this.node.parentNode, this; + } + root() { + return this.node = this.nodeTree, this; + } + attrs(e2) { + for (const t2 in e2) + Object.prototype.hasOwnProperty.call(e2, t2) && (e2[t2] === void 0 ? this.node.removeAttribute(t2) : this.node.setAttribute(t2, e2[t2])); + return this; + } + c(e2, t2, n2) { + const r2 = w.xmlElement(e2, t2, n2); + return this.node.appendChild(r2), typeof n2 != "string" && typeof n2 != "number" && (this.node = r2), this; + } + cnode(e2) { + let t2; + const n2 = w.xmlGenerator(); + try { + t2 = n2.importNode !== void 0; + } catch (e3) { + t2 = false; + } + const r2 = t2 ? n2.importNode(e2, true) : w.copyElement(e2); + return this.node.appendChild(r2), this.node = r2, this; + } + t(e2) { + const t2 = w.xmlTextNode(e2); + return this.node.appendChild(t2), this; + } + h(e2) { + const t2 = w.xmlGenerator().createElement("body"); + t2.innerHTML = e2; + const n2 = w.createHtml(t2); + for (; n2.childNodes.length > 0; ) + this.node.appendChild(n2.childNodes[0]); + return this; + } + }, Handler: function(e2, t2, n2, r2, i2, o2, s2) { + this.handler = e2, this.ns = t2, this.name = n2, this.type = r2, this.id = i2, this.options = s2 || {matchBareFromJid: false, ignoreNamespaceFragment: false}, this.options.matchBare && (w.warn('The "matchBare" option is deprecated, use "matchBareFromJid" instead.'), this.options.matchBareFromJid = this.options.matchBare, delete this.options.matchBare), this.options.matchBareFromJid ? this.from = o2 ? w.getBareJidFromJid(o2) : null : this.from = o2, this.user = true; + }}; + w.Handler.prototype = {getNamespace(e2) { + let t2 = e2.getAttribute("xmlns"); + return t2 && this.options.ignoreNamespaceFragment && (t2 = t2.split("#")[0]), t2; + }, namespaceMatch(e2) { + let t2 = false; + return !this.ns || (w.forEachChild(e2, null, (e3) => { + this.getNamespace(e3) === this.ns && (t2 = true); + }), t2 || this.getNamespace(e2) === this.ns); + }, isMatch(e2) { + let t2 = e2.getAttribute("from"); + this.options.matchBareFromJid && (t2 = w.getBareJidFromJid(t2)); + const n2 = e2.getAttribute("type"); + return !(!this.namespaceMatch(e2) || this.name && !w.isTagEqual(e2, this.name) || this.type && (Array.isArray(this.type) ? this.type.indexOf(n2) === -1 : n2 !== this.type) || this.id && e2.getAttribute("id") !== this.id || this.from && t2 !== this.from); + }, run(e2) { + let t2 = null; + try { + t2 = this.handler(e2); + } catch (e3) { + throw w._handleError(e3), e3; + } + return t2; + }, toString() { + return "{Handler: " + this.handler + "(" + this.name + "," + this.id + "," + this.ns + ")}"; + }}, w.TimedHandler = class { + constructor(e2, t2) { + this.period = e2, this.handler = t2, this.lastCalled = new Date().getTime(), this.user = true; + } + run() { + return this.lastCalled = new Date().getTime(), this.handler(); + } + reset() { + this.lastCalled = new Date().getTime(); + } + toString() { + return "{TimedHandler: " + this.handler + "(" + this.period + ")}"; + } + }, w.Connection = class { + constructor(e2, t2) { + this.service = e2, this.options = t2 || {}; + const n2 = this.options.protocol || ""; + this.options.worker ? this._proto = new w.WorkerWebsocket(this) : e2.indexOf("ws:") === 0 || e2.indexOf("wss:") === 0 || n2.indexOf("ws") === 0 ? this._proto = new w.Websocket(this) : this._proto = new w.Bosh(this), this.jid = "", this.domain = null, this.features = null, this._sasl_data = {}, this.do_bind = false, this.do_session = false, this.mechanisms = {}, this.timedHandlers = [], this.handlers = [], this.removeTimeds = [], this.removeHandlers = [], this.addTimeds = [], this.addHandlers = [], this.protocolErrorHandlers = {HTTP: {}, websocket: {}}, this._idleTimeout = null, this._disconnectTimeout = null, this.authenticated = false, this.connected = false, this.disconnecting = false, this.do_authentication = true, this.paused = false, this.restored = false, this._data = [], this._uniqueId = 0, this._sasl_success_handler = null, this._sasl_failure_handler = null, this._sasl_challenge_handler = null, this.maxRetries = 5, this._idleTimeout = setTimeout(() => this._onIdle(), 100), g(this.options.cookies), this.registerSASLMechanisms(this.options.mechanisms); + for (const e3 in w._connectionPlugins) + if (Object.prototype.hasOwnProperty.call(w._connectionPlugins, e3)) { + const t3 = function() { + }; + t3.prototype = w._connectionPlugins[e3], this[e3] = new t3(), this[e3].init(this); + } + } + reset() { + this._proto._reset(), this.do_session = false, this.do_bind = false, this.timedHandlers = [], this.handlers = [], this.removeTimeds = [], this.removeHandlers = [], this.addTimeds = [], this.addHandlers = [], this.authenticated = false, this.connected = false, this.disconnecting = false, this.restored = false, this._data = [], this._requests = [], this._uniqueId = 0; + } + pause() { + this.paused = true; + } + resume() { + this.paused = false; + } + getUniqueId(e2) { + const t2 = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e3) { + const t3 = 16 * Math.random() | 0; + return (e3 === "x" ? t3 : 3 & t3 | 8).toString(16); + }); + return typeof e2 == "string" || typeof e2 == "number" ? t2 + ":" + e2 : t2 + ""; + } + addProtocolErrorHandler(e2, t2, n2) { + this.protocolErrorHandlers[e2][t2] = n2; + } + connect(e2, t2, n2, r2, i2, o2, s2) { + this.jid = e2, this.authzid = w.getBareJidFromJid(this.jid), this.authcid = s2 || w.getNodeFromJid(this.jid), this.pass = t2, this.connect_callback = n2, this.disconnecting = false, this.connected = false, this.authenticated = false, this.restored = false, this.domain = w.getDomainFromJid(this.jid), this._changeConnectStatus(w.Status.CONNECTING, null), this._proto._connect(r2, i2, o2); + } + attach(e2, t2, n2, r2, i2, o2, s2) { + if (this._proto._attach) + return this._proto._attach(e2, t2, n2, r2, i2, o2, s2); + { + const e3 = new Error('The "attach" method is not available for your connection protocol'); + throw e3.name = "StropheSessionError", e3; + } + } + restore(e2, t2, n2, r2, i2) { + if (!this._sessionCachingSupported()) { + const e3 = new Error('The "restore" method can only be used with a BOSH connection.'); + throw e3.name = "StropheSessionError", e3; + } + this._proto._restore(e2, t2, n2, r2, i2); + } + _sessionCachingSupported() { + if (this._proto instanceof w.Bosh) { + if (!JSON) + return false; + try { + sessionStorage.setItem("_strophe_", "_strophe_"), sessionStorage.removeItem("_strophe_"); + } catch (e2) { + return false; + } + return true; + } + return false; + } + xmlInput(e2) { + } + xmlOutput(e2) { + } + rawInput(e2) { + } + rawOutput(e2) { + } + nextValidRid(e2) { + } + send(e2) { + if (e2 !== null) { + if (typeof e2.sort == "function") + for (let t2 = 0; t2 < e2.length; t2++) + this._queueData(e2[t2]); + else + typeof e2.tree == "function" ? this._queueData(e2.tree()) : this._queueData(e2); + this._proto._send(); + } + } + flush() { + clearTimeout(this._idleTimeout), this._onIdle(); + } + sendPresence(e2, t2, n2, r2) { + let i2 = null; + typeof e2.tree == "function" && (e2 = e2.tree()); + let o2 = e2.getAttribute("id"); + if (o2 || (o2 = this.getUniqueId("sendPresence"), e2.setAttribute("id", o2)), typeof t2 == "function" || typeof n2 == "function") { + const e3 = this.addHandler((e4) => { + i2 && this.deleteTimedHandler(i2), e4.getAttribute("type") === "error" ? n2 && n2(e4) : t2 && t2(e4); + }, null, "presence", null, o2); + r2 && (i2 = this.addTimedHandler(r2, () => (this.deleteHandler(e3), n2 && n2(null), false))); + } + return this.send(e2), o2; + } + sendIQ(e2, t2, n2, r2) { + let i2 = null; + typeof e2.tree == "function" && (e2 = e2.tree()); + let o2 = e2.getAttribute("id"); + if (o2 || (o2 = this.getUniqueId("sendIQ"), e2.setAttribute("id", o2)), typeof t2 == "function" || typeof n2 == "function") { + const e3 = this.addHandler((e4) => { + i2 && this.deleteTimedHandler(i2); + const r3 = e4.getAttribute("type"); + if (r3 === "result") + t2 && t2(e4); + else { + if (r3 !== "error") { + const e5 = new Error("Got bad IQ type of ".concat(r3)); + throw e5.name = "StropheError", e5; + } + n2 && n2(e4); + } + }, null, "iq", ["error", "result"], o2); + r2 && (i2 = this.addTimedHandler(r2, () => (this.deleteHandler(e3), n2 && n2(null), false))); + } + return this.send(e2), o2; + } + _queueData(e2) { + if (e2 === null || !e2.tagName || !e2.childNodes) { + const e3 = new Error("Cannot queue non-DOMElement."); + throw e3.name = "StropheError", e3; + } + this._data.push(e2); + } + _sendRestart() { + this._data.push("restart"), this._proto._sendRestart(), this._idleTimeout = setTimeout(() => this._onIdle(), 100); + } + addTimedHandler(e2, t2) { + const n2 = new w.TimedHandler(e2, t2); + return this.addTimeds.push(n2), n2; + } + deleteTimedHandler(e2) { + this.removeTimeds.push(e2); + } + addHandler(e2, t2, n2, r2, i2, o2, s2) { + const a2 = new w.Handler(e2, t2, n2, r2, i2, o2, s2); + return this.addHandlers.push(a2), a2; + } + deleteHandler(e2) { + this.removeHandlers.push(e2); + const t2 = this.addHandlers.indexOf(e2); + t2 >= 0 && this.addHandlers.splice(t2, 1); + } + registerSASLMechanisms(e2) { + this.mechanisms = {}, (e2 = e2 || [w.SASLAnonymous, w.SASLExternal, w.SASLOAuthBearer, w.SASLXOAuth2, w.SASLPlain, w.SASLSHA1]).forEach((e3) => this.registerSASLMechanism(e3)); + } + registerSASLMechanism(e2) { + this.mechanisms[e2.name] = e2; + } + disconnect(e2) { + if (this._changeConnectStatus(w.Status.DISCONNECTING, e2), e2 ? w.warn("Disconnect was called because: " + e2) : w.info("Disconnect was called"), this.connected) { + let e3 = false; + this.disconnecting = true, this.authenticated && (e3 = y({xmlns: w.NS.CLIENT, type: "unavailable"})), this._disconnectTimeout = this._addSysTimedHandler(3e3, this._onDisconnectTimeout.bind(this)), this._proto._disconnect(e3); + } else + w.warn("Disconnect was called before Strophe connected to the server"), this._proto._abortAllRequests(), this._doDisconnect(); + } + _changeConnectStatus(e2, t2, n2) { + for (const n3 in w._connectionPlugins) + if (Object.prototype.hasOwnProperty.call(w._connectionPlugins, n3)) { + const r2 = this[n3]; + if (r2.statusChanged) + try { + r2.statusChanged(e2, t2); + } catch (e3) { + w.error("".concat(n3, " plugin caused an exception changing status: ").concat(e3)); + } + } + if (this.connect_callback) + try { + this.connect_callback(e2, t2, n2); + } catch (e3) { + w._handleError(e3), w.error("User connection callback caused an exception: ".concat(e3)); + } + } + _doDisconnect(e2) { + typeof this._idleTimeout == "number" && clearTimeout(this._idleTimeout), this._disconnectTimeout !== null && (this.deleteTimedHandler(this._disconnectTimeout), this._disconnectTimeout = null), w.debug("_doDisconnect was called"), this._proto._doDisconnect(), this.authenticated = false, this.disconnecting = false, this.restored = false, this.handlers = [], this.timedHandlers = [], this.removeTimeds = [], this.removeHandlers = [], this.addTimeds = [], this.addHandlers = [], this._changeConnectStatus(w.Status.DISCONNECTED, e2), this.connected = false; + } + _dataRecv(e2, t2) { + const n2 = this._proto._reqToData(e2); + if (n2 === null) + return; + for (this.xmlInput !== w.Connection.prototype.xmlInput && (n2.nodeName === this._proto.strip && n2.childNodes.length ? this.xmlInput(n2.childNodes[0]) : this.xmlInput(n2)), this.rawInput !== w.Connection.prototype.rawInput && (t2 ? this.rawInput(t2) : this.rawInput(w.serialize(n2))); this.removeHandlers.length > 0; ) { + const e3 = this.removeHandlers.pop(), t3 = this.handlers.indexOf(e3); + t3 >= 0 && this.handlers.splice(t3, 1); + } + for (; this.addHandlers.length > 0; ) + this.handlers.push(this.addHandlers.pop()); + if (this.disconnecting && this._proto._emptyQueue()) + return void this._doDisconnect(); + const r2 = n2.getAttribute("type"); + if (r2 !== null && r2 === "terminate") { + if (this.disconnecting) + return; + let e3 = n2.getAttribute("condition"); + const t3 = n2.getElementsByTagName("conflict"); + return e3 !== null ? (e3 === "remote-stream-error" && t3.length > 0 && (e3 = "conflict"), this._changeConnectStatus(w.Status.CONNFAIL, e3)) : this._changeConnectStatus(w.Status.CONNFAIL, w.ErrorCondition.UNKOWN_REASON), void this._doDisconnect(e3); + } + w.forEachChild(n2, null, (e3) => { + const t3 = this.handlers; + this.handlers = []; + for (let n3 = 0; n3 < t3.length; n3++) { + const r3 = t3[n3]; + try { + (!r3.isMatch(e3) || !this.authenticated && r3.user || r3.run(e3)) && this.handlers.push(r3); + } catch (e4) { + w.warn("Removing Strophe handlers due to uncaught exception: " + e4.message); + } + } + }); + } + _connect_cb(e2, t2, n2) { + let r2; + w.debug("_connect_cb was called"), this.connected = true; + try { + r2 = this._proto._reqToData(e2); + } catch (e3) { + if (e3.name !== w.ErrorCondition.BAD_FORMAT) + throw e3; + this._changeConnectStatus(w.Status.CONNFAIL, w.ErrorCondition.BAD_FORMAT), this._doDisconnect(w.ErrorCondition.BAD_FORMAT); + } + if (!r2) + return; + if (this.xmlInput !== w.Connection.prototype.xmlInput && (r2.nodeName === this._proto.strip && r2.childNodes.length ? this.xmlInput(r2.childNodes[0]) : this.xmlInput(r2)), this.rawInput !== w.Connection.prototype.rawInput && (n2 ? this.rawInput(n2) : this.rawInput(w.serialize(r2))), this._proto._connect_cb(r2) === w.Status.CONNFAIL) + return; + let i2; + if (i2 = r2.getElementsByTagNameNS ? r2.getElementsByTagNameNS(w.NS.STREAM, "features").length > 0 : r2.getElementsByTagName("stream:features").length > 0 || r2.getElementsByTagName("features").length > 0, !i2) + return void this._proto._no_auth_received(t2); + const o2 = Array.from(r2.getElementsByTagName("mechanism")).map((e3) => this.mechanisms[e3.textContent]).filter((e3) => e3); + o2.length !== 0 || r2.getElementsByTagName("auth").length !== 0 ? this.do_authentication !== false && this.authenticate(o2) : this._proto._no_auth_received(t2); + } + sortMechanismsByPriority(e2) { + for (let t2 = 0; t2 < e2.length - 1; ++t2) { + let n2 = t2; + for (let r2 = t2 + 1; r2 < e2.length; ++r2) + e2[r2].priority > e2[n2].priority && (n2 = r2); + if (n2 !== t2) { + const r2 = e2[t2]; + e2[t2] = e2[n2], e2[n2] = r2; + } + } + return e2; + } + authenticate(e2) { + this._attemptSASLAuth(e2) || this._attemptLegacyAuth(); + } + _attemptSASLAuth(e2) { + e2 = this.sortMechanismsByPriority(e2 || []); + let t2 = false; + for (let n2 = 0; n2 < e2.length; ++n2) { + if (!e2[n2].test(this)) + continue; + this._sasl_success_handler = this._addSysHandler(this._sasl_success_cb.bind(this), null, "success", null, null), this._sasl_failure_handler = this._addSysHandler(this._sasl_failure_cb.bind(this), null, "failure", null, null), this._sasl_challenge_handler = this._addSysHandler(this._sasl_challenge_cb.bind(this), null, "challenge", null, null), this._sasl_mechanism = new e2[n2](), this._sasl_mechanism.onStart(this); + const r2 = v("auth", {xmlns: w.NS.SASL, mechanism: this._sasl_mechanism.name}); + if (this._sasl_mechanism.isClientFirst) { + const e3 = this._sasl_mechanism.onChallenge(this, null); + r2.t(Object(m.btoa)(e3)); + } + this.send(r2.tree()), t2 = true; + break; + } + return t2; + } + _sasl_challenge_cb(e2) { + const t2 = Object(m.atob)(w.getText(e2)), n2 = this._sasl_mechanism.onChallenge(this, t2), r2 = v("response", {xmlns: w.NS.SASL}); + return n2 !== "" && r2.t(Object(m.btoa)(n2)), this.send(r2.tree()), true; + } + _attemptLegacyAuth() { + w.getNodeFromJid(this.jid) === null ? (this._changeConnectStatus(w.Status.CONNFAIL, w.ErrorCondition.MISSING_JID_NODE), this.disconnect(w.ErrorCondition.MISSING_JID_NODE)) : (this._changeConnectStatus(w.Status.AUTHENTICATING, null), this._addSysHandler(this._onLegacyAuthIQResult.bind(this), null, null, null, "_auth_1"), this.send(b({type: "get", to: this.domain, id: "_auth_1"}).c("query", {xmlns: w.NS.AUTH}).c("username", {}).t(w.getNodeFromJid(this.jid)).tree())); + } + _onLegacyAuthIQResult(e2) { + const t2 = b({type: "set", id: "_auth_2"}).c("query", {xmlns: w.NS.AUTH}).c("username", {}).t(w.getNodeFromJid(this.jid)).up().c("password").t(this.pass); + return w.getResourceFromJid(this.jid) || (this.jid = w.getBareJidFromJid(this.jid) + "/strophe"), t2.up().c("resource", {}).t(w.getResourceFromJid(this.jid)), this._addSysHandler(this._auth2_cb.bind(this), null, null, null, "_auth_2"), this.send(t2.tree()), false; + } + _sasl_success_cb(e2) { + if (this._sasl_data["server-signature"]) { + let t3; + const n3 = /([a-z]+)=([^,]+)(,|$)/, r2 = Object(m.atob)(w.getText(e2)).match(n3); + if (r2[1] === "v" && (t3 = r2[2]), t3 !== this._sasl_data["server-signature"]) + return this.deleteHandler(this._sasl_failure_handler), this._sasl_failure_handler = null, this._sasl_challenge_handler && (this.deleteHandler(this._sasl_challenge_handler), this._sasl_challenge_handler = null), this._sasl_data = {}, this._sasl_failure_cb(null); + } + w.info("SASL authentication succeeded."), this._sasl_mechanism && this._sasl_mechanism.onSuccess(), this.deleteHandler(this._sasl_failure_handler), this._sasl_failure_handler = null, this._sasl_challenge_handler && (this.deleteHandler(this._sasl_challenge_handler), this._sasl_challenge_handler = null); + const t2 = [], n2 = (e3, t3) => { + for (; e3.length; ) + this.deleteHandler(e3.pop()); + return this._onStreamFeaturesAfterSASL(t3), false; + }; + return t2.push(this._addSysHandler((e3) => n2(t2, e3), null, "stream:features", null, null)), t2.push(this._addSysHandler((e3) => n2(t2, e3), w.NS.STREAM, "features", null, null)), this._sendRestart(), false; + } + _onStreamFeaturesAfterSASL(e2) { + this.features = e2; + for (let t2 = 0; t2 < e2.childNodes.length; t2++) { + const n2 = e2.childNodes[t2]; + n2.nodeName === "bind" && (this.do_bind = true), n2.nodeName === "session" && (this.do_session = true); + } + return this.do_bind ? (this.options.explicitResourceBinding ? this._changeConnectStatus(w.Status.BINDREQUIRED, null) : this.bind(), false) : (this._changeConnectStatus(w.Status.AUTHFAIL, null), false); + } + bind() { + if (!this.do_bind) + return void w.log(w.LogLevel.INFO, 'Strophe.Connection.prototype.bind called but "do_bind" is false'); + this._addSysHandler(this._onResourceBindResultIQ.bind(this), null, null, null, "_bind_auth_2"); + const e2 = w.getResourceFromJid(this.jid); + e2 ? this.send(b({type: "set", id: "_bind_auth_2"}).c("bind", {xmlns: w.NS.BIND}).c("resource", {}).t(e2).tree()) : this.send(b({type: "set", id: "_bind_auth_2"}).c("bind", {xmlns: w.NS.BIND}).tree()); + } + _onResourceBindResultIQ(e2) { + if (e2.getAttribute("type") === "error") { + let t3; + return w.warn("Resource binding failed."), e2.getElementsByTagName("conflict").length > 0 && (t3 = w.ErrorCondition.CONFLICT), this._changeConnectStatus(w.Status.AUTHFAIL, t3, e2), false; + } + const t2 = e2.getElementsByTagName("bind"); + if (!(t2.length > 0)) + return w.warn("Resource binding failed."), this._changeConnectStatus(w.Status.AUTHFAIL, null, e2), false; + { + const e3 = t2[0].getElementsByTagName("jid"); + e3.length > 0 && (this.jid = w.getText(e3[0]), this.do_session ? this._establishSession() : (this.authenticated = true, this._changeConnectStatus(w.Status.CONNECTED, null))); + } + } + _establishSession() { + if (!this.do_session) + throw new Error("Strophe.Connection.prototype._establishSession " + "called but apparently ".concat(w.NS.SESSION, " wasn't advertised by the server")); + this._addSysHandler(this._onSessionResultIQ.bind(this), null, null, null, "_session_auth_2"), this.send(b({type: "set", id: "_session_auth_2"}).c("session", {xmlns: w.NS.SESSION}).tree()); + } + _onSessionResultIQ(e2) { + if (e2.getAttribute("type") === "result") + this.authenticated = true, this._changeConnectStatus(w.Status.CONNECTED, null); + else if (e2.getAttribute("type") === "error") + return w.warn("Session creation failed."), this._changeConnectStatus(w.Status.AUTHFAIL, null, e2), false; + return false; + } + _sasl_failure_cb(e2) { + return this._sasl_success_handler && (this.deleteHandler(this._sasl_success_handler), this._sasl_success_handler = null), this._sasl_challenge_handler && (this.deleteHandler(this._sasl_challenge_handler), this._sasl_challenge_handler = null), this._sasl_mechanism && this._sasl_mechanism.onFailure(), this._changeConnectStatus(w.Status.AUTHFAIL, null, e2), false; + } + _auth2_cb(e2) { + return e2.getAttribute("type") === "result" ? (this.authenticated = true, this._changeConnectStatus(w.Status.CONNECTED, null)) : e2.getAttribute("type") === "error" && (this._changeConnectStatus(w.Status.AUTHFAIL, null, e2), this.disconnect("authentication failed")), false; + } + _addSysTimedHandler(e2, t2) { + const n2 = new w.TimedHandler(e2, t2); + return n2.user = false, this.addTimeds.push(n2), n2; + } + _addSysHandler(e2, t2, n2, r2, i2) { + const o2 = new w.Handler(e2, t2, n2, r2, i2); + return o2.user = false, this.addHandlers.push(o2), o2; + } + _onDisconnectTimeout() { + return w.debug("_onDisconnectTimeout was called"), this._changeConnectStatus(w.Status.CONNTIMEOUT, null), this._proto._onDisconnectTimeout(), this._doDisconnect(), false; + } + _onIdle() { + for (; this.addTimeds.length > 0; ) + this.timedHandlers.push(this.addTimeds.pop()); + for (; this.removeTimeds.length > 0; ) { + const e3 = this.removeTimeds.pop(), t3 = this.timedHandlers.indexOf(e3); + t3 >= 0 && this.timedHandlers.splice(t3, 1); + } + const e2 = new Date().getTime(), t2 = []; + for (let n2 = 0; n2 < this.timedHandlers.length; n2++) { + const r2 = this.timedHandlers[n2]; + if (this.authenticated || !r2.user) { + r2.lastCalled + r2.period - e2 <= 0 ? r2.run() && t2.push(r2) : t2.push(r2); + } + } + this.timedHandlers = t2, clearTimeout(this._idleTimeout), this._proto._onIdle(), this.connected && (this._idleTimeout = setTimeout(() => this._onIdle(), 100)); + } + }, w.SASLMechanism = class { + constructor(e2, t2, n2) { + this.name = e2, this.isClientFirst = t2, this.priority = n2; + } + static test(e2) { + return true; + } + onStart(e2) { + this._connection = e2; + } + onChallenge(e2, t2) { + throw new Error("You should implement challenge handling!"); + } + onFailure() { + this._connection = null; + } + onSuccess() { + this._connection = null; + } + }, w.SASLAnonymous = class extends w.SASLMechanism { + constructor() { + super(w.SASLAnonymous.name, false, w.SASLAnonymous.priority); + } + static get name() { + return "ANONYMOUS"; + } + static get priority() { + return 20; + } + static test(e2) { + return e2.authcid === null; + } + }, w.SASLPlain = class extends w.SASLMechanism { + constructor() { + super(w.SASLPlain.name, true, w.SASLPlain.priority); + } + static get name() { + return "PLAIN"; + } + static get priority() { + return 50; + } + static test(e2) { + return e2.authcid !== null; + } + onChallenge(e2) { + const {authcid: t2, authzid: n2, domain: r2, pass: i2} = e2; + if (!r2) + throw new Error("SASLPlain onChallenge: domain is not defined!"); + let o2 = n2 !== "".concat(t2, "@").concat(r2) ? n2 : ""; + return o2 += "\0", o2 += t2, o2 += "\0", o2 += i2, p(o2); + } + }, w.SASLSHA1 = class extends w.SASLMechanism { + constructor() { + super(w.SASLSHA1.name, true, w.SASLSHA1.priority); + } + static get name() { + return "SCRAM-SHA-1"; + } + static get priority() { + return 60; + } + static test(e2) { + return e2.authcid !== null; + } + onChallenge(e2, t2, n2) { + const r2 = n2 || h.hexdigest("" + 1234567890 * Math.random()); + let i2 = "n=" + p(e2.authcid); + return i2 += ",r=", i2 += r2, e2._sasl_data.cnonce = r2, e2._sasl_data["client-first-message-bare"] = i2, i2 = "n,," + i2, this.onChallenge = (e3, t3) => { + let n3, r3, i3, o2, s2, a2, c2, l2, u2 = "c=biws,", d2 = "".concat(e3._sasl_data["client-first-message-bare"], ",").concat(t3, ","); + const h2 = e3._sasl_data.cnonce, g2 = /([a-z]+)=([^,]+)(,|$)/; + for (; t3.match(g2); ) { + const e4 = t3.match(g2); + switch (t3 = t3.replace(e4[0], ""), e4[1]) { + case "r": + n3 = e4[2]; + break; + case "s": + r3 = e4[2]; + break; + case "i": + i3 = e4[2]; + } + } + if (n3.substr(0, h2.length) !== h2) + return e3._sasl_data = {}, e3._sasl_failure_cb(); + u2 += "r=" + n3, d2 += u2, r3 = Object(m.atob)(r3), r3 += "\0\0\0"; + const v2 = p(e3.pass); + for (o2 = a2 = f.a.core_hmac_sha1(v2, r3), c2 = 1; c2 < i3; c2++) { + for (s2 = f.a.core_hmac_sha1(v2, f.a.binb2str(a2)), l2 = 0; l2 < 5; l2++) + o2[l2] ^= s2[l2]; + a2 = s2; + } + o2 = f.a.binb2str(o2); + const _2 = f.a.core_hmac_sha1(o2, "Client Key"), b2 = f.a.str_hmac_sha1(o2, "Server Key"), y2 = f.a.core_hmac_sha1(f.a.str_sha1(f.a.binb2str(_2)), d2); + for (e3._sasl_data["server-signature"] = f.a.b64_hmac_sha1(b2, d2), l2 = 0; l2 < 5; l2++) + _2[l2] ^= y2[l2]; + return u2 += ",p=" + Object(m.btoa)(f.a.binb2str(_2)), u2; + }, i2; + } + }, w.SASLOAuthBearer = class extends w.SASLMechanism { + constructor() { + super(w.SASLOAuthBearer.name, true, w.SASLOAuthBearer.priority); + } + static get name() { + return "OAUTHBEARER"; + } + static get priority() { + return 40; + } + static test(e2) { + return e2.pass !== null; + } + onChallenge(e2) { + let t2 = "n,"; + return e2.authcid !== null && (t2 = t2 + "a=" + e2.authzid), t2 += ",", t2 += "", t2 += "auth=Bearer ", t2 += e2.pass, t2 += "", t2 += "", p(t2); + } + }, w.SASLExternal = class extends w.SASLMechanism { + constructor() { + super(w.SASLExternal.name, true, w.SASLExternal.priority); + } + static get name() { + return "EXTERNAL"; + } + static get priority() { + return 10; + } + onChallenge(e2) { + return e2.authcid === e2.authzid ? "" : e2.authzid; + } + }, w.SASLXOAuth2 = class extends w.SASLMechanism { + constructor() { + super(w.SASLXOAuth2.name, true, w.SASLXOAuth2.priority); + } + static get name() { + return "X-OAUTH2"; + } + static get priority() { + return 30; + } + static test(e2) { + return e2.pass !== null; + } + onChallenge(e2) { + let t2 = "\0"; + return e2.authcid !== null && (t2 += e2.authzid), t2 += "\0", t2 += e2.pass, p(t2); + } + }; + t.f = {Strophe: w, $build: v, $iq: b, $msg: _, $pres: y, SHA1: f.a, MD5: h, b64_hmac_sha1: f.a.b64_hmac_sha1, b64_sha1: f.a.b64_sha1, str_hmac_sha1: f.a.str_hmac_sha1, str_sha1: f.a.str_sha1}; + }, function(e, t, n) { + (function(e2) { + n(154), n(68), n(493); + var r = n(0); + n.d(t, "e", function() { + return r.e; + }), n.d(t, "a", function() { + return r.a; + }), n.d(t, "b", function() { + return r.b; + }), n.d(t, "c", function() { + return r.c; + }), n.d(t, "d", function() { + return r.d; + }), e2.$build = r.f.$build, e2.$iq = r.f.$iq, e2.$msg = r.f.$msg, e2.$pres = r.f.$pres, e2.Strophe = r.f.Strophe; + }).call(this, n(12)); + }, function(e, t, n) { + n.d(t, "a", function() { + return C; + }), n.d(t, "b", function() { + return j; + }), n.d(t, "d", function() { + return O; + }), n.d(t, "c", function() { + return S; + }); + var r = n(9); + const i = function(e2, t2) { + const n2 = (65535 & e2) + (65535 & t2); + return (e2 >> 16) + (t2 >> 16) + (n2 >> 16) << 16 | 65535 & n2; + }, o = function(e2) { + if (typeof e2 != "string") + throw new Error("str2binl was passed a non-string"); + const t2 = []; + for (let n2 = 0; n2 < 8 * e2.length; n2 += 8) + t2[n2 >> 5] |= (255 & e2.charCodeAt(n2 / 8)) << n2 % 32; + return t2; + }, s = function(e2, t2, n2, r2, o2, s2) { + return i((a2 = i(i(t2, e2), i(r2, s2))) << (c2 = o2) | a2 >>> 32 - c2, n2); + var a2, c2; + }, a = function(e2, t2, n2, r2, i2, o2, a2) { + return s(t2 & n2 | ~t2 & r2, e2, t2, i2, o2, a2); + }, c = function(e2, t2, n2, r2, i2, o2, a2) { + return s(t2 & r2 | n2 & ~r2, e2, t2, i2, o2, a2); + }, l = function(e2, t2, n2, r2, i2, o2, a2) { + return s(t2 ^ n2 ^ r2, e2, t2, i2, o2, a2); + }, u = function(e2, t2, n2, r2, i2, o2, a2) { + return s(n2 ^ (t2 | ~r2), e2, t2, i2, o2, a2); + }, d = function(e2, t2) { + e2[t2 >> 5] |= 128 << t2 % 32, e2[14 + (t2 + 64 >>> 9 << 4)] = t2; + let n2, r2, o2, s2, d2 = 1732584193, h2 = -271733879, f2 = -1732584194, p2 = 271733878; + for (let t3 = 0; t3 < e2.length; t3 += 16) + n2 = d2, r2 = h2, o2 = f2, s2 = p2, d2 = a(d2, h2, f2, p2, e2[t3 + 0], 7, -680876936), p2 = a(p2, d2, h2, f2, e2[t3 + 1], 12, -389564586), f2 = a(f2, p2, d2, h2, e2[t3 + 2], 17, 606105819), h2 = a(h2, f2, p2, d2, e2[t3 + 3], 22, -1044525330), d2 = a(d2, h2, f2, p2, e2[t3 + 4], 7, -176418897), p2 = a(p2, d2, h2, f2, e2[t3 + 5], 12, 1200080426), f2 = a(f2, p2, d2, h2, e2[t3 + 6], 17, -1473231341), h2 = a(h2, f2, p2, d2, e2[t3 + 7], 22, -45705983), d2 = a(d2, h2, f2, p2, e2[t3 + 8], 7, 1770035416), p2 = a(p2, d2, h2, f2, e2[t3 + 9], 12, -1958414417), f2 = a(f2, p2, d2, h2, e2[t3 + 10], 17, -42063), h2 = a(h2, f2, p2, d2, e2[t3 + 11], 22, -1990404162), d2 = a(d2, h2, f2, p2, e2[t3 + 12], 7, 1804603682), p2 = a(p2, d2, h2, f2, e2[t3 + 13], 12, -40341101), f2 = a(f2, p2, d2, h2, e2[t3 + 14], 17, -1502002290), h2 = a(h2, f2, p2, d2, e2[t3 + 15], 22, 1236535329), d2 = c(d2, h2, f2, p2, e2[t3 + 1], 5, -165796510), p2 = c(p2, d2, h2, f2, e2[t3 + 6], 9, -1069501632), f2 = c(f2, p2, d2, h2, e2[t3 + 11], 14, 643717713), h2 = c(h2, f2, p2, d2, e2[t3 + 0], 20, -373897302), d2 = c(d2, h2, f2, p2, e2[t3 + 5], 5, -701558691), p2 = c(p2, d2, h2, f2, e2[t3 + 10], 9, 38016083), f2 = c(f2, p2, d2, h2, e2[t3 + 15], 14, -660478335), h2 = c(h2, f2, p2, d2, e2[t3 + 4], 20, -405537848), d2 = c(d2, h2, f2, p2, e2[t3 + 9], 5, 568446438), p2 = c(p2, d2, h2, f2, e2[t3 + 14], 9, -1019803690), f2 = c(f2, p2, d2, h2, e2[t3 + 3], 14, -187363961), h2 = c(h2, f2, p2, d2, e2[t3 + 8], 20, 1163531501), d2 = c(d2, h2, f2, p2, e2[t3 + 13], 5, -1444681467), p2 = c(p2, d2, h2, f2, e2[t3 + 2], 9, -51403784), f2 = c(f2, p2, d2, h2, e2[t3 + 7], 14, 1735328473), h2 = c(h2, f2, p2, d2, e2[t3 + 12], 20, -1926607734), d2 = l(d2, h2, f2, p2, e2[t3 + 5], 4, -378558), p2 = l(p2, d2, h2, f2, e2[t3 + 8], 11, -2022574463), f2 = l(f2, p2, d2, h2, e2[t3 + 11], 16, 1839030562), h2 = l(h2, f2, p2, d2, e2[t3 + 14], 23, -35309556), d2 = l(d2, h2, f2, p2, e2[t3 + 1], 4, -1530992060), p2 = l(p2, d2, h2, f2, e2[t3 + 4], 11, 1272893353), f2 = l(f2, p2, d2, h2, e2[t3 + 7], 16, -155497632), h2 = l(h2, f2, p2, d2, e2[t3 + 10], 23, -1094730640), d2 = l(d2, h2, f2, p2, e2[t3 + 13], 4, 681279174), p2 = l(p2, d2, h2, f2, e2[t3 + 0], 11, -358537222), f2 = l(f2, p2, d2, h2, e2[t3 + 3], 16, -722521979), h2 = l(h2, f2, p2, d2, e2[t3 + 6], 23, 76029189), d2 = l(d2, h2, f2, p2, e2[t3 + 9], 4, -640364487), p2 = l(p2, d2, h2, f2, e2[t3 + 12], 11, -421815835), f2 = l(f2, p2, d2, h2, e2[t3 + 15], 16, 530742520), h2 = l(h2, f2, p2, d2, e2[t3 + 2], 23, -995338651), d2 = u(d2, h2, f2, p2, e2[t3 + 0], 6, -198630844), p2 = u(p2, d2, h2, f2, e2[t3 + 7], 10, 1126891415), f2 = u(f2, p2, d2, h2, e2[t3 + 14], 15, -1416354905), h2 = u(h2, f2, p2, d2, e2[t3 + 5], 21, -57434055), d2 = u(d2, h2, f2, p2, e2[t3 + 12], 6, 1700485571), p2 = u(p2, d2, h2, f2, e2[t3 + 3], 10, -1894986606), f2 = u(f2, p2, d2, h2, e2[t3 + 10], 15, -1051523), h2 = u(h2, f2, p2, d2, e2[t3 + 1], 21, -2054922799), d2 = u(d2, h2, f2, p2, e2[t3 + 8], 6, 1873313359), p2 = u(p2, d2, h2, f2, e2[t3 + 15], 10, -30611744), f2 = u(f2, p2, d2, h2, e2[t3 + 6], 15, -1560198380), h2 = u(h2, f2, p2, d2, e2[t3 + 13], 21, 1309151649), d2 = u(d2, h2, f2, p2, e2[t3 + 4], 6, -145523070), p2 = u(p2, d2, h2, f2, e2[t3 + 11], 10, -1120210379), f2 = u(f2, p2, d2, h2, e2[t3 + 2], 15, 718787259), h2 = u(h2, f2, p2, d2, e2[t3 + 9], 21, -343485551), d2 = i(d2, n2), h2 = i(h2, r2), f2 = i(f2, o2), p2 = i(p2, s2); + return [d2, h2, f2, p2]; + }, h = {hexdigest: function(e2) { + return function(e3) { + let t2 = ""; + for (let n2 = 0; n2 < 4 * e3.length; n2++) + t2 += "0123456789abcdef".charAt(e3[n2 >> 2] >> n2 % 4 * 8 + 4 & 15) + "0123456789abcdef".charAt(e3[n2 >> 2] >> n2 % 4 * 8 & 15); + return t2; + }(d(o(e2), 8 * e2.length)); + }, hash: function(e2) { + return function(e3) { + let t2 = ""; + for (let n2 = 0; n2 < 32 * e3.length; n2 += 8) + t2 += String.fromCharCode(e3[n2 >> 5] >>> n2 % 32 & 255); + return t2; + }(d(o(e2), 8 * e2.length)); + }}; + function f(e2, t2) { + e2[t2 >> 5] |= 128 << 24 - t2 % 32, e2[15 + (t2 + 64 >> 9 << 4)] = t2; + var n2, r2, i2, o2, s2, a2, c2, l2, u2 = new Array(80), d2 = 1732584193, h2 = -271733879, f2 = -1732584194, m2 = 271733878, b2 = -1009589776; + for (n2 = 0; n2 < e2.length; n2 += 16) { + for (o2 = d2, s2 = h2, a2 = f2, c2 = m2, l2 = b2, r2 = 0; r2 < 80; r2++) + u2[r2] = r2 < 16 ? e2[n2 + r2] : _(u2[r2 - 3] ^ u2[r2 - 8] ^ u2[r2 - 14] ^ u2[r2 - 16], 1), i2 = v(v(_(d2, 5), p(r2, h2, f2, m2)), v(v(b2, u2[r2]), g(r2))), b2 = m2, m2 = f2, f2 = _(h2, 30), h2 = d2, d2 = i2; + d2 = v(d2, o2), h2 = v(h2, s2), f2 = v(f2, a2), m2 = v(m2, c2), b2 = v(b2, l2); + } + return [d2, h2, f2, m2, b2]; + } + function p(e2, t2, n2, r2) { + return e2 < 20 ? t2 & n2 | ~t2 & r2 : e2 < 40 ? t2 ^ n2 ^ r2 : e2 < 60 ? t2 & n2 | t2 & r2 | n2 & r2 : t2 ^ n2 ^ r2; + } + function g(e2) { + return e2 < 20 ? 1518500249 : e2 < 40 ? 1859775393 : e2 < 60 ? -1894007588 : -899497514; + } + function m(e2, t2) { + var n2 = b(e2); + n2.length > 16 && (n2 = f(n2, 8 * e2.length)); + for (var r2 = new Array(16), i2 = new Array(16), o2 = 0; o2 < 16; o2++) + r2[o2] = 909522486 ^ n2[o2], i2[o2] = 1549556828 ^ n2[o2]; + var s2 = f(r2.concat(b(t2)), 512 + 8 * t2.length); + return f(i2.concat(s2), 672); + } + function v(e2, t2) { + var n2 = (65535 & e2) + (65535 & t2); + return (e2 >> 16) + (t2 >> 16) + (n2 >> 16) << 16 | 65535 & n2; + } + function _(e2, t2) { + return e2 << t2 | e2 >>> 32 - t2; + } + function b(e2) { + for (var t2 = [], n2 = 0; n2 < 8 * e2.length; n2 += 8) + t2[n2 >> 5] |= (255 & e2.charCodeAt(n2 / 8)) << 24 - n2 % 32; + return t2; + } + function y(e2) { + for (var t2, n2, r2 = "", i2 = 0; i2 < 4 * e2.length; i2 += 3) + for (t2 = (e2[i2 >> 2] >> 8 * (3 - i2 % 4) & 255) << 16 | (e2[i2 + 1 >> 2] >> 8 * (3 - (i2 + 1) % 4) & 255) << 8 | e2[i2 + 2 >> 2] >> 8 * (3 - (i2 + 2) % 4) & 255, n2 = 0; n2 < 4; n2++) + 8 * i2 + 6 * n2 > 32 * e2.length ? r2 += "=" : r2 += "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t2 >> 6 * (3 - n2) & 63); + return r2; + } + function w(e2) { + for (var t2 = "", n2 = 0; n2 < 32 * e2.length; n2 += 8) + t2 += String.fromCharCode(e2[n2 >> 5] >>> 24 - n2 % 32 & 255); + return t2; + } + const S = {b64_hmac_sha1: function(e2, t2) { + return y(m(e2, t2)); + }, b64_sha1: function(e2) { + return y(f(b(e2), 8 * e2.length)); + }, binb2str: w, core_hmac_sha1: m, str_hmac_sha1: function(e2, t2) { + return w(m(e2, t2)); + }, str_sha1: function(e2) { + return w(f(b(e2), 8 * e2.length)); + }}, x = function(e2) { + var t2, n2, r2 = "", i2 = e2.length; + for (t2 = 0; t2 < i2; t2++) + (n2 = e2.charCodeAt(t2)) >= 0 && n2 <= 127 ? r2 += e2.charAt(t2) : n2 > 2047 ? (r2 += String.fromCharCode(224 | n2 >> 12 & 15), r2 += String.fromCharCode(128 | n2 >> 6 & 63), r2 += String.fromCharCode(128 | n2 >> 0 & 63)) : (r2 += String.fromCharCode(192 | n2 >> 6 & 31), r2 += String.fromCharCode(128 | n2 >> 0 & 63)); + return r2; + }, E = function(e2) { + e2 = e2 || {}; + for (const t2 in e2) + if (Object.prototype.hasOwnProperty.call(e2, t2)) { + let n2 = "", r2 = "", i2 = ""; + const o2 = e2[t2], s2 = typeof o2 == "object", a2 = escape(unescape(s2 ? o2.value : o2)); + s2 && (n2 = o2.expires ? ";expires=" + o2.expires : "", r2 = o2.domain ? ";domain=" + o2.domain : "", i2 = o2.path ? ";path=" + o2.path : ""), document.cookie = t2 + "=" + a2 + n2 + r2 + i2; + } + }; + var A = n(10); + function C(e2, t2) { + return new O.Builder(e2, t2); + } + function j(e2) { + return new O.Builder("iq", e2); + } + function T(e2) { + return new O.Builder("presence", e2); + } + const O = {VERSION: "1.4.1", NS: {HTTPBIND: "http://jabber.org/protocol/httpbind", BOSH: "urn:xmpp:xbosh", CLIENT: "jabber:client", AUTH: "jabber:iq:auth", ROSTER: "jabber:iq:roster", PROFILE: "jabber:iq:profile", DISCO_INFO: "http://jabber.org/protocol/disco#info", DISCO_ITEMS: "http://jabber.org/protocol/disco#items", MUC: "http://jabber.org/protocol/muc", SASL: "urn:ietf:params:xml:ns:xmpp-sasl", STREAM: "http://etherx.jabber.org/streams", FRAMING: "urn:ietf:params:xml:ns:xmpp-framing", BIND: "urn:ietf:params:xml:ns:xmpp-bind", SESSION: "urn:ietf:params:xml:ns:xmpp-session", VERSION: "jabber:iq:version", STANZAS: "urn:ietf:params:xml:ns:xmpp-stanzas", XHTML_IM: "http://jabber.org/protocol/xhtml-im", XHTML: "http://www.w3.org/1999/xhtml"}, XHTML: {tags: ["a", "blockquote", "br", "cite", "em", "img", "li", "ol", "p", "span", "strong", "ul", "body"], attributes: {a: ["href"], blockquote: ["style"], br: [], cite: ["style"], em: [], img: ["src", "alt", "style", "height", "width"], li: ["style"], ol: ["style"], p: ["style"], span: ["style"], strong: [], ul: ["style"], body: []}, css: ["background-color", "color", "font-family", "font-size", "font-style", "font-weight", "margin-left", "margin-right", "text-align", "text-decoration"], validTag(e2) { + for (let t2 = 0; t2 < O.XHTML.tags.length; t2++) + if (e2 === O.XHTML.tags[t2]) + return true; + return false; + }, validAttribute(e2, t2) { + if (O.XHTML.attributes[e2] !== void 0 && O.XHTML.attributes[e2].length > 0) { + for (let n2 = 0; n2 < O.XHTML.attributes[e2].length; n2++) + if (t2 === O.XHTML.attributes[e2][n2]) + return true; + } + return false; + }, validCSS(e2) { + for (let t2 = 0; t2 < O.XHTML.css.length; t2++) + if (e2 === O.XHTML.css[t2]) + return true; + return false; + }}, Status: {ERROR: 0, CONNECTING: 1, CONNFAIL: 2, AUTHENTICATING: 3, AUTHFAIL: 4, CONNECTED: 5, DISCONNECTED: 6, DISCONNECTING: 7, ATTACHED: 8, REDIRECT: 9, CONNTIMEOUT: 10, BINDREQUIRED: 11, ATTACHFAIL: 12}, ErrorCondition: {BAD_FORMAT: "bad-format", CONFLICT: "conflict", MISSING_JID_NODE: "x-strophe-bad-non-anon-jid", NO_AUTH_MECH: "no-auth-mech", UNKNOWN_REASON: "unknown"}, LogLevel: {DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3, FATAL: 4}, ElementType: {NORMAL: 1, TEXT: 3, CDATA: 4, FRAGMENT: 11}, TIMEOUT: 1.1, SECONDARY_TIMEOUT: 0.1, addNamespace(e2, t2) { + O.NS[e2] = t2; + }, forEachChild(e2, t2, n2) { + for (let r2 = 0; r2 < e2.childNodes.length; r2++) { + const i2 = e2.childNodes[r2]; + i2.nodeType !== O.ElementType.NORMAL || t2 && !this.isTagEqual(i2, t2) || n2(i2); + } + }, isTagEqual: (e2, t2) => e2.tagName === t2, _xmlGenerator: null, xmlGenerator: () => (O._xmlGenerator || (O._xmlGenerator = r.c()), O._xmlGenerator), xmlElement(e2) { + if (!e2) + return null; + const t2 = O.xmlGenerator().createElement(e2); + for (let e3 = 1; e3 < arguments.length; e3++) { + const n2 = arguments[e3]; + if (n2) { + if (typeof n2 == "string" || typeof n2 == "number") + t2.appendChild(O.xmlTextNode(n2)); + else if (typeof n2 == "object" && typeof n2.sort == "function") + for (let e4 = 0; e4 < n2.length; e4++) { + const r2 = n2[e4]; + typeof r2 == "object" && typeof r2.sort == "function" && r2[1] !== void 0 && r2[1] !== null && t2.setAttribute(r2[0], r2[1]); + } + else if (typeof n2 == "object") + for (const e4 in n2) + Object.prototype.hasOwnProperty.call(n2, e4) && n2[e4] !== void 0 && n2[e4] !== null && t2.setAttribute(e4, n2[e4]); + } + } + return t2; + }, xmlescape: (e2) => e2 = (e2 = (e2 = (e2 = (e2 = e2.replace(/\&/g, "&")).replace(/</g, "<")).replace(/>/g, ">")).replace(/'/g, "'")).replace(/"/g, """), xmlunescape: (e2) => e2 = (e2 = (e2 = (e2 = (e2 = e2.replace(/\&/g, "&")).replace(/</g, "<")).replace(/>/g, ">")).replace(/'/g, "'")).replace(/"/g, '"'), xmlTextNode: (e2) => O.xmlGenerator().createTextNode(e2), xmlHtmlNode(e2) { + let t2; + if (r.a) { + t2 = new r.a().parseFromString(e2, "text/xml"); + } else + t2 = new ActiveXObject("Microsoft.XMLDOM"), t2.async = "false", t2.loadXML(e2); + return t2; + }, getText(e2) { + if (!e2) + return null; + let t2 = ""; + e2.childNodes.length === 0 && e2.nodeType === O.ElementType.TEXT && (t2 += e2.nodeValue); + for (let n2 = 0; n2 < e2.childNodes.length; n2++) + e2.childNodes[n2].nodeType === O.ElementType.TEXT && (t2 += e2.childNodes[n2].nodeValue); + return O.xmlescape(t2); + }, copyElement(e2) { + let t2; + if (e2.nodeType === O.ElementType.NORMAL) { + t2 = O.xmlElement(e2.tagName); + for (let n2 = 0; n2 < e2.attributes.length; n2++) + t2.setAttribute(e2.attributes[n2].nodeName, e2.attributes[n2].value); + for (let n2 = 0; n2 < e2.childNodes.length; n2++) + t2.appendChild(O.copyElement(e2.childNodes[n2])); + } else + e2.nodeType === O.ElementType.TEXT && (t2 = O.xmlGenerator().createTextNode(e2.nodeValue)); + return t2; + }, createHtml(e2) { + let t2; + if (e2.nodeType === O.ElementType.NORMAL) { + const n2 = e2.nodeName.toLowerCase(); + if (O.XHTML.validTag(n2)) + try { + t2 = O.xmlElement(n2); + for (let r2 = 0; r2 < O.XHTML.attributes[n2].length; r2++) { + const i2 = O.XHTML.attributes[n2][r2]; + let o2 = e2.getAttribute(i2); + if (o2 != null && o2 !== "" && o2 !== false && o2 !== 0) + if (i2 === "style" && typeof o2 == "object" && o2.cssText !== void 0 && (o2 = o2.cssText), i2 === "style") { + const e3 = [], n3 = o2.split(";"); + for (let t3 = 0; t3 < n3.length; t3++) { + const r3 = n3[t3].split(":"), i3 = r3[0].replace(/^\s*/, "").replace(/\s*$/, "").toLowerCase(); + if (O.XHTML.validCSS(i3)) { + const t4 = r3[1].replace(/^\s*/, "").replace(/\s*$/, ""); + e3.push(i3 + ": " + t4); + } + } + e3.length > 0 && (o2 = e3.join("; "), t2.setAttribute(i2, o2)); + } else + t2.setAttribute(i2, o2); + } + for (let n3 = 0; n3 < e2.childNodes.length; n3++) + t2.appendChild(O.createHtml(e2.childNodes[n3])); + } catch (e3) { + t2 = O.xmlTextNode(""); + } + else { + t2 = O.xmlGenerator().createDocumentFragment(); + for (let n3 = 0; n3 < e2.childNodes.length; n3++) + t2.appendChild(O.createHtml(e2.childNodes[n3])); + } + } else if (e2.nodeType === O.ElementType.FRAGMENT) { + t2 = O.xmlGenerator().createDocumentFragment(); + for (let n2 = 0; n2 < e2.childNodes.length; n2++) + t2.appendChild(O.createHtml(e2.childNodes[n2])); + } else + e2.nodeType === O.ElementType.TEXT && (t2 = O.xmlTextNode(e2.nodeValue)); + return t2; + }, escapeNode: (e2) => typeof e2 != "string" ? e2 : e2.replace(/^\s+|\s+$/g, "").replace(/\\/g, "\\5c").replace(/ /g, "\\20").replace(/\"/g, "\\22").replace(/\&/g, "\\26").replace(/\'/g, "\\27").replace(/\//g, "\\2f").replace(/:/g, "\\3a").replace(/</g, "\\3c").replace(/>/g, "\\3e").replace(/@/g, "\\40"), unescapeNode: (e2) => typeof e2 != "string" ? e2 : e2.replace(/\\20/g, " ").replace(/\\22/g, '"').replace(/\\26/g, "&").replace(/\\27/g, "'").replace(/\\2f/g, "/").replace(/\\3a/g, ":").replace(/\\3c/g, "<").replace(/\\3e/g, ">").replace(/\\40/g, "@").replace(/\\5c/g, "\\"), getNodeFromJid: (e2) => e2.indexOf("@") < 0 ? null : e2.split("@")[0], getDomainFromJid(e2) { + const t2 = O.getBareJidFromJid(e2); + if (t2.indexOf("@") < 0) + return t2; + { + const e3 = t2.split("@"); + return e3.splice(0, 1), e3.join("@"); + } + }, getResourceFromJid(e2) { + if (!e2) + return null; + const t2 = e2.split("/"); + return t2.length < 2 ? null : (t2.splice(0, 1), t2.join("/")); + }, getBareJidFromJid: (e2) => e2 ? e2.split("/")[0] : null, _handleError(e2) { + e2.stack !== void 0 && O.fatal(e2.stack), e2.sourceURL ? O.fatal("error: " + this.handler + " " + e2.sourceURL + ":" + e2.line + " - " + e2.name + ": " + e2.message) : e2.fileName ? O.fatal("error: " + this.handler + " " + e2.fileName + ":" + e2.lineNumber + " - " + e2.name + ": " + e2.message) : O.fatal("error: " + e2.message); + }, log(e2, t2) { + var n2; + e2 === this.LogLevel.FATAL && ((n2 = console) === null || n2 === void 0 || n2.error(t2)); + }, debug(e2) { + this.log(this.LogLevel.DEBUG, e2); + }, info(e2) { + this.log(this.LogLevel.INFO, e2); + }, warn(e2) { + this.log(this.LogLevel.WARN, e2); + }, error(e2) { + this.log(this.LogLevel.ERROR, e2); + }, fatal(e2) { + this.log(this.LogLevel.FATAL, e2); + }, serialize(e2) { + if (!e2) + return null; + typeof e2.tree == "function" && (e2 = e2.tree()); + const t2 = [...Array(e2.attributes.length).keys()].map((t3) => e2.attributes[t3].nodeName); + t2.sort(); + let n2 = t2.reduce((t3, n3) => "".concat(t3, " ").concat(n3, '="').concat(O.xmlescape(e2.attributes.getNamedItem(n3).value), '"'), "<".concat(e2.nodeName)); + if (e2.childNodes.length > 0) { + n2 += ">"; + for (let t3 = 0; t3 < e2.childNodes.length; t3++) { + const r2 = e2.childNodes[t3]; + switch (r2.nodeType) { + case O.ElementType.NORMAL: + n2 += O.serialize(r2); + break; + case O.ElementType.TEXT: + n2 += O.xmlescape(r2.nodeValue); + break; + case O.ElementType.CDATA: + n2 += "<![CDATA[" + r2.nodeValue + "]]>"; + } + } + n2 += "</" + e2.nodeName + ">"; + } else + n2 += "/>"; + return n2; + }, _requestId: 0, _connectionPlugins: {}, addConnectionPlugin(e2, t2) { + O._connectionPlugins[e2] = t2; + }, Builder: class { + constructor(e2, t2) { + e2 !== "presence" && e2 !== "message" && e2 !== "iq" || (t2 && !t2.xmlns ? t2.xmlns = O.NS.CLIENT : t2 || (t2 = {xmlns: O.NS.CLIENT})), this.nodeTree = O.xmlElement(e2, t2), this.node = this.nodeTree; + } + tree() { + return this.nodeTree; + } + toString() { + return O.serialize(this.nodeTree); + } + up() { + return this.node = this.node.parentNode, this; + } + root() { + return this.node = this.nodeTree, this; + } + attrs(e2) { + for (const t2 in e2) + Object.prototype.hasOwnProperty.call(e2, t2) && (e2[t2] === void 0 ? this.node.removeAttribute(t2) : this.node.setAttribute(t2, e2[t2])); + return this; + } + c(e2, t2, n2) { + const r2 = O.xmlElement(e2, t2, n2); + return this.node.appendChild(r2), typeof n2 != "string" && typeof n2 != "number" && (this.node = r2), this; + } + cnode(e2) { + let t2; + const n2 = O.xmlGenerator(); + try { + t2 = n2.importNode !== void 0; + } catch (e3) { + t2 = false; + } + const r2 = t2 ? n2.importNode(e2, true) : O.copyElement(e2); + return this.node.appendChild(r2), this.node = r2, this; + } + t(e2) { + const t2 = O.xmlTextNode(e2); + return this.node.appendChild(t2), this; + } + h(e2) { + const t2 = O.xmlGenerator().createElement("body"); + t2.innerHTML = e2; + const n2 = O.createHtml(t2); + for (; n2.childNodes.length > 0; ) + this.node.appendChild(n2.childNodes[0]); + return this; + } + }, Handler: function(e2, t2, n2, r2, i2, o2, s2) { + this.handler = e2, this.ns = t2, this.name = n2, this.type = r2, this.id = i2, this.options = s2 || {matchBareFromJid: false, ignoreNamespaceFragment: false}, this.options.matchBare && (O.warn('The "matchBare" option is deprecated, use "matchBareFromJid" instead.'), this.options.matchBareFromJid = this.options.matchBare, delete this.options.matchBare), this.options.matchBareFromJid ? this.from = o2 ? O.getBareJidFromJid(o2) : null : this.from = o2, this.user = true; + }}; + O.Handler.prototype = {getNamespace(e2) { + let t2 = e2.getAttribute("xmlns"); + return t2 && this.options.ignoreNamespaceFragment && (t2 = t2.split("#")[0]), t2; + }, namespaceMatch(e2) { + let t2 = false; + return !this.ns || (O.forEachChild(e2, null, (e3) => { + this.getNamespace(e3) === this.ns && (t2 = true); + }), t2 || this.getNamespace(e2) === this.ns); + }, isMatch(e2) { + let t2 = e2.getAttribute("from"); + this.options.matchBareFromJid && (t2 = O.getBareJidFromJid(t2)); + const n2 = e2.getAttribute("type"); + return !(!this.namespaceMatch(e2) || this.name && !O.isTagEqual(e2, this.name) || this.type && (Array.isArray(this.type) ? this.type.indexOf(n2) === -1 : n2 !== this.type) || this.id && e2.getAttribute("id") !== this.id || this.from && t2 !== this.from); + }, run(e2) { + let t2 = null; + try { + t2 = this.handler(e2); + } catch (e3) { + throw O._handleError(e3), e3; + } + return t2; + }, toString() { + return "{Handler: " + this.handler + "(" + this.name + "," + this.id + "," + this.ns + ")}"; + }}, O.TimedHandler = class { + constructor(e2, t2) { + this.period = e2, this.handler = t2, this.lastCalled = new Date().getTime(), this.user = true; + } + run() { + return this.lastCalled = new Date().getTime(), this.handler(); + } + reset() { + this.lastCalled = new Date().getTime(); + } + toString() { + return "{TimedHandler: " + this.handler + "(" + this.period + ")}"; + } + }, O.Connection = class { + constructor(e2, t2) { + this.service = e2, this.options = t2 || {}, this.setProtocol(), this.jid = "", this.domain = null, this.features = null, this._sasl_data = {}, this.do_bind = false, this.do_session = false, this.mechanisms = {}, this.timedHandlers = [], this.handlers = [], this.removeTimeds = [], this.removeHandlers = [], this.addTimeds = [], this.addHandlers = [], this.protocolErrorHandlers = {HTTP: {}, websocket: {}}, this._idleTimeout = null, this._disconnectTimeout = null, this.authenticated = false, this.connected = false, this.disconnecting = false, this.do_authentication = true, this.paused = false, this.restored = false, this._data = [], this._uniqueId = 0, this._sasl_success_handler = null, this._sasl_failure_handler = null, this._sasl_challenge_handler = null, this.maxRetries = 5, this._idleTimeout = setTimeout(() => this._onIdle(), 100), E(this.options.cookies), this.registerSASLMechanisms(this.options.mechanisms); + for (const e3 in O._connectionPlugins) + if (Object.prototype.hasOwnProperty.call(O._connectionPlugins, e3)) { + const t3 = function() { + }; + t3.prototype = O._connectionPlugins[e3], this[e3] = new t3(), this[e3].init(this); + } + } + setProtocol() { + const e2 = this.options.protocol || ""; + this.options.worker ? this._proto = new O.WorkerWebsocket(this) : this.service.indexOf("ws:") === 0 || this.service.indexOf("wss:") === 0 || e2.indexOf("ws") === 0 ? this._proto = new O.Websocket(this) : this._proto = new O.Bosh(this); + } + reset() { + this._proto._reset(), this.do_session = false, this.do_bind = false, this.timedHandlers = [], this.handlers = [], this.removeTimeds = [], this.removeHandlers = [], this.addTimeds = [], this.addHandlers = [], this.authenticated = false, this.connected = false, this.disconnecting = false, this.restored = false, this._data = [], this._requests = [], this._uniqueId = 0; + } + pause() { + this.paused = true; + } + resume() { + this.paused = false; + } + getUniqueId(e2) { + const t2 = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e3) { + const t3 = 16 * Math.random() | 0; + return (e3 === "x" ? t3 : 3 & t3 | 8).toString(16); + }); + return typeof e2 == "string" || typeof e2 == "number" ? t2 + ":" + e2 : t2 + ""; + } + addProtocolErrorHandler(e2, t2, n2) { + this.protocolErrorHandlers[e2][t2] = n2; + } + connect(e2, t2, n2, r2, i2, o2, s2) { + this.jid = e2, this.authzid = O.getBareJidFromJid(this.jid), this.authcid = s2 || O.getNodeFromJid(this.jid), this.pass = t2, this.connect_callback = n2, this.disconnecting = false, this.connected = false, this.authenticated = false, this.restored = false, this.domain = O.getDomainFromJid(this.jid), this._changeConnectStatus(O.Status.CONNECTING, null), this._proto._connect(r2, i2, o2); + } + attach(e2, t2, n2, r2, i2, o2, s2) { + if (this._proto._attach) + return this._proto._attach(e2, t2, n2, r2, i2, o2, s2); + { + const e3 = new Error('The "attach" method is not available for your connection protocol'); + throw e3.name = "StropheSessionError", e3; + } + } + restore(e2, t2, n2, r2, i2) { + if (!this._sessionCachingSupported()) { + const e3 = new Error('The "restore" method can only be used with a BOSH connection.'); + throw e3.name = "StropheSessionError", e3; + } + this._proto._restore(e2, t2, n2, r2, i2); + } + _sessionCachingSupported() { + if (this._proto instanceof O.Bosh) { + if (!JSON) + return false; + try { + sessionStorage.setItem("_strophe_", "_strophe_"), sessionStorage.removeItem("_strophe_"); + } catch (e2) { + return false; + } + return true; + } + return false; + } + xmlInput(e2) { + } + xmlOutput(e2) { + } + rawInput(e2) { + } + rawOutput(e2) { + } + nextValidRid(e2) { + } + send(e2) { + if (e2 !== null) { + if (typeof e2.sort == "function") + for (let t2 = 0; t2 < e2.length; t2++) + this._queueData(e2[t2]); + else + typeof e2.tree == "function" ? this._queueData(e2.tree()) : this._queueData(e2); + this._proto._send(); + } + } + flush() { + clearTimeout(this._idleTimeout), this._onIdle(); + } + sendPresence(e2, t2, n2, r2) { + let i2 = null; + typeof e2.tree == "function" && (e2 = e2.tree()); + let o2 = e2.getAttribute("id"); + if (o2 || (o2 = this.getUniqueId("sendPresence"), e2.setAttribute("id", o2)), typeof t2 == "function" || typeof n2 == "function") { + const e3 = this.addHandler((e4) => { + i2 && this.deleteTimedHandler(i2), e4.getAttribute("type") === "error" ? n2 && n2(e4) : t2 && t2(e4); + }, null, "presence", null, o2); + r2 && (i2 = this.addTimedHandler(r2, () => (this.deleteHandler(e3), n2 && n2(null), false))); + } + return this.send(e2), o2; + } + sendIQ(e2, t2, n2, r2) { + let i2 = null; + typeof e2.tree == "function" && (e2 = e2.tree()); + let o2 = e2.getAttribute("id"); + if (o2 || (o2 = this.getUniqueId("sendIQ"), e2.setAttribute("id", o2)), typeof t2 == "function" || typeof n2 == "function") { + const e3 = this.addHandler((e4) => { + i2 && this.deleteTimedHandler(i2); + const r3 = e4.getAttribute("type"); + if (r3 === "result") + t2 && t2(e4); + else { + if (r3 !== "error") { + const e5 = new Error("Got bad IQ type of ".concat(r3)); + throw e5.name = "StropheError", e5; + } + n2 && n2(e4); + } + }, null, "iq", ["error", "result"], o2); + r2 && (i2 = this.addTimedHandler(r2, () => (this.deleteHandler(e3), n2 && n2(null), false))); + } + return this.send(e2), o2; + } + _queueData(e2) { + if (e2 === null || !e2.tagName || !e2.childNodes) { + const e3 = new Error("Cannot queue non-DOMElement."); + throw e3.name = "StropheError", e3; + } + this._data.push(e2); + } + _sendRestart() { + this._data.push("restart"), this._proto._sendRestart(), this._idleTimeout = setTimeout(() => this._onIdle(), 100); + } + addTimedHandler(e2, t2) { + const n2 = new O.TimedHandler(e2, t2); + return this.addTimeds.push(n2), n2; + } + deleteTimedHandler(e2) { + this.removeTimeds.push(e2); + } + addHandler(e2, t2, n2, r2, i2, o2, s2) { + const a2 = new O.Handler(e2, t2, n2, r2, i2, o2, s2); + return this.addHandlers.push(a2), a2; + } + deleteHandler(e2) { + this.removeHandlers.push(e2); + const t2 = this.addHandlers.indexOf(e2); + t2 >= 0 && this.addHandlers.splice(t2, 1); + } + registerSASLMechanisms(e2) { + this.mechanisms = {}, (e2 = e2 || [O.SASLAnonymous, O.SASLExternal, O.SASLOAuthBearer, O.SASLXOAuth2, O.SASLPlain, O.SASLSHA1]).forEach((e3) => this.registerSASLMechanism(e3)); + } + registerSASLMechanism(e2) { + const t2 = new e2(); + this.mechanisms[t2.mechname] = t2; + } + disconnect(e2) { + if (this._changeConnectStatus(O.Status.DISCONNECTING, e2), e2 ? O.warn("Disconnect was called because: " + e2) : O.info("Disconnect was called"), this.connected) { + let e3 = false; + this.disconnecting = true, this.authenticated && (e3 = T({xmlns: O.NS.CLIENT, type: "unavailable"})), this._disconnectTimeout = this._addSysTimedHandler(3e3, this._onDisconnectTimeout.bind(this)), this._proto._disconnect(e3); + } else + O.warn("Disconnect was called before Strophe connected to the server"), this._proto._abortAllRequests(), this._doDisconnect(); + } + _changeConnectStatus(e2, t2, n2) { + for (const n3 in O._connectionPlugins) + if (Object.prototype.hasOwnProperty.call(O._connectionPlugins, n3)) { + const r2 = this[n3]; + if (r2.statusChanged) + try { + r2.statusChanged(e2, t2); + } catch (e3) { + O.error("".concat(n3, " plugin caused an exception changing status: ").concat(e3)); + } + } + if (this.connect_callback) + try { + this.connect_callback(e2, t2, n2); + } catch (e3) { + O._handleError(e3), O.error("User connection callback caused an exception: ".concat(e3)); + } + } + _doDisconnect(e2) { + typeof this._idleTimeout == "number" && clearTimeout(this._idleTimeout), this._disconnectTimeout !== null && (this.deleteTimedHandler(this._disconnectTimeout), this._disconnectTimeout = null), O.debug("_doDisconnect was called"), this._proto._doDisconnect(), this.authenticated = false, this.disconnecting = false, this.restored = false, this.handlers = [], this.timedHandlers = [], this.removeTimeds = [], this.removeHandlers = [], this.addTimeds = [], this.addHandlers = [], this._changeConnectStatus(O.Status.DISCONNECTED, e2), this.connected = false; + } + _dataRecv(e2, t2) { + const n2 = this._proto._reqToData(e2); + if (n2 === null) + return; + for (this.xmlInput !== O.Connection.prototype.xmlInput && (n2.nodeName === this._proto.strip && n2.childNodes.length ? this.xmlInput(n2.childNodes[0]) : this.xmlInput(n2)), this.rawInput !== O.Connection.prototype.rawInput && (t2 ? this.rawInput(t2) : this.rawInput(O.serialize(n2))); this.removeHandlers.length > 0; ) { + const e3 = this.removeHandlers.pop(), t3 = this.handlers.indexOf(e3); + t3 >= 0 && this.handlers.splice(t3, 1); + } + for (; this.addHandlers.length > 0; ) + this.handlers.push(this.addHandlers.pop()); + if (this.disconnecting && this._proto._emptyQueue()) + return void this._doDisconnect(); + const r2 = n2.getAttribute("type"); + if (r2 !== null && r2 === "terminate") { + if (this.disconnecting) + return; + let e3 = n2.getAttribute("condition"); + const t3 = n2.getElementsByTagName("conflict"); + return e3 !== null ? (e3 === "remote-stream-error" && t3.length > 0 && (e3 = "conflict"), this._changeConnectStatus(O.Status.CONNFAIL, e3)) : this._changeConnectStatus(O.Status.CONNFAIL, O.ErrorCondition.UNKOWN_REASON), void this._doDisconnect(e3); + } + O.forEachChild(n2, null, (e3) => { + const t3 = this.handlers; + this.handlers = []; + for (let n3 = 0; n3 < t3.length; n3++) { + const r3 = t3[n3]; + try { + (!r3.isMatch(e3) || !this.authenticated && r3.user || r3.run(e3)) && this.handlers.push(r3); + } catch (e4) { + O.warn("Removing Strophe handlers due to uncaught exception: " + e4.message); + } + } + }); + } + _connect_cb(e2, t2, n2) { + let r2; + O.debug("_connect_cb was called"), this.connected = true; + try { + r2 = this._proto._reqToData(e2); + } catch (e3) { + if (e3.name !== O.ErrorCondition.BAD_FORMAT) + throw e3; + this._changeConnectStatus(O.Status.CONNFAIL, O.ErrorCondition.BAD_FORMAT), this._doDisconnect(O.ErrorCondition.BAD_FORMAT); + } + if (!r2) + return; + if (this.xmlInput !== O.Connection.prototype.xmlInput && (r2.nodeName === this._proto.strip && r2.childNodes.length ? this.xmlInput(r2.childNodes[0]) : this.xmlInput(r2)), this.rawInput !== O.Connection.prototype.rawInput && (n2 ? this.rawInput(n2) : this.rawInput(O.serialize(r2))), this._proto._connect_cb(r2) === O.Status.CONNFAIL) + return; + let i2; + if (i2 = r2.getElementsByTagNameNS ? r2.getElementsByTagNameNS(O.NS.STREAM, "features").length > 0 : r2.getElementsByTagName("stream:features").length > 0 || r2.getElementsByTagName("features").length > 0, !i2) + return void this._proto._no_auth_received(t2); + const o2 = Array.from(r2.getElementsByTagName("mechanism")).map((e3) => this.mechanisms[e3.textContent]).filter((e3) => e3); + o2.length !== 0 || r2.getElementsByTagName("auth").length !== 0 ? this.do_authentication !== false && this.authenticate(o2) : this._proto._no_auth_received(t2); + } + sortMechanismsByPriority(e2) { + for (let t2 = 0; t2 < e2.length - 1; ++t2) { + let n2 = t2; + for (let r2 = t2 + 1; r2 < e2.length; ++r2) + e2[r2].priority > e2[n2].priority && (n2 = r2); + if (n2 !== t2) { + const r2 = e2[t2]; + e2[t2] = e2[n2], e2[n2] = r2; + } + } + return e2; + } + authenticate(e2) { + this._attemptSASLAuth(e2) || this._attemptLegacyAuth(); + } + _attemptSASLAuth(e2) { + e2 = this.sortMechanismsByPriority(e2 || []); + let t2 = false; + for (let n2 = 0; n2 < e2.length; ++n2) { + if (!e2[n2].test(this)) + continue; + this._sasl_success_handler = this._addSysHandler(this._sasl_success_cb.bind(this), null, "success", null, null), this._sasl_failure_handler = this._addSysHandler(this._sasl_failure_cb.bind(this), null, "failure", null, null), this._sasl_challenge_handler = this._addSysHandler(this._sasl_challenge_cb.bind(this), null, "challenge", null, null), this._sasl_mechanism = e2[n2], this._sasl_mechanism.onStart(this); + const r2 = C("auth", {xmlns: O.NS.SASL, mechanism: this._sasl_mechanism.mechname}); + if (this._sasl_mechanism.isClientFirst) { + const e3 = this._sasl_mechanism.onChallenge(this, null); + r2.t(Object(A.btoa)(e3)); + } + this.send(r2.tree()), t2 = true; + break; + } + return t2; + } + _sasl_challenge_cb(e2) { + const t2 = Object(A.atob)(O.getText(e2)), n2 = this._sasl_mechanism.onChallenge(this, t2), r2 = C("response", {xmlns: O.NS.SASL}); + return n2 !== "" && r2.t(Object(A.btoa)(n2)), this.send(r2.tree()), true; + } + _attemptLegacyAuth() { + O.getNodeFromJid(this.jid) === null ? (this._changeConnectStatus(O.Status.CONNFAIL, O.ErrorCondition.MISSING_JID_NODE), this.disconnect(O.ErrorCondition.MISSING_JID_NODE)) : (this._changeConnectStatus(O.Status.AUTHENTICATING, null), this._addSysHandler(this._onLegacyAuthIQResult.bind(this), null, null, null, "_auth_1"), this.send(j({type: "get", to: this.domain, id: "_auth_1"}).c("query", {xmlns: O.NS.AUTH}).c("username", {}).t(O.getNodeFromJid(this.jid)).tree())); + } + _onLegacyAuthIQResult(e2) { + const t2 = j({type: "set", id: "_auth_2"}).c("query", {xmlns: O.NS.AUTH}).c("username", {}).t(O.getNodeFromJid(this.jid)).up().c("password").t(this.pass); + return O.getResourceFromJid(this.jid) || (this.jid = O.getBareJidFromJid(this.jid) + "/strophe"), t2.up().c("resource", {}).t(O.getResourceFromJid(this.jid)), this._addSysHandler(this._auth2_cb.bind(this), null, null, null, "_auth_2"), this.send(t2.tree()), false; + } + _sasl_success_cb(e2) { + if (this._sasl_data["server-signature"]) { + let t3; + const n3 = /([a-z]+)=([^,]+)(,|$)/, r2 = Object(A.atob)(O.getText(e2)).match(n3); + if (r2[1] === "v" && (t3 = r2[2]), t3 !== this._sasl_data["server-signature"]) + return this.deleteHandler(this._sasl_failure_handler), this._sasl_failure_handler = null, this._sasl_challenge_handler && (this.deleteHandler(this._sasl_challenge_handler), this._sasl_challenge_handler = null), this._sasl_data = {}, this._sasl_failure_cb(null); + } + O.info("SASL authentication succeeded."), this._sasl_mechanism && this._sasl_mechanism.onSuccess(), this.deleteHandler(this._sasl_failure_handler), this._sasl_failure_handler = null, this._sasl_challenge_handler && (this.deleteHandler(this._sasl_challenge_handler), this._sasl_challenge_handler = null); + const t2 = [], n2 = (e3, t3) => { + for (; e3.length; ) + this.deleteHandler(e3.pop()); + return this._onStreamFeaturesAfterSASL(t3), false; + }; + return t2.push(this._addSysHandler((e3) => n2(t2, e3), null, "stream:features", null, null)), t2.push(this._addSysHandler((e3) => n2(t2, e3), O.NS.STREAM, "features", null, null)), this._sendRestart(), false; + } + _onStreamFeaturesAfterSASL(e2) { + this.features = e2; + for (let t2 = 0; t2 < e2.childNodes.length; t2++) { + const n2 = e2.childNodes[t2]; + n2.nodeName === "bind" && (this.do_bind = true), n2.nodeName === "session" && (this.do_session = true); + } + return this.do_bind ? (this.options.explicitResourceBinding ? this._changeConnectStatus(O.Status.BINDREQUIRED, null) : this.bind(), false) : (this._changeConnectStatus(O.Status.AUTHFAIL, null), false); + } + bind() { + if (!this.do_bind) + return void O.log(O.LogLevel.INFO, 'Strophe.Connection.prototype.bind called but "do_bind" is false'); + this._addSysHandler(this._onResourceBindResultIQ.bind(this), null, null, null, "_bind_auth_2"); + const e2 = O.getResourceFromJid(this.jid); + e2 ? this.send(j({type: "set", id: "_bind_auth_2"}).c("bind", {xmlns: O.NS.BIND}).c("resource", {}).t(e2).tree()) : this.send(j({type: "set", id: "_bind_auth_2"}).c("bind", {xmlns: O.NS.BIND}).tree()); + } + _onResourceBindResultIQ(e2) { + if (e2.getAttribute("type") === "error") { + let t3; + return O.warn("Resource binding failed."), e2.getElementsByTagName("conflict").length > 0 && (t3 = O.ErrorCondition.CONFLICT), this._changeConnectStatus(O.Status.AUTHFAIL, t3, e2), false; + } + const t2 = e2.getElementsByTagName("bind"); + if (!(t2.length > 0)) + return O.warn("Resource binding failed."), this._changeConnectStatus(O.Status.AUTHFAIL, null, e2), false; + { + const e3 = t2[0].getElementsByTagName("jid"); + e3.length > 0 && (this.authenticated = true, this.jid = O.getText(e3[0]), this.do_session ? this._establishSession() : this._changeConnectStatus(O.Status.CONNECTED, null)); + } + } + _establishSession() { + if (!this.do_session) + throw new Error("Strophe.Connection.prototype._establishSession " + "called but apparently ".concat(O.NS.SESSION, " wasn't advertised by the server")); + this._addSysHandler(this._onSessionResultIQ.bind(this), null, null, null, "_session_auth_2"), this.send(j({type: "set", id: "_session_auth_2"}).c("session", {xmlns: O.NS.SESSION}).tree()); + } + _onSessionResultIQ(e2) { + if (e2.getAttribute("type") === "result") + this.authenticated = true, this._changeConnectStatus(O.Status.CONNECTED, null); + else if (e2.getAttribute("type") === "error") + return this.authenticated = false, O.warn("Session creation failed."), this._changeConnectStatus(O.Status.AUTHFAIL, null, e2), false; + return false; + } + _sasl_failure_cb(e2) { + return this._sasl_success_handler && (this.deleteHandler(this._sasl_success_handler), this._sasl_success_handler = null), this._sasl_challenge_handler && (this.deleteHandler(this._sasl_challenge_handler), this._sasl_challenge_handler = null), this._sasl_mechanism && this._sasl_mechanism.onFailure(), this._changeConnectStatus(O.Status.AUTHFAIL, null, e2), false; + } + _auth2_cb(e2) { + return e2.getAttribute("type") === "result" ? (this.authenticated = true, this._changeConnectStatus(O.Status.CONNECTED, null)) : e2.getAttribute("type") === "error" && (this._changeConnectStatus(O.Status.AUTHFAIL, null, e2), this.disconnect("authentication failed")), false; + } + _addSysTimedHandler(e2, t2) { + const n2 = new O.TimedHandler(e2, t2); + return n2.user = false, this.addTimeds.push(n2), n2; + } + _addSysHandler(e2, t2, n2, r2, i2) { + const o2 = new O.Handler(e2, t2, n2, r2, i2); + return o2.user = false, this.addHandlers.push(o2), o2; + } + _onDisconnectTimeout() { + return O.debug("_onDisconnectTimeout was called"), this._changeConnectStatus(O.Status.CONNTIMEOUT, null), this._proto._onDisconnectTimeout(), this._doDisconnect(), false; + } + _onIdle() { + for (; this.addTimeds.length > 0; ) + this.timedHandlers.push(this.addTimeds.pop()); + for (; this.removeTimeds.length > 0; ) { + const e3 = this.removeTimeds.pop(), t3 = this.timedHandlers.indexOf(e3); + t3 >= 0 && this.timedHandlers.splice(t3, 1); + } + const e2 = new Date().getTime(), t2 = []; + for (let n2 = 0; n2 < this.timedHandlers.length; n2++) { + const r2 = this.timedHandlers[n2]; + if (this.authenticated || !r2.user) { + r2.lastCalled + r2.period - e2 <= 0 ? r2.run() && t2.push(r2) : t2.push(r2); + } + } + this.timedHandlers = t2, clearTimeout(this._idleTimeout), this._proto._onIdle(), this.connected && (this._idleTimeout = setTimeout(() => this._onIdle(), 100)); + } + }, O.SASLMechanism = class { + constructor(e2, t2, n2) { + this.mechname = e2, this.isClientFirst = t2, this.priority = n2; + } + test() { + return true; + } + onStart(e2) { + this._connection = e2; + } + onChallenge(e2, t2) { + throw new Error("You should implement challenge handling!"); + } + onFailure() { + this._connection = null; + } + onSuccess() { + this._connection = null; + } + }, O.SASLAnonymous = class extends O.SASLMechanism { + constructor(e2 = "ANONYMOUS", t2 = false, n2 = 20) { + super(e2, t2, n2); + } + test(e2) { + return e2.authcid === null; + } + }, O.SASLPlain = class extends O.SASLMechanism { + constructor(e2 = "PLAIN", t2 = true, n2 = 50) { + super(e2, t2, n2); + } + test(e2) { + return e2.authcid !== null; + } + onChallenge(e2) { + const {authcid: t2, authzid: n2, domain: r2, pass: i2} = e2; + if (!r2) + throw new Error("SASLPlain onChallenge: domain is not defined!"); + let o2 = n2 !== "".concat(t2, "@").concat(r2) ? n2 : ""; + return o2 += "\0", o2 += t2, o2 += "\0", o2 += i2, x(o2); + } + }, O.SASLSHA1 = class extends O.SASLMechanism { + constructor(e2 = "SCRAM-SHA-1", t2 = true, n2 = 60) { + super(e2, t2, n2); + } + test(e2) { + return e2.authcid !== null; + } + onChallenge(e2, t2, n2) { + const r2 = n2 || h.hexdigest("" + 1234567890 * Math.random()); + let i2 = "n=" + x(e2.authcid); + return i2 += ",r=", i2 += r2, e2._sasl_data.cnonce = r2, e2._sasl_data["client-first-message-bare"] = i2, i2 = "n,," + i2, this.onChallenge = (e3, t3) => { + let n3, r3, i3, o2, s2, a2, c2, l2, u2 = "c=biws,", d2 = "".concat(e3._sasl_data["client-first-message-bare"], ",").concat(t3, ","); + const h2 = e3._sasl_data.cnonce, f2 = /([a-z]+)=([^,]+)(,|$)/; + for (; t3.match(f2); ) { + const e4 = t3.match(f2); + switch (t3 = t3.replace(e4[0], ""), e4[1]) { + case "r": + n3 = e4[2]; + break; + case "s": + r3 = e4[2]; + break; + case "i": + i3 = e4[2]; + } + } + if (n3.substr(0, h2.length) !== h2) + return e3._sasl_data = {}, e3._sasl_failure_cb(); + u2 += "r=" + n3, d2 += u2, r3 = Object(A.atob)(r3), r3 += "\0\0\0"; + const p2 = x(e3.pass); + for (o2 = a2 = S.core_hmac_sha1(p2, r3), c2 = 1; c2 < i3; c2++) { + for (s2 = S.core_hmac_sha1(p2, S.binb2str(a2)), l2 = 0; l2 < 5; l2++) + o2[l2] ^= s2[l2]; + a2 = s2; + } + o2 = S.binb2str(o2); + const g2 = S.core_hmac_sha1(o2, "Client Key"), m2 = S.str_hmac_sha1(o2, "Server Key"), v2 = S.core_hmac_sha1(S.str_sha1(S.binb2str(g2)), d2); + for (e3._sasl_data["server-signature"] = S.b64_hmac_sha1(m2, d2), l2 = 0; l2 < 5; l2++) + g2[l2] ^= v2[l2]; + return u2 += ",p=" + Object(A.btoa)(S.binb2str(g2)), u2; + }, i2; + } + }, O.SASLOAuthBearer = class extends O.SASLMechanism { + constructor(e2 = "OAUTHBEARER", t2 = true, n2 = 40) { + super(e2, t2, n2); + } + test(e2) { + return e2.pass !== null; + } + onChallenge(e2) { + let t2 = "n,"; + return e2.authcid !== null && (t2 = t2 + "a=" + e2.authzid), t2 += ",", t2 += "", t2 += "auth=Bearer ", t2 += e2.pass, t2 += "", t2 += "", x(t2); + } + }, O.SASLExternal = class extends O.SASLMechanism { + constructor(e2 = "EXTERNAL", t2 = true, n2 = 10) { + super(e2, t2, n2); + } + onChallenge(e2) { + return e2.authcid === e2.authzid ? "" : e2.authzid; + } + }, O.SASLXOAuth2 = class extends O.SASLMechanism { + constructor(e2 = "X-OAUTH2", t2 = true, n2 = 30) { + super(e2, t2, n2); + } + test(e2) { + return e2.pass !== null; + } + onChallenge(e2) { + let t2 = "\0"; + return e2.authcid !== null && (t2 += e2.authzid), t2 += "\0", t2 += e2.pass, x(t2); + } + }; + t.e = {Strophe: O, $build: C, $iq: j, $msg: function(e2) { + return new O.Builder("message", e2); + }, $pres: T, SHA1: S, MD5: h, b64_hmac_sha1: S.b64_hmac_sha1, b64_sha1: S.b64_sha1, str_hmac_sha1: S.str_hmac_sha1, str_sha1: S.str_sha1}; + }, function(e, t, n) { + var r; + /*! + * Sizzle CSS Selector Engine v2.3.5 + * https://sizzlejs.com/ + * + * Copyright JS Foundation and other contributors + * Released under the MIT license + * https://js.foundation/ + * + * Date: 2020-03-14 + */ + !function(i) { + var o, s, a, c, l, u, d, h, f, p, g, m, v, _, b, y, w, S, x, E = "sizzle" + 1 * new Date(), A = i.document, C = 0, j = 0, T = he(), O = he(), k = he(), N = he(), I = function(e2, t2) { + return e2 === t2 && (g = true), 0; + }, M = {}.hasOwnProperty, R = [], D = R.pop, P = R.push, L = R.push, z = R.slice, F = function(e2, t2) { + for (var n2 = 0, r2 = e2.length; n2 < r2; n2++) + if (e2[n2] === t2) + return n2; + return -1; + }, B = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", q = "[\\x20\\t\\r\\n\\f]", H = "(?:\\\\[\\da-fA-F]{1,6}" + q + "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", U = "\\[" + q + "*(" + H + ")(?:" + q + "*([*^$|!~]?=)" + q + `*(?:'((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)"|(` + H + "))|)" + q + "*\\]", $ = ":(" + H + `)(?:\\((('((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)")|((?:\\\\.|[^\\\\()[\\]]|` + U + ")*)|.*)\\)|)", W = new RegExp(q + "+", "g"), G = new RegExp("^" + q + "+|((?:^|[^\\\\])(?:\\\\.)*)" + q + "+$", "g"), V = new RegExp("^" + q + "*," + q + "*"), J = new RegExp("^" + q + "*([>+~]|" + q + ")" + q + "*"), X = new RegExp(q + "|>"), Q = new RegExp($), Y = new RegExp("^" + H + "$"), K = {ID: new RegExp("^#(" + H + ")"), CLASS: new RegExp("^\\.(" + H + ")"), TAG: new RegExp("^(" + H + "|[*])"), ATTR: new RegExp("^" + U), PSEUDO: new RegExp("^" + $), CHILD: new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + q + "*(even|odd|(([+-]|)(\\d*)n|)" + q + "*(?:([+-]|)" + q + "*(\\d+)|))" + q + "*\\)|)", "i"), bool: new RegExp("^(?:" + B + ")$", "i"), needsContext: new RegExp("^" + q + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + q + "*((?:-\\d)?\\d*)" + q + "*\\)|)(?=[^-]|$)", "i")}, Z = /HTML$/i, ee = /^(?:input|select|textarea|button)$/i, te = /^h\d$/i, ne = /^[^{]+\{\s*\[native \w/, re = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, ie = /[+~]/, oe = new RegExp("\\\\[\\da-fA-F]{1,6}" + q + "?|\\\\([^\\r\\n\\f])", "g"), se = function(e2, t2) { + var n2 = "0x" + e2.slice(1) - 65536; + return t2 || (n2 < 0 ? String.fromCharCode(n2 + 65536) : String.fromCharCode(n2 >> 10 | 55296, 1023 & n2 | 56320)); + }, ae = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, ce = function(e2, t2) { + return t2 ? e2 === "\0" ? "\uFFFD" : e2.slice(0, -1) + "\\" + e2.charCodeAt(e2.length - 1).toString(16) + " " : "\\" + e2; + }, le = function() { + m(); + }, ue = Ee(function(e2) { + return e2.disabled === true && e2.nodeName.toLowerCase() === "fieldset"; + }, {dir: "parentNode", next: "legend"}); + try { + L.apply(R = z.call(A.childNodes), A.childNodes), R[A.childNodes.length].nodeType; + } catch (e2) { + L = {apply: R.length ? function(e3, t2) { + P.apply(e3, z.call(t2)); + } : function(e3, t2) { + for (var n2 = e3.length, r2 = 0; e3[n2++] = t2[r2++]; ) + ; + e3.length = n2 - 1; + }}; + } + function de(e2, t2, n2, r2) { + var i2, o2, a2, c2, l2, d2, f2, p2 = t2 && t2.ownerDocument, g2 = t2 ? t2.nodeType : 9; + if (n2 = n2 || [], typeof e2 != "string" || !e2 || g2 !== 1 && g2 !== 9 && g2 !== 11) + return n2; + if (!r2 && (m(t2), t2 = t2 || v, b)) { + if (g2 !== 11 && (l2 = re.exec(e2))) + if (i2 = l2[1]) { + if (g2 === 9) { + if (!(a2 = t2.getElementById(i2))) + return n2; + if (a2.id === i2) + return n2.push(a2), n2; + } else if (p2 && (a2 = p2.getElementById(i2)) && x(t2, a2) && a2.id === i2) + return n2.push(a2), n2; + } else { + if (l2[2]) + return L.apply(n2, t2.getElementsByTagName(e2)), n2; + if ((i2 = l2[3]) && s.getElementsByClassName && t2.getElementsByClassName) + return L.apply(n2, t2.getElementsByClassName(i2)), n2; + } + if (s.qsa && !N[e2 + " "] && (!y || !y.test(e2)) && (g2 !== 1 || t2.nodeName.toLowerCase() !== "object")) { + if (f2 = e2, p2 = t2, g2 === 1 && (X.test(e2) || J.test(e2))) { + for ((p2 = ie.test(e2) && we(t2.parentNode) || t2) === t2 && s.scope || ((c2 = t2.getAttribute("id")) ? c2 = c2.replace(ae, ce) : t2.setAttribute("id", c2 = E)), o2 = (d2 = u(e2)).length; o2--; ) + d2[o2] = (c2 ? "#" + c2 : ":scope") + " " + xe(d2[o2]); + f2 = d2.join(","); + } + try { + return L.apply(n2, p2.querySelectorAll(f2)), n2; + } catch (t3) { + N(e2, true); + } finally { + c2 === E && t2.removeAttribute("id"); + } + } + } + return h(e2.replace(G, "$1"), t2, n2, r2); + } + function he() { + var e2 = []; + return function t2(n2, r2) { + return e2.push(n2 + " ") > a.cacheLength && delete t2[e2.shift()], t2[n2 + " "] = r2; + }; + } + function fe(e2) { + return e2[E] = true, e2; + } + function pe(e2) { + var t2 = v.createElement("fieldset"); + try { + return !!e2(t2); + } catch (e3) { + return false; + } finally { + t2.parentNode && t2.parentNode.removeChild(t2), t2 = null; + } + } + function ge(e2, t2) { + for (var n2 = e2.split("|"), r2 = n2.length; r2--; ) + a.attrHandle[n2[r2]] = t2; + } + function me(e2, t2) { + var n2 = t2 && e2, r2 = n2 && e2.nodeType === 1 && t2.nodeType === 1 && e2.sourceIndex - t2.sourceIndex; + if (r2) + return r2; + if (n2) { + for (; n2 = n2.nextSibling; ) + if (n2 === t2) + return -1; + } + return e2 ? 1 : -1; + } + function ve(e2) { + return function(t2) { + return t2.nodeName.toLowerCase() === "input" && t2.type === e2; + }; + } + function _e(e2) { + return function(t2) { + var n2 = t2.nodeName.toLowerCase(); + return (n2 === "input" || n2 === "button") && t2.type === e2; + }; + } + function be(e2) { + return function(t2) { + return "form" in t2 ? t2.parentNode && t2.disabled === false ? "label" in t2 ? "label" in t2.parentNode ? t2.parentNode.disabled === e2 : t2.disabled === e2 : t2.isDisabled === e2 || t2.isDisabled !== !e2 && ue(t2) === e2 : t2.disabled === e2 : "label" in t2 && t2.disabled === e2; + }; + } + function ye(e2) { + return fe(function(t2) { + return t2 = +t2, fe(function(n2, r2) { + for (var i2, o2 = e2([], n2.length, t2), s2 = o2.length; s2--; ) + n2[i2 = o2[s2]] && (n2[i2] = !(r2[i2] = n2[i2])); + }); + }); + } + function we(e2) { + return e2 && e2.getElementsByTagName !== void 0 && e2; + } + for (o in s = de.support = {}, l = de.isXML = function(e2) { + var t2 = e2.namespaceURI, n2 = (e2.ownerDocument || e2).documentElement; + return !Z.test(t2 || n2 && n2.nodeName || "HTML"); + }, m = de.setDocument = function(e2) { + var t2, n2, r2 = e2 ? e2.ownerDocument || e2 : A; + return r2 != v && r2.nodeType === 9 && r2.documentElement ? (_ = (v = r2).documentElement, b = !l(v), A != v && (n2 = v.defaultView) && n2.top !== n2 && (n2.addEventListener ? n2.addEventListener("unload", le, false) : n2.attachEvent && n2.attachEvent("onunload", le)), s.scope = pe(function(e3) { + return _.appendChild(e3).appendChild(v.createElement("div")), e3.querySelectorAll !== void 0 && !e3.querySelectorAll(":scope fieldset div").length; + }), s.attributes = pe(function(e3) { + return e3.className = "i", !e3.getAttribute("className"); + }), s.getElementsByTagName = pe(function(e3) { + return e3.appendChild(v.createComment("")), !e3.getElementsByTagName("*").length; + }), s.getElementsByClassName = ne.test(v.getElementsByClassName), s.getById = pe(function(e3) { + return _.appendChild(e3).id = E, !v.getElementsByName || !v.getElementsByName(E).length; + }), s.getById ? (a.filter.ID = function(e3) { + var t3 = e3.replace(oe, se); + return function(e4) { + return e4.getAttribute("id") === t3; + }; + }, a.find.ID = function(e3, t3) { + if (t3.getElementById !== void 0 && b) { + var n3 = t3.getElementById(e3); + return n3 ? [n3] : []; + } + }) : (a.filter.ID = function(e3) { + var t3 = e3.replace(oe, se); + return function(e4) { + var n3 = e4.getAttributeNode !== void 0 && e4.getAttributeNode("id"); + return n3 && n3.value === t3; + }; + }, a.find.ID = function(e3, t3) { + if (t3.getElementById !== void 0 && b) { + var n3, r3, i2, o2 = t3.getElementById(e3); + if (o2) { + if ((n3 = o2.getAttributeNode("id")) && n3.value === e3) + return [o2]; + for (i2 = t3.getElementsByName(e3), r3 = 0; o2 = i2[r3++]; ) + if ((n3 = o2.getAttributeNode("id")) && n3.value === e3) + return [o2]; + } + return []; + } + }), a.find.TAG = s.getElementsByTagName ? function(e3, t3) { + return t3.getElementsByTagName !== void 0 ? t3.getElementsByTagName(e3) : s.qsa ? t3.querySelectorAll(e3) : void 0; + } : function(e3, t3) { + var n3, r3 = [], i2 = 0, o2 = t3.getElementsByTagName(e3); + if (e3 === "*") { + for (; n3 = o2[i2++]; ) + n3.nodeType === 1 && r3.push(n3); + return r3; + } + return o2; + }, a.find.CLASS = s.getElementsByClassName && function(e3, t3) { + if (t3.getElementsByClassName !== void 0 && b) + return t3.getElementsByClassName(e3); + }, w = [], y = [], (s.qsa = ne.test(v.querySelectorAll)) && (pe(function(e3) { + var t3; + _.appendChild(e3).innerHTML = "<a id='" + E + "'></a><select id='" + E + "-\r\\' msallowcapture=''><option selected=''></option></select>", e3.querySelectorAll("[msallowcapture^='']").length && y.push("[*^$]=" + q + `*(?:''|"")`), e3.querySelectorAll("[selected]").length || y.push("\\[" + q + "*(?:value|" + B + ")"), e3.querySelectorAll("[id~=" + E + "-]").length || y.push("~="), (t3 = v.createElement("input")).setAttribute("name", ""), e3.appendChild(t3), e3.querySelectorAll("[name='']").length || y.push("\\[" + q + "*name" + q + "*=" + q + `*(?:''|"")`), e3.querySelectorAll(":checked").length || y.push(":checked"), e3.querySelectorAll("a#" + E + "+*").length || y.push(".#.+[+~]"), e3.querySelectorAll("\\\f"), y.push("[\\r\\n\\f]"); + }), pe(function(e3) { + e3.innerHTML = "<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>"; + var t3 = v.createElement("input"); + t3.setAttribute("type", "hidden"), e3.appendChild(t3).setAttribute("name", "D"), e3.querySelectorAll("[name=d]").length && y.push("name" + q + "*[*^$|!~]?="), e3.querySelectorAll(":enabled").length !== 2 && y.push(":enabled", ":disabled"), _.appendChild(e3).disabled = true, e3.querySelectorAll(":disabled").length !== 2 && y.push(":enabled", ":disabled"), e3.querySelectorAll("*,:x"), y.push(",.*:"); + })), (s.matchesSelector = ne.test(S = _.matches || _.webkitMatchesSelector || _.mozMatchesSelector || _.oMatchesSelector || _.msMatchesSelector)) && pe(function(e3) { + s.disconnectedMatch = S.call(e3, "*"), S.call(e3, "[s!='']:x"), w.push("!=", $); + }), y = y.length && new RegExp(y.join("|")), w = w.length && new RegExp(w.join("|")), t2 = ne.test(_.compareDocumentPosition), x = t2 || ne.test(_.contains) ? function(e3, t3) { + var n3 = e3.nodeType === 9 ? e3.documentElement : e3, r3 = t3 && t3.parentNode; + return e3 === r3 || !(!r3 || r3.nodeType !== 1 || !(n3.contains ? n3.contains(r3) : e3.compareDocumentPosition && 16 & e3.compareDocumentPosition(r3))); + } : function(e3, t3) { + if (t3) { + for (; t3 = t3.parentNode; ) + if (t3 === e3) + return true; + } + return false; + }, I = t2 ? function(e3, t3) { + if (e3 === t3) + return g = true, 0; + var n3 = !e3.compareDocumentPosition - !t3.compareDocumentPosition; + return n3 || (1 & (n3 = (e3.ownerDocument || e3) == (t3.ownerDocument || t3) ? e3.compareDocumentPosition(t3) : 1) || !s.sortDetached && t3.compareDocumentPosition(e3) === n3 ? e3 == v || e3.ownerDocument == A && x(A, e3) ? -1 : t3 == v || t3.ownerDocument == A && x(A, t3) ? 1 : p ? F(p, e3) - F(p, t3) : 0 : 4 & n3 ? -1 : 1); + } : function(e3, t3) { + if (e3 === t3) + return g = true, 0; + var n3, r3 = 0, i2 = e3.parentNode, o2 = t3.parentNode, s2 = [e3], a2 = [t3]; + if (!i2 || !o2) + return e3 == v ? -1 : t3 == v ? 1 : i2 ? -1 : o2 ? 1 : p ? F(p, e3) - F(p, t3) : 0; + if (i2 === o2) + return me(e3, t3); + for (n3 = e3; n3 = n3.parentNode; ) + s2.unshift(n3); + for (n3 = t3; n3 = n3.parentNode; ) + a2.unshift(n3); + for (; s2[r3] === a2[r3]; ) + r3++; + return r3 ? me(s2[r3], a2[r3]) : s2[r3] == A ? -1 : a2[r3] == A ? 1 : 0; + }, v) : v; + }, de.matches = function(e2, t2) { + return de(e2, null, null, t2); + }, de.matchesSelector = function(e2, t2) { + if (m(e2), s.matchesSelector && b && !N[t2 + " "] && (!w || !w.test(t2)) && (!y || !y.test(t2))) + try { + var n2 = S.call(e2, t2); + if (n2 || s.disconnectedMatch || e2.document && e2.document.nodeType !== 11) + return n2; + } catch (e3) { + N(t2, true); + } + return de(t2, v, null, [e2]).length > 0; + }, de.contains = function(e2, t2) { + return (e2.ownerDocument || e2) != v && m(e2), x(e2, t2); + }, de.attr = function(e2, t2) { + (e2.ownerDocument || e2) != v && m(e2); + var n2 = a.attrHandle[t2.toLowerCase()], r2 = n2 && M.call(a.attrHandle, t2.toLowerCase()) ? n2(e2, t2, !b) : void 0; + return r2 !== void 0 ? r2 : s.attributes || !b ? e2.getAttribute(t2) : (r2 = e2.getAttributeNode(t2)) && r2.specified ? r2.value : null; + }, de.escape = function(e2) { + return (e2 + "").replace(ae, ce); + }, de.error = function(e2) { + throw new Error("Syntax error, unrecognized expression: " + e2); + }, de.uniqueSort = function(e2) { + var t2, n2 = [], r2 = 0, i2 = 0; + if (g = !s.detectDuplicates, p = !s.sortStable && e2.slice(0), e2.sort(I), g) { + for (; t2 = e2[i2++]; ) + t2 === e2[i2] && (r2 = n2.push(i2)); + for (; r2--; ) + e2.splice(n2[r2], 1); + } + return p = null, e2; + }, c = de.getText = function(e2) { + var t2, n2 = "", r2 = 0, i2 = e2.nodeType; + if (i2) { + if (i2 === 1 || i2 === 9 || i2 === 11) { + if (typeof e2.textContent == "string") + return e2.textContent; + for (e2 = e2.firstChild; e2; e2 = e2.nextSibling) + n2 += c(e2); + } else if (i2 === 3 || i2 === 4) + return e2.nodeValue; + } else + for (; t2 = e2[r2++]; ) + n2 += c(t2); + return n2; + }, (a = de.selectors = {cacheLength: 50, createPseudo: fe, match: K, attrHandle: {}, find: {}, relative: {">": {dir: "parentNode", first: true}, " ": {dir: "parentNode"}, "+": {dir: "previousSibling", first: true}, "~": {dir: "previousSibling"}}, preFilter: {ATTR: function(e2) { + return e2[1] = e2[1].replace(oe, se), e2[3] = (e2[3] || e2[4] || e2[5] || "").replace(oe, se), e2[2] === "~=" && (e2[3] = " " + e2[3] + " "), e2.slice(0, 4); + }, CHILD: function(e2) { + return e2[1] = e2[1].toLowerCase(), e2[1].slice(0, 3) === "nth" ? (e2[3] || de.error(e2[0]), e2[4] = +(e2[4] ? e2[5] + (e2[6] || 1) : 2 * (e2[3] === "even" || e2[3] === "odd")), e2[5] = +(e2[7] + e2[8] || e2[3] === "odd")) : e2[3] && de.error(e2[0]), e2; + }, PSEUDO: function(e2) { + var t2, n2 = !e2[6] && e2[2]; + return K.CHILD.test(e2[0]) ? null : (e2[3] ? e2[2] = e2[4] || e2[5] || "" : n2 && Q.test(n2) && (t2 = u(n2, true)) && (t2 = n2.indexOf(")", n2.length - t2) - n2.length) && (e2[0] = e2[0].slice(0, t2), e2[2] = n2.slice(0, t2)), e2.slice(0, 3)); + }}, filter: {TAG: function(e2) { + var t2 = e2.replace(oe, se).toLowerCase(); + return e2 === "*" ? function() { + return true; + } : function(e3) { + return e3.nodeName && e3.nodeName.toLowerCase() === t2; + }; + }, CLASS: function(e2) { + var t2 = T[e2 + " "]; + return t2 || (t2 = new RegExp("(^|" + q + ")" + e2 + "(" + q + "|$)")) && T(e2, function(e3) { + return t2.test(typeof e3.className == "string" && e3.className || e3.getAttribute !== void 0 && e3.getAttribute("class") || ""); + }); + }, ATTR: function(e2, t2, n2) { + return function(r2) { + var i2 = de.attr(r2, e2); + return i2 == null ? t2 === "!=" : !t2 || (i2 += "", t2 === "=" ? i2 === n2 : t2 === "!=" ? i2 !== n2 : t2 === "^=" ? n2 && i2.indexOf(n2) === 0 : t2 === "*=" ? n2 && i2.indexOf(n2) > -1 : t2 === "$=" ? n2 && i2.slice(-n2.length) === n2 : t2 === "~=" ? (" " + i2.replace(W, " ") + " ").indexOf(n2) > -1 : t2 === "|=" && (i2 === n2 || i2.slice(0, n2.length + 1) === n2 + "-")); + }; + }, CHILD: function(e2, t2, n2, r2, i2) { + var o2 = e2.slice(0, 3) !== "nth", s2 = e2.slice(-4) !== "last", a2 = t2 === "of-type"; + return r2 === 1 && i2 === 0 ? function(e3) { + return !!e3.parentNode; + } : function(t3, n3, c2) { + var l2, u2, d2, h2, f2, p2, g2 = o2 !== s2 ? "nextSibling" : "previousSibling", m2 = t3.parentNode, v2 = a2 && t3.nodeName.toLowerCase(), _2 = !c2 && !a2, b2 = false; + if (m2) { + if (o2) { + for (; g2; ) { + for (h2 = t3; h2 = h2[g2]; ) + if (a2 ? h2.nodeName.toLowerCase() === v2 : h2.nodeType === 1) + return false; + p2 = g2 = e2 === "only" && !p2 && "nextSibling"; + } + return true; + } + if (p2 = [s2 ? m2.firstChild : m2.lastChild], s2 && _2) { + for (b2 = (f2 = (l2 = (u2 = (d2 = (h2 = m2)[E] || (h2[E] = {}))[h2.uniqueID] || (d2[h2.uniqueID] = {}))[e2] || [])[0] === C && l2[1]) && l2[2], h2 = f2 && m2.childNodes[f2]; h2 = ++f2 && h2 && h2[g2] || (b2 = f2 = 0) || p2.pop(); ) + if (h2.nodeType === 1 && ++b2 && h2 === t3) { + u2[e2] = [C, f2, b2]; + break; + } + } else if (_2 && (b2 = f2 = (l2 = (u2 = (d2 = (h2 = t3)[E] || (h2[E] = {}))[h2.uniqueID] || (d2[h2.uniqueID] = {}))[e2] || [])[0] === C && l2[1]), b2 === false) + for (; (h2 = ++f2 && h2 && h2[g2] || (b2 = f2 = 0) || p2.pop()) && ((a2 ? h2.nodeName.toLowerCase() !== v2 : h2.nodeType !== 1) || !++b2 || (_2 && ((u2 = (d2 = h2[E] || (h2[E] = {}))[h2.uniqueID] || (d2[h2.uniqueID] = {}))[e2] = [C, b2]), h2 !== t3)); ) + ; + return (b2 -= i2) === r2 || b2 % r2 == 0 && b2 / r2 >= 0; + } + }; + }, PSEUDO: function(e2, t2) { + var n2, r2 = a.pseudos[e2] || a.setFilters[e2.toLowerCase()] || de.error("unsupported pseudo: " + e2); + return r2[E] ? r2(t2) : r2.length > 1 ? (n2 = [e2, e2, "", t2], a.setFilters.hasOwnProperty(e2.toLowerCase()) ? fe(function(e3, n3) { + for (var i2, o2 = r2(e3, t2), s2 = o2.length; s2--; ) + e3[i2 = F(e3, o2[s2])] = !(n3[i2] = o2[s2]); + }) : function(e3) { + return r2(e3, 0, n2); + }) : r2; + }}, pseudos: {not: fe(function(e2) { + var t2 = [], n2 = [], r2 = d(e2.replace(G, "$1")); + return r2[E] ? fe(function(e3, t3, n3, i2) { + for (var o2, s2 = r2(e3, null, i2, []), a2 = e3.length; a2--; ) + (o2 = s2[a2]) && (e3[a2] = !(t3[a2] = o2)); + }) : function(e3, i2, o2) { + return t2[0] = e3, r2(t2, null, o2, n2), t2[0] = null, !n2.pop(); + }; + }), has: fe(function(e2) { + return function(t2) { + return de(e2, t2).length > 0; + }; + }), contains: fe(function(e2) { + return e2 = e2.replace(oe, se), function(t2) { + return (t2.textContent || c(t2)).indexOf(e2) > -1; + }; + }), lang: fe(function(e2) { + return Y.test(e2 || "") || de.error("unsupported lang: " + e2), e2 = e2.replace(oe, se).toLowerCase(), function(t2) { + var n2; + do { + if (n2 = b ? t2.lang : t2.getAttribute("xml:lang") || t2.getAttribute("lang")) + return (n2 = n2.toLowerCase()) === e2 || n2.indexOf(e2 + "-") === 0; + } while ((t2 = t2.parentNode) && t2.nodeType === 1); + return false; + }; + }), target: function(e2) { + var t2 = i.location && i.location.hash; + return t2 && t2.slice(1) === e2.id; + }, root: function(e2) { + return e2 === _; + }, focus: function(e2) { + return e2 === v.activeElement && (!v.hasFocus || v.hasFocus()) && !!(e2.type || e2.href || ~e2.tabIndex); + }, enabled: be(false), disabled: be(true), checked: function(e2) { + var t2 = e2.nodeName.toLowerCase(); + return t2 === "input" && !!e2.checked || t2 === "option" && !!e2.selected; + }, selected: function(e2) { + return e2.parentNode && e2.parentNode.selectedIndex, e2.selected === true; + }, empty: function(e2) { + for (e2 = e2.firstChild; e2; e2 = e2.nextSibling) + if (e2.nodeType < 6) + return false; + return true; + }, parent: function(e2) { + return !a.pseudos.empty(e2); + }, header: function(e2) { + return te.test(e2.nodeName); + }, input: function(e2) { + return ee.test(e2.nodeName); + }, button: function(e2) { + var t2 = e2.nodeName.toLowerCase(); + return t2 === "input" && e2.type === "button" || t2 === "button"; + }, text: function(e2) { + var t2; + return e2.nodeName.toLowerCase() === "input" && e2.type === "text" && ((t2 = e2.getAttribute("type")) == null || t2.toLowerCase() === "text"); + }, first: ye(function() { + return [0]; + }), last: ye(function(e2, t2) { + return [t2 - 1]; + }), eq: ye(function(e2, t2, n2) { + return [n2 < 0 ? n2 + t2 : n2]; + }), even: ye(function(e2, t2) { + for (var n2 = 0; n2 < t2; n2 += 2) + e2.push(n2); + return e2; + }), odd: ye(function(e2, t2) { + for (var n2 = 1; n2 < t2; n2 += 2) + e2.push(n2); + return e2; + }), lt: ye(function(e2, t2, n2) { + for (var r2 = n2 < 0 ? n2 + t2 : n2 > t2 ? t2 : n2; --r2 >= 0; ) + e2.push(r2); + return e2; + }), gt: ye(function(e2, t2, n2) { + for (var r2 = n2 < 0 ? n2 + t2 : n2; ++r2 < t2; ) + e2.push(r2); + return e2; + })}}).pseudos.nth = a.pseudos.eq, {radio: true, checkbox: true, file: true, password: true, image: true}) + a.pseudos[o] = ve(o); + for (o in {submit: true, reset: true}) + a.pseudos[o] = _e(o); + function Se() { + } + function xe(e2) { + for (var t2 = 0, n2 = e2.length, r2 = ""; t2 < n2; t2++) + r2 += e2[t2].value; + return r2; + } + function Ee(e2, t2, n2) { + var r2 = t2.dir, i2 = t2.next, o2 = i2 || r2, s2 = n2 && o2 === "parentNode", a2 = j++; + return t2.first ? function(t3, n3, i3) { + for (; t3 = t3[r2]; ) + if (t3.nodeType === 1 || s2) + return e2(t3, n3, i3); + return false; + } : function(t3, n3, c2) { + var l2, u2, d2, h2 = [C, a2]; + if (c2) { + for (; t3 = t3[r2]; ) + if ((t3.nodeType === 1 || s2) && e2(t3, n3, c2)) + return true; + } else + for (; t3 = t3[r2]; ) + if (t3.nodeType === 1 || s2) + if (u2 = (d2 = t3[E] || (t3[E] = {}))[t3.uniqueID] || (d2[t3.uniqueID] = {}), i2 && i2 === t3.nodeName.toLowerCase()) + t3 = t3[r2] || t3; + else { + if ((l2 = u2[o2]) && l2[0] === C && l2[1] === a2) + return h2[2] = l2[2]; + if (u2[o2] = h2, h2[2] = e2(t3, n3, c2)) + return true; + } + return false; + }; + } + function Ae(e2) { + return e2.length > 1 ? function(t2, n2, r2) { + for (var i2 = e2.length; i2--; ) + if (!e2[i2](t2, n2, r2)) + return false; + return true; + } : e2[0]; + } + function Ce(e2, t2, n2, r2, i2) { + for (var o2, s2 = [], a2 = 0, c2 = e2.length, l2 = t2 != null; a2 < c2; a2++) + (o2 = e2[a2]) && (n2 && !n2(o2, r2, i2) || (s2.push(o2), l2 && t2.push(a2))); + return s2; + } + function je(e2, t2, n2, r2, i2, o2) { + return r2 && !r2[E] && (r2 = je(r2)), i2 && !i2[E] && (i2 = je(i2, o2)), fe(function(o3, s2, a2, c2) { + var l2, u2, d2, h2 = [], f2 = [], p2 = s2.length, g2 = o3 || function(e3, t3, n3) { + for (var r3 = 0, i3 = t3.length; r3 < i3; r3++) + de(e3, t3[r3], n3); + return n3; + }(t2 || "*", a2.nodeType ? [a2] : a2, []), m2 = !e2 || !o3 && t2 ? g2 : Ce(g2, h2, e2, a2, c2), v2 = n2 ? i2 || (o3 ? e2 : p2 || r2) ? [] : s2 : m2; + if (n2 && n2(m2, v2, a2, c2), r2) + for (l2 = Ce(v2, f2), r2(l2, [], a2, c2), u2 = l2.length; u2--; ) + (d2 = l2[u2]) && (v2[f2[u2]] = !(m2[f2[u2]] = d2)); + if (o3) { + if (i2 || e2) { + if (i2) { + for (l2 = [], u2 = v2.length; u2--; ) + (d2 = v2[u2]) && l2.push(m2[u2] = d2); + i2(null, v2 = [], l2, c2); + } + for (u2 = v2.length; u2--; ) + (d2 = v2[u2]) && (l2 = i2 ? F(o3, d2) : h2[u2]) > -1 && (o3[l2] = !(s2[l2] = d2)); + } + } else + v2 = Ce(v2 === s2 ? v2.splice(p2, v2.length) : v2), i2 ? i2(null, s2, v2, c2) : L.apply(s2, v2); + }); + } + function Te(e2) { + for (var t2, n2, r2, i2 = e2.length, o2 = a.relative[e2[0].type], s2 = o2 || a.relative[" "], c2 = o2 ? 1 : 0, l2 = Ee(function(e3) { + return e3 === t2; + }, s2, true), u2 = Ee(function(e3) { + return F(t2, e3) > -1; + }, s2, true), d2 = [function(e3, n3, r3) { + var i3 = !o2 && (r3 || n3 !== f) || ((t2 = n3).nodeType ? l2(e3, n3, r3) : u2(e3, n3, r3)); + return t2 = null, i3; + }]; c2 < i2; c2++) + if (n2 = a.relative[e2[c2].type]) + d2 = [Ee(Ae(d2), n2)]; + else { + if ((n2 = a.filter[e2[c2].type].apply(null, e2[c2].matches))[E]) { + for (r2 = ++c2; r2 < i2 && !a.relative[e2[r2].type]; r2++) + ; + return je(c2 > 1 && Ae(d2), c2 > 1 && xe(e2.slice(0, c2 - 1).concat({value: e2[c2 - 2].type === " " ? "*" : ""})).replace(G, "$1"), n2, c2 < r2 && Te(e2.slice(c2, r2)), r2 < i2 && Te(e2 = e2.slice(r2)), r2 < i2 && xe(e2)); + } + d2.push(n2); + } + return Ae(d2); + } + Se.prototype = a.filters = a.pseudos, a.setFilters = new Se(), u = de.tokenize = function(e2, t2) { + var n2, r2, i2, o2, s2, c2, l2, u2 = O[e2 + " "]; + if (u2) + return t2 ? 0 : u2.slice(0); + for (s2 = e2, c2 = [], l2 = a.preFilter; s2; ) { + for (o2 in n2 && !(r2 = V.exec(s2)) || (r2 && (s2 = s2.slice(r2[0].length) || s2), c2.push(i2 = [])), n2 = false, (r2 = J.exec(s2)) && (n2 = r2.shift(), i2.push({value: n2, type: r2[0].replace(G, " ")}), s2 = s2.slice(n2.length)), a.filter) + !(r2 = K[o2].exec(s2)) || l2[o2] && !(r2 = l2[o2](r2)) || (n2 = r2.shift(), i2.push({value: n2, type: o2, matches: r2}), s2 = s2.slice(n2.length)); + if (!n2) + break; + } + return t2 ? s2.length : s2 ? de.error(e2) : O(e2, c2).slice(0); + }, d = de.compile = function(e2, t2) { + var n2, r2 = [], i2 = [], o2 = k[e2 + " "]; + if (!o2) { + for (t2 || (t2 = u(e2)), n2 = t2.length; n2--; ) + (o2 = Te(t2[n2]))[E] ? r2.push(o2) : i2.push(o2); + (o2 = k(e2, function(e3, t3) { + var n3 = t3.length > 0, r3 = e3.length > 0, i3 = function(i4, o3, s2, c2, l2) { + var u2, d2, h2, p2 = 0, g2 = "0", _2 = i4 && [], y2 = [], w2 = f, S2 = i4 || r3 && a.find.TAG("*", l2), x2 = C += w2 == null ? 1 : Math.random() || 0.1, E2 = S2.length; + for (l2 && (f = o3 == v || o3 || l2); g2 !== E2 && (u2 = S2[g2]) != null; g2++) { + if (r3 && u2) { + for (d2 = 0, o3 || u2.ownerDocument == v || (m(u2), s2 = !b); h2 = e3[d2++]; ) + if (h2(u2, o3 || v, s2)) { + c2.push(u2); + break; + } + l2 && (C = x2); + } + n3 && ((u2 = !h2 && u2) && p2--, i4 && _2.push(u2)); + } + if (p2 += g2, n3 && g2 !== p2) { + for (d2 = 0; h2 = t3[d2++]; ) + h2(_2, y2, o3, s2); + if (i4) { + if (p2 > 0) + for (; g2--; ) + _2[g2] || y2[g2] || (y2[g2] = D.call(c2)); + y2 = Ce(y2); + } + L.apply(c2, y2), l2 && !i4 && y2.length > 0 && p2 + t3.length > 1 && de.uniqueSort(c2); + } + return l2 && (C = x2, f = w2), _2; + }; + return n3 ? fe(i3) : i3; + }(i2, r2))).selector = e2; + } + return o2; + }, h = de.select = function(e2, t2, n2, r2) { + var i2, o2, s2, c2, l2, h2 = typeof e2 == "function" && e2, f2 = !r2 && u(e2 = h2.selector || e2); + if (n2 = n2 || [], f2.length === 1) { + if ((o2 = f2[0] = f2[0].slice(0)).length > 2 && (s2 = o2[0]).type === "ID" && t2.nodeType === 9 && b && a.relative[o2[1].type]) { + if (!(t2 = (a.find.ID(s2.matches[0].replace(oe, se), t2) || [])[0])) + return n2; + h2 && (t2 = t2.parentNode), e2 = e2.slice(o2.shift().value.length); + } + for (i2 = K.needsContext.test(e2) ? 0 : o2.length; i2-- && (s2 = o2[i2], !a.relative[c2 = s2.type]); ) + if ((l2 = a.find[c2]) && (r2 = l2(s2.matches[0].replace(oe, se), ie.test(o2[0].type) && we(t2.parentNode) || t2))) { + if (o2.splice(i2, 1), !(e2 = r2.length && xe(o2))) + return L.apply(n2, r2), n2; + break; + } + } + return (h2 || d(e2, f2))(r2, t2, !b, n2, !t2 || ie.test(e2) && we(t2.parentNode) || t2), n2; + }, s.sortStable = E.split("").sort(I).join("") === E, s.detectDuplicates = !!g, m(), s.sortDetached = pe(function(e2) { + return 1 & e2.compareDocumentPosition(v.createElement("fieldset")); + }), pe(function(e2) { + return e2.innerHTML = "<a href='#'></a>", e2.firstChild.getAttribute("href") === "#"; + }) || ge("type|href|height|width", function(e2, t2, n2) { + if (!n2) + return e2.getAttribute(t2, t2.toLowerCase() === "type" ? 1 : 2); + }), s.attributes && pe(function(e2) { + return e2.innerHTML = "<input/>", e2.firstChild.setAttribute("value", ""), e2.firstChild.getAttribute("value") === ""; + }) || ge("value", function(e2, t2, n2) { + if (!n2 && e2.nodeName.toLowerCase() === "input") + return e2.defaultValue; + }), pe(function(e2) { + return e2.getAttribute("disabled") == null; + }) || ge(B, function(e2, t2, n2) { + var r2; + if (!n2) + return e2[t2] === true ? t2.toLowerCase() : (r2 = e2.getAttributeNode(t2)) && r2.specified ? r2.value : null; + }); + var Oe = i.Sizzle; + de.noConflict = function() { + return i.Sizzle === de && (i.Sizzle = Oe), de; + }, (r = function() { + return de; + }.call(t, n, t, e)) === void 0 || (e.exports = r); + }(window); + }, , function(e, t, n) { + e.exports = function() { + var e2 = "millisecond", t2 = "second", n2 = "minute", r = "hour", i = "day", o = "week", s = "month", a = "quarter", c = "year", l = /^(\d{4})-?(\d{1,2})-?(\d{0,2})[^0-9]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?.?(\d{1,3})?$/, u = /\[([^\]]+)]|Y{2,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, d = function(e3, t3, n3) { + var r2 = String(e3); + return !r2 || r2.length >= t3 ? e3 : "" + Array(t3 + 1 - r2.length).join(n3) + e3; + }, h = {s: d, z: function(e3) { + var t3 = -e3.utcOffset(), n3 = Math.abs(t3), r2 = Math.floor(n3 / 60), i2 = n3 % 60; + return (t3 <= 0 ? "+" : "-") + d(r2, 2, "0") + ":" + d(i2, 2, "0"); + }, m: function(e3, t3) { + var n3 = 12 * (t3.year() - e3.year()) + (t3.month() - e3.month()), r2 = e3.clone().add(n3, s), i2 = t3 - r2 < 0, o2 = e3.clone().add(n3 + (i2 ? -1 : 1), s); + return Number(-(n3 + (t3 - r2) / (i2 ? r2 - o2 : o2 - r2)) || 0); + }, a: function(e3) { + return e3 < 0 ? Math.ceil(e3) || 0 : Math.floor(e3); + }, p: function(l2) { + return {M: s, y: c, w: o, d: i, D: "date", h: r, m: n2, s: t2, ms: e2, Q: a}[l2] || String(l2 || "").toLowerCase().replace(/s$/, ""); + }, u: function(e3) { + return e3 === void 0; + }}, f = {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("_")}, p = "en", g = {}; + g[p] = f; + var m = function(e3) { + return e3 instanceof y; + }, v = function(e3, t3, n3) { + var r2; + if (!e3) + return p; + if (typeof e3 == "string") + g[e3] && (r2 = e3), t3 && (g[e3] = t3, r2 = e3); + else { + var i2 = e3.name; + g[i2] = e3, r2 = i2; + } + return !n3 && r2 && (p = r2), r2 || !n3 && p; + }, _ = function(e3, t3) { + if (m(e3)) + return e3.clone(); + var n3 = typeof t3 == "object" ? t3 : {}; + return n3.date = e3, n3.args = arguments, new y(n3); + }, b = h; + b.l = v, b.i = m, b.w = function(e3, t3) { + return _(e3, {locale: t3.$L, utc: t3.$u, $offset: t3.$offset}); + }; + var y = function() { + function d2(e3) { + this.$L = this.$L || v(e3.locale, null, true), this.parse(e3); + } + var h2 = d2.prototype; + return h2.parse = function(e3) { + this.$d = function(e4) { + var t3 = e4.date, n3 = e4.utc; + if (t3 === null) + return new Date(NaN); + if (b.u(t3)) + return new Date(); + if (t3 instanceof Date) + return new Date(t3); + if (typeof t3 == "string" && !/Z$/i.test(t3)) { + var r2 = t3.match(l); + if (r2) + return n3 ? new Date(Date.UTC(r2[1], r2[2] - 1, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, r2[7] || 0)) : new Date(r2[1], r2[2] - 1, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, r2[7] || 0); + } + return new Date(t3); + }(e3), this.init(); + }, h2.init = function() { + var e3 = this.$d; + this.$y = e3.getFullYear(), this.$M = e3.getMonth(), this.$D = e3.getDate(), this.$W = e3.getDay(), this.$H = e3.getHours(), this.$m = e3.getMinutes(), this.$s = e3.getSeconds(), this.$ms = e3.getMilliseconds(); + }, h2.$utils = function() { + return b; + }, h2.isValid = function() { + return !(this.$d.toString() === "Invalid Date"); + }, h2.isSame = function(e3, t3) { + var n3 = _(e3); + return this.startOf(t3) <= n3 && n3 <= this.endOf(t3); + }, h2.isAfter = function(e3, t3) { + return _(e3) < this.startOf(t3); + }, h2.isBefore = function(e3, t3) { + return this.endOf(t3) < _(e3); + }, h2.$g = function(e3, t3, n3) { + return b.u(e3) ? this[t3] : this.set(n3, e3); + }, h2.year = function(e3) { + return this.$g(e3, "$y", c); + }, h2.month = function(e3) { + return this.$g(e3, "$M", s); + }, h2.day = function(e3) { + return this.$g(e3, "$W", i); + }, h2.date = function(e3) { + return this.$g(e3, "$D", "date"); + }, h2.hour = function(e3) { + return this.$g(e3, "$H", r); + }, h2.minute = function(e3) { + return this.$g(e3, "$m", n2); + }, h2.second = function(e3) { + return this.$g(e3, "$s", t2); + }, h2.millisecond = function(t3) { + return this.$g(t3, "$ms", e2); + }, h2.unix = function() { + return Math.floor(this.valueOf() / 1e3); + }, h2.valueOf = function() { + return this.$d.getTime(); + }, h2.startOf = function(e3, a2) { + var l2 = this, u2 = !!b.u(a2) || a2, d3 = b.p(e3), h3 = function(e4, t3) { + var n3 = b.w(l2.$u ? Date.UTC(l2.$y, t3, e4) : new Date(l2.$y, t3, e4), l2); + return u2 ? n3 : n3.endOf(i); + }, f2 = function(e4, t3) { + return b.w(l2.toDate()[e4].apply(l2.toDate("s"), (u2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(t3)), l2); + }, p2 = this.$W, g2 = this.$M, m2 = this.$D, v2 = "set" + (this.$u ? "UTC" : ""); + switch (d3) { + case c: + return u2 ? h3(1, 0) : h3(31, 11); + case s: + return u2 ? h3(1, g2) : h3(0, g2 + 1); + case o: + var _2 = this.$locale().weekStart || 0, y2 = (p2 < _2 ? p2 + 7 : p2) - _2; + return h3(u2 ? m2 - y2 : m2 + (6 - y2), g2); + case i: + case "date": + return f2(v2 + "Hours", 0); + case r: + return f2(v2 + "Minutes", 1); + case n2: + return f2(v2 + "Seconds", 2); + case t2: + return f2(v2 + "Milliseconds", 3); + default: + return this.clone(); + } + }, h2.endOf = function(e3) { + return this.startOf(e3, false); + }, h2.$set = function(o2, a2) { + var l2, u2 = b.p(o2), d3 = "set" + (this.$u ? "UTC" : ""), h3 = (l2 = {}, l2.day = d3 + "Date", l2.date = d3 + "Date", l2[s] = d3 + "Month", l2[c] = d3 + "FullYear", l2[r] = d3 + "Hours", l2[n2] = d3 + "Minutes", l2[t2] = d3 + "Seconds", l2[e2] = d3 + "Milliseconds", l2)[u2], f2 = u2 === i ? this.$D + (a2 - this.$W) : a2; + if (u2 === s || u2 === c) { + var p2 = this.clone().set("date", 1); + p2.$d[h3](f2), p2.init(), this.$d = p2.set("date", Math.min(this.$D, p2.daysInMonth())).$d; + } else + h3 && this.$d[h3](f2); + return this.init(), this; + }, h2.set = function(e3, t3) { + return this.clone().$set(e3, t3); + }, h2.get = function(e3) { + return this[b.p(e3)](); + }, h2.add = function(e3, a2) { + var l2, u2 = this; + e3 = Number(e3); + var d3 = b.p(a2), h3 = function(t3) { + var n3 = _(u2); + return b.w(n3.date(n3.date() + Math.round(t3 * e3)), u2); + }; + if (d3 === s) + return this.set(s, this.$M + e3); + if (d3 === c) + return this.set(c, this.$y + e3); + if (d3 === i) + return h3(1); + if (d3 === o) + return h3(7); + var f2 = (l2 = {}, l2[n2] = 6e4, l2[r] = 36e5, l2[t2] = 1e3, l2)[d3] || 1, p2 = this.$d.getTime() + e3 * f2; + return b.w(p2, this); + }, h2.subtract = function(e3, t3) { + return this.add(-1 * e3, t3); + }, h2.format = function(e3) { + var t3 = this; + if (!this.isValid()) + return "Invalid Date"; + var n3 = e3 || "YYYY-MM-DDTHH:mm:ssZ", r2 = b.z(this), i2 = this.$locale(), o2 = this.$H, s2 = this.$m, a2 = this.$M, c2 = i2.weekdays, l2 = i2.months, d3 = function(e4, r3, i3, o3) { + return e4 && (e4[r3] || e4(t3, n3)) || i3[r3].substr(0, o3); + }, h3 = function(e4) { + return b.s(o2 % 12 || 12, e4, "0"); + }, f2 = i2.meridiem || function(e4, t4, n4) { + var r3 = e4 < 12 ? "AM" : "PM"; + return n4 ? r3.toLowerCase() : r3; + }, p2 = {YY: String(this.$y).slice(-2), YYYY: this.$y, M: a2 + 1, MM: b.s(a2 + 1, 2, "0"), MMM: d3(i2.monthsShort, a2, l2, 3), MMMM: d3(l2, a2), D: this.$D, DD: b.s(this.$D, 2, "0"), d: String(this.$W), dd: d3(i2.weekdaysMin, this.$W, c2, 2), ddd: d3(i2.weekdaysShort, this.$W, c2, 3), dddd: c2[this.$W], H: String(o2), HH: b.s(o2, 2, "0"), h: h3(1), hh: h3(2), a: f2(o2, s2, true), A: f2(o2, s2, false), m: String(s2), mm: b.s(s2, 2, "0"), s: String(this.$s), ss: b.s(this.$s, 2, "0"), SSS: b.s(this.$ms, 3, "0"), Z: r2}; + return n3.replace(u, function(e4, t4) { + return t4 || p2[e4] || r2.replace(":", ""); + }); + }, h2.utcOffset = function() { + return 15 * -Math.round(this.$d.getTimezoneOffset() / 15); + }, h2.diff = function(e3, i2, l2) { + var u2, d3 = b.p(i2), h3 = _(e3), f2 = 6e4 * (h3.utcOffset() - this.utcOffset()), p2 = this - h3, g2 = b.m(this, h3); + return g2 = (u2 = {}, u2[c] = g2 / 12, u2[s] = g2, u2[a] = g2 / 3, u2[o] = (p2 - f2) / 6048e5, u2.day = (p2 - f2) / 864e5, u2[r] = p2 / 36e5, u2[n2] = p2 / 6e4, u2[t2] = p2 / 1e3, u2)[d3] || p2, l2 ? g2 : b.a(g2); + }, h2.daysInMonth = function() { + return this.endOf(s).$D; + }, h2.$locale = function() { + return g[this.$L]; + }, h2.locale = function(e3, t3) { + if (!e3) + return this.$L; + var n3 = this.clone(), r2 = v(e3, t3, true); + return r2 && (n3.$L = r2), n3; + }, h2.clone = function() { + return b.w(this.$d, this); + }, h2.toDate = function() { + return new Date(this.valueOf()); + }, h2.toJSON = function() { + return this.isValid() ? this.toISOString() : null; + }, h2.toISOString = function() { + return this.$d.toISOString(); + }, h2.toString = function() { + return this.$d.toUTCString(); + }, d2; + }(); + return _.prototype = y.prototype, _.extend = function(e3, t3) { + return e3(t3, y, _), _; + }, _.locale = v, _.isDayjs = m, _.unix = function(e3) { + return _(1e3 * e3); + }, _.en = g[p], _.Ls = g, _; + }(); + }, function(e, t, n) { + var r = n(63), i = typeof self == "object" && self && self.Object === Object && self, o = r.a || i || Function("return this")(); + t.a = o; + }, function(e, t, n) { + function r(e2, t2) { + e2[t2 >> 5] |= 128 << 24 - t2 % 32, e2[15 + (t2 + 64 >> 9 << 4)] = t2; + var n2, r2, s2, l2, u2, d2, h2, f, p = new Array(80), g = 1732584193, m = -271733879, v = -1732584194, _ = 271733878, b = -1009589776; + for (n2 = 0; n2 < e2.length; n2 += 16) { + for (l2 = g, u2 = m, d2 = v, h2 = _, f = b, r2 = 0; r2 < 80; r2++) + p[r2] = r2 < 16 ? e2[n2 + r2] : c(p[r2 - 3] ^ p[r2 - 8] ^ p[r2 - 14] ^ p[r2 - 16], 1), s2 = a(a(c(g, 5), i(r2, m, v, _)), a(a(b, p[r2]), o(r2))), b = _, _ = v, v = c(m, 30), m = g, g = s2; + g = a(g, l2), m = a(m, u2), v = a(v, d2), _ = a(_, h2), b = a(b, f); + } + return [g, m, v, _, b]; + } + function i(e2, t2, n2, r2) { + return e2 < 20 ? t2 & n2 | ~t2 & r2 : e2 < 40 ? t2 ^ n2 ^ r2 : e2 < 60 ? t2 & n2 | t2 & r2 | n2 & r2 : t2 ^ n2 ^ r2; + } + function o(e2) { + return e2 < 20 ? 1518500249 : e2 < 40 ? 1859775393 : e2 < 60 ? -1894007588 : -899497514; + } + function s(e2, t2) { + var n2 = l(e2); + n2.length > 16 && (n2 = r(n2, 8 * e2.length)); + for (var i2 = new Array(16), o2 = new Array(16), s2 = 0; s2 < 16; s2++) + i2[s2] = 909522486 ^ n2[s2], o2[s2] = 1549556828 ^ n2[s2]; + var a2 = r(i2.concat(l(t2)), 512 + 8 * t2.length); + return r(o2.concat(a2), 672); + } + function a(e2, t2) { + var n2 = (65535 & e2) + (65535 & t2); + return (e2 >> 16) + (t2 >> 16) + (n2 >> 16) << 16 | 65535 & n2; + } + function c(e2, t2) { + return e2 << t2 | e2 >>> 32 - t2; + } + function l(e2) { + for (var t2 = [], n2 = 0; n2 < 8 * e2.length; n2 += 8) + t2[n2 >> 5] |= (255 & e2.charCodeAt(n2 / 8)) << 24 - n2 % 32; + return t2; + } + function u(e2) { + for (var t2, n2, r2 = "", i2 = 0; i2 < 4 * e2.length; i2 += 3) + for (t2 = (e2[i2 >> 2] >> 8 * (3 - i2 % 4) & 255) << 16 | (e2[i2 + 1 >> 2] >> 8 * (3 - (i2 + 1) % 4) & 255) << 8 | e2[i2 + 2 >> 2] >> 8 * (3 - (i2 + 2) % 4) & 255, n2 = 0; n2 < 4; n2++) + 8 * i2 + 6 * n2 > 32 * e2.length ? r2 += "=" : r2 += "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t2 >> 6 * (3 - n2) & 63); + return r2; + } + function d(e2) { + for (var t2 = "", n2 = 0; n2 < 32 * e2.length; n2 += 8) + t2 += String.fromCharCode(e2[n2 >> 5] >>> 24 - n2 % 32 & 255); + return t2; + } + n.d(t, "a", function() { + return h; + }); + const h = {b64_hmac_sha1: function(e2, t2) { + return u(s(e2, t2)); + }, b64_sha1: function(e2) { + return u(r(l(e2), 8 * e2.length)); + }, binb2str: d, core_hmac_sha1: s, str_hmac_sha1: function(e2, t2) { + return d(s(e2, t2)); + }, str_sha1: function(e2) { + return d(r(l(e2), 8 * e2.length)); + }}; + }, function(e, t, n) { + var r = n(496), i = n(137), o = /[&<>"']/g, s = RegExp(o.source); + e.exports = function(e2) { + return (e2 = i(e2)) && s.test(e2) ? e2.replace(o, r) : e2; + }; + }, function(e, t, n) { + (function(e2) { + n.d(t, "b", function() { + return r; + }), n.d(t, "a", function() { + return i; + }), n.d(t, "c", function() { + return o; + }); + const r = function() { + let t2 = e2.WebSocket; + if (t2 === void 0) + try { + t2 = n(499); + } catch (e3) { + throw new Error('You must install the "ws" package to use Strophe in nodejs.'); + } + return t2; + }(); + const i = function() { + let t2 = e2.DOMParser; + if (t2 === void 0) + try { + t2 = n(47).DOMParser; + } catch (e3) { + throw new Error('You must install the "xmldom" package to use Strophe in nodejs.'); + } + return t2; + }(); + function o() { + if (typeof document == "undefined") + try { + return new (0, n(47).DOMImplementation)().createDocument("jabber:client", "strophe", null); + } catch (e3) { + throw new Error('You must install the "xmldom" package to use Strophe in nodejs.'); + } + if (document.implementation.createDocument === void 0 || document.implementation.createDocument && document.documentMode && document.documentMode < 10) { + const e3 = function() { + const e4 = ["Msxml2.DOMDocument.6.0", "Msxml2.DOMDocument.5.0", "Msxml2.DOMDocument.4.0", "MSXML2.DOMDocument.3.0", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XMLDOM"]; + for (let t2 = 0; t2 < e4.length; t2++) + try { + return new ActiveXObject(e4[t2]); + } catch (e5) { + } + }(); + return e3.appendChild(e3.createElement("strophe")), e3; + } + return document.implementation.createDocument("jabber:client", "strophe", null); + } + }).call(this, n(12)); + }, function(e, t, n) { + const r = n(330), i = n(331); + e.exports = {atob: r, btoa: i}; + }, function(e, t, n) { + var r = n(96), i = typeof self == "object" && self && self.Object === Object && self, o = r || i || Function("return this")(); + e.exports = o; + }, function(e, t) { + var n; + n = function() { + return this; + }(); + try { + n = n || new Function("return this")(); + } catch (e2) { + typeof window == "object" && (n = window); + } + e.exports = n; + }, function(e, t) { + var n = e.exports = typeof window != "undefined" && window.Math == Math ? window : typeof self != "undefined" && self.Math == Math ? self : Function("return this")(); + typeof __g == "number" && (__g = n); + }, function(e, t, n) { + (function(e2) { + var r = n(63), i = exports && !exports.nodeType && exports, o = i && typeof e2 == "object" && e2 && !e2.nodeType && e2, s = o && o.exports === i && r.a.process, a = function() { + try { + var e3 = o && o.require && o.require("util").types; + return e3 || s && s.binding && s.binding("util"); + } catch (e4) { + } + }(); + t.a = a; + }).call(this, n(69)(e)); + }, function(e, t, n) { + (function(e2) { + n.d(t, "a", function() { + return r; + }), n.d(t, "b", function() { + return i; + }); + !function() { + let t2 = e2.WebSocket; + if (t2 === void 0) + try { + t2 = n(328); + } catch (e3) { + throw new Error('You must install the "ws" package to use Strophe in nodejs.'); + } + }(); + const r = function() { + let t2 = e2.DOMParser; + if (t2 === void 0) + try { + t2 = n(47).DOMParser; + } catch (e3) { + throw new Error('You must install the "xmldom" package to use Strophe in nodejs.'); + } + return t2; + }(); + function i() { + if (typeof document == "undefined") + try { + return new (0, n(47).DOMImplementation)().createDocument("jabber:client", "strophe", null); + } catch (e3) { + throw new Error('You must install the "xmldom" package to use Strophe in nodejs.'); + } + if (document.implementation.createDocument === void 0 || document.implementation.createDocument && document.documentMode && document.documentMode < 10) { + const e3 = function() { + const e4 = ["Msxml2.DOMDocument.6.0", "Msxml2.DOMDocument.5.0", "Msxml2.DOMDocument.4.0", "MSXML2.DOMDocument.3.0", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XMLDOM"]; + for (let t2 = 0; t2 < e4.length; t2++) + try { + return new ActiveXObject(e4[t2]); + } catch (e5) { + } + }(); + return e3.appendChild(e3.createElement("strophe")), e3; + } + return document.implementation.createDocument("jabber:client", "strophe", null); + } + }).call(this, n(12)); + }, function(e, t) { + var n = Array.isArray; + e.exports = n; + }, function(e, t, n) { + var r = n(144)("wks"), i = n(145), o = n(13).Symbol, s = typeof o == "function"; + (e.exports = function(e2) { + return r[e2] || (r[e2] = s && o[e2] || (s ? o : i)("Symbol." + e2)); + }).store = r; + }, function(e, t, n) { + !function e2(t2, n2, r) { + function i(s2, a) { + if (!n2[s2]) { + if (!t2[s2]) { + if (o) + return o(s2, true); + var c = new Error("Cannot find module '" + s2 + "'"); + throw c.code = "MODULE_NOT_FOUND", c; + } + var l = n2[s2] = {exports: {}}; + t2[s2][0].call(l.exports, function(e3) { + return i(t2[s2][1][e3] || e3); + }, l, l.exports, e2, t2, n2, r); + } + return n2[s2].exports; + } + for (var o = false, s = 0; s < r.length; s++) + i(r[s]); + return i; + }({1: [function(e2, t2, n2) { + var r = e2("cssfilter").FilterCSS, i = e2("cssfilter").getDefaultWhiteList, o = e2("./util"); + function s() { + return {a: ["target", "href", "title"], abbr: ["title"], address: [], area: ["shape", "coords", "href", "alt"], article: [], aside: [], audio: ["autoplay", "controls", "loop", "preload", "src"], b: [], bdi: ["dir"], bdo: ["dir"], big: [], blockquote: ["cite"], br: [], caption: [], center: [], cite: [], code: [], col: ["align", "valign", "span", "width"], colgroup: ["align", "valign", "span", "width"], dd: [], del: ["datetime"], details: ["open"], div: [], dl: [], dt: [], em: [], font: ["color", "size", "face"], footer: [], h1: [], h2: [], h3: [], h4: [], h5: [], h6: [], header: [], hr: [], i: [], img: ["src", "alt", "title", "width", "height"], ins: ["datetime"], li: [], mark: [], nav: [], ol: [], p: [], pre: [], s: [], section: [], small: [], span: [], sub: [], sup: [], strong: [], table: ["width", "border", "align", "valign"], tbody: ["align", "valign"], td: ["width", "rowspan", "colspan", "align", "valign"], tfoot: ["align", "valign"], th: ["width", "rowspan", "colspan", "align", "valign"], thead: ["align", "valign"], tr: ["rowspan", "align", "valign"], tt: [], u: [], ul: [], video: ["autoplay", "controls", "loop", "preload", "src", "height", "width"]}; + } + var a = new r(); + function c(e3) { + return e3.replace(l, "<").replace(u, ">"); + } + var l = /</g, u = />/g, d = /"/g, h = /"/g, f = /&#([a-zA-Z0-9]*);?/gim, p = /:?/gim, g = /&newline;?/gim, m = /((j\s*a\s*v\s*a|v\s*b|l\s*i\s*v\s*e)\s*s\s*c\s*r\s*i\s*p\s*t\s*|m\s*o\s*c\s*h\s*a)\:/gi, v = /e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi, _ = /u\s*r\s*l\s*\(.*/gi; + function b(e3) { + return e3.replace(d, """); + } + function y(e3) { + return e3.replace(h, '"'); + } + function w(e3) { + return e3.replace(f, function(e4, t3) { + return t3[0] === "x" || t3[0] === "X" ? String.fromCharCode(parseInt(t3.substr(1), 16)) : String.fromCharCode(parseInt(t3, 10)); + }); + } + function S(e3) { + return e3.replace(p, ":").replace(g, " "); + } + function x(e3) { + for (var t3 = "", n3 = 0, r2 = e3.length; n3 < r2; n3++) + t3 += e3.charCodeAt(n3) < 32 ? " " : e3.charAt(n3); + return o.trim(t3); + } + function E(e3) { + return e3 = x(e3 = S(e3 = w(e3 = y(e3)))); + } + function A(e3) { + return e3 = c(e3 = b(e3)); + } + var C = /<!--[\s\S]*?-->/g; + n2.whiteList = {a: ["target", "href", "title"], abbr: ["title"], address: [], area: ["shape", "coords", "href", "alt"], article: [], aside: [], audio: ["autoplay", "controls", "loop", "preload", "src"], b: [], bdi: ["dir"], bdo: ["dir"], big: [], blockquote: ["cite"], br: [], caption: [], center: [], cite: [], code: [], col: ["align", "valign", "span", "width"], colgroup: ["align", "valign", "span", "width"], dd: [], del: ["datetime"], details: ["open"], div: [], dl: [], dt: [], em: [], font: ["color", "size", "face"], footer: [], h1: [], h2: [], h3: [], h4: [], h5: [], h6: [], header: [], hr: [], i: [], img: ["src", "alt", "title", "width", "height"], ins: ["datetime"], li: [], mark: [], nav: [], ol: [], p: [], pre: [], s: [], section: [], small: [], span: [], sub: [], sup: [], strong: [], table: ["width", "border", "align", "valign"], tbody: ["align", "valign"], td: ["width", "rowspan", "colspan", "align", "valign"], tfoot: ["align", "valign"], th: ["width", "rowspan", "colspan", "align", "valign"], thead: ["align", "valign"], tr: ["rowspan", "align", "valign"], tt: [], u: [], ul: [], video: ["autoplay", "controls", "loop", "preload", "src", "height", "width"]}, n2.getDefaultWhiteList = s, n2.onTag = function(e3, t3, n3) { + }, n2.onIgnoreTag = function(e3, t3, n3) { + }, n2.onTagAttr = function(e3, t3, n3) { + }, n2.onIgnoreTagAttr = function(e3, t3, n3) { + }, n2.safeAttrValue = function(e3, t3, n3, r2) { + if (n3 = E(n3), t3 === "href" || t3 === "src") { + if ((n3 = o.trim(n3)) === "#") + return "#"; + if (n3.substr(0, 7) !== "http://" && n3.substr(0, 8) !== "https://" && n3.substr(0, 7) !== "mailto:" && n3.substr(0, 4) !== "tel:" && n3.substr(0, 11) !== "data:image/" && n3.substr(0, 6) !== "ftp://" && n3.substr(0, 2) !== "./" && n3.substr(0, 3) !== "../" && n3[0] !== "#" && n3[0] !== "/") + return ""; + } else if (t3 === "background") { + if (m.lastIndex = 0, m.test(n3)) + return ""; + } else if (t3 === "style") { + if (v.lastIndex = 0, v.test(n3)) + return ""; + if (_.lastIndex = 0, _.test(n3) && (m.lastIndex = 0, m.test(n3))) + return ""; + r2 !== false && (n3 = (r2 = r2 || a).process(n3)); + } + return n3 = A(n3); + }, n2.escapeHtml = c, n2.escapeQuote = b, n2.unescapeQuote = y, n2.escapeHtmlEntities = w, n2.escapeDangerHtml5Entities = S, n2.clearNonPrintableCharacter = x, n2.friendlyAttrValue = E, n2.escapeAttrValue = A, n2.onIgnoreTagStripAll = function() { + return ""; + }, n2.StripTagBody = function(e3, t3) { + typeof t3 != "function" && (t3 = function() { + }); + var n3 = !Array.isArray(e3), r2 = [], i2 = false; + return {onIgnoreTag: function(s2, a2, c2) { + if (function(t4) { + return !!n3 || o.indexOf(e3, t4) !== -1; + }(s2)) { + if (c2.isClosing) { + var l2 = "[/removed]", u2 = c2.position + l2.length; + return r2.push([i2 !== false ? i2 : c2.position, u2]), i2 = false, l2; + } + return i2 || (i2 = c2.position), "[removed]"; + } + return t3(s2, a2, c2); + }, remove: function(e4) { + var t4 = "", n4 = 0; + return o.forEach(r2, function(r3) { + t4 += e4.slice(n4, r3[0]), n4 = r3[1]; + }), t4 += e4.slice(n4); + }}; + }, n2.stripCommentTag = function(e3) { + return e3.replace(C, ""); + }, n2.stripBlankChar = function(e3) { + var t3 = e3.split(""); + return (t3 = t3.filter(function(e4) { + var t4 = e4.charCodeAt(0); + return t4 !== 127 && (!(t4 <= 31) || (t4 === 10 || t4 === 13)); + })).join(""); + }, n2.cssFilter = a, n2.getDefaultCSSWhiteList = i; + }, {"./util": 4, cssfilter: 8}], 2: [function(e2, t2, n2) { + var r = e2("./default"), i = e2("./parser"), o = e2("./xss"); + function s(e3, t3) { + return new o(t3).process(e3); + } + for (var a in (n2 = t2.exports = s).filterXSS = s, n2.FilterXSS = o, r) + n2[a] = r[a]; + for (var a in i) + n2[a] = i[a]; + typeof window != "undefined" && (window.filterXSS = t2.exports), typeof self != "undefined" && typeof DedicatedWorkerGlobalScope != "undefined" && self instanceof DedicatedWorkerGlobalScope && (self.filterXSS = t2.exports); + }, {"./default": 1, "./parser": 3, "./xss": 5}], 3: [function(e2, t2, n2) { + var r = e2("./util"); + function i(e3) { + var t3 = r.spaceIndex(e3); + if (t3 === -1) + var n3 = e3.slice(1, -1); + else + n3 = e3.slice(1, t3 + 1); + return (n3 = r.trim(n3).toLowerCase()).slice(0, 1) === "/" && (n3 = n3.slice(1)), n3.slice(-1) === "/" && (n3 = n3.slice(0, -1)), n3; + } + function o(e3) { + return e3.slice(0, 2) === "</"; + } + var s = /[^a-zA-Z0-9_:\.\-]/gim; + function a(e3, t3) { + for (; t3 < e3.length; t3++) { + var n3 = e3[t3]; + if (n3 !== " ") + return n3 === "=" ? t3 : -1; + } + } + function c(e3, t3) { + for (; t3 > 0; t3--) { + var n3 = e3[t3]; + if (n3 !== " ") + return n3 === "=" ? t3 : -1; + } + } + function l(e3) { + return function(e4) { + return e4[0] === '"' && e4[e4.length - 1] === '"' || e4[0] === "'" && e4[e4.length - 1] === "'"; + }(e3) ? e3.substr(1, e3.length - 2) : e3; + } + n2.parseTag = function(e3, t3, n3) { + var r2 = "", s2 = 0, a2 = false, c2 = false, l2 = 0, u = e3.length, d = "", h = ""; + for (l2 = 0; l2 < u; l2++) { + var f = e3.charAt(l2); + if (a2 === false) { + if (f === "<") { + a2 = l2; + continue; + } + } else if (c2 === false) { + if (f === "<") { + r2 += n3(e3.slice(s2, l2)), a2 = l2, s2 = l2; + continue; + } + if (f === ">") { + r2 += n3(e3.slice(s2, a2)), d = i(h = e3.slice(a2, l2 + 1)), r2 += t3(a2, r2.length, d, h, o(h)), s2 = l2 + 1, a2 = false; + continue; + } + if ((f === '"' || f === "'") && e3.charAt(l2 - 1) === "=") { + c2 = f; + continue; + } + } else if (f === c2) { + c2 = false; + continue; + } + } + return s2 < e3.length && (r2 += n3(e3.substr(s2))), r2; + }, n2.parseAttr = function(e3, t3) { + var n3 = 0, i2 = [], o2 = false, u = e3.length; + function d(e4, n4) { + if (!((e4 = (e4 = r.trim(e4)).replace(s, "").toLowerCase()).length < 1)) { + var o3 = t3(e4, n4 || ""); + o3 && i2.push(o3); + } + } + for (var h = 0; h < u; h++) { + var f, p = e3.charAt(h); + if (o2 !== false || p !== "=") + if (o2 === false || h !== n3 || p !== '"' && p !== "'" || e3.charAt(h - 1) !== "=") + if (/\s|\n|\t/.test(p)) { + if (e3 = e3.replace(/\s|\n|\t/g, " "), o2 === false) { + if ((f = a(e3, h)) === -1) { + d(r.trim(e3.slice(n3, h))), o2 = false, n3 = h + 1; + continue; + } + h = f - 1; + continue; + } + if ((f = c(e3, h - 1)) === -1) { + d(o2, l(r.trim(e3.slice(n3, h)))), o2 = false, n3 = h + 1; + continue; + } + } else + ; + else { + if ((f = e3.indexOf(p, h + 1)) === -1) + break; + d(o2, r.trim(e3.slice(n3 + 1, f))), o2 = false, n3 = (h = f) + 1; + } + else + o2 = e3.slice(n3, h), n3 = h + 1; + } + return n3 < e3.length && (o2 === false ? d(e3.slice(n3)) : d(o2, l(r.trim(e3.slice(n3))))), r.trim(i2.join(" ")); + }; + }, {"./util": 4}], 4: [function(e2, t2, n2) { + t2.exports = {indexOf: function(e3, t3) { + var n3, r; + if (Array.prototype.indexOf) + return e3.indexOf(t3); + for (n3 = 0, r = e3.length; n3 < r; n3++) + if (e3[n3] === t3) + return n3; + return -1; + }, forEach: function(e3, t3, n3) { + var r, i; + if (Array.prototype.forEach) + return e3.forEach(t3, n3); + for (r = 0, i = e3.length; r < i; r++) + t3.call(n3, e3[r], r, e3); + }, trim: function(e3) { + return String.prototype.trim ? e3.trim() : e3.replace(/(^\s*)|(\s*$)/g, ""); + }, spaceIndex: function(e3) { + var t3 = /\s|\n|\t/.exec(e3); + return t3 ? t3.index : -1; + }}; + }, {}], 5: [function(e2, t2, n2) { + var r = e2("cssfilter").FilterCSS, i = e2("./default"), o = e2("./parser"), s = o.parseTag, a = o.parseAttr, c = e2("./util"); + function l(e3) { + return e3 == null; + } + function u(e3) { + (e3 = function(e4) { + var t3 = {}; + for (var n3 in e4) + t3[n3] = e4[n3]; + return t3; + }(e3 || {})).stripIgnoreTag && (e3.onIgnoreTag && console.error('Notes: cannot use these two options "stripIgnoreTag" and "onIgnoreTag" at the same time'), e3.onIgnoreTag = i.onIgnoreTagStripAll), e3.whiteList = e3.whiteList || i.whiteList, e3.onTag = e3.onTag || i.onTag, e3.onTagAttr = e3.onTagAttr || i.onTagAttr, e3.onIgnoreTag = e3.onIgnoreTag || i.onIgnoreTag, e3.onIgnoreTagAttr = e3.onIgnoreTagAttr || i.onIgnoreTagAttr, e3.safeAttrValue = e3.safeAttrValue || i.safeAttrValue, e3.escapeHtml = e3.escapeHtml || i.escapeHtml, this.options = e3, e3.css === false ? this.cssFilter = false : (e3.css = e3.css || {}, this.cssFilter = new r(e3.css)); + } + u.prototype.process = function(e3) { + if (!(e3 = (e3 = e3 || "").toString())) + return ""; + var t3 = this.options, n3 = t3.whiteList, r2 = t3.onTag, o2 = t3.onIgnoreTag, u2 = t3.onTagAttr, d = t3.onIgnoreTagAttr, h = t3.safeAttrValue, f = t3.escapeHtml, p = this.cssFilter; + t3.stripBlankChar && (e3 = i.stripBlankChar(e3)), t3.allowCommentTag || (e3 = i.stripCommentTag(e3)); + var g = false; + if (t3.stripIgnoreTagBody) { + g = i.StripTagBody(t3.stripIgnoreTagBody, o2); + o2 = g.onIgnoreTag; + } + var m = s(e3, function(e4, t4, i2, s2, g2) { + var m2, v = {sourcePosition: e4, position: t4, isClosing: g2, isWhite: n3.hasOwnProperty(i2)}; + if (!l(m2 = r2(i2, s2, v))) + return m2; + if (v.isWhite) { + if (v.isClosing) + return "</" + i2 + ">"; + var _ = function(e5) { + var t5 = c.spaceIndex(e5); + if (t5 === -1) + return {html: "", closing: e5[e5.length - 2] === "/"}; + var n4 = (e5 = c.trim(e5.slice(t5 + 1, -1)))[e5.length - 1] === "/"; + return n4 && (e5 = c.trim(e5.slice(0, -1))), {html: e5, closing: n4}; + }(s2), b = n3[i2], y = a(_.html, function(e5, t5) { + var n4, r3 = c.indexOf(b, e5) !== -1; + return l(n4 = u2(i2, e5, t5, r3)) ? r3 ? (t5 = h(i2, e5, t5, p)) ? e5 + '="' + t5 + '"' : e5 : l(n4 = d(i2, e5, t5, r3)) ? void 0 : n4 : n4; + }); + s2 = "<" + i2; + return y && (s2 += " " + y), _.closing && (s2 += " /"), s2 += ">"; + } + return l(m2 = o2(i2, s2, v)) ? f(s2) : m2; + }, f); + return g && (m = g.remove(m)), m; + }, t2.exports = u; + }, {"./default": 1, "./parser": 3, "./util": 4, cssfilter: 8}], 6: [function(e2, t2, n2) { + var r = e2("./default"), i = e2("./parser"); + e2("./util"); + function o(e3) { + return e3 == null; + } + function s(e3) { + (e3 = function(e4) { + var t3 = {}; + for (var n3 in e4) + t3[n3] = e4[n3]; + return t3; + }(e3 || {})).whiteList = e3.whiteList || r.whiteList, e3.onAttr = e3.onAttr || r.onAttr, e3.onIgnoreAttr = e3.onIgnoreAttr || r.onIgnoreAttr, e3.safeAttrValue = e3.safeAttrValue || r.safeAttrValue, this.options = e3; + } + s.prototype.process = function(e3) { + if (!(e3 = (e3 = e3 || "").toString())) + return ""; + var t3 = this.options, n3 = t3.whiteList, r2 = t3.onAttr, s2 = t3.onIgnoreAttr, a = t3.safeAttrValue; + return i(e3, function(e4, t4, i2, c, l) { + var u = n3[i2], d = false; + if (u === true ? d = u : typeof u == "function" ? d = u(c) : u instanceof RegExp && (d = u.test(c)), d !== true && (d = false), c = a(i2, c)) { + var h, f = {position: t4, sourcePosition: e4, source: l, isWhite: d}; + return d ? o(h = r2(i2, c, f)) ? i2 + ":" + c : h : o(h = s2(i2, c, f)) ? void 0 : h; + } + }); + }, t2.exports = s; + }, {"./default": 7, "./parser": 9, "./util": 10}], 7: [function(e2, t2, n2) { + function r() { + var e3 = {"align-content": false, "align-items": false, "align-self": false, "alignment-adjust": false, "alignment-baseline": false, all: false, "anchor-point": false, animation: false, "animation-delay": false, "animation-direction": false, "animation-duration": false, "animation-fill-mode": false, "animation-iteration-count": false, "animation-name": false, "animation-play-state": false, "animation-timing-function": false, azimuth: false, "backface-visibility": false, background: true, "background-attachment": true, "background-clip": true, "background-color": true, "background-image": true, "background-origin": true, "background-position": true, "background-repeat": true, "background-size": true, "baseline-shift": false, binding: false, bleed: false, "bookmark-label": false, "bookmark-level": false, "bookmark-state": false, border: true, "border-bottom": true, "border-bottom-color": true, "border-bottom-left-radius": true, "border-bottom-right-radius": true, "border-bottom-style": true, "border-bottom-width": true, "border-collapse": true, "border-color": true, "border-image": true, "border-image-outset": true, "border-image-repeat": true, "border-image-slice": true, "border-image-source": true, "border-image-width": true, "border-left": true, "border-left-color": true, "border-left-style": true, "border-left-width": true, "border-radius": true, "border-right": true, "border-right-color": true, "border-right-style": true, "border-right-width": true, "border-spacing": true, "border-style": true, "border-top": true, "border-top-color": true, "border-top-left-radius": true, "border-top-right-radius": true, "border-top-style": true, "border-top-width": true, "border-width": true, bottom: false, "box-decoration-break": true, "box-shadow": true, "box-sizing": true, "box-snap": true, "box-suppress": true, "break-after": true, "break-before": true, "break-inside": true, "caption-side": false, chains: false, clear: true, clip: false, "clip-path": false, "clip-rule": false, color: true, "color-interpolation-filters": true, "column-count": false, "column-fill": false, "column-gap": false, "column-rule": false, "column-rule-color": false, "column-rule-style": false, "column-rule-width": false, "column-span": false, "column-width": false, columns: false, contain: false, content: false, "counter-increment": false, "counter-reset": false, "counter-set": false, crop: false, cue: false, "cue-after": false, "cue-before": false, cursor: false, direction: false, display: true, "display-inside": true, "display-list": true, "display-outside": true, "dominant-baseline": false, elevation: false, "empty-cells": false, filter: false, flex: false, "flex-basis": false, "flex-direction": false, "flex-flow": false, "flex-grow": false, "flex-shrink": false, "flex-wrap": false, float: false, "float-offset": false, "flood-color": false, "flood-opacity": false, "flow-from": false, "flow-into": false, font: true, "font-family": true, "font-feature-settings": true, "font-kerning": true, "font-language-override": true, "font-size": true, "font-size-adjust": true, "font-stretch": true, "font-style": true, "font-synthesis": true, "font-variant": true, "font-variant-alternates": true, "font-variant-caps": true, "font-variant-east-asian": true, "font-variant-ligatures": true, "font-variant-numeric": true, "font-variant-position": true, "font-weight": true, grid: false, "grid-area": false, "grid-auto-columns": false, "grid-auto-flow": false, "grid-auto-rows": false, "grid-column": false, "grid-column-end": false, "grid-column-start": false, "grid-row": false, "grid-row-end": false, "grid-row-start": false, "grid-template": false, "grid-template-areas": false, "grid-template-columns": false, "grid-template-rows": false, "hanging-punctuation": false, height: true, hyphens: false, icon: false, "image-orientation": false, "image-resolution": false, "ime-mode": false, "initial-letters": false, "inline-box-align": false, "justify-content": false, "justify-items": false, "justify-self": false, left: false, "letter-spacing": true, "lighting-color": true, "line-box-contain": false, "line-break": false, "line-grid": false, "line-height": false, "line-snap": false, "line-stacking": false, "line-stacking-ruby": false, "line-stacking-shift": false, "line-stacking-strategy": false, "list-style": true, "list-style-image": true, "list-style-position": true, "list-style-type": true, margin: true, "margin-bottom": true, "margin-left": true, "margin-right": true, "margin-top": true, "marker-offset": false, "marker-side": false, marks: false, mask: false, "mask-box": false, "mask-box-outset": false, "mask-box-repeat": false, "mask-box-slice": false, "mask-box-source": false, "mask-box-width": false, "mask-clip": false, "mask-image": false, "mask-origin": false, "mask-position": false, "mask-repeat": false, "mask-size": false, "mask-source-type": false, "mask-type": false, "max-height": true, "max-lines": false, "max-width": true, "min-height": true, "min-width": true, "move-to": false, "nav-down": false, "nav-index": false, "nav-left": false, "nav-right": false, "nav-up": false, "object-fit": false, "object-position": false, opacity: false, order: false, orphans: false, outline: false, "outline-color": false, "outline-offset": false, "outline-style": false, "outline-width": false, overflow: false, "overflow-wrap": false, "overflow-x": false, "overflow-y": false, padding: true, "padding-bottom": true, "padding-left": true, "padding-right": true, "padding-top": true, page: false, "page-break-after": false, "page-break-before": false, "page-break-inside": false, "page-policy": false, pause: false, "pause-after": false, "pause-before": false, perspective: false, "perspective-origin": false, pitch: false, "pitch-range": false, "play-during": false, position: false, "presentation-level": false, quotes: false, "region-fragment": false, resize: false, rest: false, "rest-after": false, "rest-before": false, richness: false, right: false, rotation: false, "rotation-point": false, "ruby-align": false, "ruby-merge": false, "ruby-position": false, "shape-image-threshold": false, "shape-outside": false, "shape-margin": false, size: false, speak: false, "speak-as": false, "speak-header": false, "speak-numeral": false, "speak-punctuation": false, "speech-rate": false, stress: false, "string-set": false, "tab-size": false, "table-layout": false, "text-align": true, "text-align-last": true, "text-combine-upright": true, "text-decoration": true, "text-decoration-color": true, "text-decoration-line": true, "text-decoration-skip": true, "text-decoration-style": true, "text-emphasis": true, "text-emphasis-color": true, "text-emphasis-position": true, "text-emphasis-style": true, "text-height": true, "text-indent": true, "text-justify": true, "text-orientation": true, "text-overflow": true, "text-shadow": true, "text-space-collapse": true, "text-transform": true, "text-underline-position": true, "text-wrap": true, top: false, transform: false, "transform-origin": false, "transform-style": false, transition: false, "transition-delay": false, "transition-duration": false, "transition-property": false, "transition-timing-function": false, "unicode-bidi": false, "vertical-align": false, visibility: false, "voice-balance": false, "voice-duration": false, "voice-family": false, "voice-pitch": false, "voice-range": false, "voice-rate": false, "voice-stress": false, "voice-volume": false, volume: false, "white-space": false, widows: false, width: true, "will-change": false, "word-break": true, "word-spacing": true, "word-wrap": true, "wrap-flow": false, "wrap-through": false, "writing-mode": false, "z-index": false}; + return e3; + } + var i = /javascript\s*\:/gim; + n2.whiteList = r(), n2.getDefaultWhiteList = r, n2.onAttr = function(e3, t3, n3) { + }, n2.onIgnoreAttr = function(e3, t3, n3) { + }, n2.safeAttrValue = function(e3, t3) { + return i.test(t3) ? "" : t3; + }; + }, {}], 8: [function(e2, t2, n2) { + var r = e2("./default"), i = e2("./css"); + for (var o in (n2 = t2.exports = function(e3, t3) { + return new i(t3).process(e3); + }).FilterCSS = i, r) + n2[o] = r[o]; + typeof window != "undefined" && (window.filterCSS = t2.exports); + }, {"./css": 6, "./default": 7}], 9: [function(e2, t2, n2) { + var r = e2("./util"); + t2.exports = function(e3, t3) { + (e3 = r.trimRight(e3))[e3.length - 1] !== ";" && (e3 += ";"); + var n3 = e3.length, i = false, o = 0, s = 0, a = ""; + function c() { + if (!i) { + var n4 = r.trim(e3.slice(o, s)), c2 = n4.indexOf(":"); + if (c2 !== -1) { + var l2 = r.trim(n4.slice(0, c2)), u2 = r.trim(n4.slice(c2 + 1)); + if (l2) { + var d = t3(o, a.length, l2, u2, n4); + d && (a += d + "; "); + } + } + } + o = s + 1; + } + for (; s < n3; s++) { + var l = e3[s]; + if (l === "/" && e3[s + 1] === "*") { + var u = e3.indexOf("*/", s + 2); + if (u === -1) + break; + o = (s = u + 1) + 1, i = false; + } else + l === "(" ? i = true : l === ")" ? i = false : l === ";" ? i || c() : l === "\n" && c(); + } + return r.trim(a); + }; + }, {"./util": 10}], 10: [function(e2, t2, n2) { + t2.exports = {indexOf: function(e3, t3) { + var n3, r; + if (Array.prototype.indexOf) + return e3.indexOf(t3); + for (n3 = 0, r = e3.length; n3 < r; n3++) + if (e3[n3] === t3) + return n3; + return -1; + }, forEach: function(e3, t3, n3) { + var r, i; + if (Array.prototype.forEach) + return e3.forEach(t3, n3); + for (r = 0, i = e3.length; r < i; r++) + t3.call(n3, e3[r], r, e3); + }, trim: function(e3) { + return String.prototype.trim ? e3.trim() : e3.replace(/(^\s*)|(\s*$)/g, ""); + }, trimRight: function(e3) { + return String.prototype.trimRight ? e3.trimRight() : e3.replace(/(\s*$)/g, ""); + }}; + }, {}]}, {}, [2]), t.filterXSS = filterXSS, t.filterCSS = filterCSS; + }, function(e, t) { + var n = e.exports = {version: "2.6.12"}; + typeof __e == "number" && (__e = n); + }, function(e, t) { + e.exports = function(e2) { + var t2 = typeof e2; + return e2 != null && (t2 == "object" || t2 == "function"); + }; + }, function(e, t, n) { + (function(e2) { + var r = n(6), i = n(159), o = exports && !exports.nodeType && exports, s = o && typeof e2 == "object" && e2 && !e2.nodeType && e2, a = s && s.exports === o ? r.a.Buffer : void 0, c = (a ? a.isBuffer : void 0) || i.a; + t.a = c; + }).call(this, n(69)(e)); + }, function(e, t, n) { + (function(t2) { + e.exports = function e2(t3, n2, r) { + function i(s2, a) { + if (!n2[s2]) { + if (!t3[s2]) { + if (o) + return o(s2, true); + var c = new Error("Cannot find module '" + s2 + "'"); + throw c.code = "MODULE_NOT_FOUND", c; + } + var l = n2[s2] = {exports: {}}; + t3[s2][0].call(l.exports, function(e3) { + var n3 = t3[s2][1][e3]; + return i(n3 || e3); + }, l, l.exports, e2, t3, n2, r); + } + return n2[s2].exports; + } + for (var o = false, s = 0; s < r.length; s++) + i(r[s]); + return i; + }({1: [function(e2, n2, r) { + (function(e3) { + var t3, r2, i = e3.MutationObserver || e3.WebKitMutationObserver; + if (i) { + var o = 0, s = new i(u), a = e3.document.createTextNode(""); + s.observe(a, {characterData: true}), t3 = function() { + a.data = o = ++o % 2; + }; + } else if (e3.setImmediate || e3.MessageChannel === void 0) + t3 = "document" in e3 && "onreadystatechange" in e3.document.createElement("script") ? function() { + var t4 = e3.document.createElement("script"); + t4.onreadystatechange = function() { + u(), t4.onreadystatechange = null, t4.parentNode.removeChild(t4), t4 = null; + }, e3.document.documentElement.appendChild(t4); + } : function() { + setTimeout(u, 0); + }; + else { + var c = new e3.MessageChannel(); + c.port1.onmessage = u, t3 = function() { + c.port2.postMessage(0); + }; + } + var l = []; + function u() { + var e4, t4; + r2 = true; + for (var n3 = l.length; n3; ) { + for (t4 = l, l = [], e4 = -1; ++e4 < n3; ) + t4[e4](); + n3 = l.length; + } + r2 = false; + } + n2.exports = function(e4) { + l.push(e4) !== 1 || r2 || t3(); + }; + }).call(this, t2 !== void 0 ? t2 : typeof self != "undefined" ? self : typeof window != "undefined" ? window : {}); + }, {}], 2: [function(e2, t3, n2) { + var r = e2(1); + function i() { + } + var o = {}, s = ["REJECTED"], a = ["FULFILLED"], c = ["PENDING"]; + function l(e3) { + if (typeof e3 != "function") + throw new TypeError("resolver must be a function"); + this.state = c, this.queue = [], this.outcome = void 0, e3 !== i && f(this, e3); + } + function u(e3, t4, n3) { + this.promise = e3, typeof t4 == "function" && (this.onFulfilled = t4, this.callFulfilled = this.otherCallFulfilled), typeof n3 == "function" && (this.onRejected = n3, this.callRejected = this.otherCallRejected); + } + function d(e3, t4, n3) { + r(function() { + var r2; + try { + r2 = t4(n3); + } catch (t5) { + return o.reject(e3, t5); + } + r2 === e3 ? o.reject(e3, new TypeError("Cannot resolve promise with itself")) : o.resolve(e3, r2); + }); + } + function h(e3) { + var t4 = e3 && e3.then; + if (e3 && (typeof e3 == "object" || typeof e3 == "function") && typeof t4 == "function") + return function() { + t4.apply(e3, arguments); + }; + } + function f(e3, t4) { + var n3 = false; + function r2(t5) { + n3 || (n3 = true, o.reject(e3, t5)); + } + function i2(t5) { + n3 || (n3 = true, o.resolve(e3, t5)); + } + var s2 = p(function() { + t4(i2, r2); + }); + s2.status === "error" && r2(s2.value); + } + function p(e3, t4) { + var n3 = {}; + try { + n3.value = e3(t4), n3.status = "success"; + } catch (e4) { + n3.status = "error", n3.value = e4; + } + return n3; + } + t3.exports = l, l.prototype.catch = function(e3) { + return this.then(null, e3); + }, l.prototype.then = function(e3, t4) { + if (typeof e3 != "function" && this.state === a || typeof t4 != "function" && this.state === s) + return this; + var n3 = new this.constructor(i); + return this.state !== c ? d(n3, this.state === a ? e3 : t4, this.outcome) : this.queue.push(new u(n3, e3, t4)), n3; + }, u.prototype.callFulfilled = function(e3) { + o.resolve(this.promise, e3); + }, u.prototype.otherCallFulfilled = function(e3) { + d(this.promise, this.onFulfilled, e3); + }, u.prototype.callRejected = function(e3) { + o.reject(this.promise, e3); + }, u.prototype.otherCallRejected = function(e3) { + d(this.promise, this.onRejected, e3); + }, o.resolve = function(e3, t4) { + var n3 = p(h, t4); + if (n3.status === "error") + return o.reject(e3, n3.value); + var r2 = n3.value; + if (r2) + f(e3, r2); + else { + e3.state = a, e3.outcome = t4; + for (var i2 = -1, s2 = e3.queue.length; ++i2 < s2; ) + e3.queue[i2].callFulfilled(t4); + } + return e3; + }, o.reject = function(e3, t4) { + e3.state = s, e3.outcome = t4; + for (var n3 = -1, r2 = e3.queue.length; ++n3 < r2; ) + e3.queue[n3].callRejected(t4); + return e3; + }, l.resolve = function(e3) { + return e3 instanceof this ? e3 : o.resolve(new this(i), e3); + }, l.reject = function(e3) { + var t4 = new this(i); + return o.reject(t4, e3); + }, l.all = function(e3) { + var t4 = this; + if (Object.prototype.toString.call(e3) !== "[object Array]") + return this.reject(new TypeError("must be an array")); + var n3 = e3.length, r2 = false; + if (!n3) + return this.resolve([]); + for (var s2 = new Array(n3), a2 = 0, c2 = -1, l2 = new this(i); ++c2 < n3; ) + u2(e3[c2], c2); + return l2; + function u2(e4, i2) { + t4.resolve(e4).then(function(e5) { + s2[i2] = e5, ++a2 !== n3 || r2 || (r2 = true, o.resolve(l2, s2)); + }, function(e5) { + r2 || (r2 = true, o.reject(l2, e5)); + }); + } + }, l.race = function(e3) { + var t4 = this; + if (Object.prototype.toString.call(e3) !== "[object Array]") + return this.reject(new TypeError("must be an array")); + var n3 = e3.length, r2 = false; + if (!n3) + return this.resolve([]); + for (var s2, a2 = -1, c2 = new this(i); ++a2 < n3; ) + s2 = e3[a2], t4.resolve(s2).then(function(e4) { + r2 || (r2 = true, o.resolve(c2, e4)); + }, function(e4) { + r2 || (r2 = true, o.reject(c2, e4)); + }); + return c2; + }; + }, {1: 1}], 3: [function(e2, n2, r) { + (function(t3) { + typeof t3.Promise != "function" && (t3.Promise = e2(2)); + }).call(this, t2 !== void 0 ? t2 : typeof self != "undefined" ? self : typeof window != "undefined" ? window : {}); + }, {2: 2}], 4: [function(e2, t3, n2) { + var r = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e3) { + return typeof e3; + } : function(e3) { + return e3 && typeof Symbol == "function" && e3.constructor === Symbol && e3 !== Symbol.prototype ? "symbol" : typeof e3; + }, i = function() { + try { + if (typeof indexedDB != "undefined") + return indexedDB; + if (typeof webkitIndexedDB != "undefined") + return webkitIndexedDB; + if (typeof mozIndexedDB != "undefined") + return mozIndexedDB; + if (typeof OIndexedDB != "undefined") + return OIndexedDB; + if (typeof msIndexedDB != "undefined") + return msIndexedDB; + } catch (e3) { + return; + } + }(); + function o(e3, t4) { + e3 = e3 || [], t4 = t4 || {}; + try { + return new Blob(e3, t4); + } catch (i2) { + if (i2.name !== "TypeError") + throw i2; + for (var n3 = new (typeof BlobBuilder != "undefined" ? BlobBuilder : typeof MSBlobBuilder != "undefined" ? MSBlobBuilder : typeof MozBlobBuilder != "undefined" ? MozBlobBuilder : WebKitBlobBuilder)(), r2 = 0; r2 < e3.length; r2 += 1) + n3.append(e3[r2]); + return n3.getBlob(t4.type); + } + } + typeof Promise == "undefined" && e2(3); + var s = Promise; + function a(e3, t4) { + t4 && e3.then(function(e4) { + t4(null, e4); + }, function(e4) { + t4(e4); + }); + } + function c(e3, t4, n3) { + typeof t4 == "function" && e3.then(t4), typeof n3 == "function" && e3.catch(n3); + } + function l(e3) { + return typeof e3 != "string" && (console.warn(e3 + " used as a key, but it is not a string."), e3 = String(e3)), e3; + } + function u() { + if (arguments.length && typeof arguments[arguments.length - 1] == "function") + return arguments[arguments.length - 1]; + } + var d = void 0, h = {}, f = Object.prototype.toString; + function p(e3) { + return typeof d == "boolean" ? s.resolve(d) : function(e4) { + return new s(function(t4) { + var n3 = e4.transaction("local-forage-detect-blob-support", "readwrite"), r2 = o([""]); + n3.objectStore("local-forage-detect-blob-support").put(r2, "key"), n3.onabort = function(e5) { + e5.preventDefault(), e5.stopPropagation(), t4(false); + }, n3.oncomplete = function() { + var e5 = navigator.userAgent.match(/Chrome\/(\d+)/), n4 = navigator.userAgent.match(/Edge\//); + t4(n4 || !e5 || parseInt(e5[1], 10) >= 43); + }; + }).catch(function() { + return false; + }); + }(e3).then(function(e4) { + return d = e4; + }); + } + function g(e3) { + var t4 = h[e3.name], n3 = {}; + n3.promise = new s(function(e4, t5) { + n3.resolve = e4, n3.reject = t5; + }), t4.deferredOperations.push(n3), t4.dbReady ? t4.dbReady = t4.dbReady.then(function() { + return n3.promise; + }) : t4.dbReady = n3.promise; + } + function m(e3) { + var t4 = h[e3.name].deferredOperations.pop(); + if (t4) + return t4.resolve(), t4.promise; + } + function v(e3, t4) { + var n3 = h[e3.name].deferredOperations.pop(); + if (n3) + return n3.reject(t4), n3.promise; + } + function _(e3, t4) { + return new s(function(n3, r2) { + if (h[e3.name] = h[e3.name] || {forages: [], db: null, dbReady: null, deferredOperations: []}, e3.db) { + if (!t4) + return n3(e3.db); + g(e3), e3.db.close(); + } + var o2 = [e3.name]; + t4 && o2.push(e3.version); + var s2 = i.open.apply(i, o2); + t4 && (s2.onupgradeneeded = function(t5) { + var n4 = s2.result; + try { + n4.createObjectStore(e3.storeName), t5.oldVersion <= 1 && n4.createObjectStore("local-forage-detect-blob-support"); + } catch (n5) { + if (n5.name !== "ConstraintError") + throw n5; + console.warn('The database "' + e3.name + '" has been upgraded from version ' + t5.oldVersion + " to version " + t5.newVersion + ', but the storage "' + e3.storeName + '" already exists.'); + } + }), s2.onerror = function(e4) { + e4.preventDefault(), r2(s2.error); + }, s2.onsuccess = function() { + n3(s2.result), m(e3); + }; + }); + } + function b(e3) { + return _(e3, false); + } + function y(e3) { + return _(e3, true); + } + function w(e3, t4) { + if (!e3.db) + return true; + var n3 = !e3.db.objectStoreNames.contains(e3.storeName), r2 = e3.version < e3.db.version, i2 = e3.version > e3.db.version; + if (r2 && (e3.version !== t4 && console.warn('The database "' + e3.name + `" can't be downgraded from version ` + e3.db.version + " to version " + e3.version + "."), e3.version = e3.db.version), i2 || n3) { + if (n3) { + var o2 = e3.db.version + 1; + o2 > e3.version && (e3.version = o2); + } + return true; + } + return false; + } + function S(e3) { + return o([function(e4) { + for (var t4 = e4.length, n3 = new ArrayBuffer(t4), r2 = new Uint8Array(n3), i2 = 0; i2 < t4; i2++) + r2[i2] = e4.charCodeAt(i2); + return n3; + }(atob(e3.data))], {type: e3.type}); + } + function x(e3) { + return e3 && e3.__local_forage_encoded_blob; + } + function E(e3) { + var t4 = this, n3 = t4._initReady().then(function() { + var e4 = h[t4._dbInfo.name]; + if (e4 && e4.dbReady) + return e4.dbReady; + }); + return c(n3, e3, e3), n3; + } + function A(e3, t4, n3, r2) { + r2 === void 0 && (r2 = 1); + try { + var i2 = e3.db.transaction(e3.storeName, t4); + n3(null, i2); + } catch (i3) { + if (r2 > 0 && (!e3.db || i3.name === "InvalidStateError" || i3.name === "NotFoundError")) + return s.resolve().then(function() { + if (!e3.db || i3.name === "NotFoundError" && !e3.db.objectStoreNames.contains(e3.storeName) && e3.version <= e3.db.version) + return e3.db && (e3.version = e3.db.version + 1), y(e3); + }).then(function() { + return function(e4) { + g(e4); + for (var t5 = h[e4.name], n4 = t5.forages, r3 = 0; r3 < n4.length; r3++) { + var i4 = n4[r3]; + i4._dbInfo.db && (i4._dbInfo.db.close(), i4._dbInfo.db = null); + } + return e4.db = null, b(e4).then(function(t6) { + return e4.db = t6, w(e4) ? y(e4) : t6; + }).then(function(r4) { + e4.db = t5.db = r4; + for (var i5 = 0; i5 < n4.length; i5++) + n4[i5]._dbInfo.db = r4; + }).catch(function(t6) { + throw v(e4, t6), t6; + }); + }(e3).then(function() { + A(e3, t4, n3, r2 - 1); + }); + }).catch(n3); + n3(i3); + } + } + var C = {_driver: "asyncStorage", _initStorage: function(e3) { + var t4 = this, n3 = {db: null}; + if (e3) + for (var r2 in e3) + n3[r2] = e3[r2]; + var i2 = h[n3.name]; + i2 || (i2 = {forages: [], db: null, dbReady: null, deferredOperations: []}, h[n3.name] = i2), i2.forages.push(t4), t4._initReady || (t4._initReady = t4.ready, t4.ready = E); + var o2 = []; + function a2() { + return s.resolve(); + } + for (var c2 = 0; c2 < i2.forages.length; c2++) { + var l2 = i2.forages[c2]; + l2 !== t4 && o2.push(l2._initReady().catch(a2)); + } + var u2 = i2.forages.slice(0); + return s.all(o2).then(function() { + return n3.db = i2.db, b(n3); + }).then(function(e4) { + return n3.db = e4, w(n3, t4._defaultConfig.version) ? y(n3) : e4; + }).then(function(e4) { + n3.db = i2.db = e4, t4._dbInfo = n3; + for (var r3 = 0; r3 < u2.length; r3++) { + var o3 = u2[r3]; + o3 !== t4 && (o3._dbInfo.db = n3.db, o3._dbInfo.version = n3.version); + } + }); + }, _support: function() { + try { + if (!i || !i.open) + return false; + var e3 = typeof openDatabase != "undefined" && /(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent) && !/BlackBerry/.test(navigator.platform), t4 = typeof fetch == "function" && fetch.toString().indexOf("[native code") !== -1; + return (!e3 || t4) && typeof indexedDB != "undefined" && typeof IDBKeyRange != "undefined"; + } catch (e4) { + return false; + } + }(), iterate: function(e3, t4) { + var n3 = this, r2 = new s(function(t5, r3) { + n3.ready().then(function() { + A(n3._dbInfo, "readonly", function(i2, o2) { + if (i2) + return r3(i2); + try { + var s2 = o2.objectStore(n3._dbInfo.storeName).openCursor(), a2 = 1; + s2.onsuccess = function() { + var n4 = s2.result; + if (n4) { + var r4 = n4.value; + x(r4) && (r4 = S(r4)); + var i3 = e3(r4, n4.key, a2++); + i3 !== void 0 ? t5(i3) : n4.continue(); + } else + t5(); + }, s2.onerror = function() { + r3(s2.error); + }; + } catch (e4) { + r3(e4); + } + }); + }).catch(r3); + }); + return a(r2, t4), r2; + }, getItem: function(e3, t4) { + var n3 = this; + e3 = l(e3); + var r2 = new s(function(t5, r3) { + n3.ready().then(function() { + A(n3._dbInfo, "readonly", function(i2, o2) { + if (i2) + return r3(i2); + try { + var s2 = o2.objectStore(n3._dbInfo.storeName).get(e3); + s2.onsuccess = function() { + var e4 = s2.result; + e4 === void 0 && (e4 = null), x(e4) && (e4 = S(e4)), t5(e4); + }, s2.onerror = function() { + r3(s2.error); + }; + } catch (e4) { + r3(e4); + } + }); + }).catch(r3); + }); + return a(r2, t4), r2; + }, setItem: function(e3, t4, n3) { + var r2 = this; + e3 = l(e3); + var i2 = new s(function(n4, i3) { + var o2; + r2.ready().then(function() { + return o2 = r2._dbInfo, f.call(t4) === "[object Blob]" ? p(o2.db).then(function(e4) { + return e4 ? t4 : (n5 = t4, new s(function(e5, t5) { + var r3 = new FileReader(); + r3.onerror = t5, r3.onloadend = function(t6) { + var r4 = btoa(t6.target.result || ""); + e5({__local_forage_encoded_blob: true, data: r4, type: n5.type}); + }, r3.readAsBinaryString(n5); + })); + var n5; + }) : t4; + }).then(function(t5) { + A(r2._dbInfo, "readwrite", function(o3, s2) { + if (o3) + return i3(o3); + try { + var a2 = s2.objectStore(r2._dbInfo.storeName); + t5 === null && (t5 = void 0); + var c2 = a2.put(t5, e3); + s2.oncomplete = function() { + t5 === void 0 && (t5 = null), n4(t5); + }, s2.onabort = s2.onerror = function() { + var e4 = c2.error ? c2.error : c2.transaction.error; + i3(e4); + }; + } catch (e4) { + i3(e4); + } + }); + }).catch(i3); + }); + return a(i2, n3), i2; + }, removeItem: function(e3, t4) { + var n3 = this; + e3 = l(e3); + var r2 = new s(function(t5, r3) { + n3.ready().then(function() { + A(n3._dbInfo, "readwrite", function(i2, o2) { + if (i2) + return r3(i2); + try { + var s2 = o2.objectStore(n3._dbInfo.storeName).delete(e3); + o2.oncomplete = function() { + t5(); + }, o2.onerror = function() { + r3(s2.error); + }, o2.onabort = function() { + var e4 = s2.error ? s2.error : s2.transaction.error; + r3(e4); + }; + } catch (e4) { + r3(e4); + } + }); + }).catch(r3); + }); + return a(r2, t4), r2; + }, clear: function(e3) { + var t4 = this, n3 = new s(function(e4, n4) { + t4.ready().then(function() { + A(t4._dbInfo, "readwrite", function(r2, i2) { + if (r2) + return n4(r2); + try { + var o2 = i2.objectStore(t4._dbInfo.storeName).clear(); + i2.oncomplete = function() { + e4(); + }, i2.onabort = i2.onerror = function() { + var e5 = o2.error ? o2.error : o2.transaction.error; + n4(e5); + }; + } catch (e5) { + n4(e5); + } + }); + }).catch(n4); + }); + return a(n3, e3), n3; + }, length: function(e3) { + var t4 = this, n3 = new s(function(e4, n4) { + t4.ready().then(function() { + A(t4._dbInfo, "readonly", function(r2, i2) { + if (r2) + return n4(r2); + try { + var o2 = i2.objectStore(t4._dbInfo.storeName).count(); + o2.onsuccess = function() { + e4(o2.result); + }, o2.onerror = function() { + n4(o2.error); + }; + } catch (e5) { + n4(e5); + } + }); + }).catch(n4); + }); + return a(n3, e3), n3; + }, key: function(e3, t4) { + var n3 = this, r2 = new s(function(t5, r3) { + e3 < 0 ? t5(null) : n3.ready().then(function() { + A(n3._dbInfo, "readonly", function(i2, o2) { + if (i2) + return r3(i2); + try { + var s2 = o2.objectStore(n3._dbInfo.storeName), a2 = false, c2 = s2.openKeyCursor(); + c2.onsuccess = function() { + var n4 = c2.result; + n4 ? e3 === 0 || a2 ? t5(n4.key) : (a2 = true, n4.advance(e3)) : t5(null); + }, c2.onerror = function() { + r3(c2.error); + }; + } catch (e4) { + r3(e4); + } + }); + }).catch(r3); + }); + return a(r2, t4), r2; + }, keys: function(e3) { + var t4 = this, n3 = new s(function(e4, n4) { + t4.ready().then(function() { + A(t4._dbInfo, "readonly", function(r2, i2) { + if (r2) + return n4(r2); + try { + var o2 = i2.objectStore(t4._dbInfo.storeName).openKeyCursor(), s2 = []; + o2.onsuccess = function() { + var t5 = o2.result; + t5 ? (s2.push(t5.key), t5.continue()) : e4(s2); + }, o2.onerror = function() { + n4(o2.error); + }; + } catch (e5) { + n4(e5); + } + }); + }).catch(n4); + }); + return a(n3, e3), n3; + }, dropInstance: function(e3, t4) { + t4 = u.apply(this, arguments); + var n3 = this.config(); + (e3 = typeof e3 != "function" && e3 || {}).name || (e3.name = e3.name || n3.name, e3.storeName = e3.storeName || n3.storeName); + var r2, o2 = this; + if (e3.name) { + var c2 = e3.name === n3.name && o2._dbInfo.db, l2 = c2 ? s.resolve(o2._dbInfo.db) : b(e3).then(function(t5) { + var n4 = h[e3.name], r3 = n4.forages; + n4.db = t5; + for (var i2 = 0; i2 < r3.length; i2++) + r3[i2]._dbInfo.db = t5; + return t5; + }); + r2 = e3.storeName ? l2.then(function(t5) { + if (t5.objectStoreNames.contains(e3.storeName)) { + var n4 = t5.version + 1; + g(e3); + var r3 = h[e3.name], o3 = r3.forages; + t5.close(); + for (var a2 = 0; a2 < o3.length; a2++) { + var c3 = o3[a2]; + c3._dbInfo.db = null, c3._dbInfo.version = n4; + } + return new s(function(t6, r4) { + var o4 = i.open(e3.name, n4); + o4.onerror = function(e4) { + o4.result.close(), r4(e4); + }, o4.onupgradeneeded = function() { + o4.result.deleteObjectStore(e3.storeName); + }, o4.onsuccess = function() { + var e4 = o4.result; + e4.close(), t6(e4); + }; + }).then(function(e4) { + r3.db = e4; + for (var t6 = 0; t6 < o3.length; t6++) { + var n5 = o3[t6]; + n5._dbInfo.db = e4, m(n5._dbInfo); + } + }).catch(function(t6) { + throw (v(e3, t6) || s.resolve()).catch(function() { + }), t6; + }); + } + }) : l2.then(function(t5) { + g(e3); + var n4 = h[e3.name], r3 = n4.forages; + t5.close(); + for (var o3 = 0; o3 < r3.length; o3++) + r3[o3]._dbInfo.db = null; + return new s(function(t6, n5) { + var r4 = i.deleteDatabase(e3.name); + r4.onerror = r4.onblocked = function(e4) { + var t7 = r4.result; + t7 && t7.close(), n5(e4); + }, r4.onsuccess = function() { + var e4 = r4.result; + e4 && e4.close(), t6(e4); + }; + }).then(function(e4) { + n4.db = e4; + for (var t6 = 0; t6 < r3.length; t6++) + m(r3[t6]._dbInfo); + }).catch(function(t6) { + throw (v(e3, t6) || s.resolve()).catch(function() { + }), t6; + }); + }); + } else + r2 = s.reject("Invalid arguments"); + return a(r2, t4), r2; + }}, j = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", T = /^~~local_forage_type~([^~]+)~/, O = "__lfsc__:".length, k = O + "arbf".length, N = Object.prototype.toString; + function I(e3) { + var t4, n3, r2, i2, o2, s2 = 0.75 * e3.length, a2 = e3.length, c2 = 0; + e3[e3.length - 1] === "=" && (s2--, e3[e3.length - 2] === "=" && s2--); + var l2 = new ArrayBuffer(s2), u2 = new Uint8Array(l2); + for (t4 = 0; t4 < a2; t4 += 4) + n3 = j.indexOf(e3[t4]), r2 = j.indexOf(e3[t4 + 1]), i2 = j.indexOf(e3[t4 + 2]), o2 = j.indexOf(e3[t4 + 3]), u2[c2++] = n3 << 2 | r2 >> 4, u2[c2++] = (15 & r2) << 4 | i2 >> 2, u2[c2++] = (3 & i2) << 6 | 63 & o2; + return l2; + } + function M(e3) { + var t4, n3 = new Uint8Array(e3), r2 = ""; + for (t4 = 0; t4 < n3.length; t4 += 3) + r2 += j[n3[t4] >> 2], r2 += j[(3 & n3[t4]) << 4 | n3[t4 + 1] >> 4], r2 += j[(15 & n3[t4 + 1]) << 2 | n3[t4 + 2] >> 6], r2 += j[63 & n3[t4 + 2]]; + return n3.length % 3 == 2 ? r2 = r2.substring(0, r2.length - 1) + "=" : n3.length % 3 == 1 && (r2 = r2.substring(0, r2.length - 2) + "=="), r2; + } + var R = {serialize: function(e3, t4) { + var n3 = ""; + if (e3 && (n3 = N.call(e3)), e3 && (n3 === "[object ArrayBuffer]" || e3.buffer && N.call(e3.buffer) === "[object ArrayBuffer]")) { + var r2, i2 = "__lfsc__:"; + e3 instanceof ArrayBuffer ? (r2 = e3, i2 += "arbf") : (r2 = e3.buffer, n3 === "[object Int8Array]" ? i2 += "si08" : n3 === "[object Uint8Array]" ? i2 += "ui08" : n3 === "[object Uint8ClampedArray]" ? i2 += "uic8" : n3 === "[object Int16Array]" ? i2 += "si16" : n3 === "[object Uint16Array]" ? i2 += "ur16" : n3 === "[object Int32Array]" ? i2 += "si32" : n3 === "[object Uint32Array]" ? i2 += "ui32" : n3 === "[object Float32Array]" ? i2 += "fl32" : n3 === "[object Float64Array]" ? i2 += "fl64" : t4(new Error("Failed to get type for BinaryArray"))), t4(i2 + M(r2)); + } else if (n3 === "[object Blob]") { + var o2 = new FileReader(); + o2.onload = function() { + var n4 = "~~local_forage_type~" + e3.type + "~" + M(this.result); + t4("__lfsc__:blob" + n4); + }, o2.readAsArrayBuffer(e3); + } else + try { + t4(JSON.stringify(e3)); + } catch (n4) { + console.error("Couldn't convert value into a JSON string: ", e3), t4(null, n4); + } + }, deserialize: function(e3) { + if (e3.substring(0, O) !== "__lfsc__:") + return JSON.parse(e3); + var t4, n3 = e3.substring(k), r2 = e3.substring(O, k); + if (r2 === "blob" && T.test(n3)) { + var i2 = n3.match(T); + t4 = i2[1], n3 = n3.substring(i2[0].length); + } + var s2 = I(n3); + switch (r2) { + case "arbf": + return s2; + case "blob": + return o([s2], {type: t4}); + case "si08": + return new Int8Array(s2); + case "ui08": + return new Uint8Array(s2); + case "uic8": + return new Uint8ClampedArray(s2); + case "si16": + return new Int16Array(s2); + case "ur16": + return new Uint16Array(s2); + case "si32": + return new Int32Array(s2); + case "ui32": + return new Uint32Array(s2); + case "fl32": + return new Float32Array(s2); + case "fl64": + return new Float64Array(s2); + default: + throw new Error("Unkown type: " + r2); + } + }, stringToBuffer: I, bufferToString: M}; + function D(e3, t4, n3, r2) { + e3.executeSql("CREATE TABLE IF NOT EXISTS " + t4.storeName + " (id INTEGER PRIMARY KEY, key unique, value)", [], n3, r2); + } + function P(e3, t4, n3, r2, i2, o2) { + e3.executeSql(n3, r2, i2, function(e4, s2) { + s2.code === s2.SYNTAX_ERR ? e4.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?", [t4.storeName], function(e5, a2) { + a2.rows.length ? o2(e5, s2) : D(e5, t4, function() { + e5.executeSql(n3, r2, i2, o2); + }, o2); + }, o2) : o2(e4, s2); + }, o2); + } + function L(e3, t4, n3, r2) { + var i2 = this; + e3 = l(e3); + var o2 = new s(function(o3, s2) { + i2.ready().then(function() { + t4 === void 0 && (t4 = null); + var a2 = t4, c2 = i2._dbInfo; + c2.serializer.serialize(t4, function(t5, l2) { + l2 ? s2(l2) : c2.db.transaction(function(n4) { + P(n4, c2, "INSERT OR REPLACE INTO " + c2.storeName + " (key, value) VALUES (?, ?)", [e3, t5], function() { + o3(a2); + }, function(e4, t6) { + s2(t6); + }); + }, function(t6) { + if (t6.code === t6.QUOTA_ERR) { + if (r2 > 0) + return void o3(L.apply(i2, [e3, a2, n3, r2 - 1])); + s2(t6); + } + }); + }); + }).catch(s2); + }); + return a(o2, n3), o2; + } + function z(e3) { + return new s(function(t4, n3) { + e3.transaction(function(r2) { + r2.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'", [], function(n4, r3) { + for (var i2 = [], o2 = 0; o2 < r3.rows.length; o2++) + i2.push(r3.rows.item(o2).name); + t4({db: e3, storeNames: i2}); + }, function(e4, t5) { + n3(t5); + }); + }, function(e4) { + n3(e4); + }); + }); + } + var F = {_driver: "webSQLStorage", _initStorage: function(e3) { + var t4 = this, n3 = {db: null}; + if (e3) + for (var r2 in e3) + n3[r2] = typeof e3[r2] != "string" ? e3[r2].toString() : e3[r2]; + var i2 = new s(function(e4, r3) { + try { + n3.db = openDatabase(n3.name, String(n3.version), n3.description, n3.size); + } catch (e5) { + return r3(e5); + } + n3.db.transaction(function(i3) { + D(i3, n3, function() { + t4._dbInfo = n3, e4(); + }, function(e5, t5) { + r3(t5); + }); + }, r3); + }); + return n3.serializer = R, i2; + }, _support: typeof openDatabase == "function", iterate: function(e3, t4) { + var n3 = this, r2 = new s(function(t5, r3) { + n3.ready().then(function() { + var i2 = n3._dbInfo; + i2.db.transaction(function(n4) { + P(n4, i2, "SELECT * FROM " + i2.storeName, [], function(n5, r4) { + for (var o2 = r4.rows, s2 = o2.length, a2 = 0; a2 < s2; a2++) { + var c2 = o2.item(a2), l2 = c2.value; + if (l2 && (l2 = i2.serializer.deserialize(l2)), (l2 = e3(l2, c2.key, a2 + 1)) !== void 0) + return void t5(l2); + } + t5(); + }, function(e4, t6) { + r3(t6); + }); + }); + }).catch(r3); + }); + return a(r2, t4), r2; + }, getItem: function(e3, t4) { + var n3 = this; + e3 = l(e3); + var r2 = new s(function(t5, r3) { + n3.ready().then(function() { + var i2 = n3._dbInfo; + i2.db.transaction(function(n4) { + P(n4, i2, "SELECT * FROM " + i2.storeName + " WHERE key = ? LIMIT 1", [e3], function(e4, n5) { + var r4 = n5.rows.length ? n5.rows.item(0).value : null; + r4 && (r4 = i2.serializer.deserialize(r4)), t5(r4); + }, function(e4, t6) { + r3(t6); + }); + }); + }).catch(r3); + }); + return a(r2, t4), r2; + }, setItem: function(e3, t4, n3) { + return L.apply(this, [e3, t4, n3, 1]); + }, removeItem: function(e3, t4) { + var n3 = this; + e3 = l(e3); + var r2 = new s(function(t5, r3) { + n3.ready().then(function() { + var i2 = n3._dbInfo; + i2.db.transaction(function(n4) { + P(n4, i2, "DELETE FROM " + i2.storeName + " WHERE key = ?", [e3], function() { + t5(); + }, function(e4, t6) { + r3(t6); + }); + }); + }).catch(r3); + }); + return a(r2, t4), r2; + }, clear: function(e3) { + var t4 = this, n3 = new s(function(e4, n4) { + t4.ready().then(function() { + var r2 = t4._dbInfo; + r2.db.transaction(function(t5) { + P(t5, r2, "DELETE FROM " + r2.storeName, [], function() { + e4(); + }, function(e5, t6) { + n4(t6); + }); + }); + }).catch(n4); + }); + return a(n3, e3), n3; + }, length: function(e3) { + var t4 = this, n3 = new s(function(e4, n4) { + t4.ready().then(function() { + var r2 = t4._dbInfo; + r2.db.transaction(function(t5) { + P(t5, r2, "SELECT COUNT(key) as c FROM " + r2.storeName, [], function(t6, n5) { + var r3 = n5.rows.item(0).c; + e4(r3); + }, function(e5, t6) { + n4(t6); + }); + }); + }).catch(n4); + }); + return a(n3, e3), n3; + }, key: function(e3, t4) { + var n3 = this, r2 = new s(function(t5, r3) { + n3.ready().then(function() { + var i2 = n3._dbInfo; + i2.db.transaction(function(n4) { + P(n4, i2, "SELECT key FROM " + i2.storeName + " WHERE id = ? LIMIT 1", [e3 + 1], function(e4, n5) { + var r4 = n5.rows.length ? n5.rows.item(0).key : null; + t5(r4); + }, function(e4, t6) { + r3(t6); + }); + }); + }).catch(r3); + }); + return a(r2, t4), r2; + }, keys: function(e3) { + var t4 = this, n3 = new s(function(e4, n4) { + t4.ready().then(function() { + var r2 = t4._dbInfo; + r2.db.transaction(function(t5) { + P(t5, r2, "SELECT key FROM " + r2.storeName, [], function(t6, n5) { + for (var r3 = [], i2 = 0; i2 < n5.rows.length; i2++) + r3.push(n5.rows.item(i2).key); + e4(r3); + }, function(e5, t6) { + n4(t6); + }); + }); + }).catch(n4); + }); + return a(n3, e3), n3; + }, dropInstance: function(e3, t4) { + t4 = u.apply(this, arguments); + var n3 = this.config(); + (e3 = typeof e3 != "function" && e3 || {}).name || (e3.name = e3.name || n3.name, e3.storeName = e3.storeName || n3.storeName); + var r2, i2 = this; + return a(r2 = e3.name ? new s(function(t5) { + var r3; + r3 = e3.name === n3.name ? i2._dbInfo.db : openDatabase(e3.name, "", "", 0), e3.storeName ? t5({db: r3, storeNames: [e3.storeName]}) : t5(z(r3)); + }).then(function(e4) { + return new s(function(t5, n4) { + e4.db.transaction(function(r3) { + function i3(e5) { + return new s(function(t6, n5) { + r3.executeSql("DROP TABLE IF EXISTS " + e5, [], function() { + t6(); + }, function(e6, t7) { + n5(t7); + }); + }); + } + for (var o2 = [], a2 = 0, c2 = e4.storeNames.length; a2 < c2; a2++) + o2.push(i3(e4.storeNames[a2])); + s.all(o2).then(function() { + t5(); + }).catch(function(e5) { + n4(e5); + }); + }, function(e5) { + n4(e5); + }); + }); + }) : s.reject("Invalid arguments"), t4), r2; + }}; + function B(e3, t4) { + var n3 = e3.name + "/"; + return e3.storeName !== t4.storeName && (n3 += e3.storeName + "/"), n3; + } + function q() { + return !function() { + try { + return localStorage.setItem("_localforage_support_test", true), localStorage.removeItem("_localforage_support_test"), false; + } catch (e3) { + return true; + } + }() || localStorage.length > 0; + } + var H = {_driver: "localStorageWrapper", _initStorage: function(e3) { + var t4 = {}; + if (e3) + for (var n3 in e3) + t4[n3] = e3[n3]; + return t4.keyPrefix = B(e3, this._defaultConfig), q() ? (this._dbInfo = t4, t4.serializer = R, s.resolve()) : s.reject(); + }, _support: function() { + try { + return typeof localStorage != "undefined" && "setItem" in localStorage && !!localStorage.setItem; + } catch (e3) { + return false; + } + }(), iterate: function(e3, t4) { + var n3 = this, r2 = n3.ready().then(function() { + for (var t5 = n3._dbInfo, r3 = t5.keyPrefix, i2 = r3.length, o2 = localStorage.length, s2 = 1, a2 = 0; a2 < o2; a2++) { + var c2 = localStorage.key(a2); + if (c2.indexOf(r3) === 0) { + var l2 = localStorage.getItem(c2); + if (l2 && (l2 = t5.serializer.deserialize(l2)), (l2 = e3(l2, c2.substring(i2), s2++)) !== void 0) + return l2; + } + } + }); + return a(r2, t4), r2; + }, getItem: function(e3, t4) { + var n3 = this; + e3 = l(e3); + var r2 = n3.ready().then(function() { + var t5 = n3._dbInfo, r3 = localStorage.getItem(t5.keyPrefix + e3); + return r3 && (r3 = t5.serializer.deserialize(r3)), r3; + }); + return a(r2, t4), r2; + }, setItem: function(e3, t4, n3) { + var r2 = this; + e3 = l(e3); + var i2 = r2.ready().then(function() { + t4 === void 0 && (t4 = null); + var n4 = t4; + return new s(function(i3, o2) { + var s2 = r2._dbInfo; + s2.serializer.serialize(t4, function(t5, r3) { + if (r3) + o2(r3); + else + try { + localStorage.setItem(s2.keyPrefix + e3, t5), i3(n4); + } catch (e4) { + e4.name !== "QuotaExceededError" && e4.name !== "NS_ERROR_DOM_QUOTA_REACHED" || o2(e4), o2(e4); + } + }); + }); + }); + return a(i2, n3), i2; + }, removeItem: function(e3, t4) { + var n3 = this; + e3 = l(e3); + var r2 = n3.ready().then(function() { + var t5 = n3._dbInfo; + localStorage.removeItem(t5.keyPrefix + e3); + }); + return a(r2, t4), r2; + }, clear: function(e3) { + var t4 = this, n3 = t4.ready().then(function() { + for (var e4 = t4._dbInfo.keyPrefix, n4 = localStorage.length - 1; n4 >= 0; n4--) { + var r2 = localStorage.key(n4); + r2.indexOf(e4) === 0 && localStorage.removeItem(r2); + } + }); + return a(n3, e3), n3; + }, length: function(e3) { + var t4 = this.keys().then(function(e4) { + return e4.length; + }); + return a(t4, e3), t4; + }, key: function(e3, t4) { + var n3 = this, r2 = n3.ready().then(function() { + var t5, r3 = n3._dbInfo; + try { + t5 = localStorage.key(e3); + } catch (e4) { + t5 = null; + } + return t5 && (t5 = t5.substring(r3.keyPrefix.length)), t5; + }); + return a(r2, t4), r2; + }, keys: function(e3) { + var t4 = this, n3 = t4.ready().then(function() { + for (var e4 = t4._dbInfo, n4 = localStorage.length, r2 = [], i2 = 0; i2 < n4; i2++) { + var o2 = localStorage.key(i2); + o2.indexOf(e4.keyPrefix) === 0 && r2.push(o2.substring(e4.keyPrefix.length)); + } + return r2; + }); + return a(n3, e3), n3; + }, dropInstance: function(e3, t4) { + if (t4 = u.apply(this, arguments), !(e3 = typeof e3 != "function" && e3 || {}).name) { + var n3 = this.config(); + e3.name = e3.name || n3.name, e3.storeName = e3.storeName || n3.storeName; + } + var r2, i2 = this; + return a(r2 = e3.name ? new s(function(t5) { + e3.storeName ? t5(B(e3, i2._defaultConfig)) : t5(e3.name + "/"); + }).then(function(e4) { + for (var t5 = localStorage.length - 1; t5 >= 0; t5--) { + var n4 = localStorage.key(t5); + n4.indexOf(e4) === 0 && localStorage.removeItem(n4); + } + }) : s.reject("Invalid arguments"), t4), r2; + }}, U = function(e3, t4) { + for (var n3, r2, i2 = e3.length, o2 = 0; o2 < i2; ) { + if ((n3 = e3[o2]) === (r2 = t4) || typeof n3 == "number" && typeof r2 == "number" && isNaN(n3) && isNaN(r2)) + return true; + o2++; + } + return false; + }, $ = Array.isArray || function(e3) { + return Object.prototype.toString.call(e3) === "[object Array]"; + }, W = {}, G = {}, V = {INDEXEDDB: C, WEBSQL: F, LOCALSTORAGE: H}, J = [V.INDEXEDDB._driver, V.WEBSQL._driver, V.LOCALSTORAGE._driver], X = ["dropInstance"], Q = ["clear", "getItem", "iterate", "key", "keys", "length", "removeItem", "setItem"].concat(X), Y = {description: "", driver: J.slice(), name: "localforage", size: 4980736, storeName: "keyvaluepairs", version: 1}; + function K(e3, t4) { + e3[t4] = function() { + var n3 = arguments; + return e3.ready().then(function() { + return e3[t4].apply(e3, n3); + }); + }; + } + function Z() { + for (var e3 = 1; e3 < arguments.length; e3++) { + var t4 = arguments[e3]; + if (t4) + for (var n3 in t4) + t4.hasOwnProperty(n3) && ($(t4[n3]) ? arguments[0][n3] = t4[n3].slice() : arguments[0][n3] = t4[n3]); + } + return arguments[0]; + } + var ee = new (function() { + function e3(t4) { + for (var n3 in function(e4, t5) { + if (!(e4 instanceof t5)) + throw new TypeError("Cannot call a class as a function"); + }(this, e3), V) + if (V.hasOwnProperty(n3)) { + var r2 = V[n3], i2 = r2._driver; + this[n3] = i2, W[i2] || this.defineDriver(r2); + } + this._defaultConfig = Z({}, Y), this._config = Z({}, this._defaultConfig, t4), this._driverSet = null, this._initDriver = null, this._ready = false, this._dbInfo = null, this._wrapLibraryMethodsWithReady(), this.setDriver(this._config.driver).catch(function() { + }); + } + return e3.prototype.config = function(e4) { + if ((e4 === void 0 ? "undefined" : r(e4)) === "object") { + if (this._ready) + return new Error("Can't call config() after localforage has been used."); + for (var t4 in e4) { + if (t4 === "storeName" && (e4[t4] = e4[t4].replace(/\W/g, "_")), t4 === "version" && typeof e4[t4] != "number") + return new Error("Database version must be a number."); + this._config[t4] = e4[t4]; + } + return !("driver" in e4) || !e4.driver || this.setDriver(this._config.driver); + } + return typeof e4 == "string" ? this._config[e4] : this._config; + }, e3.prototype.defineDriver = function(e4, t4, n3) { + var r2 = new s(function(t5, n4) { + try { + var r3 = e4._driver, i2 = new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver"); + if (!e4._driver) + return void n4(i2); + for (var o2 = Q.concat("_initStorage"), c2 = 0, l2 = o2.length; c2 < l2; c2++) { + var u2 = o2[c2]; + if ((!U(X, u2) || e4[u2]) && typeof e4[u2] != "function") + return void n4(i2); + } + !function() { + for (var t6 = function(e5) { + return function() { + var t7 = new Error("Method " + e5 + " is not implemented by the current driver"), n6 = s.reject(t7); + return a(n6, arguments[arguments.length - 1]), n6; + }; + }, n5 = 0, r4 = X.length; n5 < r4; n5++) { + var i3 = X[n5]; + e4[i3] || (e4[i3] = t6(i3)); + } + }(); + var d2 = function(n5) { + W[r3] && console.info("Redefining LocalForage driver: " + r3), W[r3] = e4, G[r3] = n5, t5(); + }; + "_support" in e4 ? e4._support && typeof e4._support == "function" ? e4._support().then(d2, n4) : d2(!!e4._support) : d2(true); + } catch (e5) { + n4(e5); + } + }); + return c(r2, t4, n3), r2; + }, e3.prototype.driver = function() { + return this._driver || null; + }, e3.prototype.getDriver = function(e4, t4, n3) { + var r2 = W[e4] ? s.resolve(W[e4]) : s.reject(new Error("Driver not found.")); + return c(r2, t4, n3), r2; + }, e3.prototype.getSerializer = function(e4) { + var t4 = s.resolve(R); + return c(t4, e4), t4; + }, e3.prototype.ready = function(e4) { + var t4 = this, n3 = t4._driverSet.then(function() { + return t4._ready === null && (t4._ready = t4._initDriver()), t4._ready; + }); + return c(n3, e4, e4), n3; + }, e3.prototype.setDriver = function(e4, t4, n3) { + var r2 = this; + $(e4) || (e4 = [e4]); + var i2 = this._getSupportedDrivers(e4); + function o2() { + r2._config.driver = r2.driver(); + } + function a2(e5) { + return r2._extend(e5), o2(), r2._ready = r2._initStorage(r2._config), r2._ready; + } + var l2 = this._driverSet !== null ? this._driverSet.catch(function() { + return s.resolve(); + }) : s.resolve(); + return this._driverSet = l2.then(function() { + var e5 = i2[0]; + return r2._dbInfo = null, r2._ready = null, r2.getDriver(e5).then(function(e6) { + r2._driver = e6._driver, o2(), r2._wrapLibraryMethodsWithReady(), r2._initDriver = function(e7) { + return function() { + var t5 = 0; + return function n4() { + for (; t5 < e7.length; ) { + var i3 = e7[t5]; + return t5++, r2._dbInfo = null, r2._ready = null, r2.getDriver(i3).then(a2).catch(n4); + } + o2(); + var c2 = new Error("No available storage method found."); + return r2._driverSet = s.reject(c2), r2._driverSet; + }(); + }; + }(i2); + }); + }).catch(function() { + o2(); + var e5 = new Error("No available storage method found."); + return r2._driverSet = s.reject(e5), r2._driverSet; + }), c(this._driverSet, t4, n3), this._driverSet; + }, e3.prototype.supports = function(e4) { + return !!G[e4]; + }, e3.prototype._extend = function(e4) { + Z(this, e4); + }, e3.prototype._getSupportedDrivers = function(e4) { + for (var t4 = [], n3 = 0, r2 = e4.length; n3 < r2; n3++) { + var i2 = e4[n3]; + this.supports(i2) && t4.push(i2); + } + return t4; + }, e3.prototype._wrapLibraryMethodsWithReady = function() { + for (var e4 = 0, t4 = Q.length; e4 < t4; e4++) + K(this, Q[e4]); + }, e3.prototype.createInstance = function(t4) { + return new e3(t4); + }, e3; + }())(); + t3.exports = ee; + }, {3: 3}]}, {}, [4])(4); + }).call(this, n(12)); + }, function(e, t) { + e.exports = function(e2) { + return e2 != null && typeof e2 == "object"; + }; + }, function(e, t, n) { + (function(e2) { + n(498), n(158), n(500); + var r = n(2); + n.d(t, "b", function() { + return r.d; + }), n.d(t, "a", function() { + return r.b; + }), e2.$build = r.e.$build, e2.$iq = r.e.$iq, e2.$msg = r.e.$msg, e2.$pres = r.e.$pres, e2.Strophe = r.e.Strophe; + const {b64_sha1: i} = r.c; + }).call(this, n(12)); + }, function(e, t, n) { + var r = n(49), i = n(335), o = n(336), s = r ? r.toStringTag : void 0; + e.exports = function(e2) { + return e2 == null ? e2 === void 0 ? "[object Undefined]" : "[object Null]" : s && s in Object(e2) ? i(e2) : o(e2); + }; + }, function(e, t, n) { + var r = n(353), i = n(356); + e.exports = function(e2, t2) { + var n2 = i(e2, t2); + return r(n2) ? n2 : void 0; + }; + }, function(e, t, n) { + var r = n(41); + e.exports = function(e2) { + if (!r(e2)) + throw TypeError(e2 + " is not an object!"); + return e2; + }; + }, , function(e, t, n) { + var r = n(62), i = n(71); + e.exports = function(e2) { + return e2 != null && i(e2.length) && !r(e2); + }; + }, function(e, t, n) { + var r = n(13), i = n(19), o = n(58), s = n(31), a = n(60), c = function(e2, t2, n2) { + var l, u, d, h = e2 & c.F, f = e2 & c.G, p = e2 & c.S, g = e2 & c.P, m = e2 & c.B, v = e2 & c.W, _ = f ? i : i[t2] || (i[t2] = {}), b = _.prototype, y = f ? r : p ? r[t2] : (r[t2] || {}).prototype; + for (l in f && (n2 = t2), n2) + (u = !h && y && y[l] !== void 0) && a(_, l) || (d = u ? y[l] : n2[l], _[l] = f && typeof y[l] != "function" ? n2[l] : m && u ? o(d, r) : v && y[l] == d ? function(e3) { + var t3 = function(t4, n3, r2) { + if (this instanceof e3) { + switch (arguments.length) { + case 0: + return new e3(); + case 1: + return new e3(t4); + case 2: + return new e3(t4, n3); + } + return new e3(t4, n3, r2); + } + return e3.apply(this, arguments); + }; + return t3.prototype = e3.prototype, t3; + }(d) : g && typeof d == "function" ? o(Function.call, d) : d, g && ((_.virtual || (_.virtual = {}))[l] = d, e2 & c.R && b && !b[l] && s(b, l, d))); + }; + c.F = 1, c.G = 2, c.S = 4, c.P = 8, c.B = 16, c.W = 32, c.U = 64, c.R = 128, e.exports = c; + }, function(e, t, n) { + var r = n(40), i = n(140); + e.exports = n(32) ? function(e2, t2, n2) { + return r.f(e2, t2, i(1, n2)); + } : function(e2, t2, n2) { + return e2[t2] = n2, e2; + }; + }, function(e, t, n) { + e.exports = !n(82)(function() { + return Object.defineProperty({}, "a", {get: function() { + return 7; + }}).a != 7; + }); + }, function(e, t, n) { + var r = n(98), i = n(102), o = n(29); + e.exports = function(e2) { + return o(e2) ? r(e2) : i(e2); + }; + }, function(e, t, n) { + (function(n2) { + var r, i, o; + i = [], (o = typeof (r = function() { + var e2 = n2 !== void 0 ? n2 : this || window, t2 = document, r2 = t2.documentElement, i2 = "body", o2 = e2.BSN = {}, s = o2.supports = [], a = "data-toggle", c = "delay", l = "target", u = "animation", d = "onmouseleave" in t2 ? ["mouseenter", "mouseleave"] : ["mouseover", "mouseout"], h = "getAttribute", f = "setAttribute", p = "parentNode", g = "length", m = "style", v = "push", _ = "active", b = "left", y = "top", w = /\b(top|bottom|left|right)+/, S = 0, x = "WebkitTransition" in r2[m] || "Transition".toLowerCase() in r2[m], E = "WebkitTransition" in r2[m] ? "Webkit".toLowerCase() + "TransitionEnd" : "Transition".toLowerCase() + "end", A = "WebkitDuration" in r2[m] ? "Webkit".toLowerCase() + "TransitionDuration" : "Transition".toLowerCase() + "Duration", C = function(e3) { + e3.focus ? e3.focus() : e3.setActive(); + }, j = function(e3, t3) { + e3.classList.add(t3); + }, T = function(e3, t3) { + e3.classList.remove(t3); + }, O = function(e3, t3) { + return e3.classList.contains(t3); + }, k = function(e3, t3) { + return [].slice.call(e3.getElementsByClassName(t3)); + }, N = function(e3, n3) { + return typeof e3 == "object" ? e3 : (n3 || t2).querySelector(e3); + }, I = function(e3, n3) { + var r3 = n3.charAt(0), i3 = n3.substr(1); + if (r3 === ".") { + for (; e3 && e3 !== t2; e3 = e3[p]) + if (N(n3, e3[p]) !== null && O(e3, i3)) + return e3; + } else if (r3 === "#") { + for (; e3 && e3 !== t2; e3 = e3[p]) + if (e3.id === i3) + return e3; + } + return false; + }, M = function(e3, t3, n3, r3) { + r3 = r3 || false, e3.addEventListener(t3, n3, r3); + }, R = function(e3, t3, n3, r3) { + r3 = r3 || false, e3.removeEventListener(t3, n3, r3); + }, D = function(e3, t3, n3, r3) { + M(e3, t3, function i3(o3) { + n3(o3), R(e3, t3, i3, r3); + }, r3); + }, P = !!function() { + var t3 = false; + try { + var n3 = Object.defineProperty({}, "passive", {get: function() { + t3 = true; + }}); + D(e2, "testPassive", null, n3); + } catch (e3) { + } + return t3; + }() && {passive: true}, L = function(t3) { + var n3 = x ? e2.getComputedStyle(t3)[A] : 0; + return n3 = typeof (n3 = parseFloat(n3)) != "number" || isNaN(n3) ? 0 : 1e3 * n3; + }, z = function(e3, t3) { + var n3 = 0; + L(e3) ? D(e3, E, function(e4) { + !n3 && t3(e4), n3 = 1; + }) : setTimeout(function() { + !n3 && t3(), n3 = 1; + }, 17); + }, F = function(e3, t3, n3) { + var r3 = new CustomEvent(e3 + ".bs." + t3); + r3.relatedTarget = n3, this.dispatchEvent(r3); + }, B = function(n3, o3, s2, a2) { + var c2, l2, u2, d2, h2, f2, p2 = o3.offsetWidth, g2 = o3.offsetHeight, v2 = r2.clientWidth || t2[i2].clientWidth, _2 = r2.clientHeight || t2[i2].clientHeight, S2 = n3.getBoundingClientRect(), x2 = a2 === t2[i2] ? {y: e2.pageYOffset || r2.scrollTop, x: e2.pageXOffset || r2.scrollLeft} : {x: a2.offsetLeft + a2.scrollLeft, y: a2.offsetTop + a2.scrollTop}, E2 = S2.right - S2[b], A2 = S2.bottom - S2.top, C2 = O(o3, "popover"), j2 = N(".arrow", o3), T2 = S2.top + A2 / 2 - g2 / 2 < 0, k2 = S2[b] + E2 / 2 - p2 / 2 < 0, I2 = S2[b] + p2 / 2 + E2 / 2 >= v2, M2 = S2.top + g2 / 2 + A2 / 2 >= _2, R2 = S2.top - g2 < 0, D2 = S2[b] - p2 < 0, P2 = S2.top + g2 + A2 >= _2, L2 = S2[b] + p2 + E2 >= v2; + s2 = (s2 = (s2 = (s2 = (s2 = (s2 === b || s2 === "right") && D2 && L2 ? y : s2) === y && R2 ? "bottom" : s2) === "bottom" && P2 ? y : s2) === b && D2 ? "right" : s2) === "right" && L2 ? b : s2, o3.className.indexOf(s2) === -1 && (o3.className = o3.className.replace(w, s2)), h2 = j2.offsetWidth, f2 = j2.offsetHeight, s2 === b || s2 === "right" ? (l2 = s2 === b ? S2[b] + x2.x - p2 - (C2 ? h2 : 0) : S2[b] + x2.x + E2, T2 ? (c2 = S2.top + x2.y, u2 = A2 / 2 - h2) : M2 ? (c2 = S2.top + x2.y - g2 + A2, u2 = g2 - A2 / 2 - h2) : (c2 = S2.top + x2.y - g2 / 2 + A2 / 2, u2 = g2 / 2 - (C2 ? 0.9 * f2 : f2 / 2))) : s2 !== y && s2 !== "bottom" || (c2 = s2 === y ? S2.top + x2.y - g2 - (C2 ? f2 : 0) : S2.top + x2.y + A2, k2 ? (l2 = 0, d2 = S2[b] + E2 / 2 - h2) : I2 ? (l2 = v2 - 1.01 * p2, d2 = p2 - (v2 - S2[b]) + E2 / 2 - h2 / 2) : (l2 = S2[b] + x2.x - p2 / 2 + E2 / 2, d2 = p2 / 2 - (C2 ? h2 : h2 / 2))), o3[m].top = c2 + "px", o3[m][b] = l2 + "px", u2 && (j2[m].top = u2 + "px"), d2 && (j2[m][b] = d2 + "px"); + }; + o2.version = "2.0.27"; + var q = function(e3) { + e3 = N(e3); + var t3 = this, n3 = I(e3, ".alert"), r3 = function(r4) { + n3 = I(r4[l], ".alert"), (e3 = N('[data-dismiss="alert"]', n3)) && n3 && (e3 === r4[l] || e3.contains(r4[l])) && t3.close(); + }, i3 = function() { + F.call(n3, "closed", "alert"), R(e3, "click", r3), n3[p].removeChild(n3); + }; + this.close = function() { + n3 && e3 && O(n3, "show") && (F.call(n3, "close", "alert"), T(n3, "show"), n3 && (O(n3, "fade") ? z(n3, i3) : i3())); + }, "Alert" in e3 || M(e3, "click", r3), e3.Alert = t3; + }; + s[v](["Alert", q, '[data-dismiss="alert"]']); + var H = function(e3) { + e3 = N(e3); + var n3 = false, r3 = "checked", i3 = function(t3) { + var i4 = t3[l].tagName === "LABEL" ? t3[l] : t3[l][p].tagName === "LABEL" ? t3[l][p] : null; + if (i4) { + var o4 = k(i4[p], "btn"), s3 = i4.getElementsByTagName("INPUT")[0]; + if (s3) { + if (s3.type === "checkbox" && (s3[r3] ? (T(i4, _), s3[h](r3), s3.removeAttribute(r3), s3[r3] = false) : (j(i4, _), s3[h](r3), s3[f](r3, r3), s3[r3] = true), n3 || (n3 = true, F.call(s3, "change", "button"), F.call(e3, "change", "button"))), s3.type === "radio" && !n3 && (!s3[r3] || t3.screenX === 0 && t3.screenY == 0)) { + j(i4, _), j(i4, "focus"), s3[f](r3, r3), s3[r3] = true, F.call(s3, "change", "button"), F.call(e3, "change", "button"), n3 = true; + for (var a3 = 0, c3 = o4[g]; a3 < c3; a3++) { + var u3 = o4[a3], d3 = u3.getElementsByTagName("INPUT")[0]; + u3 !== i4 && O(u3, _) && (T(u3, _), d3.removeAttribute(r3), d3[r3] = false, F.call(d3, "change", "button")); + } + } + setTimeout(function() { + n3 = false; + }, 50); + } + } + }, o3 = function(e4) { + j(e4[l][p], "focus"); + }, s2 = function(e4) { + T(e4[l][p], "focus"); + }; + if (!("Button" in e3)) { + M(e3, "click", i3), M(e3, "keyup", function(e4) { + (e4.which || e4.keyCode) === 32 && e4[l] === t2.activeElement && i3(e4); + }), M(e3, "keydown", function(e4) { + (e4.which || e4.keyCode) === 32 && e4.preventDefault(); + }); + for (var a2 = k(e3, "btn"), c2 = 0; c2 < a2.length; c2++) { + var u2 = a2[c2].getElementsByTagName("INPUT")[0]; + M(u2, "focus", o3), M(u2, "blur", s2); + } + } + var d2 = k(e3, "btn"), m2 = d2[g]; + for (c2 = 0; c2 < m2; c2++) + !O(d2[c2], _) && N("input:checked", d2[c2]) && j(d2[c2], _); + e3.Button = this; + }; + s[v](["Button", H, "[" + a + '="buttons"]']); + var U = function(e3, t3) { + e3 = N(e3), t3 = t3 || {}; + var n3, r3, i3, o3, s2, a2 = null, c2 = null, l2 = this, u2 = e3[h]("data-parent"), d2 = function(e4, t4) { + F.call(e4, "hide", "collapse"), e4.isAnimating = true, e4[m].height = e4.scrollHeight + "px", T(e4, "collapse"), T(e4, "show"), j(e4, "collapsing"), e4.offsetWidth, e4[m].height = "0px", z(e4, function() { + e4.isAnimating = false, e4[f]("aria-expanded", "false"), t4[f]("aria-expanded", "false"), T(e4, "collapsing"), j(e4, "collapse"), e4[m].height = "", F.call(e4, "hidden", "collapse"); + }); + }; + this.toggle = function(e4) { + e4.preventDefault(), O(c2, "show") ? l2.hide() : l2.show(); + }, this.hide = function() { + c2.isAnimating || (d2(c2, e3), j(e3, "collapsed")); + }, this.show = function() { + var t4, i4; + a2 && (n3 = N(".collapse.show", a2), r3 = n3 && (N('[data-target="#' + n3.id + '"]', a2) || N('[href="#' + n3.id + '"]', a2))), (!c2.isAnimating || n3 && !n3.isAnimating) && (r3 && n3 !== c2 && (d2(n3, r3), j(r3, "collapsed")), i4 = e3, F.call(t4 = c2, "show", "collapse"), t4.isAnimating = true, j(t4, "collapsing"), T(t4, "collapse"), t4[m].height = t4.scrollHeight + "px", z(t4, function() { + t4.isAnimating = false, t4[f]("aria-expanded", "true"), i4[f]("aria-expanded", "true"), T(t4, "collapsing"), j(t4, "collapse"), j(t4, "show"), t4[m].height = "", F.call(t4, "shown", "collapse"); + }), T(e3, "collapsed")); + }, "Collapse" in e3 || M(e3, "click", l2.toggle), i3 = e3.href && e3[h]("href"), o3 = e3[h]("data-target"), s2 = i3 || o3 && o3.charAt(0) === "#" && o3, (c2 = s2 && N(s2)).isAnimating = false, a2 = N(t3.parent) || u2 && I(e3, u2), e3.Collapse = l2; + }; + s[v](["Collapse", U, "[" + a + '="collapse"]']); + var $ = function(e3, n3) { + e3 = N(e3), this.persist = n3 === true || e3[h]("data-persist") === "true" || false; + var r3 = this, i3 = e3[p], o3 = null, s2 = N(".dropdown-menu", i3), c2 = function() { + for (var e4 = s2.children, t3 = [], n4 = 0; n4 < e4[g]; n4++) + e4[n4].children[g] && e4[n4].children[0].tagName === "A" && t3[v](e4[n4].children[0]), e4[n4].tagName === "A" && t3[v](e4[n4]); + return t3; + }(), u2 = function(e4) { + (e4.href && e4.href.slice(-1) === "#" || e4[p] && e4[p].href && e4[p].href.slice(-1) === "#") && this.preventDefault(); + }, d2 = function() { + var n4 = e3.open ? M : R; + n4(t2, "click", m2), n4(t2, "keydown", b2), n4(t2, "keyup", y2), n4(t2, "focus", m2, true); + }, m2 = function(t3) { + var n4 = t3[l], i4 = n4 && (n4[h](a) || n4[p] && h in n4[p] && n4[p][h](a)); + (t3.type !== "focus" || n4 !== e3 && n4 !== s2 && !s2.contains(n4)) && (n4 !== s2 && !s2.contains(n4) || !r3.persist && !i4) && (o3 = n4 === e3 || e3.contains(n4) ? e3 : null, S2(), u2.call(t3, n4)); + }, _2 = function(t3) { + o3 = e3, w2(), u2.call(t3, t3[l]); + }, b2 = function(e4) { + var t3 = e4.which || e4.keyCode; + t3 !== 38 && t3 !== 40 || e4.preventDefault(); + }, y2 = function(n4) { + var i4 = n4.which || n4.keyCode, a2 = t2.activeElement, l2 = c2.indexOf(a2), u3 = a2 === e3, d3 = s2.contains(a2), h2 = a2[p] === s2 || a2[p][p] === s2; + h2 && (l2 = u3 ? 0 : i4 === 38 ? l2 > 1 ? l2 - 1 : 0 : i4 === 40 && l2 < c2[g] - 1 ? l2 + 1 : l2, c2[l2] && C(c2[l2])), (c2[g] && h2 || !c2[g] && (d3 || u3) || !d3) && e3.open && i4 === 27 && (r3.toggle(), o3 = null); + }, w2 = function() { + F.call(i3, "show", "dropdown", o3), j(s2, "show"), j(i3, "show"), e3[f]("aria-expanded", true), F.call(i3, "shown", "dropdown", o3), e3.open = true, R(e3, "click", _2), setTimeout(function() { + C(s2.getElementsByTagName("INPUT")[0] || e3), d2(); + }, 1); + }, S2 = function() { + F.call(i3, "hide", "dropdown", o3), T(s2, "show"), T(i3, "show"), e3[f]("aria-expanded", false), F.call(i3, "hidden", "dropdown", o3), e3.open = false, d2(), C(e3), setTimeout(function() { + M(e3, "click", _2); + }, 1); + }; + e3.open = false, this.toggle = function() { + O(i3, "show") && e3.open ? S2() : w2(); + }, "Dropdown" in e3 || (false in s2 && s2[f]("tabindex", "0"), M(e3, "click", _2)), e3.Dropdown = r3; + }; + s[v](["Dropdown", $, "[" + a + '="dropdown"]']); + var W = function(n3, o3) { + var s2 = (n3 = N(n3))[h]("data-target") || n3[h]("href"), a2 = N(s2), c2 = O(n3, "modal") ? n3 : a2; + if (O(n3, "modal") && (n3 = null), c2) { + o3 = o3 || {}, this.keyboard = o3.keyboard !== false && c2[h]("data-keyboard") !== "false", this.backdrop = o3.backdrop !== "static" && c2[h]("data-backdrop") !== "static" || "static", this.backdrop = o3.backdrop !== false && c2[h]("data-backdrop") !== "false" && this.backdrop, this[u] = !!O(c2, "fade"), this.content = o3.content, c2.isAnimating = false; + var d2, v2, _2, y2, w2, E2 = this, A2 = null, I2 = k(r2, "fixed-top").concat(k(r2, "fixed-bottom")), D2 = function() { + var n4, r3 = e2.getComputedStyle(t2[i2]), o4 = parseInt(r3.paddingRight, 10); + if (d2 && (t2[i2][m].paddingRight = o4 + v2 + "px", c2[m].paddingRight = v2 + "px", I2[g])) + for (var s3 = 0; s3 < I2[g]; s3++) + n4 = e2.getComputedStyle(I2[s3]).paddingRight, I2[s3][m].paddingRight = parseInt(n4) + v2 + "px"; + }, B2 = function() { + var n4, o4, s3; + d2 = t2[i2].clientWidth < (n4 = r2.getBoundingClientRect(), e2.innerWidth || n4.right - Math.abs(n4[b])), (s3 = t2.createElement("div")).className = "modal-scrollbar-measure", t2[i2].appendChild(s3), o4 = s3.offsetWidth - s3.clientWidth, t2[i2].removeChild(s3), v2 = o4; + }, q2 = function() { + (_2 = N(".modal-backdrop")) && _2 !== null && typeof _2 == "object" && (S = 0, t2[i2].removeChild(_2), _2 = null); + }, H2 = function() { + C(c2), c2.isAnimating = false, F.call(c2, "shown", "modal", A2), M(e2, "resize", E2.update, P), M(c2, "click", W2), M(t2, "keydown", $2); + }, U2 = function() { + c2[m].display = "", n3 && C(n3), F.call(c2, "hidden", "modal"), k(t2, "modal show")[0] || (function() { + if (t2[i2][m].paddingRight = "", c2[m].paddingRight = "", I2[g]) + for (var e3 = 0; e3 < I2[g]; e3++) + I2[e3][m].paddingRight = ""; + }(), T(t2[i2], "modal-open"), _2 && O(_2, "fade") ? (T(_2, "show"), z(_2, q2)) : q2(), R(e2, "resize", E2.update, P), R(c2, "click", W2), R(t2, "keydown", $2)), c2.isAnimating = false; + }, $2 = function(e3) { + c2.isAnimating || E2.keyboard && e3.which == 27 && O(c2, "show") && E2.hide(); + }, W2 = function(e3) { + if (!c2.isAnimating) { + var t3 = e3[l]; + O(c2, "show") && (t3[p][h]("data-dismiss") === "modal" || t3[h]("data-dismiss") === "modal" || t3 === c2 && E2.backdrop !== "static") && (E2.hide(), A2 = null, e3.preventDefault()); + } + }; + this.toggle = function() { + O(c2, "show") ? this.hide() : this.show(); + }, this.show = function() { + O(c2, "show") || c2.isAnimating || (clearTimeout(w2), w2 = setTimeout(function() { + c2.isAnimating = true, F.call(c2, "show", "modal", A2); + var e3, n4 = k(t2, "modal show")[0]; + n4 && n4 !== c2 && ("modalTrigger" in n4 && n4.modalTrigger.Modal.hide(), "Modal" in n4 && n4.Modal.hide()), E2.backdrop && !S && !_2 && (e3 = t2.createElement("div"), (_2 = N(".modal-backdrop")) === null && (e3[f]("class", "modal-backdrop" + (E2[u] ? " fade" : "")), _2 = e3, t2[i2].appendChild(_2)), S = 1), _2 && !O(_2, "show") && (_2.offsetWidth, y2 = L(_2), j(_2, "show")), setTimeout(function() { + c2[m].display = "block", B2(), D2(), j(t2[i2], "modal-open"), j(c2, "show"), c2[f]("aria-hidden", false), O(c2, "fade") ? z(c2, H2) : H2(); + }, x && _2 && y2 ? y2 : 1); + }, 1)); + }, this.hide = function() { + !c2.isAnimating && O(c2, "show") && (clearTimeout(w2), w2 = setTimeout(function() { + c2.isAnimating = true, F.call(c2, "hide", "modal"), _2 = N(".modal-backdrop"), y2 = _2 && L(_2), T(c2, "show"), c2[f]("aria-hidden", true), setTimeout(function() { + O(c2, "fade") ? z(c2, U2) : U2(); + }, x && _2 && y2 ? y2 : 2); + }, 2)); + }, this.setContent = function(e3) { + N(".modal-content", c2).innerHTML = e3; + }, this.update = function() { + O(c2, "show") && (B2(), D2()); + }, n3 && !("Modal" in n3) && M(n3, "click", function(e3) { + if (!c2.isAnimating) { + var t3 = e3[l]; + (t3 = t3.hasAttribute("data-target") || t3.hasAttribute("href") ? t3 : t3[p]) !== n3 || O(c2, "show") || (c2.modalTrigger = n3, A2 = n3, E2.show(), e3.preventDefault()); + } + }), E2.content && E2.setContent(E2.content), n3 ? (n3.Modal = E2, c2.modalTrigger = n3) : c2.Modal = E2; + } + }; + s[v](["Modal", W, "[" + a + '="modal"]']); + var G = function(n3, r3) { + n3 = N(n3), r3 = r3 || {}; + var o3 = n3[h]("data-trigger"), s2 = n3[h]("data-animation"), a2 = n3[h]("data-placement"), p2 = n3[h]("data-dismissible"), g2 = n3[h]("data-delay"), v2 = n3[h]("data-container"), _2 = '<button type="button" class="close">\xD7</button>', b2 = N(r3.container), w2 = N(v2), S2 = I(n3, ".modal"), x2 = I(n3, ".fixed-top"), E2 = I(n3, ".fixed-bottom"); + this.template = r3.template ? r3.template : null, this.trigger = r3.trigger ? r3.trigger : o3 || "hover", this[u] = r3[u] && r3[u] !== "fade" ? r3[u] : s2 || "fade", this.placement = r3.placement ? r3.placement : a2 || y, this[c] = parseInt(r3[c] || g2) || 200, this.dismissible = !(!r3.dismissible && p2 !== "true"), this.container = b2 || w2 || x2 || E2 || S2 || t2[i2]; + var A2 = this, C2 = r3.title || n3[h]("data-title") || null, k2 = r3.content || n3[h]("data-content") || null; + if (k2 || this.template) { + var D2 = null, L2 = 0, q2 = this.placement, H2 = function(e3) { + D2 !== null && e3[l] === N(".close", D2) && A2.hide(); + }, U2 = function(r4) { + A2.trigger != "click" && A2.trigger != "focus" || !A2.dismissible && r4(n3, "blur", A2.hide), A2.dismissible && r4(t2, "click", H2), r4(e2, "resize", A2.hide, P); + }, $2 = function() { + U2(M), F.call(n3, "shown", "popover"); + }, W2 = function() { + U2(R), A2.container.removeChild(D2), L2 = null, D2 = null, F.call(n3, "hidden", "popover"); + }; + this.toggle = function() { + D2 === null ? A2.show() : A2.hide(); + }, this.show = function() { + clearTimeout(L2), L2 = setTimeout(function() { + D2 === null && (q2 = A2.placement, function() { + C2 = r3.title || n3[h]("data-title"), k2 = (k2 = r3.content || n3[h]("data-content")) ? k2.trim() : null, D2 = t2.createElement("div"); + var e3 = t2.createElement("div"); + if (e3[f]("class", "arrow"), D2.appendChild(e3), k2 !== null && A2.template === null) { + if (D2[f]("role", "tooltip"), C2 !== null) { + var i3 = t2.createElement("h3"); + i3[f]("class", "popover-header"), i3.innerHTML = A2.dismissible ? C2 + _2 : C2, D2.appendChild(i3); + } + var o4 = t2.createElement("div"); + o4[f]("class", "popover-body"), o4.innerHTML = A2.dismissible && C2 === null ? k2 + _2 : k2, D2.appendChild(o4); + } else { + var s3 = t2.createElement("div"); + A2.template = A2.template.trim(), s3.innerHTML = A2.template, D2.innerHTML = s3.firstChild.innerHTML; + } + A2.container.appendChild(D2), D2[m].display = "block", D2[f]("class", "popover bs-popover-" + q2 + " " + A2[u]); + }(), B(n3, D2, q2, A2.container), !O(D2, "show") && j(D2, "show"), F.call(n3, "show", "popover"), A2[u] ? z(D2, $2) : $2()); + }, 20); + }, this.hide = function() { + clearTimeout(L2), L2 = setTimeout(function() { + D2 && D2 !== null && O(D2, "show") && (F.call(n3, "hide", "popover"), T(D2, "show"), A2[u] ? z(D2, W2) : W2()); + }, A2[c]); + }, "Popover" in n3 || (A2.trigger === "hover" ? (M(n3, d[0], A2.show), A2.dismissible || M(n3, d[1], A2.hide)) : A2.trigger != "click" && A2.trigger != "focus" || M(n3, A2.trigger, A2.toggle)), n3.Popover = A2; + } + }; + s[v](["Popover", G, "[" + a + '="popover"]']); + var V = function(e3, t3) { + var n3 = (e3 = N(e3))[h]("data-height"); + t3 = t3 || {}, this.height = !!x && (t3.height || n3 === "true"); + var r3, i3, o3, s2, a2, c2, l2, u2 = this, d2 = I(e3, ".nav"), v2 = false, y2 = d2 && N(".dropdown-toggle", d2), w2 = function() { + v2[m].height = "", T(v2, "collapsing"), d2.isAnimating = false; + }, S2 = function() { + v2 ? c2 ? w2() : setTimeout(function() { + v2[m].height = l2 + "px", v2.offsetWidth, z(v2, w2); + }, 50) : d2.isAnimating = false, F.call(r3, "shown", "tab", i3); + }, E2 = function() { + v2 && (o3[m].float = b, s2[m].float = b, a2 = o3.scrollHeight), j(s2, _), F.call(r3, "show", "tab", i3), T(o3, _), F.call(i3, "hidden", "tab", r3), v2 && (l2 = s2.scrollHeight, c2 = l2 === a2, j(v2, "collapsing"), v2[m].height = a2 + "px", v2.offsetHeight, o3[m].float = "", s2[m].float = ""), O(s2, "fade") ? setTimeout(function() { + j(s2, "show"), z(s2, S2); + }, 20) : S2(); + }; + if (d2) { + d2.isAnimating = false; + var A2 = function() { + var e4, t4 = k(d2, _); + return t4[g] !== 1 || O(t4[0][p], "dropdown") ? t4[g] > 1 && (e4 = t4[t4[g] - 1]) : e4 = t4[0], e4; + }, C2 = function() { + return N(A2()[h]("href")); + }; + this.show = function() { + s2 = N((r3 = r3 || e3)[h]("href")), i3 = A2(), o3 = C2(), d2.isAnimating = true, T(i3, _), i3[f]("aria-selected", "false"), j(r3, _), r3[f]("aria-selected", "true"), y2 && (O(e3[p], "dropdown-menu") ? O(y2, _) || j(y2, _) : O(y2, _) && T(y2, _)), F.call(i3, "hide", "tab", r3), O(o3, "fade") ? (T(o3, "show"), z(o3, E2)) : E2(); + }, "Tab" in e3 || M(e3, "click", function(e4) { + e4.preventDefault(), r3 = e4.currentTarget, !d2.isAnimating && !O(r3, _) && u2.show(); + }), u2.height && (v2 = C2()[p]), e3.Tab = u2; + } + }; + s[v](["Tab", V, "[" + a + '="tab"]']); + var J = function(e3, t3) { + t3 = t3 || {}; + var n3 = (e3 = N(e3))[h]("data-animation"), r3 = e3[h]("data-autohide"), i3 = e3[h]("data-delay"); + this.animation = t3.animation === false || n3 === "false" ? 0 : 1, this.autohide = t3.autohide === false || r3 === "false" ? 0 : 1, this[c] = parseInt(t3[c] || i3) || 500; + var o3 = this, s2 = 0, a2 = I(e3, ".toast"), l2 = function() { + T(a2, "showing"), j(a2, "show"), F.call(a2, "shown", "toast"), o3.autohide && o3.hide(); + }, u2 = function() { + j(a2, "hide"), F.call(a2, "hidden", "toast"); + }, d2 = function() { + T(a2, "show"), o3.animation ? z(a2, u2) : u2(); + }, f2 = function() { + clearTimeout(s2), s2 = null, j(a2, "hide"), R(e3, "click", o3.hide), e3.Toast = null, e3 = null, a2 = null; + }; + this.show = function() { + a2 && (F.call(a2, "show", "toast"), o3.animation && j(a2, "fade"), T(a2, "hide"), j(a2, "showing"), o3.animation ? z(a2, l2) : l2()); + }, this.hide = function(e4) { + a2 && O(a2, "show") && (F.call(a2, "hide", "toast"), e4 ? d2() : s2 = setTimeout(d2, o3[c])); + }, this.dispose = function() { + a2 && O(a2, "show") && (T(a2, "show"), o3.animation ? z(a2, f2) : f2()); + }, "Toast" in e3 || M(e3, "click", o3.hide), e3.Toast = o3; + }; + s[v](["Toast", J, '[data-dismiss="toast"]']); + var X = function(n3, r3) { + r3 = r3 || {}; + var o3 = (n3 = N(n3))[h]("data-animation"), s2 = n3[h]("data-placement"), a2 = n3[h]("data-delay"), l2 = n3[h]("data-container"), p2 = N(r3.container), g2 = N(l2), v2 = I(n3, ".modal"), _2 = I(n3, ".fixed-top"), w2 = I(n3, ".fixed-bottom"); + this[u] = r3[u] && r3[u] !== "fade" ? r3[u] : o3 || "fade", this.placement = r3.placement ? r3.placement : s2 || y, this[c] = parseInt(r3[c] || a2) || 200, this.container = p2 || g2 || _2 || w2 || v2 || t2[i2]; + var S2 = this, x2 = 0, E2 = this.placement, A2 = null, C2 = n3[h]("title") || n3[h]("data-title") || n3[h]("data-original-title"); + if (C2 && C2 != "") { + var k2 = function() { + M(e2, "resize", S2.hide, P), F.call(n3, "shown", "tooltip"); + }, D2 = function() { + R(e2, "resize", S2.hide, P), S2.container.removeChild(A2), A2 = null, x2 = null, F.call(n3, "hidden", "tooltip"); + }; + this.show = function() { + clearTimeout(x2), x2 = setTimeout(function() { + A2 === null && (E2 = S2.placement, function() { + if ((C2 = n3[h]("title") || n3[h]("data-title") || n3[h]("data-original-title")) && C2 !== "") { + (A2 = t2.createElement("div"))[f]("role", "tooltip"), A2[m][b] = "0", A2[m].top = "0"; + var e3 = t2.createElement("div"); + e3[f]("class", "arrow"), A2.appendChild(e3); + var r4 = t2.createElement("div"); + r4[f]("class", "tooltip-inner"), A2.appendChild(r4), r4.innerHTML = C2, S2.container.appendChild(A2), A2[f]("class", "tooltip bs-tooltip-" + E2 + " " + S2[u]); + } + }() !== false && (B(n3, A2, E2, S2.container), !O(A2, "show") && j(A2, "show"), F.call(n3, "show", "tooltip"), S2[u] ? z(A2, k2) : k2())); + }, 20); + }, this.hide = function() { + clearTimeout(x2), x2 = setTimeout(function() { + A2 && O(A2, "show") && (F.call(n3, "hide", "tooltip"), T(A2, "show"), S2[u] ? z(A2, D2) : D2()); + }, S2[c]); + }, this.toggle = function() { + A2 ? S2.hide() : S2.show(); + }, "Tooltip" in n3 || (n3[f]("data-original-title", C2), n3.removeAttribute("title"), M(n3, d[0], S2.show), M(n3, d[1], S2.hide)), n3.Tooltip = S2; + } + }; + s[v](["Tooltip", X, "[" + a + '="tooltip"]']); + var Q = function(e3, t3) { + for (var n3 = 0, r3 = t3[g]; n3 < r3; n3++) + new e3(t3[n3]); + }, Y = o2.initCallback = function(e3) { + e3 = e3 || t2; + for (var n3 = 0, r3 = s[g]; n3 < r3; n3++) + Q(s[n3][1], e3.querySelectorAll(s[n3][2])); + }; + return t2[i2] ? Y() : M(t2, "DOMContentLoaded", function() { + Y(); + }), {Alert: q, Button: H, Collapse: U, Dropdown: $, Modal: W, Popover: G, Tab: V, Toast: J, Tooltip: X}; + }) == "function" ? r.apply(t, i) : r) === void 0 || (e.exports = o); + }).call(this, n(12)); + }, function(e, t, n) { + var r, i, o; + /*! + * URI.js - Mutating URLs + * + * Version: 1.19.2 + * + * Author: Rodney Rehm + * Web: http://medialize.github.io/URI.js/ + * + * Licensed under + * MIT License http://www.opensource.org/licenses/mit-license + * + */ + !function(s, a) { + e.exports ? e.exports = a(n(155), n(156), n(157)) : (i = [n(155), n(156), n(157)], (o = typeof (r = a) == "function" ? r.apply(t, i) : r) === void 0 || (e.exports = o)); + }(0, function(e2, t2, n2, r2) { + var i2 = r2 && r2.URI; + function o2(e3, t3) { + var n3 = arguments.length >= 1, r3 = arguments.length >= 2; + if (!(this instanceof o2)) + return n3 ? r3 ? new o2(e3, t3) : new o2(e3) : new o2(); + if (e3 === void 0) { + if (n3) + throw new TypeError("undefined is not a valid argument for URI"); + e3 = typeof location != "undefined" ? location.href + "" : ""; + } + if (e3 === null && n3) + throw new TypeError("null is not a valid argument for URI"); + return this.href(e3), t3 !== void 0 ? this.absoluteTo(t3) : this; + } + o2.version = "1.19.2"; + var s = o2.prototype, a = Object.prototype.hasOwnProperty; + function c(e3) { + return e3.replace(/([.*+?^=!:${}()|[\]\/\\])/g, "\\$1"); + } + function l(e3) { + return e3 === void 0 ? "Undefined" : String(Object.prototype.toString.call(e3)).slice(8, -1); + } + function u(e3) { + return l(e3) === "Array"; + } + function d(e3, t3) { + var n3, r3, i3 = {}; + if (l(t3) === "RegExp") + i3 = null; + else if (u(t3)) + for (n3 = 0, r3 = t3.length; n3 < r3; n3++) + i3[t3[n3]] = true; + else + i3[t3] = true; + for (n3 = 0, r3 = e3.length; n3 < r3; n3++) { + (i3 && i3[e3[n3]] !== void 0 || !i3 && t3.test(e3[n3])) && (e3.splice(n3, 1), r3--, n3--); + } + return e3; + } + function h(e3, t3) { + var n3, r3; + if (u(t3)) { + for (n3 = 0, r3 = t3.length; n3 < r3; n3++) + if (!h(e3, t3[n3])) + return false; + return true; + } + var i3 = l(t3); + for (n3 = 0, r3 = e3.length; n3 < r3; n3++) + if (i3 === "RegExp") { + if (typeof e3[n3] == "string" && e3[n3].match(t3)) + return true; + } else if (e3[n3] === t3) + return true; + return false; + } + function f(e3, t3) { + if (!u(e3) || !u(t3)) + return false; + if (e3.length !== t3.length) + return false; + e3.sort(), t3.sort(); + for (var n3 = 0, r3 = e3.length; n3 < r3; n3++) + if (e3[n3] !== t3[n3]) + return false; + return true; + } + function p(e3) { + return e3.replace(/^\/+|\/+$/g, ""); + } + function g(e3) { + return escape(e3); + } + function m(e3) { + return encodeURIComponent(e3).replace(/[!'()*]/g, g).replace(/\*/g, "%2A"); + } + o2._parts = function() { + return {protocol: null, username: null, password: null, hostname: null, urn: null, port: null, path: null, query: null, fragment: null, preventInvalidHostname: o2.preventInvalidHostname, duplicateQueryParameters: o2.duplicateQueryParameters, escapeQuerySpace: o2.escapeQuerySpace}; + }, o2.preventInvalidHostname = false, o2.duplicateQueryParameters = false, o2.escapeQuerySpace = true, o2.protocol_expression = /^[a-z][a-z0-9.+-]*$/i, o2.idn_expression = /[^a-z0-9\._-]/i, o2.punycode_expression = /(xn--)/i, o2.ip4_expression = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/, o2.ip6_expression = /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/, o2.find_uri_expression = /\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“â€â€˜â€™]))/gi, o2.findUri = {start: /\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi, end: /[\s\r\n]|$/, trim: /[`!()\[\]{};:'".,<>?«»“â€â€žâ€˜â€™]+$/, parens: /(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g}, o2.defaultPorts = {http: "80", https: "443", ftp: "21", gopher: "70", ws: "80", wss: "443"}, o2.hostProtocols = ["http", "https"], o2.invalid_hostname_characters = /[^a-zA-Z0-9\.\-:_]/, o2.domAttributes = {a: "href", blockquote: "cite", link: "href", base: "href", script: "src", form: "action", img: "src", area: "href", iframe: "src", embed: "src", source: "src", track: "src", input: "src", audio: "src", video: "src"}, o2.getDomAttribute = function(e3) { + if (e3 && e3.nodeName) { + var t3 = e3.nodeName.toLowerCase(); + if (t3 !== "input" || e3.type === "image") + return o2.domAttributes[t3]; + } + }, o2.encode = m, o2.decode = decodeURIComponent, o2.iso8859 = function() { + o2.encode = escape, o2.decode = unescape; + }, o2.unicode = function() { + o2.encode = m, o2.decode = decodeURIComponent; + }, o2.characters = {pathname: {encode: {expression: /%(24|26|2B|2C|3B|3D|3A|40)/gi, map: {"%24": "$", "%26": "&", "%2B": "+", "%2C": ",", "%3B": ";", "%3D": "=", "%3A": ":", "%40": "@"}}, decode: {expression: /[\/\?#]/g, map: {"/": "%2F", "?": "%3F", "#": "%23"}}}, reserved: {encode: {expression: /%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/gi, map: {"%3A": ":", "%2F": "/", "%3F": "?", "%23": "#", "%5B": "[", "%5D": "]", "%40": "@", "%21": "!", "%24": "$", "%26": "&", "%27": "'", "%28": "(", "%29": ")", "%2A": "*", "%2B": "+", "%2C": ",", "%3B": ";", "%3D": "="}}}, urnpath: {encode: {expression: /%(21|24|27|28|29|2A|2B|2C|3B|3D|40)/gi, map: {"%21": "!", "%24": "$", "%27": "'", "%28": "(", "%29": ")", "%2A": "*", "%2B": "+", "%2C": ",", "%3B": ";", "%3D": "=", "%40": "@"}}, decode: {expression: /[\/\?#:]/g, map: {"/": "%2F", "?": "%3F", "#": "%23", ":": "%3A"}}}}, o2.encodeQuery = function(e3, t3) { + var n3 = o2.encode(e3 + ""); + return t3 === void 0 && (t3 = o2.escapeQuerySpace), t3 ? n3.replace(/%20/g, "+") : n3; + }, o2.decodeQuery = function(e3, t3) { + e3 += "", t3 === void 0 && (t3 = o2.escapeQuerySpace); + try { + return o2.decode(t3 ? e3.replace(/\+/g, "%20") : e3); + } catch (t4) { + return e3; + } + }; + var v, _ = {encode: "encode", decode: "decode"}, b = function(e3, t3) { + return function(n3) { + try { + return o2[t3](n3 + "").replace(o2.characters[e3][t3].expression, function(n4) { + return o2.characters[e3][t3].map[n4]; + }); + } catch (e4) { + return n3; + } + }; + }; + for (v in _) + o2[v + "PathSegment"] = b("pathname", _[v]), o2[v + "UrnPathSegment"] = b("urnpath", _[v]); + var y = function(e3, t3, n3) { + return function(r3) { + var i3; + i3 = n3 ? function(e4) { + return o2[t3](o2[n3](e4)); + } : o2[t3]; + for (var s2 = (r3 + "").split(e3), a2 = 0, c2 = s2.length; a2 < c2; a2++) + s2[a2] = i3(s2[a2]); + return s2.join(e3); + }; + }; + function w(e3) { + return function(t3, n3) { + return t3 === void 0 ? this._parts[e3] || "" : (this._parts[e3] = t3 || null, this.build(!n3), this); + }; + } + function S(e3, t3) { + return function(n3, r3) { + return n3 === void 0 ? this._parts[e3] || "" : (n3 !== null && (n3 += "").charAt(0) === t3 && (n3 = n3.substring(1)), this._parts[e3] = n3, this.build(!r3), this); + }; + } + o2.decodePath = y("/", "decodePathSegment"), o2.decodeUrnPath = y(":", "decodeUrnPathSegment"), o2.recodePath = y("/", "encodePathSegment", "decode"), o2.recodeUrnPath = y(":", "encodeUrnPathSegment", "decode"), o2.encodeReserved = b("reserved", "encode"), o2.parse = function(e3, t3) { + var n3; + return t3 || (t3 = {preventInvalidHostname: o2.preventInvalidHostname}), (n3 = e3.indexOf("#")) > -1 && (t3.fragment = e3.substring(n3 + 1) || null, e3 = e3.substring(0, n3)), (n3 = e3.indexOf("?")) > -1 && (t3.query = e3.substring(n3 + 1) || null, e3 = e3.substring(0, n3)), e3.substring(0, 2) === "//" ? (t3.protocol = null, e3 = e3.substring(2), e3 = o2.parseAuthority(e3, t3)) : (n3 = e3.indexOf(":")) > -1 && (t3.protocol = e3.substring(0, n3) || null, t3.protocol && !t3.protocol.match(o2.protocol_expression) ? t3.protocol = void 0 : e3.substring(n3 + 1, n3 + 3) === "//" ? (e3 = e3.substring(n3 + 3), e3 = o2.parseAuthority(e3, t3)) : (e3 = e3.substring(n3 + 1), t3.urn = true)), t3.path = e3, t3; + }, o2.parseHost = function(e3, t3) { + e3 || (e3 = ""); + var n3, r3, i3 = (e3 = e3.replace(/\\/g, "/")).indexOf("/"); + if (i3 === -1 && (i3 = e3.length), e3.charAt(0) === "[") + n3 = e3.indexOf("]"), t3.hostname = e3.substring(1, n3) || null, t3.port = e3.substring(n3 + 2, i3) || null, t3.port === "/" && (t3.port = null); + else { + var s2 = e3.indexOf(":"), a2 = e3.indexOf("/"), c2 = e3.indexOf(":", s2 + 1); + c2 !== -1 && (a2 === -1 || c2 < a2) ? (t3.hostname = e3.substring(0, i3) || null, t3.port = null) : (r3 = e3.substring(0, i3).split(":"), t3.hostname = r3[0] || null, t3.port = r3[1] || null); + } + return t3.hostname && e3.substring(i3).charAt(0) !== "/" && (i3++, e3 = "/" + e3), t3.preventInvalidHostname && o2.ensureValidHostname(t3.hostname, t3.protocol), t3.port && o2.ensureValidPort(t3.port), e3.substring(i3) || "/"; + }, o2.parseAuthority = function(e3, t3) { + return e3 = o2.parseUserinfo(e3, t3), o2.parseHost(e3, t3); + }, o2.parseUserinfo = function(e3, t3) { + var n3, r3 = e3.indexOf("/"), i3 = e3.lastIndexOf("@", r3 > -1 ? r3 : e3.length - 1); + return i3 > -1 && (r3 === -1 || i3 < r3) ? (n3 = e3.substring(0, i3).split(":"), t3.username = n3[0] ? o2.decode(n3[0]) : null, n3.shift(), t3.password = n3[0] ? o2.decode(n3.join(":")) : null, e3 = e3.substring(i3 + 1)) : (t3.username = null, t3.password = null), e3; + }, o2.parseQuery = function(e3, t3) { + if (!e3) + return {}; + if (!(e3 = e3.replace(/&+/g, "&").replace(/^\?*&*|&+$/g, ""))) + return {}; + for (var n3, r3, i3, s2 = {}, c2 = e3.split("&"), l2 = c2.length, u2 = 0; u2 < l2; u2++) + n3 = c2[u2].split("="), r3 = o2.decodeQuery(n3.shift(), t3), i3 = n3.length ? o2.decodeQuery(n3.join("="), t3) : null, a.call(s2, r3) ? (typeof s2[r3] != "string" && s2[r3] !== null || (s2[r3] = [s2[r3]]), s2[r3].push(i3)) : s2[r3] = i3; + return s2; + }, o2.build = function(e3) { + var t3 = "", n3 = false; + return e3.protocol && (t3 += e3.protocol + ":"), e3.urn || !t3 && !e3.hostname || (t3 += "//", n3 = true), t3 += o2.buildAuthority(e3) || "", typeof e3.path == "string" && (e3.path.charAt(0) !== "/" && n3 && (t3 += "/"), t3 += e3.path), typeof e3.query == "string" && e3.query && (t3 += "?" + e3.query), typeof e3.fragment == "string" && e3.fragment && (t3 += "#" + e3.fragment), t3; + }, o2.buildHost = function(e3) { + var t3 = ""; + return e3.hostname ? (o2.ip6_expression.test(e3.hostname) ? t3 += "[" + e3.hostname + "]" : t3 += e3.hostname, e3.port && (t3 += ":" + e3.port), t3) : ""; + }, o2.buildAuthority = function(e3) { + return o2.buildUserinfo(e3) + o2.buildHost(e3); + }, o2.buildUserinfo = function(e3) { + var t3 = ""; + return e3.username && (t3 += o2.encode(e3.username)), e3.password && (t3 += ":" + o2.encode(e3.password)), t3 && (t3 += "@"), t3; + }, o2.buildQuery = function(e3, t3, n3) { + var r3, i3, s2, c2, l2 = ""; + for (i3 in e3) + if (a.call(e3, i3)) + if (u(e3[i3])) + for (r3 = {}, s2 = 0, c2 = e3[i3].length; s2 < c2; s2++) + e3[i3][s2] !== void 0 && r3[e3[i3][s2] + ""] === void 0 && (l2 += "&" + o2.buildQueryParameter(i3, e3[i3][s2], n3), t3 !== true && (r3[e3[i3][s2] + ""] = true)); + else + e3[i3] !== void 0 && (l2 += "&" + o2.buildQueryParameter(i3, e3[i3], n3)); + return l2.substring(1); + }, o2.buildQueryParameter = function(e3, t3, n3) { + return o2.encodeQuery(e3, n3) + (t3 !== null ? "=" + o2.encodeQuery(t3, n3) : ""); + }, o2.addQuery = function(e3, t3, n3) { + if (typeof t3 == "object") + for (var r3 in t3) + a.call(t3, r3) && o2.addQuery(e3, r3, t3[r3]); + else { + if (typeof t3 != "string") + throw new TypeError("URI.addQuery() accepts an object, string as the name parameter"); + if (e3[t3] === void 0) + return void (e3[t3] = n3); + typeof e3[t3] == "string" && (e3[t3] = [e3[t3]]), u(n3) || (n3 = [n3]), e3[t3] = (e3[t3] || []).concat(n3); + } + }, o2.setQuery = function(e3, t3, n3) { + if (typeof t3 == "object") + for (var r3 in t3) + a.call(t3, r3) && o2.setQuery(e3, r3, t3[r3]); + else { + if (typeof t3 != "string") + throw new TypeError("URI.setQuery() accepts an object, string as the name parameter"); + e3[t3] = n3 === void 0 ? null : n3; + } + }, o2.removeQuery = function(e3, t3, n3) { + var r3, i3, s2; + if (u(t3)) + for (r3 = 0, i3 = t3.length; r3 < i3; r3++) + e3[t3[r3]] = void 0; + else if (l(t3) === "RegExp") + for (s2 in e3) + t3.test(s2) && (e3[s2] = void 0); + else if (typeof t3 == "object") + for (s2 in t3) + a.call(t3, s2) && o2.removeQuery(e3, s2, t3[s2]); + else { + if (typeof t3 != "string") + throw new TypeError("URI.removeQuery() accepts an object, string, RegExp as the first parameter"); + n3 !== void 0 ? l(n3) === "RegExp" ? !u(e3[t3]) && n3.test(e3[t3]) ? e3[t3] = void 0 : e3[t3] = d(e3[t3], n3) : e3[t3] !== String(n3) || u(n3) && n3.length !== 1 ? u(e3[t3]) && (e3[t3] = d(e3[t3], n3)) : e3[t3] = void 0 : e3[t3] = void 0; + } + }, o2.hasQuery = function(e3, t3, n3, r3) { + switch (l(t3)) { + case "String": + break; + case "RegExp": + for (var i3 in e3) + if (a.call(e3, i3) && t3.test(i3) && (n3 === void 0 || o2.hasQuery(e3, i3, n3))) + return true; + return false; + case "Object": + for (var s2 in t3) + if (a.call(t3, s2) && !o2.hasQuery(e3, s2, t3[s2])) + return false; + return true; + default: + throw new TypeError("URI.hasQuery() accepts a string, regular expression or object as the name parameter"); + } + switch (l(n3)) { + case "Undefined": + return t3 in e3; + case "Boolean": + return n3 === Boolean(u(e3[t3]) ? e3[t3].length : e3[t3]); + case "Function": + return !!n3(e3[t3], t3, e3); + case "Array": + return !!u(e3[t3]) && (r3 ? h : f)(e3[t3], n3); + case "RegExp": + return u(e3[t3]) ? !!r3 && h(e3[t3], n3) : Boolean(e3[t3] && e3[t3].match(n3)); + case "Number": + n3 = String(n3); + case "String": + return u(e3[t3]) ? !!r3 && h(e3[t3], n3) : e3[t3] === n3; + default: + throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter"); + } + }, o2.joinPaths = function() { + for (var e3 = [], t3 = [], n3 = 0, r3 = 0; r3 < arguments.length; r3++) { + var i3 = new o2(arguments[r3]); + e3.push(i3); + for (var s2 = i3.segment(), a2 = 0; a2 < s2.length; a2++) + typeof s2[a2] == "string" && t3.push(s2[a2]), s2[a2] && n3++; + } + if (!t3.length || !n3) + return new o2(""); + var c2 = new o2("").segment(t3); + return e3[0].path() !== "" && e3[0].path().slice(0, 1) !== "/" || c2.path("/" + c2.path()), c2.normalize(); + }, o2.commonPath = function(e3, t3) { + var n3, r3 = Math.min(e3.length, t3.length); + for (n3 = 0; n3 < r3; n3++) + if (e3.charAt(n3) !== t3.charAt(n3)) { + n3--; + break; + } + return n3 < 1 ? e3.charAt(0) === t3.charAt(0) && e3.charAt(0) === "/" ? "/" : "" : (e3.charAt(n3) === "/" && t3.charAt(n3) === "/" || (n3 = e3.substring(0, n3).lastIndexOf("/")), e3.substring(0, n3 + 1)); + }, o2.withinString = function(e3, t3, n3) { + n3 || (n3 = {}); + var r3 = n3.start || o2.findUri.start, i3 = n3.end || o2.findUri.end, s2 = n3.trim || o2.findUri.trim, a2 = n3.parens || o2.findUri.parens, c2 = /[a-z0-9-]=["']?$/i; + for (r3.lastIndex = 0; ; ) { + var l2 = r3.exec(e3); + if (!l2) + break; + var u2 = l2.index; + if (n3.ignoreHtml) { + var d2 = e3.slice(Math.max(u2 - 3, 0), u2); + if (d2 && c2.test(d2)) + continue; + } + for (var h2 = u2 + e3.slice(u2).search(i3), f2 = e3.slice(u2, h2), p2 = -1; ; ) { + var g2 = a2.exec(f2); + if (!g2) + break; + var m2 = g2.index + g2[0].length; + p2 = Math.max(p2, m2); + } + if (!((f2 = p2 > -1 ? f2.slice(0, p2) + f2.slice(p2).replace(s2, "") : f2.replace(s2, "")).length <= l2[0].length || n3.ignore && n3.ignore.test(f2))) { + var v2 = t3(f2, u2, h2 = u2 + f2.length, e3); + v2 !== void 0 ? (v2 = String(v2), e3 = e3.slice(0, u2) + v2 + e3.slice(h2), r3.lastIndex = u2 + v2.length) : r3.lastIndex = h2; + } + } + return r3.lastIndex = 0, e3; + }, o2.ensureValidHostname = function(t3, n3) { + var r3 = !!t3, i3 = false; + if (!!n3 && (i3 = h(o2.hostProtocols, n3)), i3 && !r3) + throw new TypeError("Hostname cannot be empty, if protocol is " + n3); + if (t3 && t3.match(o2.invalid_hostname_characters)) { + if (!e2) + throw new TypeError('Hostname "' + t3 + '" contains characters other than [A-Z0-9.-:_] and Punycode.js is not available'); + if (e2.toASCII(t3).match(o2.invalid_hostname_characters)) + throw new TypeError('Hostname "' + t3 + '" contains characters other than [A-Z0-9.-:_]'); + } + }, o2.ensureValidPort = function(e3) { + if (e3) { + var t3 = Number(e3); + if (!(/^[0-9]+$/.test(t3) && t3 > 0 && t3 < 65536)) + throw new TypeError('Port "' + e3 + '" is not a valid port'); + } + }, o2.noConflict = function(e3) { + if (e3) { + var t3 = {URI: this.noConflict()}; + return r2.URITemplate && typeof r2.URITemplate.noConflict == "function" && (t3.URITemplate = r2.URITemplate.noConflict()), r2.IPv6 && typeof r2.IPv6.noConflict == "function" && (t3.IPv6 = r2.IPv6.noConflict()), r2.SecondLevelDomains && typeof r2.SecondLevelDomains.noConflict == "function" && (t3.SecondLevelDomains = r2.SecondLevelDomains.noConflict()), t3; + } + return r2.URI === this && (r2.URI = i2), this; + }, s.build = function(e3) { + return e3 === true ? this._deferred_build = true : (e3 === void 0 || this._deferred_build) && (this._string = o2.build(this._parts), this._deferred_build = false), this; + }, s.clone = function() { + return new o2(this); + }, s.valueOf = s.toString = function() { + return this.build(false)._string; + }, s.protocol = w("protocol"), s.username = w("username"), s.password = w("password"), s.hostname = w("hostname"), s.port = w("port"), s.query = S("query", "?"), s.fragment = S("fragment", "#"), s.search = function(e3, t3) { + var n3 = this.query(e3, t3); + return typeof n3 == "string" && n3.length ? "?" + n3 : n3; + }, s.hash = function(e3, t3) { + var n3 = this.fragment(e3, t3); + return typeof n3 == "string" && n3.length ? "#" + n3 : n3; + }, s.pathname = function(e3, t3) { + if (e3 === void 0 || e3 === true) { + var n3 = this._parts.path || (this._parts.hostname ? "/" : ""); + return e3 ? (this._parts.urn ? o2.decodeUrnPath : o2.decodePath)(n3) : n3; + } + return this._parts.urn ? this._parts.path = e3 ? o2.recodeUrnPath(e3) : "" : this._parts.path = e3 ? o2.recodePath(e3) : "/", this.build(!t3), this; + }, s.path = s.pathname, s.href = function(e3, t3) { + var n3; + if (e3 === void 0) + return this.toString(); + this._string = "", this._parts = o2._parts(); + var r3 = e3 instanceof o2, i3 = typeof e3 == "object" && (e3.hostname || e3.path || e3.pathname); + e3.nodeName && (e3 = e3[o2.getDomAttribute(e3)] || "", i3 = false); + if (!r3 && i3 && e3.pathname !== void 0 && (e3 = e3.toString()), typeof e3 == "string" || e3 instanceof String) + this._parts = o2.parse(String(e3), this._parts); + else { + if (!r3 && !i3) + throw new TypeError("invalid input"); + var s2 = r3 ? e3._parts : e3; + for (n3 in s2) + n3 !== "query" && a.call(this._parts, n3) && (this._parts[n3] = s2[n3]); + s2.query && this.query(s2.query, false); + } + return this.build(!t3), this; + }, s.is = function(e3) { + var t3 = false, r3 = false, i3 = false, s2 = false, a2 = false, c2 = false, l2 = false, u2 = !this._parts.urn; + switch (this._parts.hostname && (u2 = false, r3 = o2.ip4_expression.test(this._parts.hostname), i3 = o2.ip6_expression.test(this._parts.hostname), a2 = (s2 = !(t3 = r3 || i3)) && n2 && n2.has(this._parts.hostname), c2 = s2 && o2.idn_expression.test(this._parts.hostname), l2 = s2 && o2.punycode_expression.test(this._parts.hostname)), e3.toLowerCase()) { + case "relative": + return u2; + case "absolute": + return !u2; + case "domain": + case "name": + return s2; + case "sld": + return a2; + case "ip": + return t3; + case "ip4": + case "ipv4": + case "inet4": + return r3; + case "ip6": + case "ipv6": + case "inet6": + return i3; + case "idn": + return c2; + case "url": + return !this._parts.urn; + case "urn": + return !!this._parts.urn; + case "punycode": + return l2; + } + return null; + }; + var x = s.protocol, E = s.port, A = s.hostname; + s.protocol = function(e3, t3) { + if (e3 && !(e3 = e3.replace(/:(\/\/)?$/, "")).match(o2.protocol_expression)) + throw new TypeError('Protocol "' + e3 + `" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]`); + return x.call(this, e3, t3); + }, s.scheme = s.protocol, s.port = function(e3, t3) { + return this._parts.urn ? e3 === void 0 ? "" : this : (e3 !== void 0 && (e3 === 0 && (e3 = null), e3 && ((e3 += "").charAt(0) === ":" && (e3 = e3.substring(1)), o2.ensureValidPort(e3))), E.call(this, e3, t3)); + }, s.hostname = function(e3, t3) { + if (this._parts.urn) + return e3 === void 0 ? "" : this; + if (e3 !== void 0) { + var n3 = {preventInvalidHostname: this._parts.preventInvalidHostname}; + if (o2.parseHost(e3, n3) !== "/") + throw new TypeError('Hostname "' + e3 + '" contains characters other than [A-Z0-9.-]'); + e3 = n3.hostname, this._parts.preventInvalidHostname && o2.ensureValidHostname(e3, this._parts.protocol); + } + return A.call(this, e3, t3); + }, s.origin = function(e3, t3) { + if (this._parts.urn) + return e3 === void 0 ? "" : this; + if (e3 === void 0) { + var n3 = this.protocol(); + return this.authority() ? (n3 ? n3 + "://" : "") + this.authority() : ""; + } + var r3 = o2(e3); + return this.protocol(r3.protocol()).authority(r3.authority()).build(!t3), this; + }, s.host = function(e3, t3) { + if (this._parts.urn) + return e3 === void 0 ? "" : this; + if (e3 === void 0) + return this._parts.hostname ? o2.buildHost(this._parts) : ""; + if (o2.parseHost(e3, this._parts) !== "/") + throw new TypeError('Hostname "' + e3 + '" contains characters other than [A-Z0-9.-]'); + return this.build(!t3), this; + }, s.authority = function(e3, t3) { + if (this._parts.urn) + return e3 === void 0 ? "" : this; + if (e3 === void 0) + return this._parts.hostname ? o2.buildAuthority(this._parts) : ""; + if (o2.parseAuthority(e3, this._parts) !== "/") + throw new TypeError('Hostname "' + e3 + '" contains characters other than [A-Z0-9.-]'); + return this.build(!t3), this; + }, s.userinfo = function(e3, t3) { + if (this._parts.urn) + return e3 === void 0 ? "" : this; + if (e3 === void 0) { + var n3 = o2.buildUserinfo(this._parts); + return n3 ? n3.substring(0, n3.length - 1) : n3; + } + return e3[e3.length - 1] !== "@" && (e3 += "@"), o2.parseUserinfo(e3, this._parts), this.build(!t3), this; + }, s.resource = function(e3, t3) { + var n3; + return e3 === void 0 ? this.path() + this.search() + this.hash() : (n3 = o2.parse(e3), this._parts.path = n3.path, this._parts.query = n3.query, this._parts.fragment = n3.fragment, this.build(!t3), this); + }, s.subdomain = function(e3, t3) { + if (this._parts.urn) + return e3 === void 0 ? "" : this; + if (e3 === void 0) { + if (!this._parts.hostname || this.is("IP")) + return ""; + var n3 = this._parts.hostname.length - this.domain().length - 1; + return this._parts.hostname.substring(0, n3) || ""; + } + var r3 = this._parts.hostname.length - this.domain().length, i3 = this._parts.hostname.substring(0, r3), s2 = new RegExp("^" + c(i3)); + if (e3 && e3.charAt(e3.length - 1) !== "." && (e3 += "."), e3.indexOf(":") !== -1) + throw new TypeError("Domains cannot contain colons"); + return e3 && o2.ensureValidHostname(e3, this._parts.protocol), this._parts.hostname = this._parts.hostname.replace(s2, e3), this.build(!t3), this; + }, s.domain = function(e3, t3) { + if (this._parts.urn) + return e3 === void 0 ? "" : this; + if (typeof e3 == "boolean" && (t3 = e3, e3 = void 0), e3 === void 0) { + if (!this._parts.hostname || this.is("IP")) + return ""; + var n3 = this._parts.hostname.match(/\./g); + if (n3 && n3.length < 2) + return this._parts.hostname; + var r3 = this._parts.hostname.length - this.tld(t3).length - 1; + return r3 = this._parts.hostname.lastIndexOf(".", r3 - 1) + 1, this._parts.hostname.substring(r3) || ""; + } + if (!e3) + throw new TypeError("cannot set domain empty"); + if (e3.indexOf(":") !== -1) + throw new TypeError("Domains cannot contain colons"); + if (o2.ensureValidHostname(e3, this._parts.protocol), !this._parts.hostname || this.is("IP")) + this._parts.hostname = e3; + else { + var i3 = new RegExp(c(this.domain()) + "$"); + this._parts.hostname = this._parts.hostname.replace(i3, e3); + } + return this.build(!t3), this; + }, s.tld = function(e3, t3) { + if (this._parts.urn) + return e3 === void 0 ? "" : this; + if (typeof e3 == "boolean" && (t3 = e3, e3 = void 0), e3 === void 0) { + if (!this._parts.hostname || this.is("IP")) + return ""; + var r3 = this._parts.hostname.lastIndexOf("."), i3 = this._parts.hostname.substring(r3 + 1); + return t3 !== true && n2 && n2.list[i3.toLowerCase()] && n2.get(this._parts.hostname) || i3; + } + var o3; + if (!e3) + throw new TypeError("cannot set TLD empty"); + if (e3.match(/[^a-zA-Z0-9-]/)) { + if (!n2 || !n2.is(e3)) + throw new TypeError('TLD "' + e3 + '" contains characters other than [A-Z0-9]'); + o3 = new RegExp(c(this.tld()) + "$"), this._parts.hostname = this._parts.hostname.replace(o3, e3); + } else { + if (!this._parts.hostname || this.is("IP")) + throw new ReferenceError("cannot set TLD on non-domain host"); + o3 = new RegExp(c(this.tld()) + "$"), this._parts.hostname = this._parts.hostname.replace(o3, e3); + } + return this.build(!t3), this; + }, s.directory = function(e3, t3) { + if (this._parts.urn) + return e3 === void 0 ? "" : this; + if (e3 === void 0 || e3 === true) { + if (!this._parts.path && !this._parts.hostname) + return ""; + if (this._parts.path === "/") + return "/"; + var n3 = this._parts.path.length - this.filename().length - 1, r3 = this._parts.path.substring(0, n3) || (this._parts.hostname ? "/" : ""); + return e3 ? o2.decodePath(r3) : r3; + } + var i3 = this._parts.path.length - this.filename().length, s2 = this._parts.path.substring(0, i3), a2 = new RegExp("^" + c(s2)); + return this.is("relative") || (e3 || (e3 = "/"), e3.charAt(0) !== "/" && (e3 = "/" + e3)), e3 && e3.charAt(e3.length - 1) !== "/" && (e3 += "/"), e3 = o2.recodePath(e3), this._parts.path = this._parts.path.replace(a2, e3), this.build(!t3), this; + }, s.filename = function(e3, t3) { + if (this._parts.urn) + return e3 === void 0 ? "" : this; + if (typeof e3 != "string") { + if (!this._parts.path || this._parts.path === "/") + return ""; + var n3 = this._parts.path.lastIndexOf("/"), r3 = this._parts.path.substring(n3 + 1); + return e3 ? o2.decodePathSegment(r3) : r3; + } + var i3 = false; + e3.charAt(0) === "/" && (e3 = e3.substring(1)), e3.match(/\.?\//) && (i3 = true); + var s2 = new RegExp(c(this.filename()) + "$"); + return e3 = o2.recodePath(e3), this._parts.path = this._parts.path.replace(s2, e3), i3 ? this.normalizePath(t3) : this.build(!t3), this; + }, s.suffix = function(e3, t3) { + if (this._parts.urn) + return e3 === void 0 ? "" : this; + if (e3 === void 0 || e3 === true) { + if (!this._parts.path || this._parts.path === "/") + return ""; + var n3, r3, i3 = this.filename(), s2 = i3.lastIndexOf("."); + return s2 === -1 ? "" : (n3 = i3.substring(s2 + 1), r3 = /^[a-z0-9%]+$/i.test(n3) ? n3 : "", e3 ? o2.decodePathSegment(r3) : r3); + } + e3.charAt(0) === "." && (e3 = e3.substring(1)); + var a2, l2 = this.suffix(); + if (l2) + a2 = e3 ? new RegExp(c(l2) + "$") : new RegExp(c("." + l2) + "$"); + else { + if (!e3) + return this; + this._parts.path += "." + o2.recodePath(e3); + } + return a2 && (e3 = o2.recodePath(e3), this._parts.path = this._parts.path.replace(a2, e3)), this.build(!t3), this; + }, s.segment = function(e3, t3, n3) { + var r3 = this._parts.urn ? ":" : "/", i3 = this.path(), o3 = i3.substring(0, 1) === "/", s2 = i3.split(r3); + if (e3 !== void 0 && typeof e3 != "number" && (n3 = t3, t3 = e3, e3 = void 0), e3 !== void 0 && typeof e3 != "number") + throw new Error('Bad segment "' + e3 + '", must be 0-based integer'); + if (o3 && s2.shift(), e3 < 0 && (e3 = Math.max(s2.length + e3, 0)), t3 === void 0) + return e3 === void 0 ? s2 : s2[e3]; + if (e3 === null || s2[e3] === void 0) + if (u(t3)) { + s2 = []; + for (var a2 = 0, c2 = t3.length; a2 < c2; a2++) + (t3[a2].length || s2.length && s2[s2.length - 1].length) && (s2.length && !s2[s2.length - 1].length && s2.pop(), s2.push(p(t3[a2]))); + } else + (t3 || typeof t3 == "string") && (t3 = p(t3), s2[s2.length - 1] === "" ? s2[s2.length - 1] = t3 : s2.push(t3)); + else + t3 ? s2[e3] = p(t3) : s2.splice(e3, 1); + return o3 && s2.unshift(""), this.path(s2.join(r3), n3); + }, s.segmentCoded = function(e3, t3, n3) { + var r3, i3, s2; + if (typeof e3 != "number" && (n3 = t3, t3 = e3, e3 = void 0), t3 === void 0) { + if (u(r3 = this.segment(e3, t3, n3))) + for (i3 = 0, s2 = r3.length; i3 < s2; i3++) + r3[i3] = o2.decode(r3[i3]); + else + r3 = r3 !== void 0 ? o2.decode(r3) : void 0; + return r3; + } + if (u(t3)) + for (i3 = 0, s2 = t3.length; i3 < s2; i3++) + t3[i3] = o2.encode(t3[i3]); + else + t3 = typeof t3 == "string" || t3 instanceof String ? o2.encode(t3) : t3; + return this.segment(e3, t3, n3); + }; + var C = s.query; + return s.query = function(e3, t3) { + if (e3 === true) + return o2.parseQuery(this._parts.query, this._parts.escapeQuerySpace); + if (typeof e3 == "function") { + var n3 = o2.parseQuery(this._parts.query, this._parts.escapeQuerySpace), r3 = e3.call(this, n3); + return this._parts.query = o2.buildQuery(r3 || n3, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace), this.build(!t3), this; + } + return e3 !== void 0 && typeof e3 != "string" ? (this._parts.query = o2.buildQuery(e3, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace), this.build(!t3), this) : C.call(this, e3, t3); + }, s.setQuery = function(e3, t3, n3) { + var r3 = o2.parseQuery(this._parts.query, this._parts.escapeQuerySpace); + if (typeof e3 == "string" || e3 instanceof String) + r3[e3] = t3 !== void 0 ? t3 : null; + else { + if (typeof e3 != "object") + throw new TypeError("URI.addQuery() accepts an object, string as the name parameter"); + for (var i3 in e3) + a.call(e3, i3) && (r3[i3] = e3[i3]); + } + return this._parts.query = o2.buildQuery(r3, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace), typeof e3 != "string" && (n3 = t3), this.build(!n3), this; + }, s.addQuery = function(e3, t3, n3) { + var r3 = o2.parseQuery(this._parts.query, this._parts.escapeQuerySpace); + return o2.addQuery(r3, e3, t3 === void 0 ? null : t3), this._parts.query = o2.buildQuery(r3, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace), typeof e3 != "string" && (n3 = t3), this.build(!n3), this; + }, s.removeQuery = function(e3, t3, n3) { + var r3 = o2.parseQuery(this._parts.query, this._parts.escapeQuerySpace); + return o2.removeQuery(r3, e3, t3), this._parts.query = o2.buildQuery(r3, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace), typeof e3 != "string" && (n3 = t3), this.build(!n3), this; + }, s.hasQuery = function(e3, t3, n3) { + var r3 = o2.parseQuery(this._parts.query, this._parts.escapeQuerySpace); + return o2.hasQuery(r3, e3, t3, n3); + }, s.setSearch = s.setQuery, s.addSearch = s.addQuery, s.removeSearch = s.removeQuery, s.hasSearch = s.hasQuery, s.normalize = function() { + return this._parts.urn ? this.normalizeProtocol(false).normalizePath(false).normalizeQuery(false).normalizeFragment(false).build() : this.normalizeProtocol(false).normalizeHostname(false).normalizePort(false).normalizePath(false).normalizeQuery(false).normalizeFragment(false).build(); + }, s.normalizeProtocol = function(e3) { + return typeof this._parts.protocol == "string" && (this._parts.protocol = this._parts.protocol.toLowerCase(), this.build(!e3)), this; + }, s.normalizeHostname = function(n3) { + return this._parts.hostname && (this.is("IDN") && e2 ? this._parts.hostname = e2.toASCII(this._parts.hostname) : this.is("IPv6") && t2 && (this._parts.hostname = t2.best(this._parts.hostname)), this._parts.hostname = this._parts.hostname.toLowerCase(), this.build(!n3)), this; + }, s.normalizePort = function(e3) { + return typeof this._parts.protocol == "string" && this._parts.port === o2.defaultPorts[this._parts.protocol] && (this._parts.port = null, this.build(!e3)), this; + }, s.normalizePath = function(e3) { + var t3, n3 = this._parts.path; + if (!n3) + return this; + if (this._parts.urn) + return this._parts.path = o2.recodeUrnPath(this._parts.path), this.build(!e3), this; + if (this._parts.path === "/") + return this; + var r3, i3, s2 = ""; + for ((n3 = o2.recodePath(n3)).charAt(0) !== "/" && (t3 = true, n3 = "/" + n3), n3.slice(-3) !== "/.." && n3.slice(-2) !== "/." || (n3 += "/"), n3 = n3.replace(/(\/(\.\/)+)|(\/\.$)/g, "/").replace(/\/{2,}/g, "/"), t3 && (s2 = n3.substring(1).match(/^(\.\.\/)+/) || "") && (s2 = s2[0]); (r3 = n3.search(/\/\.\.(\/|$)/)) !== -1; ) + r3 !== 0 ? ((i3 = n3.substring(0, r3).lastIndexOf("/")) === -1 && (i3 = r3), n3 = n3.substring(0, i3) + n3.substring(r3 + 3)) : n3 = n3.substring(3); + return t3 && this.is("relative") && (n3 = s2 + n3.substring(1)), this._parts.path = n3, this.build(!e3), this; + }, s.normalizePathname = s.normalizePath, s.normalizeQuery = function(e3) { + return typeof this._parts.query == "string" && (this._parts.query.length ? this.query(o2.parseQuery(this._parts.query, this._parts.escapeQuerySpace)) : this._parts.query = null, this.build(!e3)), this; + }, s.normalizeFragment = function(e3) { + return this._parts.fragment || (this._parts.fragment = null, this.build(!e3)), this; + }, s.normalizeSearch = s.normalizeQuery, s.normalizeHash = s.normalizeFragment, s.iso8859 = function() { + var e3 = o2.encode, t3 = o2.decode; + o2.encode = escape, o2.decode = decodeURIComponent; + try { + this.normalize(); + } finally { + o2.encode = e3, o2.decode = t3; + } + return this; + }, s.unicode = function() { + var e3 = o2.encode, t3 = o2.decode; + o2.encode = m, o2.decode = unescape; + try { + this.normalize(); + } finally { + o2.encode = e3, o2.decode = t3; + } + return this; + }, s.readable = function() { + var t3 = this.clone(); + t3.username("").password("").normalize(); + var n3 = ""; + if (t3._parts.protocol && (n3 += t3._parts.protocol + "://"), t3._parts.hostname && (t3.is("punycode") && e2 ? (n3 += e2.toUnicode(t3._parts.hostname), t3._parts.port && (n3 += ":" + t3._parts.port)) : n3 += t3.host()), t3._parts.hostname && t3._parts.path && t3._parts.path.charAt(0) !== "/" && (n3 += "/"), n3 += t3.path(true), t3._parts.query) { + for (var r3 = "", i3 = 0, s2 = t3._parts.query.split("&"), a2 = s2.length; i3 < a2; i3++) { + var c2 = (s2[i3] || "").split("="); + r3 += "&" + o2.decodeQuery(c2[0], this._parts.escapeQuerySpace).replace(/&/g, "%26"), c2[1] !== void 0 && (r3 += "=" + o2.decodeQuery(c2[1], this._parts.escapeQuerySpace).replace(/&/g, "%26")); + } + n3 += "?" + r3.substring(1); + } + return n3 += o2.decodeQuery(t3.hash(), true); + }, s.absoluteTo = function(e3) { + var t3, n3, r3, i3 = this.clone(), s2 = ["protocol", "username", "password", "hostname", "port"]; + if (this._parts.urn) + throw new Error("URNs do not have any generally defined hierarchical components"); + if (e3 instanceof o2 || (e3 = new o2(e3)), i3._parts.protocol) + return i3; + if (i3._parts.protocol = e3._parts.protocol, this._parts.hostname) + return i3; + for (n3 = 0; r3 = s2[n3]; n3++) + i3._parts[r3] = e3._parts[r3]; + return i3._parts.path ? (i3._parts.path.substring(-2) === ".." && (i3._parts.path += "/"), i3.path().charAt(0) !== "/" && (t3 = (t3 = e3.directory()) || (e3.path().indexOf("/") === 0 ? "/" : ""), i3._parts.path = (t3 ? t3 + "/" : "") + i3._parts.path, i3.normalizePath())) : (i3._parts.path = e3._parts.path, i3._parts.query || (i3._parts.query = e3._parts.query)), i3.build(), i3; + }, s.relativeTo = function(e3) { + var t3, n3, r3, i3, s2, a2 = this.clone().normalize(); + if (a2._parts.urn) + throw new Error("URNs do not have any generally defined hierarchical components"); + if (e3 = new o2(e3).normalize(), t3 = a2._parts, n3 = e3._parts, i3 = a2.path(), s2 = e3.path(), i3.charAt(0) !== "/") + throw new Error("URI is already relative"); + if (s2.charAt(0) !== "/") + throw new Error("Cannot calculate a URI relative to another relative URI"); + if (t3.protocol === n3.protocol && (t3.protocol = null), t3.username !== n3.username || t3.password !== n3.password) + return a2.build(); + if (t3.protocol !== null || t3.username !== null || t3.password !== null) + return a2.build(); + if (t3.hostname !== n3.hostname || t3.port !== n3.port) + return a2.build(); + if (t3.hostname = null, t3.port = null, i3 === s2) + return t3.path = "", a2.build(); + if (!(r3 = o2.commonPath(i3, s2))) + return a2.build(); + var c2 = n3.path.substring(r3.length).replace(/[^\/]*$/, "").replace(/.*?\//g, "../"); + return t3.path = c2 + t3.path.substring(r3.length) || "./", a2.build(); + }, s.equals = function(e3) { + var t3, n3, r3, i3, s2, c2 = this.clone(), l2 = new o2(e3), d2 = {}; + if (c2.normalize(), l2.normalize(), c2.toString() === l2.toString()) + return true; + if (r3 = c2.query(), i3 = l2.query(), c2.query(""), l2.query(""), c2.toString() !== l2.toString()) + return false; + if (r3.length !== i3.length) + return false; + for (s2 in t3 = o2.parseQuery(r3, this._parts.escapeQuerySpace), n3 = o2.parseQuery(i3, this._parts.escapeQuerySpace), t3) + if (a.call(t3, s2)) { + if (u(t3[s2])) { + if (!f(t3[s2], n3[s2])) + return false; + } else if (t3[s2] !== n3[s2]) + return false; + d2[s2] = true; + } + for (s2 in n3) + if (a.call(n3, s2) && !d2[s2]) + return false; + return true; + }, s.preventInvalidHostname = function(e3) { + return this._parts.preventInvalidHostname = !!e3, this; + }, s.duplicateQueryParameters = function(e3) { + return this._parts.duplicateQueryParameters = !!e3, this; + }, s.escapeQuerySpace = function(e3) { + return this._parts.escapeQuerySpace = !!e3, this; + }, o2; + }); + }, function(e, t, n) { + var r = n(113), i = n(29), o = n(114), s = n(70), a = n(92), c = Math.max; + e.exports = function(e2, t2, n2, l) { + e2 = i(e2) ? e2 : a(e2), n2 = n2 && !l ? s(n2) : 0; + var u = e2.length; + return n2 < 0 && (n2 = c(u + n2, 0)), o(e2) ? n2 <= u && e2.indexOf(t2, n2) > -1 : !!u && r(e2, t2, n2) > -1; + }; + }, function(e, t) { + var n = /^(?:0|[1-9]\d*)$/; + e.exports = function(e2, t2) { + var r = typeof e2; + return !!(t2 = t2 == null ? 9007199254740991 : t2) && (r == "number" || r != "symbol" && n.test(e2)) && e2 > -1 && e2 % 1 == 0 && e2 < t2; + }; + }, function(e, t) { + e.exports = function(e2) { + return e2; + }; + }, function(e, t, n) { + var r = n(48); + e.exports = function(e2) { + if (typeof e2 == "string" || r(e2)) + return e2; + var t2 = e2 + ""; + return t2 == "0" && 1 / e2 == -1 / 0 ? "-0" : t2; + }; + }, function(e, t, n) { + var r = n(27), i = n(451), o = n(452), s = Object.defineProperty; + t.f = n(32) ? Object.defineProperty : function(e2, t2, n2) { + if (r(e2), t2 = o(t2, true), r(n2), i) + try { + return s(e2, t2, n2); + } catch (e3) { + } + if ("get" in n2 || "set" in n2) + throw TypeError("Accessors not supported!"); + return "value" in n2 && (e2[t2] = n2.value), e2; + }; + }, function(e, t) { + e.exports = function(e2) { + return typeof e2 == "object" ? e2 !== null : typeof e2 == "function"; + }; + }, function(e, t) { + e.exports = {}; + }, function(e, t, n) { + (function(e2, r) { + var i; + /** + * @license + * Lodash <https://lodash.com/> + * Copyright OpenJS Foundation and other contributors <https://openjsf.org/> + * Released under MIT license <https://lodash.com/license> + * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ + (function() { + var o = "Expected a function", s = "__lodash_placeholder__", a = [["ary", 128], ["bind", 1], ["bindKey", 2], ["curry", 8], ["curryRight", 16], ["flip", 512], ["partial", 32], ["partialRight", 64], ["rearg", 256]], c = "[object Arguments]", l = "[object Array]", u = "[object Boolean]", d = "[object Date]", h = "[object Error]", f = "[object Function]", p = "[object GeneratorFunction]", g = "[object Map]", m = "[object Number]", v = "[object Object]", _ = "[object RegExp]", b = "[object Set]", y = "[object String]", w = "[object Symbol]", S = "[object WeakMap]", x = "[object ArrayBuffer]", E = "[object DataView]", A = "[object Float32Array]", C = "[object Float64Array]", j = "[object Int8Array]", T = "[object Int16Array]", O = "[object Int32Array]", k = "[object Uint8Array]", N = "[object Uint16Array]", I = "[object Uint32Array]", M = /\b__p \+= '';/g, R = /\b(__p \+=) '' \+/g, D = /(__e\(.*?\)|\b__t\)) \+\n'';/g, P = /&(?:amp|lt|gt|quot|#39);/g, L = /[&<>"']/g, z = RegExp(P.source), F = RegExp(L.source), B = /<%-([\s\S]+?)%>/g, q = /<%([\s\S]+?)%>/g, H = /<%=([\s\S]+?)%>/g, U = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, $ = /^\w*$/, W = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, G = /[\\^$.*+?()[\]{}|]/g, V = RegExp(G.source), J = /^\s+|\s+$/g, X = /^\s+/, Q = /\s+$/, Y = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, K = /\{\n\/\* \[wrapped with (.+)\] \*/, Z = /,? & /, ee = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g, te = /\\(\\)?/g, ne = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g, re = /\w*$/, ie = /^[-+]0x[0-9a-f]+$/i, oe = /^0b[01]+$/i, se = /^\[object .+?Constructor\]$/, ae = /^0o[0-7]+$/i, ce = /^(?:0|[1-9]\d*)$/, le = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, ue = /($^)/, de = /['\n\r\u2028\u2029\\]/g, he = "\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff", fe = "\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", pe = "[\\ud800-\\udfff]", ge = "[" + fe + "]", me = "[" + he + "]", ve = "\\d+", _e = "[\\u2700-\\u27bf]", be = "[a-z\\xdf-\\xf6\\xf8-\\xff]", ye = "[^\\ud800-\\udfff" + fe + ve + "\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]", we = "\\ud83c[\\udffb-\\udfff]", Se = "[^\\ud800-\\udfff]", xe = "(?:\\ud83c[\\udde6-\\uddff]){2}", Ee = "[\\ud800-\\udbff][\\udc00-\\udfff]", Ae = "[A-Z\\xc0-\\xd6\\xd8-\\xde]", Ce = "(?:" + be + "|" + ye + ")", je = "(?:" + Ae + "|" + ye + ")", Te = "(?:" + me + "|" + we + ")?", Oe = "[\\ufe0e\\ufe0f]?" + Te + ("(?:\\u200d(?:" + [Se, xe, Ee].join("|") + ")[\\ufe0e\\ufe0f]?" + Te + ")*"), ke = "(?:" + [_e, xe, Ee].join("|") + ")" + Oe, Ne = "(?:" + [Se + me + "?", me, xe, Ee, pe].join("|") + ")", Ie = RegExp("['\u2019]", "g"), Me = RegExp(me, "g"), Re = RegExp(we + "(?=" + we + ")|" + Ne + Oe, "g"), De = RegExp([Ae + "?" + be + "+(?:['\u2019](?:d|ll|m|re|s|t|ve))?(?=" + [ge, Ae, "$"].join("|") + ")", je + "+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?(?=" + [ge, Ae + Ce, "$"].join("|") + ")", Ae + "?" + Ce + "+(?:['\u2019](?:d|ll|m|re|s|t|ve))?", Ae + "+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?", "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", ve, ke].join("|"), "g"), Pe = RegExp("[\\u200d\\ud800-\\udfff" + he + "\\ufe0e\\ufe0f]"), Le = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/, ze = ["Array", "Buffer", "DataView", "Date", "Error", "Float32Array", "Float64Array", "Function", "Int8Array", "Int16Array", "Int32Array", "Map", "Math", "Object", "Promise", "RegExp", "Set", "String", "Symbol", "TypeError", "Uint8Array", "Uint8ClampedArray", "Uint16Array", "Uint32Array", "WeakMap", "_", "clearTimeout", "isFinite", "parseInt", "setTimeout"], Fe = -1, Be = {}; + Be[A] = Be[C] = Be[j] = Be[T] = Be[O] = Be[k] = Be["[object Uint8ClampedArray]"] = Be[N] = Be[I] = true, Be[c] = Be[l] = Be[x] = Be[u] = Be[E] = Be[d] = Be[h] = Be[f] = Be[g] = Be[m] = Be[v] = Be[_] = Be[b] = Be[y] = Be[S] = false; + var qe = {}; + qe[c] = qe[l] = qe[x] = qe[E] = qe[u] = qe[d] = qe[A] = qe[C] = qe[j] = qe[T] = qe[O] = qe[g] = qe[m] = qe[v] = qe[_] = qe[b] = qe[y] = qe[w] = qe[k] = qe["[object Uint8ClampedArray]"] = qe[N] = qe[I] = true, qe[h] = qe[f] = qe[S] = false; + var He = {"\\": "\\", "'": "'", "\n": "n", "\r": "r", "\u2028": "u2028", "\u2029": "u2029"}, Ue = parseFloat, $e = parseInt, We = typeof e2 == "object" && e2 && e2.Object === Object && e2, Ge = typeof self == "object" && self && self.Object === Object && self, Ve = We || Ge || Function("return this")(), Je = t && !t.nodeType && t, Xe = Je && typeof r == "object" && r && !r.nodeType && r, Qe = Xe && Xe.exports === Je, Ye = Qe && We.process, Ke = function() { + try { + var e3 = Xe && Xe.require && Xe.require("util").types; + return e3 || Ye && Ye.binding && Ye.binding("util"); + } catch (e4) { + } + }(), Ze = Ke && Ke.isArrayBuffer, et = Ke && Ke.isDate, tt = Ke && Ke.isMap, nt = Ke && Ke.isRegExp, rt = Ke && Ke.isSet, it = Ke && Ke.isTypedArray; + function ot(e3, t2, n2) { + switch (n2.length) { + case 0: + return e3.call(t2); + case 1: + return e3.call(t2, n2[0]); + case 2: + return e3.call(t2, n2[0], n2[1]); + case 3: + return e3.call(t2, n2[0], n2[1], n2[2]); + } + return e3.apply(t2, n2); + } + function st(e3, t2, n2, r2) { + for (var i2 = -1, o2 = e3 == null ? 0 : e3.length; ++i2 < o2; ) { + var s2 = e3[i2]; + t2(r2, s2, n2(s2), e3); + } + return r2; + } + function at(e3, t2) { + for (var n2 = -1, r2 = e3 == null ? 0 : e3.length; ++n2 < r2 && t2(e3[n2], n2, e3) !== false; ) + ; + return e3; + } + function ct(e3, t2) { + for (var n2 = e3 == null ? 0 : e3.length; n2-- && t2(e3[n2], n2, e3) !== false; ) + ; + return e3; + } + function lt(e3, t2) { + for (var n2 = -1, r2 = e3 == null ? 0 : e3.length; ++n2 < r2; ) + if (!t2(e3[n2], n2, e3)) + return false; + return true; + } + function ut(e3, t2) { + for (var n2 = -1, r2 = e3 == null ? 0 : e3.length, i2 = 0, o2 = []; ++n2 < r2; ) { + var s2 = e3[n2]; + t2(s2, n2, e3) && (o2[i2++] = s2); + } + return o2; + } + function dt(e3, t2) { + return !!(e3 == null ? 0 : e3.length) && wt(e3, t2, 0) > -1; + } + function ht(e3, t2, n2) { + for (var r2 = -1, i2 = e3 == null ? 0 : e3.length; ++r2 < i2; ) + if (n2(t2, e3[r2])) + return true; + return false; + } + function ft(e3, t2) { + for (var n2 = -1, r2 = e3 == null ? 0 : e3.length, i2 = Array(r2); ++n2 < r2; ) + i2[n2] = t2(e3[n2], n2, e3); + return i2; + } + function pt(e3, t2) { + for (var n2 = -1, r2 = t2.length, i2 = e3.length; ++n2 < r2; ) + e3[i2 + n2] = t2[n2]; + return e3; + } + function gt(e3, t2, n2, r2) { + var i2 = -1, o2 = e3 == null ? 0 : e3.length; + for (r2 && o2 && (n2 = e3[++i2]); ++i2 < o2; ) + n2 = t2(n2, e3[i2], i2, e3); + return n2; + } + function mt(e3, t2, n2, r2) { + var i2 = e3 == null ? 0 : e3.length; + for (r2 && i2 && (n2 = e3[--i2]); i2--; ) + n2 = t2(n2, e3[i2], i2, e3); + return n2; + } + function vt(e3, t2) { + for (var n2 = -1, r2 = e3 == null ? 0 : e3.length; ++n2 < r2; ) + if (t2(e3[n2], n2, e3)) + return true; + return false; + } + var _t = At("length"); + function bt(e3, t2, n2) { + var r2; + return n2(e3, function(e4, n3, i2) { + if (t2(e4, n3, i2)) + return r2 = n3, false; + }), r2; + } + function yt(e3, t2, n2, r2) { + for (var i2 = e3.length, o2 = n2 + (r2 ? 1 : -1); r2 ? o2-- : ++o2 < i2; ) + if (t2(e3[o2], o2, e3)) + return o2; + return -1; + } + function wt(e3, t2, n2) { + return t2 == t2 ? function(e4, t3, n3) { + var r2 = n3 - 1, i2 = e4.length; + for (; ++r2 < i2; ) + if (e4[r2] === t3) + return r2; + return -1; + }(e3, t2, n2) : yt(e3, xt, n2); + } + function St(e3, t2, n2, r2) { + for (var i2 = n2 - 1, o2 = e3.length; ++i2 < o2; ) + if (r2(e3[i2], t2)) + return i2; + return -1; + } + function xt(e3) { + return e3 != e3; + } + function Et(e3, t2) { + var n2 = e3 == null ? 0 : e3.length; + return n2 ? Tt(e3, t2) / n2 : NaN; + } + function At(e3) { + return function(t2) { + return t2 == null ? void 0 : t2[e3]; + }; + } + function Ct(e3) { + return function(t2) { + return e3 == null ? void 0 : e3[t2]; + }; + } + function jt(e3, t2, n2, r2, i2) { + return i2(e3, function(e4, i3, o2) { + n2 = r2 ? (r2 = false, e4) : t2(n2, e4, i3, o2); + }), n2; + } + function Tt(e3, t2) { + for (var n2, r2 = -1, i2 = e3.length; ++r2 < i2; ) { + var o2 = t2(e3[r2]); + o2 !== void 0 && (n2 = n2 === void 0 ? o2 : n2 + o2); + } + return n2; + } + function Ot(e3, t2) { + for (var n2 = -1, r2 = Array(e3); ++n2 < e3; ) + r2[n2] = t2(n2); + return r2; + } + function kt(e3) { + return function(t2) { + return e3(t2); + }; + } + function Nt(e3, t2) { + return ft(t2, function(t3) { + return e3[t3]; + }); + } + function It(e3, t2) { + return e3.has(t2); + } + function Mt(e3, t2) { + for (var n2 = -1, r2 = e3.length; ++n2 < r2 && wt(t2, e3[n2], 0) > -1; ) + ; + return n2; + } + function Rt(e3, t2) { + for (var n2 = e3.length; n2-- && wt(t2, e3[n2], 0) > -1; ) + ; + return n2; + } + function Dt(e3, t2) { + for (var n2 = e3.length, r2 = 0; n2--; ) + e3[n2] === t2 && ++r2; + return r2; + } + var Pt = Ct({\u00C0: "A", \u00C1: "A", \u00C2: "A", \u00C3: "A", \u00C4: "A", \u00C5: "A", \u00E0: "a", \u00E1: "a", \u00E2: "a", \u00E3: "a", \u00E4: "a", \u00E5: "a", \u00C7: "C", \u00E7: "c", \u00D0: "D", \u00F0: "d", \u00C8: "E", \u00C9: "E", \u00CA: "E", \u00CB: "E", \u00E8: "e", \u00E9: "e", \u00EA: "e", \u00EB: "e", \u00CC: "I", \u00CD: "I", \u00CE: "I", \u00CF: "I", \u00EC: "i", \u00ED: "i", \u00EE: "i", \u00EF: "i", \u00D1: "N", \u00F1: "n", \u00D2: "O", \u00D3: "O", \u00D4: "O", \u00D5: "O", \u00D6: "O", \u00D8: "O", \u00F2: "o", \u00F3: "o", \u00F4: "o", \u00F5: "o", \u00F6: "o", \u00F8: "o", \u00D9: "U", \u00DA: "U", \u00DB: "U", \u00DC: "U", \u00F9: "u", \u00FA: "u", \u00FB: "u", \u00FC: "u", \u00DD: "Y", \u00FD: "y", \u00FF: "y", \u00C6: "Ae", \u00E6: "ae", \u00DE: "Th", \u00FE: "th", \u00DF: "ss", \u0100: "A", \u0102: "A", \u0104: "A", \u0101: "a", \u0103: "a", \u0105: "a", \u0106: "C", \u0108: "C", \u010A: "C", \u010C: "C", \u0107: "c", \u0109: "c", \u010B: "c", \u010D: "c", \u010E: "D", \u0110: "D", \u010F: "d", \u0111: "d", \u0112: "E", \u0114: "E", \u0116: "E", \u0118: "E", \u011A: "E", \u0113: "e", \u0115: "e", \u0117: "e", \u0119: "e", \u011B: "e", \u011C: "G", \u011E: "G", \u0120: "G", \u0122: "G", \u011D: "g", \u011F: "g", \u0121: "g", \u0123: "g", \u0124: "H", \u0126: "H", \u0125: "h", \u0127: "h", \u0128: "I", \u012A: "I", \u012C: "I", \u012E: "I", \u0130: "I", \u0129: "i", \u012B: "i", \u012D: "i", \u012F: "i", \u0131: "i", \u0134: "J", \u0135: "j", \u0136: "K", \u0137: "k", \u0138: "k", \u0139: "L", \u013B: "L", \u013D: "L", \u013F: "L", \u0141: "L", \u013A: "l", \u013C: "l", \u013E: "l", \u0140: "l", \u0142: "l", \u0143: "N", \u0145: "N", \u0147: "N", \u014A: "N", \u0144: "n", \u0146: "n", \u0148: "n", \u014B: "n", \u014C: "O", \u014E: "O", \u0150: "O", \u014D: "o", \u014F: "o", \u0151: "o", \u0154: "R", \u0156: "R", \u0158: "R", \u0155: "r", \u0157: "r", \u0159: "r", \u015A: "S", \u015C: "S", \u015E: "S", \u0160: "S", \u015B: "s", \u015D: "s", \u015F: "s", \u0161: "s", \u0162: "T", \u0164: "T", \u0166: "T", \u0163: "t", \u0165: "t", \u0167: "t", \u0168: "U", \u016A: "U", \u016C: "U", \u016E: "U", \u0170: "U", \u0172: "U", \u0169: "u", \u016B: "u", \u016D: "u", \u016F: "u", \u0171: "u", \u0173: "u", \u0174: "W", \u0175: "w", \u0176: "Y", \u0177: "y", \u0178: "Y", \u0179: "Z", \u017B: "Z", \u017D: "Z", \u017A: "z", \u017C: "z", \u017E: "z", \u0132: "IJ", \u0133: "ij", \u0152: "Oe", \u0153: "oe", \u0149: "'n", \u017F: "s"}), Lt = Ct({"&": "&", "<": "<", ">": ">", '"': """, "'": "'"}); + function zt(e3) { + return "\\" + He[e3]; + } + function Ft(e3) { + return Pe.test(e3); + } + function Bt(e3) { + var t2 = -1, n2 = Array(e3.size); + return e3.forEach(function(e4, r2) { + n2[++t2] = [r2, e4]; + }), n2; + } + function qt(e3, t2) { + return function(n2) { + return e3(t2(n2)); + }; + } + function Ht(e3, t2) { + for (var n2 = -1, r2 = e3.length, i2 = 0, o2 = []; ++n2 < r2; ) { + var a2 = e3[n2]; + a2 !== t2 && a2 !== s || (e3[n2] = s, o2[i2++] = n2); + } + return o2; + } + function Ut(e3) { + var t2 = -1, n2 = Array(e3.size); + return e3.forEach(function(e4) { + n2[++t2] = e4; + }), n2; + } + function $t(e3) { + var t2 = -1, n2 = Array(e3.size); + return e3.forEach(function(e4) { + n2[++t2] = [e4, e4]; + }), n2; + } + function Wt(e3) { + return Ft(e3) ? function(e4) { + var t2 = Re.lastIndex = 0; + for (; Re.test(e4); ) + ++t2; + return t2; + }(e3) : _t(e3); + } + function Gt(e3) { + return Ft(e3) ? function(e4) { + return e4.match(Re) || []; + }(e3) : function(e4) { + return e4.split(""); + }(e3); + } + var Vt = Ct({"&": "&", "<": "<", ">": ">", """: '"', "'": "'"}); + var Jt = function e3(t2) { + var n2, r2 = (t2 = t2 == null ? Ve : Jt.defaults(Ve.Object(), t2, Jt.pick(Ve, ze))).Array, i2 = t2.Date, he2 = t2.Error, fe2 = t2.Function, pe2 = t2.Math, ge2 = t2.Object, me2 = t2.RegExp, ve2 = t2.String, _e2 = t2.TypeError, be2 = r2.prototype, ye2 = fe2.prototype, we2 = ge2.prototype, Se2 = t2["__core-js_shared__"], xe2 = ye2.toString, Ee2 = we2.hasOwnProperty, Ae2 = 0, Ce2 = (n2 = /[^.]+$/.exec(Se2 && Se2.keys && Se2.keys.IE_PROTO || "")) ? "Symbol(src)_1." + n2 : "", je2 = we2.toString, Te2 = xe2.call(ge2), Oe2 = Ve._, ke2 = me2("^" + xe2.call(Ee2).replace(G, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"), Ne2 = Qe ? t2.Buffer : void 0, Re2 = t2.Symbol, Pe2 = t2.Uint8Array, He2 = Ne2 ? Ne2.allocUnsafe : void 0, We2 = qt(ge2.getPrototypeOf, ge2), Ge2 = ge2.create, Je2 = we2.propertyIsEnumerable, Xe2 = be2.splice, Ye2 = Re2 ? Re2.isConcatSpreadable : void 0, Ke2 = Re2 ? Re2.iterator : void 0, _t2 = Re2 ? Re2.toStringTag : void 0, Ct2 = function() { + try { + var e4 = Zi(ge2, "defineProperty"); + return e4({}, "", {}), e4; + } catch (e5) { + } + }(), Xt = t2.clearTimeout !== Ve.clearTimeout && t2.clearTimeout, Qt = i2 && i2.now !== Ve.Date.now && i2.now, Yt = t2.setTimeout !== Ve.setTimeout && t2.setTimeout, Kt = pe2.ceil, Zt = pe2.floor, en = ge2.getOwnPropertySymbols, tn = Ne2 ? Ne2.isBuffer : void 0, nn = t2.isFinite, rn = be2.join, on = qt(ge2.keys, ge2), sn = pe2.max, an = pe2.min, cn = i2.now, ln = t2.parseInt, un = pe2.random, dn = be2.reverse, hn = Zi(t2, "DataView"), fn = Zi(t2, "Map"), pn = Zi(t2, "Promise"), gn = Zi(t2, "Set"), mn = Zi(t2, "WeakMap"), vn = Zi(ge2, "create"), _n = mn && new mn(), bn = {}, yn = jo(hn), wn = jo(fn), Sn = jo(pn), xn = jo(gn), En = jo(mn), An = Re2 ? Re2.prototype : void 0, Cn = An ? An.valueOf : void 0, jn = An ? An.toString : void 0; + function Tn(e4) { + if ($s(e4) && !Ms(e4) && !(e4 instanceof In)) { + if (e4 instanceof Nn) + return e4; + if (Ee2.call(e4, "__wrapped__")) + return To(e4); + } + return new Nn(e4); + } + var On = function() { + function e4() { + } + return function(t3) { + if (!Us(t3)) + return {}; + if (Ge2) + return Ge2(t3); + e4.prototype = t3; + var n3 = new e4(); + return e4.prototype = void 0, n3; + }; + }(); + function kn() { + } + function Nn(e4, t3) { + this.__wrapped__ = e4, this.__actions__ = [], this.__chain__ = !!t3, this.__index__ = 0, this.__values__ = void 0; + } + function In(e4) { + this.__wrapped__ = e4, this.__actions__ = [], this.__dir__ = 1, this.__filtered__ = false, this.__iteratees__ = [], this.__takeCount__ = 4294967295, this.__views__ = []; + } + function Mn(e4) { + var t3 = -1, n3 = e4 == null ? 0 : e4.length; + for (this.clear(); ++t3 < n3; ) { + var r3 = e4[t3]; + this.set(r3[0], r3[1]); + } + } + function Rn(e4) { + var t3 = -1, n3 = e4 == null ? 0 : e4.length; + for (this.clear(); ++t3 < n3; ) { + var r3 = e4[t3]; + this.set(r3[0], r3[1]); + } + } + function Dn(e4) { + var t3 = -1, n3 = e4 == null ? 0 : e4.length; + for (this.clear(); ++t3 < n3; ) { + var r3 = e4[t3]; + this.set(r3[0], r3[1]); + } + } + function Pn(e4) { + var t3 = -1, n3 = e4 == null ? 0 : e4.length; + for (this.__data__ = new Dn(); ++t3 < n3; ) + this.add(e4[t3]); + } + function Ln(e4) { + var t3 = this.__data__ = new Rn(e4); + this.size = t3.size; + } + function zn(e4, t3) { + var n3 = Ms(e4), r3 = !n3 && Is(e4), i3 = !n3 && !r3 && Ls(e4), o2 = !n3 && !r3 && !i3 && Ks(e4), s2 = n3 || r3 || i3 || o2, a2 = s2 ? Ot(e4.length, ve2) : [], c2 = a2.length; + for (var l2 in e4) + !t3 && !Ee2.call(e4, l2) || s2 && (l2 == "length" || i3 && (l2 == "offset" || l2 == "parent") || o2 && (l2 == "buffer" || l2 == "byteLength" || l2 == "byteOffset") || so(l2, c2)) || a2.push(l2); + return a2; + } + function Fn(e4) { + var t3 = e4.length; + return t3 ? e4[Pr(0, t3 - 1)] : void 0; + } + function Bn(e4, t3) { + return Eo(vi(e4), Xn(t3, 0, e4.length)); + } + function qn(e4) { + return Eo(vi(e4)); + } + function Hn(e4, t3, n3) { + (n3 !== void 0 && !Os(e4[t3], n3) || n3 === void 0 && !(t3 in e4)) && Vn(e4, t3, n3); + } + function Un(e4, t3, n3) { + var r3 = e4[t3]; + Ee2.call(e4, t3) && Os(r3, n3) && (n3 !== void 0 || t3 in e4) || Vn(e4, t3, n3); + } + function $n(e4, t3) { + for (var n3 = e4.length; n3--; ) + if (Os(e4[n3][0], t3)) + return n3; + return -1; + } + function Wn(e4, t3, n3, r3) { + return er(e4, function(e5, i3, o2) { + t3(r3, e5, n3(e5), o2); + }), r3; + } + function Gn(e4, t3) { + return e4 && _i(t3, ya(t3), e4); + } + function Vn(e4, t3, n3) { + t3 == "__proto__" && Ct2 ? Ct2(e4, t3, {configurable: true, enumerable: true, value: n3, writable: true}) : e4[t3] = n3; + } + function Jn(e4, t3) { + for (var n3 = -1, i3 = t3.length, o2 = r2(i3), s2 = e4 == null; ++n3 < i3; ) + o2[n3] = s2 ? void 0 : ga(e4, t3[n3]); + return o2; + } + function Xn(e4, t3, n3) { + return e4 == e4 && (n3 !== void 0 && (e4 = e4 <= n3 ? e4 : n3), t3 !== void 0 && (e4 = e4 >= t3 ? e4 : t3)), e4; + } + function Qn(e4, t3, n3, r3, i3, o2) { + var s2, a2 = 1 & t3, l2 = 2 & t3, h2 = 4 & t3; + if (n3 && (s2 = i3 ? n3(e4, r3, i3, o2) : n3(e4)), s2 !== void 0) + return s2; + if (!Us(e4)) + return e4; + var S2 = Ms(e4); + if (S2) { + if (s2 = function(e5) { + var t4 = e5.length, n4 = new e5.constructor(t4); + t4 && typeof e5[0] == "string" && Ee2.call(e5, "index") && (n4.index = e5.index, n4.input = e5.input); + return n4; + }(e4), !a2) + return vi(e4, s2); + } else { + var M2 = no(e4), R2 = M2 == f || M2 == p; + if (Ls(e4)) + return di(e4, a2); + if (M2 == v || M2 == c || R2 && !i3) { + if (s2 = l2 || R2 ? {} : io(e4), !a2) + return l2 ? function(e5, t4) { + return _i(e5, to(e5), t4); + }(e4, function(e5, t4) { + return e5 && _i(t4, wa(t4), e5); + }(s2, e4)) : function(e5, t4) { + return _i(e5, eo(e5), t4); + }(e4, Gn(s2, e4)); + } else { + if (!qe[M2]) + return i3 ? e4 : {}; + s2 = function(e5, t4, n4) { + var r4 = e5.constructor; + switch (t4) { + case x: + return hi(e5); + case u: + case d: + return new r4(+e5); + case E: + return function(e6, t5) { + var n5 = t5 ? hi(e6.buffer) : e6.buffer; + return new e6.constructor(n5, e6.byteOffset, e6.byteLength); + }(e5, n4); + case A: + case C: + case j: + case T: + case O: + case k: + case "[object Uint8ClampedArray]": + case N: + case I: + return fi(e5, n4); + case g: + return new r4(); + case m: + case y: + return new r4(e5); + case _: + return function(e6) { + var t5 = new e6.constructor(e6.source, re.exec(e6)); + return t5.lastIndex = e6.lastIndex, t5; + }(e5); + case b: + return new r4(); + case w: + return i4 = e5, Cn ? ge2(Cn.call(i4)) : {}; + } + var i4; + }(e4, M2, a2); + } + } + o2 || (o2 = new Ln()); + var D2 = o2.get(e4); + if (D2) + return D2; + o2.set(e4, s2), Xs(e4) ? e4.forEach(function(r4) { + s2.add(Qn(r4, t3, n3, r4, e4, o2)); + }) : Ws(e4) && e4.forEach(function(r4, i4) { + s2.set(i4, Qn(r4, t3, n3, i4, e4, o2)); + }); + var P2 = S2 ? void 0 : (h2 ? l2 ? Gi : Wi : l2 ? wa : ya)(e4); + return at(P2 || e4, function(r4, i4) { + P2 && (r4 = e4[i4 = r4]), Un(s2, i4, Qn(r4, t3, n3, i4, e4, o2)); + }), s2; + } + function Yn(e4, t3, n3) { + var r3 = n3.length; + if (e4 == null) + return !r3; + for (e4 = ge2(e4); r3--; ) { + var i3 = n3[r3], o2 = t3[i3], s2 = e4[i3]; + if (s2 === void 0 && !(i3 in e4) || !o2(s2)) + return false; + } + return true; + } + function Kn(e4, t3, n3) { + if (typeof e4 != "function") + throw new _e2(o); + return yo(function() { + e4.apply(void 0, n3); + }, t3); + } + function Zn(e4, t3, n3, r3) { + var i3 = -1, o2 = dt, s2 = true, a2 = e4.length, c2 = [], l2 = t3.length; + if (!a2) + return c2; + n3 && (t3 = ft(t3, kt(n3))), r3 ? (o2 = ht, s2 = false) : t3.length >= 200 && (o2 = It, s2 = false, t3 = new Pn(t3)); + e: + for (; ++i3 < a2; ) { + var u2 = e4[i3], d2 = n3 == null ? u2 : n3(u2); + if (u2 = r3 || u2 !== 0 ? u2 : 0, s2 && d2 == d2) { + for (var h2 = l2; h2--; ) + if (t3[h2] === d2) + continue e; + c2.push(u2); + } else + o2(t3, d2, r3) || c2.push(u2); + } + return c2; + } + Tn.templateSettings = {escape: B, evaluate: q, interpolate: H, variable: "", imports: {_: Tn}}, Tn.prototype = kn.prototype, Tn.prototype.constructor = Tn, Nn.prototype = On(kn.prototype), Nn.prototype.constructor = Nn, In.prototype = On(kn.prototype), In.prototype.constructor = In, Mn.prototype.clear = function() { + this.__data__ = vn ? vn(null) : {}, this.size = 0; + }, Mn.prototype.delete = function(e4) { + var t3 = this.has(e4) && delete this.__data__[e4]; + return this.size -= t3 ? 1 : 0, t3; + }, Mn.prototype.get = function(e4) { + var t3 = this.__data__; + if (vn) { + var n3 = t3[e4]; + return n3 === "__lodash_hash_undefined__" ? void 0 : n3; + } + return Ee2.call(t3, e4) ? t3[e4] : void 0; + }, Mn.prototype.has = function(e4) { + var t3 = this.__data__; + return vn ? t3[e4] !== void 0 : Ee2.call(t3, e4); + }, Mn.prototype.set = function(e4, t3) { + var n3 = this.__data__; + return this.size += this.has(e4) ? 0 : 1, n3[e4] = vn && t3 === void 0 ? "__lodash_hash_undefined__" : t3, this; + }, Rn.prototype.clear = function() { + this.__data__ = [], this.size = 0; + }, Rn.prototype.delete = function(e4) { + var t3 = this.__data__, n3 = $n(t3, e4); + return !(n3 < 0) && (n3 == t3.length - 1 ? t3.pop() : Xe2.call(t3, n3, 1), --this.size, true); + }, Rn.prototype.get = function(e4) { + var t3 = this.__data__, n3 = $n(t3, e4); + return n3 < 0 ? void 0 : t3[n3][1]; + }, Rn.prototype.has = function(e4) { + return $n(this.__data__, e4) > -1; + }, Rn.prototype.set = function(e4, t3) { + var n3 = this.__data__, r3 = $n(n3, e4); + return r3 < 0 ? (++this.size, n3.push([e4, t3])) : n3[r3][1] = t3, this; + }, Dn.prototype.clear = function() { + this.size = 0, this.__data__ = {hash: new Mn(), map: new (fn || Rn)(), string: new Mn()}; + }, Dn.prototype.delete = function(e4) { + var t3 = Yi(this, e4).delete(e4); + return this.size -= t3 ? 1 : 0, t3; + }, Dn.prototype.get = function(e4) { + return Yi(this, e4).get(e4); + }, Dn.prototype.has = function(e4) { + return Yi(this, e4).has(e4); + }, Dn.prototype.set = function(e4, t3) { + var n3 = Yi(this, e4), r3 = n3.size; + return n3.set(e4, t3), this.size += n3.size == r3 ? 0 : 1, this; + }, Pn.prototype.add = Pn.prototype.push = function(e4) { + return this.__data__.set(e4, "__lodash_hash_undefined__"), this; + }, Pn.prototype.has = function(e4) { + return this.__data__.has(e4); + }, Ln.prototype.clear = function() { + this.__data__ = new Rn(), this.size = 0; + }, Ln.prototype.delete = function(e4) { + var t3 = this.__data__, n3 = t3.delete(e4); + return this.size = t3.size, n3; + }, Ln.prototype.get = function(e4) { + return this.__data__.get(e4); + }, Ln.prototype.has = function(e4) { + return this.__data__.has(e4); + }, Ln.prototype.set = function(e4, t3) { + var n3 = this.__data__; + if (n3 instanceof Rn) { + var r3 = n3.__data__; + if (!fn || r3.length < 199) + return r3.push([e4, t3]), this.size = ++n3.size, this; + n3 = this.__data__ = new Dn(r3); + } + return n3.set(e4, t3), this.size = n3.size, this; + }; + var er = wi(cr), tr = wi(lr, true); + function nr(e4, t3) { + var n3 = true; + return er(e4, function(e5, r3, i3) { + return n3 = !!t3(e5, r3, i3); + }), n3; + } + function rr(e4, t3, n3) { + for (var r3 = -1, i3 = e4.length; ++r3 < i3; ) { + var o2 = e4[r3], s2 = t3(o2); + if (s2 != null && (a2 === void 0 ? s2 == s2 && !Ys(s2) : n3(s2, a2))) + var a2 = s2, c2 = o2; + } + return c2; + } + function ir(e4, t3) { + var n3 = []; + return er(e4, function(e5, r3, i3) { + t3(e5, r3, i3) && n3.push(e5); + }), n3; + } + function or(e4, t3, n3, r3, i3) { + var o2 = -1, s2 = e4.length; + for (n3 || (n3 = oo), i3 || (i3 = []); ++o2 < s2; ) { + var a2 = e4[o2]; + t3 > 0 && n3(a2) ? t3 > 1 ? or(a2, t3 - 1, n3, r3, i3) : pt(i3, a2) : r3 || (i3[i3.length] = a2); + } + return i3; + } + var sr = Si(), ar = Si(true); + function cr(e4, t3) { + return e4 && sr(e4, t3, ya); + } + function lr(e4, t3) { + return e4 && ar(e4, t3, ya); + } + function ur(e4, t3) { + return ut(t3, function(t4) { + return Bs(e4[t4]); + }); + } + function dr(e4, t3) { + for (var n3 = 0, r3 = (t3 = ai(t3, e4)).length; e4 != null && n3 < r3; ) + e4 = e4[Co(t3[n3++])]; + return n3 && n3 == r3 ? e4 : void 0; + } + function hr(e4, t3, n3) { + var r3 = t3(e4); + return Ms(e4) ? r3 : pt(r3, n3(e4)); + } + function fr(e4) { + return e4 == null ? e4 === void 0 ? "[object Undefined]" : "[object Null]" : _t2 && _t2 in ge2(e4) ? function(e5) { + var t3 = Ee2.call(e5, _t2), n3 = e5[_t2]; + try { + e5[_t2] = void 0; + var r3 = true; + } catch (e6) { + } + var i3 = je2.call(e5); + r3 && (t3 ? e5[_t2] = n3 : delete e5[_t2]); + return i3; + }(e4) : function(e5) { + return je2.call(e5); + }(e4); + } + function pr(e4, t3) { + return e4 > t3; + } + function gr(e4, t3) { + return e4 != null && Ee2.call(e4, t3); + } + function mr(e4, t3) { + return e4 != null && t3 in ge2(e4); + } + function vr(e4, t3, n3) { + for (var i3 = n3 ? ht : dt, o2 = e4[0].length, s2 = e4.length, a2 = s2, c2 = r2(s2), l2 = 1 / 0, u2 = []; a2--; ) { + var d2 = e4[a2]; + a2 && t3 && (d2 = ft(d2, kt(t3))), l2 = an(d2.length, l2), c2[a2] = !n3 && (t3 || o2 >= 120 && d2.length >= 120) ? new Pn(a2 && d2) : void 0; + } + d2 = e4[0]; + var h2 = -1, f2 = c2[0]; + e: + for (; ++h2 < o2 && u2.length < l2; ) { + var p2 = d2[h2], g2 = t3 ? t3(p2) : p2; + if (p2 = n3 || p2 !== 0 ? p2 : 0, !(f2 ? It(f2, g2) : i3(u2, g2, n3))) { + for (a2 = s2; --a2; ) { + var m2 = c2[a2]; + if (!(m2 ? It(m2, g2) : i3(e4[a2], g2, n3))) + continue e; + } + f2 && f2.push(g2), u2.push(p2); + } + } + return u2; + } + function _r(e4, t3, n3) { + var r3 = (e4 = mo(e4, t3 = ai(t3, e4))) == null ? e4 : e4[Co(Fo(t3))]; + return r3 == null ? void 0 : ot(r3, e4, n3); + } + function br(e4) { + return $s(e4) && fr(e4) == c; + } + function yr(e4, t3, n3, r3, i3) { + return e4 === t3 || (e4 == null || t3 == null || !$s(e4) && !$s(t3) ? e4 != e4 && t3 != t3 : function(e5, t4, n4, r4, i4, o2) { + var s2 = Ms(e5), a2 = Ms(t4), f2 = s2 ? l : no(e5), p2 = a2 ? l : no(t4), S2 = (f2 = f2 == c ? v : f2) == v, A2 = (p2 = p2 == c ? v : p2) == v, C2 = f2 == p2; + if (C2 && Ls(e5)) { + if (!Ls(t4)) + return false; + s2 = true, S2 = false; + } + if (C2 && !S2) + return o2 || (o2 = new Ln()), s2 || Ks(e5) ? Ui(e5, t4, n4, r4, i4, o2) : function(e6, t5, n5, r5, i5, o3, s3) { + switch (n5) { + case E: + if (e6.byteLength != t5.byteLength || e6.byteOffset != t5.byteOffset) + return false; + e6 = e6.buffer, t5 = t5.buffer; + case x: + return !(e6.byteLength != t5.byteLength || !o3(new Pe2(e6), new Pe2(t5))); + case u: + case d: + case m: + return Os(+e6, +t5); + case h: + return e6.name == t5.name && e6.message == t5.message; + case _: + case y: + return e6 == t5 + ""; + case g: + var a3 = Bt; + case b: + var c2 = 1 & r5; + if (a3 || (a3 = Ut), e6.size != t5.size && !c2) + return false; + var l2 = s3.get(e6); + if (l2) + return l2 == t5; + r5 |= 2, s3.set(e6, t5); + var f3 = Ui(a3(e6), a3(t5), r5, i5, o3, s3); + return s3.delete(e6), f3; + case w: + if (Cn) + return Cn.call(e6) == Cn.call(t5); + } + return false; + }(e5, t4, f2, n4, r4, i4, o2); + if (!(1 & n4)) { + var j2 = S2 && Ee2.call(e5, "__wrapped__"), T2 = A2 && Ee2.call(t4, "__wrapped__"); + if (j2 || T2) { + var O2 = j2 ? e5.value() : e5, k2 = T2 ? t4.value() : t4; + return o2 || (o2 = new Ln()), i4(O2, k2, n4, r4, o2); + } + } + if (!C2) + return false; + return o2 || (o2 = new Ln()), function(e6, t5, n5, r5, i5, o3) { + var s3 = 1 & n5, a3 = Wi(e6), c2 = a3.length, l2 = Wi(t5).length; + if (c2 != l2 && !s3) + return false; + var u2 = c2; + for (; u2--; ) { + var d2 = a3[u2]; + if (!(s3 ? d2 in t5 : Ee2.call(t5, d2))) + return false; + } + var h2 = o3.get(e6), f3 = o3.get(t5); + if (h2 && f3) + return h2 == t5 && f3 == e6; + var p3 = true; + o3.set(e6, t5), o3.set(t5, e6); + var g2 = s3; + for (; ++u2 < c2; ) { + d2 = a3[u2]; + var m2 = e6[d2], v2 = t5[d2]; + if (r5) + var _2 = s3 ? r5(v2, m2, d2, t5, e6, o3) : r5(m2, v2, d2, e6, t5, o3); + if (!(_2 === void 0 ? m2 === v2 || i5(m2, v2, n5, r5, o3) : _2)) { + p3 = false; + break; + } + g2 || (g2 = d2 == "constructor"); + } + if (p3 && !g2) { + var b2 = e6.constructor, y2 = t5.constructor; + b2 == y2 || !("constructor" in e6) || !("constructor" in t5) || typeof b2 == "function" && b2 instanceof b2 && typeof y2 == "function" && y2 instanceof y2 || (p3 = false); + } + return o3.delete(e6), o3.delete(t5), p3; + }(e5, t4, n4, r4, i4, o2); + }(e4, t3, n3, r3, yr, i3)); + } + function wr(e4, t3, n3, r3) { + var i3 = n3.length, o2 = i3, s2 = !r3; + if (e4 == null) + return !o2; + for (e4 = ge2(e4); i3--; ) { + var a2 = n3[i3]; + if (s2 && a2[2] ? a2[1] !== e4[a2[0]] : !(a2[0] in e4)) + return false; + } + for (; ++i3 < o2; ) { + var c2 = (a2 = n3[i3])[0], l2 = e4[c2], u2 = a2[1]; + if (s2 && a2[2]) { + if (l2 === void 0 && !(c2 in e4)) + return false; + } else { + var d2 = new Ln(); + if (r3) + var h2 = r3(l2, u2, c2, e4, t3, d2); + if (!(h2 === void 0 ? yr(u2, l2, 3, r3, d2) : h2)) + return false; + } + } + return true; + } + function Sr(e4) { + return !(!Us(e4) || (t3 = e4, Ce2 && Ce2 in t3)) && (Bs(e4) ? ke2 : se).test(jo(e4)); + var t3; + } + function xr(e4) { + return typeof e4 == "function" ? e4 : e4 == null ? Ga : typeof e4 == "object" ? Ms(e4) ? Or(e4[0], e4[1]) : Tr(e4) : tc(e4); + } + function Er(e4) { + if (!ho(e4)) + return on(e4); + var t3 = []; + for (var n3 in ge2(e4)) + Ee2.call(e4, n3) && n3 != "constructor" && t3.push(n3); + return t3; + } + function Ar(e4) { + if (!Us(e4)) + return function(e5) { + var t4 = []; + if (e5 != null) + for (var n4 in ge2(e5)) + t4.push(n4); + return t4; + }(e4); + var t3 = ho(e4), n3 = []; + for (var r3 in e4) + (r3 != "constructor" || !t3 && Ee2.call(e4, r3)) && n3.push(r3); + return n3; + } + function Cr(e4, t3) { + return e4 < t3; + } + function jr(e4, t3) { + var n3 = -1, i3 = Ds(e4) ? r2(e4.length) : []; + return er(e4, function(e5, r3, o2) { + i3[++n3] = t3(e5, r3, o2); + }), i3; + } + function Tr(e4) { + var t3 = Ki(e4); + return t3.length == 1 && t3[0][2] ? po(t3[0][0], t3[0][1]) : function(n3) { + return n3 === e4 || wr(n3, e4, t3); + }; + } + function Or(e4, t3) { + return co(e4) && fo(t3) ? po(Co(e4), t3) : function(n3) { + var r3 = ga(n3, e4); + return r3 === void 0 && r3 === t3 ? ma(n3, e4) : yr(t3, r3, 3); + }; + } + function kr(e4, t3, n3, r3, i3) { + e4 !== t3 && sr(t3, function(o2, s2) { + if (i3 || (i3 = new Ln()), Us(o2)) + !function(e5, t4, n4, r4, i4, o3, s3) { + var a3 = _o(e5, n4), c2 = _o(t4, n4), l2 = s3.get(c2); + if (l2) + return void Hn(e5, n4, l2); + var u2 = o3 ? o3(a3, c2, n4 + "", e5, t4, s3) : void 0, d2 = u2 === void 0; + if (d2) { + var h2 = Ms(c2), f2 = !h2 && Ls(c2), p2 = !h2 && !f2 && Ks(c2); + u2 = c2, h2 || f2 || p2 ? Ms(a3) ? u2 = a3 : Ps(a3) ? u2 = vi(a3) : f2 ? (d2 = false, u2 = di(c2, true)) : p2 ? (d2 = false, u2 = fi(c2, true)) : u2 = [] : Vs(c2) || Is(c2) ? (u2 = a3, Is(a3) ? u2 = sa(a3) : Us(a3) && !Bs(a3) || (u2 = io(c2))) : d2 = false; + } + d2 && (s3.set(c2, u2), i4(u2, c2, r4, o3, s3), s3.delete(c2)); + Hn(e5, n4, u2); + }(e4, t3, s2, n3, kr, r3, i3); + else { + var a2 = r3 ? r3(_o(e4, s2), o2, s2 + "", e4, t3, i3) : void 0; + a2 === void 0 && (a2 = o2), Hn(e4, s2, a2); + } + }, wa); + } + function Nr(e4, t3) { + var n3 = e4.length; + if (n3) + return so(t3 += t3 < 0 ? n3 : 0, n3) ? e4[t3] : void 0; + } + function Ir(e4, t3, n3) { + t3 = t3.length ? ft(t3, function(e5) { + return Ms(e5) ? function(t4) { + return dr(t4, e5.length === 1 ? e5[0] : e5); + } : e5; + }) : [Ga]; + var r3 = -1; + return t3 = ft(t3, kt(Qi())), function(e5, t4) { + var n4 = e5.length; + for (e5.sort(t4); n4--; ) + e5[n4] = e5[n4].value; + return e5; + }(jr(e4, function(e5, n4, i3) { + return {criteria: ft(t3, function(t4) { + return t4(e5); + }), index: ++r3, value: e5}; + }), function(e5, t4) { + return function(e6, t5, n4) { + var r4 = -1, i3 = e6.criteria, o2 = t5.criteria, s2 = i3.length, a2 = n4.length; + for (; ++r4 < s2; ) { + var c2 = pi(i3[r4], o2[r4]); + if (c2) { + if (r4 >= a2) + return c2; + var l2 = n4[r4]; + return c2 * (l2 == "desc" ? -1 : 1); + } + } + return e6.index - t5.index; + }(e5, t4, n3); + }); + } + function Mr(e4, t3, n3) { + for (var r3 = -1, i3 = t3.length, o2 = {}; ++r3 < i3; ) { + var s2 = t3[r3], a2 = dr(e4, s2); + n3(a2, s2) && qr(o2, ai(s2, e4), a2); + } + return o2; + } + function Rr(e4, t3, n3, r3) { + var i3 = r3 ? St : wt, o2 = -1, s2 = t3.length, a2 = e4; + for (e4 === t3 && (t3 = vi(t3)), n3 && (a2 = ft(e4, kt(n3))); ++o2 < s2; ) + for (var c2 = 0, l2 = t3[o2], u2 = n3 ? n3(l2) : l2; (c2 = i3(a2, u2, c2, r3)) > -1; ) + a2 !== e4 && Xe2.call(a2, c2, 1), Xe2.call(e4, c2, 1); + return e4; + } + function Dr(e4, t3) { + for (var n3 = e4 ? t3.length : 0, r3 = n3 - 1; n3--; ) { + var i3 = t3[n3]; + if (n3 == r3 || i3 !== o2) { + var o2 = i3; + so(i3) ? Xe2.call(e4, i3, 1) : Zr(e4, i3); + } + } + return e4; + } + function Pr(e4, t3) { + return e4 + Zt(un() * (t3 - e4 + 1)); + } + function Lr(e4, t3) { + var n3 = ""; + if (!e4 || t3 < 1 || t3 > 9007199254740991) + return n3; + do { + t3 % 2 && (n3 += e4), (t3 = Zt(t3 / 2)) && (e4 += e4); + } while (t3); + return n3; + } + function zr(e4, t3) { + return wo(go(e4, t3, Ga), e4 + ""); + } + function Fr(e4) { + return Fn(Oa(e4)); + } + function Br(e4, t3) { + var n3 = Oa(e4); + return Eo(n3, Xn(t3, 0, n3.length)); + } + function qr(e4, t3, n3, r3) { + if (!Us(e4)) + return e4; + for (var i3 = -1, o2 = (t3 = ai(t3, e4)).length, s2 = o2 - 1, a2 = e4; a2 != null && ++i3 < o2; ) { + var c2 = Co(t3[i3]), l2 = n3; + if (c2 === "__proto__" || c2 === "constructor" || c2 === "prototype") + return e4; + if (i3 != s2) { + var u2 = a2[c2]; + (l2 = r3 ? r3(u2, c2, a2) : void 0) === void 0 && (l2 = Us(u2) ? u2 : so(t3[i3 + 1]) ? [] : {}); + } + Un(a2, c2, l2), a2 = a2[c2]; + } + return e4; + } + var Hr = _n ? function(e4, t3) { + return _n.set(e4, t3), e4; + } : Ga, Ur = Ct2 ? function(e4, t3) { + return Ct2(e4, "toString", {configurable: true, enumerable: false, value: Ua(t3), writable: true}); + } : Ga; + function $r(e4) { + return Eo(Oa(e4)); + } + function Wr(e4, t3, n3) { + var i3 = -1, o2 = e4.length; + t3 < 0 && (t3 = -t3 > o2 ? 0 : o2 + t3), (n3 = n3 > o2 ? o2 : n3) < 0 && (n3 += o2), o2 = t3 > n3 ? 0 : n3 - t3 >>> 0, t3 >>>= 0; + for (var s2 = r2(o2); ++i3 < o2; ) + s2[i3] = e4[i3 + t3]; + return s2; + } + function Gr(e4, t3) { + var n3; + return er(e4, function(e5, r3, i3) { + return !(n3 = t3(e5, r3, i3)); + }), !!n3; + } + function Vr(e4, t3, n3) { + var r3 = 0, i3 = e4 == null ? r3 : e4.length; + if (typeof t3 == "number" && t3 == t3 && i3 <= 2147483647) { + for (; r3 < i3; ) { + var o2 = r3 + i3 >>> 1, s2 = e4[o2]; + s2 !== null && !Ys(s2) && (n3 ? s2 <= t3 : s2 < t3) ? r3 = o2 + 1 : i3 = o2; + } + return i3; + } + return Jr(e4, t3, Ga, n3); + } + function Jr(e4, t3, n3, r3) { + var i3 = 0, o2 = e4 == null ? 0 : e4.length; + if (o2 === 0) + return 0; + for (var s2 = (t3 = n3(t3)) != t3, a2 = t3 === null, c2 = Ys(t3), l2 = t3 === void 0; i3 < o2; ) { + var u2 = Zt((i3 + o2) / 2), d2 = n3(e4[u2]), h2 = d2 !== void 0, f2 = d2 === null, p2 = d2 == d2, g2 = Ys(d2); + if (s2) + var m2 = r3 || p2; + else + m2 = l2 ? p2 && (r3 || h2) : a2 ? p2 && h2 && (r3 || !f2) : c2 ? p2 && h2 && !f2 && (r3 || !g2) : !f2 && !g2 && (r3 ? d2 <= t3 : d2 < t3); + m2 ? i3 = u2 + 1 : o2 = u2; + } + return an(o2, 4294967294); + } + function Xr(e4, t3) { + for (var n3 = -1, r3 = e4.length, i3 = 0, o2 = []; ++n3 < r3; ) { + var s2 = e4[n3], a2 = t3 ? t3(s2) : s2; + if (!n3 || !Os(a2, c2)) { + var c2 = a2; + o2[i3++] = s2 === 0 ? 0 : s2; + } + } + return o2; + } + function Qr(e4) { + return typeof e4 == "number" ? e4 : Ys(e4) ? NaN : +e4; + } + function Yr(e4) { + if (typeof e4 == "string") + return e4; + if (Ms(e4)) + return ft(e4, Yr) + ""; + if (Ys(e4)) + return jn ? jn.call(e4) : ""; + var t3 = e4 + ""; + return t3 == "0" && 1 / e4 == -1 / 0 ? "-0" : t3; + } + function Kr(e4, t3, n3) { + var r3 = -1, i3 = dt, o2 = e4.length, s2 = true, a2 = [], c2 = a2; + if (n3) + s2 = false, i3 = ht; + else if (o2 >= 200) { + var l2 = t3 ? null : Li(e4); + if (l2) + return Ut(l2); + s2 = false, i3 = It, c2 = new Pn(); + } else + c2 = t3 ? [] : a2; + e: + for (; ++r3 < o2; ) { + var u2 = e4[r3], d2 = t3 ? t3(u2) : u2; + if (u2 = n3 || u2 !== 0 ? u2 : 0, s2 && d2 == d2) { + for (var h2 = c2.length; h2--; ) + if (c2[h2] === d2) + continue e; + t3 && c2.push(d2), a2.push(u2); + } else + i3(c2, d2, n3) || (c2 !== a2 && c2.push(d2), a2.push(u2)); + } + return a2; + } + function Zr(e4, t3) { + return (e4 = mo(e4, t3 = ai(t3, e4))) == null || delete e4[Co(Fo(t3))]; + } + function ei(e4, t3, n3, r3) { + return qr(e4, t3, n3(dr(e4, t3)), r3); + } + function ti(e4, t3, n3, r3) { + for (var i3 = e4.length, o2 = r3 ? i3 : -1; (r3 ? o2-- : ++o2 < i3) && t3(e4[o2], o2, e4); ) + ; + return n3 ? Wr(e4, r3 ? 0 : o2, r3 ? o2 + 1 : i3) : Wr(e4, r3 ? o2 + 1 : 0, r3 ? i3 : o2); + } + function ni(e4, t3) { + var n3 = e4; + return n3 instanceof In && (n3 = n3.value()), gt(t3, function(e5, t4) { + return t4.func.apply(t4.thisArg, pt([e5], t4.args)); + }, n3); + } + function ri(e4, t3, n3) { + var i3 = e4.length; + if (i3 < 2) + return i3 ? Kr(e4[0]) : []; + for (var o2 = -1, s2 = r2(i3); ++o2 < i3; ) + for (var a2 = e4[o2], c2 = -1; ++c2 < i3; ) + c2 != o2 && (s2[o2] = Zn(s2[o2] || a2, e4[c2], t3, n3)); + return Kr(or(s2, 1), t3, n3); + } + function ii(e4, t3, n3) { + for (var r3 = -1, i3 = e4.length, o2 = t3.length, s2 = {}; ++r3 < i3; ) { + var a2 = r3 < o2 ? t3[r3] : void 0; + n3(s2, e4[r3], a2); + } + return s2; + } + function oi(e4) { + return Ps(e4) ? e4 : []; + } + function si(e4) { + return typeof e4 == "function" ? e4 : Ga; + } + function ai(e4, t3) { + return Ms(e4) ? e4 : co(e4, t3) ? [e4] : Ao(aa(e4)); + } + var ci = zr; + function li(e4, t3, n3) { + var r3 = e4.length; + return n3 = n3 === void 0 ? r3 : n3, !t3 && n3 >= r3 ? e4 : Wr(e4, t3, n3); + } + var ui = Xt || function(e4) { + return Ve.clearTimeout(e4); + }; + function di(e4, t3) { + if (t3) + return e4.slice(); + var n3 = e4.length, r3 = He2 ? He2(n3) : new e4.constructor(n3); + return e4.copy(r3), r3; + } + function hi(e4) { + var t3 = new e4.constructor(e4.byteLength); + return new Pe2(t3).set(new Pe2(e4)), t3; + } + function fi(e4, t3) { + var n3 = t3 ? hi(e4.buffer) : e4.buffer; + return new e4.constructor(n3, e4.byteOffset, e4.length); + } + function pi(e4, t3) { + if (e4 !== t3) { + var n3 = e4 !== void 0, r3 = e4 === null, i3 = e4 == e4, o2 = Ys(e4), s2 = t3 !== void 0, a2 = t3 === null, c2 = t3 == t3, l2 = Ys(t3); + if (!a2 && !l2 && !o2 && e4 > t3 || o2 && s2 && c2 && !a2 && !l2 || r3 && s2 && c2 || !n3 && c2 || !i3) + return 1; + if (!r3 && !o2 && !l2 && e4 < t3 || l2 && n3 && i3 && !r3 && !o2 || a2 && n3 && i3 || !s2 && i3 || !c2) + return -1; + } + return 0; + } + function gi(e4, t3, n3, i3) { + for (var o2 = -1, s2 = e4.length, a2 = n3.length, c2 = -1, l2 = t3.length, u2 = sn(s2 - a2, 0), d2 = r2(l2 + u2), h2 = !i3; ++c2 < l2; ) + d2[c2] = t3[c2]; + for (; ++o2 < a2; ) + (h2 || o2 < s2) && (d2[n3[o2]] = e4[o2]); + for (; u2--; ) + d2[c2++] = e4[o2++]; + return d2; + } + function mi(e4, t3, n3, i3) { + for (var o2 = -1, s2 = e4.length, a2 = -1, c2 = n3.length, l2 = -1, u2 = t3.length, d2 = sn(s2 - c2, 0), h2 = r2(d2 + u2), f2 = !i3; ++o2 < d2; ) + h2[o2] = e4[o2]; + for (var p2 = o2; ++l2 < u2; ) + h2[p2 + l2] = t3[l2]; + for (; ++a2 < c2; ) + (f2 || o2 < s2) && (h2[p2 + n3[a2]] = e4[o2++]); + return h2; + } + function vi(e4, t3) { + var n3 = -1, i3 = e4.length; + for (t3 || (t3 = r2(i3)); ++n3 < i3; ) + t3[n3] = e4[n3]; + return t3; + } + function _i(e4, t3, n3, r3) { + var i3 = !n3; + n3 || (n3 = {}); + for (var o2 = -1, s2 = t3.length; ++o2 < s2; ) { + var a2 = t3[o2], c2 = r3 ? r3(n3[a2], e4[a2], a2, n3, e4) : void 0; + c2 === void 0 && (c2 = e4[a2]), i3 ? Vn(n3, a2, c2) : Un(n3, a2, c2); + } + return n3; + } + function bi(e4, t3) { + return function(n3, r3) { + var i3 = Ms(n3) ? st : Wn, o2 = t3 ? t3() : {}; + return i3(n3, e4, Qi(r3, 2), o2); + }; + } + function yi(e4) { + return zr(function(t3, n3) { + var r3 = -1, i3 = n3.length, o2 = i3 > 1 ? n3[i3 - 1] : void 0, s2 = i3 > 2 ? n3[2] : void 0; + for (o2 = e4.length > 3 && typeof o2 == "function" ? (i3--, o2) : void 0, s2 && ao(n3[0], n3[1], s2) && (o2 = i3 < 3 ? void 0 : o2, i3 = 1), t3 = ge2(t3); ++r3 < i3; ) { + var a2 = n3[r3]; + a2 && e4(t3, a2, r3, o2); + } + return t3; + }); + } + function wi(e4, t3) { + return function(n3, r3) { + if (n3 == null) + return n3; + if (!Ds(n3)) + return e4(n3, r3); + for (var i3 = n3.length, o2 = t3 ? i3 : -1, s2 = ge2(n3); (t3 ? o2-- : ++o2 < i3) && r3(s2[o2], o2, s2) !== false; ) + ; + return n3; + }; + } + function Si(e4) { + return function(t3, n3, r3) { + for (var i3 = -1, o2 = ge2(t3), s2 = r3(t3), a2 = s2.length; a2--; ) { + var c2 = s2[e4 ? a2 : ++i3]; + if (n3(o2[c2], c2, o2) === false) + break; + } + return t3; + }; + } + function xi(e4) { + return function(t3) { + var n3 = Ft(t3 = aa(t3)) ? Gt(t3) : void 0, r3 = n3 ? n3[0] : t3.charAt(0), i3 = n3 ? li(n3, 1).join("") : t3.slice(1); + return r3[e4]() + i3; + }; + } + function Ei(e4) { + return function(t3) { + return gt(Ba(Ia(t3).replace(Ie, "")), e4, ""); + }; + } + function Ai(e4) { + return function() { + var t3 = arguments; + switch (t3.length) { + case 0: + return new e4(); + case 1: + return new e4(t3[0]); + case 2: + return new e4(t3[0], t3[1]); + case 3: + return new e4(t3[0], t3[1], t3[2]); + case 4: + return new e4(t3[0], t3[1], t3[2], t3[3]); + case 5: + return new e4(t3[0], t3[1], t3[2], t3[3], t3[4]); + case 6: + return new e4(t3[0], t3[1], t3[2], t3[3], t3[4], t3[5]); + case 7: + return new e4(t3[0], t3[1], t3[2], t3[3], t3[4], t3[5], t3[6]); + } + var n3 = On(e4.prototype), r3 = e4.apply(n3, t3); + return Us(r3) ? r3 : n3; + }; + } + function Ci(e4) { + return function(t3, n3, r3) { + var i3 = ge2(t3); + if (!Ds(t3)) { + var o2 = Qi(n3, 3); + t3 = ya(t3), n3 = function(e5) { + return o2(i3[e5], e5, i3); + }; + } + var s2 = e4(t3, n3, r3); + return s2 > -1 ? i3[o2 ? t3[s2] : s2] : void 0; + }; + } + function ji(e4) { + return $i(function(t3) { + var n3 = t3.length, r3 = n3, i3 = Nn.prototype.thru; + for (e4 && t3.reverse(); r3--; ) { + var s2 = t3[r3]; + if (typeof s2 != "function") + throw new _e2(o); + if (i3 && !a2 && Ji(s2) == "wrapper") + var a2 = new Nn([], true); + } + for (r3 = a2 ? r3 : n3; ++r3 < n3; ) { + var c2 = Ji(s2 = t3[r3]), l2 = c2 == "wrapper" ? Vi(s2) : void 0; + a2 = l2 && lo(l2[0]) && l2[1] == 424 && !l2[4].length && l2[9] == 1 ? a2[Ji(l2[0])].apply(a2, l2[3]) : s2.length == 1 && lo(s2) ? a2[c2]() : a2.thru(s2); + } + return function() { + var e5 = arguments, r4 = e5[0]; + if (a2 && e5.length == 1 && Ms(r4)) + return a2.plant(r4).value(); + for (var i4 = 0, o2 = n3 ? t3[i4].apply(this, e5) : r4; ++i4 < n3; ) + o2 = t3[i4].call(this, o2); + return o2; + }; + }); + } + function Ti(e4, t3, n3, i3, o2, s2, a2, c2, l2, u2) { + var d2 = 128 & t3, h2 = 1 & t3, f2 = 2 & t3, p2 = 24 & t3, g2 = 512 & t3, m2 = f2 ? void 0 : Ai(e4); + return function v2() { + for (var _2 = arguments.length, b2 = r2(_2), y2 = _2; y2--; ) + b2[y2] = arguments[y2]; + if (p2) + var w2 = Xi(v2), S2 = Dt(b2, w2); + if (i3 && (b2 = gi(b2, i3, o2, p2)), s2 && (b2 = mi(b2, s2, a2, p2)), _2 -= S2, p2 && _2 < u2) { + var x2 = Ht(b2, w2); + return Di(e4, t3, Ti, v2.placeholder, n3, b2, x2, c2, l2, u2 - _2); + } + var E2 = h2 ? n3 : this, A2 = f2 ? E2[e4] : e4; + return _2 = b2.length, c2 ? b2 = vo(b2, c2) : g2 && _2 > 1 && b2.reverse(), d2 && l2 < _2 && (b2.length = l2), this && this !== Ve && this instanceof v2 && (A2 = m2 || Ai(A2)), A2.apply(E2, b2); + }; + } + function Oi(e4, t3) { + return function(n3, r3) { + return function(e5, t4, n4, r4) { + return cr(e5, function(e6, i3, o2) { + t4(r4, n4(e6), i3, o2); + }), r4; + }(n3, e4, t3(r3), {}); + }; + } + function ki(e4, t3) { + return function(n3, r3) { + var i3; + if (n3 === void 0 && r3 === void 0) + return t3; + if (n3 !== void 0 && (i3 = n3), r3 !== void 0) { + if (i3 === void 0) + return r3; + typeof n3 == "string" || typeof r3 == "string" ? (n3 = Yr(n3), r3 = Yr(r3)) : (n3 = Qr(n3), r3 = Qr(r3)), i3 = e4(n3, r3); + } + return i3; + }; + } + function Ni(e4) { + return $i(function(t3) { + return t3 = ft(t3, kt(Qi())), zr(function(n3) { + var r3 = this; + return e4(t3, function(e5) { + return ot(e5, r3, n3); + }); + }); + }); + } + function Ii(e4, t3) { + var n3 = (t3 = t3 === void 0 ? " " : Yr(t3)).length; + if (n3 < 2) + return n3 ? Lr(t3, e4) : t3; + var r3 = Lr(t3, Kt(e4 / Wt(t3))); + return Ft(t3) ? li(Gt(r3), 0, e4).join("") : r3.slice(0, e4); + } + function Mi(e4) { + return function(t3, n3, i3) { + return i3 && typeof i3 != "number" && ao(t3, n3, i3) && (n3 = i3 = void 0), t3 = na(t3), n3 === void 0 ? (n3 = t3, t3 = 0) : n3 = na(n3), function(e5, t4, n4, i4) { + for (var o2 = -1, s2 = sn(Kt((t4 - e5) / (n4 || 1)), 0), a2 = r2(s2); s2--; ) + a2[i4 ? s2 : ++o2] = e5, e5 += n4; + return a2; + }(t3, n3, i3 = i3 === void 0 ? t3 < n3 ? 1 : -1 : na(i3), e4); + }; + } + function Ri(e4) { + return function(t3, n3) { + return typeof t3 == "string" && typeof n3 == "string" || (t3 = oa(t3), n3 = oa(n3)), e4(t3, n3); + }; + } + function Di(e4, t3, n3, r3, i3, o2, s2, a2, c2, l2) { + var u2 = 8 & t3; + t3 |= u2 ? 32 : 64, 4 & (t3 &= ~(u2 ? 64 : 32)) || (t3 &= -4); + var d2 = [e4, t3, i3, u2 ? o2 : void 0, u2 ? s2 : void 0, u2 ? void 0 : o2, u2 ? void 0 : s2, a2, c2, l2], h2 = n3.apply(void 0, d2); + return lo(e4) && bo(h2, d2), h2.placeholder = r3, So(h2, e4, t3); + } + function Pi(e4) { + var t3 = pe2[e4]; + return function(e5, n3) { + if (e5 = oa(e5), (n3 = n3 == null ? 0 : an(ra(n3), 292)) && nn(e5)) { + var r3 = (aa(e5) + "e").split("e"); + return +((r3 = (aa(t3(r3[0] + "e" + (+r3[1] + n3))) + "e").split("e"))[0] + "e" + (+r3[1] - n3)); + } + return t3(e5); + }; + } + var Li = gn && 1 / Ut(new gn([, -0]))[1] == 1 / 0 ? function(e4) { + return new gn(e4); + } : Ya; + function zi(e4) { + return function(t3) { + var n3 = no(t3); + return n3 == g ? Bt(t3) : n3 == b ? $t(t3) : function(e5, t4) { + return ft(t4, function(t5) { + return [t5, e5[t5]]; + }); + }(t3, e4(t3)); + }; + } + function Fi(e4, t3, n3, i3, a2, c2, l2, u2) { + var d2 = 2 & t3; + if (!d2 && typeof e4 != "function") + throw new _e2(o); + var h2 = i3 ? i3.length : 0; + if (h2 || (t3 &= -97, i3 = a2 = void 0), l2 = l2 === void 0 ? l2 : sn(ra(l2), 0), u2 = u2 === void 0 ? u2 : ra(u2), h2 -= a2 ? a2.length : 0, 64 & t3) { + var f2 = i3, p2 = a2; + i3 = a2 = void 0; + } + var g2 = d2 ? void 0 : Vi(e4), m2 = [e4, t3, n3, i3, a2, f2, p2, c2, l2, u2]; + if (g2 && function(e5, t4) { + var n4 = e5[1], r3 = t4[1], i4 = n4 | r3, o2 = i4 < 131, a3 = r3 == 128 && n4 == 8 || r3 == 128 && n4 == 256 && e5[7].length <= t4[8] || r3 == 384 && t4[7].length <= t4[8] && n4 == 8; + if (!o2 && !a3) + return e5; + 1 & r3 && (e5[2] = t4[2], i4 |= 1 & n4 ? 0 : 4); + var c3 = t4[3]; + if (c3) { + var l3 = e5[3]; + e5[3] = l3 ? gi(l3, c3, t4[4]) : c3, e5[4] = l3 ? Ht(e5[3], s) : t4[4]; + } + (c3 = t4[5]) && (l3 = e5[5], e5[5] = l3 ? mi(l3, c3, t4[6]) : c3, e5[6] = l3 ? Ht(e5[5], s) : t4[6]); + (c3 = t4[7]) && (e5[7] = c3); + 128 & r3 && (e5[8] = e5[8] == null ? t4[8] : an(e5[8], t4[8])); + e5[9] == null && (e5[9] = t4[9]); + e5[0] = t4[0], e5[1] = i4; + }(m2, g2), e4 = m2[0], t3 = m2[1], n3 = m2[2], i3 = m2[3], a2 = m2[4], !(u2 = m2[9] = m2[9] === void 0 ? d2 ? 0 : e4.length : sn(m2[9] - h2, 0)) && 24 & t3 && (t3 &= -25), t3 && t3 != 1) + v2 = t3 == 8 || t3 == 16 ? function(e5, t4, n4) { + var i4 = Ai(e5); + return function o2() { + for (var s2 = arguments.length, a3 = r2(s2), c3 = s2, l3 = Xi(o2); c3--; ) + a3[c3] = arguments[c3]; + var u3 = s2 < 3 && a3[0] !== l3 && a3[s2 - 1] !== l3 ? [] : Ht(a3, l3); + if ((s2 -= u3.length) < n4) + return Di(e5, t4, Ti, o2.placeholder, void 0, a3, u3, void 0, void 0, n4 - s2); + var d3 = this && this !== Ve && this instanceof o2 ? i4 : e5; + return ot(d3, this, a3); + }; + }(e4, t3, u2) : t3 != 32 && t3 != 33 || a2.length ? Ti.apply(void 0, m2) : function(e5, t4, n4, i4) { + var o2 = 1 & t4, s2 = Ai(e5); + return function t5() { + for (var a3 = -1, c3 = arguments.length, l3 = -1, u3 = i4.length, d3 = r2(u3 + c3), h3 = this && this !== Ve && this instanceof t5 ? s2 : e5; ++l3 < u3; ) + d3[l3] = i4[l3]; + for (; c3--; ) + d3[l3++] = arguments[++a3]; + return ot(h3, o2 ? n4 : this, d3); + }; + }(e4, t3, n3, i3); + else + var v2 = function(e5, t4, n4) { + var r3 = 1 & t4, i4 = Ai(e5); + return function t5() { + var o2 = this && this !== Ve && this instanceof t5 ? i4 : e5; + return o2.apply(r3 ? n4 : this, arguments); + }; + }(e4, t3, n3); + return So((g2 ? Hr : bo)(v2, m2), e4, t3); + } + function Bi(e4, t3, n3, r3) { + return e4 === void 0 || Os(e4, we2[n3]) && !Ee2.call(r3, n3) ? t3 : e4; + } + function qi(e4, t3, n3, r3, i3, o2) { + return Us(e4) && Us(t3) && (o2.set(t3, e4), kr(e4, t3, void 0, qi, o2), o2.delete(t3)), e4; + } + function Hi(e4) { + return Vs(e4) ? void 0 : e4; + } + function Ui(e4, t3, n3, r3, i3, o2) { + var s2 = 1 & n3, a2 = e4.length, c2 = t3.length; + if (a2 != c2 && !(s2 && c2 > a2)) + return false; + var l2 = o2.get(e4), u2 = o2.get(t3); + if (l2 && u2) + return l2 == t3 && u2 == e4; + var d2 = -1, h2 = true, f2 = 2 & n3 ? new Pn() : void 0; + for (o2.set(e4, t3), o2.set(t3, e4); ++d2 < a2; ) { + var p2 = e4[d2], g2 = t3[d2]; + if (r3) + var m2 = s2 ? r3(g2, p2, d2, t3, e4, o2) : r3(p2, g2, d2, e4, t3, o2); + if (m2 !== void 0) { + if (m2) + continue; + h2 = false; + break; + } + if (f2) { + if (!vt(t3, function(e5, t4) { + if (!It(f2, t4) && (p2 === e5 || i3(p2, e5, n3, r3, o2))) + return f2.push(t4); + })) { + h2 = false; + break; + } + } else if (p2 !== g2 && !i3(p2, g2, n3, r3, o2)) { + h2 = false; + break; + } + } + return o2.delete(e4), o2.delete(t3), h2; + } + function $i(e4) { + return wo(go(e4, void 0, Ro), e4 + ""); + } + function Wi(e4) { + return hr(e4, ya, eo); + } + function Gi(e4) { + return hr(e4, wa, to); + } + var Vi = _n ? function(e4) { + return _n.get(e4); + } : Ya; + function Ji(e4) { + for (var t3 = e4.name + "", n3 = bn[t3], r3 = Ee2.call(bn, t3) ? n3.length : 0; r3--; ) { + var i3 = n3[r3], o2 = i3.func; + if (o2 == null || o2 == e4) + return i3.name; + } + return t3; + } + function Xi(e4) { + return (Ee2.call(Tn, "placeholder") ? Tn : e4).placeholder; + } + function Qi() { + var e4 = Tn.iteratee || Va; + return e4 = e4 === Va ? xr : e4, arguments.length ? e4(arguments[0], arguments[1]) : e4; + } + function Yi(e4, t3) { + var n3, r3, i3 = e4.__data__; + return ((r3 = typeof (n3 = t3)) == "string" || r3 == "number" || r3 == "symbol" || r3 == "boolean" ? n3 !== "__proto__" : n3 === null) ? i3[typeof t3 == "string" ? "string" : "hash"] : i3.map; + } + function Ki(e4) { + for (var t3 = ya(e4), n3 = t3.length; n3--; ) { + var r3 = t3[n3], i3 = e4[r3]; + t3[n3] = [r3, i3, fo(i3)]; + } + return t3; + } + function Zi(e4, t3) { + var n3 = function(e5, t4) { + return e5 == null ? void 0 : e5[t4]; + }(e4, t3); + return Sr(n3) ? n3 : void 0; + } + var eo = en ? function(e4) { + return e4 == null ? [] : (e4 = ge2(e4), ut(en(e4), function(t3) { + return Je2.call(e4, t3); + })); + } : ic, to = en ? function(e4) { + for (var t3 = []; e4; ) + pt(t3, eo(e4)), e4 = We2(e4); + return t3; + } : ic, no = fr; + function ro(e4, t3, n3) { + for (var r3 = -1, i3 = (t3 = ai(t3, e4)).length, o2 = false; ++r3 < i3; ) { + var s2 = Co(t3[r3]); + if (!(o2 = e4 != null && n3(e4, s2))) + break; + e4 = e4[s2]; + } + return o2 || ++r3 != i3 ? o2 : !!(i3 = e4 == null ? 0 : e4.length) && Hs(i3) && so(s2, i3) && (Ms(e4) || Is(e4)); + } + function io(e4) { + return typeof e4.constructor != "function" || ho(e4) ? {} : On(We2(e4)); + } + function oo(e4) { + return Ms(e4) || Is(e4) || !!(Ye2 && e4 && e4[Ye2]); + } + function so(e4, t3) { + var n3 = typeof e4; + return !!(t3 = t3 == null ? 9007199254740991 : t3) && (n3 == "number" || n3 != "symbol" && ce.test(e4)) && e4 > -1 && e4 % 1 == 0 && e4 < t3; + } + function ao(e4, t3, n3) { + if (!Us(n3)) + return false; + var r3 = typeof t3; + return !!(r3 == "number" ? Ds(n3) && so(t3, n3.length) : r3 == "string" && t3 in n3) && Os(n3[t3], e4); + } + function co(e4, t3) { + if (Ms(e4)) + return false; + var n3 = typeof e4; + return !(n3 != "number" && n3 != "symbol" && n3 != "boolean" && e4 != null && !Ys(e4)) || ($.test(e4) || !U.test(e4) || t3 != null && e4 in ge2(t3)); + } + function lo(e4) { + var t3 = Ji(e4), n3 = Tn[t3]; + if (typeof n3 != "function" || !(t3 in In.prototype)) + return false; + if (e4 === n3) + return true; + var r3 = Vi(n3); + return !!r3 && e4 === r3[0]; + } + (hn && no(new hn(new ArrayBuffer(1))) != E || fn && no(new fn()) != g || pn && no(pn.resolve()) != "[object Promise]" || gn && no(new gn()) != b || mn && no(new mn()) != S) && (no = function(e4) { + var t3 = fr(e4), n3 = t3 == v ? e4.constructor : void 0, r3 = n3 ? jo(n3) : ""; + if (r3) + switch (r3) { + case yn: + return E; + case wn: + return g; + case Sn: + return "[object Promise]"; + case xn: + return b; + case En: + return S; + } + return t3; + }); + var uo = Se2 ? Bs : oc; + function ho(e4) { + var t3 = e4 && e4.constructor; + return e4 === (typeof t3 == "function" && t3.prototype || we2); + } + function fo(e4) { + return e4 == e4 && !Us(e4); + } + function po(e4, t3) { + return function(n3) { + return n3 != null && (n3[e4] === t3 && (t3 !== void 0 || e4 in ge2(n3))); + }; + } + function go(e4, t3, n3) { + return t3 = sn(t3 === void 0 ? e4.length - 1 : t3, 0), function() { + for (var i3 = arguments, o2 = -1, s2 = sn(i3.length - t3, 0), a2 = r2(s2); ++o2 < s2; ) + a2[o2] = i3[t3 + o2]; + o2 = -1; + for (var c2 = r2(t3 + 1); ++o2 < t3; ) + c2[o2] = i3[o2]; + return c2[t3] = n3(a2), ot(e4, this, c2); + }; + } + function mo(e4, t3) { + return t3.length < 2 ? e4 : dr(e4, Wr(t3, 0, -1)); + } + function vo(e4, t3) { + for (var n3 = e4.length, r3 = an(t3.length, n3), i3 = vi(e4); r3--; ) { + var o2 = t3[r3]; + e4[r3] = so(o2, n3) ? i3[o2] : void 0; + } + return e4; + } + function _o(e4, t3) { + if ((t3 !== "constructor" || typeof e4[t3] != "function") && t3 != "__proto__") + return e4[t3]; + } + var bo = xo(Hr), yo = Yt || function(e4, t3) { + return Ve.setTimeout(e4, t3); + }, wo = xo(Ur); + function So(e4, t3, n3) { + var r3 = t3 + ""; + return wo(e4, function(e5, t4) { + var n4 = t4.length; + if (!n4) + return e5; + var r4 = n4 - 1; + return t4[r4] = (n4 > 1 ? "& " : "") + t4[r4], t4 = t4.join(n4 > 2 ? ", " : " "), e5.replace(Y, "{\n/* [wrapped with " + t4 + "] */\n"); + }(r3, function(e5, t4) { + return at(a, function(n4) { + var r4 = "_." + n4[0]; + t4 & n4[1] && !dt(e5, r4) && e5.push(r4); + }), e5.sort(); + }(function(e5) { + var t4 = e5.match(K); + return t4 ? t4[1].split(Z) : []; + }(r3), n3))); + } + function xo(e4) { + var t3 = 0, n3 = 0; + return function() { + var r3 = cn(), i3 = 16 - (r3 - n3); + if (n3 = r3, i3 > 0) { + if (++t3 >= 800) + return arguments[0]; + } else + t3 = 0; + return e4.apply(void 0, arguments); + }; + } + function Eo(e4, t3) { + var n3 = -1, r3 = e4.length, i3 = r3 - 1; + for (t3 = t3 === void 0 ? r3 : t3; ++n3 < t3; ) { + var o2 = Pr(n3, i3), s2 = e4[o2]; + e4[o2] = e4[n3], e4[n3] = s2; + } + return e4.length = t3, e4; + } + var Ao = function(e4) { + var t3 = xs(e4, function(e5) { + return n3.size === 500 && n3.clear(), e5; + }), n3 = t3.cache; + return t3; + }(function(e4) { + var t3 = []; + return e4.charCodeAt(0) === 46 && t3.push(""), e4.replace(W, function(e5, n3, r3, i3) { + t3.push(r3 ? i3.replace(te, "$1") : n3 || e5); + }), t3; + }); + function Co(e4) { + if (typeof e4 == "string" || Ys(e4)) + return e4; + var t3 = e4 + ""; + return t3 == "0" && 1 / e4 == -1 / 0 ? "-0" : t3; + } + function jo(e4) { + if (e4 != null) { + try { + return xe2.call(e4); + } catch (e5) { + } + try { + return e4 + ""; + } catch (e5) { + } + } + return ""; + } + function To(e4) { + if (e4 instanceof In) + return e4.clone(); + var t3 = new Nn(e4.__wrapped__, e4.__chain__); + return t3.__actions__ = vi(e4.__actions__), t3.__index__ = e4.__index__, t3.__values__ = e4.__values__, t3; + } + var Oo = zr(function(e4, t3) { + return Ps(e4) ? Zn(e4, or(t3, 1, Ps, true)) : []; + }), ko = zr(function(e4, t3) { + var n3 = Fo(t3); + return Ps(n3) && (n3 = void 0), Ps(e4) ? Zn(e4, or(t3, 1, Ps, true), Qi(n3, 2)) : []; + }), No = zr(function(e4, t3) { + var n3 = Fo(t3); + return Ps(n3) && (n3 = void 0), Ps(e4) ? Zn(e4, or(t3, 1, Ps, true), void 0, n3) : []; + }); + function Io(e4, t3, n3) { + var r3 = e4 == null ? 0 : e4.length; + if (!r3) + return -1; + var i3 = n3 == null ? 0 : ra(n3); + return i3 < 0 && (i3 = sn(r3 + i3, 0)), yt(e4, Qi(t3, 3), i3); + } + function Mo(e4, t3, n3) { + var r3 = e4 == null ? 0 : e4.length; + if (!r3) + return -1; + var i3 = r3 - 1; + return n3 !== void 0 && (i3 = ra(n3), i3 = n3 < 0 ? sn(r3 + i3, 0) : an(i3, r3 - 1)), yt(e4, Qi(t3, 3), i3, true); + } + function Ro(e4) { + return (e4 == null ? 0 : e4.length) ? or(e4, 1) : []; + } + function Do(e4) { + return e4 && e4.length ? e4[0] : void 0; + } + var Po = zr(function(e4) { + var t3 = ft(e4, oi); + return t3.length && t3[0] === e4[0] ? vr(t3) : []; + }), Lo = zr(function(e4) { + var t3 = Fo(e4), n3 = ft(e4, oi); + return t3 === Fo(n3) ? t3 = void 0 : n3.pop(), n3.length && n3[0] === e4[0] ? vr(n3, Qi(t3, 2)) : []; + }), zo = zr(function(e4) { + var t3 = Fo(e4), n3 = ft(e4, oi); + return (t3 = typeof t3 == "function" ? t3 : void 0) && n3.pop(), n3.length && n3[0] === e4[0] ? vr(n3, void 0, t3) : []; + }); + function Fo(e4) { + var t3 = e4 == null ? 0 : e4.length; + return t3 ? e4[t3 - 1] : void 0; + } + var Bo = zr(qo); + function qo(e4, t3) { + return e4 && e4.length && t3 && t3.length ? Rr(e4, t3) : e4; + } + var Ho = $i(function(e4, t3) { + var n3 = e4 == null ? 0 : e4.length, r3 = Jn(e4, t3); + return Dr(e4, ft(t3, function(e5) { + return so(e5, n3) ? +e5 : e5; + }).sort(pi)), r3; + }); + function Uo(e4) { + return e4 == null ? e4 : dn.call(e4); + } + var $o = zr(function(e4) { + return Kr(or(e4, 1, Ps, true)); + }), Wo = zr(function(e4) { + var t3 = Fo(e4); + return Ps(t3) && (t3 = void 0), Kr(or(e4, 1, Ps, true), Qi(t3, 2)); + }), Go = zr(function(e4) { + var t3 = Fo(e4); + return t3 = typeof t3 == "function" ? t3 : void 0, Kr(or(e4, 1, Ps, true), void 0, t3); + }); + function Vo(e4) { + if (!e4 || !e4.length) + return []; + var t3 = 0; + return e4 = ut(e4, function(e5) { + if (Ps(e5)) + return t3 = sn(e5.length, t3), true; + }), Ot(t3, function(t4) { + return ft(e4, At(t4)); + }); + } + function Jo(e4, t3) { + if (!e4 || !e4.length) + return []; + var n3 = Vo(e4); + return t3 == null ? n3 : ft(n3, function(e5) { + return ot(t3, void 0, e5); + }); + } + var Xo = zr(function(e4, t3) { + return Ps(e4) ? Zn(e4, t3) : []; + }), Qo = zr(function(e4) { + return ri(ut(e4, Ps)); + }), Yo = zr(function(e4) { + var t3 = Fo(e4); + return Ps(t3) && (t3 = void 0), ri(ut(e4, Ps), Qi(t3, 2)); + }), Ko = zr(function(e4) { + var t3 = Fo(e4); + return t3 = typeof t3 == "function" ? t3 : void 0, ri(ut(e4, Ps), void 0, t3); + }), Zo = zr(Vo); + var es = zr(function(e4) { + var t3 = e4.length, n3 = t3 > 1 ? e4[t3 - 1] : void 0; + return n3 = typeof n3 == "function" ? (e4.pop(), n3) : void 0, Jo(e4, n3); + }); + function ts(e4) { + var t3 = Tn(e4); + return t3.__chain__ = true, t3; + } + function ns(e4, t3) { + return t3(e4); + } + var rs = $i(function(e4) { + var t3 = e4.length, n3 = t3 ? e4[0] : 0, r3 = this.__wrapped__, i3 = function(t4) { + return Jn(t4, e4); + }; + return !(t3 > 1 || this.__actions__.length) && r3 instanceof In && so(n3) ? ((r3 = r3.slice(n3, +n3 + (t3 ? 1 : 0))).__actions__.push({func: ns, args: [i3], thisArg: void 0}), new Nn(r3, this.__chain__).thru(function(e5) { + return t3 && !e5.length && e5.push(void 0), e5; + })) : this.thru(i3); + }); + var is = bi(function(e4, t3, n3) { + Ee2.call(e4, n3) ? ++e4[n3] : Vn(e4, n3, 1); + }); + var os = Ci(Io), ss = Ci(Mo); + function as(e4, t3) { + return (Ms(e4) ? at : er)(e4, Qi(t3, 3)); + } + function cs(e4, t3) { + return (Ms(e4) ? ct : tr)(e4, Qi(t3, 3)); + } + var ls = bi(function(e4, t3, n3) { + Ee2.call(e4, n3) ? e4[n3].push(t3) : Vn(e4, n3, [t3]); + }); + var us = zr(function(e4, t3, n3) { + var i3 = -1, o2 = typeof t3 == "function", s2 = Ds(e4) ? r2(e4.length) : []; + return er(e4, function(e5) { + s2[++i3] = o2 ? ot(t3, e5, n3) : _r(e5, t3, n3); + }), s2; + }), ds = bi(function(e4, t3, n3) { + Vn(e4, n3, t3); + }); + function hs(e4, t3) { + return (Ms(e4) ? ft : jr)(e4, Qi(t3, 3)); + } + var fs = bi(function(e4, t3, n3) { + e4[n3 ? 0 : 1].push(t3); + }, function() { + return [[], []]; + }); + var ps = zr(function(e4, t3) { + if (e4 == null) + return []; + var n3 = t3.length; + return n3 > 1 && ao(e4, t3[0], t3[1]) ? t3 = [] : n3 > 2 && ao(t3[0], t3[1], t3[2]) && (t3 = [t3[0]]), Ir(e4, or(t3, 1), []); + }), gs = Qt || function() { + return Ve.Date.now(); + }; + function ms(e4, t3, n3) { + return t3 = n3 ? void 0 : t3, Fi(e4, 128, void 0, void 0, void 0, void 0, t3 = e4 && t3 == null ? e4.length : t3); + } + function vs(e4, t3) { + var n3; + if (typeof t3 != "function") + throw new _e2(o); + return e4 = ra(e4), function() { + return --e4 > 0 && (n3 = t3.apply(this, arguments)), e4 <= 1 && (t3 = void 0), n3; + }; + } + var _s = zr(function(e4, t3, n3) { + var r3 = 1; + if (n3.length) { + var i3 = Ht(n3, Xi(_s)); + r3 |= 32; + } + return Fi(e4, r3, t3, n3, i3); + }), bs = zr(function(e4, t3, n3) { + var r3 = 3; + if (n3.length) { + var i3 = Ht(n3, Xi(bs)); + r3 |= 32; + } + return Fi(t3, r3, e4, n3, i3); + }); + function ys(e4, t3, n3) { + var r3, i3, s2, a2, c2, l2, u2 = 0, d2 = false, h2 = false, f2 = true; + if (typeof e4 != "function") + throw new _e2(o); + function p2(t4) { + var n4 = r3, o2 = i3; + return r3 = i3 = void 0, u2 = t4, a2 = e4.apply(o2, n4); + } + function g2(e5) { + return u2 = e5, c2 = yo(v2, t3), d2 ? p2(e5) : a2; + } + function m2(e5) { + var n4 = e5 - l2; + return l2 === void 0 || n4 >= t3 || n4 < 0 || h2 && e5 - u2 >= s2; + } + function v2() { + var e5 = gs(); + if (m2(e5)) + return _2(e5); + c2 = yo(v2, function(e6) { + var n4 = t3 - (e6 - l2); + return h2 ? an(n4, s2 - (e6 - u2)) : n4; + }(e5)); + } + function _2(e5) { + return c2 = void 0, f2 && r3 ? p2(e5) : (r3 = i3 = void 0, a2); + } + function b2() { + var e5 = gs(), n4 = m2(e5); + if (r3 = arguments, i3 = this, l2 = e5, n4) { + if (c2 === void 0) + return g2(l2); + if (h2) + return ui(c2), c2 = yo(v2, t3), p2(l2); + } + return c2 === void 0 && (c2 = yo(v2, t3)), a2; + } + return t3 = oa(t3) || 0, Us(n3) && (d2 = !!n3.leading, s2 = (h2 = "maxWait" in n3) ? sn(oa(n3.maxWait) || 0, t3) : s2, f2 = "trailing" in n3 ? !!n3.trailing : f2), b2.cancel = function() { + c2 !== void 0 && ui(c2), u2 = 0, r3 = l2 = i3 = c2 = void 0; + }, b2.flush = function() { + return c2 === void 0 ? a2 : _2(gs()); + }, b2; + } + var ws = zr(function(e4, t3) { + return Kn(e4, 1, t3); + }), Ss = zr(function(e4, t3, n3) { + return Kn(e4, oa(t3) || 0, n3); + }); + function xs(e4, t3) { + if (typeof e4 != "function" || t3 != null && typeof t3 != "function") + throw new _e2(o); + var n3 = function() { + var r3 = arguments, i3 = t3 ? t3.apply(this, r3) : r3[0], o2 = n3.cache; + if (o2.has(i3)) + return o2.get(i3); + var s2 = e4.apply(this, r3); + return n3.cache = o2.set(i3, s2) || o2, s2; + }; + return n3.cache = new (xs.Cache || Dn)(), n3; + } + function Es(e4) { + if (typeof e4 != "function") + throw new _e2(o); + return function() { + var t3 = arguments; + switch (t3.length) { + case 0: + return !e4.call(this); + case 1: + return !e4.call(this, t3[0]); + case 2: + return !e4.call(this, t3[0], t3[1]); + case 3: + return !e4.call(this, t3[0], t3[1], t3[2]); + } + return !e4.apply(this, t3); + }; + } + xs.Cache = Dn; + var As = ci(function(e4, t3) { + var n3 = (t3 = t3.length == 1 && Ms(t3[0]) ? ft(t3[0], kt(Qi())) : ft(or(t3, 1), kt(Qi()))).length; + return zr(function(r3) { + for (var i3 = -1, o2 = an(r3.length, n3); ++i3 < o2; ) + r3[i3] = t3[i3].call(this, r3[i3]); + return ot(e4, this, r3); + }); + }), Cs = zr(function(e4, t3) { + return Fi(e4, 32, void 0, t3, Ht(t3, Xi(Cs))); + }), js = zr(function(e4, t3) { + return Fi(e4, 64, void 0, t3, Ht(t3, Xi(js))); + }), Ts = $i(function(e4, t3) { + return Fi(e4, 256, void 0, void 0, void 0, t3); + }); + function Os(e4, t3) { + return e4 === t3 || e4 != e4 && t3 != t3; + } + var ks = Ri(pr), Ns = Ri(function(e4, t3) { + return e4 >= t3; + }), Is = br(function() { + return arguments; + }()) ? br : function(e4) { + return $s(e4) && Ee2.call(e4, "callee") && !Je2.call(e4, "callee"); + }, Ms = r2.isArray, Rs = Ze ? kt(Ze) : function(e4) { + return $s(e4) && fr(e4) == x; + }; + function Ds(e4) { + return e4 != null && Hs(e4.length) && !Bs(e4); + } + function Ps(e4) { + return $s(e4) && Ds(e4); + } + var Ls = tn || oc, zs = et ? kt(et) : function(e4) { + return $s(e4) && fr(e4) == d; + }; + function Fs(e4) { + if (!$s(e4)) + return false; + var t3 = fr(e4); + return t3 == h || t3 == "[object DOMException]" || typeof e4.message == "string" && typeof e4.name == "string" && !Vs(e4); + } + function Bs(e4) { + if (!Us(e4)) + return false; + var t3 = fr(e4); + return t3 == f || t3 == p || t3 == "[object AsyncFunction]" || t3 == "[object Proxy]"; + } + function qs(e4) { + return typeof e4 == "number" && e4 == ra(e4); + } + function Hs(e4) { + return typeof e4 == "number" && e4 > -1 && e4 % 1 == 0 && e4 <= 9007199254740991; + } + function Us(e4) { + var t3 = typeof e4; + return e4 != null && (t3 == "object" || t3 == "function"); + } + function $s(e4) { + return e4 != null && typeof e4 == "object"; + } + var Ws = tt ? kt(tt) : function(e4) { + return $s(e4) && no(e4) == g; + }; + function Gs(e4) { + return typeof e4 == "number" || $s(e4) && fr(e4) == m; + } + function Vs(e4) { + if (!$s(e4) || fr(e4) != v) + return false; + var t3 = We2(e4); + if (t3 === null) + return true; + var n3 = Ee2.call(t3, "constructor") && t3.constructor; + return typeof n3 == "function" && n3 instanceof n3 && xe2.call(n3) == Te2; + } + var Js = nt ? kt(nt) : function(e4) { + return $s(e4) && fr(e4) == _; + }; + var Xs = rt ? kt(rt) : function(e4) { + return $s(e4) && no(e4) == b; + }; + function Qs(e4) { + return typeof e4 == "string" || !Ms(e4) && $s(e4) && fr(e4) == y; + } + function Ys(e4) { + return typeof e4 == "symbol" || $s(e4) && fr(e4) == w; + } + var Ks = it ? kt(it) : function(e4) { + return $s(e4) && Hs(e4.length) && !!Be[fr(e4)]; + }; + var Zs = Ri(Cr), ea = Ri(function(e4, t3) { + return e4 <= t3; + }); + function ta(e4) { + if (!e4) + return []; + if (Ds(e4)) + return Qs(e4) ? Gt(e4) : vi(e4); + if (Ke2 && e4[Ke2]) + return function(e5) { + for (var t4, n3 = []; !(t4 = e5.next()).done; ) + n3.push(t4.value); + return n3; + }(e4[Ke2]()); + var t3 = no(e4); + return (t3 == g ? Bt : t3 == b ? Ut : Oa)(e4); + } + function na(e4) { + return e4 ? (e4 = oa(e4)) === 1 / 0 || e4 === -1 / 0 ? 17976931348623157e292 * (e4 < 0 ? -1 : 1) : e4 == e4 ? e4 : 0 : e4 === 0 ? e4 : 0; + } + function ra(e4) { + var t3 = na(e4), n3 = t3 % 1; + return t3 == t3 ? n3 ? t3 - n3 : t3 : 0; + } + function ia(e4) { + return e4 ? Xn(ra(e4), 0, 4294967295) : 0; + } + function oa(e4) { + if (typeof e4 == "number") + return e4; + if (Ys(e4)) + return NaN; + if (Us(e4)) { + var t3 = typeof e4.valueOf == "function" ? e4.valueOf() : e4; + e4 = Us(t3) ? t3 + "" : t3; + } + if (typeof e4 != "string") + return e4 === 0 ? e4 : +e4; + e4 = e4.replace(J, ""); + var n3 = oe.test(e4); + return n3 || ae.test(e4) ? $e(e4.slice(2), n3 ? 2 : 8) : ie.test(e4) ? NaN : +e4; + } + function sa(e4) { + return _i(e4, wa(e4)); + } + function aa(e4) { + return e4 == null ? "" : Yr(e4); + } + var ca = yi(function(e4, t3) { + if (ho(t3) || Ds(t3)) + _i(t3, ya(t3), e4); + else + for (var n3 in t3) + Ee2.call(t3, n3) && Un(e4, n3, t3[n3]); + }), la = yi(function(e4, t3) { + _i(t3, wa(t3), e4); + }), ua = yi(function(e4, t3, n3, r3) { + _i(t3, wa(t3), e4, r3); + }), da = yi(function(e4, t3, n3, r3) { + _i(t3, ya(t3), e4, r3); + }), ha = $i(Jn); + var fa = zr(function(e4, t3) { + e4 = ge2(e4); + var n3 = -1, r3 = t3.length, i3 = r3 > 2 ? t3[2] : void 0; + for (i3 && ao(t3[0], t3[1], i3) && (r3 = 1); ++n3 < r3; ) + for (var o2 = t3[n3], s2 = wa(o2), a2 = -1, c2 = s2.length; ++a2 < c2; ) { + var l2 = s2[a2], u2 = e4[l2]; + (u2 === void 0 || Os(u2, we2[l2]) && !Ee2.call(e4, l2)) && (e4[l2] = o2[l2]); + } + return e4; + }), pa = zr(function(e4) { + return e4.push(void 0, qi), ot(xa, void 0, e4); + }); + function ga(e4, t3, n3) { + var r3 = e4 == null ? void 0 : dr(e4, t3); + return r3 === void 0 ? n3 : r3; + } + function ma(e4, t3) { + return e4 != null && ro(e4, t3, mr); + } + var va = Oi(function(e4, t3, n3) { + t3 != null && typeof t3.toString != "function" && (t3 = je2.call(t3)), e4[t3] = n3; + }, Ua(Ga)), _a = Oi(function(e4, t3, n3) { + t3 != null && typeof t3.toString != "function" && (t3 = je2.call(t3)), Ee2.call(e4, t3) ? e4[t3].push(n3) : e4[t3] = [n3]; + }, Qi), ba = zr(_r); + function ya(e4) { + return Ds(e4) ? zn(e4) : Er(e4); + } + function wa(e4) { + return Ds(e4) ? zn(e4, true) : Ar(e4); + } + var Sa = yi(function(e4, t3, n3) { + kr(e4, t3, n3); + }), xa = yi(function(e4, t3, n3, r3) { + kr(e4, t3, n3, r3); + }), Ea = $i(function(e4, t3) { + var n3 = {}; + if (e4 == null) + return n3; + var r3 = false; + t3 = ft(t3, function(t4) { + return t4 = ai(t4, e4), r3 || (r3 = t4.length > 1), t4; + }), _i(e4, Gi(e4), n3), r3 && (n3 = Qn(n3, 7, Hi)); + for (var i3 = t3.length; i3--; ) + Zr(n3, t3[i3]); + return n3; + }); + var Aa = $i(function(e4, t3) { + return e4 == null ? {} : function(e5, t4) { + return Mr(e5, t4, function(t5, n3) { + return ma(e5, n3); + }); + }(e4, t3); + }); + function Ca(e4, t3) { + if (e4 == null) + return {}; + var n3 = ft(Gi(e4), function(e5) { + return [e5]; + }); + return t3 = Qi(t3), Mr(e4, n3, function(e5, n4) { + return t3(e5, n4[0]); + }); + } + var ja = zi(ya), Ta = zi(wa); + function Oa(e4) { + return e4 == null ? [] : Nt(e4, ya(e4)); + } + var ka = Ei(function(e4, t3, n3) { + return t3 = t3.toLowerCase(), e4 + (n3 ? Na(t3) : t3); + }); + function Na(e4) { + return Fa(aa(e4).toLowerCase()); + } + function Ia(e4) { + return (e4 = aa(e4)) && e4.replace(le, Pt).replace(Me, ""); + } + var Ma = Ei(function(e4, t3, n3) { + return e4 + (n3 ? "-" : "") + t3.toLowerCase(); + }), Ra = Ei(function(e4, t3, n3) { + return e4 + (n3 ? " " : "") + t3.toLowerCase(); + }), Da = xi("toLowerCase"); + var Pa = Ei(function(e4, t3, n3) { + return e4 + (n3 ? "_" : "") + t3.toLowerCase(); + }); + var La = Ei(function(e4, t3, n3) { + return e4 + (n3 ? " " : "") + Fa(t3); + }); + var za = Ei(function(e4, t3, n3) { + return e4 + (n3 ? " " : "") + t3.toUpperCase(); + }), Fa = xi("toUpperCase"); + function Ba(e4, t3, n3) { + return e4 = aa(e4), (t3 = n3 ? void 0 : t3) === void 0 ? function(e5) { + return Le.test(e5); + }(e4) ? function(e5) { + return e5.match(De) || []; + }(e4) : function(e5) { + return e5.match(ee) || []; + }(e4) : e4.match(t3) || []; + } + var qa = zr(function(e4, t3) { + try { + return ot(e4, void 0, t3); + } catch (e5) { + return Fs(e5) ? e5 : new he2(e5); + } + }), Ha = $i(function(e4, t3) { + return at(t3, function(t4) { + t4 = Co(t4), Vn(e4, t4, _s(e4[t4], e4)); + }), e4; + }); + function Ua(e4) { + return function() { + return e4; + }; + } + var $a = ji(), Wa = ji(true); + function Ga(e4) { + return e4; + } + function Va(e4) { + return xr(typeof e4 == "function" ? e4 : Qn(e4, 1)); + } + var Ja = zr(function(e4, t3) { + return function(n3) { + return _r(n3, e4, t3); + }; + }), Xa = zr(function(e4, t3) { + return function(n3) { + return _r(e4, n3, t3); + }; + }); + function Qa(e4, t3, n3) { + var r3 = ya(t3), i3 = ur(t3, r3); + n3 != null || Us(t3) && (i3.length || !r3.length) || (n3 = t3, t3 = e4, e4 = this, i3 = ur(t3, ya(t3))); + var o2 = !(Us(n3) && "chain" in n3 && !n3.chain), s2 = Bs(e4); + return at(i3, function(n4) { + var r4 = t3[n4]; + e4[n4] = r4, s2 && (e4.prototype[n4] = function() { + var t4 = this.__chain__; + if (o2 || t4) { + var n5 = e4(this.__wrapped__), i4 = n5.__actions__ = vi(this.__actions__); + return i4.push({func: r4, args: arguments, thisArg: e4}), n5.__chain__ = t4, n5; + } + return r4.apply(e4, pt([this.value()], arguments)); + }); + }), e4; + } + function Ya() { + } + var Ka = Ni(ft), Za = Ni(lt), ec = Ni(vt); + function tc(e4) { + return co(e4) ? At(Co(e4)) : function(e5) { + return function(t3) { + return dr(t3, e5); + }; + }(e4); + } + var nc = Mi(), rc = Mi(true); + function ic() { + return []; + } + function oc() { + return false; + } + var sc = ki(function(e4, t3) { + return e4 + t3; + }, 0), ac = Pi("ceil"), cc = ki(function(e4, t3) { + return e4 / t3; + }, 1), lc = Pi("floor"); + var uc, dc = ki(function(e4, t3) { + return e4 * t3; + }, 1), hc = Pi("round"), fc = ki(function(e4, t3) { + return e4 - t3; + }, 0); + return Tn.after = function(e4, t3) { + if (typeof t3 != "function") + throw new _e2(o); + return e4 = ra(e4), function() { + if (--e4 < 1) + return t3.apply(this, arguments); + }; + }, Tn.ary = ms, Tn.assign = ca, Tn.assignIn = la, Tn.assignInWith = ua, Tn.assignWith = da, Tn.at = ha, Tn.before = vs, Tn.bind = _s, Tn.bindAll = Ha, Tn.bindKey = bs, Tn.castArray = function() { + if (!arguments.length) + return []; + var e4 = arguments[0]; + return Ms(e4) ? e4 : [e4]; + }, Tn.chain = ts, Tn.chunk = function(e4, t3, n3) { + t3 = (n3 ? ao(e4, t3, n3) : t3 === void 0) ? 1 : sn(ra(t3), 0); + var i3 = e4 == null ? 0 : e4.length; + if (!i3 || t3 < 1) + return []; + for (var o2 = 0, s2 = 0, a2 = r2(Kt(i3 / t3)); o2 < i3; ) + a2[s2++] = Wr(e4, o2, o2 += t3); + return a2; + }, Tn.compact = function(e4) { + for (var t3 = -1, n3 = e4 == null ? 0 : e4.length, r3 = 0, i3 = []; ++t3 < n3; ) { + var o2 = e4[t3]; + o2 && (i3[r3++] = o2); + } + return i3; + }, Tn.concat = function() { + var e4 = arguments.length; + if (!e4) + return []; + for (var t3 = r2(e4 - 1), n3 = arguments[0], i3 = e4; i3--; ) + t3[i3 - 1] = arguments[i3]; + return pt(Ms(n3) ? vi(n3) : [n3], or(t3, 1)); + }, Tn.cond = function(e4) { + var t3 = e4 == null ? 0 : e4.length, n3 = Qi(); + return e4 = t3 ? ft(e4, function(e5) { + if (typeof e5[1] != "function") + throw new _e2(o); + return [n3(e5[0]), e5[1]]; + }) : [], zr(function(n4) { + for (var r3 = -1; ++r3 < t3; ) { + var i3 = e4[r3]; + if (ot(i3[0], this, n4)) + return ot(i3[1], this, n4); + } + }); + }, Tn.conforms = function(e4) { + return function(e5) { + var t3 = ya(e5); + return function(n3) { + return Yn(n3, e5, t3); + }; + }(Qn(e4, 1)); + }, Tn.constant = Ua, Tn.countBy = is, Tn.create = function(e4, t3) { + var n3 = On(e4); + return t3 == null ? n3 : Gn(n3, t3); + }, Tn.curry = function e4(t3, n3, r3) { + var i3 = Fi(t3, 8, void 0, void 0, void 0, void 0, void 0, n3 = r3 ? void 0 : n3); + return i3.placeholder = e4.placeholder, i3; + }, Tn.curryRight = function e4(t3, n3, r3) { + var i3 = Fi(t3, 16, void 0, void 0, void 0, void 0, void 0, n3 = r3 ? void 0 : n3); + return i3.placeholder = e4.placeholder, i3; + }, Tn.debounce = ys, Tn.defaults = fa, Tn.defaultsDeep = pa, Tn.defer = ws, Tn.delay = Ss, Tn.difference = Oo, Tn.differenceBy = ko, Tn.differenceWith = No, Tn.drop = function(e4, t3, n3) { + var r3 = e4 == null ? 0 : e4.length; + return r3 ? Wr(e4, (t3 = n3 || t3 === void 0 ? 1 : ra(t3)) < 0 ? 0 : t3, r3) : []; + }, Tn.dropRight = function(e4, t3, n3) { + var r3 = e4 == null ? 0 : e4.length; + return r3 ? Wr(e4, 0, (t3 = r3 - (t3 = n3 || t3 === void 0 ? 1 : ra(t3))) < 0 ? 0 : t3) : []; + }, Tn.dropRightWhile = function(e4, t3) { + return e4 && e4.length ? ti(e4, Qi(t3, 3), true, true) : []; + }, Tn.dropWhile = function(e4, t3) { + return e4 && e4.length ? ti(e4, Qi(t3, 3), true) : []; + }, Tn.fill = function(e4, t3, n3, r3) { + var i3 = e4 == null ? 0 : e4.length; + return i3 ? (n3 && typeof n3 != "number" && ao(e4, t3, n3) && (n3 = 0, r3 = i3), function(e5, t4, n4, r4) { + var i4 = e5.length; + for ((n4 = ra(n4)) < 0 && (n4 = -n4 > i4 ? 0 : i4 + n4), (r4 = r4 === void 0 || r4 > i4 ? i4 : ra(r4)) < 0 && (r4 += i4), r4 = n4 > r4 ? 0 : ia(r4); n4 < r4; ) + e5[n4++] = t4; + return e5; + }(e4, t3, n3, r3)) : []; + }, Tn.filter = function(e4, t3) { + return (Ms(e4) ? ut : ir)(e4, Qi(t3, 3)); + }, Tn.flatMap = function(e4, t3) { + return or(hs(e4, t3), 1); + }, Tn.flatMapDeep = function(e4, t3) { + return or(hs(e4, t3), 1 / 0); + }, Tn.flatMapDepth = function(e4, t3, n3) { + return n3 = n3 === void 0 ? 1 : ra(n3), or(hs(e4, t3), n3); + }, Tn.flatten = Ro, Tn.flattenDeep = function(e4) { + return (e4 == null ? 0 : e4.length) ? or(e4, 1 / 0) : []; + }, Tn.flattenDepth = function(e4, t3) { + return (e4 == null ? 0 : e4.length) ? or(e4, t3 = t3 === void 0 ? 1 : ra(t3)) : []; + }, Tn.flip = function(e4) { + return Fi(e4, 512); + }, Tn.flow = $a, Tn.flowRight = Wa, Tn.fromPairs = function(e4) { + for (var t3 = -1, n3 = e4 == null ? 0 : e4.length, r3 = {}; ++t3 < n3; ) { + var i3 = e4[t3]; + r3[i3[0]] = i3[1]; + } + return r3; + }, Tn.functions = function(e4) { + return e4 == null ? [] : ur(e4, ya(e4)); + }, Tn.functionsIn = function(e4) { + return e4 == null ? [] : ur(e4, wa(e4)); + }, Tn.groupBy = ls, Tn.initial = function(e4) { + return (e4 == null ? 0 : e4.length) ? Wr(e4, 0, -1) : []; + }, Tn.intersection = Po, Tn.intersectionBy = Lo, Tn.intersectionWith = zo, Tn.invert = va, Tn.invertBy = _a, Tn.invokeMap = us, Tn.iteratee = Va, Tn.keyBy = ds, Tn.keys = ya, Tn.keysIn = wa, Tn.map = hs, Tn.mapKeys = function(e4, t3) { + var n3 = {}; + return t3 = Qi(t3, 3), cr(e4, function(e5, r3, i3) { + Vn(n3, t3(e5, r3, i3), e5); + }), n3; + }, Tn.mapValues = function(e4, t3) { + var n3 = {}; + return t3 = Qi(t3, 3), cr(e4, function(e5, r3, i3) { + Vn(n3, r3, t3(e5, r3, i3)); + }), n3; + }, Tn.matches = function(e4) { + return Tr(Qn(e4, 1)); + }, Tn.matchesProperty = function(e4, t3) { + return Or(e4, Qn(t3, 1)); + }, Tn.memoize = xs, Tn.merge = Sa, Tn.mergeWith = xa, Tn.method = Ja, Tn.methodOf = Xa, Tn.mixin = Qa, Tn.negate = Es, Tn.nthArg = function(e4) { + return e4 = ra(e4), zr(function(t3) { + return Nr(t3, e4); + }); + }, Tn.omit = Ea, Tn.omitBy = function(e4, t3) { + return Ca(e4, Es(Qi(t3))); + }, Tn.once = function(e4) { + return vs(2, e4); + }, Tn.orderBy = function(e4, t3, n3, r3) { + return e4 == null ? [] : (Ms(t3) || (t3 = t3 == null ? [] : [t3]), Ms(n3 = r3 ? void 0 : n3) || (n3 = n3 == null ? [] : [n3]), Ir(e4, t3, n3)); + }, Tn.over = Ka, Tn.overArgs = As, Tn.overEvery = Za, Tn.overSome = ec, Tn.partial = Cs, Tn.partialRight = js, Tn.partition = fs, Tn.pick = Aa, Tn.pickBy = Ca, Tn.property = tc, Tn.propertyOf = function(e4) { + return function(t3) { + return e4 == null ? void 0 : dr(e4, t3); + }; + }, Tn.pull = Bo, Tn.pullAll = qo, Tn.pullAllBy = function(e4, t3, n3) { + return e4 && e4.length && t3 && t3.length ? Rr(e4, t3, Qi(n3, 2)) : e4; + }, Tn.pullAllWith = function(e4, t3, n3) { + return e4 && e4.length && t3 && t3.length ? Rr(e4, t3, void 0, n3) : e4; + }, Tn.pullAt = Ho, Tn.range = nc, Tn.rangeRight = rc, Tn.rearg = Ts, Tn.reject = function(e4, t3) { + return (Ms(e4) ? ut : ir)(e4, Es(Qi(t3, 3))); + }, Tn.remove = function(e4, t3) { + var n3 = []; + if (!e4 || !e4.length) + return n3; + var r3 = -1, i3 = [], o2 = e4.length; + for (t3 = Qi(t3, 3); ++r3 < o2; ) { + var s2 = e4[r3]; + t3(s2, r3, e4) && (n3.push(s2), i3.push(r3)); + } + return Dr(e4, i3), n3; + }, Tn.rest = function(e4, t3) { + if (typeof e4 != "function") + throw new _e2(o); + return zr(e4, t3 = t3 === void 0 ? t3 : ra(t3)); + }, Tn.reverse = Uo, Tn.sampleSize = function(e4, t3, n3) { + return t3 = (n3 ? ao(e4, t3, n3) : t3 === void 0) ? 1 : ra(t3), (Ms(e4) ? Bn : Br)(e4, t3); + }, Tn.set = function(e4, t3, n3) { + return e4 == null ? e4 : qr(e4, t3, n3); + }, Tn.setWith = function(e4, t3, n3, r3) { + return r3 = typeof r3 == "function" ? r3 : void 0, e4 == null ? e4 : qr(e4, t3, n3, r3); + }, Tn.shuffle = function(e4) { + return (Ms(e4) ? qn : $r)(e4); + }, Tn.slice = function(e4, t3, n3) { + var r3 = e4 == null ? 0 : e4.length; + return r3 ? (n3 && typeof n3 != "number" && ao(e4, t3, n3) ? (t3 = 0, n3 = r3) : (t3 = t3 == null ? 0 : ra(t3), n3 = n3 === void 0 ? r3 : ra(n3)), Wr(e4, t3, n3)) : []; + }, Tn.sortBy = ps, Tn.sortedUniq = function(e4) { + return e4 && e4.length ? Xr(e4) : []; + }, Tn.sortedUniqBy = function(e4, t3) { + return e4 && e4.length ? Xr(e4, Qi(t3, 2)) : []; + }, Tn.split = function(e4, t3, n3) { + return n3 && typeof n3 != "number" && ao(e4, t3, n3) && (t3 = n3 = void 0), (n3 = n3 === void 0 ? 4294967295 : n3 >>> 0) ? (e4 = aa(e4)) && (typeof t3 == "string" || t3 != null && !Js(t3)) && !(t3 = Yr(t3)) && Ft(e4) ? li(Gt(e4), 0, n3) : e4.split(t3, n3) : []; + }, Tn.spread = function(e4, t3) { + if (typeof e4 != "function") + throw new _e2(o); + return t3 = t3 == null ? 0 : sn(ra(t3), 0), zr(function(n3) { + var r3 = n3[t3], i3 = li(n3, 0, t3); + return r3 && pt(i3, r3), ot(e4, this, i3); + }); + }, Tn.tail = function(e4) { + var t3 = e4 == null ? 0 : e4.length; + return t3 ? Wr(e4, 1, t3) : []; + }, Tn.take = function(e4, t3, n3) { + return e4 && e4.length ? Wr(e4, 0, (t3 = n3 || t3 === void 0 ? 1 : ra(t3)) < 0 ? 0 : t3) : []; + }, Tn.takeRight = function(e4, t3, n3) { + var r3 = e4 == null ? 0 : e4.length; + return r3 ? Wr(e4, (t3 = r3 - (t3 = n3 || t3 === void 0 ? 1 : ra(t3))) < 0 ? 0 : t3, r3) : []; + }, Tn.takeRightWhile = function(e4, t3) { + return e4 && e4.length ? ti(e4, Qi(t3, 3), false, true) : []; + }, Tn.takeWhile = function(e4, t3) { + return e4 && e4.length ? ti(e4, Qi(t3, 3)) : []; + }, Tn.tap = function(e4, t3) { + return t3(e4), e4; + }, Tn.throttle = function(e4, t3, n3) { + var r3 = true, i3 = true; + if (typeof e4 != "function") + throw new _e2(o); + return Us(n3) && (r3 = "leading" in n3 ? !!n3.leading : r3, i3 = "trailing" in n3 ? !!n3.trailing : i3), ys(e4, t3, {leading: r3, maxWait: t3, trailing: i3}); + }, Tn.thru = ns, Tn.toArray = ta, Tn.toPairs = ja, Tn.toPairsIn = Ta, Tn.toPath = function(e4) { + return Ms(e4) ? ft(e4, Co) : Ys(e4) ? [e4] : vi(Ao(aa(e4))); + }, Tn.toPlainObject = sa, Tn.transform = function(e4, t3, n3) { + var r3 = Ms(e4), i3 = r3 || Ls(e4) || Ks(e4); + if (t3 = Qi(t3, 4), n3 == null) { + var o2 = e4 && e4.constructor; + n3 = i3 ? r3 ? new o2() : [] : Us(e4) && Bs(o2) ? On(We2(e4)) : {}; + } + return (i3 ? at : cr)(e4, function(e5, r4, i4) { + return t3(n3, e5, r4, i4); + }), n3; + }, Tn.unary = function(e4) { + return ms(e4, 1); + }, Tn.union = $o, Tn.unionBy = Wo, Tn.unionWith = Go, Tn.uniq = function(e4) { + return e4 && e4.length ? Kr(e4) : []; + }, Tn.uniqBy = function(e4, t3) { + return e4 && e4.length ? Kr(e4, Qi(t3, 2)) : []; + }, Tn.uniqWith = function(e4, t3) { + return t3 = typeof t3 == "function" ? t3 : void 0, e4 && e4.length ? Kr(e4, void 0, t3) : []; + }, Tn.unset = function(e4, t3) { + return e4 == null || Zr(e4, t3); + }, Tn.unzip = Vo, Tn.unzipWith = Jo, Tn.update = function(e4, t3, n3) { + return e4 == null ? e4 : ei(e4, t3, si(n3)); + }, Tn.updateWith = function(e4, t3, n3, r3) { + return r3 = typeof r3 == "function" ? r3 : void 0, e4 == null ? e4 : ei(e4, t3, si(n3), r3); + }, Tn.values = Oa, Tn.valuesIn = function(e4) { + return e4 == null ? [] : Nt(e4, wa(e4)); + }, Tn.without = Xo, Tn.words = Ba, Tn.wrap = function(e4, t3) { + return Cs(si(t3), e4); + }, Tn.xor = Qo, Tn.xorBy = Yo, Tn.xorWith = Ko, Tn.zip = Zo, Tn.zipObject = function(e4, t3) { + return ii(e4 || [], t3 || [], Un); + }, Tn.zipObjectDeep = function(e4, t3) { + return ii(e4 || [], t3 || [], qr); + }, Tn.zipWith = es, Tn.entries = ja, Tn.entriesIn = Ta, Tn.extend = la, Tn.extendWith = ua, Qa(Tn, Tn), Tn.add = sc, Tn.attempt = qa, Tn.camelCase = ka, Tn.capitalize = Na, Tn.ceil = ac, Tn.clamp = function(e4, t3, n3) { + return n3 === void 0 && (n3 = t3, t3 = void 0), n3 !== void 0 && (n3 = (n3 = oa(n3)) == n3 ? n3 : 0), t3 !== void 0 && (t3 = (t3 = oa(t3)) == t3 ? t3 : 0), Xn(oa(e4), t3, n3); + }, Tn.clone = function(e4) { + return Qn(e4, 4); + }, Tn.cloneDeep = function(e4) { + return Qn(e4, 5); + }, Tn.cloneDeepWith = function(e4, t3) { + return Qn(e4, 5, t3 = typeof t3 == "function" ? t3 : void 0); + }, Tn.cloneWith = function(e4, t3) { + return Qn(e4, 4, t3 = typeof t3 == "function" ? t3 : void 0); + }, Tn.conformsTo = function(e4, t3) { + return t3 == null || Yn(e4, t3, ya(t3)); + }, Tn.deburr = Ia, Tn.defaultTo = function(e4, t3) { + return e4 == null || e4 != e4 ? t3 : e4; + }, Tn.divide = cc, Tn.endsWith = function(e4, t3, n3) { + e4 = aa(e4), t3 = Yr(t3); + var r3 = e4.length, i3 = n3 = n3 === void 0 ? r3 : Xn(ra(n3), 0, r3); + return (n3 -= t3.length) >= 0 && e4.slice(n3, i3) == t3; + }, Tn.eq = Os, Tn.escape = function(e4) { + return (e4 = aa(e4)) && F.test(e4) ? e4.replace(L, Lt) : e4; + }, Tn.escapeRegExp = function(e4) { + return (e4 = aa(e4)) && V.test(e4) ? e4.replace(G, "\\$&") : e4; + }, Tn.every = function(e4, t3, n3) { + var r3 = Ms(e4) ? lt : nr; + return n3 && ao(e4, t3, n3) && (t3 = void 0), r3(e4, Qi(t3, 3)); + }, Tn.find = os, Tn.findIndex = Io, Tn.findKey = function(e4, t3) { + return bt(e4, Qi(t3, 3), cr); + }, Tn.findLast = ss, Tn.findLastIndex = Mo, Tn.findLastKey = function(e4, t3) { + return bt(e4, Qi(t3, 3), lr); + }, Tn.floor = lc, Tn.forEach = as, Tn.forEachRight = cs, Tn.forIn = function(e4, t3) { + return e4 == null ? e4 : sr(e4, Qi(t3, 3), wa); + }, Tn.forInRight = function(e4, t3) { + return e4 == null ? e4 : ar(e4, Qi(t3, 3), wa); + }, Tn.forOwn = function(e4, t3) { + return e4 && cr(e4, Qi(t3, 3)); + }, Tn.forOwnRight = function(e4, t3) { + return e4 && lr(e4, Qi(t3, 3)); + }, Tn.get = ga, Tn.gt = ks, Tn.gte = Ns, Tn.has = function(e4, t3) { + return e4 != null && ro(e4, t3, gr); + }, Tn.hasIn = ma, Tn.head = Do, Tn.identity = Ga, Tn.includes = function(e4, t3, n3, r3) { + e4 = Ds(e4) ? e4 : Oa(e4), n3 = n3 && !r3 ? ra(n3) : 0; + var i3 = e4.length; + return n3 < 0 && (n3 = sn(i3 + n3, 0)), Qs(e4) ? n3 <= i3 && e4.indexOf(t3, n3) > -1 : !!i3 && wt(e4, t3, n3) > -1; + }, Tn.indexOf = function(e4, t3, n3) { + var r3 = e4 == null ? 0 : e4.length; + if (!r3) + return -1; + var i3 = n3 == null ? 0 : ra(n3); + return i3 < 0 && (i3 = sn(r3 + i3, 0)), wt(e4, t3, i3); + }, Tn.inRange = function(e4, t3, n3) { + return t3 = na(t3), n3 === void 0 ? (n3 = t3, t3 = 0) : n3 = na(n3), function(e5, t4, n4) { + return e5 >= an(t4, n4) && e5 < sn(t4, n4); + }(e4 = oa(e4), t3, n3); + }, Tn.invoke = ba, Tn.isArguments = Is, Tn.isArray = Ms, Tn.isArrayBuffer = Rs, Tn.isArrayLike = Ds, Tn.isArrayLikeObject = Ps, Tn.isBoolean = function(e4) { + return e4 === true || e4 === false || $s(e4) && fr(e4) == u; + }, Tn.isBuffer = Ls, Tn.isDate = zs, Tn.isElement = function(e4) { + return $s(e4) && e4.nodeType === 1 && !Vs(e4); + }, Tn.isEmpty = function(e4) { + if (e4 == null) + return true; + if (Ds(e4) && (Ms(e4) || typeof e4 == "string" || typeof e4.splice == "function" || Ls(e4) || Ks(e4) || Is(e4))) + return !e4.length; + var t3 = no(e4); + if (t3 == g || t3 == b) + return !e4.size; + if (ho(e4)) + return !Er(e4).length; + for (var n3 in e4) + if (Ee2.call(e4, n3)) + return false; + return true; + }, Tn.isEqual = function(e4, t3) { + return yr(e4, t3); + }, Tn.isEqualWith = function(e4, t3, n3) { + var r3 = (n3 = typeof n3 == "function" ? n3 : void 0) ? n3(e4, t3) : void 0; + return r3 === void 0 ? yr(e4, t3, void 0, n3) : !!r3; + }, Tn.isError = Fs, Tn.isFinite = function(e4) { + return typeof e4 == "number" && nn(e4); + }, Tn.isFunction = Bs, Tn.isInteger = qs, Tn.isLength = Hs, Tn.isMap = Ws, Tn.isMatch = function(e4, t3) { + return e4 === t3 || wr(e4, t3, Ki(t3)); + }, Tn.isMatchWith = function(e4, t3, n3) { + return n3 = typeof n3 == "function" ? n3 : void 0, wr(e4, t3, Ki(t3), n3); + }, Tn.isNaN = function(e4) { + return Gs(e4) && e4 != +e4; + }, Tn.isNative = function(e4) { + if (uo(e4)) + throw new he2("Unsupported core-js use. Try https://npms.io/search?q=ponyfill."); + return Sr(e4); + }, Tn.isNil = function(e4) { + return e4 == null; + }, Tn.isNull = function(e4) { + return e4 === null; + }, Tn.isNumber = Gs, Tn.isObject = Us, Tn.isObjectLike = $s, Tn.isPlainObject = Vs, Tn.isRegExp = Js, Tn.isSafeInteger = function(e4) { + return qs(e4) && e4 >= -9007199254740991 && e4 <= 9007199254740991; + }, Tn.isSet = Xs, Tn.isString = Qs, Tn.isSymbol = Ys, Tn.isTypedArray = Ks, Tn.isUndefined = function(e4) { + return e4 === void 0; + }, Tn.isWeakMap = function(e4) { + return $s(e4) && no(e4) == S; + }, Tn.isWeakSet = function(e4) { + return $s(e4) && fr(e4) == "[object WeakSet]"; + }, Tn.join = function(e4, t3) { + return e4 == null ? "" : rn.call(e4, t3); + }, Tn.kebabCase = Ma, Tn.last = Fo, Tn.lastIndexOf = function(e4, t3, n3) { + var r3 = e4 == null ? 0 : e4.length; + if (!r3) + return -1; + var i3 = r3; + return n3 !== void 0 && (i3 = (i3 = ra(n3)) < 0 ? sn(r3 + i3, 0) : an(i3, r3 - 1)), t3 == t3 ? function(e5, t4, n4) { + for (var r4 = n4 + 1; r4--; ) + if (e5[r4] === t4) + return r4; + return r4; + }(e4, t3, i3) : yt(e4, xt, i3, true); + }, Tn.lowerCase = Ra, Tn.lowerFirst = Da, Tn.lt = Zs, Tn.lte = ea, Tn.max = function(e4) { + return e4 && e4.length ? rr(e4, Ga, pr) : void 0; + }, Tn.maxBy = function(e4, t3) { + return e4 && e4.length ? rr(e4, Qi(t3, 2), pr) : void 0; + }, Tn.mean = function(e4) { + return Et(e4, Ga); + }, Tn.meanBy = function(e4, t3) { + return Et(e4, Qi(t3, 2)); + }, Tn.min = function(e4) { + return e4 && e4.length ? rr(e4, Ga, Cr) : void 0; + }, Tn.minBy = function(e4, t3) { + return e4 && e4.length ? rr(e4, Qi(t3, 2), Cr) : void 0; + }, Tn.stubArray = ic, Tn.stubFalse = oc, Tn.stubObject = function() { + return {}; + }, Tn.stubString = function() { + return ""; + }, Tn.stubTrue = function() { + return true; + }, Tn.multiply = dc, Tn.nth = function(e4, t3) { + return e4 && e4.length ? Nr(e4, ra(t3)) : void 0; + }, Tn.noConflict = function() { + return Ve._ === this && (Ve._ = Oe2), this; + }, Tn.noop = Ya, Tn.now = gs, Tn.pad = function(e4, t3, n3) { + e4 = aa(e4); + var r3 = (t3 = ra(t3)) ? Wt(e4) : 0; + if (!t3 || r3 >= t3) + return e4; + var i3 = (t3 - r3) / 2; + return Ii(Zt(i3), n3) + e4 + Ii(Kt(i3), n3); + }, Tn.padEnd = function(e4, t3, n3) { + e4 = aa(e4); + var r3 = (t3 = ra(t3)) ? Wt(e4) : 0; + return t3 && r3 < t3 ? e4 + Ii(t3 - r3, n3) : e4; + }, Tn.padStart = function(e4, t3, n3) { + e4 = aa(e4); + var r3 = (t3 = ra(t3)) ? Wt(e4) : 0; + return t3 && r3 < t3 ? Ii(t3 - r3, n3) + e4 : e4; + }, Tn.parseInt = function(e4, t3, n3) { + return n3 || t3 == null ? t3 = 0 : t3 && (t3 = +t3), ln(aa(e4).replace(X, ""), t3 || 0); + }, Tn.random = function(e4, t3, n3) { + if (n3 && typeof n3 != "boolean" && ao(e4, t3, n3) && (t3 = n3 = void 0), n3 === void 0 && (typeof t3 == "boolean" ? (n3 = t3, t3 = void 0) : typeof e4 == "boolean" && (n3 = e4, e4 = void 0)), e4 === void 0 && t3 === void 0 ? (e4 = 0, t3 = 1) : (e4 = na(e4), t3 === void 0 ? (t3 = e4, e4 = 0) : t3 = na(t3)), e4 > t3) { + var r3 = e4; + e4 = t3, t3 = r3; + } + if (n3 || e4 % 1 || t3 % 1) { + var i3 = un(); + return an(e4 + i3 * (t3 - e4 + Ue("1e-" + ((i3 + "").length - 1))), t3); + } + return Pr(e4, t3); + }, Tn.reduce = function(e4, t3, n3) { + var r3 = Ms(e4) ? gt : jt, i3 = arguments.length < 3; + return r3(e4, Qi(t3, 4), n3, i3, er); + }, Tn.reduceRight = function(e4, t3, n3) { + var r3 = Ms(e4) ? mt : jt, i3 = arguments.length < 3; + return r3(e4, Qi(t3, 4), n3, i3, tr); + }, Tn.repeat = function(e4, t3, n3) { + return t3 = (n3 ? ao(e4, t3, n3) : t3 === void 0) ? 1 : ra(t3), Lr(aa(e4), t3); + }, Tn.replace = function() { + var e4 = arguments, t3 = aa(e4[0]); + return e4.length < 3 ? t3 : t3.replace(e4[1], e4[2]); + }, Tn.result = function(e4, t3, n3) { + var r3 = -1, i3 = (t3 = ai(t3, e4)).length; + for (i3 || (i3 = 1, e4 = void 0); ++r3 < i3; ) { + var o2 = e4 == null ? void 0 : e4[Co(t3[r3])]; + o2 === void 0 && (r3 = i3, o2 = n3), e4 = Bs(o2) ? o2.call(e4) : o2; + } + return e4; + }, Tn.round = hc, Tn.runInContext = e3, Tn.sample = function(e4) { + return (Ms(e4) ? Fn : Fr)(e4); + }, Tn.size = function(e4) { + if (e4 == null) + return 0; + if (Ds(e4)) + return Qs(e4) ? Wt(e4) : e4.length; + var t3 = no(e4); + return t3 == g || t3 == b ? e4.size : Er(e4).length; + }, Tn.snakeCase = Pa, Tn.some = function(e4, t3, n3) { + var r3 = Ms(e4) ? vt : Gr; + return n3 && ao(e4, t3, n3) && (t3 = void 0), r3(e4, Qi(t3, 3)); + }, Tn.sortedIndex = function(e4, t3) { + return Vr(e4, t3); + }, Tn.sortedIndexBy = function(e4, t3, n3) { + return Jr(e4, t3, Qi(n3, 2)); + }, Tn.sortedIndexOf = function(e4, t3) { + var n3 = e4 == null ? 0 : e4.length; + if (n3) { + var r3 = Vr(e4, t3); + if (r3 < n3 && Os(e4[r3], t3)) + return r3; + } + return -1; + }, Tn.sortedLastIndex = function(e4, t3) { + return Vr(e4, t3, true); + }, Tn.sortedLastIndexBy = function(e4, t3, n3) { + return Jr(e4, t3, Qi(n3, 2), true); + }, Tn.sortedLastIndexOf = function(e4, t3) { + if (e4 == null ? 0 : e4.length) { + var n3 = Vr(e4, t3, true) - 1; + if (Os(e4[n3], t3)) + return n3; + } + return -1; + }, Tn.startCase = La, Tn.startsWith = function(e4, t3, n3) { + return e4 = aa(e4), n3 = n3 == null ? 0 : Xn(ra(n3), 0, e4.length), t3 = Yr(t3), e4.slice(n3, n3 + t3.length) == t3; + }, Tn.subtract = fc, Tn.sum = function(e4) { + return e4 && e4.length ? Tt(e4, Ga) : 0; + }, Tn.sumBy = function(e4, t3) { + return e4 && e4.length ? Tt(e4, Qi(t3, 2)) : 0; + }, Tn.template = function(e4, t3, n3) { + var r3 = Tn.templateSettings; + n3 && ao(e4, t3, n3) && (t3 = void 0), e4 = aa(e4), t3 = ua({}, t3, r3, Bi); + var i3, o2, s2 = ua({}, t3.imports, r3.imports, Bi), a2 = ya(s2), c2 = Nt(s2, a2), l2 = 0, u2 = t3.interpolate || ue, d2 = "__p += '", h2 = me2((t3.escape || ue).source + "|" + u2.source + "|" + (u2 === H ? ne : ue).source + "|" + (t3.evaluate || ue).source + "|$", "g"), f2 = "//# sourceURL=" + (Ee2.call(t3, "sourceURL") ? (t3.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++Fe + "]") + "\n"; + e4.replace(h2, function(t4, n4, r4, s3, a3, c3) { + return r4 || (r4 = s3), d2 += e4.slice(l2, c3).replace(de, zt), n4 && (i3 = true, d2 += "' +\n__e(" + n4 + ") +\n'"), a3 && (o2 = true, d2 += "';\n" + a3 + ";\n__p += '"), r4 && (d2 += "' +\n((__t = (" + r4 + ")) == null ? '' : __t) +\n'"), l2 = c3 + t4.length, t4; + }), d2 += "';\n"; + var p2 = Ee2.call(t3, "variable") && t3.variable; + p2 || (d2 = "with (obj) {\n" + d2 + "\n}\n"), d2 = (o2 ? d2.replace(M, "") : d2).replace(R, "$1").replace(D, "$1;"), d2 = "function(" + (p2 || "obj") + ") {\n" + (p2 ? "" : "obj || (obj = {});\n") + "var __t, __p = ''" + (i3 ? ", __e = _.escape" : "") + (o2 ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + d2 + "return __p\n}"; + var g2 = qa(function() { + return fe2(a2, f2 + "return " + d2).apply(void 0, c2); + }); + if (g2.source = d2, Fs(g2)) + throw g2; + return g2; + }, Tn.times = function(e4, t3) { + if ((e4 = ra(e4)) < 1 || e4 > 9007199254740991) + return []; + var n3 = 4294967295, r3 = an(e4, 4294967295); + e4 -= 4294967295; + for (var i3 = Ot(r3, t3 = Qi(t3)); ++n3 < e4; ) + t3(n3); + return i3; + }, Tn.toFinite = na, Tn.toInteger = ra, Tn.toLength = ia, Tn.toLower = function(e4) { + return aa(e4).toLowerCase(); + }, Tn.toNumber = oa, Tn.toSafeInteger = function(e4) { + return e4 ? Xn(ra(e4), -9007199254740991, 9007199254740991) : e4 === 0 ? e4 : 0; + }, Tn.toString = aa, Tn.toUpper = function(e4) { + return aa(e4).toUpperCase(); + }, Tn.trim = function(e4, t3, n3) { + if ((e4 = aa(e4)) && (n3 || t3 === void 0)) + return e4.replace(J, ""); + if (!e4 || !(t3 = Yr(t3))) + return e4; + var r3 = Gt(e4), i3 = Gt(t3); + return li(r3, Mt(r3, i3), Rt(r3, i3) + 1).join(""); + }, Tn.trimEnd = function(e4, t3, n3) { + if ((e4 = aa(e4)) && (n3 || t3 === void 0)) + return e4.replace(Q, ""); + if (!e4 || !(t3 = Yr(t3))) + return e4; + var r3 = Gt(e4); + return li(r3, 0, Rt(r3, Gt(t3)) + 1).join(""); + }, Tn.trimStart = function(e4, t3, n3) { + if ((e4 = aa(e4)) && (n3 || t3 === void 0)) + return e4.replace(X, ""); + if (!e4 || !(t3 = Yr(t3))) + return e4; + var r3 = Gt(e4); + return li(r3, Mt(r3, Gt(t3))).join(""); + }, Tn.truncate = function(e4, t3) { + var n3 = 30, r3 = "..."; + if (Us(t3)) { + var i3 = "separator" in t3 ? t3.separator : i3; + n3 = "length" in t3 ? ra(t3.length) : n3, r3 = "omission" in t3 ? Yr(t3.omission) : r3; + } + var o2 = (e4 = aa(e4)).length; + if (Ft(e4)) { + var s2 = Gt(e4); + o2 = s2.length; + } + if (n3 >= o2) + return e4; + var a2 = n3 - Wt(r3); + if (a2 < 1) + return r3; + var c2 = s2 ? li(s2, 0, a2).join("") : e4.slice(0, a2); + if (i3 === void 0) + return c2 + r3; + if (s2 && (a2 += c2.length - a2), Js(i3)) { + if (e4.slice(a2).search(i3)) { + var l2, u2 = c2; + for (i3.global || (i3 = me2(i3.source, aa(re.exec(i3)) + "g")), i3.lastIndex = 0; l2 = i3.exec(u2); ) + var d2 = l2.index; + c2 = c2.slice(0, d2 === void 0 ? a2 : d2); + } + } else if (e4.indexOf(Yr(i3), a2) != a2) { + var h2 = c2.lastIndexOf(i3); + h2 > -1 && (c2 = c2.slice(0, h2)); + } + return c2 + r3; + }, Tn.unescape = function(e4) { + return (e4 = aa(e4)) && z.test(e4) ? e4.replace(P, Vt) : e4; + }, Tn.uniqueId = function(e4) { + var t3 = ++Ae2; + return aa(e4) + t3; + }, Tn.upperCase = za, Tn.upperFirst = Fa, Tn.each = as, Tn.eachRight = cs, Tn.first = Do, Qa(Tn, (uc = {}, cr(Tn, function(e4, t3) { + Ee2.call(Tn.prototype, t3) || (uc[t3] = e4); + }), uc), {chain: false}), Tn.VERSION = "4.17.20", at(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(e4) { + Tn[e4].placeholder = Tn; + }), at(["drop", "take"], function(e4, t3) { + In.prototype[e4] = function(n3) { + n3 = n3 === void 0 ? 1 : sn(ra(n3), 0); + var r3 = this.__filtered__ && !t3 ? new In(this) : this.clone(); + return r3.__filtered__ ? r3.__takeCount__ = an(n3, r3.__takeCount__) : r3.__views__.push({size: an(n3, 4294967295), type: e4 + (r3.__dir__ < 0 ? "Right" : "")}), r3; + }, In.prototype[e4 + "Right"] = function(t4) { + return this.reverse()[e4](t4).reverse(); + }; + }), at(["filter", "map", "takeWhile"], function(e4, t3) { + var n3 = t3 + 1, r3 = n3 == 1 || n3 == 3; + In.prototype[e4] = function(e5) { + var t4 = this.clone(); + return t4.__iteratees__.push({iteratee: Qi(e5, 3), type: n3}), t4.__filtered__ = t4.__filtered__ || r3, t4; + }; + }), at(["head", "last"], function(e4, t3) { + var n3 = "take" + (t3 ? "Right" : ""); + In.prototype[e4] = function() { + return this[n3](1).value()[0]; + }; + }), at(["initial", "tail"], function(e4, t3) { + var n3 = "drop" + (t3 ? "" : "Right"); + In.prototype[e4] = function() { + return this.__filtered__ ? new In(this) : this[n3](1); + }; + }), In.prototype.compact = function() { + return this.filter(Ga); + }, In.prototype.find = function(e4) { + return this.filter(e4).head(); + }, In.prototype.findLast = function(e4) { + return this.reverse().find(e4); + }, In.prototype.invokeMap = zr(function(e4, t3) { + return typeof e4 == "function" ? new In(this) : this.map(function(n3) { + return _r(n3, e4, t3); + }); + }), In.prototype.reject = function(e4) { + return this.filter(Es(Qi(e4))); + }, In.prototype.slice = function(e4, t3) { + e4 = ra(e4); + var n3 = this; + return n3.__filtered__ && (e4 > 0 || t3 < 0) ? new In(n3) : (e4 < 0 ? n3 = n3.takeRight(-e4) : e4 && (n3 = n3.drop(e4)), t3 !== void 0 && (n3 = (t3 = ra(t3)) < 0 ? n3.dropRight(-t3) : n3.take(t3 - e4)), n3); + }, In.prototype.takeRightWhile = function(e4) { + return this.reverse().takeWhile(e4).reverse(); + }, In.prototype.toArray = function() { + return this.take(4294967295); + }, cr(In.prototype, function(e4, t3) { + var n3 = /^(?:filter|find|map|reject)|While$/.test(t3), r3 = /^(?:head|last)$/.test(t3), i3 = Tn[r3 ? "take" + (t3 == "last" ? "Right" : "") : t3], o2 = r3 || /^find/.test(t3); + i3 && (Tn.prototype[t3] = function() { + var t4 = this.__wrapped__, s2 = r3 ? [1] : arguments, a2 = t4 instanceof In, c2 = s2[0], l2 = a2 || Ms(t4), u2 = function(e5) { + var t5 = i3.apply(Tn, pt([e5], s2)); + return r3 && d2 ? t5[0] : t5; + }; + l2 && n3 && typeof c2 == "function" && c2.length != 1 && (a2 = l2 = false); + var d2 = this.__chain__, h2 = !!this.__actions__.length, f2 = o2 && !d2, p2 = a2 && !h2; + if (!o2 && l2) { + t4 = p2 ? t4 : new In(this); + var g2 = e4.apply(t4, s2); + return g2.__actions__.push({func: ns, args: [u2], thisArg: void 0}), new Nn(g2, d2); + } + return f2 && p2 ? e4.apply(this, s2) : (g2 = this.thru(u2), f2 ? r3 ? g2.value()[0] : g2.value() : g2); + }); + }), at(["pop", "push", "shift", "sort", "splice", "unshift"], function(e4) { + var t3 = be2[e4], n3 = /^(?:push|sort|unshift)$/.test(e4) ? "tap" : "thru", r3 = /^(?:pop|shift)$/.test(e4); + Tn.prototype[e4] = function() { + var e5 = arguments; + if (r3 && !this.__chain__) { + var i3 = this.value(); + return t3.apply(Ms(i3) ? i3 : [], e5); + } + return this[n3](function(n4) { + return t3.apply(Ms(n4) ? n4 : [], e5); + }); + }; + }), cr(In.prototype, function(e4, t3) { + var n3 = Tn[t3]; + if (n3) { + var r3 = n3.name + ""; + Ee2.call(bn, r3) || (bn[r3] = []), bn[r3].push({name: t3, func: n3}); + } + }), bn[Ti(void 0, 2).name] = [{name: "wrapper", func: void 0}], In.prototype.clone = function() { + var e4 = new In(this.__wrapped__); + return e4.__actions__ = vi(this.__actions__), e4.__dir__ = this.__dir__, e4.__filtered__ = this.__filtered__, e4.__iteratees__ = vi(this.__iteratees__), e4.__takeCount__ = this.__takeCount__, e4.__views__ = vi(this.__views__), e4; + }, In.prototype.reverse = function() { + if (this.__filtered__) { + var e4 = new In(this); + e4.__dir__ = -1, e4.__filtered__ = true; + } else + (e4 = this.clone()).__dir__ *= -1; + return e4; + }, In.prototype.value = function() { + var e4 = this.__wrapped__.value(), t3 = this.__dir__, n3 = Ms(e4), r3 = t3 < 0, i3 = n3 ? e4.length : 0, o2 = function(e5, t4, n4) { + var r4 = -1, i4 = n4.length; + for (; ++r4 < i4; ) { + var o3 = n4[r4], s3 = o3.size; + switch (o3.type) { + case "drop": + e5 += s3; + break; + case "dropRight": + t4 -= s3; + break; + case "take": + t4 = an(t4, e5 + s3); + break; + case "takeRight": + e5 = sn(e5, t4 - s3); + } + } + return {start: e5, end: t4}; + }(0, i3, this.__views__), s2 = o2.start, a2 = o2.end, c2 = a2 - s2, l2 = r3 ? a2 : s2 - 1, u2 = this.__iteratees__, d2 = u2.length, h2 = 0, f2 = an(c2, this.__takeCount__); + if (!n3 || !r3 && i3 == c2 && f2 == c2) + return ni(e4, this.__actions__); + var p2 = []; + e: + for (; c2-- && h2 < f2; ) { + for (var g2 = -1, m2 = e4[l2 += t3]; ++g2 < d2; ) { + var v2 = u2[g2], _2 = v2.iteratee, b2 = v2.type, y2 = _2(m2); + if (b2 == 2) + m2 = y2; + else if (!y2) { + if (b2 == 1) + continue e; + break e; + } + } + p2[h2++] = m2; + } + return p2; + }, Tn.prototype.at = rs, Tn.prototype.chain = function() { + return ts(this); + }, Tn.prototype.commit = function() { + return new Nn(this.value(), this.__chain__); + }, Tn.prototype.next = function() { + this.__values__ === void 0 && (this.__values__ = ta(this.value())); + var e4 = this.__index__ >= this.__values__.length; + return {done: e4, value: e4 ? void 0 : this.__values__[this.__index__++]}; + }, Tn.prototype.plant = function(e4) { + for (var t3, n3 = this; n3 instanceof kn; ) { + var r3 = To(n3); + r3.__index__ = 0, r3.__values__ = void 0, t3 ? i3.__wrapped__ = r3 : t3 = r3; + var i3 = r3; + n3 = n3.__wrapped__; + } + return i3.__wrapped__ = e4, t3; + }, Tn.prototype.reverse = function() { + var e4 = this.__wrapped__; + if (e4 instanceof In) { + var t3 = e4; + return this.__actions__.length && (t3 = new In(this)), (t3 = t3.reverse()).__actions__.push({func: ns, args: [Uo], thisArg: void 0}), new Nn(t3, this.__chain__); + } + return this.thru(Uo); + }, Tn.prototype.toJSON = Tn.prototype.valueOf = Tn.prototype.value = function() { + return ni(this.__wrapped__, this.__actions__); + }, Tn.prototype.first = Tn.prototype.head, Ke2 && (Tn.prototype[Ke2] = function() { + return this; + }), Tn; + }(); + Ve._ = Jt, (i = function() { + return Jt; + }.call(t, n, t, r)) === void 0 || (r.exports = i); + }).call(this); + }).call(this, n(12), n(46)(e)); + }, function(e, t, n) { + e.exports = n(337); + }, function(e, t, n) { + e.exports = n(351); + }, function(e, t) { + e.exports = function(e2) { + return e2.webpackPolyfill || (e2.deprecate = function() { + }, e2.paths = [], e2.children || (e2.children = []), Object.defineProperty(e2, "loaded", {enumerable: true, get: function() { + return e2.l; + }}), Object.defineProperty(e2, "id", {enumerable: true, get: function() { + return e2.i; + }}), e2.webpackPolyfill = 1), e2; + }; + }, function(e, t, n) { + function r(e2) { + this.options = e2 || {locator: {}}; + } + function i() { + this.cdata = false; + } + function o(e2, t2) { + t2.lineNumber = e2.lineNumber, t2.columnNumber = e2.columnNumber; + } + function s(e2) { + if (e2) + return "\n@" + (e2.systemId || "") + "#[line:" + e2.lineNumber + ",col:" + e2.columnNumber + "]"; + } + function a(e2, t2, n2) { + return typeof e2 == "string" ? e2.substr(t2, n2) : e2.length >= t2 + n2 || t2 ? new java.lang.String(e2, t2, n2) + "" : e2; + } + function c(e2, t2) { + e2.currentElement ? e2.currentElement.appendChild(t2) : e2.doc.appendChild(t2); + } + r.prototype.parseFromString = function(e2, t2) { + var n2 = this.options, r2 = new l(), o2 = n2.domBuilder || new i(), a2 = n2.errorHandler, c2 = n2.locator, u2 = n2.xmlns || {}, d = {lt: "<", gt: ">", amp: "&", quot: '"', apos: "'"}; + return c2 && o2.setDocumentLocator(c2), r2.errorHandler = function(e3, t3, n3) { + if (!e3) { + if (t3 instanceof i) + return t3; + e3 = t3; + } + var r3 = {}, o3 = e3 instanceof Function; + function a3(t4) { + var i2 = e3[t4]; + !i2 && o3 && (i2 = e3.length == 2 ? function(n4) { + e3(t4, n4); + } : e3), r3[t4] = i2 && function(e4) { + i2("[xmldom " + t4 + "] " + e4 + s(n3)); + } || function() { + }; + } + return n3 = n3 || {}, a3("warning"), a3("error"), a3("fatalError"), r3; + }(a2, o2, c2), r2.domBuilder = n2.domBuilder || o2, /\/x?html?$/.test(t2) && (d.nbsp = "\xA0", d.copy = "\xA9", u2[""] = "http://www.w3.org/1999/xhtml"), u2.xml = u2.xml || "http://www.w3.org/XML/1998/namespace", e2 ? r2.parse(e2, u2, d) : r2.errorHandler.error("invalid doc source"), o2.doc; + }, i.prototype = {startDocument: function() { + this.doc = new u().createDocument(null, null, null), this.locator && (this.doc.documentURI = this.locator.systemId); + }, startElement: function(e2, t2, n2, r2) { + var i2 = this.doc, s2 = i2.createElementNS(e2, n2 || t2), a2 = r2.length; + c(this, s2), this.currentElement = s2, this.locator && o(this.locator, s2); + for (var l2 = 0; l2 < a2; l2++) { + e2 = r2.getURI(l2); + var u2 = r2.getValue(l2), d = (n2 = r2.getQName(l2), i2.createAttributeNS(e2, n2)); + this.locator && o(r2.getLocator(l2), d), d.value = d.nodeValue = u2, s2.setAttributeNode(d); + } + }, endElement: function(e2, t2, n2) { + var r2 = this.currentElement; + r2.tagName; + this.currentElement = r2.parentNode; + }, startPrefixMapping: function(e2, t2) { + }, endPrefixMapping: function(e2) { + }, processingInstruction: function(e2, t2) { + var n2 = this.doc.createProcessingInstruction(e2, t2); + this.locator && o(this.locator, n2), c(this, n2); + }, ignorableWhitespace: function(e2, t2, n2) { + }, characters: function(e2, t2, n2) { + if (e2 = a.apply(this, arguments)) { + if (this.cdata) + var r2 = this.doc.createCDATASection(e2); + else + r2 = this.doc.createTextNode(e2); + this.currentElement ? this.currentElement.appendChild(r2) : /^\s*$/.test(e2) && this.doc.appendChild(r2), this.locator && o(this.locator, r2); + } + }, skippedEntity: function(e2) { + }, endDocument: function() { + this.doc.normalize(); + }, setDocumentLocator: function(e2) { + (this.locator = e2) && (e2.lineNumber = 0); + }, comment: function(e2, t2, n2) { + e2 = a.apply(this, arguments); + var r2 = this.doc.createComment(e2); + this.locator && o(this.locator, r2), c(this, r2); + }, startCDATA: function() { + this.cdata = true; + }, endCDATA: function() { + this.cdata = false; + }, startDTD: function(e2, t2, n2) { + var r2 = this.doc.implementation; + if (r2 && r2.createDocumentType) { + var i2 = r2.createDocumentType(e2, t2, n2); + this.locator && o(this.locator, i2), c(this, i2); + } + }, warning: function(e2) { + console.warn("[xmldom warning] " + e2, s(this.locator)); + }, error: function(e2) { + console.error("[xmldom error] " + e2, s(this.locator)); + }, fatalError: function(e2) { + throw console.error("[xmldom fatalError] " + e2, s(this.locator)), e2; + }}, "endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g, function(e2) { + i.prototype[e2] = function() { + return null; + }; + }); + var l = n(329).XMLReader, u = t.DOMImplementation = n(95).DOMImplementation; + t.XMLSerializer = n(95).XMLSerializer, t.DOMParser = r; + }, function(e, t, n) { + var r = n(25), i = n(23); + e.exports = function(e2) { + return typeof e2 == "symbol" || i(e2) && r(e2) == "[object Symbol]"; + }; + }, function(e, t, n) { + var r = n(11).Symbol; + e.exports = r; + }, function(e, t) { + e.exports = function(e2, t2) { + return e2 === t2 || e2 != e2 && t2 != t2; + }; + }, function(e, t, n) { + var r = n(74), i = n(20); + e.exports = function(e2) { + return function() { + var t2 = arguments; + switch (t2.length) { + case 0: + return new e2(); + case 1: + return new e2(t2[0]); + case 2: + return new e2(t2[0], t2[1]); + case 3: + return new e2(t2[0], t2[1], t2[2]); + case 4: + return new e2(t2[0], t2[1], t2[2], t2[3]); + case 5: + return new e2(t2[0], t2[1], t2[2], t2[3], t2[4]); + case 6: + return new e2(t2[0], t2[1], t2[2], t2[3], t2[4], t2[5]); + case 7: + return new e2(t2[0], t2[1], t2[2], t2[3], t2[4], t2[5], t2[6]); + } + var n2 = r(e2.prototype), o = e2.apply(n2, t2); + return i(o) ? o : n2; + }; + }; + }, function(e, t) { + e.exports = function(e2, t2) { + for (var n = -1, r = e2.length, i = 0, o = []; ++n < r; ) { + var s = e2[n]; + s !== t2 && s !== "__lodash_placeholder__" || (e2[n] = "__lodash_placeholder__", o[i++] = n); + } + return o; + }; + }, function(e, t, n) { + var r = n(388), i = n(389), o = n(390), s = n(391), a = n(392); + function c(e2) { + var t2 = -1, n2 = e2 == null ? 0 : e2.length; + for (this.clear(); ++t2 < n2; ) { + var r2 = e2[t2]; + this.set(r2[0], r2[1]); + } + } + c.prototype.clear = r, c.prototype.delete = i, c.prototype.get = o, c.prototype.has = s, c.prototype.set = a, e.exports = c; + }, function(e, t, n) { + var r = n(50); + e.exports = function(e2, t2) { + for (var n2 = e2.length; n2--; ) + if (r(e2[n2][0], t2)) + return n2; + return -1; + }; + }, function(e, t, n) { + var r = n(26)(Object, "create"); + e.exports = r; + }, function(e, t, n) { + var r = n(406); + e.exports = function(e2, t2) { + var n2 = e2.__data__; + return r(t2) ? n2[typeof t2 == "string" ? "string" : "hash"] : n2.map; + }; + }, function(e, t, n) { + var r = n(16), i = n(81), o = n(429), s = n(137); + e.exports = function(e2, t2) { + return r(e2) ? e2 : i(e2, t2) ? [e2] : o(s(e2)); + }; + }, function(e, t, n) { + var r = n(59); + e.exports = function(e2, t2, n2) { + if (r(e2), t2 === void 0) + return e2; + switch (n2) { + case 1: + return function(n3) { + return e2.call(t2, n3); + }; + case 2: + return function(n3, r2) { + return e2.call(t2, n3, r2); + }; + case 3: + return function(n3, r2, i) { + return e2.call(t2, n3, r2, i); + }; + } + return function() { + return e2.apply(t2, arguments); + }; + }; + }, function(e, t) { + e.exports = function(e2) { + if (typeof e2 != "function") + throw TypeError(e2 + " is not a function!"); + return e2; + }; + }, function(e, t) { + var n = {}.hasOwnProperty; + e.exports = function(e2, t2) { + return n.call(e2, t2); + }; + }, function(e, t) { + var n = {}.toString; + e.exports = function(e2) { + return n.call(e2).slice(8, -1); + }; + }, function(e, t, n) { + var r = n(25), i = n(20); + e.exports = function(e2) { + if (!i(e2)) + return false; + var t2 = r(e2); + return t2 == "[object Function]" || t2 == "[object GeneratorFunction]" || t2 == "[object AsyncFunction]" || t2 == "[object Proxy]"; + }; + }, function(e, t, n) { + (function(e2) { + var n2 = typeof e2 == "object" && e2 && e2.Object === Object && e2; + t.a = n2; + }).call(this, n(12)); + }, function(e, t, n) { + var r = {escape: n(8)}; + e.exports = function(e2) { + var t2 = "", n2 = r.escape; + return t2 += '<!-- src/templates/form_input.html -->\n<div class="form-group">\n ', e2.type !== "hidden" && (t2 += '\n <label for="' + n2(e2.id) + '">' + n2(e2.label) + "</label>\n "), t2 += "\n ", e2.type === "password" && e2.fixed_username && (t2 += '\n <!-- This is a hack to prevent Chrome from auto-filling the username in\n any of the other input fields in the MUC configuration form. -->\n <input class="hidden-username" type="text" autocomplete="username" value="' + n2(e2.fixed_username) + '"></input>\n '), t2 += '\n <input \n class="form-control" name="' + n2(e2.name) + '" type="' + n2(e2.type) + '" id="' + n2(e2.id) + '"\n ', e2.autocomplete && (t2 += ' autocomplete="' + n2(e2.autocomplete) + '" '), t2 += "\n ", e2.placeholder && (t2 += ' placeholder="' + n2(e2.placeholder) + '" '), t2 += "\n ", e2.value && (t2 += ' value="' + n2(e2.value) + '" '), t2 += "\n ", e2.required && (t2 += ' required="required" '), t2 += " />\n</div>\n"; + }; + }, function(e, t, n) { + var r = {escape: n(8)}; + e.exports = function(e2) { + var t2 = "", n2 = r.escape; + return t2 += '<!-- src/templates/form_username.html -->\n<div class="form-group">\n ', e2.label && (t2 += "\n <label>\n " + n2(e2.label) + "\n </label>\n "), t2 += '\n <div class="input-group">\n <div class="input-group-prepend">\n <input name="' + n2(e2.name) + '" type="' + n2(e2.type) + '"\n ', e2.value && (t2 += ' value="' + n2(e2.value) + '" '), t2 += "\n ", e2.required && (t2 += ' required="required" '), t2 += ' />\n <div class="input-group-text col" title="' + n2(e2.domain) + '">' + n2(e2.domain) + "</div>\n </div>\n </div>\n</div>\n"; + }; + }, function(e, t, n) { + var r, i; + r = [n(43)], (i = function(e2) { + return e2.noConflict(); + }.apply(t, r)) === void 0 || (e.exports = i); + }, function(e, t, n) { + /** + * @preserve jed.js https://github.com/SlexAxton/Jed + */ + !function(n2, r) { + var i = Array.prototype, o = Object.prototype, s = i.slice, a = o.hasOwnProperty, c = i.forEach, l = {}, u = {forEach: function(e2, t2, n3) { + var r2, i2, o2; + if (e2 !== null) { + if (c && e2.forEach === c) + e2.forEach(t2, n3); + else if (e2.length === +e2.length) { + for (r2 = 0, i2 = e2.length; r2 < i2; r2++) + if (r2 in e2 && t2.call(n3, e2[r2], r2, e2) === l) + return; + } else + for (o2 in e2) + if (a.call(e2, o2) && t2.call(n3, e2[o2], o2, e2) === l) + return; + } + }, extend: function(e2) { + return this.forEach(s.call(arguments, 1), function(t2) { + for (var n3 in t2) + e2[n3] = t2[n3]; + }), e2; + }}, d = function(e2) { + if (this.defaults = {locale_data: {messages: {"": {domain: "messages", lang: "en", plural_forms: "nplurals=2; plural=(n != 1);"}}}, domain: "messages", debug: false}, this.options = u.extend({}, this.defaults, e2), this.textdomain(this.options.domain), e2.domain && !this.options.locale_data[this.options.domain]) + throw new Error("Text domain set to non-existent domain: `" + e2.domain + "`"); + }; + function h(e2) { + return d.PF.compile(e2 || "nplurals=2; plural=(n != 1);"); + } + function f(e2, t2) { + this._key = e2, this._i18n = t2; + } + d.context_delimiter = String.fromCharCode(4), u.extend(f.prototype, {onDomain: function(e2) { + return this._domain = e2, this; + }, withContext: function(e2) { + return this._context = e2, this; + }, ifPlural: function(e2, t2) { + return this._val = e2, this._pkey = t2, this; + }, fetch: function(e2) { + return {}.toString.call(e2) != "[object Array]" && (e2 = [].slice.call(arguments, 0)), (e2 && e2.length ? d.sprintf : function(e3) { + return e3; + })(this._i18n.dcnpgettext(this._domain, this._context, this._key, this._pkey, this._val), e2); + }}), u.extend(d.prototype, {translate: function(e2) { + return new f(e2, this); + }, textdomain: function(e2) { + if (!e2) + return this._textdomain; + this._textdomain = e2; + }, gettext: function(e2) { + return this.dcnpgettext.call(this, void 0, void 0, e2); + }, dgettext: function(e2, t2) { + return this.dcnpgettext.call(this, e2, void 0, t2); + }, dcgettext: function(e2, t2) { + return this.dcnpgettext.call(this, e2, void 0, t2); + }, ngettext: function(e2, t2, n3) { + return this.dcnpgettext.call(this, void 0, void 0, e2, t2, n3); + }, dngettext: function(e2, t2, n3, r2) { + return this.dcnpgettext.call(this, e2, void 0, t2, n3, r2); + }, dcngettext: function(e2, t2, n3, r2) { + return this.dcnpgettext.call(this, e2, void 0, t2, n3, r2); + }, pgettext: function(e2, t2) { + return this.dcnpgettext.call(this, void 0, e2, t2); + }, dpgettext: function(e2, t2, n3) { + return this.dcnpgettext.call(this, e2, t2, n3); + }, dcpgettext: function(e2, t2, n3) { + return this.dcnpgettext.call(this, e2, t2, n3); + }, npgettext: function(e2, t2, n3, r2) { + return this.dcnpgettext.call(this, void 0, e2, t2, n3, r2); + }, dnpgettext: function(e2, t2, n3, r2, i2) { + return this.dcnpgettext.call(this, e2, t2, n3, r2, i2); + }, dcnpgettext: function(e2, t2, n3, r2, i2) { + var o2; + if (r2 = r2 || n3, e2 = e2 || this._textdomain, !this.options) + return (o2 = new d()).dcnpgettext.call(o2, void 0, void 0, n3, r2, i2); + if (!this.options.locale_data) + throw new Error("No locale data provided."); + if (!this.options.locale_data[e2]) + throw new Error("Domain `" + e2 + "` was not found."); + if (!this.options.locale_data[e2][""]) + throw new Error("No locale meta information provided."); + if (!n3) + throw new Error("No translation key found."); + var s2, a2, c2, l2 = t2 ? t2 + d.context_delimiter + n3 : n3, u2 = this.options.locale_data, f2 = u2[e2], p2 = (u2.messages || this.defaults.locale_data.messages)[""], g2 = f2[""].plural_forms || f2[""]["Plural-Forms"] || f2[""]["plural-forms"] || p2.plural_forms || p2["Plural-Forms"] || p2["plural-forms"]; + if (i2 === void 0) + c2 = 0; + else { + if (typeof i2 != "number" && (i2 = parseInt(i2, 10), isNaN(i2))) + throw new Error("The number that was passed in is not a number."); + c2 = h(g2)(i2); + } + if (!f2) + throw new Error("No domain named `" + e2 + "` could be found."); + return !(s2 = f2[l2]) || c2 > s2.length ? (this.options.missing_key_callback && this.options.missing_key_callback(l2, e2), a2 = [n3, r2], this.options.debug === true && console.log(a2[h(g2)(i2)]), a2[h()(i2)]) : (a2 = s2[c2]) || (a2 = [n3, r2])[h()(i2)]; + }}); + var p, g, m = function() { + function e2(e3) { + return Object.prototype.toString.call(e3).slice(8, -1).toLowerCase(); + } + function t2(e3, t3) { + for (var n4 = []; t3 > 0; n4[--t3] = e3) + ; + return n4.join(""); + } + var n3 = function() { + return n3.cache.hasOwnProperty(arguments[0]) || (n3.cache[arguments[0]] = n3.parse(arguments[0])), n3.format.call(null, n3.cache[arguments[0]], arguments); + }; + return n3.format = function(n4, r2) { + var i2, o2, s2, a2, c2, l2, u2, d2 = 1, h2 = n4.length, f2 = "", p2 = []; + for (o2 = 0; o2 < h2; o2++) + if ((f2 = e2(n4[o2])) === "string") + p2.push(n4[o2]); + else if (f2 === "array") { + if ((a2 = n4[o2])[2]) + for (i2 = r2[d2], s2 = 0; s2 < a2[2].length; s2++) { + if (!i2.hasOwnProperty(a2[2][s2])) + throw m('[sprintf] property "%s" does not exist', a2[2][s2]); + i2 = i2[a2[2][s2]]; + } + else + i2 = a2[1] ? r2[a2[1]] : r2[d2++]; + if (/[^s]/.test(a2[8]) && e2(i2) != "number") + throw m("[sprintf] expecting number but found %s", e2(i2)); + switch (i2 == null && (i2 = ""), a2[8]) { + case "b": + i2 = i2.toString(2); + break; + case "c": + i2 = String.fromCharCode(i2); + break; + case "d": + i2 = parseInt(i2, 10); + break; + case "e": + i2 = a2[7] ? i2.toExponential(a2[7]) : i2.toExponential(); + break; + case "f": + i2 = a2[7] ? parseFloat(i2).toFixed(a2[7]) : parseFloat(i2); + break; + case "o": + i2 = i2.toString(8); + break; + case "s": + i2 = (i2 = String(i2)) && a2[7] ? i2.substring(0, a2[7]) : i2; + break; + case "u": + i2 = Math.abs(i2); + break; + case "x": + i2 = i2.toString(16); + break; + case "X": + i2 = i2.toString(16).toUpperCase(); + } + i2 = /[def]/.test(a2[8]) && a2[3] && i2 >= 0 ? "+" + i2 : i2, l2 = a2[4] ? a2[4] == "0" ? "0" : a2[4].charAt(1) : " ", u2 = a2[6] - String(i2).length, c2 = a2[6] ? t2(l2, u2) : "", p2.push(a2[5] ? i2 + c2 : c2 + i2); + } + return p2.join(""); + }, n3.cache = {}, n3.parse = function(e3) { + for (var t3 = e3, n4 = [], r2 = [], i2 = 0; t3; ) { + if ((n4 = /^[^\x25]+/.exec(t3)) !== null) + r2.push(n4[0]); + else if ((n4 = /^\x25{2}/.exec(t3)) !== null) + r2.push("%"); + else { + if ((n4 = /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(t3)) === null) + throw "[sprintf] huh?"; + if (n4[2]) { + i2 |= 1; + var o2 = [], s2 = n4[2], a2 = []; + if ((a2 = /^([a-z_][a-z_\d]*)/i.exec(s2)) === null) + throw "[sprintf] huh?"; + for (o2.push(a2[1]); (s2 = s2.substring(a2[0].length)) !== ""; ) + if ((a2 = /^\.([a-z_][a-z_\d]*)/i.exec(s2)) !== null) + o2.push(a2[1]); + else { + if ((a2 = /^\[(\d+)\]/.exec(s2)) === null) + throw "[sprintf] huh?"; + o2.push(a2[1]); + } + n4[2] = o2; + } else + i2 |= 2; + if (i2 === 3) + throw "[sprintf] mixing positional and named placeholders is not (yet) supported"; + r2.push(n4); + } + t3 = t3.substring(n4[0].length); + } + return r2; + }, n3; + }(), v = function(e2, t2) { + return t2.unshift(e2), m.apply(null, t2); + }; + d.parse_plural = function(e2, t2) { + return e2 = e2.replace(/n/g, t2), d.parse_expression(e2); + }, d.sprintf = function(e2, t2) { + return {}.toString.call(t2) == "[object Array]" ? v(e2, [].slice.call(t2)) : m.apply(this, [].slice.call(arguments)); + }, d.prototype.sprintf = function() { + return d.sprintf.apply(this, arguments); + }, (d.PF = {}).parse = function(e2) { + var t2 = d.PF.extractPluralExpr(e2); + return d.PF.parser.parse.call(d.PF.parser, t2); + }, d.PF.compile = function(e2) { + var t2 = d.PF.parse(e2); + return function(e3) { + return (n3 = d.PF.interpreter(t2)(e3)) === true ? 1 : n3 || 0; + var n3; + }; + }, d.PF.interpreter = function(e2) { + return function(t2) { + switch (e2.type) { + case "GROUP": + return d.PF.interpreter(e2.expr)(t2); + case "TERNARY": + return d.PF.interpreter(e2.expr)(t2) ? d.PF.interpreter(e2.truthy)(t2) : d.PF.interpreter(e2.falsey)(t2); + case "OR": + return d.PF.interpreter(e2.left)(t2) || d.PF.interpreter(e2.right)(t2); + case "AND": + return d.PF.interpreter(e2.left)(t2) && d.PF.interpreter(e2.right)(t2); + case "LT": + return d.PF.interpreter(e2.left)(t2) < d.PF.interpreter(e2.right)(t2); + case "GT": + return d.PF.interpreter(e2.left)(t2) > d.PF.interpreter(e2.right)(t2); + case "LTE": + return d.PF.interpreter(e2.left)(t2) <= d.PF.interpreter(e2.right)(t2); + case "GTE": + return d.PF.interpreter(e2.left)(t2) >= d.PF.interpreter(e2.right)(t2); + case "EQ": + return d.PF.interpreter(e2.left)(t2) == d.PF.interpreter(e2.right)(t2); + case "NEQ": + return d.PF.interpreter(e2.left)(t2) != d.PF.interpreter(e2.right)(t2); + case "MOD": + return d.PF.interpreter(e2.left)(t2) % d.PF.interpreter(e2.right)(t2); + case "VAR": + return t2; + case "NUM": + return e2.val; + default: + throw new Error("Invalid Token found."); + } + }; + }, d.PF.extractPluralExpr = function(e2) { + e2 = e2.replace(/^\s\s*/, "").replace(/\s\s*$/, ""), /;\s*$/.test(e2) || (e2 = e2.concat(";")); + var t2, n3 = /nplurals\=(\d+);/, r2 = e2.match(n3); + if (!(r2.length > 1)) + throw new Error("nplurals not found in plural_forms string: " + e2); + if (r2[1], !((t2 = (e2 = e2.replace(n3, "")).match(/plural\=(.*);/)) && t2.length > 1)) + throw new Error("`plural` expression not found: " + e2); + return t2[1]; + }, d.PF.parser = (p = {trace: function() { + }, yy: {}, symbols_: {error: 2, expressions: 3, e: 4, EOF: 5, "?": 6, ":": 7, "||": 8, "&&": 9, "<": 10, "<=": 11, ">": 12, ">=": 13, "!=": 14, "==": 15, "%": 16, "(": 17, ")": 18, n: 19, NUMBER: 20, $accept: 0, $end: 1}, terminals_: {2: "error", 5: "EOF", 6: "?", 7: ":", 8: "||", 9: "&&", 10: "<", 11: "<=", 12: ">", 13: ">=", 14: "!=", 15: "==", 16: "%", 17: "(", 18: ")", 19: "n", 20: "NUMBER"}, productions_: [0, [3, 2], [4, 5], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 1], [4, 1]], performAction: function(e2, t2, n3, r2, i2, o2, s2) { + var a2 = o2.length - 1; + switch (i2) { + case 1: + return {type: "GROUP", expr: o2[a2 - 1]}; + case 2: + this.$ = {type: "TERNARY", expr: o2[a2 - 4], truthy: o2[a2 - 2], falsey: o2[a2]}; + break; + case 3: + this.$ = {type: "OR", left: o2[a2 - 2], right: o2[a2]}; + break; + case 4: + this.$ = {type: "AND", left: o2[a2 - 2], right: o2[a2]}; + break; + case 5: + this.$ = {type: "LT", left: o2[a2 - 2], right: o2[a2]}; + break; + case 6: + this.$ = {type: "LTE", left: o2[a2 - 2], right: o2[a2]}; + break; + case 7: + this.$ = {type: "GT", left: o2[a2 - 2], right: o2[a2]}; + break; + case 8: + this.$ = {type: "GTE", left: o2[a2 - 2], right: o2[a2]}; + break; + case 9: + this.$ = {type: "NEQ", left: o2[a2 - 2], right: o2[a2]}; + break; + case 10: + this.$ = {type: "EQ", left: o2[a2 - 2], right: o2[a2]}; + break; + case 11: + this.$ = {type: "MOD", left: o2[a2 - 2], right: o2[a2]}; + break; + case 12: + this.$ = {type: "GROUP", expr: o2[a2 - 1]}; + break; + case 13: + this.$ = {type: "VAR"}; + break; + case 14: + this.$ = {type: "NUM", val: Number(e2)}; + } + }, table: [{3: 1, 4: 2, 17: [1, 3], 19: [1, 4], 20: [1, 5]}, {1: [3]}, {5: [1, 6], 6: [1, 7], 8: [1, 8], 9: [1, 9], 10: [1, 10], 11: [1, 11], 12: [1, 12], 13: [1, 13], 14: [1, 14], 15: [1, 15], 16: [1, 16]}, {4: 17, 17: [1, 3], 19: [1, 4], 20: [1, 5]}, {5: [2, 13], 6: [2, 13], 7: [2, 13], 8: [2, 13], 9: [2, 13], 10: [2, 13], 11: [2, 13], 12: [2, 13], 13: [2, 13], 14: [2, 13], 15: [2, 13], 16: [2, 13], 18: [2, 13]}, {5: [2, 14], 6: [2, 14], 7: [2, 14], 8: [2, 14], 9: [2, 14], 10: [2, 14], 11: [2, 14], 12: [2, 14], 13: [2, 14], 14: [2, 14], 15: [2, 14], 16: [2, 14], 18: [2, 14]}, {1: [2, 1]}, {4: 18, 17: [1, 3], 19: [1, 4], 20: [1, 5]}, {4: 19, 17: [1, 3], 19: [1, 4], 20: [1, 5]}, {4: 20, 17: [1, 3], 19: [1, 4], 20: [1, 5]}, {4: 21, 17: [1, 3], 19: [1, 4], 20: [1, 5]}, {4: 22, 17: [1, 3], 19: [1, 4], 20: [1, 5]}, {4: 23, 17: [1, 3], 19: [1, 4], 20: [1, 5]}, {4: 24, 17: [1, 3], 19: [1, 4], 20: [1, 5]}, {4: 25, 17: [1, 3], 19: [1, 4], 20: [1, 5]}, {4: 26, 17: [1, 3], 19: [1, 4], 20: [1, 5]}, {4: 27, 17: [1, 3], 19: [1, 4], 20: [1, 5]}, {6: [1, 7], 8: [1, 8], 9: [1, 9], 10: [1, 10], 11: [1, 11], 12: [1, 12], 13: [1, 13], 14: [1, 14], 15: [1, 15], 16: [1, 16], 18: [1, 28]}, {6: [1, 7], 7: [1, 29], 8: [1, 8], 9: [1, 9], 10: [1, 10], 11: [1, 11], 12: [1, 12], 13: [1, 13], 14: [1, 14], 15: [1, 15], 16: [1, 16]}, {5: [2, 3], 6: [2, 3], 7: [2, 3], 8: [2, 3], 9: [1, 9], 10: [1, 10], 11: [1, 11], 12: [1, 12], 13: [1, 13], 14: [1, 14], 15: [1, 15], 16: [1, 16], 18: [2, 3]}, {5: [2, 4], 6: [2, 4], 7: [2, 4], 8: [2, 4], 9: [2, 4], 10: [1, 10], 11: [1, 11], 12: [1, 12], 13: [1, 13], 14: [1, 14], 15: [1, 15], 16: [1, 16], 18: [2, 4]}, {5: [2, 5], 6: [2, 5], 7: [2, 5], 8: [2, 5], 9: [2, 5], 10: [2, 5], 11: [2, 5], 12: [2, 5], 13: [2, 5], 14: [2, 5], 15: [2, 5], 16: [1, 16], 18: [2, 5]}, {5: [2, 6], 6: [2, 6], 7: [2, 6], 8: [2, 6], 9: [2, 6], 10: [2, 6], 11: [2, 6], 12: [2, 6], 13: [2, 6], 14: [2, 6], 15: [2, 6], 16: [1, 16], 18: [2, 6]}, {5: [2, 7], 6: [2, 7], 7: [2, 7], 8: [2, 7], 9: [2, 7], 10: [2, 7], 11: [2, 7], 12: [2, 7], 13: [2, 7], 14: [2, 7], 15: [2, 7], 16: [1, 16], 18: [2, 7]}, {5: [2, 8], 6: [2, 8], 7: [2, 8], 8: [2, 8], 9: [2, 8], 10: [2, 8], 11: [2, 8], 12: [2, 8], 13: [2, 8], 14: [2, 8], 15: [2, 8], 16: [1, 16], 18: [2, 8]}, {5: [2, 9], 6: [2, 9], 7: [2, 9], 8: [2, 9], 9: [2, 9], 10: [2, 9], 11: [2, 9], 12: [2, 9], 13: [2, 9], 14: [2, 9], 15: [2, 9], 16: [1, 16], 18: [2, 9]}, {5: [2, 10], 6: [2, 10], 7: [2, 10], 8: [2, 10], 9: [2, 10], 10: [2, 10], 11: [2, 10], 12: [2, 10], 13: [2, 10], 14: [2, 10], 15: [2, 10], 16: [1, 16], 18: [2, 10]}, {5: [2, 11], 6: [2, 11], 7: [2, 11], 8: [2, 11], 9: [2, 11], 10: [2, 11], 11: [2, 11], 12: [2, 11], 13: [2, 11], 14: [2, 11], 15: [2, 11], 16: [2, 11], 18: [2, 11]}, {5: [2, 12], 6: [2, 12], 7: [2, 12], 8: [2, 12], 9: [2, 12], 10: [2, 12], 11: [2, 12], 12: [2, 12], 13: [2, 12], 14: [2, 12], 15: [2, 12], 16: [2, 12], 18: [2, 12]}, {4: 30, 17: [1, 3], 19: [1, 4], 20: [1, 5]}, {5: [2, 2], 6: [1, 7], 7: [2, 2], 8: [1, 8], 9: [1, 9], 10: [1, 10], 11: [1, 11], 12: [1, 12], 13: [1, 13], 14: [1, 14], 15: [1, 15], 16: [1, 16], 18: [2, 2]}], defaultActions: {6: [2, 1]}, parseError: function(e2, t2) { + throw new Error(e2); + }, parse: function(e2) { + var t2 = this, n3 = [0], r2 = [null], i2 = [], o2 = this.table, s2 = "", a2 = 0, c2 = 0, l2 = 0; + this.lexer.setInput(e2), this.lexer.yy = this.yy, this.yy.lexer = this.lexer, this.lexer.yylloc === void 0 && (this.lexer.yylloc = {}); + var u2 = this.lexer.yylloc; + function d2() { + var e3; + return typeof (e3 = t2.lexer.lex() || 1) != "number" && (e3 = t2.symbols_[e3] || e3), e3; + } + i2.push(u2), typeof this.yy.parseError == "function" && (this.parseError = this.yy.parseError); + for (var h2, f2, p2, g2, m2, v2, _, b, y, w, S = {}; ; ) { + if (p2 = n3[n3.length - 1], this.defaultActions[p2] ? g2 = this.defaultActions[p2] : (h2 == null && (h2 = d2()), g2 = o2[p2] && o2[p2][h2]), g2 === void 0 || !g2.length || !g2[0]) { + if (!l2) { + for (v2 in y = [], o2[p2]) + this.terminals_[v2] && v2 > 2 && y.push("'" + this.terminals_[v2] + "'"); + var x = ""; + x = this.lexer.showPosition ? "Parse error on line " + (a2 + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + y.join(", ") + ", got '" + this.terminals_[h2] + "'" : "Parse error on line " + (a2 + 1) + ": Unexpected " + (h2 == 1 ? "end of input" : "'" + (this.terminals_[h2] || h2) + "'"), this.parseError(x, {text: this.lexer.match, token: this.terminals_[h2] || h2, line: this.lexer.yylineno, loc: u2, expected: y}); + } + if (l2 == 3) { + if (h2 == 1) + throw new Error(x || "Parsing halted."); + c2 = this.lexer.yyleng, s2 = this.lexer.yytext, a2 = this.lexer.yylineno, u2 = this.lexer.yylloc, h2 = d2(); + } + for (; !(2 .toString() in o2[p2]); ) { + if (p2 == 0) + throw new Error(x || "Parsing halted."); + w = 1, n3.length = n3.length - 2 * w, r2.length = r2.length - w, i2.length = i2.length - w, p2 = n3[n3.length - 1]; + } + f2 = h2, h2 = 2, g2 = o2[p2 = n3[n3.length - 1]] && o2[p2][2], l2 = 3; + } + if (g2[0] instanceof Array && g2.length > 1) + throw new Error("Parse Error: multiple actions possible at state: " + p2 + ", token: " + h2); + switch (g2[0]) { + case 1: + n3.push(h2), r2.push(this.lexer.yytext), i2.push(this.lexer.yylloc), n3.push(g2[1]), h2 = null, f2 ? (h2 = f2, f2 = null) : (c2 = this.lexer.yyleng, s2 = this.lexer.yytext, a2 = this.lexer.yylineno, u2 = this.lexer.yylloc, l2 > 0 && l2--); + break; + case 2: + if (_ = this.productions_[g2[1]][1], S.$ = r2[r2.length - _], S._$ = {first_line: i2[i2.length - (_ || 1)].first_line, last_line: i2[i2.length - 1].last_line, first_column: i2[i2.length - (_ || 1)].first_column, last_column: i2[i2.length - 1].last_column}, (m2 = this.performAction.call(S, s2, c2, a2, this.yy, g2[1], r2, i2)) !== void 0) + return m2; + _ && (n3 = n3.slice(0, -1 * _ * 2), r2 = r2.slice(0, -1 * _), i2 = i2.slice(0, -1 * _)), n3.push(this.productions_[g2[1]][0]), r2.push(S.$), i2.push(S._$), b = o2[n3[n3.length - 2]][n3[n3.length - 1]], n3.push(b); + break; + case 3: + return true; + } + } + return true; + }}, g = function() { + var e2 = {EOF: 1, parseError: function(e3, t2) { + if (!this.yy.parseError) + throw new Error(e3); + this.yy.parseError(e3, t2); + }, setInput: function(e3) { + return this._input = e3, this._more = this._less = this.done = false, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {first_line: 1, first_column: 0, last_line: 1, last_column: 0}, this; + }, input: function() { + var e3 = this._input[0]; + return this.yytext += e3, this.yyleng++, this.match += e3, this.matched += e3, e3.match(/\n/) && this.yylineno++, this._input = this._input.slice(1), e3; + }, unput: function(e3) { + return this._input = e3 + this._input, this; + }, more: function() { + return this._more = true, this; + }, pastInput: function() { + var e3 = this.matched.substr(0, this.matched.length - this.match.length); + return (e3.length > 20 ? "..." : "") + e3.substr(-20).replace(/\n/g, ""); + }, upcomingInput: function() { + var e3 = this.match; + return e3.length < 20 && (e3 += this._input.substr(0, 20 - e3.length)), (e3.substr(0, 20) + (e3.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, showPosition: function() { + var e3 = this.pastInput(), t2 = new Array(e3.length + 1).join("-"); + return e3 + this.upcomingInput() + "\n" + t2 + "^"; + }, next: function() { + if (this.done) + return this.EOF; + var e3, t2; + this._input || (this.done = true), this._more || (this.yytext = "", this.match = ""); + for (var n3 = this._currentRules(), r2 = 0; r2 < n3.length; r2++) + if (e3 = this._input.match(this.rules[n3[r2]])) + return (t2 = e3[0].match(/\n.*/g)) && (this.yylineno += t2.length), this.yylloc = {first_line: this.yylloc.last_line, last_line: this.yylineno + 1, first_column: this.yylloc.last_column, last_column: t2 ? t2[t2.length - 1].length - 1 : this.yylloc.last_column + e3[0].length}, this.yytext += e3[0], this.match += e3[0], this.matches = e3, this.yyleng = this.yytext.length, this._more = false, this._input = this._input.slice(e3[0].length), this.matched += e3[0], this.performAction.call(this, this.yy, this, n3[r2], this.conditionStack[this.conditionStack.length - 1]) || void 0; + if (this._input === "") + return this.EOF; + this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {text: "", token: null, line: this.yylineno}); + }, lex: function() { + var e3 = this.next(); + return e3 !== void 0 ? e3 : this.lex(); + }, begin: function(e3) { + this.conditionStack.push(e3); + }, popState: function() { + return this.conditionStack.pop(); + }, _currentRules: function() { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + }, topState: function() { + return this.conditionStack[this.conditionStack.length - 2]; + }, pushState: function(e3) { + this.begin(e3); + }, performAction: function(e3, t2, n3, r2) { + switch (n3) { + case 0: + break; + case 1: + return 20; + case 2: + return 19; + case 3: + return 8; + case 4: + return 9; + case 5: + return 6; + case 6: + return 7; + case 7: + return 11; + case 8: + return 13; + case 9: + return 10; + case 10: + return 12; + case 11: + return 14; + case 12: + return 15; + case 13: + return 16; + case 14: + return 17; + case 15: + return 18; + case 16: + return 5; + case 17: + return "INVALID"; + } + }, rules: [/^\s+/, /^[0-9]+(\.[0-9]+)?\b/, /^n\b/, /^\|\|/, /^&&/, /^\?/, /^:/, /^<=/, /^>=/, /^</, /^>/, /^!=/, /^==/, /^%/, /^\(/, /^\)/, /^$/, /^./], conditions: {INITIAL: {rules: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17], inclusive: true}}}; + return e2; + }(), p.lexer = g, p), e.exports && (t = e.exports = d), t.Jed = d; + }(); + }, function(e, t, n) { + var r = n(15), i = n(0); + i.e.Websocket = class { + constructor(e2) { + this._conn = e2, this.strip = "wrapper"; + const t2 = e2.service; + if (t2.indexOf("ws:") !== 0 && t2.indexOf("wss:") !== 0) { + let n2 = ""; + e2.options.protocol === "ws" && window.location.protocol !== "https:" ? n2 += "ws" : n2 += "wss", n2 += "://" + window.location.host, t2.indexOf("/") !== 0 ? n2 += window.location.pathname + t2 : n2 += t2, e2.service = n2; + } + } + _buildStream() { + return Object(i.a)("open", {xmlns: i.e.NS.FRAMING, to: this._conn.domain, version: "1.0"}); + } + _checkStreamError(e2, t2) { + let n2; + if (n2 = e2.getElementsByTagNameNS ? e2.getElementsByTagNameNS(i.e.NS.STREAM, "error") : e2.getElementsByTagName("stream:error"), n2.length === 0) + return false; + const r2 = n2[0]; + let o = "", s = ""; + for (let e3 = 0; e3 < r2.childNodes.length; e3++) { + const t3 = r2.childNodes[e3]; + if (t3.getAttribute("xmlns") !== "urn:ietf:params:xml:ns:xmpp-streams") + break; + t3.nodeName === "text" ? s = t3.textContent : o = t3.nodeName; + } + let a = "WebSocket stream error: "; + return a += o || "unknown", s && (a += " - " + s), i.e.error(a), this._conn._changeConnectStatus(t2, o), this._conn._doDisconnect(), true; + } + _reset() { + } + _connect() { + this._closeSocket(), this.socket = new WebSocket(this._conn.service, "xmpp"), this.socket.onopen = () => this._onOpen(), this.socket.onerror = (e2) => this._onError(e2), this.socket.onclose = (e2) => this._onClose(e2), this.socket.onmessage = (e2) => this._onInitialMessage(e2); + } + _connect_cb(e2) { + if (this._checkStreamError(e2, i.e.Status.CONNFAIL)) + return i.e.Status.CONNFAIL; + } + _handleStreamStart(e2) { + let t2 = false; + const n2 = e2.getAttribute("xmlns"); + typeof n2 != "string" ? t2 = "Missing xmlns in <open />" : n2 !== i.e.NS.FRAMING && (t2 = "Wrong xmlns in <open />: " + n2); + const r2 = e2.getAttribute("version"); + return typeof r2 != "string" ? t2 = "Missing version in <open />" : r2 !== "1.0" && (t2 = "Wrong version in <open />: " + r2), !t2 || (this._conn._changeConnectStatus(i.e.Status.CONNFAIL, t2), this._conn._doDisconnect(), false); + } + _onInitialMessage(e2) { + if (e2.data.indexOf("<open ") === 0 || e2.data.indexOf("<?xml") === 0) { + const t2 = e2.data.replace(/^(<\?.*?\?>\s*)*/, ""); + if (t2 === "") + return; + const n2 = new r.a().parseFromString(t2, "text/xml").documentElement; + this._conn.xmlInput(n2), this._conn.rawInput(e2.data), this._handleStreamStart(n2) && this._connect_cb(n2); + } else if (e2.data.indexOf("<close ") === 0) { + const t2 = new r.a().parseFromString(e2.data, "text/xml").documentElement; + this._conn.xmlInput(t2), this._conn.rawInput(e2.data); + const n2 = t2.getAttribute("see-other-uri"); + if (n2) { + const e3 = this._conn.service; + (e3.indexOf("wss:") >= 0 && n2.indexOf("wss:") >= 0 || e3.indexOf("ws:") >= 0) && (this._conn._changeConnectStatus(i.e.Status.REDIRECT, "Received see-other-uri, resetting connection"), this._conn.reset(), this._conn.service = n2, this._connect()); + } else + this._conn._changeConnectStatus(i.e.Status.CONNFAIL, "Received closing stream"), this._conn._doDisconnect(); + } else { + this._replaceMessageHandler(); + const t2 = this._streamWrap(e2.data), n2 = new r.a().parseFromString(t2, "text/xml").documentElement; + this._conn._connect_cb(n2, null, e2.data); + } + } + _replaceMessageHandler() { + this.socket.onmessage = (e2) => this._onMessage(e2); + } + _disconnect(e2) { + if (this.socket && this.socket.readyState !== WebSocket.CLOSED) { + e2 && this._conn.send(e2); + const t2 = Object(i.a)("close", {xmlns: i.e.NS.FRAMING}); + this._conn.xmlOutput(t2.tree()); + const n2 = i.e.serialize(t2); + this._conn.rawOutput(n2); + try { + this.socket.send(n2); + } catch (e3) { + i.e.warn("Couldn't send <close /> tag."); + } + } + this._conn._doDisconnect(); + } + _doDisconnect() { + i.e.debug("WebSockets _doDisconnect was called"), this._closeSocket(); + } + _streamWrap(e2) { + return "<wrapper>" + e2 + "</wrapper>"; + } + _closeSocket() { + if (this.socket) + try { + this.socket.onclose = null, this.socket.onerror = null, this.socket.onmessage = null, this.socket.close(); + } catch (e2) { + i.e.debug(e2.message); + } + this.socket = null; + } + _emptyQueue() { + return true; + } + _onClose(e2) { + this._conn.connected && !this._conn.disconnecting ? (i.e.error("Websocket closed unexpectedly"), this._conn._doDisconnect()) : e2 && e2.code === 1006 && !this._conn.connected && this.socket ? (i.e.error("Websocket closed unexcectedly"), this._conn._changeConnectStatus(i.e.Status.CONNFAIL, "The WebSocket connection could not be established or was disconnected."), this._conn._doDisconnect()) : i.e.debug("Websocket closed"); + } + _no_auth_received(e2) { + i.e.error("Server did not offer a supported authentication mechanism"), this._conn._changeConnectStatus(i.e.Status.CONNFAIL, i.e.ErrorCondition.NO_AUTH_MECH), e2 && e2.call(this._conn), this._conn._doDisconnect(); + } + _onDisconnectTimeout() { + } + _abortAllRequests() { + } + _onError(e2) { + i.e.error("Websocket error " + e2), this._conn._changeConnectStatus(i.e.Status.CONNFAIL, "The WebSocket connection could not be established or was disconnected."), this._disconnect(); + } + _onIdle() { + const e2 = this._conn._data; + if (e2.length > 0 && !this._conn.paused) { + for (let t2 = 0; t2 < e2.length; t2++) + if (e2[t2] !== null) { + let n2; + n2 = e2[t2] === "restart" ? this._buildStream().tree() : e2[t2]; + const r2 = i.e.serialize(n2); + this._conn.xmlOutput(n2), this._conn.rawOutput(r2), this.socket.send(r2); + } + this._conn._data = []; + } + } + _onMessage(e2) { + let t2; + const n2 = '<close xmlns="urn:ietf:params:xml:ns:xmpp-framing" />'; + if (e2.data === n2) + return this._conn.rawInput(n2), this._conn.xmlInput(e2), void (this._conn.disconnecting || this._conn._doDisconnect()); + if (e2.data.search("<open ") === 0) { + if (t2 = new r.a().parseFromString(e2.data, "text/xml").documentElement, !this._handleStreamStart(t2)) + return; + } else { + const n3 = this._streamWrap(e2.data); + t2 = new r.a().parseFromString(n3, "text/xml").documentElement; + } + return this._checkStreamError(t2, i.e.Status.ERROR) ? void 0 : this._conn.disconnecting && t2.firstChild.nodeName === "presence" && t2.firstChild.getAttribute("type") === "unavailable" ? (this._conn.xmlInput(t2), void this._conn.rawInput(i.e.serialize(t2))) : void this._conn._dataRecv(t2, e2.data); + } + _onOpen() { + i.e.debug("Websocket open"); + const e2 = this._buildStream(); + this._conn.xmlOutput(e2.tree()); + const t2 = i.e.serialize(e2); + this._conn.rawOutput(t2), this.socket.send(t2); + } + _reqToData(e2) { + return e2; + } + _send() { + this._conn.flush(); + } + _sendRestart() { + clearTimeout(this._conn._idleTimeout), this._conn._onIdle.bind(this._conn)(); + } + }; + }, function(e, t) { + e.exports = function(e2) { + if (!e2.webpackPolyfill) { + var t2 = Object.create(e2); + t2.children || (t2.children = []), Object.defineProperty(t2, "loaded", {enumerable: true, get: function() { + return t2.l; + }}), Object.defineProperty(t2, "id", {enumerable: true, get: function() { + return t2.i; + }}), Object.defineProperty(t2, "exports", {enumerable: true}), t2.webpackPolyfill = 1; + } + return t2; + }; + }, function(e, t, n) { + var r = n(333); + e.exports = function(e2) { + var t2 = r(e2), n2 = t2 % 1; + return t2 == t2 ? n2 ? t2 - n2 : t2 : 0; + }; + }, function(e, t) { + e.exports = function(e2) { + return typeof e2 == "number" && e2 > -1 && e2 % 1 == 0 && e2 <= 9007199254740991; + }; + }, function(e, t) { + e.exports = function(e2, t2, n) { + switch (n.length) { + case 0: + return e2.call(t2); + case 1: + return e2.call(t2, n[0]); + case 2: + return e2.call(t2, n[0], n[1]); + case 3: + return e2.call(t2, n[0], n[1], n[2]); + } + return e2.apply(t2, n); + }; + }, function(e, t) { + e.exports = function(e2, t2) { + for (var n = -1, r = e2 == null ? 0 : e2.length, i = Array(r); ++n < r; ) + i[n] = t2(e2[n], n, e2); + return i; + }; + }, function(e, t, n) { + var r = n(20), i = Object.create, o = function() { + function e2() { + } + return function(t2) { + if (!r(t2)) + return {}; + if (i) + return i(t2); + e2.prototype = t2; + var n2 = new e2(); + return e2.prototype = void 0, n2; + }; + }(); + e.exports = o; + }, function(e, t, n) { + var r = n(74), i = n(76); + function o(e2) { + this.__wrapped__ = e2, this.__actions__ = [], this.__dir__ = 1, this.__filtered__ = false, this.__iteratees__ = [], this.__takeCount__ = 4294967295, this.__views__ = []; + } + o.prototype = r(i.prototype), o.prototype.constructor = o, e.exports = o; + }, function(e, t) { + e.exports = function() { + }; + }, function(e, t) { + e.exports = function(e2) { + return e2.placeholder; + }; + }, function(e, t, n) { + var r = n(26)(n(11), "Map"); + e.exports = r; + }, function(e, t, n) { + var r = n(398), i = n(405), o = n(407), s = n(408), a = n(409); + function c(e2) { + var t2 = -1, n2 = e2 == null ? 0 : e2.length; + for (this.clear(); ++t2 < n2; ) { + var r2 = e2[t2]; + this.set(r2[0], r2[1]); + } + } + c.prototype.clear = r, c.prototype.delete = i, c.prototype.get = o, c.prototype.has = s, c.prototype.set = a, e.exports = c; + }, function(e, t, n) { + var r = n(57), i = n(39); + e.exports = function(e2, t2) { + for (var n2 = 0, o = (t2 = r(t2, e2)).length; e2 != null && n2 < o; ) + e2 = e2[i(t2[n2++])]; + return n2 && n2 == o ? e2 : void 0; + }; + }, function(e, t, n) { + var r = n(16), i = n(48), o = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, s = /^\w*$/; + e.exports = function(e2, t2) { + if (r(e2)) + return false; + var n2 = typeof e2; + return !(n2 != "number" && n2 != "symbol" && n2 != "boolean" && e2 != null && !i(e2)) || (s.test(e2) || !o.test(e2) || t2 != null && e2 in Object(t2)); + }; + }, function(e, t) { + e.exports = function(e2) { + try { + return !!e2(); + } catch (e3) { + return true; + } + }; + }, function(e, t, n) { + var r = n(41), i = n(13).document, o = r(i) && r(i.createElement); + e.exports = function(e2) { + return o ? i.createElement(e2) : {}; + }; + }, function(e, t) { + e.exports = function(e2) { + if (e2 == null) + throw TypeError("Can't call method on " + e2); + return e2; + }; + }, function(e, t, n) { + var r = n(457), i = n(84); + e.exports = function(e2) { + return r(i(e2)); + }; + }, function(e, t) { + var n = Math.ceil, r = Math.floor; + e.exports = function(e2) { + return isNaN(e2 = +e2) ? 0 : (e2 > 0 ? r : n)(e2); + }; + }, function(e, t, n) { + var r = n(144)("keys"), i = n(145); + e.exports = function(e2) { + return r[e2] || (r[e2] = i(e2)); + }; + }, function(e, t) { + e.exports = true; + }, function(e, t, n) { + e.exports = {default: n(465), __esModule: true}; + }, function(e, t, n) { + var r = n(40).f, i = n(60), o = n(17)("toStringTag"); + e.exports = function(e2, t2, n2) { + e2 && !i(e2 = n2 ? e2 : e2.prototype, o) && r(e2, o, {configurable: true, value: t2}); + }; + }, function(e, t, n) { + var r = n(59); + function i(e2) { + var t2, n2; + this.promise = new e2(function(e3, r2) { + if (t2 !== void 0 || n2 !== void 0) + throw TypeError("Bad Promise constructor"); + t2 = e3, n2 = r2; + }), this.resolve = r(t2), this.reject = r(n2); + } + e.exports.f = function(e2) { + return new i(e2); + }; + }, function(e, t, n) { + var r = n(367), i = n(33); + e.exports = function(e2) { + return e2 == null ? [] : r(e2, i(e2)); + }; + }, function(e, t, n) { + var r = n(109), i = n(368), o = n(77), s = n(52), a = r(function(e2, t2) { + var n2 = s(t2, o(a)); + return i(e2, 32, void 0, t2, n2); + }); + a.placeholder = {}, e.exports = a; + }, function(e, t, n) { + var r; + !function() { + var i = {not_string: /[^s]/, not_bool: /[^t]/, not_type: /[^T]/, not_primitive: /[^v]/, number: /[diefg]/, numeric_arg: /[bcdiefguxX]/, json: /[j]/, not_json: /[^j]/, text: /^[^\x25]+/, modulo: /^\x25{2}/, placeholder: /^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/, key: /^([a-z_][a-z_\d]*)/i, key_access: /^\.([a-z_][a-z_\d]*)/i, index_access: /^\[(\d+)\]/, sign: /^[+-]/}; + function o(e2) { + return a(l(e2), arguments); + } + function s(e2, t2) { + return o.apply(null, [e2].concat(t2 || [])); + } + function a(e2, t2) { + var n2, r2, s2, a2, c2, l2, u, d, h, f = 1, p = e2.length, g = ""; + for (r2 = 0; r2 < p; r2++) + if (typeof e2[r2] == "string") + g += e2[r2]; + else if (typeof e2[r2] == "object") { + if ((a2 = e2[r2]).keys) + for (n2 = t2[f], s2 = 0; s2 < a2.keys.length; s2++) { + if (n2 == null) + throw new Error(o('[sprintf] Cannot access property "%s" of undefined value "%s"', a2.keys[s2], a2.keys[s2 - 1])); + n2 = n2[a2.keys[s2]]; + } + else + n2 = a2.param_no ? t2[a2.param_no] : t2[f++]; + if (i.not_type.test(a2.type) && i.not_primitive.test(a2.type) && n2 instanceof Function && (n2 = n2()), i.numeric_arg.test(a2.type) && typeof n2 != "number" && isNaN(n2)) + throw new TypeError(o("[sprintf] expecting number but found %T", n2)); + switch (i.number.test(a2.type) && (d = n2 >= 0), a2.type) { + case "b": + n2 = parseInt(n2, 10).toString(2); + break; + case "c": + n2 = String.fromCharCode(parseInt(n2, 10)); + break; + case "d": + case "i": + n2 = parseInt(n2, 10); + break; + case "j": + n2 = JSON.stringify(n2, null, a2.width ? parseInt(a2.width) : 0); + break; + case "e": + n2 = a2.precision ? parseFloat(n2).toExponential(a2.precision) : parseFloat(n2).toExponential(); + break; + case "f": + n2 = a2.precision ? parseFloat(n2).toFixed(a2.precision) : parseFloat(n2); + break; + case "g": + n2 = a2.precision ? String(Number(n2.toPrecision(a2.precision))) : parseFloat(n2); + break; + case "o": + n2 = (parseInt(n2, 10) >>> 0).toString(8); + break; + case "s": + n2 = String(n2), n2 = a2.precision ? n2.substring(0, a2.precision) : n2; + break; + case "t": + n2 = String(!!n2), n2 = a2.precision ? n2.substring(0, a2.precision) : n2; + break; + case "T": + n2 = Object.prototype.toString.call(n2).slice(8, -1).toLowerCase(), n2 = a2.precision ? n2.substring(0, a2.precision) : n2; + break; + case "u": + n2 = parseInt(n2, 10) >>> 0; + break; + case "v": + n2 = n2.valueOf(), n2 = a2.precision ? n2.substring(0, a2.precision) : n2; + break; + case "x": + n2 = (parseInt(n2, 10) >>> 0).toString(16); + break; + case "X": + n2 = (parseInt(n2, 10) >>> 0).toString(16).toUpperCase(); + } + i.json.test(a2.type) ? g += n2 : (!i.number.test(a2.type) || d && !a2.sign ? h = "" : (h = d ? "+" : "-", n2 = n2.toString().replace(i.sign, "")), l2 = a2.pad_char ? a2.pad_char === "0" ? "0" : a2.pad_char.charAt(1) : " ", u = a2.width - (h + n2).length, c2 = a2.width && u > 0 ? l2.repeat(u) : "", g += a2.align ? h + n2 + c2 : l2 === "0" ? h + c2 + n2 : c2 + h + n2); + } + return g; + } + var c = Object.create(null); + function l(e2) { + if (c[e2]) + return c[e2]; + for (var t2, n2 = e2, r2 = [], o2 = 0; n2; ) { + if ((t2 = i.text.exec(n2)) !== null) + r2.push(t2[0]); + else if ((t2 = i.modulo.exec(n2)) !== null) + r2.push("%"); + else { + if ((t2 = i.placeholder.exec(n2)) === null) + throw new SyntaxError("[sprintf] unexpected placeholder"); + if (t2[2]) { + o2 |= 1; + var s2 = [], a2 = t2[2], l2 = []; + if ((l2 = i.key.exec(a2)) === null) + throw new SyntaxError("[sprintf] failed to parse named argument key"); + for (s2.push(l2[1]); (a2 = a2.substring(l2[0].length)) !== ""; ) + if ((l2 = i.key_access.exec(a2)) !== null) + s2.push(l2[1]); + else { + if ((l2 = i.index_access.exec(a2)) === null) + throw new SyntaxError("[sprintf] failed to parse named argument key"); + s2.push(l2[1]); + } + t2[2] = s2; + } else + o2 |= 2; + if (o2 === 3) + throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported"); + r2.push({placeholder: t2[0], param_no: t2[1], keys: t2[2], sign: t2[3], pad_char: t2[4], align: t2[5], width: t2[6], precision: t2[7], type: t2[8]}); + } + n2 = n2.substring(t2[0].length); + } + return c[e2] = r2; + } + t.sprintf = o, t.vsprintf = s, typeof window != "undefined" && (window.sprintf = o, window.vsprintf = s, (r = function() { + return {sprintf: o, vsprintf: s}; + }.call(t, n, t, e)) === void 0 || (e.exports = r)); + }(); + }, function(e, t) { + function n(e2, t2) { + for (var n2 in e2) + t2[n2] = e2[n2]; + } + function r(e2, t2) { + var r2 = e2.prototype; + if (Object.create) { + var i2 = Object.create(t2.prototype); + r2.__proto__ = i2; + } + if (!(r2 instanceof t2)) { + function o2() { + } + o2.prototype = t2.prototype, n(r2, o2 = new o2()), e2.prototype = r2 = o2; + } + r2.constructor != e2 && (typeof e2 != "function" && console.error("unknow Class:" + e2), r2.constructor = e2); + } + var i = {}, o = i.ELEMENT_NODE = 1, s = i.ATTRIBUTE_NODE = 2, a = i.TEXT_NODE = 3, c = i.CDATA_SECTION_NODE = 4, l = i.ENTITY_REFERENCE_NODE = 5, u = i.ENTITY_NODE = 6, d = i.PROCESSING_INSTRUCTION_NODE = 7, h = i.COMMENT_NODE = 8, f = i.DOCUMENT_NODE = 9, p = i.DOCUMENT_TYPE_NODE = 10, g = i.DOCUMENT_FRAGMENT_NODE = 11, m = i.NOTATION_NODE = 12, v = {}, _ = {}, b = (v.INDEX_SIZE_ERR = (_[1] = "Index size error", 1), v.DOMSTRING_SIZE_ERR = (_[2] = "DOMString size error", 2), v.HIERARCHY_REQUEST_ERR = (_[3] = "Hierarchy request error", 3)), y = (v.WRONG_DOCUMENT_ERR = (_[4] = "Wrong document", 4), v.INVALID_CHARACTER_ERR = (_[5] = "Invalid character", 5), v.NO_DATA_ALLOWED_ERR = (_[6] = "No data allowed", 6), v.NO_MODIFICATION_ALLOWED_ERR = (_[7] = "No modification allowed", 7), v.NOT_FOUND_ERR = (_[8] = "Not found", 8)), w = (v.NOT_SUPPORTED_ERR = (_[9] = "Not supported", 9), v.INUSE_ATTRIBUTE_ERR = (_[10] = "Attribute in use", 10)); + v.INVALID_STATE_ERR = (_[11] = "Invalid state", 11), v.SYNTAX_ERR = (_[12] = "Syntax error", 12), v.INVALID_MODIFICATION_ERR = (_[13] = "Invalid modification", 13), v.NAMESPACE_ERR = (_[14] = "Invalid namespace", 14), v.INVALID_ACCESS_ERR = (_[15] = "Invalid access", 15); + function S(e2, t2) { + if (t2 instanceof Error) + var n2 = t2; + else + n2 = this, Error.call(this, _[e2]), this.message = _[e2], Error.captureStackTrace && Error.captureStackTrace(this, S); + return n2.code = e2, t2 && (this.message = this.message + ": " + t2), n2; + } + function x() { + } + function E(e2, t2) { + this._node = e2, this._refresh = t2, A(this); + } + function A(e2) { + var t2 = e2._node._inc || e2._node.ownerDocument._inc; + if (e2._inc != t2) { + var r2 = e2._refresh(e2._node); + te(e2, "length", r2.length), n(r2, e2), e2._inc = t2; + } + } + function C() { + } + function j(e2, t2) { + for (var n2 = e2.length; n2--; ) + if (e2[n2] === t2) + return n2; + } + function T(e2, t2, n2, r2) { + if (r2 ? t2[j(t2, r2)] = n2 : t2[t2.length++] = n2, e2) { + n2.ownerElement = e2; + var i2 = e2.ownerDocument; + i2 && (r2 && D(i2, e2, r2), function(e3, t3, n3) { + e3 && e3._inc++, n3.namespaceURI == "http://www.w3.org/2000/xmlns/" && (t3._nsMap[n3.prefix ? n3.localName : ""] = n3.value); + }(i2, e2, n2)); + } + } + function O(e2, t2, n2) { + var r2 = j(t2, n2); + if (!(r2 >= 0)) + throw S(y, new Error(e2.tagName + "@" + n2)); + for (var i2 = t2.length - 1; r2 < i2; ) + t2[r2] = t2[++r2]; + if (t2.length = i2, e2) { + var o2 = e2.ownerDocument; + o2 && (D(o2, e2, n2), n2.ownerElement = null); + } + } + function k(e2) { + if (this._features = {}, e2) + for (var t2 in e2) + this._features = e2[t2]; + } + function N() { + } + function I(e2) { + return (e2 == "<" ? "<" : e2 == ">" && ">") || e2 == "&" && "&" || e2 == '"' && """ || "&#" + e2.charCodeAt() + ";"; + } + function M(e2, t2) { + if (t2(e2)) + return true; + if (e2 = e2.firstChild) + do { + if (M(e2, t2)) + return true; + } while (e2 = e2.nextSibling); + } + function R() { + } + function D(e2, t2, n2, r2) { + e2 && e2._inc++, n2.namespaceURI == "http://www.w3.org/2000/xmlns/" && delete t2._nsMap[n2.prefix ? n2.localName : ""]; + } + function P(e2, t2, n2) { + if (e2 && e2._inc) { + e2._inc++; + var r2 = t2.childNodes; + if (n2) + r2[r2.length++] = n2; + else { + for (var i2 = t2.firstChild, o2 = 0; i2; ) + r2[o2++] = i2, i2 = i2.nextSibling; + r2.length = o2; + } + } + } + function L(e2, t2) { + var n2 = t2.previousSibling, r2 = t2.nextSibling; + return n2 ? n2.nextSibling = r2 : e2.firstChild = r2, r2 ? r2.previousSibling = n2 : e2.lastChild = n2, P(e2.ownerDocument, e2), t2; + } + function z(e2, t2, n2) { + var r2 = t2.parentNode; + if (r2 && r2.removeChild(t2), t2.nodeType === g) { + var i2 = t2.firstChild; + if (i2 == null) + return t2; + var o2 = t2.lastChild; + } else + i2 = o2 = t2; + var s2 = n2 ? n2.previousSibling : e2.lastChild; + i2.previousSibling = s2, o2.nextSibling = n2, s2 ? s2.nextSibling = i2 : e2.firstChild = i2, n2 == null ? e2.lastChild = o2 : n2.previousSibling = o2; + do { + i2.parentNode = e2; + } while (i2 !== o2 && (i2 = i2.nextSibling)); + return P(e2.ownerDocument || e2, e2), t2.nodeType == g && (t2.firstChild = t2.lastChild = null), t2; + } + function F() { + this._nsMap = {}; + } + function B() { + } + function q() { + } + function H() { + } + function U() { + } + function $() { + } + function W() { + } + function G() { + } + function V() { + } + function J() { + } + function X() { + } + function Q() { + } + function Y() { + } + function K(e2, t2) { + var n2 = [], r2 = this.nodeType == 9 ? this.documentElement : this, i2 = r2.prefix, o2 = r2.namespaceURI; + if (o2 && i2 == null && (i2 = r2.lookupPrefix(o2)) == null) + var s2 = [{namespace: o2, prefix: null}]; + return ee(this, n2, e2, t2, s2), n2.join(""); + } + function Z(e2, t2, n2) { + var r2 = e2.prefix || "", i2 = e2.namespaceURI; + if (!r2 && !i2) + return false; + if (r2 === "xml" && i2 === "http://www.w3.org/XML/1998/namespace" || i2 == "http://www.w3.org/2000/xmlns/") + return false; + for (var o2 = n2.length; o2--; ) { + var s2 = n2[o2]; + if (s2.prefix == r2) + return s2.namespace != i2; + } + return true; + } + function ee(e2, t2, n2, r2, i2) { + if (r2) { + if (!(e2 = r2(e2))) + return; + if (typeof e2 == "string") + return void t2.push(e2); + } + switch (e2.nodeType) { + case o: + i2 || (i2 = []); + i2.length; + var u2 = e2.attributes, m2 = u2.length, v2 = e2.firstChild, _2 = e2.tagName; + n2 = e2.namespaceURI === "http://www.w3.org/1999/xhtml" || n2, t2.push("<", _2); + for (var b2 = 0; b2 < m2; b2++) { + (y2 = u2.item(b2)).prefix == "xmlns" ? i2.push({prefix: y2.localName, namespace: y2.value}) : y2.nodeName == "xmlns" && i2.push({prefix: "", namespace: y2.value}); + } + for (b2 = 0; b2 < m2; b2++) { + var y2; + if (Z(y2 = u2.item(b2), 0, i2)) { + var w2 = y2.prefix || "", S2 = y2.namespaceURI, x2 = w2 ? " xmlns:" + w2 : " xmlns"; + t2.push(x2, '="', S2, '"'), i2.push({prefix: w2, namespace: S2}); + } + ee(y2, t2, n2, r2, i2); + } + if (Z(e2, 0, i2)) { + w2 = e2.prefix || "", S2 = e2.namespaceURI, x2 = w2 ? " xmlns:" + w2 : " xmlns"; + t2.push(x2, '="', S2, '"'), i2.push({prefix: w2, namespace: S2}); + } + if (v2 || n2 && !/^(?:meta|link|img|br|hr|input)$/i.test(_2)) { + if (t2.push(">"), n2 && /^script$/i.test(_2)) + for (; v2; ) + v2.data ? t2.push(v2.data) : ee(v2, t2, n2, r2, i2), v2 = v2.nextSibling; + else + for (; v2; ) + ee(v2, t2, n2, r2, i2), v2 = v2.nextSibling; + t2.push("</", _2, ">"); + } else + t2.push("/>"); + return; + case f: + case g: + for (v2 = e2.firstChild; v2; ) + ee(v2, t2, n2, r2, i2), v2 = v2.nextSibling; + return; + case s: + return t2.push(" ", e2.name, '="', e2.value.replace(/[<&"]/g, I), '"'); + case a: + return t2.push(e2.data.replace(/[<&]/g, I)); + case c: + return t2.push("<![CDATA[", e2.data, "]]>"); + case h: + return t2.push("<!--", e2.data, "-->"); + case p: + var E2 = e2.publicId, A2 = e2.systemId; + if (t2.push("<!DOCTYPE ", e2.name), E2) + t2.push(' PUBLIC "', E2), A2 && A2 != "." && t2.push('" "', A2), t2.push('">'); + else if (A2 && A2 != ".") + t2.push(' SYSTEM "', A2, '">'); + else { + var C2 = e2.internalSubset; + C2 && t2.push(" [", C2, "]"), t2.push(">"); + } + return; + case d: + return t2.push("<?", e2.target, " ", e2.data, "?>"); + case l: + return t2.push("&", e2.nodeName, ";"); + default: + t2.push("??", e2.nodeName); + } + } + function te(e2, t2, n2) { + e2[t2] = n2; + } + S.prototype = Error.prototype, n(v, S), x.prototype = {length: 0, item: function(e2) { + return this[e2] || null; + }, toString: function(e2, t2) { + for (var n2 = [], r2 = 0; r2 < this.length; r2++) + ee(this[r2], n2, e2, t2); + return n2.join(""); + }}, E.prototype.item = function(e2) { + return A(this), this[e2]; + }, r(E, x), C.prototype = {length: 0, item: x.prototype.item, getNamedItem: function(e2) { + for (var t2 = this.length; t2--; ) { + var n2 = this[t2]; + if (n2.nodeName == e2) + return n2; + } + }, setNamedItem: function(e2) { + var t2 = e2.ownerElement; + if (t2 && t2 != this._ownerElement) + throw new S(w); + var n2 = this.getNamedItem(e2.nodeName); + return T(this._ownerElement, this, e2, n2), n2; + }, setNamedItemNS: function(e2) { + var t2, n2 = e2.ownerElement; + if (n2 && n2 != this._ownerElement) + throw new S(w); + return t2 = this.getNamedItemNS(e2.namespaceURI, e2.localName), T(this._ownerElement, this, e2, t2), t2; + }, removeNamedItem: function(e2) { + var t2 = this.getNamedItem(e2); + return O(this._ownerElement, this, t2), t2; + }, removeNamedItemNS: function(e2, t2) { + var n2 = this.getNamedItemNS(e2, t2); + return O(this._ownerElement, this, n2), n2; + }, getNamedItemNS: function(e2, t2) { + for (var n2 = this.length; n2--; ) { + var r2 = this[n2]; + if (r2.localName == t2 && r2.namespaceURI == e2) + return r2; + } + return null; + }}, k.prototype = {hasFeature: function(e2, t2) { + var n2 = this._features[e2.toLowerCase()]; + return !(!n2 || t2 && !(t2 in n2)); + }, createDocument: function(e2, t2, n2) { + var r2 = new R(); + if (r2.implementation = this, r2.childNodes = new x(), r2.doctype = n2, n2 && r2.appendChild(n2), t2) { + var i2 = r2.createElementNS(e2, t2); + r2.appendChild(i2); + } + return r2; + }, createDocumentType: function(e2, t2, n2) { + var r2 = new W(); + return r2.name = e2, r2.nodeName = e2, r2.publicId = t2, r2.systemId = n2, r2; + }}, N.prototype = {firstChild: null, lastChild: null, previousSibling: null, nextSibling: null, attributes: null, parentNode: null, childNodes: null, ownerDocument: null, nodeValue: null, namespaceURI: null, prefix: null, localName: null, insertBefore: function(e2, t2) { + return z(this, e2, t2); + }, replaceChild: function(e2, t2) { + this.insertBefore(e2, t2), t2 && this.removeChild(t2); + }, removeChild: function(e2) { + return L(this, e2); + }, appendChild: function(e2) { + return this.insertBefore(e2, null); + }, hasChildNodes: function() { + return this.firstChild != null; + }, cloneNode: function(e2) { + return function e3(t2, n2, r2) { + var i2 = new n2.constructor(); + for (var a2 in n2) { + var c2 = n2[a2]; + typeof c2 != "object" && c2 != i2[a2] && (i2[a2] = c2); + } + n2.childNodes && (i2.childNodes = new x()); + switch (i2.ownerDocument = t2, i2.nodeType) { + case o: + var l2 = n2.attributes, u2 = i2.attributes = new C(), d2 = l2.length; + u2._ownerElement = i2; + for (var h2 = 0; h2 < d2; h2++) + i2.setAttributeNode(e3(t2, l2.item(h2), true)); + break; + case s: + r2 = true; + } + if (r2) + for (var f2 = n2.firstChild; f2; ) + i2.appendChild(e3(t2, f2, r2)), f2 = f2.nextSibling; + return i2; + }(this.ownerDocument || this, this, e2); + }, normalize: function() { + for (var e2 = this.firstChild; e2; ) { + var t2 = e2.nextSibling; + t2 && t2.nodeType == a && e2.nodeType == a ? (this.removeChild(t2), e2.appendData(t2.data)) : (e2.normalize(), e2 = t2); + } + }, isSupported: function(e2, t2) { + return this.ownerDocument.implementation.hasFeature(e2, t2); + }, hasAttributes: function() { + return this.attributes.length > 0; + }, lookupPrefix: function(e2) { + for (var t2 = this; t2; ) { + var n2 = t2._nsMap; + if (n2) { + for (var r2 in n2) + if (n2[r2] == e2) + return r2; + } + t2 = t2.nodeType == s ? t2.ownerDocument : t2.parentNode; + } + return null; + }, lookupNamespaceURI: function(e2) { + for (var t2 = this; t2; ) { + var n2 = t2._nsMap; + if (n2 && e2 in n2) + return n2[e2]; + t2 = t2.nodeType == s ? t2.ownerDocument : t2.parentNode; + } + return null; + }, isDefaultNamespace: function(e2) { + return this.lookupPrefix(e2) == null; + }}, n(i, N), n(i, N.prototype), R.prototype = {nodeName: "#document", nodeType: f, doctype: null, documentElement: null, _inc: 1, insertBefore: function(e2, t2) { + if (e2.nodeType == g) { + for (var n2 = e2.firstChild; n2; ) { + var r2 = n2.nextSibling; + this.insertBefore(n2, t2), n2 = r2; + } + return e2; + } + return this.documentElement == null && e2.nodeType == o && (this.documentElement = e2), z(this, e2, t2), e2.ownerDocument = this, e2; + }, removeChild: function(e2) { + return this.documentElement == e2 && (this.documentElement = null), L(this, e2); + }, importNode: function(e2, t2) { + return function e3(t3, n2, r2) { + var i2; + switch (n2.nodeType) { + case o: + (i2 = n2.cloneNode(false)).ownerDocument = t3; + case g: + break; + case s: + r2 = true; + } + i2 || (i2 = n2.cloneNode(false)); + if (i2.ownerDocument = t3, i2.parentNode = null, r2) + for (var a2 = n2.firstChild; a2; ) + i2.appendChild(e3(t3, a2, r2)), a2 = a2.nextSibling; + return i2; + }(this, e2, t2); + }, getElementById: function(e2) { + var t2 = null; + return M(this.documentElement, function(n2) { + if (n2.nodeType == o && n2.getAttribute("id") == e2) + return t2 = n2, true; + }), t2; + }, createElement: function(e2) { + var t2 = new F(); + return t2.ownerDocument = this, t2.nodeName = e2, t2.tagName = e2, t2.childNodes = new x(), (t2.attributes = new C())._ownerElement = t2, t2; + }, createDocumentFragment: function() { + var e2 = new X(); + return e2.ownerDocument = this, e2.childNodes = new x(), e2; + }, createTextNode: function(e2) { + var t2 = new H(); + return t2.ownerDocument = this, t2.appendData(e2), t2; + }, createComment: function(e2) { + var t2 = new U(); + return t2.ownerDocument = this, t2.appendData(e2), t2; + }, createCDATASection: function(e2) { + var t2 = new $(); + return t2.ownerDocument = this, t2.appendData(e2), t2; + }, createProcessingInstruction: function(e2, t2) { + var n2 = new Q(); + return n2.ownerDocument = this, n2.tagName = n2.target = e2, n2.nodeValue = n2.data = t2, n2; + }, createAttribute: function(e2) { + var t2 = new B(); + return t2.ownerDocument = this, t2.name = e2, t2.nodeName = e2, t2.localName = e2, t2.specified = true, t2; + }, createEntityReference: function(e2) { + var t2 = new J(); + return t2.ownerDocument = this, t2.nodeName = e2, t2; + }, createElementNS: function(e2, t2) { + var n2 = new F(), r2 = t2.split(":"), i2 = n2.attributes = new C(); + return n2.childNodes = new x(), n2.ownerDocument = this, n2.nodeName = t2, n2.tagName = t2, n2.namespaceURI = e2, r2.length == 2 ? (n2.prefix = r2[0], n2.localName = r2[1]) : n2.localName = t2, i2._ownerElement = n2, n2; + }, createAttributeNS: function(e2, t2) { + var n2 = new B(), r2 = t2.split(":"); + return n2.ownerDocument = this, n2.nodeName = t2, n2.name = t2, n2.namespaceURI = e2, n2.specified = true, r2.length == 2 ? (n2.prefix = r2[0], n2.localName = r2[1]) : n2.localName = t2, n2; + }}, r(R, N), F.prototype = {nodeType: o, hasAttribute: function(e2) { + return this.getAttributeNode(e2) != null; + }, getAttribute: function(e2) { + var t2 = this.getAttributeNode(e2); + return t2 && t2.value || ""; + }, getAttributeNode: function(e2) { + return this.attributes.getNamedItem(e2); + }, setAttribute: function(e2, t2) { + var n2 = this.ownerDocument.createAttribute(e2); + n2.value = n2.nodeValue = "" + t2, this.setAttributeNode(n2); + }, removeAttribute: function(e2) { + var t2 = this.getAttributeNode(e2); + t2 && this.removeAttributeNode(t2); + }, appendChild: function(e2) { + return e2.nodeType === g ? this.insertBefore(e2, null) : function(e3, t2) { + var n2 = t2.parentNode; + if (n2) { + var r2 = e3.lastChild; + n2.removeChild(t2); + r2 = e3.lastChild; + } + return r2 = e3.lastChild, t2.parentNode = e3, t2.previousSibling = r2, t2.nextSibling = null, r2 ? r2.nextSibling = t2 : e3.firstChild = t2, e3.lastChild = t2, P(e3.ownerDocument, e3, t2), t2; + }(this, e2); + }, setAttributeNode: function(e2) { + return this.attributes.setNamedItem(e2); + }, setAttributeNodeNS: function(e2) { + return this.attributes.setNamedItemNS(e2); + }, removeAttributeNode: function(e2) { + return this.attributes.removeNamedItem(e2.nodeName); + }, removeAttributeNS: function(e2, t2) { + var n2 = this.getAttributeNodeNS(e2, t2); + n2 && this.removeAttributeNode(n2); + }, hasAttributeNS: function(e2, t2) { + return this.getAttributeNodeNS(e2, t2) != null; + }, getAttributeNS: function(e2, t2) { + var n2 = this.getAttributeNodeNS(e2, t2); + return n2 && n2.value || ""; + }, setAttributeNS: function(e2, t2, n2) { + var r2 = this.ownerDocument.createAttributeNS(e2, t2); + r2.value = r2.nodeValue = "" + n2, this.setAttributeNode(r2); + }, getAttributeNodeNS: function(e2, t2) { + return this.attributes.getNamedItemNS(e2, t2); + }, getElementsByTagName: function(e2) { + return new E(this, function(t2) { + var n2 = []; + return M(t2, function(r2) { + r2 === t2 || r2.nodeType != o || e2 !== "*" && r2.tagName != e2 || n2.push(r2); + }), n2; + }); + }, getElementsByTagNameNS: function(e2, t2) { + return new E(this, function(n2) { + var r2 = []; + return M(n2, function(i2) { + i2 === n2 || i2.nodeType !== o || e2 !== "*" && i2.namespaceURI !== e2 || t2 !== "*" && i2.localName != t2 || r2.push(i2); + }), r2; + }); + }}, R.prototype.getElementsByTagName = F.prototype.getElementsByTagName, R.prototype.getElementsByTagNameNS = F.prototype.getElementsByTagNameNS, r(F, N), B.prototype.nodeType = s, r(B, N), q.prototype = {data: "", substringData: function(e2, t2) { + return this.data.substring(e2, e2 + t2); + }, appendData: function(e2) { + e2 = this.data + e2, this.nodeValue = this.data = e2, this.length = e2.length; + }, insertData: function(e2, t2) { + this.replaceData(e2, 0, t2); + }, appendChild: function(e2) { + throw new Error(_[b]); + }, deleteData: function(e2, t2) { + this.replaceData(e2, t2, ""); + }, replaceData: function(e2, t2, n2) { + n2 = this.data.substring(0, e2) + n2 + this.data.substring(e2 + t2), this.nodeValue = this.data = n2, this.length = n2.length; + }}, r(q, N), H.prototype = {nodeName: "#text", nodeType: a, splitText: function(e2) { + var t2 = this.data, n2 = t2.substring(e2); + t2 = t2.substring(0, e2), this.data = this.nodeValue = t2, this.length = t2.length; + var r2 = this.ownerDocument.createTextNode(n2); + return this.parentNode && this.parentNode.insertBefore(r2, this.nextSibling), r2; + }}, r(H, q), U.prototype = {nodeName: "#comment", nodeType: h}, r(U, q), $.prototype = {nodeName: "#cdata-section", nodeType: c}, r($, q), W.prototype.nodeType = p, r(W, N), G.prototype.nodeType = m, r(G, N), V.prototype.nodeType = u, r(V, N), J.prototype.nodeType = l, r(J, N), X.prototype.nodeName = "#document-fragment", X.prototype.nodeType = g, r(X, N), Q.prototype.nodeType = d, r(Q, N), Y.prototype.serializeToString = function(e2, t2, n2) { + return K.call(e2, t2, n2); + }, N.prototype.toString = K; + try { + if (Object.defineProperty) { + Object.defineProperty(E.prototype, "length", {get: function() { + return A(this), this.$$length; + }}), Object.defineProperty(N.prototype, "textContent", {get: function() { + return function e2(t2) { + switch (t2.nodeType) { + case o: + case g: + var n2 = []; + for (t2 = t2.firstChild; t2; ) + t2.nodeType !== 7 && t2.nodeType !== 8 && n2.push(e2(t2)), t2 = t2.nextSibling; + return n2.join(""); + default: + return t2.nodeValue; + } + }(this); + }, set: function(e2) { + switch (this.nodeType) { + case o: + case g: + for (; this.firstChild; ) + this.removeChild(this.firstChild); + (e2 || String(e2)) && this.appendChild(this.ownerDocument.createTextNode(e2)); + break; + default: + this.data = e2, this.value = e2, this.nodeValue = e2; + } + }}), te = function(e2, t2, n2) { + e2["$$" + t2] = n2; + }; + } + } catch (e2) { + } + t.DOMImplementation = k, t.XMLSerializer = Y; + }, function(e, t, n) { + (function(t2) { + var n2 = typeof t2 == "object" && t2 && t2.Object === Object && t2; + e.exports = n2; + }).call(this, n(12)); + }, function(e, t) { + e.exports = function(e2, t2) { + for (var n = -1, r = e2 == null ? 0 : e2.length; ++n < r && t2(e2[n], n, e2) !== false; ) + ; + return e2; + }; + }, function(e, t, n) { + var r = n(342), i = n(99), o = n(16), s = n(100), a = n(37), c = n(101), l = Object.prototype.hasOwnProperty; + e.exports = function(e2, t2) { + var n2 = o(e2), u = !n2 && i(e2), d = !n2 && !u && s(e2), h = !n2 && !u && !d && c(e2), f = n2 || u || d || h, p = f ? r(e2.length, String) : [], g = p.length; + for (var m in e2) + !t2 && !l.call(e2, m) || f && (m == "length" || d && (m == "offset" || m == "parent") || h && (m == "buffer" || m == "byteLength" || m == "byteOffset") || a(m, g)) || p.push(m); + return p; + }; + }, function(e, t, n) { + var r = n(343), i = n(23), o = Object.prototype, s = o.hasOwnProperty, a = o.propertyIsEnumerable, c = r(function() { + return arguments; + }()) ? r : function(e2) { + return i(e2) && s.call(e2, "callee") && !a.call(e2, "callee"); + }; + e.exports = c; + }, function(e, t, n) { + (function(e2) { + var r = n(11), i = n(344), o = t && !t.nodeType && t, s = o && typeof e2 == "object" && e2 && !e2.nodeType && e2, a = s && s.exports === o ? r.Buffer : void 0, c = (a ? a.isBuffer : void 0) || i; + e2.exports = c; + }).call(this, n(46)(e)); + }, function(e, t, n) { + var r = n(345), i = n(346), o = n(347), s = o && o.isTypedArray, a = s ? i(s) : r; + e.exports = a; + }, function(e, t, n) { + var r = n(103), i = n(348), o = Object.prototype.hasOwnProperty; + e.exports = function(e2) { + if (!r(e2)) + return i(e2); + var t2 = []; + for (var n2 in Object(e2)) + o.call(e2, n2) && n2 != "constructor" && t2.push(n2); + return t2; + }; + }, function(e, t) { + var n = Object.prototype; + e.exports = function(e2) { + var t2 = e2 && e2.constructor; + return e2 === (typeof t2 == "function" && t2.prototype || n); + }; + }, function(e, t) { + e.exports = function(e2, t2) { + return function(n) { + return e2(t2(n)); + }; + }; + }, function(e, t, n) { + var r = n(106), i = n(50), o = Object.prototype.hasOwnProperty; + e.exports = function(e2, t2, n2) { + var s = e2[t2]; + o.call(e2, t2) && i(s, n2) && (n2 !== void 0 || t2 in e2) || r(e2, t2, n2); + }; + }, function(e, t, n) { + var r = n(107); + e.exports = function(e2, t2, n2) { + t2 == "__proto__" && r ? r(e2, t2, {configurable: true, enumerable: true, value: n2, writable: true}) : e2[t2] = n2; + }; + }, function(e, t, n) { + var r = n(26), i = function() { + try { + var e2 = r(Object, "defineProperty"); + return e2({}, "", {}), e2; + } catch (e3) { + } + }(); + e.exports = i; + }, function(e, t) { + var n = Function.prototype.toString; + e.exports = function(e2) { + if (e2 != null) { + try { + return n.call(e2); + } catch (e3) { + } + try { + return e2 + ""; + } catch (e3) { + } + } + return ""; + }; + }, function(e, t, n) { + var r = n(38), i = n(358), o = n(110); + e.exports = function(e2, t2) { + return o(i(e2, t2, r), e2 + ""); + }; + }, function(e, t, n) { + var r = n(359), i = n(111)(r); + e.exports = i; + }, function(e, t) { + var n = Date.now; + e.exports = function(e2) { + var t2 = 0, r = 0; + return function() { + var i = n(), o = 16 - (i - r); + if (r = i, o > 0) { + if (++t2 >= 800) + return arguments[0]; + } else + t2 = 0; + return e2.apply(void 0, arguments); + }; + }; + }, function(e, t, n) { + var r = n(98), i = n(362), o = n(29); + e.exports = function(e2) { + return o(e2) ? r(e2, true) : i(e2); + }; + }, function(e, t, n) { + var r = n(364), i = n(365), o = n(366); + e.exports = function(e2, t2, n2) { + return t2 == t2 ? o(e2, t2, n2) : r(e2, i, n2); + }; + }, function(e, t, n) { + var r = n(25), i = n(16), o = n(23); + e.exports = function(e2) { + return typeof e2 == "string" || !i(e2) && o(e2) && r(e2) == "[object String]"; + }; + }, function(e, t, n) { + var r = n(38), i = n(116), o = i ? function(e2, t2) { + return i.set(e2, t2), e2; + } : r; + e.exports = o; + }, function(e, t, n) { + var r = n(117), i = r && new r(); + e.exports = i; + }, function(e, t, n) { + var r = n(26)(n(11), "WeakMap"); + e.exports = r; + }, function(e, t, n) { + var r = n(119), i = n(120), o = n(371), s = n(51), a = n(121), c = n(77), l = n(382), u = n(52), d = n(11); + e.exports = function e2(t2, n2, h, f, p, g, m, v, _, b) { + var y = 128 & n2, w = 1 & n2, S = 2 & n2, x = 24 & n2, E = 512 & n2, A = S ? void 0 : s(t2); + return function C() { + for (var j = arguments.length, T = Array(j), O = j; O--; ) + T[O] = arguments[O]; + if (x) + var k = c(C), N = o(T, k); + if (f && (T = r(T, f, p, x)), g && (T = i(T, g, m, x)), j -= N, x && j < b) { + var I = u(T, k); + return a(t2, n2, e2, C.placeholder, h, T, I, v, _, b - j); + } + var M = w ? h : this, R = S ? M[t2] : t2; + return j = T.length, v ? T = l(T, v) : E && j > 1 && T.reverse(), y && _ < j && (T.length = _), this && this !== d && this instanceof C && (R = A || s(R)), R.apply(M, T); + }; + }; + }, function(e, t) { + var n = Math.max; + e.exports = function(e2, t2, r, i) { + for (var o = -1, s = e2.length, a = r.length, c = -1, l = t2.length, u = n(s - a, 0), d = Array(l + u), h = !i; ++c < l; ) + d[c] = t2[c]; + for (; ++o < a; ) + (h || o < s) && (d[r[o]] = e2[o]); + for (; u--; ) + d[c++] = e2[o++]; + return d; + }; + }, function(e, t) { + var n = Math.max; + e.exports = function(e2, t2, r, i) { + for (var o = -1, s = e2.length, a = -1, c = r.length, l = -1, u = t2.length, d = n(s - c, 0), h = Array(d + u), f = !i; ++o < d; ) + h[o] = e2[o]; + for (var p = o; ++l < u; ) + h[p + l] = t2[l]; + for (; ++a < c; ) + (f || o < s) && (h[p + r[a]] = e2[o++]); + return h; + }; + }, function(e, t, n) { + var r = n(372), i = n(125), o = n(126); + e.exports = function(e2, t2, n2, s, a, c, l, u, d, h) { + var f = 8 & t2; + t2 |= f ? 32 : 64, 4 & (t2 &= ~(f ? 64 : 32)) || (t2 &= -4); + var p = [e2, t2, a, f ? c : void 0, f ? l : void 0, f ? void 0 : c, f ? void 0 : l, u, d, h], g = n2.apply(void 0, p); + return r(e2) && i(g, p), g.placeholder = s, o(g, e2, t2); + }; + }, function(e, t, n) { + var r = n(116), i = n(373), o = r ? function(e2) { + return r.get(e2); + } : i; + e.exports = o; + }, function(e, t, n) { + var r = n(74), i = n(76); + function o(e2, t2) { + this.__wrapped__ = e2, this.__actions__ = [], this.__chain__ = !!t2, this.__index__ = 0, this.__values__ = void 0; + } + o.prototype = r(i.prototype), o.prototype.constructor = o, e.exports = o; + }, function(e, t) { + e.exports = function(e2, t2) { + var n = -1, r = e2.length; + for (t2 || (t2 = Array(r)); ++n < r; ) + t2[n] = e2[n]; + return t2; + }; + }, function(e, t, n) { + var r = n(115), i = n(111)(r); + e.exports = i; + }, function(e, t, n) { + var r = n(378), i = n(379), o = n(110), s = n(380); + e.exports = function(e2, t2, n2) { + var a = t2 + ""; + return o(e2, i(a, s(r(a), n2))); + }; + }, function(e, t, n) { + var r = n(53), i = n(393), o = n(394), s = n(395), a = n(396), c = n(397); + function l(e2) { + var t2 = this.__data__ = new r(e2); + this.size = t2.size; + } + l.prototype.clear = i, l.prototype.delete = o, l.prototype.get = s, l.prototype.has = a, l.prototype.set = c, e.exports = l; + }, function(e, t, n) { + var r = n(410), i = n(23); + e.exports = function e2(t2, n2, o, s, a) { + return t2 === n2 || (t2 == null || n2 == null || !i(t2) && !i(n2) ? t2 != t2 && n2 != n2 : r(t2, n2, o, s, e2, a)); + }; + }, function(e, t, n) { + var r = n(411), i = n(414), o = n(415); + e.exports = function(e2, t2, n2, s, a, c) { + var l = 1 & n2, u = e2.length, d = t2.length; + if (u != d && !(l && d > u)) + return false; + var h = c.get(e2), f = c.get(t2); + if (h && f) + return h == t2 && f == e2; + var p = -1, g = true, m = 2 & n2 ? new r() : void 0; + for (c.set(e2, t2), c.set(t2, e2); ++p < u; ) { + var v = e2[p], _ = t2[p]; + if (s) + var b = l ? s(_, v, p, t2, e2, c) : s(v, _, p, e2, t2, c); + if (b !== void 0) { + if (b) + continue; + g = false; + break; + } + if (m) { + if (!i(t2, function(e3, t3) { + if (!o(m, t3) && (v === e3 || a(v, e3, n2, s, c))) + return m.push(t3); + })) { + g = false; + break; + } + } else if (v !== _ && !a(v, _, n2, s, c)) { + g = false; + break; + } + } + return c.delete(e2), c.delete(t2), g; + }; + }, function(e, t, n) { + var r = n(131), i = n(16); + e.exports = function(e2, t2, n2) { + var o = t2(e2); + return i(e2) ? o : r(o, n2(e2)); + }; + }, function(e, t) { + e.exports = function(e2, t2) { + for (var n = -1, r = t2.length, i = e2.length; ++n < r; ) + e2[i + n] = t2[n]; + return e2; + }; + }, function(e, t, n) { + var r = n(422), i = n(133), o = Object.prototype.propertyIsEnumerable, s = Object.getOwnPropertySymbols, a = s ? function(e2) { + return e2 == null ? [] : (e2 = Object(e2), r(s(e2), function(t2) { + return o.call(e2, t2); + })); + } : i; + e.exports = a; + }, function(e, t) { + e.exports = function() { + return []; + }; + }, function(e, t, n) { + var r = n(423), i = n(78), o = n(424), s = n(425), a = n(117), c = n(25), l = n(108), u = l(r), d = l(i), h = l(o), f = l(s), p = l(a), g = c; + (r && g(new r(new ArrayBuffer(1))) != "[object DataView]" || i && g(new i()) != "[object Map]" || o && g(o.resolve()) != "[object Promise]" || s && g(new s()) != "[object Set]" || a && g(new a()) != "[object WeakMap]") && (g = function(e2) { + var t2 = c(e2), n2 = t2 == "[object Object]" ? e2.constructor : void 0, r2 = n2 ? l(n2) : ""; + if (r2) + switch (r2) { + case u: + return "[object DataView]"; + case d: + return "[object Map]"; + case h: + return "[object Promise]"; + case f: + return "[object Set]"; + case p: + return "[object WeakMap]"; + } + return t2; + }), e.exports = g; + }, function(e, t, n) { + var r = n(20); + e.exports = function(e2) { + return e2 == e2 && !r(e2); + }; + }, function(e, t) { + e.exports = function(e2, t2) { + return function(n) { + return n != null && (n[e2] === t2 && (t2 !== void 0 || e2 in Object(n))); + }; + }; + }, function(e, t, n) { + var r = n(432); + e.exports = function(e2) { + return e2 == null ? "" : r(e2); + }; + }, function(e, t) { + e.exports = function(e2) { + return function(t2) { + return t2 == null ? void 0 : t2[e2]; + }; + }; + }, function(e, t, n) { + Object.defineProperty(t, "__esModule", {value: true}); + var r = l(n(447)), i = l(n(453)), o = l(n(461)), s = l(n(464)), a = l(n(89)); + t.default = function(e2, t2) { + var n2 = (0, c.getStorage)(), l2 = !(!n2 || !n2[t2]), u = l2 ? n2[t2] : {clear: function() { + }, get: function() { + }, remove: function() { + }, set: function() { + }}, d = u.clear.bind(u), h = u.get.bind(u), f = u.remove.bind(u), p = u.set.bind(u); + return {_driver: e2, _support: l2, _initStorage: function() { + return a.default.resolve(); + }, clear: function(e3) { + var t3 = this; + return (0, s.default)(o.default.mark(function n3() { + return o.default.wrap(function(t4) { + for (; ; ) + switch (t4.prev = t4.next) { + case 0: + d(), e3 && e3(); + case 2: + case "end": + return t4.stop(); + } + }, n3, t3); + }))(); + }, iterate: function(e3, t3) { + var n3 = this; + return (0, s.default)(o.default.mark(function r2() { + var s2; + return o.default.wrap(function(n4) { + for (; ; ) + switch (n4.prev = n4.next) { + case 0: + return n4.next = 2, (0, c.usePromise)(h, null); + case 2: + s2 = n4.sent, (0, i.default)(s2).forEach(function(t4, n5) { + return e3(s2[t4], t4, n5); + }), t3 && t3(); + case 6: + case "end": + return n4.stop(); + } + }, r2, n3); + }))(); + }, getItem: function(e3, t3) { + var n3 = this; + return (0, s.default)(o.default.mark(function r2() { + var i2; + return o.default.wrap(function(n4) { + for (; ; ) + switch (n4.prev = n4.next) { + case 0: + return n4.prev = 0, n4.next = 3, (0, c.usePromise)(h, e3); + case 3: + return i2 = n4.sent, i2 = (i2 = typeof e3 == "string" ? i2[e3] : i2) === void 0 ? null : i2, t3 && t3(null, i2), n4.abrupt("return", i2); + case 10: + throw n4.prev = 10, n4.t0 = n4.catch(0), t3 && t3(n4.t0), n4.t0; + case 14: + case "end": + return n4.stop(); + } + }, r2, n3, [[0, 10]]); + }))(); + }, key: function(e3, t3) { + var n3 = this; + return (0, s.default)(o.default.mark(function r2() { + var s2, a2; + return o.default.wrap(function(n4) { + for (; ; ) + switch (n4.prev = n4.next) { + case 0: + return n4.next = 2, (0, c.usePromise)(h, null); + case 2: + return s2 = n4.sent, a2 = (0, i.default)(s2)[e3], t3 && t3(a2), n4.abrupt("return", a2); + case 6: + case "end": + return n4.stop(); + } + }, r2, n3); + }))(); + }, keys: function(e3) { + var t3 = this; + return (0, s.default)(o.default.mark(function n3() { + var r2, s2; + return o.default.wrap(function(t4) { + for (; ; ) + switch (t4.prev = t4.next) { + case 0: + return t4.next = 2, (0, c.usePromise)(h, null); + case 2: + return r2 = t4.sent, s2 = (0, i.default)(r2), e3 && e3(s2), t4.abrupt("return", s2); + case 6: + case "end": + return t4.stop(); + } + }, n3, t3); + }))(); + }, length: function(e3) { + var t3 = this; + return (0, s.default)(o.default.mark(function n3() { + var r2, s2; + return o.default.wrap(function(t4) { + for (; ; ) + switch (t4.prev = t4.next) { + case 0: + return t4.next = 2, (0, c.usePromise)(h, null); + case 2: + return r2 = t4.sent, s2 = (0, i.default)(r2).length, e3 && e3(s2), t4.abrupt("return", s2); + case 6: + case "end": + return t4.stop(); + } + }, n3, t3); + }))(); + }, removeItem: function(e3, t3) { + var n3 = this; + return (0, s.default)(o.default.mark(function r2() { + return o.default.wrap(function(n4) { + for (; ; ) + switch (n4.prev = n4.next) { + case 0: + return n4.next = 2, (0, c.usePromise)(f, e3); + case 2: + t3 && t3(); + case 3: + case "end": + return n4.stop(); + } + }, r2, n3); + }))(); + }, setItem: function(e3, t3, n3) { + var i2 = this; + return (0, s.default)(o.default.mark(function s2() { + return o.default.wrap(function(i3) { + for (; ; ) + switch (i3.prev = i3.next) { + case 0: + return i3.next = 2, (0, c.usePromise)(p, (0, r.default)({}, e3, t3)); + case 2: + n3 && n3(); + case 3: + case "end": + return i3.stop(); + } + }, s2, i2); + }))(); + }}; + }; + var c = n(492); + function l(e2) { + return e2 && e2.__esModule ? e2 : {default: e2}; + } + }, function(e, t) { + e.exports = function(e2, t2) { + return {enumerable: !(1 & e2), configurable: !(2 & e2), writable: !(4 & e2), value: t2}; + }; + }, function(e, t, n) { + var r = n(84); + e.exports = function(e2) { + return Object(r(e2)); + }; + }, function(e, t, n) { + var r = n(456), i = n(146); + e.exports = Object.keys || function(e2) { + return r(e2, i); + }; + }, function(e, t, n) { + var r = n(86), i = Math.min; + e.exports = function(e2) { + return e2 > 0 ? i(r(e2), 9007199254740991) : 0; + }; + }, function(e, t, n) { + var r = n(19), i = n(13), o = i["__core-js_shared__"] || (i["__core-js_shared__"] = {}); + (e.exports = function(e2, t2) { + return o[e2] || (o[e2] = t2 !== void 0 ? t2 : {}); + })("versions", []).push({version: r.version, mode: n(88) ? "pure" : "global", copyright: "\xA9 2020 Denis Pushkarev (zloirock.ru)"}); + }, function(e, t) { + var n = 0, r = Math.random(); + e.exports = function(e2) { + return "Symbol(".concat(e2 === void 0 ? "" : e2, ")_", (++n + r).toString(36)); + }; + }, function(e, t) { + e.exports = "constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","); + }, function(e, t, n) { + var r = n(88), i = n(30), o = n(469), s = n(31), a = n(42), c = n(470), l = n(90), u = n(473), d = n(17)("iterator"), h = !([].keys && "next" in [].keys()), f = function() { + return this; + }; + e.exports = function(e2, t2, n2, p, g, m, v) { + c(n2, t2, p); + var _, b, y, w = function(e3) { + if (!h && e3 in A) + return A[e3]; + switch (e3) { + case "keys": + case "values": + return function() { + return new n2(this, e3); + }; + } + return function() { + return new n2(this, e3); + }; + }, S = t2 + " Iterator", x = g == "values", E = false, A = e2.prototype, C = A[d] || A["@@iterator"] || g && A[g], j = C || w(g), T = g ? x ? w("entries") : j : void 0, O = t2 == "Array" && A.entries || C; + if (O && (y = u(O.call(new e2()))) !== Object.prototype && y.next && (l(y, S, true), r || typeof y[d] == "function" || s(y, d, f)), x && C && C.name !== "values" && (E = true, j = function() { + return C.call(this); + }), r && !v || !h && !E && A[d] || s(A, d, j), a[t2] = j, a[S] = f, g) + if (_ = {values: x ? j : w("values"), keys: m ? j : w("keys"), entries: T}, v) + for (b in _) + b in A || o(A, b, _[b]); + else + i(i.P + i.F * (h || E), t2, _); + return _; + }; + }, function(e, t, n) { + var r = n(13).document; + e.exports = r && r.documentElement; + }, function(e, t, n) { + var r = n(61), i = n(17)("toStringTag"), o = r(function() { + return arguments; + }()) == "Arguments"; + e.exports = function(e2) { + var t2, n2, s; + return e2 === void 0 ? "Undefined" : e2 === null ? "Null" : typeof (n2 = function(e3, t3) { + try { + return e3[t3]; + } catch (e4) { + } + }(t2 = Object(e2), i)) == "string" ? n2 : o ? r(t2) : (s = r(t2)) == "Object" && typeof t2.callee == "function" ? "Arguments" : s; + }; + }, function(e, t, n) { + var r = n(27), i = n(59), o = n(17)("species"); + e.exports = function(e2, t2) { + var n2, s = r(e2).constructor; + return s === void 0 || (n2 = r(s)[o]) == null ? t2 : i(n2); + }; + }, function(e, t, n) { + var r, i, o, s = n(58), a = n(484), c = n(148), l = n(83), u = n(13), d = u.process, h = u.setImmediate, f = u.clearImmediate, p = u.MessageChannel, g = u.Dispatch, m = 0, v = {}, _ = function() { + var e2 = +this; + if (v.hasOwnProperty(e2)) { + var t2 = v[e2]; + delete v[e2], t2(); + } + }, b = function(e2) { + _.call(e2.data); + }; + h && f || (h = function(e2) { + for (var t2 = [], n2 = 1; arguments.length > n2; ) + t2.push(arguments[n2++]); + return v[++m] = function() { + a(typeof e2 == "function" ? e2 : Function(e2), t2); + }, r(m), m; + }, f = function(e2) { + delete v[e2]; + }, n(61)(d) == "process" ? r = function(e2) { + d.nextTick(s(_, e2, 1)); + } : g && g.now ? r = function(e2) { + g.now(s(_, e2, 1)); + } : p ? (o = (i = new p()).port2, i.port1.onmessage = b, r = s(o.postMessage, o, 1)) : u.addEventListener && typeof postMessage == "function" && !u.importScripts ? (r = function(e2) { + u.postMessage(e2 + "", "*"); + }, u.addEventListener("message", b, false)) : r = "onreadystatechange" in l("script") ? function(e2) { + c.appendChild(l("script")).onreadystatechange = function() { + c.removeChild(this), _.call(e2); + }; + } : function(e2) { + setTimeout(s(_, e2, 1), 0); + }), e.exports = {set: h, clear: f}; + }, function(e, t) { + e.exports = function(e2) { + try { + return {e: false, v: e2()}; + } catch (e3) { + return {e: true, v: e3}; + } + }; + }, function(e, t, n) { + var r = n(27), i = n(41), o = n(91); + e.exports = function(e2, t2) { + if (r(e2), i(t2) && t2.constructor === e2) + return t2; + var n2 = o.f(e2); + return (0, n2.resolve)(t2), n2.promise; + }; + }, function(e, t, n) { + var r = n(15), i = n(0); + i.e.Request = class { + constructor(e2, t2, n2, r2) { + this.id = ++i.e._requestId, this.xmlData = e2, this.data = i.e.serialize(e2), this.origFunc = t2, this.func = t2, this.rid = n2, this.date = NaN, this.sends = r2 || 0, this.abort = false, this.dead = null, this.age = function() { + if (!this.date) + return 0; + return (new Date() - this.date) / 1e3; + }, this.timeDead = function() { + if (!this.dead) + return 0; + return (new Date() - this.dead) / 1e3; + }, this.xhr = this._newXHR(); + } + getResponse() { + let e2 = null; + if (this.xhr.responseXML && this.xhr.responseXML.documentElement) { + if (e2 = this.xhr.responseXML.documentElement, e2.tagName === "parsererror") + throw i.e.error("invalid response received"), i.e.error("responseText: " + this.xhr.responseText), i.e.error("responseXML: " + i.e.serialize(this.xhr.responseXML)), new Error("parsererror"); + } else if (this.xhr.responseText) { + if (i.e.debug("Got responseText but no responseXML; attempting to parse it with DOMParser..."), e2 = new r.a().parseFromString(this.xhr.responseText, "application/xml").documentElement, !e2) + throw new Error("Parsing produced null node"); + if (e2.querySelector("parsererror")) { + i.e.error("invalid response received: " + e2.querySelector("parsererror").textContent), i.e.error("responseText: " + this.xhr.responseText); + const t2 = new Error(); + throw t2.name = i.e.ErrorCondition.BAD_FORMAT, t2; + } + } + return e2; + } + _newXHR() { + let e2 = null; + return window.XMLHttpRequest ? (e2 = new XMLHttpRequest(), e2.overrideMimeType && e2.overrideMimeType("text/xml; charset=utf-8")) : window.ActiveXObject && (e2 = new ActiveXObject("Microsoft.XMLHTTP")), e2.onreadystatechange = this.func.bind(null, this), e2; + } + }, i.e.Bosh = class e2 { + constructor(e3) { + this._conn = e3, this.rid = Math.floor(4294967295 * Math.random()), this.sid = null, this.hold = 1, this.wait = 60, this.window = 5, this.errors = 0, this.inactivity = null, this.lastResponseHeaders = null, this._requests = []; + } + _buildBody() { + const e3 = Object(i.a)("body", {rid: this.rid++, xmlns: i.e.NS.HTTPBIND}); + return this.sid !== null && e3.attrs({sid: this.sid}), this._conn.options.keepalive && this._conn._sessionCachingSupported() && this._cacheSession(), e3; + } + _reset() { + this.rid = Math.floor(4294967295 * Math.random()), this.sid = null, this.errors = 0, this._conn._sessionCachingSupported() && window.sessionStorage.removeItem("strophe-bosh-session"), this._conn.nextValidRid(this.rid); + } + _connect(e3, t2, n2) { + this.wait = e3 || this.wait, this.hold = t2 || this.hold, this.errors = 0; + const r2 = this._buildBody().attrs({to: this._conn.domain, "xml:lang": "en", wait: this.wait, hold: this.hold, content: "text/xml; charset=utf-8", ver: "1.6", "xmpp:version": "1.0", "xmlns:xmpp": i.e.NS.BOSH}); + n2 && r2.attrs({route: n2}); + const o = this._conn._connect_cb; + this._requests.push(new i.e.Request(r2.tree(), this._onRequestStateChange.bind(this, o.bind(this._conn)), r2.tree().getAttribute("rid"))), this._throttledRequestHandler(); + } + _attach(e3, t2, n2, r2, o, s, a) { + this._conn.jid = e3, this.sid = t2, this.rid = n2, this._conn.connect_callback = r2, this._conn.domain = i.e.getDomainFromJid(this._conn.jid), this._conn.authenticated = true, this._conn.connected = true, this.wait = o || this.wait, this.hold = s || this.hold, this.window = a || this.window, this._conn._changeConnectStatus(i.e.Status.ATTACHED, null); + } + _restore(e3, t2, n2, r2, o) { + const s = JSON.parse(window.sessionStorage.getItem("strophe-bosh-session")); + if (!(s != null && s.rid && s.sid && s.jid && (e3 == null || i.e.getBareJidFromJid(s.jid) === i.e.getBareJidFromJid(e3) || i.e.getNodeFromJid(e3) === null && i.e.getDomainFromJid(s.jid) === e3))) { + const e4 = new Error("_restore: no restoreable session."); + throw e4.name = "StropheSessionError", e4; + } + this._conn.restored = true, this._attach(s.jid, s.sid, s.rid, t2, n2, r2, o); + } + _cacheSession() { + this._conn.authenticated ? this._conn.jid && this.rid && this.sid && window.sessionStorage.setItem("strophe-bosh-session", JSON.stringify({jid: this._conn.jid, rid: this.rid, sid: this.sid})) : window.sessionStorage.removeItem("strophe-bosh-session"); + } + _connect_cb(e3) { + const t2 = e3.getAttribute("type"); + if (t2 !== null && t2 === "terminate") { + let t3 = e3.getAttribute("condition"); + i.e.error("BOSH-Connection failed: " + t3); + const n3 = e3.getElementsByTagName("conflict"); + return t3 !== null ? (t3 === "remote-stream-error" && n3.length > 0 && (t3 = "conflict"), this._conn._changeConnectStatus(i.e.Status.CONNFAIL, t3)) : this._conn._changeConnectStatus(i.e.Status.CONNFAIL, "unknown"), this._conn._doDisconnect(t3), i.e.Status.CONNFAIL; + } + this.sid || (this.sid = e3.getAttribute("sid")); + const n2 = e3.getAttribute("requests"); + n2 && (this.window = parseInt(n2, 10)); + const r2 = e3.getAttribute("hold"); + r2 && (this.hold = parseInt(r2, 10)); + const o = e3.getAttribute("wait"); + o && (this.wait = parseInt(o, 10)); + const s = e3.getAttribute("inactivity"); + s && (this.inactivity = parseInt(s, 10)); + } + _disconnect(e3) { + this._sendTerminate(e3); + } + _doDisconnect() { + this.sid = null, this.rid = Math.floor(4294967295 * Math.random()), this._conn._sessionCachingSupported() && window.sessionStorage.removeItem("strophe-bosh-session"), this._conn.nextValidRid(this.rid); + } + _emptyQueue() { + return this._requests.length === 0; + } + _callProtocolErrorHandlers(t2) { + const n2 = e2._getRequestStatus(t2), r2 = this._conn.protocolErrorHandlers.HTTP[n2]; + r2 && r2.call(this, n2); + } + _hitError(e3) { + this.errors++, i.e.warn("request errored, status: " + e3 + ", number of errors: " + this.errors), this.errors > 4 && this._conn._onDisconnectTimeout(); + } + _no_auth_received(e3) { + i.e.warn("Server did not yet offer a supported authentication mechanism. Sending a blank poll request."), e3 = e3 ? e3.bind(this._conn) : this._conn._connect_cb.bind(this._conn); + const t2 = this._buildBody(); + this._requests.push(new i.e.Request(t2.tree(), this._onRequestStateChange.bind(this, e3), t2.tree().getAttribute("rid"))), this._throttledRequestHandler(); + } + _onDisconnectTimeout() { + this._abortAllRequests(); + } + _abortAllRequests() { + for (; this._requests.length > 0; ) { + const e3 = this._requests.pop(); + e3.abort = true, e3.xhr.abort(), e3.xhr.onreadystatechange = function() { + }; + } + } + _onIdle() { + const e3 = this._conn._data; + if (this._conn.authenticated && this._requests.length === 0 && e3.length === 0 && !this._conn.disconnecting && (i.e.debug("no requests during idle cycle, sending blank request"), e3.push(null)), !this._conn.paused) { + if (this._requests.length < 2 && e3.length > 0) { + const t2 = this._buildBody(); + for (let n2 = 0; n2 < e3.length; n2++) + e3[n2] !== null && (e3[n2] === "restart" ? t2.attrs({to: this._conn.domain, "xml:lang": "en", "xmpp:restart": "true", "xmlns:xmpp": i.e.NS.BOSH}) : t2.cnode(e3[n2]).up()); + delete this._conn._data, this._conn._data = [], this._requests.push(new i.e.Request(t2.tree(), this._onRequestStateChange.bind(this, this._conn._dataRecv.bind(this._conn)), t2.tree().getAttribute("rid"))), this._throttledRequestHandler(); + } + if (this._requests.length > 0) { + const e4 = this._requests[0].age(); + this._requests[0].dead !== null && this._requests[0].timeDead() > Math.floor(i.e.SECONDARY_TIMEOUT * this.wait) && this._throttledRequestHandler(), e4 > Math.floor(i.e.TIMEOUT * this.wait) && (i.e.warn("Request " + this._requests[0].id + " timed out, over " + Math.floor(i.e.TIMEOUT * this.wait) + " seconds since last activity"), this._throttledRequestHandler()); + } + } + } + static _getRequestStatus(e3, t2) { + let n2; + if (e3.xhr.readyState === 4) + try { + n2 = e3.xhr.status; + } catch (e4) { + i.e.error("Caught an error while retrieving a request's status, reqStatus: " + n2); + } + return n2 === void 0 && (n2 = typeof t2 == "number" ? t2 : 0), n2; + } + _onRequestStateChange(t2, n2) { + if (i.e.debug("request id " + n2.id + "." + n2.sends + " state changed to " + n2.xhr.readyState), n2.abort) + return void (n2.abort = false); + if (n2.xhr.readyState !== 4) + return; + const r2 = e2._getRequestStatus(n2); + if (this.lastResponseHeaders = n2.xhr.getAllResponseHeaders(), this._conn.disconnecting && r2 >= 400) + return this._hitError(r2), void this._callProtocolErrorHandlers(n2); + const o = r2 > 0 && r2 < 500, s = n2.sends > this._conn.maxRetries; + if ((o || s) && (this._removeRequest(n2), i.e.debug("request id " + n2.id + " should now be removed")), r2 === 200) { + const e3 = this._requests[0] === n2; + (this._requests[1] === n2 || e3 && this._requests.length > 0 && this._requests[0].age() > Math.floor(i.e.SECONDARY_TIMEOUT * this.wait)) && this._restartRequest(0), this._conn.nextValidRid(Number(n2.rid) + 1), i.e.debug("request id " + n2.id + "." + n2.sends + " got 200"), t2(n2), this.errors = 0; + } else + r2 === 0 || r2 >= 400 && r2 < 600 || r2 >= 12e3 ? (i.e.error("request id " + n2.id + "." + n2.sends + " error " + r2 + " happened"), this._hitError(r2), this._callProtocolErrorHandlers(n2), r2 >= 400 && r2 < 500 && (this._conn._changeConnectStatus(i.e.Status.DISCONNECTING, null), this._conn._doDisconnect())) : i.e.error("request id " + n2.id + "." + n2.sends + " error " + r2 + " happened"); + o || s ? s && !this._conn.connected && this._conn._changeConnectStatus(i.e.Status.CONNFAIL, "giving-up") : this._throttledRequestHandler(); + } + _processRequest(t2) { + let n2 = this._requests[t2]; + const r2 = e2._getRequestStatus(n2, -1); + if (n2.sends > this._conn.maxRetries) + return void this._conn._onDisconnectTimeout(); + const o = n2.age(), s = !isNaN(o) && o > Math.floor(i.e.TIMEOUT * this.wait), a = n2.dead !== null && n2.timeDead() > Math.floor(i.e.SECONDARY_TIMEOUT * this.wait), c = n2.xhr.readyState === 4 && (r2 < 1 || r2 >= 500); + if ((s || a || c) && (a && i.e.error("Request ".concat(this._requests[t2].id, " timed out (secondary), restarting")), n2.abort = true, n2.xhr.abort(), n2.xhr.onreadystatechange = function() { + }, this._requests[t2] = new i.e.Request(n2.xmlData, n2.origFunc, n2.rid, n2.sends), n2 = this._requests[t2]), n2.xhr.readyState === 0) { + i.e.debug("request id " + n2.id + "." + n2.sends + " posting"); + try { + const e4 = this._conn.options.contentType || "text/xml; charset=utf-8"; + n2.xhr.open("POST", this._conn.service, !this._conn.options.sync), n2.xhr.setRequestHeader !== void 0 && n2.xhr.setRequestHeader("Content-Type", e4), this._conn.options.withCredentials && (n2.xhr.withCredentials = true); + } catch (e4) { + return i.e.error("XHR open failed: " + e4.toString()), this._conn.connected || this._conn._changeConnectStatus(i.e.Status.CONNFAIL, "bad-service"), void this._conn.disconnect(); + } + const e3 = () => { + if (n2.date = new Date(), this._conn.options.customHeaders) { + const e4 = this._conn.options.customHeaders; + for (const t3 in e4) + Object.prototype.hasOwnProperty.call(e4, t3) && n2.xhr.setRequestHeader(t3, e4[t3]); + } + n2.xhr.send(n2.data); + }; + if (n2.sends > 1) { + const t3 = 1e3 * Math.min(Math.floor(i.e.TIMEOUT * this.wait), Math.pow(n2.sends, 3)); + setTimeout(function() { + e3(); + }, t3); + } else + e3(); + n2.sends++, this._conn.xmlOutput !== i.e.Connection.prototype.xmlOutput && (n2.xmlData.nodeName === this.strip && n2.xmlData.childNodes.length ? this._conn.xmlOutput(n2.xmlData.childNodes[0]) : this._conn.xmlOutput(n2.xmlData)), this._conn.rawOutput !== i.e.Connection.prototype.rawOutput && this._conn.rawOutput(n2.data); + } else + i.e.debug("_processRequest: " + (t2 === 0 ? "first" : "second") + " request has readyState of " + n2.xhr.readyState); + } + _removeRequest(e3) { + i.e.debug("removing request"); + for (let t2 = this._requests.length - 1; t2 >= 0; t2--) + e3 === this._requests[t2] && this._requests.splice(t2, 1); + e3.xhr.onreadystatechange = function() { + }, this._throttledRequestHandler(); + } + _restartRequest(e3) { + const t2 = this._requests[e3]; + t2.dead === null && (t2.dead = new Date()), this._processRequest(e3); + } + _reqToData(e3) { + try { + return e3.getResponse(); + } catch (e4) { + if (e4.message !== "parsererror") + throw e4; + this._conn.disconnect("strophe-parsererror"); + } + } + _sendTerminate(e3) { + i.e.debug("_sendTerminate was called"); + const t2 = this._buildBody().attrs({type: "terminate"}); + e3 && t2.cnode(e3.tree()); + const n2 = new i.e.Request(t2.tree(), this._onRequestStateChange.bind(this, this._conn._dataRecv.bind(this._conn)), t2.tree().getAttribute("rid")); + this._requests.push(n2), this._throttledRequestHandler(); + } + _send() { + clearTimeout(this._conn._idleTimeout), this._throttledRequestHandler(), this._conn._idleTimeout = setTimeout(() => this._conn._onIdle(), 100); + } + _sendRestart() { + this._throttledRequestHandler(), clearTimeout(this._conn._idleTimeout); + } + _throttledRequestHandler() { + this._requests ? i.e.debug("_throttledRequestHandler called with " + this._requests.length + " requests") : i.e.debug("_throttledRequestHandler called with undefined requests"), this._requests && this._requests.length !== 0 && (this._requests.length > 0 && this._processRequest(0), this._requests.length > 1 && Math.abs(this._requests[0].rid - this._requests[1].rid) < this.window && this._processRequest(1)); + } + }, i.e.Bosh.prototype.strip = null; + }, function(e, t, n) { + (function(e2, r) { + var i; + /*! https://mths.be/punycode v1.4.0 by @mathias */ + !function(o) { + t && t.nodeType, e2 && e2.nodeType; + var s = typeof r == "object" && r; + s.global !== s && s.window !== s && s.self; + var a, c = 2147483647, l = /^xn--/, u = /[^\x20-\x7E]/, d = /[\x2E\u3002\uFF0E\uFF61]/g, h = {overflow: "Overflow: input needs wider integers to process", "not-basic": "Illegal input >= 0x80 (not a basic code point)", "invalid-input": "Invalid input"}, f = Math.floor, p = String.fromCharCode; + function g(e3) { + throw new RangeError(h[e3]); + } + function m(e3, t2) { + for (var n2 = e3.length, r2 = []; n2--; ) + r2[n2] = t2(e3[n2]); + return r2; + } + function v(e3, t2) { + var n2 = e3.split("@"), r2 = ""; + return n2.length > 1 && (r2 = n2[0] + "@", e3 = n2[1]), r2 + m((e3 = e3.replace(d, ".")).split("."), t2).join("."); + } + function _(e3) { + for (var t2, n2, r2 = [], i2 = 0, o2 = e3.length; i2 < o2; ) + (t2 = e3.charCodeAt(i2++)) >= 55296 && t2 <= 56319 && i2 < o2 ? (64512 & (n2 = e3.charCodeAt(i2++))) == 56320 ? r2.push(((1023 & t2) << 10) + (1023 & n2) + 65536) : (r2.push(t2), i2--) : r2.push(t2); + return r2; + } + function b(e3) { + return m(e3, function(e4) { + var t2 = ""; + return e4 > 65535 && (t2 += p((e4 -= 65536) >>> 10 & 1023 | 55296), e4 = 56320 | 1023 & e4), t2 += p(e4); + }).join(""); + } + function y(e3, t2) { + return e3 + 22 + 75 * (e3 < 26) - ((t2 != 0) << 5); + } + function w(e3, t2, n2) { + var r2 = 0; + for (e3 = n2 ? f(e3 / 700) : e3 >> 1, e3 += f(e3 / t2); e3 > 455; r2 += 36) + e3 = f(e3 / 35); + return f(r2 + 36 * e3 / (e3 + 38)); + } + function S(e3) { + var t2, n2, r2, i2, o2, s2, a2, l2, u2, d2, h2, p2 = [], m2 = e3.length, v2 = 0, _2 = 128, y2 = 72; + for ((n2 = e3.lastIndexOf("-")) < 0 && (n2 = 0), r2 = 0; r2 < n2; ++r2) + e3.charCodeAt(r2) >= 128 && g("not-basic"), p2.push(e3.charCodeAt(r2)); + for (i2 = n2 > 0 ? n2 + 1 : 0; i2 < m2; ) { + for (o2 = v2, s2 = 1, a2 = 36; i2 >= m2 && g("invalid-input"), ((l2 = (h2 = e3.charCodeAt(i2++)) - 48 < 10 ? h2 - 22 : h2 - 65 < 26 ? h2 - 65 : h2 - 97 < 26 ? h2 - 97 : 36) >= 36 || l2 > f((c - v2) / s2)) && g("overflow"), v2 += l2 * s2, !(l2 < (u2 = a2 <= y2 ? 1 : a2 >= y2 + 26 ? 26 : a2 - y2)); a2 += 36) + s2 > f(c / (d2 = 36 - u2)) && g("overflow"), s2 *= d2; + y2 = w(v2 - o2, t2 = p2.length + 1, o2 == 0), f(v2 / t2) > c - _2 && g("overflow"), _2 += f(v2 / t2), v2 %= t2, p2.splice(v2++, 0, _2); + } + return b(p2); + } + function x(e3) { + var t2, n2, r2, i2, o2, s2, a2, l2, u2, d2, h2, m2, v2, b2, S2, x2 = []; + for (m2 = (e3 = _(e3)).length, t2 = 128, n2 = 0, o2 = 72, s2 = 0; s2 < m2; ++s2) + (h2 = e3[s2]) < 128 && x2.push(p(h2)); + for (r2 = i2 = x2.length, i2 && x2.push("-"); r2 < m2; ) { + for (a2 = c, s2 = 0; s2 < m2; ++s2) + (h2 = e3[s2]) >= t2 && h2 < a2 && (a2 = h2); + for (a2 - t2 > f((c - n2) / (v2 = r2 + 1)) && g("overflow"), n2 += (a2 - t2) * v2, t2 = a2, s2 = 0; s2 < m2; ++s2) + if ((h2 = e3[s2]) < t2 && ++n2 > c && g("overflow"), h2 == t2) { + for (l2 = n2, u2 = 36; !(l2 < (d2 = u2 <= o2 ? 1 : u2 >= o2 + 26 ? 26 : u2 - o2)); u2 += 36) + S2 = l2 - d2, b2 = 36 - d2, x2.push(p(y(d2 + S2 % b2, 0))), l2 = f(S2 / b2); + x2.push(p(y(l2, 0))), o2 = w(n2, v2, r2 == i2), n2 = 0, ++r2; + } + ++n2, ++t2; + } + return x2.join(""); + } + a = {version: "1.3.2", ucs2: {decode: _, encode: b}, decode: S, encode: x, toASCII: function(e3) { + return v(e3, function(e4) { + return u.test(e4) ? "xn--" + x(e4) : e4; + }); + }, toUnicode: function(e3) { + return v(e3, function(e4) { + return l.test(e4) ? S(e4.slice(4).toLowerCase()) : e4; + }); + }}, (i = function() { + return a; + }.call(t, n, t, e2)) === void 0 || (e2.exports = i); + }(); + }).call(this, n(46)(e), n(12)); + }, function(e, t, n) { + var r, i; + /*! + * URI.js - Mutating URLs + * IPv6 Support + * + * Version: 1.19.2 + * + * Author: Rodney Rehm + * Web: http://medialize.github.io/URI.js/ + * + * Licensed under + * MIT License http://www.opensource.org/licenses/mit-license + * + */ + !function(o, s) { + e.exports ? e.exports = s() : (i = typeof (r = s) == "function" ? r.call(t, n, t, e) : r) === void 0 || (e.exports = i); + }(0, function(e2) { + var t2 = e2 && e2.IPv6; + return {best: function(e3) { + var t3, n2, r2 = e3.toLowerCase().split(":"), i2 = r2.length, o = 8; + for (r2[0] === "" && r2[1] === "" && r2[2] === "" ? (r2.shift(), r2.shift()) : r2[0] === "" && r2[1] === "" ? r2.shift() : r2[i2 - 1] === "" && r2[i2 - 2] === "" && r2.pop(), r2[(i2 = r2.length) - 1].indexOf(".") !== -1 && (o = 7), t3 = 0; t3 < i2 && r2[t3] !== ""; t3++) + ; + if (t3 < o) + for (r2.splice(t3, 1, "0000"); r2.length < o; ) + r2.splice(t3, 0, "0000"); + for (var s = 0; s < o; s++) { + n2 = r2[s].split(""); + for (var a = 0; a < 3 && (n2[0] === "0" && n2.length > 1); a++) + n2.splice(0, 1); + r2[s] = n2.join(""); + } + var c = -1, l = 0, u = 0, d = -1, h = false; + for (s = 0; s < o; s++) + h ? r2[s] === "0" ? u += 1 : (h = false, u > l && (c = d, l = u)) : r2[s] === "0" && (h = true, d = s, u = 1); + u > l && (c = d, l = u), l > 1 && r2.splice(c, l, ""), i2 = r2.length; + var f = ""; + for (r2[0] === "" && (f = ":"), s = 0; s < i2 && (f += r2[s], s !== i2 - 1); s++) + f += ":"; + return r2[i2 - 1] === "" && (f += ":"), f; + }, noConflict: function() { + return e2.IPv6 === this && (e2.IPv6 = t2), this; + }}; + }); + }, function(e, t, n) { + var r, i; + /*! + * URI.js - Mutating URLs + * Second Level Domain (SLD) Support + * + * Version: 1.19.2 + * + * Author: Rodney Rehm + * Web: http://medialize.github.io/URI.js/ + * + * Licensed under + * MIT License http://www.opensource.org/licenses/mit-license + * + */ + !function(o, s) { + e.exports ? e.exports = s() : (i = typeof (r = s) == "function" ? r.call(t, n, t, e) : r) === void 0 || (e.exports = i); + }(0, function(e2) { + var t2 = e2 && e2.SecondLevelDomains, n2 = {list: {ac: " com gov mil net org ", ae: " ac co gov mil name net org pro sch ", af: " com edu gov net org ", al: " com edu gov mil net org ", ao: " co ed gv it og pb ", ar: " com edu gob gov int mil net org tur ", at: " ac co gv or ", au: " asn com csiro edu gov id net org ", ba: " co com edu gov mil net org rs unbi unmo unsa untz unze ", bb: " biz co com edu gov info net org store tv ", bh: " biz cc com edu gov info net org ", bn: " com edu gov net org ", bo: " com edu gob gov int mil net org tv ", br: " adm adv agr am arq art ato b bio blog bmd cim cng cnt com coop ecn edu eng esp etc eti far flog fm fnd fot fst g12 ggf gov imb ind inf jor jus lel mat med mil mus net nom not ntr odo org ppg pro psc psi qsl rec slg srv tmp trd tur tv vet vlog wiki zlg ", bs: " com edu gov net org ", bz: " du et om ov rg ", ca: " ab bc mb nb nf nl ns nt nu on pe qc sk yk ", ck: " biz co edu gen gov info net org ", cn: " ac ah bj com cq edu fj gd gov gs gx gz ha hb he hi hl hn jl js jx ln mil net nm nx org qh sc sd sh sn sx tj tw xj xz yn zj ", co: " com edu gov mil net nom org ", cr: " ac c co ed fi go or sa ", cy: " ac biz com ekloges gov ltd name net org parliament press pro tm ", do: " art com edu gob gov mil net org sld web ", dz: " art asso com edu gov net org pol ", ec: " com edu fin gov info med mil net org pro ", eg: " com edu eun gov mil name net org sci ", er: " com edu gov ind mil net org rochest w ", es: " com edu gob nom org ", et: " biz com edu gov info name net org ", fj: " ac biz com info mil name net org pro ", fk: " ac co gov net nom org ", fr: " asso com f gouv nom prd presse tm ", gg: " co net org ", gh: " com edu gov mil org ", gn: " ac com gov net org ", gr: " com edu gov mil net org ", gt: " com edu gob ind mil net org ", gu: " com edu gov net org ", hk: " com edu gov idv net org ", hu: " 2000 agrar bolt casino city co erotica erotika film forum games hotel info ingatlan jogasz konyvelo lakas media news org priv reklam sex shop sport suli szex tm tozsde utazas video ", id: " ac co go mil net or sch web ", il: " ac co gov idf k12 muni net org ", in: " ac co edu ernet firm gen gov i ind mil net nic org res ", iq: " com edu gov i mil net org ", ir: " ac co dnssec gov i id net org sch ", it: " edu gov ", je: " co net org ", jo: " com edu gov mil name net org sch ", jp: " ac ad co ed go gr lg ne or ", ke: " ac co go info me mobi ne or sc ", kh: " com edu gov mil net org per ", ki: " biz com de edu gov info mob net org tel ", km: " asso com coop edu gouv k medecin mil nom notaires pharmaciens presse tm veterinaire ", kn: " edu gov net org ", kr: " ac busan chungbuk chungnam co daegu daejeon es gangwon go gwangju gyeongbuk gyeonggi gyeongnam hs incheon jeju jeonbuk jeonnam k kg mil ms ne or pe re sc seoul ulsan ", kw: " com edu gov net org ", ky: " com edu gov net org ", kz: " com edu gov mil net org ", lb: " com edu gov net org ", lk: " assn com edu gov grp hotel int ltd net ngo org sch soc web ", lr: " com edu gov net org ", lv: " asn com conf edu gov id mil net org ", ly: " com edu gov id med net org plc sch ", ma: " ac co gov m net org press ", mc: " asso tm ", me: " ac co edu gov its net org priv ", mg: " com edu gov mil nom org prd tm ", mk: " com edu gov inf name net org pro ", ml: " com edu gov net org presse ", mn: " edu gov org ", mo: " com edu gov net org ", mt: " com edu gov net org ", mv: " aero biz com coop edu gov info int mil museum name net org pro ", mw: " ac co com coop edu gov int museum net org ", mx: " com edu gob net org ", my: " com edu gov mil name net org sch ", nf: " arts com firm info net other per rec store web ", ng: " biz com edu gov mil mobi name net org sch ", ni: " ac co com edu gob mil net nom org ", np: " com edu gov mil net org ", nr: " biz com edu gov info net org ", om: " ac biz co com edu gov med mil museum net org pro sch ", pe: " com edu gob mil net nom org sld ", ph: " com edu gov i mil net ngo org ", pk: " biz com edu fam gob gok gon gop gos gov net org web ", pl: " art bialystok biz com edu gda gdansk gorzow gov info katowice krakow lodz lublin mil net ngo olsztyn org poznan pwr radom slupsk szczecin torun warszawa waw wroc wroclaw zgora ", pr: " ac biz com edu est gov info isla name net org pro prof ", ps: " com edu gov net org plo sec ", pw: " belau co ed go ne or ", ro: " arts com firm info nom nt org rec store tm www ", rs: " ac co edu gov in org ", sb: " com edu gov net org ", sc: " com edu gov net org ", sh: " co com edu gov net nom org ", sl: " com edu gov net org ", st: " co com consulado edu embaixada gov mil net org principe saotome store ", sv: " com edu gob org red ", sz: " ac co org ", tr: " av bbs bel biz com dr edu gen gov info k12 name net org pol tel tsk tv web ", tt: " aero biz cat co com coop edu gov info int jobs mil mobi museum name net org pro tel travel ", tw: " club com ebiz edu game gov idv mil net org ", mu: " ac co com gov net or org ", mz: " ac co edu gov org ", na: " co com ", nz: " ac co cri geek gen govt health iwi maori mil net org parliament school ", pa: " abo ac com edu gob ing med net nom org sld ", pt: " com edu gov int net nome org publ ", py: " com edu gov mil net org ", qa: " com edu gov mil net org ", re: " asso com nom ", ru: " ac adygeya altai amur arkhangelsk astrakhan bashkiria belgorod bir bryansk buryatia cbg chel chelyabinsk chita chukotka chuvashia com dagestan e-burg edu gov grozny int irkutsk ivanovo izhevsk jar joshkar-ola kalmykia kaluga kamchatka karelia kazan kchr kemerovo khabarovsk khakassia khv kirov koenig komi kostroma kranoyarsk kuban kurgan kursk lipetsk magadan mari mari-el marine mil mordovia mosreg msk murmansk nalchik net nnov nov novosibirsk nsk omsk orenburg org oryol penza perm pp pskov ptz rnd ryazan sakhalin samara saratov simbirsk smolensk spb stavropol stv surgut tambov tatarstan tom tomsk tsaritsyn tsk tula tuva tver tyumen udm udmurtia ulan-ude vladikavkaz vladimir vladivostok volgograd vologda voronezh vrn vyatka yakutia yamal yekaterinburg yuzhno-sakhalinsk ", rw: " ac co com edu gouv gov int mil net ", sa: " com edu gov med net org pub sch ", sd: " com edu gov info med net org tv ", se: " a ac b bd c d e f g h i k l m n o org p parti pp press r s t tm u w x y z ", sg: " com edu gov idn net org per ", sn: " art com edu gouv org perso univ ", sy: " com edu gov mil net news org ", th: " ac co go in mi net or ", tj: " ac biz co com edu go gov info int mil name net nic org test web ", tn: " agrinet com defense edunet ens fin gov ind info intl mincom nat net org perso rnrt rns rnu tourism ", tz: " ac co go ne or ", ua: " biz cherkassy chernigov chernovtsy ck cn co com crimea cv dn dnepropetrovsk donetsk dp edu gov if in ivano-frankivsk kh kharkov kherson khmelnitskiy kiev kirovograd km kr ks kv lg lugansk lutsk lviv me mk net nikolaev od odessa org pl poltava pp rovno rv sebastopol sumy te ternopil uzhgorod vinnica vn zaporizhzhe zhitomir zp zt ", ug: " ac co go ne or org sc ", uk: " ac bl british-library co cym gov govt icnet jet lea ltd me mil mod national-library-scotland nel net nhs nic nls org orgn parliament plc police sch scot soc ", us: " dni fed isa kids nsn ", uy: " com edu gub mil net org ", ve: " co com edu gob info mil net org web ", vi: " co com k12 net org ", vn: " ac biz com edu gov health info int name net org pro ", ye: " co com gov ltd me net org plc ", yu: " ac co edu gov org ", za: " ac agric alt bourse city co cybernet db edu gov grondar iaccess imt inca landesign law mil net ngo nis nom olivetti org pix school tm web ", zm: " ac co com edu gov net org sch ", com: "ar br cn de eu gb gr hu jpn kr no qc ru sa se uk us uy za ", net: "gb jp se uk ", org: "ae", de: "com "}, has: function(e3) { + var t3 = e3.lastIndexOf("."); + if (t3 <= 0 || t3 >= e3.length - 1) + return false; + var r2 = e3.lastIndexOf(".", t3 - 1); + if (r2 <= 0 || r2 >= t3 - 1) + return false; + var i2 = n2.list[e3.slice(t3 + 1)]; + return !!i2 && i2.indexOf(" " + e3.slice(r2 + 1, t3) + " ") >= 0; + }, is: function(e3) { + var t3 = e3.lastIndexOf("."); + if (t3 <= 0 || t3 >= e3.length - 1) + return false; + if (e3.lastIndexOf(".", t3 - 1) >= 0) + return false; + var r2 = n2.list[e3.slice(t3 + 1)]; + return !!r2 && r2.indexOf(" " + e3.slice(0, t3) + " ") >= 0; + }, get: function(e3) { + var t3 = e3.lastIndexOf("."); + if (t3 <= 0 || t3 >= e3.length - 1) + return null; + var r2 = e3.lastIndexOf(".", t3 - 1); + if (r2 <= 0 || r2 >= t3 - 1) + return null; + var i2 = n2.list[e3.slice(t3 + 1)]; + return i2 ? i2.indexOf(" " + e3.slice(r2 + 1, t3) + " ") < 0 ? null : e3.slice(r2 + 1) : null; + }, noConflict: function() { + return e2.SecondLevelDomains === this && (e2.SecondLevelDomains = t2), this; + }}; + return n2; + }); + }, function(e, t, n) { + var r = n(9), i = n(2); + i.d.Websocket = class { + constructor(e2) { + this._conn = e2, this.strip = "wrapper"; + const t2 = e2.service; + if (t2.indexOf("ws:") !== 0 && t2.indexOf("wss:") !== 0) { + let n2 = ""; + e2.options.protocol === "ws" && window.location.protocol !== "https:" ? n2 += "ws" : n2 += "wss", n2 += "://" + window.location.host, t2.indexOf("/") !== 0 ? n2 += window.location.pathname + t2 : n2 += t2, e2.service = n2; + } + } + _buildStream() { + return Object(i.a)("open", {xmlns: i.d.NS.FRAMING, to: this._conn.domain, version: "1.0"}); + } + _checkStreamError(e2, t2) { + let n2; + if (n2 = e2.getElementsByTagNameNS ? e2.getElementsByTagNameNS(i.d.NS.STREAM, "error") : e2.getElementsByTagName("stream:error"), n2.length === 0) + return false; + const r2 = n2[0]; + let o = "", s = ""; + for (let e3 = 0; e3 < r2.childNodes.length; e3++) { + const t3 = r2.childNodes[e3]; + if (t3.getAttribute("xmlns") !== "urn:ietf:params:xml:ns:xmpp-streams") + break; + t3.nodeName === "text" ? s = t3.textContent : o = t3.nodeName; + } + let a = "WebSocket stream error: "; + return a += o || "unknown", s && (a += " - " + s), i.d.error(a), this._conn._changeConnectStatus(t2, o), this._conn._doDisconnect(), true; + } + _reset() { + } + _connect() { + this._closeSocket(), this.socket = new r.b(this._conn.service, "xmpp"), this.socket.onopen = () => this._onOpen(), this.socket.onerror = (e2) => this._onError(e2), this.socket.onclose = (e2) => this._onClose(e2), this.socket.onmessage = (e2) => this._onInitialMessage(e2); + } + _connect_cb(e2) { + if (this._checkStreamError(e2, i.d.Status.CONNFAIL)) + return i.d.Status.CONNFAIL; + } + _handleStreamStart(e2) { + let t2 = false; + const n2 = e2.getAttribute("xmlns"); + typeof n2 != "string" ? t2 = "Missing xmlns in <open />" : n2 !== i.d.NS.FRAMING && (t2 = "Wrong xmlns in <open />: " + n2); + const r2 = e2.getAttribute("version"); + return typeof r2 != "string" ? t2 = "Missing version in <open />" : r2 !== "1.0" && (t2 = "Wrong version in <open />: " + r2), !t2 || (this._conn._changeConnectStatus(i.d.Status.CONNFAIL, t2), this._conn._doDisconnect(), false); + } + _onInitialMessage(e2) { + if (e2.data.indexOf("<open ") === 0 || e2.data.indexOf("<?xml") === 0) { + const t2 = e2.data.replace(/^(<\?.*?\?>\s*)*/, ""); + if (t2 === "") + return; + const n2 = new r.a().parseFromString(t2, "text/xml").documentElement; + this._conn.xmlInput(n2), this._conn.rawInput(e2.data), this._handleStreamStart(n2) && this._connect_cb(n2); + } else if (e2.data.indexOf("<close ") === 0) { + const t2 = new r.a().parseFromString(e2.data, "text/xml").documentElement; + this._conn.xmlInput(t2), this._conn.rawInput(e2.data); + const n2 = t2.getAttribute("see-other-uri"); + if (n2) { + const e3 = this._conn.service; + (e3.indexOf("wss:") >= 0 && n2.indexOf("wss:") >= 0 || e3.indexOf("ws:") >= 0) && (this._conn._changeConnectStatus(i.d.Status.REDIRECT, "Received see-other-uri, resetting connection"), this._conn.reset(), this._conn.service = n2, this._connect()); + } else + this._conn._changeConnectStatus(i.d.Status.CONNFAIL, "Received closing stream"), this._conn._doDisconnect(); + } else { + this._replaceMessageHandler(); + const t2 = this._streamWrap(e2.data), n2 = new r.a().parseFromString(t2, "text/xml").documentElement; + this._conn._connect_cb(n2, null, e2.data); + } + } + _replaceMessageHandler() { + this.socket.onmessage = (e2) => this._onMessage(e2); + } + _disconnect(e2) { + if (this.socket && this.socket.readyState !== r.b.CLOSED) { + e2 && this._conn.send(e2); + const t2 = Object(i.a)("close", {xmlns: i.d.NS.FRAMING}); + this._conn.xmlOutput(t2.tree()); + const n2 = i.d.serialize(t2); + this._conn.rawOutput(n2); + try { + this.socket.send(n2); + } catch (e3) { + i.d.warn("Couldn't send <close /> tag."); + } + } + setTimeout(() => this._conn._doDisconnect, 0); + } + _doDisconnect() { + i.d.debug("WebSockets _doDisconnect was called"), this._closeSocket(); + } + _streamWrap(e2) { + return "<wrapper>" + e2 + "</wrapper>"; + } + _closeSocket() { + if (this.socket) + try { + this.socket.onclose = null, this.socket.onerror = null, this.socket.onmessage = null, this.socket.close(); + } catch (e2) { + i.d.debug(e2.message); + } + this.socket = null; + } + _emptyQueue() { + return true; + } + _onClose(e2) { + this._conn.connected && !this._conn.disconnecting ? (i.d.error("Websocket closed unexpectedly"), this._conn._doDisconnect()) : e2 && e2.code === 1006 && !this._conn.connected && this.socket ? (i.d.error("Websocket closed unexcectedly"), this._conn._changeConnectStatus(i.d.Status.CONNFAIL, "The WebSocket connection could not be established or was disconnected."), this._conn._doDisconnect()) : i.d.debug("Websocket closed"); + } + _no_auth_received(e2) { + i.d.error("Server did not offer a supported authentication mechanism"), this._conn._changeConnectStatus(i.d.Status.CONNFAIL, i.d.ErrorCondition.NO_AUTH_MECH), e2 && e2.call(this._conn), this._conn._doDisconnect(); + } + _onDisconnectTimeout() { + } + _abortAllRequests() { + } + _onError(e2) { + i.d.error("Websocket error " + e2), this._conn._changeConnectStatus(i.d.Status.CONNFAIL, "The WebSocket connection could not be established or was disconnected."), this._disconnect(); + } + _onIdle() { + const e2 = this._conn._data; + if (e2.length > 0 && !this._conn.paused) { + for (let t2 = 0; t2 < e2.length; t2++) + if (e2[t2] !== null) { + let n2; + n2 = e2[t2] === "restart" ? this._buildStream().tree() : e2[t2]; + const r2 = i.d.serialize(n2); + this._conn.xmlOutput(n2), this._conn.rawOutput(r2), this.socket.send(r2); + } + this._conn._data = []; + } + } + _onMessage(e2) { + let t2; + const n2 = '<close xmlns="urn:ietf:params:xml:ns:xmpp-framing" />'; + if (e2.data === n2) + return this._conn.rawInput(n2), this._conn.xmlInput(e2), void (this._conn.disconnecting || this._conn._doDisconnect()); + if (e2.data.search("<open ") === 0) { + if (t2 = new r.a().parseFromString(e2.data, "text/xml").documentElement, !this._handleStreamStart(t2)) + return; + } else { + const n3 = this._streamWrap(e2.data); + t2 = new r.a().parseFromString(n3, "text/xml").documentElement; + } + return this._checkStreamError(t2, i.d.Status.ERROR) ? void 0 : this._conn.disconnecting && t2.firstChild.nodeName === "presence" && t2.firstChild.getAttribute("type") === "unavailable" ? (this._conn.xmlInput(t2), void this._conn.rawInput(i.d.serialize(t2))) : void this._conn._dataRecv(t2, e2.data); + } + _onOpen() { + i.d.debug("Websocket open"); + const e2 = this._buildStream(); + this._conn.xmlOutput(e2.tree()); + const t2 = i.d.serialize(e2); + this._conn.rawOutput(t2), this.socket.send(t2); + } + _reqToData(e2) { + return e2; + } + _send() { + this._conn.flush(); + } + _sendRestart() { + clearTimeout(this._conn._idleTimeout), this._conn._onIdle.bind(this._conn)(); + } + }; + }, function(e, t, n) { + t.a = function() { + return false; + }; + }, function(e, t, n) { + (function(e2) { + var r = n(6), i = exports && !exports.nodeType && exports, o = i && typeof e2 == "object" && e2 && !e2.nodeType && e2, s = o && o.exports === i ? r.a.Buffer : void 0, a = s ? s.allocUnsafe : void 0; + t.a = function(e3, t2) { + if (t2) + return e3.slice(); + var n2 = e3.length, r2 = a ? a(n2) : new e3.constructor(n2); + return e3.copy(r2), r2; + }; + }).call(this, n(69)(e)); + }, function(e, t, n) { + e.exports = function() { + return function(e2, t2, n2) { + var r = t2.prototype, i = r.format; + n2.en.ordinal = function(e3) { + var t3 = ["th", "st", "nd", "rd"], n3 = e3 % 100; + return "[" + e3 + (t3[(n3 - 20) % 10] || t3[n3] || t3[0]) + "]"; + }, r.format = function(e3) { + var t3 = this, n3 = this.$locale(), r2 = this.$utils(), o = (e3 || "YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|gggg|Do|X|x|k{1,2}|S/g, function(e4) { + switch (e4) { + case "Q": + return Math.ceil((t3.$M + 1) / 3); + case "Do": + return n3.ordinal(t3.$D); + case "gggg": + return t3.weekYear(); + case "wo": + return n3.ordinal(t3.week(), "W"); + case "w": + case "ww": + return r2.s(t3.week(), e4 === "w" ? 1 : 2, "0"); + case "k": + case "kk": + return r2.s(String(t3.$H === 0 ? 24 : t3.$H), e4 === "k" ? 1 : 2, "0"); + case "X": + return Math.floor(t3.$d.getTime() / 1e3); + case "x": + return t3.$d.getTime(); + default: + return e4; + } + }); + return i.bind(this)(o); + }; + }; + }(); + }, function(e, t, n) { + var r = n(332), i = n(70); + e.exports = function(e2, t2, n2) { + var o = e2 == null ? 0 : e2.length; + return o ? (t2 = n2 || t2 === void 0 ? 1 : i(t2), r(e2, t2 < 0 ? 0 : t2, o)) : []; + }; + }, function(e, t, n) { + var r = n(25), i = n(23); + e.exports = function(e2) { + return e2 === true || e2 === false || i(e2) && r(e2) == "[object Boolean]"; + }; + }, function(e, t) { + e.exports = function(e2) { + return e2 == null; + }; + }, function(e, t, n) { + var r = n(73), i = n(385), o = n(438), s = n(440); + e.exports = function(e2, t2) { + if (e2 == null) + return {}; + var n2 = r(s(e2), function(e3) { + return [e3]; + }); + return t2 = i(t2), o(e2, n2, function(e3, n3) { + return t2(e3, n3[0]); + }); + }; + }, function(e, t, n) { + var r = n(102), i = n(134), o = n(29), s = n(114), a = n(443); + e.exports = function(e2) { + if (e2 == null) + return 0; + if (o(e2)) + return s(e2) ? a(e2) : e2.length; + var t2 = i(e2); + return t2 == "[object Map]" || t2 == "[object Set]" ? e2.size : r(e2).length; + }; + }, function(e, t, n) { + Object.defineProperty(t, "__esModule", {value: true}); + var r, i = n(139), o = (r = i) && r.__esModule ? r : {default: r}; + t.default = (0, o.default)("webExtensionSyncStorage", "sync"); + }, function(e, t, n) { + Object.defineProperty(t, "__esModule", {value: true}); + var r, i = n(139), o = (r = i) && r.__esModule ? r : {default: r}; + t.default = (0, o.default)("webExtensionLocalStorage", "local"); + }, function(e, t, n) { + (function(t2) { + !function(t3) { + var n2 = /^(b|B)$/, r = {iec: {bits: ["b", "Kib", "Mib", "Gib", "Tib", "Pib", "Eib", "Zib", "Yib"], bytes: ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"]}, jedec: {bits: ["b", "Kb", "Mb", "Gb", "Tb", "Pb", "Eb", "Zb", "Yb"], bytes: ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]}}, i = {iec: ["", "kibi", "mebi", "gibi", "tebi", "pebi", "exbi", "zebi", "yobi"], jedec: ["", "kilo", "mega", "giga", "tera", "peta", "exa", "zetta", "yotta"]}; + function o(e2) { + var t4, o2, s, a, c, l, u, d, h, f, p, g, m, v, _, b = 1 < arguments.length && arguments[1] !== void 0 ? arguments[1] : {}, y = [], w = 0, S = void 0, x = void 0; + if (isNaN(e2)) + throw new TypeError("Invalid number"); + return o2 = b.bits === true, p = b.unix === true, t4 = b.base || 2, f = b.round !== void 0 ? b.round : p ? 1 : 2, l = b.locale !== void 0 ? b.locale : "", u = b.localeOptions || {}, g = b.separator !== void 0 ? b.separator : "", m = b.spacer !== void 0 ? b.spacer : p ? "" : " ", _ = b.symbols || {}, v = t4 === 2 && b.standard || "jedec", h = b.output || "string", a = b.fullform === true, c = b.fullforms instanceof Array ? b.fullforms : [], S = b.exponent !== void 0 ? b.exponent : -1, s = 2 < t4 ? 1e3 : 1024, (d = (x = Number(e2)) < 0) && (x = -x), (S === -1 || isNaN(S)) && (S = Math.floor(Math.log(x) / Math.log(s))) < 0 && (S = 0), 8 < S && (S = 8), h === "exponent" ? S : (x === 0 ? (y[0] = 0, y[1] = p ? "" : r[v][o2 ? "bits" : "bytes"][S]) : (w = x / (t4 === 2 ? Math.pow(2, 10 * S) : Math.pow(1e3, S)), o2 && s <= (w *= 8) && S < 8 && (w /= s, S++), y[0] = Number(w.toFixed(0 < S ? f : 0)), y[0] === s && S < 8 && b.exponent === void 0 && (y[0] = 1, S++), y[1] = t4 === 10 && S === 1 ? o2 ? "kb" : "kB" : r[v][o2 ? "bits" : "bytes"][S], p && (y[1] = v === "jedec" ? y[1].charAt(0) : 0 < S ? y[1].replace(/B$/, "") : y[1], n2.test(y[1]) && (y[0] = Math.floor(y[0]), y[1] = ""))), d && (y[0] = -y[0]), y[1] = _[y[1]] || y[1], l === true ? y[0] = y[0].toLocaleString() : 0 < l.length ? y[0] = y[0].toLocaleString(l, u) : 0 < g.length && (y[0] = y[0].toString().replace(".", g)), h === "array" ? y : (a && (y[1] = c[S] ? c[S] : i[v][S] + (o2 ? "bit" : "byte") + (y[0] === 1 ? "" : "s")), h === "object" ? {value: y[0], symbol: y[1], exponent: S} : y.join(m))); + } + o.partial = function(e2) { + return function(t4) { + return o(t4, e2); + }; + }, e.exports = o; + }(); + }).call(this, n(12)); + }, function(e, t, n) { + var r = {escape: n(8)}; + e.exports = function(e2) { + var t2 = "", n2 = r.escape; + return t2 += "<!-- src/templates/form_captcha.html -->\n", e2.label && (t2 += "\n<label>\n " + n2(e2.label) + "\n</label>\n"), t2 += '\n<img src="data:' + n2(e2.type) + ";base64," + n2(e2.data) + '">\n<input name="' + n2(e2.name) + '" type="text" ', e2.required && (t2 += ' required="required" '), t2 += " />\n\n\n"; + }; + }, function(e, t, n) { + var r = {escape: n(8)}; + e.exports = function(e2) { + var t2 = "", n2 = r.escape; + return t2 += '<!-- src/templates/form_checkbox.html -->\n<div class="form-group">\n <input id="' + n2(e2.id) + '" name="' + n2(e2.name) + '" type="checkbox" ' + n2(e2.checked) + " ", e2.required && (t2 += " required "), t2 += ' />\n <label class="form-check-label" for="' + n2(e2.id) + '">' + n2(e2.label) + "</label>\n</div>\n"; + }; + }, function(e, t, n) { + var r = {escape: n(8)}; + e.exports = function(e2) { + var t2, n2 = "", i = r.escape; + return n2 += '<!-- src/templates/form_select.html -->\n<div class="form-group">\n <label for="' + i(e2.id) + '">' + i(e2.label) + '</label>\n <select class="form-control" id="' + i(e2.id) + '" name="' + i(e2.name) + '" ', e2.multiple && (n2 += ' multiple="multiple" '), n2 += ">" + ((t2 = e2.options) == null ? "" : t2) + "</select>\n</div>\n"; + }; + }, function(e, t, n) { + var r = {escape: n(8)}; + e.exports = function(e2) { + var t2 = "", n2 = r.escape; + return t2 += '<!-- src/templates/form_textarea.html -->\n<label class="label-ta">' + n2(e2.label) + '</label>\n<textarea name="' + n2(e2.name) + '">' + n2(e2.value) + "</textarea>\n"; + }; + }, function(e, t, n) { + var r = {escape: n(8)}; + e.exports = function(e2) { + var t2 = "", n2 = r.escape; + return t2 += "<!-- src/templates/form_url.html -->\n<label>\n " + n2(e2.label) + '\n <a class="form-url" target="_blank" rel="noopener" href="' + n2(e2.value) + '">' + n2(e2.value) + "</a>\n</label>\n"; + }; + }, function(e, t, n) { + var r = {escape: n(8)}; + e.exports = function(e2) { + var t2 = "", n2 = r.escape; + return t2 += '<!-- src/templates/select_option.html -->\n<option value="' + n2(e2.value) + '" ', e2.selected && (t2 += ' selected="selected" '), t2 += " >" + n2(e2.label) + "</option>\n"; + }; + }, function(e, t, n) { + (function(t2) { + !function(t3) { + var n2 = /^(b|B)$/, r = {iec: {bits: ["b", "Kib", "Mib", "Gib", "Tib", "Pib", "Eib", "Zib", "Yib"], bytes: ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"]}, jedec: {bits: ["b", "Kb", "Mb", "Gb", "Tb", "Pb", "Eb", "Zb", "Yb"], bytes: ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]}}, i = {iec: ["", "kibi", "mebi", "gibi", "tebi", "pebi", "exbi", "zebi", "yobi"], jedec: ["", "kilo", "mega", "giga", "tera", "peta", "exa", "zetta", "yotta"]}; + function o(e2) { + var t4, o2, s, a, c, l, u, d, h, f, p, g, m, v, _, b = 1 < arguments.length && arguments[1] !== void 0 ? arguments[1] : {}, y = [], w = 0, S = void 0, x = void 0; + if (isNaN(e2)) + throw new TypeError("Invalid number"); + return o2 = b.bits === true, p = b.unix === true, t4 = b.base || 2, f = b.round !== void 0 ? b.round : p ? 1 : 2, l = b.locale !== void 0 ? b.locale : "", u = b.localeOptions || {}, g = b.separator !== void 0 ? b.separator : "", m = b.spacer !== void 0 ? b.spacer : p ? "" : " ", _ = b.symbols || {}, v = t4 === 2 && b.standard || "jedec", h = b.output || "string", a = b.fullform === true, c = b.fullforms instanceof Array ? b.fullforms : [], S = b.exponent !== void 0 ? b.exponent : -1, s = 2 < t4 ? 1e3 : 1024, (d = (x = Number(e2)) < 0) && (x = -x), (S === -1 || isNaN(S)) && (S = Math.floor(Math.log(x) / Math.log(s))) < 0 && (S = 0), 8 < S && (S = 8), h === "exponent" ? S : (x === 0 ? (y[0] = 0, y[1] = p ? "" : r[v][o2 ? "bits" : "bytes"][S]) : (w = x / (t4 === 2 ? Math.pow(2, 10 * S) : Math.pow(1e3, S)), o2 && s <= (w *= 8) && S < 8 && (w /= s, S++), y[0] = Number(w.toFixed(0 < S ? f : 0)), y[0] === s && S < 8 && b.exponent === void 0 && (y[0] = 1, S++), y[1] = t4 === 10 && S === 1 ? o2 ? "kb" : "kB" : r[v][o2 ? "bits" : "bytes"][S], p && (y[1] = v === "jedec" ? y[1].charAt(0) : 0 < S ? y[1].replace(/B$/, "") : y[1], n2.test(y[1]) && (y[0] = Math.floor(y[0]), y[1] = ""))), d && (y[0] = -y[0]), y[1] = _[y[1]] || y[1], l === true ? y[0] = y[0].toLocaleString() : 0 < l.length ? y[0] = y[0].toLocaleString(l, u) : 0 < g.length && (y[0] = y[0].toString().replace(".", g)), h === "array" ? y : (a && (y[1] = c[S] ? c[S] : i[v][S] + (o2 ? "bit" : "byte") + (y[0] === 1 ? "" : "s")), h === "object" ? {value: y[0], symbol: y[1], exponent: S} : y.join(m))); + } + o.partial = function(e2) { + return function(t4) { + return o(t4, e2); + }; + }, e.exports = o; + }(); + }).call(this, n(12)); + }, function(e, t, n) { + var r = {escape: n(8)}; + e.exports = function(e2) { + var t2 = ""; + return t2 += '<!-- src/plugins/controlbox/templates/toggle.html -->\n<span class="toggle-feedback">' + (0, r.escape)(e2.label_toggle) + "</span>\n"; + }; + }, function(e, t, n) { + n(8); + e.exports = function(e2) { + return '<!-- src/templates/dragresize.html -->\n<div class="dragresize dragresize-top"></div>\n<div class="dragresize dragresize-topleft"></div>\n<div class="dragresize dragresize-left"></div>\n'; + }; + }, function(e, t, n) { + var r = {escape: n(8)}; + e.exports = function(e2) { + var t2 = "", n2 = r.escape; + return t2 += '<!-- src/templates/room_description.html -->\n<!-- FIXME: check markup in mockup -->\n<div class="room-info">\n<p class="room-info"><strong>' + n2(e2.label_jid) + "</strong> " + n2(e2.jid) + '</p>\n<p class="room-info"><strong>' + n2(e2.label_desc) + "</strong> " + n2(e2.desc) + '</p>\n<p class="room-info"><strong>' + n2(e2.label_occ) + "</strong> " + n2(e2.occ) + '</p>\n<p class="room-info"><strong>' + n2(e2.label_features) + "</strong>\n <ul>\n ", e2.passwordprotected && (t2 += '\n <li class="room-info locked">' + n2(e2.label_requires_auth) + "</li>\n "), t2 += "\n ", e2.hidden && (t2 += '\n <li class="room-info">' + n2(e2.label_hidden) + "</li>\n "), t2 += "\n ", e2.membersonly && (t2 += '\n <li class="room-info">' + n2(e2.label_requires_invite) + "</li>\n "), t2 += "\n ", e2.moderated && (t2 += '\n <li class="room-info">' + n2(e2.label_moderated) + "</li>\n "), t2 += "\n ", e2.nonanonymous && (t2 += '\n <li class="room-info">' + n2(e2.label_non_anon) + "</li>\n "), t2 += "\n ", e2.open && (t2 += '\n <li class="room-info">' + n2(e2.label_open_room) + "</li>\n "), t2 += "\n ", e2.persistent && (t2 += '\n <li class="room-info">' + n2(e2.label_permanent_room) + "</li>\n "), t2 += "\n ", e2.publicroom && (t2 += '\n <li class="room-info">' + n2(e2.label_public) + "</li>\n "), t2 += "\n ", e2.semianonymous && (t2 += '\n <li class="room-info">' + n2(e2.label_semi_anon) + "</li>\n "), t2 += "\n ", e2.temporary && (t2 += '\n <li class="room-info">' + n2(e2.label_temp_room) + "</li>\n "), t2 += "\n ", e2.unmoderated && (t2 += '\n <li class="room-info">' + n2(e2.label_unmoderated) + "</li>\n "), t2 += "\n </ul>\n</p>\n</div>\n"; + }; + }, function(e, t, n) { + var r, i; + /** + * @license MIT or GPL-2.0 + * @fileOverview Favico animations + * @author Miroslav Magda, http://blog.ejci.net + * @source: https://github.com/ejci/favico.js + * @version 0.3.10 + */ + i = function(e2) { + e2 = e2 || {}; + var t2, n2, r2, i2, o, s, a, c, l, u, d, h, f, p, g = {bgColor: "#d00", textColor: "#fff", fontFamily: "sans-serif", fontStyle: "bold", type: "circle", position: "down", animation: "slide", elementId: false, element: null, dataUrl: false, win: window}; + (h = {}).ff = typeof InstallTrigger != "undefined", h.chrome = !!window.chrome, h.opera = !!window.opera || navigator.userAgent.indexOf("Opera") >= 0, h.ie = false, h.safari = Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor") > 0, h.supported = h.chrome || h.ff || h.opera; + var m = []; + d = function() { + }, c = false; + var v = {ready: function() { + c = true, v.reset(), d(); + }, reset: function() { + c && (m = [], l = false, u = false, s.clearRect(0, 0, i2, r2), s.drawImage(a, 0, 0, i2, r2), y.setIcon(o), window.clearTimeout(f), window.clearTimeout(void 0)); + }, start: function() { + if (c && !u && m.length > 0) { + u = true; + var e3 = function() { + ["type", "animation", "bgColor", "textColor", "fontFamily", "fontStyle"].forEach(function(e4) { + e4 in m[0].options && (t2[e4] = m[0].options[e4]); + }), x.run(m[0].options, function() { + l = m[0], u = false, m.length > 0 && (m.shift(), v.start()); + }, false); + }; + l ? x.run(l.options, function() { + e3(); + }, true) : e3(); + } + }}, _ = {}, b = function(e3) { + return e3.n = typeof e3.n == "number" ? Math.abs(0 | e3.n) : e3.n, e3.x = i2 * e3.x, e3.y = r2 * e3.y, e3.w = i2 * e3.w, e3.h = r2 * e3.h, e3.len = ("" + e3.n).length, e3; + }; + _.circle = function(e3) { + var n3 = false; + (e3 = b(e3)).len === 2 ? (e3.x = e3.x - 0.4 * e3.w, e3.w = 1.4 * e3.w, n3 = true) : e3.len >= 3 && (e3.x = e3.x - 0.65 * e3.w, e3.w = 1.65 * e3.w, n3 = true), s.clearRect(0, 0, i2, r2), s.drawImage(a, 0, 0, i2, r2), s.beginPath(), s.font = t2.fontStyle + " " + Math.floor(e3.h * (e3.n > 99 ? 0.85 : 1)) + "px " + t2.fontFamily, s.textAlign = "center", n3 ? (s.moveTo(e3.x + e3.w / 2, e3.y), s.lineTo(e3.x + e3.w - e3.h / 2, e3.y), s.quadraticCurveTo(e3.x + e3.w, e3.y, e3.x + e3.w, e3.y + e3.h / 2), s.lineTo(e3.x + e3.w, e3.y + e3.h - e3.h / 2), s.quadraticCurveTo(e3.x + e3.w, e3.y + e3.h, e3.x + e3.w - e3.h / 2, e3.y + e3.h), s.lineTo(e3.x + e3.h / 2, e3.y + e3.h), s.quadraticCurveTo(e3.x, e3.y + e3.h, e3.x, e3.y + e3.h - e3.h / 2), s.lineTo(e3.x, e3.y + e3.h / 2), s.quadraticCurveTo(e3.x, e3.y, e3.x + e3.h / 2, e3.y)) : s.arc(e3.x + e3.w / 2, e3.y + e3.h / 2, e3.h / 2, 0, 2 * Math.PI), s.fillStyle = "rgba(" + t2.bgColor.r + "," + t2.bgColor.g + "," + t2.bgColor.b + "," + e3.o + ")", s.fill(), s.closePath(), s.beginPath(), s.stroke(), s.fillStyle = "rgba(" + t2.textColor.r + "," + t2.textColor.g + "," + t2.textColor.b + "," + e3.o + ")", typeof e3.n == "number" && e3.n > 999 ? s.fillText((e3.n > 9999 ? 9 : Math.floor(e3.n / 1e3)) + "k+", Math.floor(e3.x + e3.w / 2), Math.floor(e3.y + e3.h - 0.2 * e3.h)) : s.fillText(e3.n, Math.floor(e3.x + e3.w / 2), Math.floor(e3.y + e3.h - 0.15 * e3.h)), s.closePath(); + }, _.rectangle = function(e3) { + (e3 = b(e3)).len === 2 ? (e3.x = e3.x - 0.4 * e3.w, e3.w = 1.4 * e3.w) : e3.len >= 3 && (e3.x = e3.x - 0.65 * e3.w, e3.w = 1.65 * e3.w), s.clearRect(0, 0, i2, r2), s.drawImage(a, 0, 0, i2, r2), s.beginPath(), s.font = t2.fontStyle + " " + Math.floor(e3.h * (e3.n > 99 ? 0.9 : 1)) + "px " + t2.fontFamily, s.textAlign = "center", s.fillStyle = "rgba(" + t2.bgColor.r + "," + t2.bgColor.g + "," + t2.bgColor.b + "," + e3.o + ")", s.fillRect(e3.x, e3.y, e3.w, e3.h), s.fillStyle = "rgba(" + t2.textColor.r + "," + t2.textColor.g + "," + t2.textColor.b + "," + e3.o + ")", typeof e3.n == "number" && e3.n > 999 ? s.fillText((e3.n > 9999 ? 9 : Math.floor(e3.n / 1e3)) + "k+", Math.floor(e3.x + e3.w / 2), Math.floor(e3.y + e3.h - 0.2 * e3.h)) : s.fillText(e3.n, Math.floor(e3.x + e3.w / 2), Math.floor(e3.y + e3.h - 0.15 * e3.h)), s.closePath(); + }; + var y = {}; + function w(e3) { + e3 = e3.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, function(e4, t4, n3, r3) { + return t4 + t4 + n3 + n3 + r3 + r3; + }); + var t3 = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e3); + return !!t3 && {r: parseInt(t3[1], 16), g: parseInt(t3[2], 16), b: parseInt(t3[3], 16)}; + } + function S(e3, t3) { + var n3, r3 = {}; + for (n3 in e3) + r3[n3] = e3[n3]; + for (n3 in t3) + r3[n3] = t3[n3]; + return r3; + } + y.getIcons = function() { + var e3 = []; + return t2.element ? e3 = [t2.element] : t2.elementId ? (e3 = [p.getElementById(t2.elementId)])[0].setAttribute("href", e3[0].getAttribute("src")) : (e3 = function() { + for (var e4 = [], t3 = p.getElementsByTagName("head")[0].getElementsByTagName("link"), n3 = 0; n3 < t3.length; n3++) + /(^|\s)icon(\s|$)/i.test(t3[n3].getAttribute("rel")) && e4.push(t3[n3]); + return e4; + }()).length === 0 && ((e3 = [p.createElement("link")])[0].setAttribute("rel", "icon"), p.getElementsByTagName("head")[0].appendChild(e3[0])), e3.forEach(function(e4) { + e4.setAttribute("type", "image/png"); + }), e3; + }, y.setIcon = function(e3) { + var t3 = e3.toDataURL("image/png"); + y.setIconSrc(t3); + }, y.setIconSrc = function(e3) { + if (t2.dataUrl && t2.dataUrl(e3), t2.element) + t2.element.setAttribute("href", e3), t2.element.setAttribute("src", e3); + else if (t2.elementId) { + var r3 = p.getElementById(t2.elementId); + r3.setAttribute("href", e3), r3.setAttribute("src", e3); + } else if (h.ff || h.opera) { + var i3 = n2[n2.length - 1], o2 = p.createElement("link"); + n2 = [o2], h.opera && o2.setAttribute("rel", "icon"), o2.setAttribute("rel", "icon"), o2.setAttribute("type", "image/png"), p.getElementsByTagName("head")[0].appendChild(o2), o2.setAttribute("href", e3), i3.parentNode && i3.parentNode.removeChild(i3); + } else + n2.forEach(function(t3) { + t3.setAttribute("href", e3); + }); + }; + var x = {duration: 40, types: {}}; + return x.types.fade = [{x: 0.4, y: 0.4, w: 0.6, h: 0.6, o: 0}, {x: 0.4, y: 0.4, w: 0.6, h: 0.6, o: 0.1}, {x: 0.4, y: 0.4, w: 0.6, h: 0.6, o: 0.2}, {x: 0.4, y: 0.4, w: 0.6, h: 0.6, o: 0.3}, {x: 0.4, y: 0.4, w: 0.6, h: 0.6, o: 0.4}, {x: 0.4, y: 0.4, w: 0.6, h: 0.6, o: 0.5}, {x: 0.4, y: 0.4, w: 0.6, h: 0.6, o: 0.6}, {x: 0.4, y: 0.4, w: 0.6, h: 0.6, o: 0.7}, {x: 0.4, y: 0.4, w: 0.6, h: 0.6, o: 0.8}, {x: 0.4, y: 0.4, w: 0.6, h: 0.6, o: 0.9}, {x: 0.4, y: 0.4, w: 0.6, h: 0.6, o: 1}], x.types.none = [{x: 0.4, y: 0.4, w: 0.6, h: 0.6, o: 1}], x.types.pop = [{x: 1, y: 1, w: 0, h: 0, o: 1}, {x: 0.9, y: 0.9, w: 0.1, h: 0.1, o: 1}, {x: 0.8, y: 0.8, w: 0.2, h: 0.2, o: 1}, {x: 0.7, y: 0.7, w: 0.3, h: 0.3, o: 1}, {x: 0.6, y: 0.6, w: 0.4, h: 0.4, o: 1}, {x: 0.5, y: 0.5, w: 0.5, h: 0.5, o: 1}, {x: 0.4, y: 0.4, w: 0.6, h: 0.6, o: 1}], x.types.popFade = [{x: 0.75, y: 0.75, w: 0, h: 0, o: 0}, {x: 0.65, y: 0.65, w: 0.1, h: 0.1, o: 0.2}, {x: 0.6, y: 0.6, w: 0.2, h: 0.2, o: 0.4}, {x: 0.55, y: 0.55, w: 0.3, h: 0.3, o: 0.6}, {x: 0.5, y: 0.5, w: 0.4, h: 0.4, o: 0.8}, {x: 0.45, y: 0.45, w: 0.5, h: 0.5, o: 0.9}, {x: 0.4, y: 0.4, w: 0.6, h: 0.6, o: 1}], x.types.slide = [{x: 0.4, y: 1, w: 0.6, h: 0.6, o: 1}, {x: 0.4, y: 0.9, w: 0.6, h: 0.6, o: 1}, {x: 0.4, y: 0.9, w: 0.6, h: 0.6, o: 1}, {x: 0.4, y: 0.8, w: 0.6, h: 0.6, o: 1}, {x: 0.4, y: 0.7, w: 0.6, h: 0.6, o: 1}, {x: 0.4, y: 0.6, w: 0.6, h: 0.6, o: 1}, {x: 0.4, y: 0.5, w: 0.6, h: 0.6, o: 1}, {x: 0.4, y: 0.4, w: 0.6, h: 0.6, o: 1}], x.run = function(e3, n3, r3, i3) { + var s2 = x.types[p.hidden || p.msHidden || p.webkitHidden || p.mozHidden ? "none" : t2.animation]; + i3 = r3 === true ? i3 !== void 0 ? i3 : s2.length - 1 : i3 !== void 0 ? i3 : 0, n3 = n3 || function() { + }, i3 < s2.length && i3 >= 0 ? (_[t2.type](S(e3, s2[i3])), f = setTimeout(function() { + r3 ? i3 -= 1 : i3 += 1, x.run(e3, n3, r3, i3); + }, x.duration), y.setIcon(o)) : n3(); + }, function() { + (t2 = S(g, e2)).bgColor = w(t2.bgColor), t2.textColor = w(t2.textColor), t2.position = t2.position.toLowerCase(), t2.animation = x.types["" + t2.animation] ? t2.animation : g.animation, p = t2.win.document; + var c2 = t2.position.indexOf("up") > -1, l2 = t2.position.indexOf("left") > -1; + if (c2 || l2) + for (var u2 in x.types) + for (var d2 = 0; d2 < x.types[u2].length; d2++) { + var h2 = x.types[u2][d2]; + c2 && (h2.y < 0.6 ? h2.y = h2.y - 0.4 : h2.y = h2.y - 2 * h2.y + (1 - h2.w)), l2 && (h2.x < 0.6 ? h2.x = h2.x - 0.4 : h2.x = h2.x - 2 * h2.x + (1 - h2.h)), x.types[u2][d2] = h2; + } + t2.type = _["" + t2.type] ? t2.type : g.type, n2 = y.getIcons(), o = document.createElement("canvas"), a = document.createElement("img"); + var f2 = n2[n2.length - 1]; + f2.hasAttribute("href") ? (a.setAttribute("crossOrigin", "anonymous"), a.onload = function() { + r2 = a.height > 0 ? a.height : 32, i2 = a.width > 0 ? a.width : 32, o.height = r2, o.width = i2, s = o.getContext("2d"), v.ready(); + }, a.setAttribute("src", f2.getAttribute("href"))) : (r2 = 32, i2 = 32, a.height = r2, a.width = i2, o.height = r2, o.width = i2, s = o.getContext("2d"), v.ready()); + }(), {badge: function(e3, t3) { + t3 = (typeof t3 == "string" ? {animation: t3} : t3) || {}, d = function() { + try { + if (typeof e3 == "number" ? e3 > 0 : e3 !== "") { + var n3 = {type: "badge", options: {n: e3}}; + if ("animation" in t3 && x.types["" + t3.animation] && (n3.options.animation = "" + t3.animation), "type" in t3 && _["" + t3.type] && (n3.options.type = "" + t3.type), ["bgColor", "textColor"].forEach(function(e4) { + e4 in t3 && (n3.options[e4] = w(t3[e4])); + }), ["fontStyle", "fontFamily"].forEach(function(e4) { + e4 in t3 && (n3.options[e4] = t3[e4]); + }), m.push(n3), m.length > 100) + throw new Error("Too many badges requests in queue."); + v.start(); + } else + v.reset(); + } catch (e4) { + throw new Error("Error setting badge. Message: " + e4.message); + } + }, c && d(); + }, setOpt: function(e3, n3) { + var r3 = e3; + n3 == null && Object.prototype.toString.call(e3) == "[object Object]" || ((r3 = {})[e3] = n3); + for (var i3 = Object.keys(r3), o2 = 0; o2 < i3.length; o2++) + i3[o2] == "bgColor" || i3[o2] == "textColor" ? t2[i3[o2]] = w(r3[i3[o2]]) : t2[i3[o2]] = r3[i3[o2]]; + m.push(l), v.start(); + }, reset: v.reset, browser: {supported: h.supported}}; + }, (r = function() { + return i; + }.apply(t, [])) === void 0 || (e.exports = r); + }, function(e, t, n) { + var r = {escape: n(8)}; + e.exports = function(e2) { + var t2 = "", n2 = r.escape; + return t2 += '<!-- src/templates/register_panel.html -->\n<div>\n <form id="converse-register" class="converse-form">\n <legend class="col-form-label">' + n2(e2.__("Create your account")) + '</legend>\n\n <div class="form-group">\n <label>' + n2(e2.__("Please enter the XMPP provider to register with:")) + '</label>\n <div class="form-errors hidden"></div>\n\n ', e2.default_domain ? t2 += "\n " + n2(e2.default_domain) + "\n </div>\n " : t2 += '\n <input class="form-control" required="required" type="text" name="domain" placeholder="' + n2(e2.domain_placeholder) + '"/>\n <p class="form-text text-muted">' + n2(e2.help_providers) + ' <a href="' + n2(e2.href_providers) + '" class="url" target="_blank" rel="noopener">' + n2(e2.help_providers_link) + '</a>.</p>\n </div>\n <fieldset class="buttons">\n <input class="btn btn-primary" type="submit" value="' + n2(e2.label_register) + '"/>\n <div class="switch-form">\n <p>' + n2(e2.__("Already have a chat account?")) + '</p>\n <p><a class="login-here toggle-register-login" href="#converse/login">' + n2(e2.__("Log in here")) + "</a></p>\n </div>\n </fieldset>\n ", t2 += "\n <!--</div>-->\n </form>\n</div>\n"; + }; + }, function(e, t, n) { + var r = {escape: n(8)}; + e.exports = function(e2) { + var t2 = "", n2 = r.escape; + return t2 += '<!-- src/templates/registration_form.html -->\n<legend class="col-form-label">' + n2(e2.__("Account Registration:")) + " " + n2(e2.domain) + '</legend>\n<p class="title">' + n2(e2.title) + '</p>\n<p class="form-help instructions">' + n2(e2.instructions) + '</p>\n<div class="form-errors hidden"></div>\n\n<fieldset class="buttons">\n <input type="submit" class="btn btn-primary" value="' + n2(e2.__("Register")) + '"/>\n ', e2.registration_domain || (t2 += '\n <input type="button" class="btn btn-secondary button-cancel" value="' + n2(e2.__("Choose a different provider")) + '"/>\n '), t2 += '\n <div class="switch-form">\n <p>' + n2(e2.__("Already have a chat account?")) + '</p>\n <p><a class="login-here toggle-register-login" href="#converse/login">' + n2(e2.__("Log in here")) + "</a></p>\n </div>\n</fieldset>\n"; + }; + }, function(e, t, n) { + var r = {escape: n(8)}; + e.exports = function(e2) { + var t2 = "", n2 = r.escape; + return t2 += '<!-- src/templates/registration_request.html -->\n<span class="spinner login-submit fa fa-spinner"></span>\n<p class="info">' + n2(e2.__("Hold tight, we're fetching the registration form\u2026")) + "</p>\n", e2.cancel && (t2 += '\n <button class="btn btn-secondary button-cancel hor_centered">' + n2(e2.__("Cancel")) + "</button>\n"), t2 += "\n"; + }; + }, function(e, t, n) { + var r = {escape: n(8)}; + e.exports = function(e2) { + var t2 = "", n2 = r.escape; + return t2 += '<!-- src/templates/group_header.html -->\n<a href="#" class="list-toggle group-toggle controlbox-padded" title="' + n2(e2.desc_group_toggle) + '">\n <span class="fa ', e2.toggle_state === e2._converse.OPENED ? t2 += " fa-caret-down " : t2 += " fa-caret-right ", t2 += '">\n </span> ' + n2(e2.label_group) + '</a>\n<ul class="items-list roster-group-contacts ', e2.toggle_state === e2._converse.CLOSED && (t2 += " collapsed "), t2 += '"></ul>\n'; + }; + }, function(e, t, n) { + var r = {escape: n(8)}; + e.exports = function(e2) { + var t2 = "", n2 = r.escape; + return t2 += "<!-- src/templates/pending_contact.html -->\n", e2.allow_chat_pending_contacts && (t2 += '\n<a class="list-item-link open-chat w-100" href="#">\n'), t2 += '\n<span class="pending-contact-name" title="JID: ' + n2(e2.jid) + '">' + n2(e2.display_name) + "</span> \n", e2.allow_chat_pending_contacts && (t2 += "</a>"), t2 += '\n<a class="list-item-action remove-xmpp-contact far fa-trash-alt" title="' + n2(e2.desc_remove) + '" href="#"></a>\n'; + }; + }, function(e, t, n) { + var r = {escape: n(8)}; + e.exports = function(e2) { + var t2 = "", n2 = r.escape; + return t2 += "<!-- src/templates/requesting_contact.html -->\n", e2.allow_chat_pending_contacts && (t2 += '\n<a class="open-chat w-100"href="#">\n'), t2 += '\n<span class="req-contact-name w-100" title="JID: ' + n2(e2.jid) + '">' + n2(e2.display_name) + "</span>\n", e2.allow_chat_pending_contacts && (t2 += "\n</a>\n"), t2 += '\n<a class="accept-xmpp-request list-item-action list-item-action--visible fa fa-check"\n aria-label="' + n2(e2.desc_accept) + '" title="' + n2(e2.desc_accept) + '" href="#"></a>\n<a class="decline-xmpp-request list-item-action list-item-action--visible fa fa-times"\n aria-label="' + n2(e2.desc_decline) + '" title="' + n2(e2.desc_decline) + '" href="#"></a>\n'; + }; + }, function(e, t, n) { + var r = {escape: n(8)}; + e.exports = function(e2) { + var t2 = "", n2 = r.escape; + return t2 += '<!-- src/templates/roster.html -->\n<div class="d-flex controlbox-padded">\n <span class="w-100 controlbox-heading controlbox-heading--contacts">' + n2(e2.heading_contacts) + '</span>\n <a class="controlbox-heading__btn sync-contacts fa fa-sync" title="' + n2(e2.title_sync_contacts) + '"></a>\n ', e2.allow_contact_requests && (t2 += '\n <a class="controlbox-heading__btn add-contact fa fa-user-plus"\n title="' + n2(e2.title_add_contact) + '"\n data-toggle="modal"\n data-target="#add-contact-modal"></a>\n '), t2 += '\n</div>\n\n<form class="roster-filter-form"></form>\n\n<div class="list-container roster-contacts"></div>\n'; + }; + }, function(e, t, n) { + var r = {escape: n(8)}; + e.exports = function(e2) { + var t2 = "", n2 = r.escape; + return t2 += '<!-- src/templates/roster_item.html -->\n<a class="list-item-link cbox-list-item open-chat w-100 ', e2.num_unread && (t2 += " unread-msgs "), t2 += '"\n title="' + n2(e2.desc_chat) + '" href="#">\n\n <canvas class="avatar" height="30" width="30"></canvas>\n <span class="' + n2(e2.status_icon) + '" title="' + n2(e2.desc_status) + '"></span>\n ', e2.num_unread && (t2 += ' <span class="msgs-indicator">' + n2(e2.num_unread) + "</span> "), t2 += '\n <span class="contact-name contact-name--' + n2(e2.show) + " ", e2.num_unread && (t2 += " unread-msgs "), t2 += '">' + n2(e2.display_name) + "</span>\n</a>\n", e2.allow_contact_removal && (t2 += '\n<a class="list-item-action remove-xmpp-contact far fa-trash-alt" title="' + n2(e2.desc_remove) + '" href="#"></a>\n'), t2 += "\n"; + }; + }, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , function(e, t, n) { + n.r(t); + const r = {}, i = {plugins: {add(e2, t2) { + if (r[e2] !== void 0) + throw new TypeError('Error: plugin with name "'.concat(e2, '" has already been ') + "registered!"); + r[e2] = t2; + }}, initialize(e2 = {}) { + i.load(e2).initialize(e2); + }, load: (e2 = {}) => (e2.assets_path && (n.p = e2.assets_path), n(506), Object.keys(r).forEach((e3) => i.plugins.add(e3, r[e3])), i)}; + window.converse = i, t.default = i; + }, function(e, t) { + function n(e2, t2) { + t2 = t2 || {bubbles: false, cancelable: false, detail: void 0}; + const n2 = document.createEvent("CustomEvent"); + return n2.initCustomEvent(e2, t2.bubbles, t2.cancelable, t2.detail), n2; + } + typeof window.CustomEvent != "function" && (n.prototype = window.Event.prototype, window.CustomEvent = n), String.prototype.includes || (String.prototype.includes = function(e2, t2) { + return typeof t2 != "number" && (t2 = 0), !(t2 + e2.length > this.length) && this.indexOf(e2, t2) !== -1; + }), String.prototype.endsWith || (String.prototype.endsWith = function(e2, t2) { + const n2 = this.toString(); + (t2 === void 0 || t2 > n2.length) && (t2 = n2.length), t2 -= e2.length; + const r = n2.indexOf(e2, t2); + return r !== -1 && r === t2; + }), String.prototype.startsWith || (String.prototype.startsWith = function(e2, t2) { + return t2 = t2 || 0, this.substr(t2, e2.length) === e2; + }), String.prototype.splitOnce || (String.prototype.splitOnce = function(e2) { + const t2 = this.split(e2); + return [t2.shift(), t2.join(e2)]; + }), String.prototype.trim || (String.prototype.trim = function() { + return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""); + }); + }, function(e, t, n) { + e.exports = function() { + throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object"); + }; + }, function(e, t) { + var n = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/, r = new RegExp("[\\-\\.0-9" + n.source.slice(1, -1) + "\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"), i = new RegExp("^" + n.source + r.source + "*(?::" + n.source + r.source + "*)?$"); + function o() { + } + function s(e2, t2) { + return t2.lineNumber = e2.lineNumber, t2.columnNumber = e2.columnNumber, t2; + } + function a(e2, t2, n2, r2, i2, o2) { + for (var s2, a2 = ++t2, c2 = 0; ; ) { + var l2 = e2.charAt(a2); + switch (l2) { + case "=": + if (c2 === 1) + s2 = e2.slice(t2, a2), c2 = 3; + else { + if (c2 !== 2) + throw new Error("attribute equal must after attrName"); + c2 = 3; + } + break; + case "'": + case '"': + if (c2 === 3 || c2 === 1) { + if (c2 === 1 && (o2.warning('attribute value must after "="'), s2 = e2.slice(t2, a2)), t2 = a2 + 1, !((a2 = e2.indexOf(l2, t2)) > 0)) + throw new Error("attribute value no end '" + l2 + "' match"); + u2 = e2.slice(t2, a2).replace(/&#?\w+;/g, i2), n2.add(s2, u2, t2 - 1), c2 = 5; + } else { + if (c2 != 4) + throw new Error('attribute value must after "="'); + u2 = e2.slice(t2, a2).replace(/&#?\w+;/g, i2), n2.add(s2, u2, t2), o2.warning('attribute "' + s2 + '" missed start quot(' + l2 + ")!!"), t2 = a2 + 1, c2 = 5; + } + break; + case "/": + switch (c2) { + case 0: + n2.setTagName(e2.slice(t2, a2)); + case 5: + case 6: + case 7: + c2 = 7, n2.closed = true; + case 4: + case 1: + case 2: + break; + default: + throw new Error("attribute invalid close char('/')"); + } + break; + case "": + return o2.error("unexpected end of input"), c2 == 0 && n2.setTagName(e2.slice(t2, a2)), a2; + case ">": + switch (c2) { + case 0: + n2.setTagName(e2.slice(t2, a2)); + case 5: + case 6: + case 7: + break; + case 4: + case 1: + (u2 = e2.slice(t2, a2)).slice(-1) === "/" && (n2.closed = true, u2 = u2.slice(0, -1)); + case 2: + c2 === 2 && (u2 = s2), c2 == 4 ? (o2.warning('attribute "' + u2 + '" missed quot(")!!'), n2.add(s2, u2.replace(/&#?\w+;/g, i2), t2)) : (r2[""] === "http://www.w3.org/1999/xhtml" && u2.match(/^(?:disabled|checked|selected)$/i) || o2.warning('attribute "' + u2 + '" missed value!! "' + u2 + '" instead!!'), n2.add(u2, u2, t2)); + break; + case 3: + throw new Error("attribute value missed!!"); + } + return a2; + case "\x80": + l2 = " "; + default: + if (l2 <= " ") + switch (c2) { + case 0: + n2.setTagName(e2.slice(t2, a2)), c2 = 6; + break; + case 1: + s2 = e2.slice(t2, a2), c2 = 2; + break; + case 4: + var u2 = e2.slice(t2, a2).replace(/&#?\w+;/g, i2); + o2.warning('attribute "' + u2 + '" missed quot(")!!'), n2.add(s2, u2, t2); + case 5: + c2 = 6; + } + else + switch (c2) { + case 2: + n2.tagName; + r2[""] === "http://www.w3.org/1999/xhtml" && s2.match(/^(?:disabled|checked|selected)$/i) || o2.warning('attribute "' + s2 + '" missed value!! "' + s2 + '" instead2!!'), n2.add(s2, s2, t2), t2 = a2, c2 = 1; + break; + case 5: + o2.warning('attribute space is required"' + s2 + '"!!'); + case 6: + c2 = 1, t2 = a2; + break; + case 3: + c2 = 4, t2 = a2; + break; + case 7: + throw new Error("elements closed character '/' and '>' must be connected to"); + } + } + a2++; + } + } + function c(e2, t2, n2) { + for (var r2 = e2.tagName, i2 = null, o2 = e2.length; o2--; ) { + var s2 = e2[o2], a2 = s2.qName, c2 = s2.value; + if ((f2 = a2.indexOf(":")) > 0) + var l2 = s2.prefix = a2.slice(0, f2), u2 = a2.slice(f2 + 1), h2 = l2 === "xmlns" && u2; + else + u2 = a2, l2 = null, h2 = a2 === "xmlns" && ""; + s2.localName = u2, h2 !== false && (i2 == null && (i2 = {}, d(n2, n2 = {})), n2[h2] = i2[h2] = c2, s2.uri = "http://www.w3.org/2000/xmlns/", t2.startPrefixMapping(h2, c2)); + } + for (o2 = e2.length; o2--; ) { + (l2 = (s2 = e2[o2]).prefix) && (l2 === "xml" && (s2.uri = "http://www.w3.org/XML/1998/namespace"), l2 !== "xmlns" && (s2.uri = n2[l2 || ""])); + } + var f2; + (f2 = r2.indexOf(":")) > 0 ? (l2 = e2.prefix = r2.slice(0, f2), u2 = e2.localName = r2.slice(f2 + 1)) : (l2 = null, u2 = e2.localName = r2); + var p2 = e2.uri = n2[l2 || ""]; + if (t2.startElement(p2, u2, r2, e2), !e2.closed) + return e2.currentNSMap = n2, e2.localNSMap = i2, true; + if (t2.endElement(p2, u2, r2), i2) + for (l2 in i2) + t2.endPrefixMapping(l2); + } + function l(e2, t2, n2, r2, i2) { + if (/^(?:script|textarea)$/i.test(n2)) { + var o2 = e2.indexOf("</" + n2 + ">", t2), s2 = e2.substring(t2 + 1, o2); + if (/[&<]/.test(s2)) + return /^script$/i.test(n2) ? (i2.characters(s2, 0, s2.length), o2) : (s2 = s2.replace(/&#?\w+;/g, r2), i2.characters(s2, 0, s2.length), o2); + } + return t2 + 1; + } + function u(e2, t2, n2, r2) { + var i2 = r2[n2]; + return i2 == null && ((i2 = e2.lastIndexOf("</" + n2 + ">")) < t2 && (i2 = e2.lastIndexOf("</" + n2)), r2[n2] = i2), i2 < t2; + } + function d(e2, t2) { + for (var n2 in e2) + t2[n2] = e2[n2]; + } + function h(e2, t2, n2, r2) { + switch (e2.charAt(t2 + 2)) { + case "-": + return e2.charAt(t2 + 3) === "-" ? (i2 = e2.indexOf("-->", t2 + 4)) > t2 ? (n2.comment(e2, t2 + 4, i2 - t2 - 4), i2 + 3) : (r2.error("Unclosed comment"), -1) : -1; + default: + if (e2.substr(t2 + 3, 6) == "CDATA[") { + var i2 = e2.indexOf("]]>", t2 + 9); + return n2.startCDATA(), n2.characters(e2, t2 + 9, i2 - t2 - 9), n2.endCDATA(), i2 + 3; + } + var o2 = function(e3, t3) { + var n3, r3 = [], i3 = /'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g; + i3.lastIndex = t3, i3.exec(e3); + for (; n3 = i3.exec(e3); ) + if (r3.push(n3), n3[1]) + return r3; + }(e2, t2), s2 = o2.length; + if (s2 > 1 && /!doctype/i.test(o2[0][0])) { + var a2 = o2[1][0], c2 = s2 > 3 && /^public$/i.test(o2[2][0]) && o2[3][0], l2 = s2 > 4 && o2[4][0], u2 = o2[s2 - 1]; + return n2.startDTD(a2, c2 && c2.replace(/^(['"])(.*?)\1$/, "$2"), l2 && l2.replace(/^(['"])(.*?)\1$/, "$2")), n2.endDTD(), u2.index + u2[0].length; + } + } + return -1; + } + function f(e2, t2, n2) { + var r2 = e2.indexOf("?>", t2); + if (r2) { + var i2 = e2.substring(t2, r2).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/); + if (i2) { + i2[0].length; + return n2.processingInstruction(i2[1], i2[2]), r2 + 2; + } + return -1; + } + return -1; + } + function p(e2) { + } + function g(e2, t2) { + return e2.__proto__ = t2, e2; + } + o.prototype = {parse: function(e2, t2, n2) { + var r2 = this.domBuilder; + r2.startDocument(), d(t2, t2 = {}), function(e3, t3, n3, r3, i2) { + function o2(e4) { + var t4 = e4.slice(1, -1); + return t4 in n3 ? n3[t4] : t4.charAt(0) === "#" ? function(e5) { + if (e5 > 65535) { + var t5 = 55296 + ((e5 -= 65536) >> 10), n4 = 56320 + (1023 & e5); + return String.fromCharCode(t5, n4); + } + return String.fromCharCode(e5); + }(parseInt(t4.substr(1).replace("x", "0x"))) : (i2.error("entity not found:" + e4), e4); + } + function d2(t4) { + if (t4 > S) { + var n4 = e3.substring(S, t4).replace(/&#?\w+;/g, o2); + b && g2(S), r3.characters(n4, 0, t4 - S), S = t4; + } + } + function g2(t4, n4) { + for (; t4 >= v && (n4 = _.exec(e3)); ) + m = n4.index, v = m + n4[0].length, b.lineNumber++; + b.columnNumber = t4 - m + 1; + } + var m = 0, v = 0, _ = /.*(?:\r\n?|\n)|.*$/g, b = r3.locator, y = [{currentNSMap: t3}], w = {}, S = 0; + for (; ; ) { + try { + var x = e3.indexOf("<", S); + if (x < 0) { + if (!e3.substr(S).match(/^\s*$/)) { + var E = r3.doc, A = E.createTextNode(e3.substr(S)); + E.appendChild(A), r3.currentElement = A; + } + return; + } + switch (x > S && d2(x), e3.charAt(x + 1)) { + case "/": + var C = e3.indexOf(">", x + 3), j = e3.substring(x + 2, C), T = y.pop(); + C < 0 ? (j = e3.substring(x + 2).replace(/[\s<].*/, ""), i2.error("end tag name: " + j + " is not complete:" + T.tagName), C = x + 1 + j.length) : j.match(/\s</) && (j = j.replace(/[\s<].*/, ""), i2.error("end tag name: " + j + " maybe not complete"), C = x + 1 + j.length); + var O = T.localNSMap, k = T.tagName == j; + if (k || T.tagName && T.tagName.toLowerCase() == j.toLowerCase()) { + if (r3.endElement(T.uri, T.localName, j), O) + for (var N in O) + r3.endPrefixMapping(N); + k || i2.fatalError("end tag name: " + j + " is not match the current start tagName:" + T.tagName); + } else + y.push(T); + C++; + break; + case "?": + b && g2(x), C = f(e3, x, r3); + break; + case "!": + b && g2(x), C = h(e3, x, r3, i2); + break; + default: + b && g2(x); + var I = new p(), M = y[y.length - 1].currentNSMap, R = (C = a(e3, x, I, M, o2, i2), I.length); + if (!I.closed && u(e3, C, I.tagName, w) && (I.closed = true, n3.nbsp || i2.warning("unclosed xml attribute")), b && R) { + for (var D = s(b, {}), P = 0; P < R; P++) { + var L = I[P]; + g2(L.offset), L.locator = s(b, {}); + } + r3.locator = D, c(I, r3, M) && y.push(I), r3.locator = b; + } else + c(I, r3, M) && y.push(I); + I.uri !== "http://www.w3.org/1999/xhtml" || I.closed ? C++ : C = l(e3, C, I.tagName, o2, r3); + } + } catch (e4) { + i2.error("element parse error: " + e4), C = -1; + } + C > S ? S = C : d2(Math.max(x, S) + 1); + } + }(e2, t2, n2, r2, this.errorHandler), r2.endDocument(); + }}, p.prototype = {setTagName: function(e2) { + if (!i.test(e2)) + throw new Error("invalid tagName:" + e2); + this.tagName = e2; + }, add: function(e2, t2, n2) { + if (!i.test(e2)) + throw new Error("invalid attribute:" + e2); + this[this.length++] = {qName: e2, value: t2, offset: n2}; + }, length: 0, getLocalName: function(e2) { + return this[e2].localName; + }, getLocator: function(e2) { + return this[e2].locator; + }, getQName: function(e2) { + return this[e2].qName; + }, getURI: function(e2) { + return this[e2].uri; + }, getValue: function(e2) { + return this[e2].value; + }}, g({}, g.prototype) instanceof g || (g = function(e2, t2) { + function n2() { + } + for (t2 in n2.prototype = t2, n2 = new n2(), e2) + n2[t2] = e2[t2]; + return n2; + }), t.XMLReader = o; + }, function(e, t, n) { + function r(e2) { + const t2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e2); + return t2 < 0 ? void 0 : t2; + } + e.exports = function(e2) { + if ((e2 = (e2 = "" + e2).replace(/[ \t\n\f\r]/g, "")).length % 4 == 0 && (e2 = e2.replace(/==?$/, "")), e2.length % 4 == 1 || /[^+/0-9A-Za-z]/.test(e2)) + return null; + let t2 = "", n2 = 0, i = 0; + for (let o = 0; o < e2.length; o++) + n2 <<= 6, n2 |= r(e2[o]), i += 6, i === 24 && (t2 += String.fromCharCode((16711680 & n2) >> 16), t2 += String.fromCharCode((65280 & n2) >> 8), t2 += String.fromCharCode(255 & n2), n2 = i = 0); + return i === 12 ? (n2 >>= 4, t2 += String.fromCharCode(n2)) : i === 18 && (n2 >>= 2, t2 += String.fromCharCode((65280 & n2) >> 8), t2 += String.fromCharCode(255 & n2)), t2; + }; + }, function(e, t, n) { + function r(e2) { + if (e2 >= 0 && e2 < 64) + return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[e2]; + } + e.exports = function(e2) { + let t2; + for (e2 = "" + e2, t2 = 0; t2 < e2.length; t2++) + if (e2.charCodeAt(t2) > 255) + return null; + let n2 = ""; + for (t2 = 0; t2 < e2.length; t2 += 3) { + const i = [void 0, void 0, void 0, void 0]; + i[0] = e2.charCodeAt(t2) >> 2, i[1] = (3 & e2.charCodeAt(t2)) << 4, e2.length > t2 + 1 && (i[1] |= e2.charCodeAt(t2 + 1) >> 4, i[2] = (15 & e2.charCodeAt(t2 + 1)) << 2), e2.length > t2 + 2 && (i[2] |= e2.charCodeAt(t2 + 2) >> 6, i[3] = 63 & e2.charCodeAt(t2 + 2)); + for (let e3 = 0; e3 < i.length; e3++) + i[e3] === void 0 ? n2 += "=" : n2 += r(i[e3]); + } + return n2; + }; + }, function(e, t) { + e.exports = function(e2, t2, n) { + var r = -1, i = e2.length; + t2 < 0 && (t2 = -t2 > i ? 0 : i + t2), (n = n > i ? i : n) < 0 && (n += i), i = t2 > n ? 0 : n - t2 >>> 0, t2 >>>= 0; + for (var o = Array(i); ++r < i; ) + o[r] = e2[r + t2]; + return o; + }; + }, function(e, t, n) { + var r = n(334); + e.exports = function(e2) { + return e2 ? (e2 = r(e2)) === 1 / 0 || e2 === -1 / 0 ? 17976931348623157e292 * (e2 < 0 ? -1 : 1) : e2 == e2 ? e2 : 0 : e2 === 0 ? e2 : 0; + }; + }, function(e, t, n) { + var r = n(20), i = n(48), o = /^\s+|\s+$/g, s = /^[-+]0x[0-9a-f]+$/i, a = /^0b[01]+$/i, c = /^0o[0-7]+$/i, l = parseInt; + e.exports = function(e2) { + if (typeof e2 == "number") + return e2; + if (i(e2)) + return NaN; + if (r(e2)) { + var t2 = typeof e2.valueOf == "function" ? e2.valueOf() : e2; + e2 = r(t2) ? t2 + "" : t2; + } + if (typeof e2 != "string") + return e2 === 0 ? e2 : +e2; + e2 = e2.replace(o, ""); + var n2 = a.test(e2); + return n2 || c.test(e2) ? l(e2.slice(2), n2 ? 2 : 8) : s.test(e2) ? NaN : +e2; + }; + }, function(e, t, n) { + var r = n(49), i = Object.prototype, o = i.hasOwnProperty, s = i.toString, a = r ? r.toStringTag : void 0; + e.exports = function(e2) { + var t2 = o.call(e2, a), n2 = e2[a]; + try { + e2[a] = void 0; + var r2 = true; + } catch (e3) { + } + var i2 = s.call(e2); + return r2 && (t2 ? e2[a] = n2 : delete e2[a]), i2; + }; + }, function(e, t) { + var n = Object.prototype.toString; + e.exports = function(e2) { + return n.call(e2); + }; + }, function(e, t, n) { + var r = n(97), i = n(338), o = n(350), s = n(16); + e.exports = function(e2, t2) { + return (s(e2) ? r : i)(e2, o(t2)); + }; + }, function(e, t, n) { + var r = n(339), i = n(349)(r); + e.exports = i; + }, function(e, t, n) { + var r = n(340), i = n(33); + e.exports = function(e2, t2) { + return e2 && r(e2, t2, i); + }; + }, function(e, t, n) { + var r = n(341)(); + e.exports = r; + }, function(e, t) { + e.exports = function(e2) { + return function(t2, n, r) { + for (var i = -1, o = Object(t2), s = r(t2), a = s.length; a--; ) { + var c = s[e2 ? a : ++i]; + if (n(o[c], c, o) === false) + break; + } + return t2; + }; + }; + }, function(e, t) { + e.exports = function(e2, t2) { + for (var n = -1, r = Array(e2); ++n < e2; ) + r[n] = t2(n); + return r; + }; + }, function(e, t, n) { + var r = n(25), i = n(23); + e.exports = function(e2) { + return i(e2) && r(e2) == "[object Arguments]"; + }; + }, function(e, t) { + e.exports = function() { + return false; + }; + }, function(e, t, n) { + var r = n(25), i = n(71), o = n(23), s = {}; + s["[object Float32Array]"] = s["[object Float64Array]"] = s["[object Int8Array]"] = s["[object Int16Array]"] = s["[object Int32Array]"] = s["[object Uint8Array]"] = s["[object Uint8ClampedArray]"] = s["[object Uint16Array]"] = s["[object Uint32Array]"] = true, s["[object Arguments]"] = s["[object Array]"] = s["[object ArrayBuffer]"] = s["[object Boolean]"] = s["[object DataView]"] = s["[object Date]"] = s["[object Error]"] = s["[object Function]"] = s["[object Map]"] = s["[object Number]"] = s["[object Object]"] = s["[object RegExp]"] = s["[object Set]"] = s["[object String]"] = s["[object WeakMap]"] = false, e.exports = function(e2) { + return o(e2) && i(e2.length) && !!s[r(e2)]; + }; + }, function(e, t) { + e.exports = function(e2) { + return function(t2) { + return e2(t2); + }; + }; + }, function(e, t, n) { + (function(e2) { + var r = n(96), i = t && !t.nodeType && t, o = i && typeof e2 == "object" && e2 && !e2.nodeType && e2, s = o && o.exports === i && r.process, a = function() { + try { + var e3 = o && o.require && o.require("util").types; + return e3 || s && s.binding && s.binding("util"); + } catch (e4) { + } + }(); + e2.exports = a; + }).call(this, n(46)(e)); + }, function(e, t, n) { + var r = n(104)(Object.keys, Object); + e.exports = r; + }, function(e, t, n) { + var r = n(29); + e.exports = function(e2, t2) { + return function(n2, i) { + if (n2 == null) + return n2; + if (!r(n2)) + return e2(n2, i); + for (var o = n2.length, s = t2 ? o : -1, a = Object(n2); (t2 ? s-- : ++s < o) && i(a[s], s, a) !== false; ) + ; + return n2; + }; + }; + }, function(e, t, n) { + var r = n(38); + e.exports = function(e2) { + return typeof e2 == "function" ? e2 : r; + }; + }, function(e, t, n) { + var r = n(352), i = n(357), o = n(112), s = i(function(e2, t2) { + r(t2, o(t2), e2); + }); + e.exports = s; + }, function(e, t, n) { + var r = n(105), i = n(106); + e.exports = function(e2, t2, n2, o) { + var s = !n2; + n2 || (n2 = {}); + for (var a = -1, c = t2.length; ++a < c; ) { + var l = t2[a], u = o ? o(n2[l], e2[l], l, n2, e2) : void 0; + u === void 0 && (u = e2[l]), s ? i(n2, l, u) : r(n2, l, u); + } + return n2; + }; + }, function(e, t, n) { + var r = n(62), i = n(354), o = n(20), s = n(108), a = /^\[object .+?Constructor\]$/, c = Function.prototype, l = Object.prototype, u = c.toString, d = l.hasOwnProperty, h = RegExp("^" + u.call(d).replace(/[\\^$.*+?()[\]{}|]/g, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"); + e.exports = function(e2) { + return !(!o(e2) || i(e2)) && (r(e2) ? h : a).test(s(e2)); + }; + }, function(e, t, n) { + var r, i = n(355), o = (r = /[^.]+$/.exec(i && i.keys && i.keys.IE_PROTO || "")) ? "Symbol(src)_1." + r : ""; + e.exports = function(e2) { + return !!o && o in e2; + }; + }, function(e, t, n) { + var r = n(11)["__core-js_shared__"]; + e.exports = r; + }, function(e, t) { + e.exports = function(e2, t2) { + return e2 == null ? void 0 : e2[t2]; + }; + }, function(e, t, n) { + var r = n(109), i = n(361); + e.exports = function(e2) { + return r(function(t2, n2) { + var r2 = -1, o = n2.length, s = o > 1 ? n2[o - 1] : void 0, a = o > 2 ? n2[2] : void 0; + for (s = e2.length > 3 && typeof s == "function" ? (o--, s) : void 0, a && i(n2[0], n2[1], a) && (s = o < 3 ? void 0 : s, o = 1), t2 = Object(t2); ++r2 < o; ) { + var c = n2[r2]; + c && e2(t2, c, r2, s); + } + return t2; + }); + }; + }, function(e, t, n) { + var r = n(72), i = Math.max; + e.exports = function(e2, t2, n2) { + return t2 = i(t2 === void 0 ? e2.length - 1 : t2, 0), function() { + for (var o = arguments, s = -1, a = i(o.length - t2, 0), c = Array(a); ++s < a; ) + c[s] = o[t2 + s]; + s = -1; + for (var l = Array(t2 + 1); ++s < t2; ) + l[s] = o[s]; + return l[t2] = n2(c), r(e2, this, l); + }; + }; + }, function(e, t, n) { + var r = n(360), i = n(107), o = n(38), s = i ? function(e2, t2) { + return i(e2, "toString", {configurable: true, enumerable: false, value: r(t2), writable: true}); + } : o; + e.exports = s; + }, function(e, t) { + e.exports = function(e2) { + return function() { + return e2; + }; + }; + }, function(e, t, n) { + var r = n(50), i = n(29), o = n(37), s = n(20); + e.exports = function(e2, t2, n2) { + if (!s(n2)) + return false; + var a = typeof t2; + return !!(a == "number" ? i(n2) && o(t2, n2.length) : a == "string" && t2 in n2) && r(n2[t2], e2); + }; + }, function(e, t, n) { + var r = n(20), i = n(103), o = n(363), s = Object.prototype.hasOwnProperty; + e.exports = function(e2) { + if (!r(e2)) + return o(e2); + var t2 = i(e2), n2 = []; + for (var a in e2) + (a != "constructor" || !t2 && s.call(e2, a)) && n2.push(a); + return n2; + }; + }, function(e, t) { + e.exports = function(e2) { + var t2 = []; + if (e2 != null) + for (var n in Object(e2)) + t2.push(n); + return t2; + }; + }, function(e, t) { + e.exports = function(e2, t2, n, r) { + for (var i = e2.length, o = n + (r ? 1 : -1); r ? o-- : ++o < i; ) + if (t2(e2[o], o, e2)) + return o; + return -1; + }; + }, function(e, t) { + e.exports = function(e2) { + return e2 != e2; + }; + }, function(e, t) { + e.exports = function(e2, t2, n) { + for (var r = n - 1, i = e2.length; ++r < i; ) + if (e2[r] === t2) + return r; + return -1; + }; + }, function(e, t, n) { + var r = n(73); + e.exports = function(e2, t2) { + return r(t2, function(t3) { + return e2[t3]; + }); + }; + }, function(e, t, n) { + var r = n(115), i = n(369), o = n(370), s = n(118), a = n(383), c = n(122), l = n(384), u = n(125), d = n(126), h = n(70), f = Math.max; + e.exports = function(e2, t2, n2, p, g, m, v, _) { + var b = 2 & t2; + if (!b && typeof e2 != "function") + throw new TypeError("Expected a function"); + var y = p ? p.length : 0; + if (y || (t2 &= -97, p = g = void 0), v = v === void 0 ? v : f(h(v), 0), _ = _ === void 0 ? _ : h(_), y -= g ? g.length : 0, 64 & t2) { + var w = p, S = g; + p = g = void 0; + } + var x = b ? void 0 : c(e2), E = [e2, t2, n2, p, g, w, S, m, v, _]; + if (x && l(E, x), e2 = E[0], t2 = E[1], n2 = E[2], p = E[3], g = E[4], !(_ = E[9] = E[9] === void 0 ? b ? 0 : e2.length : f(E[9] - y, 0)) && 24 & t2 && (t2 &= -25), t2 && t2 != 1) + A = t2 == 8 || t2 == 16 ? o(e2, t2, _) : t2 != 32 && t2 != 33 || g.length ? s.apply(void 0, E) : a(e2, t2, n2, p); + else + var A = i(e2, t2, n2); + return d((x ? r : u)(A, E), e2, t2); + }; + }, function(e, t, n) { + var r = n(51), i = n(11); + e.exports = function(e2, t2, n2) { + var o = 1 & t2, s = r(e2); + return function t3() { + var r2 = this && this !== i && this instanceof t3 ? s : e2; + return r2.apply(o ? n2 : this, arguments); + }; + }; + }, function(e, t, n) { + var r = n(72), i = n(51), o = n(118), s = n(121), a = n(77), c = n(52), l = n(11); + e.exports = function(e2, t2, n2) { + var u = i(e2); + return function i2() { + for (var d = arguments.length, h = Array(d), f = d, p = a(i2); f--; ) + h[f] = arguments[f]; + var g = d < 3 && h[0] !== p && h[d - 1] !== p ? [] : c(h, p); + if ((d -= g.length) < n2) + return s(e2, t2, o, i2.placeholder, void 0, h, g, void 0, void 0, n2 - d); + var m = this && this !== l && this instanceof i2 ? u : e2; + return r(m, this, h); + }; + }; + }, function(e, t) { + e.exports = function(e2, t2) { + for (var n = e2.length, r = 0; n--; ) + e2[n] === t2 && ++r; + return r; + }; + }, function(e, t, n) { + var r = n(75), i = n(122), o = n(374), s = n(376); + e.exports = function(e2) { + var t2 = o(e2), n2 = s[t2]; + if (typeof n2 != "function" || !(t2 in r.prototype)) + return false; + if (e2 === n2) + return true; + var a = i(n2); + return !!a && e2 === a[0]; + }; + }, function(e, t) { + e.exports = function() { + }; + }, function(e, t, n) { + var r = n(375), i = Object.prototype.hasOwnProperty; + e.exports = function(e2) { + for (var t2 = e2.name + "", n2 = r[t2], o = i.call(r, t2) ? n2.length : 0; o--; ) { + var s = n2[o], a = s.func; + if (a == null || a == e2) + return s.name; + } + return t2; + }; + }, function(e, t) { + e.exports = {}; + }, function(e, t, n) { + var r = n(75), i = n(123), o = n(76), s = n(16), a = n(23), c = n(377), l = Object.prototype.hasOwnProperty; + function u(e2) { + if (a(e2) && !s(e2) && !(e2 instanceof r)) { + if (e2 instanceof i) + return e2; + if (l.call(e2, "__wrapped__")) + return c(e2); + } + return new i(e2); + } + u.prototype = o.prototype, u.prototype.constructor = u, e.exports = u; + }, function(e, t, n) { + var r = n(75), i = n(123), o = n(124); + e.exports = function(e2) { + if (e2 instanceof r) + return e2.clone(); + var t2 = new i(e2.__wrapped__, e2.__chain__); + return t2.__actions__ = o(e2.__actions__), t2.__index__ = e2.__index__, t2.__values__ = e2.__values__, t2; + }; + }, function(e, t) { + var n = /\{\n\/\* \[wrapped with (.+)\] \*/, r = /,? & /; + e.exports = function(e2) { + var t2 = e2.match(n); + return t2 ? t2[1].split(r) : []; + }; + }, function(e, t) { + var n = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/; + e.exports = function(e2, t2) { + var r = t2.length; + if (!r) + return e2; + var i = r - 1; + return t2[i] = (r > 1 ? "& " : "") + t2[i], t2 = t2.join(r > 2 ? ", " : " "), e2.replace(n, "{\n/* [wrapped with " + t2 + "] */\n"); + }; + }, function(e, t, n) { + var r = n(97), i = n(381), o = [["ary", 128], ["bind", 1], ["bindKey", 2], ["curry", 8], ["curryRight", 16], ["flip", 512], ["partial", 32], ["partialRight", 64], ["rearg", 256]]; + e.exports = function(e2, t2) { + return r(o, function(n2) { + var r2 = "_." + n2[0]; + t2 & n2[1] && !i(e2, r2) && e2.push(r2); + }), e2.sort(); + }; + }, function(e, t, n) { + var r = n(113); + e.exports = function(e2, t2) { + return !!(e2 == null ? 0 : e2.length) && r(e2, t2, 0) > -1; + }; + }, function(e, t, n) { + var r = n(124), i = n(37), o = Math.min; + e.exports = function(e2, t2) { + for (var n2 = e2.length, s = o(t2.length, n2), a = r(e2); s--; ) { + var c = t2[s]; + e2[s] = i(c, n2) ? a[c] : void 0; + } + return e2; + }; + }, function(e, t, n) { + var r = n(72), i = n(51), o = n(11); + e.exports = function(e2, t2, n2, s) { + var a = 1 & t2, c = i(e2); + return function t3() { + for (var i2 = -1, l = arguments.length, u = -1, d = s.length, h = Array(d + l), f = this && this !== o && this instanceof t3 ? c : e2; ++u < d; ) + h[u] = s[u]; + for (; l--; ) + h[u++] = arguments[++i2]; + return r(f, a ? n2 : this, h); + }; + }; + }, function(e, t, n) { + var r = n(119), i = n(120), o = n(52), s = Math.min; + e.exports = function(e2, t2) { + var n2 = e2[1], a = t2[1], c = n2 | a, l = c < 131, u = a == 128 && n2 == 8 || a == 128 && n2 == 256 && e2[7].length <= t2[8] || a == 384 && t2[7].length <= t2[8] && n2 == 8; + if (!l && !u) + return e2; + 1 & a && (e2[2] = t2[2], c |= 1 & n2 ? 0 : 4); + var d = t2[3]; + if (d) { + var h = e2[3]; + e2[3] = h ? r(h, d, t2[4]) : d, e2[4] = h ? o(e2[3], "__lodash_placeholder__") : t2[4]; + } + return (d = t2[5]) && (h = e2[5], e2[5] = h ? i(h, d, t2[6]) : d, e2[6] = h ? o(e2[5], "__lodash_placeholder__") : t2[6]), (d = t2[7]) && (e2[7] = d), 128 & a && (e2[8] = e2[8] == null ? t2[8] : s(e2[8], t2[8])), e2[9] == null && (e2[9] = t2[9]), e2[0] = t2[0], e2[1] = c, e2; + }; + }, function(e, t, n) { + var r = n(386), i = n(427), o = n(38), s = n(16), a = n(436); + e.exports = function(e2) { + return typeof e2 == "function" ? e2 : e2 == null ? o : typeof e2 == "object" ? s(e2) ? i(e2[0], e2[1]) : r(e2) : a(e2); + }; + }, function(e, t, n) { + var r = n(387), i = n(426), o = n(136); + e.exports = function(e2) { + var t2 = i(e2); + return t2.length == 1 && t2[0][2] ? o(t2[0][0], t2[0][1]) : function(n2) { + return n2 === e2 || r(n2, e2, t2); + }; + }; + }, function(e, t, n) { + var r = n(127), i = n(128); + e.exports = function(e2, t2, n2, o) { + var s = n2.length, a = s, c = !o; + if (e2 == null) + return !a; + for (e2 = Object(e2); s--; ) { + var l = n2[s]; + if (c && l[2] ? l[1] !== e2[l[0]] : !(l[0] in e2)) + return false; + } + for (; ++s < a; ) { + var u = (l = n2[s])[0], d = e2[u], h = l[1]; + if (c && l[2]) { + if (d === void 0 && !(u in e2)) + return false; + } else { + var f = new r(); + if (o) + var p = o(d, h, u, e2, t2, f); + if (!(p === void 0 ? i(h, d, 3, o, f) : p)) + return false; + } + } + return true; + }; + }, function(e, t) { + e.exports = function() { + this.__data__ = [], this.size = 0; + }; + }, function(e, t, n) { + var r = n(54), i = Array.prototype.splice; + e.exports = function(e2) { + var t2 = this.__data__, n2 = r(t2, e2); + return !(n2 < 0) && (n2 == t2.length - 1 ? t2.pop() : i.call(t2, n2, 1), --this.size, true); + }; + }, function(e, t, n) { + var r = n(54); + e.exports = function(e2) { + var t2 = this.__data__, n2 = r(t2, e2); + return n2 < 0 ? void 0 : t2[n2][1]; + }; + }, function(e, t, n) { + var r = n(54); + e.exports = function(e2) { + return r(this.__data__, e2) > -1; + }; + }, function(e, t, n) { + var r = n(54); + e.exports = function(e2, t2) { + var n2 = this.__data__, i = r(n2, e2); + return i < 0 ? (++this.size, n2.push([e2, t2])) : n2[i][1] = t2, this; + }; + }, function(e, t, n) { + var r = n(53); + e.exports = function() { + this.__data__ = new r(), this.size = 0; + }; + }, function(e, t) { + e.exports = function(e2) { + var t2 = this.__data__, n = t2.delete(e2); + return this.size = t2.size, n; + }; + }, function(e, t) { + e.exports = function(e2) { + return this.__data__.get(e2); + }; + }, function(e, t) { + e.exports = function(e2) { + return this.__data__.has(e2); + }; + }, function(e, t, n) { + var r = n(53), i = n(78), o = n(79); + e.exports = function(e2, t2) { + var n2 = this.__data__; + if (n2 instanceof r) { + var s = n2.__data__; + if (!i || s.length < 199) + return s.push([e2, t2]), this.size = ++n2.size, this; + n2 = this.__data__ = new o(s); + } + return n2.set(e2, t2), this.size = n2.size, this; + }; + }, function(e, t, n) { + var r = n(399), i = n(53), o = n(78); + e.exports = function() { + this.size = 0, this.__data__ = {hash: new r(), map: new (o || i)(), string: new r()}; + }; + }, function(e, t, n) { + var r = n(400), i = n(401), o = n(402), s = n(403), a = n(404); + function c(e2) { + var t2 = -1, n2 = e2 == null ? 0 : e2.length; + for (this.clear(); ++t2 < n2; ) { + var r2 = e2[t2]; + this.set(r2[0], r2[1]); + } + } + c.prototype.clear = r, c.prototype.delete = i, c.prototype.get = o, c.prototype.has = s, c.prototype.set = a, e.exports = c; + }, function(e, t, n) { + var r = n(55); + e.exports = function() { + this.__data__ = r ? r(null) : {}, this.size = 0; + }; + }, function(e, t) { + e.exports = function(e2) { + var t2 = this.has(e2) && delete this.__data__[e2]; + return this.size -= t2 ? 1 : 0, t2; + }; + }, function(e, t, n) { + var r = n(55), i = Object.prototype.hasOwnProperty; + e.exports = function(e2) { + var t2 = this.__data__; + if (r) { + var n2 = t2[e2]; + return n2 === "__lodash_hash_undefined__" ? void 0 : n2; + } + return i.call(t2, e2) ? t2[e2] : void 0; + }; + }, function(e, t, n) { + var r = n(55), i = Object.prototype.hasOwnProperty; + e.exports = function(e2) { + var t2 = this.__data__; + return r ? t2[e2] !== void 0 : i.call(t2, e2); + }; + }, function(e, t, n) { + var r = n(55); + e.exports = function(e2, t2) { + var n2 = this.__data__; + return this.size += this.has(e2) ? 0 : 1, n2[e2] = r && t2 === void 0 ? "__lodash_hash_undefined__" : t2, this; + }; + }, function(e, t, n) { + var r = n(56); + e.exports = function(e2) { + var t2 = r(this, e2).delete(e2); + return this.size -= t2 ? 1 : 0, t2; + }; + }, function(e, t) { + e.exports = function(e2) { + var t2 = typeof e2; + return t2 == "string" || t2 == "number" || t2 == "symbol" || t2 == "boolean" ? e2 !== "__proto__" : e2 === null; + }; + }, function(e, t, n) { + var r = n(56); + e.exports = function(e2) { + return r(this, e2).get(e2); + }; + }, function(e, t, n) { + var r = n(56); + e.exports = function(e2) { + return r(this, e2).has(e2); + }; + }, function(e, t, n) { + var r = n(56); + e.exports = function(e2, t2) { + var n2 = r(this, e2), i = n2.size; + return n2.set(e2, t2), this.size += n2.size == i ? 0 : 1, this; + }; + }, function(e, t, n) { + var r = n(127), i = n(129), o = n(416), s = n(420), a = n(134), c = n(16), l = n(100), u = n(101), d = "[object Object]", h = Object.prototype.hasOwnProperty; + e.exports = function(e2, t2, n2, f, p, g) { + var m = c(e2), v = c(t2), _ = m ? "[object Array]" : a(e2), b = v ? "[object Array]" : a(t2), y = (_ = _ == "[object Arguments]" ? d : _) == d, w = (b = b == "[object Arguments]" ? d : b) == d, S = _ == b; + if (S && l(e2)) { + if (!l(t2)) + return false; + m = true, y = false; + } + if (S && !y) + return g || (g = new r()), m || u(e2) ? i(e2, t2, n2, f, p, g) : o(e2, t2, _, n2, f, p, g); + if (!(1 & n2)) { + var x = y && h.call(e2, "__wrapped__"), E = w && h.call(t2, "__wrapped__"); + if (x || E) { + var A = x ? e2.value() : e2, C = E ? t2.value() : t2; + return g || (g = new r()), p(A, C, n2, f, g); + } + } + return !!S && (g || (g = new r()), s(e2, t2, n2, f, p, g)); + }; + }, function(e, t, n) { + var r = n(79), i = n(412), o = n(413); + function s(e2) { + var t2 = -1, n2 = e2 == null ? 0 : e2.length; + for (this.__data__ = new r(); ++t2 < n2; ) + this.add(e2[t2]); + } + s.prototype.add = s.prototype.push = i, s.prototype.has = o, e.exports = s; + }, function(e, t) { + e.exports = function(e2) { + return this.__data__.set(e2, "__lodash_hash_undefined__"), this; + }; + }, function(e, t) { + e.exports = function(e2) { + return this.__data__.has(e2); + }; + }, function(e, t) { + e.exports = function(e2, t2) { + for (var n = -1, r = e2 == null ? 0 : e2.length; ++n < r; ) + if (t2(e2[n], n, e2)) + return true; + return false; + }; + }, function(e, t) { + e.exports = function(e2, t2) { + return e2.has(t2); + }; + }, function(e, t, n) { + var r = n(49), i = n(417), o = n(50), s = n(129), a = n(418), c = n(419), l = r ? r.prototype : void 0, u = l ? l.valueOf : void 0; + e.exports = function(e2, t2, n2, r2, l2, d, h) { + switch (n2) { + case "[object DataView]": + if (e2.byteLength != t2.byteLength || e2.byteOffset != t2.byteOffset) + return false; + e2 = e2.buffer, t2 = t2.buffer; + case "[object ArrayBuffer]": + return !(e2.byteLength != t2.byteLength || !d(new i(e2), new i(t2))); + case "[object Boolean]": + case "[object Date]": + case "[object Number]": + return o(+e2, +t2); + case "[object Error]": + return e2.name == t2.name && e2.message == t2.message; + case "[object RegExp]": + case "[object String]": + return e2 == t2 + ""; + case "[object Map]": + var f = a; + case "[object Set]": + var p = 1 & r2; + if (f || (f = c), e2.size != t2.size && !p) + return false; + var g = h.get(e2); + if (g) + return g == t2; + r2 |= 2, h.set(e2, t2); + var m = s(f(e2), f(t2), r2, l2, d, h); + return h.delete(e2), m; + case "[object Symbol]": + if (u) + return u.call(e2) == u.call(t2); + } + return false; + }; + }, function(e, t, n) { + var r = n(11).Uint8Array; + e.exports = r; + }, function(e, t) { + e.exports = function(e2) { + var t2 = -1, n = Array(e2.size); + return e2.forEach(function(e3, r) { + n[++t2] = [r, e3]; + }), n; + }; + }, function(e, t) { + e.exports = function(e2) { + var t2 = -1, n = Array(e2.size); + return e2.forEach(function(e3) { + n[++t2] = e3; + }), n; + }; + }, function(e, t, n) { + var r = n(421), i = Object.prototype.hasOwnProperty; + e.exports = function(e2, t2, n2, o, s, a) { + var c = 1 & n2, l = r(e2), u = l.length; + if (u != r(t2).length && !c) + return false; + for (var d = u; d--; ) { + var h = l[d]; + if (!(c ? h in t2 : i.call(t2, h))) + return false; + } + var f = a.get(e2), p = a.get(t2); + if (f && p) + return f == t2 && p == e2; + var g = true; + a.set(e2, t2), a.set(t2, e2); + for (var m = c; ++d < u; ) { + var v = e2[h = l[d]], _ = t2[h]; + if (o) + var b = c ? o(_, v, h, t2, e2, a) : o(v, _, h, e2, t2, a); + if (!(b === void 0 ? v === _ || s(v, _, n2, o, a) : b)) { + g = false; + break; + } + m || (m = h == "constructor"); + } + if (g && !m) { + var y = e2.constructor, w = t2.constructor; + y == w || !("constructor" in e2) || !("constructor" in t2) || typeof y == "function" && y instanceof y && typeof w == "function" && w instanceof w || (g = false); + } + return a.delete(e2), a.delete(t2), g; + }; + }, function(e, t, n) { + var r = n(130), i = n(132), o = n(33); + e.exports = function(e2) { + return r(e2, o, i); + }; + }, function(e, t) { + e.exports = function(e2, t2) { + for (var n = -1, r = e2 == null ? 0 : e2.length, i = 0, o = []; ++n < r; ) { + var s = e2[n]; + t2(s, n, e2) && (o[i++] = s); + } + return o; + }; + }, function(e, t, n) { + var r = n(26)(n(11), "DataView"); + e.exports = r; + }, function(e, t, n) { + var r = n(26)(n(11), "Promise"); + e.exports = r; + }, function(e, t, n) { + var r = n(26)(n(11), "Set"); + e.exports = r; + }, function(e, t, n) { + var r = n(135), i = n(33); + e.exports = function(e2) { + for (var t2 = i(e2), n2 = t2.length; n2--; ) { + var o = t2[n2], s = e2[o]; + t2[n2] = [o, s, r(s)]; + } + return t2; + }; + }, function(e, t, n) { + var r = n(128), i = n(428), o = n(433), s = n(81), a = n(135), c = n(136), l = n(39); + e.exports = function(e2, t2) { + return s(e2) && a(t2) ? c(l(e2), t2) : function(n2) { + var s2 = i(n2, e2); + return s2 === void 0 && s2 === t2 ? o(n2, e2) : r(t2, s2, 3); + }; + }; + }, function(e, t, n) { + var r = n(80); + e.exports = function(e2, t2, n2) { + var i = e2 == null ? void 0 : r(e2, t2); + return i === void 0 ? n2 : i; + }; + }, function(e, t, n) { + var r = n(430), i = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, o = /\\(\\)?/g, s = r(function(e2) { + var t2 = []; + return e2.charCodeAt(0) === 46 && t2.push(""), e2.replace(i, function(e3, n2, r2, i2) { + t2.push(r2 ? i2.replace(o, "$1") : n2 || e3); + }), t2; + }); + e.exports = s; + }, function(e, t, n) { + var r = n(431); + e.exports = function(e2) { + var t2 = r(e2, function(e3) { + return n2.size === 500 && n2.clear(), e3; + }), n2 = t2.cache; + return t2; + }; + }, function(e, t, n) { + var r = n(79); + function i(e2, t2) { + if (typeof e2 != "function" || t2 != null && typeof t2 != "function") + throw new TypeError("Expected a function"); + var n2 = function() { + var r2 = arguments, i2 = t2 ? t2.apply(this, r2) : r2[0], o = n2.cache; + if (o.has(i2)) + return o.get(i2); + var s = e2.apply(this, r2); + return n2.cache = o.set(i2, s) || o, s; + }; + return n2.cache = new (i.Cache || r)(), n2; + } + i.Cache = r, e.exports = i; + }, function(e, t, n) { + var r = n(49), i = n(73), o = n(16), s = n(48), a = r ? r.prototype : void 0, c = a ? a.toString : void 0; + e.exports = function e2(t2) { + if (typeof t2 == "string") + return t2; + if (o(t2)) + return i(t2, e2) + ""; + if (s(t2)) + return c ? c.call(t2) : ""; + var n2 = t2 + ""; + return n2 == "0" && 1 / t2 == -1 / 0 ? "-0" : n2; + }; + }, function(e, t, n) { + var r = n(434), i = n(435); + e.exports = function(e2, t2) { + return e2 != null && i(e2, t2, r); + }; + }, function(e, t) { + e.exports = function(e2, t2) { + return e2 != null && t2 in Object(e2); + }; + }, function(e, t, n) { + var r = n(57), i = n(99), o = n(16), s = n(37), a = n(71), c = n(39); + e.exports = function(e2, t2, n2) { + for (var l = -1, u = (t2 = r(t2, e2)).length, d = false; ++l < u; ) { + var h = c(t2[l]); + if (!(d = e2 != null && n2(e2, h))) + break; + e2 = e2[h]; + } + return d || ++l != u ? d : !!(u = e2 == null ? 0 : e2.length) && a(u) && s(h, u) && (o(e2) || i(e2)); + }; + }, function(e, t, n) { + var r = n(138), i = n(437), o = n(81), s = n(39); + e.exports = function(e2) { + return o(e2) ? r(s(e2)) : i(e2); + }; + }, function(e, t, n) { + var r = n(80); + e.exports = function(e2) { + return function(t2) { + return r(t2, e2); + }; + }; + }, function(e, t, n) { + var r = n(80), i = n(439), o = n(57); + e.exports = function(e2, t2, n2) { + for (var s = -1, a = t2.length, c = {}; ++s < a; ) { + var l = t2[s], u = r(e2, l); + n2(u, l) && i(c, o(l, e2), u); + } + return c; + }; + }, function(e, t, n) { + var r = n(105), i = n(57), o = n(37), s = n(20), a = n(39); + e.exports = function(e2, t2, n2, c) { + if (!s(e2)) + return e2; + for (var l = -1, u = (t2 = i(t2, e2)).length, d = u - 1, h = e2; h != null && ++l < u; ) { + var f = a(t2[l]), p = n2; + if (f === "__proto__" || f === "constructor" || f === "prototype") + return e2; + if (l != d) { + var g = h[f]; + (p = c ? c(g, f, h) : void 0) === void 0 && (p = s(g) ? g : o(t2[l + 1]) ? [] : {}); + } + r(h, f, p), h = h[f]; + } + return e2; + }; + }, function(e, t, n) { + var r = n(130), i = n(441), o = n(112); + e.exports = function(e2) { + return r(e2, o, i); + }; + }, function(e, t, n) { + var r = n(131), i = n(442), o = n(132), s = n(133), a = Object.getOwnPropertySymbols ? function(e2) { + for (var t2 = []; e2; ) + r(t2, o(e2)), e2 = i(e2); + return t2; + } : s; + e.exports = a; + }, function(e, t, n) { + var r = n(104)(Object.getPrototypeOf, Object); + e.exports = r; + }, function(e, t, n) { + var r = n(444), i = n(445), o = n(446); + e.exports = function(e2) { + return i(e2) ? o(e2) : r(e2); + }; + }, function(e, t, n) { + var r = n(138)("length"); + e.exports = r; + }, function(e, t) { + var n = RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"); + e.exports = function(e2) { + return n.test(e2); + }; + }, function(e, t) { + var n = "[\\ud800-\\udfff]", r = "[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]", i = "\\ud83c[\\udffb-\\udfff]", o = "[^\\ud800-\\udfff]", s = "(?:\\ud83c[\\udde6-\\uddff]){2}", a = "[\\ud800-\\udbff][\\udc00-\\udfff]", c = "(?:" + r + "|" + i + ")?", l = "[\\ufe0e\\ufe0f]?" + c + ("(?:\\u200d(?:" + [o, s, a].join("|") + ")[\\ufe0e\\ufe0f]?" + c + ")*"), u = "(?:" + [o + r + "?", r, s, a, n].join("|") + ")", d = RegExp(i + "(?=" + i + ")|" + u + l, "g"); + e.exports = function(e2) { + for (var t2 = d.lastIndex = 0; d.test(e2); ) + ++t2; + return t2; + }; + }, function(e, t, n) { + t.__esModule = true; + var r, i = n(448), o = (r = i) && r.__esModule ? r : {default: r}; + t.default = function(e2, t2, n2) { + return t2 in e2 ? (0, o.default)(e2, t2, {value: n2, enumerable: true, configurable: true, writable: true}) : e2[t2] = n2, e2; + }; + }, function(e, t, n) { + e.exports = {default: n(449), __esModule: true}; + }, function(e, t, n) { + n(450); + var r = n(19).Object; + e.exports = function(e2, t2, n2) { + return r.defineProperty(e2, t2, n2); + }; + }, function(e, t, n) { + var r = n(30); + r(r.S + r.F * !n(32), "Object", {defineProperty: n(40).f}); + }, function(e, t, n) { + e.exports = !n(32) && !n(82)(function() { + return Object.defineProperty(n(83)("div"), "a", {get: function() { + return 7; + }}).a != 7; + }); + }, function(e, t, n) { + var r = n(41); + e.exports = function(e2, t2) { + if (!r(e2)) + return e2; + var n2, i; + if (t2 && typeof (n2 = e2.toString) == "function" && !r(i = n2.call(e2))) + return i; + if (typeof (n2 = e2.valueOf) == "function" && !r(i = n2.call(e2))) + return i; + if (!t2 && typeof (n2 = e2.toString) == "function" && !r(i = n2.call(e2))) + return i; + throw TypeError("Can't convert object to primitive value"); + }; + }, function(e, t, n) { + e.exports = {default: n(454), __esModule: true}; + }, function(e, t, n) { + n(455), e.exports = n(19).Object.keys; + }, function(e, t, n) { + var r = n(141), i = n(142); + n(460)("keys", function() { + return function(e2) { + return i(r(e2)); + }; + }); + }, function(e, t, n) { + var r = n(60), i = n(85), o = n(458)(false), s = n(87)("IE_PROTO"); + e.exports = function(e2, t2) { + var n2, a = i(e2), c = 0, l = []; + for (n2 in a) + n2 != s && r(a, n2) && l.push(n2); + for (; t2.length > c; ) + r(a, n2 = t2[c++]) && (~o(l, n2) || l.push(n2)); + return l; + }; + }, function(e, t, n) { + var r = n(61); + e.exports = Object("z").propertyIsEnumerable(0) ? Object : function(e2) { + return r(e2) == "String" ? e2.split("") : Object(e2); + }; + }, function(e, t, n) { + var r = n(85), i = n(143), o = n(459); + e.exports = function(e2) { + return function(t2, n2, s) { + var a, c = r(t2), l = i(c.length), u = o(s, l); + if (e2 && n2 != n2) { + for (; l > u; ) + if ((a = c[u++]) != a) + return true; + } else + for (; l > u; u++) + if ((e2 || u in c) && c[u] === n2) + return e2 || u || 0; + return !e2 && -1; + }; + }; + }, function(e, t, n) { + var r = n(86), i = Math.max, o = Math.min; + e.exports = function(e2, t2) { + return (e2 = r(e2)) < 0 ? i(e2 + t2, 0) : o(e2, t2); + }; + }, function(e, t, n) { + var r = n(30), i = n(19), o = n(82); + e.exports = function(e2, t2) { + var n2 = (i.Object || {})[e2] || Object[e2], s = {}; + s[e2] = t2(n2), r(r.S + r.F * o(function() { + n2(1); + }), "Object", s); + }; + }, function(e, t, n) { + e.exports = n(462); + }, function(e, t, n) { + var r = function() { + return this; + }() || Function("return this")(), i = r.regeneratorRuntime && Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime") >= 0, o = i && r.regeneratorRuntime; + if (r.regeneratorRuntime = void 0, e.exports = n(463), i) + r.regeneratorRuntime = o; + else + try { + delete r.regeneratorRuntime; + } catch (e2) { + r.regeneratorRuntime = void 0; + } + }, function(e, t) { + !function(t2) { + var n = Object.prototype, r = n.hasOwnProperty, i = typeof Symbol == "function" ? Symbol : {}, o = i.iterator || "@@iterator", s = i.asyncIterator || "@@asyncIterator", a = i.toStringTag || "@@toStringTag", c = typeof e == "object", l = t2.regeneratorRuntime; + if (l) + c && (e.exports = l); + else { + (l = t2.regeneratorRuntime = c ? e.exports : {}).wrap = g; + var u = {}, d = {}; + d[o] = function() { + return this; + }; + var h = Object.getPrototypeOf, f = h && h(h(C([]))); + f && f !== n && r.call(f, o) && (d = f); + var p = b.prototype = v.prototype = Object.create(d); + _.prototype = p.constructor = b, b.constructor = _, b[a] = _.displayName = "GeneratorFunction", l.isGeneratorFunction = function(e2) { + var t3 = typeof e2 == "function" && e2.constructor; + return !!t3 && (t3 === _ || (t3.displayName || t3.name) === "GeneratorFunction"); + }, l.mark = function(e2) { + return Object.setPrototypeOf ? Object.setPrototypeOf(e2, b) : (e2.__proto__ = b, a in e2 || (e2[a] = "GeneratorFunction")), e2.prototype = Object.create(p), e2; + }, l.awrap = function(e2) { + return {__await: e2}; + }, y(w.prototype), w.prototype[s] = function() { + return this; + }, l.AsyncIterator = w, l.async = function(e2, t3, n2, r2) { + var i2 = new w(g(e2, t3, n2, r2)); + return l.isGeneratorFunction(t3) ? i2 : i2.next().then(function(e3) { + return e3.done ? e3.value : i2.next(); + }); + }, y(p), p[a] = "Generator", p[o] = function() { + return this; + }, p.toString = function() { + return "[object Generator]"; + }, l.keys = function(e2) { + var t3 = []; + for (var n2 in e2) + t3.push(n2); + return t3.reverse(), function n3() { + for (; t3.length; ) { + var r2 = t3.pop(); + if (r2 in e2) + return n3.value = r2, n3.done = false, n3; + } + return n3.done = true, n3; + }; + }, l.values = C, A.prototype = {constructor: A, reset: function(e2) { + if (this.prev = 0, this.next = 0, this.sent = this._sent = void 0, this.done = false, this.delegate = null, this.method = "next", this.arg = void 0, this.tryEntries.forEach(E), !e2) + for (var t3 in this) + t3.charAt(0) === "t" && r.call(this, t3) && !isNaN(+t3.slice(1)) && (this[t3] = void 0); + }, stop: function() { + this.done = true; + var e2 = this.tryEntries[0].completion; + if (e2.type === "throw") + throw e2.arg; + return this.rval; + }, dispatchException: function(e2) { + if (this.done) + throw e2; + var t3 = this; + function n2(n3, r2) { + return s2.type = "throw", s2.arg = e2, t3.next = n3, r2 && (t3.method = "next", t3.arg = void 0), !!r2; + } + for (var i2 = this.tryEntries.length - 1; i2 >= 0; --i2) { + var o2 = this.tryEntries[i2], s2 = o2.completion; + if (o2.tryLoc === "root") + return n2("end"); + if (o2.tryLoc <= this.prev) { + var a2 = r.call(o2, "catchLoc"), c2 = r.call(o2, "finallyLoc"); + if (a2 && c2) { + if (this.prev < o2.catchLoc) + return n2(o2.catchLoc, true); + if (this.prev < o2.finallyLoc) + return n2(o2.finallyLoc); + } else if (a2) { + if (this.prev < o2.catchLoc) + return n2(o2.catchLoc, true); + } else { + if (!c2) + throw new Error("try statement without catch or finally"); + if (this.prev < o2.finallyLoc) + return n2(o2.finallyLoc); + } + } + } + }, abrupt: function(e2, t3) { + for (var n2 = this.tryEntries.length - 1; n2 >= 0; --n2) { + var i2 = this.tryEntries[n2]; + if (i2.tryLoc <= this.prev && r.call(i2, "finallyLoc") && this.prev < i2.finallyLoc) { + var o2 = i2; + break; + } + } + o2 && (e2 === "break" || e2 === "continue") && o2.tryLoc <= t3 && t3 <= o2.finallyLoc && (o2 = null); + var s2 = o2 ? o2.completion : {}; + return s2.type = e2, s2.arg = t3, o2 ? (this.method = "next", this.next = o2.finallyLoc, u) : this.complete(s2); + }, complete: function(e2, t3) { + if (e2.type === "throw") + throw e2.arg; + return e2.type === "break" || e2.type === "continue" ? this.next = e2.arg : e2.type === "return" ? (this.rval = this.arg = e2.arg, this.method = "return", this.next = "end") : e2.type === "normal" && t3 && (this.next = t3), u; + }, finish: function(e2) { + for (var t3 = this.tryEntries.length - 1; t3 >= 0; --t3) { + var n2 = this.tryEntries[t3]; + if (n2.finallyLoc === e2) + return this.complete(n2.completion, n2.afterLoc), E(n2), u; + } + }, catch: function(e2) { + for (var t3 = this.tryEntries.length - 1; t3 >= 0; --t3) { + var n2 = this.tryEntries[t3]; + if (n2.tryLoc === e2) { + var r2 = n2.completion; + if (r2.type === "throw") { + var i2 = r2.arg; + E(n2); + } + return i2; + } + } + throw new Error("illegal catch attempt"); + }, delegateYield: function(e2, t3, n2) { + return this.delegate = {iterator: C(e2), resultName: t3, nextLoc: n2}, this.method === "next" && (this.arg = void 0), u; + }}; + } + function g(e2, t3, n2, r2) { + var i2 = t3 && t3.prototype instanceof v ? t3 : v, o2 = Object.create(i2.prototype), s2 = new A(r2 || []); + return o2._invoke = function(e3, t4, n3) { + var r3 = "suspendedStart"; + return function(i3, o3) { + if (r3 === "executing") + throw new Error("Generator is already running"); + if (r3 === "completed") { + if (i3 === "throw") + throw o3; + return j(); + } + for (n3.method = i3, n3.arg = o3; ; ) { + var s3 = n3.delegate; + if (s3) { + var a2 = S(s3, n3); + if (a2) { + if (a2 === u) + continue; + return a2; + } + } + if (n3.method === "next") + n3.sent = n3._sent = n3.arg; + else if (n3.method === "throw") { + if (r3 === "suspendedStart") + throw r3 = "completed", n3.arg; + n3.dispatchException(n3.arg); + } else + n3.method === "return" && n3.abrupt("return", n3.arg); + r3 = "executing"; + var c2 = m(e3, t4, n3); + if (c2.type === "normal") { + if (r3 = n3.done ? "completed" : "suspendedYield", c2.arg === u) + continue; + return {value: c2.arg, done: n3.done}; + } + c2.type === "throw" && (r3 = "completed", n3.method = "throw", n3.arg = c2.arg); + } + }; + }(e2, n2, s2), o2; + } + function m(e2, t3, n2) { + try { + return {type: "normal", arg: e2.call(t3, n2)}; + } catch (e3) { + return {type: "throw", arg: e3}; + } + } + function v() { + } + function _() { + } + function b() { + } + function y(e2) { + ["next", "throw", "return"].forEach(function(t3) { + e2[t3] = function(e3) { + return this._invoke(t3, e3); + }; + }); + } + function w(e2) { + var t3; + this._invoke = function(n2, i2) { + function o2() { + return new Promise(function(t4, o3) { + !function t5(n3, i3, o4, s2) { + var a2 = m(e2[n3], e2, i3); + if (a2.type !== "throw") { + var c2 = a2.arg, l2 = c2.value; + return l2 && typeof l2 == "object" && r.call(l2, "__await") ? Promise.resolve(l2.__await).then(function(e3) { + t5("next", e3, o4, s2); + }, function(e3) { + t5("throw", e3, o4, s2); + }) : Promise.resolve(l2).then(function(e3) { + c2.value = e3, o4(c2); + }, s2); + } + s2(a2.arg); + }(n2, i2, t4, o3); + }); + } + return t3 = t3 ? t3.then(o2, o2) : o2(); + }; + } + function S(e2, t3) { + var n2 = e2.iterator[t3.method]; + if (n2 === void 0) { + if (t3.delegate = null, t3.method === "throw") { + if (e2.iterator.return && (t3.method = "return", t3.arg = void 0, S(e2, t3), t3.method === "throw")) + return u; + t3.method = "throw", t3.arg = new TypeError("The iterator does not provide a 'throw' method"); + } + return u; + } + var r2 = m(n2, e2.iterator, t3.arg); + if (r2.type === "throw") + return t3.method = "throw", t3.arg = r2.arg, t3.delegate = null, u; + var i2 = r2.arg; + return i2 ? i2.done ? (t3[e2.resultName] = i2.value, t3.next = e2.nextLoc, t3.method !== "return" && (t3.method = "next", t3.arg = void 0), t3.delegate = null, u) : i2 : (t3.method = "throw", t3.arg = new TypeError("iterator result is not an object"), t3.delegate = null, u); + } + function x(e2) { + var t3 = {tryLoc: e2[0]}; + 1 in e2 && (t3.catchLoc = e2[1]), 2 in e2 && (t3.finallyLoc = e2[2], t3.afterLoc = e2[3]), this.tryEntries.push(t3); + } + function E(e2) { + var t3 = e2.completion || {}; + t3.type = "normal", delete t3.arg, e2.completion = t3; + } + function A(e2) { + this.tryEntries = [{tryLoc: "root"}], e2.forEach(x, this), this.reset(true); + } + function C(e2) { + if (e2) { + var t3 = e2[o]; + if (t3) + return t3.call(e2); + if (typeof e2.next == "function") + return e2; + if (!isNaN(e2.length)) { + var n2 = -1, i2 = function t4() { + for (; ++n2 < e2.length; ) + if (r.call(e2, n2)) + return t4.value = e2[n2], t4.done = false, t4; + return t4.value = void 0, t4.done = true, t4; + }; + return i2.next = i2; + } + } + return {next: j}; + } + function j() { + return {value: void 0, done: true}; + } + }(function() { + return this; + }() || Function("return this")()); + }, function(e, t, n) { + t.__esModule = true; + var r, i = n(89), o = (r = i) && r.__esModule ? r : {default: r}; + t.default = function(e2) { + return function() { + var t2 = e2.apply(this, arguments); + return new o.default(function(e3, n2) { + return function r2(i2, s) { + try { + var a = t2[i2](s), c = a.value; + } catch (e4) { + return void n2(e4); + } + if (!a.done) + return o.default.resolve(c).then(function(e4) { + r2("next", e4); + }, function(e4) { + r2("throw", e4); + }); + e3(c); + }("next"); + }); + }; + }; + }, function(e, t, n) { + n(466), n(467), n(474), n(478), n(490), n(491), e.exports = n(19).Promise; + }, function(e, t) { + }, function(e, t, n) { + var r = n(468)(true); + n(147)(String, "String", function(e2) { + this._t = String(e2), this._i = 0; + }, function() { + var e2, t2 = this._t, n2 = this._i; + return n2 >= t2.length ? {value: void 0, done: true} : (e2 = r(t2, n2), this._i += e2.length, {value: e2, done: false}); + }); + }, function(e, t, n) { + var r = n(86), i = n(84); + e.exports = function(e2) { + return function(t2, n2) { + var o, s, a = String(i(t2)), c = r(n2), l = a.length; + return c < 0 || c >= l ? e2 ? "" : void 0 : (o = a.charCodeAt(c)) < 55296 || o > 56319 || c + 1 === l || (s = a.charCodeAt(c + 1)) < 56320 || s > 57343 ? e2 ? a.charAt(c) : o : e2 ? a.slice(c, c + 2) : s - 56320 + (o - 55296 << 10) + 65536; + }; + }; + }, function(e, t, n) { + e.exports = n(31); + }, function(e, t, n) { + var r = n(471), i = n(140), o = n(90), s = {}; + n(31)(s, n(17)("iterator"), function() { + return this; + }), e.exports = function(e2, t2, n2) { + e2.prototype = r(s, {next: i(1, n2)}), o(e2, t2 + " Iterator"); + }; + }, function(e, t, n) { + var r = n(27), i = n(472), o = n(146), s = n(87)("IE_PROTO"), a = function() { + }, c = function() { + var e2, t2 = n(83)("iframe"), r2 = o.length; + for (t2.style.display = "none", n(148).appendChild(t2), t2.src = "javascript:", (e2 = t2.contentWindow.document).open(), e2.write("<script>document.F=Object</script>"), e2.close(), c = e2.F; r2--; ) + delete c.prototype[o[r2]]; + return c(); + }; + e.exports = Object.create || function(e2, t2) { + var n2; + return e2 !== null ? (a.prototype = r(e2), n2 = new a(), a.prototype = null, n2[s] = e2) : n2 = c(), t2 === void 0 ? n2 : i(n2, t2); + }; + }, function(e, t, n) { + var r = n(40), i = n(27), o = n(142); + e.exports = n(32) ? Object.defineProperties : function(e2, t2) { + i(e2); + for (var n2, s = o(t2), a = s.length, c = 0; a > c; ) + r.f(e2, n2 = s[c++], t2[n2]); + return e2; + }; + }, function(e, t, n) { + var r = n(60), i = n(141), o = n(87)("IE_PROTO"), s = Object.prototype; + e.exports = Object.getPrototypeOf || function(e2) { + return e2 = i(e2), r(e2, o) ? e2[o] : typeof e2.constructor == "function" && e2 instanceof e2.constructor ? e2.constructor.prototype : e2 instanceof Object ? s : null; + }; + }, function(e, t, n) { + n(475); + for (var r = n(13), i = n(31), o = n(42), s = n(17)("toStringTag"), a = "CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","), c = 0; c < a.length; c++) { + var l = a[c], u = r[l], d = u && u.prototype; + d && !d[s] && i(d, s, l), o[l] = o.Array; + } + }, function(e, t, n) { + var r = n(476), i = n(477), o = n(42), s = n(85); + e.exports = n(147)(Array, "Array", function(e2, t2) { + this._t = s(e2), this._i = 0, this._k = t2; + }, function() { + var e2 = this._t, t2 = this._k, n2 = this._i++; + return !e2 || n2 >= e2.length ? (this._t = void 0, i(1)) : i(0, t2 == "keys" ? n2 : t2 == "values" ? e2[n2] : [n2, e2[n2]]); + }, "values"), o.Arguments = o.Array, r("keys"), r("values"), r("entries"); + }, function(e, t) { + e.exports = function() { + }; + }, function(e, t) { + e.exports = function(e2, t2) { + return {value: t2, done: !!e2}; + }; + }, function(e, t, n) { + var r, i, o, s, a = n(88), c = n(13), l = n(58), u = n(149), d = n(30), h = n(41), f = n(59), p = n(479), g = n(480), m = n(150), v = n(151).set, _ = n(485)(), b = n(91), y = n(152), w = n(486), S = n(153), x = c.TypeError, E = c.process, A = E && E.versions, C = A && A.v8 || "", j = c.Promise, T = u(E) == "process", O = function() { + }, k = i = b.f, N = !!function() { + try { + var e2 = j.resolve(1), t2 = (e2.constructor = {})[n(17)("species")] = function(e3) { + e3(O, O); + }; + return (T || typeof PromiseRejectionEvent == "function") && e2.then(O) instanceof t2 && C.indexOf("6.6") !== 0 && w.indexOf("Chrome/66") === -1; + } catch (e3) { + } + }(), I = function(e2) { + var t2; + return !(!h(e2) || typeof (t2 = e2.then) != "function") && t2; + }, M = function(e2, t2) { + if (!e2._n) { + e2._n = true; + var n2 = e2._c; + _(function() { + for (var r2 = e2._v, i2 = e2._s == 1, o2 = 0, s2 = function(t3) { + var n3, o3, s3, a2 = i2 ? t3.ok : t3.fail, c2 = t3.resolve, l2 = t3.reject, u2 = t3.domain; + try { + a2 ? (i2 || (e2._h == 2 && P(e2), e2._h = 1), a2 === true ? n3 = r2 : (u2 && u2.enter(), n3 = a2(r2), u2 && (u2.exit(), s3 = true)), n3 === t3.promise ? l2(x("Promise-chain cycle")) : (o3 = I(n3)) ? o3.call(n3, c2, l2) : c2(n3)) : l2(r2); + } catch (e3) { + u2 && !s3 && u2.exit(), l2(e3); + } + }; n2.length > o2; ) + s2(n2[o2++]); + e2._c = [], e2._n = false, t2 && !e2._h && R(e2); + }); + } + }, R = function(e2) { + v.call(c, function() { + var t2, n2, r2, i2 = e2._v, o2 = D(e2); + if (o2 && (t2 = y(function() { + T ? E.emit("unhandledRejection", i2, e2) : (n2 = c.onunhandledrejection) ? n2({promise: e2, reason: i2}) : (r2 = c.console) && r2.error && r2.error("Unhandled promise rejection", i2); + }), e2._h = T || D(e2) ? 2 : 1), e2._a = void 0, o2 && t2.e) + throw t2.v; + }); + }, D = function(e2) { + return e2._h !== 1 && (e2._a || e2._c).length === 0; + }, P = function(e2) { + v.call(c, function() { + var t2; + T ? E.emit("rejectionHandled", e2) : (t2 = c.onrejectionhandled) && t2({promise: e2, reason: e2._v}); + }); + }, L = function(e2) { + var t2 = this; + t2._d || (t2._d = true, (t2 = t2._w || t2)._v = e2, t2._s = 2, t2._a || (t2._a = t2._c.slice()), M(t2, true)); + }, z = function(e2) { + var t2, n2 = this; + if (!n2._d) { + n2._d = true, n2 = n2._w || n2; + try { + if (n2 === e2) + throw x("Promise can't be resolved itself"); + (t2 = I(e2)) ? _(function() { + var r2 = {_w: n2, _d: false}; + try { + t2.call(e2, l(z, r2, 1), l(L, r2, 1)); + } catch (e3) { + L.call(r2, e3); + } + }) : (n2._v = e2, n2._s = 1, M(n2, false)); + } catch (e3) { + L.call({_w: n2, _d: false}, e3); + } + } + }; + N || (j = function(e2) { + p(this, j, "Promise", "_h"), f(e2), r.call(this); + try { + e2(l(z, this, 1), l(L, this, 1)); + } catch (e3) { + L.call(this, e3); + } + }, (r = function(e2) { + this._c = [], this._a = void 0, this._s = 0, this._d = false, this._v = void 0, this._h = 0, this._n = false; + }).prototype = n(487)(j.prototype, {then: function(e2, t2) { + var n2 = k(m(this, j)); + return n2.ok = typeof e2 != "function" || e2, n2.fail = typeof t2 == "function" && t2, n2.domain = T ? E.domain : void 0, this._c.push(n2), this._a && this._a.push(n2), this._s && M(this, false), n2.promise; + }, catch: function(e2) { + return this.then(void 0, e2); + }}), o = function() { + var e2 = new r(); + this.promise = e2, this.resolve = l(z, e2, 1), this.reject = l(L, e2, 1); + }, b.f = k = function(e2) { + return e2 === j || e2 === s ? new o(e2) : i(e2); + }), d(d.G + d.W + d.F * !N, {Promise: j}), n(90)(j, "Promise"), n(488)("Promise"), s = n(19).Promise, d(d.S + d.F * !N, "Promise", {reject: function(e2) { + var t2 = k(this); + return (0, t2.reject)(e2), t2.promise; + }}), d(d.S + d.F * (a || !N), "Promise", {resolve: function(e2) { + return S(a && this === s ? j : this, e2); + }}), d(d.S + d.F * !(N && n(489)(function(e2) { + j.all(e2).catch(O); + })), "Promise", {all: function(e2) { + var t2 = this, n2 = k(t2), r2 = n2.resolve, i2 = n2.reject, o2 = y(function() { + var n3 = [], o3 = 0, s2 = 1; + g(e2, false, function(e3) { + var a2 = o3++, c2 = false; + n3.push(void 0), s2++, t2.resolve(e3).then(function(e4) { + c2 || (c2 = true, n3[a2] = e4, --s2 || r2(n3)); + }, i2); + }), --s2 || r2(n3); + }); + return o2.e && i2(o2.v), n2.promise; + }, race: function(e2) { + var t2 = this, n2 = k(t2), r2 = n2.reject, i2 = y(function() { + g(e2, false, function(e3) { + t2.resolve(e3).then(n2.resolve, r2); + }); + }); + return i2.e && r2(i2.v), n2.promise; + }}); + }, function(e, t) { + e.exports = function(e2, t2, n, r) { + if (!(e2 instanceof t2) || r !== void 0 && r in e2) + throw TypeError(n + ": incorrect invocation!"); + return e2; + }; + }, function(e, t, n) { + var r = n(58), i = n(481), o = n(482), s = n(27), a = n(143), c = n(483), l = {}, u = {}; + (t = e.exports = function(e2, t2, n2, d, h) { + var f, p, g, m, v = h ? function() { + return e2; + } : c(e2), _ = r(n2, d, t2 ? 2 : 1), b = 0; + if (typeof v != "function") + throw TypeError(e2 + " is not iterable!"); + if (o(v)) { + for (f = a(e2.length); f > b; b++) + if ((m = t2 ? _(s(p = e2[b])[0], p[1]) : _(e2[b])) === l || m === u) + return m; + } else + for (g = v.call(e2); !(p = g.next()).done; ) + if ((m = i(g, _, p.value, t2)) === l || m === u) + return m; + }).BREAK = l, t.RETURN = u; + }, function(e, t, n) { + var r = n(27); + e.exports = function(e2, t2, n2, i) { + try { + return i ? t2(r(n2)[0], n2[1]) : t2(n2); + } catch (t3) { + var o = e2.return; + throw o !== void 0 && r(o.call(e2)), t3; + } + }; + }, function(e, t, n) { + var r = n(42), i = n(17)("iterator"), o = Array.prototype; + e.exports = function(e2) { + return e2 !== void 0 && (r.Array === e2 || o[i] === e2); + }; + }, function(e, t, n) { + var r = n(149), i = n(17)("iterator"), o = n(42); + e.exports = n(19).getIteratorMethod = function(e2) { + if (e2 != null) + return e2[i] || e2["@@iterator"] || o[r(e2)]; + }; + }, function(e, t) { + e.exports = function(e2, t2, n) { + var r = n === void 0; + switch (t2.length) { + case 0: + return r ? e2() : e2.call(n); + case 1: + return r ? e2(t2[0]) : e2.call(n, t2[0]); + case 2: + return r ? e2(t2[0], t2[1]) : e2.call(n, t2[0], t2[1]); + case 3: + return r ? e2(t2[0], t2[1], t2[2]) : e2.call(n, t2[0], t2[1], t2[2]); + case 4: + return r ? e2(t2[0], t2[1], t2[2], t2[3]) : e2.call(n, t2[0], t2[1], t2[2], t2[3]); + } + return e2.apply(n, t2); + }; + }, function(e, t, n) { + var r = n(13), i = n(151).set, o = r.MutationObserver || r.WebKitMutationObserver, s = r.process, a = r.Promise, c = n(61)(s) == "process"; + e.exports = function() { + var e2, t2, n2, l = function() { + var r2, i2; + for (c && (r2 = s.domain) && r2.exit(); e2; ) { + i2 = e2.fn, e2 = e2.next; + try { + i2(); + } catch (r3) { + throw e2 ? n2() : t2 = void 0, r3; + } + } + t2 = void 0, r2 && r2.enter(); + }; + if (c) + n2 = function() { + s.nextTick(l); + }; + else if (!o || r.navigator && r.navigator.standalone) + if (a && a.resolve) { + var u = a.resolve(void 0); + n2 = function() { + u.then(l); + }; + } else + n2 = function() { + i.call(r, l); + }; + else { + var d = true, h = document.createTextNode(""); + new o(l).observe(h, {characterData: true}), n2 = function() { + h.data = d = !d; + }; + } + return function(r2) { + var i2 = {fn: r2, next: void 0}; + t2 && (t2.next = i2), e2 || (e2 = i2, n2()), t2 = i2; + }; + }; + }, function(e, t, n) { + var r = n(13).navigator; + e.exports = r && r.userAgent || ""; + }, function(e, t, n) { + var r = n(31); + e.exports = function(e2, t2, n2) { + for (var i in t2) + n2 && e2[i] ? e2[i] = t2[i] : r(e2, i, t2[i]); + return e2; + }; + }, function(e, t, n) { + var r = n(13), i = n(19), o = n(40), s = n(32), a = n(17)("species"); + e.exports = function(e2) { + var t2 = typeof i[e2] == "function" ? i[e2] : r[e2]; + s && t2 && !t2[a] && o.f(t2, a, {configurable: true, get: function() { + return this; + }}); + }; + }, function(e, t, n) { + var r = n(17)("iterator"), i = false; + try { + var o = [7][r](); + o.return = function() { + i = true; + }, Array.from(o, function() { + throw 2; + }); + } catch (e2) { + } + e.exports = function(e2, t2) { + if (!t2 && !i) + return false; + var n2 = false; + try { + var o2 = [7], s = o2[r](); + s.next = function() { + return {done: n2 = true}; + }, o2[r] = function() { + return s; + }, e2(o2); + } catch (e3) { + } + return n2; + }; + }, function(e, t, n) { + var r = n(30), i = n(19), o = n(13), s = n(150), a = n(153); + r(r.P + r.R, "Promise", {finally: function(e2) { + var t2 = s(this, i.Promise || o.Promise), n2 = typeof e2 == "function"; + return this.then(n2 ? function(n3) { + return a(t2, e2()).then(function() { + return n3; + }); + } : e2, n2 ? function(n3) { + return a(t2, e2()).then(function() { + throw n3; + }); + } : e2); + }}); + }, function(e, t, n) { + var r = n(30), i = n(91), o = n(152); + r(r.S, "Promise", {try: function(e2) { + var t2 = i.f(this), n2 = o(e2); + return (n2.e ? t2.reject : t2.resolve)(n2.v), t2.promise; + }}); + }, function(e, t, n) { + Object.defineProperty(t, "__esModule", {value: true}); + var r, i = n(89), o = (r = i) && r.__esModule ? r : {default: r}; + function s() { + return window.browser && browser.storage || window.chrome && chrome.storage; + } + t.getStorage = s, t.usePromise = function(e2, t2) { + if (function() { + var e3 = s(); + try { + return e3 && e3.local.get && e3.local.get() && typeof e3.local.get().then == "function"; + } catch (e4) { + return false; + } + }()) + return e2(t2); + return new o.default(function(n2) { + e2(t2, function() { + n2.apply(void 0, arguments); + }); + }); + }; + }, function(e, t, n) { + n(68); + var r = n(0); + const i = {}; + i.debug = r.e.LogLevel.DEBUG, i.info = r.e.LogLevel.INFO, i.warn = r.e.LogLevel.WARN, i.error = r.e.LogLevel.ERROR, i.fatal = r.e.LogLevel.FATAL, r.e.WorkerWebsocket = class extends r.e.Websocket { + constructor(e2) { + super(e2), this._conn = e2, this.worker = new SharedWorker(this._conn.options.worker, "Strophe XMPP Connection"), this.worker.onerror = (e3) => { + var t2; + (t2 = console) === null || t2 === void 0 || t2.error(e3), r.e.log(r.e.LogLevel.ERROR, "Shared Worker Error: ".concat(e3)); + }; + } + get socket() { + return {send: (e2) => this.worker.port.postMessage(["send", e2])}; + } + _connect() { + this._messageHandler = (e2) => this._onInitialMessage(e2), this.worker.port.start(), this.worker.port.onmessage = (e2) => this._onWorkerMessage(e2), this.worker.port.postMessage(["_connect", this._conn.service, this._conn.jid]); + } + _attach(e2) { + this._messageHandler = (e3) => this._onMessage(e3), this._conn.connect_callback = e2, this.worker.port.start(), this.worker.port.onmessage = (e3) => this._onWorkerMessage(e3), this.worker.port.postMessage(["_attach", this._conn.service]); + } + _attachCallback(e2, t2) { + e2 === r.e.Status.ATTACHED ? (this._conn.jid = t2, this._conn.authenticated = true, this._conn.connected = true, this._conn.restored = true, this._conn._changeConnectStatus(r.e.Status.ATTACHED)) : e2 === r.e.Status.ATTACHFAIL && (this._conn.authenticated = false, this._conn.connected = false, this._conn.restored = false, this._conn._changeConnectStatus(r.e.Status.ATTACHFAIL)); + } + _disconnect(e2, t2) { + t2 && this._conn.send(t2); + const n2 = Object(r.a)("close", {xmlns: r.e.NS.FRAMING}); + this._conn.xmlOutput(n2.tree()); + const i2 = r.e.serialize(n2); + this._conn.rawOutput(i2), this.worker.port.postMessage(["send", i2]), this._conn._doDisconnect(); + } + _onClose(e2) { + this._conn.connected && !this._conn.disconnecting ? (r.e.error("Websocket closed unexpectedly"), this._conn._doDisconnect()) : e2 && e2.code === 1006 && !this._conn.connected ? (r.e.error("Websocket closed unexcectedly"), this._conn._changeConnectStatus(r.e.Status.CONNFAIL, "The WebSocket connection could not be established or was disconnected."), this._conn._doDisconnect()) : r.e.debug("Websocket closed"); + } + _closeSocket() { + this.worker.port.postMessage(["_closeSocket"]); + } + _replaceMessageHandler() { + this._messageHandler = (e2) => this._onMessage(e2); + } + _onWorkerMessage(e2) { + const {data: t2} = e2, n2 = t2[0]; + if (n2 === "_onMessage") + this._messageHandler(t2[1]); + else if (n2 in this) + try { + this[n2].apply(this, e2.data.slice(1)); + } catch (e3) { + r.e.log(r.e.LogLevel.ERROR, e3); + } + else if (n2 === "log") { + const e3 = t2[1], n3 = t2[2]; + r.e.log(i[e3], n3); + } else + r.e.log(r.e.LogLevel.ERROR, "Found unhandled service worker message: ".concat(t2)); + } + }; + }, function(e, t, n) { + var r = {"./af/LC_MESSAGES/converse.po": [507, 139], "./ar/LC_MESSAGES/converse.po": [508, 140], "./bg/LC_MESSAGES/converse.po": [509, 141], "./ca/LC_MESSAGES/converse.po": [510, 142], "./cs/LC_MESSAGES/converse.po": [511, 143], "./da/LC_MESSAGES/converse.po": [512, 144], "./de/LC_MESSAGES/converse.po": [513, 147], "./eo/LC_MESSAGES/converse.po": [514, 148], "./es/LC_MESSAGES/converse.po": [515, 149], "./eu/LC_MESSAGES/converse.po": [516, 150], "./fi/LC_MESSAGES/converse.po": [517, 151], "./fr/LC_MESSAGES/converse.po": [518, 152], "./gl/LC_MESSAGES/converse.po": [519, 153], "./he/LC_MESSAGES/converse.po": [520, 154], "./hi/LC_MESSAGES/converse.po": [521, 155], "./hu/LC_MESSAGES/converse.po": [522, 156], "./id/LC_MESSAGES/converse.po": [523, 157], "./it/LC_MESSAGES/converse.po": [524, 158], "./ja/LC_MESSAGES/converse.po": [525, 159], "./lt/LC_MESSAGES/converse.po": [526, 160], "./mr/LC_MESSAGES/converse.po": [527, 161], "./nb/LC_MESSAGES/converse.po": [528, 162], "./nl/LC_MESSAGES/converse.po": [529, 163], "./nl_BE/LC_MESSAGES/converse.po": [530, 164], "./oc/LC_MESSAGES/converse.po": [531, 165], "./pl/LC_MESSAGES/converse.po": [532, 166], "./pt/LC_MESSAGES/converse.po": [533, 167], "./pt_BR/LC_MESSAGES/converse.po": [534, 168], "./ro/LC_MESSAGES/converse.po": [535, 169], "./ru/LC_MESSAGES/converse.po": [536, 170], "./sv/LC_MESSAGES/converse.po": [537, 171], "./th/LC_MESSAGES/converse.po": [538, 172], "./tr/LC_MESSAGES/converse.po": [539, 173], "./uk/LC_MESSAGES/converse.po": [540, 174], "./vi/LC_MESSAGES/converse.po": [541, 175], "./zh_CN/LC_MESSAGES/converse.po": [542, 176], "./zh_TW/LC_MESSAGES/converse.po": [543, 177]}; + function i(e2) { + if (!n.o(r, e2)) + return Promise.resolve().then(function() { + var t3 = new Error("Cannot find module '" + e2 + "'"); + throw t3.code = "MODULE_NOT_FOUND", t3; + }); + var t2 = r[e2], i2 = t2[0]; + return n.e(t2[1]).then(function() { + return n.t(i2, 3); + }); + } + i.keys = function() { + return Object.keys(r); + }, i.id = 494, e.exports = i; + }, function(e, t, n) { + var r = {"./af": [189, 0], "./af.js": [189, 0], "./ar": [196, 1], "./ar-dz": [190, 2], "./ar-dz.js": [190, 2], "./ar-kw": [191, 3], "./ar-kw.js": [191, 3], "./ar-ly": [192, 4], "./ar-ly.js": [192, 4], "./ar-ma": [193, 5], "./ar-ma.js": [193, 5], "./ar-sa": [194, 6], "./ar-sa.js": [194, 6], "./ar-tn": [195, 7], "./ar-tn.js": [195, 7], "./ar.js": [196, 1], "./az": [197, 8], "./az.js": [197, 8], "./be": [198, 9], "./be.js": [198, 9], "./bg": [199, 10], "./bg.js": [199, 10], "./bi": [200, 11], "./bi.js": [200, 11], "./bm": [201, 12], "./bm.js": [201, 12], "./bn": [202, 13], "./bn.js": [202, 13], "./bo": [203, 14], "./bo.js": [203, 14], "./br": [204, 15], "./br.js": [204, 15], "./bs": [205, 16], "./bs.js": [205, 16], "./ca": [206, 17], "./ca.js": [206, 17], "./cs": [207, 18], "./cs.js": [207, 18], "./cv": [208, 19], "./cv.js": [208, 19], "./cy": [209, 20], "./cy.js": [209, 20], "./da": [210, 21], "./da.js": [210, 21], "./de": [213, 22], "./de-at": [211, 23], "./de-at.js": [211, 23], "./de-ch": [212, 24], "./de-ch.js": [212, 24], "./de.js": [213, 22], "./dv": [214, 25], "./dv.js": [214, 25], "./el": [215, 26], "./el.js": [215, 26], "./en": [225, 27], "./en-SG": [216, 28], "./en-SG.js": [216, 28], "./en-au": [217, 29], "./en-au.js": [217, 29], "./en-ca": [218, 30], "./en-ca.js": [218, 30], "./en-gb": [219, 31], "./en-gb.js": [219, 31], "./en-ie": [220, 32], "./en-ie.js": [220, 32], "./en-il": [221, 33], "./en-il.js": [221, 33], "./en-in": [222, 34], "./en-in.js": [222, 34], "./en-nz": [223, 35], "./en-nz.js": [223, 35], "./en-tt": [224, 36], "./en-tt.js": [224, 36], "./en.js": [225, 27], "./eo": [226, 37], "./eo.js": [226, 37], "./es": [230, 38], "./es-do": [227, 39], "./es-do.js": [227, 39], "./es-pr": [228, 40], "./es-pr.js": [228, 40], "./es-us": [229, 41], "./es-us.js": [229, 41], "./es.js": [230, 38], "./et": [231, 42], "./et.js": [231, 42], "./eu": [232, 43], "./eu.js": [232, 43], "./fa": [233, 44], "./fa.js": [233, 44], "./fi": [234, 45], "./fi.js": [234, 45], "./fo": [235, 46], "./fo.js": [235, 46], "./fr": [238, 47], "./fr-ca": [236, 48], "./fr-ca.js": [236, 48], "./fr-ch": [237, 49], "./fr-ch.js": [237, 49], "./fr.js": [238, 47], "./fy": [239, 50], "./fy.js": [239, 50], "./ga": [240, 51], "./ga.js": [240, 51], "./gd": [241, 52], "./gd.js": [241, 52], "./gl": [242, 53], "./gl.js": [242, 53], "./gom-latn": [243, 54], "./gom-latn.js": [243, 54], "./gu": [244, 55], "./gu.js": [244, 55], "./he": [245, 56], "./he.js": [245, 56], "./hi": [246, 57], "./hi.js": [246, 57], "./hr": [247, 58], "./hr.js": [247, 58], "./ht": [248, 59], "./ht.js": [248, 59], "./hu": [249, 60], "./hu.js": [249, 60], "./hy-am": [250, 61], "./hy-am.js": [250, 61], "./id": [251, 62], "./id.js": [251, 62], "./index.d.ts": [544, 145], "./is": [252, 63], "./is.js": [252, 63], "./it": [254, 64], "./it-ch": [253, 65], "./it-ch.js": [253, 65], "./it.js": [254, 64], "./ja": [255, 66], "./ja.js": [255, 66], "./jv": [256, 67], "./jv.js": [256, 67], "./ka": [257, 68], "./ka.js": [257, 68], "./kk": [258, 69], "./kk.js": [258, 69], "./km": [259, 70], "./km.js": [259, 70], "./kn": [260, 71], "./kn.js": [260, 71], "./ko": [261, 72], "./ko.js": [261, 72], "./ku": [262, 73], "./ku.js": [262, 73], "./ky": [263, 74], "./ky.js": [263, 74], "./lb": [264, 75], "./lb.js": [264, 75], "./lo": [265, 76], "./lo.js": [265, 76], "./lt": [266, 77], "./lt.js": [266, 77], "./lv": [267, 78], "./lv.js": [267, 78], "./me": [268, 79], "./me.js": [268, 79], "./mi": [269, 80], "./mi.js": [269, 80], "./mk": [270, 81], "./mk.js": [270, 81], "./ml": [271, 82], "./ml.js": [271, 82], "./mn": [272, 83], "./mn.js": [272, 83], "./mr": [273, 84], "./mr.js": [273, 84], "./ms": [275, 85], "./ms-my": [274, 86], "./ms-my.js": [274, 86], "./ms.js": [275, 85], "./mt": [276, 87], "./mt.js": [276, 87], "./my": [277, 88], "./my.js": [277, 88], "./nb": [278, 89], "./nb.js": [278, 89], "./ne": [279, 90], "./ne.js": [279, 90], "./nl": [281, 91], "./nl-be": [280, 92], "./nl-be.js": [280, 92], "./nl.js": [281, 91], "./nn": [282, 93], "./nn.js": [282, 93], "./oc-lnc": [283, 94], "./oc-lnc.js": [283, 94], "./pa-in": [284, 95], "./pa-in.js": [284, 95], "./pl": [285, 96], "./pl.js": [285, 96], "./pt": [287, 97], "./pt-br": [286, 98], "./pt-br.js": [286, 98], "./pt.js": [287, 97], "./ro": [288, 99], "./ro.js": [288, 99], "./ru": [289, 100], "./ru.js": [289, 100], "./rw": [290, 101], "./rw.js": [290, 101], "./sd": [291, 102], "./sd.js": [291, 102], "./se": [292, 103], "./se.js": [292, 103], "./si": [293, 104], "./si.js": [293, 104], "./sk": [294, 105], "./sk.js": [294, 105], "./sl": [295, 106], "./sl.js": [295, 106], "./sq": [296, 107], "./sq.js": [296, 107], "./sr": [298, 108], "./sr-cyrl": [297, 109], "./sr-cyrl.js": [297, 109], "./sr.js": [298, 108], "./ss": [299, 110], "./ss.js": [299, 110], "./sv": [300, 111], "./sv.js": [300, 111], "./sw": [301, 112], "./sw.js": [301, 112], "./ta": [302, 113], "./ta.js": [302, 113], "./te": [303, 114], "./te.js": [303, 114], "./tet": [304, 115], "./tet.js": [304, 115], "./tg": [305, 116], "./tg.js": [305, 116], "./th": [306, 117], "./th.js": [306, 117], "./tk": [307, 118], "./tk.js": [307, 118], "./tl-ph": [308, 119], "./tl-ph.js": [308, 119], "./tlh": [309, 120], "./tlh.js": [309, 120], "./tr": [310, 121], "./tr.js": [310, 121], "./types.d.ts": [545, 146], "./tzl": [311, 122], "./tzl.js": [311, 122], "./tzm": [313, 123], "./tzm-latn": [312, 124], "./tzm-latn.js": [312, 124], "./tzm.js": [313, 123], "./ug-cn": [314, 125], "./ug-cn.js": [314, 125], "./uk": [315, 126], "./uk.js": [315, 126], "./ur": [316, 127], "./ur.js": [316, 127], "./uz": [318, 128], "./uz-latn": [317, 129], "./uz-latn.js": [317, 129], "./uz.js": [318, 128], "./vi": [319, 130], "./vi.js": [319, 130], "./x-pseudo": [320, 131], "./x-pseudo.js": [320, 131], "./yo": [321, 132], "./yo.js": [321, 132], "./zh": [325, 133], "./zh-cn": [322, 134], "./zh-cn.js": [322, 134], "./zh-hk": [323, 135], "./zh-hk.js": [323, 135], "./zh-tw": [324, 136], "./zh-tw.js": [324, 136], "./zh.js": [325, 133]}; + function i(e2) { + if (!n.o(r, e2)) + return Promise.resolve().then(function() { + var t3 = new Error("Cannot find module '" + e2 + "'"); + throw t3.code = "MODULE_NOT_FOUND", t3; + }); + var t2 = r[e2], i2 = t2[0]; + return n.e(t2[1]).then(function() { + return n.t(i2, 7); + }); + } + i.keys = function() { + return Object.keys(r); + }, i.id = 495, e.exports = i; + }, function(e, t, n) { + var r = n(497)({"&": "&", "<": "<", ">": ">", '"': """, "'": "'"}); + e.exports = r; + }, function(e, t) { + e.exports = function(e2) { + return function(t2) { + return e2 == null ? void 0 : e2[t2]; + }; + }; + }, function(e, t, n) { + var r = n(9), i = n(2); + i.d.Request = class { + constructor(e2, t2, n2, r2) { + this.id = ++i.d._requestId, this.xmlData = e2, this.data = i.d.serialize(e2), this.origFunc = t2, this.func = t2, this.rid = n2, this.date = NaN, this.sends = r2 || 0, this.abort = false, this.dead = null, this.age = function() { + if (!this.date) + return 0; + return (new Date() - this.date) / 1e3; + }, this.timeDead = function() { + if (!this.dead) + return 0; + return (new Date() - this.dead) / 1e3; + }, this.xhr = this._newXHR(); + } + getResponse() { + let e2 = null; + if (this.xhr.responseXML && this.xhr.responseXML.documentElement) { + if (e2 = this.xhr.responseXML.documentElement, e2.tagName === "parsererror") + throw i.d.error("invalid response received"), i.d.error("responseText: " + this.xhr.responseText), i.d.error("responseXML: " + i.d.serialize(this.xhr.responseXML)), new Error("parsererror"); + } else if (this.xhr.responseText) { + if (i.d.debug("Got responseText but no responseXML; attempting to parse it with DOMParser..."), e2 = new r.a().parseFromString(this.xhr.responseText, "application/xml").documentElement, !e2) + throw new Error("Parsing produced null node"); + if (e2.querySelector("parsererror")) { + i.d.error("invalid response received: " + e2.querySelector("parsererror").textContent), i.d.error("responseText: " + this.xhr.responseText); + const t2 = new Error(); + throw t2.name = i.d.ErrorCondition.BAD_FORMAT, t2; + } + } + return e2; + } + _newXHR() { + let e2 = null; + return window.XMLHttpRequest ? (e2 = new XMLHttpRequest(), e2.overrideMimeType && e2.overrideMimeType("text/xml; charset=utf-8")) : window.ActiveXObject && (e2 = new ActiveXObject("Microsoft.XMLHTTP")), e2.onreadystatechange = this.func.bind(null, this), e2; + } + }, i.d.Bosh = class e2 { + constructor(e3) { + this._conn = e3, this.rid = Math.floor(4294967295 * Math.random()), this.sid = null, this.hold = 1, this.wait = 60, this.window = 5, this.errors = 0, this.inactivity = null, this.lastResponseHeaders = null, this._requests = []; + } + _buildBody() { + const e3 = Object(i.a)("body", {rid: this.rid++, xmlns: i.d.NS.HTTPBIND}); + return this.sid !== null && e3.attrs({sid: this.sid}), this._conn.options.keepalive && this._conn._sessionCachingSupported() && this._cacheSession(), e3; + } + _reset() { + this.rid = Math.floor(4294967295 * Math.random()), this.sid = null, this.errors = 0, this._conn._sessionCachingSupported() && window.sessionStorage.removeItem("strophe-bosh-session"), this._conn.nextValidRid(this.rid); + } + _connect(e3, t2, n2) { + this.wait = e3 || this.wait, this.hold = t2 || this.hold, this.errors = 0; + const r2 = this._buildBody().attrs({to: this._conn.domain, "xml:lang": "en", wait: this.wait, hold: this.hold, content: "text/xml; charset=utf-8", ver: "1.6", "xmpp:version": "1.0", "xmlns:xmpp": i.d.NS.BOSH}); + n2 && r2.attrs({route: n2}); + const o = this._conn._connect_cb; + this._requests.push(new i.d.Request(r2.tree(), this._onRequestStateChange.bind(this, o.bind(this._conn)), r2.tree().getAttribute("rid"))), this._throttledRequestHandler(); + } + _attach(e3, t2, n2, r2, o, s, a) { + this._conn.jid = e3, this.sid = t2, this.rid = n2, this._conn.connect_callback = r2, this._conn.domain = i.d.getDomainFromJid(this._conn.jid), this._conn.authenticated = true, this._conn.connected = true, this.wait = o || this.wait, this.hold = s || this.hold, this.window = a || this.window, this._conn._changeConnectStatus(i.d.Status.ATTACHED, null); + } + _restore(e3, t2, n2, r2, o) { + const s = JSON.parse(window.sessionStorage.getItem("strophe-bosh-session")); + if (!(s != null && s.rid && s.sid && s.jid && (e3 == null || i.d.getBareJidFromJid(s.jid) === i.d.getBareJidFromJid(e3) || i.d.getNodeFromJid(e3) === null && i.d.getDomainFromJid(s.jid) === e3))) { + const e4 = new Error("_restore: no restoreable session."); + throw e4.name = "StropheSessionError", e4; + } + this._conn.restored = true, this._attach(s.jid, s.sid, s.rid, t2, n2, r2, o); + } + _cacheSession() { + this._conn.authenticated ? this._conn.jid && this.rid && this.sid && window.sessionStorage.setItem("strophe-bosh-session", JSON.stringify({jid: this._conn.jid, rid: this.rid, sid: this.sid})) : window.sessionStorage.removeItem("strophe-bosh-session"); + } + _connect_cb(e3) { + const t2 = e3.getAttribute("type"); + if (t2 !== null && t2 === "terminate") { + let t3 = e3.getAttribute("condition"); + i.d.error("BOSH-Connection failed: " + t3); + const n3 = e3.getElementsByTagName("conflict"); + return t3 !== null ? (t3 === "remote-stream-error" && n3.length > 0 && (t3 = "conflict"), this._conn._changeConnectStatus(i.d.Status.CONNFAIL, t3)) : this._conn._changeConnectStatus(i.d.Status.CONNFAIL, "unknown"), this._conn._doDisconnect(t3), i.d.Status.CONNFAIL; + } + this.sid || (this.sid = e3.getAttribute("sid")); + const n2 = e3.getAttribute("requests"); + n2 && (this.window = parseInt(n2, 10)); + const r2 = e3.getAttribute("hold"); + r2 && (this.hold = parseInt(r2, 10)); + const o = e3.getAttribute("wait"); + o && (this.wait = parseInt(o, 10)); + const s = e3.getAttribute("inactivity"); + s && (this.inactivity = parseInt(s, 10)); + } + _disconnect(e3) { + this._sendTerminate(e3); + } + _doDisconnect() { + this.sid = null, this.rid = Math.floor(4294967295 * Math.random()), this._conn._sessionCachingSupported() && window.sessionStorage.removeItem("strophe-bosh-session"), this._conn.nextValidRid(this.rid); + } + _emptyQueue() { + return this._requests.length === 0; + } + _callProtocolErrorHandlers(t2) { + const n2 = e2._getRequestStatus(t2), r2 = this._conn.protocolErrorHandlers.HTTP[n2]; + r2 && r2.call(this, n2); + } + _hitError(e3) { + this.errors++, i.d.warn("request errored, status: " + e3 + ", number of errors: " + this.errors), this.errors > 4 && this._conn._onDisconnectTimeout(); + } + _no_auth_received(e3) { + i.d.warn("Server did not yet offer a supported authentication mechanism. Sending a blank poll request."), e3 = e3 ? e3.bind(this._conn) : this._conn._connect_cb.bind(this._conn); + const t2 = this._buildBody(); + this._requests.push(new i.d.Request(t2.tree(), this._onRequestStateChange.bind(this, e3), t2.tree().getAttribute("rid"))), this._throttledRequestHandler(); + } + _onDisconnectTimeout() { + this._abortAllRequests(); + } + _abortAllRequests() { + for (; this._requests.length > 0; ) { + const e3 = this._requests.pop(); + e3.abort = true, e3.xhr.abort(), e3.xhr.onreadystatechange = function() { + }; + } + } + _onIdle() { + const e3 = this._conn._data; + if (this._conn.authenticated && this._requests.length === 0 && e3.length === 0 && !this._conn.disconnecting && (i.d.debug("no requests during idle cycle, sending blank request"), e3.push(null)), !this._conn.paused) { + if (this._requests.length < 2 && e3.length > 0) { + const t2 = this._buildBody(); + for (let n2 = 0; n2 < e3.length; n2++) + e3[n2] !== null && (e3[n2] === "restart" ? t2.attrs({to: this._conn.domain, "xml:lang": "en", "xmpp:restart": "true", "xmlns:xmpp": i.d.NS.BOSH}) : t2.cnode(e3[n2]).up()); + delete this._conn._data, this._conn._data = [], this._requests.push(new i.d.Request(t2.tree(), this._onRequestStateChange.bind(this, this._conn._dataRecv.bind(this._conn)), t2.tree().getAttribute("rid"))), this._throttledRequestHandler(); + } + if (this._requests.length > 0) { + const e4 = this._requests[0].age(); + this._requests[0].dead !== null && this._requests[0].timeDead() > Math.floor(i.d.SECONDARY_TIMEOUT * this.wait) && this._throttledRequestHandler(), e4 > Math.floor(i.d.TIMEOUT * this.wait) && (i.d.warn("Request " + this._requests[0].id + " timed out, over " + Math.floor(i.d.TIMEOUT * this.wait) + " seconds since last activity"), this._throttledRequestHandler()); + } + } + } + static _getRequestStatus(e3, t2) { + let n2; + if (e3.xhr.readyState === 4) + try { + n2 = e3.xhr.status; + } catch (e4) { + i.d.error("Caught an error while retrieving a request's status, reqStatus: " + n2); + } + return n2 === void 0 && (n2 = typeof t2 == "number" ? t2 : 0), n2; + } + _onRequestStateChange(t2, n2) { + if (i.d.debug("request id " + n2.id + "." + n2.sends + " state changed to " + n2.xhr.readyState), n2.abort) + return void (n2.abort = false); + if (n2.xhr.readyState !== 4) + return; + const r2 = e2._getRequestStatus(n2); + if (this.lastResponseHeaders = n2.xhr.getAllResponseHeaders(), this._conn.disconnecting && r2 >= 400) + return this._hitError(r2), void this._callProtocolErrorHandlers(n2); + const o = r2 > 0 && r2 < 500, s = n2.sends > this._conn.maxRetries; + if ((o || s) && (this._removeRequest(n2), i.d.debug("request id " + n2.id + " should now be removed")), r2 === 200) { + const e3 = this._requests[0] === n2; + (this._requests[1] === n2 || e3 && this._requests.length > 0 && this._requests[0].age() > Math.floor(i.d.SECONDARY_TIMEOUT * this.wait)) && this._restartRequest(0), this._conn.nextValidRid(Number(n2.rid) + 1), i.d.debug("request id " + n2.id + "." + n2.sends + " got 200"), t2(n2), this.errors = 0; + } else + r2 === 0 || r2 >= 400 && r2 < 600 || r2 >= 12e3 ? (i.d.error("request id " + n2.id + "." + n2.sends + " error " + r2 + " happened"), this._hitError(r2), this._callProtocolErrorHandlers(n2), r2 >= 400 && r2 < 500 && (this._conn._changeConnectStatus(i.d.Status.DISCONNECTING, null), this._conn._doDisconnect())) : i.d.error("request id " + n2.id + "." + n2.sends + " error " + r2 + " happened"); + o || s ? s && !this._conn.connected && this._conn._changeConnectStatus(i.d.Status.CONNFAIL, "giving-up") : this._throttledRequestHandler(); + } + _processRequest(t2) { + let n2 = this._requests[t2]; + const r2 = e2._getRequestStatus(n2, -1); + if (n2.sends > this._conn.maxRetries) + return void this._conn._onDisconnectTimeout(); + const o = n2.age(), s = !isNaN(o) && o > Math.floor(i.d.TIMEOUT * this.wait), a = n2.dead !== null && n2.timeDead() > Math.floor(i.d.SECONDARY_TIMEOUT * this.wait), c = n2.xhr.readyState === 4 && (r2 < 1 || r2 >= 500); + if ((s || a || c) && (a && i.d.error("Request ".concat(this._requests[t2].id, " timed out (secondary), restarting")), n2.abort = true, n2.xhr.abort(), n2.xhr.onreadystatechange = function() { + }, this._requests[t2] = new i.d.Request(n2.xmlData, n2.origFunc, n2.rid, n2.sends), n2 = this._requests[t2]), n2.xhr.readyState === 0) { + i.d.debug("request id " + n2.id + "." + n2.sends + " posting"); + try { + const e4 = this._conn.options.contentType || "text/xml; charset=utf-8"; + n2.xhr.open("POST", this._conn.service, !this._conn.options.sync), n2.xhr.setRequestHeader !== void 0 && n2.xhr.setRequestHeader("Content-Type", e4), this._conn.options.withCredentials && (n2.xhr.withCredentials = true); + } catch (e4) { + return i.d.error("XHR open failed: " + e4.toString()), this._conn.connected || this._conn._changeConnectStatus(i.d.Status.CONNFAIL, "bad-service"), void this._conn.disconnect(); + } + const e3 = () => { + if (n2.date = new Date(), this._conn.options.customHeaders) { + const e4 = this._conn.options.customHeaders; + for (const t3 in e4) + Object.prototype.hasOwnProperty.call(e4, t3) && n2.xhr.setRequestHeader(t3, e4[t3]); + } + n2.xhr.send(n2.data); + }; + if (n2.sends > 1) { + const t3 = 1e3 * Math.min(Math.floor(i.d.TIMEOUT * this.wait), Math.pow(n2.sends, 3)); + setTimeout(function() { + e3(); + }, t3); + } else + e3(); + n2.sends++, this._conn.xmlOutput !== i.d.Connection.prototype.xmlOutput && (n2.xmlData.nodeName === this.strip && n2.xmlData.childNodes.length ? this._conn.xmlOutput(n2.xmlData.childNodes[0]) : this._conn.xmlOutput(n2.xmlData)), this._conn.rawOutput !== i.d.Connection.prototype.rawOutput && this._conn.rawOutput(n2.data); + } else + i.d.debug("_processRequest: " + (t2 === 0 ? "first" : "second") + " request has readyState of " + n2.xhr.readyState); + } + _removeRequest(e3) { + i.d.debug("removing request"); + for (let t2 = this._requests.length - 1; t2 >= 0; t2--) + e3 === this._requests[t2] && this._requests.splice(t2, 1); + e3.xhr.onreadystatechange = function() { + }, this._throttledRequestHandler(); + } + _restartRequest(e3) { + const t2 = this._requests[e3]; + t2.dead === null && (t2.dead = new Date()), this._processRequest(e3); + } + _reqToData(e3) { + try { + return e3.getResponse(); + } catch (e4) { + if (e4.message !== "parsererror") + throw e4; + this._conn.disconnect("strophe-parsererror"); + } + } + _sendTerminate(e3) { + i.d.debug("_sendTerminate was called"); + const t2 = this._buildBody().attrs({type: "terminate"}); + e3 && t2.cnode(e3.tree()); + const n2 = new i.d.Request(t2.tree(), this._onRequestStateChange.bind(this, this._conn._dataRecv.bind(this._conn)), t2.tree().getAttribute("rid")); + this._requests.push(n2), this._throttledRequestHandler(); + } + _send() { + clearTimeout(this._conn._idleTimeout), this._throttledRequestHandler(), this._conn._idleTimeout = setTimeout(() => this._conn._onIdle(), 100); + } + _sendRestart() { + this._throttledRequestHandler(), clearTimeout(this._conn._idleTimeout); + } + _throttledRequestHandler() { + this._requests ? i.d.debug("_throttledRequestHandler called with " + this._requests.length + " requests") : i.d.debug("_throttledRequestHandler called with undefined requests"), this._requests && this._requests.length !== 0 && (this._requests.length > 0 && this._processRequest(0), this._requests.length > 1 && Math.abs(this._requests[0].rid - this._requests[1].rid) < this.window && this._processRequest(1)); + } + }, i.d.Bosh.prototype.strip = null; + }, function(e, t, n) { + e.exports = function() { + throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object"); + }; + }, function(e, t, n) { + n(158); + var r = n(2); + const i = {}; + i.debug = r.d.LogLevel.DEBUG, i.info = r.d.LogLevel.INFO, i.warn = r.d.LogLevel.WARN, i.error = r.d.LogLevel.ERROR, i.fatal = r.d.LogLevel.FATAL, r.d.WorkerWebsocket = class extends r.d.Websocket { + constructor(e2) { + super(e2), this._conn = e2, this.worker = new SharedWorker(this._conn.options.worker, "Strophe XMPP Connection"), this.worker.onerror = (e3) => { + var t2; + (t2 = console) === null || t2 === void 0 || t2.error(e3), r.d.log(r.d.LogLevel.ERROR, "Shared Worker Error: ".concat(e3)); + }; + } + get socket() { + return {send: (e2) => this.worker.port.postMessage(["send", e2])}; + } + _connect() { + this._messageHandler = (e2) => this._onInitialMessage(e2), this.worker.port.start(), this.worker.port.onmessage = (e2) => this._onWorkerMessage(e2), this.worker.port.postMessage(["_connect", this._conn.service, this._conn.jid]); + } + _attach(e2) { + this._messageHandler = (e3) => this._onMessage(e3), this._conn.connect_callback = e2, this.worker.port.start(), this.worker.port.onmessage = (e3) => this._onWorkerMessage(e3), this.worker.port.postMessage(["_attach", this._conn.service]); + } + _attachCallback(e2, t2) { + e2 === r.d.Status.ATTACHED ? (this._conn.jid = t2, this._conn.authenticated = true, this._conn.connected = true, this._conn.restored = true, this._conn._changeConnectStatus(r.d.Status.ATTACHED)) : e2 === r.d.Status.ATTACHFAIL && (this._conn.authenticated = false, this._conn.connected = false, this._conn.restored = false, this._conn._changeConnectStatus(r.d.Status.ATTACHFAIL)); + } + _disconnect(e2, t2) { + t2 && this._conn.send(t2); + const n2 = Object(r.a)("close", {xmlns: r.d.NS.FRAMING}); + this._conn.xmlOutput(n2.tree()); + const i2 = r.d.serialize(n2); + this._conn.rawOutput(i2), this.worker.port.postMessage(["send", i2]), this._conn._doDisconnect(); + } + _onClose(e2) { + this._conn.connected && !this._conn.disconnecting ? (r.d.error("Websocket closed unexpectedly"), this._conn._doDisconnect()) : e2 && e2.code === 1006 && !this._conn.connected ? (r.d.error("Websocket closed unexcectedly"), this._conn._changeConnectStatus(r.d.Status.CONNFAIL, "The WebSocket connection could not be established or was disconnected."), this._conn._doDisconnect()) : r.d.debug("Websocket closed"); + } + _closeSocket() { + this.worker.port.postMessage(["_closeSocket"]); + } + _replaceMessageHandler() { + this._messageHandler = (e2) => this._onMessage(e2); + } + _onWorkerMessage(e2) { + const {data: t2} = e2, n2 = t2[0]; + if (n2 === "_onMessage") + this._messageHandler(t2[1]); + else if (n2 in this) + try { + this[n2].apply(this, e2.data.slice(1)); + } catch (e3) { + r.d.log(r.d.LogLevel.ERROR, e3); + } + else if (n2 === "log") { + const e3 = t2[1], n3 = t2[2]; + r.d.log(i[e3], n3); + } else + r.d.log(r.d.LogLevel.ERROR, "Found unhandled service worker message: ".concat(t2)); + } + }; + }, function(e, t, n) { + var r = n(502); + typeof r == "string" && (r = [[e.i, r, ""]]); + var i = {hmr: true, transform: void 0, insertInto: void 0}; + n(504)(r, i); + r.locals && (e.exports = r.locals); + }, function(e, t, n) { + (t = n(503)(true)).push([e.i, "", "", {version: 3, sources: [], names: [], mappings: "", file: "converse.scss"}]), e.exports = t; + }, function(e, t, n) { + e.exports = function(e2) { + var t2 = []; + return t2.toString = function() { + return this.map(function(t3) { + var n2 = function(e3, t4) { + var n3 = e3[1] || "", r = e3[3]; + if (!r) + return n3; + if (t4 && typeof btoa == "function") { + var i = (s = r, a = btoa(unescape(encodeURIComponent(JSON.stringify(s)))), c = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(a), "/*# ".concat(c, " */")), o = r.sources.map(function(e4) { + return "/*# sourceURL=".concat(r.sourceRoot || "").concat(e4, " */"); + }); + return [n3].concat(o).concat([i]).join("\n"); + } + var s, a, c; + return [n3].join("\n"); + }(t3, e2); + return t3[2] ? "@media ".concat(t3[2], " {").concat(n2, "}") : n2; + }).join(""); + }, t2.i = function(e3, n2, r) { + typeof e3 == "string" && (e3 = [[null, e3, ""]]); + var i = {}; + if (r) + for (var o = 0; o < this.length; o++) { + var s = this[o][0]; + s != null && (i[s] = true); + } + for (var a = 0; a < e3.length; a++) { + var c = [].concat(e3[a]); + r && i[c[0]] || (n2 && (c[2] ? c[2] = "".concat(n2, " and ").concat(c[2]) : c[2] = n2), t2.push(c)); + } + }, t2; + }; + }, function(e, t, n) { + var r, i, o = {}, s = (r = function() { + return window && document && document.all && !window.atob; + }, function() { + return i === void 0 && (i = r.apply(this, arguments)), i; + }), a = function(e2, t2) { + return t2 ? t2.querySelector(e2) : document.querySelector(e2); + }, c = function(e2) { + var t2 = {}; + return function(e3, n2) { + if (typeof e3 == "function") + return e3(); + if (t2[e3] === void 0) { + var r2 = a.call(this, e3, n2); + if (window.HTMLIFrameElement && r2 instanceof window.HTMLIFrameElement) + try { + r2 = r2.contentDocument.head; + } catch (e4) { + r2 = null; + } + t2[e3] = r2; + } + return t2[e3]; + }; + }(), l = null, u = 0, d = [], h = n(505); + function f(e2, t2) { + for (var n2 = 0; n2 < e2.length; n2++) { + var r2 = e2[n2], i2 = o[r2.id]; + if (i2) { + i2.refs++; + for (var s2 = 0; s2 < i2.parts.length; s2++) + i2.parts[s2](r2.parts[s2]); + for (; s2 < r2.parts.length; s2++) + i2.parts.push(b(r2.parts[s2], t2)); + } else { + var a2 = []; + for (s2 = 0; s2 < r2.parts.length; s2++) + a2.push(b(r2.parts[s2], t2)); + o[r2.id] = {id: r2.id, refs: 1, parts: a2}; + } + } + } + function p(e2, t2) { + for (var n2 = [], r2 = {}, i2 = 0; i2 < e2.length; i2++) { + var o2 = e2[i2], s2 = t2.base ? o2[0] + t2.base : o2[0], a2 = {css: o2[1], media: o2[2], sourceMap: o2[3]}; + r2[s2] ? r2[s2].parts.push(a2) : n2.push(r2[s2] = {id: s2, parts: [a2]}); + } + return n2; + } + function g(e2, t2) { + var n2 = c(e2.insertInto); + if (!n2) + throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid."); + var r2 = d[d.length - 1]; + if (e2.insertAt === "top") + r2 ? r2.nextSibling ? n2.insertBefore(t2, r2.nextSibling) : n2.appendChild(t2) : n2.insertBefore(t2, n2.firstChild), d.push(t2); + else if (e2.insertAt === "bottom") + n2.appendChild(t2); + else { + if (typeof e2.insertAt != "object" || !e2.insertAt.before) + throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n"); + var i2 = c(e2.insertAt.before, n2); + n2.insertBefore(t2, i2); + } + } + function m(e2) { + if (e2.parentNode === null) + return false; + e2.parentNode.removeChild(e2); + var t2 = d.indexOf(e2); + t2 >= 0 && d.splice(t2, 1); + } + function v(e2) { + var t2 = document.createElement("style"); + if (e2.attrs.type === void 0 && (e2.attrs.type = "text/css"), e2.attrs.nonce === void 0) { + var r2 = function() { + return n.nc; + }(); + r2 && (e2.attrs.nonce = r2); + } + return _(t2, e2.attrs), g(e2, t2), t2; + } + function _(e2, t2) { + Object.keys(t2).forEach(function(n2) { + e2.setAttribute(n2, t2[n2]); + }); + } + function b(e2, t2) { + var n2, r2, i2, o2; + if (t2.transform && e2.css) { + if (!(o2 = typeof t2.transform == "function" ? t2.transform(e2.css) : t2.transform.default(e2.css))) + return function() { + }; + e2.css = o2; + } + if (t2.singleton) { + var s2 = u++; + n2 = l || (l = v(t2)), r2 = S.bind(null, n2, s2, false), i2 = S.bind(null, n2, s2, true); + } else + e2.sourceMap && typeof URL == "function" && typeof URL.createObjectURL == "function" && typeof URL.revokeObjectURL == "function" && typeof Blob == "function" && typeof btoa == "function" ? (n2 = function(e3) { + var t3 = document.createElement("link"); + return e3.attrs.type === void 0 && (e3.attrs.type = "text/css"), e3.attrs.rel = "stylesheet", _(t3, e3.attrs), g(e3, t3), t3; + }(t2), r2 = E.bind(null, n2, t2), i2 = function() { + m(n2), n2.href && URL.revokeObjectURL(n2.href); + }) : (n2 = v(t2), r2 = x.bind(null, n2), i2 = function() { + m(n2); + }); + return r2(e2), function(t3) { + if (t3) { + if (t3.css === e2.css && t3.media === e2.media && t3.sourceMap === e2.sourceMap) + return; + r2(e2 = t3); + } else + i2(); + }; + } + e.exports = function(e2, t2) { + if (typeof DEBUG != "undefined" && DEBUG && typeof document != "object") + throw new Error("The style-loader cannot be used in a non-browser environment"); + (t2 = t2 || {}).attrs = typeof t2.attrs == "object" ? t2.attrs : {}, t2.singleton || typeof t2.singleton == "boolean" || (t2.singleton = s()), t2.insertInto || (t2.insertInto = "head"), t2.insertAt || (t2.insertAt = "bottom"); + var n2 = p(e2, t2); + return f(n2, t2), function(e3) { + for (var r2 = [], i2 = 0; i2 < n2.length; i2++) { + var s2 = n2[i2]; + (a2 = o[s2.id]).refs--, r2.push(a2); + } + e3 && f(p(e3, t2), t2); + for (i2 = 0; i2 < r2.length; i2++) { + var a2; + if ((a2 = r2[i2]).refs === 0) { + for (var c2 = 0; c2 < a2.parts.length; c2++) + a2.parts[c2](); + delete o[a2.id]; + } + } + }; + }; + var y, w = (y = [], function(e2, t2) { + return y[e2] = t2, y.filter(Boolean).join("\n"); + }); + function S(e2, t2, n2, r2) { + var i2 = n2 ? "" : r2.css; + if (e2.styleSheet) + e2.styleSheet.cssText = w(t2, i2); + else { + var o2 = document.createTextNode(i2), s2 = e2.childNodes; + s2[t2] && e2.removeChild(s2[t2]), s2.length ? e2.insertBefore(o2, s2[t2]) : e2.appendChild(o2); + } + } + function x(e2, t2) { + var n2 = t2.css, r2 = t2.media; + if (r2 && e2.setAttribute("media", r2), e2.styleSheet) + e2.styleSheet.cssText = n2; + else { + for (; e2.firstChild; ) + e2.removeChild(e2.firstChild); + e2.appendChild(document.createTextNode(n2)); + } + } + function E(e2, t2, n2) { + var r2 = n2.css, i2 = n2.sourceMap, o2 = t2.convertToAbsoluteUrls === void 0 && i2; + (t2.convertToAbsoluteUrls || o2) && (r2 = h(r2)), i2 && (r2 += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(i2)))) + " */"); + var s2 = new Blob([r2], {type: "text/css"}), a2 = e2.href; + e2.href = URL.createObjectURL(s2), a2 && URL.revokeObjectURL(a2); + } + }, function(e, t) { + e.exports = function(e2) { + var t2 = typeof window != "undefined" && window.location; + if (!t2) + throw new Error("fixUrls requires window.location"); + if (!e2 || typeof e2 != "string") + return e2; + var n = t2.protocol + "//" + t2.host, r = n + t2.pathname.replace(/\/[^\/]*$/, "/"); + return e2.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(e3, t3) { + var i, o = t3.trim().replace(/^"(.*)"$/, function(e4, t4) { + return t4; + }).replace(/^'(.*)'$/, function(e4, t4) { + return t4; + }); + return /^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(o) ? e3 : (i = o.indexOf("//") === 0 ? o : o.indexOf("/") === 0 ? n + o : r + o.replace(/^\.\//, ""), "url(" + JSON.stringify(i) + ")"); + }); + }; + }, function(e, t, n) { + n.r(t); + var r = n(66), i = n.n(r), o = (n(327), n(68), n(22)); + var s = function() { + this.__data__ = [], this.size = 0; + }; + var a = function(e2, t2) { + return e2 === t2 || e2 != e2 && t2 != t2; + }; + var c = function(e2, t2) { + for (var n2 = e2.length; n2--; ) + if (a(e2[n2][0], t2)) + return n2; + return -1; + }, l = Array.prototype.splice; + var u = function(e2) { + var t2 = this.__data__, n2 = c(t2, e2); + return !(n2 < 0) && (n2 == t2.length - 1 ? t2.pop() : l.call(t2, n2, 1), --this.size, true); + }; + var d = function(e2) { + var t2 = this.__data__, n2 = c(t2, e2); + return n2 < 0 ? void 0 : t2[n2][1]; + }; + var h = function(e2) { + return c(this.__data__, e2) > -1; + }; + var f = function(e2, t2) { + var n2 = this.__data__, r2 = c(n2, e2); + return r2 < 0 ? (++this.size, n2.push([e2, t2])) : n2[r2][1] = t2, this; + }; + function p(e2) { + var t2 = -1, n2 = e2 == null ? 0 : e2.length; + for (this.clear(); ++t2 < n2; ) { + var r2 = e2[t2]; + this.set(r2[0], r2[1]); + } + } + p.prototype.clear = s, p.prototype.delete = u, p.prototype.get = d, p.prototype.has = h, p.prototype.set = f; + var g = p; + var m = function() { + this.__data__ = new g(), this.size = 0; + }; + var v = function(e2) { + var t2 = this.__data__, n2 = t2.delete(e2); + return this.size = t2.size, n2; + }; + var _ = function(e2) { + return this.__data__.get(e2); + }; + var b = function(e2) { + return this.__data__.has(e2); + }, y = n(6), w = y.a.Symbol, S = Object.prototype, x = S.hasOwnProperty, E = S.toString, A = w ? w.toStringTag : void 0; + var C = function(e2) { + var t2 = x.call(e2, A), n2 = e2[A]; + try { + e2[A] = void 0; + var r2 = true; + } catch (e3) { + } + var i2 = E.call(e2); + return r2 && (t2 ? e2[A] = n2 : delete e2[A]), i2; + }, j = Object.prototype.toString; + var T = function(e2) { + return j.call(e2); + }, O = w ? w.toStringTag : void 0; + var k = function(e2) { + return e2 == null ? e2 === void 0 ? "[object Undefined]" : "[object Null]" : O && O in Object(e2) ? C(e2) : T(e2); + }; + var N = function(e2) { + var t2 = typeof e2; + return e2 != null && (t2 == "object" || t2 == "function"); + }; + var I, M = function(e2) { + if (!N(e2)) + return false; + var t2 = k(e2); + return t2 == "[object Function]" || t2 == "[object GeneratorFunction]" || t2 == "[object AsyncFunction]" || t2 == "[object Proxy]"; + }, R = y.a["__core-js_shared__"], D = (I = /[^.]+$/.exec(R && R.keys && R.keys.IE_PROTO || "")) ? "Symbol(src)_1." + I : ""; + var P = function(e2) { + return !!D && D in e2; + }, L = Function.prototype.toString; + var z = function(e2) { + if (e2 != null) { + try { + return L.call(e2); + } catch (e3) { + } + try { + return e2 + ""; + } catch (e3) { + } + } + return ""; + }, F = /^\[object .+?Constructor\]$/, B = Function.prototype, q = Object.prototype, H = B.toString, U = q.hasOwnProperty, $ = RegExp("^" + H.call(U).replace(/[\\^$.*+?()[\]{}|]/g, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"); + var W = function(e2) { + return !(!N(e2) || P(e2)) && (M(e2) ? $ : F).test(z(e2)); + }; + var G = function(e2, t2) { + return e2 == null ? void 0 : e2[t2]; + }; + var V = function(e2, t2) { + var n2 = G(e2, t2); + return W(n2) ? n2 : void 0; + }, J = V(y.a, "Map"), X = V(Object, "create"); + var Q = function() { + this.__data__ = X ? X(null) : {}, this.size = 0; + }; + var Y = function(e2) { + var t2 = this.has(e2) && delete this.__data__[e2]; + return this.size -= t2 ? 1 : 0, t2; + }, K = Object.prototype.hasOwnProperty; + var Z = function(e2) { + var t2 = this.__data__; + if (X) { + var n2 = t2[e2]; + return n2 === "__lodash_hash_undefined__" ? void 0 : n2; + } + return K.call(t2, e2) ? t2[e2] : void 0; + }, ee = Object.prototype.hasOwnProperty; + var te = function(e2) { + var t2 = this.__data__; + return X ? t2[e2] !== void 0 : ee.call(t2, e2); + }; + var ne = function(e2, t2) { + var n2 = this.__data__; + return this.size += this.has(e2) ? 0 : 1, n2[e2] = X && t2 === void 0 ? "__lodash_hash_undefined__" : t2, this; + }; + function re(e2) { + var t2 = -1, n2 = e2 == null ? 0 : e2.length; + for (this.clear(); ++t2 < n2; ) { + var r2 = e2[t2]; + this.set(r2[0], r2[1]); + } + } + re.prototype.clear = Q, re.prototype.delete = Y, re.prototype.get = Z, re.prototype.has = te, re.prototype.set = ne; + var ie = re; + var oe = function() { + this.size = 0, this.__data__ = {hash: new ie(), map: new (J || g)(), string: new ie()}; + }; + var se = function(e2) { + var t2 = typeof e2; + return t2 == "string" || t2 == "number" || t2 == "symbol" || t2 == "boolean" ? e2 !== "__proto__" : e2 === null; + }; + var ae = function(e2, t2) { + var n2 = e2.__data__; + return se(t2) ? n2[typeof t2 == "string" ? "string" : "hash"] : n2.map; + }; + var ce = function(e2) { + var t2 = ae(this, e2).delete(e2); + return this.size -= t2 ? 1 : 0, t2; + }; + var le = function(e2) { + return ae(this, e2).get(e2); + }; + var ue = function(e2) { + return ae(this, e2).has(e2); + }; + var de = function(e2, t2) { + var n2 = ae(this, e2), r2 = n2.size; + return n2.set(e2, t2), this.size += n2.size == r2 ? 0 : 1, this; + }; + function he(e2) { + var t2 = -1, n2 = e2 == null ? 0 : e2.length; + for (this.clear(); ++t2 < n2; ) { + var r2 = e2[t2]; + this.set(r2[0], r2[1]); + } + } + he.prototype.clear = oe, he.prototype.delete = ce, he.prototype.get = le, he.prototype.has = ue, he.prototype.set = de; + var fe = he; + var pe = function(e2, t2) { + var n2 = this.__data__; + if (n2 instanceof g) { + var r2 = n2.__data__; + if (!J || r2.length < 199) + return r2.push([e2, t2]), this.size = ++n2.size, this; + n2 = this.__data__ = new fe(r2); + } + return n2.set(e2, t2), this.size = n2.size, this; + }; + function ge(e2) { + var t2 = this.__data__ = new g(e2); + this.size = t2.size; + } + ge.prototype.clear = m, ge.prototype.delete = v, ge.prototype.get = _, ge.prototype.has = b, ge.prototype.set = pe; + var me = ge; + var ve = function(e2, t2) { + for (var n2 = -1, r2 = e2 == null ? 0 : e2.length; ++n2 < r2 && t2(e2[n2], n2, e2) !== false; ) + ; + return e2; + }, _e = function() { + try { + var e2 = V(Object, "defineProperty"); + return e2({}, "", {}), e2; + } catch (e3) { + } + }(); + var be = function(e2, t2, n2) { + t2 == "__proto__" && _e ? _e(e2, t2, {configurable: true, enumerable: true, value: n2, writable: true}) : e2[t2] = n2; + }, ye = Object.prototype.hasOwnProperty; + var we = function(e2, t2, n2) { + var r2 = e2[t2]; + ye.call(e2, t2) && a(r2, n2) && (n2 !== void 0 || t2 in e2) || be(e2, t2, n2); + }; + var Se = function(e2, t2, n2, r2) { + var i2 = !n2; + n2 || (n2 = {}); + for (var o2 = -1, s2 = t2.length; ++o2 < s2; ) { + var a2 = t2[o2], c2 = r2 ? r2(n2[a2], e2[a2], a2, n2, e2) : void 0; + c2 === void 0 && (c2 = e2[a2]), i2 ? be(n2, a2, c2) : we(n2, a2, c2); + } + return n2; + }; + var xe = function(e2, t2) { + for (var n2 = -1, r2 = Array(e2); ++n2 < e2; ) + r2[n2] = t2(n2); + return r2; + }; + var Ee = function(e2) { + return e2 != null && typeof e2 == "object"; + }; + var Ae = function(e2) { + return Ee(e2) && k(e2) == "[object Arguments]"; + }, Ce = Object.prototype, je = Ce.hasOwnProperty, Te = Ce.propertyIsEnumerable, Oe = Ae(function() { + return arguments; + }()) ? Ae : function(e2) { + return Ee(e2) && je.call(e2, "callee") && !Te.call(e2, "callee"); + }, ke = Array.isArray, Ne = n(21), Ie = /^(?:0|[1-9]\d*)$/; + var Me = function(e2, t2) { + var n2 = typeof e2; + return !!(t2 = t2 == null ? 9007199254740991 : t2) && (n2 == "number" || n2 != "symbol" && Ie.test(e2)) && e2 > -1 && e2 % 1 == 0 && e2 < t2; + }; + var Re = function(e2) { + return typeof e2 == "number" && e2 > -1 && e2 % 1 == 0 && e2 <= 9007199254740991; + }, De = {}; + De["[object Float32Array]"] = De["[object Float64Array]"] = De["[object Int8Array]"] = De["[object Int16Array]"] = De["[object Int32Array]"] = De["[object Uint8Array]"] = De["[object Uint8ClampedArray]"] = De["[object Uint16Array]"] = De["[object Uint32Array]"] = true, De["[object Arguments]"] = De["[object Array]"] = De["[object ArrayBuffer]"] = De["[object Boolean]"] = De["[object DataView]"] = De["[object Date]"] = De["[object Error]"] = De["[object Function]"] = De["[object Map]"] = De["[object Number]"] = De["[object Object]"] = De["[object RegExp]"] = De["[object Set]"] = De["[object String]"] = De["[object WeakMap]"] = false; + var Pe = function(e2) { + return Ee(e2) && Re(e2.length) && !!De[k(e2)]; + }; + var Le = function(e2) { + return function(t2) { + return e2(t2); + }; + }, ze = n(14), Fe = ze.a && ze.a.isTypedArray, Be = Fe ? Le(Fe) : Pe, qe = Object.prototype.hasOwnProperty; + var He = function(e2, t2) { + var n2 = ke(e2), r2 = !n2 && Oe(e2), i2 = !n2 && !r2 && Object(Ne.a)(e2), o2 = !n2 && !r2 && !i2 && Be(e2), s2 = n2 || r2 || i2 || o2, a2 = s2 ? xe(e2.length, String) : [], c2 = a2.length; + for (var l2 in e2) + !t2 && !qe.call(e2, l2) || s2 && (l2 == "length" || i2 && (l2 == "offset" || l2 == "parent") || o2 && (l2 == "buffer" || l2 == "byteLength" || l2 == "byteOffset") || Me(l2, c2)) || a2.push(l2); + return a2; + }, Ue = Object.prototype; + var $e = function(e2) { + var t2 = e2 && e2.constructor; + return e2 === (typeof t2 == "function" && t2.prototype || Ue); + }; + var We = function(e2, t2) { + return function(n2) { + return e2(t2(n2)); + }; + }, Ge = We(Object.keys, Object), Ve = Object.prototype.hasOwnProperty; + var Je = function(e2) { + if (!$e(e2)) + return Ge(e2); + var t2 = []; + for (var n2 in Object(e2)) + Ve.call(e2, n2) && n2 != "constructor" && t2.push(n2); + return t2; + }; + var Xe = function(e2) { + return e2 != null && Re(e2.length) && !M(e2); + }; + var Qe = function(e2) { + return Xe(e2) ? He(e2) : Je(e2); + }; + var Ye = function(e2, t2) { + return e2 && Se(t2, Qe(t2), e2); + }; + var Ke = function(e2) { + var t2 = []; + if (e2 != null) + for (var n2 in Object(e2)) + t2.push(n2); + return t2; + }, Ze = Object.prototype.hasOwnProperty; + var et = function(e2) { + if (!N(e2)) + return Ke(e2); + var t2 = $e(e2), n2 = []; + for (var r2 in e2) + (r2 != "constructor" || !t2 && Ze.call(e2, r2)) && n2.push(r2); + return n2; + }; + var tt = function(e2) { + return Xe(e2) ? He(e2, true) : et(e2); + }; + var nt = function(e2, t2) { + return e2 && Se(t2, tt(t2), e2); + }, rt = n(160); + var it = function(e2, t2) { + var n2 = -1, r2 = e2.length; + for (t2 || (t2 = Array(r2)); ++n2 < r2; ) + t2[n2] = e2[n2]; + return t2; + }; + var ot = function(e2, t2) { + for (var n2 = -1, r2 = e2 == null ? 0 : e2.length, i2 = 0, o2 = []; ++n2 < r2; ) { + var s2 = e2[n2]; + t2(s2, n2, e2) && (o2[i2++] = s2); + } + return o2; + }; + var st = function() { + return []; + }, at = Object.prototype.propertyIsEnumerable, ct = Object.getOwnPropertySymbols, lt = ct ? function(e2) { + return e2 == null ? [] : (e2 = Object(e2), ot(ct(e2), function(t2) { + return at.call(e2, t2); + })); + } : st; + var ut = function(e2, t2) { + return Se(e2, lt(e2), t2); + }; + var dt = function(e2, t2) { + for (var n2 = -1, r2 = t2.length, i2 = e2.length; ++n2 < r2; ) + e2[i2 + n2] = t2[n2]; + return e2; + }, ht = We(Object.getPrototypeOf, Object), ft = Object.getOwnPropertySymbols ? function(e2) { + for (var t2 = []; e2; ) + dt(t2, lt(e2)), e2 = ht(e2); + return t2; + } : st; + var pt = function(e2, t2) { + return Se(e2, ft(e2), t2); + }; + var gt = function(e2, t2, n2) { + var r2 = t2(e2); + return ke(e2) ? r2 : dt(r2, n2(e2)); + }; + var mt = function(e2) { + return gt(e2, Qe, lt); + }; + var vt = function(e2) { + return gt(e2, tt, ft); + }, _t = V(y.a, "DataView"), bt = V(y.a, "Promise"), yt = V(y.a, "Set"), wt = V(y.a, "WeakMap"), St = z(_t), xt = z(J), Et = z(bt), At = z(yt), Ct = z(wt), jt = k; + (_t && jt(new _t(new ArrayBuffer(1))) != "[object DataView]" || J && jt(new J()) != "[object Map]" || bt && jt(bt.resolve()) != "[object Promise]" || yt && jt(new yt()) != "[object Set]" || wt && jt(new wt()) != "[object WeakMap]") && (jt = function(e2) { + var t2 = k(e2), n2 = t2 == "[object Object]" ? e2.constructor : void 0, r2 = n2 ? z(n2) : ""; + if (r2) + switch (r2) { + case St: + return "[object DataView]"; + case xt: + return "[object Map]"; + case Et: + return "[object Promise]"; + case At: + return "[object Set]"; + case Ct: + return "[object WeakMap]"; + } + return t2; + }); + var Tt = jt, Ot = Object.prototype.hasOwnProperty; + var kt = function(e2) { + var t2 = e2.length, n2 = new e2.constructor(t2); + return t2 && typeof e2[0] == "string" && Ot.call(e2, "index") && (n2.index = e2.index, n2.input = e2.input), n2; + }, Nt = y.a.Uint8Array; + var It = function(e2) { + var t2 = new e2.constructor(e2.byteLength); + return new Nt(t2).set(new Nt(e2)), t2; + }; + var Mt = function(e2, t2) { + var n2 = t2 ? It(e2.buffer) : e2.buffer; + return new e2.constructor(n2, e2.byteOffset, e2.byteLength); + }, Rt = /\w*$/; + var Dt = function(e2) { + var t2 = new e2.constructor(e2.source, Rt.exec(e2)); + return t2.lastIndex = e2.lastIndex, t2; + }, Pt = w ? w.prototype : void 0, Lt = Pt ? Pt.valueOf : void 0; + var zt = function(e2) { + return Lt ? Object(Lt.call(e2)) : {}; + }; + var Ft = function(e2, t2) { + var n2 = t2 ? It(e2.buffer) : e2.buffer; + return new e2.constructor(n2, e2.byteOffset, e2.length); + }; + var Bt = function(e2, t2, n2) { + var r2 = e2.constructor; + switch (t2) { + case "[object ArrayBuffer]": + return It(e2); + case "[object Boolean]": + case "[object Date]": + return new r2(+e2); + case "[object DataView]": + return Mt(e2, n2); + case "[object Float32Array]": + case "[object Float64Array]": + case "[object Int8Array]": + case "[object Int16Array]": + case "[object Int32Array]": + case "[object Uint8Array]": + case "[object Uint8ClampedArray]": + case "[object Uint16Array]": + case "[object Uint32Array]": + return Ft(e2, n2); + case "[object Map]": + return new r2(); + case "[object Number]": + case "[object String]": + return new r2(e2); + case "[object RegExp]": + return Dt(e2); + case "[object Set]": + return new r2(); + case "[object Symbol]": + return zt(e2); + } + }, qt = Object.create, Ht = function() { + function e2() { + } + return function(t2) { + if (!N(t2)) + return {}; + if (qt) + return qt(t2); + e2.prototype = t2; + var n2 = new e2(); + return e2.prototype = void 0, n2; + }; + }(); + var Ut = function(e2) { + return typeof e2.constructor != "function" || $e(e2) ? {} : Ht(ht(e2)); + }; + var $t = function(e2) { + return Ee(e2) && Tt(e2) == "[object Map]"; + }, Wt = ze.a && ze.a.isMap, Gt = Wt ? Le(Wt) : $t; + var Vt = function(e2) { + return Ee(e2) && Tt(e2) == "[object Set]"; + }, Jt = ze.a && ze.a.isSet, Xt = Jt ? Le(Jt) : Vt, Qt = {}; + Qt["[object Arguments]"] = Qt["[object Array]"] = Qt["[object ArrayBuffer]"] = Qt["[object DataView]"] = Qt["[object Boolean]"] = Qt["[object Date]"] = Qt["[object Float32Array]"] = Qt["[object Float64Array]"] = Qt["[object Int8Array]"] = Qt["[object Int16Array]"] = Qt["[object Int32Array]"] = Qt["[object Map]"] = Qt["[object Number]"] = Qt["[object Object]"] = Qt["[object RegExp]"] = Qt["[object Set]"] = Qt["[object String]"] = Qt["[object Symbol]"] = Qt["[object Uint8Array]"] = Qt["[object Uint8ClampedArray]"] = Qt["[object Uint16Array]"] = Qt["[object Uint32Array]"] = true, Qt["[object Error]"] = Qt["[object Function]"] = Qt["[object WeakMap]"] = false; + var Yt = function e2(t2, n2, r2, i2, o2, s2) { + var a2, c2 = 1 & n2, l2 = 2 & n2, u2 = 4 & n2; + if (r2 && (a2 = o2 ? r2(t2, i2, o2, s2) : r2(t2)), a2 !== void 0) + return a2; + if (!N(t2)) + return t2; + var d2 = ke(t2); + if (d2) { + if (a2 = kt(t2), !c2) + return it(t2, a2); + } else { + var h2 = Tt(t2), f2 = h2 == "[object Function]" || h2 == "[object GeneratorFunction]"; + if (Object(Ne.a)(t2)) + return Object(rt.a)(t2, c2); + if (h2 == "[object Object]" || h2 == "[object Arguments]" || f2 && !o2) { + if (a2 = l2 || f2 ? {} : Ut(t2), !c2) + return l2 ? pt(t2, nt(a2, t2)) : ut(t2, Ye(a2, t2)); + } else { + if (!Qt[h2]) + return o2 ? t2 : {}; + a2 = Bt(t2, h2, c2); + } + } + s2 || (s2 = new me()); + var p2 = s2.get(t2); + if (p2) + return p2; + s2.set(t2, a2), Xt(t2) ? t2.forEach(function(i3) { + a2.add(e2(i3, n2, r2, i3, t2, s2)); + }) : Gt(t2) && t2.forEach(function(i3, o3) { + a2.set(o3, e2(i3, n2, r2, o3, t2, s2)); + }); + var g2 = u2 ? l2 ? vt : mt : l2 ? keysIn : Qe, m2 = d2 ? void 0 : g2(t2); + return ve(m2 || t2, function(i3, o3) { + m2 && (i3 = t2[o3 = i3]), we(a2, o3, e2(i3, n2, r2, o3, t2, s2)); + }), a2; + }; + var Kt = function(e2) { + return Yt(e2, 5); + }; + var Zt = function(e2) { + return typeof e2 == "string" || !ke(e2) && Ee(e2) && k(e2) == "[object String]"; + }; + var en = function(e2, t2) { + t2 && e2.then(function(e3) { + t2(null, e3); + }, function(e3) { + t2(e3); + }); + }; + function tn() { + if (arguments.length && typeof arguments[arguments.length - 1] == "function") + return arguments[arguments.length - 1]; + } + function nn(e2) { + return typeof e2 != "string" && (console.warn("".concat(e2, " used as a key, but it is not a string.")), e2 = String(e2)), e2; + } + var rn = function(e2, t2) { + e2 = e2 || [], t2 = t2 || {}; + try { + return new Blob(e2, t2); + } catch (i2) { + if (i2.name !== "TypeError") + throw i2; + for (var n2 = new (typeof BlobBuilder != "undefined" ? BlobBuilder : typeof MSBlobBuilder != "undefined" ? MSBlobBuilder : typeof MozBlobBuilder != "undefined" ? MozBlobBuilder : WebKitBlobBuilder)(), r2 = 0; r2 < e2.length; r2 += 1) + n2.append(e2[r2]); + return n2.getBlob(t2.type); + } + }, on = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", sn = /^~~local_forage_type~([^~]+)~/, an = "__lfsc__:".length, cn = an + "arbf".length, ln = Object.prototype.toString; + function un(e2) { + var t2, n2, r2, i2, o2, s2 = 0.75 * e2.length, a2 = e2.length, c2 = 0; + e2[e2.length - 1] === "=" && (s2--, e2[e2.length - 2] === "=" && s2--); + var l2 = new ArrayBuffer(s2), u2 = new Uint8Array(l2); + for (t2 = 0; t2 < a2; t2 += 4) + n2 = on.indexOf(e2[t2]), r2 = on.indexOf(e2[t2 + 1]), i2 = on.indexOf(e2[t2 + 2]), o2 = on.indexOf(e2[t2 + 3]), u2[c2++] = n2 << 2 | r2 >> 4, u2[c2++] = (15 & r2) << 4 | i2 >> 2, u2[c2++] = (3 & i2) << 6 | 63 & o2; + return l2; + } + function dn(e2) { + var t2, n2 = new Uint8Array(e2), r2 = ""; + for (t2 = 0; t2 < n2.length; t2 += 3) + r2 += on[n2[t2] >> 2], r2 += on[(3 & n2[t2]) << 4 | n2[t2 + 1] >> 4], r2 += on[(15 & n2[t2 + 1]) << 2 | n2[t2 + 2] >> 6], r2 += on[63 & n2[t2 + 2]]; + return n2.length % 3 == 2 ? r2 = r2.substring(0, r2.length - 1) + "=" : n2.length % 3 == 1 && (r2 = r2.substring(0, r2.length - 2) + "=="), r2; + } + var hn = {serialize: function(e2, t2) { + var n2 = ""; + if (e2 && (n2 = ln.call(e2)), e2 && (n2 === "[object ArrayBuffer]" || e2.buffer && ln.call(e2.buffer) === "[object ArrayBuffer]")) { + var r2, i2 = "__lfsc__:"; + e2 instanceof ArrayBuffer ? (r2 = e2, i2 += "arbf") : (r2 = e2.buffer, n2 === "[object Int8Array]" ? i2 += "si08" : n2 === "[object Uint8Array]" ? i2 += "ui08" : n2 === "[object Uint8ClampedArray]" ? i2 += "uic8" : n2 === "[object Int16Array]" ? i2 += "si16" : n2 === "[object Uint16Array]" ? i2 += "ur16" : n2 === "[object Int32Array]" ? i2 += "si32" : n2 === "[object Uint32Array]" ? i2 += "ui32" : n2 === "[object Float32Array]" ? i2 += "fl32" : n2 === "[object Float64Array]" ? i2 += "fl64" : t2(new Error("Failed to get type for BinaryArray"))), t2(i2 + dn(r2)); + } else if (n2 === "[object Blob]") { + var o2 = new FileReader(); + o2.onload = function() { + var n3 = "~~local_forage_type~" + e2.type + "~" + dn(this.result); + t2("__lfsc__:blob" + n3); + }, o2.readAsArrayBuffer(e2); + } else + try { + t2(JSON.stringify(e2)); + } catch (n3) { + console.error("Couldn't convert value into a JSON string: ", e2), t2(null, n3); + } + }, deserialize: function(e2) { + if (e2.substring(0, an) !== "__lfsc__:") + return JSON.parse(e2); + var t2, n2 = e2.substring(cn), r2 = e2.substring(an, cn); + if (r2 === "blob" && sn.test(n2)) { + var i2 = n2.match(sn); + t2 = i2[1], n2 = n2.substring(i2[0].length); + } + var o2 = un(n2); + switch (r2) { + case "arbf": + return o2; + case "blob": + return rn([o2], {type: t2}); + case "si08": + return new Int8Array(o2); + case "ui08": + return new Uint8Array(o2); + case "uic8": + return new Uint8ClampedArray(o2); + case "si16": + return new Int16Array(o2); + case "ur16": + return new Uint16Array(o2); + case "si32": + return new Int32Array(o2); + case "ui32": + return new Uint32Array(o2); + case "fl32": + return new Float32Array(o2); + case "fl64": + return new Float64Array(o2); + default: + throw new Error("Unkown type: " + r2); + } + }, stringToBuffer: un, bufferToString: dn}; + function fn(e2, t2) { + let n2 = e2.name + "/"; + return e2.storeName !== t2.storeName && (n2 += e2.storeName + "/"), n2; + } + const pn = {serializer: {serialize: hn.serialize, deserialize: hn.deserialize}}; + var gn = {_driver: "sessionStorageWrapper", _initStorage: function(e2) { + if (pn.keyPrefix = fn(e2, this._defaultConfig), e2) + for (const t2 in e2) + pn[t2] = e2[t2]; + }, _support: function() { + try { + if (sessionStorage && "setItem" in sessionStorage) + return true; + } catch (e2) { + console.log(e2); + } + return false; + }(), iterate: function(e2, t2) { + const n2 = this.ready().then(function() { + const t3 = pn.keyPrefix, n3 = t3.length, r2 = sessionStorage.length; + let i2 = 1; + for (let o2 = 0; o2 < r2; o2++) { + const r3 = sessionStorage.key(o2); + if (r3.indexOf(t3) !== 0) + continue; + let s2 = sessionStorage.getItem(r3); + if (s2 && (s2 = pn.serializer.deserialize(s2)), s2 = e2(s2, r3.substring(n3), i2++), s2 !== void 0) + return s2; + } + }); + return en(n2, t2), n2; + }, getItem: function(e2, t2) { + e2 = nn(e2); + const n2 = this.ready().then(function() { + let t3 = sessionStorage.getItem(pn.keyPrefix + e2); + return t3 && (t3 = pn.serializer.deserialize(t3)), t3; + }); + return en(n2, t2), n2; + }, setItem: function(e2, t2, n2) { + e2 = nn(e2); + const r2 = this.ready().then(function() { + t2 === void 0 && (t2 = null); + const n3 = t2; + return new Promise(function(r3, i2) { + pn.serializer.serialize(t2, function(t3, o2) { + if (o2) + i2(o2); + else + try { + sessionStorage.setItem(pn.keyPrefix + e2, t3), r3(n3); + } catch (e3) { + e3.name !== "QuotaExceededError" && e3.name !== "NS_ERROR_DOM_QUOTA_REACHED" || i2(e3), i2(e3); + } + }); + }); + }); + return en(r2, n2), r2; + }, removeItem: function(e2, t2) { + e2 = nn(e2); + const n2 = this.ready().then(function() { + sessionStorage.removeItem(pn.keyPrefix + e2); + }); + return en(n2, t2), n2; + }, clear: function(e2) { + const t2 = this.ready().then(function() { + const e3 = pn.keyPrefix; + for (let t3 = sessionStorage.length - 1; t3 >= 0; t3--) { + const n2 = sessionStorage.key(t3); + n2.indexOf(e3) === 0 && sessionStorage.removeItem(n2); + } + }); + return en(t2, e2), t2; + }, length: function(e2) { + const t2 = this.keys().then(function(e3) { + return e3.length; + }); + return en(t2, e2), t2; + }, key: function(e2, t2) { + const n2 = this.ready().then(function() { + let t3; + try { + t3 = sessionStorage.key(e2); + } catch (e3) { + t3 = null; + } + return t3 && (t3 = t3.substring(pn.keyPrefix.length)), t3; + }); + return en(n2, t2), n2; + }, keys: function(e2) { + const t2 = this.ready().then(function() { + const e3 = sessionStorage.length, t3 = []; + for (let n2 = 0; n2 < e3; n2++) { + const e4 = sessionStorage.key(n2); + e4.indexOf(pn.keyPrefix) === 0 && t3.push(e4.substring(pn.keyPrefix.length)); + } + return t3; + }); + return en(t2, e2), t2; + }, dropInstance: function(e2, t2) { + if (t2 = tn.apply(this, arguments), !(e2 = typeof e2 != "function" && e2 || {}).name) { + const t3 = this.config(); + e2.name = e2.name || t3.name, e2.storeName = e2.storeName || t3.storeName; + } + const n2 = this; + let r2; + return r2 = e2.name ? new Promise(function(t3) { + e2.storeName ? t3(fn(e2, n2._defaultConfig)) : t3("".concat(e2.name, "/")); + }).then(function(e3) { + for (let t3 = sessionStorage.length - 1; t3 >= 0; t3--) { + const n3 = sessionStorage.key(t3); + n3.indexOf(e3) === 0 && sessionStorage.removeItem(n3); + } + }) : Promise.reject(new Error("Invalid arguments")), en(r2, t2), r2; + }}; + const mn = {}; + var vn = {_driver: "noStorageWrapper", _initStorage: function(e2) { + if (mn.keyPrefix = function(e3, t2) { + let n2 = e3.name + "/"; + return e3.storeName !== t2.storeName && (n2 += e3.storeName + "/"), n2; + }(e2, this._defaultConfig), e2) + for (const t2 in e2) + mn[t2] = e2[t2]; + }, _support: true, iterate: function(e2, t2) { + const n2 = Promise.resolve(); + return en(n2, t2), n2; + }, getItem: function(e2, t2) { + const n2 = this.ready().then(function() { + }); + return en(n2, t2), n2; + }, setItem: function(e2, t2, n2) { + const r2 = Promise.resolve(t2); + return en(r2, n2), r2; + }, removeItem: function(e2, t2) { + const n2 = Promise.resolve(); + return en(n2, t2), n2; + }, clear: function(e2) { + const t2 = Promise.resolve(); + return en(t2, e2), t2; + }, length: function(e2) { + const t2 = this.keys().then(function(e3) { + return e3.length; + }); + return en(t2, e2), t2; + }, key: function(e2, t2) { + const n2 = this.ready().then(function() { + return null; + }); + return en(n2, t2), n2; + }, keys: function(e2) { + const t2 = this.ready().then(function() { + return []; + }); + return en(t2, e2), t2; + }, dropInstance: function(e2, t2) { + if (t2 = tn.apply(this, arguments), !(e2 = typeof e2 != "function" && e2 || {}).name) { + const t3 = this.config(); + e2.name = e2.name || t3.name, e2.storeName = e2.storeName || t3.storeName; + } + let n2; + return n2 = e2.name ? Promise.resolve() : Promise.reject(new Error("Invalid arguments")), en(n2, t2), n2; + }}; + function _n() { + return (65536 * (1 + Math.random()) | 0).toString(16).substring(1); + } + class bn { + constructor(e2, t2) { + if (t2 === "local" && !window.localStorage) + throw new Error("Skeletor.storage: Environment does not support localStorage."); + if (t2 === "session" && !window.sessionStorage) + throw new Error("Skeletor.storage: Environment does not support sessionStorage."); + Zt(t2) ? this.storeInitialized = this.initStore(t2) : (this.store = t2, this.storeInitialized = Promise.resolve()), this.name = e2; + } + async initStore(e2) { + if (e2 === "session") + o.setDriver(gn._driver); + else if (e2 === "local") + await o.config({driver: o.LOCALSTORAGE}); + else if (e2 === "in_memory") + o.setDriver(vn._driver); + else if (e2 !== "indexed") + throw new Error("Skeletor.storage: No storage type was specified"); + this.store = o; + } + async clear() { + await this.store.removeItem(this.name).catch((e3) => console.error(e3)); + const e2 = new RegExp("^".concat(this.name, "-")), t2 = (await this.store.keys()).filter((t3) => e2.test(t3)); + await Promise.all(t2.map((e3) => this.store.removeItem(e3).catch((e4) => console.error(e4)))); + } + sync(e2) { + const t2 = this; + async function n2(e3, n3, r2) { + let i2, o2, s2, a2; + const c2 = n3.collection; + ["patch", "update"].includes(e3) && (a2 = Kt(n3.attributes)), await t2.storeInitialized; + try { + const o3 = n3.attributes; + switch (e3) { + case "read": + i2 = n3.id !== void 0 ? await t2.find(n3) : await t2.findAll(); + break; + case "create": + i2 = await t2.create(n3, r2); + break; + case "patch": + case "update": + r2.wait && (n3.attributes = a2), s2 = t2.update(n3, r2), r2.wait && (n3.attributes = o3), i2 = await s2; + break; + case "delete": + i2 = await t2.destroy(n3, c2); + } + } catch (e4) { + o2 = e4.code === 22 && t2.getStorageSize() === 0 ? "Private browsing is unsupported" : e4.message; + } + if (i2) { + if (r2 && r2.success) { + const t3 = e3 === "read" ? i2 : null; + r2.success(t3, r2); + } + } else + o2 = o2 || "Record Not Found", r2 && r2.error && r2.error(o2); + } + return n2.__name__ = "localSync", n2; + } + removeCollectionReference(e2, t2) { + if (!t2) + return; + const n2 = t2.filter((t3) => t3.id !== e2.id).map((e3) => this.getItemName(e3.id)); + return this.store.setItem(this.name, n2); + } + addCollectionReference(e2, t2) { + if (!t2) + return; + const n2 = t2.map((e3) => this.getItemName(e3.id)), r2 = this.getItemName(e2.id); + return n2.includes(r2) || n2.push(r2), this.store.setItem(this.name, n2); + } + async save(e2, t2 = {}) { + const n2 = this.getItemName(e2.id), r2 = await this.store.setItem(n2, e2.toJSON()); + return await this.addCollectionReference(e2, e2.collection), r2; + } + create(e2, t2) { + return e2.id || (e2.id = _n() + _n() + "-" + _n() + "-" + _n() + "-" + _n() + "-" + _n() + _n() + _n(), e2.set(e2.idAttribute, e2.id, t2)), this.save(e2); + } + update(e2, t2) { + return this.save(e2, t2); + } + find(e2) { + return this.store.getItem(this.getItemName(e2.id)); + } + async findAll() { + const e2 = await this.store.getItem(this.name); + return e2 && e2.length ? Promise.all(e2.map((e3) => this.store.getItem(e3))) : []; + } + async destroy(e2, t2) { + return await this.store.removeItem(this.getItemName(e2.id)), await this.removeCollectionReference(e2, t2), e2; + } + getStorageSize() { + return this.store.length; + } + getItemName(e2) { + return this.name + "-" + e2; + } + } + bn.IN_MEMORY = vn._driver, bn.memoryStorageInitialized = o.defineDriver(vn), bn.sessionStorageInitialized = o.defineDriver(gn), bn.localForage = o; + var yn = bn, wn = n(161), Sn = n.n(wn), xn = n(5), En = n.n(xn), An = Function.prototype, Cn = Object.prototype, jn = An.toString, Tn = Cn.hasOwnProperty, On = jn.call(Object); + var kn = function(e2) { + if (!Ee(e2) || k(e2) != "[object Object]") + return false; + var t2 = ht(e2); + if (t2 === null) + return true; + var n2 = Tn.call(t2, "constructor") && t2.constructor; + return typeof n2 == "function" && n2 instanceof n2 && jn.call(n2) == On; + }; + var Nn, In, Mn, Rn, Dn = function(e2) { + return Ee(e2) && e2.nodeType === 1 && !kn(e2); + }; + const Pn = {debug: 0, info: 1, warn: 2, error: 3, fatal: 4}, Ln = Object.assign({debug: ((Nn = console) === null || Nn === void 0 ? void 0 : Nn.log) ? console.log.bind(console) : function() { + }, error: ((In = console) === null || In === void 0 ? void 0 : In.log) ? console.log.bind(console) : function() { + }, info: ((Mn = console) === null || Mn === void 0 ? void 0 : Mn.log) ? console.log.bind(console) : function() { + }, warn: ((Rn = console) === null || Rn === void 0 ? void 0 : Rn.log) ? console.log.bind(console) : function() { + }}, console); + var zn = {setLogLevel(e2) { + if (!["debug", "info", "warn", "error", "fatal"].includes(e2)) + throw new Error("Invalid loglevel: ".concat(e2)); + this.loglevel = e2; + }, log(e2, t2, n2 = "") { + if (Pn[t2] < Pn[this.loglevel]) + return; + t2 === "error" || t2 === "fatal" ? n2 = n2 || "color: maroon" : t2 === "debug" && (n2 = n2 || "color: green"), e2 instanceof Error ? e2 = e2.stack : Dn(e2) && (e2 = e2.outerHTML); + const r2 = n2 ? "%c" : ""; + t2 === "error" ? Ln.error("".concat(r2, " ERROR: ").concat(e2), n2) : t2 === "warn" ? Ln.warn("".concat(r2, " ").concat(new Date().toISOString(), " WARNING: ").concat(e2), n2) : t2 === "fatal" ? Ln.error("".concat(r2, " FATAL: ").concat(e2), n2) : t2 === "debug" ? Ln.debug("".concat(r2, " ").concat(new Date().toISOString(), " DEBUG: ").concat(e2), n2) : Ln.info("".concat(r2, " ").concat(new Date().toISOString(), " INFO: ").concat(e2), n2); + }, debug(e2, t2) { + this.log(e2, "debug", t2); + }, error(e2, t2) { + this.log(e2, "error", t2); + }, info(e2, t2) { + this.log(e2, "info", t2); + }, warn(e2, t2) { + this.log(e2, "warn", t2); + }, fatal(e2, t2) { + this.log(e2, "fatal", t2); + }}, Fn = n(162), Bn = n.n(Fn), qn = n(44), Hn = n.n(qn), Un = n(45), $n = n.n(Un), Wn = n(36), Gn = n.n(Wn), Vn = n(163), Jn = n.n(Vn), Xn = n(62), Qn = n.n(Xn), Yn = n(164), Kn = n.n(Yn), Zn = n(33), er = n.n(Zn), tr = n(93), nr = n.n(tr), rr = n(165), ir = n.n(rr), or = n(166), sr = n.n(or), ar = n(92), cr = n.n(ar); + function lr(e2, t2) { + this.name = t2, this.plugged = e2, this.plugged.__super__ === void 0 ? this.plugged.__super__ = {} : typeof this.plugged.__super__ == "string" && (this.plugged.__super__ = {__string__: this.plugged.__super__}), this.plugged.__super__[t2] = this.plugged, this.plugins = {}, this.initialized_plugins = []; + } + $n()(lr.prototype, {wrappedOverride: function(e2, t2, n2, r2) { + return typeof n2 == "function" && (this.__super__ === void 0 && (this.__super__ = r2), this.__super__[e2] = n2.bind(this)), t2.apply(this, Bn()(arguments, 4)); + }, _overrideAttribute: function(e2, t2) { + let n2 = t2.overrides[e2]; + if (typeof n2 == "function") { + let t3 = {}; + t3[this.name] = this.plugged; + let r2 = nr()(this.wrappedOverride, e2, n2, this.plugged[e2], t3); + this.plugged[e2] = r2; + } else + this.plugged[e2] = n2; + }, _extendObject: function(e2, t2) { + e2.prototype.__super__ || (e2.prototype.__super__ = {}, e2.prototype.__super__[this.name] = this.plugged); + let n2 = this; + Hn()(t2, function(t3, r2) { + if (r2 === "events") + e2.prototype[r2] = $n()(t3, e2.prototype[r2]); + else if (typeof t3 == "function") { + let i2 = {}; + i2[n2.name] = n2.plugged; + let o2 = nr()(n2.wrappedOverride, r2, t3, e2.prototype[r2], i2); + e2.prototype[r2] = o2; + } else + e2.prototype[r2] = t3; + }); + }, loadPluginDependencies: function(e2) { + Hn()(e2.dependencies, (t2) => { + let n2 = this.plugins[t2]; + if (n2) { + if (Gn()(n2.dependencies, e2.__name__)) + throw 'Found a circular dependency between the plugins "' + e2.__name__ + '" and "' + t2 + '"'; + this.initializePlugin(n2); + } else + this.throwUndefinedDependencyError('Could not find dependency "' + t2 + '" for the plugin "' + e2.__name__ + `". If it's needed, make sure it's loaded by require.js`); + }); + }, throwUndefinedDependencyError: function(e2) { + if (this.plugged.strict_plugin_dependencies) + throw e2; + console.warn ? console.warn(e2) : console.log(e2); + }, applyOverrides: function(e2) { + Hn()(Object.keys(e2.overrides || {}), (t2) => { + let n2 = e2.overrides[t2]; + typeof n2 == "object" ? this.plugged[t2] === void 0 ? this.throwUndefinedDependencyError('Plugin "'.concat(e2.__name__, '" tried to override "').concat(t2, `" but it's not found.`)) : this._extendObject(this.plugged[t2], n2) : this._overrideAttribute(t2, e2); + }); + }, initializePlugin: function(e2) { + Gn()(er()(this.allowed_plugins), e2.__name__) && (Gn()(this.initialized_plugins, e2.__name__) || (Jn()(e2.enabled) && e2.enabled || Qn()(e2.enabled) && e2.enabled(this.plugged) || Kn()(e2.enabled)) && ($n()(e2, this.properties), e2.dependencies && this.loadPluginDependencies(e2), this.applyOverrides(e2), typeof e2.initialize == "function" && e2.initialize.bind(e2)(this), this.initialized_plugins.push(e2.__name__))); + }, registerPlugin: function(e2, t2) { + if (e2 in this.plugins) + throw new Error("Error: Plugin name " + e2 + " is already taken"); + t2.__name__ = e2, this.plugins[e2] = t2; + }, initializePlugins: function(e2 = {}, t2 = [], n2 = []) { + sr()(this.plugins) && (this.properties = e2, this.allowed_plugins = ir()(this.plugins, function(e3, r2) { + return (!t2.length || t2.length && Gn()(t2, r2)) && !Gn()(n2, r2); + }), Hn()(cr()(this.allowed_plugins), this.initializePlugin.bind(this))); + }}); + var ur = {enable: function(e2, t2, n2) { + n2 === void 0 && (n2 = "pluginSocket"), t2 === void 0 && (t2 = "plugged"); + let r2 = {}; + return r2[n2] = new lr(e2, t2), $n()(e2, r2); + }}, dr = n(167), hr = n.n(dr), fr = n(168), pr = n.n(fr), gr = n(3), mr = n.n(gr), vr = n(0); + var _r = function(e2, t2) { + var n2 = Ht(e2); + return t2 == null ? n2 : Ye(n2, t2); + }; + var br = function(e2) { + return e2; + }; + var yr = function(e2, t2, n2) { + switch (n2.length) { + case 0: + return e2.call(t2); + case 1: + return e2.call(t2, n2[0]); + case 2: + return e2.call(t2, n2[0], n2[1]); + case 3: + return e2.call(t2, n2[0], n2[1], n2[2]); + } + return e2.apply(t2, n2); + }, wr = Math.max; + var Sr = function(e2, t2, n2) { + return t2 = wr(t2 === void 0 ? e2.length - 1 : t2, 0), function() { + for (var r2 = arguments, i2 = -1, o2 = wr(r2.length - t2, 0), s2 = Array(o2); ++i2 < o2; ) + s2[i2] = r2[t2 + i2]; + i2 = -1; + for (var a2 = Array(t2 + 1); ++i2 < t2; ) + a2[i2] = r2[i2]; + return a2[t2] = n2(s2), yr(e2, this, a2); + }; + }; + var xr = function(e2) { + return function() { + return e2; + }; + }, Er = _e ? function(e2, t2) { + return _e(e2, "toString", {configurable: true, enumerable: false, value: xr(t2), writable: true}); + } : br, Ar = Date.now; + var Cr = function(e2) { + var t2 = 0, n2 = 0; + return function() { + var r2 = Ar(), i2 = 16 - (r2 - n2); + if (n2 = r2, i2 > 0) { + if (++t2 >= 800) + return arguments[0]; + } else + t2 = 0; + return e2.apply(void 0, arguments); + }; + }(Er); + var jr = function(e2, t2) { + return Cr(Sr(e2, t2, br), e2 + ""); + }; + var Tr = function(e2, t2, n2) { + if (!N(n2)) + return false; + var r2 = typeof t2; + return !!(r2 == "number" ? Xe(n2) && Me(t2, n2.length) : r2 == "string" && t2 in n2) && a(n2[t2], e2); + }; + var Or = function(e2) { + return jr(function(t2, n2) { + var r2 = -1, i2 = n2.length, o2 = i2 > 1 ? n2[i2 - 1] : void 0, s2 = i2 > 2 ? n2[2] : void 0; + for (o2 = e2.length > 3 && typeof o2 == "function" ? (i2--, o2) : void 0, s2 && Tr(n2[0], n2[1], s2) && (o2 = i2 < 3 ? void 0 : o2, i2 = 1), t2 = Object(t2); ++r2 < i2; ) { + var a2 = n2[r2]; + a2 && e2(t2, a2, r2, o2); + } + return t2; + }); + }(function(e2, t2) { + Se(t2, tt(t2), e2); + }), kr = Object.prototype.hasOwnProperty; + var Nr = function(e2, t2) { + return e2 != null && kr.call(e2, t2); + }; + var Ir = function(e2) { + return typeof e2 == "symbol" || Ee(e2) && k(e2) == "[object Symbol]"; + }, Mr = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Rr = /^\w*$/; + var Dr = function(e2, t2) { + if (ke(e2)) + return false; + var n2 = typeof e2; + return !(n2 != "number" && n2 != "symbol" && n2 != "boolean" && e2 != null && !Ir(e2)) || (Rr.test(e2) || !Mr.test(e2) || t2 != null && e2 in Object(t2)); + }; + function Pr(e2, t2) { + if (typeof e2 != "function" || t2 != null && typeof t2 != "function") + throw new TypeError("Expected a function"); + var n2 = function() { + var r2 = arguments, i2 = t2 ? t2.apply(this, r2) : r2[0], o2 = n2.cache; + if (o2.has(i2)) + return o2.get(i2); + var s2 = e2.apply(this, r2); + return n2.cache = o2.set(i2, s2) || o2, s2; + }; + return n2.cache = new (Pr.Cache || fe)(), n2; + } + Pr.Cache = fe; + var Lr = Pr; + var zr = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, Fr = /\\(\\)?/g, Br = function(e2) { + var t2 = Lr(e2, function(e3) { + return n2.size === 500 && n2.clear(), e3; + }), n2 = t2.cache; + return t2; + }(function(e2) { + var t2 = []; + return e2.charCodeAt(0) === 46 && t2.push(""), e2.replace(zr, function(e3, n2, r2, i2) { + t2.push(r2 ? i2.replace(Fr, "$1") : n2 || e3); + }), t2; + }); + var qr = function(e2, t2) { + for (var n2 = -1, r2 = e2 == null ? 0 : e2.length, i2 = Array(r2); ++n2 < r2; ) + i2[n2] = t2(e2[n2], n2, e2); + return i2; + }, Hr = w ? w.prototype : void 0, Ur = Hr ? Hr.toString : void 0; + var $r = function e2(t2) { + if (typeof t2 == "string") + return t2; + if (ke(t2)) + return qr(t2, e2) + ""; + if (Ir(t2)) + return Ur ? Ur.call(t2) : ""; + var n2 = t2 + ""; + return n2 == "0" && 1 / t2 == -1 / 0 ? "-0" : n2; + }; + var Wr = function(e2) { + return e2 == null ? "" : $r(e2); + }; + var Gr = function(e2, t2) { + return ke(e2) ? e2 : Dr(e2, t2) ? [e2] : Br(Wr(e2)); + }; + var Vr = function(e2) { + if (typeof e2 == "string" || Ir(e2)) + return e2; + var t2 = e2 + ""; + return t2 == "0" && 1 / e2 == -1 / 0 ? "-0" : t2; + }; + var Jr = function(e2, t2, n2) { + for (var r2 = -1, i2 = (t2 = Gr(t2, e2)).length, o2 = false; ++r2 < i2; ) { + var s2 = Vr(t2[r2]); + if (!(o2 = e2 != null && n2(e2, s2))) + break; + e2 = e2[s2]; + } + return o2 || ++r2 != i2 ? o2 : !!(i2 = e2 == null ? 0 : e2.length) && Re(i2) && Me(s2, i2) && (ke(e2) || Oe(e2)); + }; + var Xr = function(e2, t2) { + return e2 != null && Jr(e2, t2, Nr); + }; + var Qr = function(e2, t2, n2) { + var r2 = -1, i2 = (t2 = Gr(t2, e2)).length; + for (i2 || (i2 = 1, e2 = void 0); ++r2 < i2; ) { + var o2 = e2 == null ? void 0 : e2[Vr(t2[r2])]; + o2 === void 0 && (r2 = i2, o2 = n2), e2 = M(o2) ? o2.call(e2) : o2; + } + return e2; + }; + function Yr(e2, t2) { + const n2 = this; + let r2; + return r2 = e2 && Xr(e2, "constructor") ? e2.constructor : function() { + return n2.apply(this, arguments); + }, Or(r2, n2, t2), r2.prototype = _r(n2.prototype, e2), r2.prototype.constructor = r2, r2.__super__ = n2.prototype, r2; + } + function Kr() { + const e2 = {isResolved: false, isPending: true, isRejected: false}, t2 = new Promise((t3, n2) => { + e2.resolve = t3, e2.reject = n2; + }); + return Object.assign(t2, e2), t2.then(function(e3) { + return t2.isResolved = true, t2.isPending = false, t2.isRejected = false, e3; + }, function(e3) { + throw t2.isResolved = false, t2.isPending = false, t2.isRejected = true, e3; + }), t2; + } + function Zr() { + throw new Error('A "url" property or function must be specified'); + } + function ei(e2, t2) { + const n2 = t2.error; + t2.error = function(r2) { + n2 && n2.call(t2.context, e2, r2, t2), e2.trigger("error", e2, r2, t2); + }; + } + const ti = {create: "POST", update: "PUT", patch: "PATCH", delete: "DELETE", read: "GET"}; + function ni(e2) { + const t2 = Qr(e2, "browserStorage") || Qr(e2.collection, "browserStorage"); + return t2 ? t2.sync() : ri; + } + function ri(e2, t2, n2 = {}) { + const r2 = {type: ti[e2], dataType: "json"}; + n2.url || (r2.url = Qr(t2, "url") || Zr()), n2.data != null || !t2 || e2 !== "create" && e2 !== "update" && e2 !== "patch" || (r2.contentType = "application/json", r2.data = JSON.stringify(n2.attrs || t2.toJSON(n2))), r2.type !== "GET" && (r2.processData = false); + const i2 = n2.error; + n2.error = function(e3, t3, r3) { + n2.textStatus = t3, n2.errorThrown = r3, i2 && i2.call(n2.context, e3, t3, r3); + }; + const o2 = n2.xhr = function() { + return fetch.apply(this, arguments); + }(Or(r2, n2)); + return t2.trigger("request", t2, o2, n2), o2; + } + var ii = Object.prototype.hasOwnProperty; + var oi = function(e2) { + if (e2 == null) + return true; + if (Xe(e2) && (ke(e2) || typeof e2 == "string" || typeof e2.splice == "function" || Object(Ne.a)(e2) || Be(e2) || Oe(e2))) + return !e2.length; + var t2 = Tt(e2); + if (t2 == "[object Map]" || t2 == "[object Set]") + return !e2.size; + if ($e(e2)) + return !Je(e2).length; + for (var n2 in e2) + if (ii.call(e2, n2)) + return false; + return true; + }, si = /^\s+|\s+$/g, ai = /^[-+]0x[0-9a-f]+$/i, ci = /^0b[01]+$/i, li = /^0o[0-7]+$/i, ui = parseInt; + var di = function(e2) { + if (typeof e2 == "number") + return e2; + if (Ir(e2)) + return NaN; + if (N(e2)) { + var t2 = typeof e2.valueOf == "function" ? e2.valueOf() : e2; + e2 = N(t2) ? t2 + "" : t2; + } + if (typeof e2 != "string") + return e2 === 0 ? e2 : +e2; + e2 = e2.replace(si, ""); + var n2 = ci.test(e2); + return n2 || li.test(e2) ? ui(e2.slice(2), n2 ? 2 : 8) : ai.test(e2) ? NaN : +e2; + }; + var hi = function(e2) { + return e2 ? (e2 = di(e2)) === 1 / 0 || e2 === -1 / 0 ? 17976931348623157e292 * (e2 < 0 ? -1 : 1) : e2 == e2 ? e2 : 0 : e2 === 0 ? e2 : 0; + }; + var fi = function(e2) { + var t2 = hi(e2), n2 = t2 % 1; + return t2 == t2 ? n2 ? t2 - n2 : t2 : 0; + }; + var pi = function(e2, t2) { + var n2; + if (typeof t2 != "function") + throw new TypeError("Expected a function"); + return e2 = fi(e2), function() { + return --e2 > 0 && (n2 = t2.apply(this, arguments)), e2 <= 1 && (t2 = void 0), n2; + }; + }; + var gi = function(e2) { + return pi(2, e2); + }, mi = 0; + var vi = function(e2) { + var t2 = ++mi; + return Wr(e2) + t2; + }; + const _i = {}, bi = /\s+/; + let yi; + const wi = function(e2, t2, n2, r2, i2) { + let o2, s2 = 0; + if (n2 && typeof n2 == "object") { + r2 !== void 0 && "context" in i2 && i2.context === void 0 && (i2.context = r2); + for (o2 = Qe(n2); s2 < o2.length; s2++) + t2 = wi(e2, t2, o2[s2], n2[o2[s2]], i2); + } else if (n2 && bi.test(n2)) + for (o2 = n2.split(bi); s2 < o2.length; s2++) + t2 = e2(t2, o2[s2], r2, i2); + else + t2 = e2(t2, n2, r2, i2); + return t2; + }; + _i.on = function(e2, t2, n2) { + if (this._events = wi(Si, this._events || {}, e2, t2, {context: n2, ctx: this, listening: yi}), yi) { + (this._listeners || (this._listeners = {}))[yi.id] = yi, yi.interop = false; + } + return this; + }, _i.listenTo = function(e2, t2, n2) { + if (!e2) + return this; + const r2 = e2._listenId || (e2._listenId = vi("l")), i2 = this._listeningTo || (this._listeningTo = {}); + let o2 = yi = i2[r2]; + o2 || (this._listenId || (this._listenId = vi("l")), o2 = yi = i2[r2] = new Ti(this, e2)); + const s2 = xi(e2, t2, n2, this); + if (yi = void 0, s2) + throw s2; + return o2.interop && o2.on(t2, n2), this; + }; + const Si = function(e2, t2, n2, r2) { + if (n2) { + const i2 = e2[t2] || (e2[t2] = []), o2 = r2.context, s2 = r2.ctx, a2 = r2.listening; + a2 && a2.count++, i2.push({callback: n2, context: o2, ctx: o2 || s2, listening: a2}); + } + return e2; + }, xi = function(e2, t2, n2, r2) { + try { + e2.on(t2, n2, r2); + } catch (e3) { + return e3; + } + }; + _i.off = function(e2, t2, n2) { + return this._events ? (this._events = wi(Ei, this._events, e2, t2, {context: n2, listeners: this._listeners}), this) : this; + }, _i.stopListening = function(e2, t2, n2) { + const r2 = this._listeningTo; + if (!r2) + return this; + const i2 = e2 ? [e2._listenId] : Qe(r2); + for (let e3 = 0; e3 < i2.length; e3++) { + const o2 = r2[i2[e3]]; + if (!o2) + break; + o2.obj.off(t2, n2, this), o2.interop && o2.off(t2, n2); + } + return oi(r2) && (this._listeningTo = void 0), this; + }; + const Ei = function(e2, t2, n2, r2) { + if (!e2) + return; + const i2 = r2.context, o2 = r2.listeners; + let s2, a2 = 0; + if (t2 || i2 || n2) { + for (s2 = t2 ? [t2] : Qe(e2); a2 < s2.length; a2++) { + const r3 = e2[t2 = s2[a2]]; + if (!r3) + break; + const o3 = []; + for (let e3 = 0; e3 < r3.length; e3++) { + const s3 = r3[e3]; + if (n2 && n2 !== s3.callback && n2 !== s3.callback._callback || i2 && i2 !== s3.context) + o3.push(s3); + else { + const e4 = s3.listening; + e4 && e4.off(t2, n2); + } + } + o3.length ? e2[t2] = o3 : delete e2[t2]; + } + return e2; + } + for (s2 = Qe(o2); a2 < s2.length; a2++) + o2[s2[a2]].cleanup(); + }; + _i.once = function(e2, t2, n2) { + const r2 = wi(Ai, {}, e2, t2, this.off.bind(this)); + return typeof e2 == "string" && n2 == null && (t2 = void 0), this.on(r2, t2, n2); + }, _i.listenToOnce = function(e2, t2, n2) { + const r2 = wi(Ai, {}, t2, n2, this.stopListening.bind(this, e2)); + return this.listenTo(e2, r2); + }; + const Ai = function(e2, t2, n2, r2) { + if (n2) { + const i2 = e2[t2] = gi(function() { + r2(t2, i2), n2.apply(this, arguments); + }); + i2._callback = n2; + } + return e2; + }; + _i.trigger = function(e2) { + if (!this._events) + return this; + const t2 = Math.max(0, arguments.length - 1), n2 = Array(t2); + for (let e3 = 0; e3 < t2; e3++) + n2[e3] = arguments[e3 + 1]; + return wi(Ci, this._events, e2, void 0, n2), this; + }; + const Ci = function(e2, t2, n2, r2) { + if (e2) { + const n3 = e2[t2]; + let i2 = e2.all; + n3 && i2 && (i2 = i2.slice()), n3 && ji(n3, r2), i2 && ji(i2, [t2].concat(r2)); + } + return e2; + }, ji = function(e2, t2) { + let n2, r2 = -1; + const i2 = e2.length, o2 = t2[0], s2 = t2[1], a2 = t2[2]; + switch (t2.length) { + case 0: + for (; ++r2 < i2; ) + (n2 = e2[r2]).callback.call(n2.ctx); + return; + case 1: + for (; ++r2 < i2; ) + (n2 = e2[r2]).callback.call(n2.ctx, o2); + return; + case 2: + for (; ++r2 < i2; ) + (n2 = e2[r2]).callback.call(n2.ctx, o2, s2); + return; + case 3: + for (; ++r2 < i2; ) + (n2 = e2[r2]).callback.call(n2.ctx, o2, s2, a2); + return; + default: + for (; ++r2 < i2; ) + (n2 = e2[r2]).callback.apply(n2.ctx, t2); + return; + } + }, Ti = function(e2, t2) { + this.id = e2._listenId, this.listener = e2, this.obj = t2, this.interop = true, this.count = 0, this._events = void 0; + }; + Ti.prototype.on = _i.on, Ti.prototype.off = function(e2, t2) { + let n2; + this.interop ? (this._events = wi(Ei, this._events, e2, t2, {context: void 0, listeners: void 0}), n2 = !this._events) : (this.count--, n2 = this.count === 0), n2 && this.cleanup(); + }, Ti.prototype.cleanup = function() { + delete this.listener._listeningTo[this.obj._listenId], this.interop || delete this.obj._listeners[this.id]; + }, _i.bind = _i.on, _i.unbind = _i.off; + var Oi = function(e2) { + return Yt(e2, 4); + }, ki = Object.prototype, Ni = ki.hasOwnProperty, Ii = jr(function(e2, t2) { + e2 = Object(e2); + var n2 = -1, r2 = t2.length, i2 = r2 > 2 ? t2[2] : void 0; + for (i2 && Tr(t2[0], t2[1], i2) && (r2 = 1); ++n2 < r2; ) + for (var o2 = t2[n2], s2 = tt(o2), c2 = -1, l2 = s2.length; ++c2 < l2; ) { + var u2 = s2[c2], d2 = e2[u2]; + (d2 === void 0 || a(d2, ki[u2]) && !Ni.call(e2, u2)) && (e2[u2] = o2[u2]); + } + return e2; + }); + var Mi = function(e2, t2, n2) { + if (typeof e2 != "function") + throw new TypeError("Expected a function"); + return setTimeout(function() { + e2.apply(void 0, n2); + }, t2); + }, Ri = jr(function(e2, t2) { + return Mi(e2, 1, t2); + }); + var Di = function(e2) { + return function(t2) { + return e2 == null ? void 0 : e2[t2]; + }; + }({"&": "&", "<": "<", ">": ">", '"': """, "'": "'"}), Pi = /[&<>"']/g, Li = RegExp(Pi.source); + var zi = function(e2) { + return (e2 = Wr(e2)) && Li.test(e2) ? e2.replace(Pi, Di) : e2; + }; + var Fi = function(e2) { + return function(t2, n2, r2) { + for (var i2 = -1, o2 = Object(t2), s2 = r2(t2), a2 = s2.length; a2--; ) { + var c2 = s2[e2 ? a2 : ++i2]; + if (n2(o2[c2], c2, o2) === false) + break; + } + return t2; + }; + }, Bi = Fi(); + var qi = function(e2, t2) { + return e2 && Bi(e2, t2, Qe); + }; + var Hi = function(e2, t2, n2, r2) { + return qi(e2, function(e3, i2, o2) { + t2(r2, n2(e3), i2, o2); + }), r2; + }; + var Ui = function(e2, t2) { + return function(n2, r2) { + return Hi(n2, e2, t2(r2), {}); + }; + }, $i = Object.prototype.toString, Wi = Ui(function(e2, t2, n2) { + t2 != null && typeof t2.toString != "function" && (t2 = $i.call(t2)), e2[t2] = n2; + }, xr(br)); + var Gi = function(e2) { + return this.__data__.set(e2, "__lodash_hash_undefined__"), this; + }; + var Vi = function(e2) { + return this.__data__.has(e2); + }; + function Ji(e2) { + var t2 = -1, n2 = e2 == null ? 0 : e2.length; + for (this.__data__ = new fe(); ++t2 < n2; ) + this.add(e2[t2]); + } + Ji.prototype.add = Ji.prototype.push = Gi, Ji.prototype.has = Vi; + var Xi = Ji; + var Qi = function(e2, t2) { + for (var n2 = -1, r2 = e2 == null ? 0 : e2.length; ++n2 < r2; ) + if (t2(e2[n2], n2, e2)) + return true; + return false; + }; + var Yi = function(e2, t2) { + return e2.has(t2); + }; + var Ki = function(e2, t2, n2, r2, i2, o2) { + var s2 = 1 & n2, a2 = e2.length, c2 = t2.length; + if (a2 != c2 && !(s2 && c2 > a2)) + return false; + var l2 = o2.get(e2); + if (l2 && o2.get(t2)) + return l2 == t2; + var u2 = -1, d2 = true, h2 = 2 & n2 ? new Xi() : void 0; + for (o2.set(e2, t2), o2.set(t2, e2); ++u2 < a2; ) { + var f2 = e2[u2], p2 = t2[u2]; + if (r2) + var g2 = s2 ? r2(p2, f2, u2, t2, e2, o2) : r2(f2, p2, u2, e2, t2, o2); + if (g2 !== void 0) { + if (g2) + continue; + d2 = false; + break; + } + if (h2) { + if (!Qi(t2, function(e3, t3) { + if (!Yi(h2, t3) && (f2 === e3 || i2(f2, e3, n2, r2, o2))) + return h2.push(t3); + })) { + d2 = false; + break; + } + } else if (f2 !== p2 && !i2(f2, p2, n2, r2, o2)) { + d2 = false; + break; + } + } + return o2.delete(e2), o2.delete(t2), d2; + }; + var Zi = function(e2) { + var t2 = -1, n2 = Array(e2.size); + return e2.forEach(function(e3, r2) { + n2[++t2] = [r2, e3]; + }), n2; + }; + var eo = function(e2) { + var t2 = -1, n2 = Array(e2.size); + return e2.forEach(function(e3) { + n2[++t2] = e3; + }), n2; + }, to = w ? w.prototype : void 0, no = to ? to.valueOf : void 0; + var ro = function(e2, t2, n2, r2, i2, o2, s2) { + switch (n2) { + case "[object DataView]": + if (e2.byteLength != t2.byteLength || e2.byteOffset != t2.byteOffset) + return false; + e2 = e2.buffer, t2 = t2.buffer; + case "[object ArrayBuffer]": + return !(e2.byteLength != t2.byteLength || !o2(new Nt(e2), new Nt(t2))); + case "[object Boolean]": + case "[object Date]": + case "[object Number]": + return a(+e2, +t2); + case "[object Error]": + return e2.name == t2.name && e2.message == t2.message; + case "[object RegExp]": + case "[object String]": + return e2 == t2 + ""; + case "[object Map]": + var c2 = Zi; + case "[object Set]": + var l2 = 1 & r2; + if (c2 || (c2 = eo), e2.size != t2.size && !l2) + return false; + var u2 = s2.get(e2); + if (u2) + return u2 == t2; + r2 |= 2, s2.set(e2, t2); + var d2 = Ki(c2(e2), c2(t2), r2, i2, o2, s2); + return s2.delete(e2), d2; + case "[object Symbol]": + if (no) + return no.call(e2) == no.call(t2); + } + return false; + }, io = Object.prototype.hasOwnProperty; + var oo = function(e2, t2, n2, r2, i2, o2) { + var s2 = 1 & n2, a2 = mt(e2), c2 = a2.length; + if (c2 != mt(t2).length && !s2) + return false; + for (var l2 = c2; l2--; ) { + var u2 = a2[l2]; + if (!(s2 ? u2 in t2 : io.call(t2, u2))) + return false; + } + var d2 = o2.get(e2); + if (d2 && o2.get(t2)) + return d2 == t2; + var h2 = true; + o2.set(e2, t2), o2.set(t2, e2); + for (var f2 = s2; ++l2 < c2; ) { + var p2 = e2[u2 = a2[l2]], g2 = t2[u2]; + if (r2) + var m2 = s2 ? r2(g2, p2, u2, t2, e2, o2) : r2(p2, g2, u2, e2, t2, o2); + if (!(m2 === void 0 ? p2 === g2 || i2(p2, g2, n2, r2, o2) : m2)) { + h2 = false; + break; + } + f2 || (f2 = u2 == "constructor"); + } + if (h2 && !f2) { + var v2 = e2.constructor, _2 = t2.constructor; + v2 == _2 || !("constructor" in e2) || !("constructor" in t2) || typeof v2 == "function" && v2 instanceof v2 && typeof _2 == "function" && _2 instanceof _2 || (h2 = false); + } + return o2.delete(e2), o2.delete(t2), h2; + }, so = Object.prototype.hasOwnProperty; + var ao = function(e2, t2, n2, r2, i2, o2) { + var s2 = ke(e2), a2 = ke(t2), c2 = s2 ? "[object Array]" : Tt(e2), l2 = a2 ? "[object Array]" : Tt(t2), u2 = (c2 = c2 == "[object Arguments]" ? "[object Object]" : c2) == "[object Object]", d2 = (l2 = l2 == "[object Arguments]" ? "[object Object]" : l2) == "[object Object]", h2 = c2 == l2; + if (h2 && Object(Ne.a)(e2)) { + if (!Object(Ne.a)(t2)) + return false; + s2 = true, u2 = false; + } + if (h2 && !u2) + return o2 || (o2 = new me()), s2 || Be(e2) ? Ki(e2, t2, n2, r2, i2, o2) : ro(e2, t2, c2, n2, r2, i2, o2); + if (!(1 & n2)) { + var f2 = u2 && so.call(e2, "__wrapped__"), p2 = d2 && so.call(t2, "__wrapped__"); + if (f2 || p2) { + var g2 = f2 ? e2.value() : e2, m2 = p2 ? t2.value() : t2; + return o2 || (o2 = new me()), i2(g2, m2, n2, r2, o2); + } + } + return !!h2 && (o2 || (o2 = new me()), oo(e2, t2, n2, r2, i2, o2)); + }; + var co = function e2(t2, n2, r2, i2, o2) { + return t2 === n2 || (t2 == null || n2 == null || !Ee(t2) && !Ee(n2) ? t2 != t2 && n2 != n2 : ao(t2, n2, r2, i2, e2, o2)); + }; + var lo = function(e2, t2) { + return co(e2, t2); + }; + var uo = function(e2, t2, n2, r2) { + var i2 = n2.length, o2 = i2, s2 = !r2; + if (e2 == null) + return !o2; + for (e2 = Object(e2); i2--; ) { + var a2 = n2[i2]; + if (s2 && a2[2] ? a2[1] !== e2[a2[0]] : !(a2[0] in e2)) + return false; + } + for (; ++i2 < o2; ) { + var c2 = (a2 = n2[i2])[0], l2 = e2[c2], u2 = a2[1]; + if (s2 && a2[2]) { + if (l2 === void 0 && !(c2 in e2)) + return false; + } else { + var d2 = new me(); + if (r2) + var h2 = r2(l2, u2, c2, e2, t2, d2); + if (!(h2 === void 0 ? co(u2, l2, 3, r2, d2) : h2)) + return false; + } + } + return true; + }; + var ho = function(e2) { + return e2 == e2 && !N(e2); + }; + var fo = function(e2) { + for (var t2 = Qe(e2), n2 = t2.length; n2--; ) { + var r2 = t2[n2], i2 = e2[r2]; + t2[n2] = [r2, i2, ho(i2)]; + } + return t2; + }; + var po = function(e2, t2) { + return function(n2) { + return n2 != null && (n2[e2] === t2 && (t2 !== void 0 || e2 in Object(n2))); + }; + }; + var go = function(e2) { + var t2 = fo(e2); + return t2.length == 1 && t2[0][2] ? po(t2[0][0], t2[0][1]) : function(n2) { + return n2 === e2 || uo(n2, e2, t2); + }; + }; + var mo = function(e2, t2) { + for (var n2 = 0, r2 = (t2 = Gr(t2, e2)).length; e2 != null && n2 < r2; ) + e2 = e2[Vr(t2[n2++])]; + return n2 && n2 == r2 ? e2 : void 0; + }; + var vo = function(e2, t2, n2) { + var r2 = e2 == null ? void 0 : mo(e2, t2); + return r2 === void 0 ? n2 : r2; + }; + var _o = function(e2, t2) { + return e2 != null && t2 in Object(e2); + }; + var bo = function(e2, t2) { + return e2 != null && Jr(e2, t2, _o); + }; + var yo = function(e2, t2) { + return Dr(e2) && ho(t2) ? po(Vr(e2), t2) : function(n2) { + var r2 = vo(n2, e2); + return r2 === void 0 && r2 === t2 ? bo(n2, e2) : co(t2, r2, 3); + }; + }; + var wo = function(e2) { + return function(t2) { + return t2 == null ? void 0 : t2[e2]; + }; + }; + var So = function(e2) { + return function(t2) { + return mo(t2, e2); + }; + }; + var xo = function(e2) { + return Dr(e2) ? wo(Vr(e2)) : So(e2); + }; + var Eo = function(e2) { + return typeof e2 == "function" ? e2 : e2 == null ? br : typeof e2 == "object" ? ke(e2) ? yo(e2[0], e2[1]) : go(e2) : xo(e2); + }; + var Ao = function(e2) { + return Eo(typeof e2 == "function" ? e2 : Yt(e2, 1)); + }; + var Co = function(e2) { + var t2 = e2 == null ? 0 : e2.length; + return t2 ? e2[t2 - 1] : void 0; + }; + var jo = function(e2, t2, n2) { + var r2 = -1, i2 = e2.length; + t2 < 0 && (t2 = -t2 > i2 ? 0 : i2 + t2), (n2 = n2 > i2 ? i2 : n2) < 0 && (n2 += i2), i2 = t2 > n2 ? 0 : n2 - t2 >>> 0, t2 >>>= 0; + for (var o2 = Array(i2); ++r2 < i2; ) + o2[r2] = e2[r2 + t2]; + return o2; + }; + var To = function(e2, t2) { + return t2.length < 2 ? e2 : mo(e2, jo(t2, 0, -1)); + }; + var Oo = function(e2, t2) { + return t2 = Gr(t2, e2), (e2 = To(e2, t2)) == null || delete e2[Vr(Co(t2))]; + }; + var ko = function(e2) { + return kn(e2) ? void 0 : e2; + }, No = w ? w.isConcatSpreadable : void 0; + var Io = function(e2) { + return ke(e2) || Oe(e2) || !!(No && e2 && e2[No]); + }; + var Mo = function e2(t2, n2, r2, i2, o2) { + var s2 = -1, a2 = t2.length; + for (r2 || (r2 = Io), o2 || (o2 = []); ++s2 < a2; ) { + var c2 = t2[s2]; + n2 > 0 && r2(c2) ? n2 > 1 ? e2(c2, n2 - 1, r2, i2, o2) : dt(o2, c2) : i2 || (o2[o2.length] = c2); + } + return o2; + }; + var Ro = function(e2) { + return (e2 == null ? 0 : e2.length) ? Mo(e2, 1) : []; + }; + var Do = function(e2) { + return Cr(Sr(e2, void 0, Ro), e2 + ""); + }, Po = Do(function(e2, t2) { + var n2 = {}; + if (e2 == null) + return n2; + var r2 = false; + t2 = qr(t2, function(t3) { + return t3 = Gr(t3, e2), r2 || (r2 = t3.length > 1), t3; + }), Se(e2, vt(e2), n2), r2 && (n2 = Yt(n2, 7, ko)); + for (var i2 = t2.length; i2--; ) + Oo(n2, t2[i2]); + return n2; + }); + var Lo = function(e2, t2, n2, r2) { + if (!N(e2)) + return e2; + for (var i2 = -1, o2 = (t2 = Gr(t2, e2)).length, s2 = o2 - 1, a2 = e2; a2 != null && ++i2 < o2; ) { + var c2 = Vr(t2[i2]), l2 = n2; + if (i2 != s2) { + var u2 = a2[c2]; + (l2 = r2 ? r2(u2, c2, a2) : void 0) === void 0 && (l2 = N(u2) ? u2 : Me(t2[i2 + 1]) ? [] : {}); + } + we(a2, c2, l2), a2 = a2[c2]; + } + return e2; + }; + var zo = function(e2, t2, n2) { + for (var r2 = -1, i2 = t2.length, o2 = {}; ++r2 < i2; ) { + var s2 = t2[r2], a2 = mo(e2, s2); + n2(a2, s2) && Lo(o2, Gr(s2, e2), a2); + } + return o2; + }; + var Fo = function(e2, t2) { + return zo(e2, t2, function(t3, n2) { + return bo(e2, n2); + }); + }, Bo = Do(function(e2, t2) { + return e2 == null ? {} : Fo(e2, t2); + }); + const qo = function(e2, t2) { + let n2 = e2 || {}; + t2 || (t2 = {}), this.preinitialize.apply(this, arguments), this.cid = vi(this.cidPrefix), this.attributes = {}, t2.collection && (this.collection = t2.collection), t2.parse && (n2 = this.parse(n2, t2) || {}); + const r2 = Qr(this, "defaults"); + n2 = Ii(Or({}, r2, n2), r2), this.set(n2, t2), this.changed = {}, this.initialize.apply(this, arguments); + }; + qo.extend = Yr, Object.assign(qo.prototype, _i, {changed: null, validationError: null, idAttribute: "id", cidPrefix: "c", preinitialize: function() { + }, initialize: function() { + }, toJSON: function(e2) { + return Oi(this.attributes); + }, sync: function(e2, t2, n2) { + return ni(this)(e2, t2, n2); + }, get: function(e2) { + return this.attributes[e2]; + }, keys: function() { + return Object.keys(this.attributes); + }, values: function() { + return Object.values(this.attributes); + }, pairs: function() { + return this.entries(); + }, entries: function() { + return Object.entries(this.attributes); + }, invert: function() { + return Wi(this.attributes); + }, pick: function(...e2) { + return e2.length === 1 && Array.isArray(e2[0]) && (e2 = e2[0]), Bo(this.attributes, e2); + }, omit: function(...e2) { + return e2.length === 1 && Array.isArray(e2[0]) && (e2 = e2[0]), Po(this.attributes, e2); + }, isEmpty: function() { + return oi(this.attributes); + }, escape: function(e2) { + return zi(this.get(e2)); + }, has: function(e2) { + return this.get(e2) != null; + }, matches: function(e2) { + return !!Ao(e2)(this.attributes); + }, set: function(e2, t2, n2) { + if (e2 == null) + return this; + let r2; + if (typeof e2 == "object" ? (r2 = e2, n2 = t2) : (r2 = {})[e2] = t2, n2 || (n2 = {}), !this._validate(r2, n2)) + return false; + const i2 = n2.unset, o2 = n2.silent, s2 = [], a2 = this._changing; + this._changing = true, a2 || (this._previousAttributes = Oi(this.attributes), this.changed = {}); + const c2 = this.attributes, l2 = this.changed, u2 = this._previousAttributes; + for (const e3 in r2) + t2 = r2[e3], lo(c2[e3], t2) || s2.push(e3), lo(u2[e3], t2) ? delete l2[e3] : l2[e3] = t2, i2 ? delete c2[e3] : c2[e3] = t2; + if (this.idAttribute in r2 && (this.id = this.get(this.idAttribute)), !o2) { + s2.length && (this._pending = n2); + for (let e3 = 0; e3 < s2.length; e3++) + this.trigger("change:" + s2[e3], this, c2[s2[e3]], n2); + } + if (a2) + return this; + if (!o2) + for (; this._pending; ) + n2 = this._pending, this._pending = false, this.trigger("change", this, n2); + return this._pending = false, this._changing = false, this; + }, unset: function(e2, t2) { + return this.set(e2, void 0, Or({}, t2, {unset: true})); + }, clear: function(e2) { + const t2 = {}; + for (const e3 in this.attributes) + t2[e3] = void 0; + return this.set(t2, Or({}, e2, {unset: true})); + }, hasChanged: function(e2) { + return e2 == null ? !oi(this.changed) : Xr(this.changed, e2); + }, changedAttributes: function(e2) { + if (!e2) + return !!this.hasChanged() && Oi(this.changed); + const t2 = this._changing ? this._previousAttributes : this.attributes, n2 = {}; + let r2; + for (const i2 in e2) { + const o2 = e2[i2]; + lo(t2[i2], o2) || (n2[i2] = o2, r2 = true); + } + return !!r2 && n2; + }, previous: function(e2) { + return e2 != null && this._previousAttributes ? this._previousAttributes[e2] : null; + }, previousAttributes: function() { + return Oi(this._previousAttributes); + }, fetch: function(e2) { + e2 = Or({parse: true}, e2); + const t2 = this, n2 = e2.success; + return e2.success = function(r2) { + const i2 = e2.parse ? t2.parse(r2, e2) : r2; + if (!t2.set(i2, e2)) + return false; + n2 && n2.call(e2.context, t2, r2, e2), t2.trigger("sync", t2, r2, e2); + }, ei(this, e2), this.sync("read", this, e2); + }, save: function(e2, t2, n2) { + let r2; + e2 == null || typeof e2 == "object" ? (r2 = e2, n2 = t2) : (r2 = {})[e2] = t2; + const i2 = (n2 = Or({validate: true, parse: true}, n2)).wait, o2 = n2.promise, s2 = o2 && Kr(); + if (r2 && !i2) { + if (!this.set(r2, n2)) + return false; + } else if (!this._validate(r2, n2)) + return false; + const a2 = this, c2 = n2.success, l2 = n2.error, u2 = this.attributes; + n2.success = function(e3) { + a2.attributes = u2; + let t3 = n2.parse ? a2.parse(e3, n2) : e3; + if (i2 && (t3 = Or({}, r2, t3)), t3 && !a2.set(t3, n2)) + return false; + c2 && c2.call(n2.context, a2, e3, n2), a2.trigger("sync", a2, e3, n2), o2 && s2.resolve(); + }, n2.error = function(e3, t3, n3) { + l2 && l2.call(n3.context, e3, t3, n3), o2 && s2.reject(t3); + }, ei(this, n2), r2 && i2 && (this.attributes = Or({}, u2, r2)); + const d2 = this.isNew() ? "create" : n2.patch ? "patch" : "update"; + d2 !== "patch" || n2.attrs || (n2.attrs = r2); + const h2 = this.sync(d2, this, n2); + return this.attributes = u2, o2 ? s2 : h2; + }, destroy: function(e2) { + e2 = e2 ? Oi(e2) : {}; + const t2 = this, n2 = e2.success, r2 = e2.wait, i2 = function() { + t2.stopListening(), t2.trigger("destroy", t2, t2.collection, e2); + }; + e2.success = function(o3) { + r2 && i2(), n2 && n2.call(e2.context, t2, o3, e2), t2.isNew() || t2.trigger("sync", t2, o3, e2); + }; + let o2 = false; + return this.isNew() ? Ri(e2.success) : (ei(this, e2), o2 = this.sync("delete", this, e2)), r2 || i2(), o2; + }, url: function() { + const e2 = Qr(this, "urlRoot") || Qr(this.collection, "url") || Zr(); + if (this.isNew()) + return e2; + const t2 = this.get(this.idAttribute); + return e2.replace(/[^\/]$/, "$&/") + encodeURIComponent(t2); + }, parse: function(e2, t2) { + return e2; + }, clone: function() { + return new this.constructor(this.attributes); + }, isNew: function() { + return !this.has(this.idAttribute); + }, isValid: function(e2) { + return this._validate({}, Or({}, e2, {validate: true})); + }, _validate: function(e2, t2) { + if (!t2.validate || !this.validate) + return true; + e2 = Or({}, this.attributes, e2); + const n2 = this.validationError = this.validate(e2, t2) || null; + return !n2 || (this.trigger("invalid", this, n2, Or(t2, {validationError: n2})), false); + }}); + var Ho = function(e2) { + for (var t2 = -1, n2 = e2 == null ? 0 : e2.length, r2 = 0, i2 = []; ++t2 < n2; ) { + var o2 = e2[t2]; + o2 && (i2[r2++] = o2); + } + return i2; + }; + /** + * @copyright 2020, the Converse.js contributors + * @license Mozilla Public License (MPLv2) + * @description This is the core utilities module. + */ + const Uo = vr.f.Strophe, $o = {isTagEqual: function(e2, t2) { + if (e2.nodeTree) + return $o.isTagEqual(e2.nodeTree, t2); + if (e2 instanceof Element) + return Uo.isTagEqual(e2, t2); + throw Error("isTagEqual called with value which isn't an element or Strophe.Builder instance"); + }}, Wo = new DOMParser(), Go = Wo.parseFromString("invalid", "text/xml").getElementsByTagName("parsererror")[0].namespaceURI; + /** + * Clears the specified timeout and interval. + * @method u#clearTimers + * @param {number} timeout - Id if the timeout to clear. + * @param {number} interval - Id of the interval to clear. + * @private + * @copyright Simen Bekkhus 2016 + * @license MIT + */ + function Vo(e2, t2) { + clearTimeout(e2), clearInterval(t2); + } + /** + * Creates a {@link Promise} that resolves if the passed in function returns a truthy value. + * Rejects if it throws or does not return truthy within the given max_wait. + * @method u#waitUntil + * @param {Function} func - The function called every check_delay, + * and the result of which is the resolved value of the promise. + * @param {number} [max_wait=300] - The time to wait before rejecting the promise. + * @param {number} [check_delay=3] - The time to wait before each invocation of {func}. + * @returns {Promise} A promise resolved with the value of func, + * or rejected with the exception thrown by it or it times out. + * @copyright Simen Bekkhus 2016 + * @license MIT + */ + $o.getJIDFromURI = function(e2) { + return e2.startsWith("xmpp:") && e2.endsWith("?join") ? e2.replace(/^xmpp:/, "").replace(/\?join$/, "") : e2; + }, $o.toStanza = function(e2) { + const t2 = Wo.parseFromString(e2, "text/xml"); + if (t2.getElementsByTagNameNS(Go, "parsererror").length) + throw new Error("Parser Error: ".concat(e2)); + return t2.firstElementChild; + }, $o.getLongestSubstring = function(e2, t2) { + return t2.reduce(function(t3, n2) { + return e2.startsWith(n2) && n2.length > t3.length ? n2 : t3; + }, ""); + }, $o.prefixMentions = function(e2) { + let t2 = e2.get("message"); + return (e2.get("references") || []).sort((e3, t3) => t3.begin - e3.begin).forEach((e3) => { + t2 = "".concat(t2.slice(0, e3.begin), "@").concat(t2.slice(e3.begin)); + }), t2; + }, $o.isValidJID = function(e2) { + return typeof e2 == "string" && (Ho(e2.split("@")).length === 2 && !e2.startsWith("@") && !e2.endsWith("@")); + }, $o.isValidMUCJID = function(e2) { + return !e2.startsWith("@") && !e2.endsWith("@"); + }, $o.isSameBareJID = function(e2, t2) { + return typeof e2 == "string" && typeof t2 == "string" && Uo.getBareJidFromJid(e2).toLowerCase() === Uo.getBareJidFromJid(t2).toLowerCase(); + }, $o.isSameDomain = function(e2, t2) { + return typeof e2 == "string" && typeof t2 == "string" && Uo.getDomainFromJid(e2).toLowerCase() === Uo.getDomainFromJid(t2).toLowerCase(); + }, $o.isNewMessage = function(e2) { + return e2 instanceof Element ? !(mr()('result[xmlns="'.concat(Uo.NS.MAM, '"]'), e2).length && mr()('delay[xmlns="'.concat(Uo.NS.DELAY, '"]'), e2).length) : (e2 instanceof qo && (e2 = e2.attributes), !(e2.is_delayed && e2.is_archived)); + }, $o.shouldCreateMessage = function(e2) { + return e2.retracted || !$o.isEmptyMessage(e2); + }, $o.shouldCreateGroupchatMessage = function(e2) { + return e2.nick && ($o.shouldCreateMessage(e2) || e2.is_tombstone); + }, $o.isEmptyMessage = function(e2) { + return e2 instanceof qo && (e2 = e2.attributes), !(e2.oob_url || e2.file || e2.is_encrypted && e2.plaintext || e2.message); + }, $o.isOnlyChatStateNotification = function(e2) { + return e2 instanceof Element ? e2.querySelector("body") === null && (e2.querySelector("active") !== null || e2.querySelector("composing") !== null || e2.querySelector("inactive") !== null || e2.querySelector("paused") !== null || e2.querySelector("gone") !== null) : (e2 instanceof qo && (e2 = e2.attributes), e2.chat_state && $o.isEmptyMessage(e2)); + }, $o.isOnlyMessageDeliveryReceipt = function(e2) { + return e2 instanceof Element ? e2.querySelector("body") === null && e2.querySelector("received") !== null : (e2 instanceof qo && (e2 = e2.attributes), e2.received && $o.isEmptyMessage(e2)); + }, $o.isChatRoom = function(e2) { + return e2 && e2.get("type") === "chatroom"; + }, $o.isErrorObject = function(e2) { + return e2 instanceof Error; + }, $o.isErrorStanza = function(e2) { + return !!Dn(e2) && e2.getAttribute("type") === "error"; + }, $o.isForbiddenError = function(e2) { + return !!Dn(e2) && mr()('error[type="auth"] forbidden[xmlns="'.concat(Uo.NS.STANZAS, '"]'), e2).length > 0; + }, $o.isServiceUnavailableError = function(e2) { + return !!Dn(e2) && mr()('error[type="cancel"] service-unavailable[xmlns="'.concat(Uo.NS.STANZAS, '"]'), e2).length > 0; + }, $o.merge = function e2(t2, n2) { + for (const r2 in n2) + N(t2[r2]) ? e2(t2[r2], n2[r2]) : t2[r2] = n2[r2]; + }, $o.getOuterWidth = function(e2, t2 = false) { + let n2 = e2.offsetWidth; + if (!t2) + return n2; + const r2 = window.getComputedStyle(e2); + return n2 += parseInt(r2.marginLeft ? r2.marginLeft : 0, 10) + parseInt(r2.marginRight ? r2.marginRight : 0, 10), n2; + }, $o.stringToElement = function(e2) { + var t2 = document.createElement("div"); + return t2.innerHTML = e2, t2.firstElementChild; + }, $o.matchesSelector = function(e2, t2) { + const n2 = e2.matches || e2.matchesSelector || e2.msMatchesSelector || e2.mozMatchesSelector || e2.webkitMatchesSelector || e2.oMatchesSelector; + return !!n2 && n2.call(e2, t2); + }, $o.queryChildren = function(e2, t2) { + return Array.from(e2.childNodes).filter((e3) => $o.matchesSelector(e3, t2)); + }, $o.contains = function(e2, t2) { + const n2 = (e3, n3) => e3.get(n3).toLowerCase().includes(t2.toLowerCase()); + return function(t3) { + if (typeof e2 == "object") + return Object.keys(e2).reduce((e3, r2) => e3 || n2(t3, r2), false); + if (typeof e2 == "string") + return n2(t3, e2); + throw new TypeError("contains: wrong attribute type. Must be string or array."); + }; + }, $o.isOfType = function(e2, t2) { + return t2.get("type") == e2; + }, $o.isInstance = function(e2, t2) { + return t2 instanceof e2; + }, $o.getAttribute = function(e2, t2) { + return t2.get(e2); + }, $o.contains.not = function(e2, t2) { + return function(n2) { + return !$o.contains(e2, t2)(n2); + }; + }, $o.rootContains = function(e2, t2) { + return e2 !== document || e2.contains ? e2.contains ? e2.contains(t2) : window.HTMLElement.prototype.contains.call(e2, t2) : document.head.contains(t2) || document.body.contains(t2); + }, $o.createFragmentFromText = function(e2) { + var t2, n2 = document.createDocumentFragment(), r2 = document.createElement("body"); + for (r2.innerHTML = e2; t2 = r2.firstChild; ) + n2.appendChild(t2); + return n2; + }, $o.isPersistableModel = function(e2) { + return e2.collection && e2.collection.browserStorage; + }, $o.getResolveablePromise = function() { + const e2 = {isResolved: false, isPending: true, isRejected: false}, t2 = new Promise((t3, n2) => { + e2.resolve = t3, e2.reject = n2; + }); + return Object.assign(t2, e2), t2.then(function(e3) { + return t2.isResolved = true, t2.isPending = false, t2.isRejected = false, e3; + }, function(e3) { + throw t2.isResolved = false, t2.isPending = false, t2.isRejected = true, e3; + }), t2; + }, $o.interpolate = function(e2, t2) { + return e2.replace(/{{{([^{}]*)}}}/g, (e3, n2) => { + var r2 = t2[n2]; + return typeof r2 == "string" || typeof r2 == "number" ? r2 : e3; + }); + }, $o.onMultipleEvents = function(e2 = [], t2) { + let n2 = []; + function r2(r3) { + n2.push(r3), e2.length === n2.length && (t2(n2), n2 = []); + } + e2.forEach((e3) => e3.object.on(e3.event, r2)); + }, $o.safeSave = function(e2, t2, n2) { + $o.isPersistableModel(e2) ? e2.save(t2, n2) : e2.set(t2, n2); + }, $o.siblingIndex = function(e2) { + for (var t2 = 0; e2 = e2.previousElementSibling; t2++) + ; + return t2; + }, $o.getCurrentWord = function(e2, t2, n2) { + t2 || (t2 = e2.selectionEnd || void 0); + let [r2] = e2.value.slice(0, t2).split(/\s/).slice(-1); + return n2 && ([r2] = r2.split(n2).slice(-1)), r2; + }, $o.isMentionBoundary = (e2) => e2 !== "@" && RegExp("(\\p{Z}|\\p{P})", "u").test(e2), $o.replaceCurrentWord = function(e2, t2) { + const n2 = e2.selectionEnd || void 0, r2 = Co(e2.value.slice(0, n2).split(/\s/)), i2 = e2.value, o2 = $o.isMentionBoundary(r2[0]) ? r2[0] : ""; + e2.value = i2.slice(0, n2 - r2.length) + o2 + "".concat(t2, " ") + i2.slice(n2); + const s2 = n2 - r2.length + t2.length + 1; + e2.selectionEnd = o2 ? s2 + 1 : s2; + }, $o.triggerEvent = function(e2, t2, n2 = "Event", r2 = true, i2 = true) { + const o2 = document.createEvent(n2); + o2.initEvent(t2, r2, i2), e2.dispatchEvent(o2); + }, $o.getSelectValues = function(e2) { + const t2 = [], n2 = e2 && e2.options; + for (var r2 = 0, i2 = n2.length; r2 < i2; r2++) { + const e3 = n2[r2]; + e3.selected && t2.push(e3.value || e3.text); + } + return t2; + }, $o.formatFingerprint = function(e2) { + e2 = e2.replace(/^05/, ""); + for (let t2 = 1; t2 < 8; t2++) { + const n2 = 8 * t2 + t2 - 1; + e2 = e2.slice(0, n2) + " " + e2.slice(n2); + } + return e2; + }, $o.appendArrayBuffer = function(e2, t2) { + const n2 = new Uint8Array(e2.byteLength + t2.byteLength); + return n2.set(new Uint8Array(e2), 0), n2.set(new Uint8Array(t2), e2.byteLength), n2.buffer; + }, $o.arrayBufferToHex = function(e2) { + return Array.prototype.map.call(new Uint8Array(e2), (e3) => ("00" + e3.toString(16)).slice(-2)).join(""); + }, $o.arrayBufferToString = function(e2) { + return new TextDecoder("utf-8").decode(e2); + }, $o.stringToArrayBuffer = function(e2) { + return new TextEncoder("utf-8").encode(e2).buffer; + }, $o.arrayBufferToBase64 = function(e2) { + return btoa(new Uint8Array(e2).reduce((e3, t2) => e3 + String.fromCharCode(t2), "")); + }, $o.base64ToArrayBuffer = function(e2) { + const t2 = window.atob(e2), n2 = t2.length, r2 = new Uint8Array(n2); + for (let e3 = 0; e3 < n2; e3++) + r2[e3] = t2.charCodeAt(e3); + return r2.buffer; + }, $o.getRandomInt = function(e2) { + return Math.floor(Math.random() * Math.floor(e2)); + }, $o.placeCaretAtEnd = function(e2) { + e2 !== document.activeElement && e2.focus(); + const t2 = 2 * e2.value.length; + setTimeout(() => e2.setSelectionRange(t2, t2), 1), this.scrollTop = 999999; + }, $o.getUniqueId = function(e2) { + const t2 = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e3) { + const t3 = 16 * Math.random() | 0; + return (e3 === "x" ? t3 : 3 & t3 | 8).toString(16); + }); + return typeof e2 == "string" || typeof e2 == "number" ? t2 + ":" + e2 : t2; + }, $o.waitUntil = function(e2, t2 = 300, n2 = 3) { + try { + const t3 = e2(); + if (t3) + return Promise.resolve(t3); + } catch (e3) { + return Promise.reject(e3); + } + const r2 = $o.getResolveablePromise(), i2 = new Error(); + const o2 = setInterval(function() { + try { + const t3 = e2(); + t3 && (Vo(s2, o2), r2.resolve(t3)); + } catch (e3) { + Vo(s2, o2), r2.reject(e3); + } + }, n2); + const s2 = setTimeout(function() { + Vo(s2, o2); + const e3 = "Wait until promise timed out: \n\n".concat(i2.stack); + console.trace(), zn.error(e3), r2.reject(new Error(e3)); + }, t2); + return r2; + }; + var Jo = $o; + const Xo = vr.f.Strophe, Qo = vr.f.$msg, {NS: Yo} = Xo; + function Ko(e2) { + const t2 = mr()('spoiler[xmlns="'.concat(Xo.NS.SPOILER, '"]'), e2).pop(); + return {is_spoiler: !!t2, spoiler_hint: t2 == null ? void 0 : t2.textContent}; + } + function Zo(e2) { + const t2 = mr()('x[xmlns="'.concat(Xo.NS.OUTOFBAND, '"]'), e2).pop(); + var n2, r2; + return t2 ? {oob_url: (n2 = t2.querySelector("url")) === null || n2 === void 0 ? void 0 : n2.textContent, oob_desc: (r2 = t2.querySelector("desc")) === null || r2 === void 0 ? void 0 : r2.textContent} : {}; + } + function es(e2, t2) { + const n2 = mr()('replace[xmlns="'.concat(Xo.NS.MESSAGE_CORRECT, '"]'), e2).pop(); + if (n2) { + const e3 = n2.getAttribute("id"), r2 = e3; + if (e3) { + const n3 = mr()('delay[xmlns="'.concat(Xo.NS.DELAY, '"]'), t2).pop(); + return {msgid: r2, replace_id: e3, edited: n3 ? En()(n3.getAttribute("stamp")).toISOString() : new Date().toISOString()}; + } + } + return {}; + } + function ts(e2, t2) { + var n2; + const r2 = mr()('encrypted[xmlns="'.concat(Xo.NS.OMEMO, '"]'), e2).pop(), i2 = {is_encrypted: !!r2}; + if (!r2 || Vc.settings.get("clear_cache_on_logout")) + return i2; + const o2 = r2.querySelector("header"); + i2.encrypted = {device_id: o2.getAttribute("sid")}; + const s2 = (n2 = t2.omemo_store) === null || n2 === void 0 ? void 0 : n2.get("device_id"), a2 = s2 && mr()('key[rid="'.concat(s2, '"]'), r2).pop(); + var c2; + a2 && Object.assign(i2.encrypted, {iv: o2.querySelector("iv").textContent, key: a2.textContent, payload: ((c2 = r2.querySelector("payload")) === null || c2 === void 0 ? void 0 : c2.textContent) || null, prekey: ["true", "1"].includes(a2.getAttribute("prekey"))}); + return i2; + } + function ns(e2, t2) { + return t2.sender !== "me" && !t2.is_carbon && !t2.is_archived && mr()('request[xmlns="'.concat(Xo.NS.RECEIPTS, '"]'), e2).length; + } + function rs(e2) { + const t2 = mr()('received[xmlns="'.concat(Xo.NS.RECEIPTS, '"]'), e2).pop(); + return t2 == null ? void 0 : t2.getAttribute("id"); + } + function is(e2) { + var t2; + return (t2 = mr()('\n composing[xmlns="'.concat(Yo.CHATSTATES, '"],\n paused[xmlns="').concat(Yo.CHATSTATES, '"],\n inactive[xmlns="').concat(Yo.CHATSTATES, '"],\n active[xmlns="').concat(Yo.CHATSTATES, '"],\n gone[xmlns="').concat(Yo.CHATSTATES, '"]'), e2).pop()) === null || t2 === void 0 ? void 0 : t2.nodeName; + } + function os(e2) { + const t2 = Xo.NS.CARBONS; + return mr()('message > received[xmlns="'.concat(t2, '"]'), e2).length > 0 || mr()('message > sent[xmlns="'.concat(t2, '"]'), e2).length > 0; + } + function ss(e2, t2) { + const n2 = {}, r2 = mr()('stanza-id[xmlns="'.concat(Xo.NS.SID, '"]'), e2).reduce((e3, t3) => (e3["stanza_id ".concat(t3.getAttribute("by"))] = t3.getAttribute("id"), e3), {}); + Object.assign(n2, r2); + const i2 = mr()('message > result[xmlns="'.concat(Xo.NS.MAM, '"]'), t2).pop(); + if (i2) { + const e3 = t2.getAttribute("from") || Uc.bare_jid; + n2["stanza_id ".concat(e3)] = i2.getAttribute("id"); + } + const o2 = mr()('origin-id[xmlns="'.concat(Xo.NS.SID, '"]'), e2).pop(); + return o2 && (n2.origin_id = o2.getAttribute("id")), n2; + } + function as(e2, t2) { + const n2 = mr()('> apply-to[xmlns="'.concat(Xo.NS.FASTEN, '"]'), e2).pop(); + if (n2) { + const e3 = n2.getAttribute("id"); + if (mr()('> retract[xmlns="'.concat(Xo.NS.RETRACT, '"]'), n2).pop()) { + const n3 = mr()('delay[xmlns="'.concat(Xo.NS.DELAY, '"]'), t2).pop(); + return {editable: false, retracted: n3 ? En()(n3.getAttribute("stamp")).toISOString() : new Date().toISOString(), retracted_id: e3}; + } + } else { + const t3 = mr()('> retracted[xmlns="'.concat(Xo.NS.RETRACT, '"]'), e2).pop(); + if (t3) + return {editable: false, is_tombstone: true, retracted: t3.getAttribute("stamp")}; + } + return {}; + } + function cs(e2) { + var t2; + const n2 = (t2 = e2.querySelector("body")) === null || t2 === void 0 ? void 0 : t2.textContent; + return mr()('reference[xmlns="'.concat(Xo.NS.REFERENCE, '"]'), e2).map((e3) => { + const t3 = e3.getAttribute("begin"), r2 = e3.getAttribute("end"); + return {begin: t3, end: r2, type: e3.getAttribute("type"), value: n2.slice(t3, r2), uri: e3.getAttribute("uri")}; + }); + } + function ls(e2, t2) { + Vc.send(Qo({to: e2.getAttribute("from"), type: "error", id: e2.getAttribute("id")}).c("error", {type: "cancel"}).c("not-allowed", {xmlns: "urn:ietf:params:xml:ns:xmpp-stanzas"}).up().c("text", {xmlns: "urn:ietf:params:xml:ns:xmpp-stanzas"}).t(t2)), zn.warn("Rejecting message stanza with the following reason: ".concat(t2)), zn.warn(e2); + } + function us(e2) { + if (e2.getAttribute("type") === "error") { + const t2 = e2.querySelector("error"), n2 = mr()('text[xmlns="'.concat(Xo.NS.STANZAS, '"]'), t2).pop(); + return {is_error: true, error_text: n2 == null ? void 0 : n2.textContent, error_type: t2.getAttribute("type"), error_condition: t2.firstElementChild.nodeName}; + } + return {}; + } + class ds extends Error { + constructor(e2, t2) { + super(e2, t2), this.name = "StanzaParseError", this.stanza = t2; + } + } + function hs(e2) { + if (mr()('message > forwarded[xmlns="'.concat(Xo.NS.FORWARD, '"]'), e2).length) { + ls(e2, "Forwarded messages not part of an encapsulating protocol are not supported"); + const t2 = e2.getAttribute("from"); + return new ds("Ignoring unencapsulated forwarded message from ".concat(t2), e2); + } + } + const fs = {isHeadline: (e2) => e2.getAttribute("type") === "headline", isServerMessage(e2) { + const t2 = e2.getAttribute("from"); + return !(e2.getAttribute("type") === "error" || !t2 || t2.includes("@")); + }, getChatMarker: (e2) => mr()('\n acknowledged[xmlns="'.concat(Xo.NS.MARKERS, '"],\n displayed[xmlns="').concat(Xo.NS.MARKERS, '"],\n received[xmlns="').concat(Xo.NS.MARKERS, '"]'), e2).pop(), isArchived: (e2) => !!mr()('message > result[xmlns="'.concat(Xo.NS.MAM, '"]'), e2).pop(), getAttributes: (e2) => e2.getAttributeNames().reduce((t2, n2) => (t2[n2] = Xo.xmlunescape(e2.getAttribute(n2)), t2), {}), async parseMessage(e2, t2) { + var n2, r2, i2, o2, s2, a2; + const c2 = hs(e2); + if (c2) + return c2; + let l2 = e2.getAttribute("to"); + const u2 = Xo.getResourceFromJid(l2); + if (Vc.settings.get("filter_by_resource") && u2 && u2 !== t2.resource) + return new ds("Ignoring incoming message intended for a different resource: ".concat(l2), e2); + const d2 = e2; + let h2 = e2.getAttribute("from") || t2.bare_jid; + if (os(e2)) { + if (h2 !== t2.bare_jid) + return ls(e2, "Rejecting carbon from invalid JID"), new ds("Rejecting carbon from invalid JID ".concat(l2), e2); + { + const t3 = '[xmlns="'.concat(Xo.NS.CARBONS, '"] > forwarded[xmlns="').concat(Xo.NS.FORWARD, '"] > message'); + l2 = (e2 = mr()(t3, e2).pop()).getAttribute("to"), h2 = e2.getAttribute("from"); + } + } + const f2 = fs.isArchived(e2); + if (f2) { + if (h2 !== t2.bare_jid) + return new ds("Invalid Stanza: alleged MAM message from ".concat(e2.getAttribute("from")), e2); + { + const t3 = '[xmlns="'.concat(Xo.NS.MAM, '"] > forwarded[xmlns="').concat(Xo.NS.FORWARD, '"] > message'); + l2 = (e2 = mr()(t3, e2).pop()).getAttribute("to"), h2 = e2.getAttribute("from"); + } + } + const p2 = Xo.getBareJidFromJid(h2), g2 = p2 === t2.bare_jid; + if (g2 && l2 === null) + return new ds("Don't know how to handle message stanza without 'to' attribute. ".concat(e2.outerHTML), e2); + const m2 = fs.isHeadline(e2), v2 = fs.isServerMessage(e2); + let _2, b2; + if (!m2 && !v2 && (b2 = g2 ? Xo.getBareJidFromJid(l2) : p2, _2 = await Vc.contacts.get(b2), _2 === void 0 && !Vc.settings.get("allow_non_roster_messaging"))) + return zn.error(e2), new ds("Blocking messaging with a JID not in our roster because allow_non_roster_messaging is false.", e2); + const y2 = mr()('delay[xmlns="'.concat(Xo.NS.DELAY, '"]'), d2).pop(), w2 = fs.getChatMarker(e2), S2 = new Date().toISOString(); + let x2 = Object.assign({contact_jid: b2, is_archived: f2, is_headline: m2, is_server_message: v2, body: (n2 = e2.querySelector("body")) === null || n2 === void 0 || (r2 = n2.textContent) === null || r2 === void 0 ? void 0 : r2.trim(), chat_state: is(e2), from: Xo.getBareJidFromJid(e2.getAttribute("from")), is_carbon: os(d2), is_delayed: !!y2, is_markable: !!mr()('markable[xmlns="'.concat(Xo.NS.MARKERS, '"]'), e2).length, is_marker: !!w2, is_unstyled: !!mr()('unstyled[xmlns="'.concat(Xo.NS.STYLING, '"]'), e2).length, marker_id: w2 && w2.getAttribute("id"), msgid: e2.getAttribute("id") || d2.getAttribute("id"), nick: (i2 = _2) === null || i2 === void 0 || (o2 = i2.attributes) === null || o2 === void 0 ? void 0 : o2.nickname, receipt_id: rs(e2), received: new Date().toISOString(), references: cs(e2), sender: g2 ? "me" : "them", subject: (s2 = e2.querySelector("subject")) === null || s2 === void 0 ? void 0 : s2.textContent, thread: (a2 = e2.querySelector("thread")) === null || a2 === void 0 ? void 0 : a2.textContent, time: y2 ? En()(y2.getAttribute("stamp")).toISOString() : S2, to: e2.getAttribute("to"), type: e2.getAttribute("type")}, us(e2), Zo(e2), Ko(e2), es(e2, d2), ss(e2, d2), as(e2, d2), ts(e2, t2)); + if (x2.is_archived) { + const n3 = d2.getAttribute("from"); + if (n3 && n3 !== t2.bare_jid) + return new ds("Invalid Stanza: Forged MAM message from ".concat(n3), e2); + } + return await Vc.emojis.initialize(), x2 = Object.assign({message: x2.body || x2.error, is_only_emojis: !!x2.body && Jo.isOnlyEmojis(x2.body), is_valid_receipt_request: ns(e2, x2)}, x2), x2.id = x2.origin_id || x2["stanza_id ".concat(x2.from)] || Jo.getUniqueId(), Vc.hook("parseMessage", e2, x2); + }, async parseMUCMessage(e2, t2, n2) { + var r2, i2, o2, s2, a2; + const c2 = hs(e2); + if (c2) + return c2; + const l2 = '[xmlns="'.concat(Yo.MAM, '"] > forwarded[xmlns="').concat(Yo.FORWARD, '"] > message'), u2 = e2; + if (e2 = mr()(l2, e2).pop() || e2, mr()('message > forwarded[xmlns="'.concat(Xo.NS.FORWARD, '"]'), e2).length) + return new ds("Invalid Stanza: Forged MAM groupchat message from ".concat(e2.getAttribute("from")), e2); + const d2 = mr()('delay[xmlns="'.concat(Xo.NS.DELAY, '"]'), u2).pop(), h2 = e2.getAttribute("from"), f2 = Xo.unescapeNode(Xo.getResourceFromJid(h2)), p2 = fs.getChatMarker(e2), g2 = new Date().toISOString(); + let m2 = Object.assign({from: h2, nick: f2, body: (r2 = e2.querySelector("body")) === null || r2 === void 0 || (i2 = r2.textContent) === null || i2 === void 0 ? void 0 : i2.trim(), chat_state: is(e2), from_muc: Xo.getBareJidFromJid(h2), from_real_jid: (o2 = t2.occupants.findOccupant({nick: f2})) === null || o2 === void 0 ? void 0 : o2.get("jid"), is_archived: fs.isArchived(u2), is_carbon: os(u2), is_delayed: !!d2, is_headline: fs.isHeadline(e2), is_markable: !!mr()('markable[xmlns="'.concat(Xo.NS.MARKERS, '"]'), e2).length, is_marker: !!p2, is_unstyled: !!mr()('unstyled[xmlns="'.concat(Xo.NS.STYLING, '"]'), e2).length, marker_id: p2 && p2.getAttribute("id"), msgid: e2.getAttribute("id") || u2.getAttribute("id"), receipt_id: rs(e2), received: new Date().toISOString(), references: cs(e2), subject: (s2 = e2.querySelector("subject")) === null || s2 === void 0 ? void 0 : s2.textContent, thread: (a2 = e2.querySelector("thread")) === null || a2 === void 0 ? void 0 : a2.textContent, time: d2 ? En()(d2.getAttribute("stamp")).toISOString() : g2, to: e2.getAttribute("to"), type: e2.getAttribute("type")}, us(e2), Zo(e2), Ko(e2), es(e2, u2), ss(e2, u2), as(e2, u2), function(e3) { + const t3 = mr()('apply-to[xmlns="'.concat(Xo.NS.FASTEN, '"]'), e3).pop(); + if (t3) { + const e4 = t3.getAttribute("id"), r4 = mr()('moderated[xmlns="'.concat(Xo.NS.MODERATE, '"]'), t3).pop(); + if (r4) { + var n3; + if (mr()('retract[xmlns="'.concat(Xo.NS.RETRACT, '"]'), r4).pop()) + return {editable: false, moderated: "retracted", moderated_by: r4.getAttribute("by"), moderated_id: e4, moderation_reason: (n3 = r4.querySelector("reason")) === null || n3 === void 0 ? void 0 : n3.textContent}; + } + } else { + const t4 = mr()('> moderated[xmlns="'.concat(Xo.NS.MODERATE, '"]'), e3).pop(); + if (t4) { + var r3; + if (mr()('retracted[xmlns="'.concat(Xo.NS.RETRACT, '"]'), t4).pop()) + return {editable: false, is_tombstone: true, moderated_by: t4.getAttribute("by"), retracted: t4.getAttribute("stamp"), moderation_reason: (r3 = t4.querySelector("reason")) === null || r3 === void 0 ? void 0 : r3.textContent}; + } + } + return {}; + }(e2), ts(e2, n2)); + return await Vc.emojis.initialize(), m2 = Object.assign({is_only_emojis: !!m2.body && Jo.isOnlyEmojis(m2.body), is_valid_receipt_request: ns(e2, m2), message: m2.body || m2.error, sender: m2.nick === t2.get("nick") ? "me" : "them"}, m2), m2.is_archived && u2.getAttribute("from") !== m2.from_muc ? new ds("Invalid Stanza: Forged MAM message from ".concat(u2.getAttribute("from")), e2) : m2.is_archived && u2.getAttribute("from") !== t2.get("jid") ? new ds("Invalid Stanza: Forged MAM groupchat message from ".concat(e2.getAttribute("from")), e2) : m2.is_carbon ? new ds("Invalid Stanza: MUC messages SHOULD NOT be XEP-0280 carbon copied", e2) : (m2.id = m2.origin_id || m2["stanza_id ".concat(m2.from_muc || m2.from)] || Jo.getUniqueId(), Vc.hook("parseMUCMessage", e2, m2)); + }, parseMUCPresence(e2) { + const t2 = e2.getAttribute("from"), n2 = e2.getAttribute("type"), r2 = {from: t2, nick: Xo.getResourceFromJid(t2), type: n2, states: [], hats: [], show: n2 !== "unavailable" ? "online" : "offline"}; + return Array.from(e2.children).forEach((e3) => { + if (e3.matches("status")) + r2.status = e3.textContent || null; + else if (e3.matches("show")) + r2.show = e3.textContent || "online"; + else if (e3.matches("x") && e3.getAttribute("xmlns") === Xo.NS.MUC_USER) + Array.from(e3.children).forEach((e4) => { + e4.nodeName === "item" ? (r2.affiliation = e4.getAttribute("affiliation"), r2.role = e4.getAttribute("role"), r2.jid = e4.getAttribute("jid"), r2.nick = e4.getAttribute("nick") || r2.nick) : e4.nodeName == "status" && e4.getAttribute("code") && r2.states.push(e4.getAttribute("code")); + }); + else if (e3.matches("x") && e3.getAttribute("xmlns") === Xo.NS.VCARDUPDATE) { + var t3; + r2.image_hash = (t3 = e3.querySelector("photo")) === null || t3 === void 0 ? void 0 : t3.textContent; + } else + e3.matches("hats") && e3.getAttribute("xmlns") === Xo.NS.MUC_HATS && (r2.hats = Array.from(e3.children).map((e4) => e4.matches("hat") && {title: e4.getAttribute("title"), uri: e4.getAttribute("uri")})); + }), r2; + }}; + var ps = fs; + var gs = function(e2, t2, n2, r2) { + for (var i2 = -1, o2 = e2 == null ? 0 : e2.length; ++i2 < o2; ) { + var s2 = e2[i2]; + t2(r2, s2, n2(s2), e2); + } + return r2; + }; + var ms = function(e2, t2) { + return function(n2, r2) { + if (n2 == null) + return n2; + if (!Xe(n2)) + return e2(n2, r2); + for (var i2 = n2.length, o2 = t2 ? i2 : -1, s2 = Object(n2); (t2 ? o2-- : ++o2 < i2) && r2(s2[o2], o2, s2) !== false; ) + ; + return n2; + }; + }, vs = ms(qi); + var _s = function(e2, t2, n2, r2) { + return vs(e2, function(e3, i2, o2) { + t2(r2, e3, n2(e3), o2); + }), r2; + }; + var bs = function(e2, t2) { + return function(n2, r2) { + var i2 = ke(n2) ? gs : _s, o2 = t2 ? t2() : {}; + return i2(n2, e2, Eo(r2), o2); + }; + }, ys = Object.prototype.hasOwnProperty, ws = bs(function(e2, t2, n2) { + ys.call(e2, n2) ? ++e2[n2] : be(e2, n2, 1); + }); + var Ss = function(e2, t2, n2, r2) { + for (var i2 = e2.length, o2 = n2 + (r2 ? 1 : -1); r2 ? o2-- : ++o2 < i2; ) + if (t2(e2[o2], o2, e2)) + return o2; + return -1; + }; + var xs = function(e2) { + return e2 != e2; + }; + var Es = function(e2, t2, n2) { + for (var r2 = n2 - 1, i2 = e2.length; ++r2 < i2; ) + if (e2[r2] === t2) + return r2; + return -1; + }; + var As = function(e2, t2, n2) { + return t2 == t2 ? Es(e2, t2, n2) : Ss(e2, xs, n2); + }; + var Cs = function(e2, t2) { + return !!(e2 == null ? 0 : e2.length) && As(e2, t2, 0) > -1; + }; + var js = function(e2, t2, n2) { + for (var r2 = -1, i2 = e2 == null ? 0 : e2.length; ++r2 < i2; ) + if (n2(t2, e2[r2])) + return true; + return false; + }; + var Ts = function(e2, t2, n2, r2) { + var i2 = -1, o2 = Cs, s2 = true, a2 = e2.length, c2 = [], l2 = t2.length; + if (!a2) + return c2; + n2 && (t2 = qr(t2, Le(n2))), r2 ? (o2 = js, s2 = false) : t2.length >= 200 && (o2 = Yi, s2 = false, t2 = new Xi(t2)); + e: + for (; ++i2 < a2; ) { + var u2 = e2[i2], d2 = n2 == null ? u2 : n2(u2); + if (u2 = r2 || u2 !== 0 ? u2 : 0, s2 && d2 == d2) { + for (var h2 = l2; h2--; ) + if (t2[h2] === d2) + continue e; + c2.push(u2); + } else + o2(t2, d2, r2) || c2.push(u2); + } + return c2; + }; + var Os = function(e2) { + return Ee(e2) && Xe(e2); + }, ks = jr(function(e2, t2) { + return Os(e2) ? Ts(e2, Mo(t2, 1, Os, true)) : []; + }); + var Ns = function(e2, t2) { + for (var n2 = -1, r2 = e2 == null ? 0 : e2.length; ++n2 < r2; ) + if (!t2(e2[n2], n2, e2)) + return false; + return true; + }; + var Is = function(e2, t2) { + var n2 = true; + return vs(e2, function(e3, r2, i2) { + return n2 = !!t2(e3, r2, i2); + }), n2; + }; + var Ms = function(e2, t2, n2) { + var r2 = ke(e2) ? Ns : Is; + return n2 && Tr(e2, t2, n2) && (t2 = void 0), r2(e2, Eo(t2)); + }, Rs = Math.max; + var Ds = function(e2, t2, n2) { + var r2 = e2 == null ? 0 : e2.length; + if (!r2) + return -1; + var i2 = n2 == null ? 0 : fi(n2); + return i2 < 0 && (i2 = Rs(r2 + i2, 0)), Ss(e2, Eo(t2), i2); + }, Ps = Math.max, Ls = Math.min; + var zs = function(e2, t2, n2) { + var r2 = e2 == null ? 0 : e2.length; + if (!r2) + return -1; + var i2 = r2 - 1; + return n2 !== void 0 && (i2 = fi(n2), i2 = n2 < 0 ? Ps(r2 + i2, 0) : Ls(i2, r2 - 1)), Ss(e2, Eo(t2), i2, true); + }, Fs = Object.prototype.hasOwnProperty, Bs = bs(function(e2, t2, n2) { + Fs.call(e2, n2) ? e2[n2].push(t2) : be(e2, n2, [t2]); + }), qs = Math.max; + var Hs = function(e2, t2, n2) { + var r2 = e2 == null ? 0 : e2.length; + if (!r2) + return -1; + var i2 = n2 == null ? 0 : fi(n2); + return i2 < 0 && (i2 = qs(r2 + i2, 0)), As(e2, t2, i2); + }, Us = bs(function(e2, t2, n2) { + be(e2, n2, t2); + }); + var $s = function(e2, t2, n2) { + for (var r2 = n2 + 1; r2--; ) + if (e2[r2] === t2) + return r2; + return r2; + }, Ws = Math.max, Gs = Math.min; + var Vs = function(e2, t2, n2) { + var r2 = e2 == null ? 0 : e2.length; + if (!r2) + return -1; + var i2 = r2; + return n2 !== void 0 && (i2 = (i2 = fi(n2)) < 0 ? Ws(r2 + i2, 0) : Gs(i2, r2 - 1)), t2 == t2 ? $s(e2, t2, i2) : Ss(e2, xs, i2, true); + }; + var Js = function(e2, t2) { + var n2; + return vs(e2, function(e3, r2, i2) { + return !(n2 = t2(e3, r2, i2)); + }), !!n2; + }; + var Xs = function(e2, t2, n2) { + var r2 = ke(e2) ? Qi : Js; + return n2 && Tr(e2, t2, n2) && (t2 = void 0), r2(e2, Eo(t2)); + }; + var Qs = function(e2, t2) { + var n2 = -1, r2 = Xe(e2) ? Array(e2.length) : []; + return vs(e2, function(e3, i2, o2) { + r2[++n2] = t2(e3, i2, o2); + }), r2; + }; + var Ys = function(e2, t2) { + var n2 = e2.length; + for (e2.sort(t2); n2--; ) + e2[n2] = e2[n2].value; + return e2; + }; + var Ks = function(e2, t2) { + if (e2 !== t2) { + var n2 = e2 !== void 0, r2 = e2 === null, i2 = e2 == e2, o2 = Ir(e2), s2 = t2 !== void 0, a2 = t2 === null, c2 = t2 == t2, l2 = Ir(t2); + if (!a2 && !l2 && !o2 && e2 > t2 || o2 && s2 && c2 && !a2 && !l2 || r2 && s2 && c2 || !n2 && c2 || !i2) + return 1; + if (!r2 && !o2 && !l2 && e2 < t2 || l2 && n2 && i2 && !r2 && !o2 || a2 && n2 && i2 || !s2 && i2 || !c2) + return -1; + } + return 0; + }; + var Zs = function(e2, t2, n2) { + for (var r2 = -1, i2 = e2.criteria, o2 = t2.criteria, s2 = i2.length, a2 = n2.length; ++r2 < s2; ) { + var c2 = Ks(i2[r2], o2[r2]); + if (c2) + return r2 >= a2 ? c2 : c2 * (n2[r2] == "desc" ? -1 : 1); + } + return e2.index - t2.index; + }; + var ea = function(e2, t2, n2) { + var r2 = -1; + t2 = qr(t2.length ? t2 : [br], Le(Eo)); + var i2 = Qs(e2, function(e3, n3, i3) { + return {criteria: qr(t2, function(t3) { + return t3(e3); + }), index: ++r2, value: e3}; + }); + return Ys(i2, function(e3, t3) { + return Zs(e3, t3, n2); + }); + }, ta = jr(function(e2, t2) { + if (e2 == null) + return []; + var n2 = t2.length; + return n2 > 1 && Tr(e2, t2[0], t2[1]) ? t2 = [] : n2 > 2 && Tr(t2[0], t2[1], t2[2]) && (t2 = [t2[0]]), ea(e2, Mo(t2, 1), []); + }); + const na = Array.prototype.slice, ra = function(e2, t2) { + t2 || (t2 = {}), this.preinitialize.apply(this, arguments), t2.model && (this.model = t2.model), t2.comparator !== void 0 && (this.comparator = t2.comparator), this._reset(), this.initialize.apply(this, arguments), e2 && this.reset(e2, Or({silent: true}, t2)); + }; + ra.extend = Yr; + const ia = {add: true, remove: true, merge: true}, oa = {add: true, remove: false}, sa = function(e2, t2, n2) { + n2 = Math.min(Math.max(n2, 0), e2.length); + const r2 = Array(e2.length - n2), i2 = t2.length; + let o2; + for (o2 = 0; o2 < r2.length; o2++) + r2[o2] = e2[o2 + n2]; + for (o2 = 0; o2 < i2; o2++) + e2[o2 + n2] = t2[o2]; + for (o2 = 0; o2 < r2.length; o2++) + e2[o2 + i2 + n2] = r2[o2]; + }; + Object.assign(ra.prototype, _i, {model: qo, preinitialize: function() { + }, initialize: function() { + }, toJSON: function(e2) { + return this.map(function(t2) { + return t2.toJSON(e2); + }); + }, sync: function(e2, t2, n2) { + return ni(this)(e2, t2, n2); + }, add: function(e2, t2) { + return this.set(e2, Or({merge: false}, t2, oa)); + }, remove: function(e2, t2) { + t2 = Or({}, t2); + const n2 = !Array.isArray(e2); + e2 = n2 ? [e2] : e2.slice(); + const r2 = this._removeModels(e2, t2); + return !t2.silent && r2.length && (t2.changes = {added: [], merged: [], removed: r2}, this.trigger("update", this, t2)), n2 ? r2[0] : r2; + }, set: function(e2, t2) { + if (e2 == null) + return; + (t2 = Or({}, ia, t2)).parse && !this._isModel(e2) && (e2 = this.parse(e2, t2) || []); + const n2 = !Array.isArray(e2); + e2 = n2 ? [e2] : e2.slice(); + let r2 = t2.at; + r2 != null && (r2 = +r2), r2 > this.length && (r2 = this.length), r2 < 0 && (r2 += this.length + 1); + const i2 = [], o2 = [], s2 = [], a2 = [], c2 = {}, l2 = t2.add, u2 = t2.merge, d2 = t2.remove; + let h2 = false; + const f2 = this.comparator && r2 == null && t2.sort !== false, p2 = Zt(this.comparator) ? this.comparator : null; + let g2, m2; + for (m2 = 0; m2 < e2.length; m2++) { + g2 = e2[m2]; + const n3 = this.get(g2); + if (n3) { + if (u2 && g2 !== n3) { + let e3 = this._isModel(g2) ? g2.attributes : g2; + t2.parse && (e3 = n3.parse(e3, t2)), n3.set(e3, t2), s2.push(n3), f2 && !h2 && (h2 = n3.hasChanged(p2)); + } + c2[n3.cid] || (c2[n3.cid] = true, i2.push(n3)), e2[m2] = n3; + } else + l2 && (g2 = e2[m2] = this._prepareModel(g2, t2), g2 && (o2.push(g2), this._addReference(g2, t2), c2[g2.cid] = true, i2.push(g2))); + } + if (d2) { + for (m2 = 0; m2 < this.length; m2++) + g2 = this.models[m2], c2[g2.cid] || a2.push(g2); + a2.length && this._removeModels(a2, t2); + } + let v2 = false; + const _2 = !f2 && l2 && d2; + if (i2.length && _2 ? (v2 = this.length !== i2.length || Xs(this.models, (e3, t3) => e3 !== i2[t3]), this.models.length = 0, sa(this.models, i2, 0), this.length = this.models.length) : o2.length && (f2 && (h2 = true), sa(this.models, o2, r2 == null ? this.length : r2), this.length = this.models.length), h2 && this.sort({silent: true}), !t2.silent) { + for (m2 = 0; m2 < o2.length; m2++) + r2 != null && (t2.index = r2 + m2), g2 = o2[m2], g2.trigger("add", g2, this, t2); + (h2 || v2) && this.trigger("sort", this, t2), (o2.length || a2.length || s2.length) && (t2.changes = {added: o2, removed: a2, merged: s2}, this.trigger("update", this, t2)); + } + return n2 ? e2[0] : e2; + }, clearStore: async function(e2 = {}, t2 = (e3) => e3) { + await Promise.all(this.models.filter(t2).map((t3) => new Promise((n2) => { + t3.destroy(Object.assign(e2, {success: n2, error: (e3, t4) => { + console.error(t4), n2(); + }})); + }))), await this.browserStorage.clear(), this.reset(); + }, reset: function(e2, t2) { + t2 = t2 ? Oi(t2) : {}; + for (let e3 = 0; e3 < this.models.length; e3++) + this._removeReference(this.models[e3], t2); + return t2.previousModels = this.models, this._reset(), e2 = this.add(e2, Or({silent: true}, t2)), t2.silent || this.trigger("reset", this, t2), e2; + }, push: function(e2, t2) { + return this.add(e2, Or({at: this.length}, t2)); + }, pop: function(e2) { + const t2 = this.at(this.length - 1); + return this.remove(t2, e2); + }, unshift: function(e2, t2) { + return this.add(e2, Or({at: 0}, t2)); + }, shift: function(e2) { + const t2 = this.at(0); + return this.remove(t2, e2); + }, slice: function() { + return na.apply(this.models, arguments); + }, filter: function(e2, t2) { + return this.models.filter(M(e2) ? e2 : (t3) => t3.matches(e2), t2); + }, every: function(e2) { + return Ms(this.models.map((e3) => e3.attributes), e2); + }, difference: function(e2) { + return ks(this.models, e2); + }, max: function() { + return Math.max.apply(Math, this.models); + }, min: function() { + return Math.min.apply(Math, this.models); + }, drop: function(e2 = 1) { + return this.models.slice(e2); + }, some: function(e2) { + return Xs(this.models.map((e3) => e3.attributes), e2); + }, sortBy: function(e2) { + return ta(this.models, M(e2) ? e2 : (t2) => Zt(e2) ? t2.get(e2) : t2.matches(e2)); + }, isEmpty: function() { + return oi(this.models); + }, keyBy: function(e2) { + return Us(this.models, e2); + }, each: function(e2, t2) { + return this.forEach(e2, t2); + }, forEach: function(e2, t2) { + return this.models.forEach(e2, t2); + }, includes: function(e2) { + return this.models.includes(e2); + }, size: function() { + return this.models.length; + }, countBy: function(e2) { + return ws(this.models, M(e2) ? e2 : (t2) => Zt(e2) ? t2.get(e2) : t2.matches(e2)); + }, groupBy: function(e2) { + return Bs(this.models, M(e2) ? e2 : (t2) => Zt(e2) ? t2.get(e2) : t2.matches(e2)); + }, indexOf: function(e2) { + return Hs(this.models, e2); + }, findLastIndex: function(e2, t2) { + return zs(this.models, M(e2) ? e2 : (t3) => Zt(e2) ? t3.get(e2) : t3.matches(e2), t2); + }, lastIndexOf: function(e2) { + return Vs(this.models, e2); + }, findIndex: function(e2) { + return Ds(this.models, M(e2) ? e2 : (t2) => Zt(e2) ? t2.get(e2) : t2.matches(e2)); + }, last: function() { + const e2 = this.models == null ? 0 : this.models.length; + return e2 ? this.models[e2 - 1] : void 0; + }, head: function() { + return this.models[0]; + }, first: function() { + return this.head(); + }, map: function(e2, t2) { + return this.models.map(M(e2) ? e2 : (t3) => Zt(e2) ? t3.get(e2) : t3.matches(e2), t2); + }, reduce: function(e2, t2) { + return this.models.reduce(e2, t2 || this.models[0]); + }, reduceRight: function(e2, t2) { + return this.models.reduceRight(e2, t2 || this.models[0]); + }, toArray: function() { + return Array.from(this.models); + }, get: function(e2) { + if (e2 != null) + return this._byId[e2] || this._byId[this.modelId(this._isModel(e2) ? e2.attributes : e2)] || e2.cid && this._byId[e2.cid]; + }, has: function(e2) { + return this.get(e2) != null; + }, at: function(e2) { + return e2 < 0 && (e2 += this.length), this.models[e2]; + }, where: function(e2, t2) { + return this[t2 ? "find" : "filter"](e2); + }, findWhere: function(e2) { + return this.where(e2, true); + }, find: function(e2, t2) { + const n2 = M(e2) ? e2 : (t3) => t3.matches(e2); + return this.models.find(n2, t2); + }, sort: function(e2) { + let t2 = this.comparator; + if (!t2) + throw new Error("Cannot sort a set without a comparator"); + e2 || (e2 = {}); + const n2 = t2.length; + return M(t2) && (t2 = t2.bind(this)), n2 === 1 || Zt(t2) ? this.models = this.sortBy(t2) : this.models.sort(t2), e2.silent || this.trigger("sort", this, e2), this; + }, pluck: function(e2) { + return this.map(e2 + ""); + }, fetch: function(e2) { + const t2 = (e2 = Or({parse: true}, e2)).success, n2 = this, r2 = e2.promise && Kr(); + return e2.success = function(i2) { + const o2 = e2.reset ? "reset" : "set"; + n2[o2](i2, e2), t2 && t2.call(e2.context, n2, i2, e2), r2 && r2.resolve(), n2.trigger("sync", n2, i2, e2); + }, ei(this, e2), r2 || this.sync("read", this, e2); + }, create: function(e2, t2) { + const n2 = (t2 = t2 ? Oi(t2) : {}).wait, r2 = t2.promise, i2 = r2 && Kr(); + if (!(e2 = this._prepareModel(e2, t2))) + return false; + n2 || this.add(e2, t2); + const o2 = this, s2 = t2.success, a2 = t2.error; + return t2.success = function(e3, t3, a3) { + n2 && o2.add(e3, a3), s2 && s2.call(a3.context, e3, t3, a3), r2 && i2.resolve(e3); + }, t2.error = function(e3, t3, n3) { + a2 && a2.call(n3.context, e3, t3, n3), r2 && i2.reject(t3); + }, e2.save(null, Object.assign(t2, {promise: false})), r2 ? i2 : e2; + }, parse: function(e2, t2) { + return e2; + }, clone: function() { + return new this.constructor(this.models, {model: this.model, comparator: this.comparator}); + }, modelId: function(e2) { + return e2[this.model.prototype.idAttribute || "id"]; + }, values: function() { + return new ca(this, la); + }, keys: function() { + return new ca(this, ua); + }, entries: function() { + return new ca(this, da); + }, _reset: function() { + this.length = 0, this.models = [], this._byId = {}; + }, _prepareModel: function(e2, t2) { + if (this._isModel(e2)) + return e2.collection || (e2.collection = this), e2; + (t2 = t2 ? Oi(t2) : {}).collection = this; + const n2 = new this.model(e2, t2); + return n2.validationError ? (this.trigger("invalid", this, n2.validationError, t2), false) : n2; + }, _removeModels: function(e2, t2) { + const n2 = []; + for (let r2 = 0; r2 < e2.length; r2++) { + const i2 = this.get(e2[r2]); + if (!i2) + continue; + const o2 = this.indexOf(i2); + this.models.splice(o2, 1), this.length--, delete this._byId[i2.cid]; + const s2 = this.modelId(i2.attributes); + s2 != null && delete this._byId[s2], t2.silent || (t2.index = o2, i2.trigger("remove", i2, this, t2)), n2.push(i2), this._removeReference(i2, t2); + } + return n2; + }, _isModel: function(e2) { + return e2 instanceof qo; + }, _addReference: function(e2, t2) { + this._byId[e2.cid] = e2; + const n2 = this.modelId(e2.attributes); + n2 != null && (this._byId[n2] = e2), e2.on("all", this._onModelEvent, this); + }, _removeReference: function(e2, t2) { + delete this._byId[e2.cid]; + const n2 = this.modelId(e2.attributes); + n2 != null && delete this._byId[n2], this === e2.collection && delete e2.collection, e2.off("all", this._onModelEvent, this); + }, _onModelEvent: function(e2, t2, n2, r2) { + if (t2) { + if ((e2 === "add" || e2 === "remove") && n2 !== this) + return; + if (e2 === "destroy" && this.remove(t2, r2), e2 === "change") { + const e3 = this.modelId(t2.previousAttributes()), n3 = this.modelId(t2.attributes); + e3 !== n3 && (e3 != null && delete this._byId[e3], n3 != null && (this._byId[n3] = t2)); + } + } + this.trigger.apply(this, arguments); + }}); + const aa = typeof Symbol == "function" && Symbol.iterator; + aa && (ra.prototype[aa] = ra.prototype.values); + const ca = function(e2, t2) { + this._collection = e2, this._kind = t2, this._index = 0; + }, la = 1, ua = 2, da = 3; + aa && (ca.prototype[aa] = function() { + return this; + }), ca.prototype.next = function() { + if (this._collection) { + if (this._index < this._collection.length) { + const e2 = this._collection.at(this._index); + let t2; + if (this._index++, this._kind === la) + t2 = e2; + else { + const n2 = this._collection.modelId(e2.attributes); + t2 = this._kind === ua ? n2 : [n2, e2]; + } + return {value: t2, done: false}; + } + this._collection = void 0; + } + return {value: void 0, done: true}; + }; + var ha = n(43); + class fa extends vr.e.Connection { + constructor(e2, t2) { + super(e2, t2), this.debouncedReconnect = Object(ha.debounce)(this.reconnect, 2e3); + } + static generateResource() { + return "/converse.js-".concat(Math.floor(139749528 * Math.random()).toString()); + } + async bind() { + await Vc.trigger("beforeResourceBinding", {synchronous: true}), super.bind(); + } + async onDomainDiscovered(e2) { + const t2 = await e2.text(), n2 = new window.DOMParser().parseFromString(t2, "text/xml").firstElementChild; + if (n2.nodeName != "XRD" || n2.namespaceURI != "http://docs.oasis-open.org/ns/xri/xrd-1.0") + return zn.warn("Could not discover XEP-0156 connection methods"); + const r2 = mr()('Link[rel="urn:xmpp:alt-connections:xbosh"]', n2), i2 = mr()('Link[rel="urn:xmpp:alt-connections:websocket"]', n2), o2 = r2.map((e3) => e3.getAttribute("href")), s2 = i2.map((e3) => e3.getAttribute("href")); + o2.length === 0 && s2.length === 0 ? zn.warn("Neither BOSH nor WebSocket connection methods have been specified with XEP-0156.") : (Vc.settings.set("websocket_url", s2.pop()), Vc.settings.set("bosh_service_url", o2.pop()), this.service = Vc.settings.get("websocket_url") || Vc.settings.get("bosh_service_url"), this.setProtocol()); + } + async discoverConnectionMethods(e2) { + const t2 = {mode: "cors", headers: {Accept: "application/xrd+xml, text/xml"}}, n2 = "https://".concat(e2, "/.well-known/host-meta"); + let r2; + try { + r2 = await fetch(n2, t2); + } catch (e3) { + return zn.error("Failed to discover alternative connection methods at ".concat(n2)), void zn.error(e3); + } + r2.status >= 200 && r2.status < 400 ? await this.onDomainDiscovered(r2) : zn.warn("Could not discover XEP-0156 connection methods"); + } + async connect(e2, t2, n2) { + if (Vc.settings.get("discover_connection_methods")) { + const t3 = vr.e.getDomainFromJid(e2); + await this.discoverConnectionMethods(t3); + } + super.connect(e2, t2, n2 || this.onConnectStatusChanged, 59); + } + async reconnect() { + const {__: e2} = Uc; + return zn.debug("RECONNECTING: the connection has dropped, attempting to reconnect."), this.setConnectionStatus(vr.e.Status.RECONNECTING, e2("The connection has dropped, attempting to reconnect.")), Vc.trigger("will-reconnect"), this.reconnecting = true, await Qc(), Vc.user.login(); + } + async onConnected(e2) { + delete this.reconnecting, this.flush(), await Uc.setUserJID(this.jid), await Vc.trigger("afterResourceBinding", e2, {synchronous: true}), e2 ? Vc.trigger("reconnected") : Vc.trigger("connected"); + } + setDisconnectionCause(e2, t2, n2) { + e2 === void 0 ? (delete this.disconnection_cause, delete this.disconnection_reason) : (this.disconnection_cause === void 0 || n2) && (this.disconnection_cause = e2, this.disconnection_reason = t2); + } + setConnectionStatus(e2, t2) { + this.status = e2, Uc.connfeedback.set({connection_status: e2, message: t2}); + } + async finishDisconnection() { + zn.debug("DISCONNECTED"), delete this.reconnecting, this.reset(), Qc(), await Kc(), delete Uc.connection, Vc.trigger("disconnected"); + } + onDisconnected() { + if (!Vc.settings.get("auto_reconnect")) + return this.finishDisconnection(); + { + const e2 = this.disconnection_reason; + if (this.disconnection_cause === vr.e.Status.AUTHFAIL) + return Vc.settings.get("credentials_url") || Vc.settings.get("authentication") === Uc.ANONYMOUS ? Vc.connection.reconnect() : this.finishDisconnection(); + if (this.disconnection_cause === Uc.LOGOUT || e2 === vr.e.ErrorCondition.NO_AUTH_MECH || e2 === "host-unknown" || e2 === "remote-connection-failed") + return this.finishDisconnection(); + Vc.connection.reconnect(); + } + } + onConnectStatusChanged(e2, t2) { + const {__: n2} = Uc; + var r2; + if (zn.debug("Status changed to: ".concat(Uc.CONNECTION_STATUS[e2])), e2 === vr.e.Status.ATTACHFAIL) + this.setConnectionStatus(e2), (r2 = this.worker_attach_promise) === null || r2 === void 0 || r2.resolve(false); + else if (e2 === vr.e.Status.CONNECTED || e2 === vr.e.Status.ATTACHED) { + var i2, o2; + if (((i2 = this.worker_attach_promise) === null || i2 === void 0 ? void 0 : i2.isResolved) && this.status === vr.e.Status.ATTACHED) + return; + this.setConnectionStatus(e2), (o2 = this.worker_attach_promise) === null || o2 === void 0 || o2.resolve(true), Uc.send_initial_presence = true, this.setDisconnectionCause(), this.reconnecting ? (zn.debug(e2 === vr.e.Status.CONNECTED ? "Reconnected" : "Reattached"), this.onConnected(true)) : (zn.debug(e2 === vr.e.Status.CONNECTED ? "Connected" : "Attached"), this.restored && (Uc.send_initial_presence = false), this.onConnected()); + } else if (e2 === vr.e.Status.DISCONNECTED) + this.setDisconnectionCause(e2, t2), this.onDisconnected(); + else if (e2 === vr.e.Status.BINDREQUIRED) + this.bind(); + else if (e2 === vr.e.Status.ERROR) + this.setConnectionStatus(e2, n2("An error occurred while connecting to the chat server.")); + else if (e2 === vr.e.Status.CONNECTING) + this.setConnectionStatus(e2); + else if (e2 === vr.e.Status.AUTHENTICATING) + this.setConnectionStatus(e2); + else if (e2 === vr.e.Status.AUTHFAIL) + t2 || (t2 = n2("Your XMPP address and/or password is incorrect. Please try again.")), this.setConnectionStatus(e2, t2), this.setDisconnectionCause(e2, t2, true), this.onDisconnected(); + else if (e2 === vr.e.Status.CONNFAIL) { + var s2; + let r3 = t2; + t2 === "host-unknown" || t2 == "remote-connection-failed" ? r3 = n2("Sorry, we could not connect to the XMPP host with domain: %1$s", '"'.concat(vr.e.getDomainFromJid(this.jid), '"')) : t2 !== void 0 && t2 === (vr.e === null || vr.e === void 0 || (s2 = vr.e.ErrorCondition) === null || s2 === void 0 ? void 0 : s2.NO_AUTH_MECH) && (r3 = n2("The XMPP server did not offer a supported authentication mechanism")), this.setConnectionStatus(e2, r3), this.setDisconnectionCause(e2, t2); + } else + e2 === vr.e.Status.DISCONNECTING && this.setDisconnectionCause(e2, t2); + } + isType(e2) { + return e2.toLowerCase() === "websocket" ? this._proto instanceof vr.e.Websocket : e2.toLowerCase() === "bosh" ? vr.e.Bosh && this._proto instanceof vr.e.Bosh : void 0; + } + hasResumed() { + var e2; + return ((e2 = Vc.settings.get("connection_options")) === null || e2 === void 0 ? void 0 : e2.worker) || this.isType("bosh") ? Uc.connfeedback.get("connection_status") === vr.e.Status.ATTACHED : !this.do_bind; + } + restoreWorkerSession() { + return this.attach(this.onConnectStatusChanged), this.worker_attach_promise = Jo.getResolveablePromise(), this.worker_attach_promise; + } + } + class pa extends fa { + constructor(e2, t2) { + super(e2, t2), this.sent_stanzas = [], this.IQ_stanzas = [], this.IQ_ids = [], this.features = vr.e.xmlHtmlNode(`<stream:features xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client"><ver xmlns="urn:xmpp:features:rosterver"/><csi xmlns="urn:xmpp:csi:0"/><this xmlns="http://jabber.org/protocol/caps" ver="UwBpfJpEt3IoLYfWma/o/p3FFRo=" hash="sha-1" node="http://prosody.im"/><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><required/></bind><sm xmlns='urn:xmpp:sm:3'/><session xmlns="urn:ietf:params:xml:ns:xmpp-session"><optional/></session></stream:features>`).firstChild, this._proto._processRequest = () => { + }, this._proto._disconnect = () => this._onDisconnectTimeout(), this._proto._onDisconnectTimeout = () => { + }, this._proto._connect = () => { + this.connected = true, this.mock = true, this.jid = "romeo@montague.lit/orchard", this._changeConnectStatus(vr.e.Status.BINDREQUIRED); + }; + } + _processRequest() { + } + sendIQ(e2, t2, n2) { + Object(ha.isElement)(e2) || (e2 = e2.nodeTree), this.IQ_stanzas.push(e2); + const r2 = super.sendIQ(e2, t2, n2); + return this.IQ_ids.push(r2), r2; + } + send(e2) { + return Object(ha.isElement)(e2) ? this.sent_stanzas.push(e2) : this.sent_stanzas.push(e2.nodeTree), super.send(e2); + } + async bind() { + await Vc.trigger("beforeResourceBinding", {synchronous: true}), this.authenticated = true, Uc.no_connection_on_bind || this._changeConnectStatus(vr.e.Status.CONNECTED); + } + } + /** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ + const ga = typeof window != "undefined" && window.customElements != null && window.customElements.polyfillWrapFlushCallback !== void 0, ma = (e2, t2, n2 = null, r2 = null) => { + for (; t2 !== n2; ) { + const n3 = t2.nextSibling; + e2.insertBefore(t2, r2), t2 = n3; + } + }, va = (e2, t2, n2 = null) => { + for (; t2 !== n2; ) { + const n3 = t2.nextSibling; + e2.removeChild(t2), t2 = n3; + } + }, _a = `{{lit-${String(Math.random()).slice(2)}}}`, ba = `<!--${_a}-->`, ya = new RegExp(`${_a}|${ba}`); + class wa { + constructor(e2, t2) { + this.parts = [], this.element = t2; + const n2 = [], r2 = [], i2 = document.createTreeWalker(t2.content, 133, null, false); + let o2 = 0, s2 = -1, a2 = 0; + const {strings: c2, values: {length: l2}} = e2; + for (; a2 < l2; ) { + const e3 = i2.nextNode(); + if (e3 !== null) { + if (s2++, e3.nodeType === 1) { + if (e3.hasAttributes()) { + const t3 = e3.attributes, {length: n3} = t3; + let r3 = 0; + for (let e4 = 0; e4 < n3; e4++) + Sa(t3[e4].name, "$lit$") && r3++; + for (; r3-- > 0; ) { + const t4 = c2[a2], n4 = Aa.exec(t4)[2], r4 = n4.toLowerCase() + "$lit$", i3 = e3.getAttribute(r4); + e3.removeAttribute(r4); + const o3 = i3.split(ya); + this.parts.push({type: "attribute", index: s2, name: n4, strings: o3}), a2 += o3.length - 1; + } + } + e3.tagName === "TEMPLATE" && (r2.push(e3), i2.currentNode = e3.content); + } else if (e3.nodeType === 3) { + const t3 = e3.data; + if (t3.indexOf(_a) >= 0) { + const r3 = e3.parentNode, i3 = t3.split(ya), o3 = i3.length - 1; + for (let t4 = 0; t4 < o3; t4++) { + let n3, o4 = i3[t4]; + if (o4 === "") + n3 = Ea(); + else { + const e4 = Aa.exec(o4); + e4 !== null && Sa(e4[2], "$lit$") && (o4 = o4.slice(0, e4.index) + e4[1] + e4[2].slice(0, -"$lit$".length) + e4[3]), n3 = document.createTextNode(o4); + } + r3.insertBefore(n3, e3), this.parts.push({type: "node", index: ++s2}); + } + i3[o3] === "" ? (r3.insertBefore(Ea(), e3), n2.push(e3)) : e3.data = i3[o3], a2 += o3; + } + } else if (e3.nodeType === 8) + if (e3.data === _a) { + const t3 = e3.parentNode; + e3.previousSibling !== null && s2 !== o2 || (s2++, t3.insertBefore(Ea(), e3)), o2 = s2, this.parts.push({type: "node", index: s2}), e3.nextSibling === null ? e3.data = "" : (n2.push(e3), s2--), a2++; + } else { + let t3 = -1; + for (; (t3 = e3.data.indexOf(_a, t3 + 1)) !== -1; ) + this.parts.push({type: "node", index: -1}), a2++; + } + } else + i2.currentNode = r2.pop(); + } + for (const e3 of n2) + e3.parentNode.removeChild(e3); + } + } + const Sa = (e2, t2) => { + const n2 = e2.length - t2.length; + return n2 >= 0 && e2.slice(n2) === t2; + }, xa = (e2) => e2.index !== -1, Ea = () => document.createComment(""), Aa = /([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/; + function Ca(e2, t2) { + const {element: {content: n2}, parts: r2} = e2, i2 = document.createTreeWalker(n2, 133, null, false); + let o2 = Ta(r2), s2 = r2[o2], a2 = -1, c2 = 0; + const l2 = []; + let u2 = null; + for (; i2.nextNode(); ) { + a2++; + const e3 = i2.currentNode; + for (e3.previousSibling === u2 && (u2 = null), t2.has(e3) && (l2.push(e3), u2 === null && (u2 = e3)), u2 !== null && c2++; s2 !== void 0 && s2.index === a2; ) + s2.index = u2 !== null ? -1 : s2.index - c2, o2 = Ta(r2, o2), s2 = r2[o2]; + } + l2.forEach((e3) => e3.parentNode.removeChild(e3)); + } + const ja = (e2) => { + let t2 = e2.nodeType === 11 ? 0 : 1; + const n2 = document.createTreeWalker(e2, 133, null, false); + for (; n2.nextNode(); ) + t2++; + return t2; + }, Ta = (e2, t2 = -1) => { + for (let n2 = t2 + 1; n2 < e2.length; n2++) { + const t3 = e2[n2]; + if (xa(t3)) + return n2; + } + return -1; + }; + /** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ + const Oa = new WeakMap(), ka = (e2) => (...t2) => { + const n2 = e2(...t2); + return Oa.set(n2, true), n2; + }, Na = (e2) => typeof e2 == "function" && Oa.has(e2), Ia = {}, Ma = {}; + /** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ + class Ra { + constructor(e2, t2, n2) { + this.__parts = [], this.template = e2, this.processor = t2, this.options = n2; + } + update(e2) { + let t2 = 0; + for (const n2 of this.__parts) + n2 !== void 0 && n2.setValue(e2[t2]), t2++; + for (const e3 of this.__parts) + e3 !== void 0 && e3.commit(); + } + _clone() { + const e2 = ga ? this.template.element.content.cloneNode(true) : document.importNode(this.template.element.content, true), t2 = [], n2 = this.template.parts, r2 = document.createTreeWalker(e2, 133, null, false); + let i2, o2 = 0, s2 = 0, a2 = r2.nextNode(); + for (; o2 < n2.length; ) + if (i2 = n2[o2], xa(i2)) { + for (; s2 < i2.index; ) + s2++, a2.nodeName === "TEMPLATE" && (t2.push(a2), r2.currentNode = a2.content), (a2 = r2.nextNode()) === null && (r2.currentNode = t2.pop(), a2 = r2.nextNode()); + if (i2.type === "node") { + const e3 = this.processor.handleTextExpression(this.options); + e3.insertAfterNode(a2.previousSibling), this.__parts.push(e3); + } else + this.__parts.push(...this.processor.handleAttributeExpressions(a2, i2.name, i2.strings, this.options)); + o2++; + } else + this.__parts.push(void 0), o2++; + return ga && (document.adoptNode(e2), customElements.upgrade(e2)), e2; + } + } + /** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ + const Da = ` ${_a} `; + class Pa { + constructor(e2, t2, n2, r2) { + this.strings = e2, this.values = t2, this.type = n2, this.processor = r2; + } + getHTML() { + const e2 = this.strings.length - 1; + let t2 = "", n2 = false; + for (let r2 = 0; r2 < e2; r2++) { + const e3 = this.strings[r2], i2 = e3.lastIndexOf("<!--"); + n2 = (i2 > -1 || n2) && e3.indexOf("-->", i2 + 1) === -1; + const o2 = Aa.exec(e3); + t2 += o2 === null ? e3 + (n2 ? Da : ba) : e3.substr(0, o2.index) + o2[1] + o2[2] + "$lit$" + o2[3] + _a; + } + return t2 += this.strings[e2], t2; + } + getTemplateElement() { + const e2 = document.createElement("template"); + return e2.innerHTML = this.getHTML(), e2; + } + } + /** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ + const La = (e2) => e2 === null || !(typeof e2 == "object" || typeof e2 == "function"), za = (e2) => Array.isArray(e2) || !(!e2 || !e2[Symbol.iterator]); + class Fa { + constructor(e2, t2, n2) { + this.dirty = true, this.element = e2, this.name = t2, this.strings = n2, this.parts = []; + for (let e3 = 0; e3 < n2.length - 1; e3++) + this.parts[e3] = this._createPart(); + } + _createPart() { + return new Ba(this); + } + _getValue() { + const e2 = this.strings, t2 = e2.length - 1; + let n2 = ""; + for (let r2 = 0; r2 < t2; r2++) { + n2 += e2[r2]; + const t3 = this.parts[r2]; + if (t3 !== void 0) { + const e3 = t3.value; + if (La(e3) || !za(e3)) + n2 += typeof e3 == "string" ? e3 : String(e3); + else + for (const t4 of e3) + n2 += typeof t4 == "string" ? t4 : String(t4); + } + } + return n2 += e2[t2], n2; + } + commit() { + this.dirty && (this.dirty = false, this.element.setAttribute(this.name, this._getValue())); + } + } + class Ba { + constructor(e2) { + this.value = void 0, this.committer = e2; + } + setValue(e2) { + e2 === Ia || La(e2) && e2 === this.value || (this.value = e2, Na(e2) || (this.committer.dirty = true)); + } + commit() { + for (; Na(this.value); ) { + const e2 = this.value; + this.value = Ia, e2(this); + } + this.value !== Ia && this.committer.commit(); + } + } + class qa { + constructor(e2) { + this.value = void 0, this.__pendingValue = void 0, this.options = e2; + } + appendInto(e2) { + this.startNode = e2.appendChild(Ea()), this.endNode = e2.appendChild(Ea()); + } + insertAfterNode(e2) { + this.startNode = e2, this.endNode = e2.nextSibling; + } + appendIntoPart(e2) { + e2.__insert(this.startNode = Ea()), e2.__insert(this.endNode = Ea()); + } + insertAfterPart(e2) { + e2.__insert(this.startNode = Ea()), this.endNode = e2.endNode, e2.endNode = this.startNode; + } + setValue(e2) { + this.__pendingValue = e2; + } + commit() { + if (this.startNode.parentNode === null) + return; + for (; Na(this.__pendingValue); ) { + const e3 = this.__pendingValue; + this.__pendingValue = Ia, e3(this); + } + const e2 = this.__pendingValue; + e2 !== Ia && (La(e2) ? e2 !== this.value && this.__commitText(e2) : e2 instanceof Pa ? this.__commitTemplateResult(e2) : e2 instanceof Node ? this.__commitNode(e2) : za(e2) ? this.__commitIterable(e2) : e2 === Ma ? (this.value = Ma, this.clear()) : this.__commitText(e2)); + } + __insert(e2) { + this.endNode.parentNode.insertBefore(e2, this.endNode); + } + __commitNode(e2) { + this.value !== e2 && (this.clear(), this.__insert(e2), this.value = e2); + } + __commitText(e2) { + const t2 = this.startNode.nextSibling, n2 = typeof (e2 = e2 == null ? "" : e2) == "string" ? e2 : String(e2); + t2 === this.endNode.previousSibling && t2.nodeType === 3 ? t2.data = n2 : this.__commitNode(document.createTextNode(n2)), this.value = e2; + } + __commitTemplateResult(e2) { + const t2 = this.options.templateFactory(e2); + if (this.value instanceof Ra && this.value.template === t2) + this.value.update(e2.values); + else { + const n2 = new Ra(t2, e2.processor, this.options), r2 = n2._clone(); + n2.update(e2.values), this.__commitNode(r2), this.value = n2; + } + } + __commitIterable(e2) { + Array.isArray(this.value) || (this.value = [], this.clear()); + const t2 = this.value; + let n2, r2 = 0; + for (const i2 of e2) + n2 = t2[r2], n2 === void 0 && (n2 = new qa(this.options), t2.push(n2), r2 === 0 ? n2.appendIntoPart(this) : n2.insertAfterPart(t2[r2 - 1])), n2.setValue(i2), n2.commit(), r2++; + r2 < t2.length && (t2.length = r2, this.clear(n2 && n2.endNode)); + } + clear(e2 = this.startNode) { + va(this.startNode.parentNode, e2.nextSibling, this.endNode); + } + } + class Ha { + constructor(e2, t2, n2) { + if (this.value = void 0, this.__pendingValue = void 0, n2.length !== 2 || n2[0] !== "" || n2[1] !== "") + throw new Error("Boolean attributes can only contain a single expression"); + this.element = e2, this.name = t2, this.strings = n2; + } + setValue(e2) { + this.__pendingValue = e2; + } + commit() { + for (; Na(this.__pendingValue); ) { + const e3 = this.__pendingValue; + this.__pendingValue = Ia, e3(this); + } + if (this.__pendingValue === Ia) + return; + const e2 = !!this.__pendingValue; + this.value !== e2 && (e2 ? this.element.setAttribute(this.name, "") : this.element.removeAttribute(this.name), this.value = e2), this.__pendingValue = Ia; + } + } + class Ua extends Fa { + constructor(e2, t2, n2) { + super(e2, t2, n2), this.single = n2.length === 2 && n2[0] === "" && n2[1] === ""; + } + _createPart() { + return new $a(this); + } + _getValue() { + return this.single ? this.parts[0].value : super._getValue(); + } + commit() { + this.dirty && (this.dirty = false, this.element[this.name] = this._getValue()); + } + } + class $a extends Ba { + } + let Wa = false; + (() => { + try { + const e2 = {get capture() { + return Wa = true, false; + }}; + window.addEventListener("test", e2, e2), window.removeEventListener("test", e2, e2); + } catch (e2) { + } + })(); + class Ga { + constructor(e2, t2, n2) { + this.value = void 0, this.__pendingValue = void 0, this.element = e2, this.eventName = t2, this.eventContext = n2, this.__boundHandleEvent = (e3) => this.handleEvent(e3); + } + setValue(e2) { + this.__pendingValue = e2; + } + commit() { + for (; Na(this.__pendingValue); ) { + const e3 = this.__pendingValue; + this.__pendingValue = Ia, e3(this); + } + if (this.__pendingValue === Ia) + return; + const e2 = this.__pendingValue, t2 = this.value, n2 = e2 == null || t2 != null && (e2.capture !== t2.capture || e2.once !== t2.once || e2.passive !== t2.passive), r2 = e2 != null && (t2 == null || n2); + n2 && this.element.removeEventListener(this.eventName, this.__boundHandleEvent, this.__options), r2 && (this.__options = Va(e2), this.element.addEventListener(this.eventName, this.__boundHandleEvent, this.__options)), this.value = e2, this.__pendingValue = Ia; + } + handleEvent(e2) { + typeof this.value == "function" ? this.value.call(this.eventContext || this.element, e2) : this.value.handleEvent(e2); + } + } + const Va = (e2) => e2 && (Wa ? {capture: e2.capture, passive: e2.passive, once: e2.once} : e2.capture); + function Ja(e2) { + let t2 = Xa.get(e2.type); + t2 === void 0 && (t2 = {stringsArray: new WeakMap(), keyString: new Map()}, Xa.set(e2.type, t2)); + let n2 = t2.stringsArray.get(e2.strings); + if (n2 !== void 0) + return n2; + const r2 = e2.strings.join(_a); + return n2 = t2.keyString.get(r2), n2 === void 0 && (n2 = new wa(e2, e2.getTemplateElement()), t2.keyString.set(r2, n2)), t2.stringsArray.set(e2.strings, n2), n2; + } + const Xa = new Map(), Qa = new WeakMap(), Ya = (e2, t2, n2) => { + let r2 = Qa.get(t2); + r2 === void 0 && (va(t2, t2.firstChild), Qa.set(t2, r2 = new qa(Object.assign({templateFactory: Ja}, n2))), r2.appendInto(t2)), r2.setValue(e2), r2.commit(); + }; + /** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ + const Ka = new class { + handleAttributeExpressions(e2, t2, n2, r2) { + const i2 = t2[0]; + if (i2 === ".") { + return new Ua(e2, t2.slice(1), n2).parts; + } + return i2 === "@" ? [new Ga(e2, t2.slice(1), r2.eventContext)] : i2 === "?" ? [new Ha(e2, t2.slice(1), n2)] : new Fa(e2, t2, n2).parts; + } + handleTextExpression(e2) { + return new qa(e2); + } + }(); + /** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ + typeof window != "undefined" && (window.litHtmlVersions || (window.litHtmlVersions = [])).push("1.2.1"); + const Za = (e2, ...t2) => new Pa(e2, t2, "html", Ka), ec = (e2, t2) => `${e2}--${t2}`; + let tc = true; + window.ShadyCSS === void 0 ? tc = false : window.ShadyCSS.prepareTemplateDom === void 0 && (console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."), tc = false); + const nc = (e2) => (t2) => { + const n2 = ec(t2.type, e2); + let r2 = Xa.get(n2); + r2 === void 0 && (r2 = {stringsArray: new WeakMap(), keyString: new Map()}, Xa.set(n2, r2)); + let i2 = r2.stringsArray.get(t2.strings); + if (i2 !== void 0) + return i2; + const o2 = t2.strings.join(_a); + if (i2 = r2.keyString.get(o2), i2 === void 0) { + const n3 = t2.getTemplateElement(); + tc && window.ShadyCSS.prepareTemplateDom(n3, e2), i2 = new wa(t2, n3), r2.keyString.set(o2, i2); + } + return r2.stringsArray.set(t2.strings, i2), i2; + }, rc = ["html", "svg"], ic = new Set(), oc = (e2, t2, n2) => { + ic.add(e2); + const r2 = n2 ? n2.element : document.createElement("template"), i2 = t2.querySelectorAll("style"), {length: o2} = i2; + if (o2 === 0) + return void window.ShadyCSS.prepareTemplateStyles(r2, e2); + const s2 = document.createElement("style"); + for (let e3 = 0; e3 < o2; e3++) { + const t3 = i2[e3]; + t3.parentNode.removeChild(t3), s2.textContent += t3.textContent; + } + ((e3) => { + rc.forEach((t3) => { + const n3 = Xa.get(ec(t3, e3)); + n3 !== void 0 && n3.keyString.forEach((e4) => { + const {element: {content: t4}} = e4, n4 = new Set(); + Array.from(t4.querySelectorAll("style")).forEach((e5) => { + n4.add(e5); + }), Ca(e4, n4); + }); + }); + })(e2); + const a2 = r2.content; + n2 ? function(e3, t3, n3 = null) { + const {element: {content: r3}, parts: i3} = e3; + if (n3 == null) + return void r3.appendChild(t3); + const o3 = document.createTreeWalker(r3, 133, null, false); + let s3 = Ta(i3), a3 = 0, c3 = -1; + for (; o3.nextNode(); ) { + for (c3++, o3.currentNode === n3 && (a3 = ja(t3), n3.parentNode.insertBefore(t3, n3)); s3 !== -1 && i3[s3].index === c3; ) { + if (a3 > 0) { + for (; s3 !== -1; ) + i3[s3].index += a3, s3 = Ta(i3, s3); + return; + } + s3 = Ta(i3, s3); + } + } + }(n2, s2, a2.firstChild) : a2.insertBefore(s2, a2.firstChild), window.ShadyCSS.prepareTemplateStyles(r2, e2); + const c2 = a2.querySelector("style"); + if (window.ShadyCSS.nativeShadow && c2 !== null) + t2.insertBefore(c2.cloneNode(true), t2.firstChild); + else if (n2) { + a2.insertBefore(s2, a2.firstChild); + const e3 = new Set(); + e3.add(s2), Ca(n2, e3); + } + }; + window.JSCompiler_renameProperty = (e2, t2) => e2; + const sc = {toAttribute(e2, t2) { + switch (t2) { + case Boolean: + return e2 ? "" : null; + case Object: + case Array: + return e2 == null ? e2 : JSON.stringify(e2); + } + return e2; + }, fromAttribute(e2, t2) { + switch (t2) { + case Boolean: + return e2 !== null; + case Number: + return e2 === null ? null : Number(e2); + case Object: + case Array: + return JSON.parse(e2); + } + return e2; + }}, ac = (e2, t2) => t2 !== e2 && (t2 == t2 || e2 == e2), cc = {attribute: true, type: String, converter: sc, reflect: false, hasChanged: ac}; + class lc extends HTMLElement { + constructor() { + super(), this._updateState = 0, this._instanceProperties = void 0, this._updatePromise = new Promise((e2) => this._enableUpdatingResolver = e2), this._changedProperties = new Map(), this._reflectingProperties = void 0, this.initialize(); + } + static get observedAttributes() { + this.finalize(); + const e2 = []; + return this._classProperties.forEach((t2, n2) => { + const r2 = this._attributeNameForProperty(n2, t2); + r2 !== void 0 && (this._attributeToPropertyMap.set(r2, n2), e2.push(r2)); + }), e2; + } + static _ensureClassProperties() { + if (!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties", this))) { + this._classProperties = new Map(); + const e2 = Object.getPrototypeOf(this)._classProperties; + e2 !== void 0 && e2.forEach((e3, t2) => this._classProperties.set(t2, e3)); + } + } + static createProperty(e2, t2 = cc) { + if (this._ensureClassProperties(), this._classProperties.set(e2, t2), t2.noAccessor || this.prototype.hasOwnProperty(e2)) + return; + const n2 = typeof e2 == "symbol" ? Symbol() : "__" + e2, r2 = this.getPropertyDescriptor(e2, n2, t2); + r2 !== void 0 && Object.defineProperty(this.prototype, e2, r2); + } + static getPropertyDescriptor(e2, t2, n2) { + return {get() { + return this[t2]; + }, set(n3) { + const r2 = this[e2]; + this[t2] = n3, this._requestUpdate(e2, r2); + }, configurable: true, enumerable: true}; + } + static getPropertyOptions(e2) { + return this._classProperties && this._classProperties.get(e2) || cc; + } + static finalize() { + const e2 = Object.getPrototypeOf(this); + if (e2.hasOwnProperty("finalized") || e2.finalize(), this.finalized = true, this._ensureClassProperties(), this._attributeToPropertyMap = new Map(), this.hasOwnProperty(JSCompiler_renameProperty("properties", this))) { + const e3 = this.properties, t2 = [...Object.getOwnPropertyNames(e3), ...typeof Object.getOwnPropertySymbols == "function" ? Object.getOwnPropertySymbols(e3) : []]; + for (const n2 of t2) + this.createProperty(n2, e3[n2]); + } + } + static _attributeNameForProperty(e2, t2) { + const n2 = t2.attribute; + return n2 === false ? void 0 : typeof n2 == "string" ? n2 : typeof e2 == "string" ? e2.toLowerCase() : void 0; + } + static _valueHasChanged(e2, t2, n2 = ac) { + return n2(e2, t2); + } + static _propertyValueFromAttribute(e2, t2) { + const n2 = t2.type, r2 = t2.converter || sc, i2 = typeof r2 == "function" ? r2 : r2.fromAttribute; + return i2 ? i2(e2, n2) : e2; + } + static _propertyValueToAttribute(e2, t2) { + if (t2.reflect === void 0) + return; + const n2 = t2.type, r2 = t2.converter; + return (r2 && r2.toAttribute || sc.toAttribute)(e2, n2); + } + initialize() { + this._saveInstanceProperties(), this._requestUpdate(); + } + _saveInstanceProperties() { + this.constructor._classProperties.forEach((e2, t2) => { + if (this.hasOwnProperty(t2)) { + const e3 = this[t2]; + delete this[t2], this._instanceProperties || (this._instanceProperties = new Map()), this._instanceProperties.set(t2, e3); + } + }); + } + _applyInstanceProperties() { + this._instanceProperties.forEach((e2, t2) => this[t2] = e2), this._instanceProperties = void 0; + } + connectedCallback() { + this.enableUpdating(); + } + enableUpdating() { + this._enableUpdatingResolver !== void 0 && (this._enableUpdatingResolver(), this._enableUpdatingResolver = void 0); + } + disconnectedCallback() { + } + attributeChangedCallback(e2, t2, n2) { + t2 !== n2 && this._attributeToProperty(e2, n2); + } + _propertyToAttribute(e2, t2, n2 = cc) { + const r2 = this.constructor, i2 = r2._attributeNameForProperty(e2, n2); + if (i2 !== void 0) { + const e3 = r2._propertyValueToAttribute(t2, n2); + if (e3 === void 0) + return; + this._updateState = 8 | this._updateState, e3 == null ? this.removeAttribute(i2) : this.setAttribute(i2, e3), this._updateState = -9 & this._updateState; + } + } + _attributeToProperty(e2, t2) { + if (8 & this._updateState) + return; + const n2 = this.constructor, r2 = n2._attributeToPropertyMap.get(e2); + if (r2 !== void 0) { + const e3 = n2.getPropertyOptions(r2); + this._updateState = 16 | this._updateState, this[r2] = n2._propertyValueFromAttribute(t2, e3), this._updateState = -17 & this._updateState; + } + } + _requestUpdate(e2, t2) { + let n2 = true; + if (e2 !== void 0) { + const r2 = this.constructor, i2 = r2.getPropertyOptions(e2); + r2._valueHasChanged(this[e2], t2, i2.hasChanged) ? (this._changedProperties.has(e2) || this._changedProperties.set(e2, t2), i2.reflect !== true || 16 & this._updateState || (this._reflectingProperties === void 0 && (this._reflectingProperties = new Map()), this._reflectingProperties.set(e2, i2))) : n2 = false; + } + !this._hasRequestedUpdate && n2 && (this._updatePromise = this._enqueueUpdate()); + } + requestUpdate(e2, t2) { + return this._requestUpdate(e2, t2), this.updateComplete; + } + async _enqueueUpdate() { + this._updateState = 4 | this._updateState; + try { + await this._updatePromise; + } catch (e3) { + } + const e2 = this.performUpdate(); + return e2 != null && await e2, !this._hasRequestedUpdate; + } + get _hasRequestedUpdate() { + return 4 & this._updateState; + } + get hasUpdated() { + return 1 & this._updateState; + } + performUpdate() { + this._instanceProperties && this._applyInstanceProperties(); + let e2 = false; + const t2 = this._changedProperties; + try { + e2 = this.shouldUpdate(t2), e2 ? this.update(t2) : this._markUpdated(); + } catch (t3) { + throw e2 = false, this._markUpdated(), t3; + } + e2 && (1 & this._updateState || (this._updateState = 1 | this._updateState, this.firstUpdated(t2)), this.updated(t2)); + } + _markUpdated() { + this._changedProperties = new Map(), this._updateState = -5 & this._updateState; + } + get updateComplete() { + return this._getUpdateComplete(); + } + _getUpdateComplete() { + return this._updatePromise; + } + shouldUpdate(e2) { + return true; + } + update(e2) { + this._reflectingProperties !== void 0 && this._reflectingProperties.size > 0 && (this._reflectingProperties.forEach((e3, t2) => this._propertyToAttribute(t2, this[t2], e3)), this._reflectingProperties = void 0), this._markUpdated(); + } + updated(e2) { + } + firstUpdated(e2) { + } + } + lc.finalized = true; + /** + @license + Copyright (c) 2019 The Polymer Project Authors. All rights reserved. + This code may only be used under the BSD style license found at + http://polymer.github.io/LICENSE.txt The complete set of authors may be found at + http://polymer.github.io/AUTHORS.txt The complete set of contributors may be + found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as + part of the polymer project is also subject to an additional IP rights grant + found at http://polymer.github.io/PATENTS.txt + */ + const uc = "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, dc = Symbol(); + class hc { + constructor(e2, t2) { + if (t2 !== dc) + throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead."); + this.cssText = e2; + } + get styleSheet() { + return this._styleSheet === void 0 && (uc ? (this._styleSheet = new CSSStyleSheet(), this._styleSheet.replaceSync(this.cssText)) : this._styleSheet = null), this._styleSheet; + } + toString() { + return this.cssText; + } + } + const fc = (e2, ...t2) => { + const n2 = t2.reduce((t3, n3, r2) => t3 + ((e3) => { + if (e3 instanceof hc) + return e3.cssText; + if (typeof e3 == "number") + return e3; + throw new Error(`Value passed to 'css' function must be a 'css' function result: ${e3}. Use 'unsafeCSS' to pass non-literal values, but + take care to ensure page security.`); + })(n3) + e2[r2 + 1], e2[0]); + return new hc(n2, dc); + }; + /** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ + (window.litElementVersions || (window.litElementVersions = [])).push("2.3.1"); + const pc = {}; + class gc extends lc { + static getStyles() { + return this.styles; + } + static _getUniqueStyles() { + if (this.hasOwnProperty(JSCompiler_renameProperty("_styles", this))) + return; + const e2 = this.getStyles(); + if (e2 === void 0) + this._styles = []; + else if (Array.isArray(e2)) { + const t2 = (e3, n3) => e3.reduceRight((e4, n4) => Array.isArray(n4) ? t2(n4, e4) : (e4.add(n4), e4), n3), n2 = t2(e2, new Set()), r2 = []; + n2.forEach((e3) => r2.unshift(e3)), this._styles = r2; + } else + this._styles = [e2]; + } + initialize() { + super.initialize(), this.constructor._getUniqueStyles(), this.renderRoot = this.createRenderRoot(), window.ShadowRoot && this.renderRoot instanceof window.ShadowRoot && this.adoptStyles(); + } + createRenderRoot() { + return this.attachShadow({mode: "open"}); + } + adoptStyles() { + const e2 = this.constructor._styles; + e2.length !== 0 && (window.ShadyCSS === void 0 || window.ShadyCSS.nativeShadow ? uc ? this.renderRoot.adoptedStyleSheets = e2.map((e3) => e3.styleSheet) : this._needsShimAdoptedStyleSheets = true : window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e2.map((e3) => e3.cssText), this.localName)); + } + connectedCallback() { + super.connectedCallback(), this.hasUpdated && window.ShadyCSS !== void 0 && window.ShadyCSS.styleElement(this); + } + update(e2) { + const t2 = this.render(); + super.update(e2), t2 !== pc && this.constructor.render(t2, this.renderRoot, {scopeName: this.localName, eventContext: this}), this._needsShimAdoptedStyleSheets && (this._needsShimAdoptedStyleSheets = false, this.constructor._styles.forEach((e3) => { + const t3 = document.createElement("style"); + t3.textContent = e3.cssText, this.renderRoot.appendChild(t3); + })); + } + render() { + return pc; + } + } + gc.finalized = true, gc.render = (e2, t2, n2) => { + if (!n2 || typeof n2 != "object" || !n2.scopeName) + throw new Error("The `scopeName` option is required."); + const r2 = n2.scopeName, i2 = Qa.has(t2), o2 = tc && t2.nodeType === 11 && !!t2.host, s2 = o2 && !ic.has(r2), a2 = s2 ? document.createDocumentFragment() : t2; + if (Ya(e2, a2, Object.assign({templateFactory: nc(r2)}, n2)), s2) { + const e3 = Qa.get(a2); + Qa.delete(a2); + const n3 = e3.value instanceof Ra ? e3.value.template : void 0; + oc(r2, a2, n3), va(t2, t2.firstChild), t2.appendChild(a2), Qa.set(t2, e3); + } + !i2 && o2 && window.ShadyCSS.styleElement(t2.host); + }; + class mc extends gc { + constructor() { + super(), Object.assign(this, _i); + } + createRenderRoot() { + return this; + } + disconnectedCallback() { + super.disconnectedCallback(), this.stopListening(); + } + } + const vc = function() { + this.handlers = [], this.checkUrl = this.checkUrl.bind(this), typeof window != "undefined" && (this.location = window.location, this.history = window.history); + }; + vc.extend = Yr; + const _c = /^[#\/]|\s+$/g, bc = /^\/+|\/+$/g, yc = /#.*$/; + vc.started = false, Object.assign(vc.prototype, _i, {interval: 50, atRoot: function() { + return this.location.pathname.replace(/[^\/]$/, "$&/") === this.root && !this.getSearch(); + }, matchRoot: function() { + return this.decodeFragment(this.location.pathname).slice(0, this.root.length - 1) + "/" === this.root; + }, decodeFragment: function(e2) { + return decodeURI(e2.replace(/%25/g, "%2525")); + }, getSearch: function() { + const e2 = this.location.href.replace(/#.*/, "").match(/\?.+/); + return e2 ? e2[0] : ""; + }, getHash: function(e2) { + const t2 = (e2 || this).location.href.match(/#(.*)$/); + return t2 ? t2[1] : ""; + }, getPath: function() { + const e2 = this.decodeFragment(this.location.pathname + this.getSearch()).slice(this.root.length - 1); + return e2.charAt(0) === "/" ? e2.slice(1) : e2; + }, getFragment: function(e2) { + return e2 == null && (e2 = this._usePushState || !this._wantsHashChange ? this.getPath() : this.getHash()), e2.replace(_c, ""); + }, start: function(e2) { + if (vc.started) + throw new Error("history has already been started"); + if (vc.started = true, this.options = Or({root: "/"}, this.options, e2), this.root = this.options.root, this._wantsHashChange = this.options.hashChange !== false, this._hasHashChange = "onhashchange" in window && (document.documentMode === void 0 || document.documentMode > 7), this._useHashChange = this._wantsHashChange && this._hasHashChange, this._wantsPushState = !!this.options.pushState, this._hasPushState = !(!this.history || !this.history.pushState), this._usePushState = this._wantsPushState && this._hasPushState, this.fragment = this.getFragment(), this.root = ("/" + this.root + "/").replace(bc, "/"), this._wantsHashChange && this._wantsPushState) { + if (!this._hasPushState && !this.atRoot()) { + const e3 = this.root.slice(0, -1) || "/"; + return this.location.replace(e3 + "#" + this.getPath()), true; + } + this._hasPushState && this.atRoot() && this.navigate(this.getHash(), {replace: true}); + } + if (!this._hasHashChange && this._wantsHashChange && !this._usePushState) { + this.iframe = document.createElement("iframe"), this.iframe.src = "javascript:0", this.iframe.style.display = "none", this.iframe.tabIndex = -1; + const e3 = document.body, t2 = e3.insertBefore(this.iframe, e3.firstChild).contentWindow; + t2.document.open(), t2.document.close(), t2.location.hash = "#" + this.fragment; + } + if (this._usePushState ? addEventListener("popstate", this.checkUrl, false) : this._useHashChange && !this.iframe ? addEventListener("hashchange", this.checkUrl, false) : this._wantsHashChange && (this._checkUrlInterval = setInterval(this.checkUrl, this.interval)), !this.options.silent) + return this.loadUrl(); + }, stop: function() { + this._usePushState ? removeEventListener("popstate", this.checkUrl, false) : this._useHashChange && !this.iframe && removeEventListener("hashchange", this.checkUrl, false), this.iframe && (document.body.removeChild(this.iframe), this.iframe = null), this._checkUrlInterval && clearInterval(this._checkUrlInterval), vc.started = false; + }, route: function(e2, t2) { + this.handlers.unshift({route: e2, callback: t2}); + }, checkUrl: function(e2) { + let t2 = this.getFragment(); + if (t2 === this.fragment && this.iframe && (t2 = this.getHash(this.iframe.contentWindow)), t2 === this.fragment) + return false; + this.iframe && this.navigate(t2), this.loadUrl(); + }, loadUrl: function(e2) { + return !!this.matchRoot() && (e2 = this.fragment = this.getFragment(e2), Xs(this.handlers, function(t2) { + if (t2.route.test(e2)) + return t2.callback(e2), true; + })); + }, navigate: function(e2, t2) { + if (!vc.started) + return false; + t2 && t2 !== true || (t2 = {trigger: !!t2}), e2 = this.getFragment(e2 || ""); + let n2 = this.root; + e2 !== "" && e2.charAt(0) !== "?" || (n2 = n2.slice(0, -1) || "/"); + const r2 = n2 + e2; + e2 = e2.replace(yc, ""); + const i2 = this.decodeFragment(e2); + if (this.fragment !== i2) { + if (this.fragment = i2, this._usePushState) + this.history[t2.replace ? "replaceState" : "pushState"]({}, document.title, r2); + else { + if (!this._wantsHashChange) + return this.location.assign(r2); + if (this._updateHash(this.location, e2, t2.replace), this.iframe && e2 !== this.getHash(this.iframe.contentWindow)) { + const n3 = this.iframe.contentWindow; + t2.replace || (n3.document.open(), n3.document.close()), this._updateHash(n3.location, e2, t2.replace); + } + } + return t2.trigger ? this.loadUrl(e2) : void 0; + } + }, _updateHash: function(e2, t2, n2) { + if (n2) { + const n3 = e2.href.replace(/(javascript:|#).*$/, ""); + e2.replace(n3 + "#" + t2); + } else + e2.hash = "#" + t2; + }}); + var wc = vc; + var Sc = function(e2) { + return Ee(e2) && k(e2) == "[object RegExp]"; + }, xc = ze.a && ze.a.isRegExp, Ec = xc ? Le(xc) : Sc; + const Ac = function(e2 = {}) { + this.history = e2.history || new wc(), this.preinitialize.apply(this, arguments), e2.routes && (this.routes = e2.routes), this._bindRoutes(), this.initialize.apply(this, arguments); + }; + Ac.extend = Yr; + const Cc = /\((.*?)\)/g, jc = /(\(\?)?:\w+/g, Tc = /\*\w+/g, Oc = /[\-{}\[\]+?.,\\\^$|#\s]/g; + Object.assign(Ac.prototype, _i, {preinitialize: function() { + }, initialize: function() { + }, route: function(e2, t2, n2) { + return Ec(e2) || (e2 = this._routeToRegExp(e2)), M(t2) && (n2 = t2, t2 = ""), n2 || (n2 = this[t2]), this.history.route(e2, (r2) => { + const i2 = this._extractParameters(e2, r2); + this.execute(n2, i2, t2) !== false && (this.trigger.apply(this, ["route:" + t2].concat(i2)), this.trigger("route", t2, i2), this.history.trigger("route", this, t2, i2)); + }), this; + }, execute: function(e2, t2, n2) { + e2 && e2.apply(this, t2); + }, navigate: function(e2, t2) { + return this.history.navigate(e2, t2), this; + }, _bindRoutes: function() { + if (!this.routes) + return; + let e2; + this.routes = Qr(this, "routes"); + const t2 = Qe(this.routes); + for (; (e2 = t2.pop()) != null; ) + this.route(e2, this.routes[e2]); + }, _routeToRegExp: function(e2) { + return e2 = e2.replace(Oc, "\\$&").replace(Cc, "(?:$1)?").replace(jc, function(e3, t2) { + return t2 ? e3 : "([^/?]+)"; + }).replace(Tc, "([^?]*?)"), new RegExp("^" + e2 + "(?:\\?([\\s\\S]*))?$"); + }, _extractParameters: function(e2, t2) { + const n2 = e2.exec(t2).slice(1); + return n2.map(function(e3, t3) { + return t3 === n2.length - 1 ? e3 || null : e3 ? decodeURIComponent(e3) : null; + }); + }}); + var kc = n(1), Nc = function() { + return y.a.Date.now(); + }, Ic = Math.max, Mc = Math.min; + var Rc = function(e2, t2, n2) { + var r2, i2, o2, s2, a2, c2, l2 = 0, u2 = false, d2 = false, h2 = true; + if (typeof e2 != "function") + throw new TypeError("Expected a function"); + function f2(t3) { + var n3 = r2, o3 = i2; + return r2 = i2 = void 0, l2 = t3, s2 = e2.apply(o3, n3); + } + function p2(e3) { + return l2 = e3, a2 = setTimeout(m2, t2), u2 ? f2(e3) : s2; + } + function g2(e3) { + var n3 = e3 - c2; + return c2 === void 0 || n3 >= t2 || n3 < 0 || d2 && e3 - l2 >= o2; + } + function m2() { + var e3 = Nc(); + if (g2(e3)) + return v2(e3); + a2 = setTimeout(m2, function(e4) { + var n3 = t2 - (e4 - c2); + return d2 ? Mc(n3, o2 - (e4 - l2)) : n3; + }(e3)); + } + function v2(e3) { + return a2 = void 0, h2 && r2 ? f2(e3) : (r2 = i2 = void 0, s2); + } + function _2() { + var e3 = Nc(), n3 = g2(e3); + if (r2 = arguments, i2 = this, c2 = e3, n3) { + if (a2 === void 0) + return p2(c2); + if (d2) + return clearTimeout(a2), a2 = setTimeout(m2, t2), f2(c2); + } + return a2 === void 0 && (a2 = setTimeout(m2, t2)), s2; + } + return t2 = di(t2) || 0, N(n2) && (u2 = !!n2.leading, o2 = (d2 = "maxWait" in n2) ? Ic(di(n2.maxWait) || 0, t2) : o2, h2 = "trailing" in n2 ? !!n2.trailing : h2), _2.cancel = function() { + a2 !== void 0 && clearTimeout(a2), l2 = 0, r2 = c2 = i2 = a2 = void 0; + }, _2.flush = function() { + return a2 === void 0 ? s2 : v2(Nc()); + }, _2; + }; + var Dc = function(e2, t2, n2) { + t2 = Gr(t2, e2); + var r2 = (e2 = To(e2, t2)) == null ? e2 : e2[Vr(Co(t2))]; + return r2 == null ? void 0 : yr(r2, e2, n2); + }, Pc = jr(Dc), Lc = n(94); + /** + * @module converse-core + * @copyright The Converse.js contributors + * @license Mozilla Public License (MPLv2) + */ + En.a.extend(Sn.a), kc.e.addNamespace("CARBONS", "urn:xmpp:carbons:2"), kc.e.addNamespace("CHATSTATES", "http://jabber.org/protocol/chatstates"), kc.e.addNamespace("CSI", "urn:xmpp:csi:0"), kc.e.addNamespace("DELAY", "urn:xmpp:delay"), kc.e.addNamespace("FASTEN", "urn:xmpp:fasten:0"), kc.e.addNamespace("FORWARD", "urn:xmpp:forward:0"), kc.e.addNamespace("HINTS", "urn:xmpp:hints"), kc.e.addNamespace("HTTPUPLOAD", "urn:xmpp:http:upload:0"), kc.e.addNamespace("IDLE", "urn:xmpp:idle:1"), kc.e.addNamespace("MAM", "urn:xmpp:mam:2"), kc.e.addNamespace("MODERATE", "urn:xmpp:message-moderate:0"), kc.e.addNamespace("NICK", "http://jabber.org/protocol/nick"), kc.e.addNamespace("OMEMO", "eu.siacs.conversations.axolotl"), kc.e.addNamespace("OUTOFBAND", "jabber:x:oob"), kc.e.addNamespace("PUBSUB", "http://jabber.org/protocol/pubsub"), kc.e.addNamespace("REGISTER", "jabber:iq:register"), kc.e.addNamespace("RETRACT", "urn:xmpp:message-retract:0"), kc.e.addNamespace("ROSTERX", "http://jabber.org/protocol/rosterx"), kc.e.addNamespace("RSM", "http://jabber.org/protocol/rsm"), kc.e.addNamespace("SID", "urn:xmpp:sid:0"), kc.e.addNamespace("SPOILER", "urn:xmpp:spoiler:0"), kc.e.addNamespace("STANZAS", "urn:ietf:params:xml:ns:xmpp-stanzas"), kc.e.addNamespace("STYLING", "urn:xmpp:styling:0"), kc.e.addNamespace("VCARD", "vcard-temp"), kc.e.addNamespace("VCARDUPDATE", "vcard-temp:x:update"), kc.e.addNamespace("XFORM", "jabber:x:data"); + class zc extends Error { + } + const Fc = ["converse-adhoc", "converse-bookmarks", "converse-bosh", "converse-caps", "converse-carbons", "converse-chat", "converse-chatboxes", "converse-disco", "converse-emoji", "converse-headlines", "converse-mam", "converse-muc", "converse-ping", "converse-pubsub", "converse-roster", "converse-smacks", "converse-status", "converse-vcard"], Bc = {allow_non_roster_messaging: false, assets_path: "/dist", authentication: "login", auto_login: false, auto_reconnect: true, blacklisted_plugins: [], clear_cache_on_logout: false, connection_options: {}, credentials_url: null, discover_connection_methods: true, geouri_regex: /https\:\/\/www.openstreetmap.org\/.*#map=[0-9]+\/([\-0-9.]+)\/([\-0-9.]+)\S*/g, geouri_replacement: "https://www.openstreetmap.org/?mlat=$1&mlon=$2#map=18/$1/$2", i18n: "en", idle_presence_timeout: 300, jid: void 0, keepalive: true, loglevel: "info", locales: ["af", "ar", "bg", "ca", "cs", "de", "eo", "es", "eu", "en", "fi", "fr", "gl", "he", "hi", "hu", "id", "it", "ja", "nb", "nl", "mr", "oc", "pl", "pt", "pt_BR", "ro", "ru", "tr", "uk", "vi", "zh_CN", "zh_TW"], nickname: void 0, password: void 0, persistent_store: "localStorage", rid: void 0, root: window.document, sid: void 0, singleton: false, strict_plugin_dependencies: false, view_mode: "overlayed", websocket_url: void 0, whitelisted_plugins: []}, qc = {}; + qc[kc.e.Status.ATTACHED] = "ATTACHED", qc[kc.e.Status.AUTHENTICATING] = "AUTHENTICATING", qc[kc.e.Status.AUTHFAIL] = "AUTHFAIL", qc[kc.e.Status.CONNECTED] = "CONNECTED", qc[kc.e.Status.CONNECTING] = "CONNECTING", qc[kc.e.Status.CONNFAIL] = "CONNFAIL", qc[kc.e.Status.DISCONNECTED] = "DISCONNECTED", qc[kc.e.Status.DISCONNECTING] = "DISCONNECTING", qc[kc.e.Status.ERROR] = "ERROR", qc[kc.e.Status.RECONNECTING] = "RECONNECTING", qc[kc.e.Status.REDIRECT] = "REDIRECT"; + const Hc = {initialize() { + }, __: (...e2) => Object(Lc.sprintf)(...e2)}, Uc = {log: zn, CONNECTION_STATUS: qc, templates: {}, promises: {initialized: Jo.getResolveablePromise()}, STATUS_WEIGHTS: {offline: 6, unavailable: 5, xa: 4, away: 3, dnd: 2, chat: 1, online: 1}, ANONYMOUS: "anonymous", CLOSED: "closed", EXTERNAL: "external", LOGIN: "login", LOGOUT: "logout", OPENED: "opened", PREBIND: "prebind", STANZA_TIMEOUT: 1e4, SUCCESS: "success", FAILURE: "failure", DEFAULT_IMAGE_TYPE: "image/svg+xml", DEFAULT_IMAGE: "UklGRjwNAABXRUJQVlA4TC8NAAAvA8FAELV4u21bT2pt2/j/v+AoZVndP5aQsPQoyXG+OvANFTsqbwKCQG4bSZKcjFcFI2f2CAoAABBuo7tcjKa2t9q2bdvWvHU2i9m2rXybzK5tfN2mbtNenLsJqDv/3/n/zv93/r+rNBSUUYF2277XPy/97gqZBF7SwwAMCkzmNiHzvKd/zQsSIPe4F47AAU2CgJso3J7N2yVJDj8v/Y0M4DQiYe+fA2/Ln4HsO4M2Ar/2Nuh8SZh74wKjCV3o3pb5Y3LZvr0nfIHe1zBjPKHiavgrIOsQ5EDgbXk95HL6pyB4KpOPRV/DlqmEjVVEsRpgwm7LBTivRI4C1EOy++prqNKeUE8wXrASxrCa0goaCmihj1GeZ5vv1ZTeGAMN1XjuaUjOqPY1IMqTsMg8SHLEZAqfrCWEbdyASSO9DDP+8bmg8Xt1IIS1kKeA0QI024d1klegvlbffE/zlo+s6fCJDZt5Tx+cdDzcf7EV25cOaPEGSZr58V39HWPuM4P4/MB0Ev5Drw0qpC8Yz5SZ4C0Zb21mvE5yejifTzx4rD4PGWdSv/AggOYkVKM/ATU28Q9+xudM0LTmLHtYT8EzG36XvJ4zAT/jCKg5ojYBzXUS2gnZfpGGM+QagLjQnAQWBmNAxPEXcZKwRC2VJGNjcuDAVOP6iBy2qz21LCfJM/9Oih1Dg1cgCZ141XDc0ZQE1m9V/dKTBAm9nCP4ugpgqvP6ec+5xTnJAqOqQp0XW9DQhW8NyR2NSWD+VmHCYLa0sRtDsDXlh+0zrSBhCLMq1Hi6TejGv4bldV0+ksDCsMCTyxsOold/dbnhLQWrQpXHIAk9BNTQxIn6JDBQGQUoiID1l68GQqpCmrvbhO5VDU9SWU1YPtYNxYHZBD6FNTwx4jNoQsPypqBNTZJfDAcHWjCS0IBb3VhcqU8CA+2BgSz3QEBDLbajADcYG2qTLfeQHRQPHEAAGlpxqBu9XyYX9j8MCSI2CSPHuuHHl2TzMSDQpiaBQ17d+N0hoWY/GB6oTLZcgDi1f0CHqSmR8yAJFQ9DATcmE/6hW9PGlMunzbRqfp/8Pg2ETx4mcEisKYIZA+JS8nj9oLH1FOrhkMw/hwG+zCY8gdoNObbssa0q8D8Jr/+Bryrs9q9P3aAukw0+g2DGnYS5RXUnG2H4hmpBxZIfyQarGgVA5Sm7j261eE+4PRsCK0YTHkOaAuu3QcBZ9j4xDD+Zfz7tOHPJdj2FA48TRlZDgN3bsEJETRF92hIkaXlOnjCYQhH5lS27BgDym4Q/KExjxu00zln4maeRO7NpbFYJ38/9D2dmE/ZWxxlKs4L0wWKSNV85TAJ+9+8c5MsaNFmz+1AQHmcdin2gYfa3/70izhqPDkhRRjNXsGUrKwkCGIQiW43IvOwvoPmaYbuhmbKPDtt1ntnc+yDyNKEelQ44sZIwxlLyxkEUquWGg2/JG6PJ17wDqtQnPDFC30ODloRb1w/sgBF9oOOssBVCtb4a/vUr4/cYdbg6DLdBs0O972HDTJ5ZXx3B4L2Hn4Bw7rqk6qik520ypxrfdYdiPeKcDn2PCHhhlYAuVRgxABqa0a3O6FwSBjGuzgQCBx7hfY9iRIGNZTfC4ICGHaMAzWCQ2a2bih3J4dJtBRt0SVHf41ByP+/2kDC+ajpuYC03qDWtPpKHbnP6kve+x4WEBlQ7QeRRwjekG3Y8Akm2PES64fcp4dGs09s+4ULf43bCbxQ7IQ0z4THYBsLhJsn+u+Fhl8D87fT+kxz6Hg8Svp87nU8JN6uR7WmktKHektO50/mUfPS9efKEXCdk+JR8XA1qIAnR2PKnAegjed51euJbMh8ikHiWwILWgArMseW6AdoyOR+GUlGeMIhRQ2HKffqP35tqzCtoKK/BROI+iClqKsjofEKu5u1z9g/DCS3aE36i1NT2cZGcZ8MJDEcShOwG6qLQM8LkZz2cCiM6QMM0SX8ObPfnAz48gWaLUQ2oIhc4YYwciG1m8++E1XkNKqVwCnHCMlexAtd0XHHlPnnm5NXIw6qeuLxLwjA3yMYF/ecdOSuGkiDcqFwNrEKGQ8wmCXzmmdo9zJOEOQ4jU4OrjoTBhJuW+yURxxpgVciTyGO6gMfqkac/51GAaQ+eKgiswZssts72P+i+1fQH0I38X/IuHGU/JlfAv2fg6Wl9GTDgFwk9HMEM7N95wPRnnXDF8MMFEk+SgDDIeXx/p/eL35mBbZLlYbgUrnxBkCQsfLMDF+hguq3nOL/A+kmSyxbXGjCFEkX8gp8kIMzwkzKScUAZPBDg2Gmx+tmT/MV3ZrZJMn+g6KcGTdUj6bx/T+OFKdqo4ipHKGXD4vOHqy9Pu0sa3/lAxmO1HiZVUHGjjL8sZsosUUM57teljQJ0HCpV/zwQBbw58EI/y13uj1Sf8XkErM7DZRwqawliI5d4f6CDAYYOqy01X48PM/RqFGCqw2YcHBRkUUN3uZzf5wVsTX0Q8Ojv3Myx3553NRxvkst16bcLOlUJb4/9Dg1aEm5fHXS7rkGHZPfV74gFDiJKRgFu+eMywE+9bnNJGMH8tj0wnMBEsccpjv0IEy5BuG3guQiaHQevDt/bwFLEQkIPlnXrsaA7YZH118X1NGiUMpfAIfdq4O378wXJZjlhgd3zXoYmV+Em8DlixPo3CHEDL5lzC50ehj2fQBJgjkMdBfi3CIXDrCThG059Cyxx9CRhgg2QquOfD9juALUd1EM7pCC0K4gUMwaa0Eci2F4FnZ3MJqGRIMNUe4w5xgWs2mDKA17i0mb3+LFpoSBhfOQGDi+t6gV/6pIwx27oPQrtFbxkyRvMqj1yFNOR8AzqpPk54TmUSS+bZDOfhDy/EobZg1qrKkx4tUzgcwud3oQjn0GSL06hXK3B4ctHeElmSE0iF25CM+qTjpdkT94kZPiUZMlPoiG3KhSpgJOA8BWnfmRY4ukGTZig+LNao8cp2KBJ4JFbEzGmIwnjmEx6ZCwJnacJRR78JGGR21gCtilI5H8noZfEP4ftQciwl7kkNBJ0qrbIUEBrGqlBdcI1IleSBA6ek/A4JAnXrkua8EbNWEI/pSi2qRP+NCRhnn3I9h7UeYQINIh5jWm1BYs37+GlccmGmkgMS2MISJ60uoyxTNyEWiwbsuQLoRBaVD3y6jlZ8vjYc6BwLQkcKt5HAdqiRyVs0AQh3cAJzWhNmPE3QXAJCLsnsWubyyWhBp0JM5qTexrgJWGey5s29U45nCRce+k3RN4nDJILqVoiQx7N2ySv7GT/Z7bsBmwCx3EkOf/SmnBj0iqhhYeIc6bs2HT62ObzgxI6k4SuBfIt6kDua8Iykb0GPNcT2IRVS7B4/sAFTeBwDxsUYCZ0YzAK0IwfUwm1mPM2oQpK03UpVCX3mFGTwCagqdB/BA2fNxhzifkk8GHgD25S1QU2aLgOvs+cqUt4vGqBLieYTIKEPyRCLhJYTSgzTNOGqgQOyfWY0IR603GePNYDy8k3Sk1XH5BjCTApowAQLnxGlIQZTj23AM+ThDrk+wwqDCYcrYnXpZNJwzYJw0/HUYCCzvuEISyq8V8/IKUIE+5ALrYjCWOLpsV3zi8FiVsJInYCNtTiNYGBdNUjpfQnCa3kIjOh1skrKn0GBZqTL6CGq0G48xI4CRweYn8NMwpQRdgh4QLYJuz5P6EH81GAIh5uDng14XnInoQqTOlKGMaxacHZhBWiqurqH8SSWywlgccbPA1qAOJOQjMKfQYiDxKGcRtDh2NMJkHMXxKhVFWdlskvjtUIjWcJPEqqChcWgojkJpKWYWFXVRTtE15CbyjsGE84f6qqui6JaH4+J2GKMnTHnhhOuD/rM0UKcHIhDQMMyaEeSRJGOIjGKEAjZN4lfITaNN8nvEamqtBnOGF7E6UJw89VhTQvEngUNEGdJUfIY1WospehJCA0zDFAn9RLAkzKKECvRYanSYAZeYGXhJUnnIBGAZqRojrhEbgGDGlNGMW1qgoVWhLONT0nu3VVFc4MJ3Rg3HCNwLMEBtSmui6EA4/gJIH3wjBwkidk+k1hCCvNSKi7/6jJEHiW8BelMShcSxCxF8zYB4yEWlTH3r6S2ceYYti1TLgJdQwNGpPv44QqaKRQiyTNsLbVd9GigiGECQJ6OYTOKEBrdoMEPvuRqjUaVAAnfEVlFKCRHVtQRFxA+XT62S4DUqMAjT+wEriUo6pgIf2KKIjZVK3Rfl/skt2BitkoQP8FiwmJbGULseh7mGqPGf0JMFVUcJXGZQKbwFGA5mfaQLPkD2eXK0TJ03NT4cdksqSG0xyFCS+hHb12BQYD4mZse8AEbPX1NcVwMpE5Cg2aUCTABp0I+70mXh2GAuZBJ7JARg1MiGxktAExTe/XD1uTgUikven8vphUV8ORRCuSBv4nH/zQqAVOlPONblp4wUZ0qz1G7IZBx3b/nGqPPqW8PzHID8qwW9cAXSCNMgpQqjtSj4/Qqvv3IyrILOrO/3f+v/P/nf/vQA0A", TIMEOUTS: {PAUSED: 1e4, INACTIVE: 9e4}, INACTIVE: "inactive", ACTIVE: "active", COMPOSING: "composing", PAUSED: "paused", GONE: "gone", PRIVATE_CHAT_TYPE: "chatbox", CHATROOMS_TYPE: "chatroom", HEADLINES_TYPE: "headline", CONTROLBOX_TYPE: "controlbox", default_connection_options: {explicitResourceBinding: true}, router: new Ac(), TimeoutError: zc, isTestEnv: () => Wc.bosh_service_url === "montague.lit/http-bind", __: (...e2) => Hc.__(...e2), ___: (e2) => e2}; + let $c; + Uc.VERSION_NAME = "v7.0.3dev", Object.assign(Uc, _i), ur.enable(Uc, "_converse", "pluggable"); + let Wc = {}; + function Gc() { + var e2; + if (!Uc.bare_jid) { + const e3 = "No JID to fetch user settings for"; + throw zn.error(e3), Error(e3); + } + if (!((e2 = $c) === null || e2 === void 0 ? void 0 : e2.fetched)) { + const e3 = "converse.user-settings.".concat(Uc.bare_jid); + $c = new qo({id: e3}), $c.browserStorage = Xc(e3), $c.fetched = $c.fetch({promise: true}); + } + return $c.fetched; + } + const Vc = Uc.api = {connection: {connected() { + var e2; + return (Uc == null || (e2 = Uc.connection) === null || e2 === void 0 ? void 0 : e2.connected) && true; + }, disconnect() { + Uc.connection && Uc.connection.disconnect(); + }, async reconnect() { + const e2 = Uc.connfeedback.get("connection_status"); + if (Vc.settings.get("authentication") === Uc.ANONYMOUS && (await Qc(), await Kc()), e2 === kc.e.Status.CONNFAIL ? Vc.connection.isType("websocket") && Vc.settings.get("bosh_service_url") ? (await Uc.setUserJID(Uc.bare_jid), Uc.connection._proto._doDisconnect(), Uc.connection._proto = new kc.e.Bosh(Uc.connection), Uc.connection.service = Vc.settings.get("bosh_service_url")) : Vc.connection.isType("bosh") && Vc.settings.get("websocket_url") && (Vc.settings.get("authentication") === Uc.ANONYMOUS ? await Uc.setUserJID(Vc.settings.get("jid")) : await Uc.setUserJID(Uc.bare_jid), Uc.connection._proto._doDisconnect(), Uc.connection._proto = new kc.e.Websocket(Uc.connection), Uc.connection.service = Vc.settings.get("websocket_url")) : e2 === kc.e.Status.AUTHFAIL && Vc.settings.get("authentication") === Uc.ANONYMOUS && await Uc.setUserJID(Vc.settings.get("jid")), !Uc.connection.reconnecting) + return Uc.connection.reconnect(); + Uc.connection.debouncedReconnect(); + }, isType: (e2) => Uc.connection.isType(e2)}, async trigger(e2) { + if (!Uc._events) + return; + const t2 = Array.from(arguments), n2 = t2.pop(); + if (n2 && n2.synchronous) { + const n3 = Uc._events[e2] || []; + await Promise.all(n3.map((e3) => e3.callback.apply(e3.ctx, t2.splice(1)))); + } else + Uc.trigger.apply(Uc, arguments); + const r2 = Uc.promises[e2]; + r2 !== void 0 && r2.resolve(); + }, hook(e2, t2, n2) { + const r2 = Uc._events[e2] || []; + if (r2.length) { + const e3 = r2.reduce((e4, n3) => e4.then((e5) => n3.callback(t2, e5)), Promise.resolve(n2)); + return e3.catch((e4) => { + throw zn.error(e4), e4; + }), e3; + } + return n2; + }, user: {jid: () => Uc.connection.jid, async login(e2, t2, n2 = false) { + var r2, i2; + if (e2 = e2 || Uc.jid, (!((r2 = Uc.connection) === null || r2 === void 0 ? void 0 : r2.jid) || e2 && !Jo.isSameDomain(Uc.connection.jid, e2)) && await Uc.initConnection(), ((i2 = Vc.settings.get("connection_options")) === null || i2 === void 0 ? void 0 : i2.worker) && await Uc.connection.restoreWorkerSession()) + return; + e2 && (e2 = await Uc.setUserJID(e2)); + const o2 = Uc.pluggable.plugins["converse-bosh"]; + if (o2 && o2.enabled()) { + if (await Uc.restoreBOSHSession()) + return; + if (Vc.settings.get("authentication") === Uc.PREBIND && (!n2 || Vc.settings.get("auto_login"))) + return Uc.startNewPreboundBOSHSession(); + } + t2 = t2 || Vc.settings.get("password"), async function(e3, t3) { + const {api: n3} = Uc; + n3.settings.get("authentication") === Uc.LOGIN ? e3 ? Yc(e3) : Uc.api.settings.get("credentials_url") ? Yc(await async function() { + let e4, t4 = 0; + for (; !e4; ) { + try { + e4 = await nl(t4); + } catch (e5) { + zn.error("Could not fetch login credentials"), zn.error(e5); + } + t4 = 2e3; + } + return e4; + }()) : Uc.jid && (Uc.api.settings.get("password") || Uc.connection.pass) ? Yc() : !Uc.isTestEnv() && "credentials" in navigator ? Yc(await async function() { + try { + const e4 = await navigator.credentials.get({password: true}); + if (e4 && e4.type == "password" && Jo.isValidJID(e4.id)) + return await Uc.setUserJID(e4.id), {jid: e4.id, password: e4.password}; + } catch (e4) { + zn.error(e4); + } + }()) : !Uc.isTestEnv() && zn.warn("attemptNonPreboundSession: Couldn't find credentials to log in with") : ![Uc.ANONYMOUS, Uc.EXTERNAL].includes(Uc.api.settings.get("authentication")) || t3 && !Uc.api.settings.get("auto_login") || Yc(); + }(e2 && t2 ? {jid: e2, password: t2} : null, n2); + }, logout() { + const e2 = Jo.getResolveablePromise(), t2 = () => { + Object.keys(Uc.promises).forEach(Jc), delete Uc.jid, Vc.trigger("logout"), e2.resolve(); + }; + return Uc.connection.setDisconnectionCause(Uc.LOGOUT, void 0, true), Uc.connection !== void 0 ? (Vc.listen.once("disconnected", () => t2()), Uc.connection.disconnect()) : t2(), e2; + }, settings: {getModel: async () => (await Gc(), $c), get: async (e2, t2) => (await Gc(), $c.get(e2) === void 0 ? t2 : $c.get(e2)), async set(e2, t2) { + if (await Gc(), N(e2)) + return $c.save(e2, {promise: true}); + { + const n2 = {}; + return n2[e2] = t2, $c.save(n2, {promise: true}); + } + }, async clear() { + await Gc(), $c.clear(); + }}}, settings: {extend(e2) { + Jo.merge(Bc, e2); + const t2 = Object.keys(Bo(e2, Object.keys(Bc))), n2 = Bo(Wc, t2), r2 = Or(Bo(e2, t2), n2); + Jo.merge(Uc.settings, r2), Jo.merge(Uc, r2); + }, update(e2) { + return zn.warn("The api.settings.update method has been deprecated and will be removed. Please use api.settings.extend instead."), this.extend(e2); + }, get(e2) { + if (Object.keys(Bc).includes(e2)) + return Uc[e2]; + }, set(e2, t2) { + const n2 = {}; + N(e2) ? (Or(Uc, Bo(e2, Object.keys(Bc))), Or(Uc.settings, Bo(e2, Object.keys(Bc)))) : typeof e2 == "string" && (n2[e2] = t2, Or(Uc, Bo(n2, Object.keys(Bc))), Or(Uc.settings, Bo(n2, Object.keys(Bc)))); + }}, promises: {add(e2, t2 = true) { + (e2 = Array.isArray(e2) ? e2 : [e2]).forEach((e3) => { + const n2 = Jo.getResolveablePromise(); + n2.replace = t2, Uc.promises[e3] = n2; + }); + }}, listen: {once: Uc.once.bind(Uc), on: Uc.on.bind(Uc), not: Uc.off.bind(Uc), stanza(e2, t2, n2) { + M(t2) ? (n2 = t2, t2 = {}) : t2 = t2 || {}, Uc.connection.addHandler(n2, t2.ns, e2, t2.type, t2.id, t2.from, t2); + }}, waitUntil(e2) { + if (M(e2)) + return Jo.waitUntil(e2); + { + const t2 = Uc.promises[e2]; + return t2 === void 0 ? null : t2; + } + }, send: (e2) => Vc.connection.connected() ? (typeof e2 == "string" && (e2 = Jo.toStanza(e2)), e2.tagName === "iq" ? Vc.sendIQ(e2) : (Uc.connection.send(e2), void Vc.trigger("send", e2))) : (zn.warn("Not sending stanza because we're not connected!"), void zn.warn(kc.e.serialize(e2))), sendIQ(e2, t2 = Uc.STANZA_TIMEOUT, n2 = true) { + var r2, i2; + let o2; + return e2 = (r2 = (i2 = e2) === null || i2 === void 0 ? void 0 : i2.nodeTree) !== null && r2 !== void 0 ? r2 : e2, ["get", "set"].includes(e2.getAttribute("type")) ? (t2 = t2 || Uc.STANZA_TIMEOUT, n2 ? (o2 = new Promise((n3, r3) => Uc.connection.sendIQ(e2, n3, r3, t2)), o2.catch((n3) => { + if (n3 === null) + throw new zc("Timeout error after ".concat(t2, "ms for the following IQ stanza: ").concat(kc.e.serialize(e2))); + })) : o2 = new Promise((n3) => Uc.connection.sendIQ(e2, n3, n3, t2))) : (Uc.connection.sendIQ(e2), o2 = Promise.resolve()), Vc.trigger("send", e2), o2; + }}; + function Jc(e2) { + const t2 = Uc.promises[e2]; + if (!t2) + throw new Error("Tried to replace non-existing promise: ".concat(e2)); + if (t2.replace) { + const n2 = Jo.getResolveablePromise(); + n2.replace = t2.replace, Uc.promises[e2] = n2; + } else + zn.debug('Not replacing promise "'.concat(e2, '"')); + } + function Xc(e2, t2) { + const n2 = Uc.storage[t2 || Uc.getDefaultStore()]; + return new yn(e2, n2); + } + async function Qc() { + return await Uc.api.trigger("beforeTearDown", {synchronous: true}), window.removeEventListener("click", Uc.onUserActivity), window.removeEventListener("focus", Uc.onUserActivity), window.removeEventListener("keypress", Uc.onUserActivity), window.removeEventListener("mousemove", Uc.onUserActivity), window.removeEventListener(Uc.unloadevent, Uc.onUserActivity), window.clearInterval(Uc.everySecondTrigger), Uc.api.trigger("afterTearDown"), Uc; + } + function Yc(e2) { + if ([Uc.ANONYMOUS, Uc.EXTERNAL].includes(Uc.api.settings.get("authentication"))) { + if (!Uc.jid) + throw new Error("Config Error: when using anonymous login you need to provide the server's domain via the 'jid' option. Either when calling converse.initialize, or when calling _converse.api.user.login."); + Uc.connection.reconnecting || Uc.connection.reset(), Uc.connection.connect(Uc.jid.toLowerCase()); + } else if (Uc.api.settings.get("authentication") === Uc.LOGIN) { + var t2; + const n2 = e2 ? e2.password : ((t2 = Uc.connection) === null || t2 === void 0 ? void 0 : t2.pass) || Uc.api.settings.get("password"); + if (!n2) { + if (Uc.api.settings.get("auto_login")) + throw new Error("autoLogin: If you use auto_login and authentication='login' then you also need to provide a password."); + return Uc.connection.setDisconnectionCause(kc.e.Status.AUTHFAIL, void 0, true), void Uc.api.connection.disconnect(); + } + Uc.connection.reconnecting || Uc.connection.reset(), Uc.connection.connect(Uc.jid, n2); + } + } + function Kc() { + var e2; + return (e2 = Uc.session) === null || e2 === void 0 || e2.destroy(), delete Uc.session, Uc.shouldClearCache() && Uc.api.user.settings.clear(), Uc.api.trigger("clearSession", {synchronous: true}); + } + async function Zc(e2) { + var t2; + const n2 = Vc.settings.get("connection_options").worker, r2 = kc.e.getBareJidFromJid(e2).toLowerCase(), i2 = "converse.session-".concat(r2); + ((t2 = Uc.session) === null || t2 === void 0 ? void 0 : t2.get("id")) !== i2 ? (Uc.session = new qo({id: i2}), Uc.session.browserStorage = Xc(i2, n2 ? "persistent" : "session"), await new Promise((e3) => Uc.session.fetch({success: e3, error: e3})), !n2 && Uc.session.get("active") && (Uc.session.clear(), Uc.session.save({id: i2})), el(e2), function() { + if (Vc.settings.get("persistent_store") === "sessionStorage") + return; + if (Uc.api.settings.get("persistent_store") === "BrowserExtLocal") + return yn.localForage.defineDriver(pr.a).then(() => yn.localForage.setDriver("webExtensionLocalStorage")), void (Uc.storage.persistent = yn.localForage); + if (Uc.api.settings.get("persistent_store") === "BrowserExtSync") + return yn.localForage.defineDriver(hr.a).then(() => yn.localForage.setDriver("webExtensionSyncStorage")), void (Uc.storage.persistent = yn.localForage); + const e3 = {name: Uc.isTestEnv() ? "converse-test-persistent" : "converse-persistent", storeName: Uc.bare_jid}; + Uc.api.settings.get("persistent_store") === "localStorage" ? (e3.description = "localStorage instance", e3.driver = [yn.localForage.LOCALSTORAGE]) : Uc.api.settings.get("persistent_store") === "IndexedDB" ? (e3.description = "indexedDB instance", e3.driver = [yn.localForage.INDEXEDDB]) : Uc.api.settings.get("persistent_store") === "none" && (e3.description = "in-memory instance", e3.driver = [yn.IN_MEMORY]), Uc.storage.persistent = yn.localForage.createInstance(e3); + }(), Uc.api.trigger("userSessionInitialized")) : el(e2); + } + function el(e2) { + e2 = Uc.session.get("jid") || e2, Uc.api.settings.get("authentication") === Uc.ANONYMOUS || kc.e.getResourceFromJid(e2) || (e2 = e2.toLowerCase() + fa.generateResource()), Uc.jid = e2, Uc.bare_jid = kc.e.getBareJidFromJid(e2), Uc.resource = kc.e.getResourceFromJid(e2), Uc.domain = kc.e.getDomainFromJid(e2), Uc.session.save({jid: e2, bare_jid: Uc.bare_jid, resource: Uc.resource, domain: Uc.domain, active: true}), Uc.connection.jid = e2; + } + async function tl() { + var e2; + await Vc.trigger("cleanup", {synchronous: true}), Uc.router.history.stop(), document.removeEventListener("visibilitychange", Uc.saveWindowState), Vc.trigger("unregisteredGlobalEventHandlers"), (e2 = Uc.connection) === null || e2 === void 0 || e2.reset(), Uc.stopListening(), Uc.off(), Uc.promises.initialized.isResolved && Vc.promises.add("initialized"); + } + function nl(e2 = 0) { + return new Promise(Rc((e3, t2) => { + const n2 = new XMLHttpRequest(); + n2.open("GET", Vc.settings.get("credentials_url"), true), n2.setRequestHeader("Accept", "application/json, text/javascript"), n2.onload = () => { + if (n2.status >= 200 && n2.status < 400) { + const t3 = JSON.parse(n2.responseText); + Uc.setUserJID(t3.jid).then(() => { + e3({jid: t3.jid, password: t3.password}); + }); + } else + t2(new Error("".concat(n2.status, ": ").concat(n2.responseText))); + }, n2.onerror = t2, n2.send(); + }, e2)); + } + Uc.isUniView = function() { + return ["mobile", "fullscreen", "embedded"].includes(Vc.settings.get("view_mode")); + }, Uc.getDefaultStore = function() { + if (Uc.config.get("trusted")) { + return Vc.settings.get("persistent_store") === "sessionStorage" ? "session" : "persistent"; + } + return "session"; + }, Uc.createStore = Xc, Uc.shouldClearCache = () => !Uc.config.get("trusted") || Vc.settings.get("clear_cache_on_logout") || Uc.isTestEnv(), Uc.initConnection = function() { + const e2 = Uc.api; + if (!e2.settings.get("bosh_service_url")) { + if (e2.settings.get("authentication") === Uc.PREBIND) + throw new Error("authentication is set to 'prebind' but we don't have a BOSH connection"); + if (!e2.settings.get("websocket_url")) + throw new Error("initConnection: you must supply a value for either the bosh_service_url or websocket_url or both."); + } + const t2 = Uc.isTestEnv() ? pa : fa; + if (("WebSocket" in window || "MozWebSocket" in window) && e2.settings.get("websocket_url")) + Uc.connection = new t2(e2.settings.get("websocket_url"), Object.assign(Uc.default_connection_options, e2.settings.get("connection_options"))); + else { + if (!e2.settings.get("bosh_service_url")) + throw new Error("initConnection: this browser does not support websockets and bosh_service_url wasn't specified."); + Uc.connection = new t2(e2.settings.get("bosh_service_url"), Object.assign(Uc.default_connection_options, e2.settings.get("connection_options"), {keepalive: e2.settings.get("keepalive")})); + } + !function() { + const e3 = {}; + e3[kc.e.LogLevel.DEBUG] = "debug", e3[kc.e.LogLevel.INFO] = "info", e3[kc.e.LogLevel.WARN] = "warn", e3[kc.e.LogLevel.ERROR] = "error", e3[kc.e.LogLevel.FATAL] = "fatal", kc.e.log = (t3, n2) => zn.log(n2, e3[t3]), kc.e.error = (e4) => zn.error(e4), Uc.connection.xmlInput = (e4) => zn.debug(e4.outerHTML, "color: darkgoldenrod"), Uc.connection.xmlOutput = (e4) => zn.debug(e4.outerHTML, "color: darkcyan"); + }(), e2.trigger("connectionInitialized"); + }, Uc.setUserJID = async function(e2) { + return await Zc(e2), Uc.api.trigger("setUserJID"), e2; + }, Uc.saveWindowState = function(e2) { + let t2; + const n2 = {focus: "visible", focusin: "visible", pageshow: "visible", blur: "hidden", focusout: "hidden", pagehide: "hidden"}; + t2 = (e2 = e2 || document.createEvent("Events")).type in n2 ? n2[e2.type] : document.hidden ? "hidden" : "visible", Uc.windowState = t2, Vc.trigger("windowStateChanged", {state: t2}); + }, Uc.ConnectionFeedback = qo.extend({defaults: {connection_status: kc.e.Status.DISCONNECTED, message: ""}, initialize() { + this.on("change", () => Vc.trigger("connfeedback", Uc.connfeedback)); + }}); + const rl = window.converse || {}; + Object.assign(rl, {CHAT_STATES: ["active", "composing", "gone", "inactive", "paused"], keycodes: {TAB: 9, ENTER: 13, SHIFT: 16, CTRL: 17, ALT: 18, ESCAPE: 27, LEFT_ARROW: 37, UP_ARROW: 38, RIGHT_ARROW: 39, DOWN_ARROW: 40, FORWARD_SLASH: 47, AT: 50, META: 91, META_RIGHT: 93}, async initialize(e2) { + if (await tl(), "onpagehide" in window ? Uc.unloadevent = "pagehide" : "onbeforeunload" in window ? Uc.unloadevent = "beforeunload" : "onunload" in window && (Uc.unloadevent = "unload"), function(e3) { + Uc.settings = {}, Wc = e3; + const t3 = Bo(e3, Object.keys(Bc)); + Or(Uc.settings, Bc, t3), Or(Uc, Bc, t3); + }(e2), Uc.strict_plugin_dependencies = e2.strict_plugin_dependencies, zn.setLogLevel(Vc.settings.get("loglevel")), Vc.settings.get("authentication") === Uc.ANONYMOUS && Vc.settings.get("auto_login") && !Vc.settings.get("jid")) + throw new Error("Config Error: you need to provide the server's domain via the 'jid' option when using anonymous authentication with auto_login."); + Uc.router.route(/^converse\?loglevel=(debug|info|warn|error|fatal)$/, "loglevel", (e3) => zn.setLogLevel(e3)), Uc.connfeedback = new Uc.ConnectionFeedback(), Uc.send_initial_presence = true, await async function() { + await yn.sessionStorageInitialized, Uc.storage = {session: yn.localForage.createInstance({name: Uc.isTestEnv() ? "converse-test-session" : "converse-session", description: "sessionStorage instance", driver: ["sessionStorageWrapper"]})}; + }(), await async function() { + const e3 = "converse.client-config"; + Uc.config = new qo({id: e3, trusted: true}), Uc.config.browserStorage = Xc(e3, "session"), await new Promise((e4) => Uc.config.fetch({success: e4, error: e4})), Uc.api.trigger("clientConfigInitialized"); + }(), await Hc.initialize(), function() { + Uc.pluggable.initialized_plugins = []; + const e3 = Fc.concat(Uc.api.settings.get("whitelisted_plugins")); + Uc.api.settings.get("singleton") && ["converse-bookmarks", "converse-controlbox", "converse-headline", "converse-register"].forEach((e4) => Uc.api.settings.get("blacklisted_plugins").push(e4)), Uc.pluggable.initializePlugins({_converse: Uc}, e3, Uc.api.settings.get("blacklisted_plugins")), Uc.api.trigger("pluginsInitialized"); + }(), document.addEventListener("visibilitychange", Uc.saveWindowState), Uc.saveWindowState({type: document.hidden ? "blur" : "focus"}), Vc.trigger("registeredGlobalEventHandlers"), !History.started && Uc.router.history.start(), Vc.settings.get("idle_presence_timeout") > 0 && Vc.listen.on("addClientFeatures", () => Vc.disco.own.features.add(kc.e.NS.IDLE)); + const t2 = Uc.pluggable.plugins; + if ((Vc.settings.get("auto_login") || Vc.settings.get("keepalive") && Pc(t2["converse-bosh"], "enabled")) && await Vc.user.login(null, null, true), Vc.trigger("initialized"), Uc.isTestEnv()) + return Uc; + }, plugins: {add(e2, t2) { + if (t2.__name__ = e2, Uc.pluggable.plugins[e2] !== void 0) + throw new TypeError('Error: plugin with name "'.concat(e2, '" has already been ') + "registered!"); + Uc.pluggable.plugins[e2] = t2; + }}, env: {$build: kc.a, $iq: kc.b, $msg: kc.c, $pres: kc.d, utils: Jo, Collection: ra, CustomElement: mc, Model: qo, Promise, Strophe: kc.e, dayjs: En.a, html: Za, log: zn, sizzle: mr.a, sprintf: Lc.sprintf, stanza_utils: ps, u: Jo}}); + const il = new CustomEvent("converse-loaded", {detail: {converse: rl}}); + window.dispatchEvent(il); + const {Strophe: ol} = rl.env; + let sl, al; + ol.addNamespace("ADHOC", "http://jabber.org/protocol/commands"); + const cl = {adhoc: {async getCommands(e2) { + let t2 = []; + try { + n2 = await al.disco.items(e2, ol.NS.ADHOC), t2 = mr()('query[xmlns="'.concat(ol.NS.DISCO_ITEMS, '"][node="').concat(ol.NS.ADHOC, '"] item'), n2).map(ps.getAttributes); + } catch (t3) { + t3 === null ? zn.error("Error: timeout while fetching ad-hoc commands for ".concat(e2)) : (zn.error("Error while fetching ad-hoc commands for ".concat(e2)), zn.error(t3)); + } + var n2; + return t2; + }}}; + rl.plugins.add("converse-adhoc", {dependencies: ["converse-disco"], initialize() { + sl = this._converse, al = sl.api, Object.assign(al, cl); + }}); + const ll = rl.env.utils; + var ul = qo.extend({initialize() { + this.rosterContactAdded = ll.getResolveablePromise(); + }, async setRosterContact(e2) { + const t2 = await Vc.contacts.get(e2); + t2 && (this.contact = t2, this.set("nickname", t2.get("nickname")), this.rosterContactAdded.resolve()); + }}), dl = n(169), hl = n.n(dl); + var fl = function(e2) { + return function(t2, n2, r2) { + var i2 = Object(t2); + if (!Xe(t2)) { + var o2 = Eo(n2); + t2 = Qe(t2), n2 = function(e3) { + return o2(i2[e3], e3, i2); + }; + } + var s2 = e2(t2, n2, r2); + return s2 > -1 ? i2[o2 ? t2[s2] : s2] : void 0; + }; + }(Ds); + var pl = function(e2, t2) { + return e2 === t2 || uo(e2, t2, fo(t2)); + }; + const {Strophe: gl, $msg: ml} = rl.env, vl = rl.env.utils; + var _l = ul.extend({defaults() { + return {bookmarked: false, chat_state: void 0, hidden: Uc.isUniView() && !Vc.settings.get("singleton"), message_type: "chat", nickname: void 0, num_unread: 0, time_sent: new Date(0).toISOString(), time_opened: this.get("time_opened") || new Date().getTime(), type: Uc.PRIVATE_CHAT_TYPE, url: ""}; + }, async initialize() { + this.initialized = vl.getResolveablePromise(), ul.prototype.initialize.apply(this, arguments); + const e2 = this.get("jid"); + e2 && (this.set({box_id: "box-".concat(e2)}), this.initNotifications(), this.initMessages(), this.get("type") === Uc.PRIVATE_CHAT_TYPE && (this.presence = Uc.presences.findWhere({jid: e2}) || Uc.presences.create({jid: e2}), await this.setRosterContact(e2)), this.on("change:chat_state", this.sendChatState, this), await this.fetchMessages(), await Vc.trigger("chatBoxInitialized", this, {Synchronous: true}), this.initialized.resolve()); + }, getMessagesCollection: () => new Uc.Messages(), getMessagesCacheKey() { + return "converse.messages-".concat(this.get("jid"), "-").concat(Uc.bare_jid); + }, initMessages() { + this.messages = this.getMessagesCollection(), this.messages.fetched = vl.getResolveablePromise(), this.messages.fetched.then(() => { + Vc.trigger("afterMessagesFetched", this); + }), this.messages.chatbox = this, this.messages.browserStorage = Uc.createStore(this.getMessagesCacheKey()), this.listenTo(this.messages, "change:upload", (e2) => { + e2.get("upload") === Uc.SUCCESS && Vc.send(this.createMessageStanza(e2)); + }); + }, initNotifications() { + this.notifications = new qo(); + }, afterMessagesFetched() { + Vc.trigger("afterMessagesFetched", this); + }, fetchMessages() { + if (this.messages.fetched_flag) + return void zn.info("Not re-fetching messages for ".concat(this.get("jid"))); + this.messages.fetched_flag = true; + const e2 = this.messages.fetched.resolve; + return this.messages.fetch({add: true, success: () => { + this.afterMessagesFetched(), e2(); + }, error: () => { + this.afterMessagesFetched(), e2(); + }}), this.messages.fetched; + }, async handleErrorMessageStanza(e2) { + const {__: t2} = Uc, n2 = await ps.parseMessage(e2, Uc); + if (!await this.shouldShowErrorMessage(n2)) + return; + const r2 = this.getMessageReferencedByError(n2); + if (r2) { + const e3 = {error: n2.error, error_condition: n2.error_condition, error_text: n2.error_text, error_type: n2.error_type, editable: false}; + n2.msgid === r2.get("retraction_id") ? (e3.retraction_id = void 0, n2.error || (n2.error_condition === "forbidden" ? e3.error = t2("You're not allowed to retract your message.") : e3.error = t2("Sorry, an error occurred while trying to retract your message."))) : n2.error || (n2.error_condition === "forbidden" ? e3.error = t2("You're not allowed to send a message.") : e3.error = t2("Sorry, an error occurred while trying to send your message.")), r2.save(e3); + } else + this.createMessage(n2); + }, queueMessage(e2) { + return this.msg_chain = (this.msg_chain || this.messages.fetched).then(() => this.onMessage(e2)).catch((e3) => zn.error(e3)), this.msg_chain; + }, async onMessage(e2) { + if (e2 = await e2, vl.isErrorObject(e2)) + return e2.stanza && zn.error(e2.stanza), zn.error(e2.message); + const t2 = this.getDuplicateMessage(e2); + if (t2) + this.updateMessage(t2, e2); + else if (!this.handleReceipt(e2) && !this.handleChatMarker(e2) && !await this.handleRetraction(e2) && (this.setEditable(e2, e2.time), e2.chat_state && e2.sender === "them" && this.notifications.set("chat_state", e2.chat_state), vl.shouldCreateMessage(e2))) { + const t3 = this.handleCorrection(e2) || await this.createMessage(e2); + this.notifications.set({chat_state: null}), this.handleUnreadMessage(t3); + } + }, async clearMessages() { + try { + await this.messages.clearStore(); + } catch (e2) { + this.messages.trigger("reset"), zn.error(e2); + } finally { + delete this.msg_chain, delete this.messages.fetched_flag, this.messages.fetched = vl.getResolveablePromise(); + } + }, async close() { + try { + await new Promise((e2, t2) => this.destroy({success: e2, error: (e3, n2) => t2(n2)})); + } catch (e2) { + zn.error(e2); + } finally { + Vc.settings.get("clear_messages_on_reconnection") && await this.clearMessages(); + } + }, announceReconnection() { + Vc.trigger("chatReconnected", this); + }, async onReconnection() { + Vc.settings.get("clear_messages_on_reconnection") && await this.clearMessages(), this.announceReconnection(); + }, validate(e2) { + if (!e2.jid) + return "Ignored ChatBox without JID"; + const t2 = Uc.auto_join_rooms.map((e3) => N(e3) ? e3.jid : e3), n2 = Vc.settings.get("auto_join_private_chats").concat(t2); + if (Vc.settings.get("singleton") && !n2.includes(e2.jid) && !Vc.settings.get("auto_join_on_invite")) { + const t3 = "".concat(e2.jid, " is not allowed because singleton is true and it's not being auto_joined"); + return zn.warn(t3), t3; + } + }, getDisplayName() { + return this.contact ? this.contact.getDisplayName() : this.vcard ? this.vcard.getDisplayName() : this.get("jid"); + }, async createMessageFromError(e2) { + if (e2 instanceof Uc.TimeoutError) { + (await this.createMessage({type: "error", message: e2.message, retry_event_id: e2.retry_event_id})).error = e2; + } + }, getOldestMessage() { + for (let e2 = 0; e2 < this.messages.length; e2++) { + const t2 = this.messages.at(e2); + if (t2.get("type") === this.get("message_type")) + return t2; + } + }, getMostRecentMessage() { + for (let e2 = this.messages.length - 1; e2 >= 0; e2--) { + const t2 = this.messages.at(e2); + if (t2.get("type") === this.get("message_type")) + return t2; + } + }, getUpdatedMessageAttributes: (e2, t2) => (({is_archived: e3}) => ({is_archived: e3}))(t2), updateMessage(e2, t2) { + const n2 = this.getUpdatedMessageAttributes(e2, t2); + n2 && e2.save(n2); + }, setChatState(e2, t2) { + return this.chat_state_timeout !== void 0 && (window.clearTimeout(this.chat_state_timeout), delete this.chat_state_timeout), e2 === Uc.COMPOSING ? this.chat_state_timeout = window.setTimeout(this.setChatState.bind(this), Uc.TIMEOUTS.PAUSED, Uc.PAUSED) : e2 === Uc.PAUSED && (this.chat_state_timeout = window.setTimeout(this.setChatState.bind(this), Uc.TIMEOUTS.INACTIVE, Uc.INACTIVE)), this.set("chat_state", e2, t2), this; + }, getMessageReferencedByError(e2) { + const t2 = e2.msgid; + return t2 && this.messages.models.find((e3) => [e3.get("msgid"), e3.get("retraction_id")].includes(t2)); + }, shouldShowErrorMessage(e2) { + if (this.getMessageReferencedByError(e2) || e2.body) + return true; + }, isSameUser: (e2, t2) => vl.isSameBareJID(e2, t2), findDanglingRetraction(e2) { + if (!e2.origin_id || !this.messages.length) + return null; + if (this.messages.last().get("time") > e2.time) { + const t2 = Array.from(this.messages.models); + return t2.reverse(), t2.find(({attributes: t3}) => t3.retracted_id === e2.origin_id && t3.from === e2.from && !t3.moderated_by); + } + }, async handleRetraction(e2) { + const t2 = ["retracted", "retracted_id", "editable"]; + if (e2.retracted) { + if (e2.is_tombstone) + return false; + const n2 = this.messages.findWhere({origin_id: e2.retracted_id, from: e2.from}); + return n2 ? (n2.save(Bo(e2, t2)), true) : (e2.dangling_retraction = true, await this.createMessage(e2), true); + } + { + const n2 = this.findDanglingRetraction(e2); + if (n2) { + const r2 = Bo(n2.attributes, t2), i2 = Object.assign({dangling_retraction: false}, e2, r2); + return delete i2.id, n2.save(i2), true; + } + } + return false; + }, handleCorrection(e2) { + if (!e2.replace_id || !e2.from) + return; + const t2 = this.messages.findWhere({msgid: e2.replace_id, from: e2.from}); + if (!t2) + return; + const n2 = t2.get("older_versions") || {}; + return e2.time < t2.get("time") && t2.get("edited") ? (n2[e2.time] = e2.message, t2.save({older_versions: n2})) : (Object.keys(n2).length ? n2[t2.get("edited")] = t2.get("message") : n2[t2.get("time")] = t2.get("message"), delete (e2 = Object.assign(e2, {older_versions: n2})).id, e2.time = t2.get("time"), t2.save(e2)), t2; + }, getDuplicateMessage(e2) { + const t2 = [...this.getStanzaIdQueryAttrs(e2), this.getOriginIdQueryAttrs(e2), this.getMessageBodyQueryAttrs(e2)].filter((e3) => e3), n2 = this.messages.models; + return fl(n2, (e3) => t2.reduce((t3, n3) => t3 || pl(e3.attributes, n3), false)); + }, getOriginIdQueryAttrs: (e2) => e2.origin_id && {origin_id: e2.origin_id, from: e2.from}, getStanzaIdQueryAttrs: (e2) => Object.keys(e2).filter((e3) => e3.startsWith("stanza_id ")).map((t2) => { + const n2 = t2.replace(/^stanza_id /, ""), r2 = {}; + return r2["stanza_id ".concat(n2)] = e2[t2], r2; + }), getMessageBodyQueryAttrs(e2) { + if (e2.message && e2.msgid) { + const t2 = {from: e2.from, msgid: e2.msgid}; + return e2.is_encrypted || (t2.message = e2.message), t2; + } + }, retractOwnMessage(e2) { + this.sendRetractionMessage(e2), e2.save({retracted: new Date().toISOString(), retracted_id: e2.get("origin_id"), retraction_id: e2.get("id"), is_ephemeral: true, editable: false}); + }, sendRetractionMessage(e2) { + const t2 = e2.get("origin_id"); + if (!t2) + throw new Error("Can't retract message without a XEP-0359 Origin ID"); + const n2 = ml({id: vl.getUniqueId(), to: this.get("jid"), type: "chat"}).c("store", {xmlns: gl.NS.HINTS}).up().c("apply-to", {id: t2, xmlns: gl.NS.FASTEN}).c("retract", {xmlns: gl.NS.RETRACT}); + return Uc.connection.send(n2); + }, sendMarkerForMessage(e2) { + if (e2 == null ? void 0 : e2.get("is_markable")) { + const t2 = gl.getBareJidFromJid(e2.get("from")); + this.sendMarker(t2, e2.get("msgid"), "displayed", e2.get("type")); + } + }, sendMarker(e2, t2, n2, r2) { + const i2 = ml({from: Uc.connection.jid, id: vl.getUniqueId(), to: e2, type: r2 || "chat"}).c(n2, {xmlns: gl.NS.MARKERS, id: t2}); + Vc.send(i2); + }, handleChatMarker(e2) { + if (gl.getBareJidFromJid(e2.to) !== Uc.bare_jid) + return false; + if (e2.is_markable) + return !this.contact || e2.is_archived || e2.is_carbon || this.sendMarker(e2.from, e2.msgid, "received"), false; + if (e2.marker_id) { + const t2 = this.messages.findWhere({msgid: e2.marker_id}), n2 = "marker_".concat(e2.marker); + return t2 && !t2.get(n2) && t2.save({field_name: new Date().toISOString()}), true; + } + }, sendReceiptStanza(e2, t2) { + const n2 = ml({from: Uc.connection.jid, id: vl.getUniqueId(), to: e2, type: "chat"}).c("received", {xmlns: gl.NS.RECEIPTS, id: t2}).up().c("store", {xmlns: gl.NS.HINTS}).up(); + Vc.send(n2); + }, handleReceipt(e2) { + if (e2.sender === "them") { + if (e2.is_valid_receipt_request) + this.sendReceiptStanza(e2.from, e2.msgid); + else if (e2.receipt_id) { + const t2 = this.messages.findWhere({msgid: e2.receipt_id}); + return t2 && !t2.get("received") && t2.save({received: new Date().toISOString()}), true; + } + } + return false; + }, createMessageStanza(e2) { + const t2 = ml({from: Uc.connection.jid, to: this.get("jid"), type: this.get("message_type"), id: e2.get("edited") && vl.getUniqueId() || e2.get("msgid")}).c("body").t(e2.get("message")).up().c(Uc.ACTIVE, {xmlns: gl.NS.CHATSTATES}).root(); + return e2.get("type") === "chat" && t2.c("request", {xmlns: gl.NS.RECEIPTS}).root(), e2.get("is_spoiler") && (e2.get("spoiler_hint") ? t2.c("spoiler", {xmlns: gl.NS.SPOILER}, e2.get("spoiler_hint")).root() : t2.c("spoiler", {xmlns: gl.NS.SPOILER}).root()), (e2.get("references") || []).forEach((e3) => { + const n2 = {xmlns: gl.NS.REFERENCE, begin: e3.begin, end: e3.end, type: e3.type}; + e3.uri && (n2.uri = e3.uri), t2.c("reference", n2).root(); + }), e2.get("oob_url") && t2.c("x", {xmlns: gl.NS.OUTOFBAND}).c("url").t(e2.get("oob_url")).root(), e2.get("edited") && t2.c("replace", {xmlns: gl.NS.MESSAGE_CORRECT, id: e2.get("msgid")}).root(), e2.get("origin_id") && t2.c("origin-id", {xmlns: gl.NS.SID, id: e2.get("origin_id")}).root(), t2; + }, getOutgoingMessageAttributes(e2, t2) { + const n2 = this.get("composing_spoiler"), r2 = vl.getUniqueId(), i2 = e2 ? vl.httpToGeoUri(vl.shortnamesToUnicode(e2), Uc) : void 0; + return {from: Uc.bare_jid, fullname: Uc.xmppstatus.get("fullname"), id: r2, is_only_emojis: !!e2 && vl.isOnlyEmojis(e2), jid: this.get("jid"), message: i2, msgid: r2, nickname: this.get("nickname"), sender: "me", spoiler_hint: n2 ? t2 : void 0, time: new Date().toISOString(), type: this.get("message_type"), body: i2, is_spoiler: n2, origin_id: r2}; + }, setEditable(e2, t2) { + if (!e2.is_headline && !vl.isEmptyMessage(e2) && e2.sender === "me") { + if (Vc.settings.get("allow_message_corrections") === "all") + e2.editable = !(e2.file || e2.retracted || "oob_url" in e2); + else if (Vc.settings.get("allow_message_corrections") === "last" && t2 > this.get("time_sent")) { + this.set({time_sent: t2}); + const n2 = this.messages.findWhere({editable: true}); + n2 && n2.save({editable: false}), e2.editable = !(e2.file || e2.retracted || "oob_url" in e2); + } + } + }, async createMessage(e2, t2) { + return e2.time = e2.time || new Date().toISOString(), await this.messages.fetched, this.messages.create(e2, Object.assign({wait: true, promise: true}, t2)); + }, async sendMessage(e2, t2) { + const n2 = this.getOutgoingMessageAttributes(e2, t2); + let r2 = this.messages.findWhere("correcting"); + if (r2) { + const e3 = r2.get("older_versions") || {}; + e3[r2.get("time")] = r2.get("message"), r2.save({correcting: false, edited: new Date().toISOString(), message: n2.message, older_versions: e3, references: n2.references, is_only_emojis: n2.is_only_emojis, origin_id: vl.getUniqueId(), received: void 0}); + } else + this.setEditable(n2, new Date().toISOString()), r2 = await this.createMessage(n2); + return Vc.send(this.createMessageStanza(r2)), Vc.trigger("sendMessage", {chatbox: this, message: r2}), r2; + }, sendChatState() { + if (Vc.settings.get("send_chat_state_notifications") && this.get("chat_state")) { + const e2 = Vc.settings.get("send_chat_state_notifications"); + if (Array.isArray(e2) && !e2.includes(this.get("chat_state"))) + return; + Vc.send(ml({id: vl.getUniqueId(), to: this.get("jid"), type: "chat"}).c(this.get("chat_state"), {xmlns: gl.NS.CHATSTATES}).up().c("no-store", {xmlns: gl.NS.HINTS}).up().c("no-permanent-store", {xmlns: gl.NS.HINTS})); + } + }, async sendFiles(e2) { + var t2; + const {__: n2} = Uc, r2 = (await Vc.disco.features.get(gl.NS.HTTPUPLOAD, Uc.domain)).pop(); + if (!r2) + return void this.createMessage({message: n2("Sorry, looks like file upload is not supported by your server."), type: "error", is_ephemeral: true}); + const i2 = r2.dataforms.where({FORM_TYPE: {value: gl.NS.HTTPUPLOAD, type: "hidden"}}).pop(), o2 = window.parseInt((t2 = ((i2 == null ? void 0 : i2.attributes) || {})["max-file-size"]) === null || t2 === void 0 ? void 0 : t2.value), s2 = r2 == null ? void 0 : r2.id; + s2 ? Array.from(e2).forEach(async (e3) => { + if (!window.isNaN(o2) && window.parseInt(e3.size) > o2) + return this.createMessage({message: n2("The size of your file, %1$s, exceeds the maximum allowed by your server, which is %2$s.", e3.name, hl()(o2)), type: "error", is_ephemeral: true}); + { + const t3 = Object.assign(this.getOutgoingMessageAttributes(), {file: true, progress: 0, slot_request_url: s2}); + this.setEditable(t3, new Date().toISOString()); + const n3 = await this.createMessage(t3, {silent: true}); + n3.file = e3, this.messages.trigger("add", n3), n3.getRequestSlotURL(); + } + }) : this.createMessage({message: n2("Sorry, looks like file upload is not supported by your server."), type: "error", is_ephemeral: true}); + }, maybeShow(e2) { + if (e2) { + if (Uc.isUniView()) { + const e3 = (e4) => !e4.get("hidden") && e4.get("jid") !== this.get("jid") && e4.get("id") !== "controlbox"; + Uc.chatboxes.filter(e3).forEach((e4) => vl.safeSave(e4, {hidden: true})); + } + vl.safeSave(this, {hidden: false}); + } + return Uc.isUniView() && this.get("hidden") ? void 0 : this.trigger("show"); + }, isHidden() { + return Uc.isUniView() && this.get("hidden") || this.isScrolledUp() || Uc.windowState === "hidden"; + }, handleUnreadMessage(e2) { + if ((e2 == null ? void 0 : e2.get("body")) && vl.isNewMessage(e2)) + if (this.isHidden()) { + const t2 = {num_unread: this.get("num_unread") + 1}; + this.get("num_unread") === 0 && (t2.first_unread_id = e2.get("id")), this.save(t2); + } else + this.sendMarkerForMessage(e2); + }, clearUnreadMsgCounter() { + this.get("num_unread") > 0 && this.sendMarkerForMessage(this.messages.last()), vl.safeSave(this, {num_unread: 0}); + }, isScrolledUp() { + return this.get("scrolled", true); + }}); + const bl = rl.env.utils, {Strophe: yl} = rl.env; + var wl = {defaults: () => ({msgid: bl.getUniqueId(), time: new Date().toISOString(), is_ephemeral: false}), async initialize() { + this.checkValidity() && (this.initialized = bl.getResolveablePromise(), this.get("type") === "chat" && (ul.prototype.initialize.apply(this, arguments), this.setRosterContact(yl.getBareJidFromJid(this.get("from")))), this.get("file") && this.on("change:put", this.uploadFile, this), this.setTimerForEphemeralMessage(), await Vc.trigger("messageInitialized", this, {Synchronous: true}), this.initialized.resolve()); + }, setTimerForEphemeralMessage() { + const e2 = () => { + this.ephemeral_timer = window.setTimeout(this.safeDestroy.bind(this), 1e4); + }; + return this.isEphemeral() ? (e2(), true) : (this.on("change:is_ephemeral", () => this.isEphemeral() ? e2() : clearTimeout(this.ephemeral_timer)), false); + }, checkValidity() { + return Object.keys(this.attributes).length !== 3 || (this.validationError = "Empty message", this.safeDestroy(), false); + }, mayBeRetracted() { + return this.get("sender") === "me" && ["all", "own"].includes(Vc.settings.get("allow_message_retraction")); + }, safeDestroy() { + try { + this.destroy(); + } catch (e2) { + zn.error(e2); + } + }, isEphemeral() { + return this.get("is_ephemeral"); + }, getDisplayName() { + return this.get("type") === "groupchat" ? this.get("nick") : this.contact ? this.contact.getDisplayName() : this.vcard ? this.vcard.getDisplayName() : this.get("from"); + }, getMessageText() { + const {__: e2} = Uc; + return this.get("is_encrypted") ? this.get("plaintext") || this.get("body") || e2("Undecryptable OMEMO message") : this.get("message"); + }, isMeCommand() { + const e2 = this.getMessageText(); + return !!e2 && e2.startsWith("/me "); + }, sendSlotRequestStanza() { + if (!this.file) + return Promise.reject(new Error("file is undefined")); + const e2 = rl.env.$iq({from: Uc.jid, to: this.get("slot_request_url"), type: "get"}).c("request", {xmlns: yl.NS.HTTPUPLOAD, filename: this.file.name, size: this.file.size, "content-type": this.file.type}); + return Vc.sendIQ(e2); + }, async getRequestSlotURL() { + const {__: e2} = Uc; + let t2; + try { + t2 = await this.sendSlotRequestStanza(); + } catch (t3) { + return zn.error(t3), this.save({type: "error", message: e2("Sorry, could not determine upload URL."), is_ephemeral: true}); + } + const n2 = t2.querySelector("slot"); + if (!n2) + return this.save({type: "error", message: e2("Sorry, could not determine file upload URL."), is_ephemeral: true}); + this.save({get: n2.querySelector("get").getAttribute("url"), put: n2.querySelector("put").getAttribute("url")}); + }, uploadFile() { + const e2 = new XMLHttpRequest(); + e2.onreadystatechange = () => { + e2.readyState === XMLHttpRequest.DONE && (zn.info("Status: " + e2.status), e2.status === 200 || e2.status === 201 ? this.save({upload: Uc.SUCCESS, oob_url: this.get("get"), message: this.get("get")}) : e2.onerror()); + }, e2.upload.addEventListener("progress", (e3) => { + e3.lengthComputable && this.set("progress", e3.loaded / e3.total); + }, false), e2.onerror = () => { + const {__: t2} = Uc; + let n2; + n2 = e2.responseText ? t2('Sorry, could not succesfully upload your file. Your server\u2019s response: "%1$s"', e2.responseText) : t2("Sorry, could not succesfully upload your file."), this.save({type: "error", upload: Uc.FAILURE, message: n2, is_ephemeral: true}); + }, e2.open("PUT", this.get("put"), true), e2.setRequestHeader("Content-type", this.file.type), e2.send(this.file); + }}, Sl = {chats: {async create(e2, t2) { + if (typeof e2 == "string") { + if (t2 && !(t2 == null ? void 0 : t2.fullname)) { + var n2; + const r3 = await Vc.contacts.get(e2); + t2.fullname = r3 == null || (n2 = r3.attributes) === null || n2 === void 0 ? void 0 : n2.fullname; + } + const r2 = Vc.chats.get(e2, t2, true); + return r2 || void zn.error("Could not open chatbox for JID: " + e2); + } + return Array.isArray(e2) ? Promise.all(e2.forEach(async (n3) => { + var r2; + const i2 = await Vc.contacts.get(e2); + return t2.fullname = i2 == null || (r2 = i2.attributes) === null || r2 === void 0 ? void 0 : r2.fullname, Vc.chats.get(n3, t2, true).maybeShow(); + })) : (zn.error("chats.create: You need to provide at least one JID"), null); + }, async open(e2, t2, n2) { + if (typeof e2 == "string") { + const r3 = await Vc.chats.get(e2, t2, true); + return r3 ? r3.maybeShow(n2) : r3; + } + if (Array.isArray(e2)) + return Promise.all(e2.map((e3) => Vc.chats.get(e3, t2, true).then((e4) => e4 && e4.maybeShow(n2))).filter((e3) => e3)); + const r2 = "chats.open: You need to provide at least one JID"; + throw zn.error(r2), new Error(r2); + }, async get(e2, t2 = {}, n2 = false) { + async function r2(e3) { + let r3 = await Vc.chatboxes.get(e3); + return !r3 && n2 ? r3 = await Vc.chatboxes.create(e3, t2, Uc.ChatBox) : (r3 = r3 && r3.get("type") === Uc.PRIVATE_CHAT_TYPE ? r3 : null, r3 && Object.keys(t2).length && r3.save(t2)), r3; + } + if (e2 === void 0) { + return (await Vc.chatboxes.get()).filter((e3) => e3.get("type") === Uc.PRIVATE_CHAT_TYPE); + } + return typeof e2 == "string" ? r2(e2) : Promise.all(e2.map((e3) => r2(e3))); + }}}; + /** + * @module converse-chat + * @copyright 2020, the Converse.js contributors + * @license Mozilla Public License (MPLv2) + */ + const {Strophe: xl, sizzle: El, utils: Al} = rl.env, Cl = rl.env.utils; + rl.plugins.add("converse-chat", {dependencies: ["converse-chatboxes", "converse-disco"], initialize() { + Object.assign(Vc, Sl), Vc.settings.extend({allow_message_corrections: "all", allow_message_retraction: "all", allow_message_styling: true, auto_join_private_chats: [], clear_messages_on_reconnection: false, filter_by_resource: false, send_chat_state_notifications: true}), Uc.Message = ul.extend(wl), Uc.Messages = ra.extend({model: Uc.Message, comparator: "time"}), Uc.ChatBox = _l, Uc.handleMessageStanza = async function(e2) { + if (ps.isServerMessage(e2)) { + const t3 = e2.getAttribute("from"); + return zn.info("handleMessageStanza: Ignoring incoming server message from JID: ".concat(t3)); + } + const t2 = await ps.parseMessage(e2, Uc); + if (Cl.isErrorObject(t2)) + return t2.stanza && zn.error(t2.stanza), zn.error(t2.message); + const n2 = !!El('body, encrypted[xmlns="'.concat(xl.NS.OMEMO, '"]'), e2).length, r2 = await Vc.chats.get(t2.contact_jid, {nickname: t2.nick}, n2); + await (r2 == null ? void 0 : r2.queueMessage(t2)); + const i2 = {stanza: e2, attrs: t2, chatbox: r2}; + Vc.trigger("message", i2); + }, Uc.router.route("converse/chat?jid=:jid", function(e2) { + if (!Al.isValidJID(e2)) + return zn.warn('Invalid JID "'.concat(e2, '" provided in URL fragment')); + Vc.chats.open(e2); + }), Vc.listen.on("chatBoxesFetched", function() { + Vc.settings.get("auto_join_private_chats").forEach((e2) => { + Uc.chatboxes.where({jid: e2}).length || (typeof e2 == "string" ? Vc.chats.open(e2) : zn.error('Invalid jid criteria specified for "auto_join_private_chats"')); + }), Vc.trigger("privateChatsAutoJoined"); + }), Vc.listen.on("presencesInitialized", function() { + Uc.connection.addHandler((e2) => El('message > result[xmlns="'.concat(xl.NS.MAM, '"]'), e2).pop() ? (zn.warn('Received a MAM message with type "chat".'), true) : (Uc.handleMessageStanza(e2), true), null, "message", "chat"), Uc.connection.addHandler((e2) => (e2.getAttribute("type") !== null || Uc.handleMessageStanza(e2), true), xl.NS.RECEIPTS, "message"), Uc.connection.addHandler((e2) => (async function(e3) { + const t2 = xl.getBareJidFromJid(e3.getAttribute("from")); + if (Al.isSameBareJID(t2, Uc.bare_jid)) + return; + const n2 = await Vc.chatboxes.get(t2); + n2 == null || n2.handleErrorMessageStanza(e3); + }(e2), true), null, "message", "error"); + }), Vc.listen.on("clearSession", async () => { + if (Uc.shouldClearCache()) { + await Promise.all(Uc.chatboxes.map((e3) => e3.messages && e3.messages.clearStore({silent: true}))); + const e2 = (e3) => e3.get("type") !== Uc.CONTROLBOX_TYPE; + Uc.chatboxes.clearStore({silent: true}, e2); + } + }); + }}); + /** + * @module converse-disco + * @copyright The Converse.js contributors + * @license Mozilla Public License (MPLv2) + * @description Converse plugin which add support for XEP-0030: Service Discovery + */ + const {Strophe: jl, $iq: Tl, utils: Ol} = rl.env; + rl.plugins.add("converse-disco", {initialize() { + function e2() { + if (!Uc.stream_features) { + const e3 = jl.getBareJidFromJid(Uc.jid), t3 = "converse.stream-features-".concat(e3); + Vc.promises.add("streamFeaturesAdded"), Uc.stream_features = new ra(), Uc.stream_features.browserStorage = Uc.createStore(t3, "session"); + } + } + function t2() { + Vc.trigger("streamFeaturesAdded"); + } + Vc.promises.add("discoInitialized"), Vc.promises.add("streamFeaturesAdded"), Uc.DiscoEntity = qo.extend({idAttribute: "jid", initialize(e3, t3) { + this.waitUntilFeaturesDiscovered = Ol.getResolveablePromise(), this.dataforms = new ra(); + let n3 = "converse.dataforms-".concat(this.get("jid")); + this.dataforms.browserStorage = Uc.createStore(n3, "session"), this.features = new ra(), n3 = "converse.features-".concat(this.get("jid")), this.features.browserStorage = Uc.createStore(n3, "session"), this.listenTo(this.features, "add", this.onFeatureAdded), this.fields = new ra(), n3 = "converse.fields-".concat(this.get("jid")), this.fields.browserStorage = Uc.createStore(n3, "session"), this.listenTo(this.fields, "add", this.onFieldAdded), this.identities = new ra(), n3 = "converse.identities-".concat(this.get("jid")), this.identities.browserStorage = Uc.createStore(n3, "session"), this.fetchFeatures(t3), this.items = new Uc.DiscoEntities(), n3 = "converse.disco-items-".concat(this.get("jid")), this.items.browserStorage = Uc.createStore(n3, "session"), this.items.fetch(); + }, async getIdentity(e3, t3) { + return await this.waitUntilFeaturesDiscovered, this.identities.findWhere({category: e3, type: t3}); + }, async hasFeature(e3) { + if (await this.waitUntilFeaturesDiscovered, this.features.findWhere({var: e3})) + return this; + }, onFeatureAdded(e3) { + e3.entity = this, Vc.trigger("serviceDiscovered", e3); + }, onFieldAdded(e3) { + e3.entity = this, Vc.trigger("discoExtensionFieldDiscovered", e3); + }, async fetchFeatures(e3) { + if (e3.ignore_cache) + this.queryInfo(); + else { + const e4 = this.features.browserStorage.name, t3 = await this.features.browserStorage.store.getItem(e4); + t3 && t3.length === 0 || t3 === null ? this.queryInfo() : (this.features.fetch({add: true, success: () => { + this.waitUntilFeaturesDiscovered.resolve(this), this.trigger("featuresDiscovered"); + }}), this.identities.fetch({add: true})); + } + }, async queryInfo() { + let e3; + try { + e3 = await Vc.disco.info(this.get("jid"), null); + } catch (e4) { + return e4 === null ? zn.error("Timeout for disco#info query for ".concat(this.get("jid"))) : zn.error(e4), void this.waitUntilFeaturesDiscovered.resolve(this); + } + this.onInfo(e3); + }, onDiscoItems(e3) { + mr()('query[xmlns="'.concat(jl.NS.DISCO_ITEMS, '"] item'), e3).forEach((e4) => { + if (e4.getAttribute("node")) + return; + const t3 = e4.getAttribute("jid"); + if (this.items.get(t3) === void 0) { + const e5 = Uc.disco_entities.get(t3); + e5 ? this.items.add(e5) : this.items.create({jid: t3}); + } + }); + }, async queryForItems() { + if (this.identities.where({category: "server"}).length === 0) + return; + const e3 = await Vc.disco.items(this.get("jid")); + this.onDiscoItems(e3); + }, onInfo(e3) { + Array.from(e3.querySelectorAll("identity")).forEach((e4) => { + this.identities.create({category: e4.getAttribute("category"), type: e4.getAttribute("type"), name: e4.getAttribute("name")}); + }), mr()('x[type="result"][xmlns="'.concat(jl.NS.XFORM, '"]'), e3).forEach((e4) => { + const t3 = {}; + mr()("field", e4).forEach((e5) => { + var n3; + t3[e5.getAttribute("var")] = {value: (n3 = e5.querySelector("value")) === null || n3 === void 0 ? void 0 : n3.textContent, type: e5.getAttribute("type")}; + }), this.dataforms.create(t3); + }), e3.querySelector('feature[var="'.concat(jl.NS.DISCO_ITEMS, '"]')) && this.queryForItems(), Array.from(e3.querySelectorAll("feature")).forEach((t3) => { + this.features.create({var: t3.getAttribute("var"), from: e3.getAttribute("from")}); + }), mr()('x[type="result"][xmlns="jabber:x:data"] field', e3).forEach((t3) => { + var n3; + this.fields.create({var: t3.getAttribute("var"), value: (n3 = t3.querySelector("value")) === null || n3 === void 0 ? void 0 : n3.textContent, from: e3.getAttribute("from")}); + }), this.waitUntilFeaturesDiscovered.resolve(this), this.trigger("featuresDiscovered"); + }}), Uc.DiscoEntities = ra.extend({model: Uc.DiscoEntity, fetchEntities() { + return new Promise((e3, t3) => { + this.fetch({add: true, success: e3, error(e4, n3) { + zn.error(n3), t3(new Error("Could not fetch disco entities")); + }}); + }); + }}); + const n2 = this; + function r2(e3) { + const t3 = e3.getElementsByTagName("query")[0].getAttribute("node"), r3 = {xmlns: jl.NS.DISCO_INFO}; + t3 && (r3.node = t3); + const i3 = Tl({type: "result", id: e3.getAttribute("id")}), o2 = e3.getAttribute("from"); + return o2 !== null && i3.attrs({to: o2}), i3.c("query", r3), n2._identities.forEach((e4) => { + const t4 = {category: e4.category, type: e4.type}; + e4.name && (t4.name = e4.name), e4.lang && (t4["xml:lang"] = e4.lang), i3.c("identity", t4).up(); + }), n2._features.forEach((e4) => i3.c("feature", {var: e4}).up()), Vc.send(i3.tree()), true; + } + async function i2() { + Vc.disco.own.identities.add("client", "web", "Converse"), Vc.disco.own.features.add(jl.NS.CHATSTATES), Vc.disco.own.features.add(jl.NS.DISCO_INFO), Vc.disco.own.features.add(jl.NS.ROSTERX), Vc.settings.get("message_carbons") && Vc.disco.own.features.add(jl.NS.CARBONS), Vc.trigger("addClientFeatures"), Uc.connection.addHandler(r2, jl.NS.DISCO_INFO, "iq", "get", null, null), Uc.disco_entities = new Uc.DiscoEntities(); + const e3 = "converse.disco-entities-".concat(Uc.bare_jid); + Uc.disco_entities.browserStorage = Uc.createStore(e3, "session"); + const t3 = await Uc.disco_entities.fetchEntities(); + t3.length !== 0 && t3.get(Uc.domain) || Uc.disco_entities.create({jid: Uc.domain}), Vc.trigger("discoInitialized"); + } + n2._identities = [], n2._features = [], Vc.listen.on("userSessionInitialized", async () => { + e2(), Uc.connfeedback.get("connection_status") === jl.Status.ATTACHED && (await new Promise((e3, t3) => Uc.stream_features.fetch({success: e3, error: t3})), t2()); + }), Vc.listen.on("beforeResourceBinding", function() { + e2(), Array.from(Uc.connection.features.childNodes).forEach((e3) => { + Uc.stream_features.create({name: e3.nodeName, xmlns: e3.getAttribute("xmlns")}); + }), t2(); + }), Vc.listen.on("reconnected", i2), Vc.listen.on("connected", i2), Vc.listen.on("beforeTearDown", async () => { + Vc.promises.add("streamFeaturesAdded"), Uc.stream_features && (await Uc.stream_features.clearStore(), delete Uc.stream_features); + }), Vc.listen.on("clearSession", () => { + Uc.shouldClearCache() && Uc.disco_entities && (Array.from(Uc.disco_entities.models).forEach((e3) => e3.features.clearStore()), Array.from(Uc.disco_entities.models).forEach((e3) => e3.identities.clearStore()), Array.from(Uc.disco_entities.models).forEach((e3) => e3.dataforms.clearStore()), Array.from(Uc.disco_entities.models).forEach((e3) => e3.fields.clearStore()), Uc.disco_entities.clearStore(), delete Uc.disco_entities); + }), Object.assign(Vc, {disco: {stream: {async getFeature(e3, t3) { + if (await Vc.waitUntil("streamFeaturesAdded"), !e3 || !t3) + throw new Error("name and xmlns need to be provided when calling disco.stream.getFeature"); + if (Uc.stream_features !== void 0 || Vc.connection.connected()) + return Uc.stream_features.findWhere({name: e3, xmlns: t3}); + { + const n3 = "Tried to get feature ".concat(e3, " ").concat(t3, " but _converse.stream_features has been torn down"); + zn.warn(n3); + } + }}, own: {identities: {add(e3, t3, r3, i3) { + for (var o2 = 0; o2 < n2._identities.length; o2++) + if (n2._identities[o2].category == e3 && n2._identities[o2].type == t3 && n2._identities[o2].name == r3 && n2._identities[o2].lang == i3) + return false; + n2._identities.push({category: e3, type: t3, name: r3, lang: i3}); + }, clear() { + n2._identities = []; + }, get: () => n2._identities}, features: {add(e3) { + for (var t3 = 0; t3 < n2._features.length; t3++) + if (n2._features[t3] == e3) + return false; + n2._features.push(e3); + }, clear() { + n2._features = []; + }, get: () => n2._features}}, info(e3, t3) { + const n3 = {xmlns: jl.NS.DISCO_INFO}; + t3 && (n3.node = t3); + const r3 = Tl({from: Uc.connection.jid, to: e3, type: "get"}).c("query", n3); + return Vc.sendIQ(r3); + }, items(e3, t3) { + const n3 = {xmlns: jl.NS.DISCO_ITEMS}; + return t3 && (n3.node = t3), Vc.sendIQ(Tl({from: Uc.connection.jid, to: e3, type: "get"}).c("query", n3)); + }, entities: {async get(e3, t3 = false) { + if (await Vc.waitUntil("discoInitialized"), !e3) + return Uc.disco_entities; + if (Uc.disco_entities === void 0 && !Vc.connection.connected()) { + const t4 = "Tried to look up entity ".concat(e3, " but _converse.disco_entities has been torn down"); + return void zn.warn(t4); + } + const n3 = Uc.disco_entities.get(e3); + return n3 || !t3 ? n3 : Vc.disco.entities.create(e3); + }, create: (e3, t3) => Uc.disco_entities.create({jid: e3}, t3)}, features: {async get(e3, t3) { + if (!t3) + throw new TypeError("You need to provide an entity JID"); + await Vc.waitUntil("discoInitialized"); + let n3 = await Vc.disco.entities.get(t3, true); + if (Uc.disco_entities === void 0 && !Vc.connection.connected()) { + const n4 = "Tried to get feature ".concat(e3, " for ").concat(t3, " but _converse.disco_entities has been torn down"); + return void zn.warn(n4); + } + n3 = await n3.waitUntilFeaturesDiscovered; + const r3 = [...n3.items.map((t4) => t4.hasFeature(e3)), n3.hasFeature(e3)]; + return (await Promise.all(r3)).filter(N); + }}, supports: async (e3, t3) => (await Vc.disco.features.get(e3, t3)).length > 0, async refresh(e3) { + if (!e3) + throw new TypeError("api.disco.refresh: You need to provide an entity JID"); + await Vc.waitUntil("discoInitialized"); + let t3 = await Vc.disco.entities.get(e3); + return t3 ? (t3.features.reset(), t3.fields.reset(), t3.identities.reset(), t3.waitUntilFeaturesDiscovered.isPending || (t3.waitUntilFeaturesDiscovered = Ol.getResolveablePromise()), t3.queryInfo()) : t3 = await Vc.disco.entities.create(e3, {ignore_cache: true}), t3.waitUntilFeaturesDiscovered; + }, refreshFeatures: (e3) => Vc.refresh(e3), async getFeatures(e3) { + if (!e3) + throw new TypeError("api.disco.getFeatures: You need to provide an entity JID"); + await Vc.waitUntil("discoInitialized"); + let t3 = await Vc.disco.entities.get(e3, true); + return t3 = await t3.waitUntilFeaturesDiscovered, t3.features; + }, async getFields(e3) { + if (!e3) + throw new TypeError("api.disco.getFields: You need to provide an entity JID"); + await Vc.waitUntil("discoInitialized"); + let t3 = await Vc.disco.entities.get(e3, true); + return t3 = await t3.waitUntilFeaturesDiscovered, t3.fields; + }, async getIdentity(e3, t3, n3) { + const r3 = await Vc.disco.entities.get(n3, true); + if (r3 !== void 0 || Vc.connection.connected()) + return r3.getIdentity(e3, t3); + { + const t4 = "Tried to look up category ".concat(e3, " for ").concat(n3, " but _converse.disco_entities has been torn down"); + zn.warn(t4); + } + }}}); + }}); + const kl = new RegExp("<object[^>]*>.*?</object>|<span[^>]*>.*?</span>|<(?:object|embed|svg|img|div|span|p|a)[^>]*>|((\\s|^)(\\*\\\\0\\/\\*|\\*\\\\O\\/\\*|\\-___\\-|\\:'\\-\\)|'\\:\\-\\)|'\\:\\-D|\\>\\:\\-\\)|>\\:\\-\\)|'\\:\\-\\(|\\>\\:\\-\\(|>\\:\\-\\(|\\:'\\-\\(|O\\:\\-\\)|0\\:\\-3|0\\:\\-\\)|0;\\^\\)|O;\\-\\)|0;\\-\\)|O\\:\\-3|\\-__\\-|\\:\\-\xDE|\\:\\-\xDE|\\<\\/3|<\\/3|\\:'\\)|\\:\\-D|'\\:\\)|'\\=\\)|'\\:D|'\\=D|\\>\\:\\)|>\\:\\)|\\>;\\)|>;\\)|\\>\\=\\)|>\\=\\)|;\\-\\)|\\*\\-\\)|;\\-\\]|;\\^\\)|'\\:\\(|'\\=\\(|\\:\\-\\*|\\:\\^\\*|\\>\\:P|>\\:P|X\\-P|\\>\\:\\[|>\\:\\[|\\:\\-\\(|\\:\\-\\[|\\>\\:\\(|>\\:\\(|\\:'\\(|;\\-\\(|\\>\\.\\<|>\\.<|#\\-\\)|%\\-\\)|X\\-\\)|\\\\0\\/|\\\\O\\/|0\\:3|0\\:\\)|O\\:\\)|O\\=\\)|O\\:3|B\\-\\)|8\\-\\)|B\\-D|8\\-D|\\-_\\-|\\>\\:\\\\|>\\:\\\\|\\>\\:\\/|>\\:\\/|\\:\\-\\/|\\:\\-\\.|\\:\\-P|\\:\xDE|\\:\xDE|\\:\\-b|\\:\\-O|O_O|\\>\\:O|>\\:O|\\:\\-X|\\:\\-#|\\:\\-\\)|\\(y\\)|\\<3|<3|\\:D|\\=D|;\\)|\\*\\)|;\\]|;D|\\:\\*|\\=\\*|\\:\\(|\\:\\[|\\=\\(|\\:@|;\\(|D\\:|\\:\\$|\\=\\$|#\\)|%\\)|X\\)|B\\)|8\\)|\\:\\/|\\:\\\\|\\=\\/|\\=\\\\|\\:L|\\=L|\\:P|\\=P|\\:b|\\:O|\\:X|\\:#|\\=X|\\=#|\\:\\)|\\=\\]|\\=\\)|\\:\\])(?=\\s|$|[!,.?]))", "gi"), Nl = /(?:\ud83d\udc68\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffc-\udfff]|\ud83d\udc68\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffd-\udfff]|\ud83d\udc68\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc68\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffd\udfff]|\ud83d\udc68\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffe]|\ud83d\udc69\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffc-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffc-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffd-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb\udffd-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc69\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc69\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffd\udfff]|\ud83d\udc69\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb-\udffd\udfff]|\ud83d\udc69\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffe]|\ud83d\udc69\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb-\udffe]|\ud83e\uddd1\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\u200d\ud83e\udd1d\u200d\ud83e\uddd1|\ud83d\udc6b\ud83c[\udffb-\udfff]|\ud83d\udc6c\ud83c[\udffb-\udfff]|\ud83d\udc6d\ud83c[\udffb-\udfff]|\ud83d[\udc6b-\udc6d])|(?:\ud83d[\udc68\udc69]|\ud83e\uddd1)(?:\ud83c[\udffb-\udfff])?\u200d(?:\u2695\ufe0f|\u2696\ufe0f|\u2708\ufe0f|\ud83c[\udf3e\udf73\udf93\udfa4\udfa8\udfeb\udfed]|\ud83d[\udcbb\udcbc\udd27\udd2c\ude80\ude92]|\ud83e[\uddaf-\uddb3\uddbc\uddbd])|(?:\ud83c[\udfcb\udfcc]|\ud83d[\udd74\udd75]|\u26f9)((?:\ud83c[\udffb-\udfff]|\ufe0f)\u200d[\u2640\u2642]\ufe0f)|(?:\ud83c[\udfc3\udfc4\udfca]|\ud83d[\udc6e\udc71\udc73\udc77\udc81\udc82\udc86\udc87\ude45-\ude47\ude4b\ude4d\ude4e\udea3\udeb4-\udeb6]|\ud83e[\udd26\udd35\udd37-\udd39\udd3d\udd3e\uddb8\uddb9\uddcd-\uddcf\uddd6-\udddd])(?:\ud83c[\udffb-\udfff])?\u200d[\u2640\u2642]\ufe0f|(?:\ud83d\udc68\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68|\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d[\udc68\udc69]|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\u2764\ufe0f\u200d\ud83d\udc68|\ud83d\udc68\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\u2764\ufe0f\u200d\ud83d[\udc68\udc69]|\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83c\udff3\ufe0f\u200d\u26a7\ufe0f|\ud83c\udff3\ufe0f\u200d\ud83c\udf08|\ud83c\udff4\u200d\u2620\ufe0f|\ud83d\udc15\u200d\ud83e\uddba|\ud83d\udc41\u200d\ud83d\udde8|\ud83d\udc68\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83d\udc6f\u200d\u2640\ufe0f|\ud83d\udc6f\u200d\u2642\ufe0f|\ud83e\udd3c\u200d\u2640\ufe0f|\ud83e\udd3c\u200d\u2642\ufe0f|\ud83e\uddde\u200d\u2640\ufe0f|\ud83e\uddde\u200d\u2642\ufe0f|\ud83e\udddf\u200d\u2640\ufe0f|\ud83e\udddf\u200d\u2642\ufe0f)|[#*0-9]\ufe0f?\u20e3|(?:[©®\u2122\u265f]\ufe0f)|(?:\ud83c[\udc04\udd70\udd71\udd7e\udd7f\ude02\ude1a\ude2f\ude37\udf21\udf24-\udf2c\udf36\udf7d\udf96\udf97\udf99-\udf9b\udf9e\udf9f\udfcd\udfce\udfd4-\udfdf\udff3\udff5\udff7]|\ud83d[\udc3f\udc41\udcfd\udd49\udd4a\udd6f\udd70\udd73\udd76-\udd79\udd87\udd8a-\udd8d\udda5\udda8\uddb1\uddb2\uddbc\uddc2-\uddc4\uddd1-\uddd3\udddc-\uddde\udde1\udde3\udde8\uddef\uddf3\uddfa\udecb\udecd-\udecf\udee0-\udee5\udee9\udef0\udef3]|[\u203c\u2049\u2139\u2194-\u2199\u21a9\u21aa\u231a\u231b\u2328\u23cf\u23ed-\u23ef\u23f1\u23f2\u23f8-\u23fa\u24c2\u25aa\u25ab\u25b6\u25c0\u25fb-\u25fe\u2600-\u2604\u260e\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262a\u262e\u262f\u2638-\u263a\u2640\u2642\u2648-\u2653\u2660\u2663\u2665\u2666\u2668\u267b\u267f\u2692-\u2697\u2699\u269b\u269c\u26a0\u26a1\u26a7\u26aa\u26ab\u26b0\u26b1\u26bd\u26be\u26c4\u26c5\u26c8\u26cf\u26d1\u26d3\u26d4\u26e9\u26ea\u26f0-\u26f5\u26f8\u26fa\u26fd\u2702\u2708\u2709\u270f\u2712\u2714\u2716\u271d\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u2764\u27a1\u2934\u2935\u2b05-\u2b07\u2b1b\u2b1c\u2b50\u2b55\u3030\u303d\u3297\u3299])(?:\ufe0f|(?!\ufe0e))|(?:(?:\ud83c[\udfcb\udfcc]|\ud83d[\udd74\udd75\udd90]|[\u261d\u26f7\u26f9\u270c\u270d])(?:\ufe0f|(?!\ufe0e))|(?:\ud83c[\udf85\udfc2-\udfc4\udfc7\udfca]|\ud83d[\udc42\udc43\udc46-\udc50\udc66-\udc69\udc6e\udc70-\udc78\udc7c\udc81-\udc83\udc85-\udc87\udcaa\udd7a\udd95\udd96\ude45-\ude47\ude4b-\ude4f\udea3\udeb4-\udeb6\udec0\udecc]|\ud83e[\udd0f\udd18-\udd1c\udd1e\udd1f\udd26\udd30-\udd39\udd3d\udd3e\uddb5\uddb6\uddb8\uddb9\uddbb\uddcd-\uddcf\uddd1-\udddd]|[\u270a\u270b]))(?:\ud83c[\udffb-\udfff])?|(?:\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc65\udb40\udc6e\udb40\udc67\udb40\udc7f|\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc73\udb40\udc63\udb40\udc74\udb40\udc7f|\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc77\udb40\udc6c\udb40\udc73\udb40\udc7f|\ud83c\udde6\ud83c[\udde8-\uddec\uddee\uddf1\uddf2\uddf4\uddf6-\uddfa\uddfc\uddfd\uddff]|\ud83c\udde7\ud83c[\udde6\udde7\udde9-\uddef\uddf1-\uddf4\uddf6-\uddf9\uddfb\uddfc\uddfe\uddff]|\ud83c\udde8\ud83c[\udde6\udde8\udde9\uddeb-\uddee\uddf0-\uddf5\uddf7\uddfa-\uddff]|\ud83c\udde9\ud83c[\uddea\uddec\uddef\uddf0\uddf2\uddf4\uddff]|\ud83c\uddea\ud83c[\udde6\udde8\uddea\uddec\udded\uddf7-\uddfa]|\ud83c\uddeb\ud83c[\uddee-\uddf0\uddf2\uddf4\uddf7]|\ud83c\uddec\ud83c[\udde6\udde7\udde9-\uddee\uddf1-\uddf3\uddf5-\uddfa\uddfc\uddfe]|\ud83c\udded\ud83c[\uddf0\uddf2\uddf3\uddf7\uddf9\uddfa]|\ud83c\uddee\ud83c[\udde8-\uddea\uddf1-\uddf4\uddf6-\uddf9]|\ud83c\uddef\ud83c[\uddea\uddf2\uddf4\uddf5]|\ud83c\uddf0\ud83c[\uddea\uddec-\uddee\uddf2\uddf3\uddf5\uddf7\uddfc\uddfe\uddff]|\ud83c\uddf1\ud83c[\udde6-\udde8\uddee\uddf0\uddf7-\uddfb\uddfe]|\ud83c\uddf2\ud83c[\udde6\udde8-\udded\uddf0-\uddff]|\ud83c\uddf3\ud83c[\udde6\udde8\uddea-\uddec\uddee\uddf1\uddf4\uddf5\uddf7\uddfa\uddff]|\ud83c\uddf4\ud83c\uddf2|\ud83c\uddf5\ud83c[\udde6\uddea-\udded\uddf0-\uddf3\uddf7-\uddf9\uddfc\uddfe]|\ud83c\uddf6\ud83c\udde6|\ud83c\uddf7\ud83c[\uddea\uddf4\uddf8\uddfa\uddfc]|\ud83c\uddf8\ud83c[\udde6-\uddea\uddec-\uddf4\uddf7-\uddf9\uddfb\uddfd-\uddff]|\ud83c\uddf9\ud83c[\udde6\udde8\udde9\uddeb-\udded\uddef-\uddf4\uddf7\uddf9\uddfb\uddfc\uddff]|\ud83c\uddfa\ud83c[\udde6\uddec\uddf2\uddf3\uddf8\uddfe\uddff]|\ud83c\uddfb\ud83c[\udde6\udde8\uddea\uddec\uddee\uddf3\uddfa]|\ud83c\uddfc\ud83c[\uddeb\uddf8]|\ud83c\uddfd\ud83c\uddf0|\ud83c\uddfe\ud83c[\uddea\uddf9]|\ud83c\uddff\ud83c[\udde6\uddf2\uddfc]|\ud83c[\udccf\udd8e\udd91-\udd9a\udde6-\uddff\ude01\ude32-\ude36\ude38-\ude3a\ude50\ude51\udf00-\udf20\udf2d-\udf35\udf37-\udf7c\udf7e-\udf84\udf86-\udf93\udfa0-\udfc1\udfc5\udfc6\udfc8\udfc9\udfcf-\udfd3\udfe0-\udff0\udff4\udff8-\udfff]|\ud83d[\udc00-\udc3e\udc40\udc44\udc45\udc51-\udc65\udc6a\udc6f\udc79-\udc7b\udc7d-\udc80\udc84\udc88-\udca9\udcab-\udcfc\udcff-\udd3d\udd4b-\udd4e\udd50-\udd67\udda4\uddfb-\ude44\ude48-\ude4a\ude80-\udea2\udea4-\udeb3\udeb7-\udebf\udec1-\udec5\uded0-\uded2\uded5\udeeb\udeec\udef4-\udefa\udfe0-\udfeb]|\ud83e[\udd0d\udd0e\udd10-\udd17\udd1d\udd20-\udd25\udd27-\udd2f\udd3a\udd3c\udd3f-\udd45\udd47-\udd71\udd73-\udd76\udd7a-\udda2\udda5-\uddaa\uddae-\uddb4\uddb7\uddba\uddbc-\uddca\uddd0\uddde-\uddff\ude70-\ude73\ude78-\ude7a\ude80-\ude82\ude90-\ude95]|[\u23e9-\u23ec\u23f0\u23f3\u267e\u26ce\u2705\u2728\u274c\u274e\u2753-\u2755\u2795-\u2797\u27b0\u27bf\ue50a])|\ufe0f/g; + function Il() { + const e2 = Dl(['<img class="emoji"\n draggable="false"\n title="', '"\n alt="', '"\n src="', '">']); + return Il = function() { + return e2; + }, e2; + } + function Ml() { + const e2 = Dl(['<img class="emoji"\n draggable="false"\n title="', '"\n alt="', '"\n src="', "/72x72/", '.png"/>']); + return Ml = function() { + return e2; + }, e2; + } + function Rl() { + const e2 = Dl(['<span title="', '">', "</span>"]); + return Rl = function() { + return e2; + }, e2; + } + function Dl(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + /** + * @module converse-emoji + * @copyright 2020, the Converse.js contributors + * @license Mozilla Public License (MPLv2) + */ + const Pl = rl.env.utils; + rl.emojis = {initialized: false, initialized_promise: Pl.getResolveablePromise()}; + const Ll = {"*\\0/*": "1f646", "*\\O/*": "1f646", "-___-": "1f611", ":'-)": "1f602", "':-)": "1f605", "':-D": "1f605", ">:-)": "1f606", "':-(": "1f613", ">:-(": "1f620", ":'-(": "1f622", "O:-)": "1f607", "0:-3": "1f607", "0:-)": "1f607", "0;^)": "1f607", "O;-)": "1f607", "0;-)": "1f607", "O:-3": "1f607", "-__-": "1f611", ":-\xDE": "1f61b", "</3": "1f494", ":')": "1f602", ":-D": "1f603", "':)": "1f605", "'=)": "1f605", "':D": "1f605", "'=D": "1f605", ">:)": "1f606", ">;)": "1f606", ">=)": "1f606", ";-)": "1f609", "*-)": "1f609", ";-]": "1f609", ";^)": "1f609", "':(": "1f613", "'=(": "1f613", ":-*": "1f618", ":^*": "1f618", ">:P": "1f61c", "X-P": "1f61c", ">:[": "1f61e", ":-(": "1f61e", ":-[": "1f61e", ">:(": "1f620", ":'(": "1f622", ";-(": "1f622", ">.<": "1f623", "#-)": "1f635", "%-)": "1f635", "X-)": "1f635", "\\0/": "1f646", "\\O/": "1f646", "0:3": "1f607", "0:)": "1f607", "O:)": "1f607", "O=)": "1f607", "O:3": "1f607", "B-)": "1f60e", "8-)": "1f60e", "B-D": "1f60e", "8-D": "1f60e", "-_-": "1f611", ">:\\": "1f615", ">:/": "1f615", ":-/": "1f615", ":-.": "1f615", ":-P": "1f61b", ":\xDE": "1f61b", ":-b": "1f61b", ":-O": "1f62e", O_O: "1f62e", ">:O": "1f62e", ":-X": "1f636", ":-#": "1f636", ":-)": "1f642", "(y)": "1f44d", "<3": "2764", ":D": "1f603", "=D": "1f603", ";)": "1f609", "*)": "1f609", ";]": "1f609", ";D": "1f609", ":*": "1f618", "=*": "1f618", ":(": "1f61e", ":[": "1f61e", "=(": "1f61e", ":@": "1f620", ";(": "1f622", "D:": "1f628", ":$": "1f633", "=$": "1f633", "#)": "1f635", "%)": "1f635", "X)": "1f635", "B)": "1f60e", "8)": "1f60e", ":/": "1f615", ":\\": "1f615", "=/": "1f615", "=\\": "1f615", ":L": "1f615", "=L": "1f615", ":P": "1f61b", "=P": "1f61b", ":b": "1f61b", ":O": "1f62e", ":X": "1f636", ":#": "1f636", "=X": "1f636", "=#": "1f636", ":)": "1f642", "=]": "1f642", "=)": "1f642", ":]": "1f642"}; + function zl(e2) { + if (e2.indexOf("-") > -1) { + const t2 = [], n2 = e2.split("-"); + for (let e3 = 0; e3 < n2.length; e3++) { + let r2 = parseInt(n2[e3], 16); + if (r2 >= 65536 && r2 <= 1114111) { + const e4 = Math.floor((r2 - 65536) / 1024) + 55296, t3 = (r2 - 65536) % 1024 + 56320; + r2 = String.fromCharCode(e4) + String.fromCharCode(t3); + } else + r2 = String.fromCharCode(r2); + t2.push(r2); + } + return t2.join(""); + } + return function(e3) { + let t2 = typeof e3 == "string" ? parseInt(e3, 16) : e3; + return t2 < 65536 ? String.fromCharCode(t2) : (t2 -= 65536, String.fromCharCode(55296 + (t2 >> 10), 56320 + (1023 & t2))); + }(e2); + } + function Fl() { + var e2; + return rl.emojis.toned || (rl.emojis.toned = (e2 = Object.values(rl.emojis.json.people).filter((e3) => e3.sn.includes("_tone")).map((e3) => e3.sn.replace(/_tone[1-5]/, "")), [...new Set(e2)])), rl.emojis.toned; + } + function Bl(e2) { + return e2.replace(kl, (e3, t2, n2, r2) => { + if (r2 === void 0 || r2 === "" || !(Pl.unescapeHTML(r2) in Ll)) + return e3; + return r2 = Pl.unescapeHTML(r2), n2 + zl(Ll[r2].toUpperCase()); + }); + } + function ql(e2, t2 = {unicode_only: false, add_title_wrapper: false}) { + const n2 = e2.emoji, r2 = e2.shortname; + if (n2) { + if (t2.unicode_only) + return n2; + if (Vc.settings.get("use_system_emojis")) + return t2.add_title_wrapper && r2 ? Za(Rl(), r2, n2) : n2; + { + const t3 = Vc.settings.get("emoji_image_path"); + return Za(Ml(), r2, n2, t3, e2.cp); + } + } + return t2.unicode_only ? r2 : Za(Il(), r2, r2, rl.emojis.by_sn[r2].url); + } + function Hl(e2) { + if (!rl.emojis.initialized) + throw new Error("getShortnameReferences called before emojis are initialized. To avoid this problem, first await the converse.emojis.initilaized_promise."); + return [...e2.matchAll(rl.emojis.shortnames_regex)].filter((e3) => e3[0].length > 0).map((e3) => { + const t2 = rl.emojis.by_sn[e3[0]].cp; + return {cp: t2, begin: e3.index, end: e3.index + e3[0].length, shortname: e3[0], emoji: t2 ? zl(t2) : null}; + }); + } + function Ul(e2) { + const t2 = []; + return function(e3, t3) { + const n2 = /\uFE0F/g, r2 = String.fromCharCode(8205); + String(e3).replace(Nl, (e4, i2, o2) => { + const s2 = function(e5) { + const t4 = []; + let n3 = 0, r3 = 0; + for (; r3 < e5.length; ) { + const i3 = e5.charCodeAt(r3++); + n3 ? (t4.push((65536 + (n3 - 55296 << 10) + (i3 - 56320)).toString(16)), n3 = 0) : 55296 <= i3 && i3 <= 56319 ? n3 = i3 : t4.push(i3.toString(16)); + } + return t4.join("-"); + }(e4.indexOf(r2) < 0 ? e4.replace(n2, "") : e4); + s2 && t3(s2, e4, o2); + }); + }(e2, (e3, n2, r2) => { + var i2; + t2.push({begin: r2, cp: e3, emoji: n2, end: r2 + n2.length, shortname: ((i2 = Pl.getEmojisByAtrribute("cp")[e3]) === null || i2 === void 0 ? void 0 : i2.sn) || ""}); + }), t2; + } + rl.plugins.add("converse-emoji", {initialize() { + const {___: e2} = Uc; + Vc.settings.extend({emoji_image_path: "https://twemoji.maxcdn.com/v/12.1.6/", emoji_categories: {smileys: ":grinning:", people: ":thumbsup:", activity: ":soccer:", travel: ":motorcycle:", objects: ":bomb:", nature: ":rainbow:", food: ":hotdog:", symbols: ":musical_note:", flags: ":flag_ac:", custom: null}, emoji_category_labels: {smileys: e2("Smileys and emotions"), people: e2("People"), activity: e2("Activities"), travel: e2("Travel"), objects: e2("Objects"), nature: e2("Animals and nature"), food: e2("Food and drink"), symbols: e2("Symbols"), flags: e2("Flags"), custom: e2("Stickers")}}), Uc.EmojiPicker = qo.extend({defaults: {current_category: "smileys", current_skintone: "", scroll_position: 0}}); + const t2 = {}; + Object.assign(Pl, {shortnamesToEmojis: (e3, t3 = {unicode_only: false, add_title_wrapper: false}) => function(e4, t4) { + let n2 = [e4]; + return [...Hl(e4), ...Ul(e4)].sort((e5, t5) => t5.begin - e5.begin).forEach((e5) => { + const r2 = n2.shift(), i2 = ql(e5, t4); + n2 = typeof i2 == "string" ? [r2.slice(0, e5.begin) + i2 + r2.slice(e5.end), ...n2] : [r2.slice(0, e5.begin), i2, r2.slice(e5.end), ...n2]; + }), n2; + }(e3 = Bl(e3), t3), shortnamesToUnicode: (e3) => Pl.shortnamesToEmojis(e3, {unicode_only: true})[0], isOnlyEmojis(e3) { + const t3 = e3.trim().split(/\s+/); + return !(t3.length === 0 || t3.length > 3) && t3.filter((e4) => { + const t4 = Ul(Pl.shortnamesToUnicode(e4)); + return t4.length === 1 && (e4 === t4[0].shortname || e4 === t4[0].emoji); + }).length === t3.length; + }, getEmojisByAtrribute(e3) { + if (t2[e3]) + return t2[e3]; + if (e3 === "category") + return rl.emojis.json; + const n2 = rl.emojis.list.map((t3) => t3[e3]).filter((e4, t3, n3) => n3.indexOf(e4) == t3); + return t2[e3] = {}, n2.forEach((n3) => t2[e3][n3] = rl.emojis.list.find((t3) => t3[e3] === n3)), t2[e3]; + }}), Object.assign(Vc, {emojis: {async initialize() { + if (!rl.emojis.initialized) { + rl.emojis.initialized = true; + const {default: e3} = await n.e(137).then(n.t.bind(null, 547, 3)); + rl.emojis.json = e3, rl.emojis.by_sn = Object.keys(e3).reduce((t4, n2) => Object.assign(t4, e3[n2]), {}), rl.emojis.list = Object.values(rl.emojis.by_sn), rl.emojis.list.sort((e4, t4) => e4.sn < t4.sn ? -1 : e4.sn > t4.sn ? 1 : 0), rl.emojis.shortnames = rl.emojis.list.map((e4) => e4.sn); + const t3 = () => rl.emojis.shortnames.map((e4) => e4.replace(/[+]/g, "\\$&")).join("|"); + rl.emojis.shortnames_regex = new RegExp(t3(), "gi"), rl.emojis.toned = Fl(), rl.emojis.initialized_promise.resolve(); + } + return rl.emojis.initialized_promise; + }}}); + }}); + var $l = {initialize() { + this.checkValidity() && (this.get("file") && this.on("change:put", this.uploadFile, this), this.setTimerForEphemeralMessage() || this.setOccupant(), Vc.trigger("chatRoomMessageInitialized", this)); + }, mayBeModerated() { + return ["all", "moderator"].includes(Vc.settings.get("allow_message_retraction")) && this.collection.chatbox.canModerateMessages(); + }, checkValidity() { + const e2 = Uc.Message.prototype.checkValidity.call(this); + return !e2 && this.collection.chatbox.debouncedRejoin(), e2; + }, onOccupantRemoved() { + var e2; + this.stopListening(this.occupant), delete this.occupant; + const t2 = this == null || (e2 = this.collection) === null || e2 === void 0 ? void 0 : e2.chatbox; + if (!t2) + return zn.error("Could not get collection.chatbox for message: ".concat(JSON.stringify(this.toJSON()))); + this.listenTo(t2.occupants, "add", this.onOccupantAdded); + }, onOccupantAdded(e2) { + if (e2.get("nick") === kc.e.getResourceFromJid(this.get("from"))) { + var t2; + this.occupant = e2, this.trigger("occupantAdded"), this.listenTo(this.occupant, "destroy", this.onOccupantRemoved); + const n2 = this == null || (t2 = this.collection) === null || t2 === void 0 ? void 0 : t2.chatbox; + if (!n2) + return zn.error("Could not get collection.chatbox for message: ".concat(JSON.stringify(this.toJSON()))); + this.stopListening(n2.occupants, "add", this.onOccupantAdded); + } + }, setOccupant() { + var e2; + if (this.get("type") !== "groupchat") + return; + const t2 = this == null || (e2 = this.collection) === null || e2 === void 0 ? void 0 : e2.chatbox; + if (!t2) + return zn.error("Could not get collection.chatbox for message: ".concat(JSON.stringify(this.toJSON()))); + const n2 = kc.e.getResourceFromJid(this.get("from")); + if (this.occupant = t2.occupants.findWhere({nick: n2}), !this.occupant && Vc.settings.get("muc_send_probes")) { + this.occupant = t2.occupants.create({nick: n2, type: "unavailable"}); + const e3 = "".concat(t2.get("jid"), "/").concat(n2); + Vc.user.presence.send("probe", e3); + } + this.occupant ? this.listenTo(this.occupant, "destroy", this.onOccupantRemoved) : this.listenTo(t2.occupants, "add", this.onOccupantAdded); + }}; + /** + * @copyright The Converse.js contributors + * @license Mozilla Public License (MPLv2) + * @description This is the MUC utilities module. + */ + const {Strophe: Wl, sizzle: Gl} = rl.env; + var Vl = {computeAffiliationsDelta(e2, t2, n2, r2) { + const i2 = n2.map((e3) => e3.jid), o2 = r2.map((e3) => e3.jid); + let s2 = ks(i2, o2).map((e3) => n2[Hs(i2, e3)]); + return e2 || (s2 = s2.concat(n2.filter((e3) => { + const t3 = Hs(o2, e3.jid); + return t3 >= 0 && e3.affiliation !== r2[t3].affiliation; + }))), t2 && (s2 = s2.concat(ks(o2, i2).map((e3) => ({jid: e3, affiliation: "none"})))), s2; + }, parseMemberListIQ: (e2) => Gl('query[xmlns="'.concat(Wl.NS.MUC_ADMIN, '"] item'), e2).map((e3) => { + const t2 = {affiliation: e3.getAttribute("affiliation")}, n2 = e3.getAttribute("jid"); + Jo.isValidJID(n2) ? t2.jid = n2 : t2.nick = n2; + const r2 = e3.getAttribute("nick"); + return r2 && (t2.nick = r2), e3.getAttribute("role") && (t2.role = r2), t2; + })}; + /** + * @copyright 2020, the Converse.js contributors + * @license Mozilla Public License (MPLv2) + * @description Pure functions to help functionally parse messages. + * @todo Other parsing helpers can be made more abstract and placed here. + */ + const Jl = {}, Xl = (e2, t2) => e2.replace(RegExp("\\" + t2, "ig"), "\\" + t2); + Jl.escapeCharacters = (e2) => (t2) => e2.split("").reduce(Xl, t2), Jl.escapeRegexString = Jl.escapeCharacters("[\\^$.?*+(){}"), Jl.findFirstMatchInArray = (e2) => (t2) => { + for (let n2 = 0; n2 < e2.length; n2++) + if (t2.localeCompare(e2[n2], void 0, {sensitivity: "base"}) === 0) + return e2[n2]; + return null; + }; + const Ql = ([e2, t2], n2, r2) => { + let i2 = e2, {begin: o2, end: s2} = n2; + const {value: a2} = n2; + return o2 -= r2, s2 = s2 - r2 - 1, i2 = "".concat(i2.slice(0, o2)).concat(a2).concat(i2.slice(s2 + 1)), [i2, [...t2, {...n2, begin: o2, end: s2}]]; + }; + Jl.reduceTextFromReferences = (e2, t2) => t2.reduce(Ql, [e2, []]); + var Yl = Jl; + /** + * @copyright 2020, the Converse.js contributors + * @license Mozilla Public License (MPLv2) + * @description This is the form utilities module. + */ + Jo.webForm2xForm = function(e2) { + const t2 = e2.getAttribute("name"); + if (!t2) + return null; + let n2; + return n2 = e2.getAttribute("type") === "checkbox" ? e2.checked ? 1 : 0 : e2.tagName == "TEXTAREA" ? e2.value.split("\n").filter((e3) => e3.trim()) : e2.tagName == "SELECT" ? Jo.getSelectValues(e2) : e2.value, Jo.toStanza('\n <field var="'.concat(t2, '">\n ').concat(n2.constructor === Array ? n2.map((e3) => "<value>".concat(e3, "</value>")) : "<value>".concat(n2, "</value>"), "\n </field>")); + }; + var Kl = Jo; + var Zl = function(e2, t2, n2) { + for (var r2 = -1, i2 = e2.length, o2 = t2.length, s2 = {}; ++r2 < i2; ) { + var a2 = r2 < o2 ? t2[r2] : void 0; + n2(s2, e2[r2], a2); + } + return s2; + }; + var eu = function(e2, t2) { + return Zl(e2 || [], t2 || [], we); + }, tu = Math.min; + var nu = function(e2, t2, n2) { + for (var r2 = n2 ? js : Cs, i2 = e2[0].length, o2 = e2.length, s2 = o2, a2 = Array(o2), c2 = 1 / 0, l2 = []; s2--; ) { + var u2 = e2[s2]; + s2 && t2 && (u2 = qr(u2, Le(t2))), c2 = tu(u2.length, c2), a2[s2] = !n2 && (t2 || i2 >= 120 && u2.length >= 120) ? new Xi(s2 && u2) : void 0; + } + u2 = e2[0]; + var d2 = -1, h2 = a2[0]; + e: + for (; ++d2 < i2 && l2.length < c2; ) { + var f2 = u2[d2], p2 = t2 ? t2(f2) : f2; + if (f2 = n2 || f2 !== 0 ? f2 : 0, !(h2 ? Yi(h2, p2) : r2(l2, p2, n2))) { + for (s2 = o2; --s2; ) { + var g2 = a2[s2]; + if (!(g2 ? Yi(g2, p2) : r2(e2[s2], p2, n2))) + continue e; + } + h2 && h2.push(p2), l2.push(f2); + } + } + return l2; + }; + var ru = function(e2) { + return Os(e2) ? e2 : []; + }, iu = jr(function(e2) { + var t2 = qr(e2, ru); + return t2.length && t2[0] === e2[0] ? nu(t2) : []; + }); + const ou = ["301", "303", "333", "307", "321", "322"], su = qo.extend({defaults: () => ({connection_status: rl.ROOMSTATUS.DISCONNECTED})}); + var au = {defaults() { + return {num_unread_general: 0, bookmarked: false, chat_state: void 0, hidden: Uc.isUniView() && !Vc.settings.get("singleton"), hidden_occupants: !!Vc.settings.get("hide_muc_participants"), message_type: "groupchat", name: "", num_unread: 0, roomconfig: {}, time_opened: this.get("time_opened") || new Date().getTime(), time_sent: new Date(0).toISOString(), type: Uc.CHATROOMS_TYPE}; + }, async initialize() { + this.initialized = Kl.getResolveablePromise(), this.debouncedRejoin = Rc(this.rejoin, 250), this.set("box_id", "box-".concat(this.get("jid"))), this.initNotifications(), this.initMessages(), this.initOccupants(), this.initDiscoModels(), this.registerHandlers(), this.on("change:chat_state", this.sendChatState, this), await this.restoreSession(), this.session.on("change:connection_status", this.onConnectionStatusChanged, this), this.listenTo(this.occupants, "add", this.onOccupantAdded), this.listenTo(this.occupants, "remove", this.onOccupantRemoved), this.listenTo(this.occupants, "change:show", this.onOccupantShowChanged), this.listenTo(this.occupants, "change:affiliation", this.createAffiliationChangeMessage), this.listenTo(this.occupants, "change:role", this.createRoleChangeMessage), await this.restoreFromCache() || this.join(), await Vc.trigger("chatRoomInitialized", this, {Synchronous: true}), this.initialized.resolve(); + }, async restoreFromCache() { + return this.session.get("connection_status") === rl.ROOMSTATUS.ENTERED && await this.isJoined() ? (await new Promise((e2) => this.features.fetch({success: e2, error: e2})), await this.fetchOccupants().catch((e2) => zn.error(e2)), await this.fetchMessages().catch((e2) => zn.error(e2)), true) : (await this.clearCache(), false); + }, async join(e2, t2) { + if (this.session.get("connection_status") === rl.ROOMSTATUS.ENTERED) + return this; + if (await this.refreshDiscoInfo(), !(e2 = await this.getAndPersistNickname(e2))) + return Kl.safeSave(this.session, {connection_status: rl.ROOMSTATUS.NICKNAME_REQUIRED}), Vc.settings.get("muc_show_logs_before_join") && await this.fetchMessages(), this; + const n2 = Object(kc.d)({from: Uc.connection.jid, to: this.getRoomJIDAndNick()}).c("x", {xmlns: kc.e.NS.MUC}).c("history", {maxstanzas: this.features.get("mam_enabled") ? 0 : Vc.settings.get("muc_history_max_stanzas")}).up(); + return (t2 = t2 || this.get("password")) && n2.cnode(kc.e.xmlElement("password", [], t2)), this.session.save("connection_status", rl.ROOMSTATUS.CONNECTING), Vc.send(n2), this; + }, async clearCache() { + this.session.save("connection_status", rl.ROOMSTATUS.DISCONNECTED), this.occupants.length ? this.occupants.filter((e2) => !e2.isMember()).forEach((e2) => e2.destroy()) : this.occupants.clearStore(), Vc.settings.get("clear_messages_on_reconnection") && await this.clearMessages(); + }, onOccupantAdded(e2) { + Uc.isInfoVisible(rl.MUC_TRAFFIC_STATES.ENTERED) && this.session.get("connection_status") === rl.ROOMSTATUS.ENTERED && e2.get("show") === "online" && this.updateNotifications(e2.get("nick"), rl.MUC_TRAFFIC_STATES.ENTERED); + }, onOccupantRemoved(e2) { + Uc.isInfoVisible(rl.MUC_TRAFFIC_STATES.EXITED) && this.session.get("connection_status") === rl.ROOMSTATUS.ENTERED && e2.get("show") === "online" && this.updateNotifications(e2.get("nick"), rl.MUC_TRAFFIC_STATES.EXITED); + }, onOccupantShowChanged(e2) { + e2.get("states").includes("303") || (e2.get("show") === "offline" && Uc.isInfoVisible(rl.MUC_TRAFFIC_STATES.EXITED) ? this.updateNotifications(e2.get("nick"), rl.MUC_TRAFFIC_STATES.EXITED) : e2.get("show") === "online" && Uc.isInfoVisible(rl.MUC_TRAFFIC_STATES.ENTERED) && this.updateNotifications(e2.get("nick"), rl.MUC_TRAFFIC_STATES.ENTERED)); + }, rejoin() { + return this.clearCache(), this.join(); + }, async onConnectionStatusChanged() { + this.session.get("connection_status") === rl.ROOMSTATUS.ENTERED && (await this.occupants.fetchMembers(), await this.fetchMessages(), Vc.trigger("enteredNewRoom", this), Vc.settings.get("auto_register_muc_nickname") && await Vc.disco.supports(kc.e.NS.MUC_REGISTER, this.get("jid")) && this.registerNickname()); + }, async onReconnection() { + this.registerHandlers(), await this.rejoin(), this.announceReconnection(); + }, getMessagesCollection: () => new Uc.ChatRoomMessages(), restoreSession() { + const e2 = "muc.session-".concat(Uc.bare_jid, "-").concat(this.get("jid")); + return this.session = new su({id: e2}), this.session.browserStorage = Uc.createStore(e2, "session"), new Promise((e3) => this.session.fetch({success: e3, error: e3})); + }, initDiscoModels() { + let e2 = "converse.muc-features-".concat(Uc.bare_jid, "-").concat(this.get("jid")); + this.features = new qo(Object.assign({id: e2}, eu(rl.ROOM_FEATURES, rl.ROOM_FEATURES.map(() => false)))), this.features.browserStorage = Uc.createStore(e2, "session"), e2 = "converse.muc-config-{_converse.bare_jid}-".concat(this.get("jid")), this.config = new qo(), this.config.browserStorage = Uc.createStore(e2, "session"); + }, initOccupants() { + this.occupants = new Uc.ChatRoomOccupants(); + const e2 = "converse.occupants-".concat(Uc.bare_jid).concat(this.get("jid")); + this.occupants.browserStorage = Uc.createStore(e2, "session"), this.occupants.chatroom = this; + }, fetchOccupants() { + return this.occupants.fetched = new Promise((e2) => { + this.occupants.fetch({add: true, silent: true, success: e2, error: e2}); + }), this.occupants.fetched; + }, handleAffiliationChangedMessage(e2) { + const t2 = mr()('x[xmlns="'.concat(kc.e.NS.MUC_USER, '"] item'), e2).pop(); + if (t2) { + const n2 = e2.getAttribute("from"), r2 = e2.getAttribute("type"), i2 = t2.getAttribute("affiliation"), o2 = t2.getAttribute("jid"), s2 = {from: n2, type: r2, affiliation: i2, nick: kc.e.getNodeFromJid(o2), states: [], show: r2 == "unavailable" ? "offline" : "online", role: t2.getAttribute("role"), jid: kc.e.getBareJidFromJid(o2), resource: kc.e.getResourceFromJid(o2)}, a2 = this.occupants.findOccupant({jid: s2.jid}); + a2 ? a2.save(s2) : this.occupants.create(s2); + } + }, async handleErrorMessageStanza(e2) { + const {__: t2} = Uc, n2 = await ps.parseMUCMessage(e2, this, Uc); + if (!await this.shouldShowErrorMessage(n2)) + return; + const r2 = this.getMessageReferencedByError(n2); + if (r2) { + const e3 = {error: n2.error, error_condition: n2.error_condition, error_text: n2.error_text, error_type: n2.error_type, editable: false}; + n2.msgid === r2.get("retraction_id") ? (e3.retraction_id = void 0, n2.error || (n2.error_condition === "forbidden" ? e3.error = t2("You're not allowed to retract your message.") : n2.error_condition === "not-acceptable" ? e3.error = t2("Your retraction was not delivered because you're not present in the groupchat.") : e3.error = t2("Sorry, an error occurred while trying to retract your message."))) : n2.error || (n2.error_condition === "forbidden" ? e3.error = t2("Your message was not delivered because you weren't allowed to send it.") : n2.error_condition === "not-acceptable" ? e3.error = t2("Your message was not delivered because you're not present in the groupchat.") : e3.error = t2("Sorry, an error occurred while trying to send your message.")), r2.save(e3); + } else + this.createMessage(n2); + }, async handleMessageStanza(e2) { + if (ps.isArchived(e2)) + return zn.warn('Received a MAM message with type "groupchat"'); + this.createInfoMessages(e2), this.fetchFeaturesIfConfigurationChanged(e2); + const t2 = await ps.parseMUCMessage(e2, this, Uc), n2 = {stanza: e2, attrs: t2, chatbox: this}; + return Vc.trigger("message", n2), t2 && this.queueMessage(t2); + }, registerHandlers() { + const e2 = this.get("jid"); + this.removeHandlers(), this.presence_handler = Uc.connection.addHandler((e3) => this.onPresence(e3) || true, null, "presence", null, null, e2, {ignoreNamespaceFragment: true, matchBareFromJid: true}), this.message_handler = Uc.connection.addHandler((e3) => !!this.handleMessageStanza(e3) || true, null, "message", "groupchat", null, e2, {matchBareFromJid: true}), this.affiliation_message_handler = Uc.connection.addHandler((e3) => this.handleAffiliationChangedMessage(e3) || true, kc.e.NS.MUC_USER, "message", null, null, e2); + }, removeHandlers() { + return this.message_handler && (Uc.connection && Uc.connection.deleteHandler(this.message_handler), delete this.message_handler), this.presence_handler && (Uc.connection && Uc.connection.deleteHandler(this.presence_handler), delete this.presence_handler), this.affiliation_message_handler && (Uc.connection && Uc.connection.deleteHandler(this.affiliation_message_handler), delete this.affiliation_message_handler), this; + }, invitesAllowed() { + return Vc.settings.get("allow_muc_invitations") && (this.features.get("open") || this.getOwnAffiliation() === "owner"); + }, getDisplayName() { + const e2 = this.get("name"); + return e2 || (Vc.settings.get("locked_muc_domain") === "hidden" ? kc.e.getNodeFromJid(this.get("jid")) : this.get("jid")); + }, sendTimedMessage(e2) { + typeof e2.tree == "function" && (e2 = e2.tree()); + let t2 = e2.getAttribute("id"); + t2 || (t2 = this.getUniqueId("sendIQ"), e2.setAttribute("id", t2)); + const n2 = Kl.getResolveablePromise(), r2 = Uc.connection.addTimedHandler(Uc.STANZA_TIMEOUT, () => (Uc.connection.deleteHandler(i2), n2.reject(new Uc.TimeoutError("Timeout Error: No response from server")), false)), i2 = Uc.connection.addHandler((e3) => { + r2 && Uc.connection.deleteTimedHandler(r2), e3.getAttribute("type") === "groupchat" ? n2.resolve(e3) : n2.reject(e3); + }, null, "message", ["error", "groupchat"], t2); + return Vc.send(e2), n2; + }, async retractOwnMessage(e2) { + const t2 = Uc.__, n2 = e2.get("origin_id"); + if (!n2) + throw new Error("Can't retract message without a XEP-0359 Origin ID"); + const r2 = e2.get("editable"), i2 = Object(kc.c)({id: Kl.getUniqueId(), to: this.get("jid"), type: "groupchat"}).c("store", {xmlns: kc.e.NS.HINTS}).up().c("apply-to", {id: n2, xmlns: kc.e.NS.FASTEN}).c("retract", {xmlns: kc.e.NS.RETRACT}); + e2.set({retracted: new Date().toISOString(), retracted_id: n2, retraction_id: i2.nodeTree.getAttribute("id"), editable: false}); + try { + await this.sendTimedMessage(i2); + } catch (n3) { + throw e2.save({editable: r2, error_type: "timeout", error: t2("A timeout happened while while trying to retract your message."), retracted: void 0, retracted_id: void 0}), n3; + } + }, async retractOtherMessage(e2, t2) { + const n2 = e2.get("editable"); + e2.save({moderated: "retracted", moderated_by: Uc.bare_jid, moderated_id: e2.get("msgid"), moderation_reason: t2, editable: false}); + const r2 = await this.sendRetractionIQ(e2, t2); + return (r2 === null || Kl.isErrorStanza(r2)) && e2.save({editable: n2, moderated: void 0, moderated_by: void 0, moderated_id: void 0, moderation_reason: void 0}), r2; + }, sendRetractionIQ(e2, t2) { + const n2 = Object(kc.b)({to: this.get("jid"), type: "set"}).c("apply-to", {id: e2.get("stanza_id ".concat(this.get("jid"))), xmlns: kc.e.NS.FASTEN}).c("moderate", {xmlns: kc.e.NS.MODERATE}).c("retract", {xmlns: kc.e.NS.RETRACT}).up().c("reason").t(t2 || ""); + return Vc.sendIQ(n2, null, false); + }, sendDestroyIQ(e2, t2) { + const n2 = Object(kc.a)("destroy"); + t2 && n2.attrs({jid: t2}); + const r2 = Object(kc.b)({to: this.get("jid"), type: "set"}).c("query", {xmlns: kc.e.NS.MUC_OWNER}).cnode(n2.node); + return e2 && e2.length > 0 && r2.c("reason", e2), Vc.sendIQ(r2); + }, async leave(e2) { + if (this.features.destroy(), this.occupants.clearStore(), Uc.disco_entities) { + const e3 = Uc.disco_entities.get(this.get("jid")); + e3 && await new Promise((t2, n2) => e3.destroy({success: t2, error: n2})); + } + Vc.connection.connected() && Vc.user.presence.send("unavailable", this.getRoomJIDAndNick(), e2), Kl.safeSave(this.session, {connection_status: rl.ROOMSTATUS.DISCONNECTED}), this.removeHandlers(); + }, async close() { + return await new Promise((e2) => this.session.destroy({success: e2, error: (t2, n2) => { + zn.error(n2), e2(); + }})), await new Promise((e2) => this.features.destroy({success: e2, error: (t2, n2) => { + zn.error(n2), e2(); + }})), Uc.ChatBox.prototype.close.call(this); + }, canModerateMessages() { + const e2 = this.getOwnOccupant(); + return e2 && e2.isModerator() && Vc.disco.supports(kc.e.NS.MODERATE, this.get("jid")); + }, getAllKnownNicknames() { + return [...new Set([...this.occupants.map((e2) => e2.get("nick")), ...this.messages.map((e2) => e2.get("nick"))])].filter((e2) => e2); + }, getAllKnownNicknamesRegex() { + const e2 = this.getAllKnownNicknames().join("|"), t2 = Yl.escapeRegexString(e2); + return RegExp("(?:\\p{P}|\\p{Z}|^)@(".concat(t2, ")(?![\\w@-])"), "uig"); + }, getOccupantByJID(e2) { + return this.occupants.findOccupant({jid: e2}); + }, getOccupantByNickname(e2) { + return this.occupants.findOccupant({nick: e2}); + }, parseTextForReferences(e2) { + if (!e2 || !/(\p{P}|\p{Z}|^)([@][\w_-]+(?:\.\w+)*)/giu.test(e2)) + return [e2, []]; + const t2 = Yl.findFirstMatchInArray(this.getAllKnownNicknames()), n2 = (e3) => { + const t3 = this.get("jid"), n3 = this.getOccupant(e3) || this.getOccupant(t3), r3 = n3 && n3.get("jid") || "".concat(t3, "/").concat(e3); + return encodeURI("xmpp:".concat(r3)); + }, r2 = this.getAllKnownNicknamesRegex(), i2 = [...e2.matchAll(r2)].filter((e3) => !e3[0].startsWith("/")).map((e3) => { + let r3 = e3[0].indexOf("@"); + e3[0][r3 + 1] === "@" && (r3 += 1); + const i3 = e3.index + r3, o3 = i3 + e3[0].length - r3, s3 = t2(e3[1]); + return {begin: i3, end: o3, value: s3, type: "mention", uri: n2(s3)}; + }), [o2, s2] = Yl.reduceTextFromReferences(e2, i2); + return [o2, s2]; + }, getOutgoingMessageAttributes(e2, t2) { + const n2 = this.get("composing_spoiler"), [r2, i2] = this.parseTextForReferences(e2), o2 = Kl.getUniqueId(), s2 = r2 ? Kl.httpToGeoUri(Kl.shortnamesToUnicode(r2), Uc) : void 0; + return {body: s2, is_spoiler: n2, origin_id: o2, references: i2, id: o2, msgid: o2, from: "".concat(this.get("jid"), "/").concat(this.get("nick")), fullname: this.get("nick"), is_only_emojis: !!r2 && Kl.isOnlyEmojis(r2), message: s2, nick: this.get("nick"), sender: "me", spoiler_hint: n2 ? t2 : void 0, type: "groupchat"}; + }, getRoomJIDAndNick() { + const e2 = this.get("nick"); + return kc.e.getBareJidFromJid(this.get("jid")) + (e2 !== null ? "/".concat(e2) : ""); + }, sendChatState() { + if (!Vc.settings.get("send_chat_state_notifications") || !this.get("chat_state") || this.session.get("connection_status") !== rl.ROOMSTATUS.ENTERED || this.features.get("moderated") && this.getOwnRole() === "visitor") + return; + const e2 = Vc.settings.get("send_chat_state_notifications"); + if (Array.isArray(e2) && !e2.includes(this.get("chat_state"))) + return; + const t2 = this.get("chat_state"); + t2 !== Uc.GONE && Vc.send(Object(kc.c)({to: this.get("jid"), type: "groupchat"}).c(t2, {xmlns: kc.e.NS.CHATSTATES}).up().c("no-store", {xmlns: kc.e.NS.HINTS}).up().c("no-permanent-store", {xmlns: kc.e.NS.HINTS})); + }, directInvite(e2, t2) { + this.features.get("membersonly") && this.updateMemberLists([{jid: e2, affiliation: "member", reason: t2}]); + const n2 = {xmlns: "jabber:x:conference", jid: this.get("jid")}; + t2 !== null && (n2.reason = t2), this.get("password") && (n2.password = this.get("password")); + const r2 = Object(kc.c)({from: Uc.connection.jid, to: e2, id: Kl.getUniqueId()}).c("x", n2); + Vc.send(r2), Vc.trigger("roomInviteSent", {room: this, recipient: e2, reason: t2}); + }, refreshDiscoInfo() { + return Vc.disco.refresh(this.get("jid")).then(() => this.getDiscoInfo()).catch((e2) => zn.error(e2)); + }, getDiscoInfo() { + return Vc.disco.getIdentity("conference", "text", this.get("jid")).then((e2) => this.save({name: e2 == null ? void 0 : e2.get("name")})).then(() => this.getDiscoInfoFields()).then(() => this.getDiscoInfoFeatures()).catch((e2) => zn.error(e2)); + }, async getDiscoInfoFields() { + const e2 = (await Vc.disco.getFields(this.get("jid"))).reduce((e3, t2) => { + const n2 = t2.get("var"); + return n2 && n2.startsWith("muc#roominfo_") && (e3[n2.replace("muc#roominfo_", "")] = t2.get("value")), e3; + }, {}); + this.config.save(e2); + }, async getDiscoInfoFeatures() { + const e2 = await Vc.disco.getFeatures(this.get("jid")), t2 = Object.assign(eu(rl.ROOM_FEATURES, rl.ROOM_FEATURES.map(() => false)), {fetched: new Date().toISOString()}); + e2.each((e3) => { + const n2 = e3.get("var"); + n2.startsWith("muc_") ? t2[n2.replace("muc_", "")] = true : n2 === kc.e.NS.MAM && (t2.mam_enabled = true); + }), this.features.save(t2); + }, setAffiliation(e2, t2) { + return t2 = t2.filter((t3) => t3.affiliation === void 0 || t3.affiliation === e2), Promise.all(t2.map((t3) => this.sendAffiliationIQ(e2, t3))); + }, addFieldValue(e2) { + const t2 = e2.getAttribute("type"); + if (t2 === "fixed") + return e2; + const n2 = e2.getAttribute("var").replace("muc#roomconfig_", ""), r2 = this.get("roomconfig"); + if (n2 in r2) { + let i2; + switch (t2) { + case "boolean": + i2 = [r2[n2] ? 1 : 0]; + break; + case "list-multi": + i2 = r2[n2]; + break; + default: + i2 = [r2[n2]]; + } + e2.innerHTML = i2.map((e3) => Object(kc.a)("value").t(e3)).join(""); + } + return e2; + }, async autoConfigureChatRoom() { + const e2 = await this.fetchRoomConfiguration(), t2 = mr()("field", e2).map((e3) => this.addFieldValue(e3)); + if (t2.length) + return this.sendConfiguration(t2); + }, fetchRoomConfiguration() { + return Vc.sendIQ(Object(kc.b)({to: this.get("jid"), type: "get"}).c("query", {xmlns: kc.e.NS.MUC_OWNER})); + }, sendConfiguration(e2 = []) { + const t2 = Object(kc.b)({to: this.get("jid"), type: "set"}).c("query", {xmlns: kc.e.NS.MUC_OWNER}).c("x", {xmlns: kc.e.NS.XFORM, type: "submit"}); + return e2.forEach((e3) => t2.cnode(e3).up()), Vc.sendIQ(t2); + }, getOwnRole() { + var e2, t2; + return (e2 = this.getOwnOccupant()) === null || e2 === void 0 || (t2 = e2.attributes) === null || t2 === void 0 ? void 0 : t2.role; + }, getOwnAffiliation() { + var e2, t2; + return (e2 = this.getOwnOccupant()) === null || e2 === void 0 || (t2 = e2.attributes) === null || t2 === void 0 ? void 0 : t2.affiliation; + }, getOwnOccupant() { + return this.occupants.findWhere({jid: Uc.bare_jid}); + }, sendAffiliationIQ(e2, t2) { + const n2 = Object(kc.b)({to: this.get("jid"), type: "set"}).c("query", {xmlns: kc.e.NS.MUC_ADMIN}).c("item", {affiliation: t2.affiliation || e2, nick: t2.nick, jid: t2.jid}); + return t2.reason !== void 0 && n2.c("reason", t2.reason), Vc.sendIQ(n2); + }, setAffiliations(e2) { + const t2 = [...new Set(e2.map((e3) => e3.affiliation))]; + return Promise.all(t2.map((t3) => this.setAffiliation(t3, e2))); + }, setRole(e2, t2, n2, r2, i2) { + const o2 = Object(kc.a)("item", {nick: e2.get("nick"), role: t2}), s2 = Object(kc.b)({to: this.get("jid"), type: "set"}).c("query", {xmlns: kc.e.NS.MUC_ADMIN}).cnode(o2.node); + return n2 !== null && s2.c("reason", n2), Vc.sendIQ(s2).then(r2).catch(i2); + }, getOccupant(e2) { + return Kl.isValidJID(e2) ? this.getOccupantByJID(e2) : this.getOccupantByNickname(e2); + }, getOccupantsWithRole(e2) { + return this.getOccupantsSortedBy("nick").filter((t2) => t2.get("role") === e2).map((e3) => ({jid: e3.get("jid"), nick: e3.get("nick"), role: e3.get("role")})); + }, getOccupantsWithAffiliation(e2) { + return this.getOccupantsSortedBy("nick").filter((t2) => t2.get("affiliation") === e2).map((e3) => ({jid: e3.get("jid"), nick: e3.get("nick"), affiliation: e3.get("affiliation")})); + }, getOccupantsSortedBy(e2) { + return Array.from(this.occupants.models).sort((t2, n2) => t2.get(e2) < n2.get(e2) ? -1 : t2.get(e2) > n2.get(e2) ? 1 : 0); + }, async getAffiliationList(e2) { + const t2 = Object(kc.b)({to: this.get("jid"), type: "get"}).c("query", {xmlns: kc.e.NS.MUC_ADMIN}).c("item", {affiliation: e2}), n2 = await Vc.sendIQ(t2, null, false); + if (n2 === null) { + const t3 = "Error: timeout while fetching ".concat(e2, " list for MUC ").concat(this.get("jid")), r2 = new Error(t3); + return zn.warn(t3), zn.warn(n2), r2; + } + if (Kl.isErrorStanza(n2)) { + const t3 = "Error: not allowed to fetch ".concat(e2, " list for MUC ").concat(this.get("jid")), r2 = new Error(t3); + return zn.warn(t3), zn.warn(n2), r2; + } + return Vl.parseMemberListIQ(n2).filter((e3) => e3).sort((e3, t3) => e3.nick < t3.nick ? -1 : e3.nick > t3.nick ? 1 : 0); + }, async updateMemberLists(e2) { + const t2 = (await Promise.all(["member", "admin", "owner"].map((e3) => this.getAffiliationList(e3)))).reduce((e3, t3) => Kl.isErrorObject(t3) ? e3 : [...t3, ...e3], []); + await this.setAffiliations(Vl.computeAffiliationsDelta(true, false, e2, t2)), await this.occupants.fetchMembers(); + }, async getAndPersistNickname(e2) { + return (e2 = e2 || this.get("nick") || await this.getReservedNick() || Uc.getDefaultMUCNickname()) && this.save({nick: e2}, {silent: true}), e2; + }, async getReservedNick() { + const e2 = Object(kc.b)({to: this.get("jid"), from: Uc.connection.jid, type: "get"}).c("query", {xmlns: kc.e.NS.DISCO_INFO, node: "x-roomuser-item"}), t2 = await Vc.sendIQ(e2, null, false); + if (Kl.isErrorObject(t2)) + throw t2; + const n2 = t2.querySelector('query[node="x-roomuser-item"] identity'); + return n2 ? n2.getAttribute("name") : null; + }, async registerNickname() { + const e2 = Uc.__, t2 = this.get("nick"), n2 = this.get("jid"); + let r2, i2; + try { + r2 = await Vc.sendIQ(Object(kc.b)({to: n2, from: Uc.connection.jid, type: "get"}).c("query", {xmlns: kc.e.NS.MUC_REGISTER})); + } catch (t3) { + return mr()('not-allowed[xmlns="'.concat(kc.e.NS.STANZAS, '"]'), t3).length ? i2 = e2("You're not allowed to register yourself in this groupchat.") : mr()('registration-required[xmlns="'.concat(kc.e.NS.STANZAS, '"]'), t3).length && (i2 = e2("You're not allowed to register in this groupchat because it's members-only.")), zn.error(t3), i2; + } + const o2 = mr()("field required", r2).map((e3) => e3.parentElement); + if (o2.length > 1 && o2[0].getAttribute("var") !== "muc#register_roomnick") + return zn.error("Can't register the user register in the groupchat ".concat(n2, " due to the required fields")); + try { + await Vc.sendIQ(Object(kc.b)({to: n2, from: Uc.connection.jid, type: "set"}).c("query", {xmlns: kc.e.NS.MUC_REGISTER}).c("x", {xmlns: kc.e.NS.XFORM, type: "submit"}).c("field", {var: "FORM_TYPE"}).c("value").t("http://jabber.org/protocol/muc#register").up().up().c("field", {var: "muc#register_roomnick"}).c("value").t(t2)); + } catch (t3) { + return mr()('service-unavailable[xmlns="'.concat(kc.e.NS.STANZAS, '"]'), t3).length ? i2 = e2("Can't register your nickname in this groupchat, it doesn't support registration.") : mr()('bad-request[xmlns="'.concat(kc.e.NS.STANZAS, '"]'), t3).length && (i2 = e2("Can't register your nickname in this groupchat, invalid data form supplied.")), zn.error(i2), zn.error(t3), i2; + } + }, updateOccupantsOnPresence(e2) { + var t2, n2; + const r2 = ps.parseMUCPresence(e2); + if (r2.type === "error" || !r2.jid && !r2.nick) + return true; + const i2 = this.occupants.findOccupant(r2); + if (r2.type === "unavailable" && i2 && !r2.states.includes(rl.MUC_NICK_CHANGED_CODE) && !["admin", "owner", "member"].includes(r2.affiliation)) + return i2.set(r2), void i2.destroy(); + const o2 = r2.jid || "", s2 = Object.assign(r2, {jid: kc.e.getBareJidFromJid(o2) || (i2 == null || (t2 = i2.attributes) === null || t2 === void 0 ? void 0 : t2.jid), resource: kc.e.getResourceFromJid(o2) || (i2 == null || (n2 = i2.attributes) === null || n2 === void 0 ? void 0 : n2.resource)}); + i2 ? i2.save(s2) : this.occupants.create(s2); + }, fetchFeaturesIfConfigurationChanged(e2) { + const t2 = ["104", "170", "171", "172", "173", "174"]; + mr()("status", e2).filter((e3) => t2.includes(e3.getAttribute("status"))).length && this.refreshDiscoInfo(); + }, isSameUser(e2, t2) { + const n2 = kc.e.getBareJidFromJid(e2), r2 = kc.e.getBareJidFromJid(t2), i2 = kc.e.getResourceFromJid(e2), o2 = kc.e.getResourceFromJid(t2); + if (Kl.isSameBareJID(e2, t2)) + return n2 !== this.get("jid") || i2 === o2; + return (n2 === this.get("jid") ? this.occupants.findOccupant({nick: i2}) : this.occupants.findOccupant({jid: n2})) === (r2 === this.get("jid") ? this.occupants.findOccupant({nick: o2}) : this.occupants.findOccupant({jid: r2})); + }, async isSubjectHidden() { + return (await Vc.user.settings.get("mucs_with_hidden_subject", [])).includes(this.get("jid")); + }, async toggleSubjectHiddenState() { + const e2 = this.get("jid"), t2 = await Vc.user.settings.get("mucs_with_hidden_subject", []); + t2.includes(this.get("jid")) ? Vc.user.settings.set("mucs_with_hidden_subject", t2.filter((t3) => t3 !== e2)) : Vc.user.settings.set("mucs_with_hidden_subject", [...t2, e2]); + }, async handleSubjectChange(e2) { + const t2 = Uc.__; + if (typeof e2.subject == "string" && !e2.thread && !e2.message) { + const n2 = e2.subject, r2 = e2.nick; + if (Kl.safeSave(this, {subject: {author: r2, text: e2.subject || ""}}), !e2.is_delayed && r2) { + const i2 = t2(n2 ? "Topic set by %1$s" : "Topic cleared by %1$s", r2), o2 = this.messages.last(); + (o2 == null ? void 0 : o2.get("nick")) === e2.nick && (o2 == null ? void 0 : o2.get("type")) === "info" && (o2 == null ? void 0 : o2.get("message")) === i2 || this.createMessage({message: i2, nick: e2.nick, type: "info"}), await this.isSubjectHidden() && this.toggleSubjectHiddenState(); + } + return true; + } + return false; + }, setSubject(e2 = "") { + Vc.send(Object(kc.c)({to: this.get("jid"), from: Uc.connection.jid, type: "groupchat"}).c("subject", {xmlns: "jabber:client"}).t(e2).tree()); + }, ignorableCSN(e2) { + return e2.chat_state && !e2.body && (e2.is_delayed || this.isOwnMessage(e2)); + }, isOwnMessage(e2) { + let t2; + return t2 = Dn(e2) ? e2.getAttribute("from") : e2 instanceof Uc.Message ? e2.get("from") : e2.from, kc.e.getResourceFromJid(t2) == this.get("nick"); + }, getUpdatedMessageAttributes(e2, t2) { + const n2 = Uc.ChatBox.prototype.getUpdatedMessageAttributes.call(this, e2, t2); + if (this.isOwnMessage(t2)) { + const r2 = Object.keys(t2).filter((e3) => e3.startsWith("stanza_id")); + Object.assign(n2, Bo(t2, r2)), e2.get("received") || (n2.received = new Date().toISOString()); + } + return n2; + }, async isJoined() { + const e2 = this.get("jid"), t2 = Object(kc.b)({to: "".concat(e2, "/").concat(this.get("nick")), type: "get"}).c("ping", {xmlns: kc.e.NS.PING}); + try { + await Vc.sendIQ(t2); + } catch (t3) { + return t3 === null ? zn.warn("isJoined: Timeout error while checking whether we're joined to MUC: ".concat(e2)) : zn.warn("isJoined: Apparently we're no longer connected to MUC: ".concat(e2)), false; + } + return true; + }, async rejoinIfNecessary() { + if (!await this.isJoined()) + return this.rejoin(), true; + }, async shouldShowErrorMessage(e2) { + return (e2.error_condition !== "not-acceptable" || !await this.rejoinIfNecessary()) && Uc.ChatBox.prototype.shouldShowErrorMessage.call(this, e2); + }, findDanglingModeration(e2) { + if (!this.messages.length) + return null; + if (this.messages.last().get("time") > e2.time) { + const t2 = Array.from(this.messages.models), n2 = e2["stanza_id ".concat(this.get("jid"))]; + return n2 ? (t2.reverse(), t2.find(({attributes: e3}) => e3.moderated === "retracted" && e3.moderated_id === n2 && e3.moderated_by)) : null; + } + }, async handleModeration(e2) { + const t2 = ["editable", "moderated", "moderated_by", "moderated_id", "moderation_reason"]; + if (e2.moderated === "retracted") { + const n2 = {}; + n2["stanza_id ".concat(this.get("jid"))] = e2.moderated_id; + const r2 = this.messages.findWhere(n2); + return r2 ? (r2.save(Bo(e2, t2)), true) : (e2.dangling_moderation = true, await this.createMessage(e2), true); + } + { + const n2 = this.findDanglingModeration(e2); + if (n2) { + const r2 = Bo(n2.attributes, t2), i2 = Object.assign({dangling_moderation: false}, e2, r2); + return delete i2.id, n2.save(i2), true; + } + } + return false; + }, removeNotification(e2, t2) { + const n2 = this.notifications.toJSON(); + (t2 = Array.isArray(t2) ? t2 : [t2]).forEach((t3) => { + const r2 = Array.from(n2[t3] || []); + if (r2.includes(e2)) { + const n3 = r2.indexOf(e2); + r2.splice(n3, 1), this.notifications.set(t3, Array.from(r2)); + } + }); + }, updateNotifications(e2, t2) { + const n2 = this.notifications.toJSON(), r2 = n2[t2] || []; + if (r2.includes(e2)) + return; + const i2 = (i3, o3) => (i3[o3] = o3 === t2 ? [...r2, e2] : (n2[o3] || []).filter((t3) => t3 !== e2), i3), o2 = rl.CHAT_STATES.reduce(i2, {}), s2 = rl.MUC_TRAFFIC_STATES_LIST.reduce(i2, {}), a2 = rl.MUC_ROLE_CHANGES_LIST.reduce(i2, {}); + this.notifications.set(Object.assign(o2, s2, a2)), window.setTimeout(() => this.removeNotification(e2, t2), 1e4); + }, async onMessage(e2) { + if (e2 = await e2, Kl.isErrorObject(e2)) + return e2.stanza && zn.error(e2.stanza), zn.error(e2.message); + const t2 = this.getDuplicateMessage(e2); + if (t2) + return this.updateMessage(t2, e2); + if (!(e2.is_valid_receipt_request || e2.is_marker || this.ignorableCSN(e2))) { + if (await this.handleRetraction(e2) || await this.handleModeration(e2) || await this.handleSubjectChange(e2)) + return this.removeNotification(e2.nick, ["composing", "paused"]); + if (this.setEditable(e2, e2.time), e2.chat_state && this.updateNotifications(e2.nick, e2.chat_state), Kl.shouldCreateGroupchatMessage(e2)) { + const t3 = this.handleCorrection(e2) || await this.createMessage(e2); + this.removeNotification(e2.nick, ["composing", "paused"]), this.handleUnreadMessage(t3); + } + } + }, handleModifyError(e2) { + var t2; + const n2 = (t2 = e2.querySelector("error text")) === null || t2 === void 0 ? void 0 : t2.textContent; + if (n2) + if (this.session.get("connection_status") === rl.ROOMSTATUS.CONNECTING) + this.setDisconnectionMessage(n2); + else { + const e3 = {type: "error", message: n2, is_ephemeral: true}; + this.createMessage(e3); + } + }, handleDisconnection(e2) { + var t2; + const n2 = e2.querySelector("status[code='110']") !== null, r2 = mr()('x[xmlns="'.concat(kc.e.NS.MUC_USER, '"]'), e2).pop(); + if (!r2) + return; + const i2 = mr()("status", r2).map((e3) => e3.getAttribute("code")), o2 = iu(i2, Object.keys(Uc.muc.disconnect_messages)); + if (!(n2 && o2.length > 0)) + return; + const s2 = r2.querySelector("item"), a2 = s2 ? (t2 = s2.querySelector("reason")) === null || t2 === void 0 ? void 0 : t2.textContent : void 0, c2 = s2 ? Pc(s2.querySelector("actor"), "getAttribute", "nick") : void 0, l2 = Uc.muc.disconnect_messages[o2[0]]; + this.setDisconnectionMessage(l2, a2, c2); + }, getActionInfoMessage(e2, t2, n2) { + const r2 = Uc.__; + return e2 === "301" ? n2 ? r2("%1$s has been banned by %2$s", t2, n2) : r2("%1$s has been banned", t2) : e2 === "303" ? r2("%1$s's nickname has changed", t2) : e2 === "307" ? n2 ? r2("%1$s has been kicked out by %2$s", t2, n2) : r2("%1$s has been kicked out", t2) : e2 === "321" ? r2("%1$s has been removed because of an affiliation change", t2) : e2 === "322" ? r2("%1$s has been removed for not being a member", t2) : void 0; + }, createAffiliationChangeMessage(e2) { + const t2 = Uc.__, n2 = e2._previousAttributes.affiliation; + if (!n2) + return; + const r2 = e2.get("affiliation"); + n2 === "admin" && Uc.isInfoVisible(rl.AFFILIATION_CHANGES.EXADMIN) ? this.createMessage({type: "info", message: t2("%1$s is no longer an admin of this groupchat", e2.get("nick"))}) : n2 === "owner" && Uc.isInfoVisible(rl.AFFILIATION_CHANGES.EXOWNER) ? this.createMessage({type: "info", message: t2("%1$s is no longer an owner of this groupchat", e2.get("nick"))}) : n2 === "outcast" && Uc.isInfoVisible(rl.AFFILIATION_CHANGES.EXOUTCAST) && this.createMessage({type: "info", message: t2("%1$s is no longer banned from this groupchat", e2.get("nick"))}), r2 === "none" && n2 === "member" && Uc.isInfoVisible(rl.AFFILIATION_CHANGES.EXMEMBER) && this.createMessage({type: "info", message: t2("%1$s is no longer a member of this groupchat", e2.get("nick"))}), r2 === "member" && Uc.isInfoVisible(rl.AFFILIATION_CHANGES.MEMBER) ? this.createMessage({type: "info", message: t2("%1$s is now a member of this groupchat", e2.get("nick"))}) : (r2 === "admin" && Uc.isInfoVisible(rl.AFFILIATION_CHANGES.ADMIN) || r2 == "owner" && Uc.isInfoVisible(rl.AFFILIATION_CHANGES.OWNER)) && this.createMessage({type: "info", message: t2("%1$s is now an %2$s of this groupchat", e2.get("nick"), r2)}); + }, createRoleChangeMessage(e2, t2) { + if (t2 === "none" || e2.changed.affiliation) + return; + const n2 = e2._previousAttributes.role; + n2 === "moderator" && Uc.isInfoVisible(rl.MUC_ROLE_CHANGES.DEOP) ? this.updateNotifications(e2.get("nick"), rl.MUC_ROLE_CHANGES.DEOP) : n2 === "visitor" && Uc.isInfoVisible(rl.MUC_ROLE_CHANGES.VOICE) && this.updateNotifications(e2.get("nick"), rl.MUC_ROLE_CHANGES.VOICE), e2.get("role") === "visitor" && Uc.isInfoVisible(rl.MUC_ROLE_CHANGES.MUTE) ? this.updateNotifications(e2.get("nick"), rl.MUC_ROLE_CHANGES.MUTE) : e2.get("role") === "moderator" && !["owner", "admin"].includes(e2.get("affiliation")) && Uc.isInfoVisible(rl.MUC_ROLE_CHANGES.OP) && this.updateNotifications(e2.get("nick"), rl.MUC_ROLE_CHANGES.OP); + }, createInfoMessage(e2, t2, n2) { + const r2 = Uc.__, i2 = {type: "info"}; + if (Uc.isInfoVisible(e2) && e2 !== "110" && (e2 !== "100" || n2)) { + if (e2 in Uc.muc.info_messages) + i2.message = Uc.muc.info_messages[e2]; + else if (!n2 && ou.includes(e2)) { + var o2, s2; + const n3 = kc.e.getResourceFromJid(t2.getAttribute("from")), r3 = t2.querySelector('x[xmlns="'.concat(kc.e.NS.MUC_USER, '"] item')); + i2.actor = r3 ? (o2 = r3.querySelector("actor")) === null || o2 === void 0 ? void 0 : o2.getAttribute("nick") : void 0, i2.reason = r3 ? (s2 = r3.querySelector("reason")) === null || s2 === void 0 ? void 0 : s2.textContent : void 0, i2.message = this.getActionInfoMessage(e2, n3, i2.actor); + } else if (n2 && e2 in Uc.muc.new_nickname_messages) { + let o3; + n2 && e2 === "210" ? o3 = kc.e.getResourceFromJid(t2.getAttribute("from")) : n2 && e2 === "303" && (o3 = t2.querySelector('x[xmlns="'.concat(kc.e.NS.MUC_USER, '"] item')).getAttribute("nick")), this.save("nick", o3), i2.message = r2(Uc.muc.new_nickname_messages[e2], o3); + } + if (i2.message) { + if (e2 === "201" && this.messages.findWhere(i2)) + return; + if (e2 in Uc.muc.info_messages && this.messages.length && this.messages.pop().get("message") === i2.message) + return; + this.createMessage(i2); + } + } + }, createInfoMessages(e2) { + const t2 = mr()('x[xmlns="'.concat(kc.e.NS.MUC_USER, '"] status'), e2).map((e3) => e3.getAttribute("code")); + t2.includes("333") && t2.includes("307") && t2.splice(t2.indexOf("307"), 1); + const n2 = t2.includes("110"); + t2.forEach((t3) => this.createInfoMessage(t3, e2, n2)); + }, setDisconnectionMessage(e2, t2, n2) { + this.save({disconnection_message: e2, disconnection_reason: t2, disconnection_actor: n2}), this.session.save({connection_status: rl.ROOMSTATUS.DISCONNECTED}); + }, onNicknameClash(e2) { + const t2 = Uc.__; + if (Vc.settings.get("muc_nickname_from_jid")) { + const t3 = e2.getAttribute("from").split("/")[1]; + if (t3 === Uc.getDefaultMUCNickname()) + this.join(t3 + "-2"); + else { + const e3 = t3.lastIndexOf("-"), n2 = t3.substring(e3 + 1, t3.length); + this.join(t3.substring(0, e3 + 1) + String(Number(n2) + 1)); + } + } else + this.save({nickname_validation_message: t2("The nickname you chose is reserved or currently in use, please choose a different one.")}), this.session.save({connection_status: rl.ROOMSTATUS.NICKNAME_REQUIRED}); + }, onErrorPresence(e2) { + var t2; + const n2 = Uc.__, r2 = e2.querySelector("error"), i2 = r2.getAttribute("type"), o2 = (t2 = mr()('text[xmlns="'.concat(kc.e.NS.STANZAS, '"]'), r2).pop()) === null || t2 === void 0 ? void 0 : t2.textContent; + if (i2 === "modify") + this.handleModifyError(e2); + else if (i2 === "auth") { + if (mr()('not-authorized[xmlns="'.concat(kc.e.NS.STANZAS, '"]'), r2).length && (this.save({password_validation_message: o2 || n2("Password incorrect")}), this.session.save({connection_status: rl.ROOMSTATUS.PASSWORD_REQUIRED})), r2.querySelector("registration-required")) { + const e3 = n2("You are not on the member list of this groupchat."); + this.setDisconnectionMessage(e3, o2); + } else if (r2.querySelector("forbidden")) { + const e3 = n2("You have been banned from this groupchat."); + this.setDisconnectionMessage(e3, o2); + } + } else if (i2 === "cancel") { + if (r2.querySelector("not-allowed")) { + const e3 = n2("You are not allowed to create new groupchats."); + this.setDisconnectionMessage(e3, o2); + } else if (r2.querySelector("not-acceptable")) { + const e3 = n2("Your nickname doesn't conform to this groupchat's policies."); + this.setDisconnectionMessage(e3, o2); + } else if (mr()('gone[xmlns="'.concat(kc.e.NS.STANZAS, '"]'), r2).length) { + var s2; + const e3 = (s2 = mr()('gone[xmlns="'.concat(kc.e.NS.STANZAS, '"]'), r2).pop()) === null || s2 === void 0 ? void 0 : s2.textContent.replace(/^xmpp:/, "").replace(/\?join$/, ""); + this.save({moved_jid: e3, destroyed_reason: o2}), this.session.save({connection_status: rl.ROOMSTATUS.DESTROYED}); + } else if (r2.querySelector("conflict")) + this.onNicknameClash(e2); + else if (r2.querySelector("item-not-found")) { + const e3 = n2("This groupchat does not (yet) exist."); + this.setDisconnectionMessage(e3, o2); + } else if (r2.querySelector("service-unavailable")) { + const e3 = n2("This groupchat has reached its maximum number of participants."); + this.setDisconnectionMessage(e3, o2); + } else if (r2.querySelector("remote-server-not-found")) { + const e3 = n2("Remote server not found"), t3 = o2 ? n2('The explanation given is: "%1$s".', o2) : void 0; + this.setDisconnectionMessage(e3, t3); + } + } + }, onPresence(e2) { + if (e2.getAttribute("type") === "error") + return this.onErrorPresence(e2); + this.createInfoMessages(e2), e2.querySelector("status[code='110']") ? (this.onOwnPresence(e2), this.getOwnRole() !== "none" && this.session.get("connection_status") === rl.ROOMSTATUS.CONNECTING && this.session.save("connection_status", rl.ROOMSTATUS.CONNECTED)) : this.updateOccupantsOnPresence(e2); + }, onOwnPresence(e2) { + if (e2.getAttribute("type") !== "unavailable") { + const t2 = this.session.get("connection_status"); + t2 !== rl.ROOMSTATUS.ENTERED ? (this.session.save("connection_status", rl.ROOMSTATUS.ENTERED, {silent: true}), this.updateOccupantsOnPresence(e2), this.session.trigger("change:connection_status", this.session, t2)) : this.updateOccupantsOnPresence(e2); + } else + this.updateOccupantsOnPresence(e2); + if (e2.getAttribute("type") === "unavailable") + this.handleDisconnection(e2); + else { + if (e2.querySelector("status[code='201']")) + if (this.get("auto_configure")) + this.autoConfigureChatRoom().then(() => this.refreshDiscoInfo()); + else { + if (!Vc.settings.get("muc_instant_rooms")) + return void this.trigger("configurationNeeded"); + this.sendConfiguration().then(() => this.refreshDiscoInfo()); + } + else + this.features.get("fetched") || (this.getOwnAffiliation() === "owner" && this.get("auto_configure") ? this.autoConfigureChatRoom().then(() => this.refreshDiscoInfo()) : this.getDiscoInfo()); + } + this.session.save({connection_status: rl.ROOMSTATUS.ENTERED}); + }, isUserMentioned(e2) { + const t2 = this.get("nick"); + if (e2.get("references").length) { + return e2.get("references").filter((e3) => e3.type === "mention").map((e3) => e3.value).includes(t2); + } + return new RegExp("\\b".concat(t2, "\\b")).test(e2.get("message")); + }, handleUnreadMessage(e2) { + if ((e2 == null ? void 0 : e2.get("body")) && Kl.isNewMessage(e2)) + if (this.isHidden()) { + const t2 = {num_unread_general: this.get("num_unread_general") + 1}; + this.get("num_unread_general") === 0 && (t2.first_unread_id = e2.get("id")), this.isUserMentioned(e2) && (t2.num_unread = this.get("num_unread") + 1), this.save(t2); + } else + this.sendMarkerForMessage(e2); + }, clearUnreadMsgCounter() { + (this.get("num_unread_general") > 0 || this.get("num_unread") > 0) && this.sendMarkerForMessage(this.messages.last()), Kl.safeSave(this, {num_unread: 0, num_unread_general: 0}); + }}; + var cu = qo.extend({defaults: {hats: [], show: "offline", states: []}, initialize(e2) { + this.set(Object.assign({id: Kl.getUniqueId()}, e2)), this.on("change:image_hash", this.onAvatarChanged, this); + }, onAvatarChanged() { + const e2 = this.get("image_hash"), t2 = []; + this.get("jid") && t2.push(Uc.vcards.findWhere({jid: this.get("jid")})), t2.push(Uc.vcards.findWhere({jid: this.get("from")})), t2.filter((e3) => e3).forEach((t3) => { + e2 && t3.get("image_hash") !== e2 && Vc.vcard.update(t3, true); + }); + }, getDisplayName() { + return this.get("nick") || this.get("jid"); + }, isMember() { + return ["admin", "owner", "member"].includes(this.get("affiliation")); + }, isModerator() { + return ["admin", "owner"].includes(this.get("affiliation")) || this.get("role") === "moderator"; + }, isSelf() { + return this.get("states").includes("110"); + }}); + const lu = {moderator: 1, participant: 2, visitor: 3, none: 2}; + var uu = ra.extend({model: cu, comparator(e2, t2) { + const n2 = e2.get("role") || "none", r2 = t2.get("role") || "none"; + if (lu[n2] === lu[r2]) { + const n3 = e2.getDisplayName().toLowerCase(), r3 = t2.getDisplayName().toLowerCase(); + return n3 < r3 ? -1 : n3 > r3 ? 1 : 0; + } + return lu[n2] < lu[r2] ? -1 : 1; + }, getAutoFetchedAffiliationLists() { + const e2 = Vc.settings.get("muc_fetch_members"); + return Array.isArray(e2) ? e2 : e2 ? ["member", "admin", "owner"] : []; + }, async fetchMembers() { + const e2 = this.getAutoFetchedAffiliationLists(); + if (e2.length === 0) + return; + const t2 = await Promise.all(e2.map((e3) => this.chatroom.getAffiliationList(e3))), n2 = t2.reduce((e3, t3) => Kl.isErrorObject(t3) ? e3 : [...t3, ...e3], []), r2 = e2.filter((n3) => !Kl.isErrorObject(t2[e2.indexOf(n3)])), i2 = n2.map((e3) => e3.jid).filter((e3) => e3 !== void 0), o2 = n2.map((e3) => !e3.jid && e3.nick || void 0).filter((e3) => e3 !== void 0); + this.filter((e3) => r2.includes(e3.get("affiliation")) && !o2.includes(e3.get("nick")) && !i2.includes(e3.get("jid"))).forEach((e3) => { + e3.get("jid") !== Uc.bare_jid && (e3.get("show") === "offline" ? e3.destroy() : e3.save("affiliation", null)); + }), n2.forEach((e3) => { + const t3 = e3.jid ? this.findOccupant({jid: e3.jid}) : this.findOccupant({nick: e3.nick}); + t3 ? t3.save(e3) : this.create(e3); + }), Vc.trigger("membersFetched"); + }, findOccupant(e2) { + const t2 = kc.e.getBareJidFromJid(e2.jid); + return t2 && this.findWhere({jid: t2}) || this.findWhere({nick: e2.nick}); + }}), du = {rooms: {create(e2, t2 = {}) { + if (!(t2 = typeof t2 == "string" ? {nick: t2} : t2 || {}).nick && Vc.settings.get("muc_nickname_from_jid") && (t2.nick = kc.e.getNodeFromJid(Uc.bare_jid)), e2 === void 0) + throw new TypeError("rooms.create: You need to provide at least one JID"); + return typeof e2 == "string" ? Vc.rooms.get(Kl.getJIDFromURI(e2), t2, true) : e2.map((e3) => Vc.rooms.get(Kl.getJIDFromURI(e3), t2, true)); + }, async open(e2, t2 = {}, n2 = false) { + if (await Vc.waitUntil("chatBoxesFetched"), e2 === void 0) { + const e3 = "rooms.open: You need to provide at least one JID"; + throw zn.error(e3), new TypeError(e3); + } + if (typeof e2 == "string") { + const r2 = await Vc.rooms.get(e2, t2, true); + return r2 && r2.maybeShow(n2), r2; + } + { + const r2 = await Promise.all(e2.map((e3) => Vc.rooms.get(e3, t2, true))); + return r2.forEach((e3) => e3.maybeShow(n2)), r2; + } + }, async get(e2, t2 = {}, n2 = false) { + async function r2(e3) { + e3 = Kl.getJIDFromURI(e3); + let r3 = await Vc.chatboxes.get(e3); + return !r3 && n2 ? r3 = await Vc.chatboxes.create(e3, t2, Uc.ChatRoom) : (r3 = r3 && r3.get("type") === Uc.CHATROOMS_TYPE ? r3 : null, r3 && Object.keys(t2).length && r3.save(t2)), r3; + } + if (e2 === void 0) { + return (await Vc.chatboxes.get()).filter((e3) => e3.get("type") === Uc.CHATROOMS_TYPE); + } + return typeof e2 == "string" ? r2(e2) : Promise.all(e2.map((e3) => r2(e3))); + }}}; + /** + * @module converse-muc + * @copyright The Converse.js contributors + * @license Mozilla Public License (MPLv2) + * @description Implements the non-view logic for XEP-0045 Multi-User Chat + */ + const hu = ["moderator", "participant", "visitor"], fu = ["owner", "admin", "member", "outcast", "none"]; + rl.AFFILIATION_CHANGES = {OWNER: "owner", ADMIN: "admin", MEMBER: "member", EXADMIN: "exadmin", EXOWNER: "exowner", EXOUTCAST: "exoutcast", EXMEMBER: "exmember"}, rl.AFFILIATION_CHANGES_LIST = Object.values(rl.AFFILIATION_CHANGES), rl.MUC_TRAFFIC_STATES = {ENTERED: "entered", EXITED: "exited"}, rl.MUC_TRAFFIC_STATES_LIST = Object.values(rl.MUC_TRAFFIC_STATES), rl.MUC_ROLE_CHANGES = {OP: "op", DEOP: "deop", VOICE: "voice", MUTE: "mute"}, rl.MUC_ROLE_CHANGES_LIST = Object.values(rl.MUC_ROLE_CHANGES), rl.MUC_INFO_CODES = {visibility_changes: ["100", "102", "103", "172", "173", "174"], self: ["110"], non_privacy_changes: ["104", "201"], muc_logging_changes: ["170", "171"], nickname_changes: ["210", "303"], disconnect_messages: ["301", "307", "321", "322", "332", "333"], affiliation_changes: [...rl.AFFILIATION_CHANGES_LIST], join_leave_events: [...rl.MUC_TRAFFIC_STATES_LIST], role_changes: [...rl.MUC_ROLE_CHANGES_LIST]}; + const {Strophe: pu, sizzle: gu} = rl.env; + function mu() { + return Uc.chatboxes.filter((e2) => e2.get("type") === Uc.CHATROOMS_TYPE).forEach((e2) => e2.session.save({connection_status: rl.ROOMSTATUS.DISCONNECTED})); + } + async function vu(e2) { + if (e2.state === "visible" && Vc.connection.connected()) { + (await Vc.rooms.get()).forEach((e3) => e3.rejoinIfNecessary()); + } + } + async function _u(e2) { + if (!Kl.isValidMUCJID(e2)) + return zn.warn('invalid jid "'.concat(e2, '" provided in url fragment')); + await Vc.waitUntil("roomsAutoJoined"), Vc.settings.get("allow_bookmarks") && await Vc.waitUntil("bookmarksInitialized"), Vc.rooms.open(e2); + } + async function bu() { + await Promise.all(Vc.settings.get("auto_join_rooms").map((e2) => typeof e2 == "string" ? Uc.chatboxes.where({jid: e2}).length ? Promise.resolve() : Vc.rooms.open(e2) : N(e2) ? Vc.rooms.open(e2.jid, {...e2}) : (zn.error('Invalid muc criteria specified for "auto_join_rooms"'), Promise.resolve()))), Vc.trigger("roomsAutoJoined"); + } + pu.addNamespace("MUC_ADMIN", pu.NS.MUC + "#admin"), pu.addNamespace("MUC_OWNER", pu.NS.MUC + "#owner"), pu.addNamespace("MUC_REGISTER", "jabber:iq:register"), pu.addNamespace("MUC_ROOMCONF", pu.NS.MUC + "#roomconfig"), pu.addNamespace("MUC_USER", pu.NS.MUC + "#user"), pu.addNamespace("MUC_HATS", "xmpp:prosody.im/protocol/hats:1"), rl.MUC_NICK_CHANGED_CODE = "303", rl.ROOM_FEATURES = ["passwordprotected", "unsecured", "hidden", "publicroom", "membersonly", "open", "persistent", "temporary", "nonanonymous", "semianonymous", "moderated", "unmoderated", "mam_enabled"], rl.ROOMSTATUS = {CONNECTED: 0, CONNECTING: 1, NICKNAME_REQUIRED: 2, PASSWORD_REQUIRED: 3, DISCONNECTED: 4, ENTERED: 5, DESTROYED: 6}, rl.plugins.add("converse-muc", {dependencies: ["converse-chatboxes", "converse-chat", "converse-disco", "converse-controlbox"], overrides: {ChatBoxes: {model(e2, t2) { + const {_converse: n2} = this.__super__; + return e2 && e2.type == n2.CHATROOMS_TYPE ? new n2.ChatRoom(e2, t2) : this.__super__.model.apply(this, arguments); + }}}, initialize() { + const {__: e2, ___: t2} = Uc; + if (Vc.settings.extend({allow_muc: true, allow_muc_invitations: true, auto_join_on_invite: false, auto_join_rooms: [], auto_register_muc_nickname: false, hide_muc_participants: false, locked_muc_domain: false, muc_domain: void 0, muc_fetch_members: true, muc_history_max_stanzas: void 0, muc_instant_rooms: true, muc_nickname_from_jid: false, muc_send_probes: false, muc_show_info_messages: [...rl.MUC_INFO_CODES.visibility_changes, ...rl.MUC_INFO_CODES.self, ...rl.MUC_INFO_CODES.non_privacy_changes, ...rl.MUC_INFO_CODES.muc_logging_changes, ...rl.MUC_INFO_CODES.nickname_changes, ...rl.MUC_INFO_CODES.disconnect_messages, ...rl.MUC_INFO_CODES.affiliation_changes, ...rl.MUC_INFO_CODES.join_leave_events, ...rl.MUC_INFO_CODES.role_changes], muc_show_logs_before_join: false}), Vc.promises.add(["roomsAutoJoined"]), Vc.settings.get("locked_muc_domain") && typeof Vc.settings.get("muc_domain") != "string") + throw new Error("Config Error: it makes no sense to set locked_muc_domain to true when muc_domain is not set"); + if (rl.env.muc_utils = Vl, Object.assign(Vc, du), Uc.muc = {info_messages: {100: e2("This groupchat is not anonymous"), 102: e2("This groupchat now shows unavailable members"), 103: e2("This groupchat does not show unavailable members"), 104: e2("The groupchat configuration has changed"), 170: e2("Groupchat logging is now enabled"), 171: e2("Groupchat logging is now disabled"), 172: e2("This groupchat is now no longer anonymous"), 173: e2("This groupchat is now semi-anonymous"), 174: e2("This groupchat is now fully-anonymous"), 201: e2("A new groupchat has been created")}, new_nickname_messages: {210: t2("Your nickname has been automatically set to %1$s"), 303: t2("Your nickname has been changed to %1$s")}, disconnect_messages: {301: e2("You have been banned from this groupchat"), 333: e2("You have exited this groupchat due to a technical problem"), 307: e2("You have been kicked from this groupchat"), 321: e2("You have been removed from this groupchat because of an affiliation change"), 322: e2("You have been removed from this groupchat because the groupchat has changed to members-only and you're not a member"), 332: e2("You have been removed from this groupchat because the service hosting it is being shut down")}}, Uc.isInfoVisible = function(e3) { + return !!Vc.settings.get("muc_show_info_messages").includes(e3); + }, Uc.router.route("converse/room?jid=:jid", _u), Uc.ChatRoom = Uc.ChatBox.extend(au), Uc.ChatRoomMessage = Uc.Message.extend($l), Uc.ChatRoomOccupants = uu, Uc.ChatRoomOccupant = cu, Uc.getDefaultMUCNickname = function() { + if (!Uc.xmppstatus) + throw new Error("Can't call _converse.getDefaultMUCNickname before the statusInitialized has been fired."); + const e3 = Uc.xmppstatus.getNickname(); + return e3 || (Vc.settings.get("muc_nickname_from_jid") ? pu.unescapeNode(pu.getNodeFromJid(Uc.bare_jid)) : void 0); + }, Uc.ChatRoomMessages = ra.extend({model: Uc.ChatRoomMessage, comparator: "time"}), Uc.RoomsPanelModel = qo.extend({defaults: function() { + return {muc_domain: Vc.settings.get("muc_domain"), nick: Uc.getDefaultMUCNickname()}; + }, setDomain(e3) { + Vc.settings.get("locked_muc_domain") || this.save("muc_domain", pu.getDomainFromJid(e3)); + }}), Uc.onDirectMUCInvitation = async function(t3) { + const n2 = gu('x[xmlns="jabber:x:conference"]', t3).pop(), r2 = pu.getBareJidFromJid(t3.getAttribute("from")), i2 = n2.getAttribute("jid"), o2 = n2.getAttribute("reason"); + let s2; + if (Vc.settings.get("auto_join_on_invite")) + s2 = true; + else { + let t4 = Uc.roster.get(r2); + t4 = t4 ? t4.getDisplayName() : r2, s2 = o2 ? confirm(e2('%1$s has invited you to join a groupchat: %2$s, and left the following reason: "%3$s"', t4, i2, o2)) : confirm(e2("%1$s has invited you to join a groupchat: %2$s", t4, i2)); + } + if (s2 === true) { + (await async function(e3, t4) { + t4.type = Uc.CHATROOMS_TYPE, t4.id = e3; + const n3 = await Vc.rooms.get(e3, t4, true); + return n3.maybeShow(true), n3; + }(i2, {password: n2.getAttribute("password")})).session.get("connection_status") === rl.ROOMSTATUS.DISCONNECTED && Uc.chatboxes.get(i2).rejoin(); + } + }, Vc.settings.get("allow_muc_invitations")) { + const e3 = function() { + Uc.connection.addHandler((e4) => (Uc.onDirectMUCInvitation(e4), true), "jabber:x:conference", "message"); + }; + Vc.listen.on("connected", e3), Vc.listen.on("reconnected", e3); + } + Vc.listen.on("beforeTearDown", () => { + Uc.chatboxes.where({type: Uc.CHATROOMS_TYPE}).forEach((e3) => Kl.safeSave(e3.session, {connection_status: rl.ROOMSTATUS.DISCONNECTED})); + }), Vc.listen.on("windowStateChanged", vu), Vc.listen.on("addClientFeatures", () => { + Vc.settings.get("allow_muc") && Vc.disco.own.features.add(pu.NS.MUC), Vc.settings.get("allow_muc_invitations") && Vc.disco.own.features.add("jabber:x:conference"); + }), Vc.listen.on("chatBoxesFetched", bu), Vc.listen.on("beforeResourceBinding", () => { + Uc.connection.addHandler((e3) => { + const t3 = pu.getBareJidFromJid(e3.getAttribute("from")); + return Uc.chatboxes.get(t3) || Vc.waitUntil("chatBoxesFetched").then(async () => { + const n2 = Uc.chatboxes.get(t3); + n2 && (await n2.initialized, n2.message_handler.run(e3)); + }), true; + }, null, "message", "groupchat"); + }), Vc.listen.on("disconnected", mu), Vc.listen.on("statusInitialized", () => { + window.addEventListener(Uc.unloadevent, () => { + !Vc.connection.isType("websocket") || Vc.settings.get("enable_smacks") && Uc.session.get("smacks_stream_id") || mu(); + }); + }); + }}); + /** + * @module converse-bookmarks + * @description + * Converse.js plugin which adds views for bookmarks specified in XEP-0048. + * @copyright 2020, the Converse.js contributors + * @license Mozilla Public License (MPLv2) + */ + const {Strophe: yu, $iq: wu, sizzle: Su} = rl.env, xu = rl.env.utils; + function Eu(e2) { + return Su('event[xmlns="'.concat(yu.NS.PUBSUB, '#event"] items[node="').concat(yu.NS.BOOKMARKS, '"]'), e2).length && Vc.waitUntil("bookmarksInitialized").then(() => Uc.bookmarks.createBookmarksFromStanza(e2)).catch((e3) => zn.fatal(e3)), true; + } + yu.addNamespace("BOOKMARKS", "storage:bookmarks"), rl.plugins.add("converse-bookmarks", {dependencies: ["converse-chatboxes", "converse-muc"], overrides: {ChatRoom: {getDisplayName() { + const {_converse: e2} = this.__super__; + if (this.get("bookmarked") && e2.bookmarks) { + const t2 = e2.bookmarks.findWhere({jid: this.get("jid")}); + if (t2) + return t2.get("name"); + } + return this.__super__.getDisplayName.apply(this, arguments); + }, getAndPersistNickname(e2) { + const {_converse: t2} = this.__super__; + return e2 = e2 || t2.getNicknameFromBookmark(this.get("jid")), this.__super__.getAndPersistNickname.call(this, e2); + }}}, initialize() { + const {__: e2} = Uc; + Vc.settings.extend({allow_bookmarks: true, allow_public_bookmarks: false, muc_respect_autojoin: true}), Vc.promises.add("bookmarksInitialized"), Uc.getNicknameFromBookmark = function(e3) { + if (!Uc.bookmarks || !Vc.settings.get("allow_bookmarks")) + return null; + const t3 = Uc.bookmarks.findWhere({jid: e3}); + return t3 ? t3.get("nick") : void 0; + }, Uc.Bookmark = qo.extend({idAttribute: "jid", getDisplayName() { + return yu.xmlunescape(this.get("name")); + }}), Uc.Bookmarks = ra.extend({model: Uc.Bookmark, comparator: (e3) => e3.get("name").toLowerCase(), initialize() { + this.on("add", (e4) => this.openBookmarkedRoom(e4).then((e5) => this.markRoomAsBookmarked(e5)).catch((e5) => zn.fatal(e5))), this.on("remove", this.markRoomAsUnbookmarked, this), this.on("remove", this.sendBookmarkStanza, this); + const e3 = "converse.room-bookmarks".concat(Uc.bare_jid); + this.fetched_flag = e3 + "fetched", this.browserStorage = Uc.createStore(e3); + }, async openBookmarkedRoom(e3) { + if (Vc.settings.get("muc_respect_autojoin") && e3.get("autojoin")) { + (await Vc.rooms.create(e3.get("jid"), {nick: e3.get("nick")})).maybeShow(); + } + return e3; + }, fetchBookmarks() { + const e3 = xu.getResolveablePromise(); + return window.sessionStorage.getItem(this.fetched_flag) ? this.fetch({success: () => e3.resolve(), error: () => e3.resolve()}) : this.fetchBookmarksFromServer(e3), e3; + }, createBookmark(e3) { + this.create(e3), this.sendBookmarkStanza().catch((t3) => this.onBookmarkError(t3, e3)); + }, sendBookmarkStanza() { + const e3 = wu({type: "set", from: Uc.connection.jid}).c("pubsub", {xmlns: yu.NS.PUBSUB}).c("publish", {node: yu.NS.BOOKMARKS}).c("item", {id: "current"}).c("storage", {xmlns: yu.NS.BOOKMARKS}); + return this.forEach((t3) => { + e3.c("conference", {name: t3.get("name"), autojoin: t3.get("autojoin"), jid: t3.get("jid")}).c("nick").t(t3.get("nick")).up().up(); + }), e3.up().up().up(), e3.c("publish-options").c("x", {xmlns: yu.NS.XFORM, type: "submit"}).c("field", {var: "FORM_TYPE", type: "hidden"}).c("value").t("http://jabber.org/protocol/pubsub#publish-options").up().up().c("field", {var: "pubsub#persist_items"}).c("value").t("true").up().up().c("field", {var: "pubsub#access_model"}).c("value").t("whitelist"), Vc.sendIQ(e3); + }, onBookmarkError(t3, n2) { + zn.error("Error while trying to add bookmark"), zn.error(t3), Vc.alert("error", e2("Error"), [e2("Sorry, something went wrong while trying to save your bookmark.")]), this.findWhere({jid: n2.jid}).destroy(); + }, fetchBookmarksFromServer(e3) { + const t3 = wu({from: Uc.connection.jid, type: "get"}).c("pubsub", {xmlns: yu.NS.PUBSUB}).c("items", {node: yu.NS.BOOKMARKS}); + Vc.sendIQ(t3).then((t4) => this.onBookmarksReceived(e3, t4)).catch((t4) => this.onBookmarksReceivedError(e3, t4)); + }, markRoomAsBookmarked(e3) { + const t3 = Uc.chatboxes.get(e3.get("jid")); + t3 !== void 0 && t3.save("bookmarked", true); + }, markRoomAsUnbookmarked(e3) { + const t3 = Uc.chatboxes.get(e3.get("jid")); + t3 !== void 0 && t3.save("bookmarked", false); + }, createBookmarksFromStanza(e3) { + const t3 = yu.NS.BOOKMARKS, n2 = 'items[node="'.concat(t3, '"] item storage[xmlns="').concat(t3, '"] conference'); + Su(n2, e3).forEach((e4) => { + var t4; + const n3 = e4.getAttribute("jid"), r2 = this.get(n3), i2 = {jid: n3, name: e4.getAttribute("name") || n3, autojoin: e4.getAttribute("autojoin") === "true", nick: ((t4 = e4.querySelector("nick")) === null || t4 === void 0 ? void 0 : t4.textContent) || ""}; + r2 ? r2.save(i2) : this.create(i2); + }); + }, onBookmarksReceived(e3, t3) { + if (this.createBookmarksFromStanza(t3), window.sessionStorage.setItem(this.fetched_flag, true), e3 !== void 0) + return e3.resolve(); + }, onBookmarksReceivedError(t3, n2) { + if (n2 === null) + zn.error("Error: timeout while fetching bookmarks"), Vc.alert("error", e2("Timeout Error"), [e2("The server did not return your bookmarks within the allowed time. You can reload the page to request them again.")]); + else { + if (t3) + return n2.querySelector('error[type="cancel"] item-not-found') ? (window.sessionStorage.setItem(this.fetched_flag, true), t3.resolve()) : (zn.error("Error while fetching bookmarks"), zn.error(n2), t3.reject(new Error("Could not fetch bookmarks"))); + zn.error("Error while fetching bookmarks"), zn.error(n2); + } + }, getUnopenedBookmarks() { + return this.filter((e3) => !Uc.chatboxes.get(e3.get("jid"))); + }}), Uc.BookmarksList = qo.extend({defaults: {"toggle-state": Uc.OPENED}}), Uc.checkBookmarksSupport = async function() { + const e3 = await Vc.disco.getIdentity("pubsub", "pep", Uc.bare_jid); + return Uc.allow_public_bookmarks ? !!e3 : Vc.disco.supports(yu.NS.PUBSUB + "#publish-options", Uc.bare_jid); + }; + const t2 = async function() { + Vc.settings.get("allow_bookmarks") && await Uc.checkBookmarksSupport() && (Uc.bookmarks = new Uc.Bookmarks(), await Uc.bookmarks.fetchBookmarks(), Vc.trigger("bookmarksInitialized")); + }; + Vc.listen.on("addClientFeatures", () => { + Vc.settings.get("allow_bookmarks") && Vc.disco.own.features.add(yu.NS.BOOKMARKS + "+notify"); + }), Vc.listen.on("clearSession", () => { + Uc.bookmarks !== void 0 && (Uc.bookmarks.clearStore({silent: true}), window.sessionStorage.removeItem(Uc.bookmarks.fetched_flag), delete Uc.bookmarks); + }), Vc.listen.on("reconnected", t2), Vc.listen.on("connected", async () => { + const {connection: e3} = Uc; + e3.addHandler(Eu, null, "message", "headline", null, Uc.bare_jid), await Promise.all([Vc.waitUntil("chatBoxesFetched")]), t2(); + }); + }}); + n(154); + /** + * @module converse-bosh + * @copyright The Converse.js contributors + * @license Mozilla Public License (MPLv2) + * @description Converse.js plugin which add support for XEP-0206: XMPP Over BOSH + */ + const {Strophe: Au} = rl.env; + rl.plugins.add("converse-bosh", {enabled: () => !Uc.api.settings.get("blacklisted_plugins").includes("converse-bosh"), initialize() { + Vc.settings.extend({bosh_service_url: void 0, prebind_url: null}), Uc.startNewPreboundBOSHSession = function() { + if (!Vc.settings.get("prebind_url")) + throw new Error("startNewPreboundBOSHSession: If you use prebind then you MUST supply a prebind_url"); + const e2 = new XMLHttpRequest(); + e2.open("GET", Vc.settings.get("prebind_url"), true), e2.setRequestHeader("Accept", "application/json, text/javascript"), e2.onload = async function() { + if (e2.status >= 200 && e2.status < 400) { + const t2 = JSON.parse(e2.responseText), n2 = await Uc.setUserJID(t2.jid); + Uc.connection.attach(n2, t2.sid, t2.rid, Uc.connection.onConnectStatusChanged); + } else + e2.onerror(); + }, e2.onerror = function() { + delete Uc.connection, Vc.trigger("noResumeableBOSHSession", Uc); + }, e2.send(); + }, Uc.restoreBOSHSession = async function() { + const e2 = (await async function() { + const e3 = "converse.bosh-session"; + if (Uc.bosh_session || (Uc.bosh_session = new qo({id: e3}), Uc.bosh_session.browserStorage = Uc.createStore(e3, "session"), await new Promise((e4) => Uc.bosh_session.fetch({success: e4, error: e4}))), Uc.jid) { + if (Uc.bosh_session.get("jid") !== Uc.jid) { + const e4 = await Uc.setUserJID(Uc.jid); + Uc.bosh_session.clear({silent: true}), Uc.bosh_session.save({jid: e4}); + } + } else { + const e4 = Uc.bosh_session.get("jid"); + e4 && await Uc.setUserJID(e4); + } + return Uc.bosh_session; + }()).get("jid"); + if (e2 && Uc.connection._proto instanceof Au.Bosh) + try { + return Uc.connection.restore(e2, Uc.connection.onConnectStatusChanged), true; + } catch (t2) { + return !Uc.isTestEnv() && zn.warn("Could not restore session for jid: " + e2 + " Error message: " + t2.message), false; + } + return false; + }, Vc.listen.on("clearSession", () => { + if (Uc.bosh_session === void 0) { + const e2 = "converse.bosh-session"; + sessionStorage.removeItem(e2), sessionStorage.removeItem("".concat(e2, "-").concat(e2)); + } else + Uc.bosh_session.destroy(), delete Uc.bosh_session; + }), Vc.listen.on("setUserJID", () => { + Uc.bosh_session !== void 0 && Uc.bosh_session.save({jid: Uc.jid}); + }), Vc.listen.on("addClientFeatures", () => Vc.disco.own.features.add(Au.NS.BOSH)), Object.assign(Vc, {tokens: {get: (e2) => Uc.connection === void 0 ? null : e2.toLowerCase() === "rid" ? Uc.connection.rid || Uc.connection._proto.rid : e2.toLowerCase() === "sid" ? Uc.connection.sid || Uc.connection._proto.sid : void 0}}); + }}); + var Cu = n(7); + /** + * @module converse-caps + * @copyright 2020, the Converse.js contributors + * @license Mozilla Public License (MPLv2) + */ + const {Strophe: ju, $build: Tu} = rl.env; + function Ou(e2, t2) { + return e2.sort((e3, n2) => e3[t2] > n2[t2] ? -1 : 1); + } + function ku(e2) { + const t2 = e2.api.disco.own.identities.get(), n2 = e2.api.disco.own.features.get(); + t2.length > 1 && (Ou(t2, "category"), Ou(t2, "type"), Ou(t2, "lang")); + let r2 = t2.reduce((e3, t3) => { + var n3; + return "".concat(e3).concat(t3.category, "/").concat(t3.type, "/").concat((n3 = t3 == null ? void 0 : t3.lang) !== null && n3 !== void 0 ? n3 : "", "/").concat(t3.name, "<"); + }, ""); + return n2.sort(), r2 = n2.reduce((e3, t3) => "".concat(e3).concat(t3, "<"), r2), Cu.a.b64_sha1(r2); + } + /** + * @module converse-carbons + * @copyright The Converse.js contributors + * @license Mozilla Public License (MPLv2) + * @description Implements support for XEP-0280 Message Carbons + */ + function Nu(e2) { + var t2, n2; + e2 && ((n2 = Uc.session) === null || n2 === void 0 || n2.set({carbons_enabled: false})); + if (!Vc.settings.get("message_carbons") || ((t2 = Uc.session) === null || t2 === void 0 ? void 0 : t2.get("carbons_enabled"))) + return; + const r2 = new kc.e.Builder("iq", {from: Uc.connection.jid, id: "enablecarbons", type: "set"}).c("enable", {xmlns: kc.e.NS.CARBONS}); + Uc.connection.addHandler((e3) => { + e3.querySelectorAll("error").length > 0 ? zn.warn("An error occurred while trying to enable message carbons.") : (Uc.session.set({carbons_enabled: true}), zn.debug("Message carbons have been enabled.")), Uc.session.save(); + }, null, "iq", null, "enablecarbons"), Uc.connection.send(r2); + } + ju.addNamespace("CAPS", "http://jabber.org/protocol/caps"), rl.plugins.add("converse-caps", {overrides: {XMPPStatus: {constructPresence() { + const e2 = this.__super__.constructPresence.apply(this, arguments); + var t2; + return e2.root().cnode((t2 = this.__super__._converse, Tu("c", {xmlns: ju.NS.CAPS, hash: "sha-1", node: "https://conversejs.org", ver: ku(t2)}).nodeTree)), e2; + }}}}), rl.plugins.add("converse-carbons", {initialize() { + Vc.settings.extend({message_carbons: true}), Vc.listen.on("afterResourceBinding", Nu); + }}); + /** + * @module converse-chatboxes + * @copyright 2020, the Converse.js contributors + * @license Mozilla Public License (MPLv2) + */ + const {Strophe: Iu} = rl.env; + Iu.addNamespace("MESSAGE_CORRECT", "urn:xmpp:message-correct:0"), Iu.addNamespace("RECEIPTS", "urn:xmpp:receipts"), Iu.addNamespace("REFERENCE", "urn:xmpp:reference:0"), Iu.addNamespace("MARKERS", "urn:xmpp:chat-markers:0"), rl.plugins.add("converse-chatboxes", {dependencies: ["converse-emoji", "converse-roster", "converse-vcard"], initialize() { + async function e2(e3, t2, n2) { + let r2; + e3 = Iu.getBareJidFromJid(e3.toLowerCase()), Object.assign(t2, {jid: e3, id: e3}); + try { + r2 = new n2(t2, {collection: Uc.chatboxes}); + } catch (e4) { + return zn.error(e4), null; + } + return await r2.initialized, r2.isValid() ? (Uc.chatboxes.add(r2), r2) : (r2.destroy(), null); + } + Vc.promises.add(["chatBoxesFetched", "chatBoxesInitialized", "privateChatsAutoJoined"]), Uc.ChatBoxes = ra.extend({comparator: "time_opened", model: (e3, t2) => new Uc.ChatBox(e3, t2), onChatBoxesFetched(e3) { + e3.filter((e4) => !e4.isValid()).forEach((e4) => e4.destroy()), Vc.trigger("chatBoxesFetched"); + }, onConnected(e3) { + e3 || (this.browserStorage = Uc.createStore("converse.chatboxes-".concat(Uc.bare_jid)), this.fetch({add: true, success: (e4) => this.onChatBoxesFetched(e4)})); + }}), Vc.listen.on("addClientFeatures", () => { + Vc.disco.own.features.add(Iu.NS.MESSAGE_CORRECT), Vc.disco.own.features.add(Iu.NS.HTTPUPLOAD), Vc.disco.own.features.add(Iu.NS.OUTOFBAND); + }), Vc.listen.on("pluginsInitialized", () => { + Uc.chatboxes = new Uc.ChatBoxes(), Vc.trigger("chatBoxesInitialized"); + }), Vc.listen.on("presencesInitialized", (e3) => Uc.chatboxes.onConnected(e3)), Vc.listen.on("reconnected", () => Uc.chatboxes.forEach((e3) => e3.onReconnection())), Object.assign(Vc, {chatboxes: {create: async (t2 = [], n2 = {}, r2) => (await Vc.waitUntil("chatBoxesFetched"), typeof t2 == "string" ? e2(t2, n2, r2) : Promise.all(t2.map((t3) => e2(t3, n2, r2)))), get: async (e3) => (await Vc.waitUntil("chatBoxesFetched"), e3 === void 0 ? Uc.chatboxes.models : typeof e3 == "string" ? Uc.chatboxes.get(e3.toLowerCase()) : (e3 = e3.map((e4) => e4.toLowerCase()), Uc.chatboxes.models.filter((t2) => e3.includes(t2.get("jid")))))}}); + }}), rl.plugins.add("converse-headlines", {dependencies: ["converse-chat"], overrides: {ChatBoxes: {model(e2, t2) { + const {_converse: n2} = this.__super__; + return e2.type == n2.HEADLINES_TYPE ? new n2.HeadlinesBox(e2, t2) : this.__super__.model.apply(this, arguments); + }}}, initialize() { + function e2() { + Uc.connection.addHandler((e3) => async function(e4) { + if (ps.isHeadline(e4) || ps.isServerMessage(e4)) { + const t2 = e4.getAttribute("from"); + if (t2.includes("@") && !Uc.roster.get(t2) && !Vc.settings.get("allow_non_roster_messaging")) + return; + if (e4.querySelector("body") === null) + return; + const n2 = Uc.chatboxes.create({id: t2, jid: t2, type: Uc.HEADLINES_TYPE, from: t2}), r2 = await ps.parseMessage(e4, Uc); + await n2.createMessage(r2), Vc.trigger("message", {chatbox: n2, stanza: e4, attrs: r2}); + } + }(e3) || true, null, "message"); + } + Uc.HeadlinesBox = Uc.ChatBox.extend({defaults() { + return {bookmarked: false, hidden: ["mobile", "fullscreen"].includes(Vc.settings.get("view_mode")), message_type: "headline", num_unread: 0, time_opened: this.get("time_opened") || new Date().getTime(), type: Uc.HEADLINES_TYPE}; + }, async initialize() { + this.set({box_id: "box-".concat(this.get("jid"))}), this.initMessages(), await this.fetchMessages(), Vc.trigger("headlinesBoxInitialized", this); + }}), Vc.listen.on("connected", e2), Vc.listen.on("reconnected", e2), Object.assign(Vc, {headlines: {async get(e3, t2 = {}, n2 = false) { + async function r2(e4) { + let r3 = await Vc.chatboxes.get(e4); + return !r3 && n2 ? r3 = await Vc.chatboxes.create(e4, t2, Uc.HeadlinesBox) : (r3 = r3 && r3.get("type") === Uc.HEADLINES_TYPE ? r3 : null, r3 && Object.keys(t2).length && r3.save(t2)), r3; + } + if (e3 === void 0) { + return (await Vc.chatboxes.get()).filter((e4) => e4.get("type") === Uc.HEADLINES_TYPE); + } + return typeof e3 == "string" ? r2(e3) : Promise.all(e3.map((e4) => r2(e4))); + }}}); + }}); + /** + * @module converse-rsm + * @copyright The Converse.js contributors + * @license Mozilla Public License (MPLv2) + * @description XEP-0059 Result Set Management + * Some code taken from the Strophe RSM plugin, licensed under the MIT License + * Copyright 2006-2017 Strophe (https://github.com/strophe/strophejs) + */ + const {Strophe: Mu, $build: Ru} = rl.env; + Mu.addNamespace("RSM", "http://jabber.org/protocol/rsm"); + const Du = ["after", "before", "index", "max"], Pu = (e2) => Number(e2), Lu = (e2) => e2.toString(), zu = {after: Lu, before: Lu, count: Pu, first: Lu, index: Pu, last: Lu, max: Pu}, Fu = (e2) => e2 === void 0, Bu = Object.keys(zu); + class qu { + static getQueryParameters(e2 = {}) { + return Bo(e2, Du); + } + static parseXMLResult(e2) { + const t2 = {}; + for (var n2 = 0; n2 < Bu.length; n2++) { + const r2 = Bu[n2], i2 = e2.getElementsByTagName(r2)[0]; + Fu(i2) || i2 === null || (t2[r2] = zu[r2](Mu.getText(i2)), r2 == "first" && (t2.index = zu.index(i2.getAttribute("index")))); + } + return t2; + } + constructor(e2 = {}) { + this.query = qu.getQueryParameters(e2), this.result = e2.xml ? qu.parseXMLResult(e2.xml) : {}; + } + toXML() { + const e2 = Ru("set", {xmlns: Mu.NS.RSM}); + return Du.reduce((e3, t2) => Fu(this.query[t2]) ? e3 : e3.c(t2).t((this.query[t2] || "").toString()).up(), e2).tree(); + } + next(e2, t2) { + const n2 = Object.assign({}, this.query, {after: this.result.last, before: t2, max: e2}); + return new qu(n2); + } + previous(e2, t2) { + const n2 = Object.assign({}, this.query, {after: t2, before: this.result.first, max: e2}); + return new qu(n2); + } + } + Uc.RSM_ATTRIBUTES = Bu, Uc.RSM = qu; + /** + * @module converse-mam + * @description XEP-0313 Message Archive Management + * @copyright 2020, the Converse.js contributors + * @license Mozilla Public License (MPLv2) + */ + const {Strophe: Hu, $iq: Uu, dayjs: $u} = rl.env, {NS: Wu} = Hu, Gu = rl.env.utils, Vu = {fetchNewestMessages() { + if (this.disable_mam) + return; + const e2 = this.getMostRecentMessage(); + if (e2 && !Vc.settings.get("clear_messages_on_reconnection")) { + const t2 = e2.get("stanza_id ".concat(this.get("jid"))); + t2 ? this.fetchArchivedMessages({after: t2}, "forwards") : this.fetchArchivedMessages({start: e2.get("time")}, "forwards"); + } else + this.fetchArchivedMessages({before: ""}); + }, async handleMAMResult(e2, t2, n2, r2) { + await Vc.emojis.initialize(); + const i2 = this.get("type") === Uc.CHATROOMS_TYPE; + e2.messages = e2.messages.map((e3) => i2 ? ps.parseMUCMessage(e3, this, Uc) : ps.parseMessage(e3, Uc)); + const o2 = {query: t2, chatbox: this, messages: e2.messages}; + if (await Vc.trigger("MAMResult", o2, {synchronous: true}), e2.messages.forEach((e3) => this.queueMessage(e3)), e2.error) { + const t3 = e2.error.retry_event_id = Gu.getUniqueId(); + Vc.listen.once(t3, () => this.fetchArchivedMessages(n2, r2)), this.createMessageFromError(e2.error); + } + }, async fetchArchivedMessages(e2 = {}, t2) { + if (this.disable_mam) + return; + const n2 = this.get("type") === Uc.CHATROOMS_TYPE, r2 = n2 ? this.get("jid") : Uc.bare_jid; + if (!await Vc.disco.supports(Wu.MAM, r2)) + return; + const i2 = Vc.settings.get("archived_messages_page_size"), o2 = Object.assign({groupchat: n2, max: i2, with: this.get("jid")}, e2), s2 = await Vc.archive.query(o2); + return await this.handleMAMResult(s2, o2, e2, t2), t2 && s2.rsm && !s2.complete ? (t2 === "forwards" ? e2 = s2.rsm.next(i2, e2.before).query : t2 === "backwards" && (e2 = s2.rsm.previous(i2, e2.after).query), this.fetchArchivedMessages(e2, t2)) : void 0; + }}; + rl.plugins.add("converse-mam", {dependencies: ["converse-disco", "converse-muc"], initialize() { + function e2(e3) { + Vc.settings.get("muc_show_logs_before_join") && e3.features.get("mam_enabled") && !e3.get("prejoin_mam_fetched") && (e3.fetchNewestMessages(), e3.save({prejoin_mam_fetched: true})); + } + Vc.settings.extend({archived_messages_page_size: "50", message_archiving: void 0, message_archiving_timeout: 2e4}), Object.assign(Uc.ChatBox.prototype, Vu), Uc.onMAMError = function(e3) { + (e3 == null ? void 0 : e3.querySelectorAll("feature-not-implemented").length) ? zn.warn("Message Archive Management (XEP-0313) not supported by ".concat(e3.getAttribute("from"))) : (zn.error("Error while trying to set archiving preferences for ".concat(e3.getAttribute("from"), ".")), zn.error(e3)); + }, Uc.onMAMPreferences = function(e3, t2) { + const n2 = mr()('prefs[xmlns="'.concat(Wu.MAM, '"]'), e3).pop(); + if (n2.getAttribute("default") !== Vc.settings.get("message_archiving")) { + const e4 = Uu({type: "set"}).c("prefs", {xmlns: Wu.MAM, default: Vc.settings.get("message_archiving")}); + Array.from(n2.children).forEach((t3) => e4.cnode(t3).up()), Vc.sendIQ(e4).then(() => t2.save({preferences: {default: Vc.settings.get("message_archiving")}})).catch(Uc.onMAMError); + } else + t2.save({preferences: {default: Vc.settings.get("message_archiving")}}); + }, Vc.listen.on("addClientFeatures", () => Vc.disco.own.features.add(Wu.MAM)), Vc.listen.on("serviceDiscovered", function(e3) { + const t2 = e3.get("preferences") || {}; + e3.get("var") === Wu.MAM && Vc.settings.get("message_archiving") !== void 0 && t2.default !== Vc.settings.get("message_archiving") && Vc.sendIQ(Uu({type: "get"}).c("prefs", {xmlns: Wu.MAM})).then((t3) => Uc.onMAMPreferences(t3, e3)).catch(Uc.onMAMError); + }), Vc.listen.on("chatRoomViewInitialized", (t2) => { + Vc.settings.get("muc_show_logs_before_join") && (e2(t2.model), t2.model.features.on("change:mam_enabled", () => e2(t2.model))); + }), Vc.listen.on("enteredNewRoom", (e3) => e3.features.get("mam_enabled") && e3.fetchNewestMessages()), Vc.listen.on("chatReconnected", (e3) => { + e3.get("type") === Uc.PRIVATE_CHAT_TYPE && e3.fetchNewestMessages(); + }), Vc.listen.on("afterMessagesFetched", (e3) => { + e3.get("type") !== Uc.PRIVATE_CHAT_TYPE || Uc.connection.restored || e3.fetchNewestMessages(); + }), Object.assign(Vc, {archive: {async query(e3) { + if (!Vc.connection.connected()) + throw new Error("Can't call `api.archive.query` before having established an XMPP session"); + const t2 = {type: "set"}; + if (e3 && e3.groupchat) { + if (!e3.with) + throw new Error('You need to specify a "with" value containing the chat room JID, when querying groupchat messages.'); + t2.to = e3.with; + } + const n2 = t2.to || Uc.bare_jid; + if (!await Vc.disco.supports(Wu.MAM, n2)) + return zn.warn("Did not fetch MAM archive for ".concat(n2, " because it doesn't support ").concat(Wu.MAM)), {messages: []}; + const r2 = Gu.getUniqueId(), i2 = Uu(t2).c("query", {xmlns: Wu.MAM, queryid: r2}); + if (e3) { + i2.c("x", {xmlns: Wu.XFORM, type: "submit"}).c("field", {var: "FORM_TYPE", type: "hidden"}).c("value").t(Wu.MAM).up().up(), e3.with && !e3.groupchat && i2.c("field", {var: "with"}).c("value").t(e3.with).up().up(), ["start", "end"].forEach((t4) => { + if (e3[t4]) { + const n3 = $u(e3[t4]); + if (!n3.isValid()) + throw new TypeError("archive.query: invalid date provided for: ".concat(t4)); + i2.c("field", {var: t4}).c("value").t(n3.toISOString()).up().up(); + } + }), i2.up(); + const t3 = new qu(e3); + Object.keys(t3.query).length && i2.cnode(t3.toXML()); + } + const o2 = [], s2 = Uc.connection.addHandler((t3) => { + const n3 = mr()('message > result[xmlns="'.concat(Wu.MAM, '"]'), t3).pop(); + if (n3 === void 0 || n3.getAttribute("queryid") !== r2) + return true; + const i3 = t3.getAttribute("from") || Uc.bare_jid; + if (e3.groupchat) { + if (i3 !== e3.with) + return zn.warn("Ignoring alleged groupchat MAM message from ".concat(t3.getAttribute("from"))), true; + } else if (i3 !== Uc.bare_jid) + return zn.warn("Ignoring alleged MAM message from ".concat(t3.getAttribute("from"))), true; + return o2.push(t3), true; + }, Wu.MAM); + let a2; + const c2 = await Vc.sendIQ(i2, Vc.settings.get("message_archiving_timeout"), false); + if (c2 === null) { + const {__: e4} = Uc, t3 = e4("Timeout while trying to fetch archived messages."); + return zn.error(t3), a2 = new Uc.TimeoutError(t3), {messages: o2, error: a2}; + } + if (Gu.isErrorStanza(c2)) { + const {__: e4} = Uc, t3 = e4("An error occurred while querying for archived messages."); + return zn.error(t3), zn.error(c2), a2 = new Error(t3), {messages: o2, error: a2}; + } + let l2; + Uc.connection.deleteHandler(s2); + const u2 = c2 && mr()('fin[xmlns="'.concat(Wu.MAM, '"]'), c2).pop(), d2 = (u2 == null ? void 0 : u2.getAttribute("complete")) === "true", h2 = mr()('set[xmlns="'.concat(Wu.RSM, '"]'), u2).pop(); + return h2 && (l2 = new qu({...e3, xml: h2})), {messages: o2, rsm: l2, complete: d2}; + }}}); + }}); + /** + * @module converse-ping + * @description + * Converse.js plugin which add support for application-level pings + * as specified in XEP-0199 XMPP Ping. + * @copyright 2020, the Converse.js contributors + * @license Mozilla Public License (MPLv2) + */ + const {Strophe: Ju, $iq: Xu} = rl.env, Qu = rl.env.utils; + Ju.addNamespace("PING", "urn:xmpp:ping"), rl.plugins.add("converse-ping", {initialize() { + let e2; + function t2(t3) { + e2 = new Date(); + const n3 = t3.getAttribute("from"), r2 = t3.getAttribute("id"), i2 = Xu({type: "result", to: n3, id: r2}); + return Uc.connection.sendIQ(i2), true; + } + Vc.settings.extend({ping_interval: 60}), setTimeout(() => { + if (Vc.settings.get("ping_interval") > 0) { + const t3 = new Date(); + return e2 || (e2 = t3), !((t3 - e2) / 1e3 > Vc.settings.get("ping_interval")) || Vc.ping(); + } + }, 1e3); + const n2 = function() { + Uc.connection.disco !== void 0 && Vc.disco.own.features.add(Ju.NS.PING), Uc.connection.addHandler(t2, Ju.NS.PING, "iq", "get"), Uc.connection.addHandler(() => { + if (Vc.settings.get("ping_interval") > 0) + return e2 = new Date(), true; + }); + }; + Vc.listen.on("connected", n2), Vc.listen.on("reconnected", n2), Vc.listen.on("windowStateChanged", function(e3) { + e3.state === "visible" && Vc.connection.connected() && Vc.ping(null, 5e3); + }), Object.assign(Vc, {async ping(t3, n3) { + if (e2 = new Date(), t3 = t3 || Ju.getDomainFromJid(Uc.bare_jid), Uc.connection) { + const e3 = Xu({type: "get", to: t3, id: Qu.getUniqueId("ping")}).c("ping", {xmlns: Ju.NS.PING}), r2 = await Vc.sendIQ(e3, n3 || 1e4, false); + return r2 === null ? (zn.warn("Timeout while pinging ".concat(t3)), t3 === Ju.getDomainFromJid(Uc.bare_jid) && Vc.connection.reconnect()) : Qu.isErrorStanza(r2) && (zn.error("Error while pinging ".concat(t3)), zn.error(r2)), true; + } + return false; + }}); + }}); + /** + * @module converse-pubsub + * @copyright The Converse.js contributors + * @license Mozilla Public License (MPLv2) + */ + const {Strophe: Yu, $iq: Ku} = rl.env; + Yu.addNamespace("PUBSUB_ERROR", Yu.NS.PUBSUB + "#errors"), rl.plugins.add("converse-pubsub", {dependencies: ["converse-disco"], initialize() { + Object.assign(Uc.api, {pubsub: {async publish(e2, t2, n2, r2, i2 = true) { + const o2 = Ku({from: Uc.bare_jid, type: "set", to: e2}).c("pubsub", {xmlns: Yu.NS.PUBSUB}).c("publish", {node: t2}).cnode(n2.tree()).up().up(); + r2 && (e2 = e2 || Uc.bare_jid, await Vc.disco.supports(Yu.NS.PUBSUB + "#publish-options", e2) ? (o2.c("publish-options").c("x", {xmlns: Yu.NS.XFORM, type: "submit"}).c("field", {var: "FORM_TYPE", type: "hidden"}).c("value").t("".concat(Yu.NS.PUBSUB, "#publish-options")).up().up(), Object.keys(r2).forEach((e3) => o2.c("field", {var: e3}).c("value").t(r2[e3]).up().up())) : zn.warn("_converse.api.publish: ".concat(e2, " does not support #publish-options, ") + "so we didn't set them even though they were provided.")); + try { + await Vc.sendIQ(o2); + } catch (e3) { + if (!(e3 instanceof Element && i2 && e3.querySelector('precondition-not-met[xmlns="'.concat(Yu.NS.PUBSUB_ERROR, '"]')))) + throw e3; + { + const e4 = o2.nodeTree; + e4.querySelector("publish-options").outerHTML = "", zn.warn("PubSub: Republishing without publish options. ".concat(e4.outerHTML)), await Vc.sendIQ(e4); + } + } + }}}); + }}); + var Zu = function(e2) { + return typeof e2 == "number" || Ee(e2) && k(e2) == "[object Number]"; + }; + var ed = function(e2) { + return Zu(e2) && e2 != +e2; + }; + /** + * @module converse-status + * @copyright The Converse.js contributors + * @license Mozilla Public License (MPLv2) + */ + const {Strophe: td, $build: nd, $pres: rd} = rl.env; + rl.plugins.add("converse-status", {initialize() { + function e2(e3) { + Vc.trigger("statusInitialized", e3); + } + function t2(t3) { + if (t3 = Uc.xmppstatus !== void 0 && t3) + e2(t3); + else { + const n2 = "converse.xmppstatus-".concat(Uc.bare_jid); + Uc.xmppstatus = new Uc.XMPPStatus({id: n2}), Uc.xmppstatus.browserStorage = Uc.createStore(n2, "session"), Uc.xmppstatus.fetch({success: () => e2(t3), error: () => e2(t3), silent: true}); + } + } + Vc.settings.extend({auto_away: 0, auto_xa: 0, csi_waiting_time: 0, default_state: "online", priority: 0}), Vc.promises.add(["statusInitialized"]), Uc.XMPPStatus = qo.extend({defaults: () => ({status: Vc.settings.get("default_state")}), initialize() { + this.on("change", (e3) => { + N(e3.changed) && ("status" in e3.changed || "status_message" in e3.changed) && Vc.user.presence.send(this.get("status"), null, this.get("status_message")); + }); + }, getNickname: () => Uc.nickname, getFullname: () => "", constructPresence(e3, t3 = null, n2) { + let r2; + e3 = typeof e3 == "string" ? e3 : this.get("status") || Vc.settings.get("default_state"), n2 = typeof n2 == "string" ? n2 : this.get("status_message"); + const i2 = {to: t3}; + e3 === "unavailable" || e3 === "probe" || e3 === "error" || e3 === "unsubscribe" || e3 === "unsubscribed" || e3 === "subscribe" || e3 === "subscribed" ? (i2.type = e3, r2 = rd(i2)) : e3 === "offline" ? (i2.type = "unavailable", r2 = rd(i2)) : r2 = e3 === "online" ? rd(i2) : rd(i2).c("show").t(e3).up(), n2 && r2.c("status").t(n2).up(); + const o2 = Vc.settings.get("priority"); + if (r2.c("priority").t(ed(Number(o2)) ? 0 : o2).up(), Uc.idle) { + const e4 = new Date(); + e4.setSeconds(e4.getSeconds() - Uc.idle_seconds), r2.c("idle", {xmlns: td.NS.IDLE, since: e4.toISOString()}); + } + return r2; + }}), Uc.sendCSI = function(e3) { + Vc.send(nd(e3, {xmlns: td.NS.CSI})), Uc.inactive = e3 === Uc.INACTIVE; + }, Uc.onUserActivity = function() { + var e3; + Uc.idle_seconds > 0 && (Uc.idle_seconds = 0), ((e3 = Uc.connection) === null || e3 === void 0 ? void 0 : e3.authenticated) && (Uc.inactive && Uc.sendCSI(Uc.ACTIVE), Uc.idle && (Uc.idle = false, Vc.user.presence.send()), Uc.auto_changed_status === true && (Uc.auto_changed_status = false, Uc.xmppstatus.set("status", Vc.settings.get("default_state")))); + }, Uc.onEverySecond = function() { + var e3; + if (!((e3 = Uc.connection) === null || e3 === void 0 ? void 0 : e3.authenticated)) + return; + const t3 = Uc.xmppstatus.get("status"); + Uc.idle_seconds++, Vc.settings.get("csi_waiting_time") > 0 && Uc.idle_seconds > Vc.settings.get("csi_waiting_time") && !Uc.inactive && Uc.sendCSI(Uc.INACTIVE), Vc.settings.get("idle_presence_timeout") > 0 && Uc.idle_seconds > Vc.settings.get("idle_presence_timeout") && !Uc.idle && (Uc.idle = true, Vc.user.presence.send()), Vc.settings.get("auto_away") > 0 && Uc.idle_seconds > Vc.settings.get("auto_away") && t3 !== "away" && t3 !== "xa" && t3 !== "dnd" ? (Uc.auto_changed_status = true, Uc.xmppstatus.set("status", "away")) : Vc.settings.get("auto_xa") > 0 && Uc.idle_seconds > Vc.settings.get("auto_xa") && t3 !== "xa" && t3 !== "dnd" && (Uc.auto_changed_status = true, Uc.xmppstatus.set("status", "xa")); + }, Uc.registerIntervalHandler = function() { + if (Vc.settings.get("auto_away") < 1 && Vc.settings.get("auto_xa") < 1 && Vc.settings.get("csi_waiting_time") < 1 && Vc.settings.get("idle_presence_timeout") < 1) + return; + Uc.idle_seconds = 0, Uc.auto_changed_status = false; + const {unloadevent: e3} = Uc; + window.addEventListener("click", Uc.onUserActivity), window.addEventListener("focus", Uc.onUserActivity), window.addEventListener("keypress", Uc.onUserActivity), window.addEventListener("mousemove", Uc.onUserActivity), window.addEventListener(e3, Uc.onUserActivity, {once: true, passive: true}), window.addEventListener(e3, () => { + var e4; + return (e4 = Uc.session) === null || e4 === void 0 ? void 0 : e4.save("active", false); + }), Uc.everySecondTrigger = window.setInterval(Uc.onEverySecond, 1e3); + }, Vc.listen.on("presencesInitialized", (e3) => { + e3 || Uc.registerIntervalHandler(); + }), Vc.listen.on("clearSession", () => { + Uc.shouldClearCache() && Uc.xmppstatus && (Uc.xmppstatus.destroy(), delete Uc.xmppstatus, Vc.promises.add(["statusInitialized"])); + }), Vc.listen.on("connected", () => t2(false)), Vc.listen.on("reconnected", () => t2(true)), Object.assign(Uc.api.user, {presence: {async send(e3, t3, n2) { + await Vc.waitUntil("statusInitialized"), Vc.send(Uc.xmppstatus.constructPresence(e3, t3, n2)); + }}, status: {get: async () => (await Vc.waitUntil("statusInitialized"), Uc.xmppstatus.get("status")), async set(e3, t3) { + const n2 = {status: e3}; + if (!Object.keys(Uc.STATUS_WEIGHTS).includes(e3)) + throw new Error("Invalid availability value. See https://xmpp.org/rfcs/rfc3921.html#rfc.section.2.2.2.1"); + typeof t3 == "string" && (n2.status_message = t3), await Vc.waitUntil("statusInitialized"), Uc.xmppstatus.save(n2); + }, message: {get: async () => (await Vc.waitUntil("statusInitialized"), Uc.xmppstatus.get("status_message")), async set(e3) { + await Vc.waitUntil("statusInitialized"), Uc.xmppstatus.save({status_message: e3}); + }}}}); + }}); + var id = function(e2) { + return function(t2) { + return e2 == null ? void 0 : mo(e2, t2); + }; + }; + var od = function(e2, t2) { + for (var n2, r2 = -1, i2 = e2.length; ++r2 < i2; ) { + var o2 = t2(e2[r2]); + o2 !== void 0 && (n2 = n2 === void 0 ? o2 : n2 + o2); + } + return n2; + }; + var sd = function(e2) { + return e2 && e2.length ? od(e2, br) : 0; + }; + /** + * @module converse-roster + * @copyright The Converse.js contributors + * @license Mozilla Public License (MPLv2) + */ + const {Strophe: ad, $iq: cd, $pres: ld, dayjs: ud, sizzle: dd} = rl.env, hd = rl.env.utils; + rl.plugins.add("converse-roster", {dependencies: ["converse-status"], initialize() { + const {__: e2} = Uc; + Vc.settings.extend({allow_contact_requests: true, auto_subscribe: false, synchronize_availability: true}), Vc.promises.add(["cachedRoster", "roster", "rosterContactsFetched", "rosterGroupsFetched", "rosterInitialized"]), Uc.HEADER_CURRENT_CONTACTS = e2("My contacts"), Uc.HEADER_PENDING_CONTACTS = e2("Pending contacts"), Uc.HEADER_REQUESTING_CONTACTS = e2("Contact requests"), Uc.HEADER_UNGROUPED = e2("Ungrouped"), Uc.HEADER_UNREAD = e2("New messages"); + const t2 = {}; + t2[Uc.HEADER_UNREAD] = 0, t2[Uc.HEADER_REQUESTING_CONTACTS] = 1, t2[Uc.HEADER_CURRENT_CONTACTS] = 2, t2[Uc.HEADER_UNGROUPED] = 3, t2[Uc.HEADER_PENDING_CONTACTS] = 4, Uc.registerPresenceHandler = function() { + Uc.unregisterPresenceHandler(), Uc.presence_ref = Uc.connection.addHandler((e3) => (Uc.roster.presenceHandler(e3), true), null, "presence", null); + }, Uc.rejectPresenceSubscription = function(e3, t3) { + const n3 = ld({to: e3, type: "unsubscribed"}); + t3 && t3 !== "" && n3.c("status").t(t3), Vc.send(n3); + }, Uc.sendInitialPresence = function() { + Uc.send_initial_presence && Vc.user.presence.send(); + }, Uc.populateRoster = async function(e3 = false) { + e3 && (Uc.send_initial_presence = true); + try { + await Uc.rostergroups.fetchRosterGroups(), Vc.trigger("rosterGroupsFetched"), await Uc.roster.fetchRosterContacts(), Vc.trigger("rosterContactsFetched"); + } catch (e4) { + zn.error(e4); + } finally { + Uc.sendInitialPresence(); + } + }; + const n2 = qo.extend({idAttribute: "name"}), r2 = ra.extend({model: n2}); + function i2(e3) { + const t3 = Uc.roster && Uc.roster.findWhere({jid: e3.get("jid")}); + t3 !== void 0 && t3.save({num_unread: e3.get("num_unread")}); + } + async function o2() { + Uc.presences && await Uc.presences.clearStore(); + } + Uc.Presence = qo.extend({defaults: {show: "offline"}, initialize() { + this.resources = new r2(); + const e3 = "converse.identities-".concat(this.get("jid")); + this.resources.browserStorage = Uc.createStore(e3, "session"), this.listenTo(this.resources, "update", this.onResourcesChanged), this.listenTo(this.resources, "change", this.onResourcesChanged); + }, onResourcesChanged() { + var e3; + const t3 = this.getHighestPriorityResource(), n3 = (t3 == null || (e3 = t3.attributes) === null || e3 === void 0 ? void 0 : e3.show) || "offline"; + this.get("show") !== n3 && this.save({show: n3}); + }, getHighestPriorityResource() { + return this.resources.sortBy((e3) => "".concat(e3.get("priority"), "-").concat(e3.get("timestamp"))).reverse()[0]; + }, addResource(e3) { + const t3 = e3.getAttribute("from"), n3 = ad.getResourceFromJid(t3), r3 = dd('delay[xmlns="'.concat(ad.NS.DELAY, '"]'), e3).pop(), i3 = id(e3.querySelector("priority"))("textContent") || 0, o3 = this.resources.get(n3), s2 = {name: n3, priority: ed(parseInt(i3, 10)) ? 0 : parseInt(i3, 10), show: id(e3.querySelector("show"))("textContent") || "online", timestamp: r3 ? ud(r3.getAttribute("stamp")).toISOString() : new Date().toISOString()}; + o3 ? o3.save(s2) : this.resources.create(s2); + }, removeResource(e3) { + const t3 = this.resources.get(e3); + t3 && t3.destroy(); + }}), Uc.Presences = ra.extend({model: Uc.Presence}), Uc.RosterContact = qo.extend({defaults: {chat_state: void 0, image: Uc.DEFAULT_IMAGE, image_type: Uc.DEFAULT_IMAGE_TYPE, num_unread: 0, status: void 0}, async initialize(e3) { + this.initialized = hd.getResolveablePromise(), this.setPresence(); + const {jid: t3} = e3, n3 = ad.getBareJidFromJid(t3).toLowerCase(); + e3.jid = n3, this.set(Object.assign({groups: [], id: n3, jid: n3, user_id: ad.getNodeFromJid(t3)}, e3)), this.listenTo(this.presence, "change:show", () => Vc.trigger("contactPresenceChanged", this)), this.listenTo(this.presence, "change:show", () => this.trigger("presenceChanged")), await Vc.trigger("rosterContactInitialized", this, {Synchronous: true}), this.initialized.resolve(); + }, setPresence() { + const e3 = this.get("jid"); + this.presence = Uc.presences.findWhere({jid: e3}) || Uc.presences.create({jid: e3}); + }, openChat() { + const e3 = this.attributes; + Vc.chats.open(e3.jid, e3, true); + }, getFilterCriteria() { + const e3 = this.get("nickname"), t3 = this.get("jid"); + let n3 = this.getDisplayName(); + return n3 = n3.includes(t3) ? n3 : n3.concat(" ".concat(t3)), n3 = n3.includes(e3) ? n3 : n3.concat(" ".concat(e3)), n3.toLowerCase(); + }, getDisplayName() { + return this.get("nickname") ? this.get("nickname") : this.get("jid"); + }, getFullname() { + return this.get("jid"); + }, subscribe(e3) { + const t3 = ld({to: this.get("jid"), type: "subscribe"}); + e3 && e3 !== "" && t3.c("status").t(e3).up(); + const n3 = Uc.xmppstatus.getNickname() || Uc.xmppstatus.getFullname(); + return n3 && t3.c("nick", {xmlns: ad.NS.NICK}).t(n3).up(), Vc.send(t3), this.save("ask", "subscribe"), this; + }, ackSubscribe() { + Vc.send(ld({type: "subscribe", to: this.get("jid")})); + }, ackUnsubscribe() { + Vc.send(ld({type: "unsubscribe", to: this.get("jid")})), this.removeFromRoster(), this.destroy(); + }, unauthorize(e3) { + return Uc.rejectPresenceSubscription(this.get("jid"), e3), this; + }, authorize(e3) { + const t3 = ld({to: this.get("jid"), type: "subscribed"}); + return e3 && e3 !== "" && t3.c("status").t(e3), Vc.send(t3), this; + }, removeFromRoster() { + const e3 = cd({type: "set"}).c("query", {xmlns: ad.NS.ROSTER}).c("item", {jid: this.get("jid"), subscription: "remove"}); + return Vc.sendIQ(e3); + }}), Uc.RosterContacts = ra.extend({model: Uc.RosterContact, comparator(e3, t3) { + const n3 = e3.presence.get("show") || "offline", r3 = t3.presence.get("show") || "offline"; + if (Uc.STATUS_WEIGHTS[n3] === Uc.STATUS_WEIGHTS[r3]) { + const n4 = e3.getDisplayName().toLowerCase(), r4 = t3.getDisplayName().toLowerCase(); + return n4 < r4 ? -1 : n4 > r4 ? 1 : 0; + } + return Uc.STATUS_WEIGHTS[n3] < Uc.STATUS_WEIGHTS[r3] ? -1 : 1; + }, onConnected() { + this.registerRosterHandler(), this.registerRosterXHandler(); + }, registerRosterHandler() { + Uc.connection.addHandler((e3) => (Uc.roster.onRosterPush(e3), true), ad.NS.ROSTER, "iq", "set"); + }, registerRosterXHandler() { + let e3 = 0; + Uc.connection.addHandler(function(t3) { + return window.setTimeout(function() { + Uc.connection.flush(), Uc.roster.subscribeToSuggestedItems.bind(Uc.roster)(t3); + }, e3), e3 += 250 * t3.querySelectorAll("item").length, true; + }, ad.NS.ROSTERX, "message", null); + }, async fetchRosterContacts() { + const e3 = await new Promise((e4, t3) => { + this.fetch({add: true, silent: true, success: e4, error: (e5, n3) => t3(n3)}); + }); + if (hd.isErrorObject(e3) && (zn.error(e3), Uc.session.set("roster_cached", false), this.data.save("version", void 0)), !Uc.session.get("roster_cached")) + return Uc.send_initial_presence = true, Uc.roster.fetchFromServer(); + Vc.trigger("cachedRoster", e3); + }, subscribeToSuggestedItems: (e3) => (Array.from(e3.querySelectorAll("item")).forEach((e4) => { + e4.getAttribute("action") === "add" && Uc.roster.addAndSubscribe(e4.getAttribute("jid"), Uc.xmppstatus.getNickname() || Uc.xmppstatus.getFullname()); + }), true), isSelf: (e3) => hd.isSameBareJID(e3, Uc.connection.jid), async addAndSubscribe(e3, t3, n3, r3, i3) { + const o3 = await this.addContactToRoster(e3, t3, n3, i3); + o3 instanceof Uc.RosterContact && o3.subscribe(r3); + }, sendContactAddIQ(e3, t3, n3) { + t3 = t3 || null; + const r3 = cd({type: "set"}).c("query", {xmlns: ad.NS.ROSTER}).c("item", {jid: e3, name: t3}); + return n3.forEach((e4) => r3.c("group").t(e4).up()), Vc.sendIQ(r3); + }, async addContactToRoster(t3, n3, r3, i3) { + await Vc.waitUntil("rosterContactsFetched"), r3 = r3 || []; + try { + await this.sendContactAddIQ(t3, n3, r3); + } catch (r4) { + return zn.error(r4), alert(e2("Sorry, there was an error while trying to add %1$s as a contact.", n3 || t3)), r4; + } + return this.create(Object.assign({ask: void 0, nickname: n3, groups: r3, jid: t3, requesting: false, subscription: "none"}, i3), {sort: false}); + }, async subscribeBack(e3, t3) { + const n3 = this.get(e3); + if (n3 instanceof Uc.RosterContact) + n3.authorize().subscribe(); + else { + var r3; + const n4 = ((r3 = dd('nick[xmlns="'.concat(ad.NS.NICK, '"]'), t3).pop()) === null || r3 === void 0 ? void 0 : r3.textContent) || null, i3 = await this.addContactToRoster(e3, n4, [], {subscription: "from"}); + i3 instanceof Uc.RosterContact && i3.authorize().subscribe(); + } + }, getNumOnlineContacts() { + const e3 = ["offline", "unavailable"]; + return sd(this.models.filter((t3) => !e3.includes(t3.presence.get("show")))); + }, onRosterPush(e3) { + const t3 = e3.getAttribute("id"), n3 = e3.getAttribute("from"); + if (n3 && n3 !== Uc.bare_jid) + return void zn.warn("Ignoring roster illegitimate roster push message from ".concat(e3.getAttribute("from"))); + Vc.send(cd({type: "result", id: t3, from: Uc.connection.jid})); + const r3 = dd('query[xmlns="'.concat(ad.NS.ROSTER, '"]'), e3).pop(); + this.data.save("version", r3.getAttribute("ver")); + const i3 = dd("item", r3); + if (i3.length > 1) + throw zn.error(e3), new Error('Roster push query may not contain more than one "item" element.'); + if (i3.length === 0) + return zn.warn(e3), void zn.warn('Received a roster push stanza without an "item" element.'); + this.updateContact(i3.pop()), Vc.trigger("rosterPush", e3); + }, rosterVersioningSupported() { + return Vc.disco.stream.getFeature("ver", "urn:xmpp:features:rosterver") && this.data.get("version"); + }, async fetchFromServer() { + const e3 = cd({type: "get", id: hd.getUniqueId("roster")}).c("query", {xmlns: ad.NS.ROSTER}); + this.rosterVersioningSupported() && e3.attrs({ver: this.data.get("version")}); + const t3 = await Vc.sendIQ(e3, null, false); + if (t3.getAttribute("type") !== "error") { + const e4 = dd('query[xmlns="'.concat(ad.NS.ROSTER, '"]'), t3).pop(); + if (e4) { + dd("item", e4).forEach((e5) => this.updateContact(e5)), this.data.save("version", e4.getAttribute("ver")); + } + } else if (!hd.isServiceUnavailableError(t3)) + return zn.error(t3), void zn.error("Error while trying to fetch roster from the server"); + Uc.session.save("roster_cached", true), Vc.trigger("roster", t3); + }, updateContact(e3) { + const t3 = e3.getAttribute("jid"), n3 = this.get(t3), r3 = e3.getAttribute("subscription"), i3 = e3.getAttribute("ask"), o3 = Array.from(e3.getElementsByTagName("group")).map((e4) => e4.textContent); + if (n3) { + if (r3 === "remove") + return n3.destroy(); + n3.save({subscription: r3, ask: i3, nickname: e3.getAttribute("name"), requesting: null, groups: o3}); + } else { + if (r3 === "none" && i3 === null || r3 === "remove") + return; + this.create({ask: i3, nickname: e3.getAttribute("name"), groups: o3, jid: t3, subscription: r3}, {sort: false}); + } + }, createRequestingContact(e3) { + var t3; + const n3 = {jid: ad.getBareJidFromJid(e3.getAttribute("from")), subscription: "none", ask: null, requesting: true, nickname: ((t3 = dd('nick[xmlns="'.concat(ad.NS.NICK, '"]'), e3).pop()) === null || t3 === void 0 ? void 0 : t3.textContent) || null}; + Vc.trigger("contactRequest", this.create(n3)); + }, handleIncomingSubscription(t3) { + const n3 = t3.getAttribute("from"), r3 = ad.getBareJidFromJid(n3), i3 = this.get(r3); + Vc.settings.get("allow_contact_requests") || Uc.rejectPresenceSubscription(n3, e2("This client does not allow presence subscriptions")), Vc.settings.get("auto_subscribe") ? i3 && i3.get("subscription") === "to" ? i3.authorize() : this.subscribeBack(r3, t3) : i3 ? (i3.get("subscription") !== "none" || i3.get("ask") === "subscribe") && i3.authorize() : this.createRequestingContact(t3); + }, handleOwnPresence(e3) { + const t3 = e3.getAttribute("from"), n3 = ad.getResourceFromJid(t3), r3 = e3.getAttribute("type"); + if (Uc.connection.jid !== t3 && r3 !== "unavailable" && (Vc.settings.get("synchronize_availability") === true || Vc.settings.get("synchronize_availability") === n3)) { + const t4 = id(e3.querySelector("show"))("textContent") || "online"; + Uc.xmppstatus.save({status: t4}, {silent: true}); + const n4 = id(e3.querySelector("status"))("textContent"); + n4 && Uc.xmppstatus.save({status_message: n4}); + } + Uc.jid === t3 && r3 === "unavailable" && Vc.user.presence.send(); + }, presenceHandler(e3) { + const t3 = e3.getAttribute("type"); + if (t3 === "error") + return true; + const n3 = e3.getAttribute("from"), r3 = ad.getBareJidFromJid(n3); + if (this.isSelf(r3)) + return this.handleOwnPresence(e3); + if (dd('query[xmlns="'.concat(ad.NS.MUC, '"]'), e3).length) + return; + const i3 = id(e3.querySelector("status"))("textContent"), o3 = this.get(r3); + if (o3 && i3 !== o3.get("status") && o3.save({status: i3}), t3 === "subscribed" && o3) + o3.ackSubscribe(); + else if (t3 === "unsubscribed" && o3) + o3.ackUnsubscribe(); + else { + if (t3 === "unsubscribe") + return; + if (t3 === "subscribe") + this.handleIncomingSubscription(e3); + else if (t3 === "unavailable" && o3) { + const e4 = ad.getResourceFromJid(n3); + o3.presence.removeResource(e4); + } else + o3 && o3.presence.addResource(e3); + } + }}), Uc.RosterGroup = qo.extend({initialize(t3) { + this.set(Object.assign({description: e2("Click to hide these contacts"), state: Uc.OPENED}, t3)), this.contacts = new Uc.RosterContacts(); + }}), Uc.RosterGroups = ra.extend({model: Uc.RosterGroup, comparator(e3, n3) { + e3 = e3.get("name"), n3 = n3.get("name"); + const r3 = t2, i3 = Object.keys(t2), o3 = i3.includes(e3), s2 = i3.includes(n3); + if (!o3 && !s2) + return e3.toLowerCase() < n3.toLowerCase() ? -1 : e3.toLowerCase() > n3.toLowerCase() ? 1 : 0; + if (o3 && s2) + return r3[e3] < r3[n3] ? -1 : r3[e3] > r3[n3] ? 1 : 0; + if (!o3 && s2) { + const e4 = Uc.HEADER_CURRENT_CONTACTS; + return r3[e4] < r3[n3] ? -1 : r3[e4] > r3[n3] ? 1 : 0; + } + if (o3 && !s2) { + const t3 = Uc.HEADER_CURRENT_CONTACTS; + return r3[e3] < r3[t3] ? -1 : r3[e3] > r3[t3] ? 1 : 0; + } + }, fetchRosterGroups() { + return new Promise((e3) => { + this.fetch({success: e3, silent: true}); + }); + }}), Uc.unregisterPresenceHandler = function() { + Uc.presence_ref !== void 0 && (Uc.connection.deleteHandler(Uc.presence_ref), delete Uc.presence_ref); + }, Vc.listen.on("chatBoxesInitialized", () => { + Uc.chatboxes.on("change:num_unread", i2), Uc.chatboxes.on("add", (e3) => { + e3.get("type") === Uc.PRIVATE_CHAT_TYPE && e3.setRosterContact(e3.get("jid")); + }); + }), Vc.listen.on("beforeTearDown", () => Uc.unregisterPresenceHandler()), Vc.waitUntil("rosterContactsFetched").then(() => { + Uc.roster.on("add", (e3) => { + const t3 = Uc.chatboxes.findWhere({jid: e3.get("jid")}); + t3 && t3.setRosterContact(e3.get("jid")); + }); + }), Vc.listen.on("streamResumptionFailed", () => Uc.session.set("roster_cached", false)), Vc.listen.on("clearSession", async () => { + await o2(), Uc.shouldClearCache() && (Uc.rostergroups && (await Uc.rostergroups.clearStore(), delete Uc.rostergroups), Uc.roster && (Pc(Uc, "roster.data.destroy"), await Uc.roster.clearStore(), delete Uc.roster)); + }), Vc.listen.on("statusInitialized", async (e3) => { + if (e3) + !Uc.connection.hasResumed() && await o2(); + else { + Uc.presences = new Uc.Presences(); + const e4 = "converse.presences-".concat(Uc.bare_jid); + Uc.presences.browserStorage = Uc.createStore(e4, "session"), Uc.presences.fetch(); + } + Vc.trigger("presencesInitialized", e3); + }), Vc.listen.on("presencesInitialized", async (e3) => { + e3 ? Vc.trigger("rosterReadyAfterReconnection") : await async function() { + await Vc.waitUntil("VCardsInitialized"), Uc.roster = new Uc.RosterContacts(); + let e4 = "converse.contacts-".concat(Uc.bare_jid); + Uc.roster.browserStorage = Uc.createStore(e4), Uc.roster.data = new qo(), e4 = "converse-roster-model-".concat(Uc.bare_jid), Uc.roster.data.id = e4, Uc.roster.data.browserStorage = Uc.createStore(e4), Uc.roster.data.fetch(), e4 = "converse.roster.groups".concat(Uc.bare_jid), Uc.rostergroups = new Uc.RosterGroups(), Uc.rostergroups.browserStorage = Uc.createStore(e4), Vc.trigger("rosterInitialized"); + }(), Uc.roster.onConnected(), Uc.registerPresenceHandler(), Uc.populateRoster(!Uc.connection.restored); + }), Object.assign(Uc.api, {contacts: {async get(e3) { + await Vc.waitUntil("rosterContactsFetched"); + const t3 = (e4) => Uc.roster.get(ad.getBareJidFromJid(e4)); + if (e3 === void 0) + e3 = Uc.roster.pluck("jid"); + else if (typeof e3 == "string") + return t3(e3); + return e3.map(t3); + }, async add(e3, t3) { + if (await Vc.waitUntil("rosterContactsFetched"), typeof e3 != "string" || !e3.includes("@")) + throw new TypeError("contacts.add: invalid jid"); + return Uc.roster.addAndSubscribe(e3, t3); + }}}); + }}); + /** + * @module converse-smacks + * @copyright The Converse.js contributors + * @license Mozilla Public License (MPLv2) + * @description Converse.js plugin which adds support for XEP-0198: Stream Management + */ + const {Strophe: fd} = rl.env, pd = rl.env.utils; + function gd() { + return !(Vc.connection.isType("bosh") && !Uc.isTestEnv()) && Vc.disco.stream.getFeature("sm", fd.NS.SM); + } + function md(e2) { + if (!Uc.session.get("smacks_enabled")) + return true; + const t2 = parseInt(e2.getAttribute("h"), 10), n2 = Uc.session.get("num_stanzas_handled_by_server"), r2 = t2 - n2; + if (r2 < 0) { + const e3 = "New reported stanza count lower than previous. " + "New: ".concat(t2, " - Previous: ").concat(n2); + zn.error(e3); + } + const i2 = Uc.session.get("unacked_stanzas"); + if (r2 > i2.length) { + const e3 = "Higher reported acknowledge count than unacknowledged stanzas. " + "Reported Acknowledged Count: ".concat(r2, " -") + "Unacknowledged Stanza Count: ".concat(i2.length, " -") + "New: ".concat(t2, " - Previous: ").concat(n2); + zn.error(e3); + } + return Uc.session.save({num_stanzas_handled_by_server: t2, num_stanzas_since_last_ack: 0, unacked_stanzas: i2.slice(r2)}), true; + } + function vd() { + if (Uc.session.get("smacks_enabled")) { + const e2 = Uc.session.get("num_stanzas_handled"), t2 = pd.toStanza('<a xmlns="'.concat(fd.NS.SM, '" h="').concat(e2, '"/>')); + Vc.send(t2); + } + return true; + } + function _d(e2) { + if (Uc.session.get("smacks_enabled") && (pd.isTagEqual(e2, "iq") || pd.isTagEqual(e2, "presence") || pd.isTagEqual(e2, "message"))) { + const e3 = Uc.session.get("num_stanzas_handled"); + Uc.session.save("num_stanzas_handled", e3 + 1); + } + return true; + } + function bd() { + Uc.session.save({smacks_enabled: Uc.session.get("smacks_enabled") || false, num_stanzas_handled: Uc.session.get("num_stanzas_handled") || 0, num_stanzas_handled_by_server: Uc.session.get("num_stanzas_handled_by_server") || 0, num_stanzas_since_last_ack: Uc.session.get("num_stanzas_since_last_ack") || 0, unacked_stanzas: Uc.session.get("unacked_stanzas") || []}); + } + function yd() { + Uc.session && Uc.session.save({smacks_enabled: false, num_stanzas_handled: 0, num_stanzas_handled_by_server: 0, num_stanzas_since_last_ack: 0, unacked_stanzas: []}); + } + function wd(e2) { + const t2 = {smacks_enabled: true}; + return ["1", "true"].includes(e2.getAttribute("resume")) && (t2.smacks_stream_id = e2.getAttribute("id")), Uc.session.save(t2), true; + } + function Sd(e2) { + return e2.querySelector("item-not-found") ? zn.warn("Could not resume previous SMACKS session, session id not found. A new session will be established.") : (zn.error("Failed to enable stream management"), zn.error(e2.outerHTML)), yd(), Vc.trigger("streamResumptionFailed"), true; + } + function xd(e2) { + wd(e2), md(e2), function() { + const e3 = Uc.session.get("unacked_stanzas"); + Uc.session.save("unacked_stanzas", []), e3.forEach((e4) => Vc.send(e4)); + }(), Uc.connection.do_bind = false, Uc.connection.authenticated = true, Uc.connection.restored = true, Uc.connection._changeConnectStatus(fd.Status.CONNECTED, null); + } + async function Ed() { + if (Vc.settings.get("enable_smacks") && !Uc.session.get("smacks_enabled") && await gd()) { + const e2 = pd.getResolveablePromise(); + Uc.connection._addSysHandler((t3) => e2.resolve(wd(t3)), fd.NS.SM, "enabled"), Uc.connection._addSysHandler((t3) => e2.resolve(Sd(t3)), fd.NS.SM, "failed"); + const t2 = Vc.connection.isType("websocket") || Uc.isTestEnv(), n2 = pd.toStanza('<enable xmlns="'.concat(fd.NS.SM, '" resume="').concat(t2, '"/>')); + Vc.send(n2), Uc.connection.flush(), await e2; + } + } + fd.addNamespace("SM", "urn:xmpp:sm:3"); + const Ad = []; + async function Cd() { + if (!Vc.settings.get("enable_smacks")) + return; + if (!await gd()) + return; + const e2 = Uc.connection; + for (; Ad.length; ) + e2.deleteHandler(Ad.pop()); + Ad.push(e2.addHandler(_d)), Ad.push(e2.addHandler(vd, fd.NS.SM, "r")), Ad.push(e2.addHandler(md, fd.NS.SM, "a")), Uc.session.get("smacks_stream_id") ? await async function() { + const e3 = pd.getResolveablePromise(); + Uc.connection._addSysHandler((t3) => e3.resolve(xd(t3)), fd.NS.SM, "resumed"), Uc.connection._addSysHandler((t3) => e3.resolve(Sd(t3)), fd.NS.SM, "failed"); + const t2 = Uc.session.get("smacks_stream_id"), n2 = Uc.session.get("num_stanzas_handled"), r2 = pd.toStanza('<resume xmlns="'.concat(fd.NS.SM, '" h="').concat(n2, '" previd="').concat(t2, '"/>')); + Vc.send(r2), Uc.connection.flush(), await e3; + }() : yd(); + } + function jd(e2) { + if (Uc.session) { + if (Uc.session.get("smacks_enabled") && (pd.isTagEqual(e2, "iq") || pd.isTagEqual(e2, "presence") || pd.isTagEqual(e2, "message"))) { + const t2 = fd.serialize(e2); + Uc.session.save("unacked_stanzas", (Uc.session.get("unacked_stanzas") || []).concat([t2])); + const n2 = Vc.settings.get("smacks_max_unacked_stanzas"); + if (n2 > 0) { + const e3 = Uc.session.get("num_stanzas_since_last_ack") + 1; + e3 % n2 == 0 && Vc.send(pd.toStanza('<r xmlns="'.concat(fd.NS.SM, '"/>'))), Uc.session.save({num_stanzas_since_last_ack: e3}); + } + } + } else + zn.warn("No _converse.session!"); + } + rl.plugins.add("converse-smacks", {initialize() { + Vc.settings.extend({enable_smacks: true, smacks_max_unacked_stanzas: 5}), Vc.listen.on("afterResourceBinding", Ed), Vc.listen.on("beforeResourceBinding", Cd), Vc.listen.on("send", jd), Vc.listen.on("userSessionInitialized", bd); + }}); + /** + * @module converse-vcard + * @copyright The Converse.js contributors + * @license Mozilla Public License (MPLv2) + */ + const {Strophe: Td, $iq: Od, dayjs: kd} = rl.env, Nd = rl.env.utils; + rl.plugins.add("converse-vcard", {dependencies: ["converse-status", "converse-roster"], overrides: {XMPPStatus: {getNickname() { + const {_converse: e2} = this.__super__, t2 = this.__super__.getNickname.apply(this); + return !t2 && e2.xmppstatus.vcard ? e2.xmppstatus.vcard.get("nickname") : t2; + }, getFullname() { + const {_converse: e2} = this.__super__, t2 = this.__super__.getFullname.apply(this); + return !t2 && e2.xmppstatus.vcard ? e2.xmppstatus.vcard.get("fullname") : t2; + }}, RosterContact: {getDisplayName() { + return !this.get("nickname") && this.vcard ? this.vcard.getDisplayName() : this.__super__.getDisplayName.apply(this); + }, getFullname() { + return this.vcard ? this.vcard.get("fullname") : this.__super__.getFullname.apply(this); + }}}, initialize() { + function e2(e3, t3, n3) { + const r3 = Od(t3 ? {type: e3, to: t3} : {type: e3}); + return n3 ? r3.cnode(n3) : r3.c("vCard", {xmlns: Td.NS.VCARD}), r3; + } + async function t2(t3, n3) { + const r3 = Td.getBareJidFromJid(n3) === t3.bare_jid ? null : n3; + let i2; + try { + i2 = await Vc.sendIQ(e2("get", r3)); + } catch (i3) { + return {stanza: i3, jid: n3, vcard_error: new Date().toISOString()}; + } + return async function(e3, t4) { + const n4 = t4.querySelector("vCard"); + let r4 = {}; + var i3, o2, s2, a2, c2, l2, u2; + if (n4 !== null && (r4 = {stanza: t4, fullname: (i3 = n4.querySelector("FN")) === null || i3 === void 0 ? void 0 : i3.textContent, nickname: (o2 = n4.querySelector("NICKNAME")) === null || o2 === void 0 ? void 0 : o2.textContent, image: (s2 = n4.querySelector("PHOTO BINVAL")) === null || s2 === void 0 ? void 0 : s2.textContent, image_type: (a2 = n4.querySelector("PHOTO TYPE")) === null || a2 === void 0 ? void 0 : a2.textContent, url: (c2 = n4.querySelector("URL")) === null || c2 === void 0 ? void 0 : c2.textContent, role: (l2 = n4.querySelector("ROLE")) === null || l2 === void 0 ? void 0 : l2.textContent, email: (u2 = n4.querySelector("EMAIL USERID")) === null || u2 === void 0 ? void 0 : u2.textContent, vcard_updated: new Date().toISOString(), vcard_error: void 0}), r4.image) { + const e4 = Nd.base64ToArrayBuffer(r4.image), t5 = await crypto.subtle.digest("SHA-1", e4); + r4.image_hash = Nd.arrayBufferToHex(t5); + } + return r4; + }(0, i2); + } + async function n2(e3) { + let t3; + if (e3 instanceof Uc.Message) { + if (e3.get("type") === "error") + return; + t3 = e3.get("from"); + } else + t3 = e3.get("jid"); + await Vc.waitUntil("VCardsInitialized"), e3.vcard = Uc.vcards.findWhere({jid: t3}), e3.vcard || (e3.vcard = Uc.vcards.create({jid: t3})), e3.vcard.on("change", () => e3.trigger("vcard:change")); + } + async function r2(e3) { + await Vc.waitUntil("VCardsInitialized"), ["error", "info"].includes(e3.get("type")) || (e3.vcard = function(e4) { + var t3; + const n3 = e4 == null || (t3 = e4.collection) === null || t3 === void 0 ? void 0 : t3.chatbox, r3 = Td.getResourceFromJid(e4.get("from")); + if (n3 && n3.get("nick") === r3) + return Uc.xmppstatus.vcard; + { + const t4 = e4.occupant && e4.occupant.get("jid") || e4.get("from"); + return t4 ? Uc.vcards.findWhere({jid: t4}) || Uc.vcards.create({jid: t4}) : void zn.error("Could not assign VCard for message because no JID found! msgid: ".concat(e4.get("msgid"))); + } + }(e3)); + } + Vc.promises.add("VCardsInitialized"), Uc.VCard = qo.extend({defaults: {image: Uc.DEFAULT_IMAGE, image_type: Uc.DEFAULT_IMAGE_TYPE}, set(e3, t3, n3) { + let r3; + return typeof e3 == "object" ? (r3 = e3, n3 = t3) : (r3 = {})[e3] = t3, "image" in r3 && !r3.image ? (r3.image = Uc.DEFAULT_IMAGE, r3.image_type = Uc.DEFAULT_IMAGE_TYPE, qo.prototype.set.call(this, r3, n3)) : qo.prototype.set.apply(this, arguments); + }, getDisplayName() { + return this.get("nickname") || this.get("fullname") || this.get("jid"); + }}), Uc.VCards = ra.extend({model: Uc.VCard, initialize() { + this.on("add", (e3) => e3.get("jid") && Vc.vcard.update(e3)); + }}), Uc.initVCardCollection = async function() { + Uc.vcards = new Uc.VCards(), Uc.vcards.browserStorage = Uc.createStore("".concat(Uc.bare_jid, "-converse.vcards")), await new Promise((e4) => { + Uc.vcards.fetch({success: e4, error: e4}, {silent: true}); + }); + const e3 = Uc.vcards; + if (Uc.session) { + const t3 = Uc.session.get("bare_jid"); + Uc.xmppstatus.vcard = e3.findWhere({jid: t3}) || e3.create({jid: t3}); + } + Vc.trigger("VCardsInitialized"); + }, Vc.listen.on("chatBoxInitialized", (e3) => n2(e3)), Vc.listen.on("chatRoomInitialized", (e3) => n2(e3)), Vc.listen.on("chatRoomMessageInitialized", (e3) => r2(e3)), Vc.listen.on("addClientFeatures", () => Vc.disco.own.features.add(Td.NS.VCARD)), Vc.listen.on("clearSession", () => { + Uc.shouldClearCache() && (Vc.promises.add("VCardsInitialized"), Uc.vcards && (Uc.vcards.clearStore(), delete Uc.vcards)); + }), Vc.listen.on("messageInitialized", (e3) => n2(e3)), Vc.listen.on("rosterContactInitialized", (e3) => n2(e3)), Vc.listen.on("statusInitialized", Uc.initVCardCollection), Object.assign(Uc.api, {vcard: {async set(t3, n3) { + if (!t3) + throw Error("No jid provided for the VCard data"); + const r3 = document.createElement("div"), i2 = Nd.toStanza('\n <vCard xmlns="vcard-temp">\n <FN>'.concat(n3.fn, "</FN>\n <NICKNAME>").concat(n3.nickname, "</NICKNAME>\n <URL>").concat(n3.url, "</URL>\n <ROLE>").concat(n3.role, "</ROLE>\n <EMAIL><INTERNET/><PREF/><USERID>").concat(n3.email, "</USERID></EMAIL>\n <PHOTO>\n <TYPE>").concat(n3.image_type, "</TYPE>\n <BINVAL>").concat(n3.image, "</BINVAL>\n </PHOTO>\n </vCard>"), r3); + let o2; + try { + o2 = await Vc.sendIQ(e2("set", t3, i2)); + } catch (e3) { + throw e3; + } + return await Vc.vcard.update(t3, true), o2; + }, get(e3, n3) { + if (typeof e3 == "string") + return t2(Uc, e3); + if (!n3 && e3.get("vcard_updated") && kd(e3.get("vcard_error")).isSame(new Date(), "day")) + return Promise.resolve({}); + { + const n4 = e3.get("jid"); + return n4 || zn.error("No JID to get vcard for"), t2(Uc, n4); + } + }, async update(e3, t3) { + const n3 = await this.get(e3, t3); + (e3 = typeof e3 == "string" ? Uc.vcards.findWhere({jid: e3}) : e3) ? (delete n3.stanza, e3.save(n3)) : zn.error("Could not find a VCard model for ".concat(e3)); + }}}); + }}); + var Id = n(67), Md = n.n(Id); + function Rd(e2, t2) { + return typeof e2 == "string" && t2.includes(e2); + } + function Dd(e2, t2) { + return typeof e2 != "string" || e2 !== "en" && !t2(e2) ? function(e3) { + var t3, n2; + if (window.navigator.userLanguage && (t3 = Pd(window.navigator.userLanguage, e3)), window.navigator.languages && !t3) + for (n2 = 0; n2 < window.navigator.languages.length && !t3; n2++) + t3 = Pd(window.navigator.languages[n2], e3); + return window.navigator.browserLanguage && !t3 && (t3 = Pd(window.navigator.browserLanguage, e3)), window.navigator.language && !t3 && (t3 = Pd(window.navigator.language, e3)), window.navigator.systemLanguage && !t3 && (t3 = Pd(window.navigator.systemLanguage, e3)), t3 || "en"; + }(t2) || "en" : e2; + } + function Pd(e2, t2) { + if (t2(e2)) + return e2; + var n2 = e2.split("-")[0]; + return n2 !== e2 && t2(n2) ? n2 : void 0; + } + let Ld; + Object.assign(Hc, {getLocale: (e2, t2) => Dd(e2, (e3) => Rd(e3, t2)), translate(e2) { + if (!Ld) + return Md.a.sprintf.apply(Md.a, arguments); + const t2 = Ld.translate(e2); + return arguments.length > 1 ? t2.fetch.apply(t2, [].slice.call(arguments, 1)) : t2.fetch(); + }, async initialize() { + if (Uc.isTestEnv()) + Uc.locale = "en"; + else + try { + Uc.locale = Hc.getLocale(Vc.settings.get("i18n"), Vc.settings.get("locales")), await async function(e2) { + const {api: t2, locale: r2} = e2, i2 = r2.toLowerCase().replace("_", "-"); + if (!Rd(r2, t2.settings.get("locales")) || r2 === "en") + return; + const {default: o2} = await n(494)("./".concat(r2, "/LC_MESSAGES/converse.po")); + await n(495)("./".concat(i2)), En.a.locale(Dd(i2, (e3) => En.a.locale(e3))), Ld = new Md.a(o2); + }(Uc); + } catch (e2) { + zn.fatal(e2.message), Uc.locale = "en"; + } + }, __: (...e2) => Hc.translate(...e2)}); + const zd = Hc.__, Fd = {}; + Vc.elements = {registry: Fd, define: function(e2, t2) { + this.registry[e2] = t2; + }, register: function() { + Object.keys(Fd).forEach((e2) => { + customElements.get(e2) || customElements.define(e2, Fd[e2]); + }); + }}; + /** + * @module converse-autocomplete + * @copyright Lea Verou and the Converse.js contributors + * @description + * Converse.js plugin which started as a fork of Lea Verou's Awesomplete + * https://leaverou.github.io/awesomplete/ + * @license Mozilla Public License (MPLv2) + */ + const Bd = rl.env.utils, qd = function(e2, t2) { + return RegExp(Wd.regExpEscape(t2.trim()), "i").test(e2); + }, Hd = function(e2, t2) { + return RegExp("^" + Wd.regExpEscape(t2.trim()), "i").test(e2); + }, Ud = function(e2, t2) { + const n2 = e2.query.toLowerCase(), r2 = e2.label.toLowerCase().indexOf(n2), i2 = t2.label.toLowerCase().indexOf(n2); + return r2 === i2 ? function(e3, t3) { + return e3.length !== t3.length ? e3.length - t3.length : e3 < t3 ? -1 : 1; + }(e2, t2) : (r2 === -1 ? 1 / 0 : r2) < (i2 === -1 ? 1 / 0 : i2) ? -1 : 1; + }, $d = (e2, t2) => { + t2 = t2.trim(); + const n2 = document.createElement("li"); + n2.setAttribute("aria-selected", "false"); + const r2 = new RegExp("(" + t2 + ")", "ig"); + return (t2 ? e2.split(r2) : [e2]).forEach((e3) => { + if (t2 && e3.match(r2)) { + const t3 = document.createElement("mark"); + t3.textContent = e3, n2.appendChild(t3); + } else + n2.appendChild(document.createTextNode(e3)); + }), n2; + }, Wd = {getElement: (e2, t2) => typeof e2 == "string" ? (t2 || document).querySelector(e2) : e2 || null, bind(e2, t2) { + if (e2) + for (var n2 in t2) { + if (!Object.prototype.hasOwnProperty.call(t2, n2)) + continue; + const r2 = t2[n2]; + n2.split(/\s+/).forEach((t3) => e2.addEventListener(t3, r2)); + } + }, unbind(e2, t2) { + if (e2) + for (var n2 in t2) { + if (!Object.prototype.hasOwnProperty.call(t2, n2)) + continue; + const r2 = t2[n2]; + n2.split(/\s+/).forEach((t3) => e2.removeEventListener(t3, r2)); + } + }, regExpEscape: (e2) => e2.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"), isMention: (e2, t2) => t2.includes(e2[0]) || Bd.isMentionBoundary(e2[0]) && t2.includes(e2[1])}; + class Gd extends String { + constructor(e2, t2) { + super(); + const n2 = Array.isArray(e2) ? {label: e2[0], value: e2[1]} : typeof e2 == "object" && "label" in e2 && "value" in e2 ? e2 : {label: e2, value: e2}; + this.label = n2.label || n2.value, this.value = n2.value, this.query = t2; + } + get lenth() { + return this.label.length; + } + toString() { + return "" + this.label; + } + valueOf() { + return this.toString(); + } + } + class Vd { + constructor(e2, t2 = {}) { + this.is_opened = false, Bd.hasClass("suggestion-box", e2) ? this.container = e2 : this.container = e2.querySelector(".suggestion-box"), this.input = this.container.querySelector(".suggestion-box__input"), this.input.setAttribute("aria-autocomplete", "list"), this.ul = this.container.querySelector(".suggestion-box__results"), this.status = this.container.querySelector(".suggestion-box__additions"), Object.assign(this, {match_current_word: false, ac_triggers: [], include_triggers: [], min_chars: 2, max_items: 10, auto_evaluate: true, auto_first: false, data: (e3) => e3, filter: qd, sort: t2.sort !== false && Ud, item: $d}, t2), this.index = -1, this.bindEvents(), this.input.hasAttribute("list") ? (this.list = "#" + this.input.getAttribute("list"), this.input.removeAttribute("list")) : this.list = this.input.getAttribute("data-list") || t2.list || []; + } + bindEvents() { + const e2 = {blur: () => this.close({reason: "blur"})}; + this.auto_evaluate && (e2.input = () => this.evaluate()), this._events = {input: e2, form: {submit: () => this.close({reason: "submit"})}, ul: {mousedown: (e3) => this.onMouseDown(e3), mouseover: (e3) => this.onMouseOver(e3)}}, Wd.bind(this.input, this._events.input), Wd.bind(this.input.form, this._events.form), Wd.bind(this.ul, this._events.ul); + } + set list(e2) { + if (Array.isArray(e2) || typeof e2 == "function") + this._list = e2; + else if (typeof e2 == "string" && e2.includes(",")) + this._list = e2.split(/\s*,\s*/); + else { + var t2; + const n2 = ((t2 = Wd.getElement(e2)) === null || t2 === void 0 ? void 0 : t2.children) || []; + this._list = Array.from(n2).filter((e3) => !e3.disabled).map((e3) => { + const t3 = e3.textContent.trim(), n3 = e3.value || t3, r2 = e3.label || t3; + return n3 !== "" ? {label: r2, value: n3} : null; + }).filter((e3) => e3); + } + document.activeElement === this.input && this.evaluate(); + } + get list() { + return this._list; + } + get selected() { + return this.index > -1; + } + get opened() { + return this.is_opened; + } + close(e2) { + this.opened && (this.ul.setAttribute("hidden", ""), this.is_opened = false, this.index = -1, this.trigger("suggestion-box-close", e2 || {})); + } + insertValue(e2) { + this.match_current_word ? Bd.replaceCurrentWord(this.input, e2.value) : this.input.value = e2.value; + } + open() { + this.ul.removeAttribute("hidden"), this.is_opened = true, this.auto_first && this.index === -1 && this.goto(0), this.trigger("suggestion-box-open"); + } + destroy() { + Wd.unbind(this.input, this._events.input), Wd.unbind(this.input.form, this._events.form), this.input.removeAttribute("aria-autocomplete"); + } + next() { + const e2 = this.ul.children.length; + this.goto(this.index < e2 - 1 ? this.index + 1 : e2 ? 0 : -1); + } + previous() { + const e2 = this.ul.children.length, t2 = this.index - 1; + this.goto(this.selected && t2 !== -1 ? t2 : e2 - 1); + } + goto(e2) { + const t2 = this.ul.children; + this.selected && t2[this.index].setAttribute("aria-selected", "false"), this.index = e2, e2 > -1 && t2.length > 0 && (t2[e2].setAttribute("aria-selected", "true"), t2[e2].focus(), this.status.textContent = t2[e2].textContent, this.ul.scrollTop = t2[e2].offsetTop - this.ul.clientHeight + t2[e2].clientHeight, this.trigger("suggestion-box-highlight", {text: this.suggestions[this.index]})); + } + select(e2) { + if (e2 ? this.index = Bd.siblingIndex(e2) : e2 = this.ul.children[this.index], e2) { + const e3 = this.suggestions[this.index]; + this.insertValue(e3), this.close({reason: "select"}), this.auto_completing = false, this.trigger("suggestion-box-selectcomplete", {text: e3}); + } + } + onMouseOver(e2) { + const t2 = Bd.ancestor(e2.target, "li"); + t2 && this.goto(Array.prototype.slice.call(this.ul.children).indexOf(t2)); + } + onMouseDown(e2) { + if (e2.button !== 0) + return; + const t2 = Bd.ancestor(e2.target, "li"); + t2 && (e2.preventDefault(), this.select(t2, e2.target)); + } + onKeyDown(e2) { + if (this.opened) { + if ([rl.keycodes.ENTER, rl.keycodes.TAB].includes(e2.keyCode) && this.selected) + return e2.preventDefault(), e2.stopPropagation(), this.select(), true; + if (e2.keyCode === rl.keycodes.ESCAPE) + return this.close({reason: "esc"}), true; + if ([rl.keycodes.UP_ARROW, rl.keycodes.DOWN_ARROW].includes(e2.keyCode)) + return e2.preventDefault(), e2.stopPropagation(), this[e2.keyCode === rl.keycodes.UP_ARROW ? "previous" : "next"](), true; + } + if (![rl.keycodes.SHIFT, rl.keycodes.META, rl.keycodes.META_RIGHT, rl.keycodes.ESCAPE, rl.keycodes.ALT].includes(e2.keyCode)) { + if (this.ac_triggers.includes(e2.key)) + e2.key === "Tab" && e2.preventDefault(), this.auto_completing = true; + else if (e2.key === "Backspace") { + const t2 = Bd.getCurrentWord(e2.target, e2.target.selectionEnd - 1); + Wd.isMention(t2, this.ac_triggers) && (this.auto_completing = true); + } + } + } + async evaluate(e2) { + const t2 = this.selected && e2 && (e2.keyCode === rl.keycodes.UP_ARROW || e2.keyCode === rl.keycodes.DOWN_ARROW); + if (!this.auto_evaluate && !this.auto_completing || t2) + return; + const n2 = typeof this._list == "function" ? await this._list() : this._list; + if (n2.length === 0) + return; + let r2 = this.match_current_word ? Bd.getCurrentWord(this.input) : this.input.value; + const i2 = Wd.isMention(r2, this.ac_triggers); + i2 && (this.auto_completing = true, this.include_triggers.includes(e2.key) || (r2 = Bd.isMentionBoundary(r2[0]) ? r2.slice("2") : r2.slice("1"))), (i2 || r2.length) && r2.length >= this.min_chars ? (this.index = -1, this.ul.innerHTML = "", this.suggestions = n2.map((e3) => new Gd(this.data(e3, r2), r2)).filter((e3) => this.filter(e3, r2)), this.sort !== false && (this.suggestions = this.suggestions.sort(this.sort)), this.suggestions = this.suggestions.slice(0, this.max_items), this.suggestions.forEach((e3) => this.ul.appendChild(this.item(e3, r2))), this.ul.children.length === 0 ? this.close({reason: "nomatches"}) : this.open()) : (this.close({reason: "nomatches"}), i2 || (this.auto_completing = false)); + } + } + function Jd() { + const e2 = Qd(['\n <div class="list-container list-container--bookmarks ', '">\n <a class="list-toggle bookmarks-toggle controlbox-padded"\n title="', '"\n @click=', '>\n\n <span class="fa ', '">\n </span> ', '</a>\n <div class="items-list bookmarks rooms-list ', '">\n ', "\n </div>\n </div>\n "]); + return Jd = function() { + return e2; + }, e2; + } + function Xd() { + const e2 = Qd(['\n <div class="list-item controlbox-padded room-item available-chatroom d-flex flex-row ', '" data-room-jid="', '">\n <a class="list-item-link open-room w-100" data-room-jid="', '"\n title="', '"\n @click=', ">", '</a>\n\n <a class="list-item-action remove-bookmark fa fa-bookmark align-self-center ', '"\n data-room-jid="', '"\n data-bookmark-name="', '"\n title="', '"\n @click=', "></a>\n </div>\n "]); + return Xd = function() { + return e2; + }, e2; + } + function Qd(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + Object.assign(Vd.prototype, _i), rl.plugins.add("converse-autocomplete", {initialize() { + const e2 = this._converse; + e2.FILTER_CONTAINS = qd, e2.FILTER_STARTSWITH = Hd, e2.AutoComplete = Vd; + }}); + var Yd = (e2) => { + const t2 = zd("Click to toggle the bookmarks list"), n2 = zd("Bookmarks"); + return Za(Jd(), e2.hidden ? "" : "hidden", t2, e2.toggleBookmarksList, e2.toggle_state === e2._converse.OPENED ? "fa-caret-down" : "fa-caret-right", n2, e2.toggle_state !== e2._converse.OPENED ? "hidden" : "", e2.bookmarks.map((t3) => ((e3) => { + const t4 = zd("Unbookmark this groupchat"), n3 = zd("Click to open this groupchat"); + return Za(Xd(), e3.is_hidden(e3.bm) ? "hidden" : "", e3.bm.get("jid"), e3.bm.get("jid"), n3, e3.openRoom, e3.bm.getDisplayName(), e3.bm.get("bookmarked") ? "button-on" : "", e3.bm.get("jid"), e3.bm.getDisplayName(), t4, e3.removeBookmark); + })(Object.assign({bm: t3}, e2)))); + }; + function Kd() { + const e2 = function(e3, t2) { + t2 || (t2 = e3.slice(0)); + return Object.freeze(Object.defineProperties(e3, {raw: {value: Object.freeze(t2)}})); + }(['\n <form class="converse-form chatroom-form" @submit=', ">\n <legend>", '</legend>\n <fieldset class="form-group">\n <label for="converse_muc_bookmark_name">', '</label>\n <input class="form-control" type="text" value="', '" name="name" required="required" id="converse_muc_bookmark_name"/>\n </fieldset>\n <fieldset class="form-group">\n <label for="converse_muc_bookmark_nick">', '</label>\n <input class="form-control" type="text" name="nick" value="', '" id="converse_muc_bookmark_nick"/>\n </fieldset>\n <fieldset class="form-group form-check">\n <input class="form-check-input" id="converse_muc_bookmark_autojoin" type="checkbox" name="autojoin"/>\n <label class="form-check-label" for="converse_muc_bookmark_autojoin">', '</label>\n </fieldset>\n <fieldset class="form-group">\n <input class="btn btn-primary" type="submit" value="', '">\n <input class="btn btn-secondary button-cancel" type="button" value="', '" @click=', ">\n </fieldset>\n </form>\n "]); + return Kd = function() { + return e2; + }, e2; + } + const Zd = /^\s*</, eh = function(e2) { + this.cid = vi("view"), this._domEvents = [], this.preinitialize.apply(this, arguments), Or(this, Bo(e2, nh)), this._ensureElement(), this.initialize.apply(this, arguments); + }; + eh.extend = Yr; + const th = /^(\S+)\s*(.*)$/, nh = ["model", "collection", "el", "id", "attributes", "className", "tagName", "events"]; + Object.assign(eh.prototype, _i, {tagName: "div", $: function(e2) { + return this.el.querySelectorAll(e2); + }, preinitialize: function() { + }, initialize: function() { + }, render: function() { + return M(this.beforeRender) && this.beforeRender(), M(this.toHTML) && Ya(this.toHTML(), this.el), M(this.afterRender) && this.afterRender(), this; + }, remove: function() { + return this._removeElement(), this.stopListening(), this; + }, _removeElement: function() { + this.undelegateEvents(), this.el.parentNode && this.el.parentNode.removeChild(this.el); + }, setElement: function(e2) { + return this.undelegateEvents(), this._setElement(e2), this.delegateEvents(), this; + }, _setElement: function(e2) { + if (typeof e2 == "string") + if (Zd.test(e2)) { + const t2 = document.createElement("div"); + t2.innerHTML = e2, this.el = t2.firstChild; + } else + this.el = document.querySelector(e2); + else + e2 && !Dn(e2) && e2.length ? this.el = e2[0] : this.el = e2; + }, delegateEvents: function(e2) { + if (e2 || (e2 = Qr(this, "events")), !e2) + return this; + this.undelegateEvents(); + for (const t2 in e2) { + let n2 = e2[t2]; + if (M(n2) || (n2 = this[n2]), !n2) + continue; + const r2 = t2.match(th); + this.delegate(r2[1], r2[2], n2.bind(this)); + } + return this; + }, delegate: function(e2, t2, n2) { + const r2 = this.el; + if (!r2) + return this; + if (typeof t2 == "function" && (n2 = t2, t2 = null), ["focus", "blur"].indexOf(e2) !== -1) { + const r3 = this.el.querySelectorAll(t2); + for (let t3 = 0, i3 = r3.length; t3 < i3; t3++) { + const i4 = r3[t3]; + i4.addEventListener(e2, n2, false), this._domEvents.push({el: i4, eventName: e2, handler: n2}); + } + return n2; + } + const i2 = t2 ? function(e3) { + let i3 = e3.target || e3.srcElement; + for (; i3 && i3 != r2; i3 = i3.parentNode) + i3.matches(t2) && (e3.delegateTarget = i3, n2(e3)); + } : n2; + return this.el.addEventListener(e2, i2, false), this._domEvents.push({el: this.el, eventName: e2, handler: i2, listener: n2, selector: t2}), this; + }, undelegateEvents: function() { + if (this.el) { + for (let e2 = 0, t2 = this._domEvents.length; e2 < t2; e2++) { + const t3 = this._domEvents[e2]; + t3.el.removeEventListener(t3.eventName, t3.handler, false); + } + this._domEvents.length = 0; + } + return this; + }, undelegate: function(e2, t2, n2) { + if (typeof t2 == "function" && (n2 = t2, t2 = null), this.el) { + const r2 = this._domEvents.slice(); + let i2 = r2.length; + for (; i2--; ) { + const o2 = r2[i2]; + !(o2.eventName !== e2 || n2 && o2.listener !== n2 || t2 && o2.selector !== t2) && (o2.el.removeEventListener(o2.eventName, o2.handler, false), this._domEvents.splice(i2, 1)); + } + } + return this; + }, _createElement: function(e2) { + return document.createElement(e2); + }, _ensureElement: function() { + if (this.el) + this.setElement(Qr(this, "el")); + else { + const e2 = Or({}, Qr(this, "attributes")); + this.id && (e2.id = Qr(this, "id")), this.className && (e2.class = Qr(this, "className")), this.setElement(this._createElement(Qr(this, "tagName"))), this._setAttributes(e2); + } + }, _setAttributes: function(e2) { + for (const t2 in e2) + t2 in this.el ? this.el[t2] = e2[t2] : this.el.setAttribute(t2, e2[t2]); + }}); + var rh = jr(function(e2, t2, n2) { + var r2 = -1, i2 = typeof t2 == "function", o2 = Xe(e2) ? Array(e2.length) : []; + return vs(e2, function(e3) { + o2[++r2] = i2 ? yr(t2, e3, n2) : Dc(e3, t2, n2); + }), o2; + }); + /** + * @module converse-bookmark-views + * @description Converse.js plugin which adds views for XEP-0048 bookmarks + * @copyright 2020, the Converse.js contributors + * @license Mozilla Public License (MPLv2) + */ + const {Strophe: ih} = rl.env, oh = rl.env.utils; + rl.plugins.add("converse-bookmark-views", {dependencies: ["converse-chatboxes", "converse-muc", "converse-muc-views"], initialize() { + Vc.settings.extend({hide_open_bookmarks: true}), Object.assign(Uc, {removeBookmarkViaEvent(e3) { + e3.preventDefault(); + const t2 = e3.target.getAttribute("data-bookmark-name"), n2 = e3.target.getAttribute("data-room-jid"); + confirm(zd('Are you sure you want to remove the bookmark "%1$s"?', t2)) && rh(Uc.bookmarks.where({jid: n2}), qo.prototype.destroy); + }, addBookmarkViaEvent(e3) { + e3.preventDefault(); + const t2 = e3.target.getAttribute("data-room-jid"); + Vc.rooms.open(t2, {bring_to_foreground: true}), Uc.chatboxviews.get(t2).renderBookmarkForm(); + }}); + const e2 = {setBookmarkState() { + if (Uc.bookmarks !== void 0) { + Uc.bookmarks.where({jid: this.model.get("jid")}).length ? this.model.save("bookmarked", true) : this.model.save("bookmarked", false); + } + }, renderBookmarkForm() { + if (this.hideChatRoomContents(), !this.bookmark_form) { + this.bookmark_form = new Uc.MUCBookmarkForm({model: this.model, chatroomview: this}), this.el.querySelector(".chatroom-body").insertAdjacentElement("beforeend", this.bookmark_form.el); + } + oh.showElement(this.bookmark_form.el); + }, toggleBookmark(e3) { + e3 == null || e3.preventDefault(); + const t2 = Uc.bookmarks.where({jid: this.model.get("jid")}); + t2.length ? t2.forEach((e4) => e4.destroy()) : this.renderBookmarkForm(); + }}; + Object.assign(Uc.ChatRoomView.prototype, e2), Uc.MUCBookmarkForm = eh.extend({className: "muc-bookmark-form chatroom-form-container", initialize(e3) { + this.chatroomview = e3.chatroomview, this.render(); + }, toHTML() { + return ((e3) => { + const t2 = zd("Bookmark this groupchat"), n2 = zd("Would you like this groupchat to be automatically joined upon startup?"), r2 = zd("Cancel"), i2 = zd("The name for this bookmark:"), o2 = zd("What should your nickname for this groupchat be?"), s2 = zd("Save"); + return Za(Kd(), e3.onSubmit, t2, i2, e3.name, o2, e3.nick || "", n2, s2, r2, e3.onCancel); + })(Object.assign(this.model.toJSON(), {onCancel: (e3) => this.closeBookmarkForm(e3), onSubmit: (e3) => this.onBookmarkFormSubmitted(e3)})); + }, onBookmarkFormSubmitted(e3) { + var t2, n2, r2; + e3.preventDefault(), Uc.bookmarks.createBookmark({jid: this.model.get("jid"), autojoin: ((t2 = e3.target.querySelector('input[name="autojoin"]')) === null || t2 === void 0 ? void 0 : t2.checked) || false, name: (n2 = e3.target.querySelector("input[name=name]")) === null || n2 === void 0 ? void 0 : n2.value, nick: (r2 = e3.target.querySelector("input[name=nick]")) === null || r2 === void 0 ? void 0 : r2.value}), this.closeBookmarkForm(e3); + }, closeBookmarkForm(e3) { + e3.preventDefault(), this.chatroomview.closeForm(); + }}), Uc.BookmarksView = eh.extend({tagName: "span", initialize() { + this.listenTo(this.model, "add", this.render), this.listenTo(this.model, "remove", this.render), this.listenTo(Uc.chatboxes, "add", this.render), this.listenTo(Uc.chatboxes, "remove", this.render); + const e3 = "converse.room-bookmarks".concat(Uc.bare_jid, "-list-model"); + this.list_model = new Uc.BookmarksList({id: e3}), this.list_model.browserStorage = Uc.createStore(e3); + const t2 = () => { + this.render(), this.insertIntoControlBox(); + }; + this.list_model.fetch({success: t2, error: t2}); + }, toHTML() { + return Yd({_converse: Uc, bookmarks: this.model, hidden: this.model.getUnopenedBookmarks().length && true, is_hidden: (e3) => !(!Vc.settings.get("hide_open_bookmarks") || !Uc.chatboxes.get(e3.get("jid"))), openRoom: (e3) => this.openRoom(e3), removeBookmark: (e3) => this.removeBookmark(e3), toggleBookmarksList: (e3) => this.toggleBookmarksList(e3), toggle_state: this.list_model.get("toggle-state")}); + }, insertIntoControlBox() { + const e3 = Uc.chatboxviews.get("controlbox"); + if (e3 !== void 0 && !oh.rootContains(Uc.root, this.el)) { + const t2 = e3.el.querySelector(".list-container--bookmarks"); + t2 && t2.parentNode.replaceChild(this.el, t2); + } + }, openRoom(e3) { + e3.preventDefault(); + const t2 = e3.target.textContent, n2 = e3.target.getAttribute("data-room-jid"), r2 = {name: t2 || ih.unescapeNode(ih.getNodeFromJid(n2)) || n2}; + Vc.rooms.open(n2, r2, true); + }, removeBookmark: Uc.removeBookmarkViaEvent, toggleBookmarksList(e3) { + e3 && e3.preventDefault && e3.preventDefault(); + const t2 = e3.target.matches(".fa") ? e3.target : e3.target.querySelector(".fa"); + oh.hasClass("fa-caret-down", t2) ? (oh.slideIn(this.el.querySelector(".bookmarks")), this.list_model.save({"toggle-state": Uc.CLOSED}), t2.classList.remove("fa-caret-down"), t2.classList.add("fa-caret-right")) : (t2.classList.remove("fa-caret-right"), t2.classList.add("fa-caret-down"), oh.slideOut(this.el.querySelector(".bookmarks")), this.list_model.save({"toggle-state": Uc.OPENED})); + }}); + Vc.listen.on("getHeadingButtons", (e3, t2) => { + if (Uc.allow_bookmarks && e3.model.get("type") === Uc.CHATROOMS_TYPE) { + const n2 = e3.model.get("bookmarked"), r2 = {i18n_title: zd(n2 ? "Unbookmark this groupchat" : "Bookmark this groupchat"), i18n_text: zd(n2 ? "Unbookmark" : "Bookmark"), handler: (t3) => e3.toggleBookmark(t3), a_class: "toggle-bookmark", icon_class: "fa-bookmark", name: "bookmark"}, i2 = t2.map((e4) => e4.name).indexOf("details"), o2 = Uc.checkBookmarksSupport().then((e4) => e4 ? r2 : ""); + return i2 > -1 ? [...t2.slice(0, i2), o2, ...t2.slice(i2)] : [o2, ...t2]; + } + return t2; + }), Vc.listen.on("bookmarksInitialized", async function() { + await Vc.waitUntil("roomsPanelRendered"), Uc.bookmarksview = new Uc.BookmarksView({model: Uc.bookmarks}), Vc.trigger("bookmarkViewsInitialized"); + }), Vc.listen.on("chatRoomViewInitialized", (e3) => e3.setBookmarkState()); + }}); + var sh = n(35), ah = n.n(sh); + function ch() { + const e2 = function(e3, t2) { + t2 || (t2 = e3.slice(0)); + return Object.freeze(Object.defineProperties(e3, {raw: {value: Object.freeze(t2)}})); + }(['\n <audio controls src="', '"></audio>\n <a target="_blank" rel="noopener" href="', '">', "</a>\n"]); + return ch = function() { + return e2; + }, e2; + } + function lh() { + const e2 = function(e3, t2) { + t2 || (t2 = e3.slice(0)); + return Object.freeze(Object.defineProperties(e3, {raw: {value: Object.freeze(t2)}})); + }(['<a target="_blank" rel="noopener" href="', '">', "</a>"]); + return lh = function() { + return e2; + }, e2; + } + var uh = (e2) => Za(lh(), e2.url, e2.label_download), dh = n(170), hh = n.n(dh), fh = n(171), ph = n.n(fh), gh = n(64), mh = n.n(gh), vh = n(172), _h = n.n(vh), bh = n(173), yh = n.n(bh), wh = n(174), Sh = n.n(wh), xh = n(65), Eh = n.n(xh); + function Ah() { + const e2 = function(e3, t2) { + t2 || (t2 = e3.slice(0)); + return Object.freeze(Object.defineProperties(e3, {raw: {value: Object.freeze(t2)}})); + }(['<a href="', '"\n class="chat-image__link"\n target="_blank"\n rel="noopener"\n ><img class="chat-image img-thumbnail" src="', '" @click=', " @error=", " @load=", "/></a>"]); + return Ah = function() { + return e2; + }, e2; + } + const Ch = ka((e2, t2, n2, r2) => (i2) => { + i2.setValue(Za(Ah(), t2, e2, r2, function() { + const o2 = rl.env.utils; + o2.isURLWithImageExtension(e2) ? (i2.setValue(o2.convertUrlToHyperlink(t2)), i2.commit()) : (i2.setValue(Ch("".concat(e2, ".png"), t2, n2, r2)), i2.commit()); + }, n2)); + }); + function jh() { + const e2 = function(e3, t2) { + t2 || (t2 = e3.slice(0)); + return Object.freeze(Object.defineProperties(e3, {raw: {value: Object.freeze(t2)}})); + }(["", ""]); + return jh = function() { + return e2; + }, e2; + } + var Th = n(175), Oh = n.n(Th); + function kh() { + const e2 = function(e3, t2) { + t2 || (t2 = e3.slice(0)); + return Object.freeze(Object.defineProperties(e3, {raw: {value: Object.freeze(t2)}})); + }(['<video controls preload="metadata" src="', '" style="max-height: 50vh"></video>']); + return kh = function() { + return e2; + }, e2; + } + function Nh() { + const e2 = Mh(['<a target="_blank" rel="noopener" href="', '">', "</a>"]); + return Nh = function() { + return e2; + }, e2; + } + function Ih() { + const e2 = Mh(['\n <a target="_blank"\n rel="noopener"\n @click=', '\n href="', '">', "</a>"]); + return Ih = function() { + return e2; + }, e2; + } + function Mh(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + /** + * @copyright 2020, the Converse.js contributors + * @license Mozilla Public License (MPLv2) + * @description This is the DOM/HTML utilities module. + */ + const Rh = ["http", "https", "xmpp", "mailto"]; + function Dh(e2, t2) { + return {"muc#roomconfig_lang": "language", "muc#roomconfig_roomsecret": (t2 == null ? void 0 : t2.new_password) ? "new-password" : "current-password"}[e2]; + } + const Ph = {"text-private": "password", "text-single": "text", fixed: "label", boolean: "checkbox", hidden: "hidden", "jid-multi": "textarea", "list-single": "dropdown", "list-multi": "dropdown"}; + function Lh(e2) { + try { + return e2 instanceof ah.a ? e2 : new ah.a(e2); + } catch (e3) { + return zn.debug(e3), null; + } + } + function zh(e2, t2) { + const n2 = Lh(t2); + if (n2 === null || !function(e3) { + return window.location.protocol === "http:" || window.location.protocol === "https:" && e3.protocol().toLowerCase() === "https"; + }(n2)) + return false; + const r2 = n2.filename().toLowerCase(); + return !!e2.filter((e3) => r2.endsWith(e3)).length; + } + function Fh(e2) { + try { + return decodeURI(e2.filename()); + } catch (t2) { + return zn.debug(t2), e2.filename(); + } + } + function Bh(e2, t2) { + const {__: n2} = e2; + return r2 = {url: t2.toString(), label_download: n2('Download audio file "%1$s"', Fh(t2))}, Za(ch(), r2.url, r2.url, r2.label_download); + var r2; + } + function qh(e2) { + e2.preventDefault(), Vc.rooms.open(e2.target.href); + } + function Hh(e2, t2) { + e2.classList.remove("visible"), M(t2) && t2(); + } + Jo.isAudioURL = (e2) => zh([".ogg", ".mp3", ".m4a"], e2), Jo.isVideoURL = (e2) => zh([".mp4", ".webm"], e2), Jo.isURLWithImageExtension = (e2) => zh([".jpg", ".jpeg", ".png", ".gif", ".bmp", ".tiff", ".svg"], e2), Jo.isImageURL = (e2) => { + const t2 = Vc.settings.get("image_urls_regex"); + return (t2 == null ? void 0 : t2.test(e2)) || Jo.isURLWithImageExtension(e2); + }, Jo.isImageDomainAllowed = (e2) => { + const t2 = Vc.settings.get("show_images_inline"); + if (!Array.isArray(t2)) + return true; + try { + const n2 = Lh(e2).domain(); + return t2.includes(n2); + } catch (e3) { + return zn.debug(e3), true; + } + }, Jo.getOOBURLMarkup = function(e2, t2) { + const n2 = Lh(t2); + return n2 === null ? t2 : Jo.isVideoURL(n2) ? (r2 = {url: t2}, Za(kh(), r2.url)) : Jo.isAudioURL(n2) ? Bh(e2, n2) : Jo.isImageURL(n2) ? function(e3, t3) { + const {__: n3} = e3; + return uh({url: t3.toString(), label_download: n3('Download image file "%1$s"', Fh(t3))}); + }(e2, n2) : function(e3, t3) { + const {__: n3} = e3; + return uh({url: t3.toString(), label_download: n3('Download file "%1$s"', Fh(t3))}); + }(e2, n2); + var r2; + }, Jo.applyDragResistance = function(e2, t2) { + if (e2 === void 0) + return; + if (t2 === void 0) + return e2; + return e2 !== t2 && Math.abs(e2 - t2) < 10 ? t2 : e2; + }, Jo.calculateElementHeight = function(e2) { + return Array.from(e2.children).reduce((e3, t2) => e3 + t2.offsetHeight, 0); + }, Jo.getNextElement = function(e2, t2 = "*") { + let n2 = e2.nextElementSibling; + for (; n2 !== null && !mr.a.matchesSelector(n2, t2); ) + n2 = n2.nextElementSibling; + return n2; + }, Jo.getPreviousElement = function(e2, t2 = "*") { + let n2 = e2.previousElementSibling; + for (; n2 !== null && !mr.a.matchesSelector(n2, t2); ) + n2 = n2.previousElementSibling; + return n2; + }, Jo.getFirstChildElement = function(e2, t2 = "*") { + let n2 = e2.firstElementChild; + for (; n2 !== null && !mr.a.matchesSelector(n2, t2); ) + n2 = n2.nextElementSibling; + return n2; + }, Jo.getLastChildElement = function(e2, t2 = "*") { + let n2 = e2.lastElementChild; + for (; n2 !== null && !mr.a.matchesSelector(n2, t2); ) + n2 = n2.previousElementSibling; + return n2; + }, Jo.hasClass = function(e2, t2) { + return t2 instanceof Element && t2.classList.contains(e2); + }, Jo.toggleClass = function(e2, t2) { + Jo.hasClass(e2, t2) ? Jo.removeClass(e2, t2) : Jo.addClass(e2, t2); + }, Jo.addClass = function(e2, t2) { + return t2 instanceof Element && t2.classList.add(e2), t2; + }, Jo.removeClass = function(e2, t2) { + return t2 instanceof Element && t2.classList.remove(e2), t2; + }, Jo.removeElement = function(e2) { + return e2 instanceof Element && e2.parentNode && e2.parentNode.removeChild(e2), e2; + }, Jo.getElementFromTemplateResult = function(e2) { + const t2 = document.createElement("div"); + return Ya(e2, t2), t2.firstElementChild; + }, Jo.showElement = (e2) => { + Jo.removeClass("collapsed", e2), Jo.removeClass("hidden", e2); + }, Jo.hideElement = function(e2) { + return e2 instanceof Element && e2.classList.add("hidden"), e2; + }, Jo.ancestor = function(e2, t2) { + let n2 = e2; + for (; n2 !== null && !mr.a.matchesSelector(n2, t2); ) + n2 = n2.parentElement; + return n2; + }, Jo.nextUntil = function(e2, t2) { + const n2 = []; + let r2 = e2.nextElementSibling; + for (; r2 !== null && !r2.matches(t2); ) + n2.push(r2), r2 = r2.nextElementSibling; + return n2; + }, Jo.unescapeHTML = function(e2) { + var t2 = document.createElement("div"); + return t2.innerHTML = e2, t2.innerText; + }, Jo.escapeHTML = function(e2) { + return e2.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """); + }, Jo.convertToImageTag = function(e2, t2, n2) { + return r2 = {url: e2, onClick: n2, onLoad: t2}, Za(jh(), Ch(r2.url, r2.url, r2.onLoad, r2.onClick)); + var r2; + }, Jo.convertURIoHyperlink = function(e2, t2) { + let n2 = e2.normalize()._string; + const r2 = e2._parts.urn ? n2 : e2.readable(), i2 = t2 || r2; + return e2._parts.protocol || n2.startsWith("http://") || n2.startsWith("https://") || (n2 = "http://" + n2), e2._parts.protocol === "xmpp" && e2._parts.query === "join" ? Za(Ih(), qh, n2, i2) : Za(Nh(), n2, i2); + }, Jo.convertUrlToHyperlink = function(e2) { + const t2 = RegExp("^w{3}.", "ig").test(e2) ? "http://".concat(e2) : e2, n2 = Lh(e2); + return n2 === null || !function(e3) { + try { + return !!new URL(e3); + } catch (e4) { + return false; + } + }(t2) || !function(e3, t3 = Rh) { + return !!t3.includes(e3); + }(n2._parts.protocol) && n2._parts.protocol ? e2 : this.convertURIoHyperlink(n2, e2); + }, Jo.filterQueryParamsFromURL = function(e2) { + const t2 = Vc.settings.get("filter_url_query_params"); + return t2 ? Lh(e2).removeQuery(t2).toString() : e2; + }, Jo.addHyperlinks = function(e2) { + const t2 = [], n2 = {start: /\b(?:([a-z][a-z0-9.+-]*:\/\/)|xmpp:|mailto:|www\.)/gi}; + try { + ah.a.withinString(e2, (e3, n3, r3) => (t2.push({url: e3, start: n3, end: r3}), e3), n2); + } catch (t3) { + return zn.debug(t3), [e2]; + } + let r2 = [e2]; + return t2.length ? t2.sort((e3, t3) => t3.start - e3.start).forEach((e3) => { + const t3 = r2.shift(), n3 = t3.slice(e3.start, e3.end); + r2 = [t3.slice(0, e3.start), Jo.convertUrlToHyperlink(n3), t3.slice(e3.end), ...r2]; + }) : r2 = [e2], r2; + }, Jo.httpToGeoUri = function(e2, t2) { + return e2.replace(t2.api.settings.get("geouri_regex"), "geo:$1,$2"); + }, Jo.slideInAllElements = function(e2, t2 = 300) { + return Promise.all(Array.from(e2).map((e3) => Jo.slideIn(e3, t2))); + }, Jo.slideToggleElement = function(e2, t2) { + return Jo.hasClass("collapsed", e2) || Jo.hasClass("hidden", e2) ? Jo.slideOut(e2, t2) : Jo.slideIn(e2, t2); + }, Jo.slideOut = function(e2, t2 = 200) { + return new Promise((n2, r2) => { + if (!e2) { + const e3 = "An element needs to be passed in to slideOut"; + return zn.warn(e3), void r2(new Error(e3)); + } + const i2 = e2.getAttribute("data-slider-marker"); + i2 && (e2.removeAttribute("data-slider-marker"), window.cancelAnimationFrame(i2)); + const o2 = Jo.calculateElementHeight(e2); + if (window.converse_disable_effects) + return e2.style.height = o2 + "px", function(e3) { + e3.removeAttribute("data-slider-marker"), e3.classList.remove("collapsed"), e3.style.overflow = "", e3.style.height = ""; + }(e2), void n2(); + if (!Jo.hasClass("collapsed", e2) && !Jo.hasClass("hidden", e2)) + return void n2(); + const s2 = t2 / 17; + let a2 = 0; + e2.style.height = "0", e2.style.overflow = "hidden", e2.classList.remove("hidden"), e2.classList.remove("collapsed"), e2.setAttribute("data-slider-marker", window.requestAnimationFrame(function t3() { + a2 += o2 / s2, a2 < o2 ? (e2.style.height = a2 + "px", e2.setAttribute("data-slider-marker", window.requestAnimationFrame(t3))) : (e2.removeAttribute("data-slider-marker"), e2.style.height = Jo.calculateElementHeight(e2) + "px", e2.style.overflow = "", e2.style.height = "", n2()); + })); + }); + }, Jo.slideIn = function(e2, t2 = 200) { + return new Promise((n2, r2) => { + if (!e2) { + const e3 = "An element needs to be passed in to slideIn"; + return zn.warn(e3), r2(new Error(e3)); + } + if (Jo.hasClass("collapsed", e2)) + return n2(e2); + if (window.converse_disable_effects) + return e2.classList.add("collapsed"), e2.style.height = "", n2(e2); + const i2 = e2.getAttribute("data-slider-marker"); + i2 && (e2.removeAttribute("data-slider-marker"), window.cancelAnimationFrame(i2)); + const o2 = e2.offsetHeight, s2 = t2 / 17; + let a2 = o2; + e2.style.overflow = "hidden", e2.setAttribute("data-slider-marker", window.requestAnimationFrame(function t3() { + a2 -= o2 / s2, a2 > 0 ? (e2.style.height = a2 + "px", e2.setAttribute("data-slider-marker", window.requestAnimationFrame(t3))) : (e2.removeAttribute("data-slider-marker"), e2.classList.add("collapsed"), e2.style.height = "", n2(e2)); + })); + }); + }, Jo.isInDOM = function(e2) { + return document.querySelector("body").contains(e2); + }, Jo.isVisible = function(e2) { + return e2 !== null && (!Jo.hasClass("hidden", e2) && (e2.offsetWidth > 0 || e2.offsetHeight > 0 || e2.getClientRects().length > 0)); + }, Jo.fadeIn = function(e2, t2) { + if (e2 || zn.warn("An element needs to be passed in to fadeIn"), window.converse_disable_effects) + return e2.classList.remove("hidden"), Hh(e2, t2); + Jo.hasClass("hidden", e2) ? (e2.classList.add("visible"), e2.classList.remove("hidden"), e2.addEventListener("webkitAnimationEnd", () => Hh(e2, t2)), e2.addEventListener("animationend", () => Hh(e2, t2)), e2.addEventListener("oanimationend", () => Hh(e2, t2))) : Hh(e2, t2); + }, Jo.xForm2webForm = function(e2, t2, n2) { + if (e2.getAttribute("type") === "list-single" || e2.getAttribute("type") === "list-multi") { + const t3 = Jo.queryChildren(e2, "value").map((e3) => e3 == null ? void 0 : e3.textContent), n3 = Jo.queryChildren(e2, "option").map((n4) => { + var r3; + const i3 = (r3 = n4.querySelector("value")) === null || r3 === void 0 ? void 0 : r3.textContent; + return Oh()({value: i3, label: n4.getAttribute("label"), selected: t3.includes(i3), required: !!e2.querySelector("required")}); + }); + return _h()({id: Jo.getUniqueId(), name: e2.getAttribute("var"), label: e2.getAttribute("label"), options: n3.join(""), multiple: e2.getAttribute("type") === "list-multi", required: !!e2.querySelector("required")}); + } + if (e2.getAttribute("type") === "fixed") { + var r2; + return '<p class="form-help">' + ((r2 = e2.querySelector("value")) === null || r2 === void 0 ? void 0 : r2.textContent) + "</p>"; + } + var i2, o2, s2; + if (e2.getAttribute("type") === "jid-multi") + return yh()({name: e2.getAttribute("var"), label: e2.getAttribute("label") || "", value: (i2 = e2.querySelector("value")) === null || i2 === void 0 ? void 0 : i2.textContent, required: !!e2.querySelector("required")}); + if (e2.getAttribute("type") === "boolean") { + var a2; + const t3 = (a2 = e2.querySelector("value")) === null || a2 === void 0 ? void 0 : a2.textContent; + return ph()({id: Jo.getUniqueId(), name: e2.getAttribute("var"), label: e2.getAttribute("label") || "", checked: t3 === "1" || t3 === "true" ? 'checked="1"' : "", required: !!e2.querySelector("required")}); + } + if (e2.getAttribute("var") === "url") + return Sh()({label: e2.getAttribute("label") || "", value: (o2 = e2.querySelector("value")) === null || o2 === void 0 ? void 0 : o2.textContent}); + if (e2.getAttribute("var") === "username") + return Eh()({domain: " @" + n2.domain, name: e2.getAttribute("var"), type: Ph[e2.getAttribute("type")], label: e2.getAttribute("label") || "", value: (s2 = e2.querySelector("value")) === null || s2 === void 0 ? void 0 : s2.textContent, required: !!e2.querySelector("required")}); + if (e2.getAttribute("var") === "ocr") { + const n3 = e2.querySelector("uri"), r3 = mr()('data[cid="' + n3.textContent.replace(/^cid:/, "") + '"]', t2)[0]; + return hh()({label: e2.getAttribute("label"), name: e2.getAttribute("var"), data: r3 == null ? void 0 : r3.textContent, type: n3.getAttribute("type"), required: !!e2.querySelector("required")}); + } + { + var c2; + const t3 = e2.getAttribute("var"); + return mh()({id: Jo.getUniqueId(), label: e2.getAttribute("label") || "", name: t3, fixed_username: n2 == null ? void 0 : n2.fixed_username, autocomplete: Dh(t3, n2), placeholder: null, required: !!e2.querySelector("required"), type: Ph[e2.getAttribute("type")], value: (c2 = e2.querySelector("value")) === null || c2 === void 0 ? void 0 : c2.textContent}); + } + }; + var Uh = Jo; + const {keycodes: $h} = rl; + function Wh(e2) { + let t2 = 0; + do { + isNaN(e2.offsetTop) || (t2 += e2.offsetTop); + } while (e2 = e2.offsetParent); + return t2; + } + function Gh(e2) { + let t2 = 0; + do { + isNaN(e2.offsetLeft) || (t2 += e2.offsetLeft); + } while (e2 = e2.offsetParent); + return t2; + } + class Vh { + static get DIRECTION() { + return {down: "down", end: "end", home: "home", left: "left", right: "right", up: "up"}; + } + static get DEFAULTS() { + return {home: ["".concat($h.SHIFT, "+").concat($h.UP_ARROW)], end: ["".concat($h.SHIFT, "+").concat($h.DOWN_ARROW)], up: [$h.UP_ARROW], down: [$h.DOWN_ARROW], left: [$h.LEFT_ARROW, "".concat($h.SHIFT, "+").concat($h.TAB)], right: [$h.RIGHT_ARROW, $h.TAB], getSelector: null, jump_to_picked: null, jump_to_picked_direction: null, jump_to_picked_selector: "picked", onSelected: null, selected: "selected", selector: "li"}; + } + static getClosestElement(e2, t2) { + return e2.reduce((e3, n2) => { + const r2 = t2(n2); + return r2 < e3.distance ? {distance: r2, element: n2} : e3; + }, {distance: 1 / 0}).element; + } + constructor(e2, t2) { + this.doc = window.document, this.container = e2, this.scroll_container = t2.scroll_container || e2, this.options = Object.assign({}, Vh.DEFAULTS, t2), this.init(); + } + init() { + this.selected = null, this.keydownHandler = null, this.elements = {}, this.keys = {}, this.options.down.forEach((e2) => this.keys[e2] = Vh.DIRECTION.down), this.options.end.forEach((e2) => this.keys[e2] = Vh.DIRECTION.end), this.options.home.forEach((e2) => this.keys[e2] = Vh.DIRECTION.home), this.options.left.forEach((e2) => this.keys[e2] = Vh.DIRECTION.left), this.options.right.forEach((e2) => this.keys[e2] = Vh.DIRECTION.right), this.options.up.forEach((e2) => this.keys[e2] = Vh.DIRECTION.up); + } + enable() { + this.getElements(), this.keydownHandler = (e2) => this.handleKeydown(e2), this.doc.addEventListener("keydown", this.keydownHandler), this.enabled = true; + } + disable() { + this.keydownHandler && this.doc.removeEventListener("keydown", this.keydownHandler), this.unselect(), this.elements = {}, this.enabled = false; + } + destroy() { + this.disable(), this.container.domNavigator && delete this.container.domNavigator; + } + getNextElement(e2) { + let t2; + if (e2 === Vh.DIRECTION.home) + t2 = this.getElements(e2)[0]; + else if (e2 === Vh.DIRECTION.end) + t2 = Array.from(this.getElements(e2)).pop(); + else if (this.selected) + if (e2 === Vh.DIRECTION.right) { + const n2 = this.getElements(e2); + t2 = n2.slice(n2.indexOf(this.selected))[1]; + } else if (e2 == Vh.DIRECTION.left) { + const n2 = this.getElements(e2); + t2 = n2.slice(0, n2.indexOf(this.selected)).pop() || this.selected; + } else if (e2 == Vh.DIRECTION.down) { + const e3 = this.selected.offsetLeft, n2 = this.selected.offsetTop + this.selected.offsetHeight, r2 = this.elementsAfter(0, n2), i2 = (t3) => Math.abs(t3.offsetLeft - e3) + Math.abs(t3.offsetTop - n2); + t2 = Vh.getClosestElement(r2, i2); + } else { + if (e2 != Vh.DIRECTION.up) + throw new Error("getNextElement: invalid direction value"); + { + const e3 = this.selected.offsetLeft, n2 = this.selected.offsetTop - 1, r2 = this.elementsBefore(1 / 0, n2), i2 = (t3) => Math.abs(e3 - t3.offsetLeft) + Math.abs(n2 - t3.offsetTop); + t2 = Vh.getClosestElement(r2, i2); + } + } + else + t2 = e2 === Vh.DIRECTION.right || e2 === Vh.DIRECTION.down ? this.getElements(e2)[1] : this.getElements(e2)[0]; + return this.options.jump_to_picked && t2 && t2.matches(this.options.jump_to_picked) && e2 === this.options.jump_to_picked_direction && (t2 = this.container.querySelector(this.options.jump_to_picked_selector) || t2), t2; + } + select(e2, t2) { + e2 && e2 !== this.selected && (this.unselect(), t2 && this.scrollTo(e2, t2), e2.matches("input") ? e2.focus() : Uh.addClass(this.options.selected, e2), this.selected = e2, this.options.onSelected && this.options.onSelected(e2)); + } + unselect() { + this.selected && (Uh.removeClass(this.options.selected, this.selected), delete this.selected); + } + scrollTo(e2, t2) { + if (this.inScrollContainerViewport(e2)) { + if (!function(e3) { + const t3 = e3.getBoundingClientRect(); + return t3.top >= 0 && t3.left >= 0 && t3.bottom <= window.innerHeight && t3.right <= window.innerWidth; + }(e2)) + switch (t2) { + case Vh.DIRECTION.left: + document.body.scrollLeft = Gh(e2) - document.body.offsetLeft; + break; + case Vh.DIRECTION.up: + document.body.scrollTop = Wh(e2) - document.body.offsetTop; + break; + case Vh.DIRECTION.right: + document.body.scrollLeft = Gh(e2) - document.body.offsetLeft - (document.documentElement.clientWidth - e2.offsetWidth); + break; + case Vh.DIRECTION.down: + document.body.scrollTop = Wh(e2) - document.body.offsetTop - (document.documentElement.clientHeight - e2.offsetHeight); + } + } else { + const n2 = this.scroll_container; + if (!n2.contains(e2)) + return; + switch (t2) { + case Vh.DIRECTION.left: + n2.scrollLeft = e2.offsetLeft - n2.offsetLeft, n2.scrollTop = e2.offsetTop - n2.offsetTop; + break; + case Vh.DIRECTION.up: + n2.scrollTop = e2.offsetTop - n2.offsetTop; + break; + case Vh.DIRECTION.right: + n2.scrollLeft = e2.offsetLeft - n2.offsetLeft - (n2.offsetWidth - e2.offsetWidth), n2.scrollTop = e2.offsetTop - n2.offsetTop - (n2.offsetHeight - e2.offsetHeight); + break; + case Vh.DIRECTION.down: + n2.scrollTop = e2.offsetTop - n2.offsetTop - (n2.offsetHeight - e2.offsetHeight); + } + } + } + inScrollContainerViewport(e2) { + const t2 = this.scroll_container; + return !(e2.offsetLeft - t2.scrollLeft < t2.offsetLeft) && (!(e2.offsetTop - t2.scrollTop < t2.offsetTop) && (!(e2.offsetLeft + e2.offsetWidth - t2.scrollLeft > t2.offsetLeft + t2.offsetWidth) && !(e2.offsetTop + e2.offsetHeight - t2.scrollTop > t2.offsetTop + t2.offsetHeight))); + } + getElements(e2) { + const t2 = this.options.getSelector ? this.options.getSelector(e2) : this.options.selector; + return this.elements[t2] || (this.elements[t2] = Array.from(this.container.querySelectorAll(t2))), this.elements[t2]; + } + elementsAfter(e2, t2) { + return this.getElements(Vh.DIRECTION.down).filter((n2) => n2.offsetLeft >= e2 && n2.offsetTop >= t2); + } + elementsBefore(e2, t2) { + return this.getElements(Vh.DIRECTION.up).filter((n2) => n2.offsetLeft <= e2 && n2.offsetTop <= t2); + } + handleKeydown(e2) { + const t2 = $h, n2 = e2.shiftKey ? this.keys["".concat(t2.SHIFT, "+").concat(e2.which)] : this.keys[e2.which]; + if (n2) { + e2.preventDefault(), e2.stopPropagation(); + const t3 = this.getNextElement(n2, e2); + this.select(t3, n2); + } + } + } + var Jh = Vh; + /** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ + const Xh = new WeakMap(), Qh = ka((...e2) => (t2) => { + let n2 = Xh.get(t2); + n2 === void 0 && (n2 = {lastRenderedIndex: 2147483647, values: []}, Xh.set(t2, n2)); + const r2 = n2.values; + let i2 = r2.length; + n2.values = e2; + for (let o2 = 0; o2 < e2.length && !(o2 > n2.lastRenderedIndex); o2++) { + const s2 = e2[o2]; + if (La(s2) || typeof s2.then != "function") { + t2.setValue(s2), n2.lastRenderedIndex = o2; + break; + } + o2 < i2 && s2 === r2[o2] || (n2.lastRenderedIndex = 2147483647, i2 = 0, Promise.resolve(s2).then((e3) => { + const r3 = n2.values.indexOf(s2); + r3 > -1 && r3 < n2.lastRenderedIndex && (n2.lastRenderedIndex = r3, t2.setValue(e3), t2.commit()); + })); + } + }); + function Yh() { + const e2 = function(e3, t2) { + t2 || (t2 = e3.slice(0)); + return Object.freeze(Object.defineProperties(e3, {raw: {value: Object.freeze(t2)}})); + }(['\n <div class="dropleft">\n <button type="button" class="btn btn--transparent btn--standalone" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">\n <i class="', ' only-icon"></i>\n </button>\n <div class="dropdown-menu">\n ', "\n </div>\n </div>\n "]); + return Yh = function() { + return e2; + }, e2; + } + const Kh = rl.env.utils; + class Zh extends mc { + firstUpdated() { + this.menu = this.querySelector(".dropdown-menu"), this.dropdown = this.firstElementChild, this.button = this.dropdown.querySelector("button"), this.dropdown.addEventListener("click", (e2) => this.toggleMenu(e2)), this.dropdown.addEventListener("keyup", (e2) => this.handleKeyUp(e2)), document.addEventListener("click", (e2) => !this.contains(e2.composedPath()[0]) && this.hideMenu(e2)); + } + hideMenu() { + var e2, t2; + Kh.removeClass("show", this.menu), (e2 = this.button) === null || e2 === void 0 || e2.setAttribute("aria-expanded", false), (t2 = this.button) === null || t2 === void 0 || t2.blur(); + } + showMenu() { + Kh.addClass("show", this.menu), this.button.setAttribute("aria-expanded", true); + } + toggleMenu(e2) { + e2.preventDefault(), Kh.hasClass("show", this.menu) ? this.hideMenu() : this.showMenu(); + } + handleKeyUp(e2) { + e2.keyCode === rl.keycodes.ESCAPE ? this.hideMenu() : e2.keyCode === rl.keycodes.DOWN_ARROW && this.navigator && !this.navigator.enabled && this.enableArrowNavigation(e2); + } + } + function ef() { + const e2 = rf(['<converse-dropdown class="chat-msg__actions" .items=', "></converse-dropdown>"]); + return ef = function() { + return e2; + }, e2; + } + function tf() { + const e2 = rf(['\n <button class="chat-msg__action ', '" @click=', '>\n <converse-icon class="', '"\n path-prefix="', '"\n color="var(--text-color-lighten-15-percent)"\n size="1em"></converse-icon>\n ', "\n </button>\n "]); + return tf = function() { + return e2; + }, e2; + } + function nf() { + const e2 = rf(["", ""]); + return nf = function() { + return e2; + }, e2; + } + function rf(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + Vc.elements.define("converse-dropdown", class extends Zh { + static get properties() { + return {icon_classes: {type: String}, items: {type: Array}}; + } + render() { + const e2 = this.icon_classes || "fa fa-bars"; + return Za(Yh(), e2, this.items.map((e3) => Qh(e3, ""))); + } + hideMenu() { + super.hideMenu(), this.navigator.disable(); + } + firstUpdated() { + super.firstUpdated(), this.initArrowNavigation(); + } + initArrowNavigation() { + if (!this.navigator) { + const e2 = {selector: ".dropdown-item", onSelected: (e3) => e3.focus()}; + this.navigator = new Jh(this.menu, e2); + } + } + enableArrowNavigation(e2) { + e2 && (e2.preventDefault(), e2.stopPropagation()), this.navigator.enable(), this.navigator.select(this.menu.firstElementChild); + } + handleKeyUp(e2) { + super.handleKeyUp(e2), e2.keyCode !== rl.keycodes.DOWN_ARROW || this.navigator.enabled || this.enableArrowNavigation(e2); + } + }); + class of extends mc { + static get properties() { + return {chatview: {type: Object}, model: {type: Object}, editable: {type: Boolean}, correcting: {type: Boolean}, message_type: {type: String}, is_retracted: {type: Boolean}}; + } + render() { + return Za(nf(), Qh(this.renderActions(), "")); + } + static getActionsDropdownItem(e2) { + return Za(tf(), e2.button_class, e2.handler, e2.icon_class, Vc.settings.get("assets_path"), e2.i18n_text); + } + onMessageEditButtonClicked(e2) { + e2.preventDefault(), this.chatview.onMessageEditButtonClicked(this.model); + } + onMessageRetractButtonClicked(e2) { + e2.preventDefault(), this.chatview.onMessageRetractButtonClicked(this.model); + } + async getActionButtons() { + const e2 = []; + this.editable && e2.push({i18n_text: this.correcting ? zd("Cancel Editing") : zd("Edit"), handler: (e3) => this.onMessageEditButtonClicked(e3), button_class: "chat-msg__action-edit", icon_class: "fa fa-pencil-alt", name: "edit"}); + const t2 = this.model.get("type") === "groupchat" && await this.model.mayBeModerated(); + return !this.is_retracted && (this.model.mayBeRetracted() || t2) && e2.push({i18n_text: zd("Retract"), handler: (e3) => this.onMessageRetractButtonClicked(e3), button_class: "chat-msg__action-retract", icon_class: "fas fa-trash-alt", name: "retract"}), Vc.hook("getMessageActionButtons", this, e2); + } + async renderActions() { + const e2 = (await this.getActionButtons()).map((e3) => of.getActionsDropdownItem(e3)); + return e2.length ? Za(ef(), e2) : ""; + } + } + Vc.elements.define("converse-message-actions", of); + var sf = n(34), af = n.n(sf); + function cf() { + const e2 = function(e3, t2) { + t2 || (t2 = e3.slice(0)); + return Object.freeze(Object.defineProperties(e3, {raw: {value: Object.freeze(t2)}})); + }(['<div class="alert ', '" role="alert"><p>', "</p></div>"]); + return cf = function() { + return e2; + }, e2; + } + const {sizzle: lf} = rl.env, uf = rl.env.utils; + var df = eh.extend({className: "modal", persistent: false, events: {"click .nav-item .nav-link": "switchTab"}, initialize(e2) { + if (!this.id) + throw new Error("Each modal class must have a unique id attribute"); + this.render(), Object.assign(this, e2), this.el.setAttribute("tabindex", "-1"), this.el.setAttribute("role", "dialog"), this.el.setAttribute("aria-hidden", "true"); + const t2 = this.el.querySelector(".modal-title").getAttribute("id"); + t2 && this.el.setAttribute("aria-labelledby", t2), this.insertIntoDOM(); + const n2 = af.a.Modal; + this.modal = new n2(this.el, {backdrop: true, keyboard: true}), this.el.addEventListener("hide.bs.modal", () => this.onHide(), false); + }, onHide() { + uf.removeClass("selected", this.trigger_el), !this.persistent && Vc.modal.remove(this); + }, insertIntoDOM() { + Uc.chatboxviews.el.querySelector("#converse-modals").insertAdjacentElement("beforeEnd", this.el); + }, switchTab(e2) { + e2.stopPropagation(), e2.preventDefault(), lf(".nav-link.active", this.el).forEach((e3) => { + uf.removeClass("active", this.el.querySelector(e3.getAttribute("href"))), uf.removeClass("active", e3); + }), uf.addClass("active", e2.target), uf.addClass("active", this.el.querySelector(e2.target.getAttribute("href"))); + }, alert(e2, t2 = "primary") { + const n2 = this.el.querySelector(".modal-alert"); + if (n2 === null) + return void zn.error("Could not find a .modal-alert element in the modal to show an alert message in!"); + var r2; + Ya((r2 = {type: "alert-".concat(t2), message: e2}, Za(cf(), r2.type, r2.message)), n2); + const i2 = n2.firstElementChild; + setTimeout(() => { + uf.addClass("fade-out", i2), setTimeout(() => uf.removeElement(i2), 600); + }, 5e3); + }, show(e2) { + e2 && (e2.preventDefault(), this.trigger_el = e2.target, this.trigger_el.classList.add("selected")), this.modal.show(); + }}); + function hf() { + const e2 = pf(['<button type="button" class="close" data-dismiss="modal" aria-label="', '"><span aria-hidden="true">\xD7</span></button>']); + return hf = function() { + return e2; + }, e2; + } + function ff() { + const e2 = pf(['<button type="button" class="btn btn-secondary" data-dismiss="modal">', "</button>"]); + return ff = function() { + return e2; + }, e2; + } + function pf(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + const gf = Za(ff(), zd("Close")), mf = Za(hf(), zd("Close")); + function vf() { + const e2 = function(e3, t2) { + t2 || (t2 = e3.slice(0)); + return Object.freeze(Object.defineProperties(e3, {raw: {value: Object.freeze(t2)}})); + }(['\n <div class="modal-dialog fit-content" role="document">\n <div class="modal-content fit-content">\n <div class="modal-header">\n <h4 class="modal-title" id="message-versions-modal-label">', '<a target="_blank" rel="noopener" href="', '">', "</a></h4>\n ", '\n </div>\n <div class="modal-body modal-body--image fit-content">\n <img class="chat-image" src="', '" @load=', '>\n </div>\n <div class="modal-footer">', "</div>\n </div>\n </div>"]); + return vf = function() { + return e2; + }, e2; + } + var _f = df.extend({id: "image-modal", toHTML() { + return e2 = {src: this.src, onload: (e3) => e3.target.parentElement.style.height = "".concat(e3.target.height, "px")}, Za(vf(), zd("Image: "), e2.src, e2.src, mf, e2.src, e2.onload, gf); + var e2; + }}); + function bf() { + const e2 = wf(["", ""]); + return bf = function() { + return e2; + }, e2; + } + function yf() { + const e2 = wf(["", ""]); + return yf = function() { + return e2; + }, e2; + } + function wf(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + const Sf = ka((e2, t2, n2) => (r2) => r2.setValue(function(e3, t3, n3) { + const r3 = new $f(e3, t3, n3, false); + return Za(yf(), Qh(async function(e4) { + return await e4.addTemplates(), e4.payload; + }(r3), Za(bf(), r3))); + }(e2, t2, n2))); + function xf() { + const e2 = Of(['<span class="styling-directive">*</span><b>', '</b><span class="styling-directive">*</span>']); + return xf = function() { + return e2; + }, e2; + } + function Ef() { + const e2 = Of(['<span class="styling-directive">~</span><del>', '</del><span class="styling-directive">~</span>']); + return Ef = function() { + return e2; + }, e2; + } + function Af() { + const e2 = Of(["<blockquote>", "</blockquote>"]); + return Af = function() { + return e2; + }, e2; + } + function Cf() { + const e2 = Of(['<div class="styling-directive">```</div><code class="block">', '</code><div class="styling-directive">```</div>'], ['<div class="styling-directive">\\`\\`\\`</div><code class="block">', '</code><div class="styling-directive">\\`\\`\\`</div>']); + return Cf = function() { + return e2; + }, e2; + } + function jf() { + const e2 = Of(['<span class="styling-directive">`</span><code>', '</code><span class="styling-directive">`</span>'], ['<span class="styling-directive">\\`</span><code>', '</code><span class="styling-directive">\\`</span>']); + return jf = function() { + return e2; + }, e2; + } + function Tf() { + const e2 = Of(['<span class="styling-directive">_</span><i>', '</i><span class="styling-directive">_</span>']); + return Tf = function() { + return e2; + }, e2; + } + function Of(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + /** + * @copyright 2020, the Converse.js contributors + * @license Mozilla Public License (MPLv2) + * @description Utility functions to help with parsing XEP-393 message styling hints + * @todo Other parsing helpers can be made more abstract and placed here. + */ + const kf = ["*", "_", "~", "`", "```", ">"], Nf = {"*": {name: "strong", type: "span"}, _: {name: "emphasis", type: "span"}, "~": {name: "strike", type: "span"}, "`": {name: "preformatted", type: "span"}, "```": {name: "preformatted_block", type: "block"}, ">": {name: "quote", type: "block"}}, If = ["_", ">", "`", "~"], Mf = {emphasis: (e2, t2, n2) => Za(Tf(), Sf(e2, t2, n2)), preformatted: (e2) => Za(jf(), e2), preformatted_block: (e2) => Za(Cf(), e2), quote: (e2, t2, n2) => Za(Af(), Sf(e2, t2, n2)), strike: (e2, t2, n2) => Za(Ef(), Sf(e2, t2, n2)), strong: (e2, t2, n2) => Za(xf(), Sf(e2, t2, n2))}; + function Rf(e2, t2, n2 = true) { + let r2; + if (!/(^```\s*\n|^```\s*$)/.test(e2.slice(t2)) || t2 !== 0 && e2[t2 - 1] !== "\n" && e2[t2 - 1] !== ">") { + if (!kf.includes(e2.slice(t2, t2 + 1))) + return null; + if (r2 = e2.slice(t2, t2 + 1), !function(e3, t3, n3, r3) { + if (r3) { + const r4 = RegExp(If.includes(e3) ? "^(\\p{L}|\\p{N})".concat(e3) : "^(\\p{L}|\\p{N})\\".concat(e3), "u"); + if (n3 > 1 && r4.test(t3.slice(n3 - 1))) + return false; + const i2 = Lf(e3); + if (i2 && n3 > 0 && t3[n3 - 1] !== "\n") + return false; + if (!i2 && e3 === t3[n3 + 1]) + return false; + } else { + const r4 = RegExp(If.includes(e3) ? "^".concat(e3, "(\\p{L}|\\p{N})") : "^\\".concat(e3, "(\\p{L}|\\p{N})"), "u"); + if (n3 < t3.length - 1 && r4.test(t3.slice(n3))) + return false; + } + return true; + }(r2, e2, t2, n2)) + return null; + } else + r2 = e2.slice(t2, t2 + 3); + return r2; + } + function Df(e2, t2, n2) { + const r2 = Nf[e2].type; + return t2 === n2.length || Rf(n2, t2, false) === e2 || r2 === "span" && n2[t2] === "\n"; + } + function Pf(e2, t2) { + const n2 = Rf(e2, t2), r2 = n2 ? function(e3, t3, n3) { + if (!e3) + return 0; + const r3 = n3; + if (n3 += e3.length, Lf(e3)) + return (n3 += t3.slice(n3).split(/\n[^>]/).shift().length) - r3; + if (Nf[e3].type === "span") { + const r4 = t3.slice(n3 + 1).split("\n").shift(); + let i2 = 0, o2 = r4.indexOf(e3); + for (; o2 !== -1; ) { + if (Df(e3, n3 + 1 + o2, t3)) + return o2 + 1 + 2 * e3.length; + o2 = r4.indexOf(e3, i2++); + } + return 0; + } + { + const r4 = t3.slice(n3 + 1); + let i2, o2 = r4.indexOf(e3); + for (; o2 !== -1; ) { + if (Df(e3, n3 + 1 + o2, t3)) + return o2 + 1 + 2 * e3.length; + o2 = r4.indexOf(e3, i2++); + } + return 0; + } + }(n2, e2, t2) : 0; + return r2 > 0 ? {d: n2, length: r2} : {}; + } + const Lf = (e2) => [">", ">"].includes(e2); + function zf(e2, t2, n2, r2) { + const i2 = Mf[Nf[e2].name]; + if (Lf(e2)) { + return i2(t2.replace(/\n>/g, "\n").replace(/\n$/, ""), n2, r2); + } + return i2(t2, n2, r2); + } + function Ff() { + const e2 = qf(['<span class="mention">', "</span>"]); + return Ff = function() { + return e2; + }, e2; + } + function Bf() { + const e2 = qf(['<span class="mention mention--self badge badge-info">', "</span>"]); + return Bf = function() { + return e2; + }, e2; + } + function qf(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + const Hf = rl.env.utils, Uf = (e2) => typeof e2 == "string"; + class $f extends String { + constructor(e2, t2, n2 = 0, r2, i2, o2) { + super(e2), this.model = t2, this.offset = n2, this.onImgClick = o2, this.onImgLoad = i2, this.references = [], this.show_images = r2, this.payload = []; + } + addHyperlinks(e2, t2) { + const n2 = []; + try { + const t3 = {start: /\b(?:([a-z][a-z0-9.+-]*:\/\/)|xmpp:|mailto:|www\.)/gi}; + ah.a.withinString(e2, (e3, t4, r2) => (n2.push({url: e3, start: t4, end: r2}), e3), t3); + } catch (e3) { + return void zn.debug(e3); + } + n2.forEach((n3) => { + const r2 = e2.slice(n3.start, n3.end), i2 = Hf.filterQueryParamsFromURL(r2); + this.addTemplateResult(n3.start + t2, n3.end + t2, this.show_images && Hf.isImageURL(r2) && Hf.isImageDomainAllowed(r2) ? Hf.convertToImageTag(i2, this.onImgLoad, this.onImgClick) : Hf.convertUrlToHyperlink(i2)); + }); + } + addMapURLs(e2, t2) { + const n2 = /geo:([\-0-9.]+),([\-0-9.]+)(?:,([\-0-9.]+))?(?:\?(.*))?/g, r2 = e2.matchAll(n2); + for (const e3 of r2) + this.addTemplateResult(e3.index + t2, e3.index + e3[0].length + t2, Hf.convertUrlToHyperlink(e3[0].replace(n2, Uc.geouri_replacement))); + } + addEmojis(e2, t2) { + [...Hl(e2.toString()), ...Ul(e2.toString())].forEach((e3) => { + this.addTemplateResult(e3.begin + t2, e3.end + t2, ql(e3, {add_title_wrapper: true})); + }); + } + addMentions(e2, t2) { + var n2; + const r2 = t2 + this.offset; + if (!this.model.collection) + return void zn.debug("addMentions: ignoring dangling model"); + const i2 = this.model.collection.chatbox.get("nick"); + (n2 = this.model.get("references")) === null || n2 === void 0 || n2.forEach((n3) => { + const o2 = Number(n3.begin) - r2; + if (o2 < 0 || o2 >= r2 + e2.length) + return; + const s2 = Number(n3.end) - r2, a2 = e2.slice(o2, s2); + var c2; + a2 === i2 ? this.addTemplateResult(o2 + t2, s2 + t2, (c2 = {mention: a2}, Za(Bf(), c2.mention))) : this.addTemplateResult(o2 + t2, s2 + t2, ((e3) => Za(Ff(), e3.mention))({mention: a2})); + }); + } + addStyling() { + if (this.model.get("is_unstyled") || !Vc.settings.get("allow_message_styling")) + return; + let e2 = 0; + const t2 = []; + if (function(e3) { + for (let t3 = 0; t3 < kf.length; t3++) + if (e3.includes(kf[t3])) + return true; + }(this)) + for (; e2 < this.length; ) { + const {d: n2, length: r2} = Pf(this, e2); + if (n2 && r2) { + const i2 = Lf(n2), o2 = e2 + r2, s2 = i2 ? o2 : o2 - n2.length; + let a2 = n2 === "```" ? e2 + n2.length + 1 : e2 + n2.length; + i2 && this[a2] === " " && (a2 += 1); + const c2 = a2, l2 = this.slice(a2, s2); + t2.push({begin: e2, template: zf(n2, l2, this.model, c2), end: o2}), e2 = o2; + } + e2++; + } + t2.forEach((e3) => this.addTemplateResult(e3.begin, e3.end, e3.template)); + } + trimMeMessage() { + this.offset === 0 && this.isMeCommand() && (this.payload[0] = this.payload[0].substring(4)); + } + addAnnotations(e2) { + const t2 = this.marshall(); + let n2 = 0; + for (const r2 of t2) + r2 && (Uf(r2) ? (e2.call(this, r2, n2), n2 += r2.length) : n2 = r2.end); + } + async addTemplates() { + await Vc.trigger("beforeMessageBodyTransformed", this, {Synchronous: true}), this.addStyling(), this.addAnnotations(this.addMentions), this.addAnnotations(this.addHyperlinks), this.addAnnotations(this.addMapURLs), await Vc.emojis.initialize(), this.addAnnotations(this.addEmojis), await Vc.trigger("afterMessageBodyTransformed", this, {Synchronous: true}), this.payload = this.marshall(), this.trimMeMessage(), this.payload = this.payload.map((e2) => Uf(e2) ? e2 : e2.template); + } + addTemplateResult(e2, t2, n2) { + this.references.push({begin: e2, end: t2, template: n2}); + } + isMeCommand() { + const e2 = this.toString(); + return !!e2 && e2.startsWith("/me "); + } + static replaceText(e2) { + return Bl(e2.replace(/\n\n+/g, "\n\n")); + } + marshall() { + let e2 = [this.toString()]; + return this.references.sort((e3, t2) => t2.begin - e3.begin).forEach((t2) => { + const n2 = e2.shift(); + e2 = [n2.slice(0, t2.begin), t2, n2.slice(t2.end), ...e2]; + }), e2.reduce((e3, t2) => Uf(t2) ? [...e3, $f.replaceText(t2)] : [...e3, t2], []); + } + } + function Wf() { + const e2 = Vf(["", ""]); + return Wf = function() { + return e2; + }, e2; + } + function Gf() { + const e2 = Vf(["", ""]); + return Gf = function() { + return e2; + }, e2; + } + function Vf(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + const Jf = rl.env.utils; + class Xf { + constructor(e2) { + var t2; + this.model = e2.model, this.component = e2, this.chatview = (t2 = Jf.ancestor(this.component, "converse-chat-message")) === null || t2 === void 0 ? void 0 : t2.chatview, this.was_scrolled_up = this.chatview.model.get("scrolled"), this.text = this.component.model.getMessageText(); + } + scrollDownOnImageLoad() { + this.was_scrolled_up || this.chatview.scrollDown(); + } + async transform() { + const e2 = Vc.settings.get("show_images_inline"), t2 = new $f(this.text, this.model, 0, e2, () => this.scrollDownOnImageLoad(), (e3) => this.component.showImageModal(e3)); + return await t2.addTemplates(), t2.payload; + } + render() { + return Za(Gf(), Qh(this.transform(), Za(Wf(), this.text))); + } + } + const Qf = ka((e2) => (t2) => { + var n2; + const r2 = new Xf(e2); + t2.setValue(r2.render()); + const i2 = e2.model; + (n2 = i2.collection) === null || n2 === void 0 || n2.trigger("rendered", i2); + }); + function Yf() { + const e2 = Zf(['<p class="older-msg"><time>', "</time>: ", "</p>"]); + return Yf = function() { + return e2; + }, e2; + } + function Kf() { + const e2 = Zf(['\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h4 class="modal-title" id="message-versions-modal-label">', "</h4>\n ", '\n </div>\n <div class="modal-body">\n <h4>Older versions</h4>\n ', "\n <hr/>\n <h4>Current version</h4>\n <p>", '</p>\n </div>\n <div class="modal-footer">', "</div>\n </div>\n </div>\n"]); + return Kf = function() { + return e2; + }, e2; + } + function Zf(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + Vc.elements.define("converse-chat-message-body", class extends mc { + static get properties() { + return {model: {type: Object}, is_me_message: {type: Boolean}, text: {type: String}}; + } + showImageModal(e2) { + e2.preventDefault(), Vc.modal.create(_f, {src: e2.target.src}, e2).show(e2); + } + render() { + return Qf(this); + } + }); + var ep = df.extend({id: "message-versions-modal", toHTML() { + return e2 = this.model.toJSON(), Za(Kf(), zd("Message versions"), mf, Object.keys(e2.older_versions).map((t2) => Za(Yf(), En()(t2).format("MMM D, YYYY, HH:mm:ss"), e2.older_versions[t2])), e2.message, gf); + var e2; + }}), tp = n(176), np = n.n(tp); + function rp() { + const e2 = function(e3, t2) { + t2 || (t2 = e3.slice(0)); + return Object.freeze(Object.defineProperties(e3, {raw: {value: Object.freeze(t2)}})); + }(['\n <svg xmlns="http://www.w3.org/2000/svg" class="avatar ', '" width="', '" height="', '">\n <image width="', '" height="', '" preserveAspectRatio="xMidYMid meet" href="', '"/>\n </svg>']); + return rp = function() { + return e2; + }, e2; + } + var ip = (e2) => { + return Za(rp(), e2.classes, e2.width, e2.height, e2.width, e2.height, (t2 = e2.image, n2 = e2.image_type, t2.startsWith("data:") ? t2 : "data:".concat(n2, ";base64,").concat(t2))); + var t2, n2; + }; + const op = ka((e2) => (t2) => { + const n2 = {classes: e2.classes ? "".concat(e2.classes, " avatar") : "avatar", height: e2.width || 36, image: e2.image, image_type: e2.image_type, width: e2.height || 36}; + t2.setValue(ip(n2)); + }); + function sp() { + const e2 = dp(['\n <time timestamp="', '" class="chat-msg__time">', '</time> \n <span class="chat-msg__author">', "", "</span> "]); + return sp = function() { + return e2; + }, e2; + } + function ap() { + const e2 = dp(['<span class="fa fa-lock"></span>']); + return ap = function() { + return e2; + }, e2; + } + function cp() { + const e2 = dp(['\n <span class="chat-msg__heading">\n <span class="chat-msg__author">', "</span>\n ", "\n ", "\n </span>"]); + return cp = function() { + return e2; + }, e2; + } + function lp() { + const e2 = dp(['<div class="message separator"><hr class="separator"><span class="separator-text">', "</span></div>"]); + return lp = function() { + return e2; + }, e2; + } + function up() { + const e2 = dp(["\n ", '\n <div class="message chat-msg ', '"\n data-isodate="', '"\n data-msgid="', '"\n data-from="', '"\n data-encrypted="', '">\n\n <!-- Anchor to allow us to scroll the message into view -->\n <a id="', '"></a>\n\n ', '\n <div class="chat-msg__content chat-msg__content--', " ", '">\n\n ', '\n <div class="chat-msg__body chat-msg__body--', " ", " ", '">\n <div class="chat-msg__message">\n ', "\n ", "\n </div>\n <converse-message-actions\n .chatview=", "\n .model=", '\n ?correcting="', '"\n ?editable="', '"\n ?is_retracted="', '"\n message_type="', '"></converse-message-actions>\n </div>\n </div>\n </div>']); + return up = function() { + return e2; + }, e2; + } + function dp(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + function hp() { + const e2 = function(e3, t2) { + t2 || (t2 = e3.slice(0)); + return Object.freeze(Object.defineProperties(e3, {raw: {value: Object.freeze(t2)}})); + }(['<span class="spinner fa fa-spinner centered ', '"/>']); + return hp = function() { + return e2; + }, e2; + } + var fp = (e2 = {}) => Za(hp(), e2.classes || ""); + function pp() { + const e2 = Op(['<span class="badge badge-secondary">', "</span>"]); + return pp = function() { + return e2; + }, e2; + } + function gp() { + const e2 = Op(["\n ", '\n <time timestamp="', '" class="chat-msg__time">', "</time>\n "]); + return gp = function() { + return e2; + }, e2; + } + function mp() { + const e2 = Op(['<div class="chat-msg__media">', "</div>"]); + return mp = function() { + return e2; + }, e2; + } + function vp() { + const e2 = Op(['<i title="', '" class="fa fa-edit chat-msg__edit-modal" @click=', "></i>"]); + return vp = function() { + return e2; + }, e2; + } + function _p() { + const e2 = Op(['<span class="fa fa-check chat-msg__receipt"></span>']); + return _p = function() { + return e2; + }, e2; + } + function bp() { + const e2 = Op(['<div class="chat-msg__subject">', "</div>"]); + return bp = function() { + return e2; + }, e2; + } + function yp() { + const e2 = Op(["\n ", "\n ", '\n <span>\n <converse-chat-message-body\n class="chat-msg__text ', " ", '"\n .model="', '"\n ?is_me_message="', '"\n ?is_only_emojis="', '"\n ?is_spoiler="', '"\n ?is_spoiler_visible="', '"\n text="', '"></converse-chat-message-body>\n ', "\n ", "\n </span>\n ", '\n <div class="chat-msg__error">', "</div>\n "]); + return yp = function() { + return e2; + }, e2; + } + function wp() { + const e2 = Op(['\n <div class="chat-msg__spoiler-hint">\n <span class="spoiler-hint">', '</span>\n <a class="badge badge-info spoiler-toggle" href="#" @click=', '>\n <i class="fa ', '"></i>\n ', "\n </a>\n </div>\n "]); + return wp = function() { + return e2; + }, e2; + } + function Sp() { + const e2 = Op(['<q class="chat-msg--retracted__reason">', "</q>"]); + return Sp = function() { + return e2; + }, e2; + } + function xp() { + const e2 = Op(["\n <div>", "</div>\n ", "\n "]); + return xp = function() { + return e2; + }, e2; + } + function Ep() { + const e2 = Op(['\n <div class="message chat-msg">\n ', '\n <div class="chat-msg__content">\n <span class="chat-msg__text">', " <strong>", "</strong>, ", '</span>\n <progress value="', '"/>\n </div>\n </div>']); + return Ep = function() { + return e2; + }, e2; + } + function Ap() { + const e2 = Op(['<a class="retry" @click=', ">", "</a>"]); + return Ap = function() { + return e2; + }, e2; + } + function Cp() { + const e2 = Op(['<q class="reason">', "</q>"]); + return Cp = function() { + return e2; + }, e2; + } + function jp() { + const e2 = Op(['<q class="reason">', "</q>"]); + return jp = function() { + return e2; + }, e2; + } + function Tp() { + const e2 = Op(['\n <div class="message chat-info chat-', '"\n data-isodate="', '"\n data-type="', '"\n data-value="', '">\n\n <div class="chat-info__message">\n ', "\n </div>\n ", "\n ", "\n ", "\n </div>\n "]); + return Tp = function() { + return e2; + }, e2; + } + function Op(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + const {Strophe: kp} = rl.env, Np = rl.env.utils; + class Ip extends mc { + static get properties() { + return {chatview: {type: Object}, correcting: {type: Boolean}, editable: {type: Boolean}, edited: {type: String}, error: {type: String}, error_text: {type: String}, from: {type: String}, has_mentions: {type: Boolean}, hats: {type: Array}, is_delayed: {type: Boolean}, is_encrypted: {type: Boolean}, is_first_unread: {type: Boolean}, is_me_message: {type: Boolean}, is_only_emojis: {type: Boolean}, is_retracted: {type: Boolean}, is_spoiler: {type: Boolean}, is_spoiler_visible: {type: Boolean}, message_type: {type: String}, model: {type: Object}, moderated_by: {type: String}, moderation_reason: {type: String}, msgid: {type: String}, occupant_affiliation: {type: String}, occupant_role: {type: String}, oob_url: {type: String}, progress: {type: Number}, reason: {type: String}, received: {type: String}, retractable: {type: Boolean}, retry_event_id: {type: String}, sender: {type: String}, show_spinner: {type: Boolean}, spoiler_hint: {type: String}, subject: {type: String}, time: {type: String}, username: {type: String}}; + } + render() { + const e2 = Vc.settings.get("time_format"); + return this.pretty_time = En()(this.edited || this.time).format(e2), this.show_spinner ? fp() : this.model.get("file") && !this.model.get("oob_url") ? this.renderFileProgress() : ["error", "info"].includes(this.message_type) ? this.renderInfoMessage() : this.renderChatMessage(); + } + connectedCallback() { + super.connectedCallback(), this.listenTo(this.model, "change", (e3) => { + const t2 = this.model.collection.chatbox; + Object.assign(this, Jp(t2, this.model)), Object.keys(e3.changed).filter((e4) => Object.keys(Ip.properties).includes(e4)).forEach((t3) => this[t3] = e3.changed[t3]); + }); + const e2 = this.model.vcard; + e2 && this.listenTo(e2, "change", () => this.requestUpdate()); + } + updated() { + var e2; + (this.show_spinner || this.model.get("file") && !this.model.get("oob_url") || ["error", "info"].includes(this.message_type)) && ((e2 = this.model.collection) === null || e2 === void 0 || e2.trigger("rendered", this.model)); + } + renderInfoMessage() { + const e2 = En()(this.model.get("time")).toISOString(), t2 = zd("Retry"); + return Za(Tp(), this.message_type, e2, this.data_name, this.data_value, this.model.getMessageText(), this.reason ? Za(jp(), this.reason) : "", this.error_text ? Za(Cp(), this.error_text) : "", this.retry_event_id ? Za(Ap(), this.onRetryClicked, t2) : ""); + } + renderFileProgress() { + const e2 = zd("Uploading file:"), t2 = this.model.file.name, n2 = np()(this.model.file.size); + return Za(Ep(), op(this.getAvatarData()), e2, t2, n2, this.progress); + } + renderChatMessage() { + return ((e2) => { + const t2 = zd("New messages"); + return Za(up(), e2.is_first_unread ? Za(lp(), t2) : "", e2.getExtraMessageClasses(), e2.time, e2.msgid, e2.from, e2.is_encrypted, e2.msgid, e2.shouldShowAvatar() ? op(e2.getAvatarData()) : "", e2.sender, e2.is_me_message ? "chat-msg__content--action" : "", e2.is_me_message ? "" : Za(cp(), e2.username, e2.renderAvatarByline(), e2.is_encrypted ? Za(ap()) : ""), e2.message_type, e2.received ? "chat-msg__body--received" : "", e2.is_delayed ? "chat-msg__body--delayed" : "", e2.is_me_message ? Za(sp(), e2.edited || e2.time, e2.pretty_time, e2.is_me_message ? "**" : "", e2.username) : "", e2.is_retracted ? e2.renderRetraction() : e2.renderMessageText(), e2.chatview, e2.model, e2.correcting, e2.editable, e2.is_retracted, e2.message_type); + })(this); + } + shouldShowAvatar() { + return Vc.settings.get("show_message_avatar") && !this.is_me_message && this.type !== "headline"; + } + getAvatarData() { + var e2, t2; + return {classes: "chat-msg__avatar", height: 36, width: 36, image: "data:" + (((e2 = this.model.vcard) === null || e2 === void 0 ? void 0 : e2.get("image_type")) || Uc.DEFAULT_IMAGE_TYPE) + ";base64," + (((t2 = this.model.vcard) === null || t2 === void 0 ? void 0 : t2.get("image")) || Uc.DEFAULT_IMAGE)}; + } + async onRetryClicked() { + this.show_spinner = true, await Vc.trigger(this.retry_event_id, {synchronous: true}), this.model.destroy(), this.parentElement.removeChild(this); + } + isFollowup() { + const e2 = this.model.collection.models, t2 = e2.indexOf(this.model), n2 = t2 ? e2[t2 - 1] : null; + if (n2 === null) + return false; + const r2 = En()(this.time); + return this.from === n2.get("from") && !this.is_me_message && !n2.isMeCommand() && this.message_type !== "info" && n2.get("type") !== "info" && r2.isBefore(En()(n2.get("time")).add(10, "minutes")) && !!this.is_encrypted == !!n2.get("is_encrypted"); + } + getExtraMessageClasses() { + const e2 = [this.isFollowup() ? "chat-msg--followup" : null, this.is_delayed ? "delayed" : null, this.is_me_message ? "chat-msg--action" : null, this.is_retracted ? "chat-msg--retracted" : null, this.message_type, this.shouldShowAvatar() ? "chat-msg--with-avatar" : null].map((e3) => e3); + return this.message_type === "groupchat" && (this.occupant_role && e2.push(this.occupant_role), this.occupant_affiliation && e2.push(this.occupant_affiliation), this.sender === "them" && this.has_mentions && e2.push("mentioned")), this.correcting && e2.push("correcting"), e2.filter((e3) => e3).join(" "); + } + getRetractionText() { + if (this.message_type === "groupchat" && this.moderated_by) { + const e2 = this.moderated_by, t2 = this.model.collection.chatbox; + this.model.mod || (this.model.mod = t2.occupants.findOccupant({jid: e2}) || t2.occupants.findOccupant({nick: kp.getResourceFromJid(e2)})); + const n2 = this.model.mod ? this.model.mod.getDisplayName() : "A moderator"; + return zd("%1$s has removed this message", n2); + } + return zd("%1$s has removed this message", this.model.getDisplayName()); + } + renderRetraction() { + const e2 = this.is_retracted ? this.getRetractionText() : null; + return Za(xp(), e2, this.moderation_reason ? Za(Sp(), this.moderation_reason) : ""); + } + renderMessageText() { + const e2 = zd("This message has been edited"), t2 = zd("Show more"), n2 = this.message_type === "groupchat", r2 = zd("Show less"), i2 = Za(wp(), this.spoiler_hint, this.toggleSpoilerMessage, this.is_spoiler_visible ? "fa-eye-slash" : "fa-eye", this.is_spoiler_visible ? r2 : t2), o2 = this.is_spoiler ? "spoiler ".concat(this.is_spoiler_visible ? "" : "hidden") : ""; + return Za(yp(), this.is_spoiler ? i2 : "", this.subject ? Za(bp(), this.subject) : "", this.is_only_emojis ? "chat-msg__text--larger" : "", o2, this.model, this.is_me_message, this.is_only_emojis, this.is_spoiler, this.is_spoiler_visible, this.model.getMessageText(), !this.received || this.is_me_message || n2 ? "" : Za(_p()), this.edited ? Za(vp(), e2, this.showMessageVersionsModal) : "", this.oob_url ? Za(mp(), Np.getOOBURLMarkup(Uc, this.oob_url)) : "", this.error_text || this.error); + } + renderAvatarByline() { + return Za(gp(), this.hats.map((e2) => Za(pp(), e2.title)), this.edited || this.time, this.pretty_time); + } + showUserModal(e2) { + this.model.get("sender") === "me" ? Uc.xmppstatusview.showProfileModal(e2) : this.message_type === "groupchat" ? this.chatview.showOccupantDetailsModal(e2, this.model) : this.chatview.showUserDetailsModal(e2, this.model); + } + showMessageVersionsModal(e2) { + e2.preventDefault(), this.message_versions_modal === void 0 && (this.message_versions_modal = new ep({model: this.model})), this.message_versions_modal.show(e2); + } + toggleSpoilerMessage(e2) { + e2 == null || e2.preventDefault(), this.model.save({is_spoiler_visible: !this.model.get("is_spoiler_visible")}); + } + } + function Mp() { + const e2 = function(e3, t2) { + t2 || (t2 = e3.slice(0)); + return Object.freeze(Object.defineProperties(e3, {raw: {value: Object.freeze(t2)}})); + }(['\n <div class="message date-separator" data-isodate="', '">\n <hr class="separator"/>\n <time class="separator-text" datetime="', '"><span>', "</span></time>\n </div>\n"]); + return Mp = function() { + return e2; + }, e2; + } + Vc.elements.define("converse-chat-message", Ip); + /** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ + const Rp = (e2, t2) => { + const n2 = e2.startNode.parentNode, r2 = t2 === void 0 ? e2.endNode : t2.startNode, i2 = n2.insertBefore(Ea(), r2); + n2.insertBefore(Ea(), r2); + const o2 = new qa(e2.options); + return o2.insertAfterNode(i2), o2; + }, Dp = (e2, t2) => (e2.setValue(t2), e2.commit(), e2), Pp = (e2, t2, n2) => { + const r2 = e2.startNode.parentNode, i2 = n2 ? n2.startNode : e2.endNode, o2 = t2.endNode.nextSibling; + o2 !== i2 && ma(r2, t2.startNode, o2, i2); + }, Lp = (e2) => { + va(e2.startNode.parentNode, e2.startNode, e2.endNode.nextSibling); + }, zp = (e2, t2, n2) => { + const r2 = new Map(); + for (let i2 = t2; i2 <= n2; i2++) + r2.set(e2[i2], i2); + return r2; + }, Fp = new WeakMap(), Bp = new WeakMap(), qp = ka((e2, t2, n2) => { + let r2; + return n2 === void 0 ? n2 = t2 : t2 !== void 0 && (r2 = t2), (t3) => { + if (!(t3 instanceof qa)) + throw new Error("repeat can only be used in text bindings"); + const i2 = Fp.get(t3) || [], o2 = Bp.get(t3) || [], s2 = [], a2 = [], c2 = []; + let l2, u2, d2 = 0; + for (const t4 of e2) + c2[d2] = r2 ? r2(t4, d2) : d2, a2[d2] = n2(t4, d2), d2++; + let h2 = 0, f2 = i2.length - 1, p2 = 0, g2 = a2.length - 1; + for (; h2 <= f2 && p2 <= g2; ) + if (i2[h2] === null) + h2++; + else if (i2[f2] === null) + f2--; + else if (o2[h2] === c2[p2]) + s2[p2] = Dp(i2[h2], a2[p2]), h2++, p2++; + else if (o2[f2] === c2[g2]) + s2[g2] = Dp(i2[f2], a2[g2]), f2--, g2--; + else if (o2[h2] === c2[g2]) + s2[g2] = Dp(i2[h2], a2[g2]), Pp(t3, i2[h2], s2[g2 + 1]), h2++, g2--; + else if (o2[f2] === c2[p2]) + s2[p2] = Dp(i2[f2], a2[p2]), Pp(t3, i2[f2], i2[h2]), f2--, p2++; + else if (l2 === void 0 && (l2 = zp(c2, p2, g2), u2 = zp(o2, h2, f2)), l2.has(o2[h2])) + if (l2.has(o2[f2])) { + const e3 = u2.get(c2[p2]), n3 = e3 !== void 0 ? i2[e3] : null; + if (n3 === null) { + const e4 = Rp(t3, i2[h2]); + Dp(e4, a2[p2]), s2[p2] = e4; + } else + s2[p2] = Dp(n3, a2[p2]), Pp(t3, n3, i2[h2]), i2[e3] = null; + p2++; + } else + Lp(i2[f2]), f2--; + else + Lp(i2[h2]), h2++; + for (; p2 <= g2; ) { + const e3 = Rp(t3, s2[g2 + 1]); + Dp(e3, a2[p2]), s2[p2++] = e3; + } + for (; h2 <= f2; ) { + const e3 = i2[h2++]; + e3 !== null && Lp(e3); + } + Fp.set(t3, s2), Bp.set(t3, c2); + }; + }); + function Hp() { + const e2 = Wp(['<div class="empty-history-feedback form-help"><span>', "</span></div>"]); + return Hp = function() { + return e2; + }, e2; + } + function Up() { + const e2 = Wp(["", ""]); + return Up = function() { + return e2; + }, e2; + } + function $p() { + const e2 = Wp(["\n <converse-chat-message\n .chatview=", "\n .hats=", "\n .model=", "\n ?correcting=", "\n ?editable=", "\n ?has_mentions=", "\n ?is_delayed=", "\n ?is_encrypted=", "\n ?is_first_unread=", "\n ?is_me_message=", "\n ?is_only_emojis=", "\n ?is_retracted=", "\n ?is_spoiler=", "\n ?is_spoiler_visible=", "\n ?retractable=", "\n edited=", "\n error=", "\n error_text=", "\n filename=", "\n filesize=", "\n from=", "\n message_type=", "\n moderated_by=", "\n moderation_reason=", "\n msgid=", "\n occupant_affiliation=", "\n occupant_role=", "\n oob_url=", "\n pretty_type=", "\n progress=", "\n reason=", "\n received=", "\n retry_event_id=", "\n sender=", "\n spoiler_hint=", "\n subject=", "\n time=", "\n username=", "></converse-chat-message>\n"]); + return $p = function() { + return e2; + }, e2; + } + function Wp(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + const Gp = zd("No message history available."); + function Vp(e2) { + const t2 = e2.collection.models, n2 = t2.indexOf(e2), r2 = t2[n2 - 1]; + if (!r2 || En()(e2.get("time")).isAfter(En()(r2.get("time")), "day")) { + const t3 = En()(e2.get("time")).startOf("day"); + return i2 = {type: "date", time: t3.toISOString(), datestring: t3.format("dddd MMM Do YYYY")}, Za(Mp(), i2.time, i2.time, i2.datestring); + } + var i2; + } + function Jp(e2, t2) { + return {has_mentions: t2.get("type") === "groupchat" && t2.get("sender") === "them" && e2.isUserMentioned(t2), hats: Uc.getHats(t2), is_first_unread: e2.get("first_unread_id") === t2.get("id"), is_me_message: t2.isMeCommand(), is_retracted: t2.get("retracted") || t2.get("moderated") === "retracted", username: t2.getDisplayName()}; + } + Uc.getHats = function(e2) { + if (e2.get("type") === "groupchat") { + var t2; + const n2 = Vc.settings.get("muc_hats").filter((e3) => e3).map((e3) => e3.toLowerCase()); + let r2 = []; + n2.includes("vcard_roles") && (r2 = e2.vcard ? e2.vcard.get("role") : null, r2 = r2 ? r2.split(",").filter((e3) => e3).map((e3) => ({title: e3})) : []); + const i2 = [...e2.occupant ? [e2.occupant.get("role")] : [], ...e2.occupant ? [e2.occupant.get("affiliation")] : []].filter((e3) => e3).filter((e3) => n2.includes(e3.toLowerCase())).map((e3) => ({title: e3})); + return [...n2.includes("xep317") && ((t2 = e2.occupant) === null || t2 === void 0 ? void 0 : t2.get("hats")) || [], ...r2, ...i2]; + } + return []; + }; + Vc.elements.define("converse-message-history", class extends mc { + static get properties() { + return {chatview: {type: Object}, messages: {type: Array}}; + } + render() { + const e2 = this.messages; + return e2.length ? Za(Up(), qp(e2, (e3) => e3.get("id"), (e3) => this.renderMessage(e3))) : Za(Hp(), Gp); + } + renderMessage(e2) { + if (e2.get("dangling_retraction") || e2.get("is_only_key")) + return ""; + const t2 = Vp(e2); + var n2; + return [...t2 ? [t2] : [], (n2 = Object.assign(e2.toJSON(), Jp(this.chatview.model, e2), {chatview: this.chatview, model: e2}), Za($p(), n2.chatview, n2.hats, n2.model, n2.correcting, n2.editable, n2.has_mentions, n2.is_delayed, !!n2.is_encrypted, n2.is_first_unread, n2.is_me_message, n2.is_only_emojis, n2.is_retracted, n2.is_spoiler, n2.is_spoiler_visible, n2.retractable, n2.edited || "", n2.error || "", n2.error_text || "", n2.filename || "", n2.filesize || "", n2.from, n2.type || "", n2.moderated_by || "", n2.moderation_reason || "", n2.msgid, n2.model.occupant ? n2.model.occupant.get("affiliation") : "", n2.model.occupant ? n2.model.occupant.get("role") : "", n2.oob_url || "", n2.pretty_type, n2.progress || 0, n2.reason || "", n2.received || "", n2.retry_event_id || "", n2.sender, n2.spoiler_hint || "", n2.subject || "", n2.time, n2.username))]; + } + }); + var Xp = n(18), Qp = n.n(Xp); + /** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ + const Yp = new WeakMap(), Kp = ka((e2) => (t2) => { + if (!(t2 instanceof qa)) + throw new Error("unsafeHTML can only be used in text bindings"); + const n2 = Yp.get(t2); + if (n2 !== void 0 && La(e2) && e2 === n2.value && t2.value === n2.fragment) + return; + const r2 = document.createElement("template"); + r2.innerHTML = e2; + const i2 = document.importNode(r2.content, true); + t2.setValue(i2), Yp.set(t2, {value: e2, fragment: i2}); + }); + function Zp() { + const e2 = function(e3, t2) { + t2 || (t2 = e3.slice(0)); + return Object.freeze(Object.defineProperties(e3, {raw: {value: Object.freeze(t2)}})); + }(["\n <converse-message-history\n .chatview=", "\n .messages=", '>\n </converse-message-history>\n <div class="chat-content__notifications">', "</div>\n "]); + return Zp = function() { + return e2; + }, e2; + } + function eg() { + const e2 = ng(['<svg .style="', '"> <use href="', '"> </use> </svg>']); + return eg = function() { + return e2; + }, e2; + } + function tg() { + const e2 = ng(["\n :host {\n display: inline-block;\n padding: 0;\n margin: 0;\n }\n "]); + return tg = function() { + return e2; + }, e2; + } + function ng(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + /** + * @module icons.js + * @copyright Alfredo Medrano Sánchez and the Converse.js contributors + * @description + * Component inspired by the one from fa-icons + * https://github.com/obsidiansoft-io/fa-icons/blob/master/LICENSE + * @license Mozilla Public License (MPLv2) + */ + Vc.elements.define("converse-chat-content", class extends mc { + static get properties() { + return {chatview: {type: Object}, messages: {type: Array}, notifications: {type: String}}; + } + render() { + const e2 = Qp.a.filterXSS(this.notifications, {whiteList: {}}); + return Za(Zp(), this.chatview, this.messages, Kp(e2)); + } + }); + function rg() { + const e2 = og(['<div class="message chat-', '" data-isodate="', '">', "</div>"]); + return rg = function() { + return e2; + }, e2; + } + function ig() { + const e2 = og(['<converse-icon class="fas fa-times close-chat-help"\n @click=', '\n path-prefix="', '"\n size="1em"></converse-icon>']); + return ig = function() { + return e2; + }, e2; + } + function og(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + customElements.define("converse-icon", class extends mc { + static get properties() { + return {color: String, class_name: {attribute: "class"}, style: String, size: String}; + } + static get styles() { + return fc(tg()); + } + constructor() { + super(), this.class_name = "", this.style = "", this.size = "", this.color = ""; + } + getSource() { + return "#icon-".concat(this.class_name.split(" ")[1].replace("fa-", "")); + } + getStyles() { + return "\n ".concat(this.size ? "width: ".concat(this.size, ";") : "", "\n ").concat(this.size ? "height: ".concat(this.size, ";") : "", "\n ").concat(this.color ? "fill: ".concat(this.color, ";") : "", "\n ").concat(this.style, "\n "); + } + render() { + return Za(eg(), this.getStyles(), this.getSource()); + } + }); + function sg() { + const e2 = gg(["<converse-emoji-picker-content\n .chatview=", "\n .model=", '\n .search_results="', '"\n current_skintone="', '"\n query="', '"></converse-emoji-picker-content>']); + return sg = function() { + return e2; + }, e2; + } + function ag() { + const e2 = gg(['\n <div class="emoji-picker__header">\n <input class="form-control emoji-search" name="emoji-search" placeholder="', '"\n .value=', "\n @keydown=", "\n @blur=", "\n @focus=", ">\n ", "\n </div>\n ", '\n\n <div class="emoji-skintone-picker">\n <label>Skin tone</label>\n <ul>', "</ul>\n </div>"]); + return ag = function() { + return e2; + }, e2; + } + function cg() { + const e2 = gg(['\n <li data-skintone="', '" class="emoji-skintone ', '">\n <a class="pick-skintone" href="#" data-skintone="', '" @click=', ">", "</a>\n </li>"]); + return cg = function() { + return e2; + }, e2; + } + function lg() { + const e2 = gg(["\n <span ?hidden=", ' class="emoji-lists__container emoji-lists__container--browse">\n ', "\n </span>"]); + return lg = function() { + return e2; + }, e2; + } + function ug() { + const e2 = gg(['\n <a id="emoji-picker-', '" class="emoji-category__heading" data-category="', '">', '</a>\n <ul class="emoji-picker" data-category="', '">\n ', "\n </ul>"]); + return ug = function() { + return e2; + }, e2; + } + function dg() { + const e2 = gg(["\n <span ?hidden=", ' class="emoji-lists__container emojis-lists__container--search">\n <a id="emoji-picker-search-results" class="emoji-category__heading">', '</a>\n <ul class="emoji-picker">\n ', "\n </ul>\n </span>\n "]); + return dg = function() { + return e2; + }, e2; + } + function hg() { + const e2 = gg(['\n <li class="emoji insert-emoji ', '" data-emoji="', '" title="', '">\n <a href="#" @click=', ' data-emoji="', '">', "</a>\n </li>\n "]); + return hg = function() { + return e2; + }, e2; + } + function fg() { + const e2 = gg(["<ul>", "</ul>"]); + return fg = function() { + return e2; + }, e2; + } + function pg() { + const e2 = gg(['\n <li data-category="', '"\n class="emoji-category ', " ", '"\n title="', '">\n\n <a class="pick-category"\n @click=', '\n href="#emoji-picker-', '"\n data-category="', '">', " </a>\n </li>\n "]); + return pg = function() { + return e2; + }, e2; + } + function gg(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + Vc.elements.define("converse-chat-help", class extends mc { + static get properties() { + return {chat_type: {type: String}, messages: {type: Array}, model: {type: Object}, type: {type: String}}; + } + render() { + const e2 = new Date().toISOString(); + return [Za(ig(), this.close, Vc.settings.get("assets_path")), ...this.messages.map((t2) => this.renderHelpMessage({isodate: e2, markup: Qp.a.filterXSS(t2, {whiteList: {strong: []}})}))]; + } + close() { + this.model.set({show_help_messages: false}); + } + renderHelpMessage(e2) { + return Za(rg(), this.type, e2.isodate, Kp(e2.markup)); + } + }); + const mg = rl.env.utils, vg = (e2) => { + const t2 = Vc.settings.get("emoji_categories"); + return Za(fg(), Object.keys(t2).map((n2) => t2[n2] ? ((e3) => Za(pg(), e3.category, e3.category, e3.current_category === e3.category ? "picked" : "", zd(Uc.emoji_category_labels[e3.category]), e3.onCategoryPicked, e3.category, e3.category, e3.emoji))(Object.assign({category: n2, emoji: e2.sn2Emoji(t2[n2])}, e2)) : "")); + }, _g = (e2) => Za(hg(), e2.shouldBeHidden(e2.emoji.sn) ? "hidden" : "", e2.emoji.sn, e2.emoji.sn, e2.insertEmoji, e2.emoji.sn, mg.shortnamesToEmojis(e2.emoji.sn)), bg = (e2) => { + const t2 = Vc.settings.get("emoji_categories"); + return Za(lg(), e2.query, Object.keys(t2).map((n2) => t2[n2] ? ((e3) => Za(ug(), e3.category, e3.category, zd(Vc.settings.get("emoji_category_labels")[e3.category]), e3.category, Object.values(rl.emojis.json[e3.category]).map((t3) => _g(Object.assign({emoji: t3}, e3)))))(Object.assign({category: n2}, e2)) : "")); + }, yg = (e2) => { + const t2 = zd("Search"); + return Za(ag(), t2, e2.query || "", e2.onSearchInputKeyDown, e2.onSearchInputBlurred, e2.onSearchInputFocus, e2.query ? "" : vg(e2), e2.render_emojis ? Za(sg(), e2.chatview, e2.model, e2.search_results, e2.current_skintone, e2.query) : "", ["tone1", "tone2", "tone3", "tone4", "tone5"].map((t3) => ((e3) => Za(cg(), e3.skintone, e3.current_skintone === e3.skintone ? "picked" : "", e3.skintone, e3.onSkintonePicked, mg.shortnamesToEmojis(":" + e3.skintone + ":")))(Object.assign({skintone: t3}, e2)))); + }; + function wg() { + const e2 = function(e3, t2) { + t2 || (t2 = e3.slice(0)); + return Object.freeze(Object.defineProperties(e3, {raw: {value: Object.freeze(t2)}})); + }(['\n <div class="emoji-picker__lists">\n ', "\n ", "\n </div>\n "]); + return wg = function() { + return e2; + }, e2; + } + function Sg() { + const e2 = Eg(["\n <converse-emoji-picker\n .chatview=", "\n .model=", "\n ?render_emojis=", '\n current_category="', '"\n current_skintone="', '"\n query="', '"\n ></converse-emoji-picker>']); + return Sg = function() { + return e2; + }, e2; + } + function xg() { + const e2 = Eg(['\n <div class="dropup">\n <button class="toggle-emojis"\n title="', '"\n data-toggle="dropdown"\n aria-haspopup="true"\n aria-expanded="false">\n <converse-icon\n class="fa fa-smile "\n path-prefix="', '"\n size="1em"></converse-icon>\n </button>\n <div class="dropdown-menu">\n ', "\n </div>\n </div>"]); + return xg = function() { + return e2; + }, e2; + } + function Eg(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + Vc.elements.define("converse-emoji-picker-content", class extends mc { + static get properties() { + return {chatview: {type: Object}, search_results: {type: Array}, current_skintone: {type: String}, model: {type: Object}, query: {type: String}}; + } + render() { + const e2 = {current_skintone: this.current_skintone, insertEmoji: (e3) => this.insertEmoji(e3), query: this.query, search_results: this.search_results, shouldBeHidden: (e3) => this.shouldBeHidden(e3)}; + return Za(wg(), ((e3) => { + const t2 = zd("Search results"); + return Za(dg(), !e3.query, t2, e3.search_results.map((t3) => _g(Object.assign({emoji: t3}, e3)))); + })(e2), bg(e2)); + } + firstUpdated() { + this.initIntersectionObserver(); + } + initIntersectionObserver() { + if (window.IntersectionObserver) { + if (this.observer) + this.observer.disconnect(); + else { + const e2 = {root: this.querySelector(".emoji-picker__lists"), threshold: [0.1]}, t2 = (e3) => this.setCategoryOnVisibilityChange(e3); + this.observer = new IntersectionObserver(t2, e2); + } + mr()(".emoji-picker", this).forEach((e2) => this.observer.observe(e2)); + } + } + setCategoryOnVisibilityChange(e2) { + const t2 = this.parentElement.navigator.selected, n2 = e2.filter((e3) => e3.target.contains(t2)).pop(); + let r2; + if (r2 = n2 || e2.reduce((e3, t3) => t3.intersectionRatio >= ((e3 == null ? void 0 : e3.intersectionRatio) || 0) ? t3 : e3, null), r2 && r2.isIntersecting) { + const e3 = r2.target.getAttribute("data-category"); + e3 !== this.model.get("current_category") && (this.parentElement.preserve_scroll = true, this.model.save({current_category: e3})); + } + } + insertEmoji(e2) { + e2.preventDefault(), e2.stopPropagation(); + const t2 = e2.target.nodeName === "IMG" ? e2.target.parentElement : e2.target; + this.parentElement.insertIntoTextArea(t2.getAttribute("data-emoji")); + } + shouldBeHidden(e2) { + if (e2.includes("_tone")) { + if (!this.current_skintone || !e2.includes(this.current_skintone)) + return true; + } else if (this.current_skintone && rl.emojis.toned.includes(e2)) + return true; + return !(!this.query || Uc.FILTER_CONTAINS(e2, this.query)); + } + }); + const Ag = rl.env.utils; + function Cg() { + const e2 = Lg(["", ""]); + return Cg = function() { + return e2; + }, e2; + } + function jg() { + const e2 = Lg(['\n <button class="toggle-compose-spoiler"\n title="', '"\n @click=', '>\n <converse-icon class="fa ', '"\n path-prefix="', '"\n size="1em"></converse-icon>\n </button>']); + return jg = function() { + return e2; + }, e2; + } + function Tg() { + const e2 = Lg(['\n <button title="', '" @click=', '>\n <converse-icon class="fa fa-paperclip"\n path-prefix="', '"\n size="1em"></converse-icon>\n </button>\n <input type="file" @change=', ' class="fileupload" multiple="" style="display:none"/>']); + return Tg = function() { + return e2; + }, e2; + } + function Og() { + const e2 = Lg(['\n <button class="toggle_occupants right"\n title="', '"\n @click=', '>\n <converse-icon class="fa ', '"\n path-prefix="', '" size="1em"></converse-icon>\n </button>']); + return Og = function() { + return e2; + }, e2; + } + function kg() { + const e2 = Lg(["", ""]); + return kg = function() { + return e2; + }, e2; + } + function Ng() { + const e2 = Lg(['<span class="right message-limit" title="', '">', "</span>"]); + return Ng = function() { + return e2; + }, e2; + } + function Ig() { + const e2 = Lg(['\n <button class="toggle-call" @click=', ' title="', '">\n <converse-icon class="fa fa-phone" path-prefix="/dist" size="1em"></converse-icon>\n </button>']); + return Ig = function() { + return e2; + }, e2; + } + function Mg() { + const e2 = Lg(["<converse-emoji-dropdown .chatview=", "></converse-dropdown>"]); + return Mg = function() { + return e2; + }, e2; + } + function Rg() { + const e2 = Lg(['<button type="submit" class="btn send-button fa fa-paper-plane" title="', '"></button>']); + return Rg = function() { + return e2; + }, e2; + } + function Dg() { + const e2 = Lg(['<span class="toolbar-buttons">', "</span>"]); + return Dg = function() { + return e2; + }, e2; + } + function Pg() { + const e2 = Lg(["\n ", "\n ", "\n "]); + return Pg = function() { + return e2; + }, e2; + } + function Lg(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + Vc.elements.define("converse-emoji-dropdown", class extends Zh { + static get properties() { + return {chatview: {type: Object}}; + } + constructor() { + super(), this.render_emojis = false; + } + initModel() { + return this.init_promise || (this.init_promise = (async () => { + await Vc.emojis.initialize(); + const e2 = "converse.emoji-".concat(Uc.bare_jid, "-").concat(this.chatview.model.get("jid")); + this.model = new Uc.EmojiPicker({id: e2}), this.model.browserStorage = Uc.createStore(e2), await new Promise((e3) => this.model.fetch({success: e3, error: e3})), this.model.set({autocompleting: null, ac_position: null}); + })()), this.init_promise; + } + render() { + return Za(xg(), zd("Insert emojis"), Vc.settings.get("assets_path"), Qh(this.initModel().then(() => Za(Sg(), this.chatview, this.model, this.render_emojis, this.model.get("current_category") || "", this.model.get("current_skintone") || "", this.model.get("query") || "")), "")); + } + connectedCallback() { + super.connectedCallback(), this.render_emojis = false; + } + toggleMenu(e2) { + e2.stopPropagation(), e2.preventDefault(), Ag.hasClass("show", this.menu) ? Ag.ancestor(e2.target, ".toggle-emojis") && this.hideMenu() : this.showMenu(); + } + async showMenu() { + await this.initModel(), this.render_emojis || (this.render_emojis = true, await this.requestUpdate()), super.showMenu(), setTimeout(() => { + var e2; + return (e2 = this.querySelector(".emoji-search")) === null || e2 === void 0 ? void 0 : e2.focus(); + }); + } + }), Vc.elements.define("converse-emoji-picker", class extends mc { + static get properties() { + return {chatview: {type: Object}, current_category: {type: String, reflect: true}, current_skintone: {type: String, reflect: true}, model: {type: Object}, query: {type: String, reflet: true}, render_emojis: {type: Boolean}}; + } + firstUpdated() { + this.listenTo(this.model, "change", (e2) => this.onModelChanged(e2.changed)), this.initArrowNavigation(); + } + constructor() { + super(), this._search_results = [], this.debouncedFilter = Rc((e2) => this.model.set({query: e2.value}), 250), this.registerEvents(); + } + get search_results() { + return this._search_results; + } + set search_results(e2) { + this._search_results = e2, this.requestUpdate(); + } + render() { + return yg({chatview: this.chatview, current_category: this.current_category, current_skintone: this.current_skintone, model: this.model, onCategoryPicked: (e2) => this.chooseCategory(e2), onSearchInputBlurred: (e2) => this.chatview.emitFocused(e2), onSearchInputFocus: (e2) => this.onSearchInputFocus(e2), onSearchInputKeyDown: (e2) => this.onKeyDown(e2), onSkintonePicked: (e2) => this.chooseSkinTone(e2), query: this.query, search_results: this.search_results, render_emojis: this.render_emojis, sn2Emoji: (e2) => Ag.shortnamesToEmojis(this.getTonedShortname(e2))}); + } + updated(e2) { + e2.has("query") && this.updateSearchResults(e2), e2.has("current_category") && this.setScrollPosition(); + } + onModelChanged(e2) { + "current_category" in e2 && (this.current_category = e2.current_category), "current_skintone" in e2 && (this.current_skintone = e2.current_skintone), "query" in e2 && (this.query = e2.query); + } + setScrollPosition() { + if (this.preserve_scroll) + return void (this.preserve_scroll = false); + const e2 = this.querySelector(".emoji-lists__container--browse"), t2 = this.querySelector("#emoji-picker-".concat(this.current_category)); + t2 && (e2.scrollTop = t2.offsetTop - 3 * t2.offsetHeight + 4); + } + updateSearchResults(e2) { + const t2 = e2.get("query"), n2 = Uc.FILTER_CONTAINS; + if (this.query) { + if (this.query === t2) + return this.search_results; + t2 && this.query.includes(t2) ? this.search_results = this.search_results.filter((e3) => n2(e3.sn, this.query)) : this.search_results = rl.emojis.list.filter((e3) => n2(e3.sn, this.query)); + } else + this.search_results.length && (this.search_results = []); + this.requestUpdate(); + } + registerEvents() { + this.onGlobalKeyDown = (e2) => this._onGlobalKeyDown(e2), document.querySelector("body").addEventListener("keydown", this.onGlobalKeyDown); + } + connectedCallback() { + super.connectedCallback(), this.registerEvents(); + } + disconnectedCallback() { + document.querySelector("body").removeEventListener("keydown", this.onGlobalKeyDown), super.disconnectedCallback(); + } + _onGlobalKeyDown(e2) { + this.navigator && (e2.keyCode === rl.keycodes.ENTER && this.navigator.selected && Ag.isVisible(this) ? this.onEnterPressed(e2) : e2.keyCode === rl.keycodes.DOWN_ARROW && !this.navigator.enabled && Ag.isVisible(this) && this.enableArrowNavigation(e2)); + } + setCategoryForElement(e2) { + const t2 = this.current_category, n2 = (e2 == null ? void 0 : e2.getAttribute("data-category")) || t2; + t2 !== n2 && this.model.save({current_category: n2}); + } + insertIntoTextArea(e2) { + this.chatview.onEmojiReceivedFromPicker(e2), this.model.set({autocompleting: null, query: "", ac_position: null}); + } + chooseSkinTone(e2) { + e2.preventDefault(), e2.stopPropagation(); + const t2 = (e2.target.nodeName === "IMG" ? e2.target.parentElement : e2.target).getAttribute("data-skintone").trim(); + this.current_skintone === t2 ? this.model.save({current_skintone: ""}) : this.model.save({current_skintone: t2}); + } + chooseCategory(e2) { + e2.preventDefault && e2.preventDefault(), e2.stopPropagation && e2.stopPropagation(); + const t2 = e2.target.matches("li") ? e2.target : Ag.ancestor(e2.target, "li"); + this.setCategoryForElement(t2), this.navigator.select(t2), !this.navigator.enabled && this.navigator.enable(); + } + onKeyDown(e2) { + if (e2.keyCode === rl.keycodes.TAB) + if (e2.target.value) { + e2.preventDefault(); + const t2 = rl.emojis.shortnames.find((t3) => Uc.FILTER_CONTAINS(t3, e2.target.value)); + t2 && this.model.set({query: t2}); + } else + this.navigator.enabled || this.enableArrowNavigation(e2); + else + e2.keyCode !== rl.keycodes.DOWN_ARROW || this.navigator.enabled ? e2.keyCode === rl.keycodes.ENTER ? this.onEnterPressed(e2) : e2.keyCode === rl.keycodes.ESCAPE ? (Ag.ancestor(this, "converse-emoji-dropdown").hideMenu(), this.chatview.el.querySelector(".chat-textarea").focus(), e2.stopPropagation(), e2.preventDefault()) : e2.keyCode !== rl.keycodes.ENTER && e2.keyCode !== rl.keycodes.DOWN_ARROW && this.debouncedFilter(e2.target) : this.enableArrowNavigation(e2); + } + onEnterPressed(e2) { + e2.emoji_keypress_handled || (e2.preventDefault(), e2.stopPropagation(), e2.emoji_keypress_handled = true, rl.emojis.shortnames.includes(e2.target.value) ? this.insertIntoTextArea(e2.target.value) : this.search_results.length === 1 ? this.insertIntoTextArea(this.search_results[0].sn) : this.navigator.selected && this.navigator.selected.matches(".insert-emoji") ? this.insertIntoTextArea(this.navigator.selected.getAttribute("data-emoji")) : this.navigator.selected && this.navigator.selected.matches(".emoji-category") && this.chooseCategory({target: this.navigator.selected})); + } + onSearchInputFocus(e2) { + this.chatview.emitBlurred(e2), this.disableArrowNavigation(); + } + getTonedShortname(e2) { + return rl.emojis.toned.includes(e2) && this.current_skintone ? "".concat(e2.slice(0, e2.length - 1), "_").concat(this.current_skintone, ":") : e2; + } + initArrowNavigation() { + if (!this.navigator) { + const e2 = "li:not(.hidden):not(.emoji-skintone), .emoji-search", t2 = {jump_to_picked: ".emoji-category", jump_to_picked_selector: ".emoji-category.picked", jump_to_picked_direction: Jh.DIRECTION.down, picked_selector: ".picked", scroll_container: this.querySelector(".emoji-picker__lists"), getSelector: (t3) => { + if (t3 === Jh.DIRECTION.down) { + const t4 = this.navigator.selected && this.navigator.selected.getAttribute("data-category"); + return t4 ? 'ul[data-category="'.concat(t4, '"] li:not(.hidden):not(.emoji-skintone), .emoji-search') : e2; + } + return e2; + }, onSelected: (e3) => { + e3.matches(".insert-emoji") && this.setCategoryForElement(e3.parentElement), e3.matches(".insert-emoji, .emoji-category") && e3.firstElementChild.focus(), e3.matches(".emoji-search") && e3.focus(); + }}; + this.navigator = new Jh(this, t2); + } + } + disableArrowNavigation() { + this.navigator.disable(); + } + enableArrowNavigation(e2) { + var t2, n2; + e2 == null || (t2 = e2.preventDefault) === null || t2 === void 0 || t2.call(e2), e2 == null || (n2 = e2.stopPropagation) === null || n2 === void 0 || n2.call(e2), this.disableArrowNavigation(), this.navigator.enable(), this.navigator.handleKeydown(e2); + } + }); + const zg = rl.env.Strophe; + window.customElements.define("converse-chat-toolbar", class extends mc { + static get properties() { + return {chatview: {type: Object}, composing_spoiler: {type: Boolean}, hidden_occupants: {type: Boolean}, is_groupchat: {type: Boolean}, message_limit: {type: Number}, model: {type: Object}, show_call_button: {type: Boolean}, show_emoji_button: {type: Boolean}, show_occupants_toggle: {type: Boolean}, show_send_button: {type: Boolean}, show_spoiler_button: {type: Boolean}, show_toolbar: {type: Boolean}}; + } + render() { + const e2 = zd("Send the message"); + return Za(Pg(), this.show_toolbar ? Za(Dg(), Qh(this.getButtons(), "")) : "", this.show_send_button ? Za(Rg(), e2) : ""); + } + getButtons() { + const e2 = []; + if (this.show_emoji_button && e2.push(Za(Mg(), this.chatview)), this.show_call_button) { + const t3 = zd("Start a call"); + e2.push(Za(Ig(), this.toggleCall, t3)); + } + const t2 = zd("Message characters remaining"); + Vc.settings.get("message_limit") && e2.push(Za(Ng(), t2, this.message_limit)), this.show_spoiler_button && e2.push(this.getSpoilerButton()); + const n2 = Vc.disco.supports(zg.NS.HTTPUPLOAD, Uc.domain); + if (e2.push(Za(kg(), Qh(n2.then((e3) => this.getHTTPUploadButton(e3)), ""))), this.show_occupants_toggle) { + const t3 = zd("Hide participants"), n3 = zd("Show participants"); + e2.push(Za(Og(), this.hidden_occupants ? n3 : t3, this.toggleOccupants, this.hidden_occupants ? "fa-angle-double-left" : "fa-angle-double-right", Vc.settings.get("assets_path"))); + } + return Uc.api.hook("getToolbarButtons", this, e2); + } + getHTTPUploadButton(e2) { + if (e2) { + const e3 = zd("Choose a file to send"); + return Za(Tg(), e3, this.toggleFileUpload, Vc.settings.get("assets_path"), this.onFileSelection); + } + return ""; + } + getSpoilerButton() { + const e2 = this.model; + if (!this.is_groupchat && e2.presence.resources.length === 0) + return; + let t2; + t2 = this.composing_spoiler ? zd("Click to write as a normal (non-spoiler) message") : zd("Click to write your message as a spoiler"); + const n2 = Za(jg(), t2, this.toggleComposeSpoilerMessage, this.composing_spoiler ? "fa-eye-slash" : "fa-eye", Vc.settings.get("assets_path")); + if (this.is_groupchat) + return n2; + { + const t3 = e2.get("jid"), r2 = Promise.all(e2.presence.resources.map((e3) => Vc.disco.supports(zg.NS.SPOILER, "".concat(t3, "/").concat(e3.get("name"))))).then((e3) => e3.reduce((e4, t4) => e4 && t4, true)); + return Za(Cg(), Qh(r2.then(() => n2), "")); + } + } + toggleFileUpload(e2) { + var t2, n2; + e2 == null || (t2 = e2.preventDefault) === null || t2 === void 0 || t2.call(e2), e2 == null || (n2 = e2.stopPropagation) === null || n2 === void 0 || n2.call(e2), this.querySelector(".fileupload").click(); + } + onFileSelection(e2) { + this.model.sendFiles(e2.target.files); + } + toggleComposeSpoilerMessage(e2) { + var t2, n2; + e2 == null || (t2 = e2.preventDefault) === null || t2 === void 0 || t2.call(e2), e2 == null || (n2 = e2.stopPropagation) === null || n2 === void 0 || n2.call(e2), this.model.set("composing_spoiler", !this.model.get("composing_spoiler")); + } + toggleOccupants(e2) { + var t2, n2; + e2 == null || (t2 = e2.preventDefault) === null || t2 === void 0 || t2.call(e2), e2 == null || (n2 = e2.stopPropagation) === null || n2 === void 0 || n2.call(e2), this.model.save({hidden_occupants: !this.model.get("hidden_occupants")}); + } + toggleCall(e2) { + var t2, n2; + e2 == null || (t2 = e2.preventDefault) === null || t2 === void 0 || t2.call(e2), e2 == null || (n2 = e2.stopPropagation) === null || n2 === void 0 || n2.call(e2), Vc.trigger("callButtonClicked", {connection: Uc.connection, model: this.model}); + } + }); + class Fg extends HTMLElement { + async connectedCallback() { + await Vc.waitUntil("initialized"), rl.insertInto(this); + } + } + customElements.define("converse-root", Fg); + const Bg = rl.env.utils; + var qg = {renderAvatar(e2) { + const t2 = (e2 = e2 || this.el).querySelector("canvas.avatar, svg.avatar"); + if (t2 !== null && this.model.vcard) { + const e3 = {classes: t2.getAttribute("class"), width: t2.getAttribute("width"), height: t2.getAttribute("height"), image_type: this.model.vcard.get("image_type"), image: this.model.vcard.get("image")}; + t2.outerHTML = Bg.getElementFromTemplateResult(ip(e3)).outerHTML; + } + }}; + function Hg() { + const e2 = function(e3, t2) { + t2 || (t2 = e3.slice(0)); + return Object.freeze(Object.defineProperties(e3, {raw: {value: Object.freeze(t2)}})); + }(['\n <div class="inner-content converse-brand row">\n <div class="converse-brand__padding"></div>\n <div class="converse-brand__heading">\n <svg height="200px"\n xmlns="http://www.w3.org/2000/svg"\n xmlns:xlink="http://www.w3.org/1999/xlink"\n viewBox="0 0 364 364"\n version="1.1">\n <title>Logo Converse</title>\n <defs>\n <linearGradient id="gradient" x1="92.14" y1="27.64" x2="267.65" y2="331.62" gradientUnits="userSpaceOnUse">\n <stop offset="0" stop-color="#fff1d1"/>\n <stop offset="0.05" stop-color="#fae8c1"/>\n <stop offset="0.15" stop-color="#f0d5a1"/>\n <stop offset="0.27" stop-color="#e7c687"/>\n <stop offset="0.4" stop-color="#e1bb72"/>\n <stop offset="0.54" stop-color="#dcb264"/>\n <stop offset="0.71" stop-color="#daad5c"/>\n <stop offset="1" stop-color="#d9ac59"/>\n </linearGradient>\n <filter id="shadow">\n <feGaussianBlur in="SourceAlpha" stdDeviation="2.3" result="blur1"/>\n <feOffset in="blur1" dx="3" dy="3" result="blur2"/>\n <feColorMatrix in="blur2" type="matrix" result="blur3"\n values="1 0 0 0 0.1\n 0 1 0 0 0.1\n 0 0 1 0 0.1\n 0 0 0 1 0"/>\n <feMerge>\n <feMergeNode in="blur3"/>\n <feMergeNode in="SourceGraphic"/>\n </feMerge>\n </filter>\n </defs>\n <g filter="url(#shadow)">\n <path d="M221.46,103.71c0,18.83-29.36,18.83-29.12,0C192.1,84.88,221.46,84.88,221.46,103.71Z" fill="#d9ac59"/>\n <path d="M179.9,4.15A175.48,175.48,0,1,0,355.38,179.63,175.48,175.48,0,0,0,179.9,4.15Zm-40.79,264.5c-.23-17.82,27.58-17.82,27.58,0S138.88,286.48,139.11,268.65ZM218.6,168.24A79.65,79.65,0,0,1,205.15,174a12.76,12.76,0,0,0-6.29,4.65L167.54,222a1.36,1.36,0,0,1-2.46-.8v-35.8a2.58,2.58,0,0,0-3.06-2.53c-15.43,3-30.23,7.7-42.73,19.94-38.8,38-29.42,105.69,16.09,133.16a162.25,162.25,0,0,1-91.47-67.27C-3.86,182.26,34.5,47.25,138.37,25.66c46.89-9.75,118.25,5.16,123.73,62.83C265.15,120.64,246.56,152.89,218.6,168.24Z" fill="url(#gradient)"/>\n </g>\n </svg>\n <span class="converse-brand__text">\n <span>converse<span class="subdued">.js</span></span>\n <p class="byline">messaging freedom</p>\n </span>\n </div>\n </div>']); + return Hg = function() { + return e2; + }, e2; + } + /** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ + const Ug = new WeakMap(), $g = ka((e2) => (t2) => { + if (!(t2 instanceof qa)) + throw new Error("unsafeSVG can only be used in text bindings"); + const n2 = Ug.get(t2); + if (n2 !== void 0 && La(e2) && e2 === n2.value && t2.value === n2.fragment) + return; + const r2 = document.createElement("template"); + r2.innerHTML = `<svg>${e2}</svg>`; + const i2 = r2.content, o2 = i2.firstChild; + i2.removeChild(o2), ma(i2, o2.firstChild); + const s2 = document.importNode(i2, true); + t2.setValue(s2), Ug.set(t2, {value: e2, fragment: s2}); + }); + function Wg() { + const e2 = Vg(["", ""]); + return Wg = function() { + return e2; + }, e2; + } + function Gg() { + const e2 = Vg(["", ""]); + return Gg = function() { + return e2; + }, e2; + } + function Vg(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + function Jg() { + const e2 = function(e3, t2) { + t2 || (t2 = e3.slice(0)); + return Object.freeze(Object.defineProperties(e3, {raw: {value: Object.freeze(t2)}})); + }(['\n <div class="converse-chatboxes row no-gutters"></div>\n <div id="converse-modals" class="modals"></div>\n <converse-fontawesome></converse-fontawesome>\n']); + return Jg = function() { + return e2; + }, e2; + } + window.customElements.define("converse-fontawesome", class extends mc { + constructor() { + super(); + const e2 = n.e(138).then(n.t.bind(null, 548, 7)); + this.data = e2.then((e3) => Za(Gg(), $g(e3.default()))); + } + render() { + return Za(Wg(), Qh(this.data, "")); + } + }); + var Xg = function(e2, t2, n2) { + var r2 = e2 == null ? 0 : e2.length; + return r2 ? (t2 = n2 || t2 === void 0 ? 1 : fi(t2), jo(e2, t2 < 0 ? 0 : t2, r2)) : []; + }; + var Qg = function(e2, t2) { + var n2 = []; + return vs(e2, function(e3, r2, i2) { + t2(e3, r2, i2) && n2.push(e3); + }), n2; + }; + var Yg = function(e2, t2) { + return (ke(e2) ? ot : Qg)(e2, Eo(t2)); + }; + var Kg = function(e2) { + return e2 && e2.length ? e2[0] : void 0; + }; + var Zg = function(e2) { + return typeof e2 == "function" ? e2 : br; + }; + var em = function(e2, t2) { + return (ke(e2) ? ve : vs)(e2, Zg(t2)); + }; + var tm = function(e2, t2) { + return qr(t2, function(t3) { + return e2[t3]; + }); + }; + var nm = function(e2) { + return e2 == null ? [] : tm(e2, Qe(e2)); + }, rm = Math.max; + var im = function(e2, t2, n2, r2) { + e2 = Xe(e2) ? e2 : nm(e2), n2 = n2 && !r2 ? fi(n2) : 0; + var i2 = e2.length; + return n2 < 0 && (n2 = rm(i2 + n2, 0)), Zt(e2) ? n2 <= i2 && e2.indexOf(t2, n2) > -1 : !!i2 && As(e2, t2, n2) > -1; + }; + var om = function(e2) { + return (e2 == null ? 0 : e2.length) ? jo(e2, 0, -1) : []; + }; + var sm = function(e2, t2) { + return (ke(e2) ? qr : Qs)(e2, Eo(t2)); + }; + var am = function(e2, t2, n2) { + for (var r2 = -1, i2 = e2.length; ++r2 < i2; ) { + var o2 = e2[r2], s2 = t2(o2); + if (s2 != null && (a2 === void 0 ? s2 == s2 && !Ir(s2) : n2(s2, a2))) + var a2 = s2, c2 = o2; + } + return c2; + }; + var cm = function(e2, t2) { + return e2 > t2; + }; + var lm = function(e2) { + return e2 && e2.length ? am(e2, br, cm) : void 0; + }; + var um = function(e2, t2) { + return e2 < t2; + }; + var dm = function(e2) { + return e2 && e2.length ? am(e2, br, um) : void 0; + }; + var hm = function(e2, t2, n2, r2) { + var i2 = -1, o2 = e2 == null ? 0 : e2.length; + for (r2 && o2 && (n2 = e2[++i2]); ++i2 < o2; ) + n2 = t2(n2, e2[i2], i2, e2); + return n2; + }; + var fm = function(e2, t2, n2, r2, i2) { + return i2(e2, function(e3, i3, o2) { + n2 = r2 ? (r2 = false, e3) : t2(n2, e3, i3, o2); + }), n2; + }; + var pm = function(e2, t2, n2) { + var r2 = ke(e2) ? hm : fm, i2 = arguments.length < 3; + return r2(e2, Eo(t2), n2, i2, vs); + }; + var gm = function(e2, t2, n2, r2) { + var i2 = e2 == null ? 0 : e2.length; + for (r2 && i2 && (n2 = e2[--i2]); i2--; ) + n2 = t2(n2, e2[i2], i2, e2); + return n2; + }, mm = Fi(true); + var vm = ms(function(e2, t2) { + return e2 && mm(e2, t2, Qe); + }, true); + var _m = function(e2, t2, n2) { + var r2 = ke(e2) ? gm : fm, i2 = arguments.length < 3; + return r2(e2, Eo(t2), n2, i2, vm); + }; + var bm = function(e2) { + if (typeof e2 != "function") + throw new TypeError("Expected a function"); + return function() { + var t2 = arguments; + switch (t2.length) { + case 0: + return !e2.call(this); + case 1: + return !e2.call(this, t2[0]); + case 2: + return !e2.call(this, t2[0], t2[1]); + case 3: + return !e2.call(this, t2[0], t2[1], t2[2]); + } + return !e2.apply(this, t2); + }; + }; + var ym = function(e2, t2) { + return (ke(e2) ? ot : Qg)(e2, bm(Eo(t2))); + }; + var wm = function(e2, t2) { + if (typeof e2 != "function") + throw new TypeError("Expected a function"); + return t2 = t2 === void 0 ? t2 : fi(t2), jr(e2, t2); + }, Sm = Math.floor, xm = Math.random; + var Em = function(e2, t2) { + return e2 + Sm(xm() * (t2 - e2 + 1)); + }; + var Am = function(e2) { + var t2 = e2.length; + return t2 ? e2[Em(0, t2 - 1)] : void 0; + }; + var Cm = function(e2) { + return Am(nm(e2)); + }; + var jm = function(e2) { + return (ke(e2) ? Am : Cm)(e2); + }; + var Tm = function(e2, t2) { + var n2 = -1, r2 = e2.length, i2 = r2 - 1; + for (t2 = t2 === void 0 ? r2 : t2; ++n2 < t2; ) { + var o2 = Em(n2, i2), s2 = e2[o2]; + e2[o2] = e2[n2], e2[n2] = s2; + } + return e2.length = t2, e2; + }; + var Om = function(e2) { + return Tm(it(e2)); + }; + var km = function(e2) { + return Tm(nm(e2)); + }; + var Nm = function(e2) { + return (ke(e2) ? Om : km)(e2); + }, Im = wo("length"), Mm = RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"); + var Rm = function(e2) { + return Mm.test(e2); + }, Dm = "[\\ud800-\\udfff]", Pm = "[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]", Lm = "\\ud83c[\\udffb-\\udfff]", zm = "[^\\ud800-\\udfff]", Fm = "(?:\\ud83c[\\udde6-\\uddff]){2}", Bm = "[\\ud800-\\udbff][\\udc00-\\udfff]", qm = "(?:" + Pm + "|" + Lm + ")?", Hm = "[\\ufe0e\\ufe0f]?" + qm + ("(?:\\u200d(?:" + [zm, Fm, Bm].join("|") + ")[\\ufe0e\\ufe0f]?" + qm + ")*"), Um = "(?:" + [zm + Pm + "?", Pm, Fm, Bm, Dm].join("|") + ")", $m = RegExp(Lm + "(?=" + Lm + ")|" + Um + Hm, "g"); + var Wm = function(e2) { + for (var t2 = $m.lastIndex = 0; $m.test(e2); ) + ++t2; + return t2; + }; + var Gm = function(e2) { + return Rm(e2) ? Wm(e2) : Im(e2); + }; + var Vm = function(e2) { + if (e2 == null) + return 0; + if (Xe(e2)) + return Zt(e2) ? Gm(e2) : e2.length; + var t2 = Tt(e2); + return t2 == "[object Map]" || t2 == "[object Set]" ? e2.size : Je(e2).length; + }; + var Jm = function(e2) { + var t2 = e2 == null ? 0 : e2.length; + return t2 ? jo(e2, 1, t2) : []; + }; + var Xm = function(e2, t2, n2) { + return e2 && e2.length ? (t2 = n2 || t2 === void 0 ? 1 : fi(t2), jo(e2, 0, t2 < 0 ? 0 : t2)) : []; + }; + var Qm = function(e2) { + for (var t2, n2 = []; !(t2 = e2.next()).done; ) + n2.push(t2.value); + return n2; + }; + var Ym = function(e2) { + return e2.split(""); + }, Km = "[\\ud800-\\udfff]", Zm = "[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]", ev = "[^\\ud800-\\udfff]", tv = "(?:\\ud83c[\\udde6-\\uddff]){2}", nv = "[\\ud800-\\udbff][\\udc00-\\udfff]", rv = "(?:" + Zm + "|\\ud83c[\\udffb-\\udfff])?", iv = "[\\ufe0e\\ufe0f]?" + rv + ("(?:\\u200d(?:" + [ev, tv, nv].join("|") + ")[\\ufe0e\\ufe0f]?" + rv + ")*"), ov = "(?:" + [ev + Zm + "?", Zm, tv, nv, Km].join("|") + ")", sv = RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|" + ov + iv, "g"); + var av = function(e2) { + return e2.match(sv) || []; + }; + var cv = function(e2) { + return Rm(e2) ? av(e2) : Ym(e2); + }, lv = w ? w.iterator : void 0; + var uv = function(e2) { + if (!e2) + return []; + if (Xe(e2)) + return Zt(e2) ? cv(e2) : it(e2); + if (lv && e2[lv]) + return Qm(e2[lv]()); + var t2 = Tt(e2); + return (t2 == "[object Map]" ? Zi : t2 == "[object Set]" ? eo : nm)(e2); + }, dv = jr(function(e2, t2) { + return Os(e2) ? Ts(e2, t2) : []; + }); + /*! + * Copyright (c) JC Brand <jc@opkode.com> + */ + const hv = function(e2) { + this.views = {}, this.keys = () => Object.keys(this.views), this.getAll = () => this.views, this.get = (e3) => this.views[e3], this.xget = (e3) => this.keys().filter((t2) => t2 !== e3).reduce((e4, t2) => (e4[t2] = this.views[t2], e4), {}), this.add = (e3, t2) => (this.views[e3] = t2, t2), this.remove = (e3) => { + e3 === void 0 && new eh().remove.apply(this); + const t2 = this.views[e3]; + if (t2) + return delete this.views[e3], t2.remove(), t2; + }, this.removeAll = () => (this.keys().forEach((e3) => this.remove(e3)), this), eh.apply(this, Array.prototype.slice.apply(arguments)); + }, fv = {includes: im, difference: ks, drop: Xg, every: Ms, filter: Yg, find: fl, first: Kg, forEach: em, head: Kg, indexOf: Hs, initial: om, invoke: Pc, isEmpty: oi, last: Co, lastIndexOf: Vs, map: sm, max: lm, min: dm, reduce: pm, reduceRight: _m, reject: ym, rest: wm, sample: jm, shuffle: Nm, size: Vm, some: Xs, sortBy: ta, tail: Jm, take: Xm, toArray: uv, without: dv}; + Object.keys(fv).forEach((e2) => { + hv.prototype[e2] = function() { + const t2 = Array.prototype.slice.call(arguments); + return t2.unshift(this.views), fv[e2].apply(this, t2); + }; + }), Object.assign(hv.prototype, eh.prototype), hv.extend = eh.extend; + const pv = hv.extend({listItems: "model", sortEvent: "change", sortImmediatelyOnAdd: false, listSelector: ".ordered-items", ItemView: void 0, subviewIndex: "id", initialize() { + this.sortEventually = Rc(() => this.sortAndPositionAllItems(), 100), this.items = vo(this, this.listItems), this.items.on("remove", this.removeView, this), this.items.on("reset", this.removeAll, this), this.items.on("add", (e2, t2) => { + this.sortImmediatelyOnAdd ? this.sortAndPositionAllItems() : this.sortEventually(); + }), this.sortEvent && this.items.on(this.sortEvent, this.sortEventually, this); + }, createItemView(e2) { + let t2 = this.get(e2.get(this.subviewIndex)); + return t2 ? (t2.model = e2, t2.initialize()) : (t2 = new this.ItemView({model: e2}), this.add(e2.get(this.subviewIndex), t2)), t2.render(), t2; + }, removeView(e2) { + this.remove(e2.get(this.subviewIndex)); + }, sortAndPositionAllItems() { + if (!this.items.length) + return; + this.items.sort(); + const e2 = this.el.querySelector(this.listSelector), t2 = document.createElement("div"); + e2.parentNode.replaceChild(t2, e2), this.items.forEach((t3) => { + let n2 = this.get(t3.get(this.subviewIndex)); + n2 || (n2 = this.createItemView(t3)), e2.insertAdjacentElement("beforeend", n2.el); + }), t2.parentNode.replaceChild(e2, t2); + }}), gv = rl.env.utils; + var mv = hv.extend({_ensureElement() { + if (this.el) + this.setElement(Qr(this, "el"), false); + else { + let e2 = Uc.root.querySelector("#conversejs"); + if (e2 === null) { + e2 = document.createElement("div"), e2.setAttribute("id", "conversejs"), gv.addClass("theme-".concat(Vc.settings.get("theme")), e2); + const t2 = Uc.root.querySelector("body"); + t2 ? t2.appendChild(e2) : Uc.root.appendChild(e2); + } + this.setElement(e2, false); + } + }, initialize() { + this.listenTo(this.model, "destroy", this.removeChat); + const e2 = document.getElementById("conversejs-bg"); + e2 && !e2.innerHTML.trim() && Ya(Za(Hg()), e2), document.querySelector("body").classList.add("converse-".concat(Vc.settings.get("view_mode"))), this.el.classList.add("converse-".concat(Vc.settings.get("view_mode"))), Vc.settings.get("singleton") && this.el.classList.add("converse-singleton"), this.render(); + }, render() { + this._ensureElement(), Ya(Za(Jg()), this.el), this.row_el = this.el.querySelector(".row"); + }, insertRowColumn(e2) { + this.row_el.insertAdjacentElement("afterBegin", e2); + }, removeChat(e2) { + this.remove(e2.get("id")); + }, closeAllChatBoxes() { + return Promise.all(this.map((e2) => e2.close({name: "closeAllChatBoxes"}))); + }}); + /** + * @module converse-chatboxviews + * @copyright 2020, the Converse.js contributors + * @license Mozilla Public License (MPLv2) + */ + function vv() { + Uc.chatboxviews = new Uc.ChatBoxViews({model: Uc.chatboxes}), Vc.trigger("chatBoxViewsInitialized"); + } + function _v() { + const e2 = 0.01 * window.innerHeight; + document.documentElement.style.setProperty("--vh", "".concat(e2, "px")); + } + function bv() { + const e2 = wv(["<p>", "</p>"]); + return bv = function() { + return e2; + }, e2; + } + function yv() { + const e2 = wv(['\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header ', '">\n <h5 class="modal-title">', "</h5>\n ", '\n </div>\n <div class="modal-body">\n <span class="modal-alert"></span>\n ', "\n </div>\n </div>\n </div>\n"]); + return yv = function() { + return e2; + }, e2; + } + function wv(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + rl.plugins.add("converse-chatboxviews", {dependencies: ["converse-chatboxes", "converse-vcard"], initialize() { + Vc.elements.register(), Vc.promises.add(["chatBoxViewsInitialized"]), Vc.settings.extend({animate: true, theme: "default"}), Uc.ViewWithAvatar = eh.extend(qg), Uc.ChatBoxViews = mv, Vc.listen.on("chatBoxesInitialized", vv), Vc.listen.on("cleanup", () => delete Uc.chatboxviews), Vc.listen.on("clearSession", () => Uc.chatboxviews.closeAllChatBoxes()), Vc.listen.on("chatBoxViewsInitialized", _v), window.addEventListener("resize", _v), Object.assign(rl, {insertInto(e2) { + var t2; + const n2 = (t2 = Uc.chatboxviews) === null || t2 === void 0 ? void 0 : t2.el; + if (n2 && !e2.contains(n2)) + e2.insertAdjacentElement("afterBegin", n2), Vc.chatviews.get().filter((e3) => e3.model.get("id") !== "controlbox").forEach((e3) => e3.maintainScrollTop()); + else if (!n2) + throw new Error("Cannot insert non-existing #conversejs element into the DOM"); + }}); + }}); + var Sv = df.extend({id: "alert-modal", initialize() { + df.prototype.initialize.apply(this, arguments), this.listenTo(this.model, "change", this.render); + }, toHTML() { + return e2 = Object.assign({__: zd}, this.model.toJSON()), Za(yv(), e2.level, e2.title, mf, e2.messages.map((e3) => Za(bv(), e3))); + var e2; + }}); + function xv() { + const e2 = Cv(["<p>", "</p>"]); + return xv = function() { + return e2; + }, e2; + } + function Ev() { + const e2 = Cv(['\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header ', '">\n <h5 class="modal-title">', '</h5>\n <button type="button" class="close" data-dismiss="modal" aria-label="Close">\n <span aria-hidden="true">\xD7</span>\n </button>\n </div>\n <div class="modal-body">\n <span class="modal-alert"></span>\n <form class="converse-form converse-form--modal confirm" action="#">\n <div class="form-group">\n ', "\n </div>\n ", '\n <div class="form-group">\n <button type="submit" class="btn btn-primary">', '</button>\n <input type="button" class="btn btn-secondary" data-dismiss="modal" value="', '"/>\n </div>\n </form>\n </div>\n </div>\n </div>\n']); + return Ev = function() { + return e2; + }, e2; + } + function Av() { + const e2 = Cv(['\n <div class="form-group">\n <label>\n ', '\n <input type="text"\n name="', '"\n class="', ' form-control form-control--labeled"\n ?required="', '"\n placeholder="', '" />\n </label>\n </div>\n']); + return Av = function() { + return e2; + }, e2; + } + function Cv(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + var jv = (e2) => Za(Ev(), e2.level || "", e2.title, e2.messages.map((e3) => Za(xv(), e3)), e2.fields.map((e3) => ((e4) => Za(Av(), e4.label || "", e4.name, e4.challenge_failed ? "error" : "", e4.required, e4.placeholder))(e3)), zd("OK"), zd("Cancel")); + const Tv = rl.env.utils; + var Ov = df.extend({id: "confirm-modal", events: {"submit .confirm": "onConfimation"}, initialize() { + this.confirmation = Tv.getResolveablePromise(), df.prototype.initialize.apply(this, arguments), this.listenTo(this.model, "change", this.render), this.el.addEventListener("closed.bs.modal", () => this.confirmation.reject(), false); + }, toHTML() { + return jv(this.model.toJSON()); + }, afterRender() { + this.close_handler_registered || (this.el.addEventListener("closed.bs.modal", () => { + this.confirmation.isResolved || this.confirmation.reject(); + }, false), this.close_handler_registered = true); + }, onConfimation(e2) { + e2.preventDefault(); + const t2 = new FormData(e2.target), n2 = (this.model.get("fields") || []).map((e3) => { + const n3 = t2.get(e3.name).trim(); + return e3.value = n3, e3.challenge && (e3.challenge_failed = n3 !== e3.challenge), e3; + }); + if (n2.filter((e3) => e3.challenge_failed).length) + return this.model.set("fields", n2), void this.model.trigger("change"); + this.confirmation.resolve(n2), this.modal.hide(); + }}); + /** + * @module converse-modal + * @copyright The Converse.js contributors + * @license Mozilla Public License (MPLv2) + */ + rl.env.BootstrapModal = df; + let kv = []; + const Nv = {modal: {show(e2, t2, n2) { + const r2 = this.get(e2.id) || this.create(e2, t2); + return r2.show(n2), r2; + }, get: (e2) => kv.filter((t2) => t2.id == e2).pop(), create(e2, t2) { + const n2 = new e2(t2); + return kv.push(n2), n2; + }, remove(e2) { + kv = kv.filter((t2) => t2 !== e2), e2.remove(); + }, removeAll() { + kv.forEach((e2) => e2.remove()), kv = []; + }}, async confirm(e2, t2 = [], n2 = []) { + typeof t2 == "string" && (t2 = [t2]); + const r2 = new qo({title: e2, messages: t2, fields: n2, type: "confirm"}), i2 = new Ov({model: r2}); + let o2; + i2.show(); + try { + o2 = await i2.confirmation; + } catch (e3) { + o2 = false; + } + return i2.remove(), o2; + }, async prompt(e2, t2 = [], n2 = "") { + typeof t2 == "string" && (t2 = [t2]); + const r2 = new qo({title: e2, messages: t2, fields: [{name: "reason", placeholder: n2}], type: "prompt"}), i2 = new Ov({model: r2}); + let o2; + i2.show(); + try { + var s2; + o2 = (s2 = (await i2.confirmation).pop()) === null || s2 === void 0 ? void 0 : s2.value; + } catch (e3) { + o2 = false; + } + return i2.remove(), o2; + }, alert(e2, t2, n2) { + let r2; + typeof n2 == "string" && (n2 = [n2]), e2 === "error" ? r2 = "alert-danger" : e2 === "info" ? r2 = "alert-info" : e2 === "warn" && (r2 = "alert-warning"); + const i2 = new qo({title: t2, messages: n2, level: r2, type: "alert"}); + Vc.modal.show(Sv, {model: i2}); + }}; + function Iv() { + const e2 = Uv(["<p><label>", ":</label> ", "</p>"]); + return Iv = function() { + return e2; + }, e2; + } + function Mv() { + const e2 = Uv(["<p><label>", ':</label> <a href="mailto:', '">', "</a></p>"]); + return Mv = function() { + return e2; + }, e2; + } + function Rv() { + const e2 = Uv(["<p><label>", ':</label> <a target="_blank" rel="noopener" href="', '">', "</a></p>"]); + return Rv = function() { + return e2; + }, e2; + } + function Dv() { + const e2 = Uv(["<p><label>", ":</label> ", "</p>"]); + return Dv = function() { + return e2; + }, e2; + } + function Pv() { + const e2 = Uv(["<p><label>", ":</label> ", "</p>"]); + return Pv = function() { + return e2; + }, e2; + } + function Lv() { + const e2 = Uv(['<div class="mb-4">', "</div>"]); + return Lv = function() { + return e2; + }, e2; + } + function zv() { + const e2 = Uv(['\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title" id="user-details-modal-label">', "</h5>\n ", '\n </div>\n <div class="modal-body">\n ', "\n ", "\n <p><label>", ':</label> <a href="xmpp:', '">', "</a></p>\n ", "\n ", "\n ", "\n ", "\n\n ", '\n </div>\n <div class="modal-footer">\n ', '\n <button type="button" class="btn btn-info refresh-contact"><i class="fa fa-refresh"> </i>', "</button>\n ", "\n\n </div>\n </div>\n </div>\n "]); + return zv = function() { + return e2; + }, e2; + } + function Fv() { + const e2 = Uv(['\n <button type="button" @click="', '" class="btn btn-danger remove-contact">\n <i class="far fa-trash-alt"></i>', "\n </button>\n "]); + return Fv = function() { + return e2; + }, e2; + } + function Bv() { + const e2 = Uv(['<li class="list-group-item"> ', " </li>"]); + return Bv = function() { + return e2; + }, e2; + } + function qv() { + const e2 = Uv(['\n <hr/>\n <ul class="list-group fingerprints">\n <li class="list-group-item active">', "</li>\n ", "\n </ul>\n "]); + return qv = function() { + return e2; + }, e2; + } + function Hv() { + const e2 = Uv(['\n <li class="list-group-item">\n <form class="fingerprint-trust">\n <div class="btn-group btn-group-toggle">\n <label class="btn btn--small ', '">\n <input type="radio" name="', '" value="1" ?checked=', ">", '\n </label>\n <label class="btn btn--small ', '">\n <input type="radio" name="', '" value="-1" ?checked=', ">", '\n </label>\n </div>\n <code class="fingerprint">', "</code>\n </form>\n </li>\n "]); + return Hv = function() { + return e2; + }, e2; + } + function Uv(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + rl.plugins.add("converse-modal", {initialize() { + Vc.listen.on("disconnect", () => { + const e2 = document.querySelector("#converse-modals"); + e2 && (e2.innerHTML = ""); + }), Vc.listen.on("clearSession", () => Vc.modal.removeAll()), Object.assign(Uc.api, Nv); + }}); + const $v = (e2) => { + const t2 = zd("OMEMO Fingerprints"), n2 = zd("No OMEMO-enabled devices found"), r2 = e2.view.devicelist.devices; + return Za(qv(), t2, r2.length ? r2.map((t3) => ((e3) => { + const t4 = zd("Trusted"), n3 = zd("Untrusted"); + return e3.device.get("bundle") && e3.device.get("bundle").fingerprint ? Za(Hv(), e3.device.get("trusted") !== -1 ? "btn-primary active" : "btn-secondary", e3.device.get("id"), e3.device.get("trusted") !== -1, t4, e3.device.get("trusted") !== -1 ? "btn-primary active" : "btn-secondary", e3.device.get("id"), e3.device.get("trusted") === -1, n3, e3.utils.formatFingerprint(e3.device.get("bundle").fingerprint)) : ""; + })(Object.assign({device: t3}, e2))) : Za(Bv(), n2)); + }; + var Wv = (e2) => { + const t2 = zd("XMPP Address"), n2 = zd("Email"), r2 = zd("Full Name"), i2 = zd("Nickname"), o2 = zd("The User's Profile Image"), s2 = zd("Refresh"), a2 = zd("Role"), c2 = zd("URL"), l2 = {alt_text: o2, extra_classes: "mb-3", height: "120", width: "120"}; + return Za(zv(), e2.display_name, mf, e2.image ? Za(Lv(), ip(Object.assign(e2, l2))) : "", e2.fullname ? Za(Pv(), r2, e2.fullname) : "", t2, e2.jid, e2.jid, e2.nickname ? Za(Dv(), i2, e2.nickname) : "", e2.url ? Za(Rv(), c2, e2.url, e2.url) : "", e2.email ? Za(Mv(), n2, e2.email, e2.email) : "", e2.role ? Za(Iv(), a2, e2.role) : "", e2._converse.pluggable.plugins["converse-omemo"].enabled(e2._converse) ? $v(e2) : "", gf, s2, e2.allow_contact_removal && e2.is_roster_contact ? ((e3) => { + const t3 = zd("Remove as contact"); + return Za(Fv(), e3.removeContact, t3); + })(e2) : ""); + }; + const Gv = rl.env.utils; + const Vv = df.extend({id: "user-details-modal", persistent: true, events: {"click button.refresh-contact": "refreshContact", "click .fingerprint-trust .btn input": "toggleDeviceTrust"}, initialize() { + df.prototype.initialize.apply(this, arguments), this.model.rosterContactAdded.then(() => this.registerContactEventHandlers()), this.listenTo(this.model, "change", this.render), this.registerContactEventHandlers(), Vc.trigger("userDetailsModalInitialized", this.model); + }, toHTML() { + var e2; + const t2 = (e2 = this.model) === null || e2 === void 0 ? void 0 : e2.vcard, n2 = t2 ? t2.toJSON() : {}; + return Wv(Object.assign(this.model.toJSON(), n2, {_converse: Uc, allow_contact_removal: Vc.settings.get("allow_contact_removal"), display_name: this.model.getDisplayName(), is_roster_contact: this.model.contact !== void 0, removeContact: (e3) => this.removeContact(e3), view: this, utils: Gv})); + }, registerContactEventHandlers() { + this.model.contact !== void 0 && (this.listenTo(this.model.contact, "change", this.render), this.listenTo(this.model.contact.vcard, "change", this.render), this.model.contact.on("destroy", () => { + delete this.model.contact, this.render(); + })); + }, async refreshContact(e2) { + e2 && e2.preventDefault && e2.preventDefault(); + const t2 = this.el.querySelector(".fa-refresh"); + Gv.addClass("fa-spin", t2); + try { + await Vc.vcard.update(this.model.contact.vcard, true); + } catch (e3) { + zn.fatal(e3), this.alert(zd("Sorry, something went wrong while trying to refresh"), "danger"); + } + Gv.removeClass("fa-spin", t2); + }, removeContact(e2) { + if (e2 && e2.preventDefault && e2.preventDefault(), !Vc.settings.get("allow_contact_removal")) + return; + confirm(zd("Are you sure you want to remove this contact?")) === true && (setTimeout(() => { + var e3; + (e3 = this.model.contact).removeFromRoster(() => e3.destroy(), (t2) => { + t2 && zn.error(t2), Vc.alert("error", zd("Error"), [zd("Sorry, there was an error while trying to remove %1$s as a contact.", e3.getDisplayName())]); + }); + }, 1), this.modal.hide()); + }}); + Uc.UserDetailsModal = Vv; + var Jv = Vv; + function Xv() { + const e2 = function(e3, t2) { + t2 || (t2 = e3.slice(0)); + return Object.freeze(Object.defineProperties(e3, {raw: {value: Object.freeze(t2)}})); + }(['\n <div class="flyout box-flyout">\n <div class="chat-head chat-head-chatbox row no-gutters"></div>\n <div class="chat-body">\n <div class="chat-content ', '" aria-live="polite">\n <div class="chat-content__messages" @scroll=', '></div>\n <div class="chat-content__help"></div>\n </div>\n <div class="bottom-panel">\n <div class="message-form-container">\n </div>\n </div>\n </div>\n']); + return Xv = function() { + return e2; + }, e2; + } + var Qv = (e2) => Za(Xv(), e2.show_send_button ? "chat-content-sendbutton" : "", e2.markScrolled); + function Yv() { + const e2 = i_(['<p class="chat-head__desc">', "</p>"]); + return Yv = function() { + return e2; + }, e2; + } + function Kv() { + const e2 = i_(["<converse-dropdown .items=", "></converse-dropdown>"]); + return Kv = function() { + return e2; + }, e2; + } + function Zv() { + const e2 = i_(['<a class="user show-msg-author-modal" @click=', ">", "</a>"]); + return Zv = function() { + return e2; + }, e2; + } + function e_() { + const e2 = i_(['<a class="show-msg-author-modal" @click=', ">", "</a>"]); + return e_ = function() { + return e2; + }, e2; + } + function t_() { + const e2 = i_(['<div class="chatbox-navback"><i class="fa fa-arrow-left"></i></div>']); + return t_ = function() { + return e2; + }, e2; + } + function n_() { + const e2 = i_(['\n <div class="chatbox-title ', '">\n <div class="chatbox-title--row">\n ', "\n ", '\n <div class="chatbox-title__text" title="', '">\n ', '\n </div>\n </div>\n <div class="chatbox-title__buttons row no-gutters">\n ', "\n ", "\n </div>\n </div>\n ", "\n "]); + return n_ = function() { + return e2; + }, e2; + } + function r_() { + const e2 = i_(['<span class="mr-2">', "</span>"]); + return r_ = function() { + return e2; + }, e2; + } + function i_(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + function o_() { + const e2 = function(e3, t2) { + t2 || (t2 = e3.slice(0)); + return Object.freeze(Object.defineProperties(e3, {raw: {value: Object.freeze(t2)}})); + }(['\n <div class="new-msgs-indicator hidden">\u25BC ', ' \u25BC</div>\n <form class="setNicknameButtonForm hidden">\n <input type="submit" class="btn btn-primary" name="join" value="Join"/>\n </form>\n <form class="sendXMPPMessage">\n <span class="chat-toolbar no-text-select"></span>\n <input type="text" placeholder="', '" value="', '" class="', ' spoiler-hint"/>\n\n <div class="suggestion-box">\n <ul class="suggestion-box__results suggestion-box__results--above" hidden=""></ul>\n <textarea\n type="text"\n class="chat-textarea suggestion-box__input\n ', "\n ", '"\n placeholder="', '">', '</textarea>\n <span class="suggestion-box__additions visually-hidden" role="status" aria-live="assertive" aria-relevant="additions"></span>\n </div>\n </form>\n']); + return o_ = function() { + return e2; + }, e2; + } + function s_() { + const e2 = function(e3, t2) { + t2 || (t2 = e3.slice(0)); + return Object.freeze(Object.defineProperties(e3, {raw: {value: Object.freeze(t2)}})); + }(["\n <converse-chat-toolbar\n .chatview=", "\n .model=", '\n ?composing_spoiler="', '"\n ?hidden_occupants="', '"\n ?is_groupchat="', '"\n ?show_call_button="', '"\n ?show_emoji_button="', '"\n ?show_occupants_toggle="', '"\n ?show_send_button="', '"\n ?show_spoiler_button="', '"\n ?show_toolbar="', '"\n message_limit="', '"\n ></converse-chat-toolbar>\n ']); + return s_ = function() { + return e2; + }, e2; + } + function a_() { + const e2 = d_(['\n <a href="#" class="dropdown-item ', '" @click=', ' title="', '"\n ><i class="fa ', '"></i>', "</a\n >\n "]); + return a_ = function() { + return e2; + }, e2; + } + function c_() { + const e2 = d_(['\n <a\n href="#"\n class="chatbox-btn ', " fa ", '"\n @click=', '\n title="', '"\n ></a>\n ']); + return c_ = function() { + return e2; + }, e2; + } + function l_() { + const e2 = d_(["\n <converse-chat-content .chatview=", " .messages=", " notifications=", ">\n </converse-chat-content>\n "]); + return l_ = function() { + return e2; + }, e2; + } + function u_() { + const e2 = d_(["\n <converse-chat-help\n .model=", "\n .messages=", "\n ?hidden=", '\n type="info"\n chat_type="', '"\n ></converse-chat-help>\n ']); + return u_ = function() { + return e2; + }, e2; + } + function d_(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + const h_ = rl.env.utils, {dayjs: f_} = rl.env; + var p_ = eh.extend({length: 200, className: "chatbox hidden", is_chatroom: false, events: {"click .chatbox-navback": "showControlBox", "click .new-msgs-indicator": "viewUnreadMessages", "click .send-button": "onFormSubmitted", "click .toggle-clear": "clearMessages", "input .chat-textarea": "inputChanged", "keydown .chat-textarea": "onKeyDown", "keyup .chat-textarea": "onKeyUp", "paste .chat-textarea": "onPaste"}, async initialize() { + this.initDebounced(), this.listenTo(this.model, "change:composing_spoiler", this.renderMessageForm), this.listenTo(this.model, "change:hidden", (e2) => e2.get("hidden") ? this.hide() : this.show()), this.listenTo(this.model, "change:status", this.onStatusMessageChanged), this.listenTo(this.model, "destroy", this.remove), this.listenTo(this.model, "show", this.show), this.listenTo(this.model, "vcard:change", this.renderHeading), this.model.contact && this.listenTo(this.model.contact, "destroy", this.renderHeading), this.model.rosterContactAdded && this.model.rosterContactAdded.then(() => { + this.listenTo(this.model.contact, "change:nickname", this.renderHeading), this.renderHeading(); + }), this.listenTo(this.model.presence, "change:show", this.onPresenceChanged), this.render(), this.listenTo(this.model.messages, "add", this.onMessageAdded), this.listenTo(this.model.messages, "remove", this.renderChatHistory), this.listenTo(this.model.messages, "rendered", this.maybeScrollDown), this.listenTo(this.model.messages, "reset", this.renderChatHistory), this.listenTo(this.model.notifications, "change", this.renderNotifications), this.listenTo(this.model, "change:show_help_messages", this.renderHelpMessages), await this.model.messages.fetched, this.insertIntoDOM(), this.model.maybeShow(), this.scrollDown(), Vc.trigger("chatBoxViewInitialized", this); + }, initDebounced() { + this.markScrolled = Rc(this._markScrolled, 100), this.debouncedScrollDown = Rc(this.scrollDown, 100), Vc.settings.get("debounced_content_rendering") ? (this.renderChatHistory = Rc(() => this.renderChatContent(false), 100), this.renderNotifications = Rc(() => this.renderChatContent(true), 100)) : (this.renderChatHistory = () => this.renderChatContent(false), this.renderNotifications = () => this.renderChatContent(true)); + }, render() { + const e2 = Qv(Object.assign(this.model.toJSON(), {markScrolled: (e3) => this.markScrolled(e3)})); + return Ya(e2, this.el), this.content = this.el.querySelector(".chat-content"), this.notifications = this.el.querySelector(".chat-content__notifications"), this.msgs_container = this.el.querySelector(".chat-content__messages"), this.help_container = this.el.querySelector(".chat-content__help"), this.renderChatContent(), this.renderMessageForm(), this.renderHeading(), this; + }, onMessageAdded(e2) { + this.renderChatHistory(), h_.isNewMessage(e2) && (e2.get("sender") === "me" ? this.model.set("scrolled", false) : this.model.get("scrolled", true) && this.showNewMessagesIndicator()); + }, getNotifications() { + return this.model.notifications.get("chat_state") === Uc.COMPOSING ? zd("%1$s is typing", this.model.getDisplayName()) : this.model.notifications.get("chat_state") === Uc.PAUSED ? zd("%1$s has stopped typing", this.model.getDisplayName()) : this.model.notifications.get("chat_state") === Uc.GONE ? zd("%1$s has gone away", this.model.getDisplayName()) : ""; + }, getHelpMessages: () => ["<strong>/clear</strong>: ".concat(zd("Remove messages")), "<strong>/close</strong>: ".concat(zd("Close this chat")), "<strong>/me</strong>: ".concat(zd("Write in the third person")), "<strong>/help</strong>: ".concat(zd("Show this menu"))], renderHelpMessages() { + Ya(Za(u_(), this.model, this.getHelpMessages(), !this.model.get("show_help_messages"), this.model.get("type")), this.help_container); + }, renderChatContent(e2 = false) { + this.tpl_chat_content || (this.tpl_chat_content = (e3) => Za(l_(), this, e3.messages, e3.notifications)); + const t2 = this.model.messages.models, n2 = e2 ? t2 : Array.from(t2); + Ya(this.tpl_chat_content({messages: n2, notifications: this.getNotifications()}), this.msgs_container); + }, renderToolbar() { + if (!Vc.settings.get("show_toolbar")) + return this; + const e2 = Object.assign({model: this.model, chatview: this}, this.model.toJSON(), this.getToolbarOptions()); + return Ya(((e3) => { + const t2 = Vc.settings.get("message_limit"), n2 = Vc.settings.get("visible_toolbar_buttons").call, r2 = Vc.settings.get("visible_toolbar_buttons").emoji, i2 = Vc.settings.get("show_send_button"), o2 = Vc.settings.get("visible_toolbar_buttons").spoiler, s2 = Vc.settings.get("show_toolbar"); + return Za(s_(), e3.chatview, e3.model, e3.composing_spoiler, e3.hidden_occupants, e3.is_groupchat, n2, r2, e3.show_occupants_toggle, i2, o2, s2, t2); + })(e2), this.el.querySelector(".chat-toolbar")), Vc.trigger("renderToolbar", this), this; + }, renderMessageForm() { + var e2, t2; + const n2 = this.el.querySelector(".message-form-container"); + var r2; + Ya((r2 = Object.assign(this.model.toJSON(), {hint_value: (e2 = this.el.querySelector(".spoiler-hint")) === null || e2 === void 0 ? void 0 : e2.value, label_message: this.model.get("composing_spoiler") ? zd("Hidden message") : zd("Message"), label_spoiler_hint: zd("Optional hint"), message_value: (t2 = this.el.querySelector(".chat-textarea")) === null || t2 === void 0 ? void 0 : t2.value, show_send_button: Vc.settings.get("show_send_button"), show_toolbar: Vc.settings.get("show_toolbar"), unread_msgs: zd("You have unread messages")}), Za(o_(), r2.unread_msgs, r2.label_spoiler_hint || "", r2.hint_value || "", r2.composing_spoiler ? "" : "hidden", r2.show_send_button ? "chat-textarea-send-button" : "", r2.composing_spoile ? "spoiler" : "", r2.label_message, r2.message_value || "")), n2), this.el.addEventListener("focusin", (e3) => this.emitFocused(e3)), this.el.addEventListener("focusout", (e3) => this.emitBlurred(e3)), this.renderToolbar(); + }, showControlBox() { + var e2; + (e2 = Uc.chatboxviews.get("controlbox")) === null || e2 === void 0 || e2.show(), this.hide(); + }, showUserDetailsModal(e2) { + e2.preventDefault(), Vc.modal.show(Jv, {model: this.model}, e2); + }, onDragOver(e2) { + e2.preventDefault(); + }, onDrop(e2) { + e2.dataTransfer.files.length != 0 && (e2.preventDefault(), this.model.sendFiles(e2.dataTransfer.files)); + }, async renderHeading() { + const e2 = await this.generateHeadingTemplate(); + Ya(e2, this.el.querySelector(".chat-head-chatbox")); + }, async getHeadingStandaloneButton(e2) { + const t2 = await e2; + return Za(c_(), t2.a_class, t2.icon_class, t2.handler, t2.i18n_title); + }, async getHeadingDropdownItem(e2) { + const t2 = await e2; + return Za(a_(), t2.a_class, t2.handler, t2.i18n_title, t2.icon_class, t2.i18n_text); + }, async generateHeadingTemplate() { + var e2; + const t2 = (e2 = this.model) === null || e2 === void 0 ? void 0 : e2.vcard, n2 = t2 ? t2.toJSON() : {}, r2 = zd("The User's Profile Image"), i2 = Object.assign({alt_text: r2, extra_classes: "", height: 40, width: 40}, n2), o2 = await this.getHeadingButtons(), s2 = o2.filter((e3) => e3.standalone), a2 = o2.filter((e3) => !e3.standalone); + return ((e3) => { + const t3 = Za(r_(), op(e3.avatar_data)); + return Za(n_(), e3.status ? "" : "chatbox-title--no-desc", Uc.api.settings.get("singleton") ? "" : Za(t_()), e3.type !== Uc.HEADLINES_TYPE ? Za(e_(), e3.showUserDetailsModal, t3) : "", e3.jid, e3.type !== Uc.HEADLINES_TYPE ? Za(Zv(), e3.showUserDetailsModal, e3.display_name) : e3.display_name, e3.dropdown_btns.length ? Za(Kv(), e3.dropdown_btns) : "", e3.standalone_btns.length ? ((e4) => e4.standalone_btns.reverse().map((e5) => Qh(e5, "")))(e3) : "", e3.status ? Za(Yv(), e3.status) : ""); + })(Object.assign(this.model.toJSON(), {avatar_data: i2, display_name: this.model.getDisplayName(), dropdown_btns: a2.map((e3) => this.getHeadingDropdownItem(e3)), showUserDetailsModal: (e3) => this.showUserDetailsModal(e3), standalone_btns: s2.map((e3) => this.getHeadingStandaloneButton(e3))})); + }, getHeadingButtons() { + const e2 = [{a_class: "show-user-details-modal", handler: (e3) => this.showUserDetailsModal(e3), i18n_text: zd("Details"), i18n_title: zd("See more information about this person"), icon_class: "fa-id-card", name: "details", standalone: Vc.settings.get("view_mode") === "overlayed"}]; + return Vc.settings.get("singleton") || e2.push({a_class: "close-chatbox-button", handler: (e3) => this.close(e3), i18n_text: zd("Close"), i18n_title: zd("Close and end this conversation"), icon_class: "fa-times", name: "close", standalone: Vc.settings.get("view_mode") === "overlayed"}), Uc.api.hook("getHeadingButtons", this, e2); + }, getToolbarOptions: () => ({}), maybeScrollDown(e2) { + !(!(e2 == null ? void 0 : e2.get("is_archived")) && (e2 == null ? void 0 : e2.get("sender")) === "me") && this.model.get("scrolled") || this.model.isHidden() || this.debouncedScrollDown(); + }, scrollDown(e2) { + var t2, n2; + if (e2 == null || (t2 = e2.preventDefault) === null || t2 === void 0 || t2.call(e2), e2 == null || (n2 = e2.stopPropagation) === null || n2 === void 0 || n2.call(e2), this.model.get("scrolled") && h_.safeSave(this.model, {scrolled: false, scrollTop: null}), this.msgs_container.scrollTo) { + const e3 = this.msgs_container.scrollTop ? "smooth" : "auto"; + this.msgs_container.scrollTo({top: this.msgs_container.scrollHeight, behavior: e3}); + } else + this.msgs_container.scrollTop = this.msgs_container.scrollHeight; + this.onScrolledDown(); + }, maintainScrollTop() { + const e2 = this.model.get("scrollTop"); + e2 ? this.msgs_container.scrollTop = e2 : this.scrollDown(); + }, insertIntoDOM() { + return Uc.chatboxviews.insertRowColumn(this.el), Vc.trigger("chatBoxInsertedIntoDOM", this), this; + }, addSpinner(e2 = false) { + if (this.el.querySelector(".spinner") === null) { + const t2 = h_.getElementFromTemplateResult(fp()); + e2 ? (this.content.insertAdjacentElement("beforeend", t2), this.scrollDown()) : this.content.insertAdjacentElement("afterbegin", t2); + } + }, clearSpinner() { + this.content.querySelectorAll(".spinner").forEach(h_.removeElement); + }, onStatusMessageChanged(e2) { + this.renderHeading(), Vc.trigger("contactStatusMessageChanged", {contact: e2.attributes, message: e2.get("status")}); + }, markFollowups(e2) { + const t2 = e2.getAttribute("data-from"), n2 = e2.previousElementSibling, r2 = f_(e2.getAttribute("data-isodate")), i2 = e2.nextElementSibling; + h_.hasClass("chat-msg--action", e2) || h_.hasClass("chat-msg--action", n2) || h_.hasClass("chat-info", e2) || h_.hasClass("chat-info", n2) || n2.getAttribute("data-from") !== t2 || !r2.isBefore(f_(n2.getAttribute("data-isodate")).add(10, "minutes")) || e2.getAttribute("data-encrypted") !== n2.getAttribute("data-encrypted") || h_.addClass("chat-msg--followup", e2), i2 && (!h_.hasClass("chat-msg--action", e2) && h_.hasClass("chat-info", e2) && i2.getAttribute("data-from") === t2 && f_(i2.getAttribute("data-isodate")).isBefore(r2.add(10, "minutes")) && e2.getAttribute("data-encrypted") === i2.getAttribute("data-encrypted") ? h_.addClass("chat-msg--followup", i2) : h_.removeClass("chat-msg--followup", i2)); + }, parseMessageForCommands(e2) { + const t2 = e2.replace(/^\s*/, "").match(/^\/(.*)\s*$/); + if (t2) { + if (t2[1] === "clear") + return this.clearMessages(), true; + if (t2[1] === "close") + return this.close(), true; + if (t2[1] === "help") + return this.model.set({show_help_messages: true}), true; + } + }, async onFormSubmitted(e2) { + var t2; + e2.preventDefault(); + const n2 = this.el.querySelector(".chat-textarea"), r2 = n2.value.trim(); + if (Vc.settings.get("message_limit") && r2.length > Vc.settings.get("message_limit") || !r2.replace(/\s/g, "").length) + return; + if (!Uc.connection.authenticated) { + const e3 = zd("Sorry, the connection has been lost, and your message could not be sent"); + return Vc.alert("error", zd("Error"), e3), void Vc.connection.reconnect(); + } + let i2, o2 = {}; + this.model.get("composing_spoiler") && (o2 = this.el.querySelector("form.sendXMPPMessage input.spoiler-hint"), i2 = o2.value), h_.addClass("disabled", n2), n2.setAttribute("disabled", "disabled"), (t2 = this.el.querySelector("converse-emoji-dropdown")) === null || t2 === void 0 || t2.hideMenu(); + const s2 = this.parseMessageForCommands(r2), a2 = s2 ? null : await this.model.sendMessage(r2, i2); + (s2 || a2) && (o2.value = "", n2.value = "", h_.removeClass("correcting", n2), n2.style.height = "auto", this.updateCharCounter(n2.value)), a2 && Vc.trigger("messageSend", a2), Vc.settings.get("view_mode") === "overlayed" && (this.msgs_container.parentElement.style.display = "none"), n2.removeAttribute("disabled"), h_.removeClass("disabled", n2), Vc.settings.get("view_mode") === "overlayed" && (this.msgs_container.parentElement.style.display = ""), this.model.setChatState(Uc.ACTIVE, {silent: true}), n2.focus(); + }, updateCharCounter(e2) { + if (Vc.settings.get("message_limit")) { + const t2 = this.el.querySelector(".message-limit"), n2 = Vc.settings.get("message_limit") - e2.length; + t2.textContent = n2, n2 < 1 ? h_.addClass("error", t2) : h_.removeClass("error", t2); + } + }, onPaste(e2) { + if (e2.clipboardData.files.length !== 0) + return e2.preventDefault(), void this.model.sendFiles(Array.from(e2.clipboardData.files)); + this.updateCharCounter(e2.clipboardData.getData("text/plain")); + }, autocompleteInPicker(e2, t2) { + const n2 = this.el.querySelector("converse-emoji-dropdown"), r2 = this.el.querySelector("converse-emoji-picker"); + if (r2 && n2) + return r2.model.set({ac_position: e2.selectionStart, autocompleting: t2, query: t2}), n2.showMenu(), true; + }, onEmojiReceivedFromPicker(e2) { + const t2 = this.el.querySelector("converse-emoji-picker").model, n2 = t2.get("autocompleting"), r2 = t2.get("ac_position"); + this.insertIntoTextArea(e2, n2, false, r2); + }, onKeyUp(e2) { + this.updateCharCounter(e2.target.value); + }, onKeyDown(e2) { + if (!e2.ctrlKey) { + if (!e2.shiftKey && !e2.altKey && !e2.metaKey) + if (e2.keyCode === rl.keycodes.TAB) { + const t2 = h_.getCurrentWord(e2.target, null, /(:.*?:)/g); + t2.startsWith(":") && this.autocompleteInPicker(e2.target, t2) && (e2.preventDefault(), e2.stopPropagation()); + } else { + if (e2.keyCode === rl.keycodes.FORWARD_SLASH) + return; + if (e2.keyCode === rl.keycodes.ESCAPE) + return this.onEscapePressed(e2); + if (e2.keyCode === rl.keycodes.ENTER) + return this.onEnterPressed(e2); + if (e2.keyCode !== rl.keycodes.UP_ARROW || e2.target.selectionEnd) { + if (e2.keyCode === rl.keycodes.DOWN_ARROW && e2.target.selectionEnd === e2.target.value.length && h_.hasClass("correcting", this.el.querySelector(".chat-textarea"))) + return this.editLaterMessage(); + } else { + const e3 = this.el.querySelector(".chat-textarea"); + if (!e3.value || h_.hasClass("correcting", e3)) + return this.editEarlierMessage(); + } + } + [rl.keycodes.SHIFT, rl.keycodes.META, rl.keycodes.META_RIGHT, rl.keycodes.ESCAPE, rl.keycodes.ALT].includes(e2.keyCode) || this.model.get("chat_state") !== Uc.COMPOSING && this.model.setChatState(Uc.COMPOSING); + } + }, getOwnMessages() { + return this.model.messages.filter({sender: "me"}); + }, onEnterPressed(e2) { + return this.onFormSubmitted(e2); + }, onEscapePressed(e2) { + e2.preventDefault(); + const t2 = this.model.messages.findLastIndex("correcting"), n2 = t2 >= 0 ? this.model.messages.at(t2) : null; + n2 && n2.save("correcting", false), this.insertIntoTextArea("", true, false); + }, async onMessageRetractButtonClicked(e2) { + if (e2.get("sender") !== "me") + return zn.error("onMessageRetractButtonClicked called for someone else's message!"); + const t2 = zd("Be aware that other XMPP/Jabber clients (and servers) may not yet support retractions and that this message may not be removed everywhere."), n2 = [zd("Are you sure you want to retract this message?")]; + Vc.settings.get("show_retraction_warning") && (n2[1] = t2), await Vc.confirm(zd("Confirm"), n2) && this.model.retractOwnMessage(e2); + }, onMessageEditButtonClicked(e2) { + var t2; + const n2 = this.model.messages.findWhere("correcting"), r2 = (t2 = this.el.querySelector(".chat-textarea")) === null || t2 === void 0 ? void 0 : t2.value; + (!r2 || n2 && n2.get("message") === r2 || confirm(zd("You have an unsent message which will be lost if you continue. Are you sure?"))) && (n2 !== e2 ? (n2 == null || n2.save("correcting", false), e2.save("correcting", true), this.insertIntoTextArea(h_.prefixMentions(e2), true, true)) : (e2.save("correcting", false), this.insertIntoTextArea("", true, false))); + }, editLaterMessage() { + let e2, t2 = this.model.messages.findLastIndex("correcting"); + if (t2 >= 0) + for (this.model.messages.at(t2).save("correcting", false); t2 < this.model.messages.length - 1; ) { + t2 += 1; + const n2 = this.model.messages.at(t2); + if (n2.get("editable")) { + e2 = n2; + break; + } + } + e2 ? (this.insertIntoTextArea(h_.prefixMentions(e2), true, true), e2.save("correcting", true)) : this.insertIntoTextArea("", true, false); + }, editEarlierMessage() { + let e2, t2 = this.model.messages.findLastIndex("correcting"); + if (t2 >= 0) + for (this.model.messages.at(t2).save("correcting", false); t2 > 0; ) { + t2 -= 1; + const n2 = this.model.messages.at(t2); + if (n2.get("editable")) { + e2 = n2; + break; + } + } + e2 = e2 || this.getOwnMessages().reverse().find((e3) => e3.get("editable")), e2 && (this.insertIntoTextArea(h_.prefixMentions(e2), true, true), e2.save("correcting", true)); + }, inputChanged(e2) { + const t2 = e2.target.scrollHeight + "px"; + e2.target.style.height != t2 && (e2.target.style.height = "auto", e2.target.style.height = t2); + }, async clearMessages(e2) { + return e2 && e2.preventDefault && e2.preventDefault(), confirm(zd("Are you sure you want to clear the messages from this conversation?")) === true && await this.model.clearMessages(), this; + }, insertIntoTextArea(e2, t2 = false, n2 = false, r2) { + const i2 = this.el.querySelector(".chat-textarea"); + if (n2 ? h_.addClass("correcting", i2) : h_.removeClass("correcting", i2), t2) + i2.value = r2 && typeof t2 == "string" ? i2.value.replace(new RegExp(t2, "g"), (n3, i3) => i3 == r2 - t2.length ? e2 + " " : n3) : e2; + else { + let t3 = i2.value; + t3 && t3[t3.length - 1] !== " " && (t3 += " "), i2.value = t3 + e2 + " "; + } + this.updateCharCounter(i2.value), h_.placeCaretAtEnd(i2); + }, onPresenceChanged(e2) { + const t2 = e2.get("show"), n2 = this.model.getDisplayName(); + let r2; + h_.isVisible(this.el) && (t2 === "offline" ? r2 = zd("%1$s has gone offline", n2) : t2 === "away" ? r2 = zd("%1$s has gone away", n2) : t2 === "dnd" ? r2 = zd("%1$s is busy", n2) : t2 === "online" && (r2 = zd("%1$s is online", n2)), r2 && this.model.createMessage({message: r2, type: "info"})); + }, async close(e2) { + return e2 && e2.preventDefault && e2.preventDefault(), Uc.router.history.getFragment() === "converse/chat?jid=" + this.model.get("jid") && Uc.router.navigate(""), Vc.connection.connected() && (this.model.setChatState(Uc.INACTIVE), this.model.sendChatState()), await this.model.close(), this.remove(), Vc.trigger("chatBoxClosed", this), this; + }, emitBlurred(e2) { + this.el.contains(document.activeElement) || this.el.contains(e2.relatedTarget) || Vc.trigger("chatBoxBlurred", this, e2); + }, emitFocused(e2) { + this.el.contains(e2.relatedTarget) || Vc.trigger("chatBoxFocused", this, e2); + }, focus() { + const e2 = this.el.getElementsByClassName("chat-textarea")[0]; + return e2 && document.activeElement !== e2 && e2.focus(), this; + }, maybeFocus() { + Vc.settings.get("auto_focus") && this.focus(); + }, hide() { + return this.el.classList.add("hidden"), this; + }, afterShown() { + this.model.clearUnreadMsgCounter(), this.model.setChatState(Uc.ACTIVE), this.scrollDown(), this.maybeFocus(); + }, show() { + this.model.get("hidden") ? zn.debug("Not showing chat ".concat(this.model.get("jid"), " because it's set as hidden")) : h_.isVisible(this.el) ? this.maybeFocus() : Vc.settings.get("animate") ? h_.fadeIn(this.el, () => this.afterShown()) : (h_.showElement(this.el), this.afterShown()); + }, showNewMessagesIndicator() { + h_.showElement(this.el.querySelector(".new-msgs-indicator")); + }, hideNewMessagesIndicator() { + const e2 = this.el.querySelector(".new-msgs-indicator"); + e2 !== null && e2.classList.add("hidden"); + }, _markScrolled: function(e2) { + let t2 = true, n2 = null; + this.msgs_container.scrollTop + this.msgs_container.clientHeight >= this.msgs_container.scrollHeight - 62 ? (t2 = false, this.onScrolledDown()) : this.msgs_container.scrollTop === 0 ? Vc.trigger("chatBoxScrolledUp", this) : n2 = e2.target.scrollTop, h_.safeSave(this.model, {scrolled: t2, scrollTop: n2}); + }, viewUnreadMessages() { + this.model.save({scrolled: false, scrollTop: null}), this.scrollDown(); + }, onScrolledDown() { + if (this.hideNewMessagesIndicator(), !this.model.isHidden()) { + this.model.clearUnreadMsgCounter(); + const e2 = window.location.hash; + e2 && this.model.messages.get(e2.slice(1)) && Uc.router.history.navigate(); + } + Vc.trigger("chatBoxScrolledDown", {chatbox: this.model}); + }, onWindowStateChanged(e2) { + e2 === "visible" ? this.model.isHidden() || this.model.get("num_unread", 0) && this.model.clearUnreadMsgCounter() : e2 === "hidden" && (this.model.setChatState(Uc.INACTIVE, {silent: true}), this.model.sendChatState()); + }}), g_ = {chatviews: {get: (e2) => e2 === void 0 ? Object.values(Uc.chatboxviews.getAll()) : typeof e2 == "string" ? Uc.chatboxviews.get(e2) : e2.map((e3) => Uc.chatboxviews.get(e3))}}; + /** + * @module converse-chatview + * @copyright 2020, the Converse.js contributors + * @license Mozilla Public License (MPLv2) + */ + const {Strophe: m_} = rl.env; + function v_(e2) { + Uc.chatboxviews && Uc.chatboxviews.forEach((t2) => { + t2.model.get("id") !== "controlbox" && t2.onWindowStateChanged(e2.state); + }); + } + function __() { + const e2 = Uc.chatboxviews; + Uc.chatboxes.on("add", async (t2) => { + e2.get(t2.get("id")) || t2.get("type") !== Uc.PRIVATE_CHAT_TYPE || (await t2.initialized, e2.add(t2.get("id"), new Uc.ChatBoxView({model: t2}))); + }); + } + let b_; + rl.plugins.add("converse-chatview", {dependencies: ["converse-chatboxviews", "converse-chat", "converse-disco", "converse-modal"], initialize() { + Vc.settings.extend({auto_focus: true, debounced_content_rendering: true, filter_url_query_params: null, image_urls_regex: null, message_limit: 0, muc_hats: ["xep317"], show_images_inline: true, show_message_avatar: true, show_retraction_warning: true, show_send_button: true, show_toolbar: true, time_format: "HH:mm", use_system_emojis: true, visible_toolbar_buttons: {call: false, clear: true, emoji: true, spoiler: true}}), Object.assign(Vc, g_), Uc.ChatBoxView = p_, Vc.listen.on("chatBoxViewsInitialized", __), Vc.listen.on("windowStateChanged", v_), Vc.listen.on("connected", () => Vc.disco.own.features.add(m_.NS.SPOILER)); + }}); + let y_ = 0; + function w_(e2) { + b_ = e2; + } + function S_() { + b_ = null, y_ = 0; + } + const x_ = Symbol("haunted.phase"), E_ = Symbol("haunted.hook"), A_ = Symbol("haunted.update"), C_ = Symbol("haunted.commit"), j_ = Symbol("haunted.effects"), T_ = Symbol("haunted.layoutEffects"); + class O_ { + constructor(e2, t2) { + this.update = e2, this.host = t2, this[E_] = new Map(), this[j_] = [], this[T_] = []; + } + run(e2) { + w_(this); + let t2 = e2(); + return S_(), t2; + } + _runEffects(e2) { + let t2 = this[e2]; + w_(this); + for (let e3 of t2) + e3.call(this); + S_(); + } + runEffects() { + this._runEffects(j_); + } + runLayoutEffects() { + this._runEffects(T_); + } + teardown() { + this[E_].forEach((e2) => { + typeof e2.teardown == "function" && e2.teardown(); + }); + } + } + const k_ = Promise.resolve().then.bind(Promise.resolve()); + function N_() { + let e2, t2 = []; + function n2() { + e2 = null; + let n3 = t2; + t2 = []; + for (var r2 = 0, i2 = n3.length; r2 < i2; r2++) + n3[r2](); + } + return function(r2) { + t2.push(r2), e2 == null && (e2 = k_(n2)); + }; + } + const I_ = N_(), M_ = N_(); + class R_ { + constructor(e2, t2) { + this.renderer = e2, this.host = t2, this.state = new O_(this.update.bind(this), t2), this[x_] = null, this._updateQueued = false; + } + update() { + this._updateQueued || (I_(() => { + let e2 = this.handlePhase(A_); + M_(() => { + this.handlePhase(C_, e2), M_(() => { + this.handlePhase(j_); + }); + }), this._updateQueued = false; + }), this._updateQueued = true); + } + handlePhase(e2, t2) { + switch (this[x_] = e2, e2) { + case C_: + return this.commit(t2), void this.runEffects(T_); + case A_: + return this.render(); + case j_: + return this.runEffects(j_); + } + this[x_] = null; + } + render() { + return this.state.run(() => this.renderer.call(this.host, this.host)); + } + runEffects(e2) { + this.state._runEffects(e2); + } + teardown() { + this.state.teardown(); + } + } + function D_(e2) { + class t2 extends R_ { + constructor(e3, t4, n2) { + super(e3, n2 || t4), this.frag = t4; + } + commit(t4) { + e2(t4, this.frag); + } + } + return function(e3, n2, r2) { + const i2 = (r2 || n2 || {}).baseElement || HTMLElement, {observedAttributes: o2 = [], useShadowDOM: s2 = true, shadowRootInit: a2 = {}} = r2 || n2 || {}; + class c2 extends i2 { + constructor() { + super(), s2 === false ? this._scheduler = new t2(e3, this) : (this.attachShadow({mode: "open", ...a2}), this._scheduler = new t2(e3, this.shadowRoot, this)); + } + static get observedAttributes() { + return e3.observedAttributes || o2 || []; + } + connectedCallback() { + this._scheduler.update(); + } + disconnectedCallback() { + this._scheduler.teardown(); + } + attributeChangedCallback(e4, t3, n3) { + if (t3 === n3) + return; + let r3 = n3 === "" || n3; + Reflect.set(this, ((e5 = "") => e5.replace(/-+([a-z])?/g, (e6, t4) => t4 ? t4.toUpperCase() : ""))(e4), r3); + } + } + const l2 = new Proxy(i2.prototype, {getPrototypeOf: (e4) => e4, set(e4, t3, n3, r3) { + let i3; + if (t3 in e4) { + if (i3 = Object.getOwnPropertyDescriptor(e4, t3), i3 && i3.set) + return i3.set.call(r3, n3), true; + Reflect.set(e4, t3, n3); + } + return i3 = typeof t3 == "symbol" || t3[0] === "_" ? {enumerable: true, configurable: true, writable: true, value: n3} : function(e5) { + let t4 = e5; + return Object.freeze({enumerable: true, configurable: true, get: () => t4, set(e6) { + t4 = e6, this._scheduler.update(); + }}); + }(n3), Object.defineProperty(r3, t3, i3), i3.set && i3.set.call(r3, n3), true; + }}); + return Object.setPrototypeOf(c2.prototype, l2), c2; + }; + } + class P_ { + constructor(e2, t2) { + this.id = e2, this.state = t2; + } + } + function L_(e2, ...t2) { + let n2 = y_++, r2 = b_[E_], i2 = r2.get(n2); + return i2 || (i2 = new e2(n2, b_, ...t2), r2.set(n2, i2)), i2.update(...t2); + } + function z_(e2) { + return L_.bind(null, e2); + } + function F_(e2) { + return z_(class extends P_ { + constructor(t2, n2, r2, i2) { + super(t2, n2), e2(n2, this); + } + update(e3, t2) { + this.callback = e3, this.lastValues = this.values, this.values = t2; + } + call() { + this.values && !this.hasChanged() || this.run(); + } + run() { + this.teardown(), this._teardown = this.callback.call(this.state); + } + teardown() { + typeof this._teardown == "function" && this._teardown(); + } + hasChanged() { + return !this.lastValues || this.values.some((e3, t2) => this.lastValues[t2] !== e3); + } + }); + } + function B_(e2, t2) { + e2[j_].push(t2); + } + F_(B_); + const q_ = z_(class extends P_ { + constructor(e2, t2, n2) { + super(e2, t2), this._updater = this._updater.bind(this), this._ranEffect = false, this._unsubscribe = null, B_(t2, this); + } + update(e2) { + if (this.state.virtual) + throw new Error("can't be used with virtual components"); + return this.Context !== e2 && (this._subscribe(e2), this.Context = e2), this.value; + } + call() { + this._ranEffect || (this._ranEffect = true, this._unsubscribe && this._unsubscribe(), this._subscribe(this.Context), this.state.update()); + } + _updater(e2) { + this.value = e2, this.state.update(); + } + _subscribe(e2) { + const t2 = {Context: e2, callback: this._updater}; + this.state.host.dispatchEvent(new CustomEvent("haunted.context", {detail: t2, bubbles: true, cancelable: true, composed: true})); + const {unsubscribe: n2, value: r2} = t2; + this.value = n2 ? r2 : e2.defaultValue, this._unsubscribe = n2; + } + teardown() { + this._unsubscribe && this._unsubscribe(); + } + }); + z_(class extends P_ { + constructor(e2, t2, n2, r2) { + super(e2, t2), this.value = n2(), this.values = r2; + } + update(e2, t2) { + return this.hasChanged(t2) && (this.values = t2, this.value = e2()), this.value; + } + hasChanged(e2 = []) { + return e2.some((e3, t2) => this.values[t2] !== e3); + } + }); + F_(function(e2, t2) { + e2[T_].push(t2); + }), z_(class extends P_ { + constructor(e2, t2, n2) { + super(e2, t2), this.updater = this.updater.bind(this), typeof n2 == "function" && (n2 = n2()), this.makeArgs(n2); + } + update() { + return this.args; + } + updater(e2) { + if (typeof e2 == "function") { + const t2 = e2, [n2] = this.args; + e2 = t2(n2); + } + this.makeArgs(e2), this.state.update(); + } + makeArgs(e2) { + this.args = Object.freeze([e2, this.updater]); + } + }), z_(class extends P_ { + constructor(e2, t2, n2, r2, i2) { + super(e2, t2), this.dispatch = this.dispatch.bind(this), this.currentState = i2 !== void 0 ? i2(r2) : r2; + } + update(e2) { + return this.reducer = e2, [this.currentState, this.dispatch]; + } + dispatch(e2) { + this.currentState = this.reducer(this.currentState, e2), this.state.update(); + } + }); + const {component: U_, createContext: $_} = function({render: e2}) { + const t2 = D_(e2), n2 = function(e3) { + return (t3) => { + const n3 = {Provider: class extends HTMLElement { + constructor() { + super(), this.listeners = new Set(), this.addEventListener("haunted.context", this); + } + disconnectedCallback() { + this.removeEventListener("haunted.context", this); + } + handleEvent(e4) { + const {detail: t4} = e4; + t4.Context === n3 && (t4.value = this.value, t4.unsubscribe = this.unsubscribe.bind(this, t4.callback), this.listeners.add(t4.callback), e4.stopPropagation()); + } + unsubscribe(e4) { + this.listeners.delete(e4); + } + set value(e4) { + this._value = e4; + for (let t4 of this.listeners) + t4(e4); + } + get value() { + return this._value; + } + }, Consumer: e3(function({render: e4}) { + return e4(q_(n3)); + }), defaultValue: t3}; + return n3; + }; + }(t2); + return {component: t2, createContext: n2}; + }({render: Ya}); + function W_() { + const e2 = J_(['\n <p class="brand-subtitle">', '</p>\n <p class="brand-subtitle"><a target="_blank" rel="nofollow" href="https://conversejs.org">Open Source</a> XMPP chat client brought to you by <a target="_blank" rel="nofollow" href="https://opkode.com">Opkode</a> </p>\n <p class="brand-subtitle"><a target="_blank" rel="nofollow" href="https://hosted.weblate.org/projects/conversejs/#languages">Translate</a> it into your own language</p>']); + return W_ = function() { + return e2; + }, e2; + } + function G_() { + const e2 = J_(['<p class="byline">messaging freedom</p>']); + return G_ = function() { + return e2; + }, e2; + } + function V_() { + const e2 = J_(['\n <a class="brand-heading" href="https://conversejs.org" target="_blank" rel="noopener">\n <span class="brand-name-wrapper ', '">\n <svg class="converse-svg-logo"\n xmlns:svg="http://www.w3.org/2000/svg"\n xmlns="http://www.w3.org/2000/svg"\n xmlns:xlink="http://www.w3.org/1999/xlink"\n viewBox="0 0 364 364">\n <title>Converse</title>\n <g class="cls-1" id="g904">\n <g data-name="Layer 2">\n <g data-name="Layer 7">\n <path\n class="cls-3"\n d="M221.46,103.71c0,18.83-29.36,18.83-29.12,0C192.1,84.88,221.46,84.88,221.46,103.71Z" />\n <path\n class="cls-4"\n d="M179.9,4.15A175.48,175.48,0,1,0,355.38,179.63,175.48,175.48,0,0,0,179.9,4.15Zm-40.79,264.5c-.23-17.82,27.58-17.82,27.58,0S138.88,286.48,139.11,268.65ZM218.6,168.24A79.65,79.65,0,0,1,205.15,174a12.76,12.76,0,0,0-6.29,4.65L167.54,222a1.36,1.36,0,0,1-2.46-.8v-35.8a2.58,2.58,0,0,0-3.06-2.53c-15.43,3-30.23,7.7-42.73,19.94-38.8,38-29.42,105.69,16.09,133.16a162.25,162.25,0,0,1-91.47-67.27C-3.86,182.26,34.5,47.25,138.37,25.66c46.89-9.75,118.25,5.16,123.73,62.83C265.15,120.64,246.56,152.89,218.6,168.24Z" />\n </g>\n </g>\n </g>\n </svg>\n <span class="brand-name">\n <span class="brand-name__text">converse<span class="subdued">.js</span></span>\n ', "\n </span>\n </span>\n </a>\n ", "\n "]); + return V_ = function() { + return e2; + }, e2; + } + function J_(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + Vc.elements.define("converse-brand-heading", U_((e2) => { + const t2 = Vc.settings.get("view_mode") === "fullscreen"; + return Za(V_(), t2 ? "brand-name-wrapper--fullscreen" : "", t2 ? Za(G_()) : "", t2 ? Za(W_(), e2.version_name) : ""); + }, {useShadowDOM: false})); + const {dayjs: X_} = rl.env; + var Q_ = {defaults() { + return {bookmarked: false, box_id: "controlbox", chat_state: void 0, closed: !Vc.settings.get("show_controlbox_by_default"), num_unread: 0, time_opened: this.get("time_opened") || new Date().getTime(), type: Uc.CONTROLBOX_TYPE, url: ""}; + }, initialize() { + this.get("id") === "controlbox" ? this.set({time_opened: X_(0).valueOf()}) : Uc.ChatBox.prototype.initialize.apply(this, arguments); + }, validate(e2) { + return e2.type === Uc.CONTROLBOX_TYPE ? Vc.settings.get("view_mode") === "embedded" && Vc.settings.get("singleton") ? "Controlbox not relevant in embedded view mode" : void 0 : Uc.ChatBox.prototype.validate.call(this, e2); + }, maybeShow(e2) { + return e2 || this.get("id") !== "controlbox" ? Uc.ChatBox.prototype.maybeShow.call(this, e2) : this; + }, onReconnection: function() { + }}; + var Y_ = eh.extend({tagName: "div", className: "controlbox-pane", initialize() { + Vc.trigger("controlBoxPaneInitialized", this); + }}), K_ = n(177), Z_ = n.n(K_); + function eb() { + const e2 = new Uc.ControlBox({id: "controlbox"}); + return Uc.chatboxes.add(e2); + } + const tb = rl.env.utils; + var nb = eh.extend({tagName: "a", className: "toggle-controlbox hidden", id: "toggle-controlbox", events: {click: "onClick"}, attributes: {href: "#"}, initialize() { + Uc.chatboxviews.insertRowColumn(this.render().el), Vc.waitUntil("initialized").then(this.render.bind(this)).catch((e2) => zn.fatal(e2)); + }, render() { + return this.el.innerHTML = Z_()({label_toggle: Vc.connection.connected() ? zd("Chat Contacts") : zd("Toggle chat")}), this; + }, hide(e2) { + tb.isVisible(this.el) && (tb.hideElement(this.el), e2()); + }, show(e2) { + tb.isVisible(this.el) || tb.fadeIn(this.el, e2); + }, showControlBox() { + let e2 = Uc.chatboxes.get("controlbox"); + e2 || (e2 = eb()), Vc.connection.connected() ? e2.save({closed: false}) : e2.trigger("show"); + }, onClick(e2) { + if (e2.preventDefault(), tb.isVisible(Uc.root.querySelector("#controlbox"))) { + const e3 = Uc.chatboxes.get("controlbox"); + Vc.connection.connected ? e3.save({closed: true}) : e3.trigger("hide"); + } else + this.showControlBox(); + }}); + function rb() { + const e2 = ob(['<a class="chatbox-btn close-chatbox-button fa fa-times"></a>']); + return rb = function() { + return e2; + }, e2; + } + function ib() { + const e2 = ob(['\n <div class="flyout box-flyout">\n <div class="chat-head controlbox-head">\n ', '\n </div>\n <div class="controlbox-panes"></div>\n </div>']); + return ib = function() { + return e2; + }, e2; + } + function ob(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + const sb = rl.env.utils; + var ab = {tagName: "div", className: "chatbox", id: "controlbox", events: {"click a.close-chatbox-button": "close"}, initialize() { + Uc.controlboxtoggle === void 0 && (Uc.controlboxtoggle = new Uc.ControlBoxToggle()), Uc.controlboxtoggle.el.insertAdjacentElement("afterend", this.el), this.listenTo(this.model, "change:connected", this.onConnected), this.listenTo(this.model, "destroy", this.hide), this.listenTo(this.model, "hide", this.hide), this.listenTo(this.model, "show", this.show), this.listenTo(this.model, "change:closed", this.ensureClosedState), this.render(), Vc.trigger("controlBoxInitialized", this); + }, render() { + this.model.get("connected") && this.model.get("closed") === void 0 && this.model.set("closed", !Vc.settings.get("show_controlbox_by_default")); + const e2 = (t2 = {sticky_controlbox: Vc.settings.get("sticky_controlbox"), ...this.model.toJSON()}, Za(ib(), t2.sticky_controlbox ? "" : Za(rb()))); + var t2; + Ya(e2, this.el), this.model.get("closed") ? this.hide() : this.show(); + const n2 = (Uc == null ? void 0 : Uc.connection) || {}; + return n2.connected && n2.authenticated && !n2.disconnecting ? this.model.get("connected") && this.renderControlBoxPane() : this.renderLoginPanel(), this; + }, onConnected() { + this.model.get("connected") && this.render(); + }, renderLoginPanel() { + if (this.el.classList.add("logged-out"), this.loginpanel) + this.loginpanel.render(); + else { + this.loginpanel = new Uc.LoginPanel({model: new Uc.LoginPanelModel()}); + const e2 = this.el.querySelector(".controlbox-panes"); + e2.innerHTML = "", e2.appendChild(this.loginpanel.render().el); + } + return this.loginpanel.initPopovers(), this; + }, renderControlBoxPane() { + this.loginpanel && (this.loginpanel.remove(), delete this.loginpanel), this.controlbox_pane && sb.isVisible(this.controlbox_pane.el) || (this.el.classList.remove("logged-out"), this.controlbox_pane = new Uc.ControlBoxPane(), this.el.querySelector(".controlbox-panes").insertAdjacentElement("afterBegin", this.controlbox_pane.el)); + }, async close(e2) { + if (e2 && e2.preventDefault && e2.preventDefault(), (e2 == null ? void 0 : e2.name) === "closeAllChatBoxes" && (Uc.disconnection_cause !== Uc.LOGOUT || Vc.settings.get("show_controlbox_by_default"))) + return; + if (Vc.settings.get("sticky_controlbox")) + return; + const t2 = (Uc == null ? void 0 : Uc.connection) || {}; + return t2.connected && !t2.disconnecting ? await new Promise((e3, t3) => this.model.save({closed: true}, {success: e3, error: t3, wait: true})) : this.model.trigger("hide"), Vc.trigger("controlBoxClosed", this), this; + }, ensureClosedState() { + this.model.get("closed") ? this.hide() : this.show(); + }, hide(e2) { + if (!Vc.settings.get("sticky_controlbox")) + return sb.addClass("hidden", this.el), Vc.trigger("chatBoxClosed", this), Vc.connection.connected() || Uc.controlboxtoggle.render(), Uc.controlboxtoggle.show(e2), this; + }, onControlBoxToggleHidden() { + this.model.set("closed", false), this.el.classList.remove("hidden"), Vc.trigger("controlBoxOpened", this); + }, show() { + return Uc.controlboxtoggle.hide(() => this.onControlBoxToggleHidden()), this; + }, showHelpMessages() { + }}; + function cb() { + const e2 = mb(['\n <converse-brand-heading></converse-brand-heading>\n <form id="converse-login" class="converse-form" method="post">\n <div class="conn-feedback fade-in ', '">\n <p class="feedback-subject">', '</p>\n <p class="feedback-message ', '">', "</p>\n </div>\n ", "\n </form>\n"]); + return cb = function() { + return e2; + }, e2; + } + function lb() { + const e2 = mb(["<p>", "</p>"]); + return lb = function() { + return e2; + }, e2; + } + function ub() { + const e2 = mb(['<input class="btn btn-primary login-anon" type="submit" value="', '">']); + return ub = function() { + return e2; + }, e2; + } + function db() { + const e2 = mb(["\n ", "\n ", "\n ", "\n "]); + return db = function() { + return e2; + }, e2; + } + function hb() { + const e2 = mb(['\n <div class="form-group">\n <label for="converse-login-jid">', ':</label>\n <input id="converse-login-jid"\n ?autofocus=', '\n required\n class="form-control"\n type="text"\n name="jid"\n placeholder="', '"/>\n </div>\n ', "\n ", '\n <fieldset class="buttons">\n <input class="btn btn-primary" type="submit" value="', '"/>\n </fieldset>\n ', "\n "]); + return hb = function() { + return e2; + }, e2; + } + function fb() { + const e2 = mb(['\n <fieldset class="switch-form">\n <p>', '</p>\n <p><a class="register-account toggle-register-login" href="#converse/register">', "</a></p>\n </fieldset>\n "]); + return fb = function() { + return e2; + }, e2; + } + function pb() { + const e2 = mb(['\n <div class="form-group">\n <label for="converse-login-password">', '</label>\n <input id="converse-login-password" class="form-control" required="required" type="password" name="password" placeholder="', '"/>\n </div>\n ']); + return pb = function() { + return e2; + }, e2; + } + function gb() { + const e2 = mb(['\n <div class="form-group form-check login-trusted">\n <input id="converse-login-trusted" type="checkbox" class="form-check-input" name="trusted" ?checked=', '>\n <label for="converse-login-trusted" class="form-check-label login-trusted__desc">', '</label>\n <i class="fa fa-info-circle" data-toggle="popover"\n data-title="Trusted device?"\n data-content="', '"></i>\n </div>\n ']); + return gb = function() { + return e2; + }, e2; + } + function mb(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + const vb = (e2) => { + const t2 = zd("Log in"), n2 = zd("XMPP Address"); + return Za(hb(), n2, !!Vc.settings.get("auto_focus"), e2.placeholder_username, e2.authentication !== e2.EXTERNAL ? (() => { + const e3 = zd("Password"); + return Za(pb(), e3, e3); + })() : "", e2.show_trust_checkbox ? ((e3) => { + const t3 = zd("To improve performance, we cache your data in this browser. Uncheck this box if this is a public computer or if you want your data to be deleted when you log out. It's important that you explicitly log out, otherwise not all cached data might be deleted. Please note, when using an untrusted device, OMEMO encryption is NOT available."), n3 = zd("This is a trusted device"); + return Za(gb(), e3, n3, t3); + })(e2.show_trust_checkbox !== "off") : "", t2, Uc.allow_registration && !Vc.settings.get("auto_login") && Uc.pluggable.plugins["converse-register"].enabled(Uc) ? (() => { + const e3 = zd("Create an account"), t3 = zd("Don't have a chat account?"); + return Za(fb(), t3, e3); + })() : ""); + }; + var _b = (e2) => Za(cb(), e2.conn_feedback_subject ? e2.conn_feedback_class : "hidden", e2.conn_feedback_subject, e2.conn_feedback_message ? "" : "hidden", e2.conn_feedback_message, Uc.CONNECTION_STATUS[e2.connection_status] === "CONNECTING" ? fp({classes: "hor_centered"}) : ((e3) => { + const t2 = zd("Disconnected"), n2 = zd("Click here to log in anonymously"); + return Za(db(), e3.authentication == e3.LOGIN || e3.authentication == e3.EXTERNAL ? vb(e3) : "", e3.authentication == e3.ANONYMOUS ? Za(ub(), n2) : "", e3.authentication == e3.PREBIND ? Za(lb(), t2) : ""); + })(e2)); + const bb = rl.env.utils, {Strophe: yb} = rl.env, wb = [0, 1, 2, 3, 4, 7, 10], Sb = {0: "Error", 1: "Connecting", 2: "Connection failure", 3: "Authenticating", 4: "Authentication failure", 5: "Connected", 6: "Disconnected", 7: "Disconnecting", 8: "Attached", 9: "Redirect", 10: "Reconnecting"}, xb = {Error: "error", Connecting: "info", "Connection failure": "error", Authenticating: "info", "Authentication failure": "error", Connected: "info", Disconnected: "error", Disconnecting: "warn", Attached: "info", Redirect: "info", Reconnecting: "warn"}, Eb = qo.extend({defaults: {errors: []}}), Ab = eh.extend({tagName: "div", id: "converse-login-panel", className: "controlbox-pane fade-in row no-gutters", events: {"submit form#converse-login": "authenticate", "change input": "validate"}, initialize() { + this.listenTo(this.model, "change", this.render), this.listenTo(Uc.connfeedback, "change", this.render), this.render(); + }, toHTML() { + const e2 = Uc.connfeedback.get("connection_status"); + let t2, n2; + return wb.includes(e2) && (n2 = Sb[e2], t2 = xb[n2]), _b(Object.assign(this.model.toJSON(), {_converse: Uc, ANONYMOUS: Uc.ANONYMOUS, EXTERNAL: Uc.EXTERNAL, LOGIN: Uc.LOGIN, PREBIND: Uc.PREBIND, auto_login: Vc.settings.get("auto_login"), authentication: Vc.settings.get("authentication"), connection_status: e2, conn_feedback_class: t2, conn_feedback_subject: n2, conn_feedback_message: Uc.connfeedback.get("message"), placeholder_username: (Vc.settings.get("locked_domain") || Vc.settings.get("default_domain")) && zd("Username") || zd("user@domain"), show_trust_checkbox: Vc.settings.get("allow_user_trust_override")})); + }, initPopovers() { + Array.from(this.el.querySelectorAll("[data-title]")).forEach((e2) => { + new af.a.Popover(e2, {trigger: Vc.settings.get("view_mode") === "mobile" ? "click" : "hover", dismissible: Vc.settings.get("view_mode") === "mobile", container: this.el.parentElement.parentElement.parentElement}); + }); + }, validate() { + const e2 = this.el.querySelector("form").querySelector("input[name=jid]"); + return !e2.value || Vc.settings.get("locked_domain") || Vc.settings.get("default_domain") || bb.isValidJID(e2.value) ? (e2.setCustomValidity(""), true) : (e2.setCustomValidity(zd("Please enter a valid XMPP address")), false); + }, authenticate(e2) { + if (e2 && e2.preventDefault && e2.preventDefault(), Vc.settings.get("authentication") === Uc.ANONYMOUS) + return this.connect(Uc.jid, null); + if (!this.validate()) + return; + const t2 = new FormData(e2.target); + Uc.config.save({trusted: !!t2.get("trusted")}); + let n2 = t2.get("jid"); + if (Vc.settings.get("locked_domain")) { + const e3 = "@" + Vc.settings.get("locked_domain"); + n2.endsWith(e3) && (n2 = n2.substr(0, n2.length - e3.length)), n2 = yb.escapeNode(n2) + e3; + } else + Vc.settings.get("default_domain") && !n2.includes("@") && (n2 = n2 + "@" + Vc.settings.get("default_domain")); + this.connect(n2, t2.get("password")); + }, connect(e2, t2) { + ["converse/login", "converse/register"].includes(Uc.router.history.getFragment()) && Uc.router.navigate("", {replace: true}), Uc.connection && Uc.connection.reset(), Vc.user.login(e2, t2); + }}); + var Cb = {controlbox: {async open() { + await Vc.waitUntil("chatBoxesFetched"); + const e2 = await Vc.chatboxes.get("controlbox") || Vc.chatboxes.create("controlbox", {}, Uc.Controlbox); + return e2.trigger("show"), e2; + }, get: () => Uc.chatboxviews.get("controlbox")}}; + /** + * @module converse-controlbox + * @copyright 2020, the Converse.js contributors + * @license Mozilla Public License (MPLv2) + */ + const jb = rl.env.utils; + function Tb() { + Uc.chatboxes.on("add", (e2) => { + if (e2.get("type") === Uc.CONTROLBOX_TYPE) { + const t2 = Uc.chatboxviews, n2 = t2.get(e2.get("id")); + n2 ? (n2.model = e2, n2.initialize()) : t2.add(e2.get("id"), new Uc.ControlBoxView({model: e2})); + } + }); + } + function Ob() { + const e2 = Uc.chatboxviews.get("controlbox"); + return e2.model.set({connected: false}), e2; + } + function kb() { + const e2 = Uc == null ? void 0 : Uc.chatboxviews, t2 = e2 && e2.get("controlbox"); + t2 && (jb.safeSave(t2.model, {connected: false}), (t2 == null ? void 0 : t2.controlbox_pane) && (t2.controlbox_pane.remove(), delete t2.controlbox_pane)); + } + function Nb() { + (Uc.chatboxes.get("controlbox") || eb()).save({connected: true}); + } + rl.plugins.add("converse-controlbox", {dependencies: ["converse-modal", "converse-chatboxes", "converse-chat", "converse-rosterview", "converse-chatview"], enabled: (e2) => !e2.api.settings.get("singleton"), overrides: {ChatBoxes: {model(e2, t2) { + const {_converse: n2} = this.__super__; + return e2 && e2.id == "controlbox" ? new n2.ControlBox(e2, t2) : this.__super__.model.apply(this, arguments); + }}}, initialize() { + Vc.settings.extend({allow_logout: true, allow_user_trust_override: true, default_domain: void 0, locked_domain: void 0, show_controlbox_by_default: false, sticky_controlbox: false}), Vc.promises.add("controlBoxInitialized"), Object.assign(Vc, Cb), Uc.ControlBox = Uc.ChatBox.extend(Q_), Uc.ControlBoxView = Uc.ChatBoxView.extend(ab), Uc.LoginPanelModel = Eb, Uc.LoginPanel = Ab, Uc.ControlBoxPane = Y_, Uc.ControlBoxToggle = nb, Vc.listen.on("chatBoxViewsInitialized", Tb), Vc.listen.on("chatBoxesFetched", Nb), Vc.listen.on("cleanup", () => delete Uc.controlboxtoggle), Vc.listen.on("clearSession", kb), Vc.listen.on("disconnected", () => Ob().renderLoginPanel()), Vc.listen.on("will-reconnect", Ob), Vc.waitUntil("chatBoxViewsInitialized").then(eb).catch((e2) => zn.fatal(e2)); + }}); + var Ib = n(178), Mb = n.n(Ib); + /** + * @module converse-dragresize + * @copyright 2020, the Converse.js contributors + * @license Mozilla Public License (MPLv2) + */ + const Rb = rl.env.utils; + function Db(e2, t2) { + const n2 = t2.el.querySelector(".box-flyout"), r2 = document.createElement("div"); + r2.innerHTML = Mb()(), n2.insertBefore(r2, n2.firstChild); + } + function Pb() { + const e2 = zb(['<span class="message-count badge badge-light">', "</span>"]); + return Pb = function() { + return e2; + }, e2; + } + function Lb() { + const e2 = zb(['\n <div class="chat-head-', ' chat-head row no-gutters">\n <a class="restore-chat w-100 align-self-center" title="', '" @click=', ">\n ", "\n ", '\n </a>\n <a class="chatbox-btn close-chatbox-button fa fa-times" @click=', "></a>\n </div>"]); + return Lb = function() { + return e2; + }, e2; + } + function zb(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + rl.plugins.add("converse-dragresize", {dependencies: ["converse-chatview", "converse-headlines-view", "converse-muc-views"], enabled: (e2) => e2.api.settings.get("view_mode") == "overlayed", overrides: {ChatBox: {initialize() { + const e2 = this.__super__.initialize.apply(this, arguments), t2 = this.get("height"), n2 = this.get("width"); + return (this.get("id") === "controlbox" ? (e3) => this.set(e3) : (e3) => this.save(e3))({height: Rb.applyDragResistance(t2, this.get("default_height")), width: Rb.applyDragResistance(n2, this.get("default_width"))}), e2; + }}, ChatBoxView: {events: {"mousedown .dragresize-top": "onStartVerticalResize", "mousedown .dragresize-left": "onStartHorizontalResize", "mousedown .dragresize-topleft": "onStartDiagonalResize"}, render() { + const e2 = this.__super__.render.apply(this, arguments); + return Db(this.__super__._converse, this), this.setWidth(), e2; + }}, HeadlinesBoxView: {events: {"mousedown .dragresize-top": "onStartVerticalResize", "mousedown .dragresize-left": "onStartHorizontalResize", "mousedown .dragresize-topleft": "onStartDiagonalResize"}, render() { + const e2 = this.__super__.render.apply(this, arguments); + return Db(this.__super__._converse, this), this.setWidth(), e2; + }}, ControlBoxView: {events: {"mousedown .dragresize-top": "onStartVerticalResize", "mousedown .dragresize-left": "onStartHorizontalResize", "mousedown .dragresize-topleft": "onStartDiagonalResize"}, render() { + const e2 = this.__super__.render.apply(this, arguments); + return Db(this.__super__._converse, this), this.setWidth(), e2; + }, renderLoginPanel() { + const e2 = this.__super__.renderLoginPanel.apply(this, arguments); + return this.initDragResize().setDimensions(), e2; + }, renderControlBoxPane() { + const e2 = this.__super__.renderControlBoxPane.apply(this, arguments); + return this.initDragResize().setDimensions(), e2; + }}, ChatRoomView: {events: {"mousedown .dragresize-top": "onStartVerticalResize", "mousedown .dragresize-left": "onStartHorizontalResize", "mousedown .dragresize-topleft": "onStartDiagonalResize"}, render() { + const e2 = this.__super__.render.apply(this, arguments); + return Db(this.__super__._converse, this), this.setWidth(), e2; + }}}, initialize() { + Vc.settings.extend({allow_dragresize: true}); + const e2 = {initDragResize() { + var e3; + const t3 = this, n3 = Rc(() => t3.setDimensions()); + window.addEventListener("resize", t3.debouncedSetDimensions), this.listenTo(this.model, "destroy", () => window.removeEventListener("resize", n3)); + const r2 = this.el.querySelector(".box-flyout"), i2 = window.getComputedStyle(r2); + if (this.model.get("height") === void 0) { + const e4 = parseInt(i2.height.replace(/px$/, ""), 10), t4 = parseInt(i2.width.replace(/px$/, ""), 10); + this.model.set("height", e4), this.model.set("default_height", e4), this.model.set("width", t4), this.model.set("default_width", t4); + } + const o2 = i2["min-width"], s2 = i2["min-height"]; + return this.model.set("min_width", o2.endsWith("px") ? Number(o2.replace(/px$/, "")) : 0), this.model.set("min_height", s2.endsWith("px") ? Number(s2.replace(/px$/, "")) : 0), this.prev_pageY = 0, this.prev_pageX = 0, ((e3 = Uc.connection) === null || e3 === void 0 ? void 0 : e3.connected) && (this.height = this.model.get("height"), this.width = this.model.get("width")), this; + }, resizeChatBox(e3) { + let t3; + Uc.resizing.direction.indexOf("top") === 0 && (t3 = e3.pageY - this.prev_pageY, t3 && (this.height = this.height - t3 > (this.model.get("min_height") || 0) ? this.height - t3 : this.model.get("min_height"), this.prev_pageY = e3.pageY, this.setChatBoxHeight(this.height))), Uc.resizing.direction.includes("left") && (t3 = this.prev_pageX - e3.pageX, t3 && (this.width = this.width + t3 > (this.model.get("min_width") || 0) ? this.width + t3 : this.model.get("min_width"), this.prev_pageX = e3.pageX, this.setChatBoxWidth(this.width))); + }, setWidth() { + this.model.get("width") && (this.el.style.width = this.model.get("width")); + }, setDimensions() { + this.adjustToViewport(), this.setChatBoxHeight(this.model.get("height")), this.setChatBoxWidth(this.model.get("width")); + }, setChatBoxHeight(e3) { + e3 = e3 ? Rb.applyDragResistance(e3, this.model.get("default_height")) + "px" : ""; + const t3 = this.el.querySelector(".box-flyout"); + t3 !== null && (t3.style.height = e3); + }, setChatBoxWidth(e3) { + e3 = e3 ? Rb.applyDragResistance(e3, this.model.get("default_width")) + "px" : "", this.el.style.width = e3; + const t3 = this.el.querySelector(".box-flyout"); + t3 !== null && (t3.style.width = e3); + }, adjustToViewport() { + const e3 = Math.max(document.documentElement.clientWidth, window.innerWidth || 0), t3 = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); + e3 <= 480 ? (this.model.set("height", void 0), this.model.set("width", void 0)) : e3 <= this.model.get("width") ? this.model.set("width", void 0) : t3 <= this.model.get("height") && this.model.set("height", void 0); + }, onStartVerticalResize(e3, t3 = true) { + if (!Vc.settings.get("allow_dragresize")) + return true; + e3.preventDefault(); + const n3 = this.el.querySelector(".box-flyout"), r2 = window.getComputedStyle(n3); + this.height = parseInt(r2.height.replace(/px$/, ""), 10), Uc.resizing = {chatbox: this, direction: "top"}, this.prev_pageY = e3.pageY, t3 && Vc.trigger("startVerticalResize", this); + }, onStartHorizontalResize(e3, t3 = true) { + if (!Vc.settings.get("allow_dragresize")) + return true; + e3.preventDefault(); + const n3 = this.el.querySelector(".box-flyout"), r2 = window.getComputedStyle(n3); + this.width = parseInt(r2.width.replace(/px$/, ""), 10), Uc.resizing = {chatbox: this, direction: "left"}, this.prev_pageX = e3.pageX, t3 && Vc.trigger("startHorizontalResize", this); + }, onStartDiagonalResize(e3) { + this.onStartHorizontalResize(e3, false), this.onStartVerticalResize(e3, false), Uc.resizing.direction = "topleft", Vc.trigger("startDiagonalResize", this); + }}; + function t2(e3) { + if (!Uc.resizing || !Vc.settings.get("allow_dragresize")) + return true; + e3.preventDefault(), Uc.resizing.chatbox.resizeChatBox(e3); + } + function n2(e3) { + if (!Uc.resizing || !Vc.settings.get("allow_dragresize")) + return true; + e3.preventDefault(); + const t3 = Rb.applyDragResistance(Uc.resizing.chatbox.height, Uc.resizing.chatbox.model.get("default_height")), n3 = Rb.applyDragResistance(Uc.resizing.chatbox.width, Uc.resizing.chatbox.model.get("default_width")); + Vc.connection.connected() ? (Uc.resizing.chatbox.model.save({height: t3}), Uc.resizing.chatbox.model.save({width: n3})) : (Uc.resizing.chatbox.model.set({height: t3}), Uc.resizing.chatbox.model.set({width: n3})), Uc.resizing = null; + } + Object.assign(Uc.ChatBoxView.prototype, e2), Rb.applyDragResistance = function(e3, t3) { + if (e3 === void 0) + return; + if (t3 === void 0) + return e3; + return e3 !== t3 && Math.abs(e3 - t3) < 10 ? t3 : e3; + }, Vc.listen.on("registeredGlobalEventHandlers", function() { + document.addEventListener("mousemove", t2), document.addEventListener("mouseup", n2); + }), Vc.listen.on("unregisteredGlobalEventHandlers", function() { + document.removeEventListener("mousemove", t2), document.removeEventListener("mouseup", n2); + }), Vc.listen.on("beforeShowingChatView", (e3) => e3.initDragResize().setDimensions()); + }}), rl.plugins.add("converse-singleton", {enabled: (e2) => e2.api.settings.get("singleton"), initialize() { + if (Vc.settings.extend({allow_logout: false, allow_muc_invitations: false, hide_muc_server: true}), !Array.isArray(Vc.settings.get("auto_join_rooms")) && !Array.isArray(Vc.settings.get("auto_join_private_chats"))) + throw new Error("converse-singleton: auto_join_rooms must be an Array"); + if (Vc.settings.get("auto_join_rooms").length > 1 || Vc.settings.get("auto_join_private_chats").length > 1) + throw new Error("It doesn't make sense to have singleton set to true and auto_join_rooms or auto_join_private_chats set to more then one, since only one chat room may be open at any time."); + }}), rl.plugins.add("converse-fullscreen", {enabled: (e2) => e2.isUniView(), initialize() { + Vc.settings.extend({chatview_avatar_height: 50, chatview_avatar_width: 50, hide_open_bookmarks: true, show_controlbox_by_default: true, sticky_controlbox: true}); + }}), rl.plugins.add("converse-mam-views", {dependencies: ["converse-mam", "converse-chatview", "converse-muc-views"], initialize() { + Vc.listen.on("chatBoxScrolledUp", async (e2) => { + if (e2.model.messages.length) { + const t2 = e2.model.get("type") === Uc.CHATROOMS_TYPE, n2 = e2.model.getOldestMessage(); + if (n2) { + const r2 = t2 ? e2.model.get("jid") : Uc.bare_jid, i2 = n2 && n2.get("stanza_id ".concat(r2)); + e2.addSpinner(), i2 ? await e2.model.fetchArchivedMessages({before: i2}) : await e2.model.fetchArchivedMessages({end: n2.get("time")}), e2.clearSpinner(); + } + } + }); + }}); + function Fb() { + const e2 = qb(["<converse-minimized-chat\n .model=", "\n title=", "\n type=", "\n num_unread=", "></converse-minimized-chat>"]); + return Fb = function() { + return e2; + }, e2; + } + function Bb() { + const e2 = qb(['<div id="minimized-chats" class="', '">\n <a id="toggle-minimized-chats" class="row no-gutters" @click=', ">\n ", " ", '\n <span class="unread-message-count ', '" href="#">', '</span>\n </a>\n <div class="flyout minimized-chats-flyout row no-gutters ', '">\n ', "\n </div>\n </div>"]); + return Bb = function() { + return e2; + }, e2; + } + function qb(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + Vc.elements.define("converse-minimized-chat", class extends mc { + static get properties() { + return {model: {type: Object}, title: {type: String}, type: {type: String}, num_unread: {type: Number}}; + } + render() { + return ((e2) => { + const t2 = zd("Click to restore this chat"); + return Za(Lb(), e2.type, t2, e2.restore, e2.num_unread ? Za(Pb(), e2.num_unread) : "", e2.title, e2.close); + })({close: (e2) => this.close(e2), num_unread: this.num_unread, restore: (e2) => this.restore(e2), title: this.title, type: this.type}); + } + close(e2) { + e2 == null || e2.preventDefault(); + const t2 = Uc.chatboxviews.get(this.model.get("id")); + t2 ? t2.close() : (this.model.destroy(), Vc.trigger("chatBoxClosed", this)); + } + restore(e2) { + e2 == null || e2.preventDefault(), this.model.maximize(); + } + }); + /** + * @module converse-minimize + * @copyright 2020, the Converse.js contributors + * @license Mozilla Public License (MPLv2) + */ + const {dayjs: Hb} = rl.env, Ub = rl.env.utils; + function $b() { + const e2 = Qb(['<span class="badge badge-secondary">', "</span>"]); + return $b = function() { + return e2; + }, e2; + } + function Wb() { + const e2 = Qb(['<span class="badge badge-info">', "</span>"]); + return Wb = function() { + return e2; + }, e2; + } + function Gb() { + const e2 = Qb(['<span class="badge badge-info">', "</span>"]); + return Gb = function() { + return e2; + }, e2; + } + function Vb() { + const e2 = Qb(['<span class="badge badge-info">', "</span>"]); + return Vb = function() { + return e2; + }, e2; + } + function Jb() { + const e2 = Qb(['<span class="badge badge-groupchat">', "</span>"]); + return Jb = function() { + return e2; + }, e2; + } + function Xb() { + const e2 = Qb(['\n <li class="occupant" id="', '" title="', '">\n <div class="row no-gutters">\n <div class="col-auto">\n <div class="occupant-status occupant-', ' circle" title="', '"></div>\n </div>\n <div class="col occupant-nick-badge">\n <span class="occupant-nick">', '</span>\n <span class="occupant-badges">\n ', "\n ", "\n ", "\n ", "\n ", "\n </span>\n </div>\n </div>\n </li>\n "]); + return Xb = function() { + return e2; + }, e2; + } + function Qb(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + rl.plugins.add("converse-minimize", {dependencies: ["converse-chatview", "converse-controlbox", "converse-muc-views", "converse-headlines-view", "converse-dragresize"], enabled: (e2) => e2.api.settings.get("view_mode") === "overlayed", overrides: {ChatBox: {initialize() { + this.__super__.initialize.apply(this, arguments), this.on("show", this.maximize, this), this.get("id") !== "controlbox" && this.save({minimized: this.get("minimized") || false, time_minimized: this.get("time_minimized") || Hb()}); + }, maybeShow(e2) { + return !e2 && this.get("minimized") ? this : this.__super__.maybeShow.apply(this, arguments); + }, isHidden() { + return this.__super__.isHidden.call(this) || this.get("minimized"); + }}, ChatBoxView: {show() { + const {_converse: e2} = this.__super__; + return e2.api.settings.get("view_mode") === "overlayed" && this.model.get("minimized") ? (this.model.minimize(), this) : this.__super__.show.apply(this, arguments); + }, isNewMessageHidden() { + return this.model.get("minimized") || this.__super__.isNewMessageHidden.apply(this, arguments); + }, setChatBoxHeight(e2) { + if (!this.model.get("minimized")) + return this.__super__.setChatBoxHeight.call(this, e2); + }, setChatBoxWidth(e2) { + if (!this.model.get("minimized")) + return this.__super__.setChatBoxWidth.call(this, e2); + }}}, initialize() { + Vc.settings.extend({no_trimming: false}); + const e2 = {maximize() { + Ub.safeSave(this, {minimized: false, time_opened: new Date().getTime()}); + }, minimize() { + Ub.safeSave(this, {minimized: true, time_minimized: new Date().toISOString()}); + }}; + Object.assign(Uc.ChatBox.prototype, e2); + const t2 = {onMaximized() { + const {_converse: e3} = this.__super__; + return this.insertIntoDOM(), this.model.isScrolledUp() || this.model.clearUnreadMsgCounter(), this.model.setChatState(e3.ACTIVE), this.show(), Vc.trigger("chatBoxMaximized", this), this; + }, onMinimized(e3) { + const {_converse: t3} = this.__super__; + return e3 && e3.preventDefault && e3.preventDefault(), this.model.collection && this.model.collection.browserStorage ? this.model.save({scroll: this.content.scrollTop}) : this.model.set({scroll: this.content.scrollTop}), this.model.setChatState(t3.INACTIVE), this.hide(), Vc.trigger("chatBoxMinimized", this), this; + }, minimize(e3) { + return e3 && e3.preventDefault && e3.preventDefault(), this.model.minimize(), this; + }, onMinimizedChanged(e3) { + e3.get("minimized") ? this.onMinimized() : this.onMaximized(); + }}; + Object.assign(Uc.ChatBoxView.prototype, t2); + const n2 = {getChatBoxWidth(e3) { + if (e3.model.get("id") === "controlbox") { + const e4 = this.get("controlbox"); + return e4 && Ub.isVisible(e4.el) ? Ub.getOuterWidth(e4.el, true) : Ub.getOuterWidth(Uc.controlboxtoggle.el, true); + } + return !e3.model.get("minimized") && Ub.isVisible(e3.el) ? Ub.getOuterWidth(e3.el, true) : 0; + }, getShownChats() { + return this.filter((e3) => !e3.model.get("minimized") && !e3.model.get("closed") && Ub.isVisible(e3.el)); + }, getMinimizedWidth() { + var e3; + const t3 = (e3 = Uc.minimized_chats) === null || e3 === void 0 ? void 0 : e3.el; + return this.model.pluck("minimized").includes(true) ? Ub.getOuterWidth(t3, true) : 0; + }, getBoxesWidth(e3) { + const t3 = e3 ? e3.model.get("id") : null, n3 = e3 ? Ub.getOuterWidth(e3.el, true) : 0; + return Object.values(this.xget(t3)).reduce((e4, t4) => e4 + this.getChatBoxWidth(t4), n3); + }, async trimChats(e3) { + var t3; + if (Vc.settings.get("no_trimming") || !Vc.connection.connected() || Vc.settings.get("view_mode") !== "overlayed") + return; + const n3 = this.getShownChats(); + if (n3.length <= 1) + return; + const r3 = Ub.getOuterWidth(document.querySelector("body"), true); + if (this.getChatBoxWidth(n3[0]) !== r3 && (await Vc.waitUntil("minimizedChatsInitialized"), (t3 = Uc.minimized_chats) === null || t3 === void 0 ? void 0 : t3.el)) + for (; this.getMinimizedWidth() + this.getBoxesWidth(e3) > r3; ) { + const t4 = e3 ? e3.model.get("id") : null, n4 = this.getOldestMaximizedChat([t4]); + if (!n4) + break; + { + const e4 = this.get(n4.get("id")); + e4 && e4.hide(), n4.minimize(); + } + } + }, getOldestMaximizedChat(e3) { + e3.push("controlbox"); + let t3 = 0, n3 = this.model.sort().at(t3); + for (; e3.includes(n3.get("id")) || n3.get("minimized") === true; ) + if (t3++, n3 = this.model.at(t3), !n3) + return null; + return n3; + }}; + Object.assign(Uc.ChatBoxViews.prototype, n2), Vc.promises.add("minimizedChatsInitialized"), Uc.MinimizedChatsToggle = qo.extend({defaults: {collapsed: false}}), Uc.MinimizedChats = eh.extend({tagName: "span", async initialize() { + await this.initToggle(), this.render(), this.listenTo(this.minchats, "change:collapsed", this.render), this.listenTo(this.model, "add", this.render), this.listenTo(this.model, "change:fullname", this.render), this.listenTo(this.model, "change:jid", this.render), this.listenTo(this.model, "change:minimized", this.render), this.listenTo(this.model, "change:name", this.render), this.listenTo(this.model, "change:num_unread", this.render), this.listenTo(this.model, "remove", this.render); + }, render() { + const e3 = this.model.where({minimized: true}), t3 = e3.reduce((e4, t4) => e4 + t4.get("num_unread"), 0), n3 = e3.reduce((e4, t4) => e4 + (t4.get("minimized") ? 1 : 0), 0), r3 = {chats: e3, num_unread: t3, num_minimized: n3, collapsed: this.minchats.get("collapsed")}; + var i2; + r3.toggle = (e4) => this.toggle(e4), Ya((i2 = r3, Za(Bb(), i2.chats.length ? "" : "hidden", i2.toggle, i2.num_minimized, zd("Minimized"), i2.num_unread ? "" : "unread-message-count-hidden", i2.num_unread, i2.collapsed ? "hidden" : "", i2.chats.map((e4) => Za(Fb(), e4, e4.getDisplayName(), e4.get("type"), e4.get("num_unread"))))), this.el), this.el.parentElement || Uc.chatboxviews.insertRowColumn(this.el); + }, async initToggle() { + const e3 = "converse.minchatstoggle-".concat(Uc.bare_jid); + this.minchats = new Uc.MinimizedChatsToggle({id: e3}), this.minchats.browserStorage = Uc.createStore(e3), await new Promise((e4) => this.minchats.fetch({success: e4, error: e4})); + }, toggle(e3) { + e3 == null || e3.preventDefault(), this.minchats.save({collapsed: !this.minchats.get("collapsed")}); + }}), Vc.listen.on("chatBoxInsertedIntoDOM", (e3) => Uc.chatboxviews.trimChats(e3)), Vc.listen.on("connected", () => { + return (e3 = Uc.minimized_chats) === null || e3 === void 0 || e3.remove(), Uc.minimized_chats = new Uc.MinimizedChats({model: Uc.chatboxes}), void Vc.trigger("minimizedChatsInitialized"); + var e3; + }), Vc.listen.on("controlBoxOpened", (e3) => Uc.chatboxviews.trimChats(e3)), Vc.listen.on("chatBoxViewInitialized", (e3) => e3.listenTo(e3.model, "change:minimized", e3.onMinimizedChanged)), Vc.listen.on("chatRoomViewInitialized", (e3) => { + e3.listenTo(e3.model, "change:minimized", e3.onMinimizedChanged), e3.model.get("minimized") && e3.hide(); + }), Vc.listen.on("getHeadingButtons", (e3, t3) => e3.model.get("type") === Uc.CHATROOMS_TYPE ? function(e4, t4) { + const n3 = {a_class: "toggle-chatbox-button", handler: (t5) => e4.minimize(t5), i18n_text: zd("Minimize"), i18n_title: zd("Minimize this groupchat"), icon_class: "fa-minus", name: "minimize", standalone: Uc.api.settings.get("view_mode") === "overlayed"}, r3 = t4.map((e5) => e5.name).indexOf("signout"); + return r3 > -1 ? [...t4.slice(0, r3), n3, ...t4.slice(r3)] : [n3, ...t4]; + }(e3, t3) : function(e4, t4) { + const n3 = {a_class: "toggle-chatbox-button", handler: (t5) => e4.minimize(t5), i18n_text: zd("Minimize"), i18n_title: zd("Minimize this chat"), icon_class: "fa-minus", name: "minimize", standalone: Uc.api.settings.get("view_mode") === "overlayed"}, r3 = t4.map((e5) => e5.name).indexOf("close"); + return r3 > -1 ? [...t4.slice(0, r3), n3, ...t4.slice(r3)] : [n3, ...t4]; + }(e3, t3)); + const r2 = Rc(() => Uc.chatboxviews.trimChats(), 250); + Vc.listen.on("registeredGlobalEventHandlers", () => window.addEventListener("resize", r2)), Vc.listen.on("unregisteredGlobalEventHandlers", () => window.removeEventListener("resize", r2)); + }}); + var Yb = (e2) => { + const t2 = zd("Owner"), n2 = zd("Admin"), r2 = zd("Member"), i2 = zd("Moderator"), o2 = zd("Visitor"); + return Za(Xb(), e2.id, ((e3) => { + const t3 = zd("This user is a moderator."), n3 = zd("This user can send messages in this groupchat."), r3 = zd("This user can NOT send messages in this groupchat."), i3 = "".concat(e3.jid, " ") || false; + return e3.role === "moderator" ? "".concat(i3).concat(t3, " ").concat(e3.hint_occupant) : e3.role === "participant" ? "".concat(i3).concat(n3, " ").concat(e3.hint_occupant) : e3.role === "visitor" ? "".concat(i3).concat(r3, " ").concat(e3.hint_occupant) : ["visitor", "participant", "moderator"].includes(e3.role) ? void 0 : "".concat(i3).concat(e3.hint_occupant); + })(e2), e2.show, e2.hint_show, e2.nick || e2.jid, e2.affiliation === "owner" ? Za(Jb(), t2) : "", e2.affiliation === "admin" ? Za(Vb(), n2) : "", e2.affiliation === "member" ? Za(Gb(), r2) : "", e2.role === "moderator" ? Za(Wb(), i2) : "", e2.role === "visitor" ? Za($b(), o2) : ""); + }; + function Kb() { + const e2 = function(e3, t2) { + t2 || (t2 = e3.slice(0)); + return Object.freeze(Object.defineProperties(e3, {raw: {value: Object.freeze(t2)}})); + }(['\n <div class="occupants-header">\n <i class="hide-occupants fa fa-times"></i>\n <div class="occupants-header--title">\n <span class="occupants-heading">', '</span>\n </div>\n </div>\n <div class="dragresize dragresize-occupants-left"></div>\n <ul class="occupant-list">', "</ul>\n "]); + return Kb = function() { + return e2; + }, e2; + } + const Zb = {offline: "Offline", unavailable: "Unavailable", xa: "Extended Away", away: "Away", dnd: "Do not disturb", chat: "Chattty", online: "Online"}; + const ey = rl.env.utils; + function ty() { + const e2 = ry(['<p class="form-help">', "</p>"]); + return ty = function() { + return e2; + }, e2; + } + function ny() { + const e2 = ry(['\n <form class="converse-form chatroom-form" autocomplete="off" @submit=', '>\n <fieldset class="form-group">\n <legend>', "</legend>\n ", "\n <!-- Fields are generated internally, with xForm2webForm -->\n ", '\n </fieldset>\n <fieldset>\n <input type="submit" class="btn btn-primary" value="', '">\n <input type="button" class="btn btn-secondary button-cancel" value="', '" @click=', ">\n </fieldset>\n </form>\n "]); + return ny = function() { + return e2; + }, e2; + } + function ry(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + Vc.elements.define("converse-muc-sidebar", class extends mc { + static get properties() { + return {chatroom: {type: Object}, occupants: {type: Object}}; + } + connectedCallback() { + super.connectedCallback(), this.listenTo(this.occupants, "add", this.requestUpdate), this.listenTo(this.occupants, "remove", this.requestUpdate), this.listenTo(this.occupants, "change", this.requestUpdate); + } + render() { + return ((e2) => { + const t2 = (e3) => zd("Click to mention %1$s in your message.", e3.get("nick")), n2 = zd("Participants"), r2 = e2.occupants.map((e3) => Yb(Object.assign({jid: "", hint_show: Zb[e3.get("show")], hint_occupant: t2(e3)}, e3.toJSON()))); + return Za(Kb(), n2, r2); + })(Object.assign(this.chatroom.toJSON(), {occupants: [...this.occupants.models]})); + } + shouldShow() { + return !this.chatroom.get("hidden_occupants") && this.chatroom.session.get("connection_status") === rl.ROOMSTATUS.ENTERED; + } + setVisibility() { + this.shouldShow() ? ey.showElement(this) : ey.hideElement(this); + } + }); + const {sizzle: iy} = rl.env, oy = rl.env.utils; + var sy = eh.extend({className: "chatroom-form-container muc-config-form", initialize(e2) { + this.chatroomview = e2.chatroomview, this.listenTo(this.chatroomview.model.features, "change:passwordprotected", this.render), this.listenTo(this.chatroomview.model.features, "change:config_stanza", this.render), this.render(); + }, toHTML() { + var e2, t2; + const n2 = oy.toStanza(this.model.get("config_stanza")), r2 = Vc.settings.get("roomconfig_whitelist"); + let i2 = iy("field", n2); + r2.length && (i2 = i2.filter((e3) => r2.includes(e3.getAttribute("var")))); + const o2 = {new_password: !this.model.features.get("passwordprotected"), fixed_username: this.model.get("jid")}; + return ((e3) => { + const t3 = zd("Save"), n3 = zd("Cancel"); + return Za(ny(), e3.submitConfigForm, e3.title, e3.title !== e3.instructions ? Za(ty(), e3.instructions) : "", e3.fields.map((e4) => Kp(e4)), t3, n3, e3.closeConfigForm); + })({closeConfigForm: (e3) => this.closeConfigForm(e3), fields: i2.map((e3) => oy.xForm2webForm(e3, n2, o2)), instructions: (e2 = n2.querySelector("instructions")) === null || e2 === void 0 ? void 0 : e2.textContent, submitConfigForm: (e3) => this.submitConfigForm(e3), title: (t2 = n2.querySelector("title")) === null || t2 === void 0 ? void 0 : t2.textContent}); + }, async submitConfigForm(e2) { + e2.preventDefault(); + const t2 = iy(":input:not([type=button]):not([type=submit])", e2.target).map(oy.webForm2xForm).filter((e3) => e3); + try { + await this.model.sendConfiguration(t2); + } catch (e3) { + zn.error(e3); + const t3 = zd("Sorry, an error occurred while trying to submit the config form.") + " " + zd("Check your browser's developer console for details."); + Vc.alert("error", zd("Error"), t3); + } + await this.model.refreshDiscoInfo(), this.chatroomview.closeForm(); + }, closeConfigForm(e2) { + e2.preventDefault(), this.chatroomview.closeForm(); + }}); + function ay() { + const e2 = function(e3, t2) { + t2 || (t2 = e3.slice(0)); + return Object.freeze(Object.defineProperties(e3, {raw: {value: Object.freeze(t2)}})); + }(['\n <form class="converse-form chatroom-form converse-centered-form" @submit=', '>\n <fieldset class="form-group">\n <label>', '</label>\n <p class="validation-message">', '</p>\n <input class="hidden-username" type="text" autocomplete="username" value="', '"></input>\n <input type="password"\n name="password"\n required="required"\n class="form-control ', '"\n placeholder="', '"/>\n </fieldset>\n <fieldset class="form-group">\n <input class="btn btn-primary" type="submit" value="', '"/>\n </fieldset>\n </form>\n ']); + return ay = function() { + return e2; + }, e2; + } + var cy = eh.extend({className: "chatroom-form-container muc-password-form", initialize(e2) { + this.chatroomview = e2.chatroomview, this.listenTo(this.model, "change:validation_message", this.render), this.render(); + }, toHTML() { + return ((e2) => { + const t2 = zd("This groupchat requires a password"), n2 = zd("Password: "), r2 = zd("Submit"); + return Za(ay(), e2.submitPassword, t2, e2.validation_message, e2.jid, e2.validation_message ? "error" : "", n2, r2); + })({jid: this.model.get("jid"), submitPassword: (e2) => this.submitPassword(e2), validation_message: this.model.get("validation_message")}); + }, submitPassword(e2) { + e2.preventDefault(); + const t2 = this.el.querySelector("input[type=password]").value; + this.chatroomview.model.join(this.chatroomview.model.get("nick"), t2), this.model.set("validation_message", null); + }}); + function ly() { + const e2 = dy(['<div class="error error-feedback">', "</div>"]); + return ly = function() { + return e2; + }, e2; + } + function uy() { + const e2 = dy(['\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title" id="add-chatroom-modal-label">', "</h5>\n ", '\n </div>\n <div class="modal-body">\n <span class="modal-alert"></span>\n <div class="suggestion-box room-invite">\n <form @submit=', '>\n <div class="form-group">\n <label class="clearfix" for="invitee_jids">', ":</label>\n ", '\n <input class="form-control suggestion-box__input"\n required="required"\n name="invitee_jids"\n id="invitee_jids"\n placeholder="', '"\n type="text"/>\n <span class="suggestion-box__additions visually-hidden" role="status" aria-live="assertive" aria-relevant="additions"></span>\n <ul class="suggestion-box__results suggestion-box__results--below" hidden=""></ul>\n </div>\n <div class="form-group">\n <label>', ':</label>\n <textarea class="form-control" name="reason"></textarea>\n </div>\n <div class="form-group">\n <button type="submit" class="btn btn-primary">', "</button>\n </div>\n </form>\n </div>\n </div>\n </div>\n </div>\n "]); + return uy = function() { + return e2; + }, e2; + } + function dy(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + const hy = rl.env.utils; + var fy = df.extend({id: "muc-invite-modal", initialize() { + df.prototype.initialize.apply(this, arguments), this.listenTo(this.model, "change", this.render), this.initInviteWidget(); + }, toHTML() { + return ((e2) => { + const t2 = zd("Invite"), n2 = zd("Invite someone to this groupchat"), r2 = zd("user@example.org"), i2 = zd("Please enter a valid XMPP address"), o2 = zd("XMPP Address"), s2 = zd("Optional reason for the invitation"); + return Za(uy(), n2, mf, e2.submitInviteForm, o2, e2.invalid_invite_jid ? Za(ly(), i2) : "", r2, s2, t2); + })(Object.assign(this.model.toJSON(), {submitInviteForm: (e2) => this.submitInviteForm(e2)})); + }, initInviteWidget() { + this.invite_auto_complete && this.invite_auto_complete.destroy(); + const e2 = Uc.roster.map((e3) => ({label: e3.getDisplayName(), value: e3.get("jid")})), t2 = this.el.querySelector(".suggestion-box").parentElement; + this.invite_auto_complete = new Uc.AutoComplete(t2, {min_chars: 1, list: e2}); + }, submitInviteForm(e2) { + e2.preventDefault(); + const t2 = new FormData(e2.target), n2 = t2.get("invitee_jids"), r2 = t2.get("reason"); + hy.isValidJID(n2) ? (this.chatroomview.model.directInvite(n2, r2), this.modal.hide()) : this.model.set({invalid_invite_jid: true}); + }}); + function py() { + const e2 = Dy(['<li class="list-group-item">', "</li>"]); + return py = function() { + return e2; + }, e2; + } + function gy() { + const e2 = Dy(['<li class="list-group-item"> ', " </li>"]); + return gy = function() { + return e2; + }, e2; + } + function my() { + const e2 = Dy(['<div class="row"><div class="col pt-2"><p class="helptext pb-3">', "</p></div></div>"]); + return my = function() { + return e2; + }, e2; + } + function vy() { + const e2 = Dy(['<input class="form-control" .value="', '" @keyup=', ' type="text" name="filter" placeholder="', '"/>']); + return vy = function() { + return e2; + }, e2; + } + function _y() { + const e2 = Dy(['<li class="list-group-item">', "</li>"]); + return _y = function() { + return e2; + }, e2; + } + function by() { + const e2 = Dy(['<li class="list-group-item">', "</li>"]); + return by = function() { + return e2; + }, e2; + } + function yy() { + const e2 = Dy(['<li class="list-group-item"> ', " </li>"]); + return yy = function() { + return e2; + }, e2; + } + function wy() { + const e2 = Dy(['<div class="row"><div class="col pt-2"><p class="helptext pb-3">', "</p></div></div>"]); + return wy = function() { + return e2; + }, e2; + } + function Sy() { + const e2 = Dy(['<input class="form-control" .value="', '" @keyup=', ' type="text" name="filter" placeholder="', '"/>']); + return Sy = function() { + return e2; + }, e2; + } + function xy() { + const e2 = Dy(['\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title" id="converse-modtools-modal-label">', "</h5>\n ", '\n </div>\n <div class="modal-body d-flex flex-column">\n <span class="modal-alert"></span>\n\n ', '\n\n <div class="tab-content">\n <div class="tab-pane tab-pane--columns ', '" id="affiliations-tabpanel" role="tabpanel" aria-labelledby="affiliations-tab">\n <form class="converse-form query-affiliation" @submit=', '>\n <p class="helptext pb-3">', '</p>\n <div class="form-group">\n <label for="affiliation">\n <strong>', ':</strong>\n </label>\n <div class="row">\n <div class="col">\n <select class="custom-select select-affiliation" name="affiliation">\n ', '\n </select>\n </div>\n <div class="col">\n <input type="submit" class="btn btn-primary" name="users_with_affiliation" value="', '"/>\n </div>\n </div>\n <div class="row">\n <div class="col mt-3">\n ', "\n </div>\n </div>\n\n ", '\n </div>\n </form>\n <div class="scrollable-container">\n <ul class="list-group list-group--users">\n ', "\n ", "\n\n ", '\n </ul>\n </div>\n </div>\n\n <div class="tab-pane tab-pane--columns ', '" id="roles-tabpanel" role="tabpanel" aria-labelledby="roles-tab">\n <form class="converse-form query-role" @submit=', '>\n <p class="helptext pb-3">', '</p>\n <div class="form-group">\n <label for="role"><strong>', ':</strong></label>\n <div class="row">\n <div class="col">\n <select class="custom-select select-role" name="role">\n ', '\n </select>\n </div>\n <div class="col">\n <input type="submit" class="btn btn-primary" name="users_with_role" value="', '"/>\n </div>\n </div>\n <div class="row">\n <div class="col mt-3">\n ', "\n </div>\n </div>\n\n ", '\n </div>\n </form>\n <div class="scrollable-container">\n <ul class="list-group list-group--users">\n ', "\n ", "\n ", "\n </ul>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>"]); + return xy = function() { + return e2; + }, e2; + } + function Ey() { + const e2 = Dy(['\n <ul class="nav nav-pills justify-content-center">\n <li role="presentation" class="nav-item">\n <a class="nav-link active" id="affiliations-tab" href="#affiliations-tabpanel" aria-controls="affiliations-tabpanel" role="tab" data-toggle="tab" @click=', '>Affiliations</a>\n </li>\n <li role="presentation" class="nav-item">\n <a class="nav-link" id="roles-tab" href="#roles-tabpanel" aria-controls="roles-tabpanel" role="tab" data-toggle="tab" @click=', ">Roles</a>\n </li>\n </ul>\n"]); + return Ey = function() { + return e2; + }, e2; + } + function Ay() { + const e2 = Dy(['<a href="#" data-form="affiliation-form" class="toggle-form right fa fa-wrench" @click=', "></a>"]); + return Ay = function() { + return e2; + }, e2; + } + function Cy() { + const e2 = Dy(['\n <li class="list-group-item" data-nick="', '">\n <ul class="list-group">\n <li class="list-group-item active">\n <div><strong>JID:</strong> ', '</div>\n </li>\n <li class="list-group-item">\n <div><strong>Nickname:</strong> ', '</div>\n </li>\n <li class="list-group-item">\n <div><strong>Affiliation:</strong> ', " ", "</div>\n ", "\n </li>\n </ul>\n </li>\n"]); + return Cy = function() { + return e2; + }, e2; + } + function jy() { + const e2 = Dy(['<option value="', '" ?selected=', ">", "</option>"]); + return jy = function() { + return e2; + }, e2; + } + function Ty() { + const e2 = Dy(['\n <form class="affiliation-form hidden" @submit=', '>\n <div class="form-group">\n <input type="hidden" name="jid" value="', '"/>\n <input type="hidden" name="nick" value="', '"/>\n <div class="row">\n <div class="col">\n <label><strong>', ':</strong></label>\n <select class="custom-select select-affiliation" name="affiliation">\n ', '\n </select>\n </div>\n <div class="col">\n <label><strong>', ':</strong></label>\n <input class="form-control" type="text" name="reason"/>\n </div>\n </div>\n </div>\n <div class="form-group">\n <input type="submit" class="btn btn-primary" name="change" value="', '"/>\n </div>\n </form>\n ']); + return Ty = function() { + return e2; + }, e2; + } + function Oy() { + const e2 = Dy(['<a href="#" data-form="role-form" class="toggle-form right fa fa-wrench" @click=', "></a>"]); + return Oy = function() { + return e2; + }, e2; + } + function ky() { + const e2 = Dy(['\n <li class="list-group-item" data-nick="', '">\n <ul class="list-group">\n <li class="list-group-item active">\n <div><strong>JID:</strong> ', '</div>\n </li>\n <li class="list-group-item">\n <div><strong>Nickname:</strong> ', '</div>\n </li>\n <li class="list-group-item">\n <div><strong>Role:</strong> ', " ", "</div>\n ", "\n </li>\n </ul>\n </li>\n"]); + return ky = function() { + return e2; + }, e2; + } + function Ny() { + const e2 = Dy(['<option value="', '" ?selected=', ">", "</option>"]); + return Ny = function() { + return e2; + }, e2; + } + function Iy() { + const e2 = Dy(['\n <form class="role-form hidden" @submit=', '>\n <div class="form-group">\n <input type="hidden" name="jid" value="', '"/>\n <input type="hidden" name="nick" value="', '"/>\n <div class="row">\n <div class="col">\n <label><strong>', ':</strong></label>\n <select class="custom-select select-role" name="role">\n ', '\n </select>\n </div>\n <div class="col">\n <label><strong>', ':</strong></label>\n <input class="form-control" type="text" name="reason"/>\n </div>\n </div>\n </div>\n <div class="form-group">\n <input type="submit" class="btn btn-primary" value="', '"/>\n </div>\n </form>\n ']); + return Iy = function() { + return e2; + }, e2; + } + function My() { + const e2 = Dy(['\n <option value="', '"\n ?selected=', '\n title="', '">', "</option>\n"]); + return My = function() { + return e2; + }, e2; + } + function Ry() { + const e2 = Dy(['\n <option value="', '"\n ?selected=', '\n title="', '">', "</option>\n"]); + return Ry = function() { + return e2; + }, e2; + } + function Dy(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + function Py(e2) { + return e2 === "moderator" ? zd("Moderators are privileged users who can change the roles of other users (except those with admin or owner affiliations.") : e2 === "participant" ? zd("The default role, implies that you can read and write messages.") : e2 == "visitor" ? zd("Visitors aren't allowed to write messages in a moderated multi-user chat.") : void 0; + } + function Ly(e2) { + return e2 === "owner" ? zd("Owner is the highest affiliation. Owners can modify roles and affiliations of all other users.") : e2 === "admin" ? zd("Admin is the 2nd highest affiliation. Admins can modify roles and affiliations of all other users except owners.") : e2 === "outcast" ? zd('To ban a user, you give them the affiliation of "outcast".') : void 0; + } + const zy = (e2) => Za(ky(), e2.item.nick, e2.item.jid, e2.item.nick, e2.item.role, e2.assignable_roles.length ? Za(Oy(), e2.toggleForm) : "", e2.assignable_roles.length ? ((e3) => { + const t2 = zd("Change role"), n2 = zd("New Role"), r2 = zd("Reason"); + return Za(Iy(), e3.assignRole, e3.item.jid, e3.item.nick, n2, e3.assignable_roles.map((t3) => Za(Ny(), t3, t3 === e3.item.role, t3)), r2, t2); + })(e2) : ""), Fy = (e2) => Za(Cy(), e2.item.nick, e2.item.jid, e2.item.nick, e2.item.affiliation, e2.assignable_affiliations.length ? Za(Ay(), e2.toggleForm) : "", e2.assignable_affiliations.length ? ((e3) => { + const t2 = zd("Change affiliation"), n2 = zd("New affiliation"), r2 = zd("Reason"); + return Za(Ty(), e3.assignAffiliation, e3.item.jid, e3.item.nick, n2, e3.assignable_affiliations.map((t3) => Za(jy(), t3, t3 === e3.item.affiliation, t3)), r2, t2); + })(e2) : ""); + var By = (e2) => { + const t2 = zd("Affiliation"), n2 = zd("Moderator Tools"), r2 = zd("No users with that affiliation found."), i2 = zd("No users with that role found."), o2 = zd("Type here to filter the search results"), s2 = zd("Role"), a2 = zd("Show users"), c2 = zd("Roles are assigned to users to grant or deny them certain abilities in a multi-user chat. They're assigned either explicitly or implicitly as part of an affiliation. A role that's not due to an affiliation, is only valid for the duration of the user's session."), l2 = zd("An affiliation is a long-lived entitlement which typically implies a certain role and which grants privileges and responsibilities. For example admins and owners automatically have the moderator role."), u2 = e2.queryable_roles.length && e2.queryable_affiliations.length; + return Za(xy(), n2, mf, u2 ? ((e3) => Za(Ey(), e3.switchTab, e3.switchTab))(e2) : "", e2.queryable_affiliations.length ? "active" : "", e2.queryAffiliation, l2, t2, e2.queryable_affiliations.map((t3) => ((e3) => Za(My(), e3.item || "", e3.item === e3.affiliation, Ly(e3.item), e3.item))(Object.assign({item: t3}, e2))), a2, Array.isArray(e2.users_with_affiliation) && e2.users_with_affiliation.length > 5 ? Za(Sy(), e2.affiliations_filter, e2.filterAffiliationResults, o2) : "", Ly(e2.affiliation) ? Za(wy(), Ly(e2.affiliation)) : "", e2.loading_users_with_affiliation ? Za(yy(), fp()) : "", Array.isArray(e2.users_with_affiliation) && e2.users_with_affiliation.length === 0 ? Za(by(), r2) : "", e2.users_with_affiliation instanceof Error ? Za(_y(), e2.users_with_affiliation.message) : (e2.users_with_affiliation || []).map((t3) => (t3.nick || t3.jid).match(new RegExp(e2.affiliations_filter, "i")) ? Fy(Object.assign({item: t3}, e2)) : ""), !u2 && e2.queryable_roles.length ? "active" : "", e2.queryRole, c2, s2, e2.queryable_roles.map((t3) => ((e3) => Za(Ry(), e3.item || "", e3.item === e3.role, Py(e3.item), e3.item))(Object.assign({item: t3}, e2))), a2, Array.isArray(e2.users_with_role) && e2.users_with_role.length > 5 ? Za(vy(), e2.roles_filter, e2.filterRoleResults, o2) : "", Py(e2.role) ? Za(my(), Py(e2.role)) : "", e2.loading_users_with_role ? Za(gy(), fp()) : "", e2.users_with_role && e2.users_with_role.length === 0 ? Za(py(), i2) : "", (e2.users_with_role || []).map((t3) => t3.nick.match(e2.roles_filter) ? zy(Object.assign({item: t3}, e2)) : "")); + }; + const {Strophe: qy} = rl.env, Hy = rl.env.utils; + let Uy; + var $y = df.extend({id: "converse-modtools-modal", persistent: true, initialize(e2) { + Uy = e2._converse, this.chatroomview = e2.chatroomview, df.prototype.initialize.apply(this, arguments), this.affiliations_filter = "", this.roles_filter = "", this.listenTo(this.model, "change:role", () => { + this.users_with_role = this.chatroomview.model.getOccupantsWithRole(this.model.get("role")), this.render(); + }), this.listenTo(this.model, "change:affiliation", async () => { + this.loading_users_with_affiliation = true, this.users_with_affiliation = null, this.render(); + const e3 = this.chatroomview.model, t2 = this.model.get("affiliation"); + this.shouldFetchAffiliationsList() ? this.users_with_affiliation = await e3.getAffiliationList(t2) : this.users_with_affiliation = e3.getOccupantsWithAffiliation(t2), this.loading_users_with_affiliation = false, this.render(); + }); + }, toHTML() { + const e2 = this.chatroomview.model.occupants.findWhere({jid: Uy.bare_jid}); + return By(Object.assign(this.model.toJSON(), {affiliations_filter: this.affiliations_filter, assignAffiliation: (e3) => this.assignAffiliation(e3), assignRole: (e3) => this.assignRole(e3), assignable_affiliations: this.getAssignableAffiliations(e2), assignable_roles: this.getAssignableRoles(e2), filterAffiliationResults: (e3) => this.filterAffiliationResults(e3), filterRoleResults: (e3) => this.filterRoleResults(e3), loading_users_with_affiliation: this.loading_users_with_affiliation, queryAffiliation: (e3) => this.queryAffiliation(e3), queryRole: (e3) => this.queryRole(e3), queryable_affiliations: fu.filter((e3) => !Uy.modtools_disable_query.includes(e3)), queryable_roles: hu.filter((e3) => !Uy.modtools_disable_query.includes(e3)), roles_filter: this.roles_filter, switchTab: (e3) => this.switchTab(e3), toggleForm: (e3) => this.toggleForm(e3), users_with_affiliation: this.users_with_affiliation, users_with_role: this.users_with_role})); + }, getAssignableAffiliations(e2) { + let t2 = Vc.settings.get("modtools_disable_assign"); + return Array.isArray(t2) || (t2 = t2 ? fu : []), e2.get("affiliation") === "owner" ? fu.filter((e3) => !t2.includes(e3)) : e2.get("affiliation") === "admin" ? fu.filter((e3) => !["owner", "admin", ...t2].includes(e3)) : []; + }, getAssignableRoles(e2) { + let t2 = Vc.settings.get("modtools_disable_assign"); + return Array.isArray(t2) || (t2 = t2 ? hu : []), e2.get("role") === "moderator" ? hu.filter((e3) => !t2.includes(e3)) : []; + }, shouldFetchAffiliationsList() { + const e2 = this.model.get("affiliation"); + return e2 !== "none" && !this.chatroomview.model.occupants.getAutoFetchedAffiliationLists().includes(e2); + }, toggleForm(e2) { + e2.stopPropagation(), e2.preventDefault(); + const t2 = e2.target.getAttribute("data-form"), n2 = Hy.ancestor(e2.target, ".list-group-item").querySelector(".".concat(t2)); + Hy.hasClass("hidden", n2) ? Hy.removeClass("hidden", n2) : Hy.addClass("hidden", n2); + }, filterRoleResults(e2) { + this.roles_filter = e2.target.value, this.render(); + }, filterAffiliationResults(e2) { + this.affiliations_filter = e2.target.value, this.render(); + }, queryRole(e2) { + e2.stopPropagation(), e2.preventDefault(); + const t2 = new FormData(e2.target).get("role"); + this.model.set({role: null}, {silent: true}), this.model.set({role: t2}); + }, queryAffiliation(e2) { + e2.stopPropagation(), e2.preventDefault(); + const t2 = new FormData(e2.target).get("affiliation"); + this.model.set({affiliation: null}, {silent: true}), this.model.set({affiliation: t2}); + }, async assignAffiliation(e2) { + e2.stopPropagation(), e2.preventDefault(); + const t2 = new FormData(e2.target), n2 = t2.get("affiliation"), r2 = {jid: t2.get("jid"), reason: t2.get("reason")}, i2 = this.model.get("affiliation"); + try { + await this.chatroomview.model.setAffiliation(n2, [r2]); + } catch (e3) { + return e3 === null ? this.alert(zd("Timeout error while trying to set the affiliation"), "danger") : mr()('not-allowed[xmlns="'.concat(qy.NS.STANZAS, '"]'), e3).length ? this.alert(zd("Sorry, you're not allowed to make that change"), "danger") : this.alert(zd("Sorry, something went wrong while trying to set the affiliation"), "danger"), void zn.error(e3); + } + this.alert(zd("Affiliation changed"), "primary"), await this.chatroomview.model.occupants.fetchMembers(), this.model.set({affiliation: null}, {silent: true}), this.model.set({affiliation: i2}); + }, assignRole(e2) { + e2.stopPropagation(), e2.preventDefault(); + const t2 = new FormData(e2.target), n2 = this.chatroomview.model.getOccupant(t2.get("jid") || t2.get("nick")), r2 = t2.get("role"), i2 = t2.get("reason"), o2 = this.model.get("role"); + this.chatroomview.model.setRole(n2, r2, i2, () => { + this.alert(zd("Role changed"), "primary"), this.model.set({role: null}, {silent: true}), this.model.set({role: o2}); + }, (e3) => { + mr()('not-allowed[xmlns="'.concat(qy.NS.STANZAS, '"]'), e3).length ? this.alert(zd("You're not allowed to make that change"), "danger") : (this.alert(zd("Sorry, something went wrong while trying to set the role"), "danger"), Hy.isErrorObject(e3) && zn.error(e3)); + }); + }}); + function Wy() { + const e2 = function(e3, t2) { + t2 || (t2 = e3.slice(0)); + return Object.freeze(Object.defineProperties(e3, {raw: {value: Object.freeze(t2)}})); + }(['\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title" id="user-details-modal-label">', "</h5>\n ", '\n </div>\n <div class="modal-body">\n ', '\n </div>\n <div class="modal-footer">\n ', "\n </div>\n </div>\n </div>\n "]); + return Wy = function() { + return e2; + }, e2; + } + const Gy = df.extend({initialize() { + df.prototype.initialize.apply(this, arguments), this.listenTo(this.model, "change", this.render), Vc.trigger("occupantModalInitialized", this.model); + }, toHTML() { + return e2 = Object.assign(this.model.toJSON(), {avatar_data: this.getAvatarData(), display_name: this.model.getDisplayName()}), Za(Wy(), e2.display_name, mf, op(e2.avatar_data), gf); + var e2; + }, getAvatarData() { + const e2 = Uc.vcards.findWhere({jid: this.model.get("jid")}); + return {classes: "chat-msg__avatar", height: 120, width: 120, image: "data:" + ((e2 == null ? void 0 : e2.get("image_type")) || Uc.DEFAULT_IMAGE_TYPE) + ";base64," + ((e2 == null ? void 0 : e2.get("image")) || Uc.DEFAULT_IMAGE)}; + }}); + Uc.OccupantModal = Gy; + var Vy = Gy; + function Jy() { + const e2 = lw(['<li class="feature" ><span class="fa fa-database"></span>', " - <em>", "</em></li>"]); + return Jy = function() { + return e2; + }, e2; + } + function Xy() { + const e2 = lw(['<li class="feature" ><span class="fa fa-info-circle"></span>', " - <em>", "</em></li>"]); + return Xy = function() { + return e2; + }, e2; + } + function Qy() { + const e2 = lw(['<li class="feature" ><span class="fa fa-gavel"></span>', " - <em>", "</em></li>"]); + return Qy = function() { + return e2; + }, e2; + } + function Yy() { + const e2 = lw(['<li class="feature" ><span class="fa fa-user-secret"></span>', " - <em>", "</em></li>"]); + return Yy = function() { + return e2; + }, e2; + } + function Ky() { + const e2 = lw(['<li class="feature" ><span class="fa fa-id-card"></span>', " - <em>", "</em></li>"]); + return Ky = function() { + return e2; + }, e2; + } + function Zy() { + const e2 = lw(['<li class="feature" ><span class="fa fa-snowflake-o"></span>', " - <em>", "</em></li>"]); + return Zy = function() { + return e2; + }, e2; + } + function ew() { + const e2 = lw(['<li class="feature" ><span class="fa fa-save"></span>', " - <em>", "</em></li>"]); + return ew = function() { + return e2; + }, e2; + } + function tw() { + const e2 = lw(['<li class="feature" ><span class="fa fa-globe"></span>', " - <em>", "</em></li>"]); + return tw = function() { + return e2; + }, e2; + } + function nw() { + const e2 = lw(['<li class="feature" ><span class="fa fa-address-book"></span>', " - <em>", "</em></li>"]); + return nw = function() { + return e2; + }, e2; + } + function rw() { + const e2 = lw(['<li class="feature" ><span class="fa fa-eye"></span>', " - <em>", "</em></li>"]); + return rw = function() { + return e2; + }, e2; + } + function iw() { + const e2 = lw(['<li class="feature" ><span class="fa fa-eye-slash"></span>', " - <em>", "</em></li>"]); + return iw = function() { + return e2; + }, e2; + } + function ow() { + const e2 = lw(['<li class="feature" ><span class="fa fa-unlock"></span>', " - <em>", "</em></li>"]); + return ow = function() { + return e2; + }, e2; + } + function sw() { + const e2 = lw(['<li class="feature" ><span class="fa fa-lock"></span>', " - <em>", "</em></li>"]); + return sw = function() { + return e2; + }, e2; + } + function aw() { + const e2 = lw(['\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title" id="muc-details-modal-label">', "</h5>\n ", '\n </div>\n <div class="modal-body">\n <span class="modal-alert"></span>\n <div class="room-info">\n <p class="room-info"><strong>', "</strong>: ", '</p>\n <p class="room-info"><strong>', "</strong>: ", '</p>\n <p class="room-info"><strong>', "</strong>: ", "</p>\n ", '\n <p class="room-info"><strong>', "</strong>: ", '</p>\n <p class="room-info"><strong>', '</strong>:\n <div class="chatroom-features">\n <ul class="features-list">\n ', "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", '\n </ul>\n </div>\n </p>\n </div>\n </div>\n <div class="modal-footer">', "</div>\n </div>\n </div>\n "]); + return aw = function() { + return e2; + }, e2; + } + function cw() { + const e2 = lw(['\n <p class="room-info"><strong>', "</strong>: ", '</p>\n <p class="room-info"><strong>', "</strong>: ", "</p>\n "]); + return cw = function() { + return e2; + }, e2; + } + function lw(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + var uw = (e2) => { + const t2 = zd("Groupchat address (JID)"), n2 = zd("Message archiving"), r2 = zd("Messages are archived on the server"), i2 = zd("Description"), o2 = zd("Features"), s2 = zd("Hidden"), a2 = zd("This groupchat is not publicly searchable"), c2 = zd("This groupchat is restricted to members only"), l2 = zd("Members only"), u2 = zd("Moderated"), d2 = zd("Participants entering this groupchat need to request permission to write"), h2 = zd("Name"), f2 = zd("This groupchat does not require a password upon entry"), p2 = zd("No password required"), g2 = zd("Not anonymous"), m2 = zd("All other groupchat participants can see your XMPP address"), v2 = zd("Not moderated"), _2 = zd("Participants entering this groupchat can write right away"), b2 = zd("Online users"), y2 = zd("Open"), w2 = zd("Anyone can join this groupchat"), S2 = zd("This groupchat requires a password before entry"), x2 = zd("Password protected"), E2 = zd("Persistent"), A2 = zd("This groupchat persists even if it's unoccupied"), C2 = zd("Public"), j2 = zd("Semi-anonymous"), T2 = zd("Only moderators can see your XMPP address"), O2 = zd("Temporary"), k2 = zd("This groupchat will disappear once the last person leaves"); + return Za(aw(), e2.display_name, mf, h2, e2.name, t2, e2.jid, i2, e2.config.description, e2.subject ? ((e3) => { + const t3 = zd("Topic"), n3 = zd("Topic author"); + return Za(cw(), t3, Kp(Qp.a.filterXSS(e3.subject.text, {whiteList: {}})), n3, e3.subject && e3.subject.author); + })(e2) : "", b2, e2.num_occupants, o2, e2.features.passwordprotected ? Za(sw(), x2, S2) : "", e2.features.unsecured ? Za(ow(), p2, f2) : "", e2.features.hidden ? Za(iw(), s2, a2) : "", e2.features.public_room ? Za(rw(), C2, e2.__("This groupchat is publicly searchable")) : "", e2.features.membersonly ? Za(nw(), l2, c2) : "", e2.features.open ? Za(tw(), y2, w2) : "", e2.features.persistent ? Za(ew(), E2, A2) : "", e2.features.temporary ? Za(Zy(), O2, k2) : "", e2.features.nonanonymous ? Za(Ky(), g2, m2) : "", e2.features.semianonymous ? Za(Yy(), j2, T2) : "", e2.features.moderated ? Za(Qy(), u2, d2) : "", e2.features.unmoderated ? Za(Xy(), v2, _2) : "", e2.features.mam_enabled ? Za(Jy(), n2, r2) : "", gf); + }, dw = df.extend({id: "muc-details-modal", initialize() { + df.prototype.initialize.apply(this, arguments), this.listenTo(this.model, "change", this.render), this.listenTo(this.model.features, "change", this.render), this.listenTo(this.model.occupants, "add", this.render), this.listenTo(this.model.occupants, "change", this.render); + }, toHTML() { + return uw(Object.assign(this.model.toJSON(), {config: this.model.config.toJSON(), display_name: zd("Groupchat info for %1$s", this.model.getDisplayName()), features: this.model.features.toJSON(), num_occupants: this.model.occupants.length})); + }}); + function hw() { + const e2 = function(e3, t2) { + t2 || (t2 = e3.slice(0)); + return Object.freeze(Object.defineProperties(e3, {raw: {value: Object.freeze(t2)}})); + }(['\n <div class="flyout box-flyout">\n <div class="chat-head chat-head-chatroom row no-gutters"></div>\n <div class="chat-body chatroom-body row no-gutters">\n <div class="chat-area col">\n <div class="chat-content ', '" aria-live="polite">\n <div class="chat-content__messages" @scroll=', '></div>\n <div class="chat-content__help"></div>\n </div>\n <div class="bottom-panel"></div>\n </div>\n <div class="disconnect-container hidden"></div>\n <converse-muc-sidebar class="occupants col-md-3 col-4 ', '"\n .occupants=', "\n .chatroom=", "></converse-muc-sidebar>\n </div>\n </div>\n"]); + return hw = function() { + return e2; + }, e2; + } + function fw() { + const e2 = _w(['<p class="chat-head__desc" title="', '">', "</p>"]); + return fw = function() { + return e2; + }, e2; + } + function pw() { + const e2 = _w(["<converse-dropdown .items=", "></converse-dropdown>"]); + return pw = function() { + return e2; + }, e2; + } + function gw() { + const e2 = _w(['<i class="fa fa-bookmark chatbox-title__text--bookmarked" title="', '"></i>']); + return gw = function() { + return e2; + }, e2; + } + function mw() { + const e2 = _w(['<div class="chatbox-navback"><i class="fa fa-arrow-left"></i></div>']); + return mw = function() { + return e2; + }, e2; + } + function vw() { + const e2 = _w(['\n <div class="chatbox-title ', '">\n ', '\n <div class="chatbox-title__text" title="', '">', "\n ", '\n </div>\n <div class="chatbox-title__buttons row no-gutters">\n ', "\n ", "\n </div>\n </div>\n ", "\n "]); + return vw = function() { + return e2; + }, e2; + } + function _w(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + const bw = rl.env.utils; + var yw = (e2) => { + const t2 = zd("Hide the groupchat topic"), n2 = zd("This groupchat is bookmarked"), r2 = e2.subject ? bw.addHyperlinks(e2.subject.text) : "", i2 = r2 && !e2.subject_hidden; + return Za(vw(), i2 ? "" : "chatbox-title--no-desc", e2._converse.api.settings.get("singleton") ? "" : Za(mw()), e2._converse.locked_muc_domain !== "hidden" ? e2.jid : "", e2.title, e2.bookmarked ? Za(gw(), n2) : "", e2.standalone_btns.length ? ((e3) => e3.standalone_btns.reverse().map((e4) => Qh(e4, "")))(e2) : "", e2.dropdown_btns.length ? Za(pw(), e2.dropdown_btns) : "", i2 ? Za(fw(), t2, r2) : ""); + }; + function ww() { + const e2 = Ew(['<div class="muc-bottom-panel"></div>']); + return ww = function() { + return e2; + }, e2; + } + function Sw() { + const e2 = Ew(['<div class="muc-bottom-panel">', "</div>"]); + return Sw = function() { + return e2; + }, e2; + } + function xw() { + const e2 = Ew(['\n <div class="emoji-picker__container dropup"></div>\n <div class="message-form-container">']); + return xw = function() { + return e2; + }, e2; + } + function Ew(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + var Aw = (e2) => { + const t2 = zd("You're not allowed to send messages in this room"); + return e2.entered ? e2.can_edit ? Za(xw()) : Za(Sw(), t2) : Za(ww()); + }; + function Cw() { + const e2 = Ow(['<p class="destroyed-reason">"', '"</p>']); + return Cw = function() { + return e2; + }, e2; + } + function jw() { + const e2 = Ow(['\n <div class="alert alert-danger">\n <h3 class="alert-heading disconnect-msg">', "</h3>\n ", "\n ", "\n </div>"]); + return jw = function() { + return e2; + }, e2; + } + function Tw() { + const e2 = Ow(['\n <p class="moved-label">', '</p>\n <p class="moved-link"><a class="switch-chat" href="#">', "</a></p>"]); + return Tw = function() { + return e2; + }, e2; + } + function Ow(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + var kw = (e2, t2) => { + const n2 = zd("This groupchat no longer exists"); + return Za(jw(), n2, t2 ? Za(Cw(), t2) : "", e2 ? ((e3) => { + const t3 = zd("The conversation has moved. Click below to enter."); + return Za(Tw(), t3, e3); + })(e2) : ""); + }; + function Nw() { + const e2 = Mw(['<p class="disconnect-msg">', "</p>"]); + return Nw = function() { + return e2; + }, e2; + } + function Iw() { + const e2 = Mw(['\n <div class="alert alert-danger">\n <h3 class="alert-heading disconnect-msg">', "</h3>\n ", "\n </div>"]); + return Iw = function() { + return e2; + }, e2; + } + function Mw(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + function Rw() { + const e2 = function(e3, t2) { + t2 || (t2 = e3.slice(0)); + return Object.freeze(Object.defineProperties(e3, {raw: {value: Object.freeze(t2)}})); + }(['\n <div class="chatroom-form-container muc-nickname-form">\n <form class="converse-form chatroom-form converse-centered-form">\n <fieldset class="form-group">\n <label>', '</label>\n <p class="validation-message">', '</p>\n <input type="text"\n required="required"\n name="nick"\n value="', '"\n class="form-control ', '"\n placeholder="', '"/>\n </fieldset>\n <fieldset class="form-group">\n <input type="submit" class="btn btn-primary" name="join" value="', '"/>\n </fieldset>\n </form>\n </div>']); + return Rw = function() { + return e2; + }, e2; + } + const {Strophe: Dw, sizzle: Pw, $pres: Lw} = rl.env, zw = rl.env.utils, Fw = ["owner"], Bw = ["admin", "ban", "deop", "destroy", "member", "op", "revoke"], qw = ["kick", "mute", "voice", "modtools"], Hw = ["nick"], Uw = {deop: "participant", kick: "none", mute: "visitor", op: "moderator", voice: "participant"}, $w = {admin: "admin", ban: "outcast", member: "member", owner: "owner", revoke: "none"}; + var Ww = {length: 300, tagName: "div", className: "chatbox chatroom hidden", is_chatroom: true, events: {"click .chatbox-navback": "showControlBox", "click .hide-occupants": "hideOccupants", "click .new-msgs-indicator": "viewUnreadMessages", "click .occupant-nick": function(e2) { + this.insertIntoTextArea(e2.target.textContent); + }, "click .send-button": "onFormSubmitted", "dragover .chat-textarea": "onDragOver", "drop .chat-textarea": "onDrop", "input .chat-textarea": "inputChanged", "keydown .chat-textarea": "onKeyDown", "keyup .chat-textarea": "onKeyUp", "mousedown .dragresize-occupants-left": "onStartResizeOccupants", "paste .chat-textarea": "onPaste", "submit .muc-nickname-form": "submitNickname"}, async initialize() { + this.initDebounced(), this.listenTo(this.model, "change", Rc(() => this.renderHeading(), 250)), this.listenTo(this.model, "change:composing_spoiler", this.renderMessageForm), this.listenTo(this.model, "change:hidden", (e3) => e3.get("hidden") ? this.hide() : this.show()), this.listenTo(this.model, "change:hidden_occupants", this.onSidebarToggle), this.listenTo(this.model, "configurationNeeded", this.getAndRenderConfigurationForm), this.listenTo(this.model, "destroy", this.hide), this.listenTo(this.model, "show", this.show), this.listenTo(this.model.features, "change:moderated", this.renderBottomPanel), this.listenTo(this.model.features, "change:open", this.renderHeading), this.listenTo(this.model.messages, "rendered", this.maybeScrollDown), this.listenTo(this.model.session, "change:connection_status", this.onConnectionStatusChanged), this.onMouseMove = this.onMouseMove.bind(this), this.onMouseUp = this.onMouseUp.bind(this), await this.render(), this.listenTo(this.model, "change:show_help_messages", this.renderHelpMessages), this.listenTo(this.model.messages, "add", this.onMessageAdded), this.listenTo(this.model.messages, "change", this.renderChatHistory), this.listenTo(this.model.messages, "remove", this.renderChatHistory), this.listenTo(this.model.messages, "reset", this.renderChatHistory), this.listenTo(this.model.notifications, "change", this.renderNotifications), this.model.occupants.forEach((e3) => this.onOccupantAdded(e3)), this.listenTo(this.model.occupants, "add", this.onOccupantAdded), this.listenTo(this.model.occupants, "change", this.renderChatHistory), this.listenTo(this.model.occupants, "change:affiliation", this.onOccupantAffiliationChanged), this.listenTo(this.model.occupants, "change:role", this.onOccupantRoleChanged), this.listenTo(this.model.occupants, "change:show", this.showJoinOrLeaveNotification), this.listenTo(this.model.occupants, "remove", this.onOccupantRemoved), this.renderChatContent(), this.insertIntoDOM(); + const e2 = await Uc.api.user.settings.getModel(); + this.listenTo(e2, "change:mucs_with_hidden_subject", this.renderHeading), this.onConnectionStatusChanged(), this.model.maybeShow(), this.scrollDown(), Vc.trigger("chatRoomViewInitialized", this); + }, async render() { + const e2 = !this.shouldShowSidebar(); + var t2; + this.el.setAttribute("id", this.model.get("box_id")), Ya((t2 = {sidebar_hidden: e2, model: this.model, occupants: this.model.occupants, show_sidebar: !this.model.get("hidden_occupants") && this.model.session.get("connection_status") === rl.ROOMSTATUS.ENTERED, markScrolled: (e3) => this.markScrolled(e3), muc_show_logs_before_join: Vc.settings.get("muc_show_logs_before_join"), show_send_button: Uc.show_send_button}, Za(hw(), t2.show_send_button ? "chat-content-sendbutton" : "", t2.markScrolled, t2.sidebar_hidden ? "hidden" : "", t2.occupants, t2.model)), this.el), this.notifications = this.el.querySelector(".chat-content__notifications"), this.content = this.el.querySelector(".chat-content"), this.msgs_container = this.el.querySelector(".chat-content__messages"), this.help_container = this.el.querySelector(".chat-content__help"), this.renderBottomPanel(), Vc.settings.get("muc_show_logs_before_join") || this.model.session.get("connection_status") === rl.ROOMSTATUS.ENTERED || this.showSpinner(), await this.renderHeading(), !this.model.get("hidden") && this.show(); + }, getNotifications() { + const e2 = this.model.notifications.toJSON(), t2 = Vc.settings.get("muc_show_info_messages").filter((e3) => rl.MUC_ROLE_CHANGES_LIST.includes(e3)), n2 = Vc.settings.get("muc_show_info_messages").filter((e3) => rl.MUC_TRAFFIC_STATES_LIST.includes(e3)); + return [...rl.CHAT_STATES, ...n2, ...t2].reduce((t3, n3) => { + const r2 = e2[n3]; + if (!(r2 == null ? void 0 : r2.length)) + return t3; + const i2 = r2.map((e3) => { + var t4; + return ((t4 = this.model.getOccupant(e3)) === null || t4 === void 0 ? void 0 : t4.getDisplayName()) || e3; + }); + if (i2.length === 1) { + if (n3 === "composing") + return "".concat(t3).concat(zd("%1$s is typing", i2[0]), "\n"); + if (n3 === "paused") + return "".concat(t3).concat(zd("%1$s has stopped typing", i2[0]), "\n"); + if (n3 === Uc.GONE) + return "".concat(t3).concat(zd("%1$s has gone away", i2[0]), "\n"); + if (n3 === "entered") + return "".concat(t3).concat(zd("%1$s has entered the groupchat", i2[0]), "\n"); + if (n3 === "exited") + return "".concat(t3).concat(zd("%1$s has left the groupchat", i2[0]), "\n"); + if (n3 === "op") + return "".concat(t3).concat(zd("%1$s is now a moderator", i2[0]), "\n"); + if (n3 === "deop") + return "".concat(t3).concat(zd("%1$s is no longer a moderator", i2[0]), "\n"); + if (n3 === "voice") + return "".concat(t3).concat(zd("%1$s has been given a voice", i2[0]), "\n"); + if (n3 === "mute") + return "".concat(t3).concat(zd("%1$s has been muted", i2[0]), "\n"); + } else if (i2.length > 1) { + let e3; + if (i2.length > 3) + e3 = "".concat(Array.from(i2).slice(0, 2).join(", "), " and others"); + else { + const t4 = i2.pop(); + e3 = zd("%1$s and %2$s", i2.join(", "), t4); + } + if (n3 === "composing") + return "".concat(t3).concat(zd("%1$s are typing", e3), "\n"); + if (n3 === "paused") + return "".concat(t3).concat(zd("%1$s have stopped typing", e3), "\n"); + if (n3 === Uc.GONE) + return "".concat(t3).concat(zd("%1$s have gone away", e3), "\n"); + if (n3 === "entered") + return "".concat(t3).concat(zd("%1$s have entered the groupchat", e3), "\n"); + if (n3 === "exited") + return "".concat(t3).concat(zd("%1$s have left the groupchat", e3), "\n"); + if (n3 === "op") + return "".concat(t3).concat(zd("%1$s are now moderators", i2[0]), "\n"); + if (n3 === "deop") + return "".concat(t3).concat(zd("%1$s are no longer moderators", i2[0]), "\n"); + if (n3 === "voice") + return "".concat(t3).concat(zd("%1$s have been given voices", i2[0]), "\n"); + if (n3 === "mute") + return "".concat(t3).concat(zd("%1$s have been muted", i2[0]), "\n"); + } + return t3; + }, ""); + }, getHelpMessages() { + const e2 = Vc.settings.get("muc_disable_slash_commands"), t2 = Array.isArray(e2) ? e2 : []; + return ["<strong>/admin</strong>: ".concat(zd("Change user's affiliation to admin")), "<strong>/ban</strong>: ".concat(zd("Ban user by changing their affiliation to outcast")), "<strong>/clear</strong>: ".concat(zd("Clear the chat area")), "<strong>/close</strong>: ".concat(zd("Close this groupchat")), "<strong>/deop</strong>: ".concat(zd("Change user role to participant")), "<strong>/destroy</strong>: ".concat(zd("Remove this groupchat")), "<strong>/help</strong>: ".concat(zd("Show this menu")), "<strong>/kick</strong>: ".concat(zd("Kick user from groupchat")), "<strong>/me</strong>: ".concat(zd("Write in 3rd person")), "<strong>/member</strong>: ".concat(zd("Grant membership to a user")), "<strong>/modtools</strong>: ".concat(zd("Opens up the moderator tools GUI")), "<strong>/mute</strong>: ".concat(zd("Remove user's ability to post messages")), "<strong>/nick</strong>: ".concat(zd("Change your nickname")), "<strong>/op</strong>: ".concat(zd("Grant moderator role to user")), "<strong>/owner</strong>: ".concat(zd("Grant ownership of this groupchat")), "<strong>/register</strong>: ".concat(zd("Register your nickname")), "<strong>/revoke</strong>: ".concat(zd("Revoke the user's current affiliation")), "<strong>/subject</strong>: ".concat(zd("Set groupchat subject")), "<strong>/topic</strong>: ".concat(zd("Set groupchat subject (alias for /subject)")), "<strong>/voice</strong>: ".concat(zd("Allow muted user to post messages"))].filter((e3) => t2.every((t3) => !e3.startsWith(t3 + "<", 9))).filter((e3) => this.getAllowedCommands().some((t3) => e3.startsWith(t3 + "<", 9))); + }, async renderHeading() { + const e2 = await this.generateHeadingTemplate(); + Ya(e2, this.el.querySelector(".chat-head-chatroom")); + }, renderBottomPanel() { + const e2 = this.el.querySelector(".bottom-panel"), t2 = this.model.session.get("connection_status") === rl.ROOMSTATUS.ENTERED, n2 = t2 && !(this.model.features.get("moderated") && this.model.getOwnRole() === "visitor"); + Ya(Aw({can_edit: n2, entered: t2}), e2), t2 && n2 && (this.renderMessageForm(), this.initMentionAutoComplete()); + }, onStartResizeOccupants(e2) { + this.resizing = true, this.el.addEventListener("mousemove", this.onMouseMove), this.el.addEventListener("mouseup", this.onMouseUp); + const t2 = this.el.querySelector("converse-muc-sidebar"), n2 = window.getComputedStyle(t2); + this.width = parseInt(n2.width.replace(/px$/, ""), 10), this.prev_pageX = e2.pageX; + }, onMouseMove(e2) { + if (this.resizing) { + e2.preventDefault(); + const t2 = this.prev_pageX - e2.pageX; + this.resizeSidebarView(t2, e2.pageX), this.prev_pageX = e2.pageX; + } + }, onMouseUp(e2) { + if (this.resizing) { + e2.preventDefault(), this.resizing = false, this.el.removeEventListener("mousemove", this.onMouseMove), this.el.removeEventListener("mouseup", this.onMouseUp); + const t2 = this.el.querySelector("converse-muc-sidebar").getBoundingClientRect(), n2 = {occupants_width: this.calculateSidebarWidth(t2, 0)}; + Uc.connection.connected ? this.model.save(n2) : this.model.set(n2); + } + }, resizeSidebarView(e2, t2) { + const n2 = this.el.querySelector("converse-muc-sidebar"), r2 = n2.getBoundingClientRect(); + if (this.is_minimum) + this.is_minimum = r2.left < t2; + else if (this.is_maximum) + this.is_maximum = r2.left > t2; + else { + const t3 = this.calculateSidebarWidth(r2, e2); + n2.style.flex = "0 0 " + t3 + "px"; + } + }, calculateSidebarWidth(e2, t2) { + let n2 = e2.width + t2; + const r2 = this.el.clientWidth; + return n2 < 0.2 * r2 ? (n2 = 0.2 * r2, this.is_minimum = true) : n2 > 0.75 * r2 ? (n2 = 0.75 * r2, this.is_maximum = true) : r2 - n2 < 250 ? (n2 = r2 - 250, this.is_maximum = true) : (this.is_maximum = false, this.is_minimum = false), n2; + }, getAutoCompleteList() { + return this.model.getAllKnownNicknames().map((e2) => ({label: e2, value: "@".concat(e2)})); + }, getAutoCompleteListItem(e2, t2) { + t2 = t2.trim(); + const n2 = document.createElement("li"); + if (n2.setAttribute("aria-selected", "false"), Vc.settings.get("muc_mention_autocomplete_show_avatar")) { + const t3 = document.createElement("img"); + let r3 = "data:" + Uc.DEFAULT_IMAGE_TYPE + ";base64," + Uc.DEFAULT_IMAGE; + if (Uc.vcards) { + const t4 = Uc.vcards.findWhere({nickname: e2}); + t4 && (r3 = "data:" + t4.get("image_type") + ";base64," + t4.get("image")); + } + t3.setAttribute("src", r3), t3.setAttribute("width", "22"), t3.setAttribute("class", "avatar avatar-autocomplete"), n2.appendChild(t3); + } + const r2 = new RegExp("(" + t2 + ")", "ig"); + return (t2 ? e2.split(r2) : [e2]).forEach((e3) => { + if (t2 && e3.match(r2)) { + const t3 = document.createElement("mark"); + t3.textContent = e3, n2.appendChild(t3); + } else + n2.appendChild(document.createTextNode(e3)); + }), n2; + }, initMentionAutoComplete() { + this.mention_auto_complete = new Uc.AutoComplete(this.el, {auto_first: true, auto_evaluate: false, min_chars: Vc.settings.get("muc_mention_autocomplete_min_chars"), match_current_word: true, list: () => this.getAutoCompleteList(), filter: Vc.settings.get("muc_mention_autocomplete_filter") == "contains" ? Uc.FILTER_CONTAINS : Uc.FILTER_STARTSWITH, ac_triggers: ["Tab", "@"], include_triggers: [], item: this.getAutoCompleteListItem}), this.mention_auto_complete.on("suggestion-box-selectcomplete", () => this.auto_completing = false); + }, submitNickname(e2) { + e2.preventDefault(); + const t2 = e2.target.nick.value.trim(); + t2 && this.model.join(t2); + }, onKeyDown(e2) { + if (!this.mention_auto_complete.onKeyDown(e2)) + return Uc.ChatBoxView.prototype.onKeyDown.call(this, e2); + }, onKeyUp(e2) { + return this.mention_auto_complete.evaluate(e2), Uc.ChatBoxView.prototype.onKeyUp.call(this, e2); + }, async onMessageRetractButtonClicked(e2) { + const t2 = zd("Be aware that other XMPP/Jabber clients (and servers) may not yet support retractions and that this message may not be removed everywhere."); + if (e2.mayBeRetracted()) { + const n2 = [zd("Are you sure you want to retract this message?")]; + Vc.settings.get("show_retraction_warning") && (n2[1] = t2), await Vc.confirm(zd("Confirm"), n2) && this.model.retractOwnMessage(e2); + } else if (await e2.mayBeModerated()) + if (e2.get("sender") === "me") { + let n2 = [zd("Are you sure you want to retract this message?")]; + Vc.settings.get("show_retraction_warning") && (n2 = [n2[0], t2, n2[1]]), await Vc.confirm(zd("Confirm"), n2) && this.retractOtherMessage(e2); + } else { + let n2 = [zd("You are about to retract this message."), zd("You may optionally include a message, explaining the reason for the retraction.")]; + Vc.settings.get("show_retraction_warning") && (n2 = [n2[0], t2, n2[1]]); + const r2 = await Vc.prompt(zd("Message Retraction"), n2, zd("Optional reason")); + r2 !== false && this.retractOtherMessage(e2, r2); + } + else { + const e3 = zd("Sorry, you're not allowed to retract this message"); + Vc.alert("error", zd("Error"), e3); + } + }, async retractOtherMessage(e2, t2) { + const n2 = await this.model.retractOtherMessage(e2, t2); + if (n2 === null) { + const e3 = zd("A timeout occurred while trying to retract the message"); + Vc.alert("error", zd("Error"), e3), zn(e3, Dw.LogLevel.WARN); + } else if (zw.isErrorStanza(n2)) { + const e3 = zd("Sorry, you're not allowed to retract this message."); + Vc.alert("error", zd("Error"), e3), zn(e3, Dw.LogLevel.WARN), zn(n2, Dw.LogLevel.WARN); + } + }, showModeratorToolsModal(e2) { + if (!this.verifyRoles(["moderator"])) + return; + let t2 = Vc.modal.get($y.id); + if (t2) + t2.model.set("affiliation", e2); + else { + const n2 = new qo({affiliation: e2}); + t2 = Vc.modal.create($y, {model: n2, _converse: Uc, chatroomview: this}); + } + t2.show(); + }, showRoomDetailsModal(e2) { + e2.preventDefault(), Vc.modal.show(dw, {model: this.model}, e2); + }, showOccupantDetailsModal(e2, t2) { + e2.preventDefault(), Vc.modal.show(Vy, {model: t2.occupant}, e2); + }, showChatStateNotification(e2) { + if (e2.get("sender") !== "me") + return Uc.ChatBoxView.prototype.showChatStateNotification.apply(this, arguments); + }, shouldShowSidebar() { + return !this.model.get("hidden_occupants") && this.model.session.get("connection_status") === rl.ROOMSTATUS.ENTERED; + }, onSidebarToggle() { + var e2; + this.renderToolbar(), (e2 = this.el.querySelector(".occupants")) === null || e2 === void 0 || e2.setVisibility(); + }, onOccupantAffiliationChanged(e2) { + e2.get("jid") === Uc.bare_jid && this.renderHeading(); + }, onOccupantRoleChanged(e2) { + e2.get("jid") === Uc.bare_jid && this.renderBottomPanel(); + }, getHeadingButtons(e2) { + const t2 = []; + t2.push({i18n_text: zd("Details"), i18n_title: zd("Show more information about this groupchat"), handler: (e3) => this.showRoomDetailsModal(e3), a_class: "show-muc-details-modal", icon_class: "fa-info-circle", name: "details"}), this.model.getOwnAffiliation() === "owner" && t2.push({i18n_text: zd("Configure"), i18n_title: zd("Configure this groupchat"), handler: (e3) => this.getAndRenderConfigurationForm(e3), a_class: "configure-chatroom-button", icon_class: "fa-wrench", name: "configure"}), this.model.invitesAllowed() && t2.push({i18n_text: zd("Invite"), i18n_title: zd("Invite someone to join this groupchat"), handler: (e3) => this.showInviteModal(e3), a_class: "open-invite-modal", icon_class: "fa-user-plus", name: "invite"}); + const n2 = this.model.get("subject"); + if (n2 && n2.text && t2.push({i18n_text: zd(e2 ? "Show topic" : "Hide topic"), i18n_title: zd(e2 ? "Show the topic message in the heading" : "Hide the topic in the heading"), handler: (e3) => this.toggleTopic(e3), a_class: "hide-topic", icon_class: "fa-minus-square", name: "toggle-topic"}), this.model.session.get("connection_status") === rl.ROOMSTATUS.ENTERED) { + const e3 = this.getAllowedCommands(); + e3.includes("modtools") && t2.push({i18n_text: zd("Moderate"), i18n_title: zd("Moderate this groupchat"), handler: () => this.showModeratorToolsModal(), a_class: "moderate-chatroom-button", icon_class: "fa-user-cog", name: "moderate"}), e3.includes("destroy") && t2.push({i18n_text: zd("Destroy"), i18n_title: zd("Remove this groupchat"), handler: (e4) => this.destroy(e4), a_class: "destroy-chatroom-button", icon_class: "fa-trash", name: "destroy"}); + } + return Vc.settings.get("singleton") || t2.push({i18n_text: zd("Leave"), i18n_title: zd("Leave and close this groupchat"), handler: async (e3) => { + e3.stopPropagation(); + const t3 = [zd("Are you sure you want to leave this groupchat?")]; + await Vc.confirm(zd("Confirm"), t3) && this.close(e3); + }, a_class: "close-chatbox-button", standalone: Vc.settings.get("view_mode") === "overlayed", icon_class: "fa-sign-out-alt", name: "signout"}), Uc.api.hook("getHeadingButtons", this, t2); + }, async generateHeadingTemplate() { + const e2 = await this.model.isSubjectHidden(), t2 = await this.getHeadingButtons(e2), n2 = t2.filter((e3) => e3.standalone), r2 = t2.filter((e3) => !e3.standalone); + return yw(Object.assign(this.model.toJSON(), {_converse: Uc, subject_hidden: e2, dropdown_btns: r2.map((e3) => this.getHeadingDropdownItem(e3)), standalone_btns: n2.map((e3) => this.getHeadingStandaloneButton(e3)), title: this.model.getDisplayName()})); + }, toggleTopic() { + this.model.toggleSubjectHiddenState(); + }, showInviteModal(e2) { + e2.preventDefault(), Vc.modal.show(fy, {model: new qo(), chatroomview: this}, e2); + }, afterShown() { + zw.isPersistableModel(this.model) && this.model.clearUnreadMsgCounter(), this.scrollDown(); + }, onConnectionStatusChanged() { + const e2 = this.model.session.get("connection_status"); + e2 === rl.ROOMSTATUS.NICKNAME_REQUIRED ? this.renderNicknameForm() : e2 === rl.ROOMSTATUS.PASSWORD_REQUIRED ? this.renderPasswordForm() : e2 === rl.ROOMSTATUS.CONNECTING ? this.showSpinner() : e2 === rl.ROOMSTATUS.ENTERED ? (this.renderBottomPanel(), this.hideSpinner(), this.maybeFocus()) : e2 === rl.ROOMSTATUS.DISCONNECTED ? this.showDisconnectMessage() : e2 === rl.ROOMSTATUS.DESTROYED && this.showDestroyedMessage(); + }, getToolbarOptions() { + return Object.assign(Uc.ChatBoxView.prototype.getToolbarOptions.apply(this, arguments), {is_groupchat: true, label_hide_occupants: zd("Hide the list of participants"), show_occupants_toggle: Uc.visible_toolbar_buttons.toggle_occupants}); + }, async close() { + return this.hide(), Uc.router.history.getFragment() === "converse/room?jid=" + this.model.get("jid") && Uc.router.navigate(""), await this.model.leave(), Uc.ChatBoxView.prototype.close.apply(this, arguments); + }, hideOccupants(e2) { + e2 && (e2.preventDefault(), e2.stopPropagation()), this.model.save({hidden_occupants: true}), this.scrollDown(); + }, verifyRoles(e2, t2, n2 = true) { + if (!Array.isArray(e2)) + throw new TypeError("roles must be an Array"); + if (!e2.length) + return true; + if (t2 = t2 || this.model.occupants.findWhere({jid: Uc.bare_jid})) { + const n3 = t2.get("role"); + if (e2.includes(n3)) + return true; + } + if (n2) { + const e3 = zd("Forbidden: you do not have the necessary role in order to do that."); + this.model.createMessage({message: e3, type: "error"}); + } + return false; + }, verifyAffiliations(e2, t2, n2 = true) { + if (!Array.isArray(e2)) + throw new TypeError("affiliations must be an Array"); + if (!e2.length) + return true; + if (t2 = t2 || this.model.occupants.findWhere({jid: Uc.bare_jid})) { + const n3 = t2.get("affiliation"); + if (e2.includes(n3)) + return true; + } + if (n2) { + const e3 = zd("Forbidden: you do not have the necessary affiliation in order to do that."); + this.model.createMessage({message: e3, type: "error"}); + } + return false; + }, validateRoleOrAffiliationChangeArgs(e2, t2) { + if (!t2) { + const t3 = zd(`Error: the "%1$s" command takes two arguments, the user's nickname and optionally a reason.`, e2); + return this.model.createMessage({message: t3, type: "error"}), false; + } + return true; + }, getNickOrJIDFromCommandArgs(e2) { + if (zw.isValidJID(e2.trim())) + return e2.trim(); + e2.startsWith("@") || (e2 = "@" + e2); + const [t2, n2] = this.model.parseTextForReferences(e2); + if (!n2.length) { + const e3 = zd("Error: couldn't find a groupchat participant based on your arguments"); + return void this.model.createMessage({message: e3, type: "error"}); + } + if (n2.length > 1) { + const e3 = zd("Error: found multiple groupchat participant based on your arguments"); + return void this.model.createMessage({message: e3, type: "error"}); + } + const r2 = n2.pop().value, i2 = e2.split(r2, 2)[1]; + if (!i2 || i2.startsWith(" ")) + return r2; + { + const e3 = zd("Error: couldn't find a groupchat participant based on your arguments"); + this.model.createMessage({message: e3, type: "error"}); + } + }, setAffiliation(e2, t2, n2) { + const r2 = $w[e2]; + if (!r2) + throw Error("ChatRoomView#setAffiliation called with invalid command: ".concat(e2)); + if (!this.verifyAffiliations(n2)) + return false; + if (!this.validateRoleOrAffiliationChangeArgs(e2, t2)) + return false; + const i2 = this.getNickOrJIDFromCommandArgs(t2); + if (!i2) + return false; + let o2; + const s2 = t2.split(i2, 2)[1].trim(), a2 = this.model.getOccupant(i2); + if (a2) + o2 = a2.get("jid"); + else { + if (!zw.isValidJID(i2)) { + const e3 = zd("Couldn't find a participant with that nickname. They might have left the groupchat."); + return void this.model.createMessage({message: e3, type: "error"}); + } + o2 = i2; + } + const c2 = {jid: o2, reason: s2}; + a2 && Vc.settings.get("auto_register_muc_nickname") && (c2.nick = a2.get("nick")), this.model.setAffiliation(r2, [c2]).then(() => this.model.occupants.fetchMembers()).catch((e3) => this.onCommandError(e3)); + }, getReason: (e2) => e2.includes(",") ? e2.slice(e2.indexOf(",") + 1).trim() : null, setRole(e2, t2, n2 = [], r2 = []) { + const i2 = Uw[e2]; + if (!i2) + throw Error("ChatRoomView#setRole called with invalid command: ".concat(e2)); + if (!this.verifyAffiliations(n2) || !this.verifyRoles(r2)) + return false; + if (!this.validateRoleOrAffiliationChangeArgs(e2, t2)) + return false; + const o2 = this.getNickOrJIDFromCommandArgs(t2); + if (!o2) + return false; + const s2 = t2.split(o2, 2)[1].trim(), a2 = this.model.getOccupant(o2); + return this.model.setRole(a2, i2, s2, void 0, this.onCommandError.bind(this)), true; + }, onCommandError(e2) { + zn.fatal(e2); + const t2 = zd("Sorry, an error happened while running the command.") + " " + zd("Check your browser's developer console for details."); + this.model.createMessage({message: t2, type: "error"}); + }, getAllowedCommands() { + let e2 = ["clear", "help", "me", "nick", "register"]; + (this.model.config.get("changesubject") || ["owner", "admin"].includes(this.model.getOwnAffiliation())) && (e2 = [...e2, "subject", "topic"]); + const t2 = this.model.occupants.findWhere({jid: Uc.bare_jid}); + return this.verifyAffiliations(["owner"], t2, false) ? e2 = e2.concat(Fw).concat(Bw) : this.verifyAffiliations(["admin"], t2, false) && (e2 = e2.concat(Bw)), this.verifyRoles(["moderator"], t2, false) ? e2 = e2.concat(qw).concat(Hw) : this.verifyRoles(["visitor", "participant", "moderator"], t2, false) || (e2 = e2.concat(Hw)), e2.sort(), Array.isArray(Vc.settings.get("muc_disable_slash_commands")) ? e2.filter((e3) => !Vc.settings.get("muc_disable_slash_commands").includes(e3)) : e2; + }, async destroy() { + const e2 = [zd("Are you sure you want to destroy this groupchat?")]; + let t2 = [{name: "challenge", label: zd("Please enter the XMPP address of this groupchat to confirm"), challenge: this.model.get("jid"), placeholder: zd("name@example.org"), required: true}, {name: "reason", label: zd("Optional reason for destroying this groupchat"), placeholder: zd("Reason")}, {name: "newjid", label: zd("Optional XMPP address for a new groupchat that replaces this one"), placeholder: zd("replacement@example.org")}]; + try { + var n2, r2; + t2 = await Vc.confirm(zd("Confirm"), e2, t2); + const i2 = (n2 = t2.filter((e3) => e3.name === "reason").pop()) === null || n2 === void 0 ? void 0 : n2.value, o2 = (r2 = t2.filter((e3) => e3.name === "newjid").pop()) === null || r2 === void 0 ? void 0 : r2.value; + return this.model.sendDestroyIQ(i2, o2).then(() => this.close()); + } catch (e3) { + zn.error(e3); + } + }, parseMessageForCommands(e2) { + if (Vc.settings.get("muc_disable_slash_commands") && !Array.isArray(Vc.settings.get("muc_disable_slash_commands"))) + return Uc.ChatBoxView.prototype.parseMessageForCommands.apply(this, arguments); + const t2 = ((e2 = e2.replace(/^\s*/, "")).match(/^\/([a-zA-Z]*) ?/) || [""]).pop().toLowerCase(); + if (!t2) + return false; + const n2 = e2.slice(("/" + t2).length + 1).trim(); + if (!this.getAllowedCommands().includes(t2)) + return false; + switch (t2) { + case "admin": + this.setAffiliation(t2, n2, ["owner"]); + break; + case "ban": + this.setAffiliation(t2, n2, ["admin", "owner"]); + break; + case "modtools": + this.showModeratorToolsModal(n2); + break; + case "deop": + this.setRole(t2, n2, ["admin", "owner"]); + break; + case "destroy": + if (!this.verifyAffiliations(["owner"])) + break; + this.destroy().catch((e3) => this.onCommandError(e3)); + break; + case "help": + this.model.set({show_help_messages: true}); + break; + case "kick": + case "mute": + this.setRole(t2, n2, [], ["moderator"]); + break; + case "member": + this.setAffiliation(t2, n2, ["admin", "owner"]); + break; + case "nick": + if (!this.verifyRoles(["visitor", "participant", "moderator"])) + break; + if (n2.length === 0) { + const e3 = zd('Your nickname is "%1$s"', this.model.get("nick")); + this.model.createMessage({message: e3, type: "error"}); + } else { + const e3 = Dw.getBareJidFromJid(this.model.get("jid")); + Vc.send(Lw({from: Uc.connection.jid, to: "".concat(e3, "/").concat(n2), id: zw.getUniqueId()}).tree()); + } + break; + case "owner": + this.setAffiliation(t2, n2, ["owner"]); + break; + case "op": + this.setRole(t2, n2, ["admin", "owner"]); + break; + case "register": + n2.length > 1 ? this.model.createMessage({message: zd("Error: invalid number of arguments"), type: "error"}) : this.model.registerNickname().then((e3) => { + e3 && this.model.createMessage({message: e3, type: "error"}); + }); + break; + case "revoke": + this.setAffiliation(t2, n2, ["admin", "owner"]); + break; + case "topic": + case "subject": + this.model.setSubject(n2); + break; + case "voice": + this.setRole(t2, n2, [], ["moderator"]); + break; + default: + return Uc.ChatBoxView.prototype.parseMessageForCommands.apply(this, arguments); + } + return true; + }, renderConfigurationForm(e2) { + if (this.hideChatRoomContents(), this.model.save("config_stanza", e2.outerHTML), !this.config_form) { + this.config_form = new Uc.MUCConfigForm({model: this.model, chatroomview: this}), this.el.querySelector(".chatroom-body").insertAdjacentElement("beforeend", this.config_form.el); + } + zw.showElement(this.config_form.el); + }, renderNicknameForm() { + const e2 = ((e3) => { + const t2 = zd("Nickname"), n2 = zd("Enter groupchat"), r2 = Vc.settings.get("muc_show_logs_before_join") ? zd("Choose a nickname to enter") : zd("Please choose your nickname"); + return Za(Rw(), r2, e3.nickname_validation_message, e3.nick || "", e3.nickname_validation_message ? "error" : "", t2, n2); + })(this.model.toJSON()); + if (Vc.settings.get("muc_show_logs_before_join")) { + const t2 = this.el.querySelector(".muc-bottom-panel"); + Ya(e2, t2), zw.addClass("muc-bottom-panel--nickname", t2); + } else { + const t2 = this.el.querySelector(".muc-nickname-form"), n2 = zw.getElementFromTemplateResult(e2); + if (t2) + Pw(".spinner", this.el).forEach(zw.removeElement), t2.outerHTML = n2.outerHTML; + else { + this.hideChatRoomContents(), this.el.querySelector(".chatroom-body").insertAdjacentElement("beforeend", n2); + } + } + zw.safeSave(this.model.session, {connection_status: rl.ROOMSTATUS.NICKNAME_REQUIRED}); + }, closeForm() { + Pw(".chatroom-form-container", this.el).forEach((e2) => zw.addClass("hidden", e2)), this.renderAfterTransition(); + }, getAndRenderConfigurationForm() { + this.config_form && zw.isVisible(this.config_form.el) ? this.closeForm() : (this.showSpinner(), this.model.fetchRoomConfiguration().then((e2) => this.renderConfigurationForm(e2)).catch((e2) => zn.error(e2))); + }, hideChatRoomContents() { + const e2 = this.el.querySelector(".chatroom-body"); + e2 !== null && [].forEach.call(e2.children, (e3) => e3.classList.add("hidden")); + }, renderPasswordForm() { + this.hideChatRoomContents(); + const e2 = this.model.get("password_validation_message"); + if (this.model.save("password_validation_message", void 0), this.password_form) + this.password_form.model.set("validation_message", e2); + else { + this.password_form = new Uc.MUCPasswordForm({model: new qo({validation_message: e2}), chatroomview: this}), this.el.querySelector(".chatroom-body").insertAdjacentElement("beforeend", this.password_form.el); + } + zw.showElement(this.password_form.el), this.model.session.save("connection_status", rl.ROOMSTATUS.PASSWORD_REQUIRED); + }, showDestroyedMessage() { + zw.hideElement(this.el.querySelector(".chat-area")), zw.hideElement(this.el.querySelector(".occupants")), Pw(".spinner", this.el).forEach(zw.removeElement); + const e2 = this.model.get("destroyed_reason"), t2 = this.model.get("moved_jid"); + this.model.save({destroyed_reason: void 0, moved_jid: void 0}); + const n2 = this.el.querySelector(".disconnect-container"); + Ya(kw(t2, e2), n2); + const r2 = n2.querySelector("a.switch-chat"); + r2 && r2.addEventListener("click", async (e3) => { + e3.preventDefault(), (await Vc.rooms.get(t2, null, true)).maybeShow(true), this.model.destroy(); + }), zw.showElement(n2); + }, showDisconnectMessage() { + const e2 = this.model.get("disconnection_message"); + if (!e2) + return; + zw.hideElement(this.el.querySelector(".chat-area")), zw.hideElement(this.el.querySelector(".occupants")), Pw(".spinner", this.el).forEach(zw.removeElement); + const t2 = [e2], n2 = this.model.get("disconnection_actor"); + n2 && t2.push(zd("This action was done by %1$s.", n2)); + const r2 = this.model.get("disconnection_reason"); + r2 && t2.push(zd('The reason given is: "%1$s".', r2)), this.model.save({disconnection_message: void 0, disconnection_reason: void 0, disconnection_actor: void 0}); + const i2 = this.el.querySelector(".disconnect-container"); + Ya(((e3) => Za(Iw(), e3[0], e3.slice(1).map((e4) => Za(Nw(), e4))))(t2), i2), zw.showElement(i2); + }, onOccupantAdded(e2) { + e2.get("jid") === Uc.bare_jid && (this.renderHeading(), this.renderBottomPanel()); + }, getPreviousJoinOrLeaveNotification(e2, t2) { + const n2 = new Date().toISOString().split("T")[0]; + for (; e2 !== null; ) { + var r2; + if (!e2.classList.contains("chat-info")) + return; + const i2 = e2.getAttribute("data-isodate"); + if (i2 && i2.split("T")[0] !== n2) + return; + const o2 = ((r2 = e2) === null || r2 === void 0 ? void 0 : r2.dataset) || {}; + if (o2.join === t2 || o2.leave === t2 || o2.leavejoin === t2 || o2.joinleave === t2) + return e2; + e2 = e2.previousElementSibling; + } + }, renderAfterTransition() { + const e2 = this.model.session.get("connection_status"); + if (e2 == rl.ROOMSTATUS.NICKNAME_REQUIRED) + this.renderNicknameForm(); + else if (e2 == rl.ROOMSTATUS.PASSWORD_REQUIRED) + this.renderPasswordForm(); + else if (e2 == rl.ROOMSTATUS.ENTERED) { + var t2; + this.hideChatRoomContents(), zw.showElement(this.el.querySelector(".chat-area")), (t2 = this.el.querySelector(".occupants")) === null || t2 === void 0 || t2.setVisibility(), this.scrollDown(); + } + }, showSpinner() { + Pw(".spinner", this.el).forEach(zw.removeElement), this.hideChatRoomContents(), this.el.querySelector(".chatroom-body").insertAdjacentElement("afterbegin", zw.getElementFromTemplateResult(fp())); + }, hideSpinner() { + const e2 = this.el.querySelector(".spinner"); + return e2 !== null && (zw.removeElement(e2), this.renderAfterTransition()), this; + }}, Gw = {roomviews: {get(e2) { + if (Array.isArray(e2)) { + return Vc.chatviews.get(e2).filter((e3) => e3.model.get("type") === Uc.CHATROOMS_TYPE); + } + { + const t2 = Vc.chatviews.get(e2); + return t2.model.get("type") === Uc.CHATROOMS_TYPE ? t2 : null; + } + }, close(e2) { + let t2; + return e2 === void 0 ? t2 = Uc.chatboxviews : typeof e2 == "string" ? t2 = [Uc.chatboxviews.get(e2)].filter((e3) => e3) : Array.isArray(e2) && (t2 = e2.map((e3) => Uc.chatboxviews.get(e3))), Promise.all(t2.map((e3) => e3.is_chatroom && e3.model && e3.close())); + }}}; + function Vw() { + const e2 = Yw(['<div class="form-group">', "</div>"]); + return Vw = function() { + return e2; + }, e2; + } + function Jw() { + const e2 = Yw(['<label class="roomid-policy-error">', "</label>"]); + return Jw = function() { + return e2; + }, e2; + } + function Xw() { + const e2 = Yw(['\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title" id="add-chatroom-modal-label">', "</h5>\n ", '\n </div>\n <div class="modal-body">\n <span class="modal-alert"></span>\n <form class="converse-form add-chatroom">\n <div class="form-group">\n <label for="chatroom">', ":</label>\n ", '\n <input type="text" required="required" name="chatroom" class="form-control roomjid-input" placeholder="', '"/>\n </div>\n ', "\n ", '\n <input type="submit" class="btn btn-primary" name="join" value="', '" ?disabled=', ">\n </form>\n </div>\n </div>\n </div>\n "]); + return Xw = function() { + return e2; + }, e2; + } + function Qw() { + const e2 = Yw(['\n <div class="form-group" >\n <label for="nickname">', ':</label>\n <input type="text" title="', '" required="required" name="nickname" value="', '" class="form-control"/>\n </div>\n ']); + return Qw = function() { + return e2; + }, e2; + } + function Yw(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + var Kw = (e2) => { + const t2 = zd("Join"), n2 = zd("Enter a new Groupchat"); + return Za(Xw(), n2, mf, e2.label_room_address, e2.muc_roomid_policy_error_msg ? Za(Jw(), e2.muc_roomid_policy_error_msg) : "", e2.chatroom_placeholder, e2.muc_roomid_policy_hint ? Za(Vw(), Kp(Qp.a.filterXSS(e2.muc_roomid_policy_hint, {whiteList: {b: [], br: [], em: []}}))) : "", e2._converse.locked_muc_nickname ? "" : ((e3) => { + const t3 = zd("Nickname"), n3 = zd("This field is required"); + return Za(Qw(), t3, n3, e3.nick || ""); + })(e2), t2 || "", e2.muc_roomid_policy_error_msg); + }, Zw = n(24); + const eS = rl.env.utils; + var tS = df.extend({persistent: true, id: "add-chatroom-modal", events: {"submit form.add-chatroom": "openChatRoom", "keyup .roomjid-input": "checkRoomidPolicy", "change .roomjid-input": "checkRoomidPolicy"}, initialize() { + df.prototype.initialize.apply(this, arguments), this.listenTo(this.model, "change:muc_domain", this.render), this.muc_roomid_policy_error_msg = null; + }, toHTML() { + let e2 = ""; + if (!Vc.settings.get("locked_muc_domain")) { + const t2 = this.model.get("muc_domain") || Vc.settings.get("muc_domain"); + e2 = t2 ? "name@".concat(t2) : zd("name@conference.example.org"); + } + return Kw(Object.assign(this.model.toJSON(), {_converse: Uc, label_room_address: Vc.settings.get("muc_domain") ? zd("Groupchat name") : zd("Groupchat address"), chatroom_placeholder: e2, muc_roomid_policy_error_msg: this.muc_roomid_policy_error_msg, muc_roomid_policy_hint: Vc.settings.get("muc_roomid_policy_hint")})); + }, afterRender() { + this.el.addEventListener("shown.bs.modal", () => { + this.el.querySelector('input[name="chatroom"]').focus(); + }, false); + }, parseRoomDataFromEvent(e2) { + const t2 = new FormData(e2), n2 = t2.get("chatroom"); + let r2; + if (Vc.settings.get("locked_muc_nickname")) { + if (r2 = Uc.getDefaultMUCNickname(), !r2) + throw new Error("Using locked_muc_nickname but no nickname found!"); + } else + r2 = t2.get("nickname").trim(); + return {jid: n2, nick: r2}; + }, openChatRoom(e2) { + e2.preventDefault(); + const t2 = this.parseRoomDataFromEvent(e2.target); + let n2; + t2.nick === "" && (t2.nick = void 0), Vc.settings.get("locked_muc_domain") || Vc.settings.get("muc_domain") && !eS.isValidJID(t2.jid) ? n2 = "".concat(Zw.b.escapeNode(t2.jid), "@").concat(Vc.settings.get("muc_domain")) : (n2 = t2.jid, this.model.setDomain(n2)), Vc.rooms.open(n2, Object.assign(t2, {jid: n2}), true), this.modal.hide(), e2.target.reset(); + }, checkRoomidPolicy() { + if (Vc.settings.get("muc_roomid_policy") && Vc.settings.get("muc_domain")) { + let e2 = this.el.querySelector(".roomjid-input").value; + !rl.locked_muc_domain && eS.isValidJID(e2) || (e2 = "".concat(Zw.b.escapeNode(e2), "@").concat(Vc.settings.get("muc_domain"))); + const t2 = Zw.b.getNodeFromJid(e2), n2 = Zw.b.getDomainFromJid(e2); + Vc.settings.get("muc_domain") !== n2 || Vc.settings.get("muc_roomid_policy").test(t2) ? this.muc_roomid_policy_error_msg = null : this.muc_roomid_policy_error_msg = zd("Groupchat id is invalid."), this.render(); + } + }}); + function nS() { + const e2 = function(e3, t2) { + t2 || (t2 = e3.slice(0)); + return Object.freeze(Object.defineProperties(e3, {raw: {value: Object.freeze(t2)}})); + }(['\n <div class="d-flex controlbox-padded">\n <span class="w-100 controlbox-heading controlbox-heading--groupchats">', '</span>\n <a class="controlbox-heading__btn show-list-muc-modal fa fa-list-ul" title="', '" data-toggle="modal" data-target="#muc-list-modal"></a>\n <a class="controlbox-heading__btn show-add-muc-modal fa fa-plus" title="', '" data-toggle="modal" data-target="#add-chatrooms-modal"></a>\n </div>\n <div class="list-container list-container--openrooms hidden"></div>\n <div class="list-container list-container--bookmarks hidden"></div>']); + return nS = function() { + return e2; + }, e2; + } + function rS() { + const e2 = cS(['<li class="list-group-item active">', "</li>"]); + return rS = function() { + return e2; + }, e2; + } + function iS() { + const e2 = cS(['<li class="list-group-item"> ', " </li>"]); + return iS = function() { + return e2; + }, e2; + } + function oS() { + const e2 = cS(['\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title" id="muc-list-modal-label">', "</h5>\n ", '\n </div>\n <div class="modal-body d-flex flex-column">\n <span class="modal-alert"></span>\n ', '\n <ul class="available-chatrooms list-group">\n ', "\n ", "\n ", '\n </ul>\n </div>\n <div class="modal-footer">', "</div>\n </div>\n </div>\n "]); + return oS = function() { + return e2; + }, e2; + } + function sS() { + const e2 = cS(['\n <li class="room-item list-group-item">\n <div class="available-chatroom d-flex flex-row">\n <a class="open-room available-room w-100"\n @click=', '\n data-room-jid="', '"\n data-room-name="', '"\n title="', '"\n href="#">', '</a>\n <a class="right room-info icon-room-info"\n @click=', '\n data-room-jid="', '"\n title="', '"\n href="#"></a>\n </div>\n </li>\n ']); + return sS = function() { + return e2; + }, e2; + } + function aS() { + const e2 = cS(['\n <form class="converse-form list-chatrooms"\n @submit=', '>\n <div class="form-group">\n <label for="chatroom">', ':</label>\n <input type="text"\n @change=', '\n value="', '"\n required="required"\n name="server"\n class="form-control"\n placeholder="', '"/>\n </div>\n <input type="submit" class="btn btn-primary" name="list" value="', '"/>\n </form>\n ']); + return aS = function() { + return e2; + }, e2; + } + function cS(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + var lS = (e2) => { + const t2 = zd("Query for Groupchats"); + return Za(oS(), t2, mf, e2.show_form ? ((e3) => { + const t3 = zd("Show groupchats"), n2 = zd("Server address"); + return Za(aS(), e3.submitForm, n2, e3.setDomainFromEvent, e3.muc_domain || "", e3.server_placeholder, t3); + })(e2) : "", e2.loading_items ? Za(iS(), fp()) : "", e2.feedback_text ? Za(rS(), e2.feedback_text) : "", qp(e2.items, (e3) => e3.jid, (t3) => ((e3, t4) => { + const n2 = zd("Show more information on this groupchat"), r2 = zd("Click to open this groupchat"); + return Za(sS(), e3.openRoom, t4.jid, t4.name, r2, t4.name || t4.jid, e3.toggleRoomInfo, t4.jid, n2); + })(e2, t3)), gf); + }, uS = n(179), dS = n.n(uS); + const hS = rl.env.utils; + function fS(e2) { + const t2 = hS.ancestor(e2.target, ".room-item"), n2 = t2.querySelector("div.room-info"); + n2 ? (hS.slideIn(n2).then(hS.removeElement), t2.querySelector("a.room-info").classList.remove("selected")) : (t2.insertAdjacentElement("beforeend", hS.getElementFromTemplateResult(fp())), Vc.disco.info(e2.target.getAttribute("data-room-jid"), null).then((e3) => function(e4, t3) { + var n3, r2; + e4.querySelector("span.spinner").remove(), e4.querySelector("a.room-info").classList.add("selected"), e4.insertAdjacentHTML("beforeEnd", dS()({jid: t3.getAttribute("from"), desc: (n3 = Kg(mr()('field[var="muc#roominfo_description"] value', t3))) === null || n3 === void 0 ? void 0 : n3.textContent, occ: (r2 = Kg(mr()('field[var="muc#roominfo_occupants"] value', t3))) === null || r2 === void 0 ? void 0 : r2.textContent, hidden: mr()('feature[var="muc_hidden"]', t3).length, membersonly: mr()('feature[var="muc_membersonly"]', t3).length, moderated: mr()('feature[var="muc_moderated"]', t3).length, nonanonymous: mr()('feature[var="muc_nonanonymous"]', t3).length, open: mr()('feature[var="muc_open"]', t3).length, passwordprotected: mr()('feature[var="muc_passwordprotected"]', t3).length, persistent: mr()('feature[var="muc_persistent"]', t3).length, publicroom: mr()('feature[var="muc_publicroom"]', t3).length, semianonymous: mr()('feature[var="muc_semianonymous"]', t3).length, temporary: mr()('feature[var="muc_temporary"]', t3).length, unmoderated: mr()('feature[var="muc_unmoderated"]', t3).length, label_desc: zd("Description:"), label_jid: zd("Groupchat Address (JID):"), label_occ: zd("Participants:"), label_features: zd("Features:"), label_requires_auth: zd("Requires authentication"), label_hidden: zd("Hidden"), label_requires_invite: zd("Requires an invitation"), label_moderated: zd("Moderated"), label_non_anon: zd("Non-anonymous"), label_open_room: zd("Open"), label_permanent_room: zd("Permanent"), label_public: zd("Public"), label_semi_anon: zd("Semi-anonymous"), label_temp_room: zd("Temporary"), label_unmoderated: zd("Unmoderated")})); + }(t2, e3)).catch((e3) => zn.error(e3))); + } + var pS = df.extend({id: "muc-list-modal", persistent: true, initialize() { + this.items = [], this.loading_items = false, df.prototype.initialize.apply(this, arguments), Vc.settings.get("muc_domain") && !this.model.get("muc_domain") && this.model.save("muc_domain", Vc.settings.get("muc_domain")), this.listenTo(this.model, "change:muc_domain", this.onDomainChange), this.el.addEventListener("shown.bs.modal", () => Vc.settings.get("locked_muc_domain") ? this.updateRoomsList() : this.el.querySelector('input[name="server"]').focus()); + }, toHTML() { + const e2 = this.model.get("muc_domain") || Vc.settings.get("muc_domain"); + return lS(Object.assign(this.model.toJSON(), {show_form: !Vc.settings.get("locked_muc_domain"), server_placeholder: e2 || zd("conference.example.org"), items: this.items, loading_items: this.loading_items, openRoom: (e3) => this.openRoom(e3), setDomainFromEvent: (e3) => this.setDomainFromEvent(e3), submitForm: (e3) => this.showRooms(e3), toggleRoomInfo: (e3) => this.toggleRoomInfo(e3)})); + }, openRoom(e2) { + e2.preventDefault(); + const t2 = e2.target.getAttribute("data-room-jid"), n2 = e2.target.getAttribute("data-room-name"); + this.modal.hide(), Vc.rooms.open(t2, {name: n2}, true); + }, toggleRoomInfo(e2) { + e2.preventDefault(), fS(e2); + }, onDomainChange() { + Vc.settings.get("auto_list_rooms") && this.updateRoomsList(); + }, onRoomsFound(e2) { + this.loading_items = false; + const t2 = e2 ? mr()("query item", e2) : []; + return t2.length ? (this.model.set({feedback_text: zd("Groupchats found")}, {silent: true}), this.items = t2.map(ps.getAttributes)) : (this.items = [], this.model.set({feedback_text: zd("No groupchats found")}, {silent: true})), this.render(), true; + }, updateRoomsList() { + const e2 = Object(Zw.a)({to: this.model.get("muc_domain"), from: Uc.connection.jid, type: "get"}).c("query", {xmlns: Zw.b.NS.DISCO_ITEMS}); + Vc.sendIQ(e2).then((e3) => this.onRoomsFound(e3)).catch(() => this.onRoomsFound()); + }, showRooms(e2) { + e2.preventDefault(), this.loading_items = true, this.render(); + const t2 = new FormData(e2.target); + this.model.setDomain(t2.get("server")), this.updateRoomsList(); + }, setDomainFromEvent(e2) { + this.model.setDomain(e2.target.value); + }, setNick(e2) { + this.model.save({nick: e2.target.value}); + }}); + const gS = rl.env.utils, mS = eh.extend({tagName: "div", className: "controlbox-section", id: "chatrooms", events: {"click a.controlbox-heading__btn.show-add-muc-modal": "showAddRoomModal", "click a.controlbox-heading__btn.show-list-muc-modal": "showMUCListModal"}, toHTML() { + return e2 = {heading_chatrooms: zd("Groupchats"), title_new_room: zd("Add a new groupchat"), title_list_rooms: zd("Query for groupchats")}, Za(nS(), e2.heading_chatrooms, e2.title_list_rooms, e2.title_new_room); + var e2; + }, showAddRoomModal(e2) { + Vc.modal.show(tS, {model: this.model}, e2); + }, showMUCListModal(e2) { + Vc.modal.show(pS, {model: this.model}, e2); + }}), vS = {renderRoomsPanel() { + if (this.roomspanel && gS.isInDOM(this.roomspanel.el)) + return this.roomspanel; + const e2 = "converse.roomspanel".concat(Uc.bare_jid); + return this.roomspanel = new Uc.RoomsPanel({model: new (Uc.RoomsPanelModel.extend({id: e2, browserStorage: Uc.createStore(e2)}))()}), this.roomspanel.model.fetch(), this.el.querySelector(".controlbox-pane").insertAdjacentElement("beforeEnd", this.roomspanel.render().el), Vc.trigger("roomsPanelRendered"), this.roomspanel; + }, getRoomsPanel() { + return this.roomspanel && gS.isInDOM(this.roomspanel.el) ? this.roomspanel : this.renderRoomsPanel(); + }}, {Strophe: _S} = rl.env; + function bS(e2, t2) { + t2.getRoomsPanel().model.save("muc_domain", _S.getDomainFromJid(e2)); + } + function yS(e2) { + e2.model.get("connected") && (e2.getRoomsPanel().model.get("muc_domain") || (Vc.settings.get("muc_domain") === void 0 ? function(e3) { + function t2(t3) { + t3 && t3.get("var") === _S.NS.MUC && t3.entity.getIdentity("conference", "text").then((n2) => { + n2 && bS(t3.get("from"), e3); + }); + } + Vc.waitUntil("discoInitialized").then(() => { + Vc.listen.on("serviceDiscovered", t2), Uc.disco_entities.each((e4) => t2(e4.features.findWhere({var: _S.NS.MUC}))); + }).catch((e4) => zn.error(e4)); + }(e2) : bS(Vc.settings.get("muc_domain"), e2))); + } + function wS(e2) { + e2.preventDefault(), Vc.rooms.open(e2.target.href); + } + async function SS(e2) { + const t2 = Uc.chatboxviews; + if (!t2.get(e2.get("id")) && e2.get("type") === Uc.CHATROOMS_TYPE && e2.isValid()) + return await e2.initialized, t2.add(e2.get("id"), new Uc.ChatRoomView({model: e2})); + } + rl.plugins.add("converse-muc-views", {dependencies: ["converse-autocomplete", "converse-modal", "converse-controlbox", "converse-chatview"], overrides: {ControlBoxView: {renderControlBoxPane() { + this.__super__.renderControlBoxPane.apply(this, arguments), Vc.settings.get("allow_muc") && this.renderRoomsPanel(); + }}}, initialize() { + const {_converse: e2} = this; + Vc.promises.add(["roomsPanelRendered"]), Vc.settings.extend({auto_list_rooms: false, cache_muc_messages: true, locked_muc_nickname: false, modtools_disable_query: [], modtools_disable_assign: false, muc_disable_slash_commands: false, muc_mention_autocomplete_filter: "contains", muc_mention_autocomplete_min_chars: 0, muc_mention_autocomplete_show_avatar: true, muc_roomid_policy: null, muc_roomid_policy_hint: null, roomconfig_whitelist: [], show_retraction_warning: true, visible_toolbar_buttons: {toggle_occupants: true}}), e2.MUCConfigForm = sy, e2.MUCPasswordForm = cy, e2.ChatRoomView = e2.ChatBoxView.extend(Ww), e2.RoomsPanel = mS, e2.ControlBoxView && Object.assign(e2.ControlBoxView.prototype, vS), Object.assign(e2.api, Gw), Vc.listen.on("chatBoxViewsInitialized", () => { + e2.chatboxviews.delegate("click", "a.open-chatroom", wS), e2.chatboxes.on("add", SS); + }), Vc.listen.on("clearSession", () => { + const t2 = e2.chatboxviews.get("controlbox"); + t2 && t2.roomspanel && (t2.roomspanel.model.destroy(), t2.roomspanel.remove(), delete t2.roomspanel); + }), Vc.listen.on("controlBoxInitialized", (e3) => { + Vc.settings.get("allow_muc") && (yS(e3), e3.model.on("change:connected", () => yS(e3))); + }); + }}); + var xS = {className: "chatbox headlines hidden", events: {"click .close-chatbox-button": "close", "click .toggle-chatbox-button": "minimize", "keypress textarea.chat-textarea": "onKeyDown"}, async initialize() { + this.initDebounced(), this.model.disable_mam = true, this.listenTo(this.model, "change:hidden", (e2) => e2.get("hidden") ? this.hide() : this.show()), this.listenTo(this.model, "destroy", this.remove), this.listenTo(this.model, "show", this.show), this.render(), this.listenTo(this.model.messages, "add", this.onMessageAdded), this.listenTo(this.model.messages, "remove", this.renderChatHistory), this.listenTo(this.model.messages, "rendered", this.maybeScrollDown), this.listenTo(this.model.messages, "reset", this.renderChatHistory), await this.model.messages.fetched, this.insertIntoDOM(), this.model.maybeShow(), this.scrollDown(), Vc.trigger("headlinesBoxViewInitialized", this); + }, render() { + this.el.setAttribute("id", this.model.get("box_id")); + const e2 = Qv(Object.assign(this.model.toJSON(), {info_close: "", label_personal_message: "", show_send_button: false, show_toolbar: false, unread_msgs: ""})); + return Ya(e2, this.el), this.content = this.el.querySelector(".chat-content"), this.msgs_container = this.el.querySelector(".chat-content__messages"), this.renderChatContent(), this.renderHeading(), this; + }, getNotifications: () => [], getHeadingButtons() { + const e2 = []; + return Vc.settings.get("singleton") || e2.push({a_class: "close-chatbox-button", handler: (e3) => this.close(e3), i18n_text: zd("Close"), i18n_title: zd("Close these announcements"), icon_class: "fa-times", name: "close", standalone: Vc.settings.get("view_mode") === "overlayed"}), Uc.api.hook("getHeadingButtons", this, e2); + }, renderMessageForm: function() { + }, afterShown: function() { + }}; + function ES() { + const e2 = CS(['\n <div class="list-container list-container--headline ', '">\n <div class="items-list rooms-list headline-list">\n ', "\n </div>\n </div>\n"]); + return ES = function() { + return e2; + }, e2; + } + function AS() { + const e2 = CS(['\n <div class="list-item controlbox-padded d-flex flex-row"\n data-headline-jid="', '">\n <a class="list-item-link open-headline available-room w-100"\n data-headline-jid="', '"\n title="', '" href="#">', "</a>\n </div>\n"]); + return AS = function() { + return e2; + }, e2; + } + function CS(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + var jS = (e2) => Za(ES(), e2.headlineboxes.length ? "" : "hidden", e2.headlineboxes.map((t2) => ((e3) => Za(AS(), e3.headlinebox.get("jid"), e3.headlinebox.get("jid"), e3.open_title, e3.headlinebox.get("jid")))(Object.assign({headlinebox: t2}, e2)))); + function TS() { + const e2 = function(e3, t2) { + t2 || (t2 = e3.slice(0)); + return Object.freeze(Object.defineProperties(e3, {raw: {value: Object.freeze(t2)}})); + }(['\n <div class="d-flex controlbox-padded ', '">\n <span class="w-100 controlbox-heading controlbox-heading--headline">', "</span>\n </div>\n ", "\n"]); + return TS = function() { + return e2; + }, e2; + } + const OS = rl.env.utils, kS = eh.extend({tagName: "div", className: "controlbox-section", id: "headline", events: {"click .open-headline": "openHeadline"}, initialize() { + this.listenTo(this.model, "add", this.renderIfHeadline), this.listenTo(this.model, "remove", this.renderIfHeadline), this.listenTo(this.model, "destroy", this.renderIfHeadline), this.render(), this.insertIntoDOM(); + }, toHTML() { + return e2 = {heading_headline: zd("Announcements"), headlineboxes: this.model.filter((e3) => e3.get("type") === Uc.HEADLINES_TYPE), open_title: zd("Click to open this server message")}, Za(TS(), e2.headlineboxes.length ? "" : "hidden", e2.heading_headline, jS(e2)); + var e2; + }, renderIfHeadline(e2) { + return e2 && e2.get("type") === Uc.HEADLINES_TYPE && this.render(); + }, openHeadline(e2) { + e2.preventDefault(); + const t2 = e2.target.getAttribute("data-headline-jid"); + Uc.chatboxes.get(t2).maybeShow(true); + }, insertIntoDOM() { + const e2 = Uc.chatboxviews.get("controlbox"); + e2 && e2.el.querySelector(".controlbox-pane").insertAdjacentElement("beforeEnd", this.el); + }}), NS = {renderHeadlinesPanel() { + return this.headlinepanel && OS.isInDOM(this.headlinepanel.el) || (this.headlinepanel = new Uc.HeadlinesPanel({model: Uc.chatboxes}), Vc.trigger("headlinesPanelRendered")), this.headlinepanel; + }}; + /** + * @module converse-headlines-view + * @copyright 2020, the Converse.js contributors + * @license Mozilla Public License (MPLv2) + */ + function IS() { + const e2 = Uc.chatboxviews; + Uc.chatboxes.on("add", (t2) => { + e2.get(t2.get("id")) || t2.get("type") !== Uc.HEADLINES_TYPE || e2.add(t2.get("id"), new Uc.HeadlinesBoxView({model: t2})); + }); + } + rl.plugins.add("converse-headlines-view", {dependencies: ["converse-headlines", "converse-chatview"], overrides: {ControlBoxView: {renderControlBoxPane() { + this.__super__.renderControlBoxPane.apply(this, arguments), this.renderHeadlinesPanel(); + }}}, initialize() { + Uc.ControlBoxView && Object.assign(Uc.ControlBoxView.prototype, NS), Uc.HeadlinesBoxView = Uc.ChatBoxView.extend(xS), Uc.HeadlinesPanel = kS, Vc.listen.on("chatBoxViewsInitialized", IS); + }}); + var MS = n(180), RS = n.n(MS); + /** + * @module converse-notification + * @copyright 2020, the Converse.js contributors + * @license Mozilla Public License (MPLv2) + */ + const {Strophe: DS} = rl.env, PS = rl.env.utils, LS = "Notification" in window; + let zS; + function FS() { + if (Vc.settings.get("show_tab_notifications")) { + var e2; + zS = (e2 = zS) !== null && e2 !== void 0 ? e2 : new rl.env.Favico({type: "circle", animation: "pop"}); + const t2 = Uc.chatboxes.models.reduce((e3, t3) => e3 + (t3.get("num_unread") || 0), 0); + zS.badge(t2); + } + } + function BS() { + const e2 = function(e3, t2) { + t2 || (t2 = e3.slice(0)); + return Object.freeze(Object.defineProperties(e3, {raw: {value: Object.freeze(t2)}})); + }(['\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title" id="changeStatusModalLabel">', "</h5>\n ", '\n </div>\n <div class="modal-body">\n <span class="modal-alert"></span>\n <form class="converse-form set-xmpp-status" id="set-xmpp-status">\n <div class="form-group">\n <div class="custom-control custom-radio">\n <input ?checked=', '\n type="radio" id="radio-online" value="online" name="chat_status" class="custom-control-input"/>\n <label class="custom-control-label" for="radio-online">\n <span class="fa fa-circle chat-status chat-status--online"></span>', '</label>\n </div>\n <div class="custom-control custom-radio">\n <input ?checked=', '\n type="radio" id="radio-busy" value="dnd" name="chat_status" class="custom-control-input"/>\n <label class="custom-control-label" for="radio-busy">\n <span class="fa fa-minus-circle chat-status chat-status--busy"></span>', '</label>\n </div>\n <div class="custom-control custom-radio">\n <input ?checked=', '\n type="radio" id="radio-away" value="away" name="chat_status" class="custom-control-input"/>\n <label class="custom-control-label" for="radio-away">\n <span class="fa fa-circle chat-status chat-status--away"></span>', '</label>\n </div>\n <div class="custom-control custom-radio">\n <input ?checked=', '\n type="radio" id="radio-xa" value="xa" name="chat_status" class="custom-control-input"/>\n <label class="custom-control-label" for="radio-xa">\n <span class="far fa-circle chat-status chat-status--xa"></span>', '</label>\n </div>\n </div>\n <div class="form-group">\n <div class="btn-group w-100">\n <input name="status_message" type="text" class="form-control"\n value="', '" placeholder="', '"/>\n <span class="clear-input fa fa-times ', '"></span>\n </div>\n </div>\n <button type="submit" class="btn btn-primary">', "</button>\n </form>\n </div>\n </div>\n </div>\n"]); + return BS = function() { + return e2; + }, e2; + } + rl.env.Favico = RS.a, rl.plugins.add("converse-notification", {dependencies: ["converse-chatboxes"], initialize() { + Vc.settings.extend({chatstate_notification_blacklist: [], notification_delay: 5e3, notification_icon: "logo/conversejs-filled.svg", notify_all_room_messages: false, notify_nicknames_without_references: false, play_sounds: true, show_chat_state_notifications: false, show_desktop_notifications: true, show_tab_notifications: true, sounds_path: Vc.settings.get("assets_path") + "/sounds/"}), Uc.shouldNotifyOfGroupMessage = function(e2) { + if (!(e2 == null ? void 0 : e2.body)) + return false; + const t2 = e2.from, n2 = e2.from_muc, r2 = Vc.settings.get("notify_all_room_messages"), i2 = Uc.chatboxes.get(n2), o2 = DS.getResourceFromJid(t2), s2 = o2 && DS.unescapeNode(o2) || ""; + let a2 = false; + const c2 = i2.get("nick"); + Vc.settings.get("notify_nicknames_without_references") && (a2 = new RegExp("\\b".concat(c2, "\\b")).test(e2.body)); + const l2 = e2.references.map((e3) => e3.value).includes(c2), u2 = s2 !== c2, d2 = r2 === true || Array.isArray(r2) && r2.includes(n2) || l2 || a2; + return u2 && !!d2; + }, Uc.isMessageToHiddenChat = function(e2) { + var t2, n2; + return (t2 = (n2 = Uc.chatboxes.get(e2.from)) === null || n2 === void 0 ? void 0 : n2.isHidden()) !== null && t2 !== void 0 && t2; + }, Uc.shouldNotifyOfMessage = function(e2) { + const {attrs: t2, stanza: n2} = e2; + if (!t2 || n2.querySelector("forwarded") !== null) + return false; + if (t2.type === "groupchat") + return Uc.shouldNotifyOfGroupMessage(t2); + if (t2.is_headline) + return Uc.isMessageToHiddenChat(t2); + const r2 = DS.getBareJidFromJid(t2.from) === Uc.bare_jid; + return !PS.isOnlyChatStateNotification(n2) && !PS.isOnlyMessageDeliveryReceipt(n2) && !r2 && (Vc.settings.get("show_desktop_notifications") === "all" || Uc.isMessageToHiddenChat(t2)); + }, Uc.playSoundNotification = function() { + if (Vc.settings.get("play_sounds") && window.Audio !== void 0) { + const e2 = new Audio(Vc.settings.get("sounds_path") + "msg_received.ogg"), t2 = e2.canPlayType("audio/ogg"); + if (t2 === "probably") + return e2.play(); + const n2 = new Audio(Vc.settings.get("sounds_path") + "msg_received.mp3"), r2 = n2.canPlayType("audio/mp3"); + r2 === "probably" ? n2.play() : t2 === "maybe" ? e2.play() : r2 === "maybe" && n2.play(); + } + }, Uc.areDesktopNotificationsEnabled = function() { + return LS && Vc.settings.get("show_desktop_notifications") && Notification.permission === "granted"; + }, Uc.showMessageNotification = function(e2) { + const {attrs: t2} = e2; + if (t2.is_error) + return; + if (!Uc.areDesktopNotificationsEnabled()) + return; + let n2, r2; + const i2 = t2.from, o2 = DS.getBareJidFromJid(i2); + if (t2.type === "headline") { + if (o2.includes("@") && !Vc.settings.get("allow_non_roster_messaging")) + return; + n2 = zd("Notification from %1$s", o2); + } else if (o2.includes("@")) + if (t2.type === "groupchat") + n2 = zd("%1$s says", DS.getResourceFromJid(i2)); + else { + if (Uc.roster === void 0) + return void zn.error("Could not send notification, because roster is undefined"); + if (r2 = Uc.roster.get(o2), r2 !== void 0) + n2 = zd("%1$s says", r2.getDisplayName()); + else { + if (!Vc.settings.get("allow_non_roster_messaging")) + return; + n2 = zd("%1$s says", o2); + } + } + else + n2 = zd("Notification from %1$s", o2); + const s2 = t2.is_encrypted ? zd("Encrypted message received") : t2.body; + if (!s2) + return; + const a2 = new Notification(n2, {body: s2, lang: Uc.locale, icon: Vc.settings.get("notification_icon"), requireInteraction: !Uc.notification_delay}); + Vc.settings.get("notification_delay") && setTimeout(a2.close.bind(a2), Vc.settings.get("notification_delay")), a2.onclick = function(e3) { + e3.preventDefault(), window.focus(), Uc.chatboxes.get(o2).maybeShow(true); + }, a2.onclick.bind(Uc); + }, Uc.showChatStateNotification = function(e2) { + if (Uc.chatstate_notification_blacklist.includes(e2.jid)) + return; + const t2 = e2.chat_status; + let n2 = null; + if (t2 === "offline" ? n2 = zd("has gone offline") : t2 === "away" ? n2 = zd("has gone away") : t2 === "dnd" ? n2 = zd("is busy") : t2 === "online" && (n2 = zd("has come online")), n2 === null) + return; + const r2 = new Notification(e2.getDisplayName(), {body: n2, lang: Uc.locale, icon: Uc.notification_icon}); + setTimeout(r2.close.bind(r2), 5e3); + }, Uc.showContactRequestNotification = function(e2) { + const t2 = new Notification(e2.getDisplayName(), {body: zd("wants to be your contact"), lang: Uc.locale, icon: Uc.notification_icon}); + setTimeout(t2.close.bind(t2), 5e3); + }, Uc.showFeedbackNotification = function(e2) { + if (e2.klass === "error" || e2.klass === "warn") { + const t2 = new Notification(e2.subject, {body: e2.message, lang: Uc.locale, icon: Uc.notification_icon}); + setTimeout(t2.close.bind(t2), 5e3); + } + }, Uc.handleChatStateNotification = function(e2) { + Uc.areDesktopNotificationsEnabled() && Vc.settings.get("show_chat_state_notifications") && Uc.showChatStateNotification(e2); + }, Uc.handleMessageNotification = function(e2) { + if (!Uc.shouldNotifyOfMessage(e2)) + return false; + Vc.trigger("messageNotification", e2), Uc.playSoundNotification(), Uc.showMessageNotification(e2); + }, Uc.handleContactRequestNotification = function(e2) { + Uc.areDesktopNotificationsEnabled(true) && Uc.showContactRequestNotification(e2); + }, Uc.handleFeedback = function(e2) { + Uc.areDesktopNotificationsEnabled(true) && Uc.showFeedbackNotification(e2); + }, Uc.requestPermission = function() { + LS && !["denied", "granted"].includes(Notification.permission) && Notification.requestPermission(); + }, Vc.listen.on("clearSession", () => zS = null), Vc.waitUntil("chatBoxesInitialized").then(() => Uc.chatboxes.on("change:num_unread", FS)), Vc.listen.on("pluginsInitialized", function() { + Vc.listen.on("contactRequest", Uc.handleContactRequestNotification), Vc.listen.on("contactPresenceChanged", Uc.handleChatStateNotification), Vc.listen.on("message", Uc.handleMessageNotification), Vc.listen.on("feedback", Uc.handleFeedback), Vc.listen.on("connected", Uc.requestPermission); + }); + }}); + const qS = rl.env.utils, HS = df.extend({id: "modal-status-change", events: {"submit form#set-xmpp-status": "onFormSubmitted", "click .clear-input": "clearStatusMessage"}, toHTML() { + return e2 = Object.assign(this.model.toJSON(), this.model.vcard.toJSON(), {label_away: zd("Away"), label_busy: zd("Busy"), label_cancel: zd("Cancel"), label_close: zd("Close"), label_custom_status: zd("Custom status"), label_offline: zd("Offline"), label_online: zd("Online"), label_save: zd("Save"), label_xa: zd("Away for long"), modal_title: zd("Change chat status"), placeholder_status_message: zd("Personal status message")}), Za(BS(), e2.modal_title, mf, e2.status === "online", e2.label_online, e2.status === "busy", e2.label_busy, e2.status === "away", e2.label_away, e2.status === "xa", e2.label_xa, e2.status_message || "", e2.placeholder_status_message, e2.status_message ? "" : "hidden", e2.label_save); + var e2; + }, afterRender() { + this.el.addEventListener("shown.bs.modal", () => { + this.el.querySelector('input[name="status_message"]').focus(); + }, false); + }, clearStatusMessage(e2) { + e2 && e2.preventDefault && (e2.preventDefault(), qS.hideElement(this.el.querySelector(".clear-input"))), this.el.querySelector('input[name="status_message"]').value = ""; + }, onFormSubmitted(e2) { + e2.preventDefault(); + const t2 = new FormData(e2.target); + this.model.save({status_message: t2.get("status_message"), status: t2.get("chat_status")}), this.modal.hide(); + }}); + Uc.ChatStatusModal = HS; + function US() { + const e2 = function(e3, t2) { + t2 || (t2 = e3.slice(0)); + return Object.freeze(Object.defineProperties(e3, {raw: {value: Object.freeze(t2)}})); + }(['\n <a class="change-avatar" @click=', ' title="', '">\n ', "\n </a>\n <input @change=", ' class="hidden" name="image" type="file"/>\n ']); + return US = function() { + return e2; + }, e2; + } + const $S = zd("Your avatar image"); + function WS() { + const e2 = ZS(['\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title" id="user-profile-modal-label">', "</h5>\n ", '\n </div>\n <div class="modal-body">\n <span class="modal-alert"></span>\n ', '\n <div class="tab-content">\n <div class="tab-pane active" id="profile-tabpanel" role="tabpanel" aria-labelledby="profile-tab">\n <form class="converse-form converse-form--modal profile-form" action="#">\n <div class="row">\n <div class="col-auto">\n <converse-image-picker image="', '" width="', '" height="', '"></converse-image-picker>\n </div>\n <div class="col">\n <div class="form-group">\n <label class="col-form-label">', ":</label>\n <div>", '</div>\n </div>\n </div>\n </div>\n <div class="form-group">\n <label for="vcard-fullname" class="col-form-label">', ':</label>\n <input id="vcard-fullname" type="text" class="form-control" name="fn" value="', '"/>\n </div>\n <div class="form-group">\n <label for="vcard-nickname" class="col-form-label">', ':</label>\n <input id="vcard-nickname" type="text" class="form-control" name="nickname" value="', '"/>\n </div>\n <div class="form-group">\n <label for="vcard-url" class="col-form-label">', ':</label>\n <input id="vcard-url" type="url" class="form-control" name="url" value="', '"/>\n </div>\n <div class="form-group">\n <label for="vcard-email" class="col-form-label">', ':</label>\n <input id="vcard-email" type="email" class="form-control" name="email" value="', '"/>\n </div>\n <div class="form-group">\n <label for="vcard-role" class="col-form-label">', ':</label>\n <input id="vcard-role" type="text" class="form-control" name="role" value="', '" aria-describedby="vcard-role-help"/>\n <small id="vcard-role-help" class="form-text text-muted">', '</small>\n </div>\n <hr/>\n <div class="form-group">\n <button type="submit" class="save-form btn btn-primary">', "</button>\n </div>\n </form>\n </div>\n ", "\n </div>\n </div>\n </div>\n </div>\n "]); + return WS = function() { + return e2; + }, e2; + } + function GS() { + const e2 = ZS(['\n <ul class="nav nav-pills justify-content-center">\n <li role="presentation" class="nav-item">\n <a class="nav-link active" id="profile-tab" href="#profile-tabpanel" aria-controls="profile-tabpanel" role="tab" data-toggle="tab">', '</a>\n </li>\n <li role="presentation" class="nav-item">\n <a class="nav-link" id="omemo-tab" href="#omemo-tabpanel" aria-controls="omemo-tabpanel" role="tab" data-toggle="tab">', "</a>\n </li>\n </ul>"]); + return GS = function() { + return e2; + }, e2; + } + function VS() { + const e2 = ZS(['\n <div class="tab-pane" id="omemo-tabpanel" role="tabpanel" aria-labelledby="omemo-tab">\n <form class="converse-form fingerprint-removal">\n <ul class="list-group fingerprints">\n <li class="list-group-item active">', '</li>\n <li class="list-group-item">\n ', '\n </li>\n </ul>\n <div class="form-group">\n <button type="button" class="generate-bundle btn btn-danger">', "</button>\n </div>\n ", "\n </form>\n </div>"]); + return VS = function() { + return e2; + }, e2; + } + function JS() { + const e2 = ZS(['\n <ul class="list-group fingerprints">\n <li class="list-group-item nopadding active">\n <label>\n <input type="checkbox" class="select-all" title="', '" aria-label="', '"/>\n ', "\n </label>\n </li>\n ", '\n </ul>\n <div class="form-group"><button type="submit" class="save-form btn btn-primary">', "</button></div>\n "]); + return JS = function() { + return e2; + }, e2; + } + function XS() { + const e2 = ZS(["\n ", "\n"]); + return XS = function() { + return e2; + }, e2; + } + function QS() { + const e2 = ZS(['\n <li class="fingerprint-removal-item list-group-item nopadding">\n <label>\n <input type="checkbox" value="', '"\n aria-label="', '"/>\n <span>', "</span>\n </label>\n </li>\n "]); + return QS = function() { + return e2; + }, e2; + } + function YS() { + const e2 = ZS(['\n <li class="fingerprint-removal-item list-group-item nopadding">\n <label>\n <input type="checkbox" value="', '"\n aria-label="', '"/>\n <span class="fingerprint">', "</span>\n </label>\n </li>\n "]); + return YS = function() { + return e2; + }, e2; + } + function KS() { + const e2 = ZS(['\n <span class="fingerprint">', "</span>"]); + return KS = function() { + return e2; + }, e2; + } + function ZS(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + Vc.elements.define("converse-image-picker", class extends mc { + static get properties() { + return {height: {type: Number}, image: {type: String}, width: {type: Number}}; + } + render() { + const e2 = {height: this.height, image: this.image, width: this.width}; + return Za(US(), this.openFileSelection, $S, op(e2), this.updateFilePreview); + } + openFileSelection(e2) { + e2.preventDefault(), this.querySelector('input[type="file"]').click(); + } + updateFilePreview(e2) { + const t2 = e2.target.files[0], n2 = new FileReader(); + n2.onloadend = () => this.image = n2.result, n2.readAsDataURL(t2); + } + }); + const ex = rl.env.utils, tx = (e2) => Za(XS(), e2.device.get("bundle") && e2.device.get("bundle").fingerprint ? ((e3) => { + const t2 = zd("Checkbox for selecting the following fingerprint"); + return Za(YS(), e3.device.get("id"), t2, ex.formatFingerprint(e3.device.get("bundle").fingerprint)); + })(e2) : ((e3) => { + const t2 = zd("Device without a fingerprint"), n2 = zd("Checkbox for selecting the following device"); + return Za(QS(), e3.device.get("id"), n2, t2); + })(e2)), nx = (e2) => { + const t2 = zd("This device's OMEMO fingerprint"), n2 = zd("Generate new keys and fingerprint"); + return Za(VS(), t2, e2.view.current_device && e2.view.current_device.get("bundle") && e2.view.current_device.get("bundle").fingerprint ? ((e3) => Za(KS(), ex.formatFingerprint(e3.view.current_device.get("bundle").fingerprint)))(e2) : fp(), n2, e2.view.other_devices.length ? ((e3) => { + const t3 = zd("Other OMEMO-enabled devices"), n3 = zd("Checkbox to select fingerprints of all other OMEMO devices"), r2 = zd("Remove checked devices and close"), i2 = zd("Select all"); + return Za(JS(), i2, n3, t3, e3.view.other_devices.map((t4) => tx(Object.assign({device: t4}, e3))), r2); + })(e2) : ""); + }; + const rx = df.extend({id: "user-profile-modal", events: {"submit .profile-form": "onFormSubmitted"}, initialize() { + this.listenTo(this.model, "change", this.render), df.prototype.initialize.apply(this, arguments), Vc.trigger("profileModalInitialized", this.model); + }, toHTML() { + return ((e2) => { + const t2 = zd("Your Profile"), n2 = zd("Email"), r2 = zd("Full Name"), i2 = zd("XMPP Address (JID)"), o2 = zd("Nickname"), s2 = zd("Role"), a2 = zd("Save and close"), c2 = zd("Use commas to separate multiple roles. Your roles are shown next to your name on your chat messages."), l2 = zd("URL"), u2 = zd("OMEMO"), d2 = zd("Profile"), h2 = Za(GS(), d2, u2); + return Za(WS(), t2, mf, Uc.pluggable.plugins["converse-omemo"].enabled(Uc) && h2 || "", e2.image, e2.width, e2.height, i2, e2.jid, r2, e2.fullname || "", o2, e2.nickname || "", l2, e2.url || "", n2, e2.email || "", s2, e2.role || "", c2, a2, Uc.pluggable.plugins["converse-omemo"].enabled(Uc) && nx(e2) || ""); + })(Object.assign(this.model.toJSON(), this.model.vcard.toJSON(), this.getAvatarData(), {view: this})); + }, getAvatarData() { + return {height: 128, width: 128, image: "data:" + this.model.vcard.get("image_type") + ";base64," + this.model.vcard.get("image")}; + }, afterRender() { + this.tabs = mr()(".nav-item .nav-link", this.el).map((e2) => new af.a.Tab(e2)); + }, async setVCard(e2) { + try { + await Vc.vcard.set(Uc.bare_jid, e2); + } catch (e3) { + return zn.fatal(e3), void this.alert([zd("Sorry, an error happened while trying to save your profile data."), zd("You can check your browser's developer console for any error output.")].join(" ")); + } + this.modal.hide(); + }, onFormSubmitted(e2) { + e2.preventDefault(); + const t2 = new FileReader(), n2 = new FormData(e2.target), r2 = n2.get("image"), i2 = {fn: n2.get("fn"), nickname: n2.get("nickname"), role: n2.get("role"), email: n2.get("email"), url: n2.get("url")}; + r2.size ? (t2.onloadend = () => { + Object.assign(i2, {image: btoa(t2.result), image_type: r2.type}), this.setVCard(i2); + }, t2.readAsBinaryString(r2)) : (Object.assign(i2, {image: this.model.vcard.get("image"), image_type: this.model.vcard.get("image_type")}), this.setVCard(i2)); + }}); + Uc.ProfileModal = rx; + function ix() { + const e2 = ux(['\n <fieldset class="form-group">\n <ul class="list-group">\n <li class="list-group-item active">', ":</li>\n ", "\n </ul>\n </fieldset>"]); + return ix = function() { + return e2; + }, e2; + } + function ox() { + const e2 = ux(['<div class="alert alert-', '" role="alert">', "</div>"]); + return ox = function() { + return e2; + }, e2; + } + function sx() { + const e2 = ux(["\n ", '\n <form class="converse-form" @submit=', '>\n <fieldset class="form-group">\n <label>\n ', '\n <p class="form-help">', '</p>\n <converse-autocomplete\n .getAutoCompleteList="', '"\n placeholder="', '"\n name="jid"/>\n </label>\n </fieldset>\n <fieldset class="form-group">\n <input type="submit" class="btn btn-primary" value="', '">\n </fieldset>\n ', "\n\n </form>\n "]); + return sx = function() { + return e2; + }, e2; + } + function ax() { + const e2 = ux(['\n <li class="room-item list-group-item">\n <div class="available-chatroom d-flex flex-row">\n <a class="open-room available-room w-100"\n @click=', '\n data-command-node="', '"\n data-command-jid="', '"\n data-command-name="', '"\n title="', '"\n href="#">', "</a>\n </div>\n ", "\n </li>\n"]); + return ax = function() { + return e2; + }, e2; + } + function cx() { + const e2 = ux(['<div class="alert alert-', '" role="alert">', "</div>"]); + return cx = function() { + return e2; + }, e2; + } + function lx() { + const e2 = ux(["\n <form @submit=", ">\n ", '\n <fieldset class="form-group">\n <input type="hidden" name="command_node" value="', '"/>\n <input type="hidden" name="command_jid" value="', '"/>\n\n <p class="form-help">', "</p>\n <!-- Fields are generated internally, with xForm2webForm -->\n ", '\n </fieldset>\n <fieldset>\n <input type="submit" class="btn btn-primary" value="', '">\n <input type="button" class="btn btn-secondary button-cancel" value="', '" @click=', ">\n </fieldset>\n </form>\n "]); + return lx = function() { + return e2; + }, e2; + } + function ux(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + const {Strophe: dx, $iq: hx} = rl.env, fx = rl.env.utils, px = (e2, t2) => Za(ax(), e2.toggleCommandForm, t2.node, t2.jid, t2.name, t2.name, t2.name || t2.jid, t2.node === e2.showform ? ((e3, t3) => { + const n2 = zd("Hide"), r2 = zd("Execute"); + return Za(lx(), e3.runCommand, t3.alert ? Za(cx(), t3.alert_type, t3.alert) : "", t3.node, t3.jid, t3.instructions, t3.fields.map((e4) => Kp(e4)), r2, n2, e3.hideCommandForm); + })(e2, t2) : ""); + async function gx() { + const e2 = [...await Vc.rooms.get(), ...await Vc.contacts.get()]; + return [...new Set(e2.map((e3) => dx.getDomainFromJid(e3.get("jid"))))]; + } + function mx() { + const e2 = _x(['\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title" id="converse-modtools-modal-label">', "</h5>\n ", '\n </div>\n <div class="modal-body">\n ', '\n\n <div class="tab-content">\n <div class="tab-pane tab-pane--columns ', '"\n id="about-tabpanel" role="tabpanel" aria-labelledby="about-tab">\n\n <span class="modal-alert"></span>\n <br/>\n <div class="container">\n <h6 class="brand-heading">Converse</h6>\n <p class="brand-subtitle">', '</p>\n <p class="brand-subtitle">', '</p>\n <p class="brand-subtitle">', '</p>\n </div>\n </div>\n\n <div class="tab-pane tab-pane--columns ', '"\n id="commands-tabpanel"\n role="tabpanel"\n aria-labelledby="commands-tab">\n <converse-adhoc-commands/>\n </div>\n </div>\n </div>\n </div>\n </div>\n']); + return mx = function() { + return e2; + }, e2; + } + function vx() { + const e2 = _x(['\n <ul class="nav nav-pills justify-content-center">\n <li role="presentation" class="nav-item">\n <a class="nav-link active" id="about-tab" href="#about-tabpanel" aria-controls="about-tabpanel" role="tab" data-toggle="tab" @click=', ">", '</a>\n </li>\n <li role="presentation" class="nav-item">\n <a class="nav-link" id="commands-tab" href="#commands-tabpanel" aria-controls="commands-tabpanel" role="tab" data-toggle="tab" @click=', ">", "</a>\n </li>\n </ul>\n "]); + return vx = function() { + return e2; + }, e2; + } + function _x(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + Vc.elements.define("converse-adhoc-commands", class extends mc { + static get properties() { + return {alert: {type: String}, alert_type: {type: String}, nonce: {type: String}, showform: {type: String}, view: {type: String}}; + } + constructor() { + super(), this.view = "choose-service", this.showform = "", this.commands = []; + } + render() { + return ((e2) => { + const t2 = zd("On which entity do you want to run commands?"), n2 = zd("Certain XMPP services and entities allow privileged users to execute ad-hoc commands on them."), r2 = zd("Commands found"), i2 = zd("List available commands"), o2 = zd("XMPP Address"), s2 = zd("No commands found"); + return Za(sx(), e2.alert ? Za(ox(), e2.alert_type, e2.alert) : "", e2.fetchCommands, t2, n2, gx, o2, i2, e2.view === "list-commands" ? Za(ix(), e2.commands.length ? r2 : s2, e2.commands.map((t3) => px(e2, t3))) : ""); + })({alert: this.alert, alert_type: this.alert_type, commands: this.commands, fetchCommands: (e2) => this.fetchCommands(e2), hideCommandForm: (e2) => this.hideCommandForm(e2), runCommand: (e2) => this.runCommand(e2), showform: this.showform, toggleCommandForm: (e2) => this.toggleCommandForm(e2), view: this.view}); + } + async fetchCommands(e2) { + e2.preventDefault(), delete this.alert_type, delete this.alert; + const t2 = new FormData(e2.target).get("jid").trim(); + let n2; + try { + n2 = await Vc.disco.supports(dx.NS.ADHOC, t2); + } catch (e3) { + zn.error(e3); + } + if (n2) + try { + this.commands = await Vc.adhoc.getCommands(t2), this.view = "list-commands"; + } catch (e3) { + return zn.error(e3), this.alert_type = "danger", this.alert = zd("Sorry, an error occurred while looking for commands on that entity."), this.commands = [], void zn.error(e3); + } + else + this.alert_type = "danger", this.alert = zd("The specified entity doesn't support ad-hoc commands"); + } + async toggleCommandForm(e2) { + e2.preventDefault(); + const t2 = e2.target.getAttribute("data-command-node"), n2 = this.commands.filter((e3) => e3.node === t2)[0]; + this.showform !== t2 && await async function(e3) { + const t3 = e3.node, n3 = e3.jid, r2 = hx({type: "set", to: n3}).c("command", {xmlns: dx.NS.ADHOC, node: t3, action: "execute"}); + try { + var i2; + const t4 = await Vc.sendIQ(r2), n4 = mr()('command[xmlns="'.concat(dx.NS.ADHOC, '"]'), t4).pop(); + e3.sessionid = n4.getAttribute("sessionid"), e3.instructions = (i2 = mr()('x[type="form"][xmlns="jabber:x:data"] instructions', n4).pop()) === null || i2 === void 0 ? void 0 : i2.textContent, e3.fields = mr()('x[type="form"][xmlns="jabber:x:data"] field', n4).map((e4) => fx.xForm2webForm(e4, n4)); + } catch (t4) { + t4 === null ? zn.error("Error: timeout while trying to execute command for ".concat(n3)) : (zn.error("Error while trying to execute command for ".concat(n3)), zn.error(t4)), e3.fields = []; + } + }(n2), this.showform = t2; + } + hideCommandForm(e2) { + e2.preventDefault(), this.showform = ""; + } + async runCommand(e2) { + e2.preventDefault(); + const t2 = new FormData(e2.target), n2 = t2.get("command_jid").trim(), r2 = t2.get("command_node").trim(), i2 = this.commands.filter((e3) => e3.node === r2)[0], o2 = mr()(":input:not([type=button]):not([type=submit])", e2.target).filter((e3) => !["command_jid", "command_node"].includes(e3.getAttribute("name"))).map(fx.webForm2xForm).filter((e3) => e3), s2 = hx({to: n2, type: "set"}).c("command", {sessionid: i2.sessionid, node: i2.node, xmlns: dx.NS.ADHOC}).c("x", {xmlns: dx.NS.XFORM, type: "submit"}); + let a2; + o2.forEach((e3) => s2.cnode(e3).up()); + try { + a2 = await Vc.sendIQ(s2); + } catch (e3) { + i2.alert_type = "danger", i2.alert = zd("Sorry, an error occurred while trying to execute the command. See the developer console for details"), zn.error("Error while trying to execute an ad-hoc command"), zn.error(e3); + } + var c2; + a2 ? i2.alert = (c2 = a2.querySelector("note")) === null || c2 === void 0 ? void 0 : c2.textContent : i2.alert = "Done"; + i2.alert_type = "primary", this.nonce = fx.getUniqueId(); + } + }); + var bx = (e2) => { + const t2 = zd("Settings"), n2 = zd("%1$s Open Source %2$s XMPP chat client brought to you by %3$s Opkode %2$s", '<a target="_blank" rel="nofollow" href="https://conversejs.org">', "</a>", '<a target="_blank" rel="nofollow" href="https://opkode.com">'), r2 = zd("%1$s Translate %2$s it into your own language", '<a target="_blank" rel="nofollow" href="https://hosted.weblate.org/projects/conversejs/#languages">', "</a>"), i2 = Vc.settings.get("show_client_info"), o2 = Vc.settings.get("allow_adhoc_commands"), s2 = i2 && o2; + return Za(mx(), t2, mf, s2 ? ((e3) => { + const t3 = zd("About"), n3 = zd("Commands"); + return Za(vx(), e3.switchTab, t3, e3.switchTab, n3); + })(e2) : "", i2 ? "active" : "", e2.version_name, Kp(Qp.a.filterXSS(n2, {whiteList: {a: []}})), Kp(Qp.a.filterXSS(r2, {whiteList: {a: []}})), !i2 && o2 ? "active" : ""); + }; + let yx; + var wx = df.extend({id: "converse-client-info-modal", initialize(e2) { + yx = e2._converse, df.prototype.initialize.apply(this, arguments); + }, toHTML() { + return bx(Object.assign(this.model.toJSON(), this.model.vcard.toJSON(), {version_name: yx.VERSION_NAME})); + }}); + function Sx() { + const e2 = Ax(['<a class="controlbox-heading__btn logout fa fa-sign-out-alt align-self-center" title="', '"></a>']); + return Sx = function() { + return e2; + }, e2; + } + function xx() { + const e2 = Ax(['<a class="controlbox-heading__btn show-client-info fa fa-cog align-self-center" title="', '" @click=', "></a>"]); + return xx = function() { + return e2; + }, e2; + } + function Ex() { + const e2 = Ax(['\n <div class="userinfo controlbox-padded">\n <div class="controlbox-section profile d-flex">\n <a class="show-profile" href="#">\n <canvas class="avatar align-self-center" height="40" width="40"></canvas>\n </a>\n <span class="username w-100 align-self-center">', "</span>\n ", "\n ", '\n </div>\n <div class="d-flex xmpp-status">\n <a class="change-status" title="', '" data-toggle="modal" data-target="#changeStatusModal">\n <span class="', ' w-100 align-self-center" data-value="', '">\n <span class="\n ', "\n ", "\n ", "\n ", "\n ", '"></span> ', "</span>\n </a>\n </div>\n </div>\n"]); + return Ex = function() { + return e2; + }, e2; + } + function Ax(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + /** + * @module converse-profile + * @copyright The Converse.js contributors + * @license Mozilla Public License (MPLv2) + */ + rl.plugins.add("converse-profile", {dependencies: ["converse-status", "converse-modal", "converse-vcard", "converse-chatboxviews"], initialize() { + Vc.settings.extend({allow_adhoc_commands: true, show_client_info: true}), Uc.XMPPStatusView = Uc.ViewWithAvatar.extend({tagName: "div", events: {"click a.show-profile": "showProfileModal", "click a.change-status": "showStatusChangeModal", "click .logout": "logOut"}, initialize() { + this.listenTo(this.model, "change", this.render), this.listenTo(this.model.vcard, "change", this.render); + }, toHTML() { + const e2 = this.model.get("status") || "offline"; + return ((e3) => { + const t2 = zd("Log out"), n2 = zd("Click to change your chat status"), r2 = zd("Show details about this chat client"), i2 = Vc.settings.get("show_client_info") || Vc.settings.get("allow_adhoc_commands"); + return Za(Ex(), e3.fullname, i2 ? Za(xx(), r2, e3.showUserSettingsModal) : "", Vc.settings.get("allow_logout") ? Za(Sx(), t2) : "", n2, e3.chat_status, e3.chat_status, e3.chat_status === "online" && "fa fa-circle chat-status chat-status--online", e3.chat_status === "dnd" && "fa fa-minus-circle chat-status chat-status--busy", e3.chat_status === "away" && "fa fa-circle chat-status chat-status--away", e3.chat_status === "xa" && "far fa-circle chat-status chat-status--xa ", e3.chat_status === "offline" && "fa fa-circle chat-status chat-status--offline", e3.status_message); + })(Object.assign(this.model.toJSON(), this.model.vcard.toJSON(), {chat_status: e2, fullname: this.model.vcard.get("fullname") || Uc.bare_jid, showUserSettingsModal: (e3) => this.showUserSettingsModal(e3), status_message: this.model.get("status_message") || zd("I am %1$s", this.getPrettyStatus(e2))})); + }, afterRender() { + this.renderAvatar(); + }, showProfileModal(e2) { + e2.preventDefault(), Vc.modal.show(Uc.ProfileModal, {model: this.model}, e2); + }, showStatusChangeModal(e2) { + e2.preventDefault(), Vc.modal.show(Uc.ChatStatusModal, {model: this.model}, e2); + }, showUserSettingsModal(e2) { + e2.preventDefault(), Vc.modal.show(wx, {model: this.model, _converse: Uc}, e2); + }, logOut(e2) { + e2.preventDefault(), confirm(zd("Are you sure you want to log out?")) === true && Vc.user.logout(); + }, getPrettyStatus: (e2) => e2 === "chat" ? zd("online") : e2 === "dnd" ? zd("busy") : e2 === "xa" ? zd("away for long") : e2 === "away" ? zd("away") : e2 === "offline" ? zd("offline") : zd(e2) || zd("online")}), Vc.listen.on("controlBoxPaneInitialized", async (e2) => { + await Vc.waitUntil("VCardsInitialized"), Uc.xmppstatusview = new Uc.XMPPStatusView({model: Uc.xmppstatus}), e2.el.insertAdjacentElement("afterBegin", Uc.xmppstatusview.render().el); + }); + }}); + var Cx = function() { + var e2 = arguments.length; + if (!e2) + return []; + for (var t2 = Array(e2 - 1), n2 = arguments[0], r2 = e2; r2--; ) + t2[r2 - 1] = arguments[r2]; + return dt(ke(n2) ? it(n2) : [n2], Mo(t2, 1)); + }, jx = Math.ceil, Tx = Math.max; + var Ox = function(e2, t2, n2, r2) { + for (var i2 = -1, o2 = Tx(jx((t2 - e2) / (n2 || 1)), 0), s2 = Array(o2); o2--; ) + s2[r2 ? o2 : ++i2] = e2, e2 += n2; + return s2; + }; + var kx = function(e2) { + return function(t2, n2, r2) { + return r2 && typeof r2 != "number" && Tr(t2, n2, r2) && (n2 = r2 = void 0), t2 = hi(t2), n2 === void 0 ? (n2 = t2, t2 = 0) : n2 = hi(n2), r2 = r2 === void 0 ? t2 < n2 ? 1 : -1 : hi(r2), Ox(t2, n2, r2, e2); + }; + }(); + function Nx() { + const e2 = function(e3, t2) { + t2 || (t2 = e3.slice(0)); + return Object.freeze(Object.defineProperties(e3, {raw: {value: Object.freeze(t2)}})); + }(['\n <button class="toggle-omemo"\n title="', '"\n ?disabled=', "\n @click=", '>\n <converse-icon class="fa ', '"\n path-prefix="', '" size="1em"\n color="', '"\n ></converse-icon>\n </button>']); + return Nx = function() { + return e2; + }, e2; + } + const {Strophe: Ix, sizzle: Mx, $build: Rx, $iq: Dx, $msg: Px} = rl.env, Lx = rl.env.utils; + Ix.addNamespace("OMEMO_DEVICELIST", Ix.NS.OMEMO + ".devicelist"), Ix.addNamespace("OMEMO_VERIFICATION", Ix.NS.OMEMO + ".verification"), Ix.addNamespace("OMEMO_WHITELISTED", Ix.NS.OMEMO + ".whitelisted"), Ix.addNamespace("OMEMO_BUNDLES", Ix.NS.OMEMO + ".bundles"); + const zx = {name: "AES-GCM", length: 128}; + class Fx extends Error { + constructor(e2, t2) { + super(e2, t2), this.name = "IQError", this.iq = t2; + } + } + function Bx(e2, t2) { + return t2.is_encrypted && t2.encrypted.key ? t2.encrypted.prekey === true ? async function(e3) { + const t3 = $x(e3.from, parseInt(e3.encrypted.device_id, 10)), n2 = Lx.base64ToArrayBuffer(e3.encrypted.key); + let r2; + try { + r2 = await t3.decryptPreKeyWhisperMessage(n2, "binary"); + } catch (t4) { + return zn.error("".concat(t4.name, " ").concat(t4.message)), Object.assign(e3, Gx(t4)); + } + try { + const t4 = await Wx(e3, r2); + return await Uc.omemo_store.generateMissingPreKeys(), await Uc.omemo_store.publishBundle(), t4 ? Object.assign(e3, {plaintext: t4}) : Object.assign(e3, {is_only_key: true}); + } catch (t4) { + return zn.error("".concat(t4.name, " ").concat(t4.message)), Object.assign(e3, Gx(t4)); + } + }(t2) : async function(e3) { + const t3 = e3.from_muc ? e3.from_real_jid : e3.from; + t3 || Object.assign(e3, {error_text: zd("Sorry, could not decrypt a received OMEMO because we don't have the JID for that user."), error_type: "Decryption", is_ephemeral: false, is_error: true, type: "error"}); + const n2 = $x(t3, parseInt(e3.encrypted.device_id, 10)), r2 = Lx.base64ToArrayBuffer(e3.encrypted.key); + try { + const t4 = await n2.decryptWhisperMessage(r2, "binary"), i2 = await Wx(e3, t4); + return Object.assign(e3, {plaintext: i2}); + } catch (t4) { + return zn.error("".concat(t4.name, " ").concat(t4.message)), Object.assign(e3, Gx(t4)); + } + }(t2) : t2; + } + function qx() { + Uc.chatboxes.on("add", (e2) => { + tE(e2), e2.get("type") === Uc.CHATROOMS_TYPE && (e2.occupants.on("add", (t2) => async function(e3, t3) { + if (t3.isSelf() || !e3.features.get("nonanonymous") || !e3.features.get("membersonly")) + return; + if (e3.get("omemo_active")) { + await Uc.contactHasOMEMOSupport(t3.get("jid")) || (e3.createMessage({message: zd("%1$s doesn't appear to have a client that supports OMEMO. Encrypted chat will no longer be possible in this grouchat.", t3.get("nick")), type: "error"}), e3.save({omemo_active: false, omemo_supported: false})); + } + }(e2, t2)), e2.features.on("change", () => tE(e2))); + }); + } + function Hx(e2) { + e2.listenTo(e2.model.messages, "add", (t2) => { + t2.get("is_encrypted") && !t2.get("is_error") && e2.model.save("omemo_supported", true); + }), e2.listenTo(e2.model, "change:omemo_supported", () => { + var t2; + !e2.model.get("omemo_supported") && e2.model.get("omemo_active") ? e2.model.set("omemo_active", false) : (t2 = e2.el.querySelector("converse-chat-toolbar")) === null || t2 === void 0 || t2.requestUpdate(); + }), e2.listenTo(e2.model, "change:omemo_active", () => { + e2.el.querySelector("converse-chat-toolbar").requestUpdate(); + }); + } + const Ux = rl.env.omemo = {async encryptMessage(e2) { + const t2 = crypto.getRandomValues(new window.Uint8Array(12)), n2 = await crypto.subtle.generateKey(zx, true, ["encrypt", "decrypt"]), r2 = {name: "AES-GCM", iv: t2, tagLength: 128}, i2 = await crypto.subtle.encrypt(r2, n2, Lx.stringToArrayBuffer(e2)), o2 = i2.byteLength - 16, s2 = i2.slice(0, o2), a2 = i2.slice(o2), c2 = await crypto.subtle.exportKey("raw", n2); + return {key: c2, tag: a2, key_and_tag: Lx.appendArrayBuffer(c2, a2), payload: Lx.arrayBufferToBase64(s2), iv: Lx.arrayBufferToBase64(t2)}; + }, async decryptMessage(e2) { + const t2 = await crypto.subtle.importKey("raw", e2.key, zx, true, ["encrypt", "decrypt"]), n2 = Lx.appendArrayBuffer(Lx.base64ToArrayBuffer(e2.payload), e2.tag), r2 = {name: "AES-GCM", iv: Lx.base64ToArrayBuffer(e2.iv), tagLength: 128}; + return Lx.arrayBufferToString(await crypto.subtle.decrypt(r2, t2, n2)); + }}; + function $x(e2, t2) { + const n2 = new libsignal.SignalProtocolAddress(e2, t2); + return new window.libsignal.SessionCipher(Uc.omemo_store, n2); + } + async function Wx(e2, t2) { + const n2 = e2.encrypted, r2 = Uc.devicelists.getDeviceList(e2.from); + await r2._devices_promise; + let i2 = r2.get(n2.device_id); + if (i2 || (i2 = await r2.devices.create({id: n2.device_id, jid: e2.from}, {promise: true})), n2.payload) { + const e3 = t2.slice(0, 16), r3 = t2.slice(16), o2 = await Ux.decryptMessage(Object.assign(n2, {key: e3, tag: r3})); + return i2.save("active", true), o2; + } + } + function Gx(e2) { + return Vc.settings.get("loglevel") === "debug" ? {error_text: zd("Sorry, could not decrypt a received OMEMO message due to an error.") + " ".concat(e2.name, " ").concat(e2.message), error_type: "Decryption", is_ephemeral: true, is_error: true, type: "error"} : {}; + } + function Vx(e2) { + const t2 = e2.querySelector("signedPreKeyPublic"), n2 = e2.querySelector("signedPreKeySignature"), r2 = Mx("prekeys > preKeyPublic", e2).map((e3) => ({id: parseInt(e3.getAttribute("preKeyId"), 10), key: e3.textContent})); + return {identity_key: e2.querySelector("identityKey").textContent.trim(), signed_prekey: {id: parseInt(t2.getAttribute("signedPreKeyId"), 10), public_key: t2.textContent, signature: n2.textContent}, prekeys: r2}; + } + async function Jx(e2) { + var t2; + if ((t2 = e2.get("bundle")) === null || t2 === void 0 ? void 0 : t2.fingerprint) + return; + const n2 = await e2.getBundle(); + n2.fingerprint = Lx.arrayBufferToHex(Lx.base64ToArrayBuffer(n2.identity_key)), e2.save("bundle", n2), e2.trigger("change:bundle"); + } + async function Xx(e2) { + await Vc.waitUntil("OMEMOInitialized"); + const t2 = Uc.devicelists.get(e2) || Uc.devicelists.create({jid: e2}); + return await t2.fetchDevices(), t2.devices; + } + async function Qx(e2) { + if (!e2.get("bundle")) + return zn.error("Could not build an OMEMO session for device ".concat(e2.get("id"), " because we don't have its bundle")), null; + const t2 = new libsignal.SignalProtocolAddress(e2.get("jid"), e2.get("id")), n2 = await Uc.omemo_store.loadSession(t2.toString()); + if (n2) + return n2; + try { + return await async function(e3) { + const t3 = new libsignal.SignalProtocolAddress(e3.get("jid"), e3.get("id")), n3 = new libsignal.SessionBuilder(Uc.omemo_store, t3), r2 = e3.getRandomPreKey(), i2 = await e3.getBundle(); + return n3.processPreKey({registrationId: parseInt(e3.get("id"), 10), identityKey: Lx.base64ToArrayBuffer(i2.identity_key), signedPreKey: {keyId: i2.signed_prekey.id, publicKey: Lx.base64ToArrayBuffer(i2.signed_prekey.public_key), signature: Lx.base64ToArrayBuffer(i2.signed_prekey.signature)}, preKey: {keyId: r2.id, publicKey: Lx.base64ToArrayBuffer(r2.key)}}); + }(e2); + } catch (t3) { + return zn.error("Could not build an OMEMO session for device ".concat(e2.get("id"))), zn.error(t3), null; + } + } + function Yx() { + Uc.connection.addHandler((e2) => { + try { + Mx('event[xmlns="'.concat(Ix.NS.PUBSUB, '#event"]'), e2).length && (function(e3) { + const t2 = Mx('items[node="'.concat(Ix.NS.OMEMO_DEVICELIST, '"]'), e3).pop(); + if (!t2) + return; + const n2 = 'item list[xmlns="'.concat(Ix.NS.OMEMO, '"] device'), r2 = Mx(n2, t2).map((e4) => e4.getAttribute("id")), i2 = e3.getAttribute("from"), o2 = Uc.devicelists.getDeviceList(i2), s2 = o2.devices; + ks(s2.pluck("id"), r2).forEach((e4) => { + i2 === Uc.bare_jid && e4 === Uc.omemo_store.get("device_id") || s2.get(e4).save("active", false); + }), r2.forEach((e4) => { + const t3 = s2.get(e4); + t3 ? t3.save("active", true) : s2.create({id: e4, jid: i2}); + }), Lx.isSameBareJID(i2, Uc.bare_jid) && o2.publishCurrentDevice(r2); + }(e2), function(e3) { + const t2 = Mx("items", e3).pop(); + if (!t2 || !t2.getAttribute("node").startsWith(Ix.NS.OMEMO_BUNDLES)) + return; + const n2 = t2.getAttribute("node").split(":")[1], r2 = e3.getAttribute("from"), i2 = Mx("item > bundle", t2).pop(), o2 = Uc.devicelists.getDeviceList(r2); + (o2.devices.get(n2) || o2.devices.create({id: n2, jid: r2})).save({bundle: Vx(i2)}); + }(e2)); + } catch (e3) { + zn.error(e3.message); + } + return true; + }, null, "message", "headline"); + } + function Kx() { + if (Uc.omemo_store === void 0) { + const e2 = "converse.omemosession-".concat(Uc.bare_jid); + Uc.omemo_store = new Uc.OMEMOStore({id: e2}), Uc.omemo_store.browserStorage = Uc.createStore(e2); + } + return Uc.omemo_store.fetchSession(); + } + async function Zx() { + await new Promise((e3, t2) => Uc.devicelists.fetch({success: e3, error: (e4, n2) => t2(n2)})); + let e2 = Uc.devicelists.get(Uc.bare_jid); + return e2 ? e2.fetchDevices() : e2 = await Uc.devicelists.create({jid: Uc.bare_jid}, {promise: true}), e2._devices_promise; + } + async function eE() { + if (!Uc.config.get("trusted") || Vc.settings.get("clear_cache_on_logout")) + return void zn.warn("Not initializing OMEMO, since this browser is not trusted or clear_cache_on_logout is set to true"); + Uc.devicelists = new Uc.DeviceLists(); + const e2 = "converse.devicelists-".concat(Uc.bare_jid); + Uc.devicelists.browserStorage = Uc.createStore(e2); + try { + await Zx(), await Kx(), await Uc.omemo_store.publishBundle(); + } catch (e3) { + return zn.error("Could not initialize OMEMO support"), void zn.error(e3); + } + Vc.trigger("OMEMOInitialized"); + } + async function tE(e2) { + let t2; + e2.get("type") === Uc.CHATROOMS_TYPE ? (await Vc.waitUntil("OMEMOInitialized"), t2 = e2.features.get("nonanonymous") && e2.features.get("membersonly")) : e2.get("type") === Uc.PRIVATE_CHAT_TYPE && (t2 = await Uc.contactHasOMEMOSupport(e2.get("jid"))), e2.set("omemo_supported", t2), t2 && Vc.settings.get("omemo_default") && e2.set("omemo_active", true); + } + function nE(e2) { + e2.stopPropagation(), e2.preventDefault(); + const t2 = Lx.ancestor(e2.target, "converse-chat-toolbar"); + if (!t2.model.get("omemo_supported")) { + let e3; + return e3 = t2.model.get("type") === Uc.CHATROOMS_TYPE ? [zd("Cannot use end-to-end encryption in this groupchat, either the groupchat has some anonymity or not all participants support OMEMO.")] : [zd("Cannot use end-to-end encryption because %1$s uses a client that doesn't support OMEMO.", t2.model.contact.getDisplayName())], Vc.alert("error", zd("Error"), e3); + } + t2.model.save({omemo_active: !t2.model.get("omemo_active")}); + } + function rE(e2, t2) { + const n2 = e2.model; + let r2; + if (n2.get("type") === Uc.CHATROOMS_TYPE && n2.get("omemo_supported")) { + const e3 = zd("Messages are being sent in plaintext"), t3 = zd("Messages are sent encrypted"); + r2 = n2.get("omemo_active") ? t3 : e3; + } else + r2 = zd("This groupchat needs to be members-only and non-anonymous in order to support OMEMO encrypted messages"); + return t2.push(Za(Nx(), r2, !n2.get("omemo_supported"), nE, n2.get("omemo_active") ? "fa-lock" : "fa-unlock", Vc.settings.get("assets_path"), n2.get("omemo_active") ? "var(--info-color)" : "var(--error-color)")), t2; + } + const iE = {encryptKey: (e2, t2) => $x(t2.get("jid"), t2.get("id")).encrypt(e2).then((e3) => ({payload: e3, device: t2})), handleMessageSendError(e2) { + if (e2.name === "IQError") { + this.save("omemo_supported", false); + const t2 = []; + Mx('presence-subscription-required[xmlns="'.concat(Ix.NS.PUBSUB_ERROR, '"]'), e2.iq).length ? t2.push(zd("Sorry, we're unable to send an encrypted message because %1$s requires you to be subscribed to their presence in order to see their OMEMO information", e2.iq.getAttribute("from"))) : Mx('remote-server-not-found[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]', e2.iq).length ? t2.push(zd("Sorry, we're unable to send an encrypted message because the remote server for %1$s could not be found", e2.iq.getAttribute("from"))) : (t2.push(zd("Unable to send an encrypted message due to an unexpected error.")), t2.push(e2.iq.outerHTML)), Vc.alert("error", zd("Error"), t2), zn.error(e2); + } else { + if (!e2.user_facing) + throw e2; + Vc.alert("error", zd("Error"), [e2.message]), zn.error(e2); + } + }}; + rl.plugins.add("converse-omemo", {enabled: (e2) => window.libsignal && e2.config.get("trusted") && !Vc.settings.get("clear_cache_on_logout") && !e2.api.settings.get("blacklisted_plugins").includes("converse-omemo"), dependencies: ["converse-chatview", "converse-pubsub", "converse-profile"], overrides: {ProfileModal: {events: {"change input.select-all": "selectAll", "click .generate-bundle": "generateOMEMODeviceBundle", "submit .fingerprint-removal": "removeSelectedFingerprints"}, initialize() { + return this.debouncedRender = Rc(this.render, 50), this.devicelist = Uc.devicelists.get(Uc.bare_jid), this.listenTo(this.devicelist.devices, "change:bundle", this.debouncedRender), this.listenTo(this.devicelist.devices, "reset", this.debouncedRender), this.listenTo(this.devicelist.devices, "reset", this.debouncedRender), this.listenTo(this.devicelist.devices, "remove", this.debouncedRender), this.listenTo(this.devicelist.devices, "add", this.debouncedRender), this.__super__.initialize.apply(this, arguments); + }, beforeRender() { + const e2 = Uc.omemo_store.get("device_id"); + if (e2 && (this.current_device = this.devicelist.devices.get(e2)), this.other_devices = this.devicelist.devices.filter((t2) => t2.get("id") !== e2), this.__super__.beforeRender) + return this.__super__.beforeRender.apply(this, arguments); + }, selectAll(e2) { + let t2 = Lx.ancestor(e2.target, "li"); + for (; t2; ) + t2.querySelector('input[type="checkbox"]').checked = e2.target.checked, t2 = t2.nextElementSibling; + }, removeSelectedFingerprints(e2) { + e2.preventDefault(), e2.stopPropagation(), e2.target.querySelector(".select-all").checked = false; + const t2 = Mx('.fingerprint-removal-item input[type="checkbox"]:checked', e2.target).map((e3) => e3.value); + this.devicelist.removeOwnDevices(t2).then(this.modal.hide).catch((e3) => { + zn.error(e3), Uc.api.alert(Ix.LogLevel.ERROR, zd("Error"), [zd("Sorry, an error occurred while trying to remove the devices.")]); + }); + }, generateOMEMODeviceBundle(e2) { + e2.preventDefault(), confirm(zd("Are you sure you want to generate new OMEMO keys? This will remove your old keys and all previously encrypted messages will no longer be decryptable on this device.")) && Vc.omemo.bundle.generate(); + }}, UserDetailsModal: {events: {"click .fingerprint-trust .btn input": "toggleDeviceTrust"}, initialize() { + const e2 = this.model.get("jid"); + return this.devicelist = Uc.devicelists.getDeviceList(e2), this.listenTo(this.devicelist.devices, "change:bundle", this.render), this.listenTo(this.devicelist.devices, "change:trusted", this.render), this.listenTo(this.devicelist.devices, "remove", this.render), this.listenTo(this.devicelist.devices, "add", this.render), this.listenTo(this.devicelist.devices, "reset", this.render), this.__super__.initialize.apply(this, arguments); + }, toggleDeviceTrust(e2) { + const t2 = e2.target; + this.devicelist.devices.get(t2.getAttribute("name")).save("trusted", parseInt(t2.value, 10)); + }}, ChatBox: {async sendMessage(e2, t2) { + if (this.get("omemo_active") && e2) { + const n2 = this.getOutgoingMessageAttributes(e2, t2); + let r2, i2; + n2.is_encrypted = true, n2.plaintext = n2.message; + try { + const e3 = await Uc.getBundlesAndBuildSessions(this); + r2 = await this.createMessage(n2), i2 = await Uc.createOMEMOMessageStanza(this, r2, e3); + } catch (e3) { + return this.handleMessageSendError(e3), null; + } + return Uc.api.send(i2), r2; + } + return this.__super__.sendMessage.apply(this, arguments); + }}}, initialize() { + Vc.settings.extend({omemo_default: false}), Vc.promises.add(["OMEMOInitialized"]), Uc.NUM_PREKEYS = 100, Object.assign(Uc.ChatBox.prototype, iE), Uc.generateFingerprints = async function(e2) { + const t2 = await Xx(e2); + return Promise.all(t2.map((e3) => Jx(e3))); + }, Uc.getDeviceForContact = function(e2, t2) { + return Xx(e2).then((e3) => e3.get(t2)); + }, Uc.contactHasOMEMOSupport = async function(e2) { + return (await Xx(e2)).length > 0; + }, Uc.getBundlesAndBuildSessions = async function(e2) { + const t2 = zd("Sorry, no devices found to which we can send an OMEMO encrypted message."); + let n2; + if (e2.get("type") === Uc.CHATROOMS_TYPE) { + const t3 = await Promise.all(e2.occupants.map((e3) => Xx(e3.get("jid")))); + n2 = t3.reduce((e3, t4) => Cx(e3, t4.models), []); + } else if (e2.get("type") === Uc.PRIVATE_CHAT_TYPE) { + const r3 = await Xx(e2.get("jid")); + if (r3.length === 0) { + const e3 = new Error(t2); + throw e3.user_facing = true, e3; + } + const i3 = Uc.devicelists.get(Uc.bare_jid).devices; + n2 = [...i3.models, ...r3.models]; + } + const r2 = Uc.omemo_store.get("device_id"); + n2 = n2.filter((e3) => e3.get("id") !== r2), await Promise.all(n2.map((e3) => e3.getBundle())); + const i2 = n2.filter((e3) => e3).map((e3) => Qx(e3)); + if (await Promise.all(i2), i2.includes(null) && (n2 = n2.filter((e3) => i2[n2.indexOf(e3)]), n2.length === 0)) { + const e3 = new Error(t2); + throw e3.user_facing = true, e3; + } + return n2; + }, Uc.createOMEMOMessageStanza = function(e2, t2, n2) { + const r2 = zd("This is an OMEMO encrypted message which your client doesn\u2019t seem to support. Find more information on https://conversations.im/omemo"); + if (!t2.get("message")) + throw new Error("No message body to encrypt!"); + const i2 = Px({from: Uc.connection.jid, to: e2.get("jid"), type: e2.get("message_type"), id: t2.get("msgid")}).c("body").t(r2).up(); + return t2.get("type") === "chat" && i2.c("request", {xmlns: Ix.NS.RECEIPTS}).up(), i2.c("encrypted", {xmlns: Ix.NS.OMEMO}).c("header", {sid: Uc.omemo_store.get("device_id")}), Ux.encryptMessage(t2.get("message")).then((t3) => { + const r3 = n2.filter((e3) => e3.get("trusted") != -1 && e3.get("active")).map((n3) => e2.encryptKey(t3.key_and_tag, n3)); + return Promise.all(r3).then((e3) => function(e4, t4, n3) { + for (const r4 in t4) + if (Object.prototype.hasOwnProperty.call(t4, r4)) { + const i3 = t4[r4].payload, o2 = t4[r4].device, s2 = parseInt(i3.type, 10) == 3; + e4.c("key", {rid: o2.get("id")}).t(btoa(i3.body)), s2 && e4.attrs({prekey: s2}), e4.up(), r4 == t4.length - 1 && e4.c("iv").t(n3).up().up(); + } + return Promise.resolve(e4); + }(i2, e3, t3.iv)).then((e3) => (e3.c("payload").t(t3.payload).up().up(), e3.c("store", {xmlns: Ix.NS.HINTS}), e3)); + }); + }, Uc.OMEMOStore = qo.extend({Direction: {SENDING: 1, RECEIVING: 2}, getIdentityKeyPair() { + const e2 = this.get("identity_keypair"); + return Promise.resolve({privKey: Lx.base64ToArrayBuffer(e2.privKey), pubKey: Lx.base64ToArrayBuffer(e2.pubKey)}); + }, getLocalRegistrationId() { + return Promise.resolve(parseInt(this.get("device_id"), 10)); + }, isTrustedIdentity(e2, t2, n2) { + if (e2 == null) + throw new Error("Can't check identity key for invalid key"); + if (!(t2 instanceof ArrayBuffer)) + throw new Error("Expected identity_key to be an ArrayBuffer"); + const r2 = this.get("identity_key" + e2); + return r2 === void 0 ? Promise.resolve(true) : Promise.resolve(Lx.arrayBufferToBase64(t2) === r2); + }, loadIdentityKey(e2) { + if (e2 == null) + throw new Error("Can't load identity_key for invalid identifier"); + return Promise.resolve(Lx.base64ToArrayBuffer(this.get("identity_key" + e2))); + }, saveIdentity(e2, t2) { + if (e2 == null) + throw new Error("Can't save identity_key for invalid identifier"); + const n2 = new libsignal.SignalProtocolAddress.fromString(e2), r2 = this.get("identity_key" + n2.getName()), i2 = Lx.arrayBufferToBase64(t2); + return this.save("identity_key" + n2.getName(), i2), r2 && i2 !== r2 ? Promise.resolve(true) : Promise.resolve(false); + }, getPreKeys() { + return this.get("prekeys") || {}; + }, loadPreKey(e2) { + const t2 = this.getPreKeys()[e2]; + return t2 ? Promise.resolve({privKey: Lx.base64ToArrayBuffer(t2.privKey), pubKey: Lx.base64ToArrayBuffer(t2.pubKey)}) : Promise.resolve(); + }, storePreKey(e2, t2) { + const n2 = {}; + return n2[e2] = {pubKey: Lx.arrayBufferToBase64(t2.pubKey), privKey: Lx.arrayBufferToBase64(t2.privKey)}, this.save("prekeys", Object.assign(this.getPreKeys(), n2)), Promise.resolve(); + }, removePreKey(e2) { + return this.save("prekeys", Po(this.getPreKeys(), e2)), Promise.resolve(); + }, loadSignedPreKey(e2) { + const t2 = this.get("signed_prekey"); + return t2 ? Promise.resolve({privKey: Lx.base64ToArrayBuffer(t2.privKey), pubKey: Lx.base64ToArrayBuffer(t2.pubKey)}) : Promise.resolve(); + }, storeSignedPreKey(e2) { + if (typeof e2 != "object") + throw new Error("storeSignedPreKey: expected an object"); + return this.save("signed_prekey", {id: e2.keyId, privKey: Lx.arrayBufferToBase64(e2.keyPair.privKey), pubKey: Lx.arrayBufferToBase64(e2.keyPair.pubKey), signature: Lx.arrayBufferToBase64(e2.signature)}), Promise.resolve(); + }, removeSignedPreKey(e2) { + return this.get("signed_prekey").id === e2 && (this.unset("signed_prekey"), this.save()), Promise.resolve(); + }, loadSession(e2) { + return Promise.resolve(this.get("session" + e2)); + }, storeSession(e2, t2) { + return Promise.resolve(this.save("session" + e2, t2)); + }, removeSession(e2) { + return Promise.resolve(this.unset("session" + e2)); + }, removeAllSessions(e2) { + const t2 = Object.keys(this.attributes).filter((t3) => !!t3.startsWith("session" + e2) && t3), n2 = {}; + return t2.forEach((e3) => { + n2[e3] = void 0; + }), this.save(n2), Promise.resolve(); + }, publishBundle() { + const e2 = this.get("signed_prekey"), t2 = "".concat(Ix.NS.OMEMO_BUNDLES, ":").concat(this.get("device_id")), n2 = Rx("item").c("bundle", {xmlns: Ix.NS.OMEMO}).c("signedPreKeyPublic", {signedPreKeyId: e2.id}).t(e2.pubKey).up().c("signedPreKeySignature").t(e2.signature).up().c("identityKey").t(this.get("identity_keypair").pubKey).up().c("prekeys"); + Object.values(this.get("prekeys")).forEach((e3, t3) => n2.c("preKeyPublic", {preKeyId: t3}).t(e3.pubKey).up()); + return Vc.pubsub.publish(null, t2, n2, {"pubsub#access_model": "open"}, false); + }, async generateMissingPreKeys() { + const e2 = ks(rh(kx(0, Uc.NUM_PREKEYS), Number.prototype.toString), Object.keys(this.getPreKeys())); + if (e2.length < 1) + return zn.warn("No missing prekeys to generate for our own device"), Promise.resolve(); + (await Promise.all(e2.map((e3) => libsignal.KeyHelper.generatePreKey(parseInt(e3, 10))))).forEach((e3) => this.storePreKey(e3.keyId, e3.keyPair)); + const t2 = Object.keys(this.getPreKeys()).map((e3) => ({id: e3.keyId, key: Lx.arrayBufferToBase64(e3.pubKey)})), n2 = Uc.devicelists.get(Uc.bare_jid).devices.get(this.get("device_id")), r2 = await n2.getBundle(); + n2.save("bundle", Object.assign(r2, {prekeys: t2})); + }, async generateBundle() { + const e2 = await libsignal.KeyHelper.generateIdentityKeyPair(), t2 = {}, n2 = Lx.arrayBufferToBase64(e2.pubKey), r2 = function() { + const e3 = Uc.devicelists.get(Uc.bare_jid).devices.pluck("id"); + let t3 = libsignal.KeyHelper.generateRegistrationId(), n3 = 0; + for (; e3.includes(t3); ) + if (t3 = libsignal.KeyHelper.generateRegistrationId(), n3++, n3 === 10) + throw new Error("Unable to generate a unique device ID"); + return t3.toString(); + }(); + t2.identity_key = n2, t2.device_id = r2, this.save({device_id: r2, identity_keypair: {privKey: Lx.arrayBufferToBase64(e2.privKey), pubKey: n2}, identity_key: n2}); + const i2 = await libsignal.KeyHelper.generateSignedPreKey(e2, 0); + Uc.omemo_store.storeSignedPreKey(i2), t2.signed_prekey = {id: i2.keyId, public_key: Lx.arrayBufferToBase64(i2.keyPair.privKey), signature: Lx.arrayBufferToBase64(i2.signature)}; + const o2 = await Promise.all(kx(0, Uc.NUM_PREKEYS).map((e3) => libsignal.KeyHelper.generatePreKey(e3))); + o2.forEach((e3) => Uc.omemo_store.storePreKey(e3.keyId, e3.keyPair)); + const s2 = Uc.devicelists.get(Uc.bare_jid), a2 = await s2.devices.create({id: t2.device_id, jid: Uc.bare_jid}, {promise: true}), c2 = o2.map((e3) => ({id: e3.keyId, key: Lx.arrayBufferToBase64(e3.keyPair.pubKey)})); + t2.prekeys = c2, a2.save("bundle", t2); + }, fetchSession() { + return this._setup_promise === void 0 && (this._setup_promise = new Promise((e2, t2) => { + this.fetch({success: () => { + Uc.omemo_store.get("device_id") ? e2() : this.generateBundle().then(e2).catch(t2); + }, error: (n2, r2) => { + zn.warn("Could not fetch OMEMO session from cache, we'll generate a new one."), zn.warn(r2), this.generateBundle().then(e2).catch(t2); + }}); + })), this._setup_promise; + }}), Uc.Device = qo.extend({defaults: {trusted: 0, active: true}, getRandomPreKey() { + const e2 = this.get("bundle"); + return e2.prekeys[Lx.getRandomInt(e2.prekeys.length)]; + }, async fetchBundleFromServer() { + const e2 = Dx({type: "get", from: Uc.bare_jid, to: this.get("jid")}).c("pubsub", {xmlns: Ix.NS.PUBSUB}).c("items", {node: "".concat(Ix.NS.OMEMO_BUNDLES, ":").concat(this.get("id"))}); + let t2; + try { + t2 = await Vc.sendIQ(e2); + } catch (t3) { + return zn.error("Could not fetch bundle for device ".concat(this.get("id"), " from ").concat(this.get("jid"))), zn.error(t3), null; + } + if (t2.querySelector("error")) + throw new Fx("Could not fetch bundle", t2); + const n2 = Mx('items[node="'.concat(Ix.NS.OMEMO_BUNDLES, ":").concat(this.get("id"), '"]'), t2).pop(), r2 = Vx(Mx('bundle[xmlns="'.concat(Ix.NS.OMEMO, '"]'), n2).pop()); + return this.save("bundle", r2), r2; + }, getBundle() { + return this.get("bundle") ? Promise.resolve(this.get("bundle"), this) : this.fetchBundleFromServer(); + }}), Uc.Devices = ra.extend({model: Uc.Device}), Uc.DeviceList = qo.extend({idAttribute: "jid", initialize() { + this.devices = new Uc.Devices(); + const e2 = "converse.devicelist-".concat(Uc.bare_jid, "-").concat(this.get("jid")); + this.devices.browserStorage = Uc.createStore(e2), this.fetchDevices(); + }, async onDevicesFound(e2) { + if (e2.length === 0) { + let e3; + try { + e3 = await this.fetchDevicesFromServer(); + } catch (e4) { + e4 === null ? zn.error("Timeout error while fetching devices for ".concat(this.get("jid"))) : (zn.error("Could not fetch devices for ".concat(this.get("jid"))), zn.error(e4)), this.destroy(); + } + this.get("jid") === Uc.bare_jid && await this.publishCurrentDevice(e3); + } + }, fetchDevices() { + return this._devices_promise === void 0 && (this._devices_promise = new Promise((e2) => { + this.devices.fetch({success: (t2) => e2(this.onDevicesFound(t2)), error: (t2, n2) => { + zn.error(n2), e2(); + }}); + })), this._devices_promise; + }, async getOwnDeviceId() { + let e2 = Uc.omemo_store.get("device_id"); + return this.devices.findWhere({id: e2}) || (await Uc.omemo_store.generateBundle(), e2 = Uc.omemo_store.get("device_id")), e2; + }, async publishCurrentDevice(e2) { + if (this.get("jid") === Uc.bare_jid) { + if (await Kx(), Uc.omemo_store) + return e2.includes(await this.getOwnDeviceId()) ? void 0 : this.publishDevices(); + zn.warn("publishCurrentDevice: omemo_store is not defined, likely a timing issue"); + } + }, async fetchDevicesFromServer() { + const e2 = Dx({type: "get", from: Uc.bare_jid, to: this.get("jid")}).c("pubsub", {xmlns: Ix.NS.PUBSUB}).c("items", {node: Ix.NS.OMEMO_DEVICELIST}); + let t2; + try { + t2 = await Vc.sendIQ(e2); + } catch (e3) { + return zn.error(e3), []; + } + const n2 = 'list[xmlns="'.concat(Ix.NS.OMEMO, '"] device'), r2 = Mx(n2, t2).map((e3) => e3.getAttribute("id")); + return await Promise.all(r2.map((e3) => this.devices.create({id: e3, jid: this.get("jid")}, {promise: true}))), r2; + }, publishDevices() { + const e2 = Rx("item", {id: "current"}).c("list", {xmlns: Ix.NS.OMEMO}); + this.devices.filter((e3) => e3.get("active")).forEach((t2) => e2.c("device", {id: t2.get("id")}).up()); + return Vc.pubsub.publish(null, Ix.NS.OMEMO_DEVICELIST, e2, {"pubsub#access_model": "open"}, false); + }, removeOwnDevices(e2) { + if (this.get("jid") !== Uc.bare_jid) + throw new Error("Cannot remove devices from someone else's device list"); + return e2.forEach((e3) => this.devices.get(e3).destroy()), this.publishDevices(); + }}), Uc.DeviceLists = ra.extend({model: Uc.DeviceList, getDeviceList(e2) { + return this.get(e2) || this.create({jid: e2}); + }}), Vc.waitUntil("chatBoxesInitialized").then(qx), Vc.listen.on("parseMessage", Bx), Vc.listen.on("parseMUCMessage", Bx), Vc.listen.on("chatBoxViewInitialized", Hx), Vc.listen.on("chatRoomViewInitialized", Hx), Vc.listen.on("connected", Yx), Vc.listen.on("getToolbarButtons", rE), Vc.listen.on("statusInitialized", eE), Vc.listen.on("addClientFeatures", () => Vc.disco.own.features.add("".concat(Ix.NS.OMEMO_DEVICELIST, "+notify"))), Vc.listen.on("userDetailsModalInitialized", (e2) => { + const t2 = e2.get("jid"); + Uc.generateFingerprints(t2).catch((e3) => zn.error(e3)); + }), Vc.listen.on("profileModalInitialized", () => { + Uc.generateFingerprints(Uc.bare_jid).catch((e2) => zn.error(e2)); + }), Vc.listen.on("afterTearDown", () => delete Uc.omemo_store), Vc.listen.on("clearSession", () => { + Uc.shouldClearCache() && Uc.devicelists && (Uc.devicelists.clearStore(), delete Uc.devicelists); + }), Object.assign(Uc.api, {omemo: {bundle: {generate: async () => { + const e2 = Uc.devicelists.get(Uc.bare_jid), t2 = Uc.omemo_store.get("device_id"); + if (t2) { + const n3 = e2.devices.get(t2); + Uc.omemo_store.unset(t2), n3 && await new Promise((e3) => n3.destroy({success: e3, error: e3})), e2.devices.trigger("remove"); + } + await Uc.omemo_store.generateBundle(), await e2.publishDevices(); + const n2 = Jx(e2.devices.get(Uc.omemo_store.get("device_id"))); + return await Uc.omemo_store.publishBundle(), n2; + }}}}); + }}); + /** + * @module converse-push + * @description + * Converse.js plugin which add support for registering + * an "App Server" as defined in XEP-0357 + * @copyright 2020, the Converse.js contributors + * @license Mozilla Public License (MPLv2) + */ + const {Strophe: oE, $iq: sE} = rl.env; + oE.addNamespace("PUSH", "urn:xmpp:push:0"), rl.plugins.add("converse-push", {initialize() { + async function e2(e3) { + e3 = e3 || Uc.bare_jid; + const t3 = Uc.session.get("push_enabled") || []; + if (t3.includes(e3)) + return; + const n2 = Vc.settings.get("push_app_servers").filter((e4) => !e4.disable), r2 = Vc.settings.get("push_app_servers").filter((e4) => e4.disable), i2 = n2.map((t4) => async function(e4, t5) { + if (!t5.jid || !t5.node) + return; + if (!await Vc.disco.getIdentity("pubsub", "push", t5.jid)) + return zn.warn('Not enabling push the service "'.concat(t5.jid, `", it doesn't have the right disco identtiy.`)); + const n3 = await Promise.all([Vc.disco.supports(oE.NS.PUSH, t5.jid), Vc.disco.supports(oE.NS.PUSH, e4)]); + if (!n3[0] && !n3[1]) + return void zn.warn('Not enabling push app server "'.concat(t5.jid, '", no disco support from your server.')); + const r3 = sE({type: "set"}); + return e4 !== Uc.bare_jid && r3.attrs({to: e4}), r3.c("enable", {xmlns: oE.NS.PUSH, jid: t5.jid, node: t5.node}), t5.secret && r3.c("x", {xmlns: oE.NS.XFORM, type: "submit"}).c("field", {var: "FORM_TYPE"}).c("value").t("".concat(oE.NS.PUBSUB, "#publish-options")).up().up().c("field", {var: "secret"}).c("value").t(t5.secret), Vc.sendIQ(r3); + }(e3, t4)), o2 = r2.map((t4) => async function(e4, t5) { + if (!t5.jid) + return; + if (!await Vc.disco.supports(oE.NS.PUSH, e4 || Uc.bare_jid)) + return void zn.warn('Not disabling push app server "'.concat(t5.jid, '", no disco support from your server.')); + const n3 = sE({type: "set"}); + e4 !== Uc.bare_jid && n3.attrs({to: e4}), n3.c("disable", {xmlns: oE.NS.PUSH, jid: t5.jid}), t5.node && n3.attrs({node: t5.node}), Vc.sendIQ(n3).catch((e5) => { + zn.error("Could not disable push app server for ".concat(t5.jid)), zn.error(e5); + }); + }(e3, t4)); + try { + await Promise.all(i2.concat(o2)); + } catch (e4) { + zn.error("Could not enable or disable push App Server"), e4 && zn.error(e4); + } finally { + t3.push(e3); + } + Uc.session.save("push_enabled", t3); + } + function t2(t3) { + t3.get("type") == Uc.CHATROOMS_TYPE && e2(oE.getDomainFromJid(t3.get("jid"))); + } + Vc.settings.extend({push_app_servers: [], enable_muc_push: false}), Vc.listen.on("statusInitialized", () => e2()), Vc.settings.get("enable_muc_push") && Vc.listen.on("chatBoxesInitialized", () => Uc.chatboxes.on("add", t2)); + }}); + var aE = n(181), cE = n.n(aE), lE = n(182), uE = n.n(lE), dE = n(183), hE = n.n(dE); + /** + * @module converse-register + * @description + * This is a Converse.js plugin which add support for in-band registration + * as specified in XEP-0077. + * @copyright 2020, the Converse.js contributors + * @license Mozilla Public License (MPLv2) + */ + const {Strophe: fE, sizzle: pE, $iq: gE} = rl.env, mE = rl.env.utils; + fE.addNamespace("REGISTER", "jabber:iq:register"); + const vE = Object.keys(fE.Status).reduce((e2, t2) => Math.max(e2, fE.Status[t2]), 0); + function _E() { + const e2 = xE(['\n <div class="list-container list-container--openrooms ', '">\n <a class="list-toggle open-rooms-toggle controlbox-padded" title="', '" @click=', '>\n <span class="fa ', '"></span> ', '</a>\n <div class="items-list rooms-list open-rooms-list ', '">\n ', "\n </div>\n </div>"]); + return _E = function() { + return e2; + }, e2; + } + function bE() { + const e2 = xE(['\n <div class="list-item controlbox-padded available-chatroom d-flex flex-row ', " ", '"\n data-room-jid="', '">\n\n ', '\n <a class="list-item-link open-room available-room w-100"\n data-room-jid="', '"\n title="', '"\n @click=', ">", "</a>\n\n ", '\n\n <a class="list-item-action room-info fa fa-info-circle"\n data-room-jid="', '"\n title="', '"\n @click=', '></a>\n\n <a class="list-item-action fa fa-sign-out-alt close-room"\n data-room-jid="', '"\n data-room-name="', '"\n title="', '"\n @click=', "></a>\n </div>"]); + return bE = function() { + return e2; + }, e2; + } + function yE() { + const e2 = xE(['<span class="list-item-badge badge badge--muc msgs-indicator">', "</span>"]); + return yE = function() { + return e2; + }, e2; + } + function wE() { + const e2 = xE(['\n <a class="list-item-action fa fa-bookmark add-bookmark"\n data-room-jid="', '"\n data-bookmark-name="', '"\n @click=', '\n title="', '"></a>']); + return wE = function() { + return e2; + }, e2; + } + function SE() { + const e2 = xE(['\n <a class="list-item-action fa fa-bookmark remove-bookmark button-on"\n data-room-jid="', '"\n data-bookmark-name="', '"\n @click=', '\n title="', '"></a>']); + return SE = function() { + return e2; + }, e2; + } + function xE(e2, t2) { + return t2 || (t2 = e2.slice(0)), Object.freeze(Object.defineProperties(e2, {raw: {value: Object.freeze(t2)}})); + } + fE.Status.REGIFAIL = vE + 1, fE.Status.REGISTERED = vE + 2, fE.Status.CONFLICT = vE + 3, fE.Status.NOTACCEPTABLE = vE + 5, rl.plugins.add("converse-register", {enabled: () => true, overrides: {ControlBoxView: {renderLoginPanel() { + return this.__super__.renderLoginPanel.apply(this, arguments), this.renderRegistrationPanel(), this; + }}}, initialize() { + function e2(e3) { + Vc.waitUntil("controlBoxInitialized").then(() => { + Uc.chatboxes.get("controlbox").set({"active-form": e3}); + }).catch((e4) => zn.fatal(e4)); + } + Uc.CONNECTION_STATUS[fE.Status.REGIFAIL] = "REGIFAIL", Uc.CONNECTION_STATUS[fE.Status.REGISTERED] = "REGISTERED", Uc.CONNECTION_STATUS[fE.Status.CONFLICT] = "CONFLICT", Uc.CONNECTION_STATUS[fE.Status.NOTACCEPTABLE] = "NOTACCEPTABLE", Vc.settings.extend({allow_registration: true, domain_placeholder: zd(" e.g. conversejs.org"), providers_link: "https://compliance.conversations.im/", registration_domain: ""}), Object.assign(Uc.ControlBoxView.prototype, {showLoginOrRegisterForm() { + this.registerpanel && (this.model.get("active-form") == "register" ? (this.loginpanel.el.classList.add("hidden"), this.registerpanel.el.classList.remove("hidden")) : (this.loginpanel.el.classList.remove("hidden"), this.registerpanel.el.classList.add("hidden"))); + }, renderRegistrationPanel() { + if (Vc.settings.get("allow_registration")) { + this.registerpanel = new Uc.RegisterPanel({model: this.model}), this.registerpanel.render(), this.registerpanel.el.classList.add("hidden"); + const e3 = this.el.querySelector("#converse-login-panel"); + e3 && e3.insertAdjacentElement("afterend", this.registerpanel.el), this.showLoginOrRegisterForm(); + } + return this; + }}), Uc.router.route("converse/login", () => e2("login")), Uc.router.route("converse/register", () => e2("register")), Uc.RegisterPanel = eh.extend({tagName: "div", id: "converse-register-panel", className: "controlbox-pane fade-in", events: {"submit form#converse-register": "onFormSubmission", "click .button-cancel": "renderProviderChoiceForm"}, initialize() { + this.reset(), Vc.listen.on("connectionInitialized", () => this.registerHooks()); + }, render() { + return this.model.set("registration_form_rendered", false), this.el.innerHTML = cE()({__: zd, default_domain: Vc.settings.get("registration_domain"), label_register: zd("Fetch registration form"), help_providers: zd("Tip: A list of public XMPP providers is available"), help_providers_link: zd("here"), href_providers: Vc.settings.get("providers_link"), domain_placeholder: Vc.settings.get("domain_placeholder")}), Vc.settings.get("registration_domain") && this.fetchRegistrationForm(Vc.settings.get("registration_domain")), this; + }, registerHooks() { + const e3 = Uc.connection, t2 = e3._connect_cb.bind(e3); + e3._connect_cb = (e4, n2, r2) => { + this._registering ? this.getRegistrationFields(e4, n2) && (this._registering = false) : t2(e4, n2, r2); + }; + }, getRegistrationFields(e3, t2) { + const n2 = Uc.connection; + n2.connected = true; + const r2 = n2._proto._reqToData(e3); + if (!r2) + return; + if (n2._proto._connect_cb(r2) === fE.Status.CONNFAIL) + return this.showValidationError(zd("Sorry, we're unable to connect to your chosen provider.")), false; + const i2 = r2.getElementsByTagName("register"), o2 = r2.getElementsByTagName("mechanism"); + if (i2.length === 0 && o2.length === 0) + return n2._proto._no_auth_received(t2), false; + if (i2.length === 0) + return n2._changeConnectStatus(fE.Status.REGIFAIL), this.showValidationError(zd("Sorry, the given provider does not support in band account registration. Please try with a different provider.")), true; + n2._addSysHandler(this.onRegistrationFields.bind(this), null, "iq", null, null); + const s2 = gE({type: "get"}).c("query", {xmlns: fE.NS.REGISTER}).tree(); + return s2.setAttribute("id", n2.getUniqueId("sendIQ")), n2.send(s2), n2.connected = false, true; + }, onRegistrationFields(e3) { + return e3.getAttribute("type") === "error" ? (Uc.connection._changeConnectStatus(fE.Status.REGIFAIL, zd('Something went wrong while establishing a connection with "%1$s". Are you sure it exists?', this.domain)), false) : e3.getElementsByTagName("query").length !== 1 ? (Uc.connection._changeConnectStatus(fE.Status.REGIFAIL, "unknown"), false) : (this.setFields(e3), this.model.get("registration_form_rendered") || this.renderRegistrationForm(e3), false); + }, reset(e3) { + const t2 = {fields: {}, urls: [], title: "", instructions: "", registered: false, _registering: false, domain: null, form_type: null}; + Object.assign(this, t2), e3 && Object.assign(this, Bo(e3, Object.keys(t2))); + }, onFormSubmission(e3) { + e3 && e3.preventDefault && e3.preventDefault(), e3.target.querySelector("input[name=domain]") === null ? this.submitRegistrationForm(e3.target) : this.onProviderChosen(e3.target); + }, onProviderChosen(e3) { + const t2 = e3.querySelector("input[name=domain]"), n2 = t2 == null ? void 0 : t2.value; + n2 ? (e3.querySelector("input[type=submit]").classList.add("hidden"), this.fetchRegistrationForm(n2.trim())) : t2.classList.add("error"); + }, async fetchRegistrationForm(e3) { + var t2; + return this.model.get("registration_form_rendered") || this.renderRegistrationRequest(), this.reset({domain: fE.getDomainFromJid(e3), _registering: true}), await Uc.initConnection(this.domain), (t2 = Uc.connection) === null || t2 === void 0 || t2.connect(this.domain, "", (e4) => this.onConnectStatusChanged(e4)), false; + }, renderRegistrationRequest() { + this.clearRegistrationForm().insertAdjacentHTML("beforeend", hE()({__: Uc.__, cancel: Vc.settings.get("registration_domain")})); + }, giveFeedback(e3, t2) { + let n2 = this.el.querySelector(".reg-feedback"); + n2 !== null && n2.parentNode.removeChild(n2); + const r2 = this.el.querySelector("form"); + r2.insertAdjacentHTML("afterbegin", '<span class="reg-feedback"></span>'), n2 = r2.querySelector(".reg-feedback"), n2.textContent = e3, t2 && n2.classList.add(t2); + }, clearRegistrationForm() { + const e3 = this.el.querySelector("form"); + return e3.innerHTML = "", this.model.set("registration_form_rendered", false), e3; + }, showSpinner() { + const e3 = this.el.querySelector("form"); + return Ya(fp(), e3), this.model.set("registration_form_rendered", false), this; + }, onConnectStatusChanged(e3) { + zn.debug("converse-register: onConnectStatusChanged"), [fE.Status.DISCONNECTED, fE.Status.CONNFAIL, fE.Status.REGIFAIL, fE.Status.NOTACCEPTABLE, fE.Status.CONFLICT].includes(e3) ? (zn.error("Problem during registration: Strophe.Status is ".concat(Uc.CONNECTION_STATUS[e3])), this.abortRegistration()) : e3 === fE.Status.REGISTERED && (zn.debug("Registered successfully."), Uc.connection.reset(), this.showSpinner(), ["converse/login", "converse/register"].includes(Uc.router.history.getFragment()) && Uc.router.navigate("", {replace: true}), this.fields.password && this.fields.username ? (Uc.connection.connect(this.fields.username.toLowerCase() + "@" + this.domain.toLowerCase(), this.fields.password, Uc.onConnectStatusChanged), this.giveFeedback(zd("Now logging you in"), "info")) : (Uc.chatboxviews.get("controlbox").renderLoginPanel(), Uc.giveFeedback(zd("Registered successfully"))), this.reset()); + }, renderLegacyRegistrationForm(e3) { + Object.keys(this.fields).forEach((t2) => { + t2 === "username" ? e3.insertAdjacentHTML("beforeend", Eh()({domain: " @".concat(this.domain), name: t2, type: "text", label: t2, value: "", required: true})) : e3.insertAdjacentHTML("beforeend", mh()({label: t2, name: t2, placeholder: t2, required: true, type: t2 === "password" || t2 === "email" ? t2 : "text", value: ""})); + }), this.urls.forEach((t2) => e3.insertAdjacentHTML("afterend", '<a target="blank" rel="noopener" href="' + t2 + '">' + t2 + "</a>")); + }, renderRegistrationForm(e3) { + const t2 = this.el.querySelector("form"); + t2.innerHTML = uE()({__: zd, domain: this.domain, title: this.title, instructions: this.instructions, registration_domain: Vc.settings.get("registration_domain")}); + const n2 = t2.querySelector("fieldset.buttons"); + this.form_type === "xform" ? e3.querySelectorAll("field").forEach((t3) => { + n2.insertAdjacentHTML("beforebegin", Kl.xForm2webForm(t3, e3, {domain: this.domain})); + }) : this.renderLegacyRegistrationForm(t2), this.fields || t2.querySelector(".button-primary").classList.add("hidden"), t2.classList.remove("hidden"), this.model.set("registration_form_rendered", true); + }, showValidationError(e3) { + const t2 = this.el.querySelector("form"); + let n2 = t2.querySelector(".form-errors"); + if (n2 === null) { + n2 = '<div class="form-errors hidden"></div>'; + const e4 = t2.querySelector("p.instructions"); + e4 === null ? t2.insertAdjacentHTML("afterbegin", n2) : e4.insertAdjacentHTML("afterend", n2), n2 = t2.querySelector(".form-errors"); + } else + n2.innerHTML = ""; + n2.insertAdjacentHTML("beforeend", '<p class="form-help error">' + e3 + "</p>"), n2.classList.remove("hidden"); + }, reportErrors(e3) { + const t2 = e3.querySelectorAll("error"); + if (t2.forEach((e4) => this.showValidationError(e4.textContent)), !t2.length) { + const e4 = zd("The provider rejected your registration attempt. Please check the values you entered for correctness."); + this.showValidationError(e4); + } + }, renderProviderChoiceForm(e3) { + e3 && e3.preventDefault && e3.preventDefault(), Uc.connection._proto._abortAllRequests(), Uc.connection.reset(), this.render(); + }, abortRegistration() { + Uc.connection._proto._abortAllRequests(), Uc.connection.reset(), this.model.get("registration_form_rendered") ? Vc.settings.get("registration_domain") && this.model.get("registration_form_rendered") && this.fetchRegistrationForm(Vc.settings.get("registration_domain")) : this.render(); + }, submitRegistrationForm(e3) { + if (Array.from(this.el.querySelectorAll("input.required")).reduce((e4, t3) => t3.value === "" ? (t3.classList.add("error"), e4 + 1) : e4, 0)) + return; + const t2 = pE(":input:not([type=button]):not([type=submit])", e3), n2 = gE({type: "set", id: mE.getUniqueId()}).c("query", {xmlns: fE.NS.REGISTER}); + if (this.form_type === "xform") { + n2.c("x", {xmlns: fE.NS.XFORM, type: "submit"}), t2.map((e4) => Kl.webForm2xForm(e4)).filter((e4) => e4).forEach((e4) => n2.cnode(e4).up()); + } else + t2.forEach((e4) => n2.c(e4.getAttribute("name"), {}, e4.value)); + Uc.connection._addSysHandler(this._onRegisterIQ.bind(this), null, "iq", null, null), Uc.connection.send(n2), this.setFields(n2.tree()); + }, setFields(e3) { + const t2 = e3.querySelector("query"), n2 = pE('x[xmlns="'.concat(fE.NS.XFORM, '"]'), t2); + n2.length > 0 ? this._setFieldsFromXForm(n2.pop()) : this._setFieldsFromLegacy(t2); + }, _setFieldsFromLegacy(e3) { + [].forEach.call(e3.children, (e4) => { + e4.tagName.toLowerCase() !== "instructions" ? e4.tagName.toLowerCase() !== "x" ? this.fields[e4.tagName.toLowerCase()] = fE.getText(e4) : e4.getAttribute("xmlns") === "jabber:x:oob" && this.urls.concat(pE("url", e4).map((e5) => e5.textContent)) : this.instructions = fE.getText(e4); + }), this.form_type = "legacy"; + }, _setFieldsFromXForm(e3) { + var t2, n2; + this.title = (t2 = e3.querySelector("title")) === null || t2 === void 0 ? void 0 : t2.textContent, this.instructions = (n2 = e3.querySelector("instructions")) === null || n2 === void 0 ? void 0 : n2.textContent, e3.querySelectorAll("field").forEach((e4) => { + const t3 = e4.getAttribute("var"); + var n3, r2; + t3 ? this.fields[t3.toLowerCase()] = (n3 = (r2 = e4.querySelector("value")) === null || r2 === void 0 ? void 0 : r2.textContent) !== null && n3 !== void 0 ? n3 : "" : zn.warn("Found field we couldn't parse"); + }), this.form_type = "xform"; + }, _onRegisterIQ(e3) { + if (e3.getAttribute("type") === "error") { + zn.error("Registration failed."), this.reportErrors(e3); + let t2 = e3.getElementsByTagName("error"); + if (t2.length !== 1) + return Uc.connection._changeConnectStatus(fE.Status.REGIFAIL, "unknown"), false; + t2 = t2[0].firstElementChild.tagName.toLowerCase(), t2 === "conflict" ? Uc.connection._changeConnectStatus(fE.Status.CONFLICT, t2) : t2 === "not-acceptable" ? Uc.connection._changeConnectStatus(fE.Status.NOTACCEPTABLE, t2) : Uc.connection._changeConnectStatus(fE.Status.REGIFAIL, t2); + } else + Uc.connection._changeConnectStatus(fE.Status.REGISTERED, null); + return false; + }}), Vc.listen.on("controlBoxInitialized", (e3) => { + e3.model.on("change:active-form", e3.showLoginOrRegisterForm, e3); + }); + }}); + const EE = (e2) => { + const t2 = zd("Leave this groupchat"); + return Za(bE(), e2.currently_open(e2.room) ? "open" : "", e2.room.get("num_unread_general") ? "unread-msgs" : "", e2.room.get("jid"), e2.room.get("num_unread") ? ((e3) => Za(yE(), e3.room.get("num_unread")))(e2) : "", e2.room.get("jid"), zd("Click to open this groupchat"), e2.openRoom, e2.room.getDisplayName(), e2.allow_bookmarks ? ((e3) => { + const t3 = zd("Bookmark this groupchat"), n2 = zd("Unbookmark this groupchat"); + return e3.bookmarked ? Za(SE(), e3.room.get("jid"), e3.room.getDisplayName(), e3.removeBookmark, e3.bookmarked ? n2 : t3) : Za(wE(), e3.room.get("jid"), e3.room.getDisplayName(), e3.addBookmark, e3.bookmarked ? n2 : t3); + })(e2) : "", e2.room.get("jid"), zd("Show more information on this groupchat"), e2.showRoomDetailsModal, e2.room.get("jid"), e2.room.getDisplayName(), t2, e2.closeRoom); + }; + /** + * @module converse-roomslist + * @description + * Converse.js plugin which shows a list of currently open + * rooms in the "Rooms Panel" of the ControlBox. + * @copyright 2020, the Converse.js contributors + * @license Mozilla Public License (MPLv2) + */ + const {Strophe: AE} = rl.env, CE = rl.env.utils; + function jE() { + const e2 = function(e3, t2) { + t2 || (t2 = e3.slice(0)); + return Object.freeze(Object.defineProperties(e3, {raw: {value: Object.freeze(t2)}})); + }(['\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title" id="addContactModalLabel">', "</h5>\n ", '\n </div>\n <form class="converse-form add-xmpp-contact">\n <div class="modal-body">\n <span class="modal-alert"></span>\n <div class="form-group add-xmpp-contact__jid">\n <label class="clearfix" for="jid">', ':</label>\n <div class="suggestion-box suggestion-box__jid">\n <ul class="suggestion-box__results suggestion-box__results--above" hidden=""></ul>\n <input type="text" name="jid" ?required=', '\n value="', '"\n class="form-control suggestion-box__input"\n placeholder="', '"/>\n <span class="suggestion-box__additions visually-hidden" role="status" aria-live="assertive" aria-relevant="additions"></span>\n </div>\n </div>\n <div class="form-group add-xmpp-contact__name">\n <label class="clearfix" for="name">', ':</label>\n <div class="suggestion-box suggestion-box__name">\n <ul class="suggestion-box__results suggestion-box__results--above" hidden=""></ul>\n <input type="text" name="name" value="', '"\n class="form-control suggestion-box__input"\n placeholder="', '"/>\n <span class="suggestion-box__additions visually-hidden" role="status" aria-live="assertive" aria-relevant="additions"></span>\n </div>\n </div>\n <div class="form-group">\n <div class="invalid-feedback">', '</div>\n </div>\n <button type="submit" class="btn btn-primary">', "</button>\n </div>\n </form>\n </div>\n </div>\n "]); + return jE = function() { + return e2; + }, e2; + } + rl.plugins.add("converse-roomslist", {dependencies: ["converse-singleton", "converse-controlbox", "converse-muc", "converse-bookmarks"], initialize() { + Vc.promises.add("roomsListInitialized"), Uc.RoomsList = qo.extend({defaults: {"toggle-state": Uc.OPENED}}), Uc.RoomsListView = eh.extend({tagName: "span", initialize() { + this.listenTo(this.model, "add", this.renderIfChatRoom), this.listenTo(this.model, "remove", this.renderIfChatRoom), this.listenTo(this.model, "destroy", this.renderIfChatRoom), this.listenTo(this.model, "change", this.renderIfRelevantChange); + const e3 = "converse.roomslist".concat(Uc.bare_jid); + this.list_model = new Uc.RoomsList({id: e3}), this.list_model.browserStorage = Uc.createStore(e3), this.list_model.fetch(), this.render(), this.insertIntoControlBox(); + }, renderIfChatRoom(e3) { + CE.isChatRoom(e3) && this.render(); + }, renderIfRelevantChange(e3) { + const t2 = ["bookmarked", "hidden", "name", "num_unread", "num_unread_general"], n2 = e3.changed || {}; + CE.isChatRoom(e3) && Object.keys(n2).filter((e4) => t2.includes(e4)).length && this.render(); + }, toHTML() { + return ((e3) => { + const t2 = zd("Click to toggle the list of open groupchats"); + return Za(_E(), e3.rooms.length ? "" : "hidden", t2, e3.toggleRoomsList, e3.toggle_state === e3._converse.OPENED ? "fa-caret-down" : "fa-caret-right", zd("Open Groupchats"), e3.collapsed && "collapsed", e3.rooms.map((t3) => EE(Object.assign({room: t3}, e3)))); + })({_converse: Uc, addBookmark: (e3) => this.addBookmark(e3), allow_bookmarks: Uc.allow_bookmarks && Uc.bookmarks, closeRoom: (e3) => this.closeRoom(e3), collapsed: this.list_model.get("toggle-state") !== Uc.OPENED, currently_open: (e3) => Uc.isUniView() && !e3.get("hidden"), openRoom: (e3) => this.openRoom(e3), removeBookmark: (e3) => this.removeBookmark(e3), rooms: this.model.filter((e3) => e3.get("type") === Uc.CHATROOMS_TYPE), showRoomDetailsModal: (e3) => this.showRoomDetailsModal(e3), toggleRoomsList: (e3) => this.toggleRoomsList(e3), toggle_state: this.list_model.get("toggle-state")}); + }, insertIntoControlBox() { + const e3 = Uc.chatboxviews.get("controlbox"); + if (e3 !== void 0 && !CE.rootContains(Uc.root, this.el)) { + const t2 = e3.el.querySelector(".list-container--openrooms"); + t2 && t2.parentNode.replaceChild(this.el, t2); + } + }, showRoomDetailsModal(e3) { + const t2 = e3.target.getAttribute("data-room-jid"), n2 = Uc.chatboxes.get(t2); + e3.preventDefault(), Vc.modal.show(dw, {model: n2}, e3); + }, async openRoom(e3) { + e3.preventDefault(); + const t2 = e3.target.textContent, n2 = e3.target.getAttribute("data-room-jid"), r2 = {name: t2 || AE.unescapeNode(AE.getNodeFromJid(n2)) || n2}; + await Vc.rooms.open(n2, r2, true), Vc.chatviews.get(n2).maybeFocus(); + }, closeRoom(e3) { + e3.preventDefault(); + const t2 = e3.target.getAttribute("data-room-name"), n2 = e3.target.getAttribute("data-room-jid"); + confirm(zd("Are you sure you want to leave the groupchat %1$s?", t2)) && Uc.chatboxviews.get(n2).close(); + }, removeBookmark: Uc.removeBookmarkViaEvent, addBookmark: Uc.addBookmarkViaEvent, toggleRoomsList(e3) { + e3 && e3.preventDefault && e3.preventDefault(); + const t2 = e3.target.matches(".fa") ? e3.target : e3.target.querySelector(".fa"); + t2.classList.contains("fa-caret-down") ? CE.slideIn(this.el.querySelector(".open-rooms-list")).then(() => { + this.list_model.save({"toggle-state": Uc.CLOSED}), t2.classList.remove("fa-caret-down"), t2.classList.add("fa-caret-right"); + }) : CE.slideOut(this.el.querySelector(".open-rooms-list")).then(() => { + this.list_model.save({"toggle-state": Uc.OPENED}), t2.classList.remove("fa-caret-right"), t2.classList.add("fa-caret-down"); + }); + }}); + const e2 = function() { + Uc.rooms_list_view = new Uc.RoomsListView({model: Uc.chatboxes}), Vc.trigger("roomsListInitialized"); + }; + Vc.listen.on("connected", async () => { + Uc.allow_bookmarks ? await Vc.waitUntil("bookmarksInitialized") : await Promise.all([Vc.waitUntil("chatBoxesFetched"), Vc.waitUntil("roomsPanelRendered")]), e2(); + }), Vc.listen.on("reconnected", e2); + }}); + const {Strophe: TE} = rl.env, OE = rl.env.utils, kE = df.extend({id: "add-contact-modal", events: {"submit form": "addContactFromForm"}, initialize() { + df.prototype.initialize.apply(this, arguments), this.listenTo(this.model, "change", this.render); + }, toHTML() { + const e2 = Vc.settings.get("xhr_user_search_url") ? zd("Contact name") : zd("Optional nickname"); + return ((e3) => { + const t2 = zd("name@example.org"), n2 = zd("Add"), r2 = zd("Please enter a valid XMPP address"), i2 = zd("Add a Contact"), o2 = zd("XMPP Address"), s2 = zd("Nickname"); + return Za(jE(), i2, mf, o2, !e3._converse.xhr_user_search_url, e3.jid || "", t2, s2, e3.nickname || "", s2, r2, n2); + })(Object.assign(this.model.toJSON(), {_converse: Uc, label_nickname: e2})); + }, afterRender() { + typeof Vc.settings.get("xhr_user_search_url") == "string" ? this.initXHRAutoComplete() : this.initJIDAutoComplete(); + const e2 = this.el.querySelector('input[name="jid"]'); + this.el.addEventListener("shown.bs.modal", () => e2.focus(), false); + }, initJIDAutoComplete() { + if (!Vc.settings.get("autocomplete_add_contact")) + return; + const e2 = this.el.querySelector(".suggestion-box__jid").parentElement; + this.jid_auto_complete = new Uc.AutoComplete(e2, {data: (e3, t2) => "".concat(t2.slice(0, t2.indexOf("@")), "@").concat(e3), filter: Uc.FILTER_STARTSWITH, list: [...new Set(Uc.roster.map((e3) => TE.getDomainFromJid(e3.get("jid"))))]}); + }, initXHRAutoComplete() { + if (!Vc.settings.get("autocomplete_add_contact")) + return this.initXHRFetch(); + const e2 = this.el.querySelector(".suggestion-box__name").parentElement; + this.name_auto_complete = new Uc.AutoComplete(e2, {auto_evaluate: false, filter: Uc.FILTER_STARTSWITH, list: []}); + const t2 = new window.XMLHttpRequest(); + t2.onload = () => { + if (t2.responseText) { + const e3 = t2.responseText; + this.name_auto_complete.list = JSON.parse(e3).map((e4) => ({label: e4.fullname || e4.jid, value: e4.jid})), this.name_auto_complete.auto_completing = true, this.name_auto_complete.evaluate(); + } + }; + const n2 = this.el.querySelector('input[name="name"]'); + n2.addEventListener("input", Rc(() => { + t2.open("GET", "".concat(Vc.settings.get("xhr_user_search_url"), "q=").concat(encodeURIComponent(n2.value)), true), t2.send(); + }, 300)), this.name_auto_complete.on("suggestion-box-selectcomplete", (e3) => { + this.el.querySelector('input[name="name"]').value = e3.text.label, this.el.querySelector('input[name="jid"]').value = e3.text.value; + }); + }, initXHRFetch() { + this.xhr = new window.XMLHttpRequest(), this.xhr.onload = () => { + if (this.xhr.responseText) { + const e2 = this.xhr.responseText, t2 = JSON.parse(e2).map((e3) => ({label: e3.fullname || e3.jid, value: e3.jid})); + if (t2.length !== 1) { + const e3 = this.el.querySelector(".invalid-feedback"); + return e3.textContent = zd("Sorry, could not find a contact with that name"), void OE.addClass("d-block", e3); + } + const n2 = t2[0].value; + if (this.validateSubmission(n2)) { + const e3 = this.el.querySelector("form"), r2 = t2[0].label; + this.afterSubmission(e3, n2, r2); + } + } + }; + }, validateSubmission(e2) { + const t2 = this.el.querySelector(".invalid-feedback"); + return !e2 || Ho(e2.split("@")).length < 2 ? (OE.addClass("is-invalid", this.el.querySelector('input[name="jid"]')), OE.addClass("d-block", t2), false) : Uc.roster.get(TE.getBareJidFromJid(e2)) ? (t2.textContent = zd("This contact has already been added"), OE.addClass("d-block", t2), false) : (OE.removeClass("d-block", t2), true); + }, afterSubmission(e2, t2, n2) { + Uc.roster.addAndSubscribe(t2, n2), this.model.clear(), this.modal.hide(); + }, addContactFromForm(e2) { + e2.preventDefault(); + const t2 = new FormData(e2.target), n2 = (t2.get("jid") || "").trim(); + if (!n2 && typeof Vc.settings.get("xhr_user_search_url") == "string") { + const e3 = this.el.querySelector('input[name="name"]'); + return this.xhr.open("GET", "".concat(Vc.settings.get("xhr_user_search_url"), "q=").concat(encodeURIComponent(e3.value)), true), void this.xhr.send(); + } + this.validateSubmission(n2) && this.afterSubmission(e2.target, n2, t2.get("name")); + }}); + Uc.AddContactModal = kE; + var NE = n(184), IE = n.n(NE), ME = n(185), RE = n.n(ME), DE = n(186), PE = n.n(DE), LE = n(187), zE = n.n(LE); + function FE() { + const e2 = function(e3, t2) { + t2 || (t2 = e3.slice(0)); + return Object.freeze(Object.defineProperties(e3, {raw: {value: Object.freeze(t2)}})); + }(['\n <form class="controlbox-padded roster-filter-form input-button-group ', '"\n @submit=', '>\n <div class="form-inline flex-nowrap">\n <div class="filter-by d-flex flex-nowrap">\n <span @click=', ' class="fa fa-user ', '" data-type="contacts" title="', '"></span>\n <span @click=', ' class="fa fa-users ', '" data-type="groups" title="', '"></span>\n <span @click=', ' class="fa fa-circle ', '" data-type="state" title="', '"></span>\n </div>\n <div class="btn-group">\n <input .value="', '"\n @keydown=', '\n class="roster-filter form-control ', '"\n placeholder="', '"/>\n <span class="clear-input fa fa-times ', '"\n @click=', '>\n </span>\n </div>\n <select class="form-control state-type ', '"\n @change=', '>\n <option value="">', "</option>\n <option ?selected=", ' value="unread_messages">', "</option>\n <option ?selected=", ' value="online">', "</option>\n <option ?selected=", ' value="chat">', "</option>\n <option ?selected=", ' value="dnd">', "</option>\n <option ?selected=", ' value="away">', "</option>\n <option ?selected=", ' value="xa">', "</option>\n <option ?selected=", ' value="offline">', "</option>\n </select>\n </div>\n </form>\n"]); + return FE = function() { + return e2; + }, e2; + } + var BE = n(188), qE = n.n(BE); + /** + * @module converse-rosterview + * @copyright 2020, the Converse.js contributors + * @license Mozilla Public License (MPLv2) + */ + const HE = rl.env.utils; + rl.plugins.add("converse-rosterview", {dependencies: ["converse-roster", "converse-modal", "converse-chatboxviews"], initialize() { + Vc.settings.extend({autocomplete_add_contact: true, allow_chat_pending_contacts: true, allow_contact_removal: true, hide_offline_users: false, roster_groups: true, xhr_user_search_url: null}), Vc.promises.add("rosterViewInitialized"); + const e2 = {dnd: zd("This contact is busy"), online: zd("This contact is online"), offline: zd("This contact is offline"), unavailable: zd("This contact is unavailable"), xa: zd("This contact is away for an extended period"), away: zd("This contact is away")}; + function t2() { + Vc.settings.get("authentication") !== Uc.ANONYMOUS && (Uc.rosterview = new Uc.RosterView({model: Uc.rostergroups}), Uc.rosterview.render(), Vc.trigger("rosterViewInitialized")); + } + Uc.RosterFilter = qo.extend({initialize() { + this.set({filter_text: "", filter_type: "contacts", chat_state: "online"}); + }}), Uc.RosterFilterView = eh.extend({tagName: "span", initialize() { + this.listenTo(this.model, "change:filter_type", this.render), this.listenTo(this.model, "change:filter_text", this.render); + }, toHTML() { + return e3 = Object.assign(this.model.toJSON(), {visible: this.shouldBeVisible(), placeholder: zd("Filter"), title_contact_filter: zd("Filter by contact name"), title_group_filter: zd("Filter by group name"), title_status_filter: zd("Filter by status"), label_any: zd("Any"), label_unread_messages: zd("Unread"), label_online: zd("Online"), label_chatty: zd("Chatty"), label_busy: zd("Busy"), label_away: zd("Away"), label_xa: zd("Extended Away"), label_offline: zd("Offline"), changeChatStateFilter: (e4) => this.changeChatStateFilter(e4), changeTypeFilter: (e4) => this.changeTypeFilter(e4), clearFilter: (e4) => this.clearFilter(e4), liveFilter: (e4) => this.liveFilter(e4), submitFilter: (e4) => this.submitFilter(e4)}), Za(FE(), e3.visible ? "fade-in" : "hidden", e3.submitFilter, e3.changeTypeFilter, e3.filter_type === "contacts" ? "selected" : "", e3.title_contact_filter, e3.changeTypeFilter, e3.filter_type === "groups" ? "selected" : "", e3.title_group_filter, e3.changeTypeFilter, e3.filter_type === "state" ? "selected" : "", e3.title_status_filter, e3.filter_text || "", e3.liveFilter, e3.filter_type === "state" ? "hidden" : "", e3.placeholder, e3.filter_text && e3.filter_type !== "state" ? "" : "hidden", e3.clearFilter, e3.filter_type !== "state" ? "hidden" : "", e3.changeChatStateFilter, e3.label_any, e3.chat_state === "unread_messages", e3.label_unread_messages, e3.chat_state === "online", e3.label_online, e3.chat_state === "chat", e3.label_chatty, e3.chat_state === "dnd", e3.label_busy, e3.chat_state === "away", e3.label_away, e3.chat_state === "xa", e3.label_xa, e3.chat_state === "offline", e3.label_offline); + var e3; + }, changeChatStateFilter(e3) { + e3 && e3.preventDefault(), this.model.save({chat_state: this.el.querySelector(".state-type").value}); + }, changeTypeFilter(e3) { + e3 && e3.preventDefault(); + const t3 = e3.target.dataset.type; + t3 === "state" ? this.model.save({filter_type: t3, chat_state: this.el.querySelector(".state-type").value}) : this.model.save({filter_type: t3, filter_text: this.el.querySelector(".roster-filter").value}); + }, liveFilter: Rc(function() { + this.model.save({filter_text: this.el.querySelector(".roster-filter").value}); + }, 250), submitFilter(e3) { + e3 && e3.preventDefault(), this.liveFilter(); + }, isActive() { + return this.model.get("filter_type") === "state" || this.model.get("filter_text"); + }, shouldBeVisible() { + return Uc.roster && Uc.roster.length >= 5 || this.isActive(); + }, clearFilter(e3) { + e3 && e3.preventDefault(), this.model.save({filter_text: ""}); + }}), Uc.RosterContactView = Uc.ViewWithAvatar.extend({tagName: "li", className: "list-item d-flex hidden controlbox-padded", events: {"click .accept-xmpp-request": "acceptRequest", "click .decline-xmpp-request": "declineRequest", "click .open-chat": "openChat", "click .remove-xmpp-contact": "removeContact"}, async initialize() { + await this.model.initialized, this.debouncedRender = Rc(this.render, 50), this.listenTo(this.model, "change", this.debouncedRender), this.listenTo(this.model, "destroy", this.remove), this.listenTo(this.model, "highlight", this.highlight), this.listenTo(this.model, "remove", this.remove), this.listenTo(this.model, "vcard:change", this.debouncedRender), this.listenTo(this.model.presence, "change:show", this.debouncedRender), this.render(); + }, render() { + if (!this.mayBeShown()) + return HE.hideElement(this.el), this; + const t3 = this.model.get("ask"), n2 = this.model.presence.get("show"), r2 = this.model.get("requesting"), i2 = this.model.get("subscription"), o2 = this.model.get("jid"); + if (["current-xmpp-contact", "pending-xmpp-contact", "requesting-xmpp-contact"].concat(Object.keys(e2)).forEach((e3) => HE.removeClass(e3, this.el)), this.el.classList.add(n2), this.el.setAttribute("data-status", n2), this.highlight(), Uc.isUniView()) { + const e3 = Uc.chatboxes.get(this.model.get("jid")); + e3 && (e3.get("hidden") ? this.el.classList.remove("open") : this.el.classList.add("open")); + } + if (t3 === "subscribe" || i2 === "from") { + const e3 = this.model.getDisplayName(); + this.el.classList.add("pending-xmpp-contact"), this.el.innerHTML = RE()(Object.assign(this.model.toJSON(), {display_name: e3, desc_remove: zd("Click to remove %1$s as a contact", e3), allow_chat_pending_contacts: Vc.settings.get("allow_chat_pending_contacts")})); + } else if (r2 === true) { + const e3 = this.model.getDisplayName(); + this.el.classList.add("requesting-xmpp-contact"), this.el.innerHTML = PE()(Object.assign(this.model.toJSON(), {display_name: e3, desc_accept: zd("Click to accept the contact request from %1$s", e3), desc_decline: zd("Click to decline the contact request from %1$s", e3), allow_chat_pending_contacts: Vc.settings.get("allow_chat_pending_contacts")})); + } else + (i2 === "both" || i2 === "to" || Uc.rosterview.isSelf(o2)) && (this.el.classList.add("current-xmpp-contact"), this.el.classList.remove(dv(["both", "to"], i2)[0]), this.el.classList.add(i2), this.renderRosterItem(this.model)); + return this; + }, highlight() { + if (Uc.isUniView()) { + const e3 = Uc.chatboxes.get(this.model.get("jid")); + e3 && e3.get("hidden") || !e3 ? this.el.classList.remove("open") : this.el.classList.add("open"); + } + }, renderRosterItem(t3) { + const n2 = t3.presence.get("show") || "offline"; + let r2; + r2 = n2 === "online" ? "fa fa-circle chat-status chat-status--online" : n2 === "away" ? "fa fa-circle chat-status chat-status--away" : n2 === "xa" ? "far fa-circle chat-status chat-status-xa" : n2 === "dnd" ? "fa fa-minus-circle chat-status chat-status--busy" : "fa fa-times-circle chat-status chat-status--offline"; + const i2 = t3.getDisplayName(); + return this.el.innerHTML = qE()(Object.assign(t3.toJSON(), {show: n2, display_name: i2, status_icon: r2, desc_status: e2[n2], desc_chat: zd("Click to chat with %1$s (XMPP address: %2$s)", i2, t3.get("jid")), desc_remove: zd("Click to remove %1$s as a contact", i2), allow_contact_removal: Vc.settings.get("allow_contact_removal"), num_unread: t3.get("num_unread") || 0, classes: ""})), this.renderAvatar(), this; + }, mayBeShown() { + const e3 = this.model.presence.get("show"); + return !Vc.settings.get("hide_offline_users") || e3 !== "offline" || (this.model.get("ask") === "subscribe" || this.model.get("subscription") === "from" || this.model.get("requesting") === true); + }, openChat(e3) { + e3 && e3.preventDefault && e3.preventDefault(), this.model.openChat(); + }, async removeContact(e3) { + if (e3 && e3.preventDefault && e3.preventDefault(), Vc.settings.get("allow_contact_removal") && confirm(zd("Are you sure you want to remove this contact?"))) + try { + await this.model.removeFromRoster(), this.remove(), this.model.collection && this.model.destroy(); + } catch (e4) { + zn.error(e4), Vc.alert("error", zd("Error"), [zd("Sorry, there was an error while trying to remove %1$s as a contact.", this.model.getDisplayName())]); + } + }, async acceptRequest(e3) { + e3 && e3.preventDefault && e3.preventDefault(), await Uc.roster.sendContactAddIQ(this.model.get("jid"), this.model.getFullname(), []), this.model.authorize().subscribe(); + }, declineRequest(e3) { + return e3 && e3.preventDefault && e3.preventDefault(), confirm(zd("Are you sure you want to decline this contact request?")) === true && this.model.unauthorize().destroy(), this; + }}), Uc.RosterGroupView = pv.extend({tagName: "div", className: "roster-group hidden", events: {"click a.group-toggle": "toggle"}, sortImmediatelyOnAdd: true, ItemView: Uc.RosterContactView, listItems: "model.contacts", listSelector: ".roster-group-contacts", sortEvent: "presenceChanged", initialize() { + pv.prototype.initialize.apply(this, arguments), this.model.get("name") === Uc.HEADER_UNREAD && this.listenTo(this.model.contacts, "change:num_unread", (e3) => !this.model.get("unread_messages") && this.removeContact(e3)), this.model.get("name") === Uc.HEADER_REQUESTING_CONTACTS && this.listenTo(this.model.contacts, "change:requesting", (e3) => !e3.get("requesting") && this.removeContact(e3)), this.model.get("name") === Uc.HEADER_PENDING_CONTACTS && this.listenTo(this.model.contacts, "change:subscription", (e3) => e3.get("subscription") !== "from" && this.removeContact(e3)), this.listenTo(this.model.contacts, "remove", this.onRemove), this.listenTo(Uc.roster, "change:groups", this.onContactGroupChange), Uc.rosterview.on("rosterContactsFetchedAndProcessed", () => this.sortAndPositionAllItems()); + }, render() { + return this.el.setAttribute("data-group", this.model.get("name")), this.el.innerHTML = IE()({label_group: this.model.get("name"), desc_group_toggle: this.model.get("description"), toggle_state: this.model.get("state"), _converse: Uc}), this.contacts_el = this.el.querySelector(".roster-group-contacts"), this; + }, show() { + return HE.showElement(this.el), this.model.get("state") === Uc.OPENED && Object.values(this.getAll()).filter((e3) => e3.mayBeShown()).forEach((e3) => HE.showElement(e3.el)), this; + }, collapse() { + return HE.slideIn(this.contacts_el); + }, filterOutContacts(e3 = []) { + let t3 = 0; + this.model.contacts.forEach((n2) => { + const r2 = this.get(n2.get("id")); + e3.includes(n2) ? HE.hideElement(r2.el) : r2.mayBeShown() && (HE.showElement(r2.el), t3 += 1); + }), t3 ? HE.showElement(this.el) : HE.hideElement(this.el); + }, getFilterMatches(e3, t3) { + if (e3.length === 0) + return []; + e3 = e3.toLowerCase(); + const n2 = this.model.contacts; + if (t3 === "state") { + return [Uc.HEADER_REQUESTING_CONTACTS, Uc.HEADER_UNREAD].includes(this.model.get("name")) ? [] : e3 === "unread_messages" ? n2.filter({num_unread: 0}) : e3 === "online" ? n2.filter((e4) => ["offline", "unavailable"].includes(e4.presence.get("show"))) : n2.filter((t4) => !t4.presence.get("show").includes(e3)); + } + return n2.filter((t4) => !t4.getFilterCriteria().includes(e3)); + }, filter(e3, t3) { + e3 == null && (e3 = (t3 = t3 || Uc.rosterview.filter_view.model.get("filter_type")) === "state" ? Uc.rosterview.filter_view.model.get("chat_state") : Uc.rosterview.filter_view.model.get("filter_text")), this.filterOutContacts(this.getFilterMatches(e3, t3)); + }, async toggle(e3) { + e3 && e3.preventDefault && e3.preventDefault(); + const t3 = e3.target.matches(".fa") ? e3.target : e3.target.querySelector(".fa"); + HE.hasClass("fa-caret-down", t3) ? (this.model.save({state: Uc.CLOSED}), await this.collapse(), t3.classList.remove("fa-caret-down"), t3.classList.add("fa-caret-right")) : (t3.classList.remove("fa-caret-right"), t3.classList.add("fa-caret-down"), this.model.save({state: Uc.OPENED}), this.filter(), HE.showElement(this.el), HE.slideOut(this.contacts_el)); + }, onContactGroupChange(e3) { + const t3 = e3.get("groups").includes(this.model.get("name")), n2 = e3.get("id"), r2 = !this.get(n2); + t3 && !r2 ? this.items.trigger("add", e3) : t3 || this.removeContact(e3); + }, removeContact(e3) { + this.model.contacts.remove(e3, {silent: true}), this.onRemove(e3); + }, onRemove(e3) { + this.remove(e3.get("jid")), this.model.contacts.length === 0 && this.remove(); + }}), Uc.RosterView = pv.extend({tagName: "div", id: "converse-roster", className: "controlbox-section", ItemView: Uc.RosterGroupView, listItems: "model", listSelector: ".roster-contacts", sortEvent: null, subviewIndex: "name", sortImmediatelyOnAdd: true, events: {"click a.controlbox-heading__btn.add-contact": "showAddContactModal", "click a.controlbox-heading__btn.sync-contacts": "syncContacts"}, initialize() { + pv.prototype.initialize.apply(this, arguments), this.listenTo(Uc.roster, "add", this.onContactAdded), this.listenTo(Uc.roster, "change:groups", this.onContactAdded), this.listenTo(Uc.roster, "change", this.onContactChange), this.listenTo(Uc.roster, "destroy", this.update), this.listenTo(Uc.roster, "remove", this.update), Uc.presences.on("change:show", () => { + this.update(), this.updateFilter(); + }), this.listenTo(this.model, "reset", this.reset), Vc.listen.on("rosterGroupsFetched", this.sortAndPositionAllItems.bind(this)), Vc.listen.on("rosterContactsFetched", () => { + Uc.roster.each((e3) => this.addRosterContact(e3, {silent: true})), this.update(), this.updateFilter(), this.trigger("rosterContactsFetchedAndProcessed"); + }), this.createRosterFilter(); + }, render() { + this.el.innerHTML = zE()({allow_contact_requests: Uc.allow_contact_requests, heading_contacts: zd("Contacts"), title_add_contact: zd("Add a contact"), title_sync_contacts: zd("Re-sync your contacts")}); + const e3 = this.el.querySelector(".roster-filter-form"); + return this.el.replaceChild(this.filter_view.render().el, e3), this.roster_el = this.el.querySelector(".roster-contacts"), this; + }, showAddContactModal(e3) { + Vc.modal.show(Uc.AddContactModal, {model: new qo()}, e3); + }, createRosterFilter() { + const e3 = new Uc.RosterFilter(); + e3.id = "_converse.rosterfilter-".concat(Uc.bare_jid), e3.browserStorage = Uc.createStore(e3.id), this.filter_view = new Uc.RosterFilterView({model: e3}), this.listenTo(this.filter_view.model, "change", this.updateFilter), this.filter_view.model.fetch(); + }, updateFilter: Rc(function() { + const e3 = this.filter_view.model.get("filter_type"); + e3 === "state" ? this.filter(this.filter_view.model.get("chat_state"), e3) : this.filter(this.filter_view.model.get("filter_text"), e3); + }, 100), update() { + return HE.isVisible(this.roster_el) || HE.showElement(this.roster_el), this.filter_view.render(), this; + }, filter(e3, t3) { + const n2 = Object.values(this.getAll()); + n2.forEach((e4) => e4.model.contacts.length > 0 && e4.show().filter("")), e3 = e3.toLowerCase(), t3 === "groups" ? n2.forEach((t4) => { + t4.model.get("name").toLowerCase().includes(e3) ? t4.model.contacts.length > 0 && HE.slideOut(t4.el) : HE.slideIn(t4.el); + }) : n2.forEach((n3) => n3.filter(e3, t3)); + }, async syncContacts(e3) { + e3.preventDefault(), HE.addClass("fa-spin", e3.target), Uc.roster.data.save("version", null), await Uc.roster.fetchFromServer(), Vc.user.presence.send(), HE.removeClass("fa-spin", e3.target); + }, reset() { + return this.removeAll(), this.render().update(), this; + }, onContactAdded(e3) { + this.addRosterContact(e3), this.update(), this.updateFilter(); + }, onContactChange(e3) { + this.update(), Xr(e3.changed, "subscription") && (e3.changed.subscription === "from" ? this.addContactToGroup(e3, Uc.HEADER_PENDING_CONTACTS) : ["both", "to"].includes(e3.get("subscription")) && this.addExistingContact(e3)), Xr(e3.changed, "num_unread") && e3.get("num_unread") && this.addContactToGroup(e3, Uc.HEADER_UNREAD), Xr(e3.changed, "ask") && e3.changed.ask === "subscribe" && this.addContactToGroup(e3, Uc.HEADER_PENDING_CONTACTS), Xr(e3.changed, "subscription") && e3.changed.requesting === "true" && this.addContactToGroup(e3, Uc.HEADER_REQUESTING_CONTACTS), this.updateFilter(); + }, getGroup(e3) { + const t3 = this.get(e3); + return t3 ? t3.model : this.model.create({name: e3}); + }, addContactToGroup(e3, t3, n2) { + this.getGroup(t3).contacts.add(e3, n2), this.sortAndPositionAllItems(); + }, addExistingContact(e3, t3) { + let n2; + Vc.settings.get("roster_groups") ? (n2 = e3.get("groups"), n2 = n2.length === 0 ? [Uc.HEADER_UNGROUPED] : n2) : n2 = [Uc.HEADER_CURRENT_CONTACTS], e3.get("num_unread") && n2.push(Uc.HEADER_UNREAD), n2.forEach((n3) => this.addContactToGroup(e3, n3, t3)); + }, isSelf: (e3) => HE.isSameBareJID(e3, Uc.connection.jid), addRosterContact(e3, t3) { + const n2 = e3.get("jid"); + if (e3.get("subscription") === "both" || e3.get("subscription") === "to" || this.isSelf(n2)) + this.addExistingContact(e3, t3); + else { + if (!Uc.allow_contact_requests) + return void zn.debug("Not adding requesting or pending contact ".concat(n2, " ") + "because allow_contact_requests is false"); + e3.get("ask") === "subscribe" || e3.get("subscription") === "from" ? this.addContactToGroup(e3, Uc.HEADER_PENDING_CONTACTS, t3) : e3.get("requesting") === true && this.addContactToGroup(e3, Uc.HEADER_REQUESTING_CONTACTS, t3); + } + return this; + }}), Vc.listen.on("chatBoxesInitialized", () => { + function e3(e4) { + const t3 = Uc.roster && Uc.roster.findWhere({jid: e4.get("jid")}); + t3 !== void 0 && t3.trigger("highlight"); + } + Uc.chatboxes.on("destroy", (t3) => e3(t3)), Uc.chatboxes.on("change:hidden", (t3) => e3(t3)); + }), Vc.listen.on("controlBoxInitialized", (e3) => { + function t3() { + e3.model.get("connected") && Vc.settings.get("authentication") !== Uc.ANONYMOUS && Vc.waitUntil("rosterViewInitialized").then(() => e3.controlbox_pane.el.insertAdjacentElement("beforeEnd", Uc.rosterview.el)).catch((e4) => zn.fatal(e4)); + } + t3(), e3.model.on("change:connected", t3); + }), Vc.listen.on("rosterInitialized", t2), Vc.listen.on("rosterReadyAfterReconnection", t2), Vc.listen.on("afterTearDown", () => { + rl.rosterview && (rl.rosterview.model.off().reset(), rl.rosterview.each((e3) => e3.removeAll().remove()), rl.rosterview.removeAll().remove(), delete rl.rosterview); + }); + }}); + n(501); + /** + * @description Converse.js (A browser based XMPP chat client) + * @copyright 2020, The Converse developers + * @license Mozilla Public License (MPLv2) + */ + const UE = ["converse-autocomplete", "converse-bookmark-views", "converse-chatboxviews", "converse-chatview", "converse-controlbox", "converse-dragresize", "converse-fullscreen", "converse-mam-views", "converse-minimize", "converse-modal", "converse-muc-views", "converse-headlines-view", "converse-notification", "converse-omemo", "converse-profile", "converse-push", "converse-register", "converse-roomslist", "converse-rosterview", "converse-singleton"]; + i.a.templateSettings = {escape: /\{\{\{([\s\S]+?)\}\}\}/g, evaluate: /\{\[([\s\S]+?)\]\}/g, interpolate: /\{\{([\s\S]+?)\}\}/g, imports: {_: i.a}}, rl.env._ = i.a; + const $E = rl.initialize; + rl.initialize = function(e2, t2) { + return Array.isArray(e2.whitelisted_plugins) ? e2.whitelisted_plugins = e2.whitelisted_plugins.concat(UE) : e2.whitelisted_plugins = UE, $E(e2, t2); + }; + t.default = rl; + }]); +}); +var __VIRTUAL_FILE$1 = /* @__PURE__ */ getDefaultExportFromCjs(__VIRTUAL_FILE); +export default __VIRTUAL_FILE$1; diff --git a/src/solid-xmpp-chat.js b/src/solid-xmpp-chat.js index 2c79254853fa584d79c5c2913aa29f7d3faf3a56..9d88d84a1c6c2e5b541fca267a40f39cf330390e 100644 --- a/src/solid-xmpp-chat.js +++ b/src/solid-xmpp-chat.js @@ -1,4 +1,4 @@ -import './conversejs/converse.js'; +import './conversejs/converse.min.js'; import './conversejs/emojis.js'; import './plugins/converse-rai.js'; import { Sib, store, StoreMixin } from 'https://cdn.skypack.dev/@startinblox/core@0.14';