This repository has been archived on 2022-09-21. You can view files and clone it, but cannot push or open issues or pull requests.
converse.js-dist/dist/converse.min.js

597 lines
1.1 MiB
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

!function(e){function t(t){for(var n,i,o=t[0],s=t[1],a=0,l=[];a<o.length;a++)i=o[a],Object.prototype.hasOwnProperty.call(r,i)&&r[i]&&l.push(r[i][0]),r[i]=0;for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n]);for(c&&c(t);l.length;)l.shift()()}var n={},r={178:0};function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.e=function(e){var t=[],n=r[e];if(0!==n)if(n)t.push(n[2]);else{var o=new Promise((function(t,i){n=r[e]=[t,i]}));t.push(n[2]=o);var s,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(e){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"}[e]||e)+".js"}(e);var c=new Error;s=function(t){a.onerror=a.onload=null,clearTimeout(l);var n=r[e];if(0!==n){if(n){var i=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;c.message="Loading chunk "+e+" failed.\n("+i+": "+o+")",c.name="ChunkLoadError",c.type=i,c.request=o,n[1](c)}r[e]=void 0}};var l=setTimeout((function(){s({type:"timeout",target:a})}),12e4);a.onerror=a.onload=s,document.head.appendChild(a)}return Promise.all(t)},i.m=e,i.c=n,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/dist/",i.oe=function(e){throw console.error(e),e};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){"use strict";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(e,t){const n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n},o=function(e){if("string"!=typeof e)throw new Error("str2binl was passed a non-string");const t=[];for(let n=0;n<8*e.length;n+=8)t[n>>5]|=(255&e.charCodeAt(n/8))<<n%32;return t},s=function(e,t,n,r,o,s){return i((a=i(i(t,e),i(r,s)))<<(c=o)|a>>>32-c,n);var a,c},a=function(e,t,n,r,i,o,a){return s(t&n|~t&r,e,t,i,o,a)},c=function(e,t,n,r,i,o,a){return s(t&r|n&~r,e,t,i,o,a)},l=function(e,t,n,r,i,o,a){return s(t^n^r,e,t,i,o,a)},u=function(e,t,n,r,i,o,a){return s(n^(t|~r),e,t,i,o,a)},d=function(e,t){e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;let n,r,o,s,d=1732584193,h=-271733879,f=-1732584194,p=271733878;for(let t=0;t<e.length;t+=16)n=d,r=h,o=f,s=p,d=a(d,h,f,p,e[t+0],7,-680876936),p=a(p,d,h,f,e[t+1],12,-389564586),f=a(f,p,d,h,e[t+2],17,606105819),h=a(h,f,p,d,e[t+3],22,-1044525330),d=a(d,h,f,p,e[t+4],7,-176418897),p=a(p,d,h,f,e[t+5],12,1200080426),f=a(f,p,d,h,e[t+6],17,-1473231341),h=a(h,f,p,d,e[t+7],22,-45705983),d=a(d,h,f,p,e[t+8],7,1770035416),p=a(p,d,h,f,e[t+9],12,-1958414417),f=a(f,p,d,h,e[t+10],17,-42063),h=a(h,f,p,d,e[t+11],22,-1990404162),d=a(d,h,f,p,e[t+12],7,1804603682),p=a(p,d,h,f,e[t+13],12,-40341101),f=a(f,p,d,h,e[t+14],17,-1502002290),h=a(h,f,p,d,e[t+15],22,1236535329),d=c(d,h,f,p,e[t+1],5,-165796510),p=c(p,d,h,f,e[t+6],9,-1069501632),f=c(f,p,d,h,e[t+11],14,643717713),h=c(h,f,p,d,e[t+0],20,-373897302),d=c(d,h,f,p,e[t+5],5,-701558691),p=c(p,d,h,f,e[t+10],9,38016083),f=c(f,p,d,h,e[t+15],14,-660478335),h=c(h,f,p,d,e[t+4],20,-405537848),d=c(d,h,f,p,e[t+9],5,568446438),p=c(p,d,h,f,e[t+14],9,-1019803690),f=c(f,p,d,h,e[t+3],14,-187363961),h=c(h,f,p,d,e[t+8],20,1163531501),d=c(d,h,f,p,e[t+13],5,-1444681467),p=c(p,d,h,f,e[t+2],9,-51403784),f=c(f,p,d,h,e[t+7],14,1735328473),h=c(h,f,p,d,e[t+12],20,-1926607734),d=l(d,h,f,p,e[t+5],4,-378558),p=l(p,d,h,f,e[t+8],11,-2022574463),f=l(f,p,d,h,e[t+11],16,1839030562),h=l(h,f,p,d,e[t+14],23,-35309556),d=l(d,h,f,p,e[t+1],4,-1530992060),p=l(p,d,h,f,e[t+4],11,1272893353),f=l(f,p,d,h,e[t+7],16,-155497632),h=l(h,f,p,d,e[t+10],23,-1094730640),d=l(d,h,f,p,e[t+13],4,681279174),p=l(p,d,h,f,e[t+0],11,-358537222),f=l(f,p,d,h,e[t+3],16,-722521979),h=l(h,f,p,d,e[t+6],23,76029189),d=l(d,h,f,p,e[t+9],4,-640364487),p=l(p,d,h,f,e[t+12],11,-421815835),f=l(f,p,d,h,e[t+15],16,530742520),h=l(h,f,p,d,e[t+2],23,-995338651),d=u(d,h,f,p,e[t+0],6,-198630844),p=u(p,d,h,f,e[t+7],10,1126891415),f=u(f,p,d,h,e[t+14],15,-1416354905),h=u(h,f,p,d,e[t+5],21,-57434055),d=u(d,h,f,p,e[t+12],6,1700485571),p=u(p,d,h,f,e[t+3],10,-1894986606),f=u(f,p,d,h,e[t+10],15,-1051523),h=u(h,f,p,d,e[t+1],21,-2054922799),d=u(d,h,f,p,e[t+8],6,1873313359),p=u(p,d,h,f,e[t+15],10,-30611744),f=u(f,p,d,h,e[t+6],15,-1560198380),h=u(h,f,p,d,e[t+13],21,1309151649),d=u(d,h,f,p,e[t+4],6,-145523070),p=u(p,d,h,f,e[t+11],10,-1120210379),f=u(f,p,d,h,e[t+2],15,718787259),h=u(h,f,p,d,e[t+9],21,-343485551),d=i(d,n),h=i(h,r),f=i(f,o),p=i(p,s);return[d,h,f,p]},h={hexdigest:function(e){return function(e){let t="";for(let n=0;n<4*e.length;n++)t+="0123456789abcdef".charAt(e[n>>2]>>n%4*8+4&15)+"0123456789abcdef".charAt(e[n>>2]>>n%4*8&15);return t}(d(o(e),8*e.length))},hash:function(e){return function(e){let t="";for(let n=0;n<32*e.length;n+=8)t+=String.fromCharCode(e[n>>5]>>>n%32&255);return t}(d(o(e),8*e.length))}};var f=n(7);const p=function(e){var t,n,r="",i=e.length;for(t=0;t<i;t++)(n=e.charCodeAt(t))>=0&&n<=127?r+=e.charAt(t):n>2047?(r+=String.fromCharCode(224|n>>12&15),r+=String.fromCharCode(128|n>>6&63),r+=String.fromCharCode(128|n>>0&63)):(r+=String.fromCharCode(192|n>>6&31),r+=String.fromCharCode(128|n>>0&63));return r},g=function(e){e=e||{};for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n="",r="",i="";const o=e[t],s="object"==typeof o,a=escape(unescape(s?o.value:o));s&&(n=o.expires?";expires="+o.expires:"",r=o.domain?";domain="+o.domain:"",i=o.path?";path="+o.path:""),document.cookie=t+"="+a+n+r+i}};var m=n(10);function v(e,t){return new w.Builder(e,t)}function _(e){return new w.Builder("message",e)}function b(e){return new w.Builder("iq",e)}function y(e){return new w.Builder("presence",e)}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(e){for(let t=0;t<w.XHTML.tags.length;t++)if(e===w.XHTML.tags[t])return!0;return!1},validAttribute(e,t){if(void 0!==w.XHTML.attributes[e]&&w.XHTML.attributes[e].length>0)for(let n=0;n<w.XHTML.attributes[e].length;n++)if(t===w.XHTML.attributes[e][n])return!0;return!1},validCSS(e){for(let t=0;t<w.XHTML.css.length;t++)if(e===w.XHTML.css[t])return!0;return!1}},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:.1,addNamespace(e,t){w.NS[e]=t},forEachChild(e,t,n){for(let r=0;r<e.childNodes.length;r++){const i=e.childNodes[r];i.nodeType!==w.ElementType.NORMAL||t&&!this.isTagEqual(i,t)||n(i)}},isTagEqual:(e,t)=>e.tagName===t,_xmlGenerator:null,xmlGenerator:()=>(w._xmlGenerator||(w._xmlGenerator=r.b()),w._xmlGenerator),xmlElement(e){if(!e)return null;const t=w.xmlGenerator().createElement(e);for(let e=1;e<arguments.length;e++){const n=arguments[e];if(n)if("string"==typeof n||"number"==typeof n)t.appendChild(w.xmlTextNode(n));else if("object"==typeof n&&"function"==typeof n.sort)for(let e=0;e<n.length;e++){const r=n[e];"object"==typeof r&&"function"==typeof r.sort&&void 0!==r[1]&&null!==r[1]&&t.setAttribute(r[0],r[1])}else if("object"==typeof n)for(const e in n)Object.prototype.hasOwnProperty.call(n,e)&&void 0!==n[e]&&null!==n[e]&&t.setAttribute(e,n[e])}return t},xmlescape:e=>e=(e=(e=(e=(e=e.replace(/\&/g,"&amp;")).replace(/</g,"&lt;")).replace(/>/g,"&gt;")).replace(/'/g,"&apos;")).replace(/"/g,"&quot;"),xmlunescape:e=>e=(e=(e=(e=(e=e.replace(/\&amp;/g,"&")).replace(/&lt;/g,"<")).replace(/&gt;/g,">")).replace(/&apos;/g,"'")).replace(/&quot;/g,'"'),xmlTextNode:e=>w.xmlGenerator().createTextNode(e),xmlHtmlNode(e){let t;if(r.a){t=(new r.a).parseFromString(e,"text/xml")}else t=new ActiveXObject("Microsoft.XMLDOM"),t.async="false",t.loadXML(e);return t},getText(e){if(!e)return null;let t="";0===e.childNodes.length&&e.nodeType===w.ElementType.TEXT&&(t+=e.nodeValue);for(let n=0;n<e.childNodes.length;n++)e.childNodes[n].nodeType===w.ElementType.TEXT&&(t+=e.childNodes[n].nodeValue);return w.xmlescape(t)},copyElement(e){let t;if(e.nodeType===w.ElementType.NORMAL){t=w.xmlElement(e.tagName);for(let n=0;n<e.attributes.length;n++)t.setAttribute(e.attributes[n].nodeName,e.attributes[n].value);for(let n=0;n<e.childNodes.length;n++)t.appendChild(w.copyElement(e.childNodes[n]))}else e.nodeType===w.ElementType.TEXT&&(t=w.xmlGenerator().createTextNode(e.nodeValue));return t},createHtml(e){let t;if(e.nodeType===w.ElementType.NORMAL){const n=e.nodeName.toLowerCase();if(w.XHTML.validTag(n))try{t=w.xmlElement(n);for(let r=0;r<w.XHTML.attributes[n].length;r++){const i=w.XHTML.attributes[n][r];let o=e.getAttribute(i);if(null!=o&&""!==o&&!1!==o&&0!==o)if("style"===i&&"object"==typeof o&&void 0!==o.cssText&&(o=o.cssText),"style"===i){const e=[],n=o.split(";");for(let t=0;t<n.length;t++){const r=n[t].split(":"),i=r[0].replace(/^\s*/,"").replace(/\s*$/,"").toLowerCase();if(w.XHTML.validCSS(i)){const t=r[1].replace(/^\s*/,"").replace(/\s*$/,"");e.push(i+": "+t)}}e.length>0&&(o=e.join("; "),t.setAttribute(i,o))}else t.setAttribute(i,o)}for(let n=0;n<e.childNodes.length;n++)t.appendChild(w.createHtml(e.childNodes[n]))}catch(e){t=w.xmlTextNode("")}else{t=w.xmlGenerator().createDocumentFragment();for(let n=0;n<e.childNodes.length;n++)t.appendChild(w.createHtml(e.childNodes[n]))}}else if(e.nodeType===w.ElementType.FRAGMENT){t=w.xmlGenerator().createDocumentFragment();for(let n=0;n<e.childNodes.length;n++)t.appendChild(w.createHtml(e.childNodes[n]))}else e.nodeType===w.ElementType.TEXT&&(t=w.xmlTextNode(e.nodeValue));return t},escapeNode:e=>"string"!=typeof e?e:e.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:e=>"string"!=typeof e?e:e.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:e=>e.indexOf("@")<0?null:e.split("@")[0],getDomainFromJid(e){const t=w.getBareJidFromJid(e);if(t.indexOf("@")<0)return t;{const e=t.split("@");return e.splice(0,1),e.join("@")}},getResourceFromJid(e){if(!e)return null;const t=e.split("/");return t.length<2?null:(t.splice(0,1),t.join("/"))},getBareJidFromJid:e=>e?e.split("/")[0]:null,_handleError(e){void 0!==e.stack&&w.fatal(e.stack),e.sourceURL?w.fatal("error: "+this.handler+" "+e.sourceURL+":"+e.line+" - "+e.name+": "+e.message):e.fileName?w.fatal("error: "+this.handler+" "+e.fileName+":"+e.lineNumber+" - "+e.name+": "+e.message):w.fatal("error: "+e.message)},log(e,t){e===this.LogLevel.FATAL&&"object"==typeof window.console&&"function"==typeof window.console.error&&window.console.error(t)},debug(e){this.log(this.LogLevel.DEBUG,e)},info(e){this.log(this.LogLevel.INFO,e)},warn(e){this.log(this.LogLevel.WARN,e)},error(e){this.log(this.LogLevel.ERROR,e)},fatal(e){this.log(this.LogLevel.FATAL,e)},serialize(e){if(!e)return null;"function"==typeof e.tree&&(e=e.tree());const t=[...Array(e.attributes.length).keys()].map(t=>e.attributes[t].nodeName);t.sort();let n=t.reduce((t,n)=>"".concat(t," ").concat(n,'="').concat(w.xmlescape(e.attributes.getNamedItem(n).value),'"'),"<".concat(e.nodeName));if(e.childNodes.length>0){n+=">";for(let t=0;t<e.childNodes.length;t++){const r=e.childNodes[t];switch(r.nodeType){case w.ElementType.NORMAL:n+=w.serialize(r);break;case w.ElementType.TEXT:n+=w.xmlescape(r.nodeValue);break;case w.ElementType.CDATA:n+="<![CDATA["+r.nodeValue+"]]>"}}n+="</"+e.nodeName+">"}else n+="/>";return n},_requestId:0,_connectionPlugins:{},addConnectionPlugin(e,t){w._connectionPlugins[e]=t},Builder:class{constructor(e,t){"presence"!==e&&"message"!==e&&"iq"!==e||(t&&!t.xmlns?t.xmlns=w.NS.CLIENT:t||(t={xmlns:w.NS.CLIENT})),this.nodeTree=w.xmlElement(e,t),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(e){for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(void 0===e[t]?this.node.removeAttribute(t):this.node.setAttribute(t,e[t]));return this}c(e,t,n){const r=w.xmlElement(e,t,n);return this.node.appendChild(r),"string"!=typeof n&&"number"!=typeof n&&(this.node=r),this}cnode(e){let t;const n=w.xmlGenerator();try{t=void 0!==n.importNode}catch(e){t=!1}const r=t?n.importNode(e,!0):w.copyElement(e);return this.node.appendChild(r),this.node=r,this}t(e){const t=w.xmlTextNode(e);return this.node.appendChild(t),this}h(e){const t=w.xmlGenerator().createElement("body");t.innerHTML=e;const n=w.createHtml(t);for(;n.childNodes.length>0;)this.node.appendChild(n.childNodes[0]);return this}},Handler:function(e,t,n,r,i,o,s){this.handler=e,this.ns=t,this.name=n,this.type=r,this.id=i,this.options=s||{matchBareFromJid:!1,ignoreNamespaceFragment:!1},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=o?w.getBareJidFromJid(o):null:this.from=o,this.user=!0}};w.Handler.prototype={getNamespace(e){let t=e.getAttribute("xmlns");return t&&this.options.ignoreNamespaceFragment&&(t=t.split("#")[0]),t},namespaceMatch(e){let t=!1;return!this.ns||(w.forEachChild(e,null,e=>{this.getNamespace(e)===this.ns&&(t=!0)}),t||this.getNamespace(e)===this.ns)},isMatch(e){let t=e.getAttribute("from");this.options.matchBareFromJid&&(t=w.getBareJidFromJid(t));const n=e.getAttribute("type");return!(!this.namespaceMatch(e)||this.name&&!w.isTagEqual(e,this.name)||this.type&&(Array.isArray(this.type)?-1===this.type.indexOf(n):n!==this.type)||this.id&&e.getAttribute("id")!==this.id||this.from&&t!==this.from)},run(e){let t=null;try{t=this.handler(e)}catch(e){throw w._handleError(e),e}return t},toString(){return"{Handler: "+this.handler+"("+this.name+","+this.id+","+this.ns+")}"}},w.TimedHandler=class{constructor(e,t){this.period=e,this.handler=t,this.lastCalled=(new Date).getTime(),this.user=!0}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(e,t){this.service=e,this.options=t||{};const n=this.options.protocol||"";this.options.worker?this._proto=new w.WorkerWebsocket(this):0===e.indexOf("ws:")||0===e.indexOf("wss:")||0===n.indexOf("ws")?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=!1,this.do_session=!1,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=!1,this.connected=!1,this.disconnecting=!1,this.do_authentication=!0,this.paused=!1,this.restored=!1,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 e in w._connectionPlugins)if(Object.prototype.hasOwnProperty.call(w._connectionPlugins,e)){const t=function(){};t.prototype=w._connectionPlugins[e],this[e]=new t,this[e].init(this)}}reset(){this._proto._reset(),this.do_session=!1,this.do_bind=!1,this.timedHandlers=[],this.handlers=[],this.removeTimeds=[],this.removeHandlers=[],this.addTimeds=[],this.addHandlers=[],this.authenticated=!1,this.connected=!1,this.disconnecting=!1,this.restored=!1,this._data=[],this._requests=[],this._uniqueId=0}pause(){this.paused=!0}resume(){this.paused=!1}getUniqueId(e){const t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}));return"string"==typeof e||"number"==typeof e?t+":"+e:t+""}addProtocolErrorHandler(e,t,n){this.protocolErrorHandlers[e][t]=n}connect(e,t,n,r,i,o,s){this.jid=e,this.authzid=w.getBareJidFromJid(this.jid),this.authcid=s||w.getNodeFromJid(this.jid),this.pass=t,this.connect_callback=n,this.disconnecting=!1,this.connected=!1,this.authenticated=!1,this.restored=!1,this.domain=w.getDomainFromJid(this.jid),this._changeConnectStatus(w.Status.CONNECTING,null),this._proto._connect(r,i,o)}attach(e,t,n,r,i,o,s){if(this._proto._attach)return this._proto._attach(e,t,n,r,i,o,s);{const e=new Error('The "attach" method is not available for your connection protocol');throw e.name="StropheSessionError",e}}restore(e,t,n,r,i){if(!this._sessionCachingSupported()){const e=new Error('The "restore" method can only be used with a BOSH connection.');throw e.name="StropheSessionError",e}this._proto._restore(e,t,n,r,i)}_sessionCachingSupported(){if(this._proto instanceof w.Bosh){if(!JSON)return!1;try{sessionStorage.setItem("_strophe_","_strophe_"),sessionStorage.removeItem("_strophe_")}catch(e){return!1}return!0}return!1}xmlInput(e){}xmlOutput(e){}rawInput(e){}rawOutput(e){}nextValidRid(e){}send(e){if(null!==e){if("function"==typeof e.sort)for(let t=0;t<e.length;t++)this._queueData(e[t]);else"function"==typeof e.tree?this._queueData(e.tree()):this._queueData(e);this._proto._send()}}flush(){clearTimeout(this._idleTimeout),this._onIdle()}sendPresence(e,t,n,r){let i=null;"function"==typeof e.tree&&(e=e.tree());let o=e.getAttribute("id");if(o||(o=this.getUniqueId("sendPresence"),e.setAttribute("id",o)),"function"==typeof t||"function"==typeof n){const e=this.addHandler(e=>{i&&this.deleteTimedHandler(i),"error"===e.getAttribute("type")?n&&n(e):t&&t(e)},null,"presence",null,o);r&&(i=this.addTimedHandler(r,()=>(this.deleteHandler(e),n&&n(null),!1)))}return this.send(e),o}sendIQ(e,t,n,r){let i=null;"function"==typeof e.tree&&(e=e.tree());let o=e.getAttribute("id");if(o||(o=this.getUniqueId("sendIQ"),e.setAttribute("id",o)),"function"==typeof t||"function"==typeof n){const e=this.addHandler(e=>{i&&this.deleteTimedHandler(i);const r=e.getAttribute("type");if("result"===r)t&&t(e);else{if("error"!==r){const e=new Error("Got bad IQ type of ".concat(r));throw e.name="StropheError",e}n&&n(e)}},null,"iq",["error","result"],o);r&&(i=this.addTimedHandler(r,()=>(this.deleteHandler(e),n&&n(null),!1)))}return this.send(e),o}_queueData(e){if(null===e||!e.tagName||!e.childNodes){const e=new Error("Cannot queue non-DOMElement.");throw e.name="StropheError",e}this._data.push(e)}_sendRestart(){this._data.push("restart"),this._proto._sendRestart(),this._idleTimeout=setTimeout(()=>this._onIdle(),100)}addTimedHandler(e,t){const n=new w.TimedHandler(e,t);return this.addTimeds.push(n),n}deleteTimedHandler(e){this.removeTimeds.push(e)}addHandler(e,t,n,r,i,o,s){const a=new w.Handler(e,t,n,r,i,o,s);return this.addHandlers.push(a),a}deleteHandler(e){this.removeHandlers.push(e);const t=this.addHandlers.indexOf(e);t>=0&&this.addHandlers.splice(t,1)}registerSASLMechanisms(e){this.mechanisms={},(e=e||[w.SASLAnonymous,w.SASLExternal,w.SASLOAuthBearer,w.SASLXOAuth2,w.SASLPlain,w.SASLSHA1]).forEach(e=>this.registerSASLMechanism(e))}registerSASLMechanism(e){this.mechanisms[e.name]=e}disconnect(e){if(this._changeConnectStatus(w.Status.DISCONNECTING,e),e?w.warn("Disconnect was called because: "+e):w.info("Disconnect was called"),this.connected){let e=!1;this.disconnecting=!0,this.authenticated&&(e=y({xmlns:w.NS.CLIENT,type:"unavailable"})),this._disconnectTimeout=this._addSysTimedHandler(3e3,this._onDisconnectTimeout.bind(this)),this._proto._disconnect(e)}else w.warn("Disconnect was called before Strophe connected to the server"),this._proto._abortAllRequests(),this._doDisconnect()}_changeConnectStatus(e,t,n){for(const n in w._connectionPlugins)if(Object.prototype.hasOwnProperty.call(w._connectionPlugins,n)){const r=this[n];if(r.statusChanged)try{r.statusChanged(e,t)}catch(e){w.error("".concat(n," plugin caused an exception changing status: ").concat(e))}}if(this.connect_callback)try{this.connect_callback(e,t,n)}catch(e){w._handleError(e),w.error("User connection callback caused an exception: ".concat(e))}}_doDisconnect(e){"number"==typeof this._idleTimeout&&clearTimeout(this._idleTimeout),null!==this._disconnectTimeout&&(this.deleteTimedHandler(this._disconnectTimeout),this._disconnectTimeout=null),w.debug("_doDisconnect was called"),this._proto._doDisconnect(),this.authenticated=!1,this.disconnecting=!1,this.restored=!1,this.handlers=[],this.timedHandlers=[],this.removeTimeds=[],this.removeHandlers=[],this.addTimeds=[],this.addHandlers=[],this._changeConnectStatus(w.Status.DISCONNECTED,e),this.connected=!1}_dataRecv(e,t){const n=this._proto._reqToData(e);if(null===n)return;for(this.xmlInput!==w.Connection.prototype.xmlInput&&(n.nodeName===this._proto.strip&&n.childNodes.length?this.xmlInput(n.childNodes[0]):this.xmlInput(n)),this.rawInput!==w.Connection.prototype.rawInput&&(t?this.rawInput(t):this.rawInput(w.serialize(n)));this.removeHandlers.length>0;){const e=this.removeHandlers.pop(),t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}for(;this.addHandlers.length>0;)this.handlers.push(this.addHandlers.pop());if(this.disconnecting&&this._proto._emptyQueue())return void this._doDisconnect();const r=n.getAttribute("type");if(null!==r&&"terminate"===r){if(this.disconnecting)return;let e=n.getAttribute("condition");const t=n.getElementsByTagName("conflict");return null!==e?("remote-stream-error"===e&&t.length>0&&(e="conflict"),this._changeConnectStatus(w.Status.CONNFAIL,e)):this._changeConnectStatus(w.Status.CONNFAIL,w.ErrorCondition.UNKOWN_REASON),void this._doDisconnect(e)}w.forEachChild(n,null,e=>{const t=this.handlers;this.handlers=[];for(let n=0;n<t.length;n++){const r=t[n];try{(!r.isMatch(e)||!this.authenticated&&r.user||r.run(e))&&this.handlers.push(r)}catch(e){w.warn("Removing Strophe handlers due to uncaught exception: "+e.message)}}})}_connect_cb(e,t,n){let r;w.debug("_connect_cb was called"),this.connected=!0;try{r=this._proto._reqToData(e)}catch(e){if(e.name!==w.ErrorCondition.BAD_FORMAT)throw e;this._changeConnectStatus(w.Status.CONNFAIL,w.ErrorCondition.BAD_FORMAT),this._doDisconnect(w.ErrorCondition.BAD_FORMAT)}if(!r)return;if(this.xmlInput!==w.Connection.prototype.xmlInput&&(r.nodeName===this._proto.strip&&r.childNodes.length?this.xmlInput(r.childNodes[0]):this.xmlInput(r)),this.rawInput!==w.Connection.prototype.rawInput&&(n?this.rawInput(n):this.rawInput(w.serialize(r))),this._proto._connect_cb(r)===w.Status.CONNFAIL)return;let i;if(i=r.getElementsByTagNameNS?r.getElementsByTagNameNS(w.NS.STREAM,"features").length>0:r.getElementsByTagName("stream:features").length>0||r.getElementsByTagName("features").length>0,!i)return void this._proto._no_auth_received(t);const o=Array.from(r.getElementsByTagName("mechanism")).map(e=>this.mechanisms[e.textContent]).filter(e=>e);0!==o.length||0!==r.getElementsByTagName("auth").length?!1!==this.do_authentication&&this.authenticate(o):this._proto._no_auth_received(t)}sortMechanismsByPriority(e){for(let t=0;t<e.length-1;++t){let n=t;for(let r=t+1;r<e.length;++r)e[r].priority>e[n].priority&&(n=r);if(n!==t){const r=e[t];e[t]=e[n],e[n]=r}}return e}authenticate(e){this._attemptSASLAuth(e)||this._attemptLegacyAuth()}_attemptSASLAuth(e){e=this.sortMechanismsByPriority(e||[]);let t=!1;for(let n=0;n<e.length;++n){if(!e[n].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 e[n],this._sasl_mechanism.onStart(this);const r=v("auth",{xmlns:w.NS.SASL,mechanism:this._sasl_mechanism.name});if(this._sasl_mechanism.isClientFirst){const e=this._sasl_mechanism.onChallenge(this,null);r.t(Object(m.btoa)(e))}this.send(r.tree()),t=!0;break}return t}_sasl_challenge_cb(e){const t=Object(m.atob)(w.getText(e)),n=this._sasl_mechanism.onChallenge(this,t),r=v("response",{xmlns:w.NS.SASL});return""!==n&&r.t(Object(m.btoa)(n)),this.send(r.tree()),!0}_attemptLegacyAuth(){null===w.getNodeFromJid(this.jid)?(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(e){const t=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"),t.up().c("resource",{}).t(w.getResourceFromJid(this.jid)),this._addSysHandler(this._auth2_cb.bind(this),null,null,null,"_auth_2"),this.send(t.tree()),!1}_sasl_success_cb(e){if(this._sasl_data["server-signature"]){let t;const n=/([a-z]+)=([^,]+)(,|$)/,r=Object(m.atob)(w.getText(e)).match(n);if("v"===r[1]&&(t=r[2]),t!==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 t=[],n=(e,t)=>{for(;e.length;)this.deleteHandler(e.pop());return this._onStreamFeaturesAfterSASL(t),!1};return t.push(this._addSysHandler(e=>n(t,e),null,"stream:features",null,null)),t.push(this._addSysHandler(e=>n(t,e),w.NS.STREAM,"features",null,null)),this._sendRestart(),!1}_onStreamFeaturesAfterSASL(e){this.features=e;for(let t=0;t<e.childNodes.length;t++){const n=e.childNodes[t];"bind"===n.nodeName&&(this.do_bind=!0),"session"===n.nodeName&&(this.do_session=!0)}return this.do_bind?(this.options.explicitResourceBinding?this._changeConnectStatus(w.Status.BINDREQUIRED,null):this.bind(),!1):(this._changeConnectStatus(w.Status.AUTHFAIL,null),!1)}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 e=w.getResourceFromJid(this.jid);e?this.send(b({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:w.NS.BIND}).c("resource",{}).t(e).tree()):this.send(b({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:w.NS.BIND}).tree())}_onResourceBindResultIQ(e){if("error"===e.getAttribute("type")){let t;return w.warn("Resource binding failed."),e.getElementsByTagName("conflict").length>0&&(t=w.ErrorCondition.CONFLICT),this._changeConnectStatus(w.Status.AUTHFAIL,t,e),!1}const t=e.getElementsByTagName("bind");if(!(t.length>0))return w.warn("Resource binding failed."),this._changeConnectStatus(w.Status.AUTHFAIL,null,e),!1;{const e=t[0].getElementsByTagName("jid");e.length>0&&(this.jid=w.getText(e[0]),this.do_session?this._establishSession():(this.authenticated=!0,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(e){if("result"===e.getAttribute("type"))this.authenticated=!0,this._changeConnectStatus(w.Status.CONNECTED,null);else if("error"===e.getAttribute("type"))return w.warn("Session creation failed."),this._changeConnectStatus(w.Status.AUTHFAIL,null,e),!1;return!1}_sasl_failure_cb(e){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,e),!1}_auth2_cb(e){return"result"===e.getAttribute("type")?(this.authenticated=!0,this._changeConnectStatus(w.Status.CONNECTED,null)):"error"===e.getAttribute("type")&&(this._changeConnectStatus(w.Status.AUTHFAIL,null,e),this.disconnect("authentication failed")),!1}_addSysTimedHandler(e,t){const n=new w.TimedHandler(e,t);return n.user=!1,this.addTimeds.push(n),n}_addSysHandler(e,t,n,r,i){const o=new w.Handler(e,t,n,r,i);return o.user=!1,this.addHandlers.push(o),o}_onDisconnectTimeout(){return w.debug("_onDisconnectTimeout was called"),this._changeConnectStatus(w.Status.CONNTIMEOUT,null),this._proto._onDisconnectTimeout(),this._doDisconnect(),!1}_onIdle(){for(;this.addTimeds.length>0;)this.timedHandlers.push(this.addTimeds.pop());for(;this.removeTimeds.length>0;){const e=this.removeTimeds.pop(),t=this.timedHandlers.indexOf(e);t>=0&&this.timedHandlers.splice(t,1)}const e=(new Date).getTime(),t=[];for(let n=0;n<this.timedHandlers.length;n++){const r=this.timedHandlers[n];if(this.authenticated||!r.user){r.lastCalled+r.period-e<=0?r.run()&&t.push(r):t.push(r)}}this.timedHandlers=t,clearTimeout(this._idleTimeout),this._proto._onIdle(),this.connected&&(this._idleTimeout=setTimeout(()=>this._onIdle(),100))}},w.SASLMechanism=class{constructor(e,t,n){this.name=e,this.isClientFirst=t,this.priority=n}static test(e){return!0}onStart(e){this._connection=e}onChallenge(e,t){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,!1,w.SASLAnonymous.priority)}static get name(){return"ANONYMOUS"}static get priority(){return 20}static test(e){return null===e.authcid}},w.SASLPlain=class extends w.SASLMechanism{constructor(){super(w.SASLPlain.name,!0,w.SASLPlain.priority)}static get name(){return"PLAIN"}static get priority(){return 50}static test(e){return null!==e.authcid}onChallenge(e){const{authcid:t,authzid:n,domain:r,pass:i}=e;if(!r)throw new Error("SASLPlain onChallenge: domain is not defined!");let o=n!=="".concat(t,"@").concat(r)?n:"";return o+="\0",o+=t,o+="\0",o+=i,p(o)}},w.SASLSHA1=class extends w.SASLMechanism{constructor(){super(w.SASLSHA1.name,!0,w.SASLSHA1.priority)}static get name(){return"SCRAM-SHA-1"}static get priority(){return 60}static test(e){return null!==e.authcid}onChallenge(e,t,n){const r=n||h.hexdigest(""+1234567890*Math.random());let i="n="+p(e.authcid);return i+=",r=",i+=r,e._sasl_data.cnonce=r,e._sasl_data["client-first-message-bare"]=i,i="n,,"+i,this.onChallenge=(e,t)=>{let n,r,i,o,s,a,c,l,u="c=biws,",d="".concat(e._sasl_data["client-first-message-bare"],",").concat(t,",");const h=e._sasl_data.cnonce,g=/([a-z]+)=([^,]+)(,|$)/;for(;t.match(g);){const e=t.match(g);switch(t=t.replace(e[0],""),e[1]){case"r":n=e[2];break;case"s":r=e[2];break;case"i":i=e[2]}}if(n.substr(0,h.length)!==h)return e._sasl_data={},e._sasl_failure_cb();u+="r="+n,d+=u,r=Object(m.atob)(r),r+="\0\0\0";const v=p(e.pass);for(o=a=f.a.core_hmac_sha1(v,r),c=1;c<i;c++){for(s=f.a.core_hmac_sha1(v,f.a.binb2str(a)),l=0;l<5;l++)o[l]^=s[l];a=s}o=f.a.binb2str(o);const _=f.a.core_hmac_sha1(o,"Client Key"),b=f.a.str_hmac_sha1(o,"Server Key"),y=f.a.core_hmac_sha1(f.a.str_sha1(f.a.binb2str(_)),d);for(e._sasl_data["server-signature"]=f.a.b64_hmac_sha1(b,d),l=0;l<5;l++)_[l]^=y[l];return u+=",p="+Object(m.btoa)(f.a.binb2str(_)),u},i}},w.SASLOAuthBearer=class extends w.SASLMechanism{constructor(){super(w.SASLOAuthBearer.name,!0,w.SASLOAuthBearer.priority)}static get name(){return"OAUTHBEARER"}static get priority(){return 40}static test(e){return null!==e.pass}onChallenge(e){let t="n,";return null!==e.authcid&&(t=t+"a="+e.authzid),t+=",",t+="",t+="auth=Bearer ",t+=e.pass,t+="",t+="",p(t)}},w.SASLExternal=class extends w.SASLMechanism{constructor(){super(w.SASLExternal.name,!0,w.SASLExternal.priority)}static get name(){return"EXTERNAL"}static get priority(){return 10}onChallenge(e){return e.authcid===e.authzid?"":e.authzid}},w.SASLXOAuth2=class extends w.SASLMechanism{constructor(){super(w.SASLXOAuth2.name,!0,w.SASLXOAuth2.priority)}static get name(){return"X-OAUTH2"}static get priority(){return 30}static test(e){return null!==e.pass}onChallenge(e){let t="\0";return null!==e.authcid&&(t+=e.authzid),t+="\0",t+=e.pass,p(t)}};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){"use strict";n.d(t,"a",(function(){return C})),n.d(t,"b",(function(){return j})),n.d(t,"d",(function(){return T})),n.d(t,"c",(function(){return S}));var r=n(9);const i=function(e,t){const n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n},o=function(e){if("string"!=typeof e)throw new Error("str2binl was passed a non-string");const t=[];for(let n=0;n<8*e.length;n+=8)t[n>>5]|=(255&e.charCodeAt(n/8))<<n%32;return t},s=function(e,t,n,r,o,s){return i((a=i(i(t,e),i(r,s)))<<(c=o)|a>>>32-c,n);var a,c},a=function(e,t,n,r,i,o,a){return s(t&n|~t&r,e,t,i,o,a)},c=function(e,t,n,r,i,o,a){return s(t&r|n&~r,e,t,i,o,a)},l=function(e,t,n,r,i,o,a){return s(t^n^r,e,t,i,o,a)},u=function(e,t,n,r,i,o,a){return s(n^(t|~r),e,t,i,o,a)},d=function(e,t){e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;let n,r,o,s,d=1732584193,h=-271733879,f=-1732584194,p=271733878;for(let t=0;t<e.length;t+=16)n=d,r=h,o=f,s=p,d=a(d,h,f,p,e[t+0],7,-680876936),p=a(p,d,h,f,e[t+1],12,-389564586),f=a(f,p,d,h,e[t+2],17,606105819),h=a(h,f,p,d,e[t+3],22,-1044525330),d=a(d,h,f,p,e[t+4],7,-176418897),p=a(p,d,h,f,e[t+5],12,1200080426),f=a(f,p,d,h,e[t+6],17,-1473231341),h=a(h,f,p,d,e[t+7],22,-45705983),d=a(d,h,f,p,e[t+8],7,1770035416),p=a(p,d,h,f,e[t+9],12,-1958414417),f=a(f,p,d,h,e[t+10],17,-42063),h=a(h,f,p,d,e[t+11],22,-1990404162),d=a(d,h,f,p,e[t+12],7,1804603682),p=a(p,d,h,f,e[t+13],12,-40341101),f=a(f,p,d,h,e[t+14],17,-1502002290),h=a(h,f,p,d,e[t+15],22,1236535329),d=c(d,h,f,p,e[t+1],5,-165796510),p=c(p,d,h,f,e[t+6],9,-1069501632),f=c(f,p,d,h,e[t+11],14,643717713),h=c(h,f,p,d,e[t+0],20,-373897302),d=c(d,h,f,p,e[t+5],5,-701558691),p=c(p,d,h,f,e[t+10],9,38016083),f=c(f,p,d,h,e[t+15],14,-660478335),h=c(h,f,p,d,e[t+4],20,-405537848),d=c(d,h,f,p,e[t+9],5,568446438),p=c(p,d,h,f,e[t+14],9,-1019803690),f=c(f,p,d,h,e[t+3],14,-187363961),h=c(h,f,p,d,e[t+8],20,1163531501),d=c(d,h,f,p,e[t+13],5,-1444681467),p=c(p,d,h,f,e[t+2],9,-51403784),f=c(f,p,d,h,e[t+7],14,1735328473),h=c(h,f,p,d,e[t+12],20,-1926607734),d=l(d,h,f,p,e[t+5],4,-378558),p=l(p,d,h,f,e[t+8],11,-2022574463),f=l(f,p,d,h,e[t+11],16,1839030562),h=l(h,f,p,d,e[t+14],23,-35309556),d=l(d,h,f,p,e[t+1],4,-1530992060),p=l(p,d,h,f,e[t+4],11,1272893353),f=l(f,p,d,h,e[t+7],16,-155497632),h=l(h,f,p,d,e[t+10],23,-1094730640),d=l(d,h,f,p,e[t+13],4,681279174),p=l(p,d,h,f,e[t+0],11,-358537222),f=l(f,p,d,h,e[t+3],16,-722521979),h=l(h,f,p,d,e[t+6],23,76029189),d=l(d,h,f,p,e[t+9],4,-640364487),p=l(p,d,h,f,e[t+12],11,-421815835),f=l(f,p,d,h,e[t+15],16,530742520),h=l(h,f,p,d,e[t+2],23,-995338651),d=u(d,h,f,p,e[t+0],6,-198630844),p=u(p,d,h,f,e[t+7],10,1126891415),f=u(f,p,d,h,e[t+14],15,-1416354905),h=u(h,f,p,d,e[t+5],21,-57434055),d=u(d,h,f,p,e[t+12],6,1700485571),p=u(p,d,h,f,e[t+3],10,-1894986606),f=u(f,p,d,h,e[t+10],15,-1051523),h=u(h,f,p,d,e[t+1],21,-2054922799),d=u(d,h,f,p,e[t+8],6,1873313359),p=u(p,d,h,f,e[t+15],10,-30611744),f=u(f,p,d,h,e[t+6],15,-1560198380),h=u(h,f,p,d,e[t+13],21,1309151649),d=u(d,h,f,p,e[t+4],6,-145523070),p=u(p,d,h,f,e[t+11],10,-1120210379),f=u(f,p,d,h,e[t+2],15,718787259),h=u(h,f,p,d,e[t+9],21,-343485551),d=i(d,n),h=i(h,r),f=i(f,o),p=i(p,s);return[d,h,f,p]},h={hexdigest:function(e){return function(e){let t="";for(let n=0;n<4*e.length;n++)t+="0123456789abcdef".charAt(e[n>>2]>>n%4*8+4&15)+"0123456789abcdef".charAt(e[n>>2]>>n%4*8&15);return t}(d(o(e),8*e.length))},hash:function(e){return function(e){let t="";for(let n=0;n<32*e.length;n+=8)t+=String.fromCharCode(e[n>>5]>>>n%32&255);return t}(d(o(e),8*e.length))}};function f(e,t){e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;var n,r,i,o,s,a,c,l,u=new Array(80),d=1732584193,h=-271733879,f=-1732584194,m=271733878,b=-1009589776;for(n=0;n<e.length;n+=16){for(o=d,s=h,a=f,c=m,l=b,r=0;r<80;r++)u[r]=r<16?e[n+r]:_(u[r-3]^u[r-8]^u[r-14]^u[r-16],1),i=v(v(_(d,5),p(r,h,f,m)),v(v(b,u[r]),g(r))),b=m,m=f,f=_(h,30),h=d,d=i;d=v(d,o),h=v(h,s),f=v(f,a),m=v(m,c),b=v(b,l)}return[d,h,f,m,b]}function p(e,t,n,r){return e<20?t&n|~t&r:e<40?t^n^r:e<60?t&n|t&r|n&r:t^n^r}function g(e){return e<20?1518500249:e<40?1859775393:e<60?-1894007588:-899497514}function m(e,t){var n=b(e);n.length>16&&(n=f(n,8*e.length));for(var r=new Array(16),i=new Array(16),o=0;o<16;o++)r[o]=909522486^n[o],i[o]=1549556828^n[o];var s=f(r.concat(b(t)),512+8*t.length);return f(i.concat(s),672)}function v(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function _(e,t){return e<<t|e>>>32-t}function b(e){for(var t=[],n=0;n<8*e.length;n+=8)t[n>>5]|=(255&e.charCodeAt(n/8))<<24-n%32;return t}function y(e){for(var t,n,r="",i=0;i<4*e.length;i+=3)for(t=(e[i>>2]>>8*(3-i%4)&255)<<16|(e[i+1>>2]>>8*(3-(i+1)%4)&255)<<8|e[i+2>>2]>>8*(3-(i+2)%4)&255,n=0;n<4;n++)8*i+6*n>32*e.length?r+="=":r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t>>6*(3-n)&63);return r}function w(e){for(var t="",n=0;n<32*e.length;n+=8)t+=String.fromCharCode(e[n>>5]>>>24-n%32&255);return t}const S={b64_hmac_sha1:function(e,t){return y(m(e,t))},b64_sha1:function(e){return y(f(b(e),8*e.length))},binb2str:w,core_hmac_sha1:m,str_hmac_sha1:function(e,t){return w(m(e,t))},str_sha1:function(e){return w(f(b(e),8*e.length))}},x=function(e){var t,n,r="",i=e.length;for(t=0;t<i;t++)(n=e.charCodeAt(t))>=0&&n<=127?r+=e.charAt(t):n>2047?(r+=String.fromCharCode(224|n>>12&15),r+=String.fromCharCode(128|n>>6&63),r+=String.fromCharCode(128|n>>0&63)):(r+=String.fromCharCode(192|n>>6&31),r+=String.fromCharCode(128|n>>0&63));return r},E=function(e){e=e||{};for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n="",r="",i="";const o=e[t],s="object"==typeof o,a=escape(unescape(s?o.value:o));s&&(n=o.expires?";expires="+o.expires:"",r=o.domain?";domain="+o.domain:"",i=o.path?";path="+o.path:""),document.cookie=t+"="+a+n+r+i}};var A=n(10);function C(e,t){return new T.Builder(e,t)}function j(e){return new T.Builder("iq",e)}function O(e){return new T.Builder("presence",e)}const T={VERSION:"1.4.0",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(e){for(let t=0;t<T.XHTML.tags.length;t++)if(e===T.XHTML.tags[t])return!0;return!1},validAttribute(e,t){if(void 0!==T.XHTML.attributes[e]&&T.XHTML.attributes[e].length>0)for(let n=0;n<T.XHTML.attributes[e].length;n++)if(t===T.XHTML.attributes[e][n])return!0;return!1},validCSS(e){for(let t=0;t<T.XHTML.css.length;t++)if(e===T.XHTML.css[t])return!0;return!1}},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:.1,addNamespace(e,t){T.NS[e]=t},forEachChild(e,t,n){for(let r=0;r<e.childNodes.length;r++){const i=e.childNodes[r];i.nodeType!==T.ElementType.NORMAL||t&&!this.isTagEqual(i,t)||n(i)}},isTagEqual:(e,t)=>e.tagName===t,_xmlGenerator:null,xmlGenerator:()=>(T._xmlGenerator||(T._xmlGenerator=r.c()),T._xmlGenerator),xmlElement(e){if(!e)return null;const t=T.xmlGenerator().createElement(e);for(let e=1;e<arguments.length;e++){const n=arguments[e];if(n)if("string"==typeof n||"number"==typeof n)t.appendChild(T.xmlTextNode(n));else if("object"==typeof n&&"function"==typeof n.sort)for(let e=0;e<n.length;e++){const r=n[e];"object"==typeof r&&"function"==typeof r.sort&&void 0!==r[1]&&null!==r[1]&&t.setAttribute(r[0],r[1])}else if("object"==typeof n)for(const e in n)Object.prototype.hasOwnProperty.call(n,e)&&void 0!==n[e]&&null!==n[e]&&t.setAttribute(e,n[e])}return t},xmlescape:e=>e=(e=(e=(e=(e=e.replace(/\&/g,"&amp;")).replace(/</g,"&lt;")).replace(/>/g,"&gt;")).replace(/'/g,"&apos;")).replace(/"/g,"&quot;"),xmlunescape:e=>e=(e=(e=(e=(e=e.replace(/\&amp;/g,"&")).replace(/&lt;/g,"<")).replace(/&gt;/g,">")).replace(/&apos;/g,"'")).replace(/&quot;/g,'"'),xmlTextNode:e=>T.xmlGenerator().createTextNode(e),xmlHtmlNode(e){let t;if(r.a){t=(new r.a).parseFromString(e,"text/xml")}else t=new ActiveXObject("Microsoft.XMLDOM"),t.async="false",t.loadXML(e);return t},getText(e){if(!e)return null;let t="";0===e.childNodes.length&&e.nodeType===T.ElementType.TEXT&&(t+=e.nodeValue);for(let n=0;n<e.childNodes.length;n++)e.childNodes[n].nodeType===T.ElementType.TEXT&&(t+=e.childNodes[n].nodeValue);return T.xmlescape(t)},copyElement(e){let t;if(e.nodeType===T.ElementType.NORMAL){t=T.xmlElement(e.tagName);for(let n=0;n<e.attributes.length;n++)t.setAttribute(e.attributes[n].nodeName,e.attributes[n].value);for(let n=0;n<e.childNodes.length;n++)t.appendChild(T.copyElement(e.childNodes[n]))}else e.nodeType===T.ElementType.TEXT&&(t=T.xmlGenerator().createTextNode(e.nodeValue));return t},createHtml(e){let t;if(e.nodeType===T.ElementType.NORMAL){const n=e.nodeName.toLowerCase();if(T.XHTML.validTag(n))try{t=T.xmlElement(n);for(let r=0;r<T.XHTML.attributes[n].length;r++){const i=T.XHTML.attributes[n][r];let o=e.getAttribute(i);if(null!=o&&""!==o&&!1!==o&&0!==o)if("style"===i&&"object"==typeof o&&void 0!==o.cssText&&(o=o.cssText),"style"===i){const e=[],n=o.split(";");for(let t=0;t<n.length;t++){const r=n[t].split(":"),i=r[0].replace(/^\s*/,"").replace(/\s*$/,"").toLowerCase();if(T.XHTML.validCSS(i)){const t=r[1].replace(/^\s*/,"").replace(/\s*$/,"");e.push(i+": "+t)}}e.length>0&&(o=e.join("; "),t.setAttribute(i,o))}else t.setAttribute(i,o)}for(let n=0;n<e.childNodes.length;n++)t.appendChild(T.createHtml(e.childNodes[n]))}catch(e){t=T.xmlTextNode("")}else{t=T.xmlGenerator().createDocumentFragment();for(let n=0;n<e.childNodes.length;n++)t.appendChild(T.createHtml(e.childNodes[n]))}}else if(e.nodeType===T.ElementType.FRAGMENT){t=T.xmlGenerator().createDocumentFragment();for(let n=0;n<e.childNodes.length;n++)t.appendChild(T.createHtml(e.childNodes[n]))}else e.nodeType===T.ElementType.TEXT&&(t=T.xmlTextNode(e.nodeValue));return t},escapeNode:e=>"string"!=typeof e?e:e.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:e=>"string"!=typeof e?e:e.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:e=>e.indexOf("@")<0?null:e.split("@")[0],getDomainFromJid(e){const t=T.getBareJidFromJid(e);if(t.indexOf("@")<0)return t;{const e=t.split("@");return e.splice(0,1),e.join("@")}},getResourceFromJid(e){if(!e)return null;const t=e.split("/");return t.length<2?null:(t.splice(0,1),t.join("/"))},getBareJidFromJid:e=>e?e.split("/")[0]:null,_handleError(e){void 0!==e.stack&&T.fatal(e.stack),e.sourceURL?T.fatal("error: "+this.handler+" "+e.sourceURL+":"+e.line+" - "+e.name+": "+e.message):e.fileName?T.fatal("error: "+this.handler+" "+e.fileName+":"+e.lineNumber+" - "+e.name+": "+e.message):T.fatal("error: "+e.message)},log(e,t){var n;e===this.LogLevel.FATAL&&(null===(n=console)||void 0===n||n.error(t))},debug(e){this.log(this.LogLevel.DEBUG,e)},info(e){this.log(this.LogLevel.INFO,e)},warn(e){this.log(this.LogLevel.WARN,e)},error(e){this.log(this.LogLevel.ERROR,e)},fatal(e){this.log(this.LogLevel.FATAL,e)},serialize(e){if(!e)return null;"function"==typeof e.tree&&(e=e.tree());const t=[...Array(e.attributes.length).keys()].map(t=>e.attributes[t].nodeName);t.sort();let n=t.reduce((t,n)=>"".concat(t," ").concat(n,'="').concat(T.xmlescape(e.attributes.getNamedItem(n).value),'"'),"<".concat(e.nodeName));if(e.childNodes.length>0){n+=">";for(let t=0;t<e.childNodes.length;t++){const r=e.childNodes[t];switch(r.nodeType){case T.ElementType.NORMAL:n+=T.serialize(r);break;case T.ElementType.TEXT:n+=T.xmlescape(r.nodeValue);break;case T.ElementType.CDATA:n+="<![CDATA["+r.nodeValue+"]]>"}}n+="</"+e.nodeName+">"}else n+="/>";return n},_requestId:0,_connectionPlugins:{},addConnectionPlugin(e,t){T._connectionPlugins[e]=t},Builder:class{constructor(e,t){"presence"!==e&&"message"!==e&&"iq"!==e||(t&&!t.xmlns?t.xmlns=T.NS.CLIENT:t||(t={xmlns:T.NS.CLIENT})),this.nodeTree=T.xmlElement(e,t),this.node=this.nodeTree}tree(){return this.nodeTree}toString(){return T.serialize(this.nodeTree)}up(){return this.node=this.node.parentNode,this}root(){return this.node=this.nodeTree,this}attrs(e){for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(void 0===e[t]?this.node.removeAttribute(t):this.node.setAttribute(t,e[t]));return this}c(e,t,n){const r=T.xmlElement(e,t,n);return this.node.appendChild(r),"string"!=typeof n&&"number"!=typeof n&&(this.node=r),this}cnode(e){let t;const n=T.xmlGenerator();try{t=void 0!==n.importNode}catch(e){t=!1}const r=t?n.importNode(e,!0):T.copyElement(e);return this.node.appendChild(r),this.node=r,this}t(e){const t=T.xmlTextNode(e);return this.node.appendChild(t),this}h(e){const t=T.xmlGenerator().createElement("body");t.innerHTML=e;const n=T.createHtml(t);for(;n.childNodes.length>0;)this.node.appendChild(n.childNodes[0]);return this}},Handler:function(e,t,n,r,i,o,s){this.handler=e,this.ns=t,this.name=n,this.type=r,this.id=i,this.options=s||{matchBareFromJid:!1,ignoreNamespaceFragment:!1},this.options.matchBare&&(T.warn('The "matchBare" option is deprecated, use "matchBareFromJid" instead.'),this.options.matchBareFromJid=this.options.matchBare,delete this.options.matchBare),this.options.matchBareFromJid?this.from=o?T.getBareJidFromJid(o):null:this.from=o,this.user=!0}};T.Handler.prototype={getNamespace(e){let t=e.getAttribute("xmlns");return t&&this.options.ignoreNamespaceFragment&&(t=t.split("#")[0]),t},namespaceMatch(e){let t=!1;return!this.ns||(T.forEachChild(e,null,e=>{this.getNamespace(e)===this.ns&&(t=!0)}),t||this.getNamespace(e)===this.ns)},isMatch(e){let t=e.getAttribute("from");this.options.matchBareFromJid&&(t=T.getBareJidFromJid(t));const n=e.getAttribute("type");return!(!this.namespaceMatch(e)||this.name&&!T.isTagEqual(e,this.name)||this.type&&(Array.isArray(this.type)?-1===this.type.indexOf(n):n!==this.type)||this.id&&e.getAttribute("id")!==this.id||this.from&&t!==this.from)},run(e){let t=null;try{t=this.handler(e)}catch(e){throw T._handleError(e),e}return t},toString(){return"{Handler: "+this.handler+"("+this.name+","+this.id+","+this.ns+")}"}},T.TimedHandler=class{constructor(e,t){this.period=e,this.handler=t,this.lastCalled=(new Date).getTime(),this.user=!0}run(){return this.lastCalled=(new Date).getTime(),this.handler()}reset(){this.lastCalled=(new Date).getTime()}toString(){return"{TimedHandler: "+this.handler+"("+this.period+")}"}},T.Connection=class{constructor(e,t){this.service=e,this.options=t||{},this.setProtocol(),this.jid="",this.domain=null,this.features=null,this._sasl_data={},this.do_bind=!1,this.do_session=!1,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=!1,this.connected=!1,this.disconnecting=!1,this.do_authentication=!0,this.paused=!1,this.restored=!1,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 e in T._connectionPlugins)if(Object.prototype.hasOwnProperty.call(T._connectionPlugins,e)){const t=function(){};t.prototype=T._connectionPlugins[e],this[e]=new t,this[e].init(this)}}setProtocol(){const e=this.options.protocol||"";this.options.worker?this._proto=new T.WorkerWebsocket(this):0===this.service.indexOf("ws:")||0===this.service.indexOf("wss:")||0===e.indexOf("ws")?this._proto=new T.Websocket(this):this._proto=new T.Bosh(this)}reset(){this._proto._reset(),this.do_session=!1,this.do_bind=!1,this.timedHandlers=[],this.handlers=[],this.removeTimeds=[],this.removeHandlers=[],this.addTimeds=[],this.addHandlers=[],this.authenticated=!1,this.connected=!1,this.disconnecting=!1,this.restored=!1,this._data=[],this._requests=[],this._uniqueId=0}pause(){this.paused=!0}resume(){this.paused=!1}getUniqueId(e){const t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}));return"string"==typeof e||"number"==typeof e?t+":"+e:t+""}addProtocolErrorHandler(e,t,n){this.protocolErrorHandlers[e][t]=n}connect(e,t,n,r,i,o,s){this.jid=e,this.authzid=T.getBareJidFromJid(this.jid),this.authcid=s||T.getNodeFromJid(this.jid),this.pass=t,this.connect_callback=n,this.disconnecting=!1,this.connected=!1,this.authenticated=!1,this.restored=!1,this.domain=T.getDomainFromJid(this.jid),this._changeConnectStatus(T.Status.CONNECTING,null),this._proto._connect(r,i,o)}attach(e,t,n,r,i,o,s){if(this._proto._attach)return this._proto._attach(e,t,n,r,i,o,s);{const e=new Error('The "attach" method is not available for your connection protocol');throw e.name="StropheSessionError",e}}restore(e,t,n,r,i){if(!this._sessionCachingSupported()){const e=new Error('The "restore" method can only be used with a BOSH connection.');throw e.name="StropheSessionError",e}this._proto._restore(e,t,n,r,i)}_sessionCachingSupported(){if(this._proto instanceof T.Bosh){if(!JSON)return!1;try{sessionStorage.setItem("_strophe_","_strophe_"),sessionStorage.removeItem("_strophe_")}catch(e){return!1}return!0}return!1}xmlInput(e){}xmlOutput(e){}rawInput(e){}rawOutput(e){}nextValidRid(e){}send(e){if(null!==e){if("function"==typeof e.sort)for(let t=0;t<e.length;t++)this._queueData(e[t]);else"function"==typeof e.tree?this._queueData(e.tree()):this._queueData(e);this._proto._send()}}flush(){clearTimeout(this._idleTimeout),this._onIdle()}sendPresence(e,t,n,r){let i=null;"function"==typeof e.tree&&(e=e.tree());let o=e.getAttribute("id");if(o||(o=this.getUniqueId("sendPresence"),e.setAttribute("id",o)),"function"==typeof t||"function"==typeof n){const e=this.addHandler(e=>{i&&this.deleteTimedHandler(i),"error"===e.getAttribute("type")?n&&n(e):t&&t(e)},null,"presence",null,o);r&&(i=this.addTimedHandler(r,()=>(this.deleteHandler(e),n&&n(null),!1)))}return this.send(e),o}sendIQ(e,t,n,r){let i=null;"function"==typeof e.tree&&(e=e.tree());let o=e.getAttribute("id");if(o||(o=this.getUniqueId("sendIQ"),e.setAttribute("id",o)),"function"==typeof t||"function"==typeof n){const e=this.addHandler(e=>{i&&this.deleteTimedHandler(i);const r=e.getAttribute("type");if("result"===r)t&&t(e);else{if("error"!==r){const e=new Error("Got bad IQ type of ".concat(r));throw e.name="StropheError",e}n&&n(e)}},null,"iq",["error","result"],o);r&&(i=this.addTimedHandler(r,()=>(this.deleteHandler(e),n&&n(null),!1)))}return this.send(e),o}_queueData(e){if(null===e||!e.tagName||!e.childNodes){const e=new Error("Cannot queue non-DOMElement.");throw e.name="StropheError",e}this._data.push(e)}_sendRestart(){this._data.push("restart"),this._proto._sendRestart(),this._idleTimeout=setTimeout(()=>this._onIdle(),100)}addTimedHandler(e,t){const n=new T.TimedHandler(e,t);return this.addTimeds.push(n),n}deleteTimedHandler(e){this.removeTimeds.push(e)}addHandler(e,t,n,r,i,o,s){const a=new T.Handler(e,t,n,r,i,o,s);return this.addHandlers.push(a),a}deleteHandler(e){this.removeHandlers.push(e);const t=this.addHandlers.indexOf(e);t>=0&&this.addHandlers.splice(t,1)}registerSASLMechanisms(e){this.mechanisms={},(e=e||[T.SASLAnonymous,T.SASLExternal,T.SASLOAuthBearer,T.SASLXOAuth2,T.SASLPlain,T.SASLSHA1]).forEach(e=>this.registerSASLMechanism(e))}registerSASLMechanism(e){const t=new e;this.mechanisms[t.mechname]=t}disconnect(e){if(this._changeConnectStatus(T.Status.DISCONNECTING,e),e?T.warn("Disconnect was called because: "+e):T.info("Disconnect was called"),this.connected){let e=!1;this.disconnecting=!0,this.authenticated&&(e=O({xmlns:T.NS.CLIENT,type:"unavailable"})),this._disconnectTimeout=this._addSysTimedHandler(3e3,this._onDisconnectTimeout.bind(this)),this._proto._disconnect(e)}else T.warn("Disconnect was called before Strophe connected to the server"),this._proto._abortAllRequests(),this._doDisconnect()}_changeConnectStatus(e,t,n){for(const n in T._connectionPlugins)if(Object.prototype.hasOwnProperty.call(T._connectionPlugins,n)){const r=this[n];if(r.statusChanged)try{r.statusChanged(e,t)}catch(e){T.error("".concat(n," plugin caused an exception changing status: ").concat(e))}}if(this.connect_callback)try{this.connect_callback(e,t,n)}catch(e){T._handleError(e),T.error("User connection callback caused an exception: ".concat(e))}}_doDisconnect(e){"number"==typeof this._idleTimeout&&clearTimeout(this._idleTimeout),null!==this._disconnectTimeout&&(this.deleteTimedHandler(this._disconnectTimeout),this._disconnectTimeout=null),T.debug("_doDisconnect was called"),this._proto._doDisconnect(),this.authenticated=!1,this.disconnecting=!1,this.restored=!1,this.handlers=[],this.timedHandlers=[],this.removeTimeds=[],this.removeHandlers=[],this.addTimeds=[],this.addHandlers=[],this._changeConnectStatus(T.Status.DISCONNECTED,e),this.connected=!1}_dataRecv(e,t){const n=this._proto._reqToData(e);if(null===n)return;for(this.xmlInput!==T.Connection.prototype.xmlInput&&(n.nodeName===this._proto.strip&&n.childNodes.length?this.xmlInput(n.childNodes[0]):this.xmlInput(n)),this.rawInput!==T.Connection.prototype.rawInput&&(t?this.rawInput(t):this.rawInput(T.serialize(n)));this.removeHandlers.length>0;){const e=this.removeHandlers.pop(),t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}for(;this.addHandlers.length>0;)this.handlers.push(this.addHandlers.pop());if(this.disconnecting&&this._proto._emptyQueue())return void this._doDisconnect();const r=n.getAttribute("type");if(null!==r&&"terminate"===r){if(this.disconnecting)return;let e=n.getAttribute("condition");const t=n.getElementsByTagName("conflict");return null!==e?("remote-stream-error"===e&&t.length>0&&(e="conflict"),this._changeConnectStatus(T.Status.CONNFAIL,e)):this._changeConnectStatus(T.Status.CONNFAIL,T.ErrorCondition.UNKOWN_REASON),void this._doDisconnect(e)}T.forEachChild(n,null,e=>{const t=this.handlers;this.handlers=[];for(let n=0;n<t.length;n++){const r=t[n];try{(!r.isMatch(e)||!this.authenticated&&r.user||r.run(e))&&this.handlers.push(r)}catch(e){T.warn("Removing Strophe handlers due to uncaught exception: "+e.message)}}})}_connect_cb(e,t,n){let r;T.debug("_connect_cb was called"),this.connected=!0;try{r=this._proto._reqToData(e)}catch(e){if(e.name!==T.ErrorCondition.BAD_FORMAT)throw e;this._changeConnectStatus(T.Status.CONNFAIL,T.ErrorCondition.BAD_FORMAT),this._doDisconnect(T.ErrorCondition.BAD_FORMAT)}if(!r)return;if(this.xmlInput!==T.Connection.prototype.xmlInput&&(r.nodeName===this._proto.strip&&r.childNodes.length?this.xmlInput(r.childNodes[0]):this.xmlInput(r)),this.rawInput!==T.Connection.prototype.rawInput&&(n?this.rawInput(n):this.rawInput(T.serialize(r))),this._proto._connect_cb(r)===T.Status.CONNFAIL)return;let i;if(i=r.getElementsByTagNameNS?r.getElementsByTagNameNS(T.NS.STREAM,"features").length>0:r.getElementsByTagName("stream:features").length>0||r.getElementsByTagName("features").length>0,!i)return void this._proto._no_auth_received(t);const o=Array.from(r.getElementsByTagName("mechanism")).map(e=>this.mechanisms[e.textContent]).filter(e=>e);0!==o.length||0!==r.getElementsByTagName("auth").length?!1!==this.do_authentication&&this.authenticate(o):this._proto._no_auth_received(t)}sortMechanismsByPriority(e){for(let t=0;t<e.length-1;++t){let n=t;for(let r=t+1;r<e.length;++r)e[r].priority>e[n].priority&&(n=r);if(n!==t){const r=e[t];e[t]=e[n],e[n]=r}}return e}authenticate(e){this._attemptSASLAuth(e)||this._attemptLegacyAuth()}_attemptSASLAuth(e){e=this.sortMechanismsByPriority(e||[]);let t=!1;for(let n=0;n<e.length;++n){if(!e[n].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=e[n],this._sasl_mechanism.onStart(this);const r=C("auth",{xmlns:T.NS.SASL,mechanism:this._sasl_mechanism.mechname});if(this._sasl_mechanism.isClientFirst){const e=this._sasl_mechanism.onChallenge(this,null);r.t(Object(A.btoa)(e))}this.send(r.tree()),t=!0;break}return t}_sasl_challenge_cb(e){const t=Object(A.atob)(T.getText(e)),n=this._sasl_mechanism.onChallenge(this,t),r=C("response",{xmlns:T.NS.SASL});return""!==n&&r.t(Object(A.btoa)(n)),this.send(r.tree()),!0}_attemptLegacyAuth(){null===T.getNodeFromJid(this.jid)?(this._changeConnectStatus(T.Status.CONNFAIL,T.ErrorCondition.MISSING_JID_NODE),this.disconnect(T.ErrorCondition.MISSING_JID_NODE)):(this._changeConnectStatus(T.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:T.NS.AUTH}).c("username",{}).t(T.getNodeFromJid(this.jid)).tree()))}_onLegacyAuthIQResult(e){const t=j({type:"set",id:"_auth_2"}).c("query",{xmlns:T.NS.AUTH}).c("username",{}).t(T.getNodeFromJid(this.jid)).up().c("password").t(this.pass);return T.getResourceFromJid(this.jid)||(this.jid=T.getBareJidFromJid(this.jid)+"/strophe"),t.up().c("resource",{}).t(T.getResourceFromJid(this.jid)),this._addSysHandler(this._auth2_cb.bind(this),null,null,null,"_auth_2"),this.send(t.tree()),!1}_sasl_success_cb(e){if(this._sasl_data["server-signature"]){let t;const n=/([a-z]+)=([^,]+)(,|$)/,r=Object(A.atob)(T.getText(e)).match(n);if("v"===r[1]&&(t=r[2]),t!==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)}T.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 t=[],n=(e,t)=>{for(;e.length;)this.deleteHandler(e.pop());return this._onStreamFeaturesAfterSASL(t),!1};return t.push(this._addSysHandler(e=>n(t,e),null,"stream:features",null,null)),t.push(this._addSysHandler(e=>n(t,e),T.NS.STREAM,"features",null,null)),this._sendRestart(),!1}_onStreamFeaturesAfterSASL(e){this.features=e;for(let t=0;t<e.childNodes.length;t++){const n=e.childNodes[t];"bind"===n.nodeName&&(this.do_bind=!0),"session"===n.nodeName&&(this.do_session=!0)}return this.do_bind?(this.options.explicitResourceBinding?this._changeConnectStatus(T.Status.BINDREQUIRED,null):this.bind(),!1):(this._changeConnectStatus(T.Status.AUTHFAIL,null),!1)}bind(){if(!this.do_bind)return void T.log(T.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 e=T.getResourceFromJid(this.jid);e?this.send(j({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:T.NS.BIND}).c("resource",{}).t(e).tree()):this.send(j({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:T.NS.BIND}).tree())}_onResourceBindResultIQ(e){if("error"===e.getAttribute("type")){let t;return T.warn("Resource binding failed."),e.getElementsByTagName("conflict").length>0&&(t=T.ErrorCondition.CONFLICT),this._changeConnectStatus(T.Status.AUTHFAIL,t,e),!1}const t=e.getElementsByTagName("bind");if(!(t.length>0))return T.warn("Resource binding failed."),this._changeConnectStatus(T.Status.AUTHFAIL,null,e),!1;{const e=t[0].getElementsByTagName("jid");e.length>0&&(this.authenticated=!0,this.jid=T.getText(e[0]),this.do_session?this._establishSession():this._changeConnectStatus(T.Status.CONNECTED,null))}}_establishSession(){if(!this.do_session)throw new Error("Strophe.Connection.prototype._establishSession "+"called but apparently ".concat(T.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:T.NS.SESSION}).tree())}_onSessionResultIQ(e){if("result"===e.getAttribute("type"))this.authenticated=!0,this._changeConnectStatus(T.Status.CONNECTED,null);else if("error"===e.getAttribute("type"))return this.authenticated=!1,T.warn("Session creation failed."),this._changeConnectStatus(T.Status.AUTHFAIL,null,e),!1;return!1}_sasl_failure_cb(e){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(T.Status.AUTHFAIL,null,e),!1}_auth2_cb(e){return"result"===e.getAttribute("type")?(this.authenticated=!0,this._changeConnectStatus(T.Status.CONNECTED,null)):"error"===e.getAttribute("type")&&(this._changeConnectStatus(T.Status.AUTHFAIL,null,e),this.disconnect("authentication failed")),!1}_addSysTimedHandler(e,t){const n=new T.TimedHandler(e,t);return n.user=!1,this.addTimeds.push(n),n}_addSysHandler(e,t,n,r,i){const o=new T.Handler(e,t,n,r,i);return o.user=!1,this.addHandlers.push(o),o}_onDisconnectTimeout(){return T.debug("_onDisconnectTimeout was called"),this._changeConnectStatus(T.Status.CONNTIMEOUT,null),this._proto._onDisconnectTimeout(),this._doDisconnect(),!1}_onIdle(){for(;this.addTimeds.length>0;)this.timedHandlers.push(this.addTimeds.pop());for(;this.removeTimeds.length>0;){const e=this.removeTimeds.pop(),t=this.timedHandlers.indexOf(e);t>=0&&this.timedHandlers.splice(t,1)}const e=(new Date).getTime(),t=[];for(let n=0;n<this.timedHandlers.length;n++){const r=this.timedHandlers[n];if(this.authenticated||!r.user){r.lastCalled+r.period-e<=0?r.run()&&t.push(r):t.push(r)}}this.timedHandlers=t,clearTimeout(this._idleTimeout),this._proto._onIdle(),this.connected&&(this._idleTimeout=setTimeout(()=>this._onIdle(),100))}},T.SASLMechanism=class{constructor(e,t,n){this.mechname=e,this.isClientFirst=t,this.priority=n}test(){return!0}onStart(e){this._connection=e}onChallenge(e,t){throw new Error("You should implement challenge handling!")}onFailure(){this._connection=null}onSuccess(){this._connection=null}},T.SASLAnonymous=class extends T.SASLMechanism{constructor(e="ANONYMOUS",t=!1,n=20){super(e,t,n)}test(e){return null===e.authcid}},T.SASLPlain=class extends T.SASLMechanism{constructor(e="PLAIN",t=!0,n=50){super(e,t,n)}test(e){return null!==e.authcid}onChallenge(e){const{authcid:t,authzid:n,domain:r,pass:i}=e;if(!r)throw new Error("SASLPlain onChallenge: domain is not defined!");let o=n!=="".concat(t,"@").concat(r)?n:"";return o+="\0",o+=t,o+="\0",o+=i,x(o)}},T.SASLSHA1=class extends T.SASLMechanism{constructor(e="SCRAM-SHA-1",t=!0,n=60){super(e,t,n)}test(e){return null!==e.authcid}onChallenge(e,t,n){const r=n||h.hexdigest(""+1234567890*Math.random());let i="n="+x(e.authcid);return i+=",r=",i+=r,e._sasl_data.cnonce=r,e._sasl_data["client-first-message-bare"]=i,i="n,,"+i,this.onChallenge=(e,t)=>{let n,r,i,o,s,a,c,l,u="c=biws,",d="".concat(e._sasl_data["client-first-message-bare"],",").concat(t,",");const h=e._sasl_data.cnonce,f=/([a-z]+)=([^,]+)(,|$)/;for(;t.match(f);){const e=t.match(f);switch(t=t.replace(e[0],""),e[1]){case"r":n=e[2];break;case"s":r=e[2];break;case"i":i=e[2]}}if(n.substr(0,h.length)!==h)return e._sasl_data={},e._sasl_failure_cb();u+="r="+n,d+=u,r=Object(A.atob)(r),r+="\0\0\0";const p=x(e.pass);for(o=a=S.core_hmac_sha1(p,r),c=1;c<i;c++){for(s=S.core_hmac_sha1(p,S.binb2str(a)),l=0;l<5;l++)o[l]^=s[l];a=s}o=S.binb2str(o);const g=S.core_hmac_sha1(o,"Client Key"),m=S.str_hmac_sha1(o,"Server Key"),v=S.core_hmac_sha1(S.str_sha1(S.binb2str(g)),d);for(e._sasl_data["server-signature"]=S.b64_hmac_sha1(m,d),l=0;l<5;l++)g[l]^=v[l];return u+=",p="+Object(A.btoa)(S.binb2str(g)),u},i}},T.SASLOAuthBearer=class extends T.SASLMechanism{constructor(e="OAUTHBEARER",t=!0,n=40){super(e,t,n)}test(e){return null!==e.pass}onChallenge(e){let t="n,";return null!==e.authcid&&(t=t+"a="+e.authzid),t+=",",t+="",t+="auth=Bearer ",t+=e.pass,t+="",t+="",x(t)}},T.SASLExternal=class extends T.SASLMechanism{constructor(e="EXTERNAL",t=!0,n=10){super(e,t,n)}onChallenge(e){return e.authcid===e.authzid?"":e.authzid}},T.SASLXOAuth2=class extends T.SASLMechanism{constructor(e="X-OAUTH2",t=!0,n=30){super(e,t,n)}test(e){return null!==e.pass}onChallenge(e){let t="\0";return null!==e.authcid&&(t+=e.authzid),t+="\0",t+=e.pass,x(t)}};t.e={Strophe:T,$build:C,$iq:j,$msg:function(e){return new T.Builder("message",e)},$pres:O,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,O=he(),T=he(),k=he(),N=he(),I=function(e,t){return e===t&&(g=!0),0},M={}.hasOwnProperty,R=[],D=R.pop,P=R.push,L=R.push,F=R.slice,z=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;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(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},ae=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ce=function(e,t){return t?"\0"===e?"<22>":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},le=function(){m()},ue=Ee((function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()}),{dir:"parentNode",next:"legend"});try{L.apply(R=F.call(A.childNodes),A.childNodes),R[A.childNodes.length].nodeType}catch(e){L={apply:R.length?function(e,t){P.apply(e,F.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}function de(e,t,n,r){var i,o,a,c,l,d,f,p=t&&t.ownerDocument,g=t?t.nodeType:9;if(n=n||[],"string"!=typeof e||!e||1!==g&&9!==g&&11!==g)return n;if(!r&&(m(t),t=t||v,b)){if(11!==g&&(l=re.exec(e)))if(i=l[1]){if(9===g){if(!(a=t.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(p&&(a=p.getElementById(i))&&x(t,a)&&a.id===i)return n.push(a),n}else{if(l[2])return L.apply(n,t.getElementsByTagName(e)),n;if((i=l[3])&&s.getElementsByClassName&&t.getElementsByClassName)return L.apply(n,t.getElementsByClassName(i)),n}if(s.qsa&&!N[e+" "]&&(!y||!y.test(e))&&(1!==g||"object"!==t.nodeName.toLowerCase())){if(f=e,p=t,1===g&&(X.test(e)||J.test(e))){for((p=ie.test(e)&&we(t.parentNode)||t)===t&&s.scope||((c=t.getAttribute("id"))?c=c.replace(ae,ce):t.setAttribute("id",c=E)),o=(d=u(e)).length;o--;)d[o]=(c?"#"+c:":scope")+" "+xe(d[o]);f=d.join(",")}try{return L.apply(n,p.querySelectorAll(f)),n}catch(t){N(e,!0)}finally{c===E&&t.removeAttribute("id")}}}return h(e.replace(G,"$1"),t,n,r)}function he(){var e=[];return function t(n,r){return e.push(n+" ")>a.cacheLength&&delete t[e.shift()],t[n+" "]=r}}function fe(e){return e[E]=!0,e}function pe(e){var t=v.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ge(e,t){for(var n=e.split("|"),r=n.length;r--;)a.attrHandle[n[r]]=t}function me(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function ve(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function _e(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function be(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&ue(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function ye(e){return fe((function(t){return t=+t,fe((function(n,r){for(var i,o=e([],n.length,t),s=o.length;s--;)n[i=o[s]]&&(n[i]=!(r[i]=n[i]))}))}))}function we(e){return e&&void 0!==e.getElementsByTagName&&e}for(o in s=de.support={},l=de.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!Z.test(t||n&&n.nodeName||"HTML")},m=de.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:A;return r!=v&&9===r.nodeType&&r.documentElement?(_=(v=r).documentElement,b=!l(v),A!=v&&(n=v.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",le,!1):n.attachEvent&&n.attachEvent("onunload",le)),s.scope=pe((function(e){return _.appendChild(e).appendChild(v.createElement("div")),void 0!==e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length})),s.attributes=pe((function(e){return e.className="i",!e.getAttribute("className")})),s.getElementsByTagName=pe((function(e){return e.appendChild(v.createComment("")),!e.getElementsByTagName("*").length})),s.getElementsByClassName=ne.test(v.getElementsByClassName),s.getById=pe((function(e){return _.appendChild(e).id=E,!v.getElementsByName||!v.getElementsByName(E).length})),s.getById?(a.filter.ID=function(e){var t=e.replace(oe,se);return function(e){return e.getAttribute("id")===t}},a.find.ID=function(e,t){if(void 0!==t.getElementById&&b){var n=t.getElementById(e);return n?[n]:[]}}):(a.filter.ID=function(e){var t=e.replace(oe,se);return function(e){var n=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},a.find.ID=function(e,t){if(void 0!==t.getElementById&&b){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];for(i=t.getElementsByName(e),r=0;o=i[r++];)if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),a.find.TAG=s.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):s.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){for(;n=o[i++];)1===n.nodeType&&r.push(n);return r}return o},a.find.CLASS=s.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&b)return t.getElementsByClassName(e)},w=[],y=[],(s.qsa=ne.test(v.querySelectorAll))&&(pe((function(e){var t;_.appendChild(e).innerHTML="<a id='"+E+"'></a><select id='"+E+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&y.push("[*^$]="+q+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||y.push("\\["+q+"*(?:value|"+B+")"),e.querySelectorAll("[id~="+E+"-]").length||y.push("~="),(t=v.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||y.push("\\["+q+"*name"+q+"*="+q+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||y.push(":checked"),e.querySelectorAll("a#"+E+"+*").length||y.push(".#.+[+~]"),e.querySelectorAll("\\\f"),y.push("[\\r\\n\\f]")})),pe((function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=v.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&y.push("name"+q+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&y.push(":enabled",":disabled"),_.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&y.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),y.push(",.*:")}))),(s.matchesSelector=ne.test(S=_.matches||_.webkitMatchesSelector||_.mozMatchesSelector||_.oMatchesSelector||_.msMatchesSelector))&&pe((function(e){s.disconnectedMatch=S.call(e,"*"),S.call(e,"[s!='']:x"),w.push("!=",$)})),y=y.length&&new RegExp(y.join("|")),w=w.length&&new RegExp(w.join("|")),t=ne.test(_.compareDocumentPosition),x=t||ne.test(_.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},I=t?function(e,t){if(e===t)return g=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!s.sortDetached&&t.compareDocumentPosition(e)===n?e==v||e.ownerDocument==A&&x(A,e)?-1:t==v||t.ownerDocument==A&&x(A,t)?1:p?z(p,e)-z(p,t):0:4&n?-1:1)}:function(e,t){if(e===t)return g=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,s=[e],a=[t];if(!i||!o)return e==v?-1:t==v?1:i?-1:o?1:p?z(p,e)-z(p,t):0;if(i===o)return me(e,t);for(n=e;n=n.parentNode;)s.unshift(n);for(n=t;n=n.parentNode;)a.unshift(n);for(;s[r]===a[r];)r++;return r?me(s[r],a[r]):s[r]==A?-1:a[r]==A?1:0},v):v},de.matches=function(e,t){return de(e,null,null,t)},de.matchesSelector=function(e,t){if(m(e),s.matchesSelector&&b&&!N[t+" "]&&(!w||!w.test(t))&&(!y||!y.test(t)))try{var n=S.call(e,t);if(n||s.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return de(t,v,null,[e]).length>0},de.contains=function(e,t){return(e.ownerDocument||e)!=v&&m(e),x(e,t)},de.attr=function(e,t){(e.ownerDocument||e)!=v&&m(e);var n=a.attrHandle[t.toLowerCase()],r=n&&M.call(a.attrHandle,t.toLowerCase())?n(e,t,!b):void 0;return void 0!==r?r:s.attributes||!b?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},de.escape=function(e){return(e+"").replace(ae,ce)},de.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},de.uniqueSort=function(e){var t,n=[],r=0,i=0;if(g=!s.detectDuplicates,p=!s.sortStable&&e.slice(0),e.sort(I),g){for(;t=e[i++];)t===e[i]&&(r=n.push(i));for(;r--;)e.splice(n[r],1)}return p=null,e},c=de.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=c(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r++];)n+=c(t);return n},(a=de.selectors={cacheLength:50,createPseudo:fe,match:K,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(oe,se),e[3]=(e[3]||e[4]||e[5]||"").replace(oe,se),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||de.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&de.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return K.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&Q.test(n)&&(t=u(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(oe,se).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=O[e+" "];return t||(t=new RegExp("(^|"+q+")"+e+"("+q+"|$)"))&&O(e,(function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")}))},ATTR:function(e,t,n){return function(r){var i=de.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace(W," ")+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),s="last"!==e.slice(-4),a="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,c){var l,u,d,h,f,p,g=o!==s?"nextSibling":"previousSibling",m=t.parentNode,v=a&&t.nodeName.toLowerCase(),_=!c&&!a,b=!1;if(m){if(o){for(;g;){for(h=t;h=h[g];)if(a?h.nodeName.toLowerCase()===v:1===h.nodeType)return!1;p=g="only"===e&&!p&&"nextSibling"}return!0}if(p=[s?m.firstChild:m.lastChild],s&&_){for(b=(f=(l=(u=(d=(h=m)[E]||(h[E]={}))[h.uniqueID]||(d[h.uniqueID]={}))[e]||[])[0]===C&&l[1])&&l[2],h=f&&m.childNodes[f];h=++f&&h&&h[g]||(b=f=0)||p.pop();)if(1===h.nodeType&&++b&&h===t){u[e]=[C,f,b];break}}else if(_&&(b=f=(l=(u=(d=(h=t)[E]||(h[E]={}))[h.uniqueID]||(d[h.uniqueID]={}))[e]||[])[0]===C&&l[1]),!1===b)for(;(h=++f&&h&&h[g]||(b=f=0)||p.pop())&&((a?h.nodeName.toLowerCase()!==v:1!==h.nodeType)||!++b||(_&&((u=(d=h[E]||(h[E]={}))[h.uniqueID]||(d[h.uniqueID]={}))[e]=[C,b]),h!==t)););return(b-=i)===r||b%r==0&&b/r>=0}}},PSEUDO:function(e,t){var n,r=a.pseudos[e]||a.setFilters[e.toLowerCase()]||de.error("unsupported pseudo: "+e);return r[E]?r(t):r.length>1?(n=[e,e,"",t],a.setFilters.hasOwnProperty(e.toLowerCase())?fe((function(e,n){for(var i,o=r(e,t),s=o.length;s--;)e[i=z(e,o[s])]=!(n[i]=o[s])})):function(e){return r(e,0,n)}):r}},pseudos:{not:fe((function(e){var t=[],n=[],r=d(e.replace(G,"$1"));return r[E]?fe((function(e,t,n,i){for(var o,s=r(e,null,i,[]),a=e.length;a--;)(o=s[a])&&(e[a]=!(t[a]=o))})):function(e,i,o){return t[0]=e,r(t,null,o,n),t[0]=null,!n.pop()}})),has:fe((function(e){return function(t){return de(e,t).length>0}})),contains:fe((function(e){return e=e.replace(oe,se),function(t){return(t.textContent||c(t)).indexOf(e)>-1}})),lang:fe((function(e){return Y.test(e||"")||de.error("unsupported lang: "+e),e=e.replace(oe,se).toLowerCase(),function(t){var n;do{if(n=b?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}})),target:function(e){var t=i.location&&i.location.hash;return t&&t.slice(1)===e.id},root:function(e){return e===_},focus:function(e){return e===v.activeElement&&(!v.hasFocus||v.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:be(!1),disabled:be(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!a.pseudos.empty(e)},header:function(e){return te.test(e.nodeName)},input:function(e){return ee.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:ye((function(){return[0]})),last:ye((function(e,t){return[t-1]})),eq:ye((function(e,t,n){return[n<0?n+t:n]})),even:ye((function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e})),odd:ye((function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e})),lt:ye((function(e,t,n){for(var r=n<0?n+t:n>t?t:n;--r>=0;)e.push(r);return e})),gt:ye((function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e}))}}).pseudos.nth=a.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})a.pseudos[o]=ve(o);for(o in{submit:!0,reset:!0})a.pseudos[o]=_e(o);function Se(){}function xe(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function Ee(e,t,n){var r=t.dir,i=t.next,o=i||r,s=n&&"parentNode"===o,a=j++;return t.first?function(t,n,i){for(;t=t[r];)if(1===t.nodeType||s)return e(t,n,i);return!1}:function(t,n,c){var l,u,d,h=[C,a];if(c){for(;t=t[r];)if((1===t.nodeType||s)&&e(t,n,c))return!0}else for(;t=t[r];)if(1===t.nodeType||s)if(u=(d=t[E]||(t[E]={}))[t.uniqueID]||(d[t.uniqueID]={}),i&&i===t.nodeName.toLowerCase())t=t[r]||t;else{if((l=u[o])&&l[0]===C&&l[1]===a)return h[2]=l[2];if(u[o]=h,h[2]=e(t,n,c))return!0}return!1}}function Ae(e){return e.length>1?function(t,n,r){for(var i=e.length;i--;)if(!e[i](t,n,r))return!1;return!0}:e[0]}function Ce(e,t,n,r,i){for(var o,s=[],a=0,c=e.length,l=null!=t;a<c;a++)(o=e[a])&&(n&&!n(o,r,i)||(s.push(o),l&&t.push(a)));return s}function je(e,t,n,r,i,o){return r&&!r[E]&&(r=je(r)),i&&!i[E]&&(i=je(i,o)),fe((function(o,s,a,c){var l,u,d,h=[],f=[],p=s.length,g=o||function(e,t,n){for(var r=0,i=t.length;r<i;r++)de(e,t[r],n);return n}(t||"*",a.nodeType?[a]:a,[]),m=!e||!o&&t?g:Ce(g,h,e,a,c),v=n?i||(o?e:p||r)?[]:s:m;if(n&&n(m,v,a,c),r)for(l=Ce(v,f),r(l,[],a,c),u=l.length;u--;)(d=l[u])&&(v[f[u]]=!(m[f[u]]=d));if(o){if(i||e){if(i){for(l=[],u=v.length;u--;)(d=v[u])&&l.push(m[u]=d);i(null,v=[],l,c)}for(u=v.length;u--;)(d=v[u])&&(l=i?z(o,d):h[u])>-1&&(o[l]=!(s[l]=d))}}else v=Ce(v===s?v.splice(p,v.length):v),i?i(null,s,v,c):L.apply(s,v)}))}function Oe(e){for(var t,n,r,i=e.length,o=a.relative[e[0].type],s=o||a.relative[" "],c=o?1:0,l=Ee((function(e){return e===t}),s,!0),u=Ee((function(e){return z(t,e)>-1}),s,!0),d=[function(e,n,r){var i=!o&&(r||n!==f)||((t=n).nodeType?l(e,n,r):u(e,n,r));return t=null,i}];c<i;c++)if(n=a.relative[e[c].type])d=[Ee(Ae(d),n)];else{if((n=a.filter[e[c].type].apply(null,e[c].matches))[E]){for(r=++c;r<i&&!a.relative[e[r].type];r++);return je(c>1&&Ae(d),c>1&&xe(e.slice(0,c-1).concat({value:" "===e[c-2].type?"*":""})).replace(G,"$1"),n,c<r&&Oe(e.slice(c,r)),r<i&&Oe(e=e.slice(r)),r<i&&xe(e))}d.push(n)}return Ae(d)}Se.prototype=a.filters=a.pseudos,a.setFilters=new Se,u=de.tokenize=function(e,t){var n,r,i,o,s,c,l,u=T[e+" "];if(u)return t?0:u.slice(0);for(s=e,c=[],l=a.preFilter;s;){for(o in n&&!(r=V.exec(s))||(r&&(s=s.slice(r[0].length)||s),c.push(i=[])),n=!1,(r=J.exec(s))&&(n=r.shift(),i.push({value:n,type:r[0].replace(G," ")}),s=s.slice(n.length)),a.filter)!(r=K[o].exec(s))||l[o]&&!(r=l[o](r))||(n=r.shift(),i.push({value:n,type:o,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?de.error(e):T(e,c).slice(0)},d=de.compile=function(e,t){var n,r=[],i=[],o=k[e+" "];if(!o){for(t||(t=u(e)),n=t.length;n--;)(o=Oe(t[n]))[E]?r.push(o):i.push(o);(o=k(e,function(e,t){var n=t.length>0,r=e.length>0,i=function(i,o,s,c,l){var u,d,h,p=0,g="0",_=i&&[],y=[],w=f,S=i||r&&a.find.TAG("*",l),x=C+=null==w?1:Math.random()||.1,E=S.length;for(l&&(f=o==v||o||l);g!==E&&null!=(u=S[g]);g++){if(r&&u){for(d=0,o||u.ownerDocument==v||(m(u),s=!b);h=e[d++];)if(h(u,o||v,s)){c.push(u);break}l&&(C=x)}n&&((u=!h&&u)&&p--,i&&_.push(u))}if(p+=g,n&&g!==p){for(d=0;h=t[d++];)h(_,y,o,s);if(i){if(p>0)for(;g--;)_[g]||y[g]||(y[g]=D.call(c));y=Ce(y)}L.apply(c,y),l&&!i&&y.length>0&&p+t.length>1&&de.uniqueSort(c)}return l&&(C=x,f=w),_};return n?fe(i):i}(i,r))).selector=e}return o},h=de.select=function(e,t,n,r){var i,o,s,c,l,h="function"==typeof e&&e,f=!r&&u(e=h.selector||e);if(n=n||[],1===f.length){if((o=f[0]=f[0].slice(0)).length>2&&"ID"===(s=o[0]).type&&9===t.nodeType&&b&&a.relative[o[1].type]){if(!(t=(a.find.ID(s.matches[0].replace(oe,se),t)||[])[0]))return n;h&&(t=t.parentNode),e=e.slice(o.shift().value.length)}for(i=K.needsContext.test(e)?0:o.length;i--&&(s=o[i],!a.relative[c=s.type]);)if((l=a.find[c])&&(r=l(s.matches[0].replace(oe,se),ie.test(o[0].type)&&we(t.parentNode)||t))){if(o.splice(i,1),!(e=r.length&&xe(o)))return L.apply(n,r),n;break}}return(h||d(e,f))(r,t,!b,n,!t||ie.test(e)&&we(t.parentNode)||t),n},s.sortStable=E.split("").sort(I).join("")===E,s.detectDuplicates=!!g,m(),s.sortDetached=pe((function(e){return 1&e.compareDocumentPosition(v.createElement("fieldset"))})),pe((function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")}))||ge("type|href|height|width",(function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)})),s.attributes&&pe((function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")}))||ge("value",(function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue})),pe((function(e){return null==e.getAttribute("disabled")}))||ge(B,(function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}));var Te=i.Sizzle;de.noConflict=function(){return i.Sizzle===de&&(i.Sizzle=Te),de},void 0===(r=function(){return de}.call(t,n,t,e))||(e.exports=r)}(window)},function(e,t,n){"use strict";(function(e){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})),e.$build=r.f.$build,e.$iq=r.f.$iq,e.$msg=r.f.$msg,e.$pres=r.f.$pres,e.Strophe=r.f.Strophe}).call(this,n(12))},function(e,t,n){e.exports=function(){"use strict";var e="millisecond",t="second",n="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(e,t,n){var r=String(e);return!r||r.length>=t?e:""+Array(t+1-r.length).join(n)+e},h={s:d,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),i=n%60;return(t<=0?"+":"-")+d(r,2,"0")+":"+d(i,2,"0")},m:function(e,t){var n=12*(t.year()-e.year())+(t.month()-e.month()),r=e.clone().add(n,s),i=t-r<0,o=e.clone().add(n+(i?-1:1),s);return Number(-(n+(t-r)/(i?r-o:o-r))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(l){return{M:s,y:c,w:o,d:i,D:"date",h:r,m:n,s:t,ms:e,Q:a}[l]||String(l||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},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(e){return e instanceof y},v=function(e,t,n){var r;if(!e)return p;if("string"==typeof e)g[e]&&(r=e),t&&(g[e]=t,r=e);else{var i=e.name;g[i]=e,r=i}return!n&&r&&(p=r),r||!n&&p},_=function(e,t){if(m(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new y(n)},b=h;b.l=v,b.i=m,b.w=function(e,t){return _(e,{locale:t.$L,utc:t.$u,$offset:t.$offset})};var y=function(){function d(e){this.$L=this.$L||v(e.locale,null,!0),this.parse(e)}var h=d.prototype;return h.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(b.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var r=t.match(l);if(r)return n?new Date(Date.UTC(r[1],r[2]-1,r[3]||1,r[4]||0,r[5]||0,r[6]||0,r[7]||0)):new Date(r[1],r[2]-1,r[3]||1,r[4]||0,r[5]||0,r[6]||0,r[7]||0)}return new Date(t)}(e),this.init()},h.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},h.$utils=function(){return b},h.isValid=function(){return!("Invalid Date"===this.$d.toString())},h.isSame=function(e,t){var n=_(e);return this.startOf(t)<=n&&n<=this.endOf(t)},h.isAfter=function(e,t){return _(e)<this.startOf(t)},h.isBefore=function(e,t){return this.endOf(t)<_(e)},h.$g=function(e,t,n){return b.u(e)?this[t]:this.set(n,e)},h.year=function(e){return this.$g(e,"$y",c)},h.month=function(e){return this.$g(e,"$M",s)},h.day=function(e){return this.$g(e,"$W",i)},h.date=function(e){return this.$g(e,"$D","date")},h.hour=function(e){return this.$g(e,"$H",r)},h.minute=function(e){return this.$g(e,"$m",n)},h.second=function(e){return this.$g(e,"$s",t)},h.millisecond=function(t){return this.$g(t,"$ms",e)},h.unix=function(){return Math.floor(this.valueOf()/1e3)},h.valueOf=function(){return this.$d.getTime()},h.startOf=function(e,a){var l=this,u=!!b.u(a)||a,d=b.p(e),h=function(e,t){var n=b.w(l.$u?Date.UTC(l.$y,t,e):new Date(l.$y,t,e),l);return u?n:n.endOf(i)},f=function(e,t){return b.w(l.toDate()[e].apply(l.toDate("s"),(u?[0,0,0,0]:[23,59,59,999]).slice(t)),l)},p=this.$W,g=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(d){case c:return u?h(1,0):h(31,11);case s:return u?h(1,g):h(0,g+1);case o:var _=this.$locale().weekStart||0,y=(p<_?p+7:p)-_;return h(u?m-y:m+(6-y),g);case i:case"date":return f(v+"Hours",0);case r:return f(v+"Minutes",1);case n:return f(v+"Seconds",2);case t:return f(v+"Milliseconds",3);default:return this.clone()}},h.endOf=function(e){return this.startOf(e,!1)},h.$set=function(o,a){var l,u=b.p(o),d="set"+(this.$u?"UTC":""),h=(l={},l.day=d+"Date",l.date=d+"Date",l[s]=d+"Month",l[c]=d+"FullYear",l[r]=d+"Hours",l[n]=d+"Minutes",l[t]=d+"Seconds",l[e]=d+"Milliseconds",l)[u],f=u===i?this.$D+(a-this.$W):a;if(u===s||u===c){var p=this.clone().set("date",1);p.$d[h](f),p.init(),this.$d=p.set("date",Math.min(this.$D,p.daysInMonth())).$d}else h&&this.$d[h](f);return this.init(),this},h.set=function(e,t){return this.clone().$set(e,t)},h.get=function(e){return this[b.p(e)]()},h.add=function(e,a){var l,u=this;e=Number(e);var d=b.p(a),h=function(t){var n=_(u);return b.w(n.date(n.date()+Math.round(t*e)),u)};if(d===s)return this.set(s,this.$M+e);if(d===c)return this.set(c,this.$y+e);if(d===i)return h(1);if(d===o)return h(7);var f=(l={},l[n]=6e4,l[r]=36e5,l[t]=1e3,l)[d]||1,p=this.$d.getTime()+e*f;return b.w(p,this)},h.subtract=function(e,t){return this.add(-1*e,t)},h.format=function(e){var t=this;if(!this.isValid())return"Invalid Date";var n=e||"YYYY-MM-DDTHH:mm:ssZ",r=b.z(this),i=this.$locale(),o=this.$H,s=this.$m,a=this.$M,c=i.weekdays,l=i.months,d=function(e,r,i,o){return e&&(e[r]||e(t,n))||i[r].substr(0,o)},h=function(e){return b.s(o%12||12,e,"0")},f=i.meridiem||function(e,t,n){var r=e<12?"AM":"PM";return n?r.toLowerCase():r},p={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:b.s(a+1,2,"0"),MMM:d(i.monthsShort,a,l,3),MMMM:d(l,a),D:this.$D,DD:b.s(this.$D,2,"0"),d:String(this.$W),dd:d(i.weekdaysMin,this.$W,c,2),ddd:d(i.weekdaysShort,this.$W,c,3),dddd:c[this.$W],H:String(o),HH:b.s(o,2,"0"),h:h(1),hh:h(2),a:f(o,s,!0),A:f(o,s,!1),m:String(s),mm:b.s(s,2,"0"),s:String(this.$s),ss:b.s(this.$s,2,"0"),SSS:b.s(this.$ms,3,"0"),Z:r};return n.replace(u,(function(e,t){return t||p[e]||r.replace(":","")}))},h.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},h.diff=function(e,i,l){var u,d=b.p(i),h=_(e),f=6e4*(h.utcOffset()-this.utcOffset()),p=this-h,g=b.m(this,h);return g=(u={},u[c]=g/12,u[s]=g,u[a]=g/3,u[o]=(p-f)/6048e5,u.day=(p-f)/864e5,u[r]=p/36e5,u[n]=p/6e4,u[t]=p/1e3,u)[d]||p,l?g:b.a(g)},h.daysInMonth=function(){return this.endOf(s).$D},h.$locale=function(){return g[this.$L]},h.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=v(e,t,!0);return r&&(n.$L=r),n},h.clone=function(){return b.w(this.$d,this)},h.toDate=function(){return new Date(this.valueOf())},h.toJSON=function(){return this.isValid()?this.toISOString():null},h.toISOString=function(){return this.$d.toISOString()},h.toString=function(){return this.$d.toUTCString()},d}();return _.prototype=y.prototype,_.extend=function(e,t){return e(t,y,_),_},_.locale=v,_.isDayjs=m,_.unix=function(e){return _(1e3*e)},_.en=g[p],_.Ls=g,_}()},function(e,t,n){"use strict";var r=n(63),i="object"==typeof self&&self&&self.Object===Object&&self,o=r.a||i||Function("return this")();t.a=o},,function(e,t,n){"use strict";function r(e,t){e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;var n,r,s,l,u,d,h,f,p=new Array(80),g=1732584193,m=-271733879,v=-1732584194,_=271733878,b=-1009589776;for(n=0;n<e.length;n+=16){for(l=g,u=m,d=v,h=_,f=b,r=0;r<80;r++)p[r]=r<16?e[n+r]:c(p[r-3]^p[r-8]^p[r-14]^p[r-16],1),s=a(a(c(g,5),i(r,m,v,_)),a(a(b,p[r]),o(r))),b=_,_=v,v=c(m,30),m=g,g=s;g=a(g,l),m=a(m,u),v=a(v,d),_=a(_,h),b=a(b,f)}return[g,m,v,_,b]}function i(e,t,n,r){return e<20?t&n|~t&r:e<40?t^n^r:e<60?t&n|t&r|n&r:t^n^r}function o(e){return e<20?1518500249:e<40?1859775393:e<60?-1894007588:-899497514}function s(e,t){var n=l(e);n.length>16&&(n=r(n,8*e.length));for(var i=new Array(16),o=new Array(16),s=0;s<16;s++)i[s]=909522486^n[s],o[s]=1549556828^n[s];var a=r(i.concat(l(t)),512+8*t.length);return r(o.concat(a),672)}function a(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function c(e,t){return e<<t|e>>>32-t}function l(e){for(var t=[],n=0;n<8*e.length;n+=8)t[n>>5]|=(255&e.charCodeAt(n/8))<<24-n%32;return t}function u(e){for(var t,n,r="",i=0;i<4*e.length;i+=3)for(t=(e[i>>2]>>8*(3-i%4)&255)<<16|(e[i+1>>2]>>8*(3-(i+1)%4)&255)<<8|e[i+2>>2]>>8*(3-(i+2)%4)&255,n=0;n<4;n++)8*i+6*n>32*e.length?r+="=":r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t>>6*(3-n)&63);return r}function d(e){for(var t="",n=0;n<32*e.length;n+=8)t+=String.fromCharCode(e[n>>5]>>>24-n%32&255);return t}n.d(t,"a",(function(){return h}));const h={b64_hmac_sha1:function(e,t){return u(s(e,t))},b64_sha1:function(e){return u(r(l(e),8*e.length))},binb2str:d,core_hmac_sha1:s,str_hmac_sha1:function(e,t){return d(s(e,t))},str_sha1:function(e){return d(r(l(e),8*e.length))}}},function(e,t,n){var r=n(496),i=n(137),o=/[&<>"']/g,s=RegExp(o.source);e.exports=function(e){return(e=i(e))&&s.test(e)?e.replace(o,r):e}},function(e,t,n){"use strict";(function(e){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 t=e.WebSocket;if(void 0===t)try{t=n(499)}catch(e){throw new Error('You must install the "ws" package to use Strophe in nodejs.')}return t}();const i=function(){let t=e.DOMParser;if(void 0===t)try{t=n(47).DOMParser}catch(e){throw new Error('You must install the "xmldom" package to use Strophe in nodejs.')}return t}();function o(){if("undefined"==typeof document)try{return(new(0,n(47).DOMImplementation)).createDocument("jabber:client","strophe",null)}catch(e){throw new Error('You must install the "xmldom" package to use Strophe in nodejs.')}if(void 0===document.implementation.createDocument||document.implementation.createDocument&&document.documentMode&&document.documentMode<10){const e=function(){const e=["Msxml2.DOMDocument.6.0","Msxml2.DOMDocument.5.0","Msxml2.DOMDocument.4.0","MSXML2.DOMDocument.3.0","MSXML2.DOMDocument","MSXML.DOMDocument","Microsoft.XMLDOM"];for(let t=0;t<e.length;t++)try{return new ActiveXObject(e[t])}catch(e){}}();return e.appendChild(e.createElement("strophe")),e}return document.implementation.createDocument("jabber:client","strophe",null)}}).call(this,n(12))},function(e,t,n){"use strict";const r=n(330),i=n(331);e.exports={atob:r,btoa:i}},function(e,t,n){var r=n(96),i="object"==typeof self&&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(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){"use strict";(function(e){var r=n(63),i="object"==typeof exports&&exports&&!exports.nodeType&&exports,o=i&&"object"==typeof e&&e&&!e.nodeType&&e,s=o&&o.exports===i&&r.a.process,a=function(){try{var e=o&&o.require&&o.require("util").types;return e||s&&s.binding&&s.binding("util")}catch(e){}}();t.a=a}).call(this,n(69)(e))},function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return i}));!function(){let t=e.WebSocket;if(void 0===t)try{t=n(328)}catch(e){throw new Error('You must install the "ws" package to use Strophe in nodejs.')}}();const r=function(){let t=e.DOMParser;if(void 0===t)try{t=n(47).DOMParser}catch(e){throw new Error('You must install the "xmldom" package to use Strophe in nodejs.')}return t}();function i(){if("undefined"==typeof document)try{return(new(0,n(47).DOMImplementation)).createDocument("jabber:client","strophe",null)}catch(e){throw new Error('You must install the "xmldom" package to use Strophe in nodejs.')}if(void 0===document.implementation.createDocument||document.implementation.createDocument&&document.documentMode&&document.documentMode<10){const e=function(){const e=["Msxml2.DOMDocument.6.0","Msxml2.DOMDocument.5.0","Msxml2.DOMDocument.4.0","MSXML2.DOMDocument.3.0","MSXML2.DOMDocument","MSXML.DOMDocument","Microsoft.XMLDOM"];for(let t=0;t<e.length;t++)try{return new ActiveXObject(e[t])}catch(e){}}();return e.appendChild(e.createElement("strophe")),e}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="function"==typeof o;(e.exports=function(e){return r[e]||(r[e]=s&&o[e]||(s?o:i)("Symbol."+e))}).store=r},function(e,t,n){!function e(t,n,r){function i(s,a){if(!n[s]){if(!t[s]){if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[s]={exports:{}};t[s][0].call(l.exports,(function(e){return i(t[s][1][e]||e)}),l,l.exports,e,t,n,r)}return n[s].exports}for(var o=!1,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(e,t,n){var r=e("cssfilter").FilterCSS,i=e("cssfilter").getDefaultWhiteList,o=e("./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(e){return e.replace(l,"&lt;").replace(u,"&gt;")}var l=/</g,u=/>/g,d=/"/g,h=/&quot;/g,f=/&#([a-zA-Z0-9]*);?/gim,p=/&colon;?/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(e){return e.replace(d,"&quot;")}function y(e){return e.replace(h,'"')}function w(e){return e.replace(f,(function(e,t){return"x"===t[0]||"X"===t[0]?String.fromCharCode(parseInt(t.substr(1),16)):String.fromCharCode(parseInt(t,10))}))}function S(e){return e.replace(p,":").replace(g," ")}function x(e){for(var t="",n=0,r=e.length;n<r;n++)t+=e.charCodeAt(n)<32?" ":e.charAt(n);return o.trim(t)}function E(e){return e=x(e=S(e=w(e=y(e))))}function A(e){return e=c(e=b(e))}var C=/<!--[\s\S]*?-->/g;n.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"]},n.getDefaultWhiteList=s,n.onTag=function(e,t,n){},n.onIgnoreTag=function(e,t,n){},n.onTagAttr=function(e,t,n){},n.onIgnoreTagAttr=function(e,t,n){},n.safeAttrValue=function(e,t,n,r){if(n=E(n),"href"===t||"src"===t){if("#"===(n=o.trim(n)))return"#";if("http://"!==n.substr(0,7)&&"https://"!==n.substr(0,8)&&"mailto:"!==n.substr(0,7)&&"tel:"!==n.substr(0,4)&&"data:image/"!==n.substr(0,11)&&"ftp://"!==n.substr(0,6)&&"./"!==n.substr(0,2)&&"../"!==n.substr(0,3)&&"#"!==n[0]&&"/"!==n[0])return""}else if("background"===t){if(m.lastIndex=0,m.test(n))return""}else if("style"===t){if(v.lastIndex=0,v.test(n))return"";if(_.lastIndex=0,_.test(n)&&(m.lastIndex=0,m.test(n)))return"";!1!==r&&(n=(r=r||a).process(n))}return n=A(n)},n.escapeHtml=c,n.escapeQuote=b,n.unescapeQuote=y,n.escapeHtmlEntities=w,n.escapeDangerHtml5Entities=S,n.clearNonPrintableCharacter=x,n.friendlyAttrValue=E,n.escapeAttrValue=A,n.onIgnoreTagStripAll=function(){return""},n.StripTagBody=function(e,t){"function"!=typeof t&&(t=function(){});var n=!Array.isArray(e),r=[],i=!1;return{onIgnoreTag:function(s,a,c){if(function(t){return!!n||-1!==o.indexOf(e,t)}(s)){if(c.isClosing){var l="[/removed]",u=c.position+l.length;return r.push([!1!==i?i:c.position,u]),i=!1,l}return i||(i=c.position),"[removed]"}return t(s,a,c)},remove:function(e){var t="",n=0;return o.forEach(r,(function(r){t+=e.slice(n,r[0]),n=r[1]})),t+=e.slice(n)}}},n.stripCommentTag=function(e){return e.replace(C,"")},n.stripBlankChar=function(e){var t=e.split("");return(t=t.filter((function(e){var t=e.charCodeAt(0);return 127!==t&&(!(t<=31)||(10===t||13===t))}))).join("")},n.cssFilter=a,n.getDefaultCSSWhiteList=i},{"./util":4,cssfilter:8}],2:[function(e,t,n){var r=e("./default"),i=e("./parser"),o=e("./xss");function s(e,t){return new o(t).process(e)}for(var a in(n=t.exports=s).filterXSS=s,n.FilterXSS=o,r)n[a]=r[a];for(var a in i)n[a]=i[a];"undefined"!=typeof window&&(window.filterXSS=t.exports),"undefined"!=typeof self&&"undefined"!=typeof DedicatedWorkerGlobalScope&&self instanceof DedicatedWorkerGlobalScope&&(self.filterXSS=t.exports)},{"./default":1,"./parser":3,"./xss":5}],3:[function(e,t,n){var r=e("./util");function i(e){var t=r.spaceIndex(e);if(-1===t)var n=e.slice(1,-1);else n=e.slice(1,t+1);return"/"===(n=r.trim(n).toLowerCase()).slice(0,1)&&(n=n.slice(1)),"/"===n.slice(-1)&&(n=n.slice(0,-1)),n}function o(e){return"</"===e.slice(0,2)}var s=/[^a-zA-Z0-9_:\.\-]/gim;function a(e,t){for(;t<e.length;t++){var n=e[t];if(" "!==n)return"="===n?t:-1}}function c(e,t){for(;t>0;t--){var n=e[t];if(" "!==n)return"="===n?t:-1}}function l(e){return function(e){return'"'===e[0]&&'"'===e[e.length-1]||"'"===e[0]&&"'"===e[e.length-1]}(e)?e.substr(1,e.length-2):e}n.parseTag=function(e,t,n){"use strict";var r="",s=0,a=!1,c=!1,l=0,u=e.length,d="",h="";for(l=0;l<u;l++){var f=e.charAt(l);if(!1===a){if("<"===f){a=l;continue}}else if(!1===c){if("<"===f){r+=n(e.slice(s,l)),a=l,s=l;continue}if(">"===f){r+=n(e.slice(s,a)),d=i(h=e.slice(a,l+1)),r+=t(a,r.length,d,h,o(h)),s=l+1,a=!1;continue}if(('"'===f||"'"===f)&&"="===e.charAt(l-1)){c=f;continue}}else if(f===c){c=!1;continue}}return s<e.length&&(r+=n(e.substr(s))),r},n.parseAttr=function(e,t){"use strict";var n=0,i=[],o=!1,u=e.length;function d(e,n){if(!((e=(e=r.trim(e)).replace(s,"").toLowerCase()).length<1)){var o=t(e,n||"");o&&i.push(o)}}for(var h=0;h<u;h++){var f,p=e.charAt(h);if(!1!==o||"="!==p)if(!1===o||h!==n||'"'!==p&&"'"!==p||"="!==e.charAt(h-1))if(/\s|\n|\t/.test(p)){if(e=e.replace(/\s|\n|\t/g," "),!1===o){if(-1===(f=a(e,h))){d(r.trim(e.slice(n,h))),o=!1,n=h+1;continue}h=f-1;continue}if(-1===(f=c(e,h-1))){d(o,l(r.trim(e.slice(n,h)))),o=!1,n=h+1;continue}}else;else{if(-1===(f=e.indexOf(p,h+1)))break;d(o,r.trim(e.slice(n+1,f))),o=!1,n=(h=f)+1}else o=e.slice(n,h),n=h+1}return n<e.length&&(!1===o?d(e.slice(n)):d(o,l(r.trim(e.slice(n))))),r.trim(i.join(" "))}},{"./util":4}],4:[function(e,t,n){t.exports={indexOf:function(e,t){var n,r;if(Array.prototype.indexOf)return e.indexOf(t);for(n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},forEach:function(e,t,n){var r,i;if(Array.prototype.forEach)return e.forEach(t,n);for(r=0,i=e.length;r<i;r++)t.call(n,e[r],r,e)},trim:function(e){return String.prototype.trim?e.trim():e.replace(/(^\s*)|(\s*$)/g,"")},spaceIndex:function(e){var t=/\s|\n|\t/.exec(e);return t?t.index:-1}}},{}],5:[function(e,t,n){var r=e("cssfilter").FilterCSS,i=e("./default"),o=e("./parser"),s=o.parseTag,a=o.parseAttr,c=e("./util");function l(e){return null==e}function u(e){(e=function(e){var t={};for(var n in e)t[n]=e[n];return t}(e||{})).stripIgnoreTag&&(e.onIgnoreTag&&console.error('Notes: cannot use these two options "stripIgnoreTag" and "onIgnoreTag" at the same time'),e.onIgnoreTag=i.onIgnoreTagStripAll),e.whiteList=e.whiteList||i.whiteList,e.onTag=e.onTag||i.onTag,e.onTagAttr=e.onTagAttr||i.onTagAttr,e.onIgnoreTag=e.onIgnoreTag||i.onIgnoreTag,e.onIgnoreTagAttr=e.onIgnoreTagAttr||i.onIgnoreTagAttr,e.safeAttrValue=e.safeAttrValue||i.safeAttrValue,e.escapeHtml=e.escapeHtml||i.escapeHtml,this.options=e,!1===e.css?this.cssFilter=!1:(e.css=e.css||{},this.cssFilter=new r(e.css))}u.prototype.process=function(e){if(!(e=(e=e||"").toString()))return"";var t=this.options,n=t.whiteList,r=t.onTag,o=t.onIgnoreTag,u=t.onTagAttr,d=t.onIgnoreTagAttr,h=t.safeAttrValue,f=t.escapeHtml,p=this.cssFilter;t.stripBlankChar&&(e=i.stripBlankChar(e)),t.allowCommentTag||(e=i.stripCommentTag(e));var g=!1;if(t.stripIgnoreTagBody){g=i.StripTagBody(t.stripIgnoreTagBody,o);o=g.onIgnoreTag}var m=s(e,(function(e,t,i,s,g){var m,v={sourcePosition:e,position:t,isClosing:g,isWhite:n.hasOwnProperty(i)};if(!l(m=r(i,s,v)))return m;if(v.isWhite){if(v.isClosing)return"</"+i+">";var _=function(e){var t=c.spaceIndex(e);if(-1===t)return{html:"",closing:"/"===e[e.length-2]};var n="/"===(e=c.trim(e.slice(t+1,-1)))[e.length-1];return n&&(e=c.trim(e.slice(0,-1))),{html:e,closing:n}}(s),b=n[i],y=a(_.html,(function(e,t){var n,r=-1!==c.indexOf(b,e);return l(n=u(i,e,t,r))?r?(t=h(i,e,t,p))?e+'="'+t+'"':e:l(n=d(i,e,t,r))?void 0:n:n}));s="<"+i;return y&&(s+=" "+y),_.closing&&(s+=" /"),s+=">"}return l(m=o(i,s,v))?f(s):m}),f);return g&&(m=g.remove(m)),m},t.exports=u},{"./default":1,"./parser":3,"./util":4,cssfilter:8}],6:[function(e,t,n){var r=e("./default"),i=e("./parser");e("./util");function o(e){return null==e}function s(e){(e=function(e){var t={};for(var n in e)t[n]=e[n];return t}(e||{})).whiteList=e.whiteList||r.whiteList,e.onAttr=e.onAttr||r.onAttr,e.onIgnoreAttr=e.onIgnoreAttr||r.onIgnoreAttr,e.safeAttrValue=e.safeAttrValue||r.safeAttrValue,this.options=e}s.prototype.process=function(e){if(!(e=(e=e||"").toString()))return"";var t=this.options,n=t.whiteList,r=t.onAttr,s=t.onIgnoreAttr,a=t.safeAttrValue;return i(e,(function(e,t,i,c,l){var u=n[i],d=!1;if(!0===u?d=u:"function"==typeof u?d=u(c):u instanceof RegExp&&(d=u.test(c)),!0!==d&&(d=!1),c=a(i,c)){var h,f={position:t,sourcePosition:e,source:l,isWhite:d};return d?o(h=r(i,c,f))?i+":"+c:h:o(h=s(i,c,f))?void 0:h}}))},t.exports=s},{"./default":7,"./parser":9,"./util":10}],7:[function(e,t,n){function r(){var e={"align-content":!1,"align-items":!1,"align-self":!1,"alignment-adjust":!1,"alignment-baseline":!1,all:!1,"anchor-point":!1,animation:!1,"animation-delay":!1,"animation-direction":!1,"animation-duration":!1,"animation-fill-mode":!1,"animation-iteration-count":!1,"animation-name":!1,"animation-play-state":!1,"animation-timing-function":!1,azimuth:!1,"backface-visibility":!1,background:!0,"background-attachment":!0,"background-clip":!0,"background-color":!0,"background-image":!0,"background-origin":!0,"background-position":!0,"background-repeat":!0,"background-size":!0,"baseline-shift":!1,binding:!1,bleed:!1,"bookmark-label":!1,"bookmark-level":!1,"bookmark-state":!1,border:!0,"border-bottom":!0,"border-bottom-color":!0,"border-bottom-left-radius":!0,"border-bottom-right-radius":!0,"border-bottom-style":!0,"border-bottom-width":!0,"border-collapse":!0,"border-color":!0,"border-image":!0,"border-image-outset":!0,"border-image-repeat":!0,"border-image-slice":!0,"border-image-source":!0,"border-image-width":!0,"border-left":!0,"border-left-color":!0,"border-left-style":!0,"border-left-width":!0,"border-radius":!0,"border-right":!0,"border-right-color":!0,"border-right-style":!0,"border-right-width":!0,"border-spacing":!0,"border-style":!0,"border-top":!0,"border-top-color":!0,"border-top-left-radius":!0,"border-top-right-radius":!0,"border-top-style":!0,"border-top-width":!0,"border-width":!0,bottom:!1,"box-decoration-break":!0,"box-shadow":!0,"box-sizing":!0,"box-snap":!0,"box-suppress":!0,"break-after":!0,"break-before":!0,"break-inside":!0,"caption-side":!1,chains:!1,clear:!0,clip:!1,"clip-path":!1,"clip-rule":!1,color:!0,"color-interpolation-filters":!0,"column-count":!1,"column-fill":!1,"column-gap":!1,"column-rule":!1,"column-rule-color":!1,"column-rule-style":!1,"column-rule-width":!1,"column-span":!1,"column-width":!1,columns:!1,contain:!1,content:!1,"counter-increment":!1,"counter-reset":!1,"counter-set":!1,crop:!1,cue:!1,"cue-after":!1,"cue-before":!1,cursor:!1,direction:!1,display:!0,"display-inside":!0,"display-list":!0,"display-outside":!0,"dominant-baseline":!1,elevation:!1,"empty-cells":!1,filter:!1,flex:!1,"flex-basis":!1,"flex-direction":!1,"flex-flow":!1,"flex-grow":!1,"flex-shrink":!1,"flex-wrap":!1,float:!1,"float-offset":!1,"flood-color":!1,"flood-opacity":!1,"flow-from":!1,"flow-into":!1,font:!0,"font-family":!0,"font-feature-settings":!0,"font-kerning":!0,"font-language-override":!0,"font-size":!0,"font-size-adjust":!0,"font-stretch":!0,"font-style":!0,"font-synthesis":!0,"font-variant":!0,"font-variant-alternates":!0,"font-variant-caps":!0,"font-variant-east-asian":!0,"font-variant-ligatures":!0,"font-variant-numeric":!0,"font-variant-position":!0,"font-weight":!0,grid:!1,"grid-area":!1,"grid-auto-columns":!1,"grid-auto-flow":!1,"grid-auto-rows":!1,"grid-column":!1,"grid-column-end":!1,"grid-column-start":!1,"grid-row":!1,"grid-row-end":!1,"grid-row-start":!1,"grid-template":!1,"grid-template-areas":!1,"grid-template-columns":!1,"grid-template-rows":!1,"hanging-punctuation":!1,height:!0,hyphens:!1,icon:!1,"image-orientation":!1,"image-resolution":!1,"ime-mode":!1,"initial-letters":!1,"inline-box-align":!1,"justify-content":!1,"justify-items":!1,"justify-self":!1,left:!1,"letter-spacing":!0,"lighting-color":!0,"line-box-contain":!1,"line-break":!1,"line-grid":!1,"line-height":!1,"line-snap":!1,"line-stacking":!1,"line-stacking-ruby":!1,"line-stacking-shift":!1,"line-stacking-strategy":!1,"list-style":!0,"list-style-image":!0,"list-style-position":!0,"list-style-type":!0,margin:!0,"margin-bottom":!0,"margin-left":!0,"margin-right":!0,"margin-top":!0,"marker-offset":!1,"marker-side":!1,marks:!1,mask:!1,"mask-box":!1,"mask-box-outset":!1,"mask-box-repeat":!1,"mask-box-slice":!1,"mask-box-source":!1,"mask-box-width":!1,"mask-clip":!1,"mask-image":!1,"mask-origin":!1,"mask-position":!1,"mask-repeat":!1,"mask-size":!1,"mask-source-type":!1,"mask-type":!1,"max-height":!0,"max-lines":!1,"max-width":!0,"min-height":!0,"min-width":!0,"move-to":!1,"nav-down":!1,"nav-index":!1,"nav-left":!1,"nav-right":!1,"nav-up":!1,"object-fit":!1,"object-position":!1,opacity:!1,order:!1,orphans:!1,outline:!1,"outline-color":!1,"outline-offset":!1,"outline-style":!1,"outline-width":!1,overflow:!1,"overflow-wrap":!1,"overflow-x":!1,"overflow-y":!1,padding:!0,"padding-bottom":!0,"padding-left":!0,"padding-right":!0,"padding-top":!0,page:!1,"page-break-after":!1,"page-break-before":!1,"page-break-inside":!1,"page-policy":!1,pause:!1,"pause-after":!1,"pause-before":!1,perspective:!1,"perspective-origin":!1,pitch:!1,"pitch-range":!1,"play-during":!1,position:!1,"presentation-level":!1,quotes:!1,"region-fragment":!1,resize:!1,rest:!1,"rest-after":!1,"rest-before":!1,richness:!1,right:!1,rotation:!1,"rotation-point":!1,"ruby-align":!1,"ruby-merge":!1,"ruby-position":!1,"shape-image-threshold":!1,"shape-outside":!1,"shape-margin":!1,size:!1,speak:!1,"speak-as":!1,"speak-header":!1,"speak-numeral":!1,"speak-punctuation":!1,"speech-rate":!1,stress:!1,"string-set":!1,"tab-size":!1,"table-layout":!1,"text-align":!0,"text-align-last":!0,"text-combine-upright":!0,"text-decoration":!0,"text-decoration-color":!0,"text-decoration-line":!0,"text-decoration-skip":!0,"text-decoration-style":!0,"text-emphasis":!0,"text-emphasis-color":!0,"text-emphasis-position":!0,"text-emphasis-style":!0,"text-height":!0,"text-indent":!0,"text-justify":!0,"text-orientation":!0,"text-overflow":!0,"text-shadow":!0,"text-space-collapse":!0,"text-transform":!0,"text-underline-position":!0,"text-wrap":!0,top:!1,transform:!1,"transform-origin":!1,"transform-style":!1,transition:!1,"transition-delay":!1,"transition-duration":!1,"transition-property":!1,"transition-timing-function":!1,"unicode-bidi":!1,"vertical-align":!1,visibility:!1,"voice-balance":!1,"voice-duration":!1,"voice-family":!1,"voice-pitch":!1,"voice-range":!1,"voice-rate":!1,"voice-stress":!1,"voice-volume":!1,volume:!1,"white-space":!1,widows:!1,width:!0,"will-change":!1,"word-break":!0,"word-spacing":!0,"word-wrap":!0,"wrap-flow":!1,"wrap-through":!1,"writing-mode":!1,"z-index":!1};return e}var i=/javascript\s*\:/gim;n.whiteList=r(),n.getDefaultWhiteList=r,n.onAttr=function(e,t,n){},n.onIgnoreAttr=function(e,t,n){},n.safeAttrValue=function(e,t){return i.test(t)?"":t}},{}],8:[function(e,t,n){var r=e("./default"),i=e("./css");for(var o in(n=t.exports=function(e,t){return new i(t).process(e)}).FilterCSS=i,r)n[o]=r[o];"undefined"!=typeof window&&(window.filterCSS=t.exports)},{"./css":6,"./default":7}],9:[function(e,t,n){var r=e("./util");t.exports=function(e,t){";"!==(e=r.trimRight(e))[e.length-1]&&(e+=";");var n=e.length,i=!1,o=0,s=0,a="";function c(){if(!i){var n=r.trim(e.slice(o,s)),c=n.indexOf(":");if(-1!==c){var l=r.trim(n.slice(0,c)),u=r.trim(n.slice(c+1));if(l){var d=t(o,a.length,l,u,n);d&&(a+=d+"; ")}}}o=s+1}for(;s<n;s++){var l=e[s];if("/"===l&&"*"===e[s+1]){var u=e.indexOf("*/",s+2);if(-1===u)break;o=(s=u+1)+1,i=!1}else"("===l?i=!0:")"===l?i=!1:";"===l?i||c():"\n"===l&&c()}return r.trim(a)}},{"./util":10}],10:[function(e,t,n){t.exports={indexOf:function(e,t){var n,r;if(Array.prototype.indexOf)return e.indexOf(t);for(n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},forEach:function(e,t,n){var r,i;if(Array.prototype.forEach)return e.forEach(t,n);for(r=0,i=e.length;r<i;r++)t.call(n,e[r],r,e)},trim:function(e){return String.prototype.trim?e.trim():e.replace(/(^\s*)|(\s*$)/g,"")},trimRight:function(e){return String.prototype.trimRight?e.trimRight():e.replace(/(\s*$)/g,"")}}},{}]},{},[2]),t.filterXSS=filterXSS,t.filterCSS=filterCSS},function(e,t){var n=e.exports={version:"2.6.12"};"number"==typeof __e&&(__e=n)},function(e,t){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},function(e,t,n){"use strict";(function(e){var r=n(5),i=n(159),o="object"==typeof exports&&exports&&!exports.nodeType&&exports,s=o&&"object"==typeof e&&e&&!e.nodeType&&e,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){e.exports=function(e){return null!=e&&"object"==typeof e}},function(e,t,n){"use strict";(function(e){n(498),n(158),n(500);var r=n(1);n.d(t,"b",(function(){return r.d})),n.d(t,"a",(function(){return r.b})),e.$build=r.e.$build,e.$iq=r.e.$iq,e.$msg=r.e.$msg,e.$pres=r.e.$pres,e.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(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":s&&s in Object(e)?i(e):o(e)}},function(e,t,n){var r=n(353),i=n(356);e.exports=function(e,t){var n=i(e,t);return r(n)?n:void 0}},function(e,t,n){var r=n(41);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){(function(t){e.exports=function e(t,n,r){function i(s,a){if(!n[s]){if(!t[s]){if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[s]={exports:{}};t[s][0].call(l.exports,(function(e){var n=t[s][1][e];return i(n||e)}),l,l.exports,e,t,n,r)}return n[s].exports}for(var o=!1,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(e,n,r){(function(e){"use strict";var t,r,i=e.MutationObserver||e.WebKitMutationObserver;if(i){var o=0,s=new i(u),a=e.document.createTextNode("");s.observe(a,{characterData:!0}),t=function(){a.data=o=++o%2}}else if(e.setImmediate||void 0===e.MessageChannel)t="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){u(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(u,0)};else{var c=new e.MessageChannel;c.port1.onmessage=u,t=function(){c.port2.postMessage(0)}}var l=[];function u(){var e,t;r=!0;for(var n=l.length;n;){for(t=l,l=[],e=-1;++e<n;)t[e]();n=l.length}r=!1}n.exports=function(e){1!==l.push(e)||r||t()}}).call(this,void 0!==t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){"use strict";var r=e(1);function i(){}var o={},s=["REJECTED"],a=["FULFILLED"],c=["PENDING"];function l(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,e!==i&&f(this,e)}function u(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function d(e,t,n){r((function(){var r;try{r=t(n)}catch(t){return o.reject(e,t)}r===e?o.reject(e,new TypeError("Cannot resolve promise with itself")):o.resolve(e,r)}))}function h(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function f(e,t){var n=!1;function r(t){n||(n=!0,o.reject(e,t))}function i(t){n||(n=!0,o.resolve(e,t))}var s=p((function(){t(i,r)}));"error"===s.status&&r(s.value)}function p(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}t.exports=l,l.prototype.catch=function(e){return this.then(null,e)},l.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===s)return this;var n=new this.constructor(i);return this.state!==c?d(n,this.state===a?e:t,this.outcome):this.queue.push(new u(n,e,t)),n},u.prototype.callFulfilled=function(e){o.resolve(this.promise,e)},u.prototype.otherCallFulfilled=function(e){d(this.promise,this.onFulfilled,e)},u.prototype.callRejected=function(e){o.reject(this.promise,e)},u.prototype.otherCallRejected=function(e){d(this.promise,this.onRejected,e)},o.resolve=function(e,t){var n=p(h,t);if("error"===n.status)return o.reject(e,n.value);var r=n.value;if(r)f(e,r);else{e.state=a,e.outcome=t;for(var i=-1,s=e.queue.length;++i<s;)e.queue[i].callFulfilled(t)}return e},o.reject=function(e,t){e.state=s,e.outcome=t;for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].callRejected(t);return e},l.resolve=function(e){return e instanceof this?e:o.resolve(new this(i),e)},l.reject=function(e){var t=new this(i);return o.reject(t,e)},l.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,r=!1;if(!n)return this.resolve([]);for(var s=new Array(n),a=0,c=-1,l=new this(i);++c<n;)u(e[c],c);return l;function u(e,i){t.resolve(e).then((function(e){s[i]=e,++a!==n||r||(r=!0,o.resolve(l,s))}),(function(e){r||(r=!0,o.reject(l,e))}))}},l.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,r=!1;if(!n)return this.resolve([]);for(var s,a=-1,c=new this(i);++a<n;)s=e[a],t.resolve(s).then((function(e){r||(r=!0,o.resolve(c,e))}),(function(e){r||(r=!0,o.reject(c,e))}));return c}},{1:1}],3:[function(e,n,r){(function(t){"use strict";"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}();function o(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),r=0;r<e.length;r+=1)n.append(e[r]);return n.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var s=Promise;function a(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function c(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)}function l(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function u(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var d=void 0,h={},f=Object.prototype.toString;function p(e){return"boolean"==typeof d?s.resolve(d):function(e){return new s((function(t){var n=e.transaction("local-forage-detect-blob-support","readwrite"),r=o([""]);n.objectStore("local-forage-detect-blob-support").put(r,"key"),n.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},n.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//);t(n||!e||parseInt(e[1],10)>=43)}})).catch((function(){return!1}))}(e).then((function(e){return d=e}))}function g(e){var t=h[e.name],n={};n.promise=new s((function(e,t){n.resolve=e,n.reject=t})),t.deferredOperations.push(n),t.dbReady?t.dbReady=t.dbReady.then((function(){return n.promise})):t.dbReady=n.promise}function m(e){var t=h[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function v(e,t){var n=h[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function _(e,t){return new s((function(n,r){if(h[e.name]=h[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return n(e.db);g(e),e.db.close()}var o=[e.name];t&&o.push(e.version);var s=i.open.apply(i,o);t&&(s.onupgradeneeded=function(t){var n=s.result;try{n.createObjectStore(e.storeName),t.oldVersion<=1&&n.createObjectStore("local-forage-detect-blob-support")}catch(n){if("ConstraintError"!==n.name)throw n;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),s.onerror=function(e){e.preventDefault(),r(s.error)},s.onsuccess=function(){n(s.result),m(e)}}))}function b(e){return _(e,!1)}function y(e){return _(e,!0)}function w(e,t){if(!e.db)return!0;var n=!e.db.objectStoreNames.contains(e.storeName),r=e.version<e.db.version,i=e.version>e.db.version;if(r&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),i||n){if(n){var o=e.db.version+1;o>e.version&&(e.version=o)}return!0}return!1}function S(e){return o([function(e){for(var t=e.length,n=new ArrayBuffer(t),r=new Uint8Array(n),i=0;i<t;i++)r[i]=e.charCodeAt(i);return n}(atob(e.data))],{type:e.type})}function x(e){return e&&e.__local_forage_encoded_blob}function E(e){var t=this,n=t._initReady().then((function(){var e=h[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return c(n,e,e),n}function A(e,t,n,r){void 0===r&&(r=1);try{var i=e.db.transaction(e.storeName,t);n(null,i)}catch(i){if(r>0&&(!e.db||"InvalidStateError"===i.name||"NotFoundError"===i.name))return s.resolve().then((function(){if(!e.db||"NotFoundError"===i.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),y(e)})).then((function(){return function(e){g(e);for(var t=h[e.name],n=t.forages,r=0;r<n.length;r++){var i=n[r];i._dbInfo.db&&(i._dbInfo.db.close(),i._dbInfo.db=null)}return e.db=null,b(e).then((function(t){return e.db=t,w(e)?y(e):t})).then((function(r){e.db=t.db=r;for(var i=0;i<n.length;i++)n[i]._dbInfo.db=r})).catch((function(t){throw v(e,t),t}))}(e).then((function(){A(e,t,n,r-1)}))})).catch(n);n(i)}}var C={_driver:"asyncStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var r in e)n[r]=e[r];var i=h[n.name];i||(i={forages:[],db:null,dbReady:null,deferredOperations:[]},h[n.name]=i),i.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=E);var o=[];function a(){return s.resolve()}for(var c=0;c<i.forages.length;c++){var l=i.forages[c];l!==t&&o.push(l._initReady().catch(a))}var u=i.forages.slice(0);return s.all(o).then((function(){return n.db=i.db,b(n)})).then((function(e){return n.db=e,w(n,t._defaultConfig.version)?y(n):e})).then((function(e){n.db=i.db=e,t._dbInfo=n;for(var r=0;r<u.length;r++){var o=u[r];o!==t&&(o._dbInfo.db=n.db,o._dbInfo.version=n.version)}}))},_support:function(){try{if(!i||!i.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}(),iterate:function(e,t){var n=this,r=new s((function(t,r){n.ready().then((function(){A(n._dbInfo,"readonly",(function(i,o){if(i)return r(i);try{var s=o.objectStore(n._dbInfo.storeName).openCursor(),a=1;s.onsuccess=function(){var n=s.result;if(n){var r=n.value;x(r)&&(r=S(r));var i=e(r,n.key,a++);void 0!==i?t(i):n.continue()}else t()},s.onerror=function(){r(s.error)}}catch(e){r(e)}}))})).catch(r)}));return a(r,t),r},getItem:function(e,t){var n=this;e=l(e);var r=new s((function(t,r){n.ready().then((function(){A(n._dbInfo,"readonly",(function(i,o){if(i)return r(i);try{var s=o.objectStore(n._dbInfo.storeName).get(e);s.onsuccess=function(){var e=s.result;void 0===e&&(e=null),x(e)&&(e=S(e)),t(e)},s.onerror=function(){r(s.error)}}catch(e){r(e)}}))})).catch(r)}));return a(r,t),r},setItem:function(e,t,n){var r=this;e=l(e);var i=new s((function(n,i){var o;r.ready().then((function(){return o=r._dbInfo,"[object Blob]"===f.call(t)?p(o.db).then((function(e){return e?t:(n=t,new s((function(e,t){var r=new FileReader;r.onerror=t,r.onloadend=function(t){var r=btoa(t.target.result||"");e({__local_forage_encoded_blob:!0,data:r,type:n.type})},r.readAsBinaryString(n)})));var n})):t})).then((function(t){A(r._dbInfo,"readwrite",(function(o,s){if(o)return i(o);try{var a=s.objectStore(r._dbInfo.storeName);null===t&&(t=void 0);var c=a.put(t,e);s.oncomplete=function(){void 0===t&&(t=null),n(t)},s.onabort=s.onerror=function(){var e=c.error?c.error:c.transaction.error;i(e)}}catch(e){i(e)}}))})).catch(i)}));return a(i,n),i},removeItem:function(e,t){var n=this;e=l(e);var r=new s((function(t,r){n.ready().then((function(){A(n._dbInfo,"readwrite",(function(i,o){if(i)return r(i);try{var s=o.objectStore(n._dbInfo.storeName).delete(e);o.oncomplete=function(){t()},o.onerror=function(){r(s.error)},o.onabort=function(){var e=s.error?s.error:s.transaction.error;r(e)}}catch(e){r(e)}}))})).catch(r)}));return a(r,t),r},clear:function(e){var t=this,n=new s((function(e,n){t.ready().then((function(){A(t._dbInfo,"readwrite",(function(r,i){if(r)return n(r);try{var o=i.objectStore(t._dbInfo.storeName).clear();i.oncomplete=function(){e()},i.onabort=i.onerror=function(){var e=o.error?o.error:o.transaction.error;n(e)}}catch(e){n(e)}}))})).catch(n)}));return a(n,e),n},length:function(e){var t=this,n=new s((function(e,n){t.ready().then((function(){A(t._dbInfo,"readonly",(function(r,i){if(r)return n(r);try{var o=i.objectStore(t._dbInfo.storeName).count();o.onsuccess=function(){e(o.result)},o.onerror=function(){n(o.error)}}catch(e){n(e)}}))})).catch(n)}));return a(n,e),n},key:function(e,t){var n=this,r=new s((function(t,r){e<0?t(null):n.ready().then((function(){A(n._dbInfo,"readonly",(function(i,o){if(i)return r(i);try{var s=o.objectStore(n._dbInfo.storeName),a=!1,c=s.openKeyCursor();c.onsuccess=function(){var n=c.result;n?0===e||a?t(n.key):(a=!0,n.advance(e)):t(null)},c.onerror=function(){r(c.error)}}catch(e){r(e)}}))})).catch(r)}));return a(r,t),r},keys:function(e){var t=this,n=new s((function(e,n){t.ready().then((function(){A(t._dbInfo,"readonly",(function(r,i){if(r)return n(r);try{var o=i.objectStore(t._dbInfo.storeName).openKeyCursor(),s=[];o.onsuccess=function(){var t=o.result;t?(s.push(t.key),t.continue()):e(s)},o.onerror=function(){n(o.error)}}catch(e){n(e)}}))})).catch(n)}));return a(n,e),n},dropInstance:function(e,t){t=u.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var r,o=this;if(e.name){var c=e.name===n.name&&o._dbInfo.db,l=c?s.resolve(o._dbInfo.db):b(e).then((function(t){var n=h[e.name],r=n.forages;n.db=t;for(var i=0;i<r.length;i++)r[i]._dbInfo.db=t;return t}));r=e.storeName?l.then((function(t){if(t.objectStoreNames.contains(e.storeName)){var n=t.version+1;g(e);var r=h[e.name],o=r.forages;t.close();for(var a=0;a<o.length;a++){var c=o[a];c._dbInfo.db=null,c._dbInfo.version=n}return new s((function(t,r){var o=i.open(e.name,n);o.onerror=function(e){o.result.close(),r(e)},o.onupgradeneeded=function(){o.result.deleteObjectStore(e.storeName)},o.onsuccess=function(){var e=o.result;e.close(),t(e)}})).then((function(e){r.db=e;for(var t=0;t<o.length;t++){var n=o[t];n._dbInfo.db=e,m(n._dbInfo)}})).catch((function(t){throw(v(e,t)||s.resolve()).catch((function(){})),t}))}})):l.then((function(t){g(e);var n=h[e.name],r=n.forages;t.close();for(var o=0;o<r.length;o++)r[o]._dbInfo.db=null;return new s((function(t,n){var r=i.deleteDatabase(e.name);r.onerror=r.onblocked=function(e){var t=r.result;t&&t.close(),n(e)},r.onsuccess=function(){var e=r.result;e&&e.close(),t(e)}})).then((function(e){n.db=e;for(var t=0;t<r.length;t++)m(r[t]._dbInfo)})).catch((function(t){throw(v(e,t)||s.resolve()).catch((function(){})),t}))}))}else r=s.reject("Invalid arguments");return a(r,t),r}},j="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",O=/^~~local_forage_type~([^~]+)~/,T="__lfsc__:".length,k=T+"arbf".length,N=Object.prototype.toString;function I(e){var t,n,r,i,o,s=.75*e.length,a=e.length,c=0;"="===e[e.length-1]&&(s--,"="===e[e.length-2]&&s--);var l=new ArrayBuffer(s),u=new Uint8Array(l);for(t=0;t<a;t+=4)n=j.indexOf(e[t]),r=j.indexOf(e[t+1]),i=j.indexOf(e[t+2]),o=j.indexOf(e[t+3]),u[c++]=n<<2|r>>4,u[c++]=(15&r)<<4|i>>2,u[c++]=(3&i)<<6|63&o;return l}function M(e){var t,n=new Uint8Array(e),r="";for(t=0;t<n.length;t+=3)r+=j[n[t]>>2],r+=j[(3&n[t])<<4|n[t+1]>>4],r+=j[(15&n[t+1])<<2|n[t+2]>>6],r+=j[63&n[t+2]];return n.length%3==2?r=r.substring(0,r.length-1)+"=":n.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}var R={serialize:function(e,t){var n="";if(e&&(n=N.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===N.call(e.buffer))){var r,i="__lfsc__:";e instanceof ArrayBuffer?(r=e,i+="arbf"):(r=e.buffer,"[object Int8Array]"===n?i+="si08":"[object Uint8Array]"===n?i+="ui08":"[object Uint8ClampedArray]"===n?i+="uic8":"[object Int16Array]"===n?i+="si16":"[object Uint16Array]"===n?i+="ur16":"[object Int32Array]"===n?i+="si32":"[object Uint32Array]"===n?i+="ui32":"[object Float32Array]"===n?i+="fl32":"[object Float64Array]"===n?i+="fl64":t(new Error("Failed to get type for BinaryArray"))),t(i+M(r))}else if("[object Blob]"===n){var o=new FileReader;o.onload=function(){var n="~~local_forage_type~"+e.type+"~"+M(this.result);t("__lfsc__:blob"+n)},o.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}},deserialize:function(e){if("__lfsc__:"!==e.substring(0,T))return JSON.parse(e);var t,n=e.substring(k),r=e.substring(T,k);if("blob"===r&&O.test(n)){var i=n.match(O);t=i[1],n=n.substring(i[0].length)}var s=I(n);switch(r){case"arbf":return s;case"blob":return o([s],{type:t});case"si08":return new Int8Array(s);case"ui08":return new Uint8Array(s);case"uic8":return new Uint8ClampedArray(s);case"si16":return new Int16Array(s);case"ur16":return new Uint16Array(s);case"si32":return new Int32Array(s);case"ui32":return new Uint32Array(s);case"fl32":return new Float32Array(s);case"fl64":return new Float64Array(s);default:throw new Error("Unkown type: "+r)}},stringToBuffer:I,bufferToString:M};function D(e,t,n,r){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,r)}function P(e,t,n,r,i,o){e.executeSql(n,r,i,(function(e,s){s.code===s.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,a){a.rows.length?o(e,s):D(e,t,(function(){e.executeSql(n,r,i,o)}),o)}),o):o(e,s)}),o)}function L(e,t,n,r){var i=this;e=l(e);var o=new s((function(o,s){i.ready().then((function(){void 0===t&&(t=null);var a=t,c=i._dbInfo;c.serializer.serialize(t,(function(t,l){l?s(l):c.db.transaction((function(n){P(n,c,"INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){o(a)}),(function(e,t){s(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(r>0)return void o(L.apply(i,[e,a,n,r-1]));s(t)}}))}))})).catch(s)}));return a(o,n),o}function F(e){return new s((function(t,n){e.transaction((function(r){r.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(n,r){for(var i=[],o=0;o<r.rows.length;o++)i.push(r.rows.item(o).name);t({db:e,storeNames:i})}),(function(e,t){n(t)}))}),(function(e){n(e)}))}))}var z={_driver:"webSQLStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var r in e)n[r]="string"!=typeof e[r]?e[r].toString():e[r];var i=new s((function(e,r){try{n.db=openDatabase(n.name,String(n.version),n.description,n.size)}catch(e){return r(e)}n.db.transaction((function(i){D(i,n,(function(){t._dbInfo=n,e()}),(function(e,t){r(t)}))}),r)}));return n.serializer=R,i},_support:"function"==typeof openDatabase,iterate:function(e,t){var n=this,r=new s((function(t,r){n.ready().then((function(){var i=n._dbInfo;i.db.transaction((function(n){P(n,i,"SELECT * FROM "+i.storeName,[],(function(n,r){for(var o=r.rows,s=o.length,a=0;a<s;a++){var c=o.item(a),l=c.value;if(l&&(l=i.serializer.deserialize(l)),void 0!==(l=e(l,c.key,a+1)))return void t(l)}t()}),(function(e,t){r(t)}))}))})).catch(r)}));return a(r,t),r},getItem:function(e,t){var n=this;e=l(e);var r=new s((function(t,r){n.ready().then((function(){var i=n._dbInfo;i.db.transaction((function(n){P(n,i,"SELECT * FROM "+i.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,n){var r=n.rows.length?n.rows.item(0).value:null;r&&(r=i.serializer.deserialize(r)),t(r)}),(function(e,t){r(t)}))}))})).catch(r)}));return a(r,t),r},setItem:function(e,t,n){return L.apply(this,[e,t,n,1])},removeItem:function(e,t){var n=this;e=l(e);var r=new s((function(t,r){n.ready().then((function(){var i=n._dbInfo;i.db.transaction((function(n){P(n,i,"DELETE FROM "+i.storeName+" WHERE key = ?",[e],(function(){t()}),(function(e,t){r(t)}))}))})).catch(r)}));return a(r,t),r},clear:function(e){var t=this,n=new s((function(e,n){t.ready().then((function(){var r=t._dbInfo;r.db.transaction((function(t){P(t,r,"DELETE FROM "+r.storeName,[],(function(){e()}),(function(e,t){n(t)}))}))})).catch(n)}));return a(n,e),n},length:function(e){var t=this,n=new s((function(e,n){t.ready().then((function(){var r=t._dbInfo;r.db.transaction((function(t){P(t,r,"SELECT COUNT(key) as c FROM "+r.storeName,[],(function(t,n){var r=n.rows.item(0).c;e(r)}),(function(e,t){n(t)}))}))})).catch(n)}));return a(n,e),n},key:function(e,t){var n=this,r=new s((function(t,r){n.ready().then((function(){var i=n._dbInfo;i.db.transaction((function(n){P(n,i,"SELECT key FROM "+i.storeName+" WHERE id = ? LIMIT 1",[e+1],(function(e,n){var r=n.rows.length?n.rows.item(0).key:null;t(r)}),(function(e,t){r(t)}))}))})).catch(r)}));return a(r,t),r},keys:function(e){var t=this,n=new s((function(e,n){t.ready().then((function(){var r=t._dbInfo;r.db.transaction((function(t){P(t,r,"SELECT key FROM "+r.storeName,[],(function(t,n){for(var r=[],i=0;i<n.rows.length;i++)r.push(n.rows.item(i).key);e(r)}),(function(e,t){n(t)}))}))})).catch(n)}));return a(n,e),n},dropInstance:function(e,t){t=u.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var r,i=this;return a(r=e.name?new s((function(t){var r;r=e.name===n.name?i._dbInfo.db:openDatabase(e.name,"","",0),e.storeName?t({db:r,storeNames:[e.storeName]}):t(F(r))})).then((function(e){return new s((function(t,n){e.db.transaction((function(r){function i(e){return new s((function(t,n){r.executeSql("DROP TABLE IF EXISTS "+e,[],(function(){t()}),(function(e,t){n(t)}))}))}for(var o=[],a=0,c=e.storeNames.length;a<c;a++)o.push(i(e.storeNames[a]));s.all(o).then((function(){t()})).catch((function(e){n(e)}))}),(function(e){n(e)}))}))})):s.reject("Invalid arguments"),t),r}};function B(e,t){var n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}function q(){return!function(){try{return localStorage.setItem("_localforage_support_test",!0),localStorage.removeItem("_localforage_support_test"),!1}catch(e){return!0}}()||localStorage.length>0}var H={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var n in e)t[n]=e[n];return t.keyPrefix=B(e,this._defaultConfig),q()?(this._dbInfo=t,t.serializer=R,s.resolve()):s.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(e,t){var n=this,r=n.ready().then((function(){for(var t=n._dbInfo,r=t.keyPrefix,i=r.length,o=localStorage.length,s=1,a=0;a<o;a++){var c=localStorage.key(a);if(0===c.indexOf(r)){var l=localStorage.getItem(c);if(l&&(l=t.serializer.deserialize(l)),void 0!==(l=e(l,c.substring(i),s++)))return l}}}));return a(r,t),r},getItem:function(e,t){var n=this;e=l(e);var r=n.ready().then((function(){var t=n._dbInfo,r=localStorage.getItem(t.keyPrefix+e);return r&&(r=t.serializer.deserialize(r)),r}));return a(r,t),r},setItem:function(e,t,n){var r=this;e=l(e);var i=r.ready().then((function(){void 0===t&&(t=null);var n=t;return new s((function(i,o){var s=r._dbInfo;s.serializer.serialize(t,(function(t,r){if(r)o(r);else try{localStorage.setItem(s.keyPrefix+e,t),i(n)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||o(e),o(e)}}))}))}));return a(i,n),i},removeItem:function(e,t){var n=this;e=l(e);var r=n.ready().then((function(){var t=n._dbInfo;localStorage.removeItem(t.keyPrefix+e)}));return a(r,t),r},clear:function(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,n=localStorage.length-1;n>=0;n--){var r=localStorage.key(n);0===r.indexOf(e)&&localStorage.removeItem(r)}}));return a(n,e),n},length:function(e){var t=this.keys().then((function(e){return e.length}));return a(t,e),t},key:function(e,t){var n=this,r=n.ready().then((function(){var t,r=n._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(r.keyPrefix.length)),t}));return a(r,t),r},keys:function(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo,n=localStorage.length,r=[],i=0;i<n;i++){var o=localStorage.key(i);0===o.indexOf(e.keyPrefix)&&r.push(o.substring(e.keyPrefix.length))}return r}));return a(n,e),n},dropInstance:function(e,t){if(t=u.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config();e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}var r,i=this;return a(r=e.name?new s((function(t){e.storeName?t(B(e,i._defaultConfig)):t(e.name+"/")})).then((function(e){for(var t=localStorage.length-1;t>=0;t--){var n=localStorage.key(t);0===n.indexOf(e)&&localStorage.removeItem(n)}})):s.reject("Invalid arguments"),t),r}},U=function(e,t){for(var n,r,i=e.length,o=0;o<i;){if((n=e[o])===(r=t)||"number"==typeof n&&"number"==typeof r&&isNaN(n)&&isNaN(r))return!0;o++}return!1},$=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},W={},G={},V={INDEXEDDB:C,WEBSQL:z,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(e,t){e[t]=function(){var n=arguments;return e.ready().then((function(){return e[t].apply(e,n)}))}}function Z(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var n in t)t.hasOwnProperty(n)&&($(t[n])?arguments[0][n]=t[n].slice():arguments[0][n]=t[n])}return arguments[0]}var ee=new(function(){function e(t){for(var n in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),V)if(V.hasOwnProperty(n)){var r=V[n],i=r._driver;this[n]=i,W[i]||this.defineDriver(r)}this._defaultConfig=Z({},Y),this._config=Z({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((function(){}))}return e.prototype.config=function(e){if("object"===(void 0===e?"undefined":r(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,n){var r=new s((function(t,n){try{var r=e._driver,i=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void n(i);for(var o=Q.concat("_initStorage"),c=0,l=o.length;c<l;c++){var u=o[c];if((!U(X,u)||e[u])&&"function"!=typeof e[u])return void n(i)}!function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),n=s.reject(t);return a(n,arguments[arguments.length-1]),n}},n=0,r=X.length;n<r;n++){var i=X[n];e[i]||(e[i]=t(i))}}();var d=function(n){W[r]&&console.info("Redefining LocalForage driver: "+r),W[r]=e,G[r]=n,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(d,n):d(!!e._support):d(!0)}catch(e){n(e)}}));return c(r,t,n),r},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,n){var r=W[e]?s.resolve(W[e]):s.reject(new Error("Driver not found."));return c(r,t,n),r},e.prototype.getSerializer=function(e){var t=s.resolve(R);return c(t,e),t},e.prototype.ready=function(e){var t=this,n=t._driverSet.then((function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}));return c(n,e,e),n},e.prototype.setDriver=function(e,t,n){var r=this;$(e)||(e=[e]);var i=this._getSupportedDrivers(e);function o(){r._config.driver=r.driver()}function a(e){return r._extend(e),o(),r._ready=r._initStorage(r._config),r._ready}var l=null!==this._driverSet?this._driverSet.catch((function(){return s.resolve()})):s.resolve();return this._driverSet=l.then((function(){var e=i[0];return r._dbInfo=null,r._ready=null,r.getDriver(e).then((function(e){r._driver=e._driver,o(),r._wrapLibraryMethodsWithReady(),r._initDriver=function(e){return function(){var t=0;return function n(){for(;t<e.length;){var i=e[t];return t++,r._dbInfo=null,r._ready=null,r.getDriver(i).then(a).catch(n)}o();var c=new Error("No available storage method found.");return r._driverSet=s.reject(c),r._driverSet}()}}(i)}))})).catch((function(){o();var e=new Error("No available storage method found.");return r._driverSet=s.reject(e),r._driverSet})),c(this._driverSet,t,n),this._driverSet},e.prototype.supports=function(e){return!!G[e]},e.prototype._extend=function(e){Z(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n];this.supports(i)&&t.push(i)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=Q.length;e<t;e++)K(this,Q[e])},e.prototype.createInstance=function(t){return new e(t)},e}());t.exports=ee},{3:3}]},{},[4])(4)}).call(this,n(12))},,function(e,t,n){var r=n(62),i=n(71);e.exports=function(e){return null!=e&&i(e.length)&&!r(e)}},function(e,t,n){var r=n(13),i=n(19),o=n(58),s=n(31),a=n(60),c=function(e,t,n){var l,u,d,h=e&c.F,f=e&c.G,p=e&c.S,g=e&c.P,m=e&c.B,v=e&c.W,_=f?i:i[t]||(i[t]={}),b=_.prototype,y=f?r:p?r[t]:(r[t]||{}).prototype;for(l in f&&(n=t),n)(u=!h&&y&&void 0!==y[l])&&a(_,l)||(d=u?y[l]:n[l],_[l]=f&&"function"!=typeof y[l]?n[l]:m&&u?o(d,r):v&&y[l]==d?function(e){var t=function(t,n,r){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,r)}return e.apply(this,arguments)};return t.prototype=e.prototype,t}(d):g&&"function"==typeof d?o(Function.call,d):d,g&&((_.virtual||(_.virtual={}))[l]=d,e&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(e,t,n){return r.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){e.exports=!n(82)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},function(e,t,n){var r=n(98),i=n(102),o=n(29);e.exports=function(e){return o(e)?r(e):i(e)}},function(e,t,n){(function(n){var r,i,o;i=[],void 0===(o="function"==typeof(r=function(){"use strict";var e=void 0!==n?n:this||window,t=document,r=t.documentElement,i="body",o=e.BSN={},s=o.supports=[],a="data-toggle",c="delay",l="target",u="animation",d="onmouseleave"in t?["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 r[m]||"Transition".toLowerCase()in r[m],E="WebkitTransition"in r[m]?"Webkit".toLowerCase()+"TransitionEnd":"Transition".toLowerCase()+"end",A="WebkitDuration"in r[m]?"Webkit".toLowerCase()+"TransitionDuration":"Transition".toLowerCase()+"Duration",C=function(e){e.focus?e.focus():e.setActive()},j=function(e,t){e.classList.add(t)},O=function(e,t){e.classList.remove(t)},T=function(e,t){return e.classList.contains(t)},k=function(e,t){return[].slice.call(e.getElementsByClassName(t))},N=function(e,n){return"object"==typeof e?e:(n||t).querySelector(e)},I=function(e,n){var r=n.charAt(0),i=n.substr(1);if("."===r){for(;e&&e!==t;e=e[p])if(null!==N(n,e[p])&&T(e,i))return e}else if("#"===r)for(;e&&e!==t;e=e[p])if(e.id===i)return e;return!1},M=function(e,t,n,r){r=r||!1,e.addEventListener(t,n,r)},R=function(e,t,n,r){r=r||!1,e.removeEventListener(t,n,r)},D=function(e,t,n,r){M(e,t,(function i(o){n(o),R(e,t,i,r)}),r)},P=!!function(){var t=!1;try{var n=Object.defineProperty({},"passive",{get:function(){t=!0}});D(e,"testPassive",null,n)}catch(e){}return t}()&&{passive:!0},L=function(t){var n=x?e.getComputedStyle(t)[A]:0;return n="number"!=typeof(n=parseFloat(n))||isNaN(n)?0:1e3*n},F=function(e,t){var n=0;L(e)?D(e,E,(function(e){!n&&t(e),n=1})):setTimeout((function(){!n&&t(),n=1}),17)},z=function(e,t,n){var r=new CustomEvent(e+".bs."+t);r.relatedTarget=n,this.dispatchEvent(r)},B=function(n,o,s,a){var c,l,u,d,h,f,p=o.offsetWidth,g=o.offsetHeight,v=r.clientWidth||t[i].clientWidth,_=r.clientHeight||t[i].clientHeight,S=n.getBoundingClientRect(),x=a===t[i]?{y:e.pageYOffset||r.scrollTop,x:e.pageXOffset||r.scrollLeft}:{x:a.offsetLeft+a.scrollLeft,y:a.offsetTop+a.scrollTop},E=S.right-S[b],A=S.bottom-S.top,C=T(o,"popover"),j=N(".arrow",o),O=S.top+A/2-g/2<0,k=S[b]+E/2-p/2<0,I=S[b]+p/2+E/2>=v,M=S.top+g/2+A/2>=_,R=S.top-g<0,D=S[b]-p<0,P=S.top+g+A>=_,L=S[b]+p+E>=v;s="right"===(s=(s="bottom"===(s=(s=(s===b||"right"===s)&&D&&L?y:s)===y&&R?"bottom":s)&&P?y:s)===b&&D?"right":s)&&L?b:s,-1===o.className.indexOf(s)&&(o.className=o.className.replace(w,s)),h=j.offsetWidth,f=j.offsetHeight,s===b||"right"===s?(l=s===b?S[b]+x.x-p-(C?h:0):S[b]+x.x+E,O?(c=S.top+x.y,u=A/2-h):M?(c=S.top+x.y-g+A,u=g-A/2-h):(c=S.top+x.y-g/2+A/2,u=g/2-(C?.9*f:f/2))):s!==y&&"bottom"!==s||(c=s===y?S.top+x.y-g-(C?f:0):S.top+x.y+A,k?(l=0,d=S[b]+E/2-h):I?(l=v-1.01*p,d=p-(v-S[b])+E/2-h/2):(l=S[b]+x.x-p/2+E/2,d=p/2-(C?h:h/2))),o[m].top=c+"px",o[m][b]=l+"px",u&&(j[m].top=u+"px"),d&&(j[m][b]=d+"px")};o.version="2.0.27";var q=function(e){e=N(e);var t=this,n=I(e,".alert"),r=function(r){n=I(r[l],".alert"),(e=N('[data-dismiss="alert"]',n))&&n&&(e===r[l]||e.contains(r[l]))&&t.close()},i=function(){z.call(n,"closed","alert"),R(e,"click",r),n[p].removeChild(n)};this.close=function(){n&&e&&T(n,"show")&&(z.call(n,"close","alert"),O(n,"show"),n&&(T(n,"fade")?F(n,i):i()))},"Alert"in e||M(e,"click",r),e.Alert=t};s[v](["Alert",q,'[data-dismiss="alert"]']);var H=function(e){e=N(e);var n=!1,r="checked",i=function(t){var i="LABEL"===t[l].tagName?t[l]:"LABEL"===t[l][p].tagName?t[l][p]:null;if(i){var o=k(i[p],"btn"),s=i.getElementsByTagName("INPUT")[0];if(s){if("checkbox"===s.type&&(s[r]?(O(i,_),s[h](r),s.removeAttribute(r),s[r]=!1):(j(i,_),s[h](r),s[f](r,r),s[r]=!0),n||(n=!0,z.call(s,"change","button"),z.call(e,"change","button"))),"radio"===s.type&&!n&&(!s[r]||0===t.screenX&&0==t.screenY)){j(i,_),j(i,"focus"),s[f](r,r),s[r]=!0,z.call(s,"change","button"),z.call(e,"change","button"),n=!0;for(var a=0,c=o[g];a<c;a++){var u=o[a],d=u.getElementsByTagName("INPUT")[0];u!==i&&T(u,_)&&(O(u,_),d.removeAttribute(r),d[r]=!1,z.call(d,"change","button"))}}setTimeout((function(){n=!1}),50)}}},o=function(e){j(e[l][p],"focus")},s=function(e){O(e[l][p],"focus")};if(!("Button"in e)){M(e,"click",i),M(e,"keyup",(function(e){32===(e.which||e.keyCode)&&e[l]===t.activeElement&&i(e)})),M(e,"keydown",(function(e){32===(e.which||e.keyCode)&&e.preventDefault()}));for(var a=k(e,"btn"),c=0;c<a.length;c++){var u=a[c].getElementsByTagName("INPUT")[0];M(u,"focus",o),M(u,"blur",s)}}var d=k(e,"btn"),m=d[g];for(c=0;c<m;c++)!T(d[c],_)&&N("input:checked",d[c])&&j(d[c],_);e.Button=this};s[v](["Button",H,"["+a+'="buttons"]']);var U=function(e,t){e=N(e),t=t||{};var n,r,i,o,s,a=null,c=null,l=this,u=e[h]("data-parent"),d=function(e,t){z.call(e,"hide","collapse"),e.isAnimating=!0,e[m].height=e.scrollHeight+"px",O(e,"collapse"),O(e,"show"),j(e,"collapsing"),e.offsetWidth,e[m].height="0px",F(e,(function(){e.isAnimating=!1,e[f]("aria-expanded","false"),t[f]("aria-expanded","false"),O(e,"collapsing"),j(e,"collapse"),e[m].height="",z.call(e,"hidden","collapse")}))};this.toggle=function(e){e.preventDefault(),T(c,"show")?l.hide():l.show()},this.hide=function(){c.isAnimating||(d(c,e),j(e,"collapsed"))},this.show=function(){var t,i;a&&(n=N(".collapse.show",a),r=n&&(N('[data-target="#'+n.id+'"]',a)||N('[href="#'+n.id+'"]',a))),(!c.isAnimating||n&&!n.isAnimating)&&(r&&n!==c&&(d(n,r),j(r,"collapsed")),i=e,z.call(t=c,"show","collapse"),t.isAnimating=!0,j(t,"collapsing"),O(t,"collapse"),t[m].height=t.scrollHeight+"px",F(t,(function(){t.isAnimating=!1,t[f]("aria-expanded","true"),i[f]("aria-expanded","true"),O(t,"collapsing"),j(t,"collapse"),j(t,"show"),t[m].height="",z.call(t,"shown","collapse")})),O(e,"collapsed"))},"Collapse"in e||M(e,"click",l.toggle),i=e.href&&e[h]("href"),o=e[h]("data-target"),s=i||o&&"#"===o.charAt(0)&&o,(c=s&&N(s)).isAnimating=!1,a=N(t.parent)||u&&I(e,u),e.Collapse=l};s[v](["Collapse",U,"["+a+'="collapse"]']);var $=function(e,n){e=N(e),this.persist=!0===n||"true"===e[h]("data-persist")||!1;var r=this,i=e[p],o=null,s=N(".dropdown-menu",i),c=function(){for(var e=s.children,t=[],n=0;n<e[g];n++)e[n].children[g]&&"A"===e[n].children[0].tagName&&t[v](e[n].children[0]),"A"===e[n].tagName&&t[v](e[n]);return t}(),u=function(e){(e.href&&"#"===e.href.slice(-1)||e[p]&&e[p].href&&"#"===e[p].href.slice(-1))&&this.preventDefault()},d=function(){var n=e.open?M:R;n(t,"click",m),n(t,"keydown",b),n(t,"keyup",y),n(t,"focus",m,!0)},m=function(t){var n=t[l],i=n&&(n[h](a)||n[p]&&h in n[p]&&n[p][h](a));("focus"!==t.type||n!==e&&n!==s&&!s.contains(n))&&(n!==s&&!s.contains(n)||!r.persist&&!i)&&(o=n===e||e.contains(n)?e:null,S(),u.call(t,n))},_=function(t){o=e,w(),u.call(t,t[l])},b=function(e){var t=e.which||e.keyCode;38!==t&&40!==t||e.preventDefault()},y=function(n){var i=n.which||n.keyCode,a=t.activeElement,l=c.indexOf(a),u=a===e,d=s.contains(a),h=a[p]===s||a[p][p]===s;h&&(l=u?0:38===i?l>1?l-1:0:40===i&&l<c[g]-1?l+1:l,c[l]&&C(c[l])),(c[g]&&h||!c[g]&&(d||u)||!d)&&e.open&&27===i&&(r.toggle(),o=null)},w=function(){z.call(i,"show","dropdown",o),j(s,"show"),j(i,"show"),e[f]("aria-expanded",!0),z.call(i,"shown","dropdown",o),e.open=!0,R(e,"click",_),setTimeout((function(){C(s.getElementsByTagName("INPUT")[0]||e),d()}),1)},S=function(){z.call(i,"hide","dropdown",o),O(s,"show"),O(i,"show"),e[f]("aria-expanded",!1),z.call(i,"hidden","dropdown",o),e.open=!1,d(),C(e),setTimeout((function(){M(e,"click",_)}),1)};e.open=!1,this.toggle=function(){T(i,"show")&&e.open?S():w()},"Dropdown"in e||(!1 in s&&s[f]("tabindex","0"),M(e,"click",_)),e.Dropdown=r};s[v](["Dropdown",$,"["+a+'="dropdown"]']);var W=function(n,o){var s=(n=N(n))[h]("data-target")||n[h]("href"),a=N(s),c=T(n,"modal")?n:a;if(T(n,"modal")&&(n=null),c){o=o||{},this.keyboard=!1!==o.keyboard&&"false"!==c[h]("data-keyboard"),this.backdrop="static"!==o.backdrop&&"static"!==c[h]("data-backdrop")||"static",this.backdrop=!1!==o.backdrop&&"false"!==c[h]("data-backdrop")&&this.backdrop,this[u]=!!T(c,"fade"),this.content=o.content,c.isAnimating=!1;var d,v,_,y,w,E=this,A=null,I=k(r,"fixed-top").concat(k(r,"fixed-bottom")),D=function(){var n,r=e.getComputedStyle(t[i]),o=parseInt(r.paddingRight,10);if(d&&(t[i][m].paddingRight=o+v+"px",c[m].paddingRight=v+"px",I[g]))for(var s=0;s<I[g];s++)n=e.getComputedStyle(I[s]).paddingRight,I[s][m].paddingRight=parseInt(n)+v+"px"},B=function(){var n,o,s;d=t[i].clientWidth<(n=r.getBoundingClientRect(),e.innerWidth||n.right-Math.abs(n[b])),(s=t.createElement("div")).className="modal-scrollbar-measure",t[i].appendChild(s),o=s.offsetWidth-s.clientWidth,t[i].removeChild(s),v=o},q=function(){(_=N(".modal-backdrop"))&&null!==_&&"object"==typeof _&&(S=0,t[i].removeChild(_),_=null)},H=function(){C(c),c.isAnimating=!1,z.call(c,"shown","modal",A),M(e,"resize",E.update,P),M(c,"click",W),M(t,"keydown",$)},U=function(){c[m].display="",n&&C(n),z.call(c,"hidden","modal"),k(t,"modal show")[0]||(function(){if(t[i][m].paddingRight="",c[m].paddingRight="",I[g])for(var e=0;e<I[g];e++)I[e][m].paddingRight=""}(),O(t[i],"modal-open"),_&&T(_,"fade")?(O(_,"show"),F(_,q)):q(),R(e,"resize",E.update,P),R(c,"click",W),R(t,"keydown",$)),c.isAnimating=!1},$=function(e){c.isAnimating||E.keyboard&&27==e.which&&T(c,"show")&&E.hide()},W=function(e){if(!c.isAnimating){var t=e[l];T(c,"show")&&("modal"===t[p][h]("data-dismiss")||"modal"===t[h]("data-dismiss")||t===c&&"static"!==E.backdrop)&&(E.hide(),A=null,e.preventDefault())}};this.toggle=function(){T(c,"show")?this.hide():this.show()},this.show=function(){T(c,"show")||c.isAnimating||(clearTimeout(w),w=setTimeout((function(){c.isAnimating=!0,z.call(c,"show","modal",A);var e,n=k(t,"modal show")[0];n&&n!==c&&("modalTrigger"in n&&n.modalTrigger.Modal.hide(),"Modal"in n&&n.Modal.hide()),E.backdrop&&!S&&!_&&(e=t.createElement("div"),null===(_=N(".modal-backdrop"))&&(e[f]("class","modal-backdrop"+(E[u]?" fade":"")),_=e,t[i].appendChild(_)),S=1),_&&!T(_,"show")&&(_.offsetWidth,y=L(_),j(_,"show")),setTimeout((function(){c[m].display="block",B(),D(),j(t[i],"modal-open"),j(c,"show"),c[f]("aria-hidden",!1),T(c,"fade")?F(c,H):H()}),x&&_&&y?y:1)}),1))},this.hide=function(){!c.isAnimating&&T(c,"show")&&(clearTimeout(w),w=setTimeout((function(){c.isAnimating=!0,z.call(c,"hide","modal"),_=N(".modal-backdrop"),y=_&&L(_),O(c,"show"),c[f]("aria-hidden",!0),setTimeout((function(){T(c,"fade")?F(c,U):U()}),x&&_&&y?y:2)}),2))},this.setContent=function(e){N(".modal-content",c).innerHTML=e},this.update=function(){T(c,"show")&&(B(),D())},n&&!("Modal"in n)&&M(n,"click",(function(e){if(!c.isAnimating){var t=e[l];(t=t.hasAttribute("data-target")||t.hasAttribute("href")?t:t[p])!==n||T(c,"show")||(c.modalTrigger=n,A=n,E.show(),e.preventDefault())}})),E.content&&E.setContent(E.content),n?(n.Modal=E,c.modalTrigger=n):c.Modal=E}};s[v](["Modal",W,"["+a+'="modal"]']);var G=function(n,r){n=N(n),r=r||{};var o=n[h]("data-trigger"),s=n[h]("data-animation"),a=n[h]("data-placement"),p=n[h]("data-dismissible"),g=n[h]("data-delay"),v=n[h]("data-container"),_='<button type="button" class="close">×</button>',b=N(r.container),w=N(v),S=I(n,".modal"),x=I(n,".fixed-top"),E=I(n,".fixed-bottom");this.template=r.template?r.template:null,this.trigger=r.trigger?r.trigger:o||"hover",this[u]=r[u]&&"fade"!==r[u]?r[u]:s||"fade",this.placement=r.placement?r.placement:a||y,this[c]=parseInt(r[c]||g)||200,this.dismissible=!(!r.dismissible&&"true"!==p),this.container=b||w||x||E||S||t[i];var A=this,C=r.title||n[h]("data-title")||null,k=r.content||n[h]("data-content")||null;if(k||this.template){var D=null,L=0,q=this.placement,H=function(e){null!==D&&e[l]===N(".close",D)&&A.hide()},U=function(r){"click"!=A.trigger&&"focus"!=A.trigger||!A.dismissible&&r(n,"blur",A.hide),A.dismissible&&r(t,"click",H),r(e,"resize",A.hide,P)},$=function(){U(M),z.call(n,"shown","popover")},W=function(){U(R),A.container.removeChild(D),L=null,D=null,z.call(n,"hidden","popover")};this.toggle=function(){null===D?A.show():A.hide()},this.show=function(){clearTimeout(L),L=setTimeout((function(){null===D&&(q=A.placement,function(){C=r.title||n[h]("data-title"),k=(k=r.content||n[h]("data-content"))?k.trim():null,D=t.createElement("div");var e=t.createElement("div");if(e[f]("class","arrow"),D.appendChild(e),null!==k&&null===A.template){if(D[f]("role","tooltip"),null!==C){var i=t.createElement("h3");i[f]("class","popover-header"),i.innerHTML=A.dismissible?C+_:C,D.appendChild(i)}var o=t.createElement("div");o[f]("class","popover-body"),o.innerHTML=A.dismissible&&null===C?k+_:k,D.appendChild(o)}else{var s=t.createElement("div");A.template=A.template.trim(),s.innerHTML=A.template,D.innerHTML=s.firstChild.innerHTML}A.container.appendChild(D),D[m].display="block",D[f]("class","popover bs-popover-"+q+" "+A[u])}(),B(n,D,q,A.container),!T(D,"show")&&j(D,"show"),z.call(n,"show","popover"),A[u]?F(D,$):$())}),20)},this.hide=function(){clearTimeout(L),L=setTimeout((function(){D&&null!==D&&T(D,"show")&&(z.call(n,"hide","popover"),O(D,"show"),A[u]?F(D,W):W())}),A[c])},"Popover"in n||("hover"===A.trigger?(M(n,d[0],A.show),A.dismissible||M(n,d[1],A.hide)):"click"!=A.trigger&&"focus"!=A.trigger||M(n,A.trigger,A.toggle)),n.Popover=A}};s[v](["Popover",G,"["+a+'="popover"]']);var V=function(e,t){var n=(e=N(e))[h]("data-height");t=t||{},this.height=!!x&&(t.height||"true"===n);var r,i,o,s,a,c,l,u=this,d=I(e,".nav"),v=!1,y=d&&N(".dropdown-toggle",d),w=function(){v[m].height="",O(v,"collapsing"),d.isAnimating=!1},S=function(){v?c?w():setTimeout((function(){v[m].height=l+"px",v.offsetWidth,F(v,w)}),50):d.isAnimating=!1,z.call(r,"shown","tab",i)},E=function(){v&&(o[m].float=b,s[m].float=b,a=o.scrollHeight),j(s,_),z.call(r,"show","tab",i),O(o,_),z.call(i,"hidden","tab",r),v&&(l=s.scrollHeight,c=l===a,j(v,"collapsing"),v[m].height=a+"px",v.offsetHeight,o[m].float="",s[m].float=""),T(s,"fade")?setTimeout((function(){j(s,"show"),F(s,S)}),20):S()};if(d){d.isAnimating=!1;var A=function(){var e,t=k(d,_);return 1!==t[g]||T(t[0][p],"dropdown")?t[g]>1&&(e=t[t[g]-1]):e=t[0],e},C=function(){return N(A()[h]("href"))};this.show=function(){s=N((r=r||e)[h]("href")),i=A(),o=C(),d.isAnimating=!0,O(i,_),i[f]("aria-selected","false"),j(r,_),r[f]("aria-selected","true"),y&&(T(e[p],"dropdown-menu")?T(y,_)||j(y,_):T(y,_)&&O(y,_)),z.call(i,"hide","tab",r),T(o,"fade")?(O(o,"show"),F(o,E)):E()},"Tab"in e||M(e,"click",(function(e){e.preventDefault(),r=e.currentTarget,!d.isAnimating&&!T(r,_)&&u.show()})),u.height&&(v=C()[p]),e.Tab=u}};s[v](["Tab",V,"["+a+'="tab"]']);var J=function(e,t){t=t||{};var n=(e=N(e))[h]("data-animation"),r=e[h]("data-autohide"),i=e[h]("data-delay");this.animation=!1===t.animation||"false"===n?0:1,this.autohide=!1===t.autohide||"false"===r?0:1,this[c]=parseInt(t[c]||i)||500;var o=this,s=0,a=I(e,".toast"),l=function(){O(a,"showing"),j(a,"show"),z.call(a,"shown","toast"),o.autohide&&o.hide()},u=function(){j(a,"hide"),z.call(a,"hidden","toast")},d=function(){O(a,"show"),o.animation?F(a,u):u()},f=function(){clearTimeout(s),s=null,j(a,"hide"),R(e,"click",o.hide),e.Toast=null,e=null,a=null};this.show=function(){a&&(z.call(a,"show","toast"),o.animation&&j(a,"fade"),O(a,"hide"),j(a,"showing"),o.animation?F(a,l):l())},this.hide=function(e){a&&T(a,"show")&&(z.call(a,"hide","toast"),e?d():s=setTimeout(d,o[c]))},this.dispose=function(){a&&T(a,"show")&&(O(a,"show"),o.animation?F(a,f):f())},"Toast"in e||M(e,"click",o.hide),e.Toast=o};s[v](["Toast",J,'[data-dismiss="toast"]']);var X=function(n,r){r=r||{};var o=(n=N(n))[h]("data-animation"),s=n[h]("data-placement"),a=n[h]("data-delay"),l=n[h]("data-container"),p=N(r.container),g=N(l),v=I(n,".modal"),_=I(n,".fixed-top"),w=I(n,".fixed-bottom");this[u]=r[u]&&"fade"!==r[u]?r[u]:o||"fade",this.placement=r.placement?r.placement:s||y,this[c]=parseInt(r[c]||a)||200,this.container=p||g||_||w||v||t[i];var S=this,x=0,E=this.placement,A=null,C=n[h]("title")||n[h]("data-title")||n[h]("data-original-title");if(C&&""!=C){var k=function(){M(e,"resize",S.hide,P),z.call(n,"shown","tooltip")},D=function(){R(e,"resize",S.hide,P),S.container.removeChild(A),A=null,x=null,z.call(n,"hidden","tooltip")};this.show=function(){clearTimeout(x),x=setTimeout((function(){null===A&&(E=S.placement,!1!==function(){if((C=n[h]("title")||n[h]("data-title")||n[h]("data-original-title"))&&""!==C){(A=t.createElement("div"))[f]("role","tooltip"),A[m][b]="0",A[m].top="0";var e=t.createElement("div");e[f]("class","arrow"),A.appendChild(e);var r=t.createElement("div");r[f]("class","tooltip-inner"),A.appendChild(r),r.innerHTML=C,S.container.appendChild(A),A[f]("class","tooltip bs-tooltip-"+E+" "+S[u])}}()&&(B(n,A,E,S.container),!T(A,"show")&&j(A,"show"),z.call(n,"show","tooltip"),S[u]?F(A,k):k()))}),20)},this.hide=function(){clearTimeout(x),x=setTimeout((function(){A&&T(A,"show")&&(z.call(n,"hide","tooltip"),O(A,"show"),S[u]?F(A,D):D())}),S[c])},this.toggle=function(){A?S.hide():S.show()},"Tooltip"in n||(n[f]("data-original-title",C),n.removeAttribute("title"),M(n,d[0],S.show),M(n,d[1],S.hide)),n.Tooltip=S}};s[v](["Tooltip",X,"["+a+'="tooltip"]']);var Q=function(e,t){for(var n=0,r=t[g];n<r;n++)new e(t[n])},Y=o.initCallback=function(e){e=e||t;for(var n=0,r=s[g];n<r;n++)Q(s[n][1],e.querySelectorAll(s[n][2]))};return t[i]?Y():M(t,"DOMContentLoaded",(function(){Y()})),{Alert:q,Button:H,Collapse:U,Dropdown:$,Modal:W,Popover:G,Tab:V,Toast:J,Tooltip:X}})?r.apply(t,i):r)||(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){"use strict";e.exports?e.exports=a(n(155),n(156),n(157)):(i=[n(155),n(156),n(157)],void 0===(o="function"==typeof(r=a)?r.apply(t,i):r)||(e.exports=o))}(0,(function(e,t,n,r){"use strict";var i=r&&r.URI;function o(e,t){var n=arguments.length>=1,r=arguments.length>=2;if(!(this instanceof o))return n?r?new o(e,t):new o(e):new o;if(void 0===e){if(n)throw new TypeError("undefined is not a valid argument for URI");e="undefined"!=typeof location?location.href+"":""}if(null===e&&n)throw new TypeError("null is not a valid argument for URI");return this.href(e),void 0!==t?this.absoluteTo(t):this}o.version="1.19.2";var s=o.prototype,a=Object.prototype.hasOwnProperty;function c(e){return e.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function l(e){return void 0===e?"Undefined":String(Object.prototype.toString.call(e)).slice(8,-1)}function u(e){return"Array"===l(e)}function d(e,t){var n,r,i={};if("RegExp"===l(t))i=null;else if(u(t))for(n=0,r=t.length;n<r;n++)i[t[n]]=!0;else i[t]=!0;for(n=0,r=e.length;n<r;n++){(i&&void 0!==i[e[n]]||!i&&t.test(e[n]))&&(e.splice(n,1),r--,n--)}return e}function h(e,t){var n,r;if(u(t)){for(n=0,r=t.length;n<r;n++)if(!h(e,t[n]))return!1;return!0}var i=l(t);for(n=0,r=e.length;n<r;n++)if("RegExp"===i){if("string"==typeof e[n]&&e[n].match(t))return!0}else if(e[n]===t)return!0;return!1}function f(e,t){if(!u(e)||!u(t))return!1;if(e.length!==t.length)return!1;e.sort(),t.sort();for(var n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function p(e){return e.replace(/^\/+|\/+$/g,"")}function g(e){return escape(e)}function m(e){return encodeURIComponent(e).replace(/[!'()*]/g,g).replace(/\*/g,"%2A")}o._parts=function(){return{protocol:null,username:null,password:null,hostname:null,urn:null,port:null,path:null,query:null,fragment:null,preventInvalidHostname:o.preventInvalidHostname,duplicateQueryParameters:o.duplicateQueryParameters,escapeQuerySpace:o.escapeQuerySpace}},o.preventInvalidHostname=!1,o.duplicateQueryParameters=!1,o.escapeQuerySpace=!0,o.protocol_expression=/^[a-z][a-z0-9.+-]*$/i,o.idn_expression=/[^a-z0-9\._-]/i,o.punycode_expression=/(xn--)/i,o.ip4_expression=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,o.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*$/,o.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,o.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?«»“”„‘’]+$/,parens:/(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g},o.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"},o.hostProtocols=["http","https"],o.invalid_hostname_characters=/[^a-zA-Z0-9\.\-:_]/,o.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"},o.getDomAttribute=function(e){if(e&&e.nodeName){var t=e.nodeName.toLowerCase();if("input"!==t||"image"===e.type)return o.domAttributes[t]}},o.encode=m,o.decode=decodeURIComponent,o.iso8859=function(){o.encode=escape,o.decode=unescape},o.unicode=function(){o.encode=m,o.decode=decodeURIComponent},o.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"}}}},o.encodeQuery=function(e,t){var n=o.encode(e+"");return void 0===t&&(t=o.escapeQuerySpace),t?n.replace(/%20/g,"+"):n},o.decodeQuery=function(e,t){e+="",void 0===t&&(t=o.escapeQuerySpace);try{return o.decode(t?e.replace(/\+/g,"%20"):e)}catch(t){return e}};var v,_={encode:"encode",decode:"decode"},b=function(e,t){return function(n){try{return o[t](n+"").replace(o.characters[e][t].expression,(function(n){return o.characters[e][t].map[n]}))}catch(e){return n}}};for(v in _)o[v+"PathSegment"]=b("pathname",_[v]),o[v+"UrnPathSegment"]=b("urnpath",_[v]);var y=function(e,t,n){return function(r){var i;i=n?function(e){return o[t](o[n](e))}:o[t];for(var s=(r+"").split(e),a=0,c=s.length;a<c;a++)s[a]=i(s[a]);return s.join(e)}};function w(e){return function(t,n){return void 0===t?this._parts[e]||"":(this._parts[e]=t||null,this.build(!n),this)}}function S(e,t){return function(n,r){return void 0===n?this._parts[e]||"":(null!==n&&(n+="").charAt(0)===t&&(n=n.substring(1)),this._parts[e]=n,this.build(!r),this)}}o.decodePath=y("/","decodePathSegment"),o.decodeUrnPath=y(":","decodeUrnPathSegment"),o.recodePath=y("/","encodePathSegment","decode"),o.recodeUrnPath=y(":","encodeUrnPathSegment","decode"),o.encodeReserved=b("reserved","encode"),o.parse=function(e,t){var n;return t||(t={preventInvalidHostname:o.preventInvalidHostname}),(n=e.indexOf("#"))>-1&&(t.fragment=e.substring(n+1)||null,e=e.substring(0,n)),(n=e.indexOf("?"))>-1&&(t.query=e.substring(n+1)||null,e=e.substring(0,n)),"//"===e.substring(0,2)?(t.protocol=null,e=e.substring(2),e=o.parseAuthority(e,t)):(n=e.indexOf(":"))>-1&&(t.protocol=e.substring(0,n)||null,t.protocol&&!t.protocol.match(o.protocol_expression)?t.protocol=void 0:"//"===e.substring(n+1,n+3)?(e=e.substring(n+3),e=o.parseAuthority(e,t)):(e=e.substring(n+1),t.urn=!0)),t.path=e,t},o.parseHost=function(e,t){e||(e="");var n,r,i=(e=e.replace(/\\/g,"/")).indexOf("/");if(-1===i&&(i=e.length),"["===e.charAt(0))n=e.indexOf("]"),t.hostname=e.substring(1,n)||null,t.port=e.substring(n+2,i)||null,"/"===t.port&&(t.port=null);else{var s=e.indexOf(":"),a=e.indexOf("/"),c=e.indexOf(":",s+1);-1!==c&&(-1===a||c<a)?(t.hostname=e.substring(0,i)||null,t.port=null):(r=e.substring(0,i).split(":"),t.hostname=r[0]||null,t.port=r[1]||null)}return t.hostname&&"/"!==e.substring(i).charAt(0)&&(i++,e="/"+e),t.preventInvalidHostname&&o.ensureValidHostname(t.hostname,t.protocol),t.port&&o.ensureValidPort(t.port),e.substring(i)||"/"},o.parseAuthority=function(e,t){return e=o.parseUserinfo(e,t),o.parseHost(e,t)},o.parseUserinfo=function(e,t){var n,r=e.indexOf("/"),i=e.lastIndexOf("@",r>-1?r:e.length-1);return i>-1&&(-1===r||i<r)?(n=e.substring(0,i).split(":"),t.username=n[0]?o.decode(n[0]):null,n.shift(),t.password=n[0]?o.decode(n.join(":")):null,e=e.substring(i+1)):(t.username=null,t.password=null),e},o.parseQuery=function(e,t){if(!e)return{};if(!(e=e.replace(/&+/g,"&").replace(/^\?*&*|&+$/g,"")))return{};for(var n,r,i,s={},c=e.split("&"),l=c.length,u=0;u<l;u++)n=c[u].split("="),r=o.decodeQuery(n.shift(),t),i=n.length?o.decodeQuery(n.join("="),t):null,a.call(s,r)?("string"!=typeof s[r]&&null!==s[r]||(s[r]=[s[r]]),s[r].push(i)):s[r]=i;return s},o.build=function(e){var t="",n=!1;return e.protocol&&(t+=e.protocol+":"),e.urn||!t&&!e.hostname||(t+="//",n=!0),t+=o.buildAuthority(e)||"","string"==typeof e.path&&("/"!==e.path.charAt(0)&&n&&(t+="/"),t+=e.path),"string"==typeof e.query&&e.query&&(t+="?"+e.query),"string"==typeof e.fragment&&e.fragment&&(t+="#"+e.fragment),t},o.buildHost=function(e){var t="";return e.hostname?(o.ip6_expression.test(e.hostname)?t+="["+e.hostname+"]":t+=e.hostname,e.port&&(t+=":"+e.port),t):""},o.buildAuthority=function(e){return o.buildUserinfo(e)+o.buildHost(e)},o.buildUserinfo=function(e){var t="";return e.username&&(t+=o.encode(e.username)),e.password&&(t+=":"+o.encode(e.password)),t&&(t+="@"),t},o.buildQuery=function(e,t,n){var r,i,s,c,l="";for(i in e)if(a.call(e,i))if(u(e[i]))for(r={},s=0,c=e[i].length;s<c;s++)void 0!==e[i][s]&&void 0===r[e[i][s]+""]&&(l+="&"+o.buildQueryParameter(i,e[i][s],n),!0!==t&&(r[e[i][s]+""]=!0));else void 0!==e[i]&&(l+="&"+o.buildQueryParameter(i,e[i],n));return l.substring(1)},o.buildQueryParameter=function(e,t,n){return o.encodeQuery(e,n)+(null!==t?"="+o.encodeQuery(t,n):"")},o.addQuery=function(e,t,n){if("object"==typeof t)for(var r in t)a.call(t,r)&&o.addQuery(e,r,t[r]);else{if("string"!=typeof t)throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");if(void 0===e[t])return void(e[t]=n);"string"==typeof e[t]&&(e[t]=[e[t]]),u(n)||(n=[n]),e[t]=(e[t]||[]).concat(n)}},o.setQuery=function(e,t,n){if("object"==typeof t)for(var r in t)a.call(t,r)&&o.setQuery(e,r,t[r]);else{if("string"!=typeof t)throw new TypeError("URI.setQuery() accepts an object, string as the name parameter");e[t]=void 0===n?null:n}},o.removeQuery=function(e,t,n){var r,i,s;if(u(t))for(r=0,i=t.length;r<i;r++)e[t[r]]=void 0;else if("RegExp"===l(t))for(s in e)t.test(s)&&(e[s]=void 0);else if("object"==typeof t)for(s in t)a.call(t,s)&&o.removeQuery(e,s,t[s]);else{if("string"!=typeof t)throw new TypeError("URI.removeQuery() accepts an object, string, RegExp as the first parameter");void 0!==n?"RegExp"===l(n)?!u(e[t])&&n.test(e[t])?e[t]=void 0:e[t]=d(e[t],n):e[t]!==String(n)||u(n)&&1!==n.length?u(e[t])&&(e[t]=d(e[t],n)):e[t]=void 0:e[t]=void 0}},o.hasQuery=function(e,t,n,r){switch(l(t)){case"String":break;case"RegExp":for(var i in e)if(a.call(e,i)&&t.test(i)&&(void 0===n||o.hasQuery(e,i,n)))return!0;return!1;case"Object":for(var s in t)if(a.call(t,s)&&!o.hasQuery(e,s,t[s]))return!1;return!0;default:throw new TypeError("URI.hasQuery() accepts a string, regular expression or object as the name parameter")}switch(l(n)){case"Undefined":return t in e;case"Boolean":return n===Boolean(u(e[t])?e[t].length:e[t]);case"Function":return!!n(e[t],t,e);case"Array":return!!u(e[t])&&(r?h:f)(e[t],n);case"RegExp":return u(e[t])?!!r&&h(e[t],n):Boolean(e[t]&&e[t].match(n));case"Number":n=String(n);case"String":return u(e[t])?!!r&&h(e[t],n):e[t]===n;default:throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter")}},o.joinPaths=function(){for(var e=[],t=[],n=0,r=0;r<arguments.length;r++){var i=new o(arguments[r]);e.push(i);for(var s=i.segment(),a=0;a<s.length;a++)"string"==typeof s[a]&&t.push(s[a]),s[a]&&n++}if(!t.length||!n)return new o("");var c=new o("").segment(t);return""!==e[0].path()&&"/"!==e[0].path().slice(0,1)||c.path("/"+c.path()),c.normalize()},o.commonPath=function(e,t){var n,r=Math.min(e.length,t.length);for(n=0;n<r;n++)if(e.charAt(n)!==t.charAt(n)){n--;break}return n<1?e.charAt(0)===t.charAt(0)&&"/"===e.charAt(0)?"/":"":("/"===e.charAt(n)&&"/"===t.charAt(n)||(n=e.substring(0,n).lastIndexOf("/")),e.substring(0,n+1))},o.withinString=function(e,t,n){n||(n={});var r=n.start||o.findUri.start,i=n.end||o.findUri.end,s=n.trim||o.findUri.trim,a=n.parens||o.findUri.parens,c=/[a-z0-9-]=["']?$/i;for(r.lastIndex=0;;){var l=r.exec(e);if(!l)break;var u=l.index;if(n.ignoreHtml){var d=e.slice(Math.max(u-3,0),u);if(d&&c.test(d))continue}for(var h=u+e.slice(u).search(i),f=e.slice(u,h),p=-1;;){var g=a.exec(f);if(!g)break;var m=g.index+g[0].length;p=Math.max(p,m)}if(!((f=p>-1?f.slice(0,p)+f.slice(p).replace(s,""):f.replace(s,"")).length<=l[0].length||n.ignore&&n.ignore.test(f))){var v=t(f,u,h=u+f.length,e);void 0!==v?(v=String(v),e=e.slice(0,u)+v+e.slice(h),r.lastIndex=u+v.length):r.lastIndex=h}}return r.lastIndex=0,e},o.ensureValidHostname=function(t,n){var r=!!t,i=!1;if(!!n&&(i=h(o.hostProtocols,n)),i&&!r)throw new TypeError("Hostname cannot be empty, if protocol is "+n);if(t&&t.match(o.invalid_hostname_characters)){if(!e)throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-:_] and Punycode.js is not available');if(e.toASCII(t).match(o.invalid_hostname_characters))throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-:_]')}},o.ensureValidPort=function(e){if(e){var t=Number(e);if(!(/^[0-9]+$/.test(t)&&t>0&&t<65536))throw new TypeError('Port "'+e+'" is not a valid port')}},o.noConflict=function(e){if(e){var t={URI:this.noConflict()};return r.URITemplate&&"function"==typeof r.URITemplate.noConflict&&(t.URITemplate=r.URITemplate.noConflict()),r.IPv6&&"function"==typeof r.IPv6.noConflict&&(t.IPv6=r.IPv6.noConflict()),r.SecondLevelDomains&&"function"==typeof r.SecondLevelDomains.noConflict&&(t.SecondLevelDomains=r.SecondLevelDomains.noConflict()),t}return r.URI===this&&(r.URI=i),this},s.build=function(e){return!0===e?this._deferred_build=!0:(void 0===e||this._deferred_build)&&(this._string=o.build(this._parts),this._deferred_build=!1),this},s.clone=function(){return new o(this)},s.valueOf=s.toString=function(){return this.build(!1)._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(e,t){var n=this.query(e,t);return"string"==typeof n&&n.length?"?"+n:n},s.hash=function(e,t){var n=this.fragment(e,t);return"string"==typeof n&&n.length?"#"+n:n},s.pathname=function(e,t){if(void 0===e||!0===e){var n=this._parts.path||(this._parts.hostname?"/":"");return e?(this._parts.urn?o.decodeUrnPath:o.decodePath)(n):n}return this._parts.urn?this._parts.path=e?o.recodeUrnPath(e):"":this._parts.path=e?o.recodePath(e):"/",this.build(!t),this},s.path=s.pathname,s.href=function(e,t){var n;if(void 0===e)return this.toString();this._string="",this._parts=o._parts();var r=e instanceof o,i="object"==typeof e&&(e.hostname||e.path||e.pathname);e.nodeName&&(e=e[o.getDomAttribute(e)]||"",i=!1);if(!r&&i&&void 0!==e.pathname&&(e=e.toString()),"string"==typeof e||e instanceof String)this._parts=o.parse(String(e),this._parts);else{if(!r&&!i)throw new TypeError("invalid input");var s=r?e._parts:e;for(n in s)"query"!==n&&a.call(this._parts,n)&&(this._parts[n]=s[n]);s.query&&this.query(s.query,!1)}return this.build(!t),this},s.is=function(e){var t=!1,r=!1,i=!1,s=!1,a=!1,c=!1,l=!1,u=!this._parts.urn;switch(this._parts.hostname&&(u=!1,r=o.ip4_expression.test(this._parts.hostname),i=o.ip6_expression.test(this._parts.hostname),a=(s=!(t=r||i))&&n&&n.has(this._parts.hostname),c=s&&o.idn_expression.test(this._parts.hostname),l=s&&o.punycode_expression.test(this._parts.hostname)),e.toLowerCase()){case"relative":return u;case"absolute":return!u;case"domain":case"name":return s;case"sld":return a;case"ip":return t;case"ip4":case"ipv4":case"inet4":return r;case"ip6":case"ipv6":case"inet6":return i;case"idn":return c;case"url":return!this._parts.urn;case"urn":return!!this._parts.urn;case"punycode":return l}return null};var x=s.protocol,E=s.port,A=s.hostname;s.protocol=function(e,t){if(e&&!(e=e.replace(/:(\/\/)?$/,"")).match(o.protocol_expression))throw new TypeError('Protocol "'+e+"\" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]");return x.call(this,e,t)},s.scheme=s.protocol,s.port=function(e,t){return this._parts.urn?void 0===e?"":this:(void 0!==e&&(0===e&&(e=null),e&&(":"===(e+="").charAt(0)&&(e=e.substring(1)),o.ensureValidPort(e))),E.call(this,e,t))},s.hostname=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0!==e){var n={preventInvalidHostname:this._parts.preventInvalidHostname};if("/"!==o.parseHost(e,n))throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-]');e=n.hostname,this._parts.preventInvalidHostname&&o.ensureValidHostname(e,this._parts.protocol)}return A.call(this,e,t)},s.origin=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e){var n=this.protocol();return this.authority()?(n?n+"://":"")+this.authority():""}var r=o(e);return this.protocol(r.protocol()).authority(r.authority()).build(!t),this},s.host=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e)return this._parts.hostname?o.buildHost(this._parts):"";if("/"!==o.parseHost(e,this._parts))throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-]');return this.build(!t),this},s.authority=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e)return this._parts.hostname?o.buildAuthority(this._parts):"";if("/"!==o.parseAuthority(e,this._parts))throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-]');return this.build(!t),this},s.userinfo=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e){var n=o.buildUserinfo(this._parts);return n?n.substring(0,n.length-1):n}return"@"!==e[e.length-1]&&(e+="@"),o.parseUserinfo(e,this._parts),this.build(!t),this},s.resource=function(e,t){var n;return void 0===e?this.path()+this.search()+this.hash():(n=o.parse(e),this._parts.path=n.path,this._parts.query=n.query,this._parts.fragment=n.fragment,this.build(!t),this)},s.subdomain=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var n=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,n)||""}var r=this._parts.hostname.length-this.domain().length,i=this._parts.hostname.substring(0,r),s=new RegExp("^"+c(i));if(e&&"."!==e.charAt(e.length-1)&&(e+="."),-1!==e.indexOf(":"))throw new TypeError("Domains cannot contain colons");return e&&o.ensureValidHostname(e,this._parts.protocol),this._parts.hostname=this._parts.hostname.replace(s,e),this.build(!t),this},s.domain=function(e,t){if(this._parts.urn)return void 0===e?"":this;if("boolean"==typeof e&&(t=e,e=void 0),void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var n=this._parts.hostname.match(/\./g);if(n&&n.length<2)return this._parts.hostname;var r=this._parts.hostname.length-this.tld(t).length-1;return r=this._parts.hostname.lastIndexOf(".",r-1)+1,this._parts.hostname.substring(r)||""}if(!e)throw new TypeError("cannot set domain empty");if(-1!==e.indexOf(":"))throw new TypeError("Domains cannot contain colons");if(o.ensureValidHostname(e,this._parts.protocol),!this._parts.hostname||this.is("IP"))this._parts.hostname=e;else{var i=new RegExp(c(this.domain())+"$");this._parts.hostname=this._parts.hostname.replace(i,e)}return this.build(!t),this},s.tld=function(e,t){if(this._parts.urn)return void 0===e?"":this;if("boolean"==typeof e&&(t=e,e=void 0),void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var r=this._parts.hostname.lastIndexOf("."),i=this._parts.hostname.substring(r+1);return!0!==t&&n&&n.list[i.toLowerCase()]&&n.get(this._parts.hostname)||i}var o;if(!e)throw new TypeError("cannot set TLD empty");if(e.match(/[^a-zA-Z0-9-]/)){if(!n||!n.is(e))throw new TypeError('TLD "'+e+'" contains characters other than [A-Z0-9]');o=new RegExp(c(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(o,e)}else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");o=new RegExp(c(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(o,e)}return this.build(!t),this},s.directory=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e||!0===e){if(!this._parts.path&&!this._parts.hostname)return"";if("/"===this._parts.path)return"/";var n=this._parts.path.length-this.filename().length-1,r=this._parts.path.substring(0,n)||(this._parts.hostname?"/":"");return e?o.decodePath(r):r}var i=this._parts.path.length-this.filename().length,s=this._parts.path.substring(0,i),a=new RegExp("^"+c(s));return this.is("relative")||(e||(e="/"),"/"!==e.charAt(0)&&(e="/"+e)),e&&"/"!==e.charAt(e.length-1)&&(e+="/"),e=o.recodePath(e),this._parts.path=this._parts.path.replace(a,e),this.build(!t),this},s.filename=function(e,t){if(this._parts.urn)return void 0===e?"":this;if("string"!=typeof e){if(!this._parts.path||"/"===this._parts.path)return"";var n=this._parts.path.lastIndexOf("/"),r=this._parts.path.substring(n+1);return e?o.decodePathSegment(r):r}var i=!1;"/"===e.charAt(0)&&(e=e.substring(1)),e.match(/\.?\//)&&(i=!0);var s=new RegExp(c(this.filename())+"$");return e=o.recodePath(e),this._parts.path=this._parts.path.replace(s,e),i?this.normalizePath(t):this.build(!t),this},s.suffix=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e||!0===e){if(!this._parts.path||"/"===this._parts.path)return"";var n,r,i=this.filename(),s=i.lastIndexOf(".");return-1===s?"":(n=i.substring(s+1),r=/^[a-z0-9%]+$/i.test(n)?n:"",e?o.decodePathSegment(r):r)}"."===e.charAt(0)&&(e=e.substring(1));var a,l=this.suffix();if(l)a=e?new RegExp(c(l)+"$"):new RegExp(c("."+l)+"$");else{if(!e)return this;this._parts.path+="."+o.recodePath(e)}return a&&(e=o.recodePath(e),this._parts.path=this._parts.path.replace(a,e)),this.build(!t),this},s.segment=function(e,t,n){var r=this._parts.urn?":":"/",i=this.path(),o="/"===i.substring(0,1),s=i.split(r);if(void 0!==e&&"number"!=typeof e&&(n=t,t=e,e=void 0),void 0!==e&&"number"!=typeof e)throw new Error('Bad segment "'+e+'", must be 0-based integer');if(o&&s.shift(),e<0&&(e=Math.max(s.length+e,0)),void 0===t)return void 0===e?s:s[e];if(null===e||void 0===s[e])if(u(t)){s=[];for(var a=0,c=t.length;a<c;a++)(t[a].length||s.length&&s[s.length-1].length)&&(s.length&&!s[s.length-1].length&&s.pop(),s.push(p(t[a])))}else(t||"string"==typeof t)&&(t=p(t),""===s[s.length-1]?s[s.length-1]=t:s.push(t));else t?s[e]=p(t):s.splice(e,1);return o&&s.unshift(""),this.path(s.join(r),n)},s.segmentCoded=function(e,t,n){var r,i,s;if("number"!=typeof e&&(n=t,t=e,e=void 0),void 0===t){if(u(r=this.segment(e,t,n)))for(i=0,s=r.length;i<s;i++)r[i]=o.decode(r[i]);else r=void 0!==r?o.decode(r):void 0;return r}if(u(t))for(i=0,s=t.length;i<s;i++)t[i]=o.encode(t[i]);else t="string"==typeof t||t instanceof String?o.encode(t):t;return this.segment(e,t,n)};var C=s.query;return s.query=function(e,t){if(!0===e)return o.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("function"==typeof e){var n=o.parseQuery(this._parts.query,this._parts.escapeQuerySpace),r=e.call(this,n);return this._parts.query=o.buildQuery(r||n,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!t),this}return void 0!==e&&"string"!=typeof e?(this._parts.query=o.buildQuery(e,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!t),this):C.call(this,e,t)},s.setQuery=function(e,t,n){var r=o.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("string"==typeof e||e instanceof String)r[e]=void 0!==t?t:null;else{if("object"!=typeof e)throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");for(var i in e)a.call(e,i)&&(r[i]=e[i])}return this._parts.query=o.buildQuery(r,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof e&&(n=t),this.build(!n),this},s.addQuery=function(e,t,n){var r=o.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return o.addQuery(r,e,void 0===t?null:t),this._parts.query=o.buildQuery(r,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof e&&(n=t),this.build(!n),this},s.removeQuery=function(e,t,n){var r=o.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return o.removeQuery(r,e,t),this._parts.query=o.buildQuery(r,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof e&&(n=t),this.build(!n),this},s.hasQuery=function(e,t,n){var r=o.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return o.hasQuery(r,e,t,n)},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(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build():this.normalizeProtocol(!1).normalizeHostname(!1).normalizePort(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build()},s.normalizeProtocol=function(e){return"string"==typeof this._parts.protocol&&(this._parts.protocol=this._parts.protocol.toLowerCase(),this.build(!e)),this},s.normalizeHostname=function(n){return this._parts.hostname&&(this.is("IDN")&&e?this._parts.hostname=e.toASCII(this._parts.hostname):this.is("IPv6")&&t&&(this._parts.hostname=t.best(this._parts.hostname)),this._parts.hostname=this._parts.hostname.toLowerCase(),this.build(!n)),this},s.normalizePort=function(e){return"string"==typeof this._parts.protocol&&this._parts.port===o.defaultPorts[this._parts.protocol]&&(this._parts.port=null,this.build(!e)),this},s.normalizePath=function(e){var t,n=this._parts.path;if(!n)return this;if(this._parts.urn)return this._parts.path=o.recodeUrnPath(this._parts.path),this.build(!e),this;if("/"===this._parts.path)return this;var r,i,s="";for("/"!==(n=o.recodePath(n)).charAt(0)&&(t=!0,n="/"+n),"/.."!==n.slice(-3)&&"/."!==n.slice(-2)||(n+="/"),n=n.replace(/(\/(\.\/)+)|(\/\.$)/g,"/").replace(/\/{2,}/g,"/"),t&&(s=n.substring(1).match(/^(\.\.\/)+/)||"")&&(s=s[0]);-1!==(r=n.search(/\/\.\.(\/|$)/));)0!==r?(-1===(i=n.substring(0,r).lastIndexOf("/"))&&(i=r),n=n.substring(0,i)+n.substring(r+3)):n=n.substring(3);return t&&this.is("relative")&&(n=s+n.substring(1)),this._parts.path=n,this.build(!e),this},s.normalizePathname=s.normalizePath,s.normalizeQuery=function(e){return"string"==typeof this._parts.query&&(this._parts.query.length?this.query(o.parseQuery(this._parts.query,this._parts.escapeQuerySpace)):this._parts.query=null,this.build(!e)),this},s.normalizeFragment=function(e){return this._parts.fragment||(this._parts.fragment=null,this.build(!e)),this},s.normalizeSearch=s.normalizeQuery,s.normalizeHash=s.normalizeFragment,s.iso8859=function(){var e=o.encode,t=o.decode;o.encode=escape,o.decode=decodeURIComponent;try{this.normalize()}finally{o.encode=e,o.decode=t}return this},s.unicode=function(){var e=o.encode,t=o.decode;o.encode=m,o.decode=unescape;try{this.normalize()}finally{o.encode=e,o.decode=t}return this},s.readable=function(){var t=this.clone();t.username("").password("").normalize();var n="";if(t._parts.protocol&&(n+=t._parts.protocol+"://"),t._parts.hostname&&(t.is("punycode")&&e?(n+=e.toUnicode(t._parts.hostname),t._parts.port&&(n+=":"+t._parts.port)):n+=t.host()),t._parts.hostname&&t._parts.path&&"/"!==t._parts.path.charAt(0)&&(n+="/"),n+=t.path(!0),t._parts.query){for(var r="",i=0,s=t._parts.query.split("&"),a=s.length;i<a;i++){var c=(s[i]||"").split("=");r+="&"+o.decodeQuery(c[0],this._parts.escapeQuerySpace).replace(/&/g,"%26"),void 0!==c[1]&&(r+="="+o.decodeQuery(c[1],this._parts.escapeQuerySpace).replace(/&/g,"%26"))}n+="?"+r.substring(1)}return n+=o.decodeQuery(t.hash(),!0)},s.absoluteTo=function(e){var t,n,r,i=this.clone(),s=["protocol","username","password","hostname","port"];if(this._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(e instanceof o||(e=new o(e)),i._parts.protocol)return i;if(i._parts.protocol=e._parts.protocol,this._parts.hostname)return i;for(n=0;r=s[n];n++)i._parts[r]=e._parts[r];return i._parts.path?(".."===i._parts.path.substring(-2)&&(i._parts.path+="/"),"/"!==i.path().charAt(0)&&(t=(t=e.directory())||(0===e.path().indexOf("/")?"/":""),i._parts.path=(t?t+"/":"")+i._parts.path,i.normalizePath())):(i._parts.path=e._parts.path,i._parts.query||(i._parts.query=e._parts.query)),i.build(),i},s.relativeTo=function(e){var t,n,r,i,s,a=this.clone().normalize();if(a._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(e=new o(e).normalize(),t=a._parts,n=e._parts,i=a.path(),s=e.path(),"/"!==i.charAt(0))throw new Error("URI is already relative");if("/"!==s.charAt(0))throw new Error("Cannot calculate a URI relative to another relative URI");if(t.protocol===n.protocol&&(t.protocol=null),t.username!==n.username||t.password!==n.password)return a.build();if(null!==t.protocol||null!==t.username||null!==t.password)return a.build();if(t.hostname!==n.hostname||t.port!==n.port)return a.build();if(t.hostname=null,t.port=null,i===s)return t.path="",a.build();if(!(r=o.commonPath(i,s)))return a.build();var c=n.path.substring(r.length).replace(/[^\/]*$/,"").replace(/.*?\//g,"../");return t.path=c+t.path.substring(r.length)||"./",a.build()},s.equals=function(e){var t,n,r,i,s,c=this.clone(),l=new o(e),d={};if(c.normalize(),l.normalize(),c.toString()===l.toString())return!0;if(r=c.query(),i=l.query(),c.query(""),l.query(""),c.toString()!==l.toString())return!1;if(r.length!==i.length)return!1;for(s in t=o.parseQuery(r,this._parts.escapeQuerySpace),n=o.parseQuery(i,this._parts.escapeQuerySpace),t)if(a.call(t,s)){if(u(t[s])){if(!f(t[s],n[s]))return!1}else if(t[s]!==n[s])return!1;d[s]=!0}for(s in n)if(a.call(n,s)&&!d[s])return!1;return!0},s.preventInvalidHostname=function(e){return this._parts.preventInvalidHostname=!!e,this},s.duplicateQueryParameters=function(e){return this._parts.duplicateQueryParameters=!!e,this},s.escapeQuerySpace=function(e){return this._parts.escapeQuerySpace=!!e,this},o}))},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(e,t,n,l){e=i(e)?e:a(e),n=n&&!l?s(n):0;var u=e.length;return n<0&&(n=c(u+n,0)),o(e)?n<=u&&e.indexOf(t,n)>-1:!!u&&r(e,t,n)>-1}},function(e,t){var n=/^(?:0|[1-9]\d*)$/;e.exports=function(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&n.test(e))&&e>-1&&e%1==0&&e<t}},function(e,t){e.exports=function(e){return e}},function(e,t,n){var r=n(48);e.exports=function(e){if("string"==typeof e||r(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}},function(e,t,n){var r=n(26),i=n(451),o=n(452),s=Object.defineProperty;t.f=n(32)?Object.defineProperty:function(e,t,n){if(r(e),t=o(t,!0),r(n),i)try{return s(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t){e.exports={}},function(e,t,n){(function(e,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]",O="[object Int16Array]",T="[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,F=RegExp(P.source),z=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+")",Oe="(?:"+me+"|"+we+")"+"?",Te="[\\ufe0e\\ufe0f]?"+Oe+("(?:\\u200d(?:"+[Se,xe,Ee].join("|")+")[\\ufe0e\\ufe0f]?"+Oe+")*"),ke="(?:"+[_e,xe,Ee].join("|")+")"+Te,Ne="(?:"+[Se+me+"?",me,xe,Ee,pe].join("|")+")",Ie=RegExp("[']","g"),Me=RegExp(me,"g"),Re=RegExp(we+"(?="+we+")|"+Ne+Te,"g"),De=RegExp([Ae+"?"+be+"+(?:['](?:d|ll|m|re|s|t|ve))?(?="+[ge,Ae,"$"].join("|")+")",je+"+(?:['](?:D|LL|M|RE|S|T|VE))?(?="+[ge,Ae+Ce,"$"].join("|")+")",Ae+"?"+Ce+"+(?:['](?:d|ll|m|re|s|t|ve))?",Ae+"+(?:['](?: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 ]/,Fe=["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"],ze=-1,Be={};Be[A]=Be[C]=Be[j]=Be[O]=Be[T]=Be[k]=Be["[object Uint8ClampedArray]"]=Be[N]=Be[I]=!0,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]=!1;var qe={};qe[c]=qe[l]=qe[x]=qe[E]=qe[u]=qe[d]=qe[A]=qe[C]=qe[j]=qe[O]=qe[T]=qe[g]=qe[m]=qe[v]=qe[_]=qe[b]=qe[y]=qe[w]=qe[k]=qe["[object Uint8ClampedArray]"]=qe[N]=qe[I]=!0,qe[h]=qe[f]=qe[S]=!1;var He={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ue=parseFloat,$e=parseInt,We="object"==typeof e&&e&&e.Object===Object&&e,Ge="object"==typeof self&&self&&self.Object===Object&&self,Ve=We||Ge||Function("return this")(),Je=t&&!t.nodeType&&t,Xe=Je&&"object"==typeof r&&r&&!r.nodeType&&r,Qe=Xe&&Xe.exports===Je,Ye=Qe&&We.process,Ke=function(){try{var e=Xe&&Xe.require&&Xe.require("util").types;return e||Ye&&Ye.binding&&Ye.binding("util")}catch(e){}}(),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(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function st(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i<o;){var s=e[i];t(r,s,n(s),e)}return r}function at(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function ct(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function lt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function ut(e,t){for(var n=-1,r=null==e?0:e.length,i=0,o=[];++n<r;){var s=e[n];t(s,n,e)&&(o[i++]=s)}return o}function dt(e,t){return!!(null==e?0:e.length)&&wt(e,t,0)>-1}function ht(e,t,n){for(var r=-1,i=null==e?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}function ft(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}function pt(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function gt(e,t,n,r){var i=-1,o=null==e?0:e.length;for(r&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n}function mt(e,t,n,r){var i=null==e?0:e.length;for(r&&i&&(n=e[--i]);i--;)n=t(n,e[i],i,e);return n}function vt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var _t=At("length");function bt(e,t,n){var r;return n(e,(function(e,n,i){if(t(e,n,i))return r=n,!1})),r}function yt(e,t,n,r){for(var i=e.length,o=n+(r?1:-1);r?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function wt(e,t,n){return t==t?function(e,t,n){var r=n-1,i=e.length;for(;++r<i;)if(e[r]===t)return r;return-1}(e,t,n):yt(e,xt,n)}function St(e,t,n,r){for(var i=n-1,o=e.length;++i<o;)if(r(e[i],t))return i;return-1}function xt(e){return e!=e}function Et(e,t){var n=null==e?0:e.length;return n?Ot(e,t)/n:NaN}function At(e){return function(t){return null==t?void 0:t[e]}}function Ct(e){return function(t){return null==e?void 0:e[t]}}function jt(e,t,n,r,i){return i(e,(function(e,i,o){n=r?(r=!1,e):t(n,e,i,o)})),n}function Ot(e,t){for(var n,r=-1,i=e.length;++r<i;){var o=t(e[r]);void 0!==o&&(n=void 0===n?o:n+o)}return n}function Tt(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function kt(e){return function(t){return e(t)}}function Nt(e,t){return ft(t,(function(t){return e[t]}))}function It(e,t){return e.has(t)}function Mt(e,t){for(var n=-1,r=e.length;++n<r&&wt(t,e[n],0)>-1;);return n}function Rt(e,t){for(var n=e.length;n--&&wt(t,e[n],0)>-1;);return n}function Dt(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var Pt=Ct({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),Lt=Ct({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function Ft(e){return"\\"+He[e]}function zt(e){return Pe.test(e)}function Bt(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function qt(e,t){return function(n){return e(t(n))}}function Ht(e,t){for(var n=-1,r=e.length,i=0,o=[];++n<r;){var a=e[n];a!==t&&a!==s||(e[n]=s,o[i++]=n)}return o}function Ut(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}function $t(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=[e,e]})),n}function Wt(e){return zt(e)?function(e){var t=Re.lastIndex=0;for(;Re.test(e);)++t;return t}(e):_t(e)}function Gt(e){return zt(e)?function(e){return e.match(Re)||[]}(e):function(e){return e.split("")}(e)}var Vt=Ct({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"});var Jt=function e(t){var n,r=(t=null==t?Ve:Jt.defaults(Ve.Object(),t,Jt.pick(Ve,Fe))).Array,i=t.Date,he=t.Error,fe=t.Function,pe=t.Math,ge=t.Object,me=t.RegExp,ve=t.String,_e=t.TypeError,be=r.prototype,ye=fe.prototype,we=ge.prototype,Se=t["__core-js_shared__"],xe=ye.toString,Ee=we.hasOwnProperty,Ae=0,Ce=(n=/[^.]+$/.exec(Se&&Se.keys&&Se.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",je=we.toString,Oe=xe.call(ge),Te=Ve._,ke=me("^"+xe.call(Ee).replace(G,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ne=Qe?t.Buffer:void 0,Re=t.Symbol,Pe=t.Uint8Array,He=Ne?Ne.allocUnsafe:void 0,We=qt(ge.getPrototypeOf,ge),Ge=ge.create,Je=we.propertyIsEnumerable,Xe=be.splice,Ye=Re?Re.isConcatSpreadable:void 0,Ke=Re?Re.iterator:void 0,_t=Re?Re.toStringTag:void 0,Ct=function(){try{var e=Zi(ge,"defineProperty");return e({},"",{}),e}catch(e){}}(),Xt=t.clearTimeout!==Ve.clearTimeout&&t.clearTimeout,Qt=i&&i.now!==Ve.Date.now&&i.now,Yt=t.setTimeout!==Ve.setTimeout&&t.setTimeout,Kt=pe.ceil,Zt=pe.floor,en=ge.getOwnPropertySymbols,tn=Ne?Ne.isBuffer:void 0,nn=t.isFinite,rn=be.join,on=qt(ge.keys,ge),sn=pe.max,an=pe.min,cn=i.now,ln=t.parseInt,un=pe.random,dn=be.reverse,hn=Zi(t,"DataView"),fn=Zi(t,"Map"),pn=Zi(t,"Promise"),gn=Zi(t,"Set"),mn=Zi(t,"WeakMap"),vn=Zi(ge,"create"),_n=mn&&new mn,bn={},yn=jo(hn),wn=jo(fn),Sn=jo(pn),xn=jo(gn),En=jo(mn),An=Re?Re.prototype:void 0,Cn=An?An.valueOf:void 0,jn=An?An.toString:void 0;function On(e){if($s(e)&&!Ms(e)&&!(e instanceof In)){if(e instanceof Nn)return e;if(Ee.call(e,"__wrapped__"))return Oo(e)}return new Nn(e)}var Tn=function(){function e(){}return function(t){if(!Us(t))return{};if(Ge)return Ge(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function kn(){}function Nn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function In(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Mn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Rn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Dn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Pn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Dn;++t<n;)this.add(e[t])}function Ln(e){var t=this.__data__=new Rn(e);this.size=t.size}function Fn(e,t){var n=Ms(e),r=!n&&Is(e),i=!n&&!r&&Ls(e),o=!n&&!r&&!i&&Ks(e),s=n||r||i||o,a=s?Tt(e.length,ve):[],c=a.length;for(var l in e)!t&&!Ee.call(e,l)||s&&("length"==l||i&&("offset"==l||"parent"==l)||o&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||so(l,c))||a.push(l);return a}function zn(e){var t=e.length;return t?e[Pr(0,t-1)]:void 0}function Bn(e,t){return Eo(vi(e),Xn(t,0,e.length))}function qn(e){return Eo(vi(e))}function Hn(e,t,n){(void 0!==n&&!Ts(e[t],n)||void 0===n&&!(t in e))&&Vn(e,t,n)}function Un(e,t,n){var r=e[t];Ee.call(e,t)&&Ts(r,n)&&(void 0!==n||t in e)||Vn(e,t,n)}function $n(e,t){for(var n=e.length;n--;)if(Ts(e[n][0],t))return n;return-1}function Wn(e,t,n,r){return er(e,(function(e,i,o){t(r,e,n(e),o)})),r}function Gn(e,t){return e&&_i(t,ya(t),e)}function Vn(e,t,n){"__proto__"==t&&Ct?Ct(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Jn(e,t){for(var n=-1,i=t.length,o=r(i),s=null==e;++n<i;)o[n]=s?void 0:ga(e,t[n]);return o}function Xn(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}function Qn(e,t,n,r,i,o){var s,a=1&t,l=2&t,h=4&t;if(n&&(s=i?n(e,r,i,o):n(e)),void 0!==s)return s;if(!Us(e))return e;var S=Ms(e);if(S){if(s=function(e){var t=e.length,n=new e.constructor(t);t&&"string"==typeof e[0]&&Ee.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!a)return vi(e,s)}else{var M=no(e),R=M==f||M==p;if(Ls(e))return di(e,a);if(M==v||M==c||R&&!i){if(s=l||R?{}:io(e),!a)return l?function(e,t){return _i(e,to(e),t)}(e,function(e,t){return e&&_i(t,wa(t),e)}(s,e)):function(e,t){return _i(e,eo(e),t)}(e,Gn(s,e))}else{if(!qe[M])return i?e:{};s=function(e,t,n){var r=e.constructor;switch(t){case x:return hi(e);case u:case d:return new r(+e);case E:return function(e,t){var n=t?hi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case A:case C:case j:case O:case T:case k:case"[object Uint8ClampedArray]":case N:case I:return fi(e,n);case g:return new r;case m:case y:return new r(e);case _:return function(e){var t=new e.constructor(e.source,re.exec(e));return t.lastIndex=e.lastIndex,t}(e);case b:return new r;case w:return i=e,Cn?ge(Cn.call(i)):{}}var i}(e,M,a)}}o||(o=new Ln);var D=o.get(e);if(D)return D;o.set(e,s),Xs(e)?e.forEach((function(r){s.add(Qn(r,t,n,r,e,o))})):Ws(e)&&e.forEach((function(r,i){s.set(i,Qn(r,t,n,i,e,o))}));var P=S?void 0:(h?l?Gi:Wi:l?wa:ya)(e);return at(P||e,(function(r,i){P&&(r=e[i=r]),Un(s,i,Qn(r,t,n,i,e,o))})),s}function Yn(e,t,n){var r=n.length;if(null==e)return!r;for(e=ge(e);r--;){var i=n[r],o=t[i],s=e[i];if(void 0===s&&!(i in e)||!o(s))return!1}return!0}function Kn(e,t,n){if("function"!=typeof e)throw new _e(o);return yo((function(){e.apply(void 0,n)}),t)}function Zn(e,t,n,r){var i=-1,o=dt,s=!0,a=e.length,c=[],l=t.length;if(!a)return c;n&&(t=ft(t,kt(n))),r?(o=ht,s=!1):t.length>=200&&(o=It,s=!1,t=new Pn(t));e:for(;++i<a;){var u=e[i],d=null==n?u:n(u);if(u=r||0!==u?u:0,s&&d==d){for(var h=l;h--;)if(t[h]===d)continue e;c.push(u)}else o(t,d,r)||c.push(u)}return c}On.templateSettings={escape:B,evaluate:q,interpolate:H,variable:"",imports:{_:On}},On.prototype=kn.prototype,On.prototype.constructor=On,Nn.prototype=Tn(kn.prototype),Nn.prototype.constructor=Nn,In.prototype=Tn(kn.prototype),In.prototype.constructor=In,Mn.prototype.clear=function(){this.__data__=vn?vn(null):{},this.size=0},Mn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Mn.prototype.get=function(e){var t=this.__data__;if(vn){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Ee.call(t,e)?t[e]:void 0},Mn.prototype.has=function(e){var t=this.__data__;return vn?void 0!==t[e]:Ee.call(t,e)},Mn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=vn&&void 0===t?"__lodash_hash_undefined__":t,this},Rn.prototype.clear=function(){this.__data__=[],this.size=0},Rn.prototype.delete=function(e){var t=this.__data__,n=$n(t,e);return!(n<0)&&(n==t.length-1?t.pop():Xe.call(t,n,1),--this.size,!0)},Rn.prototype.get=function(e){var t=this.__data__,n=$n(t,e);return n<0?void 0:t[n][1]},Rn.prototype.has=function(e){return $n(this.__data__,e)>-1},Rn.prototype.set=function(e,t){var n=this.__data__,r=$n(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Dn.prototype.clear=function(){this.size=0,this.__data__={hash:new Mn,map:new(fn||Rn),string:new Mn}},Dn.prototype.delete=function(e){var t=Yi(this,e).delete(e);return this.size-=t?1:0,t},Dn.prototype.get=function(e){return Yi(this,e).get(e)},Dn.prototype.has=function(e){return Yi(this,e).has(e)},Dn.prototype.set=function(e,t){var n=Yi(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Pn.prototype.add=Pn.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Pn.prototype.has=function(e){return this.__data__.has(e)},Ln.prototype.clear=function(){this.__data__=new Rn,this.size=0},Ln.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Ln.prototype.get=function(e){return this.__data__.get(e)},Ln.prototype.has=function(e){return this.__data__.has(e)},Ln.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Rn){var r=n.__data__;if(!fn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Dn(r)}return n.set(e,t),this.size=n.size,this};var er=wi(cr),tr=wi(lr,!0);function nr(e,t){var n=!0;return er(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function rr(e,t,n){for(var r=-1,i=e.length;++r<i;){var o=e[r],s=t(o);if(null!=s&&(void 0===a?s==s&&!Ys(s):n(s,a)))var a=s,c=o}return c}function ir(e,t){var n=[];return er(e,(function(e,r,i){t(e,r,i)&&n.push(e)})),n}function or(e,t,n,r,i){var o=-1,s=e.length;for(n||(n=oo),i||(i=[]);++o<s;){var a=e[o];t>0&&n(a)?t>1?or(a,t-1,n,r,i):pt(i,a):r||(i[i.length]=a)}return i}var sr=Si(),ar=Si(!0);function cr(e,t){return e&&sr(e,t,ya)}function lr(e,t){return e&&ar(e,t,ya)}function ur(e,t){return ut(t,(function(t){return Bs(e[t])}))}function dr(e,t){for(var n=0,r=(t=ai(t,e)).length;null!=e&&n<r;)e=e[Co(t[n++])];return n&&n==r?e:void 0}function hr(e,t,n){var r=t(e);return Ms(e)?r:pt(r,n(e))}function fr(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":_t&&_t in ge(e)?function(e){var t=Ee.call(e,_t),n=e[_t];try{e[_t]=void 0;var r=!0}catch(e){}var i=je.call(e);r&&(t?e[_t]=n:delete e[_t]);return i}(e):function(e){return je.call(e)}(e)}function pr(e,t){return e>t}function gr(e,t){return null!=e&&Ee.call(e,t)}function mr(e,t){return null!=e&&t in ge(e)}function vr(e,t,n){for(var i=n?ht:dt,o=e[0].length,s=e.length,a=s,c=r(s),l=1/0,u=[];a--;){var d=e[a];a&&t&&(d=ft(d,kt(t))),l=an(d.length,l),c[a]=!n&&(t||o>=120&&d.length>=120)?new Pn(a&&d):void 0}d=e[0];var h=-1,f=c[0];e:for(;++h<o&&u.length<l;){var p=d[h],g=t?t(p):p;if(p=n||0!==p?p:0,!(f?It(f,g):i(u,g,n))){for(a=s;--a;){var m=c[a];if(!(m?It(m,g):i(e[a],g,n)))continue e}f&&f.push(g),u.push(p)}}return u}function _r(e,t,n){var r=null==(e=mo(e,t=ai(t,e)))?e:e[Co(zo(t))];return null==r?void 0:ot(r,e,n)}function br(e){return $s(e)&&fr(e)==c}function yr(e,t,n,r,i){return e===t||(null==e||null==t||!$s(e)&&!$s(t)?e!=e&&t!=t:function(e,t,n,r,i,o){var s=Ms(e),a=Ms(t),f=s?l:no(e),p=a?l:no(t),S=(f=f==c?v:f)==v,A=(p=p==c?v:p)==v,C=f==p;if(C&&Ls(e)){if(!Ls(t))return!1;s=!0,S=!1}if(C&&!S)return o||(o=new Ln),s||Ks(e)?Ui(e,t,n,r,i,o):function(e,t,n,r,i,o,s){switch(n){case E:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case x:return!(e.byteLength!=t.byteLength||!o(new Pe(e),new Pe(t)));case u:case d:case m:return Ts(+e,+t);case h:return e.name==t.name&&e.message==t.message;case _:case y:return e==t+"";case g:var a=Bt;case b:var c=1&r;if(a||(a=Ut),e.size!=t.size&&!c)return!1;var l=s.get(e);if(l)return l==t;r|=2,s.set(e,t);var f=Ui(a(e),a(t),r,i,o,s);return s.delete(e),f;case w:if(Cn)return Cn.call(e)==Cn.call(t)}return!1}(e,t,f,n,r,i,o);if(!(1&n)){var j=S&&Ee.call(e,"__wrapped__"),O=A&&Ee.call(t,"__wrapped__");if(j||O){var T=j?e.value():e,k=O?t.value():t;return o||(o=new Ln),i(T,k,n,r,o)}}if(!C)return!1;return o||(o=new Ln),function(e,t,n,r,i,o){var s=1&n,a=Wi(e),c=a.length,l=Wi(t).length;if(c!=l&&!s)return!1;var u=c;for(;u--;){var d=a[u];if(!(s?d in t:Ee.call(t,d)))return!1}var h=o.get(e),f=o.get(t);if(h&&f)return h==t&&f==e;var p=!0;o.set(e,t),o.set(t,e);var g=s;for(;++u<c;){d=a[u];var m=e[d],v=t[d];if(r)var _=s?r(v,m,d,t,e,o):r(m,v,d,e,t,o);if(!(void 0===_?m===v||i(m,v,n,r,o):_)){p=!1;break}g||(g="constructor"==d)}if(p&&!g){var b=e.constructor,y=t.constructor;b==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof b&&b instanceof b&&"function"==typeof y&&y instanceof y||(p=!1)}return o.delete(e),o.delete(t),p}(e,t,n,r,i,o)}(e,t,n,r,yr,i))}function wr(e,t,n,r){var i=n.length,o=i,s=!r;if(null==e)return!o;for(e=ge(e);i--;){var a=n[i];if(s&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++i<o;){var c=(a=n[i])[0],l=e[c],u=a[1];if(s&&a[2]){if(void 0===l&&!(c in e))return!1}else{var d=new Ln;if(r)var h=r(l,u,c,e,t,d);if(!(void 0===h?yr(u,l,3,r,d):h))return!1}}return!0}function Sr(e){return!(!Us(e)||(t=e,Ce&&Ce in t))&&(Bs(e)?ke:se).test(jo(e));var t}function xr(e){return"function"==typeof e?e:null==e?Ga:"object"==typeof e?Ms(e)?Tr(e[0],e[1]):Or(e):tc(e)}function Er(e){if(!ho(e))return on(e);var t=[];for(var n in ge(e))Ee.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Ar(e){if(!Us(e))return function(e){var t=[];if(null!=e)for(var n in ge(e))t.push(n);return t}(e);var t=ho(e),n=[];for(var r in e)("constructor"!=r||!t&&Ee.call(e,r))&&n.push(r);return n}function Cr(e,t){return e<t}function jr(e,t){var n=-1,i=Ds(e)?r(e.length):[];return er(e,(function(e,r,o){i[++n]=t(e,r,o)})),i}function Or(e){var t=Ki(e);return 1==t.length&&t[0][2]?po(t[0][0],t[0][1]):function(n){return n===e||wr(n,e,t)}}function Tr(e,t){return co(e)&&fo(t)?po(Co(e),t):function(n){var r=ga(n,e);return void 0===r&&r===t?ma(n,e):yr(t,r,3)}}function kr(e,t,n,r,i){e!==t&&sr(t,(function(o,s){if(i||(i=new Ln),Us(o))!function(e,t,n,r,i,o,s){var a=_o(e,n),c=_o(t,n),l=s.get(c);if(l)return void Hn(e,n,l);var u=o?o(a,c,n+"",e,t,s):void 0,d=void 0===u;if(d){var h=Ms(c),f=!h&&Ls(c),p=!h&&!f&&Ks(c);u=c,h||f||p?Ms(a)?u=a:Ps(a)?u=vi(a):f?(d=!1,u=di(c,!0)):p?(d=!1,u=fi(c,!0)):u=[]:Vs(c)||Is(c)?(u=a,Is(a)?u=sa(a):Us(a)&&!Bs(a)||(u=io(c))):d=!1}d&&(s.set(c,u),i(u,c,r,o,s),s.delete(c));Hn(e,n,u)}(e,t,s,n,kr,r,i);else{var a=r?r(_o(e,s),o,s+"",e,t,i):void 0;void 0===a&&(a=o),Hn(e,s,a)}}),wa)}function Nr(e,t){var n=e.length;if(n)return so(t+=t<0?n:0,n)?e[t]:void 0}function Ir(e,t,n){t=t.length?ft(t,(function(e){return Ms(e)?function(t){return dr(t,1===e.length?e[0]:e)}:e})):[Ga];var r=-1;return t=ft(t,kt(Qi())),function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(jr(e,(function(e,n,i){return{criteria:ft(t,(function(t){return t(e)})),index:++r,value:e}})),(function(e,t){return function(e,t,n){var r=-1,i=e.criteria,o=t.criteria,s=i.length,a=n.length;for(;++r<s;){var c=pi(i[r],o[r]);if(c){if(r>=a)return c;var l=n[r];return c*("desc"==l?-1:1)}}return e.index-t.index}(e,t,n)}))}function Mr(e,t,n){for(var r=-1,i=t.length,o={};++r<i;){var s=t[r],a=dr(e,s);n(a,s)&&qr(o,ai(s,e),a)}return o}function Rr(e,t,n,r){var i=r?St:wt,o=-1,s=t.length,a=e;for(e===t&&(t=vi(t)),n&&(a=ft(e,kt(n)));++o<s;)for(var c=0,l=t[o],u=n?n(l):l;(c=i(a,u,c,r))>-1;)a!==e&&Xe.call(a,c,1),Xe.call(e,c,1);return e}function Dr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;so(i)?Xe.call(e,i,1):Zr(e,i)}}return e}function Pr(e,t){return e+Zt(un()*(t-e+1))}function Lr(e,t){var n="";if(!e||t<1||t>9007199254740991)return n;do{t%2&&(n+=e),(t=Zt(t/2))&&(e+=e)}while(t);return n}function Fr(e,t){return wo(go(e,t,Ga),e+"")}function zr(e){return zn(Ta(e))}function Br(e,t){var n=Ta(e);return Eo(n,Xn(t,0,n.length))}function qr(e,t,n,r){if(!Us(e))return e;for(var i=-1,o=(t=ai(t,e)).length,s=o-1,a=e;null!=a&&++i<o;){var c=Co(t[i]),l=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(i!=s){var u=a[c];void 0===(l=r?r(u,c,a):void 0)&&(l=Us(u)?u:so(t[i+1])?[]:{})}Un(a,c,l),a=a[c]}return e}var Hr=_n?function(e,t){return _n.set(e,t),e}:Ga,Ur=Ct?function(e,t){return Ct(e,"toString",{configurable:!0,enumerable:!1,value:Ua(t),writable:!0})}:Ga;function $r(e){return Eo(Ta(e))}function Wr(e,t,n){var i=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var s=r(o);++i<o;)s[i]=e[i+t];return s}function Gr(e,t){var n;return er(e,(function(e,r,i){return!(n=t(e,r,i))})),!!n}function Vr(e,t,n){var r=0,i=null==e?r:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;r<i;){var o=r+i>>>1,s=e[o];null!==s&&!Ys(s)&&(n?s<=t:s<t)?r=o+1:i=o}return i}return Jr(e,t,Ga,n)}function Jr(e,t,n,r){var i=0,o=null==e?0:e.length;if(0===o)return 0;for(var s=(t=n(t))!=t,a=null===t,c=Ys(t),l=void 0===t;i<o;){var u=Zt((i+o)/2),d=n(e[u]),h=void 0!==d,f=null===d,p=d==d,g=Ys(d);if(s)var m=r||p;else m=l?p&&(r||h):a?p&&h&&(r||!f):c?p&&h&&!f&&(r||!g):!f&&!g&&(r?d<=t:d<t);m?i=u+1:o=u}return an(o,4294967294)}function Xr(e,t){for(var n=-1,r=e.length,i=0,o=[];++n<r;){var s=e[n],a=t?t(s):s;if(!n||!Ts(a,c)){var c=a;o[i++]=0===s?0:s}}return o}function Qr(e){return"number"==typeof e?e:Ys(e)?NaN:+e}function Yr(e){if("string"==typeof e)return e;if(Ms(e))return ft(e,Yr)+"";if(Ys(e))return jn?jn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Kr(e,t,n){var r=-1,i=dt,o=e.length,s=!0,a=[],c=a;if(n)s=!1,i=ht;else if(o>=200){var l=t?null:Li(e);if(l)return Ut(l);s=!1,i=It,c=new Pn}else c=t?[]:a;e:for(;++r<o;){var u=e[r],d=t?t(u):u;if(u=n||0!==u?u:0,s&&d==d){for(var h=c.length;h--;)if(c[h]===d)continue e;t&&c.push(d),a.push(u)}else i(c,d,n)||(c!==a&&c.push(d),a.push(u))}return a}function Zr(e,t){return null==(e=mo(e,t=ai(t,e)))||delete e[Co(zo(t))]}function ei(e,t,n,r){return qr(e,t,n(dr(e,t)),r)}function ti(e,t,n,r){for(var i=e.length,o=r?i:-1;(r?o--:++o<i)&&t(e[o],o,e););return n?Wr(e,r?0:o,r?o+1:i):Wr(e,r?o+1:0,r?i:o)}function ni(e,t){var n=e;return n instanceof In&&(n=n.value()),gt(t,(function(e,t){return t.func.apply(t.thisArg,pt([e],t.args))}),n)}function ri(e,t,n){var i=e.length;if(i<2)return i?Kr(e[0]):[];for(var o=-1,s=r(i);++o<i;)for(var a=e[o],c=-1;++c<i;)c!=o&&(s[o]=Zn(s[o]||a,e[c],t,n));return Kr(or(s,1),t,n)}function ii(e,t,n){for(var r=-1,i=e.length,o=t.length,s={};++r<i;){var a=r<o?t[r]:void 0;n(s,e[r],a)}return s}function oi(e){return Ps(e)?e:[]}function si(e){return"function"==typeof e?e:Ga}function ai(e,t){return Ms(e)?e:co(e,t)?[e]:Ao(aa(e))}var ci=Fr;function li(e,t,n){var r=e.length;return n=void 0===n?r:n,!t&&n>=r?e:Wr(e,t,n)}var ui=Xt||function(e){return Ve.clearTimeout(e)};function di(e,t){if(t)return e.slice();var n=e.length,r=He?He(n):new e.constructor(n);return e.copy(r),r}function hi(e){var t=new e.constructor(e.byteLength);return new Pe(t).set(new Pe(e)),t}function fi(e,t){var n=t?hi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function pi(e,t){if(e!==t){var n=void 0!==e,r=null===e,i=e==e,o=Ys(e),s=void 0!==t,a=null===t,c=t==t,l=Ys(t);if(!a&&!l&&!o&&e>t||o&&s&&c&&!a&&!l||r&&s&&c||!n&&c||!i)return 1;if(!r&&!o&&!l&&e<t||l&&n&&i&&!r&&!o||a&&n&&i||!s&&i||!c)return-1}return 0}function gi(e,t,n,i){for(var o=-1,s=e.length,a=n.length,c=-1,l=t.length,u=sn(s-a,0),d=r(l+u),h=!i;++c<l;)d[c]=t[c];for(;++o<a;)(h||o<s)&&(d[n[o]]=e[o]);for(;u--;)d[c++]=e[o++];return d}function mi(e,t,n,i){for(var o=-1,s=e.length,a=-1,c=n.length,l=-1,u=t.length,d=sn(s-c,0),h=r(d+u),f=!i;++o<d;)h[o]=e[o];for(var p=o;++l<u;)h[p+l]=t[l];for(;++a<c;)(f||o<s)&&(h[p+n[a]]=e[o++]);return h}function vi(e,t){var n=-1,i=e.length;for(t||(t=r(i));++n<i;)t[n]=e[n];return t}function _i(e,t,n,r){var i=!n;n||(n={});for(var o=-1,s=t.length;++o<s;){var a=t[o],c=r?r(n[a],e[a],a,n,e):void 0;void 0===c&&(c=e[a]),i?Vn(n,a,c):Un(n,a,c)}return n}function bi(e,t){return function(n,r){var i=Ms(n)?st:Wn,o=t?t():{};return i(n,e,Qi(r,2),o)}}function yi(e){return Fr((function(t,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(o=e.length>3&&"function"==typeof o?(i--,o):void 0,s&&ao(n[0],n[1],s)&&(o=i<3?void 0:o,i=1),t=ge(t);++r<i;){var a=n[r];a&&e(t,a,r,o)}return t}))}function wi(e,t){return function(n,r){if(null==n)return n;if(!Ds(n))return e(n,r);for(var i=n.length,o=t?i:-1,s=ge(n);(t?o--:++o<i)&&!1!==r(s[o],o,s););return n}}function Si(e){return function(t,n,r){for(var i=-1,o=ge(t),s=r(t),a=s.length;a--;){var c=s[e?a:++i];if(!1===n(o[c],c,o))break}return t}}function xi(e){return function(t){var n=zt(t=aa(t))?Gt(t):void 0,r=n?n[0]:t.charAt(0),i=n?li(n,1).join(""):t.slice(1);return r[e]()+i}}function Ei(e){return function(t){return gt(Ba(Ia(t).replace(Ie,"")),e,"")}}function Ai(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Tn(e.prototype),r=e.apply(n,t);return Us(r)?r:n}}function Ci(e){return function(t,n,r){var i=ge(t);if(!Ds(t)){var o=Qi(n,3);t=ya(t),n=function(e){return o(i[e],e,i)}}var s=e(t,n,r);return s>-1?i[o?t[s]:s]:void 0}}function ji(e){return $i((function(t){var n=t.length,r=n,i=Nn.prototype.thru;for(e&&t.reverse();r--;){var s=t[r];if("function"!=typeof s)throw new _e(o);if(i&&!a&&"wrapper"==Ji(s))var a=new Nn([],!0)}for(r=a?r:n;++r<n;){var c=Ji(s=t[r]),l="wrapper"==c?Vi(s):void 0;a=l&&lo(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?a[Ji(l[0])].apply(a,l[3]):1==s.length&&lo(s)?a[c]():a.thru(s)}return function(){var e=arguments,r=e[0];if(a&&1==e.length&&Ms(r))return a.plant(r).value();for(var i=0,o=n?t[i].apply(this,e):r;++i<n;)o=t[i].call(this,o);return o}}))}function Oi(e,t,n,i,o,s,a,c,l,u){var d=128&t,h=1&t,f=2&t,p=24&t,g=512&t,m=f?void 0:Ai(e);return function v(){for(var _=arguments.length,b=r(_),y=_;y--;)b[y]=arguments[y];if(p)var w=Xi(v),S=Dt(b,w);if(i&&(b=gi(b,i,o,p)),s&&(b=mi(b,s,a,p)),_-=S,p&&_<u){var x=Ht(b,w);return Di(e,t,Oi,v.placeholder,n,b,x,c,l,u-_)}var E=h?n:this,A=f?E[e]:e;return _=b.length,c?b=vo(b,c):g&&_>1&&b.reverse(),d&&l<_&&(b.length=l),this&&this!==Ve&&this instanceof v&&(A=m||Ai(A)),A.apply(E,b)}}function Ti(e,t){return function(n,r){return function(e,t,n,r){return cr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function ki(e,t){return function(n,r){var i;if(void 0===n&&void 0===r)return t;if(void 0!==n&&(i=n),void 0!==r){if(void 0===i)return r;"string"==typeof n||"string"==typeof r?(n=Yr(n),r=Yr(r)):(n=Qr(n),r=Qr(r)),i=e(n,r)}return i}}function Ni(e){return $i((function(t){return t=ft(t,kt(Qi())),Fr((function(n){var r=this;return e(t,(function(e){return ot(e,r,n)}))}))}))}function Ii(e,t){var n=(t=void 0===t?" ":Yr(t)).length;if(n<2)return n?Lr(t,e):t;var r=Lr(t,Kt(e/Wt(t)));return zt(t)?li(Gt(r),0,e).join(""):r.slice(0,e)}function Mi(e){return function(t,n,i){return i&&"number"!=typeof i&&ao(t,n,i)&&(n=i=void 0),t=na(t),void 0===n?(n=t,t=0):n=na(n),function(e,t,n,i){for(var o=-1,s=sn(Kt((t-e)/(n||1)),0),a=r(s);s--;)a[i?s:++o]=e,e+=n;return a}(t,n,i=void 0===i?t<n?1:-1:na(i),e)}}function Ri(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=oa(t),n=oa(n)),e(t,n)}}function Di(e,t,n,r,i,o,s,a,c,l){var u=8&t;t|=u?32:64,4&(t&=~(u?64:32))||(t&=-4);var d=[e,t,i,u?o:void 0,u?s:void 0,u?void 0:o,u?void 0:s,a,c,l],h=n.apply(void 0,d);return lo(e)&&bo(h,d),h.placeholder=r,So(h,e,t)}function Pi(e){var t=pe[e];return function(e,n){if(e=oa(e),(n=null==n?0:an(ra(n),292))&&nn(e)){var r=(aa(e)+"e").split("e");return+((r=(aa(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var Li=gn&&1/Ut(new gn([,-0]))[1]==1/0?function(e){return new gn(e)}:Ya;function Fi(e){return function(t){var n=no(t);return n==g?Bt(t):n==b?$t(t):function(e,t){return ft(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function zi(e,t,n,i,a,c,l,u){var d=2&t;if(!d&&"function"!=typeof e)throw new _e(o);var h=i?i.length:0;if(h||(t&=-97,i=a=void 0),l=void 0===l?l:sn(ra(l),0),u=void 0===u?u:ra(u),h-=a?a.length:0,64&t){var f=i,p=a;i=a=void 0}var g=d?void 0:Vi(e),m=[e,t,n,i,a,f,p,c,l,u];if(g&&function(e,t){var n=e[1],r=t[1],i=n|r,o=i<131,a=128==r&&8==n||128==r&&256==n&&e[7].length<=t[8]||384==r&&t[7].length<=t[8]&&8==n;if(!o&&!a)return e;1&r&&(e[2]=t[2],i|=1&n?0:4);var c=t[3];if(c){var l=e[3];e[3]=l?gi(l,c,t[4]):c,e[4]=l?Ht(e[3],s):t[4]}(c=t[5])&&(l=e[5],e[5]=l?mi(l,c,t[6]):c,e[6]=l?Ht(e[5],s):t[6]);(c=t[7])&&(e[7]=c);128&r&&(e[8]=null==e[8]?t[8]:an(e[8],t[8]));null==e[9]&&(e[9]=t[9]);e[0]=t[0],e[1]=i}(m,g),e=m[0],t=m[1],n=m[2],i=m[3],a=m[4],!(u=m[9]=void 0===m[9]?d?0:e.length:sn(m[9]-h,0))&&24&t&&(t&=-25),t&&1!=t)v=8==t||16==t?function(e,t,n){var i=Ai(e);return function o(){for(var s=arguments.length,a=r(s),c=s,l=Xi(o);c--;)a[c]=arguments[c];var u=s<3&&a[0]!==l&&a[s-1]!==l?[]:Ht(a,l);if((s-=u.length)<n)return Di(e,t,Oi,o.placeholder,void 0,a,u,void 0,void 0,n-s);var d=this&&this!==Ve&&this instanceof o?i:e;return ot(d,this,a)}}(e,t,u):32!=t&&33!=t||a.length?Oi.apply(void 0,m):function(e,t,n,i){var o=1&t,s=Ai(e);return function t(){for(var a=-1,c=arguments.length,l=-1,u=i.length,d=r(u+c),h=this&&this!==Ve&&this instanceof t?s:e;++l<u;)d[l]=i[l];for(;c--;)d[l++]=arguments[++a];return ot(h,o?n:this,d)}}(e,t,n,i);else var v=function(e,t,n){var r=1&t,i=Ai(e);return function t(){var o=this&&this!==Ve&&this instanceof t?i:e;return o.apply(r?n:this,arguments)}}(e,t,n);return So((g?Hr:bo)(v,m),e,t)}function Bi(e,t,n,r){return void 0===e||Ts(e,we[n])&&!Ee.call(r,n)?t:e}function qi(e,t,n,r,i,o){return Us(e)&&Us(t)&&(o.set(t,e),kr(e,t,void 0,qi,o),o.delete(t)),e}function Hi(e){return Vs(e)?void 0:e}function Ui(e,t,n,r,i,o){var s=1&n,a=e.length,c=t.length;if(a!=c&&!(s&&c>a))return!1;var l=o.get(e),u=o.get(t);if(l&&u)return l==t&&u==e;var d=-1,h=!0,f=2&n?new Pn:void 0;for(o.set(e,t),o.set(t,e);++d<a;){var p=e[d],g=t[d];if(r)var m=s?r(g,p,d,t,e,o):r(p,g,d,e,t,o);if(void 0!==m){if(m)continue;h=!1;break}if(f){if(!vt(t,(function(e,t){if(!It(f,t)&&(p===e||i(p,e,n,r,o)))return f.push(t)}))){h=!1;break}}else if(p!==g&&!i(p,g,n,r,o)){h=!1;break}}return o.delete(e),o.delete(t),h}function $i(e){return wo(go(e,void 0,Ro),e+"")}function Wi(e){return hr(e,ya,eo)}function Gi(e){return hr(e,wa,to)}var Vi=_n?function(e){return _n.get(e)}:Ya;function Ji(e){for(var t=e.name+"",n=bn[t],r=Ee.call(bn,t)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==e)return i.name}return t}function Xi(e){return(Ee.call(On,"placeholder")?On:e).placeholder}function Qi(){var e=On.iteratee||Va;return e=e===Va?xr:e,arguments.length?e(arguments[0],arguments[1]):e}function Yi(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function Ki(e){for(var t=ya(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,fo(i)]}return t}function Zi(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Sr(n)?n:void 0}var eo=en?function(e){return null==e?[]:(e=ge(e),ut(en(e),(function(t){return Je.call(e,t)})))}:ic,to=en?function(e){for(var t=[];e;)pt(t,eo(e)),e=We(e);return t}:ic,no=fr;function ro(e,t,n){for(var r=-1,i=(t=ai(t,e)).length,o=!1;++r<i;){var s=Co(t[r]);if(!(o=null!=e&&n(e,s)))break;e=e[s]}return o||++r!=i?o:!!(i=null==e?0:e.length)&&Hs(i)&&so(s,i)&&(Ms(e)||Is(e))}function io(e){return"function"!=typeof e.constructor||ho(e)?{}:Tn(We(e))}function oo(e){return Ms(e)||Is(e)||!!(Ye&&e&&e[Ye])}function so(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&ce.test(e))&&e>-1&&e%1==0&&e<t}function ao(e,t,n){if(!Us(n))return!1;var r=typeof t;return!!("number"==r?Ds(n)&&so(t,n.length):"string"==r&&t in n)&&Ts(n[t],e)}function co(e,t){if(Ms(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Ys(e))||($.test(e)||!U.test(e)||null!=t&&e in ge(t))}function lo(e){var t=Ji(e),n=On[t];if("function"!=typeof n||!(t in In.prototype))return!1;if(e===n)return!0;var r=Vi(n);return!!r&&e===r[0]}(hn&&no(new hn(new ArrayBuffer(1)))!=E||fn&&no(new fn)!=g||pn&&"[object Promise]"!=no(pn.resolve())||gn&&no(new gn)!=b||mn&&no(new mn)!=S)&&(no=function(e){var t=fr(e),n=t==v?e.constructor:void 0,r=n?jo(n):"";if(r)switch(r){case yn:return E;case wn:return g;case Sn:return"[object Promise]";case xn:return b;case En:return S}return t});var uo=Se?Bs:oc;function ho(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||we)}function fo(e){return e==e&&!Us(e)}function po(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in ge(n)))}}function go(e,t,n){return t=sn(void 0===t?e.length-1:t,0),function(){for(var i=arguments,o=-1,s=sn(i.length-t,0),a=r(s);++o<s;)a[o]=i[t+o];o=-1;for(var c=r(t+1);++o<t;)c[o]=i[o];return c[t]=n(a),ot(e,this,c)}}function mo(e,t){return t.length<2?e:dr(e,Wr(t,0,-1))}function vo(e,t){for(var n=e.length,r=an(t.length,n),i=vi(e);r--;){var o=t[r];e[r]=so(o,n)?i[o]:void 0}return e}function _o(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var bo=xo(Hr),yo=Yt||function(e,t){return Ve.setTimeout(e,t)},wo=xo(Ur);function So(e,t,n){var r=t+"";return wo(e,function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(Y,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return at(a,(function(n){var r="_."+n[0];t&n[1]&&!dt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(K);return t?t[1].split(Z):[]}(r),n)))}function xo(e){var t=0,n=0;return function(){var r=cn(),i=16-(r-n);if(n=r,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Eo(e,t){var n=-1,r=e.length,i=r-1;for(t=void 0===t?r:t;++n<t;){var o=Pr(n,i),s=e[o];e[o]=e[n],e[n]=s}return e.length=t,e}var Ao=function(e){var t=xs(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(W,(function(e,n,r,i){t.push(r?i.replace(te,"$1"):n||e)})),t}));function Co(e){if("string"==typeof e||Ys(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function jo(e){if(null!=e){try{return xe.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Oo(e){if(e instanceof In)return e.clone();var t=new Nn(e.__wrapped__,e.__chain__);return t.__actions__=vi(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var To=Fr((function(e,t){return Ps(e)?Zn(e,or(t,1,Ps,!0)):[]})),ko=Fr((function(e,t){var n=zo(t);return Ps(n)&&(n=void 0),Ps(e)?Zn(e,or(t,1,Ps,!0),Qi(n,2)):[]})),No=Fr((function(e,t){var n=zo(t);return Ps(n)&&(n=void 0),Ps(e)?Zn(e,or(t,1,Ps,!0),void 0,n):[]}));function Io(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:ra(n);return i<0&&(i=sn(r+i,0)),yt(e,Qi(t,3),i)}function Mo(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=r-1;return void 0!==n&&(i=ra(n),i=n<0?sn(r+i,0):an(i,r-1)),yt(e,Qi(t,3),i,!0)}function Ro(e){return(null==e?0:e.length)?or(e,1):[]}function Do(e){return e&&e.length?e[0]:void 0}var Po=Fr((function(e){var t=ft(e,oi);return t.length&&t[0]===e[0]?vr(t):[]})),Lo=Fr((function(e){var t=zo(e),n=ft(e,oi);return t===zo(n)?t=void 0:n.pop(),n.length&&n[0]===e[0]?vr(n,Qi(t,2)):[]})),Fo=Fr((function(e){var t=zo(e),n=ft(e,oi);return(t="function"==typeof t?t:void 0)&&n.pop(),n.length&&n[0]===e[0]?vr(n,void 0,t):[]}));function zo(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var Bo=Fr(qo);function qo(e,t){return e&&e.length&&t&&t.length?Rr(e,t):e}var Ho=$i((function(e,t){var n=null==e?0:e.length,r=Jn(e,t);return Dr(e,ft(t,(function(e){return so(e,n)?+e:e})).sort(pi)),r}));function Uo(e){return null==e?e:dn.call(e)}var $o=Fr((function(e){return Kr(or(e,1,Ps,!0))})),Wo=Fr((function(e){var t=zo(e);return Ps(t)&&(t=void 0),Kr(or(e,1,Ps,!0),Qi(t,2))})),Go=Fr((function(e){var t=zo(e);return t="function"==typeof t?t:void 0,Kr(or(e,1,Ps,!0),void 0,t)}));function Vo(e){if(!e||!e.length)return[];var t=0;return e=ut(e,(function(e){if(Ps(e))return t=sn(e.length,t),!0})),Tt(t,(function(t){return ft(e,At(t))}))}function Jo(e,t){if(!e||!e.length)return[];var n=Vo(e);return null==t?n:ft(n,(function(e){return ot(t,void 0,e)}))}var Xo=Fr((function(e,t){return Ps(e)?Zn(e,t):[]})),Qo=Fr((function(e){return ri(ut(e,Ps))})),Yo=Fr((function(e){var t=zo(e);return Ps(t)&&(t=void 0),ri(ut(e,Ps),Qi(t,2))})),Ko=Fr((function(e){var t=zo(e);return t="function"==typeof t?t:void 0,ri(ut(e,Ps),void 0,t)})),Zo=Fr(Vo);var es=Fr((function(e){var t=e.length,n=t>1?e[t-1]:void 0;return n="function"==typeof n?(e.pop(),n):void 0,Jo(e,n)}));function ts(e){var t=On(e);return t.__chain__=!0,t}function ns(e,t){return t(e)}var rs=$i((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,i=function(t){return Jn(t,e)};return!(t>1||this.__actions__.length)&&r instanceof In&&so(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:ns,args:[i],thisArg:void 0}),new Nn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(void 0),e}))):this.thru(i)}));var is=bi((function(e,t,n){Ee.call(e,n)?++e[n]:Vn(e,n,1)}));var os=Ci(Io),ss=Ci(Mo);function as(e,t){return(Ms(e)?at:er)(e,Qi(t,3))}function cs(e,t){return(Ms(e)?ct:tr)(e,Qi(t,3))}var ls=bi((function(e,t,n){Ee.call(e,n)?e[n].push(t):Vn(e,n,[t])}));var us=Fr((function(e,t,n){var i=-1,o="function"==typeof t,s=Ds(e)?r(e.length):[];return er(e,(function(e){s[++i]=o?ot(t,e,n):_r(e,t,n)})),s})),ds=bi((function(e,t,n){Vn(e,n,t)}));function hs(e,t){return(Ms(e)?ft:jr)(e,Qi(t,3))}var fs=bi((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]}));var ps=Fr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&ao(e,t[0],t[1])?t=[]:n>2&&ao(t[0],t[1],t[2])&&(t=[t[0]]),Ir(e,or(t,1),[])})),gs=Qt||function(){return Ve.Date.now()};function ms(e,t,n){return t=n?void 0:t,zi(e,128,void 0,void 0,void 0,void 0,t=e&&null==t?e.length:t)}function vs(e,t){var n;if("function"!=typeof t)throw new _e(o);return e=ra(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}}var _s=Fr((function(e,t,n){var r=1;if(n.length){var i=Ht(n,Xi(_s));r|=32}return zi(e,r,t,n,i)})),bs=Fr((function(e,t,n){var r=3;if(n.length){var i=Ht(n,Xi(bs));r|=32}return zi(t,r,e,n,i)}));function ys(e,t,n){var r,i,s,a,c,l,u=0,d=!1,h=!1,f=!0;if("function"!=typeof e)throw new _e(o);function p(t){var n=r,o=i;return r=i=void 0,u=t,a=e.apply(o,n)}function g(e){return u=e,c=yo(v,t),d?p(e):a}function m(e){var n=e-l;return void 0===l||n>=t||n<0||h&&e-u>=s}function v(){var e=gs();if(m(e))return _(e);c=yo(v,function(e){var n=t-(e-l);return h?an(n,s-(e-u)):n}(e))}function _(e){return c=void 0,f&&r?p(e):(r=i=void 0,a)}function b(){var e=gs(),n=m(e);if(r=arguments,i=this,l=e,n){if(void 0===c)return g(l);if(h)return ui(c),c=yo(v,t),p(l)}return void 0===c&&(c=yo(v,t)),a}return t=oa(t)||0,Us(n)&&(d=!!n.leading,s=(h="maxWait"in n)?sn(oa(n.maxWait)||0,t):s,f="trailing"in n?!!n.trailing:f),b.cancel=function(){void 0!==c&&ui(c),u=0,r=l=i=c=void 0},b.flush=function(){return void 0===c?a:_(gs())},b}var ws=Fr((function(e,t){return Kn(e,1,t)})),Ss=Fr((function(e,t,n){return Kn(e,oa(t)||0,n)}));function xs(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new _e(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(xs.Cache||Dn),n}function Es(e){if("function"!=typeof e)throw new _e(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}xs.Cache=Dn;var As=ci((function(e,t){var n=(t=1==t.length&&Ms(t[0])?ft(t[0],kt(Qi())):ft(or(t,1),kt(Qi()))).length;return Fr((function(r){for(var i=-1,o=an(r.length,n);++i<o;)r[i]=t[i].call(this,r[i]);return ot(e,this,r)}))})),Cs=Fr((function(e,t){return zi(e,32,void 0,t,Ht(t,Xi(Cs)))})),js=Fr((function(e,t){return zi(e,64,void 0,t,Ht(t,Xi(js)))})),Os=$i((function(e,t){return zi(e,256,void 0,void 0,void 0,t)}));function Ts(e,t){return e===t||e!=e&&t!=t}var ks=Ri(pr),Ns=Ri((function(e,t){return e>=t})),Is=br(function(){return arguments}())?br:function(e){return $s(e)&&Ee.call(e,"callee")&&!Je.call(e,"callee")},Ms=r.isArray,Rs=Ze?kt(Ze):function(e){return $s(e)&&fr(e)==x};function Ds(e){return null!=e&&Hs(e.length)&&!Bs(e)}function Ps(e){return $s(e)&&Ds(e)}var Ls=tn||oc,Fs=et?kt(et):function(e){return $s(e)&&fr(e)==d};function zs(e){if(!$s(e))return!1;var t=fr(e);return t==h||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!Vs(e)}function Bs(e){if(!Us(e))return!1;var t=fr(e);return t==f||t==p||"[object AsyncFunction]"==t||"[object Proxy]"==t}function qs(e){return"number"==typeof e&&e==ra(e)}function Hs(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function Us(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function $s(e){return null!=e&&"object"==typeof e}var Ws=tt?kt(tt):function(e){return $s(e)&&no(e)==g};function Gs(e){return"number"==typeof e||$s(e)&&fr(e)==m}function Vs(e){if(!$s(e)||fr(e)!=v)return!1;var t=We(e);if(null===t)return!0;var n=Ee.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&xe.call(n)==Oe}var Js=nt?kt(nt):function(e){return $s(e)&&fr(e)==_};var Xs=rt?kt(rt):function(e){return $s(e)&&no(e)==b};function Qs(e){return"string"==typeof e||!Ms(e)&&$s(e)&&fr(e)==y}function Ys(e){return"symbol"==typeof e||$s(e)&&fr(e)==w}var Ks=it?kt(it):function(e){return $s(e)&&Hs(e.length)&&!!Be[fr(e)]};var Zs=Ri(Cr),ea=Ri((function(e,t){return e<=t}));function ta(e){if(!e)return[];if(Ds(e))return Qs(e)?Gt(e):vi(e);if(Ke&&e[Ke])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Ke]());var t=no(e);return(t==g?Bt:t==b?Ut:Ta)(e)}function na(e){return e?(e=oa(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ra(e){var t=na(e),n=t%1;return t==t?n?t-n:t:0}function ia(e){return e?Xn(ra(e),0,4294967295):0}function oa(e){if("number"==typeof e)return e;if(Ys(e))return NaN;if(Us(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Us(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(J,"");var n=oe.test(e);return n||ae.test(e)?$e(e.slice(2),n?2:8):ie.test(e)?NaN:+e}function sa(e){return _i(e,wa(e))}function aa(e){return null==e?"":Yr(e)}var ca=yi((function(e,t){if(ho(t)||Ds(t))_i(t,ya(t),e);else for(var n in t)Ee.call(t,n)&&Un(e,n,t[n])})),la=yi((function(e,t){_i(t,wa(t),e)})),ua=yi((function(e,t,n,r){_i(t,wa(t),e,r)})),da=yi((function(e,t,n,r){_i(t,ya(t),e,r)})),ha=$i(Jn);var fa=Fr((function(e,t){e=ge(e);var n=-1,r=t.length,i=r>2?t[2]:void 0;for(i&&ao(t[0],t[1],i)&&(r=1);++n<r;)for(var o=t[n],s=wa(o),a=-1,c=s.length;++a<c;){var l=s[a],u=e[l];(void 0===u||Ts(u,we[l])&&!Ee.call(e,l))&&(e[l]=o[l])}return e})),pa=Fr((function(e){return e.push(void 0,qi),ot(xa,void 0,e)}));function ga(e,t,n){var r=null==e?void 0:dr(e,t);return void 0===r?n:r}function ma(e,t){return null!=e&&ro(e,t,mr)}var va=Ti((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=je.call(t)),e[t]=n}),Ua(Ga)),_a=Ti((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=je.call(t)),Ee.call(e,t)?e[t].push(n):e[t]=[n]}),Qi),ba=Fr(_r);function ya(e){return Ds(e)?Fn(e):Er(e)}function wa(e){return Ds(e)?Fn(e,!0):Ar(e)}var Sa=yi((function(e,t,n){kr(e,t,n)})),xa=yi((function(e,t,n,r){kr(e,t,n,r)})),Ea=$i((function(e,t){var n={};if(null==e)return n;var r=!1;t=ft(t,(function(t){return t=ai(t,e),r||(r=t.length>1),t})),_i(e,Gi(e),n),r&&(n=Qn(n,7,Hi));for(var i=t.length;i--;)Zr(n,t[i]);return n}));var Aa=$i((function(e,t){return null==e?{}:function(e,t){return Mr(e,t,(function(t,n){return ma(e,n)}))}(e,t)}));function Ca(e,t){if(null==e)return{};var n=ft(Gi(e),(function(e){return[e]}));return t=Qi(t),Mr(e,n,(function(e,n){return t(e,n[0])}))}var ja=Fi(ya),Oa=Fi(wa);function Ta(e){return null==e?[]:Nt(e,ya(e))}var ka=Ei((function(e,t,n){return t=t.toLowerCase(),e+(n?Na(t):t)}));function Na(e){return za(aa(e).toLowerCase())}function Ia(e){return(e=aa(e))&&e.replace(le,Pt).replace(Me,"")}var Ma=Ei((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),Ra=Ei((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Da=xi("toLowerCase");var Pa=Ei((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}));var La=Ei((function(e,t,n){return e+(n?" ":"")+za(t)}));var Fa=Ei((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),za=xi("toUpperCase");function Ba(e,t,n){return e=aa(e),void 0===(t=n?void 0:t)?function(e){return Le.test(e)}(e)?function(e){return e.match(De)||[]}(e):function(e){return e.match(ee)||[]}(e):e.match(t)||[]}var qa=Fr((function(e,t){try{return ot(e,void 0,t)}catch(e){return zs(e)?e:new he(e)}})),Ha=$i((function(e,t){return at(t,(function(t){t=Co(t),Vn(e,t,_s(e[t],e))})),e}));function Ua(e){return function(){return e}}var $a=ji(),Wa=ji(!0);function Ga(e){return e}function Va(e){return xr("function"==typeof e?e:Qn(e,1))}var Ja=Fr((function(e,t){return function(n){return _r(n,e,t)}})),Xa=Fr((function(e,t){return function(n){return _r(e,n,t)}}));function Qa(e,t,n){var r=ya(t),i=ur(t,r);null!=n||Us(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=ur(t,ya(t)));var o=!(Us(n)&&"chain"in n&&!n.chain),s=Bs(e);return at(i,(function(n){var r=t[n];e[n]=r,s&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__),i=n.__actions__=vi(this.__actions__);return i.push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,pt([this.value()],arguments))})})),e}function Ya(){}var Ka=Ni(ft),Za=Ni(lt),ec=Ni(vt);function tc(e){return co(e)?At(Co(e)):function(e){return function(t){return dr(t,e)}}(e)}var nc=Mi(),rc=Mi(!0);function ic(){return[]}function oc(){return!1}var sc=ki((function(e,t){return e+t}),0),ac=Pi("ceil"),cc=ki((function(e,t){return e/t}),1),lc=Pi("floor");var uc,dc=ki((function(e,t){return e*t}),1),hc=Pi("round"),fc=ki((function(e,t){return e-t}),0);return On.after=function(e,t){if("function"!=typeof t)throw new _e(o);return e=ra(e),function(){if(--e<1)return t.apply(this,arguments)}},On.ary=ms,On.assign=ca,On.assignIn=la,On.assignInWith=ua,On.assignWith=da,On.at=ha,On.before=vs,On.bind=_s,On.bindAll=Ha,On.bindKey=bs,On.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Ms(e)?e:[e]},On.chain=ts,On.chunk=function(e,t,n){t=(n?ao(e,t,n):void 0===t)?1:sn(ra(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var o=0,s=0,a=r(Kt(i/t));o<i;)a[s++]=Wr(e,o,o+=t);return a},On.compact=function(e){for(var t=-1,n=null==e?0:e.length,r=0,i=[];++t<n;){var o=e[t];o&&(i[r++]=o)}return i},On.concat=function(){var e=arguments.length;if(!e)return[];for(var t=r(e-1),n=arguments[0],i=e;i--;)t[i-1]=arguments[i];return pt(Ms(n)?vi(n):[n],or(t,1))},On.cond=function(e){var t=null==e?0:e.length,n=Qi();return e=t?ft(e,(function(e){if("function"!=typeof e[1])throw new _e(o);return[n(e[0]),e[1]]})):[],Fr((function(n){for(var r=-1;++r<t;){var i=e[r];if(ot(i[0],this,n))return ot(i[1],this,n)}}))},On.conforms=function(e){return function(e){var t=ya(e);return function(n){return Yn(n,e,t)}}(Qn(e,1))},On.constant=Ua,On.countBy=is,On.create=function(e,t){var n=Tn(e);return null==t?n:Gn(n,t)},On.curry=function e(t,n,r){var i=zi(t,8,void 0,void 0,void 0,void 0,void 0,n=r?void 0:n);return i.placeholder=e.placeholder,i},On.curryRight=function e(t,n,r){var i=zi(t,16,void 0,void 0,void 0,void 0,void 0,n=r?void 0:n);return i.placeholder=e.placeholder,i},On.debounce=ys,On.defaults=fa,On.defaultsDeep=pa,On.defer=ws,On.delay=Ss,On.difference=To,On.differenceBy=ko,On.differenceWith=No,On.drop=function(e,t,n){var r=null==e?0:e.length;return r?Wr(e,(t=n||void 0===t?1:ra(t))<0?0:t,r):[]},On.dropRight=function(e,t,n){var r=null==e?0:e.length;return r?Wr(e,0,(t=r-(t=n||void 0===t?1:ra(t)))<0?0:t):[]},On.dropRightWhile=function(e,t){return e&&e.length?ti(e,Qi(t,3),!0,!0):[]},On.dropWhile=function(e,t){return e&&e.length?ti(e,Qi(t,3),!0):[]},On.fill=function(e,t,n,r){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&ao(e,t,n)&&(n=0,r=i),function(e,t,n,r){var i=e.length;for((n=ra(n))<0&&(n=-n>i?0:i+n),(r=void 0===r||r>i?i:ra(r))<0&&(r+=i),r=n>r?0:ia(r);n<r;)e[n++]=t;return e}(e,t,n,r)):[]},On.filter=function(e,t){return(Ms(e)?ut:ir)(e,Qi(t,3))},On.flatMap=function(e,t){return or(hs(e,t),1)},On.flatMapDeep=function(e,t){return or(hs(e,t),1/0)},On.flatMapDepth=function(e,t,n){return n=void 0===n?1:ra(n),or(hs(e,t),n)},On.flatten=Ro,On.flattenDeep=function(e){return(null==e?0:e.length)?or(e,1/0):[]},On.flattenDepth=function(e,t){return(null==e?0:e.length)?or(e,t=void 0===t?1:ra(t)):[]},On.flip=function(e){return zi(e,512)},On.flow=$a,On.flowRight=Wa,On.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var i=e[t];r[i[0]]=i[1]}return r},On.functions=function(e){return null==e?[]:ur(e,ya(e))},On.functionsIn=function(e){return null==e?[]:ur(e,wa(e))},On.groupBy=ls,On.initial=function(e){return(null==e?0:e.length)?Wr(e,0,-1):[]},On.intersection=Po,On.intersectionBy=Lo,On.intersectionWith=Fo,On.invert=va,On.invertBy=_a,On.invokeMap=us,On.iteratee=Va,On.keyBy=ds,On.keys=ya,On.keysIn=wa,On.map=hs,On.mapKeys=function(e,t){var n={};return t=Qi(t,3),cr(e,(function(e,r,i){Vn(n,t(e,r,i),e)})),n},On.mapValues=function(e,t){var n={};return t=Qi(t,3),cr(e,(function(e,r,i){Vn(n,r,t(e,r,i))})),n},On.matches=function(e){return Or(Qn(e,1))},On.matchesProperty=function(e,t){return Tr(e,Qn(t,1))},On.memoize=xs,On.merge=Sa,On.mergeWith=xa,On.method=Ja,On.methodOf=Xa,On.mixin=Qa,On.negate=Es,On.nthArg=function(e){return e=ra(e),Fr((function(t){return Nr(t,e)}))},On.omit=Ea,On.omitBy=function(e,t){return Ca(e,Es(Qi(t)))},On.once=function(e){return vs(2,e)},On.orderBy=function(e,t,n,r){return null==e?[]:(Ms(t)||(t=null==t?[]:[t]),Ms(n=r?void 0:n)||(n=null==n?[]:[n]),Ir(e,t,n))},On.over=Ka,On.overArgs=As,On.overEvery=Za,On.overSome=ec,On.partial=Cs,On.partialRight=js,On.partition=fs,On.pick=Aa,On.pickBy=Ca,On.property=tc,On.propertyOf=function(e){return function(t){return null==e?void 0:dr(e,t)}},On.pull=Bo,On.pullAll=qo,On.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Rr(e,t,Qi(n,2)):e},On.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?Rr(e,t,void 0,n):e},On.pullAt=Ho,On.range=nc,On.rangeRight=rc,On.rearg=Os,On.reject=function(e,t){return(Ms(e)?ut:ir)(e,Es(Qi(t,3)))},On.remove=function(e,t){var n=[];if(!e||!e.length)return n;var r=-1,i=[],o=e.length;for(t=Qi(t,3);++r<o;){var s=e[r];t(s,r,e)&&(n.push(s),i.push(r))}return Dr(e,i),n},On.rest=function(e,t){if("function"!=typeof e)throw new _e(o);return Fr(e,t=void 0===t?t:ra(t))},On.reverse=Uo,On.sampleSize=function(e,t,n){return t=(n?ao(e,t,n):void 0===t)?1:ra(t),(Ms(e)?Bn:Br)(e,t)},On.set=function(e,t,n){return null==e?e:qr(e,t,n)},On.setWith=function(e,t,n,r){return r="function"==typeof r?r:void 0,null==e?e:qr(e,t,n,r)},On.shuffle=function(e){return(Ms(e)?qn:$r)(e)},On.slice=function(e,t,n){var r=null==e?0:e.length;return r?(n&&"number"!=typeof n&&ao(e,t,n)?(t=0,n=r):(t=null==t?0:ra(t),n=void 0===n?r:ra(n)),Wr(e,t,n)):[]},On.sortBy=ps,On.sortedUniq=function(e){return e&&e.length?Xr(e):[]},On.sortedUniqBy=function(e,t){return e&&e.length?Xr(e,Qi(t,2)):[]},On.split=function(e,t,n){return n&&"number"!=typeof n&&ao(e,t,n)&&(t=n=void 0),(n=void 0===n?4294967295:n>>>0)?(e=aa(e))&&("string"==typeof t||null!=t&&!Js(t))&&!(t=Yr(t))&&zt(e)?li(Gt(e),0,n):e.split(t,n):[]},On.spread=function(e,t){if("function"!=typeof e)throw new _e(o);return t=null==t?0:sn(ra(t),0),Fr((function(n){var r=n[t],i=li(n,0,t);return r&&pt(i,r),ot(e,this,i)}))},On.tail=function(e){var t=null==e?0:e.length;return t?Wr(e,1,t):[]},On.take=function(e,t,n){return e&&e.length?Wr(e,0,(t=n||void 0===t?1:ra(t))<0?0:t):[]},On.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?Wr(e,(t=r-(t=n||void 0===t?1:ra(t)))<0?0:t,r):[]},On.takeRightWhile=function(e,t){return e&&e.length?ti(e,Qi(t,3),!1,!0):[]},On.takeWhile=function(e,t){return e&&e.length?ti(e,Qi(t,3)):[]},On.tap=function(e,t){return t(e),e},On.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new _e(o);return Us(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),ys(e,t,{leading:r,maxWait:t,trailing:i})},On.thru=ns,On.toArray=ta,On.toPairs=ja,On.toPairsIn=Oa,On.toPath=function(e){return Ms(e)?ft(e,Co):Ys(e)?[e]:vi(Ao(aa(e)))},On.toPlainObject=sa,On.transform=function(e,t,n){var r=Ms(e),i=r||Ls(e)||Ks(e);if(t=Qi(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Us(e)&&Bs(o)?Tn(We(e)):{}}return(i?at:cr)(e,(function(e,r,i){return t(n,e,r,i)})),n},On.unary=function(e){return ms(e,1)},On.union=$o,On.unionBy=Wo,On.unionWith=Go,On.uniq=function(e){return e&&e.length?Kr(e):[]},On.uniqBy=function(e,t){return e&&e.length?Kr(e,Qi(t,2)):[]},On.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Kr(e,void 0,t):[]},On.unset=function(e,t){return null==e||Zr(e,t)},On.unzip=Vo,On.unzipWith=Jo,On.update=function(e,t,n){return null==e?e:ei(e,t,si(n))},On.updateWith=function(e,t,n,r){return r="function"==typeof r?r:void 0,null==e?e:ei(e,t,si(n),r)},On.values=Ta,On.valuesIn=function(e){return null==e?[]:Nt(e,wa(e))},On.without=Xo,On.words=Ba,On.wrap=function(e,t){return Cs(si(t),e)},On.xor=Qo,On.xorBy=Yo,On.xorWith=Ko,On.zip=Zo,On.zipObject=function(e,t){return ii(e||[],t||[],Un)},On.zipObjectDeep=function(e,t){return ii(e||[],t||[],qr)},On.zipWith=es,On.entries=ja,On.entriesIn=Oa,On.extend=la,On.extendWith=ua,Qa(On,On),On.add=sc,On.attempt=qa,On.camelCase=ka,On.capitalize=Na,On.ceil=ac,On.clamp=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=oa(n))==n?n:0),void 0!==t&&(t=(t=oa(t))==t?t:0),Xn(oa(e),t,n)},On.clone=function(e){return Qn(e,4)},On.cloneDeep=function(e){return Qn(e,5)},On.cloneDeepWith=function(e,t){return Qn(e,5,t="function"==typeof t?t:void 0)},On.cloneWith=function(e,t){return Qn(e,4,t="function"==typeof t?t:void 0)},On.conformsTo=function(e,t){return null==t||Yn(e,t,ya(t))},On.deburr=Ia,On.defaultTo=function(e,t){return null==e||e!=e?t:e},On.divide=cc,On.endsWith=function(e,t,n){e=aa(e),t=Yr(t);var r=e.length,i=n=void 0===n?r:Xn(ra(n),0,r);return(n-=t.length)>=0&&e.slice(n,i)==t},On.eq=Ts,On.escape=function(e){return(e=aa(e))&&z.test(e)?e.replace(L,Lt):e},On.escapeRegExp=function(e){return(e=aa(e))&&V.test(e)?e.replace(G,"\\$&"):e},On.every=function(e,t,n){var r=Ms(e)?lt:nr;return n&&ao(e,t,n)&&(t=void 0),r(e,Qi(t,3))},On.find=os,On.findIndex=Io,On.findKey=function(e,t){return bt(e,Qi(t,3),cr)},On.findLast=ss,On.findLastIndex=Mo,On.findLastKey=function(e,t){return bt(e,Qi(t,3),lr)},On.floor=lc,On.forEach=as,On.forEachRight=cs,On.forIn=function(e,t){return null==e?e:sr(e,Qi(t,3),wa)},On.forInRight=function(e,t){return null==e?e:ar(e,Qi(t,3),wa)},On.forOwn=function(e,t){return e&&cr(e,Qi(t,3))},On.forOwnRight=function(e,t){return e&&lr(e,Qi(t,3))},On.get=ga,On.gt=ks,On.gte=Ns,On.has=function(e,t){return null!=e&&ro(e,t,gr)},On.hasIn=ma,On.head=Do,On.identity=Ga,On.includes=function(e,t,n,r){e=Ds(e)?e:Ta(e),n=n&&!r?ra(n):0;var i=e.length;return n<0&&(n=sn(i+n,0)),Qs(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&wt(e,t,n)>-1},On.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:ra(n);return i<0&&(i=sn(r+i,0)),wt(e,t,i)},On.inRange=function(e,t,n){return t=na(t),void 0===n?(n=t,t=0):n=na(n),function(e,t,n){return e>=an(t,n)&&e<sn(t,n)}(e=oa(e),t,n)},On.invoke=ba,On.isArguments=Is,On.isArray=Ms,On.isArrayBuffer=Rs,On.isArrayLike=Ds,On.isArrayLikeObject=Ps,On.isBoolean=function(e){return!0===e||!1===e||$s(e)&&fr(e)==u},On.isBuffer=Ls,On.isDate=Fs,On.isElement=function(e){return $s(e)&&1===e.nodeType&&!Vs(e)},On.isEmpty=function(e){if(null==e)return!0;if(Ds(e)&&(Ms(e)||"string"==typeof e||"function"==typeof e.splice||Ls(e)||Ks(e)||Is(e)))return!e.length;var t=no(e);if(t==g||t==b)return!e.size;if(ho(e))return!Er(e).length;for(var n in e)if(Ee.call(e,n))return!1;return!0},On.isEqual=function(e,t){return yr(e,t)},On.isEqualWith=function(e,t,n){var r=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===r?yr(e,t,void 0,n):!!r},On.isError=zs,On.isFinite=function(e){return"number"==typeof e&&nn(e)},On.isFunction=Bs,On.isInteger=qs,On.isLength=Hs,On.isMap=Ws,On.isMatch=function(e,t){return e===t||wr(e,t,Ki(t))},On.isMatchWith=function(e,t,n){return n="function"==typeof n?n:void 0,wr(e,t,Ki(t),n)},On.isNaN=function(e){return Gs(e)&&e!=+e},On.isNative=function(e){if(uo(e))throw new he("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Sr(e)},On.isNil=function(e){return null==e},On.isNull=function(e){return null===e},On.isNumber=Gs,On.isObject=Us,On.isObjectLike=$s,On.isPlainObject=Vs,On.isRegExp=Js,On.isSafeInteger=function(e){return qs(e)&&e>=-9007199254740991&&e<=9007199254740991},On.isSet=Xs,On.isString=Qs,On.isSymbol=Ys,On.isTypedArray=Ks,On.isUndefined=function(e){return void 0===e},On.isWeakMap=function(e){return $s(e)&&no(e)==S},On.isWeakSet=function(e){return $s(e)&&"[object WeakSet]"==fr(e)},On.join=function(e,t){return null==e?"":rn.call(e,t)},On.kebabCase=Ma,On.last=zo,On.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=r;return void 0!==n&&(i=(i=ra(n))<0?sn(r+i,0):an(i,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,i):yt(e,xt,i,!0)},On.lowerCase=Ra,On.lowerFirst=Da,On.lt=Zs,On.lte=ea,On.max=function(e){return e&&e.length?rr(e,Ga,pr):void 0},On.maxBy=function(e,t){return e&&e.length?rr(e,Qi(t,2),pr):void 0},On.mean=function(e){return Et(e,Ga)},On.meanBy=function(e,t){return Et(e,Qi(t,2))},On.min=function(e){return e&&e.length?rr(e,Ga,Cr):void 0},On.minBy=function(e,t){return e&&e.length?rr(e,Qi(t,2),Cr):void 0},On.stubArray=ic,On.stubFalse=oc,On.stubObject=function(){return{}},On.stubString=function(){return""},On.stubTrue=function(){return!0},On.multiply=dc,On.nth=function(e,t){return e&&e.length?Nr(e,ra(t)):void 0},On.noConflict=function(){return Ve._===this&&(Ve._=Te),this},On.noop=Ya,On.now=gs,On.pad=function(e,t,n){e=aa(e);var r=(t=ra(t))?Wt(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Ii(Zt(i),n)+e+Ii(Kt(i),n)},On.padEnd=function(e,t,n){e=aa(e);var r=(t=ra(t))?Wt(e):0;return t&&r<t?e+Ii(t-r,n):e},On.padStart=function(e,t,n){e=aa(e);var r=(t=ra(t))?Wt(e):0;return t&&r<t?Ii(t-r,n)+e:e},On.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),ln(aa(e).replace(X,""),t||0)},On.random=function(e,t,n){if(n&&"boolean"!=typeof n&&ao(e,t,n)&&(t=n=void 0),void 0===n&&("boolean"==typeof t?(n=t,t=void 0):"boolean"==typeof e&&(n=e,e=void 0)),void 0===e&&void 0===t?(e=0,t=1):(e=na(e),void 0===t?(t=e,e=0):t=na(t)),e>t){var r=e;e=t,t=r}if(n||e%1||t%1){var i=un();return an(e+i*(t-e+Ue("1e-"+((i+"").length-1))),t)}return Pr(e,t)},On.reduce=function(e,t,n){var r=Ms(e)?gt:jt,i=arguments.length<3;return r(e,Qi(t,4),n,i,er)},On.reduceRight=function(e,t,n){var r=Ms(e)?mt:jt,i=arguments.length<3;return r(e,Qi(t,4),n,i,tr)},On.repeat=function(e,t,n){return t=(n?ao(e,t,n):void 0===t)?1:ra(t),Lr(aa(e),t)},On.replace=function(){var e=arguments,t=aa(e[0]);return e.length<3?t:t.replace(e[1],e[2])},On.result=function(e,t,n){var r=-1,i=(t=ai(t,e)).length;for(i||(i=1,e=void 0);++r<i;){var o=null==e?void 0:e[Co(t[r])];void 0===o&&(r=i,o=n),e=Bs(o)?o.call(e):o}return e},On.round=hc,On.runInContext=e,On.sample=function(e){return(Ms(e)?zn:zr)(e)},On.size=function(e){if(null==e)return 0;if(Ds(e))return Qs(e)?Wt(e):e.length;var t=no(e);return t==g||t==b?e.size:Er(e).length},On.snakeCase=Pa,On.some=function(e,t,n){var r=Ms(e)?vt:Gr;return n&&ao(e,t,n)&&(t=void 0),r(e,Qi(t,3))},On.sortedIndex=function(e,t){return Vr(e,t)},On.sortedIndexBy=function(e,t,n){return Jr(e,t,Qi(n,2))},On.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=Vr(e,t);if(r<n&&Ts(e[r],t))return r}return-1},On.sortedLastIndex=function(e,t){return Vr(e,t,!0)},On.sortedLastIndexBy=function(e,t,n){return Jr(e,t,Qi(n,2),!0)},On.sortedLastIndexOf=function(e,t){if(null==e?0:e.length){var n=Vr(e,t,!0)-1;if(Ts(e[n],t))return n}return-1},On.startCase=La,On.startsWith=function(e,t,n){return e=aa(e),n=null==n?0:Xn(ra(n),0,e.length),t=Yr(t),e.slice(n,n+t.length)==t},On.subtract=fc,On.sum=function(e){return e&&e.length?Ot(e,Ga):0},On.sumBy=function(e,t){return e&&e.length?Ot(e,Qi(t,2)):0},On.template=function(e,t,n){var r=On.templateSettings;n&&ao(e,t,n)&&(t=void 0),e=aa(e),t=ua({},t,r,Bi);var i,o,s=ua({},t.imports,r.imports,Bi),a=ya(s),c=Nt(s,a),l=0,u=t.interpolate||ue,d="__p += '",h=me((t.escape||ue).source+"|"+u.source+"|"+(u===H?ne:ue).source+"|"+(t.evaluate||ue).source+"|$","g"),f="//# sourceURL="+(Ee.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ze+"]")+"\n";e.replace(h,(function(t,n,r,s,a,c){return r||(r=s),d+=e.slice(l,c).replace(de,Ft),n&&(i=!0,d+="' +\n__e("+n+") +\n'"),a&&(o=!0,d+="';\n"+a+";\n__p += '"),r&&(d+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=c+t.length,t})),d+="';\n";var p=Ee.call(t,"variable")&&t.variable;p||(d="with (obj) {\n"+d+"\n}\n"),d=(o?d.replace(M,""):d).replace(R,"$1").replace(D,"$1;"),d="function("+(p||"obj")+") {\n"+(p?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var g=qa((function(){return fe(a,f+"return "+d).apply(void 0,c)}));if(g.source=d,zs(g))throw g;return g},On.times=function(e,t){if((e=ra(e))<1||e>9007199254740991)return[];var n=4294967295,r=an(e,4294967295);e-=4294967295;for(var i=Tt(r,t=Qi(t));++n<e;)t(n);return i},On.toFinite=na,On.toInteger=ra,On.toLength=ia,On.toLower=function(e){return aa(e).toLowerCase()},On.toNumber=oa,On.toSafeInteger=function(e){return e?Xn(ra(e),-9007199254740991,9007199254740991):0===e?e:0},On.toString=aa,On.toUpper=function(e){return aa(e).toUpperCase()},On.trim=function(e,t,n){if((e=aa(e))&&(n||void 0===t))return e.replace(J,"");if(!e||!(t=Yr(t)))return e;var r=Gt(e),i=Gt(t);return li(r,Mt(r,i),Rt(r,i)+1).join("")},On.trimEnd=function(e,t,n){if((e=aa(e))&&(n||void 0===t))return e.replace(Q,"");if(!e||!(t=Yr(t)))return e;var r=Gt(e);return li(r,0,Rt(r,Gt(t))+1).join("")},On.trimStart=function(e,t,n){if((e=aa(e))&&(n||void 0===t))return e.replace(X,"");if(!e||!(t=Yr(t)))return e;var r=Gt(e);return li(r,Mt(r,Gt(t))).join("")},On.truncate=function(e,t){var n=30,r="...";if(Us(t)){var i="separator"in t?t.separator:i;n="length"in t?ra(t.length):n,r="omission"in t?Yr(t.omission):r}var o=(e=aa(e)).length;if(zt(e)){var s=Gt(e);o=s.length}if(n>=o)return e;var a=n-Wt(r);if(a<1)return r;var c=s?li(s,0,a).join(""):e.slice(0,a);if(void 0===i)return c+r;if(s&&(a+=c.length-a),Js(i)){if(e.slice(a).search(i)){var l,u=c;for(i.global||(i=me(i.source,aa(re.exec(i))+"g")),i.lastIndex=0;l=i.exec(u);)var d=l.index;c=c.slice(0,void 0===d?a:d)}}else if(e.indexOf(Yr(i),a)!=a){var h=c.lastIndexOf(i);h>-1&&(c=c.slice(0,h))}return c+r},On.unescape=function(e){return(e=aa(e))&&F.test(e)?e.replace(P,Vt):e},On.uniqueId=function(e){var t=++Ae;return aa(e)+t},On.upperCase=Fa,On.upperFirst=za,On.each=as,On.eachRight=cs,On.first=Do,Qa(On,(uc={},cr(On,(function(e,t){Ee.call(On.prototype,t)||(uc[t]=e)})),uc),{chain:!1}),On.VERSION="4.17.20",at(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){On[e].placeholder=On})),at(["drop","take"],(function(e,t){In.prototype[e]=function(n){n=void 0===n?1:sn(ra(n),0);var r=this.__filtered__&&!t?new In(this):this.clone();return r.__filtered__?r.__takeCount__=an(n,r.__takeCount__):r.__views__.push({size:an(n,4294967295),type:e+(r.__dir__<0?"Right":"")}),r},In.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),at(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;In.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:Qi(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),at(["head","last"],(function(e,t){var n="take"+(t?"Right":"");In.prototype[e]=function(){return this[n](1).value()[0]}})),at(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");In.prototype[e]=function(){return this.__filtered__?new In(this):this[n](1)}})),In.prototype.compact=function(){return this.filter(Ga)},In.prototype.find=function(e){return this.filter(e).head()},In.prototype.findLast=function(e){return this.reverse().find(e)},In.prototype.invokeMap=Fr((function(e,t){return"function"==typeof e?new In(this):this.map((function(n){return _r(n,e,t)}))})),In.prototype.reject=function(e){return this.filter(Es(Qi(e)))},In.prototype.slice=function(e,t){e=ra(e);var n=this;return n.__filtered__&&(e>0||t<0)?new In(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),void 0!==t&&(n=(t=ra(t))<0?n.dropRight(-t):n.take(t-e)),n)},In.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},In.prototype.toArray=function(){return this.take(4294967295)},cr(In.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),i=On[r?"take"+("last"==t?"Right":""):t],o=r||/^find/.test(t);i&&(On.prototype[t]=function(){var t=this.__wrapped__,s=r?[1]:arguments,a=t instanceof In,c=s[0],l=a||Ms(t),u=function(e){var t=i.apply(On,pt([e],s));return r&&d?t[0]:t};l&&n&&"function"==typeof c&&1!=c.length&&(a=l=!1);var d=this.__chain__,h=!!this.__actions__.length,f=o&&!d,p=a&&!h;if(!o&&l){t=p?t:new In(this);var g=e.apply(t,s);return g.__actions__.push({func:ns,args:[u],thisArg:void 0}),new Nn(g,d)}return f&&p?e.apply(this,s):(g=this.thru(u),f?r?g.value()[0]:g.value():g)})})),at(["pop","push","shift","sort","splice","unshift"],(function(e){var t=be[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);On.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Ms(i)?i:[],e)}return this[n]((function(n){return t.apply(Ms(n)?n:[],e)}))}})),cr(In.prototype,(function(e,t){var n=On[t];if(n){var r=n.name+"";Ee.call(bn,r)||(bn[r]=[]),bn[r].push({name:t,func:n})}})),bn[Oi(void 0,2).name]=[{name:"wrapper",func:void 0}],In.prototype.clone=function(){var e=new In(this.__wrapped__);return e.__actions__=vi(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=vi(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=vi(this.__views__),e},In.prototype.reverse=function(){if(this.__filtered__){var e=new In(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},In.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Ms(e),r=t<0,i=n?e.length:0,o=function(e,t,n){var r=-1,i=n.length;for(;++r<i;){var o=n[r],s=o.size;switch(o.type){case"drop":e+=s;break;case"dropRight":t-=s;break;case"take":t=an(t,e+s);break;case"takeRight":e=sn(e,t-s)}}return{start:e,end:t}}(0,i,this.__views__),s=o.start,a=o.end,c=a-s,l=r?a:s-1,u=this.__iteratees__,d=u.length,h=0,f=an(c,this.__takeCount__);if(!n||!r&&i==c&&f==c)return ni(e,this.__actions__);var p=[];e:for(;c--&&h<f;){for(var g=-1,m=e[l+=t];++g<d;){var v=u[g],_=v.iteratee,b=v.type,y=_(m);if(2==b)m=y;else if(!y){if(1==b)continue e;break e}}p[h++]=m}return p},On.prototype.at=rs,On.prototype.chain=function(){return ts(this)},On.prototype.commit=function(){return new Nn(this.value(),this.__chain__)},On.prototype.next=function(){void 0===this.__values__&&(this.__values__=ta(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?void 0:this.__values__[this.__index__++]}},On.prototype.plant=function(e){for(var t,n=this;n instanceof kn;){var r=Oo(n);r.__index__=0,r.__values__=void 0,t?i.__wrapped__=r:t=r;var i=r;n=n.__wrapped__}return i.__wrapped__=e,t},On.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof In){var t=e;return this.__actions__.length&&(t=new In(this)),(t=t.reverse()).__actions__.push({func:ns,args:[Uo],thisArg:void 0}),new Nn(t,this.__chain__)}return this.thru(Uo)},On.prototype.toJSON=On.prototype.valueOf=On.prototype.value=function(){return ni(this.__wrapped__,this.__actions__)},On.prototype.first=On.prototype.head,Ke&&(On.prototype[Ke]=function(){return this}),On}();Ve._=Jt,void 0===(i=function(){return Jt}.call(t,n,t,r))||(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(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){function r(e){this.options=e||{locator:{}}}function i(){this.cdata=!1}function o(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function s(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function a(e,t,n){return"string"==typeof e?e.substr(t,n):e.length>=t+n||t?new java.lang.String(e,t,n)+"":e}function c(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}r.prototype.parseFromString=function(e,t){var n=this.options,r=new l,o=n.domBuilder||new i,a=n.errorHandler,c=n.locator,u=n.xmlns||{},d={lt:"<",gt:">",amp:"&",quot:'"',apos:"'"};return c&&o.setDocumentLocator(c),r.errorHandler=function(e,t,n){if(!e){if(t instanceof i)return t;e=t}var r={},o=e instanceof Function;function a(t){var i=e[t];!i&&o&&(i=2==e.length?function(n){e(t,n)}:e),r[t]=i&&function(e){i("[xmldom "+t+"]\t"+e+s(n))}||function(){}}return n=n||{},a("warning"),a("error"),a("fatalError"),r}(a,o,c),r.domBuilder=n.domBuilder||o,/\/x?html?$/.test(t)&&(d.nbsp=" ",d.copy="©",u[""]="http://www.w3.org/1999/xhtml"),u.xml=u.xml||"http://www.w3.org/XML/1998/namespace",e?r.parse(e,u,d):r.errorHandler.error("invalid doc source"),o.doc},i.prototype={startDocument:function(){this.doc=(new u).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,n,r){var i=this.doc,s=i.createElementNS(e,n||t),a=r.length;c(this,s),this.currentElement=s,this.locator&&o(this.locator,s);for(var l=0;l<a;l++){e=r.getURI(l);var u=r.getValue(l),d=(n=r.getQName(l),i.createAttributeNS(e,n));this.locator&&o(r.getLocator(l),d),d.value=d.nodeValue=u,s.setAttributeNode(d)}},endElement:function(e,t,n){var r=this.currentElement;r.tagName;this.currentElement=r.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var n=this.doc.createProcessingInstruction(e,t);this.locator&&o(this.locator,n),c(this,n)},ignorableWhitespace:function(e,t,n){},characters:function(e,t,n){if(e=a.apply(this,arguments)){if(this.cdata)var r=this.doc.createCDATASection(e);else r=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(r):/^\s*$/.test(e)&&this.doc.appendChild(r),this.locator&&o(this.locator,r)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,n){e=a.apply(this,arguments);var r=this.doc.createComment(e);this.locator&&o(this.locator,r),c(this,r)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,n){var r=this.doc.implementation;if(r&&r.createDocumentType){var i=r.createDocumentType(e,t,n);this.locator&&o(this.locator,i),c(this,i)}},warning:function(e){console.warn("[xmldom warning]\t"+e,s(this.locator))},error:function(e){console.error("[xmldom error]\t"+e,s(this.locator))},fatalError:function(e){throw console.error("[xmldom fatalError]\t"+e,s(this.locator)),e}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,(function(e){i.prototype[e]=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(24),i=n(22);e.exports=function(e){return"symbol"==typeof e||i(e)&&"[object Symbol]"==r(e)}},function(e,t,n){var r=n(11).Symbol;e.exports=r},function(e,t){e.exports=function(e,t){return e===t||e!=e&&t!=t}},function(e,t,n){var r=n(74),i=n(20);e.exports=function(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=r(e.prototype),o=e.apply(n,t);return i(o)?o:n}}},function(e,t){e.exports=function(e,t){for(var n=-1,r=e.length,i=0,o=[];++n<r;){var s=e[n];s!==t&&"__lodash_placeholder__"!==s||(e[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(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[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(e,t){for(var n=e.length;n--;)if(r(e[n][0],t))return n;return-1}},function(e,t,n){var r=n(25)(Object,"create");e.exports=r},function(e,t,n){var r=n(406);e.exports=function(e,t){var n=e.__data__;return r(t)?n["string"==typeof t?"string":"hash"]:n.map}},function(e,t,n){var r=n(16),i=n(81),o=n(429),s=n(137);e.exports=function(e,t){return r(e)?e:i(e,t)?[e]:o(s(e))}},function(e,t,n){var r=n(59);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var r=n(24),i=n(20);e.exports=function(e){if(!i(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},function(e,t,n){"use strict";(function(e){var n="object"==typeof e&&e&&e.Object===Object&&e;t.a=n}).call(this,n(12))},function(e,t,n){var r={escape:n(8)};e.exports=function(e){var t="",n=r.escape;Array.prototype.join;return t+='\x3c!-- src/templates/form_input.html --\x3e\n<div class="form-group">\n ',"hidden"!==e.type&&(t+='\n <label for="'+n(e.id)+'">'+n(e.label)+"</label>\n "),t+="\n ","password"===e.type&&e.fixed_username&&(t+='\n \x3c!-- 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. --\x3e\n <input class="hidden-username" type="text" autocomplete="username" value="'+n(e.fixed_username)+'"></input>\n '),t+='\n <input \n class="form-control" name="'+n(e.name)+'" type="'+n(e.type)+'" id="'+n(e.id)+'"\n ',e.autocomplete&&(t+=' autocomplete="'+n(e.autocomplete)+'" '),t+="\n ",e.placeholder&&(t+=' placeholder="'+n(e.placeholder)+'" '),t+="\n ",e.value&&(t+=' value="'+n(e.value)+'" '),t+="\n ",e.required&&(t+=' required="required" '),t+=" />\n</div>\n"}},function(e,t,n){var r={escape:n(8)};e.exports=function(e){var t="",n=r.escape;Array.prototype.join;return t+='\x3c!-- src/templates/form_username.html --\x3e\n<div class="form-group">\n ',e.label&&(t+="\n <label>\n "+n(e.label)+"\n </label>\n "),t+='\n <div class="input-group">\n <div class="input-group-prepend">\n <input name="'+n(e.name)+'" type="'+n(e.type)+'"\n ',e.value&&(t+=' value="'+n(e.value)+'" '),t+="\n ",e.required&&(t+=' required="required" '),t+=' />\n <div class="input-group-text col" title="'+n(e.domain)+'">'+n(e.domain)+"</div>\n </div>\n </div>\n</div>\n"}},function(e,t,n){var r,i;r=[n(43)],void 0===(i=function(e){return e.noConflict()}.apply(t,r))||(e.exports=i)},function(e,t,n){
/**
* @preserve jed.js https://github.com/SlexAxton/Jed
*/
!function(n,r){var i=Array.prototype,o=Object.prototype,s=i.slice,a=o.hasOwnProperty,c=i.forEach,l={},u={forEach:function(e,t,n){var r,i,o;if(null!==e)if(c&&e.forEach===c)e.forEach(t,n);else if(e.length===+e.length){for(r=0,i=e.length;r<i;r++)if(r in e&&t.call(n,e[r],r,e)===l)return}else for(o in e)if(a.call(e,o)&&t.call(n,e[o],o,e)===l)return},extend:function(e){return this.forEach(s.call(arguments,1),(function(t){for(var n in t)e[n]=t[n]})),e}},d=function(e){if(this.defaults={locale_data:{messages:{"":{domain:"messages",lang:"en",plural_forms:"nplurals=2; plural=(n != 1);"}}},domain:"messages",debug:!1},this.options=u.extend({},this.defaults,e),this.textdomain(this.options.domain),e.domain&&!this.options.locale_data[this.options.domain])throw new Error("Text domain set to non-existent domain: `"+e.domain+"`")};function h(e){return d.PF.compile(e||"nplurals=2; plural=(n != 1);")}function f(e,t){this._key=e,this._i18n=t}d.context_delimiter=String.fromCharCode(4),u.extend(f.prototype,{onDomain:function(e){return this._domain=e,this},withContext:function(e){return this._context=e,this},ifPlural:function(e,t){return this._val=e,this._pkey=t,this},fetch:function(e){return"[object Array]"!={}.toString.call(e)&&(e=[].slice.call(arguments,0)),(e&&e.length?d.sprintf:function(e){return e})(this._i18n.dcnpgettext(this._domain,this._context,this._key,this._pkey,this._val),e)}}),u.extend(d.prototype,{translate:function(e){return new f(e,this)},textdomain:function(e){if(!e)return this._textdomain;this._textdomain=e},gettext:function(e){return this.dcnpgettext.call(this,void 0,void 0,e)},dgettext:function(e,t){return this.dcnpgettext.call(this,e,void 0,t)},dcgettext:function(e,t){return this.dcnpgettext.call(this,e,void 0,t)},ngettext:function(e,t,n){return this.dcnpgettext.call(this,void 0,void 0,e,t,n)},dngettext:function(e,t,n,r){return this.dcnpgettext.call(this,e,void 0,t,n,r)},dcngettext:function(e,t,n,r){return this.dcnpgettext.call(this,e,void 0,t,n,r)},pgettext:function(e,t){return this.dcnpgettext.call(this,void 0,e,t)},dpgettext:function(e,t,n){return this.dcnpgettext.call(this,e,t,n)},dcpgettext:function(e,t,n){return this.dcnpgettext.call(this,e,t,n)},npgettext:function(e,t,n,r){return this.dcnpgettext.call(this,void 0,e,t,n,r)},dnpgettext:function(e,t,n,r,i){return this.dcnpgettext.call(this,e,t,n,r,i)},dcnpgettext:function(e,t,n,r,i){var o;if(r=r||n,e=e||this._textdomain,!this.options)return(o=new d).dcnpgettext.call(o,void 0,void 0,n,r,i);if(!this.options.locale_data)throw new Error("No locale data provided.");if(!this.options.locale_data[e])throw new Error("Domain `"+e+"` was not found.");if(!this.options.locale_data[e][""])throw new Error("No locale meta information provided.");if(!n)throw new Error("No translation key found.");var s,a,c,l=t?t+d.context_delimiter+n:n,u=this.options.locale_data,f=u[e],p=(u.messages||this.defaults.locale_data.messages)[""],g=f[""].plural_forms||f[""]["Plural-Forms"]||f[""]["plural-forms"]||p.plural_forms||p["Plural-Forms"]||p["plural-forms"];if(void 0===i)c=0;else{if("number"!=typeof i&&(i=parseInt(i,10),isNaN(i)))throw new Error("The number that was passed in is not a number.");c=h(g)(i)}if(!f)throw new Error("No domain named `"+e+"` could be found.");return!(s=f[l])||c>s.length?(this.options.missing_key_callback&&this.options.missing_key_callback(l,e),a=[n,r],!0===this.options.debug&&console.log(a[h(g)(i)]),a[h()(i)]):(a=s[c])||(a=[n,r])[h()(i)]}});var p,g,m=function(){function e(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function t(e,t){for(var n=[];t>0;n[--t]=e);return n.join("")}var n=function(){return n.cache.hasOwnProperty(arguments[0])||(n.cache[arguments[0]]=n.parse(arguments[0])),n.format.call(null,n.cache[arguments[0]],arguments)};return n.format=function(n,r){var i,o,s,a,c,l,u,d=1,h=n.length,f="",p=[];for(o=0;o<h;o++)if("string"===(f=e(n[o])))p.push(n[o]);else if("array"===f){if((a=n[o])[2])for(i=r[d],s=0;s<a[2].length;s++){if(!i.hasOwnProperty(a[2][s]))throw m('[sprintf] property "%s" does not exist',a[2][s]);i=i[a[2][s]]}else i=a[1]?r[a[1]]:r[d++];if(/[^s]/.test(a[8])&&"number"!=e(i))throw m("[sprintf] expecting number but found %s",e(i));switch(null==i&&(i=""),a[8]){case"b":i=i.toString(2);break;case"c":i=String.fromCharCode(i);break;case"d":i=parseInt(i,10);break;case"e":i=a[7]?i.toExponential(a[7]):i.toExponential();break;case"f":i=a[7]?parseFloat(i).toFixed(a[7]):parseFloat(i);break;case"o":i=i.toString(8);break;case"s":i=(i=String(i))&&a[7]?i.substring(0,a[7]):i;break;case"u":i=Math.abs(i);break;case"x":i=i.toString(16);break;case"X":i=i.toString(16).toUpperCase()}i=/[def]/.test(a[8])&&a[3]&&i>=0?"+"+i:i,l=a[4]?"0"==a[4]?"0":a[4].charAt(1):" ",u=a[6]-String(i).length,c=a[6]?t(l,u):"",p.push(a[5]?i+c:c+i)}return p.join("")},n.cache={},n.parse=function(e){for(var t=e,n=[],r=[],i=0;t;){if(null!==(n=/^[^\x25]+/.exec(t)))r.push(n[0]);else if(null!==(n=/^\x25{2}/.exec(t)))r.push("%");else{if(null===(n=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(t)))throw"[sprintf] huh?";if(n[2]){i|=1;var o=[],s=n[2],a=[];if(null===(a=/^([a-z_][a-z_\d]*)/i.exec(s)))throw"[sprintf] huh?";for(o.push(a[1]);""!==(s=s.substring(a[0].length));)if(null!==(a=/^\.([a-z_][a-z_\d]*)/i.exec(s)))o.push(a[1]);else{if(null===(a=/^\[(\d+)\]/.exec(s)))throw"[sprintf] huh?";o.push(a[1])}n[2]=o}else i|=2;if(3===i)throw"[sprintf] mixing positional and named placeholders is not (yet) supported";r.push(n)}t=t.substring(n[0].length)}return r},n}(),v=function(e,t){return t.unshift(e),m.apply(null,t)};d.parse_plural=function(e,t){return e=e.replace(/n/g,t),d.parse_expression(e)},d.sprintf=function(e,t){return"[object Array]"=={}.toString.call(t)?v(e,[].slice.call(t)):m.apply(this,[].slice.call(arguments))},d.prototype.sprintf=function(){return d.sprintf.apply(this,arguments)},(d.PF={}).parse=function(e){var t=d.PF.extractPluralExpr(e);return d.PF.parser.parse.call(d.PF.parser,t)},d.PF.compile=function(e){var t=d.PF.parse(e);return function(e){return!0===(n=d.PF.interpreter(t)(e))?1:n||0;var n}},d.PF.interpreter=function(e){return function(t){switch(e.type){case"GROUP":return d.PF.interpreter(e.expr)(t);case"TERNARY":return d.PF.interpreter(e.expr)(t)?d.PF.interpreter(e.truthy)(t):d.PF.interpreter(e.falsey)(t);case"OR":return d.PF.interpreter(e.left)(t)||d.PF.interpreter(e.right)(t);case"AND":return d.PF.interpreter(e.left)(t)&&d.PF.interpreter(e.right)(t);case"LT":return d.PF.interpreter(e.left)(t)<d.PF.interpreter(e.right)(t);case"GT":return d.PF.interpreter(e.left)(t)>d.PF.interpreter(e.right)(t);case"LTE":return d.PF.interpreter(e.left)(t)<=d.PF.interpreter(e.right)(t);case"GTE":return d.PF.interpreter(e.left)(t)>=d.PF.interpreter(e.right)(t);case"EQ":return d.PF.interpreter(e.left)(t)==d.PF.interpreter(e.right)(t);case"NEQ":return d.PF.interpreter(e.left)(t)!=d.PF.interpreter(e.right)(t);case"MOD":return d.PF.interpreter(e.left)(t)%d.PF.interpreter(e.right)(t);case"VAR":return t;case"NUM":return e.val;default:throw new Error("Invalid Token found.")}}},d.PF.extractPluralExpr=function(e){e=e.replace(/^\s\s*/,"").replace(/\s\s*$/,""),/;\s*$/.test(e)||(e=e.concat(";"));var t,n=/nplurals\=(\d+);/,r=e.match(n);if(!(r.length>1))throw new Error("nplurals not found in plural_forms string: "+e);if(r[1],!((t=(e=e.replace(n,"")).match(/plural\=(.*);/))&&t.length>1))throw new Error("`plural` expression not found: "+e);return t[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(e,t,n,r,i,o,s){var a=o.length-1;switch(i){case 1:return{type:"GROUP",expr:o[a-1]};case 2:this.$={type:"TERNARY",expr:o[a-4],truthy:o[a-2],falsey:o[a]};break;case 3:this.$={type:"OR",left:o[a-2],right:o[a]};break;case 4:this.$={type:"AND",left:o[a-2],right:o[a]};break;case 5:this.$={type:"LT",left:o[a-2],right:o[a]};break;case 6:this.$={type:"LTE",left:o[a-2],right:o[a]};break;case 7:this.$={type:"GT",left:o[a-2],right:o[a]};break;case 8:this.$={type:"GTE",left:o[a-2],right:o[a]};break;case 9:this.$={type:"NEQ",left:o[a-2],right:o[a]};break;case 10:this.$={type:"EQ",left:o[a-2],right:o[a]};break;case 11:this.$={type:"MOD",left:o[a-2],right:o[a]};break;case 12:this.$={type:"GROUP",expr:o[a-1]};break;case 13:this.$={type:"VAR"};break;case 14:this.$={type:"NUM",val:Number(e)}}},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(e,t){throw new Error(e)},parse:function(e){var t=this,n=[0],r=[null],i=[],o=this.table,s="",a=0,c=0,l=0;this.lexer.setInput(e),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,void 0===this.lexer.yylloc&&(this.lexer.yylloc={});var u=this.lexer.yylloc;function d(){var e;return"number"!=typeof(e=t.lexer.lex()||1)&&(e=t.symbols_[e]||e),e}i.push(u),"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var h,f,p,g,m,v,_,b,y,w,S={};;){if(p=n[n.length-1],this.defaultActions[p]?g=this.defaultActions[p]:(null==h&&(h=d()),g=o[p]&&o[p][h]),void 0===g||!g.length||!g[0]){if(!l){for(v in y=[],o[p])this.terminals_[v]&&v>2&&y.push("'"+this.terminals_[v]+"'");var x="";x=this.lexer.showPosition?"Parse error on line "+(a+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+y.join(", ")+", got '"+this.terminals_[h]+"'":"Parse error on line "+(a+1)+": Unexpected "+(1==h?"end of input":"'"+(this.terminals_[h]||h)+"'"),this.parseError(x,{text:this.lexer.match,token:this.terminals_[h]||h,line:this.lexer.yylineno,loc:u,expected:y})}if(3==l){if(1==h)throw new Error(x||"Parsing halted.");c=this.lexer.yyleng,s=this.lexer.yytext,a=this.lexer.yylineno,u=this.lexer.yylloc,h=d()}for(;!(2..toString()in o[p]);){if(0==p)throw new Error(x||"Parsing halted.");w=1,n.length=n.length-2*w,r.length=r.length-w,i.length=i.length-w,p=n[n.length-1]}f=h,h=2,g=o[p=n[n.length-1]]&&o[p][2],l=3}if(g[0]instanceof Array&&g.length>1)throw new Error("Parse Error: multiple actions possible at state: "+p+", token: "+h);switch(g[0]){case 1:n.push(h),r.push(this.lexer.yytext),i.push(this.lexer.yylloc),n.push(g[1]),h=null,f?(h=f,f=null):(c=this.lexer.yyleng,s=this.lexer.yytext,a=this.lexer.yylineno,u=this.lexer.yylloc,l>0&&l--);break;case 2:if(_=this.productions_[g[1]][1],S.$=r[r.length-_],S._$={first_line:i[i.length-(_||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(_||1)].first_column,last_column:i[i.length-1].last_column},void 0!==(m=this.performAction.call(S,s,c,a,this.yy,g[1],r,i)))return m;_&&(n=n.slice(0,-1*_*2),r=r.slice(0,-1*_),i=i.slice(0,-1*_)),n.push(this.productions_[g[1]][0]),r.push(S.$),i.push(S._$),b=o[n[n.length-2]][n[n.length-1]],n.push(b);break;case 3:return!0}}return!0}},g=function(){var e={EOF:1,parseError:function(e,t){if(!this.yy.parseError)throw new Error(e);this.yy.parseError(e,t)},setInput:function(e){return this._input=e,this._more=this._less=this.done=!1,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 e=this._input[0];return this.yytext+=e,this.yyleng++,this.match+=e,this.matched+=e,e.match(/\n/)&&this.yylineno++,this._input=this._input.slice(1),e},unput:function(e){return this._input=e+this._input,this},more:function(){return this._more=!0,this},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=new Array(e.length+1).join("-");return e+this.upcomingInput()+"\n"+t+"^"},next:function(){if(this.done)return this.EOF;var e,t;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var n=this._currentRules(),r=0;r<n.length;r++)if(e=this._input.match(this.rules[n[r]]))return(t=e[0].match(/\n.*/g))&&(this.yylineno+=t.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:t?t[t.length-1].length-1:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this._more=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],this.performAction.call(this,this.yy,this,n[r],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 e=this.next();return void 0!==e?e:this.lex()},begin:function(e){this.conditionStack.push(e)},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(e){this.begin(e)},performAction:function(e,t,n,r){switch(n){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:!0}}};return e}(),p.lexer=g,p),e.exports&&(t=e.exports=d),t.Jed=d}()},function(e,t,n){"use strict";var r=n(15),i=n(0);i.e.Websocket=class{constructor(e){this._conn=e,this.strip="wrapper";const t=e.service;if(0!==t.indexOf("ws:")&&0!==t.indexOf("wss:")){let n="";"ws"===e.options.protocol&&"https:"!==window.location.protocol?n+="ws":n+="wss",n+="://"+window.location.host,0!==t.indexOf("/")?n+=window.location.pathname+t:n+=t,e.service=n}}_buildStream(){return Object(i.a)("open",{xmlns:i.e.NS.FRAMING,to:this._conn.domain,version:"1.0"})}_checkStreamError(e,t){let n;if(n=e.getElementsByTagNameNS?e.getElementsByTagNameNS(i.e.NS.STREAM,"error"):e.getElementsByTagName("stream:error"),0===n.length)return!1;const r=n[0];let o="",s="";for(let e=0;e<r.childNodes.length;e++){const t=r.childNodes[e];if("urn:ietf:params:xml:ns:xmpp-streams"!==t.getAttribute("xmlns"))break;"text"===t.nodeName?s=t.textContent:o=t.nodeName}let a="WebSocket stream error: ";return a+=o||"unknown",s&&(a+=" - "+s),i.e.error(a),this._conn._changeConnectStatus(t,o),this._conn._doDisconnect(),!0}_reset(){}_connect(){this._closeSocket(),this.socket=new WebSocket(this._conn.service,"xmpp"),this.socket.onopen=()=>this._onOpen(),this.socket.onerror=e=>this._onError(e),this.socket.onclose=e=>this._onClose(e),this.socket.onmessage=e=>this._onInitialMessage(e)}_connect_cb(e){if(this._checkStreamError(e,i.e.Status.CONNFAIL))return i.e.Status.CONNFAIL}_handleStreamStart(e){let t=!1;const n=e.getAttribute("xmlns");"string"!=typeof n?t="Missing xmlns in <open />":n!==i.e.NS.FRAMING&&(t="Wrong xmlns in <open />: "+n);const r=e.getAttribute("version");return"string"!=typeof r?t="Missing version in <open />":"1.0"!==r&&(t="Wrong version in <open />: "+r),!t||(this._conn._changeConnectStatus(i.e.Status.CONNFAIL,t),this._conn._doDisconnect(),!1)}_onInitialMessage(e){if(0===e.data.indexOf("<open ")||0===e.data.indexOf("<?xml")){const t=e.data.replace(/^(<\?.*?\?>\s*)*/,"");if(""===t)return;const n=(new r.a).parseFromString(t,"text/xml").documentElement;this._conn.xmlInput(n),this._conn.rawInput(e.data),this._handleStreamStart(n)&&this._connect_cb(n)}else if(0===e.data.indexOf("<close ")){const t=(new r.a).parseFromString(e.data,"text/xml").documentElement;this._conn.xmlInput(t),this._conn.rawInput(e.data);const n=t.getAttribute("see-other-uri");if(n){const e=this._conn.service;(e.indexOf("wss:")>=0&&n.indexOf("wss:")>=0||e.indexOf("ws:")>=0)&&(this._conn._changeConnectStatus(i.e.Status.REDIRECT,"Received see-other-uri, resetting connection"),this._conn.reset(),this._conn.service=n,this._connect())}else this._conn._changeConnectStatus(i.e.Status.CONNFAIL,"Received closing stream"),this._conn._doDisconnect()}else{this._replaceMessageHandler();const t=this._streamWrap(e.data),n=(new r.a).parseFromString(t,"text/xml").documentElement;this._conn._connect_cb(n,null,e.data)}}_replaceMessageHandler(){this.socket.onmessage=e=>this._onMessage(e)}_disconnect(e){if(this.socket&&this.socket.readyState!==WebSocket.CLOSED){e&&this._conn.send(e);const t=Object(i.a)("close",{xmlns:i.e.NS.FRAMING});this._conn.xmlOutput(t.tree());const n=i.e.serialize(t);this._conn.rawOutput(n);try{this.socket.send(n)}catch(e){i.e.warn("Couldn't send <close /> tag.")}}this._conn._doDisconnect()}_doDisconnect(){i.e.debug("WebSockets _doDisconnect was called"),this._closeSocket()}_streamWrap(e){return"<wrapper>"+e+"</wrapper>"}_closeSocket(){if(this.socket)try{this.socket.onclose=null,this.socket.onerror=null,this.socket.onmessage=null,this.socket.close()}catch(e){i.e.debug(e.message)}this.socket=null}_emptyQueue(){return!0}_onClose(e){this._conn.connected&&!this._conn.disconnecting?(i.e.error("Websocket closed unexpectedly"),this._conn._doDisconnect()):e&&1006===e.code&&!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(e){i.e.error("Server did not offer a supported authentication mechanism"),this._conn._changeConnectStatus(i.e.Status.CONNFAIL,i.e.ErrorCondition.NO_AUTH_MECH),e&&e.call(this._conn),this._conn._doDisconnect()}_onDisconnectTimeout(){}_abortAllRequests(){}_onError(e){i.e.error("Websocket error "+e),this._conn._changeConnectStatus(i.e.Status.CONNFAIL,"The WebSocket connection could not be established or was disconnected."),this._disconnect()}_onIdle(){const e=this._conn._data;if(e.length>0&&!this._conn.paused){for(let t=0;t<e.length;t++)if(null!==e[t]){let n;n="restart"===e[t]?this._buildStream().tree():e[t];const r=i.e.serialize(n);this._conn.xmlOutput(n),this._conn.rawOutput(r),this.socket.send(r)}this._conn._data=[]}}_onMessage(e){let t;const n='<close xmlns="urn:ietf:params:xml:ns:xmpp-framing" />';if(e.data===n)return this._conn.rawInput(n),this._conn.xmlInput(e),void(this._conn.disconnecting||this._conn._doDisconnect());if(0===e.data.search("<open ")){if(t=(new r.a).parseFromString(e.data,"text/xml").documentElement,!this._handleStreamStart(t))return}else{const n=this._streamWrap(e.data);t=(new r.a).parseFromString(n,"text/xml").documentElement}return this._checkStreamError(t,i.e.Status.ERROR)?void 0:this._conn.disconnecting&&"presence"===t.firstChild.nodeName&&"unavailable"===t.firstChild.getAttribute("type")?(this._conn.xmlInput(t),void this._conn.rawInput(i.e.serialize(t))):void this._conn._dataRecv(t,e.data)}_onOpen(){i.e.debug("Websocket open");const e=this._buildStream();this._conn.xmlOutput(e.tree());const t=i.e.serialize(e);this._conn.rawOutput(t),this.socket.send(t)}_reqToData(e){return e}_send(){this._conn.flush()}_sendRestart(){clearTimeout(this._conn._idleTimeout),this._conn._onIdle.bind(this._conn)()}}},function(e,t){e.exports=function(e){if(!e.webpackPolyfill){var t=Object.create(e);t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),Object.defineProperty(t,"exports",{enumerable:!0}),t.webpackPolyfill=1}return t}},function(e,t,n){var r=n(333);e.exports=function(e){var t=r(e),n=t%1;return t==t?n?t-n:t:0}},function(e,t){e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},function(e,t){e.exports=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}},function(e,t,n){var r=n(20),i=Object.create,o=function(){function e(){}return function(t){if(!r(t))return{};if(i)return i(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();e.exports=o},function(e,t,n){var r=n(74),i=n(76);function o(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,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(e){return e.placeholder}},function(e,t,n){var r=n(25)(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(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[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(e,t){for(var n=0,o=(t=r(t,e)).length;null!=e&&n<o;)e=e[i(t[n++])];return n&&n==o?e:void 0}},function(e,t,n){var r=n(16),i=n(48),o=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;e.exports=function(e,t){if(r(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!i(e))||(s.test(e)||!o.test(e)||null!=t&&e in Object(t))}},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){var r=n(41),i=n(13).document,o=r(i)&&r(i.createElement);e.exports=function(e){return o?i.createElement(e):{}}},function(e,t){e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){var r=n(457),i=n(84);e.exports=function(e){return r(i(e))}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t,n){var r=n(144)("keys"),i=n(145);e.exports=function(e){return r[e]||(r[e]=i(e))}},function(e,t){e.exports=!0},function(e,t,n){e.exports={default:n(465),__esModule:!0}},function(e,t,n){var r=n(40).f,i=n(60),o=n(17)("toStringTag");e.exports=function(e,t,n){e&&!i(e=n?e:e.prototype,o)&&r(e,o,{configurable:!0,value:t})}},function(e,t,n){"use strict";var r=n(59);function i(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r})),this.resolve=r(t),this.reject=r(n)}e.exports.f=function(e){return new i(e)}},function(e,t,n){var r=n(367),i=n(33);e.exports=function(e){return null==e?[]:r(e,i(e))}},function(e,t,n){var r=n(109),i=n(368),o=n(77),s=n(52),a=r((function(e,t){var n=s(t,o(a));return i(e,32,void 0,t,n)}));a.placeholder={},e.exports=a},function(e,t,n){var r;!function(){"use strict";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(e){return a(l(e),arguments)}function s(e,t){return o.apply(null,[e].concat(t||[]))}function a(e,t){var n,r,s,a,c,l,u,d,h,f=1,p=e.length,g="";for(r=0;r<p;r++)if("string"==typeof e[r])g+=e[r];else if("object"==typeof e[r]){if((a=e[r]).keys)for(n=t[f],s=0;s<a.keys.length;s++){if(null==n)throw new Error(o('[sprintf] Cannot access property "%s" of undefined value "%s"',a.keys[s],a.keys[s-1]));n=n[a.keys[s]]}else n=a.param_no?t[a.param_no]:t[f++];if(i.not_type.test(a.type)&&i.not_primitive.test(a.type)&&n instanceof Function&&(n=n()),i.numeric_arg.test(a.type)&&"number"!=typeof n&&isNaN(n))throw new TypeError(o("[sprintf] expecting number but found %T",n));switch(i.number.test(a.type)&&(d=n>=0),a.type){case"b":n=parseInt(n,10).toString(2);break;case"c":n=String.fromCharCode(parseInt(n,10));break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,a.width?parseInt(a.width):0);break;case"e":n=a.precision?parseFloat(n).toExponential(a.precision):parseFloat(n).toExponential();break;case"f":n=a.precision?parseFloat(n).toFixed(a.precision):parseFloat(n);break;case"g":n=a.precision?String(Number(n.toPrecision(a.precision))):parseFloat(n);break;case"o":n=(parseInt(n,10)>>>0).toString(8);break;case"s":n=String(n),n=a.precision?n.substring(0,a.precision):n;break;case"t":n=String(!!n),n=a.precision?n.substring(0,a.precision):n;break;case"T":n=Object.prototype.toString.call(n).slice(8,-1).toLowerCase(),n=a.precision?n.substring(0,a.precision):n;break;case"u":n=parseInt(n,10)>>>0;break;case"v":n=n.valueOf(),n=a.precision?n.substring(0,a.precision):n;break;case"x":n=(parseInt(n,10)>>>0).toString(16);break;case"X":n=(parseInt(n,10)>>>0).toString(16).toUpperCase()}i.json.test(a.type)?g+=n:(!i.number.test(a.type)||d&&!a.sign?h="":(h=d?"+":"-",n=n.toString().replace(i.sign,"")),l=a.pad_char?"0"===a.pad_char?"0":a.pad_char.charAt(1):" ",u=a.width-(h+n).length,c=a.width&&u>0?l.repeat(u):"",g+=a.align?h+n+c:"0"===l?h+c+n:c+h+n)}return g}var c=Object.create(null);function l(e){if(c[e])return c[e];for(var t,n=e,r=[],o=0;n;){if(null!==(t=i.text.exec(n)))r.push(t[0]);else if(null!==(t=i.modulo.exec(n)))r.push("%");else{if(null===(t=i.placeholder.exec(n)))throw new SyntaxError("[sprintf] unexpected placeholder");if(t[2]){o|=1;var s=[],a=t[2],l=[];if(null===(l=i.key.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(s.push(l[1]);""!==(a=a.substring(l[0].length));)if(null!==(l=i.key_access.exec(a)))s.push(l[1]);else{if(null===(l=i.index_access.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");s.push(l[1])}t[2]=s}else o|=2;if(3===o)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");r.push({placeholder:t[0],param_no:t[1],keys:t[2],sign:t[3],pad_char:t[4],align:t[5],width:t[6],precision:t[7],type:t[8]})}n=n.substring(t[0].length)}return c[e]=r}t.sprintf=o,t.vsprintf=s,"undefined"!=typeof window&&(window.sprintf=o,window.vsprintf=s,void 0===(r=function(){return{sprintf:o,vsprintf:s}}.call(t,n,t,e))||(e.exports=r))}()},function(e,t){function n(e,t){for(var n in e)t[n]=e[n]}function r(e,t){var r=e.prototype;if(Object.create){var i=Object.create(t.prototype);r.__proto__=i}if(!(r instanceof t)){function o(){}o.prototype=t.prototype,n(r,o=new o),e.prototype=r=o}r.constructor!=e&&("function"!=typeof e&&console.error("unknow Class:"+e),r.constructor=e)}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(e,t){if(t instanceof Error)var n=t;else n=this,Error.call(this,_[e]),this.message=_[e],Error.captureStackTrace&&Error.captureStackTrace(this,S);return n.code=e,t&&(this.message=this.message+": "+t),n}function x(){}function E(e,t){this._node=e,this._refresh=t,A(this)}function A(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!=t){var r=e._refresh(e._node);te(e,"length",r.length),n(r,e),e._inc=t}}function C(){}function j(e,t){for(var n=e.length;n--;)if(e[n]===t)return n}function O(e,t,n,r){if(r?t[j(t,r)]=n:t[t.length++]=n,e){n.ownerElement=e;var i=e.ownerDocument;i&&(r&&D(i,e,r),function(e,t,n){e&&e._inc++,"http://www.w3.org/2000/xmlns/"==n.namespaceURI&&(t._nsMap[n.prefix?n.localName:""]=n.value)}(i,e,n))}}function T(e,t,n){var r=j(t,n);if(!(r>=0))throw S(y,new Error(e.tagName+"@"+n));for(var i=t.length-1;r<i;)t[r]=t[++r];if(t.length=i,e){var o=e.ownerDocument;o&&(D(o,e,n),n.ownerElement=null)}}function k(e){if(this._features={},e)for(var t in e)this._features=e[t]}function N(){}function I(e){return("<"==e?"&lt;":">"==e&&"&gt;")||"&"==e&&"&amp;"||'"'==e&&"&quot;"||"&#"+e.charCodeAt()+";"}function M(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(M(e,t))return!0}while(e=e.nextSibling)}function R(){}function D(e,t,n,r){e&&e._inc++,"http://www.w3.org/2000/xmlns/"==n.namespaceURI&&delete t._nsMap[n.prefix?n.localName:""]}function P(e,t,n){if(e&&e._inc){e._inc++;var r=t.childNodes;if(n)r[r.length++]=n;else{for(var i=t.firstChild,o=0;i;)r[o++]=i,i=i.nextSibling;r.length=o}}}function L(e,t){var n=t.previousSibling,r=t.nextSibling;return n?n.nextSibling=r:e.firstChild=r,r?r.previousSibling=n:e.lastChild=n,P(e.ownerDocument,e),t}function F(e,t,n){var r=t.parentNode;if(r&&r.removeChild(t),t.nodeType===g){var i=t.firstChild;if(null==i)return t;var o=t.lastChild}else i=o=t;var s=n?n.previousSibling:e.lastChild;i.previousSibling=s,o.nextSibling=n,s?s.nextSibling=i:e.firstChild=i,null==n?e.lastChild=o:n.previousSibling=o;do{i.parentNode=e}while(i!==o&&(i=i.nextSibling));return P(e.ownerDocument||e,e),t.nodeType==g&&(t.firstChild=t.lastChild=null),t}function z(){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(e,t){var n=[],r=9==this.nodeType?this.documentElement:this,i=r.prefix,o=r.namespaceURI;if(o&&null==i&&null==(i=r.lookupPrefix(o)))var s=[{namespace:o,prefix:null}];return ee(this,n,e,t,s),n.join("")}function Z(e,t,n){var r=e.prefix||"",i=e.namespaceURI;if(!r&&!i)return!1;if("xml"===r&&"http://www.w3.org/XML/1998/namespace"===i||"http://www.w3.org/2000/xmlns/"==i)return!1;for(var o=n.length;o--;){var s=n[o];if(s.prefix==r)return s.namespace!=i}return!0}function ee(e,t,n,r,i){if(r){if(!(e=r(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case o:i||(i=[]);i.length;var u=e.attributes,m=u.length,v=e.firstChild,_=e.tagName;n="http://www.w3.org/1999/xhtml"===e.namespaceURI||n,t.push("<",_);for(var b=0;b<m;b++){"xmlns"==(y=u.item(b)).prefix?i.push({prefix:y.localName,namespace:y.value}):"xmlns"==y.nodeName&&i.push({prefix:"",namespace:y.value})}for(b=0;b<m;b++){var y;if(Z(y=u.item(b),0,i)){var w=y.prefix||"",S=y.namespaceURI,x=w?" xmlns:"+w:" xmlns";t.push(x,'="',S,'"'),i.push({prefix:w,namespace:S})}ee(y,t,n,r,i)}if(Z(e,0,i)){w=e.prefix||"",S=e.namespaceURI,x=w?" xmlns:"+w:" xmlns";t.push(x,'="',S,'"'),i.push({prefix:w,namespace:S})}if(v||n&&!/^(?:meta|link|img|br|hr|input)$/i.test(_)){if(t.push(">"),n&&/^script$/i.test(_))for(;v;)v.data?t.push(v.data):ee(v,t,n,r,i),v=v.nextSibling;else for(;v;)ee(v,t,n,r,i),v=v.nextSibling;t.push("</",_,">")}else t.push("/>");return;case f:case g:for(v=e.firstChild;v;)ee(v,t,n,r,i),v=v.nextSibling;return;case s:return t.push(" ",e.name,'="',e.value.replace(/[<&"]/g,I),'"');case a:return t.push(e.data.replace(/[<&]/g,I));case c:return t.push("<![CDATA[",e.data,"]]>");case h:return t.push("\x3c!--",e.data,"--\x3e");case p:var E=e.publicId,A=e.systemId;if(t.push("<!DOCTYPE ",e.name),E)t.push(' PUBLIC "',E),A&&"."!=A&&t.push('" "',A),t.push('">');else if(A&&"."!=A)t.push(' SYSTEM "',A,'">');else{var C=e.internalSubset;C&&t.push(" [",C,"]"),t.push(">")}return;case d:return t.push("<?",e.target," ",e.data,"?>");case l:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function te(e,t,n){e[t]=n}S.prototype=Error.prototype,n(v,S),x.prototype={length:0,item:function(e){return this[e]||null},toString:function(e,t){for(var n=[],r=0;r<this.length;r++)ee(this[r],n,e,t);return n.join("")}},E.prototype.item=function(e){return A(this),this[e]},r(E,x),C.prototype={length:0,item:x.prototype.item,getNamedItem:function(e){for(var t=this.length;t--;){var n=this[t];if(n.nodeName==e)return n}},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new S(w);var n=this.getNamedItem(e.nodeName);return O(this._ownerElement,this,e,n),n},setNamedItemNS:function(e){var t,n=e.ownerElement;if(n&&n!=this._ownerElement)throw new S(w);return t=this.getNamedItemNS(e.namespaceURI,e.localName),O(this._ownerElement,this,e,t),t},removeNamedItem:function(e){var t=this.getNamedItem(e);return T(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var n=this.getNamedItemNS(e,t);return T(this._ownerElement,this,n),n},getNamedItemNS:function(e,t){for(var n=this.length;n--;){var r=this[n];if(r.localName==t&&r.namespaceURI==e)return r}return null}},k.prototype={hasFeature:function(e,t){var n=this._features[e.toLowerCase()];return!(!n||t&&!(t in n))},createDocument:function(e,t,n){var r=new R;if(r.implementation=this,r.childNodes=new x,r.doctype=n,n&&r.appendChild(n),t){var i=r.createElementNS(e,t);r.appendChild(i)}return r},createDocumentType:function(e,t,n){var r=new W;return r.name=e,r.nodeName=e,r.publicId=t,r.systemId=n,r}},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(e,t){return F(this,e,t)},replaceChild:function(e,t){this.insertBefore(e,t),t&&this.removeChild(t)},removeChild:function(e){return L(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(e){return function e(t,n,r){var i=new n.constructor;for(var a in n){var c=n[a];"object"!=typeof c&&c!=i[a]&&(i[a]=c)}n.childNodes&&(i.childNodes=new x);switch(i.ownerDocument=t,i.nodeType){case o:var l=n.attributes,u=i.attributes=new C,d=l.length;u._ownerElement=i;for(var h=0;h<d;h++)i.setAttributeNode(e(t,l.item(h),!0));break;case s:r=!0}if(r)for(var f=n.firstChild;f;)i.appendChild(e(t,f,r)),f=f.nextSibling;return i}(this.ownerDocument||this,this,e)},normalize:function(){for(var e=this.firstChild;e;){var t=e.nextSibling;t&&t.nodeType==a&&e.nodeType==a?(this.removeChild(t),e.appendData(t.data)):(e.normalize(),e=t)}},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(e){for(var t=this;t;){var n=t._nsMap;if(n)for(var r in n)if(n[r]==e)return r;t=t.nodeType==s?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var n=t._nsMap;if(n&&e in n)return n[e];t=t.nodeType==s?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},n(i,N),n(i,N.prototype),R.prototype={nodeName:"#document",nodeType:f,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==g){for(var n=e.firstChild;n;){var r=n.nextSibling;this.insertBefore(n,t),n=r}return e}return null==this.documentElement&&e.nodeType==o&&(this.documentElement=e),F(this,e,t),e.ownerDocument=this,e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),L(this,e)},importNode:function(e,t){return function e(t,n,r){var i;switch(n.nodeType){case o:(i=n.cloneNode(!1)).ownerDocument=t;case g:break;case s:r=!0}i||(i=n.cloneNode(!1));if(i.ownerDocument=t,i.parentNode=null,r)for(var a=n.firstChild;a;)i.appendChild(e(t,a,r)),a=a.nextSibling;return i}(this,e,t)},getElementById:function(e){var t=null;return M(this.documentElement,(function(n){if(n.nodeType==o&&n.getAttribute("id")==e)return t=n,!0})),t},createElement:function(e){var t=new z;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.childNodes=new x,(t.attributes=new C)._ownerElement=t,t},createDocumentFragment:function(){var e=new X;return e.ownerDocument=this,e.childNodes=new x,e},createTextNode:function(e){var t=new H;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new U;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new $;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var n=new Q;return n.ownerDocument=this,n.tagName=n.target=e,n.nodeValue=n.data=t,n},createAttribute:function(e){var t=new B;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new J;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var n=new z,r=t.split(":"),i=n.attributes=new C;return n.childNodes=new x,n.ownerDocument=this,n.nodeName=t,n.tagName=t,n.namespaceURI=e,2==r.length?(n.prefix=r[0],n.localName=r[1]):n.localName=t,i._ownerElement=n,n},createAttributeNS:function(e,t){var n=new B,r=t.split(":");return n.ownerDocument=this,n.nodeName=t,n.name=t,n.namespaceURI=e,n.specified=!0,2==r.length?(n.prefix=r[0],n.localName=r[1]):n.localName=t,n}},r(R,N),z.prototype={nodeType:o,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var n=this.ownerDocument.createAttribute(e);n.value=n.nodeValue=""+t,this.setAttributeNode(n)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===g?this.insertBefore(e,null):function(e,t){var n=t.parentNode;if(n){var r=e.lastChild;n.removeChild(t);r=e.lastChild}return r=e.lastChild,t.parentNode=e,t.previousSibling=r,t.nextSibling=null,r?r.nextSibling=t:e.firstChild=t,e.lastChild=t,P(e.ownerDocument,e,t),t}(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);n&&this.removeAttributeNode(n)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);return n&&n.value||""},setAttributeNS:function(e,t,n){var r=this.ownerDocument.createAttributeNS(e,t);r.value=r.nodeValue=""+n,this.setAttributeNode(r)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new E(this,(function(t){var n=[];return M(t,(function(r){r===t||r.nodeType!=o||"*"!==e&&r.tagName!=e||n.push(r)})),n}))},getElementsByTagNameNS:function(e,t){return new E(this,(function(n){var r=[];return M(n,(function(i){i===n||i.nodeType!==o||"*"!==e&&i.namespaceURI!==e||"*"!==t&&i.localName!=t||r.push(i)})),r}))}},R.prototype.getElementsByTagName=z.prototype.getElementsByTagName,R.prototype.getElementsByTagNameNS=z.prototype.getElementsByTagNameNS,r(z,N),B.prototype.nodeType=s,r(B,N),q.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(_[b])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,n){n=this.data.substring(0,e)+n+this.data.substring(e+t),this.nodeValue=this.data=n,this.length=n.length}},r(q,N),H.prototype={nodeName:"#text",nodeType:a,splitText:function(e){var t=this.data,n=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var r=this.ownerDocument.createTextNode(n);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}},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(e,t,n){return K.call(e,t,n)},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 e(t){switch(t.nodeType){case o:case g:var n=[];for(t=t.firstChild;t;)7!==t.nodeType&&8!==t.nodeType&&n.push(e(t)),t=t.nextSibling;return n.join("");default:return t.nodeValue}}(this)},set:function(e){switch(this.nodeType){case o:case g:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),te=function(e,t,n){e["$$"+t]=n}}}catch(e){}t.DOMImplementation=k,t.XMLSerializer=Y},function(e,t,n){(function(t){var n="object"==typeof t&&t&&t.Object===Object&&t;e.exports=n}).call(this,n(12))},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}},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(e,t){var n=o(e),u=!n&&i(e),d=!n&&!u&&s(e),h=!n&&!u&&!d&&c(e),f=n||u||d||h,p=f?r(e.length,String):[],g=p.length;for(var m in e)!t&&!l.call(e,m)||f&&("length"==m||d&&("offset"==m||"parent"==m)||h&&("buffer"==m||"byteLength"==m||"byteOffset"==m)||a(m,g))||p.push(m);return p}},function(e,t,n){var r=n(343),i=n(22),o=Object.prototype,s=o.hasOwnProperty,a=o.propertyIsEnumerable,c=r(function(){return arguments}())?r:function(e){return i(e)&&s.call(e,"callee")&&!a.call(e,"callee")};e.exports=c},function(e,t,n){(function(e){var r=n(11),i=n(344),o=t&&!t.nodeType&&t,s=o&&"object"==typeof e&&e&&!e.nodeType&&e,a=s&&s.exports===o?r.Buffer:void 0,c=(a?a.isBuffer:void 0)||i;e.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(e){if(!r(e))return i(e);var t=[];for(var n in Object(e))o.call(e,n)&&"constructor"!=n&&t.push(n);return t}},function(e,t){var n=Object.prototype;e.exports=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||n)}},function(e,t){e.exports=function(e,t){return function(n){return e(t(n))}}},function(e,t,n){var r=n(106),i=n(50),o=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){var s=e[t];o.call(e,t)&&i(s,n)&&(void 0!==n||t in e)||r(e,t,n)}},function(e,t,n){var r=n(107);e.exports=function(e,t,n){"__proto__"==t&&r?r(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}},function(e,t,n){var r=n(25),i=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=i},function(e,t){var n=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return n.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},function(e,t,n){var r=n(38),i=n(358),o=n(110);e.exports=function(e,t){return o(i(e,t,r),e+"")}},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(e){var t=0,r=0;return function(){var i=n(),o=16-(i-r);if(r=i,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}},function(e,t,n){var r=n(98),i=n(362),o=n(29);e.exports=function(e){return o(e)?r(e,!0):i(e)}},function(e,t,n){var r=n(364),i=n(365),o=n(366);e.exports=function(e,t,n){return t==t?o(e,t,n):r(e,i,n)}},function(e,t,n){var r=n(24),i=n(16),o=n(22);e.exports=function(e){return"string"==typeof e||!i(e)&&o(e)&&"[object String]"==r(e)}},function(e,t,n){var r=n(38),i=n(116),o=i?function(e,t){return i.set(e,t),e}: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(25)(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 e(t,n,h,f,p,g,m,v,_,b){var y=128&n,w=1&n,S=2&n,x=24&n,E=512&n,A=S?void 0:s(t);return function C(){for(var j=arguments.length,O=Array(j),T=j;T--;)O[T]=arguments[T];if(x)var k=c(C),N=o(O,k);if(f&&(O=r(O,f,p,x)),g&&(O=i(O,g,m,x)),j-=N,x&&j<b){var I=u(O,k);return a(t,n,e,C.placeholder,h,O,I,v,_,b-j)}var M=w?h:this,R=S?M[t]:t;return j=O.length,v?O=l(O,v):E&&j>1&&O.reverse(),y&&_<j&&(O.length=_),this&&this!==d&&this instanceof C&&(R=A||s(R)),R.apply(M,O)}}},function(e,t){var n=Math.max;e.exports=function(e,t,r,i){for(var o=-1,s=e.length,a=r.length,c=-1,l=t.length,u=n(s-a,0),d=Array(l+u),h=!i;++c<l;)d[c]=t[c];for(;++o<a;)(h||o<s)&&(d[r[o]]=e[o]);for(;u--;)d[c++]=e[o++];return d}},function(e,t){var n=Math.max;e.exports=function(e,t,r,i){for(var o=-1,s=e.length,a=-1,c=r.length,l=-1,u=t.length,d=n(s-c,0),h=Array(d+u),f=!i;++o<d;)h[o]=e[o];for(var p=o;++l<u;)h[p+l]=t[l];for(;++a<c;)(f||o<s)&&(h[p+r[a]]=e[o++]);return h}},function(e,t,n){var r=n(372),i=n(125),o=n(126);e.exports=function(e,t,n,s,a,c,l,u,d,h){var f=8&t;t|=f?32:64,4&(t&=~(f?64:32))||(t&=-4);var p=[e,t,a,f?c:void 0,f?l:void 0,f?void 0:c,f?void 0:l,u,d,h],g=n.apply(void 0,p);return r(e)&&i(g,p),g.placeholder=s,o(g,e,t)}},function(e,t,n){var r=n(116),i=n(373),o=r?function(e){return r.get(e)}:i;e.exports=o},function(e,t,n){var r=n(74),i=n(76);function o(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,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(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}},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(e,t,n){var a=t+"";return o(e,i(a,s(r(a),n)))}},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(e){var t=this.__data__=new r(e);this.size=t.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(22);e.exports=function e(t,n,o,s,a){return t===n||(null==t||null==n||!i(t)&&!i(n)?t!=t&&n!=n:r(t,n,o,s,e,a))}},function(e,t,n){var r=n(411),i=n(414),o=n(415);e.exports=function(e,t,n,s,a,c){var l=1&n,u=e.length,d=t.length;if(u!=d&&!(l&&d>u))return!1;var h=c.get(e),f=c.get(t);if(h&&f)return h==t&&f==e;var p=-1,g=!0,m=2&n?new r:void 0;for(c.set(e,t),c.set(t,e);++p<u;){var v=e[p],_=t[p];if(s)var b=l?s(_,v,p,t,e,c):s(v,_,p,e,t,c);if(void 0!==b){if(b)continue;g=!1;break}if(m){if(!i(t,(function(e,t){if(!o(m,t)&&(v===e||a(v,e,n,s,c)))return m.push(t)}))){g=!1;break}}else if(v!==_&&!a(v,_,n,s,c)){g=!1;break}}return c.delete(e),c.delete(t),g}},function(e,t,n){var r=n(131),i=n(16);e.exports=function(e,t,n){var o=t(e);return i(e)?o:r(o,n(e))}},function(e,t){e.exports=function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}},function(e,t,n){var r=n(422),i=n(133),o=Object.prototype.propertyIsEnumerable,s=Object.getOwnPropertySymbols,a=s?function(e){return null==e?[]:(e=Object(e),r(s(e),(function(t){return o.call(e,t)})))}: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(24),l=n(108),u=l(r),d=l(i),h=l(o),f=l(s),p=l(a),g=c;(r&&"[object DataView]"!=g(new r(new ArrayBuffer(1)))||i&&"[object Map]"!=g(new i)||o&&"[object Promise]"!=g(o.resolve())||s&&"[object Set]"!=g(new s)||a&&"[object WeakMap]"!=g(new a))&&(g=function(e){var t=c(e),n="[object Object]"==t?e.constructor:void 0,r=n?l(n):"";if(r)switch(r){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 t}),e.exports=g},function(e,t,n){var r=n(20);e.exports=function(e){return e==e&&!r(e)}},function(e,t){e.exports=function(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}},function(e,t,n){var r=n(432);e.exports=function(e){return null==e?"":r(e)}},function(e,t){e.exports=function(e){return function(t){return null==t?void 0:t[e]}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=l(n(447)),i=l(n(453)),o=l(n(461)),s=l(n(464)),a=l(n(89));t.default=function(e,t){var n=(0,c.getStorage)(),l=!(!n||!n[t]),u=l?n[t]:{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:e,_support:l,_initStorage:function(){return a.default.resolve()},clear:function(e){var t=this;return(0,s.default)(o.default.mark((function n(){return o.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:d(),e&&e();case 2:case"end":return t.stop()}}),n,t)})))()},iterate:function(e,t){var n=this;return(0,s.default)(o.default.mark((function r(){var s;return o.default.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,(0,c.usePromise)(h,null);case 2:s=n.sent,(0,i.default)(s).forEach((function(t,n){return e(s[t],t,n)})),t&&t();case 6:case"end":return n.stop()}}),r,n)})))()},getItem:function(e,t){var n=this;return(0,s.default)(o.default.mark((function r(){var i;return o.default.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,(0,c.usePromise)(h,e);case 3:return i=n.sent,i=void 0===(i="string"==typeof e?i[e]:i)?null:i,t&&t(null,i),n.abrupt("return",i);case 10:throw n.prev=10,n.t0=n.catch(0),t&&t(n.t0),n.t0;case 14:case"end":return n.stop()}}),r,n,[[0,10]])})))()},key:function(e,t){var n=this;return(0,s.default)(o.default.mark((function r(){var s,a;return o.default.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,(0,c.usePromise)(h,null);case 2:return s=n.sent,a=(0,i.default)(s)[e],t&&t(a),n.abrupt("return",a);case 6:case"end":return n.stop()}}),r,n)})))()},keys:function(e){var t=this;return(0,s.default)(o.default.mark((function n(){var r,s;return o.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,c.usePromise)(h,null);case 2:return r=t.sent,s=(0,i.default)(r),e&&e(s),t.abrupt("return",s);case 6:case"end":return t.stop()}}),n,t)})))()},length:function(e){var t=this;return(0,s.default)(o.default.mark((function n(){var r,s;return o.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,c.usePromise)(h,null);case 2:return r=t.sent,s=(0,i.default)(r).length,e&&e(s),t.abrupt("return",s);case 6:case"end":return t.stop()}}),n,t)})))()},removeItem:function(e,t){var n=this;return(0,s.default)(o.default.mark((function r(){return o.default.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,(0,c.usePromise)(f,e);case 2:t&&t();case 3:case"end":return n.stop()}}),r,n)})))()},setItem:function(e,t,n){var i=this;return(0,s.default)(o.default.mark((function s(){return o.default.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,(0,c.usePromise)(p,(0,r.default)({},e,t));case 2:n&&n();case 3:case"end":return i.stop()}}),s,i)})))()}}};var c=n(492);function l(e){return e&&e.__esModule?e:{default:e}}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){var r=n(84);e.exports=function(e){return Object(r(e))}},function(e,t,n){var r=n(456),i=n(146);e.exports=Object.keys||function(e){return r(e,i)}},function(e,t,n){var r=n(86),i=Math.min;e.exports=function(e){return e>0?i(r(e),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(e,t){return o[e]||(o[e]=void 0!==t?t:{})})("versions",[]).push({version:r.version,mode:n(88)?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){"use strict";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(e,t,n,p,g,m,v){c(n,t,p);var _,b,y,w=function(e){if(!h&&e in A)return A[e];switch(e){case"keys":case"values":return function(){return new n(this,e)}}return function(){return new n(this,e)}},S=t+" Iterator",x="values"==g,E=!1,A=e.prototype,C=A[d]||A["@@iterator"]||g&&A[g],j=C||w(g),O=g?x?w("entries"):j:void 0,T="Array"==t&&A.entries||C;if(T&&(y=u(T.call(new e)))!==Object.prototype&&y.next&&(l(y,S,!0),r||"function"==typeof y[d]||s(y,d,f)),x&&C&&"values"!==C.name&&(E=!0,j=function(){return C.call(this)}),r&&!v||!h&&!E&&A[d]||s(A,d,j),a[t]=j,a[S]=f,g)if(_={values:x?j:w("values"),keys:m?j:w("keys"),entries:O},v)for(b in _)b in A||o(A,b,_[b]);else i(i.P+i.F*(h||E),t,_);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="Arguments"==r(function(){return arguments}());e.exports=function(e){var t,n,s;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),i))?n:o?r(t):"Object"==(s=r(t))&&"function"==typeof t.callee?"Arguments":s}},function(e,t,n){var r=n(26),i=n(59),o=n(17)("species");e.exports=function(e,t){var n,s=r(e).constructor;return void 0===s||null==(n=r(s)[o])?t:i(n)}},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 e=+this;if(v.hasOwnProperty(e)){var t=v[e];delete v[e],t()}},b=function(e){_.call(e.data)};h&&f||(h=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return v[++m]=function(){a("function"==typeof e?e:Function(e),t)},r(m),m},f=function(e){delete v[e]},"process"==n(61)(d)?r=function(e){d.nextTick(s(_,e,1))}:g&&g.now?r=function(e){g.now(s(_,e,1))}:p?(o=(i=new p).port2,i.port1.onmessage=b,r=s(o.postMessage,o,1)):u.addEventListener&&"function"==typeof postMessage&&!u.importScripts?(r=function(e){u.postMessage(e+"","*")},u.addEventListener("message",b,!1)):r="onreadystatechange"in l("script")?function(e){c.appendChild(l("script")).onreadystatechange=function(){c.removeChild(this),_.call(e)}}:function(e){setTimeout(s(_,e,1),0)}),e.exports={set:h,clear:f}},function(e,t){e.exports=function(e){try{return{e:!1,v:e()}}catch(e){return{e:!0,v:e}}}},function(e,t,n){var r=n(26),i=n(41),o=n(91);e.exports=function(e,t){if(r(e),i(t)&&t.constructor===e)return t;var n=o.f(e);return(0,n.resolve)(t),n.promise}},function(e,t,n){"use strict";var r=n(15),i=n(0);i.e.Request=class{constructor(e,t,n,r){this.id=++i.e._requestId,this.xmlData=e,this.data=i.e.serialize(e),this.origFunc=t,this.func=t,this.rid=n,this.date=NaN,this.sends=r||0,this.abort=!1,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 e=null;if(this.xhr.responseXML&&this.xhr.responseXML.documentElement){if(e=this.xhr.responseXML.documentElement,"parsererror"===e.tagName)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..."),e=(new r.a).parseFromString(this.xhr.responseText,"application/xml").documentElement,!e)throw new Error("Parsing produced null node");if(e.querySelector("parsererror")){i.e.error("invalid response received: "+e.querySelector("parsererror").textContent),i.e.error("responseText: "+this.xhr.responseText);const t=new Error;throw t.name=i.e.ErrorCondition.BAD_FORMAT,t}}return e}_newXHR(){let e=null;return window.XMLHttpRequest?(e=new XMLHttpRequest,e.overrideMimeType&&e.overrideMimeType("text/xml; charset=utf-8")):window.ActiveXObject&&(e=new ActiveXObject("Microsoft.XMLHTTP")),e.onreadystatechange=this.func.bind(null,this),e}},i.e.Bosh=class e{constructor(e){this._conn=e,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 e=Object(i.a)("body",{rid:this.rid++,xmlns:i.e.NS.HTTPBIND});return null!==this.sid&&e.attrs({sid:this.sid}),this._conn.options.keepalive&&this._conn._sessionCachingSupported()&&this._cacheSession(),e}_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(e,t,n){this.wait=e||this.wait,this.hold=t||this.hold,this.errors=0;const r=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});n&&r.attrs({route:n});const o=this._conn._connect_cb;this._requests.push(new i.e.Request(r.tree(),this._onRequestStateChange.bind(this,o.bind(this._conn)),r.tree().getAttribute("rid"))),this._throttledRequestHandler()}_attach(e,t,n,r,o,s,a){this._conn.jid=e,this.sid=t,this.rid=n,this._conn.connect_callback=r,this._conn.domain=i.e.getDomainFromJid(this._conn.jid),this._conn.authenticated=!0,this._conn.connected=!0,this.wait=o||this.wait,this.hold=s||this.hold,this.window=a||this.window,this._conn._changeConnectStatus(i.e.Status.ATTACHED,null)}_restore(e,t,n,r,o){const s=JSON.parse(window.sessionStorage.getItem("strophe-bosh-session"));if(!(null!=s&&s.rid&&s.sid&&s.jid&&(null==e||i.e.getBareJidFromJid(s.jid)===i.e.getBareJidFromJid(e)||null===i.e.getNodeFromJid(e)&&i.e.getDomainFromJid(s.jid)===e))){const e=new Error("_restore: no restoreable session.");throw e.name="StropheSessionError",e}this._conn.restored=!0,this._attach(s.jid,s.sid,s.rid,t,n,r,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(e){const t=e.getAttribute("type");if(null!==t&&"terminate"===t){let t=e.getAttribute("condition");i.e.error("BOSH-Connection failed: "+t);const n=e.getElementsByTagName("conflict");return null!==t?("remote-stream-error"===t&&n.length>0&&(t="conflict"),this._conn._changeConnectStatus(i.e.Status.CONNFAIL,t)):this._conn._changeConnectStatus(i.e.Status.CONNFAIL,"unknown"),this._conn._doDisconnect(t),i.e.Status.CONNFAIL}this.sid||(this.sid=e.getAttribute("sid"));const n=e.getAttribute("requests");n&&(this.window=parseInt(n,10));const r=e.getAttribute("hold");r&&(this.hold=parseInt(r,10));const o=e.getAttribute("wait");o&&(this.wait=parseInt(o,10));const s=e.getAttribute("inactivity");s&&(this.inactivity=parseInt(s,10))}_disconnect(e){this._sendTerminate(e)}_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 0===this._requests.length}_callProtocolErrorHandlers(t){const n=e._getRequestStatus(t),r=this._conn.protocolErrorHandlers.HTTP[n];r&&r.call(this,n)}_hitError(e){this.errors++,i.e.warn("request errored, status: "+e+", number of errors: "+this.errors),this.errors>4&&this._conn._onDisconnectTimeout()}_no_auth_received(e){i.e.warn("Server did not yet offer a supported authentication mechanism. Sending a blank poll request."),e=e?e.bind(this._conn):this._conn._connect_cb.bind(this._conn);const t=this._buildBody();this._requests.push(new i.e.Request(t.tree(),this._onRequestStateChange.bind(this,e),t.tree().getAttribute("rid"))),this._throttledRequestHandler()}_onDisconnectTimeout(){this._abortAllRequests()}_abortAllRequests(){for(;this._requests.length>0;){const e=this._requests.pop();e.abort=!0,e.xhr.abort(),e.xhr.onreadystatechange=function(){}}}_onIdle(){const e=this._conn._data;if(this._conn.authenticated&&0===this._requests.length&&0===e.length&&!this._conn.disconnecting&&(i.e.debug("no requests during idle cycle, sending blank request"),e.push(null)),!this._conn.paused){if(this._requests.length<2&&e.length>0){const t=this._buildBody();for(let n=0;n<e.length;n++)null!==e[n]&&("restart"===e[n]?t.attrs({to:this._conn.domain,"xml:lang":"en","xmpp:restart":"true","xmlns:xmpp":i.e.NS.BOSH}):t.cnode(e[n]).up());delete this._conn._data,this._conn._data=[],this._requests.push(new i.e.Request(t.tree(),this._onRequestStateChange.bind(this,this._conn._dataRecv.bind(this._conn)),t.tree().getAttribute("rid"))),this._throttledRequestHandler()}if(this._requests.length>0){const e=this._requests[0].age();null!==this._requests[0].dead&&this._requests[0].timeDead()>Math.floor(i.e.SECONDARY_TIMEOUT*this.wait)&&this._throttledRequestHandler(),e>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(e,t){let n;if(4===e.xhr.readyState)try{n=e.xhr.status}catch(e){i.e.error("Caught an error while retrieving a request's status, reqStatus: "+n)}return void 0===n&&(n="number"==typeof t?t:0),n}_onRequestStateChange(t,n){if(i.e.debug("request id "+n.id+"."+n.sends+" state changed to "+n.xhr.readyState),n.abort)return void(n.abort=!1);if(4!==n.xhr.readyState)return;const r=e._getRequestStatus(n);if(this.lastResponseHeaders=n.xhr.getAllResponseHeaders(),this._conn.disconnecting&&r>=400)return this._hitError(r),void this._callProtocolErrorHandlers(n);const o=r>0&&r<500,s=n.sends>this._conn.maxRetries;if((o||s)&&(this._removeRequest(n),i.e.debug("request id "+n.id+" should now be removed")),200===r){const e=this._requests[0]===n;(this._requests[1]===n||e&&this._requests.length>0&&this._requests[0].age()>Math.floor(i.e.SECONDARY_TIMEOUT*this.wait))&&this._restartRequest(0),this._conn.nextValidRid(Number(n.rid)+1),i.e.debug("request id "+n.id+"."+n.sends+" got 200"),t(n),this.errors=0}else 0===r||r>=400&&r<600||r>=12e3?(i.e.error("request id "+n.id+"."+n.sends+" error "+r+" happened"),this._hitError(r),this._callProtocolErrorHandlers(n),r>=400&&r<500&&(this._conn._changeConnectStatus(i.e.Status.DISCONNECTING,null),this._conn._doDisconnect())):i.e.error("request id "+n.id+"."+n.sends+" error "+r+" happened");o||s?s&&!this._conn.connected&&this._conn._changeConnectStatus(i.e.Status.CONNFAIL,"giving-up"):this._throttledRequestHandler()}_processRequest(t){let n=this._requests[t];const r=e._getRequestStatus(n,-1);if(n.sends>this._conn.maxRetries)return void this._conn._onDisconnectTimeout();const o=n.age(),s=!isNaN(o)&&o>Math.floor(i.e.TIMEOUT*this.wait),a=null!==n.dead&&n.timeDead()>Math.floor(i.e.SECONDARY_TIMEOUT*this.wait),c=4===n.xhr.readyState&&(r<1||r>=500);if((s||a||c)&&(a&&i.e.error("Request ".concat(this._requests[t].id," timed out (secondary), restarting")),n.abort=!0,n.xhr.abort(),n.xhr.onreadystatechange=function(){},this._requests[t]=new i.e.Request(n.xmlData,n.origFunc,n.rid,n.sends),n=this._requests[t]),0===n.xhr.readyState){i.e.debug("request id "+n.id+"."+n.sends+" posting");try{const e=this._conn.options.contentType||"text/xml; charset=utf-8";n.xhr.open("POST",this._conn.service,!this._conn.options.sync),void 0!==n.xhr.setRequestHeader&&n.xhr.setRequestHeader("Content-Type",e),this._conn.options.withCredentials&&(n.xhr.withCredentials=!0)}catch(e){return i.e.error("XHR open failed: "+e.toString()),this._conn.connected||this._conn._changeConnectStatus(i.e.Status.CONNFAIL,"bad-service"),void this._conn.disconnect()}const e=()=>{if(n.date=new Date,this._conn.options.customHeaders){const e=this._conn.options.customHeaders;for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.xhr.setRequestHeader(t,e[t])}n.xhr.send(n.data)};if(n.sends>1){const t=1e3*Math.min(Math.floor(i.e.TIMEOUT*this.wait),Math.pow(n.sends,3));setTimeout((function(){e()}),t)}else e();n.sends++,this._conn.xmlOutput!==i.e.Connection.prototype.xmlOutput&&(n.xmlData.nodeName===this.strip&&n.xmlData.childNodes.length?this._conn.xmlOutput(n.xmlData.childNodes[0]):this._conn.xmlOutput(n.xmlData)),this._conn.rawOutput!==i.e.Connection.prototype.rawOutput&&this._conn.rawOutput(n.data)}else i.e.debug("_processRequest: "+(0===t?"first":"second")+" request has readyState of "+n.xhr.readyState)}_removeRequest(e){i.e.debug("removing request");for(let t=this._requests.length-1;t>=0;t--)e===this._requests[t]&&this._requests.splice(t,1);e.xhr.onreadystatechange=function(){},this._throttledRequestHandler()}_restartRequest(e){const t=this._requests[e];null===t.dead&&(t.dead=new Date),this._processRequest(e)}_reqToData(e){try{return e.getResponse()}catch(e){if("parsererror"!==e.message)throw e;this._conn.disconnect("strophe-parsererror")}}_sendTerminate(e){i.e.debug("_sendTerminate was called");const t=this._buildBody().attrs({type:"terminate"});e&&t.cnode(e.tree());const n=new i.e.Request(t.tree(),this._onRequestStateChange.bind(this,this._conn._dataRecv.bind(this._conn)),t.tree().getAttribute("rid"));this._requests.push(n),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&&0!==this._requests.length&&(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(e,r){var i;/*! https://mths.be/punycode v1.4.0 by @mathias */!function(o){t&&t.nodeType,e&&e.nodeType;var s="object"==typeof r&&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(e){throw new RangeError(h[e])}function m(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function v(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+m((e=e.replace(d,".")).split("."),t).join(".")}function _(e){for(var t,n,r=[],i=0,o=e.length;i<o;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<o?56320==(64512&(n=e.charCodeAt(i++)))?r.push(((1023&t)<<10)+(1023&n)+65536):(r.push(t),i--):r.push(t);return r}function b(e){return m(e,(function(e){var t="";return e>65535&&(t+=p((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=p(e)})).join("")}function y(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function w(e,t,n){var r=0;for(e=n?f(e/700):e>>1,e+=f(e/t);e>455;r+=36)e=f(e/35);return f(r+36*e/(e+38))}function S(e){var t,n,r,i,o,s,a,l,u,d,h,p=[],m=e.length,v=0,_=128,y=72;for((n=e.lastIndexOf("-"))<0&&(n=0),r=0;r<n;++r)e.charCodeAt(r)>=128&&g("not-basic"),p.push(e.charCodeAt(r));for(i=n>0?n+1:0;i<m;){for(o=v,s=1,a=36;i>=m&&g("invalid-input"),((l=(h=e.charCodeAt(i++))-48<10?h-22:h-65<26?h-65:h-97<26?h-97:36)>=36||l>f((c-v)/s))&&g("overflow"),v+=l*s,!(l<(u=a<=y?1:a>=y+26?26:a-y));a+=36)s>f(c/(d=36-u))&&g("overflow"),s*=d;y=w(v-o,t=p.length+1,0==o),f(v/t)>c-_&&g("overflow"),_+=f(v/t),v%=t,p.splice(v++,0,_)}return b(p)}function x(e){var t,n,r,i,o,s,a,l,u,d,h,m,v,b,S,x=[];for(m=(e=_(e)).length,t=128,n=0,o=72,s=0;s<m;++s)(h=e[s])<128&&x.push(p(h));for(r=i=x.length,i&&x.push("-");r<m;){for(a=c,s=0;s<m;++s)(h=e[s])>=t&&h<a&&(a=h);for(a-t>f((c-n)/(v=r+1))&&g("overflow"),n+=(a-t)*v,t=a,s=0;s<m;++s)if((h=e[s])<t&&++n>c&&g("overflow"),h==t){for(l=n,u=36;!(l<(d=u<=o?1:u>=o+26?26:u-o));u+=36)S=l-d,b=36-d,x.push(p(y(d+S%b,0))),l=f(S/b);x.push(p(y(l,0))),o=w(n,v,r==i),n=0,++r}++n,++t}return x.join("")}a={version:"1.3.2",ucs2:{decode:_,encode:b},decode:S,encode:x,toASCII:function(e){return v(e,(function(e){return u.test(e)?"xn--"+x(e):e}))},toUnicode:function(e){return v(e,(function(e){return l.test(e)?S(e.slice(4).toLowerCase()):e}))}},void 0===(i=function(){return a}.call(t,n,t,e))||(e.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){"use strict";e.exports?e.exports=s():void 0===(i="function"==typeof(r=s)?r.call(t,n,t,e):r)||(e.exports=i)}(0,(function(e){"use strict";var t=e&&e.IPv6;return{best:function(e){var t,n,r=e.toLowerCase().split(":"),i=r.length,o=8;for(""===r[0]&&""===r[1]&&""===r[2]?(r.shift(),r.shift()):""===r[0]&&""===r[1]?r.shift():""===r[i-1]&&""===r[i-2]&&r.pop(),-1!==r[(i=r.length)-1].indexOf(".")&&(o=7),t=0;t<i&&""!==r[t];t++);if(t<o)for(r.splice(t,1,"0000");r.length<o;)r.splice(t,0,"0000");for(var s=0;s<o;s++){n=r[s].split("");for(var a=0;a<3&&("0"===n[0]&&n.length>1);a++)n.splice(0,1);r[s]=n.join("")}var c=-1,l=0,u=0,d=-1,h=!1;for(s=0;s<o;s++)h?"0"===r[s]?u+=1:(h=!1,u>l&&(c=d,l=u)):"0"===r[s]&&(h=!0,d=s,u=1);u>l&&(c=d,l=u),l>1&&r.splice(c,l,""),i=r.length;var f="";for(""===r[0]&&(f=":"),s=0;s<i&&(f+=r[s],s!==i-1);s++)f+=":";return""===r[i-1]&&(f+=":"),f},noConflict:function(){return e.IPv6===this&&(e.IPv6=t),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){"use strict";e.exports?e.exports=s():void 0===(i="function"==typeof(r=s)?r.call(t,n,t,e):r)||(e.exports=i)}(0,(function(e){"use strict";var t=e&&e.SecondLevelDomains,n={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(e){var t=e.lastIndexOf(".");if(t<=0||t>=e.length-1)return!1;var r=e.lastIndexOf(".",t-1);if(r<=0||r>=t-1)return!1;var i=n.list[e.slice(t+1)];return!!i&&i.indexOf(" "+e.slice(r+1,t)+" ")>=0},is:function(e){var t=e.lastIndexOf(".");if(t<=0||t>=e.length-1)return!1;if(e.lastIndexOf(".",t-1)>=0)return!1;var r=n.list[e.slice(t+1)];return!!r&&r.indexOf(" "+e.slice(0,t)+" ")>=0},get:function(e){var t=e.lastIndexOf(".");if(t<=0||t>=e.length-1)return null;var r=e.lastIndexOf(".",t-1);if(r<=0||r>=t-1)return null;var i=n.list[e.slice(t+1)];return i?i.indexOf(" "+e.slice(r+1,t)+" ")<0?null:e.slice(r+1):null},noConflict:function(){return e.SecondLevelDomains===this&&(e.SecondLevelDomains=t),this}};return n}))},function(e,t,n){"use strict";var r=n(9),i=n(1);i.d.Websocket=class{constructor(e){this._conn=e,this.strip="wrapper";const t=e.service;if(0!==t.indexOf("ws:")&&0!==t.indexOf("wss:")){let n="";"ws"===e.options.protocol&&"https:"!==window.location.protocol?n+="ws":n+="wss",n+="://"+window.location.host,0!==t.indexOf("/")?n+=window.location.pathname+t:n+=t,e.service=n}}_buildStream(){return Object(i.a)("open",{xmlns:i.d.NS.FRAMING,to:this._conn.domain,version:"1.0"})}_checkStreamError(e,t){let n;if(n=e.getElementsByTagNameNS?e.getElementsByTagNameNS(i.d.NS.STREAM,"error"):e.getElementsByTagName("stream:error"),0===n.length)return!1;const r=n[0];let o="",s="";for(let e=0;e<r.childNodes.length;e++){const t=r.childNodes[e];if("urn:ietf:params:xml:ns:xmpp-streams"!==t.getAttribute("xmlns"))break;"text"===t.nodeName?s=t.textContent:o=t.nodeName}let a="WebSocket stream error: ";return a+=o||"unknown",s&&(a+=" - "+s),i.d.error(a),this._conn._changeConnectStatus(t,o),this._conn._doDisconnect(),!0}_reset(){}_connect(){this._closeSocket(),this.socket=new r.b(this._conn.service,"xmpp"),this.socket.onopen=()=>this._onOpen(),this.socket.onerror=e=>this._onError(e),this.socket.onclose=e=>this._onClose(e),this.socket.onmessage=e=>this._onInitialMessage(e)}_connect_cb(e){if(this._checkStreamError(e,i.d.Status.CONNFAIL))return i.d.Status.CONNFAIL}_handleStreamStart(e){let t=!1;const n=e.getAttribute("xmlns");"string"!=typeof n?t="Missing xmlns in <open />":n!==i.d.NS.FRAMING&&(t="Wrong xmlns in <open />: "+n);const r=e.getAttribute("version");return"string"!=typeof r?t="Missing version in <open />":"1.0"!==r&&(t="Wrong version in <open />: "+r),!t||(this._conn._changeConnectStatus(i.d.Status.CONNFAIL,t),this._conn._doDisconnect(),!1)}_onInitialMessage(e){if(0===e.data.indexOf("<open ")||0===e.data.indexOf("<?xml")){const t=e.data.replace(/^(<\?.*?\?>\s*)*/,"");if(""===t)return;const n=(new r.a).parseFromString(t,"text/xml").documentElement;this._conn.xmlInput(n),this._conn.rawInput(e.data),this._handleStreamStart(n)&&this._connect_cb(n)}else if(0===e.data.indexOf("<close ")){const t=(new r.a).parseFromString(e.data,"text/xml").documentElement;this._conn.xmlInput(t),this._conn.rawInput(e.data);const n=t.getAttribute("see-other-uri");if(n){const e=this._conn.service;(e.indexOf("wss:")>=0&&n.indexOf("wss:")>=0||e.indexOf("ws:")>=0)&&(this._conn._changeConnectStatus(i.d.Status.REDIRECT,"Received see-other-uri, resetting connection"),this._conn.reset(),this._conn.service=n,this._connect())}else this._conn._changeConnectStatus(i.d.Status.CONNFAIL,"Received closing stream"),this._conn._doDisconnect()}else{this._replaceMessageHandler();const t=this._streamWrap(e.data),n=(new r.a).parseFromString(t,"text/xml").documentElement;this._conn._connect_cb(n,null,e.data)}}_replaceMessageHandler(){this.socket.onmessage=e=>this._onMessage(e)}_disconnect(e){if(this.socket&&this.socket.readyState!==r.b.CLOSED){e&&this._conn.send(e);const t=Object(i.a)("close",{xmlns:i.d.NS.FRAMING});this._conn.xmlOutput(t.tree());const n=i.d.serialize(t);this._conn.rawOutput(n);try{this.socket.send(n)}catch(e){i.d.warn("Couldn't send <close /> tag.")}}setTimeout(()=>this._conn._doDisconnect,0)}_doDisconnect(){i.d.debug("WebSockets _doDisconnect was called"),this._closeSocket()}_streamWrap(e){return"<wrapper>"+e+"</wrapper>"}_closeSocket(){if(this.socket)try{this.socket.onclose=null,this.socket.onerror=null,this.socket.onmessage=null,this.socket.close()}catch(e){i.d.debug(e.message)}this.socket=null}_emptyQueue(){return!0}_onClose(e){this._conn.connected&&!this._conn.disconnecting?(i.d.error("Websocket closed unexpectedly"),this._conn._doDisconnect()):e&&1006===e.code&&!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(e){i.d.error("Server did not offer a supported authentication mechanism"),this._conn._changeConnectStatus(i.d.Status.CONNFAIL,i.d.ErrorCondition.NO_AUTH_MECH),e&&e.call(this._conn),this._conn._doDisconnect()}_onDisconnectTimeout(){}_abortAllRequests(){}_onError(e){i.d.error("Websocket error "+e),this._conn._changeConnectStatus(i.d.Status.CONNFAIL,"The WebSocket connection could not be established or was disconnected."),this._disconnect()}_onIdle(){const e=this._conn._data;if(e.length>0&&!this._conn.paused){for(let t=0;t<e.length;t++)if(null!==e[t]){let n;n="restart"===e[t]?this._buildStream().tree():e[t];const r=i.d.serialize(n);this._conn.xmlOutput(n),this._conn.rawOutput(r),this.socket.send(r)}this._conn._data=[]}}_onMessage(e){let t;const n='<close xmlns="urn:ietf:params:xml:ns:xmpp-framing" />';if(e.data===n)return this._conn.rawInput(n),this._conn.xmlInput(e),void(this._conn.disconnecting||this._conn._doDisconnect());if(0===e.data.search("<open ")){if(t=(new r.a).parseFromString(e.data,"text/xml").documentElement,!this._handleStreamStart(t))return}else{const n=this._streamWrap(e.data);t=(new r.a).parseFromString(n,"text/xml").documentElement}return this._checkStreamError(t,i.d.Status.ERROR)?void 0:this._conn.disconnecting&&"presence"===t.firstChild.nodeName&&"unavailable"===t.firstChild.getAttribute("type")?(this._conn.xmlInput(t),void this._conn.rawInput(i.d.serialize(t))):void this._conn._dataRecv(t,e.data)}_onOpen(){i.d.debug("Websocket open");const e=this._buildStream();this._conn.xmlOutput(e.tree());const t=i.d.serialize(e);this._conn.rawOutput(t),this.socket.send(t)}_reqToData(e){return e}_send(){this._conn.flush()}_sendRestart(){clearTimeout(this._conn._idleTimeout),this._conn._onIdle.bind(this._conn)()}}},function(e,t,n){"use strict";t.a=function(){return!1}},function(e,t,n){"use strict";(function(e){var r=n(5),i="object"==typeof exports&&exports&&!exports.nodeType&&exports,o=i&&"object"==typeof e&&e&&!e.nodeType&&e,s=o&&o.exports===i?r.a.Buffer:void 0,a=s?s.allocUnsafe:void 0;t.a=function(e,t){if(t)return e.slice();var n=e.length,r=a?a(n):new e.constructor(n);return e.copy(r),r}}).call(this,n(69)(e))},function(e,t,n){e.exports=function(){"use strict";return function(e,t,n){var r=t.prototype,i=r.format;n.en.ordinal=function(e){var t=["th","st","nd","rd"],n=e%100;return"["+e+(t[(n-20)%10]||t[n]||t[0])+"]"},r.format=function(e){var t=this,n=this.$locale(),r=this.$utils(),o=(e||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|gggg|Do|X|x|k{1,2}|S/g,(function(e){switch(e){case"Q":return Math.ceil((t.$M+1)/3);case"Do":return n.ordinal(t.$D);case"gggg":return t.weekYear();case"wo":return n.ordinal(t.week(),"W");case"w":case"ww":return r.s(t.week(),"w"===e?1:2,"0");case"k":case"kk":return r.s(String(0===t.$H?24:t.$H),"k"===e?1:2,"0");case"X":return Math.floor(t.$d.getTime()/1e3);case"x":return t.$d.getTime();default:return e}}));return i.bind(this)(o)}}}()},function(e,t,n){var r=n(332),i=n(70);e.exports=function(e,t,n){var o=null==e?0:e.length;return o?(t=n||void 0===t?1:i(t),r(e,t<0?0:t,o)):[]}},function(e,t,n){var r=n(24),i=n(22);e.exports=function(e){return!0===e||!1===e||i(e)&&"[object Boolean]"==r(e)}},function(e,t){e.exports=function(e){return null==e}},function(e,t,n){var r=n(73),i=n(385),o=n(438),s=n(440);e.exports=function(e,t){if(null==e)return{};var n=r(s(e),(function(e){return[e]}));return t=i(t),o(e,n,(function(e,n){return t(e,n[0])}))}},function(e,t,n){var r=n(102),i=n(134),o=n(29),s=n(114),a=n(443);e.exports=function(e){if(null==e)return 0;if(o(e))return s(e)?a(e):e.length;var t=i(e);return"[object Map]"==t||"[object Set]"==t?e.size:r(e).length}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(139),o=(r=i)&&r.__esModule?r:{default:r};t.default=(0,o.default)("webExtensionSyncStorage","sync")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(139),o=(r=i)&&r.__esModule?r:{default:r};t.default=(0,o.default)("webExtensionLocalStorage","local")},function(e,t,n){"use strict";(function(t){!function(t){var n=/^(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(e){var t,o,s,a,c,l,u,d,h,f,p,g,m,v,_,b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},y=[],w=0,S=void 0,x=void 0;if(isNaN(e))throw new TypeError("Invalid number");return o=!0===b.bits,p=!0===b.unix,t=b.base||2,f=void 0!==b.round?b.round:p?1:2,l=void 0!==b.locale?b.locale:"",u=b.localeOptions||{},g=void 0!==b.separator?b.separator:"",m=void 0!==b.spacer?b.spacer:p?"":" ",_=b.symbols||{},v=2===t&&b.standard||"jedec",h=b.output||"string",a=!0===b.fullform,c=b.fullforms instanceof Array?b.fullforms:[],S=void 0!==b.exponent?b.exponent:-1,s=2<t?1e3:1024,(d=(x=Number(e))<0)&&(x=-x),(-1===S||isNaN(S))&&(S=Math.floor(Math.log(x)/Math.log(s)))<0&&(S=0),8<S&&(S=8),"exponent"===h?S:(0===x?(y[0]=0,y[1]=p?"":r[v][o?"bits":"bytes"][S]):(w=x/(2===t?Math.pow(2,10*S):Math.pow(1e3,S)),o&&s<=(w*=8)&&S<8&&(w/=s,S++),y[0]=Number(w.toFixed(0<S?f:0)),y[0]===s&&S<8&&void 0===b.exponent&&(y[0]=1,S++),y[1]=10===t&&1===S?o?"kb":"kB":r[v][o?"bits":"bytes"][S],p&&(y[1]="jedec"===v?y[1].charAt(0):0<S?y[1].replace(/B$/,""):y[1],n.test(y[1])&&(y[0]=Math.floor(y[0]),y[1]=""))),d&&(y[0]=-y[0]),y[1]=_[y[1]]||y[1],!0===l?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)),"array"===h?y:(a&&(y[1]=c[S]?c[S]:i[v][S]+(o?"bit":"byte")+(1===y[0]?"":"s")),"object"===h?{value:y[0],symbol:y[1],exponent:S}:y.join(m)))}o.partial=function(e){return function(t){return o(t,e)}},e.exports=o}("undefined"!=typeof window&&window)}).call(this,n(12))},function(e,t,n){var r={escape:n(8)};e.exports=function(e){var t="",n=r.escape;Array.prototype.join;return t+="\x3c!-- src/templates/form_captcha.html --\x3e\n",e.label&&(t+="\n<label>\n "+n(e.label)+"\n</label>\n"),t+='\n<img src="data:'+n(e.type)+";base64,"+n(e.data)+'">\n<input name="'+n(e.name)+'" type="text" ',e.required&&(t+=' required="required" '),t+=" />\n\n\n"}},function(e,t,n){var r={escape:n(8)};e.exports=function(e){var t="",n=r.escape;Array.prototype.join;return t+='\x3c!-- src/templates/form_checkbox.html --\x3e\n<div class="form-group">\n <input id="'+n(e.id)+'" name="'+n(e.name)+'" type="checkbox" '+n(e.checked)+" ",e.required&&(t+=" required "),t+=' />\n <label class="form-check-label" for="'+n(e.id)+'">'+n(e.label)+"</label>\n</div>\n"}},function(e,t,n){var r={escape:n(8)};e.exports=function(e){var t,n="",i=r.escape;Array.prototype.join;return n+='\x3c!-- src/templates/form_select.html --\x3e\n<div class="form-group">\n <label for="'+i(e.id)+'">'+i(e.label)+'</label>\n <select class="form-control" id="'+i(e.id)+'" name="'+i(e.name)+'" ',e.multiple&&(n+=' multiple="multiple" '),n+=">"+(null==(t=e.options)?"":t)+"</select>\n</div>\n"}},function(e,t,n){var r={escape:n(8)};e.exports=function(e){var t="",n=r.escape;return t+='\x3c!-- src/templates/form_textarea.html --\x3e\n<label class="label-ta">'+n(e.label)+'</label>\n<textarea name="'+n(e.name)+'">'+n(e.value)+"</textarea>\n"}},function(e,t,n){var r={escape:n(8)};e.exports=function(e){var t="",n=r.escape;return t+="\x3c!-- src/templates/form_url.html --\x3e\n<label>\n "+n(e.label)+'\n <a class="form-url" target="_blank" rel="noopener" href="'+n(e.value)+'">'+n(e.value)+"</a>\n</label>\n"}},function(e,t,n){var r={escape:n(8)};e.exports=function(e){var t="",n=r.escape;Array.prototype.join;return t+='\x3c!-- src/templates/select_option.html --\x3e\n<option value="'+n(e.value)+'" ',e.selected&&(t+=' selected="selected" '),t+=" >"+n(e.label)+"</option>\n"}},function(e,t,n){"use strict";(function(t){!function(t){var n=/^(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(e){var t,o,s,a,c,l,u,d,h,f,p,g,m,v,_,b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},y=[],w=0,S=void 0,x=void 0;if(isNaN(e))throw new TypeError("Invalid number");return o=!0===b.bits,p=!0===b.unix,t=b.base||2,f=void 0!==b.round?b.round:p?1:2,l=void 0!==b.locale?b.locale:"",u=b.localeOptions||{},g=void 0!==b.separator?b.separator:"",m=void 0!==b.spacer?b.spacer:p?"":" ",_=b.symbols||{},v=2===t&&b.standard||"jedec",h=b.output||"string",a=!0===b.fullform,c=b.fullforms instanceof Array?b.fullforms:[],S=void 0!==b.exponent?b.exponent:-1,s=2<t?1e3:1024,(d=(x=Number(e))<0)&&(x=-x),(-1===S||isNaN(S))&&(S=Math.floor(Math.log(x)/Math.log(s)))<0&&(S=0),8<S&&(S=8),"exponent"===h?S:(0===x?(y[0]=0,y[1]=p?"":r[v][o?"bits":"bytes"][S]):(w=x/(2===t?Math.pow(2,10*S):Math.pow(1e3,S)),o&&s<=(w*=8)&&S<8&&(w/=s,S++),y[0]=Number(w.toFixed(0<S?f:0)),y[0]===s&&S<8&&void 0===b.exponent&&(y[0]=1,S++),y[1]=10===t&&1===S?o?"kb":"kB":r[v][o?"bits":"bytes"][S],p&&(y[1]="jedec"===v?y[1].charAt(0):0<S?y[1].replace(/B$/,""):y[1],n.test(y[1])&&(y[0]=Math.floor(y[0]),y[1]=""))),d&&(y[0]=-y[0]),y[1]=_[y[1]]||y[1],!0===l?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)),"array"===h?y:(a&&(y[1]=c[S]?c[S]:i[v][S]+(o?"bit":"byte")+(1===y[0]?"":"s")),"object"===h?{value:y[0],symbol:y[1],exponent:S}:y.join(m)))}o.partial=function(e){return function(t){return o(t,e)}},e.exports=o}("undefined"!=typeof window&&window)}).call(this,n(12))},function(e,t,n){var r={escape:n(8)};e.exports=function(e){var t="";return t+='\x3c!-- src/templates/controlbox_toggle.html --\x3e\n<span class="toggle-feedback">'+(0,r.escape)(e.label_toggle)+"</span>\n"}},function(e,t,n){n(8);e.exports=function(e){return'\x3c!-- src/templates/dragresize.html --\x3e\n<div class="dragresize dragresize-top"></div>\n<div class="dragresize dragresize-topleft"></div>\n<div class="dragresize dragresize-left"></div>\n','\x3c!-- src/templates/dragresize.html --\x3e\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(e){var t="",n=r.escape;Array.prototype.join;return t+='\x3c!-- src/templates/room_description.html --\x3e\n\x3c!-- FIXME: check markup in mockup --\x3e\n<div class="room-info">\n<p class="room-info"><strong>'+n(e.label_jid)+"</strong> "+n(e.jid)+'</p>\n<p class="room-info"><strong>'+n(e.label_desc)+"</strong> "+n(e.desc)+'</p>\n<p class="room-info"><strong>'+n(e.label_occ)+"</strong> "+n(e.occ)+'</p>\n<p class="room-info"><strong>'+n(e.label_features)+"</strong>\n <ul>\n ",e.passwordprotected&&(t+='\n <li class="room-info locked">'+n(e.label_requires_auth)+"</li>\n "),t+="\n ",e.hidden&&(t+='\n <li class="room-info">'+n(e.label_hidden)+"</li>\n "),t+="\n ",e.membersonly&&(t+='\n <li class="room-info">'+n(e.label_requires_invite)+"</li>\n "),t+="\n ",e.moderated&&(t+='\n <li class="room-info">'+n(e.label_moderated)+"</li>\n "),t+="\n ",e.nonanonymous&&(t+='\n <li class="room-info">'+n(e.label_non_anon)+"</li>\n "),t+="\n ",e.open&&(t+='\n <li class="room-info">'+n(e.label_open_room)+"</li>\n "),t+="\n ",e.persistent&&(t+='\n <li class="room-info">'+n(e.label_permanent_room)+"</li>\n "),t+="\n ",e.publicroom&&(t+='\n <li class="room-info">'+n(e.label_public)+"</li>\n "),t+="\n ",e.semianonymous&&(t+='\n <li class="room-info">'+n(e.label_semi_anon)+"</li>\n "),t+="\n ",e.temporary&&(t+='\n <li class="room-info">'+n(e.label_temp_room)+"</li>\n "),t+="\n ",e.unmoderated&&(t+='\n <li class="room-info">'+n(e.label_unmoderated)+"</li>\n "),t+="\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(e){"use strict";e=e||{};var t,n,r,i,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:!1,element:null,dataUrl:!1,win:window};(h={}).ff="undefined"!=typeof InstallTrigger,h.chrome=!!window.chrome,h.opera=!!window.opera||navigator.userAgent.indexOf("Opera")>=0,h.ie=/*@cc_on!@*/!1,h.safari=Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0,h.supported=h.chrome||h.ff||h.opera;var m=[];d=function(){},c=!1;var v={ready:function(){c=!0,v.reset(),d()},reset:function(){c&&(m=[],l=!1,u=!1,s.clearRect(0,0,i,r),s.drawImage(a,0,0,i,r),y.setIcon(o),window.clearTimeout(f),window.clearTimeout(void 0))},start:function(){if(c&&!u&&m.length>0){u=!0;var e=function(){["type","animation","bgColor","textColor","fontFamily","fontStyle"].forEach((function(e){e in m[0].options&&(t[e]=m[0].options[e])})),x.run(m[0].options,(function(){l=m[0],u=!1,m.length>0&&(m.shift(),v.start())}),!1)};l?x.run(l.options,(function(){e()}),!0):e()}}},_={},b=function(e){return e.n="number"==typeof e.n?Math.abs(0|e.n):e.n,e.x=i*e.x,e.y=r*e.y,e.w=i*e.w,e.h=r*e.h,e.len=(""+e.n).length,e};_.circle=function(e){var n=!1;2===(e=b(e)).len?(e.x=e.x-.4*e.w,e.w=1.4*e.w,n=!0):e.len>=3&&(e.x=e.x-.65*e.w,e.w=1.65*e.w,n=!0),s.clearRect(0,0,i,r),s.drawImage(a,0,0,i,r),s.beginPath(),s.font=t.fontStyle+" "+Math.floor(e.h*(e.n>99?.85:1))+"px "+t.fontFamily,s.textAlign="center",n?(s.moveTo(e.x+e.w/2,e.y),s.lineTo(e.x+e.w-e.h/2,e.y),s.quadraticCurveTo(e.x+e.w,e.y,e.x+e.w,e.y+e.h/2),s.lineTo(e.x+e.w,e.y+e.h-e.h/2),s.quadraticCurveTo(e.x+e.w,e.y+e.h,e.x+e.w-e.h/2,e.y+e.h),s.lineTo(e.x+e.h/2,e.y+e.h),s.quadraticCurveTo(e.x,e.y+e.h,e.x,e.y+e.h-e.h/2),s.lineTo(e.x,e.y+e.h/2),s.quadraticCurveTo(e.x,e.y,e.x+e.h/2,e.y)):s.arc(e.x+e.w/2,e.y+e.h/2,e.h/2,0,2*Math.PI),s.fillStyle="rgba("+t.bgColor.r+","+t.bgColor.g+","+t.bgColor.b+","+e.o+")",s.fill(),s.closePath(),s.beginPath(),s.stroke(),s.fillStyle="rgba("+t.textColor.r+","+t.textColor.g+","+t.textColor.b+","+e.o+")","number"==typeof e.n&&e.n>999?s.fillText((e.n>9999?9:Math.floor(e.n/1e3))+"k+",Math.floor(e.x+e.w/2),Math.floor(e.y+e.h-.2*e.h)):s.fillText(e.n,Math.floor(e.x+e.w/2),Math.floor(e.y+e.h-.15*e.h)),s.closePath()},_.rectangle=function(e){2===(e=b(e)).len?(e.x=e.x-.4*e.w,e.w=1.4*e.w):e.len>=3&&(e.x=e.x-.65*e.w,e.w=1.65*e.w),s.clearRect(0,0,i,r),s.drawImage(a,0,0,i,r),s.beginPath(),s.font=t.fontStyle+" "+Math.floor(e.h*(e.n>99?.9:1))+"px "+t.fontFamily,s.textAlign="center",s.fillStyle="rgba("+t.bgColor.r+","+t.bgColor.g+","+t.bgColor.b+","+e.o+")",s.fillRect(e.x,e.y,e.w,e.h),s.fillStyle="rgba("+t.textColor.r+","+t.textColor.g+","+t.textColor.b+","+e.o+")","number"==typeof e.n&&e.n>999?s.fillText((e.n>9999?9:Math.floor(e.n/1e3))+"k+",Math.floor(e.x+e.w/2),Math.floor(e.y+e.h-.2*e.h)):s.fillText(e.n,Math.floor(e.x+e.w/2),Math.floor(e.y+e.h-.15*e.h)),s.closePath()};var y={};function w(e){e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(e,t,n,r){return t+t+n+n+r+r}));var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return!!t&&{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}}function S(e,t){var n,r={};for(n in e)r[n]=e[n];for(n in t)r[n]=t[n];return r}y.getIcons=function(){var e=[];return t.element?e=[t.element]:t.elementId?(e=[p.getElementById(t.elementId)])[0].setAttribute("href",e[0].getAttribute("src")):0===(e=function(){for(var e=[],t=p.getElementsByTagName("head")[0].getElementsByTagName("link"),n=0;n<t.length;n++)/(^|\s)icon(\s|$)/i.test(t[n].getAttribute("rel"))&&e.push(t[n]);return e}()).length&&((e=[p.createElement("link")])[0].setAttribute("rel","icon"),p.getElementsByTagName("head")[0].appendChild(e[0])),e.forEach((function(e){e.setAttribute("type","image/png")})),e},y.setIcon=function(e){var t=e.toDataURL("image/png");y.setIconSrc(t)},y.setIconSrc=function(e){if(t.dataUrl&&t.dataUrl(e),t.element)t.element.setAttribute("href",e),t.element.setAttribute("src",e);else if(t.elementId){var r=p.getElementById(t.elementId);r.setAttribute("href",e),r.setAttribute("src",e)}else if(h.ff||h.opera){var i=n[n.length-1],o=p.createElement("link");n=[o],h.opera&&o.setAttribute("rel","icon"),o.setAttribute("rel","icon"),o.setAttribute("type","image/png"),p.getElementsByTagName("head")[0].appendChild(o),o.setAttribute("href",e),i.parentNode&&i.parentNode.removeChild(i)}else n.forEach((function(t){t.setAttribute("href",e)}))};var x={duration:40,types:{}};return x.types.fade=[{x:.4,y:.4,w:.6,h:.6,o:0},{x:.4,y:.4,w:.6,h:.6,o:.1},{x:.4,y:.4,w:.6,h:.6,o:.2},{x:.4,y:.4,w:.6,h:.6,o:.3},{x:.4,y:.4,w:.6,h:.6,o:.4},{x:.4,y:.4,w:.6,h:.6,o:.5},{x:.4,y:.4,w:.6,h:.6,o:.6},{x:.4,y:.4,w:.6,h:.6,o:.7},{x:.4,y:.4,w:.6,h:.6,o:.8},{x:.4,y:.4,w:.6,h:.6,o:.9},{x:.4,y:.4,w:.6,h:.6,o:1}],x.types.none=[{x:.4,y:.4,w:.6,h:.6,o:1}],x.types.pop=[{x:1,y:1,w:0,h:0,o:1},{x:.9,y:.9,w:.1,h:.1,o:1},{x:.8,y:.8,w:.2,h:.2,o:1},{x:.7,y:.7,w:.3,h:.3,o:1},{x:.6,y:.6,w:.4,h:.4,o:1},{x:.5,y:.5,w:.5,h:.5,o:1},{x:.4,y:.4,w:.6,h:.6,o:1}],x.types.popFade=[{x:.75,y:.75,w:0,h:0,o:0},{x:.65,y:.65,w:.1,h:.1,o:.2},{x:.6,y:.6,w:.2,h:.2,o:.4},{x:.55,y:.55,w:.3,h:.3,o:.6},{x:.5,y:.5,w:.4,h:.4,o:.8},{x:.45,y:.45,w:.5,h:.5,o:.9},{x:.4,y:.4,w:.6,h:.6,o:1}],x.types.slide=[{x:.4,y:1,w:.6,h:.6,o:1},{x:.4,y:.9,w:.6,h:.6,o:1},{x:.4,y:.9,w:.6,h:.6,o:1},{x:.4,y:.8,w:.6,h:.6,o:1},{x:.4,y:.7,w:.6,h:.6,o:1},{x:.4,y:.6,w:.6,h:.6,o:1},{x:.4,y:.5,w:.6,h:.6,o:1},{x:.4,y:.4,w:.6,h:.6,o:1}],x.run=function(e,n,r,i){var s=x.types[p.hidden||p.msHidden||p.webkitHidden||p.mozHidden?"none":t.animation];i=!0===r?void 0!==i?i:s.length-1:void 0!==i?i:0,n=n||function(){},i<s.length&&i>=0?(_[t.type](S(e,s[i])),f=setTimeout((function(){r?i-=1:i+=1,x.run(e,n,r,i)}),x.duration),y.setIcon(o)):n()},function(){(t=S(g,e)).bgColor=w(t.bgColor),t.textColor=w(t.textColor),t.position=t.position.toLowerCase(),t.animation=x.types[""+t.animation]?t.animation:g.animation,p=t.win.document;var c=t.position.indexOf("up")>-1,l=t.position.indexOf("left")>-1;if(c||l)for(var u in x.types)for(var d=0;d<x.types[u].length;d++){var h=x.types[u][d];c&&(h.y<.6?h.y=h.y-.4:h.y=h.y-2*h.y+(1-h.w)),l&&(h.x<.6?h.x=h.x-.4:h.x=h.x-2*h.x+(1-h.h)),x.types[u][d]=h}t.type=_[""+t.type]?t.type:g.type,n=y.getIcons(),o=document.createElement("canvas"),a=document.createElement("img");var f=n[n.length-1];f.hasAttribute("href")?(a.setAttribute("crossOrigin","anonymous"),a.onload=function(){r=a.height>0?a.height:32,i=a.width>0?a.width:32,o.height=r,o.width=i,s=o.getContext("2d"),v.ready()},a.setAttribute("src",f.getAttribute("href"))):(r=32,i=32,a.height=r,a.width=i,o.height=r,o.width=i,s=o.getContext("2d"),v.ready())}(),{badge:function(e,t){t=("string"==typeof t?{animation:t}:t)||{},d=function(){try{if("number"==typeof e?e>0:""!==e){var n={type:"badge",options:{n:e}};if("animation"in t&&x.types[""+t.animation]&&(n.options.animation=""+t.animation),"type"in t&&_[""+t.type]&&(n.options.type=""+t.type),["bgColor","textColor"].forEach((function(e){e in t&&(n.options[e]=w(t[e]))})),["fontStyle","fontFamily"].forEach((function(e){e in t&&(n.options[e]=t[e])})),m.push(n),m.length>100)throw new Error("Too many badges requests in queue.");v.start()}else v.reset()}catch(e){throw new Error("Error setting badge. Message: "+e.message)}},c&&d()},setOpt:function(e,n){var r=e;null==n&&"[object Object]"==Object.prototype.toString.call(e)||((r={})[e]=n);for(var i=Object.keys(r),o=0;o<i.length;o++)"bgColor"==i[o]||"textColor"==i[o]?t[i[o]]=w(r[i[o]]):t[i[o]]=r[i[o]];m.push(l),v.start()},reset:v.reset,browser:{supported:h.supported}}},void 0===(r=function(){return i}.apply(t,[]))||(e.exports=r)},function(e,t,n){var r={escape:n(8)};e.exports=function(e){var t="",n=r.escape;Array.prototype.join;return t+='\x3c!-- src/templates/register_panel.html --\x3e\n<div>\n <form id="converse-register" class="converse-form">\n <legend class="col-form-label">'+n(e.__("Create your account"))+'</legend>\n\n <div class="form-group">\n <label>'+n(e.__("Please enter the XMPP provider to register with:"))+'</label>\n <div class="form-errors hidden"></div>\n\n ',e.default_domain?t+="\n "+n(e.default_domain)+"\n </div>\n ":t+='\n <input class="form-control" required="required" type="text" name="domain" placeholder="'+n(e.domain_placeholder)+'"/>\n <p class="form-text text-muted">'+n(e.help_providers)+' <a href="'+n(e.href_providers)+'" class="url" target="_blank" rel="noopener">'+n(e.help_providers_link)+'</a>.</p>\n </div>\n <fieldset class="buttons">\n <input class="btn btn-primary" type="submit" value="'+n(e.label_register)+'"/>\n <div class="switch-form">\n <p>'+n(e.__("Already have a chat account?"))+'</p>\n <p><a class="login-here toggle-register-login" href="#converse/login">'+n(e.__("Log in here"))+"</a></p>\n </div>\n </fieldset>\n ",t+="\n \x3c!--</div>--\x3e\n </form>\n</div>\n"}},function(e,t,n){var r={escape:n(8)};e.exports=function(e){var t="",n=r.escape;Array.prototype.join;return t+='\x3c!-- src/templates/registration_form.html --\x3e\n<legend class="col-form-label">'+n(e.__("Account Registration:"))+" "+n(e.domain)+'</legend>\n<p class="title">'+n(e.title)+'</p>\n<p class="form-help instructions">'+n(e.instructions)+'</p>\n<div class="form-errors hidden"></div>\n\n<fieldset class="buttons">\n <input type="submit" class="btn btn-primary" value="'+n(e.__("Register"))+'"/>\n ',e.registration_domain||(t+='\n <input type="button" class="btn btn-secondary button-cancel" value="'+n(e.__("Choose a different provider"))+'"/>\n '),t+='\n <div class="switch-form">\n <p>'+n(e.__("Already have a chat account?"))+'</p>\n <p><a class="login-here toggle-register-login" href="#converse/login">'+n(e.__("Log in here"))+"</a></p>\n </div>\n</fieldset>\n"}},function(e,t,n){var r={escape:n(8)};e.exports=function(e){var t="",n=r.escape;Array.prototype.join;return t+='\x3c!-- src/templates/registration_request.html --\x3e\n<span class="spinner login-submit fa fa-spinner"></span>\n<p class="info">'+n(e.__("Hold tight, we're fetching the registration form…"))+"</p>\n",e.cancel&&(t+='\n <button class="btn btn-secondary button-cancel hor_centered">'+n(e.__("Cancel"))+"</button>\n"),t+="\n"}},function(e,t,n){var r={escape:n(8)};e.exports=function(e){var t="",n=r.escape;Array.prototype.join;return t+='\x3c!-- src/templates/group_header.html --\x3e\n<a href="#" class="list-toggle group-toggle controlbox-padded" title="'+n(e.desc_group_toggle)+'">\n <span class="fa ',e.toggle_state===e._converse.OPENED?t+=" fa-caret-down ":t+=" fa-caret-right ",t+='">\n </span> '+n(e.label_group)+'</a>\n<ul class="items-list roster-group-contacts ',e.toggle_state===e._converse.CLOSED&&(t+=" collapsed "),t+='"></ul>\n'}},function(e,t,n){var r={escape:n(8)};e.exports=function(e){var t="",n=r.escape;Array.prototype.join;return t+="\x3c!-- src/templates/pending_contact.html --\x3e\n",e.allow_chat_pending_contacts&&(t+='\n<a class="list-item-link open-chat w-100" href="#">\n'),t+='\n<span class="pending-contact-name" title="JID: '+n(e.jid)+'">'+n(e.display_name)+"</span> \n",e.allow_chat_pending_contacts&&(t+="</a>"),t+='\n<a class="list-item-action remove-xmpp-contact far fa-trash-alt" title="'+n(e.desc_remove)+'" href="#"></a>\n'}},function(e,t,n){var r={escape:n(8)};e.exports=function(e){var t="",n=r.escape;Array.prototype.join;return t+="\x3c!-- src/templates/requesting_contact.html --\x3e\n",e.allow_chat_pending_contacts&&(t+='\n<a class="open-chat w-100"href="#">\n'),t+='\n<span class="req-contact-name w-100" title="JID: '+n(e.jid)+'">'+n(e.display_name)+"</span>\n",e.allow_chat_pending_contacts&&(t+="\n</a>\n"),t+='\n<a class="accept-xmpp-request list-item-action list-item-action--visible fa fa-check"\n aria-label="'+n(e.desc_accept)+'" title="'+n(e.desc_accept)+'" href="#"></a>\n<a class="decline-xmpp-request list-item-action list-item-action--visible fa fa-times"\n aria-label="'+n(e.desc_decline)+'" title="'+n(e.desc_decline)+'" href="#"></a>\n'}},function(e,t,n){var r={escape:n(8)};e.exports=function(e){var t="",n=r.escape;Array.prototype.join;return t+='\x3c!-- src/templates/roster.html --\x3e\n<div class="d-flex controlbox-padded">\n <span class="w-100 controlbox-heading controlbox-heading--contacts">'+n(e.heading_contacts)+'</span>\n <a class="controlbox-heading__btn sync-contacts fa fa-sync" title="'+n(e.title_sync_contacts)+'"></a>\n ',e.allow_contact_requests&&(t+='\n <a class="controlbox-heading__btn add-contact fa fa-user-plus"\n title="'+n(e.title_add_contact)+'"\n data-toggle="modal"\n data-target="#add-contact-modal"></a>\n '),t+='\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(e){var t="",n=r.escape;Array.prototype.join;return t+='\x3c!-- src/templates/roster_item.html --\x3e\n<a class="list-item-link cbox-list-item open-chat w-100 ',e.num_unread&&(t+=" unread-msgs "),t+='"\n title="'+n(e.desc_chat)+'" href="#">\n\n <canvas class="avatar" height="30" width="30"></canvas>\n <span class="'+n(e.status_icon)+'" title="'+n(e.desc_status)+'"></span>\n ',e.num_unread&&(t+=' <span class="msgs-indicator">'+n(e.num_unread)+"</span> "),t+='\n <span class="contact-name contact-name--'+n(e.show)+" ",e.num_unread&&(t+=" unread-msgs "),t+='">'+n(e.display_name)+"</span>\n</a>\n",e.allow_contact_removal&&(t+='\n<a class="list-item-action remove-xmpp-contact far fa-trash-alt" title="'+n(e.desc_remove)+'" href="#"></a>\n'),t+="\n"}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.r(t);const r={},i={plugins:{add(e,t){if(void 0!==r[e])throw new TypeError('Error: plugin with name "'.concat(e,'" has already been ')+"registered!");r[e]=t}},initialize(e={}){i.load(e).initialize(e)},load:(e={})=>(e.assets_path&&(n.p=e.assets_path),n(506),Object.keys(r).forEach(e=>i.plugins.add(e,r[e])),i)};window.converse=i,t.default=i},function(e,t){function n(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};const n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}"function"!=typeof window.CustomEvent&&(n.prototype=window.Event.prototype,window.CustomEvent=n),String.prototype.includes||(String.prototype.includes=function(e,t){"use strict";return"number"!=typeof t&&(t=0),!(t+e.length>this.length)&&-1!==this.indexOf(e,t)}),String.prototype.endsWith||(String.prototype.endsWith=function(e,t){const n=this.toString();(void 0===t||t>n.length)&&(t=n.length),t-=e.length;const r=n.indexOf(e,t);return-1!==r&&r===t}),String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return t=t||0,this.substr(t,e.length)===e}),String.prototype.splitOnce||(String.prototype.splitOnce=function(e){const t=this.split(e);return[t.shift(),t.join(e)]}),String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")})},function(e,t,n){"use strict";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(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function a(e,t,n,r,i,o){for(var s,a=++t,c=0;;){var l=e.charAt(a);switch(l){case"=":if(1===c)s=e.slice(t,a),c=3;else{if(2!==c)throw new Error("attribute equal must after attrName");c=3}break;case"'":case'"':if(3===c||1===c){if(1===c&&(o.warning('attribute value must after "="'),s=e.slice(t,a)),t=a+1,!((a=e.indexOf(l,t))>0))throw new Error("attribute value no end '"+l+"' match");u=e.slice(t,a).replace(/&#?\w+;/g,i),n.add(s,u,t-1),c=5}else{if(4!=c)throw new Error('attribute value must after "="');u=e.slice(t,a).replace(/&#?\w+;/g,i),n.add(s,u,t),o.warning('attribute "'+s+'" missed start quot('+l+")!!"),t=a+1,c=5}break;case"/":switch(c){case 0:n.setTagName(e.slice(t,a));case 5:case 6:case 7:c=7,n.closed=!0;case 4:case 1:case 2:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return o.error("unexpected end of input"),0==c&&n.setTagName(e.slice(t,a)),a;case">":switch(c){case 0:n.setTagName(e.slice(t,a));case 5:case 6:case 7:break;case 4:case 1:"/"===(u=e.slice(t,a)).slice(-1)&&(n.closed=!0,u=u.slice(0,-1));case 2:2===c&&(u=s),4==c?(o.warning('attribute "'+u+'" missed quot(")!!'),n.add(s,u.replace(/&#?\w+;/g,i),t)):("http://www.w3.org/1999/xhtml"===r[""]&&u.match(/^(?:disabled|checked|selected)$/i)||o.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),n.add(u,u,t));break;case 3:throw new Error("attribute value missed!!")}return a;case"€":l=" ";default:if(l<=" ")switch(c){case 0:n.setTagName(e.slice(t,a)),c=6;break;case 1:s=e.slice(t,a),c=2;break;case 4:var u=e.slice(t,a).replace(/&#?\w+;/g,i);o.warning('attribute "'+u+'" missed quot(")!!'),n.add(s,u,t);case 5:c=6}else switch(c){case 2:n.tagName;"http://www.w3.org/1999/xhtml"===r[""]&&s.match(/^(?:disabled|checked|selected)$/i)||o.warning('attribute "'+s+'" missed value!! "'+s+'" instead2!!'),n.add(s,s,t),t=a,c=1;break;case 5:o.warning('attribute space is required"'+s+'"!!');case 6:c=1,t=a;break;case 3:c=4,t=a;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}a++}}function c(e,t,n){for(var r=e.tagName,i=null,o=e.length;o--;){var s=e[o],a=s.qName,c=s.value;if((f=a.indexOf(":"))>0)var l=s.prefix=a.slice(0,f),u=a.slice(f+1),h="xmlns"===l&&u;else u=a,l=null,h="xmlns"===a&&"";s.localName=u,!1!==h&&(null==i&&(i={},d(n,n={})),n[h]=i[h]=c,s.uri="http://www.w3.org/2000/xmlns/",t.startPrefixMapping(h,c))}for(o=e.length;o--;){(l=(s=e[o]).prefix)&&("xml"===l&&(s.uri="http://www.w3.org/XML/1998/namespace"),"xmlns"!==l&&(s.uri=n[l||""]))}var f;(f=r.indexOf(":"))>0?(l=e.prefix=r.slice(0,f),u=e.localName=r.slice(f+1)):(l=null,u=e.localName=r);var p=e.uri=n[l||""];if(t.startElement(p,u,r,e),!e.closed)return e.currentNSMap=n,e.localNSMap=i,!0;if(t.endElement(p,u,r),i)for(l in i)t.endPrefixMapping(l)}function l(e,t,n,r,i){if(/^(?:script|textarea)$/i.test(n)){var o=e.indexOf("</"+n+">",t),s=e.substring(t+1,o);if(/[&<]/.test(s))return/^script$/i.test(n)?(i.characters(s,0,s.length),o):(s=s.replace(/&#?\w+;/g,r),i.characters(s,0,s.length),o)}return t+1}function u(e,t,n,r){var i=r[n];return null==i&&((i=e.lastIndexOf("</"+n+">"))<t&&(i=e.lastIndexOf("</"+n)),r[n]=i),i<t}function d(e,t){for(var n in e)t[n]=e[n]}function h(e,t,n,r){switch(e.charAt(t+2)){case"-":return"-"===e.charAt(t+3)?(i=e.indexOf("--\x3e",t+4))>t?(n.comment(e,t+4,i-t-4),i+3):(r.error("Unclosed comment"),-1):-1;default:if("CDATA["==e.substr(t+3,6)){var i=e.indexOf("]]>",t+9);return n.startCDATA(),n.characters(e,t+9,i-t-9),n.endCDATA(),i+3}var o=function(e,t){var n,r=[],i=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;i.lastIndex=t,i.exec(e);for(;n=i.exec(e);)if(r.push(n),n[1])return r}(e,t),s=o.length;if(s>1&&/!doctype/i.test(o[0][0])){var a=o[1][0],c=s>3&&/^public$/i.test(o[2][0])&&o[3][0],l=s>4&&o[4][0],u=o[s-1];return n.startDTD(a,c&&c.replace(/^(['"])(.*?)\1$/,"$2"),l&&l.replace(/^(['"])(.*?)\1$/,"$2")),n.endDTD(),u.index+u[0].length}}return-1}function f(e,t,n){var r=e.indexOf("?>",t);if(r){var i=e.substring(t,r).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(i){i[0].length;return n.processingInstruction(i[1],i[2]),r+2}return-1}return-1}function p(e){}function g(e,t){return e.__proto__=t,e}o.prototype={parse:function(e,t,n){var r=this.domBuilder;r.startDocument(),d(t,t={}),function(e,t,n,r,i){function o(e){var t=e.slice(1,-1);return t in n?n[t]:"#"===t.charAt(0)?function(e){if(e>65535){var t=55296+((e-=65536)>>10),n=56320+(1023&e);return String.fromCharCode(t,n)}return String.fromCharCode(e)}(parseInt(t.substr(1).replace("x","0x"))):(i.error("entity not found:"+e),e)}function d(t){if(t>S){var n=e.substring(S,t).replace(/&#?\w+;/g,o);b&&g(S),r.characters(n,0,t-S),S=t}}function g(t,n){for(;t>=v&&(n=_.exec(e));)m=n.index,v=m+n[0].length,b.lineNumber++;b.columnNumber=t-m+1}var m=0,v=0,_=/.*(?:\r\n?|\n)|.*$/g,b=r.locator,y=[{currentNSMap:t}],w={},S=0;for(;;){try{var x=e.indexOf("<",S);if(x<0){if(!e.substr(S).match(/^\s*$/)){var E=r.doc,A=E.createTextNode(e.substr(S));E.appendChild(A),r.currentElement=A}return}switch(x>S&&d(x),e.charAt(x+1)){case"/":var C=e.indexOf(">",x+3),j=e.substring(x+2,C),O=y.pop();C<0?(j=e.substring(x+2).replace(/[\s<].*/,""),i.error("end tag name: "+j+" is not complete:"+O.tagName),C=x+1+j.length):j.match(/\s</)&&(j=j.replace(/[\s<].*/,""),i.error("end tag name: "+j+" maybe not complete"),C=x+1+j.length);var T=O.localNSMap,k=O.tagName==j;if(k||O.tagName&&O.tagName.toLowerCase()==j.toLowerCase()){if(r.endElement(O.uri,O.localName,j),T)for(var N in T)r.endPrefixMapping(N);k||i.fatalError("end tag name: "+j+" is not match the current start tagName:"+O.tagName)}else y.push(O);C++;break;case"?":b&&g(x),C=f(e,x,r);break;case"!":b&&g(x),C=h(e,x,r,i);break;default:b&&g(x);var I=new p,M=y[y.length-1].currentNSMap,R=(C=a(e,x,I,M,o,i),I.length);if(!I.closed&&u(e,C,I.tagName,w)&&(I.closed=!0,n.nbsp||i.warning("unclosed xml attribute")),b&&R){for(var D=s(b,{}),P=0;P<R;P++){var L=I[P];g(L.offset),L.locator=s(b,{})}r.locator=D,c(I,r,M)&&y.push(I),r.locator=b}else c(I,r,M)&&y.push(I);"http://www.w3.org/1999/xhtml"!==I.uri||I.closed?C++:C=l(e,C,I.tagName,o,r)}}catch(e){i.error("element parse error: "+e),C=-1}C>S?S=C:d(Math.max(x,S)+1)}}(e,t,n,r,this.errorHandler),r.endDocument()}},p.prototype={setTagName:function(e){if(!i.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},add:function(e,t,n){if(!i.test(e))throw new Error("invalid attribute:"+e);this[this.length++]={qName:e,value:t,offset:n}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},g({},g.prototype)instanceof g||(g=function(e,t){function n(){}for(t in n.prototype=t,n=new n,e)n[t]=e[t];return n}),t.XMLReader=o},function(e,t,n){"use strict";function r(e){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e);return t<0?void 0:t}e.exports=function(e){if((e=(e=""+e).replace(/[ \t\n\f\r]/g,"")).length%4==0&&(e=e.replace(/==?$/,"")),e.length%4==1||/[^+/0-9A-Za-z]/.test(e))return null;let t="",n=0,i=0;for(let o=0;o<e.length;o++)n<<=6,n|=r(e[o]),i+=6,24===i&&(t+=String.fromCharCode((16711680&n)>>16),t+=String.fromCharCode((65280&n)>>8),t+=String.fromCharCode(255&n),n=i=0);return 12===i?(n>>=4,t+=String.fromCharCode(n)):18===i&&(n>>=2,t+=String.fromCharCode((65280&n)>>8),t+=String.fromCharCode(255&n)),t}},function(e,t,n){"use strict";function r(e){if(e>=0&&e<64)return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[e]}e.exports=function(e){let t;for(e=""+e,t=0;t<e.length;t++)if(e.charCodeAt(t)>255)return null;let n="";for(t=0;t<e.length;t+=3){const i=[void 0,void 0,void 0,void 0];i[0]=e.charCodeAt(t)>>2,i[1]=(3&e.charCodeAt(t))<<4,e.length>t+1&&(i[1]|=e.charCodeAt(t+1)>>4,i[2]=(15&e.charCodeAt(t+1))<<2),e.length>t+2&&(i[2]|=e.charCodeAt(t+2)>>6,i[3]=63&e.charCodeAt(t+2));for(let e=0;e<i.length;e++)void 0===i[e]?n+="=":n+=r(i[e])}return n}},function(e,t){e.exports=function(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r<i;)o[r]=e[r+t];return o}},function(e,t,n){var r=n(334);e.exports=function(e){return e?(e=r(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e: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(e){if("number"==typeof e)return e;if(i(e))return NaN;if(r(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=r(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(o,"");var n=a.test(e);return n||c.test(e)?l(e.slice(2),n?2:8):s.test(e)?NaN:+e}},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(e){var t=o.call(e,a),n=e[a];try{e[a]=void 0;var r=!0}catch(e){}var i=s.call(e);return r&&(t?e[a]=n:delete e[a]),i}},function(e,t){var n=Object.prototype.toString;e.exports=function(e){return n.call(e)}},function(e,t,n){var r=n(97),i=n(338),o=n(350),s=n(16);e.exports=function(e,t){return(s(e)?r:i)(e,o(t))}},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(e,t){return e&&r(e,t,i)}},function(e,t,n){var r=n(341)();e.exports=r},function(e,t){e.exports=function(e){return function(t,n,r){for(var i=-1,o=Object(t),s=r(t),a=s.length;a--;){var c=s[e?a:++i];if(!1===n(o[c],c,o))break}return t}}},function(e,t){e.exports=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}},function(e,t,n){var r=n(24),i=n(22);e.exports=function(e){return i(e)&&"[object Arguments]"==r(e)}},function(e,t){e.exports=function(){return!1}},function(e,t,n){var r=n(24),i=n(71),o=n(22),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]"]=!0,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]"]=!1,e.exports=function(e){return o(e)&&i(e.length)&&!!s[r(e)]}},function(e,t){e.exports=function(e){return function(t){return e(t)}}},function(e,t,n){(function(e){var r=n(96),i=t&&!t.nodeType&&t,o=i&&"object"==typeof e&&e&&!e.nodeType&&e,s=o&&o.exports===i&&r.process,a=function(){try{var e=o&&o.require&&o.require("util").types;return e||s&&s.binding&&s.binding("util")}catch(e){}}();e.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(e,t){return function(n,i){if(null==n)return n;if(!r(n))return e(n,i);for(var o=n.length,s=t?o:-1,a=Object(n);(t?s--:++s<o)&&!1!==i(a[s],s,a););return n}}},function(e,t,n){var r=n(38);e.exports=function(e){return"function"==typeof e?e:r}},function(e,t,n){var r=n(352),i=n(357),o=n(112),s=i((function(e,t){r(t,o(t),e)}));e.exports=s},function(e,t,n){var r=n(105),i=n(106);e.exports=function(e,t,n,o){var s=!n;n||(n={});for(var a=-1,c=t.length;++a<c;){var l=t[a],u=o?o(n[l],e[l],l,n,e):void 0;void 0===u&&(u=e[l]),s?i(n,l,u):r(n,l,u)}return n}},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(e){return!(!o(e)||i(e))&&(r(e)?h:a).test(s(e))}},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(e){return!!o&&o in e}},function(e,t,n){var r=n(11)["__core-js_shared__"];e.exports=r},function(e,t){e.exports=function(e,t){return null==e?void 0:e[t]}},function(e,t,n){var r=n(109),i=n(361);e.exports=function(e){return r((function(t,n){var r=-1,o=n.length,s=o>1?n[o-1]:void 0,a=o>2?n[2]:void 0;for(s=e.length>3&&"function"==typeof s?(o--,s):void 0,a&&i(n[0],n[1],a)&&(s=o<3?void 0:s,o=1),t=Object(t);++r<o;){var c=n[r];c&&e(t,c,r,s)}return t}))}},function(e,t,n){var r=n(72),i=Math.max;e.exports=function(e,t,n){return t=i(void 0===t?e.length-1:t,0),function(){for(var o=arguments,s=-1,a=i(o.length-t,0),c=Array(a);++s<a;)c[s]=o[t+s];s=-1;for(var l=Array(t+1);++s<t;)l[s]=o[s];return l[t]=n(c),r(e,this,l)}}},function(e,t,n){var r=n(360),i=n(107),o=n(38),s=i?function(e,t){return i(e,"toString",{configurable:!0,enumerable:!1,value:r(t),writable:!0})}:o;e.exports=s},function(e,t){e.exports=function(e){return function(){return e}}},function(e,t,n){var r=n(50),i=n(29),o=n(37),s=n(20);e.exports=function(e,t,n){if(!s(n))return!1;var a=typeof t;return!!("number"==a?i(n)&&o(t,n.length):"string"==a&&t in n)&&r(n[t],e)}},function(e,t,n){var r=n(20),i=n(103),o=n(363),s=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return o(e);var t=i(e),n=[];for(var a in e)("constructor"!=a||!t&&s.call(e,a))&&n.push(a);return n}},function(e,t){e.exports=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}},function(e,t){e.exports=function(e,t,n,r){for(var i=e.length,o=n+(r?1:-1);r?o--:++o<i;)if(t(e[o],o,e))return o;return-1}},function(e,t){e.exports=function(e){return e!=e}},function(e,t){e.exports=function(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}},function(e,t,n){var r=n(73);e.exports=function(e,t){return r(t,(function(t){return e[t]}))}},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(e,t,n,p,g,m,v,_){var b=2&t;if(!b&&"function"!=typeof e)throw new TypeError("Expected a function");var y=p?p.length:0;if(y||(t&=-97,p=g=void 0),v=void 0===v?v:f(h(v),0),_=void 0===_?_:h(_),y-=g?g.length:0,64&t){var w=p,S=g;p=g=void 0}var x=b?void 0:c(e),E=[e,t,n,p,g,w,S,m,v,_];if(x&&l(E,x),e=E[0],t=E[1],n=E[2],p=E[3],g=E[4],!(_=E[9]=void 0===E[9]?b?0:e.length:f(E[9]-y,0))&&24&t&&(t&=-25),t&&1!=t)A=8==t||16==t?o(e,t,_):32!=t&&33!=t||g.length?s.apply(void 0,E):a(e,t,n,p);else var A=i(e,t,n);return d((x?r:u)(A,E),e,t)}},function(e,t,n){var r=n(51),i=n(11);e.exports=function(e,t,n){var o=1&t,s=r(e);return function t(){var r=this&&this!==i&&this instanceof t?s:e;return r.apply(o?n: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(e,t,n){var u=i(e);return function i(){for(var d=arguments.length,h=Array(d),f=d,p=a(i);f--;)h[f]=arguments[f];var g=d<3&&h[0]!==p&&h[d-1]!==p?[]:c(h,p);if((d-=g.length)<n)return s(e,t,o,i.placeholder,void 0,h,g,void 0,void 0,n-d);var m=this&&this!==l&&this instanceof i?u:e;return r(m,this,h)}}},function(e,t){e.exports=function(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}},function(e,t,n){var r=n(75),i=n(122),o=n(374),s=n(376);e.exports=function(e){var t=o(e),n=s[t];if("function"!=typeof n||!(t in r.prototype))return!1;if(e===n)return!0;var a=i(n);return!!a&&e===a[0]}},function(e,t){e.exports=function(){}},function(e,t,n){var r=n(375),i=Object.prototype.hasOwnProperty;e.exports=function(e){for(var t=e.name+"",n=r[t],o=i.call(r,t)?n.length:0;o--;){var s=n[o],a=s.func;if(null==a||a==e)return s.name}return t}},function(e,t){e.exports={}},function(e,t,n){var r=n(75),i=n(123),o=n(76),s=n(16),a=n(22),c=n(377),l=Object.prototype.hasOwnProperty;function u(e){if(a(e)&&!s(e)&&!(e instanceof r)){if(e instanceof i)return e;if(l.call(e,"__wrapped__"))return c(e)}return new i(e)}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(e){if(e instanceof r)return e.clone();var t=new i(e.__wrapped__,e.__chain__);return t.__actions__=o(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}},function(e,t){var n=/\{\n\/\* \[wrapped with (.+)\] \*/,r=/,? & /;e.exports=function(e){var t=e.match(n);return t?t[1].split(r):[]}},function(e,t){var n=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;e.exports=function(e,t){var r=t.length;if(!r)return e;var i=r-1;return t[i]=(r>1?"& ":"")+t[i],t=t.join(r>2?", ":" "),e.replace(n,"{\n/* [wrapped with "+t+"] */\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(e,t){return r(o,(function(n){var r="_."+n[0];t&n[1]&&!i(e,r)&&e.push(r)})),e.sort()}},function(e,t,n){var r=n(113);e.exports=function(e,t){return!!(null==e?0:e.length)&&r(e,t,0)>-1}},function(e,t,n){var r=n(124),i=n(37),o=Math.min;e.exports=function(e,t){for(var n=e.length,s=o(t.length,n),a=r(e);s--;){var c=t[s];e[s]=i(c,n)?a[c]:void 0}return e}},function(e,t,n){var r=n(72),i=n(51),o=n(11);e.exports=function(e,t,n,s){var a=1&t,c=i(e);return function t(){for(var i=-1,l=arguments.length,u=-1,d=s.length,h=Array(d+l),f=this&&this!==o&&this instanceof t?c:e;++u<d;)h[u]=s[u];for(;l--;)h[u++]=arguments[++i];return r(f,a?n:this,h)}}},function(e,t,n){var r=n(119),i=n(120),o=n(52),s=Math.min;e.exports=function(e,t){var n=e[1],a=t[1],c=n|a,l=c<131,u=128==a&&8==n||128==a&&256==n&&e[7].length<=t[8]||384==a&&t[7].length<=t[8]&&8==n;if(!l&&!u)return e;1&a&&(e[2]=t[2],c|=1&n?0:4);var d=t[3];if(d){var h=e[3];e[3]=h?r(h,d,t[4]):d,e[4]=h?o(e[3],"__lodash_placeholder__"):t[4]}return(d=t[5])&&(h=e[5],e[5]=h?i(h,d,t[6]):d,e[6]=h?o(e[5],"__lodash_placeholder__"):t[6]),(d=t[7])&&(e[7]=d),128&a&&(e[8]=null==e[8]?t[8]:s(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=c,e}},function(e,t,n){var r=n(386),i=n(427),o=n(38),s=n(16),a=n(436);e.exports=function(e){return"function"==typeof e?e:null==e?o:"object"==typeof e?s(e)?i(e[0],e[1]):r(e):a(e)}},function(e,t,n){var r=n(387),i=n(426),o=n(136);e.exports=function(e){var t=i(e);return 1==t.length&&t[0][2]?o(t[0][0],t[0][1]):function(n){return n===e||r(n,e,t)}}},function(e,t,n){var r=n(127),i=n(128);e.exports=function(e,t,n,o){var s=n.length,a=s,c=!o;if(null==e)return!a;for(e=Object(e);s--;){var l=n[s];if(c&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++s<a;){var u=(l=n[s])[0],d=e[u],h=l[1];if(c&&l[2]){if(void 0===d&&!(u in e))return!1}else{var f=new r;if(o)var p=o(d,h,u,e,t,f);if(!(void 0===p?i(h,d,3,o,f):p))return!1}}return!0}},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(e){var t=this.__data__,n=r(t,e);return!(n<0)&&(n==t.length-1?t.pop():i.call(t,n,1),--this.size,!0)}},function(e,t,n){var r=n(54);e.exports=function(e){var t=this.__data__,n=r(t,e);return n<0?void 0:t[n][1]}},function(e,t,n){var r=n(54);e.exports=function(e){return r(this.__data__,e)>-1}},function(e,t,n){var r=n(54);e.exports=function(e,t){var n=this.__data__,i=r(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,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(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}},function(e,t){e.exports=function(e){return this.__data__.get(e)}},function(e,t){e.exports=function(e){return this.__data__.has(e)}},function(e,t,n){var r=n(53),i=n(78),o=n(79);e.exports=function(e,t){var n=this.__data__;if(n instanceof r){var s=n.__data__;if(!i||s.length<199)return s.push([e,t]),this.size=++n.size,this;n=this.__data__=new o(s)}return n.set(e,t),this.size=n.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(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[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(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}},function(e,t,n){var r=n(55),i=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;if(r){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return i.call(t,e)?t[e]:void 0}},function(e,t,n){var r=n(55),i=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;return r?void 0!==t[e]:i.call(t,e)}},function(e,t,n){var r=n(55);e.exports=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=r&&void 0===t?"__lodash_hash_undefined__":t,this}},function(e,t,n){var r=n(56);e.exports=function(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}},function(e,t){e.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},function(e,t,n){var r=n(56);e.exports=function(e){return r(this,e).get(e)}},function(e,t,n){var r=n(56);e.exports=function(e){return r(this,e).has(e)}},function(e,t,n){var r=n(56);e.exports=function(e,t){var n=r(this,e),i=n.size;return n.set(e,t),this.size+=n.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(e,t,n,f,p,g){var m=c(e),v=c(t),_=m?"[object Array]":a(e),b=v?"[object Array]":a(t),y=(_="[object Arguments]"==_?d:_)==d,w=(b="[object Arguments]"==b?d:b)==d,S=_==b;if(S&&l(e)){if(!l(t))return!1;m=!0,y=!1}if(S&&!y)return g||(g=new r),m||u(e)?i(e,t,n,f,p,g):o(e,t,_,n,f,p,g);if(!(1&n)){var x=y&&h.call(e,"__wrapped__"),E=w&&h.call(t,"__wrapped__");if(x||E){var A=x?e.value():e,C=E?t.value():t;return g||(g=new r),p(A,C,n,f,g)}}return!!S&&(g||(g=new r),s(e,t,n,f,p,g))}},function(e,t,n){var r=n(79),i=n(412),o=n(413);function s(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new r;++t<n;)this.add(e[t])}s.prototype.add=s.prototype.push=i,s.prototype.has=o,e.exports=s},function(e,t){e.exports=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}},function(e,t){e.exports=function(e){return this.__data__.has(e)}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}},function(e,t){e.exports=function(e,t){return e.has(t)}},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(e,t,n,r,l,d,h){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!d(new i(e),new i(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return o(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var f=a;case"[object Set]":var p=1&r;if(f||(f=c),e.size!=t.size&&!p)return!1;var g=h.get(e);if(g)return g==t;r|=2,h.set(e,t);var m=s(f(e),f(t),r,l,d,h);return h.delete(e),m;case"[object Symbol]":if(u)return u.call(e)==u.call(t)}return!1}},function(e,t,n){var r=n(11).Uint8Array;e.exports=r},function(e,t){e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}},function(e,t){e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}},function(e,t,n){var r=n(421),i=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,o,s,a){var c=1&n,l=r(e),u=l.length;if(u!=r(t).length&&!c)return!1;for(var d=u;d--;){var h=l[d];if(!(c?h in t:i.call(t,h)))return!1}var f=a.get(e),p=a.get(t);if(f&&p)return f==t&&p==e;var g=!0;a.set(e,t),a.set(t,e);for(var m=c;++d<u;){var v=e[h=l[d]],_=t[h];if(o)var b=c?o(_,v,h,t,e,a):o(v,_,h,e,t,a);if(!(void 0===b?v===_||s(v,_,n,o,a):b)){g=!1;break}m||(m="constructor"==h)}if(g&&!m){var y=e.constructor,w=t.constructor;y==w||!("constructor"in e)||!("constructor"in t)||"function"==typeof y&&y instanceof y&&"function"==typeof w&&w instanceof w||(g=!1)}return a.delete(e),a.delete(t),g}},function(e,t,n){var r=n(130),i=n(132),o=n(33);e.exports=function(e){return r(e,o,i)}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,o=[];++n<r;){var s=e[n];t(s,n,e)&&(o[i++]=s)}return o}},function(e,t,n){var r=n(25)(n(11),"DataView");e.exports=r},function(e,t,n){var r=n(25)(n(11),"Promise");e.exports=r},function(e,t,n){var r=n(25)(n(11),"Set");e.exports=r},function(e,t,n){var r=n(135),i=n(33);e.exports=function(e){for(var t=i(e),n=t.length;n--;){var o=t[n],s=e[o];t[n]=[o,s,r(s)]}return t}},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(e,t){return s(e)&&a(t)?c(l(e),t):function(n){var s=i(n,e);return void 0===s&&s===t?o(n,e):r(t,s,3)}}},function(e,t,n){var r=n(80);e.exports=function(e,t,n){var i=null==e?void 0:r(e,t);return void 0===i?n:i}},function(e,t,n){var r=n(430),i=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,o=/\\(\\)?/g,s=r((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(i,(function(e,n,r,i){t.push(r?i.replace(o,"$1"):n||e)})),t}));e.exports=s},function(e,t,n){var r=n(431);e.exports=function(e){var t=r(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}},function(e,t,n){var r=n(79);function i(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(i.Cache||r),n}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 e(t){if("string"==typeof t)return t;if(o(t))return i(t,e)+"";if(s(t))return c?c.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}},function(e,t,n){var r=n(434),i=n(435);e.exports=function(e,t){return null!=e&&i(e,t,r)}},function(e,t){e.exports=function(e,t){return null!=e&&t in Object(e)}},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(e,t,n){for(var l=-1,u=(t=r(t,e)).length,d=!1;++l<u;){var h=c(t[l]);if(!(d=null!=e&&n(e,h)))break;e=e[h]}return d||++l!=u?d:!!(u=null==e?0:e.length)&&a(u)&&s(h,u)&&(o(e)||i(e))}},function(e,t,n){var r=n(138),i=n(437),o=n(81),s=n(39);e.exports=function(e){return o(e)?r(s(e)):i(e)}},function(e,t,n){var r=n(80);e.exports=function(e){return function(t){return r(t,e)}}},function(e,t,n){var r=n(80),i=n(439),o=n(57);e.exports=function(e,t,n){for(var s=-1,a=t.length,c={};++s<a;){var l=t[s],u=r(e,l);n(u,l)&&i(c,o(l,e),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(e,t,n,c){if(!s(e))return e;for(var l=-1,u=(t=i(t,e)).length,d=u-1,h=e;null!=h&&++l<u;){var f=a(t[l]),p=n;if("__proto__"===f||"constructor"===f||"prototype"===f)return e;if(l!=d){var g=h[f];void 0===(p=c?c(g,f,h):void 0)&&(p=s(g)?g:o(t[l+1])?[]:{})}r(h,f,p),h=h[f]}return e}},function(e,t,n){var r=n(130),i=n(441),o=n(112);e.exports=function(e){return r(e,o,i)}},function(e,t,n){var r=n(131),i=n(442),o=n(132),s=n(133),a=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)r(t,o(e)),e=i(e);return t}: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(e){return i(e)?o(e):r(e)}},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(e){return n.test(e)}},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(e){for(var t=d.lastIndex=0;d.test(e);)++t;return t}},function(e,t,n){"use strict";t.__esModule=!0;var r,i=n(448),o=(r=i)&&r.__esModule?r:{default:r};t.default=function(e,t,n){return t in e?(0,o.default)(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t,n){e.exports={default:n(449),__esModule:!0}},function(e,t,n){n(450);var r=n(19).Object;e.exports=function(e,t,n){return r.defineProperty(e,t,n)}},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 7!=Object.defineProperty(n(83)("div"),"a",{get:function(){return 7}}).a}))},function(e,t,n){var r=n(41);e.exports=function(e,t){if(!r(e))return e;var n,i;if(t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;if("function"==typeof(n=e.valueOf)&&!r(i=n.call(e)))return i;if(!t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},function(e,t,n){e.exports={default:n(454),__esModule:!0}},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(e){return i(r(e))}}))},function(e,t,n){var r=n(60),i=n(85),o=n(458)(!1),s=n(87)("IE_PROTO");e.exports=function(e,t){var n,a=i(e),c=0,l=[];for(n in a)n!=s&&r(a,n)&&l.push(n);for(;t.length>c;)r(a,n=t[c++])&&(~o(l,n)||l.push(n));return l}},function(e,t,n){var r=n(61);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t,n){var r=n(85),i=n(143),o=n(459);e.exports=function(e){return function(t,n,s){var a,c=r(t),l=i(c.length),u=o(s,l);if(e&&n!=n){for(;l>u;)if((a=c[u++])!=a)return!0}else for(;l>u;u++)if((e||u in c)&&c[u]===n)return e||u||0;return!e&&-1}}},function(e,t,n){var r=n(86),i=Math.max,o=Math.min;e.exports=function(e,t){return(e=r(e))<0?i(e+t,0):o(e,t)}},function(e,t,n){var r=n(30),i=n(19),o=n(82);e.exports=function(e,t){var n=(i.Object||{})[e]||Object[e],s={};s[e]=t(n),r(r.S+r.F*o((function(){n(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(e){r.regeneratorRuntime=void 0}},function(e,t){!function(t){"use strict";var n=Object.prototype,r=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",a=i.toStringTag||"@@toStringTag",c="object"==typeof e,l=t.regeneratorRuntime;if(l)c&&(e.exports=l);else{(l=t.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(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===_||"GeneratorFunction"===(t.displayName||t.name))},l.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,a in e||(e[a]="GeneratorFunction")),e.prototype=Object.create(p),e},l.awrap=function(e){return{__await:e}},y(w.prototype),w.prototype[s]=function(){return this},l.AsyncIterator=w,l.async=function(e,t,n,r){var i=new w(g(e,t,n,r));return l.isGeneratorFunction(t)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},y(p),p[a]="Generator",p[o]=function(){return this},p.toString=function(){return"[object Generator]"},l.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},l.values=C,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,r){return s.type="throw",s.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var a=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=e,s.arg=t,o?(this.method="next",this.next=o.finallyLoc,u):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),u},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;E(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:C(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}}}function g(e,t,n,r){var i=t&&t.prototype instanceof v?t:v,o=Object.create(i.prototype),s=new A(r||[]);return o._invoke=function(e,t,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return j()}for(n.method=i,n.arg=o;;){var s=n.delegate;if(s){var a=S(s,n);if(a){if(a===u)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=m(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===u)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}(e,n,s),o}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function v(){}function _(){}function b(){}function y(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function w(e){var t;this._invoke=function(n,i){function o(){return new Promise((function(t,o){!function t(n,i,o,s){var a=m(e[n],e,i);if("throw"!==a.type){var c=a.arg,l=c.value;return l&&"object"==typeof l&&r.call(l,"__await")?Promise.resolve(l.__await).then((function(e){t("next",e,o,s)}),(function(e){t("throw",e,o,s)})):Promise.resolve(l).then((function(e){c.value=e,o(c)}),s)}s(a.arg)}(n,i,t,o)}))}return t=t?t.then(o,o):o()}}function S(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,S(e,t),"throw"===t.method))return u;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var r=m(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,u;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function C(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:j}}function j(){return{value:void 0,done:!0}}}(function(){return this}()||Function("return this")())},function(e,t,n){"use strict";t.__esModule=!0;var r,i=n(89),o=(r=i)&&r.__esModule?r:{default:r};t.default=function(e){return function(){var t=e.apply(this,arguments);return new o.default((function(e,n){return function r(i,s){try{var a=t[i](s),c=a.value}catch(e){return void n(e)}if(!a.done)return o.default.resolve(c).then((function(e){r("next",e)}),(function(e){r("throw",e)}));e(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){"use strict";var r=n(468)(!0);n(147)(String,"String",(function(e){this._t=String(e),this._i=0}),(function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})}))},function(e,t,n){var r=n(86),i=n(84);e.exports=function(e){return function(t,n){var o,s,a=String(i(t)),c=r(n),l=a.length;return c<0||c>=l?e?"":void 0:(o=a.charCodeAt(c))<55296||o>56319||c+1===l||(s=a.charCodeAt(c+1))<56320||s>57343?e?a.charAt(c):o:e?a.slice(c,c+2):s-56320+(o-55296<<10)+65536}}},function(e,t,n){e.exports=n(31)},function(e,t,n){"use strict";var r=n(471),i=n(140),o=n(90),s={};n(31)(s,n(17)("iterator"),(function(){return this})),e.exports=function(e,t,n){e.prototype=r(s,{next:i(1,n)}),o(e,t+" Iterator")}},function(e,t,n){var r=n(26),i=n(472),o=n(146),s=n(87)("IE_PROTO"),a=function(){},c=function(){var e,t=n(83)("iframe"),r=o.length;for(t.style.display="none",n(148).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("<script>document.F=Object<\/script>"),e.close(),c=e.F;r--;)delete c.prototype[o[r]];return c()};e.exports=Object.create||function(e,t){var n;return null!==e?(a.prototype=r(e),n=new a,a.prototype=null,n[s]=e):n=c(),void 0===t?n:i(n,t)}},function(e,t,n){var r=n(40),i=n(26),o=n(142);e.exports=n(32)?Object.defineProperties:function(e,t){i(e);for(var n,s=o(t),a=s.length,c=0;a>c;)r.f(e,n=s[c++],t[n]);return e}},function(e,t,n){var r=n(60),i=n(141),o=n(87)("IE_PROTO"),s=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=i(e),r(e,o)?e[o]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e 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){"use strict";var r=n(476),i=n(477),o=n(42),s=n(85);e.exports=n(147)(Array,"Array",(function(e,t){this._t=s(e),this._i=0,this._k=t}),(function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,i(1)):i(0,"keys"==t?n:"values"==t?e[n]:[n,e[n]])}),"values"),o.Arguments=o.Array,r("keys"),r("values"),r("entries")},function(e,t){e.exports=function(){}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,n){"use strict";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,O="process"==u(E),T=function(){},k=i=b.f,N=!!function(){try{var e=j.resolve(1),t=(e.constructor={})[n(17)("species")]=function(e){e(T,T)};return(O||"function"==typeof PromiseRejectionEvent)&&e.then(T)instanceof t&&0!==C.indexOf("6.6")&&-1===w.indexOf("Chrome/66")}catch(e){}}(),I=function(e){var t;return!(!h(e)||"function"!=typeof(t=e.then))&&t},M=function(e,t){if(!e._n){e._n=!0;var n=e._c;_((function(){for(var r=e._v,i=1==e._s,o=0,s=function(t){var n,o,s,a=i?t.ok:t.fail,c=t.resolve,l=t.reject,u=t.domain;try{a?(i||(2==e._h&&P(e),e._h=1),!0===a?n=r:(u&&u.enter(),n=a(r),u&&(u.exit(),s=!0)),n===t.promise?l(x("Promise-chain cycle")):(o=I(n))?o.call(n,c,l):c(n)):l(r)}catch(e){u&&!s&&u.exit(),l(e)}};n.length>o;)s(n[o++]);e._c=[],e._n=!1,t&&!e._h&&R(e)}))}},R=function(e){v.call(c,(function(){var t,n,r,i=e._v,o=D(e);if(o&&(t=y((function(){O?E.emit("unhandledRejection",i,e):(n=c.onunhandledrejection)?n({promise:e,reason:i}):(r=c.console)&&r.error&&r.error("Unhandled promise rejection",i)})),e._h=O||D(e)?2:1),e._a=void 0,o&&t.e)throw t.v}))},D=function(e){return 1!==e._h&&0===(e._a||e._c).length},P=function(e){v.call(c,(function(){var t;O?E.emit("rejectionHandled",e):(t=c.onrejectionhandled)&&t({promise:e,reason:e._v})}))},L=function(e){var t=this;t._d||(t._d=!0,(t=t._w||t)._v=e,t._s=2,t._a||(t._a=t._c.slice()),M(t,!0))},F=function(e){var t,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===e)throw x("Promise can't be resolved itself");(t=I(e))?_((function(){var r={_w:n,_d:!1};try{t.call(e,l(F,r,1),l(L,r,1))}catch(e){L.call(r,e)}})):(n._v=e,n._s=1,M(n,!1))}catch(e){L.call({_w:n,_d:!1},e)}}};N||(j=function(e){p(this,j,"Promise","_h"),f(e),r.call(this);try{e(l(F,this,1),l(L,this,1))}catch(e){L.call(this,e)}},(r=function(e){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=n(487)(j.prototype,{then:function(e,t){var n=k(m(this,j));return n.ok="function"!=typeof e||e,n.fail="function"==typeof t&&t,n.domain=O?E.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&M(this,!1),n.promise},catch:function(e){return this.then(void 0,e)}}),o=function(){var e=new r;this.promise=e,this.resolve=l(F,e,1),this.reject=l(L,e,1)},b.f=k=function(e){return e===j||e===s?new o(e):i(e)}),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(e){var t=k(this);return(0,t.reject)(e),t.promise}}),d(d.S+d.F*(a||!N),"Promise",{resolve:function(e){return S(a&&this===s?j:this,e)}}),d(d.S+d.F*!(N&&n(489)((function(e){j.all(e).catch(T)}))),"Promise",{all:function(e){var t=this,n=k(t),r=n.resolve,i=n.reject,o=y((function(){var n=[],o=0,s=1;g(e,!1,(function(e){var a=o++,c=!1;n.push(void 0),s++,t.resolve(e).then((function(e){c||(c=!0,n[a]=e,--s||r(n))}),i)})),--s||r(n)}));return o.e&&i(o.v),n.promise},race:function(e){var t=this,n=k(t),r=n.reject,i=y((function(){g(e,!1,(function(e){t.resolve(e).then(n.resolve,r)}))}));return i.e&&r(i.v),n.promise}})},function(e,t){e.exports=function(e,t,n,r){if(!(e instanceof t)||void 0!==r&&r in e)throw TypeError(n+": incorrect invocation!");return e}},function(e,t,n){var r=n(58),i=n(481),o=n(482),s=n(26),a=n(143),c=n(483),l={},u={};(t=e.exports=function(e,t,n,d,h){var f,p,g,m,v=h?function(){return e}:c(e),_=r(n,d,t?2:1),b=0;if("function"!=typeof v)throw TypeError(e+" is not iterable!");if(o(v)){for(f=a(e.length);f>b;b++)if((m=t?_(s(p=e[b])[0],p[1]):_(e[b]))===l||m===u)return m}else for(g=v.call(e);!(p=g.next()).done;)if((m=i(g,_,p.value,t))===l||m===u)return m}).BREAK=l,t.RETURN=u},function(e,t,n){var r=n(26);e.exports=function(e,t,n,i){try{return i?t(r(n)[0],n[1]):t(n)}catch(t){var o=e.return;throw void 0!==o&&r(o.call(e)),t}}},function(e,t,n){var r=n(42),i=n(17)("iterator"),o=Array.prototype;e.exports=function(e){return void 0!==e&&(r.Array===e||o[i]===e)}},function(e,t,n){var r=n(149),i=n(17)("iterator"),o=n(42);e.exports=n(19).getIteratorMethod=function(e){if(null!=e)return e[i]||e["@@iterator"]||o[r(e)]}},function(e,t){e.exports=function(e,t,n){var r=void 0===n;switch(t.length){case 0:return r?e():e.call(n);case 1:return r?e(t[0]):e.call(n,t[0]);case 2:return r?e(t[0],t[1]):e.call(n,t[0],t[1]);case 3:return r?e(t[0],t[1],t[2]):e.call(n,t[0],t[1],t[2]);case 4:return r?e(t[0],t[1],t[2],t[3]):e.call(n,t[0],t[1],t[2],t[3])}return e.apply(n,t)}},function(e,t,n){var r=n(13),i=n(151).set,o=r.MutationObserver||r.WebKitMutationObserver,s=r.process,a=r.Promise,c="process"==n(61)(s);e.exports=function(){var e,t,n,l=function(){var r,i;for(c&&(r=s.domain)&&r.exit();e;){i=e.fn,e=e.next;try{i()}catch(r){throw e?n():t=void 0,r}}t=void 0,r&&r.enter()};if(c)n=function(){s.nextTick(l)};else if(!o||r.navigator&&r.navigator.standalone)if(a&&a.resolve){var u=a.resolve(void 0);n=function(){u.then(l)}}else n=function(){i.call(r,l)};else{var d=!0,h=document.createTextNode("");new o(l).observe(h,{characterData:!0}),n=function(){h.data=d=!d}}return function(r){var i={fn:r,next:void 0};t&&(t.next=i),e||(e=i,n()),t=i}}},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(e,t,n){for(var i in t)n&&e[i]?e[i]=t[i]:r(e,i,t[i]);return e}},function(e,t,n){"use strict";var r=n(13),i=n(19),o=n(40),s=n(32),a=n(17)("species");e.exports=function(e){var t="function"==typeof i[e]?i[e]:r[e];s&&t&&!t[a]&&o.f(t,a,{configurable:!0,get:function(){return this}})}},function(e,t,n){var r=n(17)("iterator"),i=!1;try{var o=[7][r]();o.return=function(){i=!0},Array.from(o,(function(){throw 2}))}catch(e){}e.exports=function(e,t){if(!t&&!i)return!1;var n=!1;try{var o=[7],s=o[r]();s.next=function(){return{done:n=!0}},o[r]=function(){return s},e(o)}catch(e){}return n}},function(e,t,n){"use strict";var r=n(30),i=n(19),o=n(13),s=n(150),a=n(153);r(r.P+r.R,"Promise",{finally:function(e){var t=s(this,i.Promise||o.Promise),n="function"==typeof e;return this.then(n?function(n){return a(t,e()).then((function(){return n}))}:e,n?function(n){return a(t,e()).then((function(){throw n}))}:e)}})},function(e,t,n){"use strict";var r=n(30),i=n(91),o=n(152);r(r.S,"Promise",{try:function(e){var t=i.f(this),n=o(e);return(n.e?t.reject:t.resolve)(n.v),t.promise}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});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(e,t){if(function(){var e=s();try{return e&&e.local.get&&e.local.get()&&"function"==typeof e.local.get().then}catch(e){return!1}}())return e(t);return new o.default((function(n){e(t,(function(){n.apply(void 0,arguments)}))}))}},function(e,t,n){"use strict";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(e){super(e),this._conn=e,this.worker=new SharedWorker(this._conn.options.worker,"Strophe XMPP Connection"),this.worker.onerror=e=>{var t;null===(t=console)||void 0===t||t.error(e),r.e.log(r.e.LogLevel.ERROR,"Shared Worker Error: ".concat(e))}}get socket(){return{send:e=>this.worker.port.postMessage(["send",e])}}_connect(){this._messageHandler=e=>this._onInitialMessage(e),this.worker.port.start(),this.worker.port.onmessage=e=>this._onWorkerMessage(e),this.worker.port.postMessage(["_connect",this._conn.service,this._conn.jid])}_attach(e){this._messageHandler=e=>this._onMessage(e),this._conn.connect_callback=e,this.worker.port.start(),this.worker.port.onmessage=e=>this._onWorkerMessage(e),this.worker.port.postMessage(["_attach",this._conn.service])}_attachCallback(e,t){e===r.e.Status.ATTACHED?(this._conn.jid=t,this._conn.authenticated=!0,this._conn.connected=!0,this._conn.restored=!0,this._conn._changeConnectStatus(r.e.Status.ATTACHED)):e===r.e.Status.ATTACHFAIL&&(this._conn.authenticated=!1,this._conn.connected=!1,this._conn.restored=!1,this._conn._changeConnectStatus(r.e.Status.ATTACHFAIL))}_disconnect(e,t){t&&this._conn.send(t);const n=Object(r.a)("close",{xmlns:r.e.NS.FRAMING});this._conn.xmlOutput(n.tree());const i=r.e.serialize(n);this._conn.rawOutput(i),this.worker.port.postMessage(["send",i]),this._conn._doDisconnect()}_onClose(e){this._conn.connected&&!this._conn.disconnecting?(r.e.error("Websocket closed unexpectedly"),this._conn._doDisconnect()):e&&1006===e.code&&!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=e=>this._onMessage(e)}_onWorkerMessage(e){const{data:t}=e,n=t[0];if("_onMessage"===n)this._messageHandler(t[1]);else if(n in this)try{this[n].apply(this,e.data.slice(1))}catch(e){r.e.log(r.e.LogLevel.ERROR,e)}else if("log"===n){const e=t[1],n=t[2];r.e.log(i[e],n)}else r.e.log(r.e.LogLevel.ERROR,"Found unhandled service worker message: ".concat(t))}}},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(e){if(!n.o(r,e))return Promise.resolve().then((function(){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=r[e],i=t[0];return n.e(t[1]).then((function(){return n.t(i,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(e){if(!n.o(r,e))return Promise.resolve().then((function(){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=r[e],i=t[0];return n.e(t[1]).then((function(){return n.t(i,7)}))}i.keys=function(){return Object.keys(r)},i.id=495,e.exports=i},function(e,t,n){var r=n(497)({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});e.exports=r},function(e,t){e.exports=function(e){return function(t){return null==e?void 0:e[t]}}},function(e,t,n){"use strict";var r=n(9),i=n(1);i.d.Request=class{constructor(e,t,n,r){this.id=++i.d._requestId,this.xmlData=e,this.data=i.d.serialize(e),this.origFunc=t,this.func=t,this.rid=n,this.date=NaN,this.sends=r||0,this.abort=!1,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 e=null;if(this.xhr.responseXML&&this.xhr.responseXML.documentElement){if(e=this.xhr.responseXML.documentElement,"parsererror"===e.tagName)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..."),e=(new r.a).parseFromString(this.xhr.responseText,"application/xml").documentElement,!e)throw new Error("Parsing produced null node");if(e.querySelector("parsererror")){i.d.error("invalid response received: "+e.querySelector("parsererror").textContent),i.d.error("responseText: "+this.xhr.responseText);const t=new Error;throw t.name=i.d.ErrorCondition.BAD_FORMAT,t}}return e}_newXHR(){let e=null;return window.XMLHttpRequest?(e=new XMLHttpRequest,e.overrideMimeType&&e.overrideMimeType("text/xml; charset=utf-8")):window.ActiveXObject&&(e=new ActiveXObject("Microsoft.XMLHTTP")),e.onreadystatechange=this.func.bind(null,this),e}},i.d.Bosh=class e{constructor(e){this._conn=e,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 e=Object(i.a)("body",{rid:this.rid++,xmlns:i.d.NS.HTTPBIND});return null!==this.sid&&e.attrs({sid:this.sid}),this._conn.options.keepalive&&this._conn._sessionCachingSupported()&&this._cacheSession(),e}_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(e,t,n){this.wait=e||this.wait,this.hold=t||this.hold,this.errors=0;const r=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});n&&r.attrs({route:n});const o=this._conn._connect_cb;this._requests.push(new i.d.Request(r.tree(),this._onRequestStateChange.bind(this,o.bind(this._conn)),r.tree().getAttribute("rid"))),this._throttledRequestHandler()}_attach(e,t,n,r,o,s,a){this._conn.jid=e,this.sid=t,this.rid=n,this._conn.connect_callback=r,this._conn.domain=i.d.getDomainFromJid(this._conn.jid),this._conn.authenticated=!0,this._conn.connected=!0,this.wait=o||this.wait,this.hold=s||this.hold,this.window=a||this.window,this._conn._changeConnectStatus(i.d.Status.ATTACHED,null)}_restore(e,t,n,r,o){const s=JSON.parse(window.sessionStorage.getItem("strophe-bosh-session"));if(!(null!=s&&s.rid&&s.sid&&s.jid&&(null==e||i.d.getBareJidFromJid(s.jid)===i.d.getBareJidFromJid(e)||null===i.d.getNodeFromJid(e)&&i.d.getDomainFromJid(s.jid)===e))){const e=new Error("_restore: no restoreable session.");throw e.name="StropheSessionError",e}this._conn.restored=!0,this._attach(s.jid,s.sid,s.rid,t,n,r,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(e){const t=e.getAttribute("type");if(null!==t&&"terminate"===t){let t=e.getAttribute("condition");i.d.error("BOSH-Connection failed: "+t);const n=e.getElementsByTagName("conflict");return null!==t?("remote-stream-error"===t&&n.length>0&&(t="conflict"),this._conn._changeConnectStatus(i.d.Status.CONNFAIL,t)):this._conn._changeConnectStatus(i.d.Status.CONNFAIL,"unknown"),this._conn._doDisconnect(t),i.d.Status.CONNFAIL}this.sid||(this.sid=e.getAttribute("sid"));const n=e.getAttribute("requests");n&&(this.window=parseInt(n,10));const r=e.getAttribute("hold");r&&(this.hold=parseInt(r,10));const o=e.getAttribute("wait");o&&(this.wait=parseInt(o,10));const s=e.getAttribute("inactivity");s&&(this.inactivity=parseInt(s,10))}_disconnect(e){this._sendTerminate(e)}_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 0===this._requests.length}_callProtocolErrorHandlers(t){const n=e._getRequestStatus(t),r=this._conn.protocolErrorHandlers.HTTP[n];r&&r.call(this,n)}_hitError(e){this.errors++,i.d.warn("request errored, status: "+e+", number of errors: "+this.errors),this.errors>4&&this._conn._onDisconnectTimeout()}_no_auth_received(e){i.d.warn("Server did not yet offer a supported authentication mechanism. Sending a blank poll request."),e=e?e.bind(this._conn):this._conn._connect_cb.bind(this._conn);const t=this._buildBody();this._requests.push(new i.d.Request(t.tree(),this._onRequestStateChange.bind(this,e),t.tree().getAttribute("rid"))),this._throttledRequestHandler()}_onDisconnectTimeout(){this._abortAllRequests()}_abortAllRequests(){for(;this._requests.length>0;){const e=this._requests.pop();e.abort=!0,e.xhr.abort(),e.xhr.onreadystatechange=function(){}}}_onIdle(){const e=this._conn._data;if(this._conn.authenticated&&0===this._requests.length&&0===e.length&&!this._conn.disconnecting&&(i.d.debug("no requests during idle cycle, sending blank request"),e.push(null)),!this._conn.paused){if(this._requests.length<2&&e.length>0){const t=this._buildBody();for(let n=0;n<e.length;n++)null!==e[n]&&("restart"===e[n]?t.attrs({to:this._conn.domain,"xml:lang":"en","xmpp:restart":"true","xmlns:xmpp":i.d.NS.BOSH}):t.cnode(e[n]).up());delete this._conn._data,this._conn._data=[],this._requests.push(new i.d.Request(t.tree(),this._onRequestStateChange.bind(this,this._conn._dataRecv.bind(this._conn)),t.tree().getAttribute("rid"))),this._throttledRequestHandler()}if(this._requests.length>0){const e=this._requests[0].age();null!==this._requests[0].dead&&this._requests[0].timeDead()>Math.floor(i.d.SECONDARY_TIMEOUT*this.wait)&&this._throttledRequestHandler(),e>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(e,t){let n;if(4===e.xhr.readyState)try{n=e.xhr.status}catch(e){i.d.error("Caught an error while retrieving a request's status, reqStatus: "+n)}return void 0===n&&(n="number"==typeof t?t:0),n}_onRequestStateChange(t,n){if(i.d.debug("request id "+n.id+"."+n.sends+" state changed to "+n.xhr.readyState),n.abort)return void(n.abort=!1);if(4!==n.xhr.readyState)return;const r=e._getRequestStatus(n);if(this.lastResponseHeaders=n.xhr.getAllResponseHeaders(),this._conn.disconnecting&&r>=400)return this._hitError(r),void this._callProtocolErrorHandlers(n);const o=r>0&&r<500,s=n.sends>this._conn.maxRetries;if((o||s)&&(this._removeRequest(n),i.d.debug("request id "+n.id+" should now be removed")),200===r){const e=this._requests[0]===n;(this._requests[1]===n||e&&this._requests.length>0&&this._requests[0].age()>Math.floor(i.d.SECONDARY_TIMEOUT*this.wait))&&this._restartRequest(0),this._conn.nextValidRid(Number(n.rid)+1),i.d.debug("request id "+n.id+"."+n.sends+" got 200"),t(n),this.errors=0}else 0===r||r>=400&&r<600||r>=12e3?(i.d.error("request id "+n.id+"."+n.sends+" error "+r+" happened"),this._hitError(r),this._callProtocolErrorHandlers(n),r>=400&&r<500&&(this._conn._changeConnectStatus(i.d.Status.DISCONNECTING,null),this._conn._doDisconnect())):i.d.error("request id "+n.id+"."+n.sends+" error "+r+" happened");o||s?s&&!this._conn.connected&&this._conn._changeConnectStatus(i.d.Status.CONNFAIL,"giving-up"):this._throttledRequestHandler()}_processRequest(t){let n=this._requests[t];const r=e._getRequestStatus(n,-1);if(n.sends>this._conn.maxRetries)return void this._conn._onDisconnectTimeout();const o=n.age(),s=!isNaN(o)&&o>Math.floor(i.d.TIMEOUT*this.wait),a=null!==n.dead&&n.timeDead()>Math.floor(i.d.SECONDARY_TIMEOUT*this.wait),c=4===n.xhr.readyState&&(r<1||r>=500);if((s||a||c)&&(a&&i.d.error("Request ".concat(this._requests[t].id," timed out (secondary), restarting")),n.abort=!0,n.xhr.abort(),n.xhr.onreadystatechange=function(){},this._requests[t]=new i.d.Request(n.xmlData,n.origFunc,n.rid,n.sends),n=this._requests[t]),0===n.xhr.readyState){i.d.debug("request id "+n.id+"."+n.sends+" posting");try{const e=this._conn.options.contentType||"text/xml; charset=utf-8";n.xhr.open("POST",this._conn.service,!this._conn.options.sync),void 0!==n.xhr.setRequestHeader&&n.xhr.setRequestHeader("Content-Type",e),this._conn.options.withCredentials&&(n.xhr.withCredentials=!0)}catch(e){return i.d.error("XHR open failed: "+e.toString()),this._conn.connected||this._conn._changeConnectStatus(i.d.Status.CONNFAIL,"bad-service"),void this._conn.disconnect()}const e=()=>{if(n.date=new Date,this._conn.options.customHeaders){const e=this._conn.options.customHeaders;for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.xhr.setRequestHeader(t,e[t])}n.xhr.send(n.data)};if(n.sends>1){const t=1e3*Math.min(Math.floor(i.d.TIMEOUT*this.wait),Math.pow(n.sends,3));setTimeout((function(){e()}),t)}else e();n.sends++,this._conn.xmlOutput!==i.d.Connection.prototype.xmlOutput&&(n.xmlData.nodeName===this.strip&&n.xmlData.childNodes.length?this._conn.xmlOutput(n.xmlData.childNodes[0]):this._conn.xmlOutput(n.xmlData)),this._conn.rawOutput!==i.d.Connection.prototype.rawOutput&&this._conn.rawOutput(n.data)}else i.d.debug("_processRequest: "+(0===t?"first":"second")+" request has readyState of "+n.xhr.readyState)}_removeRequest(e){i.d.debug("removing request");for(let t=this._requests.length-1;t>=0;t--)e===this._requests[t]&&this._requests.splice(t,1);e.xhr.onreadystatechange=function(){},this._throttledRequestHandler()}_restartRequest(e){const t=this._requests[e];null===t.dead&&(t.dead=new Date),this._processRequest(e)}_reqToData(e){try{return e.getResponse()}catch(e){if("parsererror"!==e.message)throw e;this._conn.disconnect("strophe-parsererror")}}_sendTerminate(e){i.d.debug("_sendTerminate was called");const t=this._buildBody().attrs({type:"terminate"});e&&t.cnode(e.tree());const n=new i.d.Request(t.tree(),this._onRequestStateChange.bind(this,this._conn._dataRecv.bind(this._conn)),t.tree().getAttribute("rid"));this._requests.push(n),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&&0!==this._requests.length&&(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){"use strict";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){"use strict";n(158);var r=n(1);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(e){super(e),this._conn=e,this.worker=new SharedWorker(this._conn.options.worker,"Strophe XMPP Connection"),this.worker.onerror=e=>{var t;null===(t=console)||void 0===t||t.error(e),r.d.log(r.d.LogLevel.ERROR,"Shared Worker Error: ".concat(e))}}get socket(){return{send:e=>this.worker.port.postMessage(["send",e])}}_connect(){this._messageHandler=e=>this._onInitialMessage(e),this.worker.port.start(),this.worker.port.onmessage=e=>this._onWorkerMessage(e),this.worker.port.postMessage(["_connect",this._conn.service,this._conn.jid])}_attach(e){this._messageHandler=e=>this._onMessage(e),this._conn.connect_callback=e,this.worker.port.start(),this.worker.port.onmessage=e=>this._onWorkerMessage(e),this.worker.port.postMessage(["_attach",this._conn.service])}_attachCallback(e,t){e===r.d.Status.ATTACHED?(this._conn.jid=t,this._conn.authenticated=!0,this._conn.connected=!0,this._conn.restored=!0,this._conn._changeConnectStatus(r.d.Status.ATTACHED)):e===r.d.Status.ATTACHFAIL&&(this._conn.authenticated=!1,this._conn.connected=!1,this._conn.restored=!1,this._conn._changeConnectStatus(r.d.Status.ATTACHFAIL))}_disconnect(e,t){t&&this._conn.send(t);const n=Object(r.a)("close",{xmlns:r.d.NS.FRAMING});this._conn.xmlOutput(n.tree());const i=r.d.serialize(n);this._conn.rawOutput(i),this.worker.port.postMessage(["send",i]),this._conn._doDisconnect()}_onClose(e){this._conn.connected&&!this._conn.disconnecting?(r.d.error("Websocket closed unexpectedly"),this._conn._doDisconnect()):e&&1006===e.code&&!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=e=>this._onMessage(e)}_onWorkerMessage(e){const{data:t}=e,n=t[0];if("_onMessage"===n)this._messageHandler(t[1]);else if(n in this)try{this[n].apply(this,e.data.slice(1))}catch(e){r.d.log(r.d.LogLevel.ERROR,e)}else if("log"===n){const e=t[1],n=t[2];r.d.log(i[e],n)}else r.d.log(r.d.LogLevel.ERROR,"Found unhandled service worker message: ".concat(t))}}},function(e,t,n){var r=n(502);"string"==typeof r&&(r=[[e.i,r,""]]);var i={hmr:!0,transform:void 0,insertInto:void 0};n(504)(r,i);r.locals&&(e.exports=r.locals)},function(e,t,n){(t=n(503)(!0)).push([e.i,"","",{version:3,sources:[],names:[],mappings:"",file:"converse.scss"}]),e.exports=t},function(e,t,n){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n=e[1]||"",r=e[3];if(!r)return n;if(t&&"function"==typeof btoa){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(e){return"/*# sourceURL=".concat(r.sourceRoot||"").concat(e," */")}));return[n].concat(o).concat([i]).join("\n")}var s,a,c;return[n].join("\n")}(t,e);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,r){"string"==typeof e&&(e=[[null,e,""]]);var i={};if(r)for(var o=0;o<this.length;o++){var s=this[o][0];null!=s&&(i[s]=!0)}for(var a=0;a<e.length;a++){var c=[].concat(e[a]);r&&i[c[0]]||(n&&(c[2]?c[2]="".concat(n," and ").concat(c[2]):c[2]=n),t.push(c))}},t}},function(e,t,n){var r,i,o={},s=(r=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===i&&(i=r.apply(this,arguments)),i}),a=function(e,t){return t?t.querySelector(e):document.querySelector(e)},c=function(e){var t={};return function(e,n){if("function"==typeof e)return e();if(void 0===t[e]){var r=a.call(this,e,n);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}t[e]=r}return t[e]}}(),l=null,u=0,d=[],h=n(505);function f(e,t){for(var n=0;n<e.length;n++){var r=e[n],i=o[r.id];if(i){i.refs++;for(var s=0;s<i.parts.length;s++)i.parts[s](r.parts[s]);for(;s<r.parts.length;s++)i.parts.push(b(r.parts[s],t))}else{var a=[];for(s=0;s<r.parts.length;s++)a.push(b(r.parts[s],t));o[r.id]={id:r.id,refs:1,parts:a}}}}function p(e,t){for(var n=[],r={},i=0;i<e.length;i++){var o=e[i],s=t.base?o[0]+t.base:o[0],a={css:o[1],media:o[2],sourceMap:o[3]};r[s]?r[s].parts.push(a):n.push(r[s]={id:s,parts:[a]})}return n}function g(e,t){var n=c(e.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var r=d[d.length-1];if("top"===e.insertAt)r?r.nextSibling?n.insertBefore(t,r.nextSibling):n.appendChild(t):n.insertBefore(t,n.firstChild),d.push(t);else if("bottom"===e.insertAt)n.appendChild(t);else{if("object"!=typeof e.insertAt||!e.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 i=c(e.insertAt.before,n);n.insertBefore(t,i)}}function m(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e);var t=d.indexOf(e);t>=0&&d.splice(t,1)}function v(e){var t=document.createElement("style");if(void 0===e.attrs.type&&(e.attrs.type="text/css"),void 0===e.attrs.nonce){var r=function(){0;return n.nc}();r&&(e.attrs.nonce=r)}return _(t,e.attrs),g(e,t),t}function _(e,t){Object.keys(t).forEach((function(n){e.setAttribute(n,t[n])}))}function b(e,t){var n,r,i,o;if(t.transform&&e.css){if(!(o="function"==typeof t.transform?t.transform(e.css):t.transform.default(e.css)))return function(){};e.css=o}if(t.singleton){var s=u++;n=l||(l=v(t)),r=S.bind(null,n,s,!1),i=S.bind(null,n,s,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(e){var t=document.createElement("link");return void 0===e.attrs.type&&(e.attrs.type="text/css"),e.attrs.rel="stylesheet",_(t,e.attrs),g(e,t),t}(t),r=E.bind(null,n,t),i=function(){m(n),n.href&&URL.revokeObjectURL(n.href)}):(n=v(t),r=x.bind(null,n),i=function(){m(n)});return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else i()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=s()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var n=p(e,t);return f(n,t),function(e){for(var r=[],i=0;i<n.length;i++){var s=n[i];(a=o[s.id]).refs--,r.push(a)}e&&f(p(e,t),t);for(i=0;i<r.length;i++){var a;if(0===(a=r[i]).refs){for(var c=0;c<a.parts.length;c++)a.parts[c]();delete o[a.id]}}}};var y,w=(y=[],function(e,t){return y[e]=t,y.filter(Boolean).join("\n")});function S(e,t,n,r){var i=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=w(t,i);else{var o=document.createTextNode(i),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(o,s[t]):e.appendChild(o)}}function x(e,t){var n=t.css,r=t.media;if(r&&e.setAttribute("media",r),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}function E(e,t,n){var r=n.css,i=n.sourceMap,o=void 0===t.convertToAbsoluteUrls&&i;(t.convertToAbsoluteUrls||o)&&(r=h(r)),i&&(r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */");var s=new Blob([r],{type:"text/css"}),a=e.href;e.href=URL.createObjectURL(s),a&&URL.revokeObjectURL(a)}},function(e,t){e.exports=function(e){var t="undefined"!=typeof window&&window.location;if(!t)throw new Error("fixUrls requires window.location");if(!e||"string"!=typeof e)return e;var n=t.protocol+"//"+t.host,r=n+t.pathname.replace(/\/[^\/]*$/,"/");return e.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(e,t){var i,o=t.trim().replace(/^"(.*)"$/,(function(e,t){return t})).replace(/^'(.*)'$/,(function(e,t){return t}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(o)?e:(i=0===o.indexOf("//")?o:0===o.indexOf("/")?n+o:r+o.replace(/^\.\//,""),"url("+JSON.stringify(i)+")")}))}},function(e,t,n){"use strict";n.r(t);var r=n(66),i=n.n(r),o=(n(327),n(68),n(27));var s=function(){this.__data__=[],this.size=0};var a=function(e,t){return e===t||e!=e&&t!=t};var c=function(e,t){for(var n=e.length;n--;)if(a(e[n][0],t))return n;return-1},l=Array.prototype.splice;var u=function(e){var t=this.__data__,n=c(t,e);return!(n<0)&&(n==t.length-1?t.pop():l.call(t,n,1),--this.size,!0)};var d=function(e){var t=this.__data__,n=c(t,e);return n<0?void 0:t[n][1]};var h=function(e){return c(this.__data__,e)>-1};var f=function(e,t){var n=this.__data__,r=c(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function p(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[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(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n};var _=function(e){return this.__data__.get(e)};var b=function(e){return this.__data__.has(e)},y=n(5),w=y.a.Symbol,S=Object.prototype,x=S.hasOwnProperty,E=S.toString,A=w?w.toStringTag:void 0;var C=function(e){var t=x.call(e,A),n=e[A];try{e[A]=void 0;var r=!0}catch(e){}var i=E.call(e);return r&&(t?e[A]=n:delete e[A]),i},j=Object.prototype.toString;var O=function(e){return j.call(e)},T=w?w.toStringTag:void 0;var k=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":T&&T in Object(e)?C(e):O(e)};var N=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var I,M=function(e){if(!N(e))return!1;var t=k(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},R=y.a["__core-js_shared__"],D=(I=/[^.]+$/.exec(R&&R.keys&&R.keys.IE_PROTO||""))?"Symbol(src)_1."+I:"";var P=function(e){return!!D&&D in e},L=Function.prototype.toString;var F=function(e){if(null!=e){try{return L.call(e)}catch(e){}try{return e+""}catch(e){}}return""},z=/^\[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(e){return!(!N(e)||P(e))&&(M(e)?$:z).test(F(e))};var G=function(e,t){return null==e?void 0:e[t]};var V=function(e,t){var n=G(e,t);return W(n)?n: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(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},K=Object.prototype.hasOwnProperty;var Z=function(e){var t=this.__data__;if(X){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return K.call(t,e)?t[e]:void 0},ee=Object.prototype.hasOwnProperty;var te=function(e){var t=this.__data__;return X?void 0!==t[e]:ee.call(t,e)};var ne=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=X&&void 0===t?"__lodash_hash_undefined__":t,this};function re(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[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(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var ae=function(e,t){var n=e.__data__;return se(t)?n["string"==typeof t?"string":"hash"]:n.map};var ce=function(e){var t=ae(this,e).delete(e);return this.size-=t?1:0,t};var le=function(e){return ae(this,e).get(e)};var ue=function(e){return ae(this,e).has(e)};var de=function(e,t){var n=ae(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};function he(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[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(e,t){var n=this.__data__;if(n instanceof g){var r=n.__data__;if(!J||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new fe(r)}return n.set(e,t),this.size=n.size,this};function ge(e){var t=this.__data__=new g(e);this.size=t.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(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e},_e=function(){try{var e=V(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var be=function(e,t,n){"__proto__"==t&&_e?_e(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},ye=Object.prototype.hasOwnProperty;var we=function(e,t,n){var r=e[t];ye.call(e,t)&&a(r,n)&&(void 0!==n||t in e)||be(e,t,n)};var Se=function(e,t,n,r){var i=!n;n||(n={});for(var o=-1,s=t.length;++o<s;){var a=t[o],c=r?r(n[a],e[a],a,n,e):void 0;void 0===c&&(c=e[a]),i?be(n,a,c):we(n,a,c)}return n};var xe=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r};var Ee=function(e){return null!=e&&"object"==typeof e};var Ae=function(e){return Ee(e)&&"[object Arguments]"==k(e)},Ce=Object.prototype,je=Ce.hasOwnProperty,Oe=Ce.propertyIsEnumerable,Te=Ae(function(){return arguments}())?Ae:function(e){return Ee(e)&&je.call(e,"callee")&&!Oe.call(e,"callee")},ke=Array.isArray,Ne=n(21),Ie=/^(?:0|[1-9]\d*)$/;var Me=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Ie.test(e))&&e>-1&&e%1==0&&e<t};var Re=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=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]"]=!0,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]"]=!1;var Pe=function(e){return Ee(e)&&Re(e.length)&&!!De[k(e)]};var Le=function(e){return function(t){return e(t)}},Fe=n(14),ze=Fe.a&&Fe.a.isTypedArray,Be=ze?Le(ze):Pe,qe=Object.prototype.hasOwnProperty;var He=function(e,t){var n=ke(e),r=!n&&Te(e),i=!n&&!r&&Object(Ne.a)(e),o=!n&&!r&&!i&&Be(e),s=n||r||i||o,a=s?xe(e.length,String):[],c=a.length;for(var l in e)!t&&!qe.call(e,l)||s&&("length"==l||i&&("offset"==l||"parent"==l)||o&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||Me(l,c))||a.push(l);return a},Ue=Object.prototype;var $e=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Ue)};var We=function(e,t){return function(n){return e(t(n))}},Ge=We(Object.keys,Object),Ve=Object.prototype.hasOwnProperty;var Je=function(e){if(!$e(e))return Ge(e);var t=[];for(var n in Object(e))Ve.call(e,n)&&"constructor"!=n&&t.push(n);return t};var Xe=function(e){return null!=e&&Re(e.length)&&!M(e)};var Qe=function(e){return Xe(e)?He(e):Je(e)};var Ye=function(e,t){return e&&Se(t,Qe(t),e)};var Ke=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t},Ze=Object.prototype.hasOwnProperty;var et=function(e){if(!N(e))return Ke(e);var t=$e(e),n=[];for(var r in e)("constructor"!=r||!t&&Ze.call(e,r))&&n.push(r);return n};var tt=function(e){return Xe(e)?He(e,!0):et(e)};var nt=function(e,t){return e&&Se(t,tt(t),e)},rt=n(160);var it=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t};var ot=function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,o=[];++n<r;){var s=e[n];t(s,n,e)&&(o[i++]=s)}return o};var st=function(){return[]},at=Object.prototype.propertyIsEnumerable,ct=Object.getOwnPropertySymbols,lt=ct?function(e){return null==e?[]:(e=Object(e),ot(ct(e),(function(t){return at.call(e,t)})))}:st;var ut=function(e,t){return Se(e,lt(e),t)};var dt=function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e},ht=We(Object.getPrototypeOf,Object),ft=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)dt(t,lt(e)),e=ht(e);return t}:st;var pt=function(e,t){return Se(e,ft(e),t)};var gt=function(e,t,n){var r=t(e);return ke(e)?r:dt(r,n(e))};var mt=function(e){return gt(e,Qe,lt)};var vt=function(e){return gt(e,tt,ft)},_t=V(y.a,"DataView"),bt=V(y.a,"Promise"),yt=V(y.a,"Set"),wt=V(y.a,"WeakMap"),St=F(_t),xt=F(J),Et=F(bt),At=F(yt),Ct=F(wt),jt=k;(_t&&"[object DataView]"!=jt(new _t(new ArrayBuffer(1)))||J&&"[object Map]"!=jt(new J)||bt&&"[object Promise]"!=jt(bt.resolve())||yt&&"[object Set]"!=jt(new yt)||wt&&"[object WeakMap]"!=jt(new wt))&&(jt=function(e){var t=k(e),n="[object Object]"==t?e.constructor:void 0,r=n?F(n):"";if(r)switch(r){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 t});var Ot=jt,Tt=Object.prototype.hasOwnProperty;var kt=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Tt.call(e,"index")&&(n.index=e.index,n.input=e.input),n},Nt=y.a.Uint8Array;var It=function(e){var t=new e.constructor(e.byteLength);return new Nt(t).set(new Nt(e)),t};var Mt=function(e,t){var n=t?It(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)},Rt=/\w*$/;var Dt=function(e){var t=new e.constructor(e.source,Rt.exec(e));return t.lastIndex=e.lastIndex,t},Pt=w?w.prototype:void 0,Lt=Pt?Pt.valueOf:void 0;var Ft=function(e){return Lt?Object(Lt.call(e)):{}};var zt=function(e,t){var n=t?It(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)};var Bt=function(e,t,n){var r=e.constructor;switch(t){case"[object ArrayBuffer]":return It(e);case"[object Boolean]":case"[object Date]":return new r(+e);case"[object DataView]":return Mt(e,n);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 zt(e,n);case"[object Map]":return new r;case"[object Number]":case"[object String]":return new r(e);case"[object RegExp]":return Dt(e);case"[object Set]":return new r;case"[object Symbol]":return Ft(e)}},qt=Object.create,Ht=function(){function e(){}return function(t){if(!N(t))return{};if(qt)return qt(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();var Ut=function(e){return"function"!=typeof e.constructor||$e(e)?{}:Ht(ht(e))};var $t=function(e){return Ee(e)&&"[object Map]"==Ot(e)},Wt=Fe.a&&Fe.a.isMap,Gt=Wt?Le(Wt):$t;var Vt=function(e){return Ee(e)&&"[object Set]"==Ot(e)},Jt=Fe.a&&Fe.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]"]=!0,Qt["[object Error]"]=Qt["[object Function]"]=Qt["[object WeakMap]"]=!1;var Yt=function e(t,n,r,i,o,s){var a,c=1&n,l=2&n,u=4&n;if(r&&(a=o?r(t,i,o,s):r(t)),void 0!==a)return a;if(!N(t))return t;var d=ke(t);if(d){if(a=kt(t),!c)return it(t,a)}else{var h=Ot(t),f="[object Function]"==h||"[object GeneratorFunction]"==h;if(Object(Ne.a)(t))return Object(rt.a)(t,c);if("[object Object]"==h||"[object Arguments]"==h||f&&!o){if(a=l||f?{}:Ut(t),!c)return l?pt(t,nt(a,t)):ut(t,Ye(a,t))}else{if(!Qt[h])return o?t:{};a=Bt(t,h,c)}}s||(s=new me);var p=s.get(t);if(p)return p;s.set(t,a),Xt(t)?t.forEach((function(i){a.add(e(i,n,r,i,t,s))})):Gt(t)&&t.forEach((function(i,o){a.set(o,e(i,n,r,o,t,s))}));var g=u?l?vt:mt:l?keysIn:Qe,m=d?void 0:g(t);return ve(m||t,(function(i,o){m&&(i=t[o=i]),we(a,o,e(i,n,r,o,t,s))})),a};var Kt=function(e){return Yt(e,5)};var Zt=function(e){return"string"==typeof e||!ke(e)&&Ee(e)&&"[object String]"==k(e)};var en=function(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))};function tn(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}function nn(e){return"string"!=typeof e&&(console.warn("".concat(e," used as a key, but it is not a string.")),e=String(e)),e}var rn=function(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),r=0;r<e.length;r+=1)n.append(e[r]);return n.getBlob(t.type)}},on="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",sn=/^~~local_forage_type~([^~]+)~/,an="__lfsc__:".length,cn=an+"arbf".length,ln=Object.prototype.toString;function un(e){var t,n,r,i,o,s=.75*e.length,a=e.length,c=0;"="===e[e.length-1]&&(s--,"="===e[e.length-2]&&s--);var l=new ArrayBuffer(s),u=new Uint8Array(l);for(t=0;t<a;t+=4)n=on.indexOf(e[t]),r=on.indexOf(e[t+1]),i=on.indexOf(e[t+2]),o=on.indexOf(e[t+3]),u[c++]=n<<2|r>>4,u[c++]=(15&r)<<4|i>>2,u[c++]=(3&i)<<6|63&o;return l}function dn(e){var t,n=new Uint8Array(e),r="";for(t=0;t<n.length;t+=3)r+=on[n[t]>>2],r+=on[(3&n[t])<<4|n[t+1]>>4],r+=on[(15&n[t+1])<<2|n[t+2]>>6],r+=on[63&n[t+2]];return n.length%3==2?r=r.substring(0,r.length-1)+"=":n.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}var hn={serialize:function(e,t){var n="";if(e&&(n=ln.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===ln.call(e.buffer))){var r,i="__lfsc__:";e instanceof ArrayBuffer?(r=e,i+="arbf"):(r=e.buffer,"[object Int8Array]"===n?i+="si08":"[object Uint8Array]"===n?i+="ui08":"[object Uint8ClampedArray]"===n?i+="uic8":"[object Int16Array]"===n?i+="si16":"[object Uint16Array]"===n?i+="ur16":"[object Int32Array]"===n?i+="si32":"[object Uint32Array]"===n?i+="ui32":"[object Float32Array]"===n?i+="fl32":"[object Float64Array]"===n?i+="fl64":t(new Error("Failed to get type for BinaryArray"))),t(i+dn(r))}else if("[object Blob]"===n){var o=new FileReader;o.onload=function(){var n="~~local_forage_type~"+e.type+"~"+dn(this.result);t("__lfsc__:blob"+n)},o.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}},deserialize:function(e){if("__lfsc__:"!==e.substring(0,an))return JSON.parse(e);var t,n=e.substring(cn),r=e.substring(an,cn);if("blob"===r&&sn.test(n)){var i=n.match(sn);t=i[1],n=n.substring(i[0].length)}var o=un(n);switch(r){case"arbf":return o;case"blob":return rn([o],{type:t});case"si08":return new Int8Array(o);case"ui08":return new Uint8Array(o);case"uic8":return new Uint8ClampedArray(o);case"si16":return new Int16Array(o);case"ur16":return new Uint16Array(o);case"si32":return new Int32Array(o);case"ui32":return new Uint32Array(o);case"fl32":return new Float32Array(o);case"fl64":return new Float64Array(o);default:throw new Error("Unkown type: "+r)}},stringToBuffer:un,bufferToString:dn};function fn(e,t){let n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}const pn={serializer:{serialize:hn.serialize,deserialize:hn.deserialize}};var gn={_driver:"sessionStorageWrapper",_initStorage:function(e){if(pn.keyPrefix=fn(e,this._defaultConfig),e)for(const t in e)pn[t]=e[t]},_support:function(){try{if(sessionStorage&&"setItem"in sessionStorage)return!0}catch(e){console.log(e)}return!1}(),iterate:function(e,t){const n=this.ready().then((function(){const t=pn.keyPrefix,n=t.length,r=sessionStorage.length;let i=1;for(let o=0;o<r;o++){const r=sessionStorage.key(o);if(0!==r.indexOf(t))continue;let s=sessionStorage.getItem(r);if(s&&(s=pn.serializer.deserialize(s)),s=e(s,r.substring(n),i++),void 0!==s)return s}}));return en(n,t),n},getItem:function(e,t){e=nn(e);const n=this.ready().then((function(){let t=sessionStorage.getItem(pn.keyPrefix+e);return t&&(t=pn.serializer.deserialize(t)),t}));return en(n,t),n},setItem:function(e,t,n){e=nn(e);const r=this.ready().then((function(){void 0===t&&(t=null);const n=t;return new Promise((function(r,i){pn.serializer.serialize(t,(function(t,o){if(o)i(o);else try{sessionStorage.setItem(pn.keyPrefix+e,t),r(n)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||i(e),i(e)}}))}))}));return en(r,n),r},removeItem:function(e,t){e=nn(e);const n=this.ready().then((function(){sessionStorage.removeItem(pn.keyPrefix+e)}));return en(n,t),n},clear:function(e){const t=this.ready().then((function(){const e=pn.keyPrefix;for(let t=sessionStorage.length-1;t>=0;t--){const n=sessionStorage.key(t);0===n.indexOf(e)&&sessionStorage.removeItem(n)}}));return en(t,e),t},length:function(e){const t=this.keys().then((function(e){return e.length}));return en(t,e),t},key:function(e,t){const n=this.ready().then((function(){let t;try{t=sessionStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(pn.keyPrefix.length)),t}));return en(n,t),n},keys:function(e){const t=this.ready().then((function(){const e=sessionStorage.length,t=[];for(let n=0;n<e;n++){const e=sessionStorage.key(n);0===e.indexOf(pn.keyPrefix)&&t.push(e.substring(pn.keyPrefix.length))}return t}));return en(t,e),t},dropInstance:function(e,t){if(t=tn.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){const t=this.config();e.name=e.name||t.name,e.storeName=e.storeName||t.storeName}const n=this;let r;return r=e.name?new Promise((function(t){e.storeName?t(fn(e,n._defaultConfig)):t("".concat(e.name,"/"))})).then((function(e){for(let t=sessionStorage.length-1;t>=0;t--){const n=sessionStorage.key(t);0===n.indexOf(e)&&sessionStorage.removeItem(n)}})):Promise.reject(new Error("Invalid arguments")),en(r,t),r}};function mn(){return(65536*(1+Math.random())|0).toString(16).substring(1)}class vn{constructor(e,t){if("local"===t&&!window.localStorage)throw new Error("Skeletor.storage: Environment does not support localStorage.");if("session"===t&&!window.sessionStorage)throw new Error("Skeletor.storage: Environment does not support sessionStorage.");Zt(t)?this.storeInitialized=this.initStore(t):(this.store=t,this.storeInitialized=Promise.resolve()),this.name=e}async initStore(e){if("session"===e)o.setDriver(gn._driver);else if("local"===e)await o.config({driver:o.LOCALSTORAGE});else if("indexed"!==e)throw new Error("Skeletor.storage: No storage type was specified");this.store=o}async clear(){await this.store.removeItem(this.name).catch(e=>console.error(e));const e=new RegExp("^".concat(this.name,"-")),t=(await this.store.keys()).filter(t=>e.test(t));await Promise.all(t.map(e=>this.store.removeItem(e).catch(e=>console.error(e))))}sync(e){const t=this;async function n(e,n,r){let i,o,s,a;const c=n.collection;["patch","update"].includes(e)&&(a=Kt(n.attributes)),await t.storeInitialized;try{const o=n.attributes;switch(e){case"read":i=void 0!==n.id?await t.find(n):await t.findAll();break;case"create":i=await t.create(n,r);break;case"patch":case"update":r.wait&&(n.attributes=a),s=t.update(n,r),r.wait&&(n.attributes=o),i=await s;break;case"delete":i=await t.destroy(n,c)}}catch(e){o=22===e.code&&0===t.getStorageSize()?"Private browsing is unsupported":e.message}if(i){if(r&&r.success){const t="read"===e?i:null;r.success(t,r)}}else o=o||"Record Not Found",r&&r.error&&r.error(o)}return n.__name__="localSync",n}removeCollectionReference(e,t){if(!t)return;const n=t.filter(t=>t.id!==e.id).map(e=>this.getItemName(e.id));return this.store.setItem(this.name,n)}addCollectionReference(e,t){if(!t)return;const n=t.map(e=>this.getItemName(e.id)),r=this.getItemName(e.id);return n.includes(r)||n.push(r),this.store.setItem(this.name,n)}async save(e,t={}){const n=this.getItemName(e.id),r=await this.store.setItem(n,e.toJSON());return await this.addCollectionReference(e,e.collection),r}create(e,t){return e.id||(e.id=mn()+mn()+"-"+mn()+"-"+mn()+"-"+mn()+"-"+mn()+mn()+mn(),e.set(e.idAttribute,e.id,t)),this.save(e)}update(e,t){return this.save(e,t)}find(e){return this.store.getItem(this.getItemName(e.id))}async findAll(){const e=await this.store.getItem(this.name);return e&&e.length?Promise.all(e.map(e=>this.store.getItem(e))):[]}async destroy(e,t){return await this.store.removeItem(this.getItemName(e.id)),await this.removeCollectionReference(e,t),e}getStorageSize(){return this.store.length}getItemName(e){return this.name+"-"+e}}vn.sessionStorageInitialized=o.defineDriver(gn),vn.localForage=o;var _n=vn,bn=n(161),yn=n.n(bn),wn=n(4),Sn=n.n(wn),xn=Function.prototype,En=Object.prototype,An=xn.toString,Cn=En.hasOwnProperty,jn=An.call(Object);var On=function(e){if(!Ee(e)||"[object Object]"!=k(e))return!1;var t=ht(e);if(null===t)return!0;var n=Cn.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&An.call(n)==jn};var Tn,kn,Nn,In,Mn=function(e){return Ee(e)&&1===e.nodeType&&!On(e)};const Rn={debug:0,info:1,warn:2,error:3,fatal:4},Dn=Object.assign({debug:(null===(Tn=console)||void 0===Tn?void 0:Tn.log)?console.log.bind(console):function(){},error:(null===(kn=console)||void 0===kn?void 0:kn.log)?console.log.bind(console):function(){},info:(null===(Nn=console)||void 0===Nn?void 0:Nn.log)?console.log.bind(console):function(){},warn:(null===(In=console)||void 0===In?void 0:In.log)?console.log.bind(console):function(){}},console);var Pn={setLogLevel(e){if(!["debug","info","warn","error","fatal"].includes(e))throw new Error("Invalid loglevel: ".concat(e));this.loglevel=e},log(e,t,n=""){if(Rn[t]<Rn[this.loglevel])return;"error"===t||"fatal"===t?n=n||"color: maroon":"debug"===t&&(n=n||"color: green"),e instanceof Error?e=e.stack:Mn(e)&&(e=e.outerHTML);const r=n?"%c":"";"error"===t?Dn.error("".concat(r," ERROR: ").concat(e),n):"warn"===t?Dn.warn("".concat(r," ").concat((new Date).toISOString()," WARNING: ").concat(e),n):"fatal"===t?Dn.error("".concat(r," FATAL: ").concat(e),n):"debug"===t?Dn.debug("".concat(r," ").concat((new Date).toISOString()," DEBUG: ").concat(e),n):Dn.info("".concat(r," ").concat((new Date).toISOString()," INFO: ").concat(e),n)},debug(e,t){this.log(e,"debug",t)},error(e,t){this.log(e,"error",t)},info(e,t){this.log(e,"info",t)},warn(e,t){this.log(e,"warn",t)},fatal(e,t){this.log(e,"fatal",t)}},Ln=n(162),Fn=n.n(Ln),zn=n(44),Bn=n.n(zn),qn=n(45),Hn=n.n(qn),Un=n(36),$n=n.n(Un),Wn=n(163),Gn=n.n(Wn),Vn=n(62),Jn=n.n(Vn),Xn=n(164),Qn=n.n(Xn),Yn=n(33),Kn=n.n(Yn),Zn=n(93),er=n.n(Zn),tr=n(165),nr=n.n(tr),rr=n(166),ir=n.n(rr),or=n(92),sr=n.n(or);function ar(e,t){this.name=t,this.plugged=e,void 0===this.plugged.__super__?this.plugged.__super__={}:"string"==typeof this.plugged.__super__&&(this.plugged.__super__={__string__:this.plugged.__super__}),this.plugged.__super__[t]=this.plugged,this.plugins={},this.initialized_plugins=[]}Hn()(ar.prototype,{wrappedOverride:function(e,t,n,r){return"function"==typeof n&&(void 0===this.__super__&&(this.__super__=r),this.__super__[e]=n.bind(this)),t.apply(this,Fn()(arguments,4))},_overrideAttribute:function(e,t){let n=t.overrides[e];if("function"==typeof n){let t={};t[this.name]=this.plugged;let r=er()(this.wrappedOverride,e,n,this.plugged[e],t);this.plugged[e]=r}else this.plugged[e]=n},_extendObject:function(e,t){e.prototype.__super__||(e.prototype.__super__={},e.prototype.__super__[this.name]=this.plugged);let n=this;Bn()(t,(function(t,r){if("events"===r)e.prototype[r]=Hn()(t,e.prototype[r]);else if("function"==typeof t){let i={};i[n.name]=n.plugged;let o=er()(n.wrappedOverride,r,t,e.prototype[r],i);e.prototype[r]=o}else e.prototype[r]=t}))},loadPluginDependencies:function(e){Bn()(e.dependencies,t=>{let n=this.plugins[t];if(n){if($n()(n.dependencies,e.__name__))throw'Found a circular dependency between the plugins "'+e.__name__+'" and "'+t+'"';this.initializePlugin(n)}else this.throwUndefinedDependencyError('Could not find dependency "'+t+'" for the plugin "'+e.__name__+"\". If it's needed, make sure it's loaded by require.js")})},throwUndefinedDependencyError:function(e){if(this.plugged.strict_plugin_dependencies)throw e;console.warn?console.warn(e):console.log(e)},applyOverrides:function(e){Bn()(Object.keys(e.overrides||{}),t=>{let n=e.overrides[t];"object"==typeof n?void 0===this.plugged[t]?this.throwUndefinedDependencyError('Plugin "'.concat(e.__name__,'" tried to override "').concat(t,"\" but it's not found.")):this._extendObject(this.plugged[t],n):this._overrideAttribute(t,e)})},initializePlugin:function(e){$n()(Kn()(this.allowed_plugins),e.__name__)&&($n()(this.initialized_plugins,e.__name__)||(Gn()(e.enabled)&&e.enabled||Jn()(e.enabled)&&e.enabled(this.plugged)||Qn()(e.enabled))&&(Hn()(e,this.properties),e.dependencies&&this.loadPluginDependencies(e),this.applyOverrides(e),"function"==typeof e.initialize&&e.initialize.bind(e)(this),this.initialized_plugins.push(e.__name__)))},registerPlugin:function(e,t){if(e in this.plugins)throw new Error("Error: Plugin name "+e+" is already taken");t.__name__=e,this.plugins[e]=t},initializePlugins:function(e={},t=[],n=[]){ir()(this.plugins)&&(this.properties=e,this.allowed_plugins=nr()(this.plugins,(function(e,r){return(!t.length||t.length&&$n()(t,r))&&!$n()(n,r)})),Bn()(sr()(this.allowed_plugins),this.initializePlugin.bind(this)))}});var cr={enable:function(e,t,n){void 0===n&&(n="pluginSocket"),void 0===t&&(t="plugged");let r={};return r[n]=new ar(e,t),Hn()(e,r)}},lr=n(167),ur=n.n(lr),dr=n(168),hr=n.n(dr),fr=n(2),pr=n.n(fr),gr=n(0);var mr=function(e,t){var n=Ht(e);return null==t?n:Ye(n,t)};var vr=function(e){return e};var _r=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)},br=Math.max;var yr=function(e,t,n){return t=br(void 0===t?e.length-1:t,0),function(){for(var r=arguments,i=-1,o=br(r.length-t,0),s=Array(o);++i<o;)s[i]=r[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=r[i];return a[t]=n(s),_r(e,this,a)}};var wr=function(e){return function(){return e}},Sr=_e?function(e,t){return _e(e,"toString",{configurable:!0,enumerable:!1,value:wr(t),writable:!0})}:vr,xr=Date.now;var Er=function(e){var t=0,n=0;return function(){var r=xr(),i=16-(r-n);if(n=r,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(Sr);var Ar=function(e,t){return Er(yr(e,t,vr),e+"")};var Cr=function(e,t,n){if(!N(n))return!1;var r=typeof t;return!!("number"==r?Xe(n)&&Me(t,n.length):"string"==r&&t in n)&&a(n[t],e)};var jr=function(e){return Ar((function(t,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(o=e.length>3&&"function"==typeof o?(i--,o):void 0,s&&Cr(n[0],n[1],s)&&(o=i<3?void 0:o,i=1),t=Object(t);++r<i;){var a=n[r];a&&e(t,a,r,o)}return t}))}((function(e,t){Se(t,tt(t),e)})),Or=Object.prototype.hasOwnProperty;var Tr=function(e,t){return null!=e&&Or.call(e,t)};var kr=function(e){return"symbol"==typeof e||Ee(e)&&"[object Symbol]"==k(e)},Nr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ir=/^\w*$/;var Mr=function(e,t){if(ke(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!kr(e))||(Ir.test(e)||!Nr.test(e)||null!=t&&e in Object(t))};function Rr(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(Rr.Cache||fe),n}Rr.Cache=fe;var Dr=Rr;var Pr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Lr=/\\(\\)?/g,Fr=function(e){var t=Dr(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Pr,(function(e,n,r,i){t.push(r?i.replace(Lr,"$1"):n||e)})),t}));var zr=function(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i},Br=w?w.prototype:void 0,qr=Br?Br.toString:void 0;var Hr=function e(t){if("string"==typeof t)return t;if(ke(t))return zr(t,e)+"";if(kr(t))return qr?qr.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n};var Ur=function(e){return null==e?"":Hr(e)};var $r=function(e,t){return ke(e)?e:Mr(e,t)?[e]:Fr(Ur(e))};var Wr=function(e){if("string"==typeof e||kr(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t};var Gr=function(e,t,n){for(var r=-1,i=(t=$r(t,e)).length,o=!1;++r<i;){var s=Wr(t[r]);if(!(o=null!=e&&n(e,s)))break;e=e[s]}return o||++r!=i?o:!!(i=null==e?0:e.length)&&Re(i)&&Me(s,i)&&(ke(e)||Te(e))};var Vr=function(e,t){return null!=e&&Gr(e,t,Tr)};var Jr=function(e,t,n){var r=-1,i=(t=$r(t,e)).length;for(i||(i=1,e=void 0);++r<i;){var o=null==e?void 0:e[Wr(t[r])];void 0===o&&(r=i,o=n),e=M(o)?o.call(e):o}return e};Error;function Xr(e,t){const n=this;let r;return r=e&&Vr(e,"constructor")?e.constructor:function(){return n.apply(this,arguments)},jr(r,n,t),r.prototype=mr(n.prototype,e),r.prototype.constructor=r,r.__super__=n.prototype,r}function Qr(){const e={isResolved:!1,isPending:!0,isRejected:!1},t=new Promise((t,n)=>{e.resolve=t,e.reject=n});return Object.assign(t,e),t.then((function(e){return t.isResolved=!0,t.isPending=!1,t.isRejected=!1,e}),(function(e){throw t.isResolved=!1,t.isPending=!1,t.isRejected=!0,e})),t}function Yr(){throw new Error('A "url" property or function must be specified')}function Kr(e,t){const n=t.error;t.error=function(r){n&&n.call(t.context,e,r,t),e.trigger("error",e,r,t)}}const Zr={create:"POST",update:"PUT",patch:"PATCH",delete:"DELETE",read:"GET"};function ei(e){const t=Jr(e,"browserStorage")||Jr(e.collection,"browserStorage");return t?t.sync():ti}function ti(e,t,n={}){const r={type:Zr[e],dataType:"json"};n.url||(r.url=Jr(t,"url")||Yr()),null!=n.data||!t||"create"!==e&&"update"!==e&&"patch"!==e||(r.contentType="application/json",r.data=JSON.stringify(n.attrs||t.toJSON(n))),"GET"!==r.type&&(r.processData=!1);const i=n.error;n.error=function(e,t,r){n.textStatus=t,n.errorThrown=r,i&&i.call(n.context,e,t,r)};const o=n.xhr=function(){return fetch.apply(this,arguments)}(jr(r,n));return t.trigger("request",t,o,n),o}var ni=Object.prototype.hasOwnProperty;var ri=function(e){if(null==e)return!0;if(Xe(e)&&(ke(e)||"string"==typeof e||"function"==typeof e.splice||Object(Ne.a)(e)||Be(e)||Te(e)))return!e.length;var t=Ot(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if($e(e))return!Je(e).length;for(var n in e)if(ni.call(e,n))return!1;return!0},ii=/^\s+|\s+$/g,oi=/^[-+]0x[0-9a-f]+$/i,si=/^0b[01]+$/i,ai=/^0o[0-7]+$/i,ci=parseInt;var li=function(e){if("number"==typeof e)return e;if(kr(e))return NaN;if(N(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=N(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(ii,"");var n=si.test(e);return n||ai.test(e)?ci(e.slice(2),n?2:8):oi.test(e)?NaN:+e};var ui=function(e){return e?(e=li(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0};var di=function(e){var t=ui(e),n=t%1;return t==t?n?t-n:t:0};var hi=function(e,t){var n;if("function"!=typeof t)throw new TypeError("Expected a function");return e=di(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}};var fi=function(e){return hi(2,e)},pi=0;var gi=function(e){var t=++pi;return Ur(e)+t};const mi={},vi=/\s+/;let _i;const bi=function e(t,n,r,i,o){let s,a=0;if(r&&"object"==typeof r){void 0!==i&&"context"in o&&void 0===o.context&&(o.context=i);for(s=Qe(r);a<s.length;a++)n=e(t,n,s[a],r[s[a]],o)}else if(r&&vi.test(r))for(s=r.split(vi);a<s.length;a++)n=t(n,s[a],i,o);else n=t(n,r,i,o);return n};mi.on=function(e,t,n){if(this._events=bi(yi,this._events||{},e,t,{context:n,ctx:this,listening:_i}),_i){(this._listeners||(this._listeners={}))[_i.id]=_i,_i.interop=!1}return this},mi.listenTo=function(e,t,n){if(!e)return this;const r=e._listenId||(e._listenId=gi("l")),i=this._listeningTo||(this._listeningTo={});let o=_i=i[r];o||(this._listenId||(this._listenId=gi("l")),o=_i=i[r]=new Ci(this,e));const s=wi(e,t,n,this);if(_i=void 0,s)throw s;return o.interop&&o.on(t,n),this};const yi=function(e,t,n,r){if(n){const i=e[t]||(e[t]=[]),o=r.context,s=r.ctx,a=r.listening;a&&a.count++,i.push({callback:n,context:o,ctx:o||s,listening:a})}return e},wi=function(e,t,n,r){try{e.on(t,n,r)}catch(e){return e}};mi.off=function(e,t,n){return this._events?(this._events=bi(Si,this._events,e,t,{context:n,listeners:this._listeners}),this):this},mi.stopListening=function(e,t,n){const r=this._listeningTo;if(!r)return this;const i=e?[e._listenId]:Qe(r);for(let e=0;e<i.length;e++){const o=r[i[e]];if(!o)break;o.obj.off(t,n,this),o.interop&&o.off(t,n)}return ri(r)&&(this._listeningTo=void 0),this};const Si=function(e,t,n,r){if(!e)return;const i=r.context,o=r.listeners;let s,a=0;if(t||i||n){for(s=t?[t]:Qe(e);a<s.length;a++){const r=e[t=s[a]];if(!r)break;const o=[];for(let e=0;e<r.length;e++){const s=r[e];if(n&&n!==s.callback&&n!==s.callback._callback||i&&i!==s.context)o.push(s);else{const e=s.listening;e&&e.off(t,n)}}o.length?e[t]=o:delete e[t]}return e}for(s=Qe(o);a<s.length;a++)o[s[a]].cleanup()};mi.once=function(e,t,n){const r=bi(xi,{},e,t,this.off.bind(this));return"string"==typeof e&&null==n&&(t=void 0),this.on(r,t,n)},mi.listenToOnce=function(e,t,n){const r=bi(xi,{},t,n,this.stopListening.bind(this,e));return this.listenTo(e,r)};const xi=function(e,t,n,r){if(n){const i=e[t]=fi((function(){r(t,i),n.apply(this,arguments)}));i._callback=n}return e};mi.trigger=function(e){if(!this._events)return this;const t=Math.max(0,arguments.length-1),n=Array(t);for(let e=0;e<t;e++)n[e]=arguments[e+1];return bi(Ei,this._events,e,void 0,n),this};const Ei=function(e,t,n,r){if(e){const n=e[t];let i=e.all;n&&i&&(i=i.slice()),n&&Ai(n,r),i&&Ai(i,[t].concat(r))}return e},Ai=function(e,t){let n,r=-1;const i=e.length,o=t[0],s=t[1],a=t[2];switch(t.length){case 0:for(;++r<i;)(n=e[r]).callback.call(n.ctx);return;case 1:for(;++r<i;)(n=e[r]).callback.call(n.ctx,o);return;case 2:for(;++r<i;)(n=e[r]).callback.call(n.ctx,o,s);return;case 3:for(;++r<i;)(n=e[r]).callback.call(n.ctx,o,s,a);return;default:for(;++r<i;)(n=e[r]).callback.apply(n.ctx,t);return}},Ci=function(e,t){this.id=e._listenId,this.listener=e,this.obj=t,this.interop=!0,this.count=0,this._events=void 0};Ci.prototype.on=mi.on,Ci.prototype.off=function(e,t){let n;this.interop?(this._events=bi(Si,this._events,e,t,{context:void 0,listeners:void 0}),n=!this._events):(this.count--,n=0===this.count),n&&this.cleanup()},Ci.prototype.cleanup=function(){delete this.listener._listeningTo[this.obj._listenId],this.interop||delete this.obj._listeners[this.id]},mi.bind=mi.on,mi.unbind=mi.off;var ji=function(e){return Yt(e,4)},Oi=Object.prototype,Ti=Oi.hasOwnProperty,ki=Ar((function(e,t){e=Object(e);var n=-1,r=t.length,i=r>2?t[2]:void 0;for(i&&Cr(t[0],t[1],i)&&(r=1);++n<r;)for(var o=t[n],s=tt(o),c=-1,l=s.length;++c<l;){var u=s[c],d=e[u];(void 0===d||a(d,Oi[u])&&!Ti.call(e,u))&&(e[u]=o[u])}return e}));var Ni=function(e,t,n){if("function"!=typeof e)throw new TypeError("Expected a function");return setTimeout((function(){e.apply(void 0,n)}),t)},Ii=Ar((function(e,t){return Ni(e,1,t)}));var Mi=function(e){return function(t){return null==e?void 0:e[t]}}({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}),Ri=/[&<>"']/g,Di=RegExp(Ri.source);var Pi=function(e){return(e=Ur(e))&&Di.test(e)?e.replace(Ri,Mi):e};var Li=function(e){return function(t,n,r){for(var i=-1,o=Object(t),s=r(t),a=s.length;a--;){var c=s[e?a:++i];if(!1===n(o[c],c,o))break}return t}},Fi=Li();var zi=function(e,t){return e&&Fi(e,t,Qe)};var Bi=function(e,t,n,r){return zi(e,(function(e,i,o){t(r,n(e),i,o)})),r};var qi=function(e,t){return function(n,r){return Bi(n,e,t(r),{})}},Hi=Object.prototype.toString,Ui=qi((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Hi.call(t)),e[t]=n}),wr(vr));var $i=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};var Wi=function(e){return this.__data__.has(e)};function Gi(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new fe;++t<n;)this.add(e[t])}Gi.prototype.add=Gi.prototype.push=$i,Gi.prototype.has=Wi;var Vi=Gi;var Ji=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1};var Xi=function(e,t){return e.has(t)};var Qi=function(e,t,n,r,i,o){var s=1&n,a=e.length,c=t.length;if(a!=c&&!(s&&c>a))return!1;var l=o.get(e);if(l&&o.get(t))return l==t;var u=-1,d=!0,h=2&n?new Vi:void 0;for(o.set(e,t),o.set(t,e);++u<a;){var f=e[u],p=t[u];if(r)var g=s?r(p,f,u,t,e,o):r(f,p,u,e,t,o);if(void 0!==g){if(g)continue;d=!1;break}if(h){if(!Ji(t,(function(e,t){if(!Xi(h,t)&&(f===e||i(f,e,n,r,o)))return h.push(t)}))){d=!1;break}}else if(f!==p&&!i(f,p,n,r,o)){d=!1;break}}return o.delete(e),o.delete(t),d};var Yi=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n};var Ki=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n},Zi=w?w.prototype:void 0,eo=Zi?Zi.valueOf:void 0;var to=function(e,t,n,r,i,o,s){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!o(new Nt(e),new Nt(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return a(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var c=Yi;case"[object Set]":var l=1&r;if(c||(c=Ki),e.size!=t.size&&!l)return!1;var u=s.get(e);if(u)return u==t;r|=2,s.set(e,t);var d=Qi(c(e),c(t),r,i,o,s);return s.delete(e),d;case"[object Symbol]":if(eo)return eo.call(e)==eo.call(t)}return!1},no=Object.prototype.hasOwnProperty;var ro=function(e,t,n,r,i,o){var s=1&n,a=mt(e),c=a.length;if(c!=mt(t).length&&!s)return!1;for(var l=c;l--;){var u=a[l];if(!(s?u in t:no.call(t,u)))return!1}var d=o.get(e);if(d&&o.get(t))return d==t;var h=!0;o.set(e,t),o.set(t,e);for(var f=s;++l<c;){var p=e[u=a[l]],g=t[u];if(r)var m=s?r(g,p,u,t,e,o):r(p,g,u,e,t,o);if(!(void 0===m?p===g||i(p,g,n,r,o):m)){h=!1;break}f||(f="constructor"==u)}if(h&&!f){var v=e.constructor,_=t.constructor;v==_||!("constructor"in e)||!("constructor"in t)||"function"==typeof v&&v instanceof v&&"function"==typeof _&&_ instanceof _||(h=!1)}return o.delete(e),o.delete(t),h},io=Object.prototype.hasOwnProperty;var oo=function(e,t,n,r,i,o){var s=ke(e),a=ke(t),c=s?"[object Array]":Ot(e),l=a?"[object Array]":Ot(t),u="[object Object]"==(c="[object Arguments]"==c?"[object Object]":c),d="[object Object]"==(l="[object Arguments]"==l?"[object Object]":l),h=c==l;if(h&&Object(Ne.a)(e)){if(!Object(Ne.a)(t))return!1;s=!0,u=!1}if(h&&!u)return o||(o=new me),s||Be(e)?Qi(e,t,n,r,i,o):to(e,t,c,n,r,i,o);if(!(1&n)){var f=u&&io.call(e,"__wrapped__"),p=d&&io.call(t,"__wrapped__");if(f||p){var g=f?e.value():e,m=p?t.value():t;return o||(o=new me),i(g,m,n,r,o)}}return!!h&&(o||(o=new me),ro(e,t,n,r,i,o))};var so=function e(t,n,r,i,o){return t===n||(null==t||null==n||!Ee(t)&&!Ee(n)?t!=t&&n!=n:oo(t,n,r,i,e,o))};var ao=function(e,t){return so(e,t)};var co=function(e,t,n,r){var i=n.length,o=i,s=!r;if(null==e)return!o;for(e=Object(e);i--;){var a=n[i];if(s&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++i<o;){var c=(a=n[i])[0],l=e[c],u=a[1];if(s&&a[2]){if(void 0===l&&!(c in e))return!1}else{var d=new me;if(r)var h=r(l,u,c,e,t,d);if(!(void 0===h?so(u,l,3,r,d):h))return!1}}return!0};var lo=function(e){return e==e&&!N(e)};var uo=function(e){for(var t=Qe(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,lo(i)]}return t};var ho=function(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}};var fo=function(e){var t=uo(e);return 1==t.length&&t[0][2]?ho(t[0][0],t[0][1]):function(n){return n===e||co(n,e,t)}};var po=function(e,t){for(var n=0,r=(t=$r(t,e)).length;null!=e&&n<r;)e=e[Wr(t[n++])];return n&&n==r?e:void 0};var go=function(e,t,n){var r=null==e?void 0:po(e,t);return void 0===r?n:r};var mo=function(e,t){return null!=e&&t in Object(e)};var vo=function(e,t){return null!=e&&Gr(e,t,mo)};var _o=function(e,t){return Mr(e)&&lo(t)?ho(Wr(e),t):function(n){var r=go(n,e);return void 0===r&&r===t?vo(n,e):so(t,r,3)}};var bo=function(e){return function(t){return null==t?void 0:t[e]}};var yo=function(e){return function(t){return po(t,e)}};var wo=function(e){return Mr(e)?bo(Wr(e)):yo(e)};var So=function(e){return"function"==typeof e?e:null==e?vr:"object"==typeof e?ke(e)?_o(e[0],e[1]):fo(e):wo(e)};var xo=function(e){return So("function"==typeof e?e:Yt(e,1))};var Eo=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0};var Ao=function(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r<i;)o[r]=e[r+t];return o};var Co=function(e,t){return t.length<2?e:po(e,Ao(t,0,-1))};var jo=function(e,t){return t=$r(t,e),null==(e=Co(e,t))||delete e[Wr(Eo(t))]};var Oo=function(e){return On(e)?void 0:e},To=w?w.isConcatSpreadable:void 0;var ko=function(e){return ke(e)||Te(e)||!!(To&&e&&e[To])};var No=function e(t,n,r,i,o){var s=-1,a=t.length;for(r||(r=ko),o||(o=[]);++s<a;){var c=t[s];n>0&&r(c)?n>1?e(c,n-1,r,i,o):dt(o,c):i||(o[o.length]=c)}return o};var Io=function(e){return(null==e?0:e.length)?No(e,1):[]};var Mo=function(e){return Er(yr(e,void 0,Io),e+"")},Ro=Mo((function(e,t){var n={};if(null==e)return n;var r=!1;t=zr(t,(function(t){return t=$r(t,e),r||(r=t.length>1),t})),Se(e,vt(e),n),r&&(n=Yt(n,7,Oo));for(var i=t.length;i--;)jo(n,t[i]);return n}));var Do=function(e,t,n,r){if(!N(e))return e;for(var i=-1,o=(t=$r(t,e)).length,s=o-1,a=e;null!=a&&++i<o;){var c=Wr(t[i]),l=n;if(i!=s){var u=a[c];void 0===(l=r?r(u,c,a):void 0)&&(l=N(u)?u:Me(t[i+1])?[]:{})}we(a,c,l),a=a[c]}return e};var Po=function(e,t,n){for(var r=-1,i=t.length,o={};++r<i;){var s=t[r],a=po(e,s);n(a,s)&&Do(o,$r(s,e),a)}return o};var Lo=function(e,t){return Po(e,t,(function(t,n){return vo(e,n)}))},Fo=Mo((function(e,t){return null==e?{}:Lo(e,t)}));const zo=function(e,t){let n=e||{};t||(t={}),this.preinitialize.apply(this,arguments),this.cid=gi(this.cidPrefix),this.attributes={},t.collection&&(this.collection=t.collection),t.parse&&(n=this.parse(n,t)||{});const r=Jr(this,"defaults");n=ki(jr({},r,n),r),this.set(n,t),this.changed={},this.initialize.apply(this,arguments)};zo.extend=Xr,Object.assign(zo.prototype,mi,{changed:null,validationError:null,idAttribute:"id",cidPrefix:"c",preinitialize:function(){},initialize:function(){},toJSON:function(e){return ji(this.attributes)},sync:function(e,t,n){return ei(this)(e,t,n)},get:function(e){return this.attributes[e]},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 Ui(this.attributes)},pick:function(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),Fo(this.attributes,e)},omit:function(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),Ro(this.attributes,e)},isEmpty:function(){return ri(this.attributes)},escape:function(e){return Pi(this.get(e))},has:function(e){return null!=this.get(e)},matches:function(e){return!!xo(e,this)(this.attributes)},set:function(e,t,n){if(null==e)return this;let r;if("object"==typeof e?(r=e,n=t):(r={})[e]=t,n||(n={}),!this._validate(r,n))return!1;const i=n.unset,o=n.silent,s=[],a=this._changing;this._changing=!0,a||(this._previousAttributes=ji(this.attributes),this.changed={});const c=this.attributes,l=this.changed,u=this._previousAttributes;for(const e in r)t=r[e],ao(c[e],t)||s.push(e),ao(u[e],t)?delete l[e]:l[e]=t,i?delete c[e]:c[e]=t;if(this.idAttribute in r&&(this.id=this.get(this.idAttribute)),!o){s.length&&(this._pending=n);for(let e=0;e<s.length;e++)this.trigger("change:"+s[e],this,c[s[e]],n)}if(a)return this;if(!o)for(;this._pending;)n=this._pending,this._pending=!1,this.trigger("change",this,n);return this._pending=!1,this._changing=!1,this},unset:function(e,t){return this.set(e,void 0,jr({},t,{unset:!0}))},clear:function(e){const t={};for(const e in this.attributes)t[e]=void 0;return this.set(t,jr({},e,{unset:!0}))},hasChanged:function(e){return null==e?!ri(this.changed):Vr(this.changed,e)},changedAttributes:function(e){if(!e)return!!this.hasChanged()&&ji(this.changed);const t=this._changing?this._previousAttributes:this.attributes,n={};let r;for(const i in e){const o=e[i];ao(t[i],o)||(n[i]=o,r=!0)}return!!r&&n},previous:function(e){return null!=e&&this._previousAttributes?this._previousAttributes[e]:null},previousAttributes:function(){return ji(this._previousAttributes)},fetch:function(e){e=jr({parse:!0},e);const t=this,n=e.success;return e.success=function(r){const i=e.parse?t.parse(r,e):r;if(!t.set(i,e))return!1;n&&n.call(e.context,t,r,e),t.trigger("sync",t,r,e)},Kr(this,e),this.sync("read",this,e)},save:function(e,t,n){let r;null==e||"object"==typeof e?(r=e,n=t):(r={})[e]=t;const i=(n=jr({validate:!0,parse:!0},n)).wait,o=n.promise,s=o&&Qr();if(r&&!i){if(!this.set(r,n))return!1}else if(!this._validate(r,n))return!1;const a=this,c=n.success,l=n.error,u=this.attributes;n.success=function(e){a.attributes=u;let t=n.parse?a.parse(e,n):e;if(i&&(t=jr({},r,t)),t&&!a.set(t,n))return!1;c&&c.call(n.context,a,e,n),a.trigger("sync",a,e,n),o&&s.resolve()},n.error=function(e,t,n){l&&l.call(n.context,e,t,n),o&&s.reject(t)},Kr(this,n),r&&i&&(this.attributes=jr({},u,r));const d=this.isNew()?"create":n.patch?"patch":"update";"patch"!==d||n.attrs||(n.attrs=r);const h=this.sync(d,this,n);return this.attributes=u,o?s:h},destroy:function(e){e=e?ji(e):{};const t=this,n=e.success,r=e.wait,i=function(){t.stopListening(),t.trigger("destroy",t,t.collection,e)};e.success=function(o){r&&i(),n&&n.call(e.context,t,o,e),t.isNew()||t.trigger("sync",t,o,e)};let o=!1;return this.isNew()?Ii(e.success):(Kr(this,e),o=this.sync("delete",this,e)),r||i(),o},url:function(){const e=Jr(this,"urlRoot")||Jr(this.collection,"url")||Yr();if(this.isNew())return e;const t=this.get(this.idAttribute);return e.replace(/[^\/]$/,"$&/")+encodeURIComponent(t)},parse:function(e,t){return e},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return!this.has(this.idAttribute)},isValid:function(e){return this._validate({},jr({},e,{validate:!0}))},_validate:function(e,t){if(!t.validate||!this.validate)return!0;e=jr({},this.attributes,e);const n=this.validationError=this.validate(e,t)||null;return!n||(this.trigger("invalid",this,n,jr(t,{validationError:n})),!1)}});var Bo=function(e){for(var t=-1,n=null==e?0:e.length,r=0,i=[];++t<n;){var o=e[t];o&&(i[r++]=o)}return i};
/**
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
* @description This is the core utilities module.
*/const qo=gr.f.Strophe,Ho={isTagEqual:function(e,t){if(e.nodeTree)return Ho.isTagEqual(e.nodeTree,t);if(e instanceof Element)return qo.isTagEqual(e,t);throw Error("isTagEqual called with value which isn't an element or Strophe.Builder instance")}},Uo=new DOMParser,$o=Uo.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 Wo(e,t){clearTimeout(e),clearInterval(t)}
/**
* 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
*/Ho.getJIDFromURI=function(e){return e.startsWith("xmpp:")&&e.endsWith("?join")?e.replace(/^xmpp:/,"").replace(/\?join$/,""):e},Ho.toStanza=function(e){const t=Uo.parseFromString(e,"text/xml");if(t.getElementsByTagNameNS($o,"parsererror").length)throw new Error("Parser Error: ".concat(e));return t.firstElementChild},Ho.getLongestSubstring=function(e,t){return t.reduce((function(t,n){return e.startsWith(n)&&n.length>t.length?n:t}),"")},Ho.prefixMentions=function(e){let t=e.get("message");return(e.get("references")||[]).sort((e,t)=>t.begin-e.begin).forEach(e=>{t="".concat(t.slice(0,e.begin),"@").concat(t.slice(e.begin))}),t},Ho.isValidJID=function(e){return"string"==typeof e&&(2===Bo(e.split("@")).length&&!e.startsWith("@")&&!e.endsWith("@"))},Ho.isValidMUCJID=function(e){return!e.startsWith("@")&&!e.endsWith("@")},Ho.isSameBareJID=function(e,t){return"string"==typeof e&&"string"==typeof t&&qo.getBareJidFromJid(e).toLowerCase()===qo.getBareJidFromJid(t).toLowerCase()},Ho.isSameDomain=function(e,t){return"string"==typeof e&&"string"==typeof t&&qo.getDomainFromJid(e).toLowerCase()===qo.getDomainFromJid(t).toLowerCase()},Ho.isNewMessage=function(e){return e instanceof Element?!(pr()('result[xmlns="'.concat(qo.NS.MAM,'"]'),e).length&&pr()('delay[xmlns="'.concat(qo.NS.DELAY,'"]'),e).length):(e instanceof zo&&(e=e.attributes),!(e.is_delayed&&e.is_archived))},Ho.shouldCreateMessage=function(e){return e.retracted||!Ho.isEmptyMessage(e)},Ho.shouldCreateGroupchatMessage=function(e){return e.nick&&(Ho.shouldCreateMessage(e)||e.is_tombstone)},Ho.isEmptyMessage=function(e){return e instanceof zo&&(e=e.attributes),!(e.oob_url||e.file||e.is_encrypted&&e.plaintext||e.message)},Ho.isOnlyChatStateNotification=function(e){return e instanceof Element?null===e.querySelector("body")&&(null!==e.querySelector("active")||null!==e.querySelector("composing")||null!==e.querySelector("inactive")||null!==e.querySelector("paused")||null!==e.querySelector("gone")):(e instanceof zo&&(e=e.attributes),e.chat_state&&Ho.isEmptyMessage(e))},Ho.isOnlyMessageDeliveryReceipt=function(e){return e instanceof Element?null===e.querySelector("body")&&null!==e.querySelector("received"):(e instanceof zo&&(e=e.attributes),e.received&&Ho.isEmptyMessage(e))},Ho.isChatRoom=function(e){return e&&"chatroom"===e.get("type")},Ho.isErrorObject=function(e){return e instanceof Error},Ho.isErrorStanza=function(e){return!!Mn(e)&&"error"===e.getAttribute("type")},Ho.isForbiddenError=function(e){return!!Mn(e)&&pr()('error[type="auth"] forbidden[xmlns="'.concat(qo.NS.STANZAS,'"]'),e).length>0},Ho.isServiceUnavailableError=function(e){return!!Mn(e)&&pr()('error[type="cancel"] service-unavailable[xmlns="'.concat(qo.NS.STANZAS,'"]'),e).length>0},Ho.merge=function e(t,n){for(const r in n)N(t[r])?e(t[r],n[r]):t[r]=n[r]},Ho.getOuterWidth=function(e,t=!1){let n=e.offsetWidth;if(!t)return n;const r=window.getComputedStyle(e);return n+=parseInt(r.marginLeft?r.marginLeft:0,10)+parseInt(r.marginRight?r.marginRight:0,10),n},Ho.stringToElement=function(e){var t=document.createElement("div");return t.innerHTML=e,t.firstElementChild},Ho.matchesSelector=function(e,t){const n=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;return!!n&&n.call(e,t)},Ho.queryChildren=function(e,t){return Array.from(e.childNodes).filter(e=>Ho.matchesSelector(e,t))},Ho.contains=function(e,t){const n=(e,n)=>e.get(n).toLowerCase().includes(t.toLowerCase());return function(t){if("object"==typeof e)return Object.keys(e).reduce((e,r)=>e||n(t,r),!1);if("string"==typeof e)return n(t,e);throw new TypeError("contains: wrong attribute type. Must be string or array.")}},Ho.isOfType=function(e,t){return t.get("type")==e},Ho.isInstance=function(e,t){return t instanceof e},Ho.getAttribute=function(e,t){return t.get(e)},Ho.contains.not=function(e,t){return function(n){return!Ho.contains(e,t)(n)}},Ho.rootContains=function(e,t){return e!==document||e.contains?e.contains?e.contains(t):window.HTMLElement.prototype.contains.call(e,t):document.head.contains(t)||document.body.contains(t)},Ho.createFragmentFromText=function(e){var t,n=document.createDocumentFragment(),r=document.createElement("body");for(r.innerHTML=e;t=r.firstChild;)n.appendChild(t);return n},Ho.isPersistableModel=function(e){return e.collection&&e.collection.browserStorage},Ho.getResolveablePromise=function(){const e={isResolved:!1,isPending:!0,isRejected:!1},t=new Promise((t,n)=>{e.resolve=t,e.reject=n});return Object.assign(t,e),t.then((function(e){return t.isResolved=!0,t.isPending=!1,t.isRejected=!1,e}),(function(e){throw t.isResolved=!1,t.isPending=!1,t.isRejected=!0,e})),t},Ho.interpolate=function(e,t){return e.replace(/{{{([^{}]*)}}}/g,(e,n)=>{var r=t[n];return"string"==typeof r||"number"==typeof r?r:e})},Ho.onMultipleEvents=function(e=[],t){let n=[];function r(r){n.push(r),e.length===n.length&&(t(n),n=[])}e.forEach(e=>e.object.on(e.event,r))},Ho.safeSave=function(e,t,n){Ho.isPersistableModel(e)?e.save(t,n):e.set(t,n)},Ho.siblingIndex=function(e){for(var t=0;e=e.previousElementSibling;t++);return t},Ho.getCurrentWord=function(e,t,n){t||(t=e.selectionEnd||void 0);let[r]=e.value.slice(0,t).split(/\s/).slice(-1);return n&&([r]=r.split(n).slice(-1)),r},Ho.isMentionBoundary=e=>"@"!==e&&RegExp("(\\p{Z}|\\p{P})","u").test(e),Ho.replaceCurrentWord=function(e,t){const n=e.selectionEnd||void 0,r=Eo(e.value.slice(0,n).split(/\s/)),i=e.value,o=Ho.isMentionBoundary(r[0])?r[0]:"";e.value=i.slice(0,n-r.length)+o+"".concat(t," ")+i.slice(n);const s=n-r.length+t.length+1;e.selectionEnd=o?s+1:s},Ho.triggerEvent=function(e,t,n="Event",r=!0,i=!0){const o=document.createEvent(n);o.initEvent(t,r,i),e.dispatchEvent(o)},Ho.getSelectValues=function(e){const t=[],n=e&&e.options;for(var r=0,i=n.length;r<i;r++){const e=n[r];e.selected&&t.push(e.value||e.text)}return t},Ho.formatFingerprint=function(e){e=e.replace(/^05/,"");for(let t=1;t<8;t++){const n=8*t+t-1;e=e.slice(0,n)+" "+e.slice(n)}return e},Ho.appendArrayBuffer=function(e,t){const n=new Uint8Array(e.byteLength+t.byteLength);return n.set(new Uint8Array(e),0),n.set(new Uint8Array(t),e.byteLength),n.buffer},Ho.arrayBufferToHex=function(e){return Array.prototype.map.call(new Uint8Array(e),e=>("00"+e.toString(16)).slice(-2)).join("")},Ho.arrayBufferToString=function(e){return new TextDecoder("utf-8").decode(e)},Ho.stringToArrayBuffer=function(e){return new TextEncoder("utf-8").encode(e).buffer},Ho.arrayBufferToBase64=function(e){return btoa(new Uint8Array(e).reduce((e,t)=>e+String.fromCharCode(t),""))},Ho.base64ToArrayBuffer=function(e){const t=window.atob(e),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.charCodeAt(e);return r.buffer},Ho.getRandomInt=function(e){return Math.floor(Math.random()*Math.floor(e))},Ho.placeCaretAtEnd=function(e){e!==document.activeElement&&e.focus();const t=2*e.value.length;setTimeout(()=>e.setSelectionRange(t,t),1),this.scrollTop=999999},Ho.getUniqueId=function(e){const t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}));return"string"==typeof e||"number"==typeof e?t+":"+e:t},Ho.waitUntil=function(e,t=300,n=3){try{const t=e();if(t)return Promise.resolve(t)}catch(e){return Promise.reject(e)}const r=Ho.getResolveablePromise(),i=new Error;const o=setInterval((function(){try{const t=e();t&&(Wo(s,o),r.resolve(t))}catch(e){Wo(s,o),r.reject(e)}}),n);const s=setTimeout((function(){Wo(s,o);const e="Wait until promise timed out: \n\n".concat(i.stack);console.trace(),Pn.error(e),r.reject(new Error(e))}),t);return r};var Go=Ho;const Vo=gr.f.Strophe,Jo=gr.f.$msg,{NS:Xo}=Vo;function Qo(e){const t=pr()('spoiler[xmlns="'.concat(Vo.NS.SPOILER,'"]'),e).pop();return{is_spoiler:!!t,spoiler_hint:null==t?void 0:t.textContent}}function Yo(e){const t=pr()('x[xmlns="'.concat(Vo.NS.OUTOFBAND,'"]'),e).pop();var n,r;return t?{oob_url:null===(n=t.querySelector("url"))||void 0===n?void 0:n.textContent,oob_desc:null===(r=t.querySelector("desc"))||void 0===r?void 0:r.textContent}:{}}function Ko(e,t){const n=pr()('replace[xmlns="'.concat(Vo.NS.MESSAGE_CORRECT,'"]'),e).pop();if(n){const e=n.getAttribute("id"),r=e;if(e){const n=pr()('delay[xmlns="'.concat(Vo.NS.DELAY,'"]'),t).pop();return{msgid:r,replace_id:e,edited:n?Sn()(n.getAttribute("stamp")).toISOString():(new Date).toISOString()}}}return{}}function Zo(e,t){var n;const r=pr()('encrypted[xmlns="'.concat(Vo.NS.OMEMO,'"]'),e).pop(),i={is_encrypted:!!r};if(!r||Wc.settings.get("clear_cache_on_logout"))return i;const o=r.querySelector("header");i.encrypted={device_id:o.getAttribute("sid")};const s=null===(n=t.omemo_store)||void 0===n?void 0:n.get("device_id"),a=s&&pr()('key[rid="'.concat(s,'"]'),r).pop();var c;a&&Object.assign(i.encrypted,{iv:o.querySelector("iv").textContent,key:a.textContent,payload:(null===(c=r.querySelector("payload"))||void 0===c?void 0:c.textContent)||null,prekey:["true","1"].includes(a.getAttribute("prekey"))});return i}function es(e,t){return"me"!==t.sender&&!t.is_carbon&&!t.is_archived&&pr()('request[xmlns="'.concat(Vo.NS.RECEIPTS,'"]'),e).length}function ts(e){const t=pr()('received[xmlns="'.concat(Vo.NS.RECEIPTS,'"]'),e).pop();return null==t?void 0:t.getAttribute("id")}function ns(e){var t;return null===(t=pr()('\n composing[xmlns="'.concat(Xo.CHATSTATES,'"],\n paused[xmlns="').concat(Xo.CHATSTATES,'"],\n inactive[xmlns="').concat(Xo.CHATSTATES,'"],\n active[xmlns="').concat(Xo.CHATSTATES,'"],\n gone[xmlns="').concat(Xo.CHATSTATES,'"]'),e).pop())||void 0===t?void 0:t.nodeName}function rs(e){const t=Vo.NS.CARBONS;return pr()('message > received[xmlns="'.concat(t,'"]'),e).length>0||pr()('message > sent[xmlns="'.concat(t,'"]'),e).length>0}function is(e,t){const n={},r=pr()('stanza-id[xmlns="'.concat(Vo.NS.SID,'"]'),e).reduce((e,t)=>(e["stanza_id ".concat(t.getAttribute("by"))]=t.getAttribute("id"),e),{});Object.assign(n,r);const i=pr()('message > result[xmlns="'.concat(Vo.NS.MAM,'"]'),t).pop();if(i){const e=t.getAttribute("from")||qc.bare_jid;n["stanza_id ".concat(e)]=i.getAttribute("id")}const o=pr()('origin-id[xmlns="'.concat(Vo.NS.SID,'"]'),e).pop();return o&&(n.origin_id=o.getAttribute("id")),n}function os(e,t){const n=pr()('> apply-to[xmlns="'.concat(Vo.NS.FASTEN,'"]'),e).pop();if(n){const e=n.getAttribute("id");if(pr()('> retract[xmlns="'.concat(Vo.NS.RETRACT,'"]'),n).pop()){const n=pr()('delay[xmlns="'.concat(Vo.NS.DELAY,'"]'),t).pop();return{editable:!1,retracted:n?Sn()(n.getAttribute("stamp")).toISOString():(new Date).toISOString(),retracted_id:e}}}else{const t=pr()('> retracted[xmlns="'.concat(Vo.NS.RETRACT,'"]'),e).pop();if(t)return{editable:!1,is_tombstone:!0,retracted:t.getAttribute("stamp")}}return{}}function ss(e){var t;const n=null===(t=e.querySelector("body"))||void 0===t?void 0:t.textContent;return pr()('reference[xmlns="'.concat(Vo.NS.REFERENCE,'"]'),e).map(e=>{const t=e.getAttribute("begin"),r=e.getAttribute("end");return{begin:t,end:r,type:e.getAttribute("type"),value:n.slice(t,r),uri:e.getAttribute("uri")}})}function as(e,t){Wc.send(Jo({to:e.getAttribute("from"),type:"error",id:e.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(t)),Pn.warn("Rejecting message stanza with the following reason: ".concat(t)),Pn.warn(e)}function cs(e){if("error"===e.getAttribute("type")){const t=e.querySelector("error"),n=pr()('text[xmlns="'.concat(Vo.NS.STANZAS,'"]'),t).pop();return{is_error:!0,error_text:null==n?void 0:n.textContent,error_type:t.getAttribute("type"),error_condition:t.firstElementChild.nodeName}}return{}}class ls extends Error{constructor(e,t){super(e,t),this.name="StanzaParseError",this.stanza=t}}function us(e){if(pr()('message > forwarded[xmlns="'.concat(Vo.NS.FORWARD,'"]'),e).length){as(e,"Forwarded messages not part of an encapsulating protocol are not supported");const t=e.getAttribute("from");return new ls("Ignoring unencapsulated forwarded message from ".concat(t),e)}}const ds={isHeadline:e=>"headline"===e.getAttribute("type"),isServerMessage(e){const t=e.getAttribute("from");return!("error"===e.getAttribute("type")||!t||t.includes("@"))},getChatMarker:e=>pr()('\n acknowledged[xmlns="'.concat(Vo.NS.MARKERS,'"],\n displayed[xmlns="').concat(Vo.NS.MARKERS,'"],\n received[xmlns="').concat(Vo.NS.MARKERS,'"]'),e).pop(),isArchived:e=>!!pr()('message > result[xmlns="'.concat(Vo.NS.MAM,'"]'),e).pop(),getAttributes:e=>e.getAttributeNames().reduce((t,n)=>(t[n]=Vo.xmlunescape(e.getAttribute(n)),t),{}),async parseMessage(e,t){var n,r,i,o,s,a;const c=us(e);if(c)return c;let l=e.getAttribute("to");const u=Vo.getResourceFromJid(l);if(Wc.settings.get("filter_by_resource")&&u&&u!==t.resource)return new ls("Ignoring incoming message intended for a different resource: ".concat(l),e);const d=e;let h=e.getAttribute("from")||t.bare_jid;if(rs(e)){if(h!==t.bare_jid)return as(e,"Rejecting carbon from invalid JID"),new ls("Rejecting carbon from invalid JID ".concat(l),e);{const t='[xmlns="'.concat(Vo.NS.CARBONS,'"] > forwarded[xmlns="').concat(Vo.NS.FORWARD,'"] > message');l=(e=pr()(t,e).pop()).getAttribute("to"),h=e.getAttribute("from")}}const f=ds.isArchived(e);if(f){if(h!==t.bare_jid)return new ls("Invalid Stanza: alleged MAM message from ".concat(e.getAttribute("from")),e);{const t='[xmlns="'.concat(Vo.NS.MAM,'"] > forwarded[xmlns="').concat(Vo.NS.FORWARD,'"] > message');l=(e=pr()(t,e).pop()).getAttribute("to"),h=e.getAttribute("from")}}const p=Vo.getBareJidFromJid(h),g=p===t.bare_jid;if(g&&null===l)return new ls("Don't know how to handle message stanza without 'to' attribute. ".concat(e.outerHTML),e);const m=ds.isHeadline(e),v=ds.isServerMessage(e);let _,b;if(!m&&!v&&(b=g?Vo.getBareJidFromJid(l):p,_=await Wc.contacts.get(b),void 0===_&&!Wc.settings.get("allow_non_roster_messaging")))return Pn.error(e),new ls("Blocking messaging with a JID not in our roster because allow_non_roster_messaging is false.",e);const y=pr()('delay[xmlns="'.concat(Vo.NS.DELAY,'"]'),d).pop(),w=ds.getChatMarker(e),S=(new Date).toISOString();let x=Object.assign({contact_jid:b,is_archived:f,is_headline:m,is_server_message:v,body:null===(n=e.querySelector("body"))||void 0===n||null===(r=n.textContent)||void 0===r?void 0:r.trim(),chat_state:ns(e),from:Vo.getBareJidFromJid(e.getAttribute("from")),is_carbon:rs(d),is_delayed:!!y,is_markable:!!pr()('markable[xmlns="'.concat(Vo.NS.MARKERS,'"]'),e).length,is_marker:!!w,is_unstyled:!!pr()('unstyled[xmlns="'.concat(Vo.NS.STYLING,'"]'),e).length,marker_id:w&&w.getAttribute("id"),msgid:e.getAttribute("id")||d.getAttribute("id"),nick:null===(i=_)||void 0===i||null===(o=i.attributes)||void 0===o?void 0:o.nickname,receipt_id:ts(e),received:(new Date).toISOString(),references:ss(e),sender:g?"me":"them",subject:null===(s=e.querySelector("subject"))||void 0===s?void 0:s.textContent,thread:null===(a=e.querySelector("thread"))||void 0===a?void 0:a.textContent,time:y?Sn()(y.getAttribute("stamp")).toISOString():S,to:e.getAttribute("to"),type:e.getAttribute("type")},cs(e),Yo(e),Qo(e),Ko(e,d),is(e,d),os(e,d),Zo(e,t));if(x.is_archived){const n=d.getAttribute("from");if(n&&n!==t.bare_jid)return new ls("Invalid Stanza: Forged MAM message from ".concat(n),e)}return await Wc.emojis.initialize(),x=Object.assign({message:x.body||x.error,is_only_emojis:!!x.body&&Go.isOnlyEmojis(x.body),is_valid_receipt_request:es(e,x)},x),x.id=x.origin_id||x["stanza_id ".concat(x.from)]||Go.getUniqueId(),Wc.hook("parseMessage",e,x)},async parseMUCMessage(e,t,n){var r,i,o,s,a;const c=us(e);if(c)return c;const l='[xmlns="'.concat(Xo.MAM,'"] > forwarded[xmlns="').concat(Xo.FORWARD,'"] > message'),u=e;if(e=pr()(l,e).pop()||e,pr()('message > forwarded[xmlns="'.concat(Vo.NS.FORWARD,'"]'),e).length)return new ls("Invalid Stanza: Forged MAM groupchat message from ".concat(e.getAttribute("from")),e);const d=pr()('delay[xmlns="'.concat(Vo.NS.DELAY,'"]'),u).pop(),h=e.getAttribute("from"),f=Vo.unescapeNode(Vo.getResourceFromJid(h)),p=ds.getChatMarker(e),g=(new Date).toISOString();let m=Object.assign({from:h,nick:f,body:null===(r=e.querySelector("body"))||void 0===r||null===(i=r.textContent)||void 0===i?void 0:i.trim(),chat_state:ns(e),from_muc:Vo.getBareJidFromJid(h),from_real_jid:null===(o=t.occupants.findOccupant({nick:f}))||void 0===o?void 0:o.get("jid"),is_archived:ds.isArchived(u),is_carbon:rs(u),is_delayed:!!d,is_headline:ds.isHeadline(e),is_markable:!!pr()('markable[xmlns="'.concat(Vo.NS.MARKERS,'"]'),e).length,is_marker:!!p,is_unstyled:!!pr()('unstyled[xmlns="'.concat(Vo.NS.STYLING,'"]'),e).length,marker_id:p&&p.getAttribute("id"),msgid:e.getAttribute("id")||u.getAttribute("id"),receipt_id:ts(e),received:(new Date).toISOString(),references:ss(e),subject:null===(s=e.querySelector("subject"))||void 0===s?void 0:s.textContent,thread:null===(a=e.querySelector("thread"))||void 0===a?void 0:a.textContent,time:d?Sn()(d.getAttribute("stamp")).toISOString():g,to:e.getAttribute("to"),type:e.getAttribute("type")},cs(e),Yo(e),Qo(e),Ko(e,u),is(e,u),os(e,u),function(e){const t=pr()('apply-to[xmlns="'.concat(Vo.NS.FASTEN,'"]'),e).pop();if(t){const e=t.getAttribute("id"),r=pr()('moderated[xmlns="'.concat(Vo.NS.MODERATE,'"]'),t).pop();if(r){var n;if(pr()('retract[xmlns="'.concat(Vo.NS.RETRACT,'"]'),r).pop())return{editable:!1,moderated:"retracted",moderated_by:r.getAttribute("by"),moderated_id:e,moderation_reason:null===(n=r.querySelector("reason"))||void 0===n?void 0:n.textContent}}}else{const t=pr()('> moderated[xmlns="'.concat(Vo.NS.MODERATE,'"]'),e).pop();if(t){var r;if(pr()('retracted[xmlns="'.concat(Vo.NS.RETRACT,'"]'),t).pop())return{editable:!1,is_tombstone:!0,moderated_by:t.getAttribute("by"),retracted:t.getAttribute("stamp"),moderation_reason:null===(r=t.querySelector("reason"))||void 0===r?void 0:r.textContent}}}return{}}(e),Zo(e,n));return await Wc.emojis.initialize(),m=Object.assign({is_only_emojis:!!m.body&&Go.isOnlyEmojis(m.body),is_valid_receipt_request:es(e,m),message:m.body||m.error,sender:m.nick===t.get("nick")?"me":"them"},m),m.is_archived&&u.getAttribute("from")!==m.from_muc?new ls("Invalid Stanza: Forged MAM message from ".concat(u.getAttribute("from")),e):m.is_archived&&u.getAttribute("from")!==t.get("jid")?new ls("Invalid Stanza: Forged MAM groupchat message from ".concat(e.getAttribute("from")),e):m.is_carbon?new ls("Invalid Stanza: MUC messages SHOULD NOT be XEP-0280 carbon copied",e):(m.id=m.origin_id||m["stanza_id ".concat(m.from_muc||m.from)]||Go.getUniqueId(),Wc.hook("parseMUCMessage",e,m))},parseMUCPresence(e){const t=e.getAttribute("from"),n=e.getAttribute("type"),r={from:t,nick:Vo.getResourceFromJid(t),type:n,states:[],hats:[],show:"unavailable"!==n?"online":"offline"};return Array.from(e.children).forEach(e=>{if(e.matches("status"))r.status=e.textContent||null;else if(e.matches("show"))r.show=e.textContent||"online";else if(e.matches("x")&&e.getAttribute("xmlns")===Vo.NS.MUC_USER)Array.from(e.children).forEach(e=>{"item"===e.nodeName?(r.affiliation=e.getAttribute("affiliation"),r.role=e.getAttribute("role"),r.jid=e.getAttribute("jid"),r.nick=e.getAttribute("nick")||r.nick):"status"==e.nodeName&&e.getAttribute("code")&&r.states.push(e.getAttribute("code"))});else if(e.matches("x")&&e.getAttribute("xmlns")===Vo.NS.VCARDUPDATE){var t;r.image_hash=null===(t=e.querySelector("photo"))||void 0===t?void 0:t.textContent}else e.matches("hats")&&e.getAttribute("xmlns")===Vo.NS.MUC_HATS&&(r.hats=Array.from(e.children).map(e=>e.matches("hat")&&{title:e.getAttribute("title"),uri:e.getAttribute("uri")}))}),r}};var hs=ds;var fs=function(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i<o;){var s=e[i];t(r,s,n(s),e)}return r};var ps=function(e,t){return function(n,r){if(null==n)return n;if(!Xe(n))return e(n,r);for(var i=n.length,o=t?i:-1,s=Object(n);(t?o--:++o<i)&&!1!==r(s[o],o,s););return n}},gs=ps(zi);var ms=function(e,t,n,r){return gs(e,(function(e,i,o){t(r,e,n(e),o)})),r};var vs=function(e,t){return function(n,r){var i=ke(n)?fs:ms,o=t?t():{};return i(n,e,So(r,2),o)}},_s=Object.prototype.hasOwnProperty,bs=vs((function(e,t,n){_s.call(e,n)?++e[n]:be(e,n,1)}));var ys=function(e,t,n,r){for(var i=e.length,o=n+(r?1:-1);r?o--:++o<i;)if(t(e[o],o,e))return o;return-1};var ws=function(e){return e!=e};var Ss=function(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1};var xs=function(e,t,n){return t==t?Ss(e,t,n):ys(e,ws,n)};var Es=function(e,t){return!!(null==e?0:e.length)&&xs(e,t,0)>-1};var As=function(e,t,n){for(var r=-1,i=null==e?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1};var Cs=function(e,t,n,r){var i=-1,o=Es,s=!0,a=e.length,c=[],l=t.length;if(!a)return c;n&&(t=zr(t,Le(n))),r?(o=As,s=!1):t.length>=200&&(o=Xi,s=!1,t=new Vi(t));e:for(;++i<a;){var u=e[i],d=null==n?u:n(u);if(u=r||0!==u?u:0,s&&d==d){for(var h=l;h--;)if(t[h]===d)continue e;c.push(u)}else o(t,d,r)||c.push(u)}return c};var js=function(e){return Ee(e)&&Xe(e)},Os=Ar((function(e,t){return js(e)?Cs(e,No(t,1,js,!0)):[]}));var Ts=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0};var ks=function(e,t){var n=!0;return gs(e,(function(e,r,i){return n=!!t(e,r,i)})),n};var Ns=function(e,t,n){var r=ke(e)?Ts:ks;return n&&Cr(e,t,n)&&(t=void 0),r(e,So(t,3))},Is=Math.max;var Ms=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:di(n);return i<0&&(i=Is(r+i,0)),ys(e,So(t,3),i)},Rs=Math.max,Ds=Math.min;var Ps=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=r-1;return void 0!==n&&(i=di(n),i=n<0?Rs(r+i,0):Ds(i,r-1)),ys(e,So(t,3),i,!0)},Ls=Object.prototype.hasOwnProperty,Fs=vs((function(e,t,n){Ls.call(e,n)?e[n].push(t):be(e,n,[t])})),zs=Math.max;var Bs=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:di(n);return i<0&&(i=zs(r+i,0)),xs(e,t,i)},qs=vs((function(e,t,n){be(e,n,t)}));var Hs=function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r},Us=Math.max,$s=Math.min;var Ws=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=r;return void 0!==n&&(i=(i=di(n))<0?Us(r+i,0):$s(i,r-1)),t==t?Hs(e,t,i):ys(e,ws,i,!0)};var Gs=function(e,t){var n;return gs(e,(function(e,r,i){return!(n=t(e,r,i))})),!!n};var Vs=function(e,t,n){var r=ke(e)?Ji:Gs;return n&&Cr(e,t,n)&&(t=void 0),r(e,So(t,3))};var Js=function(e,t){var n=-1,r=Xe(e)?Array(e.length):[];return gs(e,(function(e,i,o){r[++n]=t(e,i,o)})),r};var Xs=function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e};var Qs=function(e,t){if(e!==t){var n=void 0!==e,r=null===e,i=e==e,o=kr(e),s=void 0!==t,a=null===t,c=t==t,l=kr(t);if(!a&&!l&&!o&&e>t||o&&s&&c&&!a&&!l||r&&s&&c||!n&&c||!i)return 1;if(!r&&!o&&!l&&e<t||l&&n&&i&&!r&&!o||a&&n&&i||!s&&i||!c)return-1}return 0};var Ys=function(e,t,n){for(var r=-1,i=e.criteria,o=t.criteria,s=i.length,a=n.length;++r<s;){var c=Qs(i[r],o[r]);if(c)return r>=a?c:c*("desc"==n[r]?-1:1)}return e.index-t.index};var Ks=function(e,t,n){var r=-1;t=zr(t.length?t:[vr],Le(So));var i=Js(e,(function(e,n,i){return{criteria:zr(t,(function(t){return t(e)})),index:++r,value:e}}));return Xs(i,(function(e,t){return Ys(e,t,n)}))},Zs=Ar((function(e,t){if(null==e)return[];var n=t.length;return n>1&&Cr(e,t[0],t[1])?t=[]:n>2&&Cr(t[0],t[1],t[2])&&(t=[t[0]]),Ks(e,No(t,1),[])}));const ea=Array.prototype.slice,ta=function(e,t){t||(t={}),this.preinitialize.apply(this,arguments),t.model&&(this.model=t.model),void 0!==t.comparator&&(this.comparator=t.comparator),this._reset(),this.initialize.apply(this,arguments),e&&this.reset(e,jr({silent:!0},t))};ta.extend=Xr;const na={add:!0,remove:!0,merge:!0},ra={add:!0,remove:!1},ia=function(e,t,n){n=Math.min(Math.max(n,0),e.length);const r=Array(e.length-n),i=t.length;let o;for(o=0;o<r.length;o++)r[o]=e[o+n];for(o=0;o<i;o++)e[o+n]=t[o];for(o=0;o<r.length;o++)e[o+i+n]=r[o]};Object.assign(ta.prototype,mi,{model:zo,preinitialize:function(){},initialize:function(){},toJSON:function(e){return this.map((function(t){return t.toJSON(e)}))},sync:function(e,t,n){return ei(this)(e,t,n)},add:function(e,t){return this.set(e,jr({merge:!1},t,ra))},remove:function(e,t){t=jr({},t);const n=!Array.isArray(e);e=n?[e]:e.slice();const r=this._removeModels(e,t);return!t.silent&&r.length&&(t.changes={added:[],merged:[],removed:r},this.trigger("update",this,t)),n?r[0]:r},set:function(e,t){if(null==e)return;(t=jr({},na,t)).parse&&!this._isModel(e)&&(e=this.parse(e,t)||[]);const n=!Array.isArray(e);e=n?[e]:e.slice();let r=t.at;null!=r&&(r=+r),r>this.length&&(r=this.length),r<0&&(r+=this.length+1);const i=[],o=[],s=[],a=[],c={},l=t.add,u=t.merge,d=t.remove;let h=!1;const f=this.comparator&&null==r&&!1!==t.sort,p=Zt(this.comparator)?this.comparator:null;let g,m;for(m=0;m<e.length;m++){g=e[m];const n=this.get(g);if(n){if(u&&g!==n){let e=this._isModel(g)?g.attributes:g;t.parse&&(e=n.parse(e,t)),n.set(e,t),s.push(n),f&&!h&&(h=n.hasChanged(p))}c[n.cid]||(c[n.cid]=!0,i.push(n)),e[m]=n}else l&&(g=e[m]=this._prepareModel(g,t),g&&(o.push(g),this._addReference(g,t),c[g.cid]=!0,i.push(g)))}if(d){for(m=0;m<this.length;m++)g=this.models[m],c[g.cid]||a.push(g);a.length&&this._removeModels(a,t)}let v=!1;const _=!f&&l&&d;if(i.length&&_?(v=this.length!==i.length||Vs(this.models,(e,t)=>e!==i[t]),this.models.length=0,ia(this.models,i,0),this.length=this.models.length):o.length&&(f&&(h=!0),ia(this.models,o,null==r?this.length:r),this.length=this.models.length),h&&this.sort({silent:!0}),!t.silent){for(m=0;m<o.length;m++)null!=r&&(t.index=r+m),g=o[m],g.trigger("add",g,this,t);(h||v)&&this.trigger("sort",this,t),(o.length||a.length||s.length)&&(t.changes={added:o,removed:a,merged:s},this.trigger("update",this,t))}return n?e[0]:e},clearStore:async function(e={},t=(e=>e)){await Promise.all(this.models.filter(t).map(t=>new Promise(n=>{t.destroy(Object.assign(e,{success:n,error:(e,t)=>{console.error(t),n()}}))}))),await this.browserStorage.clear(),this.reset()},reset:function(e,t){t=t?ji(t):{};for(let e=0;e<this.models.length;e++)this._removeReference(this.models[e],t);return t.previousModels=this.models,this._reset(),e=this.add(e,jr({silent:!0},t)),t.silent||this.trigger("reset",this,t),e},push:function(e,t){return this.add(e,jr({at:this.length},t))},pop:function(e){const t=this.at(this.length-1);return this.remove(t,e)},unshift:function(e,t){return this.add(e,jr({at:0},t))},shift:function(e){const t=this.at(0);return this.remove(t,e)},slice:function(){return ea.apply(this.models,arguments)},filter:function(e,t){return this.models.filter(M(e)?e:t=>t.matches(e),t)},every:function(e){return Ns(this.models.map(e=>e.attributes),e)},difference:function(e){return Os(this.models,e)},max:function(){return Math.max.apply(Math,this.models)},min:function(){return Math.min.apply(Math,this.models)},drop:function(e=1){return this.models.slice(e)},some:function(e){return Vs(this.models.map(e=>e.attributes),e)},sortBy:function(e){return Zs(this.models,M(e)?e:t=>Zt(e)?t.get(e):t.matches(e))},isEmpty:function(){return ri(this.models)},keyBy:function(e){return qs(this.models,e)},each:function(e,t){return this.forEach(e,t)},forEach:function(e,t){return this.models.forEach(e,t)},includes:function(e){return this.models.includes(e)},size:function(){return this.models.length},countBy:function(e){return bs(this.models,M(e)?e:t=>Zt(e)?t.get(e):t.matches(e))},groupBy:function(e){return Fs(this.models,M(e)?e:t=>Zt(e)?t.get(e):t.matches(e))},indexOf:function(e){return Bs(this.models,e)},findLastIndex:function(e,t){return Ps(this.models,M(e)?e:t=>Zt(e)?t.get(e):t.matches(e),t)},lastIndexOf:function(e){return Ws(this.models,e)},findIndex:function(e){return Ms(this.models,M(e)?e:t=>Zt(e)?t.get(e):t.matches(e))},last:function(){const e=null==this.models?0:this.models.length;return e?this.models[e-1]:void 0},head:function(){return this.models[0]},first:function(){return this.head()},map:function(e,t){return this.models.map(M(e)?e:t=>Zt(e)?t.get(e):t.matches(e),t)},reduce:function(e,t){return this.models.reduce(e,t||this.models[0])},reduceRight:function(e,t){return this.models.reduceRight(e,t||this.models[0])},toArray:function(){return Array.from(this.models)},get:function(e){if(null!=e)return this._byId[e]||this._byId[this.modelId(this._isModel(e)?e.attributes:e)]||e.cid&&this._byId[e.cid]},has:function(e){return null!=this.get(e)},at:function(e){return e<0&&(e+=this.length),this.models[e]},where:function(e,t){return this[t?"find":"filter"](e)},findWhere:function(e){return this.where(e,!0)},find:function(e,t){const n=M(e)?e:t=>t.matches(e);return this.models.find(n,t)},sort:function(e){let t=this.comparator;if(!t)throw new Error("Cannot sort a set without a comparator");e||(e={});const n=t.length;return M(t)&&(t=t.bind(this)),1===n||Zt(t)?this.models=this.sortBy(t):this.models.sort(t),e.silent||this.trigger("sort",this,e),this},pluck:function(e){return this.map(e+"")},fetch:function(e){const t=(e=jr({parse:!0},e)).success,n=this,r=e.promise&&Qr();return e.success=function(i){const o=e.reset?"reset":"set";n[o](i,e),t&&t.call(e.context,n,i,e),r&&r.resolve(),n.trigger("sync",n,i,e)},Kr(this,e),r||this.sync("read",this,e)},create:function(e,t){const n=(t=t?ji(t):{}).wait,r=t.promise,i=r&&Qr();if(!(e=this._prepareModel(e,t)))return!1;n||this.add(e,t);const o=this,s=t.success,a=t.error;return t.success=function(e,t,a){n&&o.add(e,a),s&&s.call(a.context,e,t,a),r&&i.resolve(e)},t.error=function(e,t,n){a&&a.call(n.context,e,t,n),r&&i.reject(t)},e.save(null,Object.assign(t,{promise:!1})),r?i:e},parse:function(e,t){return e},clone:function(){return new this.constructor(this.models,{model:this.model,comparator:this.comparator})},modelId:function(e){return e[this.model.prototype.idAttribute||"id"]},values:function(){return new sa(this,aa)},keys:function(){return new sa(this,ca)},entries:function(){return new sa(this,la)},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(e,t){if(this._isModel(e))return e.collection||(e.collection=this),e;(t=t?ji(t):{}).collection=this;const n=new this.model(e,t);return n.validationError?(this.trigger("invalid",this,n.validationError,t),!1):n},_removeModels:function(e,t){const n=[];for(let r=0;r<e.length;r++){const i=this.get(e[r]);if(!i)continue;const o=this.indexOf(i);this.models.splice(o,1),this.length--,delete this._byId[i.cid];const s=this.modelId(i.attributes);null!=s&&delete this._byId[s],t.silent||(t.index=o,i.trigger("remove",i,this,t)),n.push(i),this._removeReference(i,t)}return n},_isModel:function(e){return e instanceof zo},_addReference:function(e,t){this._byId[e.cid]=e;const n=this.modelId(e.attributes);null!=n&&(this._byId[n]=e),e.on("all",this._onModelEvent,this)},_removeReference:function(e,t){delete this._byId[e.cid];const n=this.modelId(e.attributes);null!=n&&delete this._byId[n],this===e.collection&&delete e.collection,e.off("all",this._onModelEvent,this)},_onModelEvent:function(e,t,n,r){if(t){if(("add"===e||"remove"===e)&&n!==this)return;if("destroy"===e&&this.remove(t,r),"change"===e){const e=this.modelId(t.previousAttributes()),n=this.modelId(t.attributes);e!==n&&(null!=e&&delete this._byId[e],null!=n&&(this._byId[n]=t))}}this.trigger.apply(this,arguments)}});const oa="function"==typeof Symbol&&Symbol.iterator;oa&&(ta.prototype[oa]=ta.prototype.values);const sa=function(e,t){this._collection=e,this._kind=t,this._index=0},aa=1,ca=2,la=3;oa&&(sa.prototype[oa]=function(){return this}),sa.prototype.next=function(){if(this._collection){if(this._index<this._collection.length){const e=this._collection.at(this._index);let t;if(this._index++,this._kind===aa)t=e;else{const n=this._collection.modelId(e.attributes);t=this._kind===ca?n:[n,e]}return{value:t,done:!1}}this._collection=void 0}return{value:void 0,done:!0}};var ua=n(43);class da extends gr.e.Connection{constructor(e,t){super(e,t),this.debouncedReconnect=Object(ua.debounce)(this.reconnect,2e3)}static generateResource(){return"/converse.js-".concat(Math.floor(139749528*Math.random()).toString())}async bind(){await Wc.trigger("beforeResourceBinding",{synchronous:!0}),super.bind()}async onDomainDiscovered(e){const t=await e.text(),n=(new window.DOMParser).parseFromString(t,"text/xml").firstElementChild;if("XRD"!=n.nodeName||"http://docs.oasis-open.org/ns/xri/xrd-1.0"!=n.namespaceURI)return Pn.warn("Could not discover XEP-0156 connection methods");const r=pr()('Link[rel="urn:xmpp:alt-connections:xbosh"]',n),i=pr()('Link[rel="urn:xmpp:alt-connections:websocket"]',n),o=r.map(e=>e.getAttribute("href")),s=i.map(e=>e.getAttribute("href"));0===o.length&&0===s.length?Pn.warn("Neither BOSH nor WebSocket connection methods have been specified with XEP-0156."):(Wc.settings.set("websocket_url",s.pop()),Wc.settings.set("bosh_service_url",o.pop()),this.service=Wc.settings.get("websocket_url")||Wc.settings.get("bosh_service_url"),this.setProtocol())}async discoverConnectionMethods(e){const t={mode:"cors",headers:{Accept:"application/xrd+xml, text/xml"}},n="https://".concat(e,"/.well-known/host-meta");let r;try{r=await fetch(n,t)}catch(e){return Pn.error("Failed to discover alternative connection methods at ".concat(n)),void Pn.error(e)}r.status>=200&&r.status<400?await this.onDomainDiscovered(r):Pn.warn("Could not discover XEP-0156 connection methods")}async connect(e,t,n){if(Wc.settings.get("discover_connection_methods")){const t=gr.e.getDomainFromJid(e);await this.discoverConnectionMethods(t)}super.connect(e,t,n||this.onConnectStatusChanged,59)}async reconnect(){const{__:e}=qc;return Pn.debug("RECONNECTING: the connection has dropped, attempting to reconnect."),this.setConnectionStatus(gr.e.Status.RECONNECTING,e("The connection has dropped, attempting to reconnect.")),Wc.trigger("will-reconnect"),this.reconnecting=!0,await Jc(),Wc.user.login()}async onConnected(e){delete this.reconnecting,this.flush(),await qc.setUserJID(this.jid),await Wc.trigger("afterResourceBinding",e,{synchronous:!0}),e?Wc.trigger("reconnected"):Wc.trigger("connected")}setDisconnectionCause(e,t,n){void 0===e?(delete this.disconnection_cause,delete this.disconnection_reason):(void 0===this.disconnection_cause||n)&&(this.disconnection_cause=e,this.disconnection_reason=t)}setConnectionStatus(e,t){this.status=e,qc.connfeedback.set({connection_status:e,message:t})}async finishDisconnection(){Pn.debug("DISCONNECTED"),delete this.reconnecting,this.reset(),Jc(),await Qc(),delete qc.connection,Wc.trigger("disconnected")}onDisconnected(){if(!Wc.settings.get("auto_reconnect"))return this.finishDisconnection();{const e=this.disconnection_reason;if(this.disconnection_cause===gr.e.Status.AUTHFAIL)return Wc.settings.get("credentials_url")||Wc.settings.get("authentication")===qc.ANONYMOUS?Wc.connection.reconnect():this.finishDisconnection();if(this.disconnection_cause===qc.LOGOUT||e===gr.e.ErrorCondition.NO_AUTH_MECH||"host-unknown"===e||"remote-connection-failed"===e)return this.finishDisconnection();Wc.connection.reconnect()}}onConnectStatusChanged(e,t){const{__:n}=qc;var r;if(Pn.debug("Status changed to: ".concat(qc.CONNECTION_STATUS[e])),e===gr.e.Status.ATTACHFAIL)this.setConnectionStatus(e),null===(r=this.worker_attach_promise)||void 0===r||r.resolve(!1);else if(e===gr.e.Status.CONNECTED||e===gr.e.Status.ATTACHED){var i,o;if((null===(i=this.worker_attach_promise)||void 0===i?void 0:i.isResolved)&&this.status===gr.e.Status.ATTACHED)return;this.setConnectionStatus(e),null===(o=this.worker_attach_promise)||void 0===o||o.resolve(!0),qc.send_initial_presence=!0,this.setDisconnectionCause(),this.reconnecting?(Pn.debug(e===gr.e.Status.CONNECTED?"Reconnected":"Reattached"),this.onConnected(!0)):(Pn.debug(e===gr.e.Status.CONNECTED?"Connected":"Attached"),this.restored&&(qc.send_initial_presence=!1),this.onConnected())}else if(e===gr.e.Status.DISCONNECTED)this.setDisconnectionCause(e,t),this.onDisconnected();else if(e===gr.e.Status.BINDREQUIRED)this.bind();else if(e===gr.e.Status.ERROR)this.setConnectionStatus(e,n("An error occurred while connecting to the chat server."));else if(e===gr.e.Status.CONNECTING)this.setConnectionStatus(e);else if(e===gr.e.Status.AUTHENTICATING)this.setConnectionStatus(e);else if(e===gr.e.Status.AUTHFAIL)t||(t=n("Your XMPP address and/or password is incorrect. Please try again.")),this.setConnectionStatus(e,t),this.setDisconnectionCause(e,t,!0),this.onDisconnected();else if(e===gr.e.Status.CONNFAIL){var s;let r=t;"host-unknown"===t||"remote-connection-failed"==t?r=n("Sorry, we could not connect to the XMPP host with domain: %1$s",'"'.concat(gr.e.getDomainFromJid(this.jid),'"')):void 0!==t&&t===(null===gr.e||void 0===gr.e||null===(s=gr.e.ErrorCondition)||void 0===s?void 0:s.NO_AUTH_MECH)&&(r=n("The XMPP server did not offer a supported authentication mechanism")),this.setConnectionStatus(e,r),this.setDisconnectionCause(e,t)}else e===gr.e.Status.DISCONNECTING&&this.setDisconnectionCause(e,t)}isType(e){return"websocket"===e.toLowerCase()?this._proto instanceof gr.e.Websocket:"bosh"===e.toLowerCase()?gr.e.Bosh&&this._proto instanceof gr.e.Bosh:void 0}hasResumed(){var e;return(null===(e=Wc.settings.get("connection_options"))||void 0===e?void 0:e.worker)||this.isType("bosh")?qc.connfeedback.get("connection_status")===gr.e.Status.ATTACHED:!this.do_bind}restoreWorkerSession(){return this.attach(this.onConnectStatusChanged),this.worker_attach_promise=Go.getResolveablePromise(),this.worker_attach_promise}}class ha extends da{constructor(e,t){super(e,t),this.sent_stanzas=[],this.IQ_stanzas=[],this.IQ_ids=[],this.features=gr.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=!0,this.mock=!0,this.jid="romeo@montague.lit/orchard",this._changeConnectStatus(gr.e.Status.BINDREQUIRED)}}_processRequest(){}sendIQ(e,t,n){Object(ua.isElement)(e)||(e=e.nodeTree),this.IQ_stanzas.push(e);const r=super.sendIQ(e,t,n);return this.IQ_ids.push(r),r}send(e){return Object(ua.isElement)(e)?this.sent_stanzas.push(e):this.sent_stanzas.push(e.nodeTree),super.send(e)}async bind(){await Wc.trigger("beforeResourceBinding",{synchronous:!0}),this.authenticated=!0,qc.no_connection_on_bind||this._changeConnectStatus(gr.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 fa="undefined"!=typeof window&&null!=window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,pa=(e,t,n=null,r=null)=>{for(;t!==n;){const n=t.nextSibling;e.insertBefore(t,r),t=n}},ga=(e,t,n=null)=>{for(;t!==n;){const n=t.nextSibling;e.removeChild(t),t=n}},ma=`{{lit-${String(Math.random()).slice(2)}}}`,va=`\x3c!--${ma}--\x3e`,_a=new RegExp(`${ma}|${va}`);class ba{constructor(e,t){this.parts=[],this.element=t;const n=[],r=[],i=document.createTreeWalker(t.content,133,null,!1);let o=0,s=-1,a=0;const{strings:c,values:{length:l}}=e;for(;a<l;){const e=i.nextNode();if(null!==e){if(s++,1===e.nodeType){if(e.hasAttributes()){const t=e.attributes,{length:n}=t;let r=0;for(let e=0;e<n;e++)ya(t[e].name,"$lit$")&&r++;for(;r-- >0;){const t=c[a],n=xa.exec(t)[2],r=n.toLowerCase()+"$lit$",i=e.getAttribute(r);e.removeAttribute(r);const o=i.split(_a);this.parts.push({type:"attribute",index:s,name:n,strings:o}),a+=o.length-1}}"TEMPLATE"===e.tagName&&(r.push(e),i.currentNode=e.content)}else if(3===e.nodeType){const t=e.data;if(t.indexOf(ma)>=0){const r=e.parentNode,i=t.split(_a),o=i.length-1;for(let t=0;t<o;t++){let n,o=i[t];if(""===o)n=Sa();else{const e=xa.exec(o);null!==e&&ya(e[2],"$lit$")&&(o=o.slice(0,e.index)+e[1]+e[2].slice(0,-"$lit$".length)+e[3]),n=document.createTextNode(o)}r.insertBefore(n,e),this.parts.push({type:"node",index:++s})}""===i[o]?(r.insertBefore(Sa(),e),n.push(e)):e.data=i[o],a+=o}}else if(8===e.nodeType)if(e.data===ma){const t=e.parentNode;null!==e.previousSibling&&s!==o||(s++,t.insertBefore(Sa(),e)),o=s,this.parts.push({type:"node",index:s}),null===e.nextSibling?e.data="":(n.push(e),s--),a++}else{let t=-1;for(;-1!==(t=e.data.indexOf(ma,t+1));)this.parts.push({type:"node",index:-1}),a++}}else i.currentNode=r.pop()}for(const e of n)e.parentNode.removeChild(e)}}const ya=(e,t)=>{const n=e.length-t.length;return n>=0&&e.slice(n)===t},wa=e=>-1!==e.index,Sa=()=>document.createComment(""),xa=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function Ea(e,t){const{element:{content:n},parts:r}=e,i=document.createTreeWalker(n,133,null,!1);let o=Ca(r),s=r[o],a=-1,c=0;const l=[];let u=null;for(;i.nextNode();){a++;const e=i.currentNode;for(e.previousSibling===u&&(u=null),t.has(e)&&(l.push(e),null===u&&(u=e)),null!==u&&c++;void 0!==s&&s.index===a;)s.index=null!==u?-1:s.index-c,o=Ca(r,o),s=r[o]}l.forEach(e=>e.parentNode.removeChild(e))}const Aa=e=>{let t=11===e.nodeType?0:1;const n=document.createTreeWalker(e,133,null,!1);for(;n.nextNode();)t++;return t},Ca=(e,t=-1)=>{for(let n=t+1;n<e.length;n++){const t=e[n];if(wa(t))return n}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 ja=new WeakMap,Oa=e=>(...t)=>{const n=e(...t);return ja.set(n,!0),n},Ta=e=>"function"==typeof e&&ja.has(e),ka={},Na={};
/**
* @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 Ia{constructor(e,t,n){this.__parts=[],this.template=e,this.processor=t,this.options=n}update(e){let t=0;for(const n of this.__parts)void 0!==n&&n.setValue(e[t]),t++;for(const e of this.__parts)void 0!==e&&e.commit()}_clone(){const e=fa?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),t=[],n=this.template.parts,r=document.createTreeWalker(e,133,null,!1);let i,o=0,s=0,a=r.nextNode();for(;o<n.length;)if(i=n[o],wa(i)){for(;s<i.index;)s++,"TEMPLATE"===a.nodeName&&(t.push(a),r.currentNode=a.content),null===(a=r.nextNode())&&(r.currentNode=t.pop(),a=r.nextNode());if("node"===i.type){const e=this.processor.handleTextExpression(this.options);e.insertAfterNode(a.previousSibling),this.__parts.push(e)}else this.__parts.push(...this.processor.handleAttributeExpressions(a,i.name,i.strings,this.options));o++}else this.__parts.push(void 0),o++;return fa&&(document.adoptNode(e),customElements.upgrade(e)),e}}
/**
* @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 Ma=` ${ma} `;class Ra{constructor(e,t,n,r){this.strings=e,this.values=t,this.type=n,this.processor=r}getHTML(){const e=this.strings.length-1;let t="",n=!1;for(let r=0;r<e;r++){const e=this.strings[r],i=e.lastIndexOf("\x3c!--");n=(i>-1||n)&&-1===e.indexOf("--\x3e",i+1);const o=xa.exec(e);t+=null===o?e+(n?Ma:va):e.substr(0,o.index)+o[1]+o[2]+"$lit$"+o[3]+ma}return t+=this.strings[e],t}getTemplateElement(){const e=document.createElement("template");return e.innerHTML=this.getHTML(),e}}
/**
* @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=e=>null===e||!("object"==typeof e||"function"==typeof e),Pa=e=>Array.isArray(e)||!(!e||!e[Symbol.iterator]);class La{constructor(e,t,n){this.dirty=!0,this.element=e,this.name=t,this.strings=n,this.parts=[];for(let e=0;e<n.length-1;e++)this.parts[e]=this._createPart()}_createPart(){return new Fa(this)}_getValue(){const e=this.strings,t=e.length-1;let n="";for(let r=0;r<t;r++){n+=e[r];const t=this.parts[r];if(void 0!==t){const e=t.value;if(Da(e)||!Pa(e))n+="string"==typeof e?e:String(e);else for(const t of e)n+="string"==typeof t?t:String(t)}}return n+=e[t],n}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}}class Fa{constructor(e){this.value=void 0,this.committer=e}setValue(e){e===ka||Da(e)&&e===this.value||(this.value=e,Ta(e)||(this.committer.dirty=!0))}commit(){for(;Ta(this.value);){const e=this.value;this.value=ka,e(this)}this.value!==ka&&this.committer.commit()}}class za{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(Sa()),this.endNode=e.appendChild(Sa())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=Sa()),e.__insert(this.endNode=Sa())}insertAfterPart(e){e.__insert(this.startNode=Sa()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(null===this.startNode.parentNode)return;for(;Ta(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=ka,e(this)}const e=this.__pendingValue;e!==ka&&(Da(e)?e!==this.value&&this.__commitText(e):e instanceof Ra?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):Pa(e)?this.__commitIterable(e):e===Na?(this.value=Na,this.clear()):this.__commitText(e))}__insert(e){this.endNode.parentNode.insertBefore(e,this.endNode)}__commitNode(e){this.value!==e&&(this.clear(),this.__insert(e),this.value=e)}__commitText(e){const t=this.startNode.nextSibling,n="string"==typeof(e=null==e?"":e)?e:String(e);t===this.endNode.previousSibling&&3===t.nodeType?t.data=n:this.__commitNode(document.createTextNode(n)),this.value=e}__commitTemplateResult(e){const t=this.options.templateFactory(e);if(this.value instanceof Ia&&this.value.template===t)this.value.update(e.values);else{const n=new Ia(t,e.processor,this.options),r=n._clone();n.update(e.values),this.__commitNode(r),this.value=n}}__commitIterable(e){Array.isArray(this.value)||(this.value=[],this.clear());const t=this.value;let n,r=0;for(const i of e)n=t[r],void 0===n&&(n=new za(this.options),t.push(n),0===r?n.appendIntoPart(this):n.insertAfterPart(t[r-1])),n.setValue(i),n.commit(),r++;r<t.length&&(t.length=r,this.clear(n&&n.endNode))}clear(e=this.startNode){ga(this.startNode.parentNode,e.nextSibling,this.endNode)}}class Ba{constructor(e,t,n){if(this.value=void 0,this.__pendingValue=void 0,2!==n.length||""!==n[0]||""!==n[1])throw new Error("Boolean attributes can only contain a single expression");this.element=e,this.name=t,this.strings=n}setValue(e){this.__pendingValue=e}commit(){for(;Ta(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=ka,e(this)}if(this.__pendingValue===ka)return;const e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=ka}}class qa extends La{constructor(e,t,n){super(e,t,n),this.single=2===n.length&&""===n[0]&&""===n[1]}_createPart(){return new Ha(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}}class Ha extends Fa{}let Ua=!1;(()=>{try{const e={get capture(){return Ua=!0,!1}};window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(e){}})();class $a{constructor(e,t,n){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=t,this.eventContext=n,this.__boundHandleEvent=e=>this.handleEvent(e)}setValue(e){this.__pendingValue=e}commit(){for(;Ta(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=ka,e(this)}if(this.__pendingValue===ka)return;const e=this.__pendingValue,t=this.value,n=null==e||null!=t&&(e.capture!==t.capture||e.once!==t.once||e.passive!==t.passive),r=null!=e&&(null==t||n);n&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),r&&(this.__options=Wa(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=ka}handleEvent(e){"function"==typeof this.value?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}}const Wa=e=>e&&(Ua?{capture:e.capture,passive:e.passive,once:e.once}:e.capture)
/**
* @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
*/;function Ga(e){let t=Va.get(e.type);void 0===t&&(t={stringsArray:new WeakMap,keyString:new Map},Va.set(e.type,t));let n=t.stringsArray.get(e.strings);if(void 0!==n)return n;const r=e.strings.join(ma);return n=t.keyString.get(r),void 0===n&&(n=new ba(e,e.getTemplateElement()),t.keyString.set(r,n)),t.stringsArray.set(e.strings,n),n}const Va=new Map,Ja=new WeakMap,Xa=(e,t,n)=>{let r=Ja.get(t);void 0===r&&(ga(t,t.firstChild),Ja.set(t,r=new za(Object.assign({templateFactory:Ga},n))),r.appendInto(t)),r.setValue(e),r.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 Qa=new
/**
* @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{handleAttributeExpressions(e,t,n,r){const i=t[0];if("."===i){return new qa(e,t.slice(1),n).parts}return"@"===i?[new $a(e,t.slice(1),r.eventContext)]:"?"===i?[new Ba(e,t.slice(1),n)]:new La(e,t,n).parts}handleTextExpression(e){return new za(e)}};
/**
* @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
*/"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.2.1");const Ya=(e,...t)=>new Ra(e,t,"html",Qa),Ka=(e,t)=>`${e}--${t}`;let Za=!0;void 0===window.ShadyCSS?Za=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),Za=!1);const ec=e=>t=>{const n=Ka(t.type,e);let r=Va.get(n);void 0===r&&(r={stringsArray:new WeakMap,keyString:new Map},Va.set(n,r));let i=r.stringsArray.get(t.strings);if(void 0!==i)return i;const o=t.strings.join(ma);if(i=r.keyString.get(o),void 0===i){const n=t.getTemplateElement();Za&&window.ShadyCSS.prepareTemplateDom(n,e),i=new ba(t,n),r.keyString.set(o,i)}return r.stringsArray.set(t.strings,i),i},tc=["html","svg"],nc=new Set,rc=(e,t,n)=>{nc.add(e);const r=n?n.element:document.createElement("template"),i=t.querySelectorAll("style"),{length:o}=i;if(0===o)return void window.ShadyCSS.prepareTemplateStyles(r,e);const s=document.createElement("style");for(let e=0;e<o;e++){const t=i[e];t.parentNode.removeChild(t),s.textContent+=t.textContent}(e=>{tc.forEach(t=>{const n=Va.get(Ka(t,e));void 0!==n&&n.keyString.forEach(e=>{const{element:{content:t}}=e,n=new Set;Array.from(t.querySelectorAll("style")).forEach(e=>{n.add(e)}),Ea(e,n)})})})(e);const a=r.content;n?function(e,t,n=null){const{element:{content:r},parts:i}=e;if(null==n)return void r.appendChild(t);const o=document.createTreeWalker(r,133,null,!1);let s=Ca(i),a=0,c=-1;for(;o.nextNode();){for(c++,o.currentNode===n&&(a=Aa(t),n.parentNode.insertBefore(t,n));-1!==s&&i[s].index===c;){if(a>0){for(;-1!==s;)i[s].index+=a,s=Ca(i,s);return}s=Ca(i,s)}}}(n,s,a.firstChild):a.insertBefore(s,a.firstChild),window.ShadyCSS.prepareTemplateStyles(r,e);const c=a.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==c)t.insertBefore(c.cloneNode(!0),t.firstChild);else if(n){a.insertBefore(s,a.firstChild);const e=new Set;e.add(s),Ea(n,e)}};window.JSCompiler_renameProperty=(e,t)=>e;const ic={toAttribute(e,t){switch(t){case Boolean:return e?"":null;case Object:case Array:return null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){switch(t){case Boolean:return null!==e;case Number:return null===e?null:Number(e);case Object:case Array:return JSON.parse(e)}return e}},oc=(e,t)=>t!==e&&(t==t||e==e),sc={attribute:!0,type:String,converter:ic,reflect:!1,hasChanged:oc};class ac extends HTMLElement{constructor(){super(),this._updateState=0,this._instanceProperties=void 0,this._updatePromise=new Promise(e=>this._enableUpdatingResolver=e),this._changedProperties=new Map,this._reflectingProperties=void 0,this.initialize()}static get observedAttributes(){this.finalize();const e=[];return this._classProperties.forEach((t,n)=>{const r=this._attributeNameForProperty(n,t);void 0!==r&&(this._attributeToPropertyMap.set(r,n),e.push(r))}),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const e=Object.getPrototypeOf(this)._classProperties;void 0!==e&&e.forEach((e,t)=>this._classProperties.set(t,e))}}static createProperty(e,t=sc){if(this._ensureClassProperties(),this._classProperties.set(e,t),t.noAccessor||this.prototype.hasOwnProperty(e))return;const n="symbol"==typeof e?Symbol():"__"+e,r=this.getPropertyDescriptor(e,n,t);void 0!==r&&Object.defineProperty(this.prototype,e,r)}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(n){const r=this[e];this[t]=n,this._requestUpdate(e,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||sc}static finalize(){const e=Object.getPrototypeOf(this);if(e.hasOwnProperty("finalized")||e.finalize(),this.finalized=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const e=this.properties,t=[...Object.getOwnPropertyNames(e),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]];for(const n of t)this.createProperty(n,e[n])}}static _attributeNameForProperty(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}static _valueHasChanged(e,t,n=oc){return n(e,t)}static _propertyValueFromAttribute(e,t){const n=t.type,r=t.converter||ic,i="function"==typeof r?r:r.fromAttribute;return i?i(e,n):e}static _propertyValueToAttribute(e,t){if(void 0===t.reflect)return;const n=t.type,r=t.converter;return(r&&r.toAttribute||ic.toAttribute)(e,n)}initialize(){this._saveInstanceProperties(),this._requestUpdate()}_saveInstanceProperties(){this.constructor._classProperties.forEach((e,t)=>{if(this.hasOwnProperty(t)){const e=this[t];delete this[t],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(t,e)}})}_applyInstanceProperties(){this._instanceProperties.forEach((e,t)=>this[t]=e),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){void 0!==this._enableUpdatingResolver&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,t,n){t!==n&&this._attributeToProperty(e,n)}_propertyToAttribute(e,t,n=sc){const r=this.constructor,i=r._attributeNameForProperty(e,n);if(void 0!==i){const e=r._propertyValueToAttribute(t,n);if(void 0===e)return;this._updateState=8|this._updateState,null==e?this.removeAttribute(i):this.setAttribute(i,e),this._updateState=-9&this._updateState}}_attributeToProperty(e,t){if(8&this._updateState)return;const n=this.constructor,r=n._attributeToPropertyMap.get(e);if(void 0!==r){const e=n.getPropertyOptions(r);this._updateState=16|this._updateState,this[r]=n._propertyValueFromAttribute(t,e),this._updateState=-17&this._updateState}}_requestUpdate(e,t){let n=!0;if(void 0!==e){const r=this.constructor,i=r.getPropertyOptions(e);r._valueHasChanged(this[e],t,i.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,t),!0!==i.reflect||16&this._updateState||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,i))):n=!1}!this._hasRequestedUpdate&&n&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,t){return this._requestUpdate(e,t),this.updateComplete}async _enqueueUpdate(){this._updateState=4|this._updateState;try{await this._updatePromise}catch(e){}const e=this.performUpdate();return null!=e&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return 4&this._updateState}get hasUpdated(){return 1&this._updateState}performUpdate(){this._instanceProperties&&this._applyInstanceProperties();let e=!1;const t=this._changedProperties;try{e=this.shouldUpdate(t),e?this.update(t):this._markUpdated()}catch(t){throw e=!1,this._markUpdated(),t}e&&(1&this._updateState||(this._updateState=1|this._updateState,this.firstUpdated(t)),this.updated(t))}_markUpdated(){this._changedProperties=new Map,this._updateState=-5&this._updateState}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((e,t)=>this._propertyToAttribute(t,this[t],e)),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}}ac.finalized=!0;
/**
@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 cc="adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,lc=Symbol();class uc{constructor(e,t){if(t!==lc)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return void 0===this._styleSheet&&(cc?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}}const dc=(e,...t)=>{const n=t.reduce((t,n,r)=>t+(e=>{if(e instanceof uc)return e.cssText;if("number"==typeof e)return e;throw new Error(`Value passed to 'css' function must be a 'css' function result: ${e}. Use 'unsafeCSS' to pass non-literal values, but\n take care to ensure page security.`)})(n)+e[r+1],e[0]);return new uc(n,lc)};
/**
* @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 hc={};class fc extends ac{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const e=this.getStyles();if(void 0===e)this._styles=[];else if(Array.isArray(e)){const t=(e,n)=>e.reduceRight((e,n)=>Array.isArray(n)?t(n,e):(e.add(n),e),n),n=t(e,new Set),r=[];n.forEach(e=>r.unshift(e)),this._styles=r}else this._styles=[e]}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 e=this.constructor._styles;0!==e.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?cc?this.renderRoot.adoptedStyleSheets=e.map(e=>e.styleSheet):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map(e=>e.cssText),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(e){const t=this.render();super.update(e),t!==hc&&this.constructor.render(t,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(e=>{const t=document.createElement("style");t.textContent=e.cssText,this.renderRoot.appendChild(t)}))}render(){return hc}}fc.finalized=!0,fc.render=(e,t,n)=>{if(!n||"object"!=typeof n||!n.scopeName)throw new Error("The `scopeName` option is required.");const r=n.scopeName,i=Ja.has(t),o=Za&&11===t.nodeType&&!!t.host,s=o&&!nc.has(r),a=s?document.createDocumentFragment():t;if(Xa(e,a,Object.assign({templateFactory:ec(r)},n)),s){const e=Ja.get(a);Ja.delete(a);const n=e.value instanceof Ia?e.value.template:void 0;rc(r,a,n),ga(t,t.firstChild),t.appendChild(a),Ja.set(t,e)}!i&&o&&window.ShadyCSS.styleElement(t.host)};class pc extends fc{constructor(){super(),Object.assign(this,mi)}createRenderRoot(){return this}disconnectedCallback(){super.disconnectedCallback(),this.stopListening()}}const gc=function(){this.handlers=[],this.checkUrl=this.checkUrl.bind(this),"undefined"!=typeof window&&(this.location=window.location,this.history=window.history)};gc.extend=Xr;const mc=/^[#\/]|\s+$/g,vc=/^\/+|\/+$/g,_c=/#.*$/;gc.started=!1,Object.assign(gc.prototype,mi,{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(e){return decodeURI(e.replace(/%25/g,"%2525"))},getSearch:function(){const e=this.location.href.replace(/#.*/,"").match(/\?.+/);return e?e[0]:""},getHash:function(e){const t=(e||this).location.href.match(/#(.*)$/);return t?t[1]:""},getPath:function(){const e=this.decodeFragment(this.location.pathname+this.getSearch()).slice(this.root.length-1);return"/"===e.charAt(0)?e.slice(1):e},getFragment:function(e){return null==e&&(e=this._usePushState||!this._wantsHashChange?this.getPath():this.getHash()),e.replace(mc,"")},start:function(e){if(gc.started)throw new Error("history has already been started");if(gc.started=!0,this.options=jr({root:"/"},this.options,e),this.root=this.options.root,this._wantsHashChange=!1!==this.options.hashChange,this._hasHashChange="onhashchange"in window&&(void 0===document.documentMode||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(vc,"/"),this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){const e=this.root.slice(0,-1)||"/";return this.location.replace(e+"#"+this.getPath()),!0}this._hasPushState&&this.atRoot()&&this.navigate(this.getHash(),{replace:!0})}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 e=document.body,t=e.insertBefore(this.iframe,e.firstChild).contentWindow;t.document.open(),t.document.close(),t.location.hash="#"+this.fragment}if(this._usePushState?addEventListener("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe?addEventListener("hashchange",this.checkUrl,!1):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),!this.options.silent)return this.loadUrl()},stop:function(){this._usePushState?removeEventListener("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe&&removeEventListener("hashchange",this.checkUrl,!1),this.iframe&&(document.body.removeChild(this.iframe),this.iframe=null),this._checkUrlInterval&&clearInterval(this._checkUrlInterval),gc.started=!1},route:function(e,t){this.handlers.unshift({route:e,callback:t})},checkUrl:function(e){let t=this.getFragment();if(t===this.fragment&&this.iframe&&(t=this.getHash(this.iframe.contentWindow)),t===this.fragment)return!1;this.iframe&&this.navigate(t),this.loadUrl()},loadUrl:function(e){return!!this.matchRoot()&&(e=this.fragment=this.getFragment(e),Vs(this.handlers,(function(t){if(t.route.test(e))return t.callback(e),!0})))},navigate:function(e,t){if(!gc.started)return!1;t&&!0!==t||(t={trigger:!!t}),e=this.getFragment(e||"");let n=this.root;""!==e&&"?"!==e.charAt(0)||(n=n.slice(0,-1)||"/");const r=n+e;e=e.replace(_c,"");const i=this.decodeFragment(e);if(this.fragment!==i){if(this.fragment=i,this._usePushState)this.history[t.replace?"replaceState":"pushState"]({},document.title,r);else{if(!this._wantsHashChange)return this.location.assign(r);if(this._updateHash(this.location,e,t.replace),this.iframe&&e!==this.getHash(this.iframe.contentWindow)){const n=this.iframe.contentWindow;t.replace||(n.document.open(),n.document.close()),this._updateHash(n.location,e,t.replace)}}return t.trigger?this.loadUrl(e):void 0}},_updateHash:function(e,t,n){if(n){const n=e.href.replace(/(javascript:|#).*$/,"");e.replace(n+"#"+t)}else e.hash="#"+t}});var bc=gc;var yc=function(e){return Ee(e)&&"[object RegExp]"==k(e)},wc=Fe.a&&Fe.a.isRegExp,Sc=wc?Le(wc):yc;const xc=function(e={}){this.history=e.history||new bc,this.preinitialize.apply(this,arguments),e.routes&&(this.routes=e.routes),this._bindRoutes(),this.initialize.apply(this,arguments)};xc.extend=Xr;const Ec=/\((.*?)\)/g,Ac=/(\(\?)?:\w+/g,Cc=/\*\w+/g,jc=/[\-{}\[\]+?.,\\\^$|#\s]/g;Object.assign(xc.prototype,mi,{preinitialize:function(){},initialize:function(){},route:function(e,t,n){return Sc(e)||(e=this._routeToRegExp(e)),M(t)&&(n=t,t=""),n||(n=this[t]),this.history.route(e,r=>{const i=this._extractParameters(e,r);!1!==this.execute(n,i,t)&&(this.trigger.apply(this,["route:"+t].concat(i)),this.trigger("route",t,i),this.history.trigger("route",this,t,i))}),this},execute:function(e,t,n){e&&e.apply(this,t)},navigate:function(e,t){return this.history.navigate(e,t),this},_bindRoutes:function(){if(!this.routes)return;let e;this.routes=Jr(this,"routes");const t=Qe(this.routes);for(;null!=(e=t.pop());)this.route(e,this.routes[e])},_routeToRegExp:function(e){return e=e.replace(jc,"\\$&").replace(Ec,"(?:$1)?").replace(Ac,(function(e,t){return t?e:"([^/?]+)"})).replace(Cc,"([^?]*?)"),new RegExp("^"+e+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(e,t){const n=e.exec(t).slice(1);return n.map((function(e,t){return t===n.length-1?e||null:e?decodeURIComponent(e):null}))}});var Oc=n(3),Tc=function(){return y.a.Date.now()},kc=Math.max,Nc=Math.min;var Ic=function(e,t,n){var r,i,o,s,a,c,l=0,u=!1,d=!1,h=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function f(t){var n=r,o=i;return r=i=void 0,l=t,s=e.apply(o,n)}function p(e){return l=e,a=setTimeout(m,t),u?f(e):s}function g(e){var n=e-c;return void 0===c||n>=t||n<0||d&&e-l>=o}function m(){var e=Tc();if(g(e))return v(e);a=setTimeout(m,function(e){var n=t-(e-c);return d?Nc(n,o-(e-l)):n}(e))}function v(e){return a=void 0,h&&r?f(e):(r=i=void 0,s)}function _(){var e=Tc(),n=g(e);if(r=arguments,i=this,c=e,n){if(void 0===a)return p(c);if(d)return clearTimeout(a),a=setTimeout(m,t),f(c)}return void 0===a&&(a=setTimeout(m,t)),s}return t=li(t)||0,N(n)&&(u=!!n.leading,o=(d="maxWait"in n)?kc(li(n.maxWait)||0,t):o,h="trailing"in n?!!n.trailing:h),_.cancel=function(){void 0!==a&&clearTimeout(a),l=0,r=c=i=a=void 0},_.flush=function(){return void 0===a?s:v(Tc())},_};var Mc=function(e,t,n){t=$r(t,e);var r=null==(e=Co(e,t))?e:e[Wr(Eo(t))];return null==r?void 0:_r(r,e,n)},Rc=Ar(Mc),Dc=n(94);
/**
* @module converse-core
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
Sn.a.extend(yn.a),Oc.e.addNamespace("CARBONS","urn:xmpp:carbons:2"),Oc.e.addNamespace("CHATSTATES","http://jabber.org/protocol/chatstates"),Oc.e.addNamespace("CSI","urn:xmpp:csi:0"),Oc.e.addNamespace("DELAY","urn:xmpp:delay"),Oc.e.addNamespace("FASTEN","urn:xmpp:fasten:0"),Oc.e.addNamespace("FORWARD","urn:xmpp:forward:0"),Oc.e.addNamespace("HINTS","urn:xmpp:hints"),Oc.e.addNamespace("HTTPUPLOAD","urn:xmpp:http:upload:0"),Oc.e.addNamespace("IDLE","urn:xmpp:idle:1"),Oc.e.addNamespace("MAM","urn:xmpp:mam:2"),Oc.e.addNamespace("MODERATE","urn:xmpp:message-moderate:0"),Oc.e.addNamespace("NICK","http://jabber.org/protocol/nick"),Oc.e.addNamespace("OMEMO","eu.siacs.conversations.axolotl"),Oc.e.addNamespace("OUTOFBAND","jabber:x:oob"),Oc.e.addNamespace("PUBSUB","http://jabber.org/protocol/pubsub"),Oc.e.addNamespace("REGISTER","jabber:iq:register"),Oc.e.addNamespace("RETRACT","urn:xmpp:message-retract:0"),Oc.e.addNamespace("ROSTERX","http://jabber.org/protocol/rosterx"),Oc.e.addNamespace("RSM","http://jabber.org/protocol/rsm"),Oc.e.addNamespace("SID","urn:xmpp:sid:0"),Oc.e.addNamespace("SPOILER","urn:xmpp:spoiler:0"),Oc.e.addNamespace("STANZAS","urn:ietf:params:xml:ns:xmpp-stanzas"),Oc.e.addNamespace("STYLING","urn:xmpp:styling:0"),Oc.e.addNamespace("VCARD","vcard-temp"),Oc.e.addNamespace("VCARDUPDATE","vcard-temp:x:update"),Oc.e.addNamespace("XFORM","jabber:x:data");class Pc extends Error{}const Lc=["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"],Fc={allow_non_roster_messaging:!1,assets_path:"/dist",authentication:"login",auto_login:!1,auto_reconnect:!0,blacklisted_plugins:[],clear_cache_on_logout:!1,connection_options:{},credentials_url:null,discover_connection_methods:!0,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:!0,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:!1,strict_plugin_dependencies:!1,view_mode:"overlayed",websocket_url:void 0,whitelisted_plugins:[]},zc={};zc[Oc.e.Status.ATTACHED]="ATTACHED",zc[Oc.e.Status.AUTHENTICATING]="AUTHENTICATING",zc[Oc.e.Status.AUTHFAIL]="AUTHFAIL",zc[Oc.e.Status.CONNECTED]="CONNECTED",zc[Oc.e.Status.CONNECTING]="CONNECTING",zc[Oc.e.Status.CONNFAIL]="CONNFAIL",zc[Oc.e.Status.DISCONNECTED]="DISCONNECTED",zc[Oc.e.Status.DISCONNECTING]="DISCONNECTING",zc[Oc.e.Status.ERROR]="ERROR",zc[Oc.e.Status.RECONNECTING]="RECONNECTING",zc[Oc.e.Status.REDIRECT]="REDIRECT";const Bc={initialize(){},__:(...e)=>Object(Dc.sprintf)(...e)},qc={log:Pn,CONNECTION_STATUS:zc,templates:{},promises:{initialized:Go.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:"PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCI+CiA8cmVjdCB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCIgZmlsbD0iIzU1NSIvPgogPGNpcmNsZSBjeD0iNjQiIGN5PSI0MSIgcj0iMjQiIGZpbGw9IiNmZmYiLz4KIDxwYXRoIGQ9Im0yOC41IDExMiB2LTEyIGMwLTEyIDEwLTI0IDI0LTI0IGgyMyBjMTQgMCAyNCAxMiAyNCAyNCB2MTIiIGZpbGw9IiNmZmYiLz4KPC9zdmc+Cg==",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:!0},router:new xc,TimeoutError:Pc,isTestEnv:()=>"montague.lit/http-bind"===Uc.bosh_service_url,__:(...e)=>Bc.__(...e),___:e=>e};let Hc;qc.VERSION_NAME="v7.0.3dev",Object.assign(qc,mi),cr.enable(qc,"_converse","pluggable");let Uc={};function $c(){var e;if(!qc.bare_jid){const e="No JID to fetch user settings for";throw Pn.error(e),Error(e)}if(!(null===(e=Hc)||void 0===e?void 0:e.fetched)){const e="converse.user-settings.".concat(qc.bare_jid);Hc=new zo({id:e}),Hc.browserStorage=Vc(e),Hc.fetched=Hc.fetch({promise:!0})}return Hc.fetched}const Wc=qc.api={connection:{connected(){var e;return(null==qc||null===(e=qc.connection)||void 0===e?void 0:e.connected)&&!0},disconnect(){qc.connection&&qc.connection.disconnect()},async reconnect(){const e=qc.connfeedback.get("connection_status");if(Wc.settings.get("authentication")===qc.ANONYMOUS&&(await Jc(),await Qc()),e===Oc.e.Status.CONNFAIL?Wc.connection.isType("websocket")&&Wc.settings.get("bosh_service_url")?(await qc.setUserJID(qc.bare_jid),qc.connection._proto._doDisconnect(),qc.connection._proto=new Oc.e.Bosh(qc.connection),qc.connection.service=Wc.settings.get("bosh_service_url")):Wc.connection.isType("bosh")&&Wc.settings.get("websocket_url")&&(Wc.settings.get("authentication")===qc.ANONYMOUS?await qc.setUserJID(Wc.settings.get("jid")):await qc.setUserJID(qc.bare_jid),qc.connection._proto._doDisconnect(),qc.connection._proto=new Oc.e.Websocket(qc.connection),qc.connection.service=Wc.settings.get("websocket_url")):e===Oc.e.Status.AUTHFAIL&&Wc.settings.get("authentication")===qc.ANONYMOUS&&await qc.setUserJID(Wc.settings.get("jid")),!qc.connection.reconnecting)return qc.connection.reconnect();qc.connection.debouncedReconnect()},isType:e=>qc.connection.isType(e)},async trigger(e){if(!qc._events)return;const t=Array.from(arguments),n=t.pop();if(n&&n.synchronous){const n=qc._events[e]||[];await Promise.all(n.map(e=>e.callback.apply(e.ctx,t.splice(1))))}else qc.trigger.apply(qc,arguments);const r=qc.promises[e];void 0!==r&&r.resolve()},hook(e,t,n){const r=qc._events[e]||[];if(r.length){const e=r.reduce((e,n)=>e.then(e=>n.callback(t,e)),Promise.resolve(n));return e.catch(e=>{throw Pn.error(e),e}),e}return n},user:{jid:()=>qc.connection.jid,async login(e,t,n=!1){var r,i;if(e=e||qc.jid,(!(null===(r=qc.connection)||void 0===r?void 0:r.jid)||e&&!Go.isSameDomain(qc.connection.jid,e))&&await qc.initConnection(),(null===(i=Wc.settings.get("connection_options"))||void 0===i?void 0:i.worker)&&await qc.connection.restoreWorkerSession())return;e&&(e=await qc.setUserJID(e));const o=qc.pluggable.plugins["converse-bosh"];if(o&&o.enabled()){if(await qc.restoreBOSHSession())return;if(Wc.settings.get("authentication")===qc.PREBIND&&(!n||Wc.settings.get("auto_login")))return qc.startNewPreboundBOSHSession()}t=t||Wc.settings.get("password"),async function(e,t){const{api:n}=qc;n.settings.get("authentication")===qc.LOGIN?e?Xc(e):qc.api.settings.get("credentials_url")?Xc(await async function(){let e,t=0;for(;!e;){try{e=await el(t)}catch(e){Pn.error("Could not fetch login credentials"),Pn.error(e)}t=2e3}return e}()):qc.jid&&(qc.api.settings.get("password")||qc.connection.pass)?Xc():!qc.isTestEnv()&&"credentials"in navigator?Xc(await async function(){try{const e=await navigator.credentials.get({password:!0});if(e&&"password"==e.type&&Go.isValidJID(e.id))return await qc.setUserJID(e.id),{jid:e.id,password:e.password}}catch(e){Pn.error(e)}}()):!qc.isTestEnv()&&Pn.warn("attemptNonPreboundSession: Couldn't find credentials to log in with"):![qc.ANONYMOUS,qc.EXTERNAL].includes(qc.api.settings.get("authentication"))||t&&!qc.api.settings.get("auto_login")||Xc()}(e&&t?{jid:e,password:t}:null,n)},logout(){const e=Go.getResolveablePromise(),t=()=>{Object.keys(qc.promises).forEach(Gc),delete qc.jid,Wc.trigger("logout"),e.resolve()};return qc.connection.setDisconnectionCause(qc.LOGOUT,void 0,!0),void 0!==qc.connection?(Wc.listen.once("disconnected",()=>t()),qc.connection.disconnect()):t(),e},settings:{getModel:async()=>(await $c(),Hc),get:async(e,t)=>(await $c(),void 0===Hc.get(e)?t:Hc.get(e)),async set(e,t){if(await $c(),N(e))return Hc.save(e,{promise:!0});{const n={};return n[e]=t,Hc.save(n,{promise:!0})}},async clear(){await $c(),Hc.clear()}}},settings:{extend(e){Go.merge(Fc,e);const t=Object.keys(Fo(e,Object.keys(Fc))),n=Fo(Uc,t),r=jr(Fo(e,t),n);Go.merge(qc.settings,r),Go.merge(qc,r)},update(e){return Pn.warn("The api.settings.update method has been deprecated and will be removed. Please use api.settings.extend instead."),this.extend(e)},get(e){if(Object.keys(Fc).includes(e))return qc[e]},set(e,t){const n={};N(e)?(jr(qc,Fo(e,Object.keys(Fc))),jr(qc.settings,Fo(e,Object.keys(Fc)))):"string"==typeof e&&(n[e]=t,jr(qc,Fo(n,Object.keys(Fc))),jr(qc.settings,Fo(n,Object.keys(Fc))))}},promises:{add(e,t=!0){(e=Array.isArray(e)?e:[e]).forEach(e=>{const n=Go.getResolveablePromise();n.replace=t,qc.promises[e]=n})}},listen:{once:qc.once.bind(qc),on:qc.on.bind(qc),not:qc.off.bind(qc),stanza(e,t,n){M(t)?(n=t,t={}):t=t||{},qc.connection.addHandler(n,t.ns,e,t.type,t.id,t.from,t)}},waitUntil(e){if(M(e))return Go.waitUntil(e);{const t=qc.promises[e];return void 0===t?null:t}},send:e=>Wc.connection.connected()?("string"==typeof e&&(e=Go.toStanza(e)),"iq"===e.tagName?Wc.sendIQ(e):(qc.connection.send(e),void Wc.trigger("send",e))):(Pn.warn("Not sending stanza because we're not connected!"),void Pn.warn(Oc.e.serialize(e))),sendIQ(e,t=qc.STANZA_TIMEOUT,n=!0){var r,i;let o;return e=null!==(r=null===(i=e)||void 0===i?void 0:i.nodeTree)&&void 0!==r?r:e,["get","set"].includes(e.getAttribute("type"))?(t=t||qc.STANZA_TIMEOUT,n?(o=new Promise((n,r)=>qc.connection.sendIQ(e,n,r,t)),o.catch(n=>{if(null===n)throw new Pc("Timeout error after ".concat(t,"ms for the following IQ stanza: ").concat(Oc.e.serialize(e)))})):o=new Promise(n=>qc.connection.sendIQ(e,n,n,t))):(qc.connection.sendIQ(e),o=Promise.resolve()),Wc.trigger("send",e),o}};function Gc(e){const t=qc.promises[e];if(!t)throw new Error("Tried to replace non-existing promise: ".concat(e));if(t.replace){const n=Go.getResolveablePromise();n.replace=t.replace,qc.promises[e]=n}else Pn.debug('Not replacing promise "'.concat(e,'"'))}function Vc(e,t){const n=qc.storage[t||qc.getDefaultStore()];return new _n(e,n)}async function Jc(){return await qc.api.trigger("beforeTearDown",{synchronous:!0}),window.removeEventListener("click",qc.onUserActivity),window.removeEventListener("focus",qc.onUserActivity),window.removeEventListener("keypress",qc.onUserActivity),window.removeEventListener("mousemove",qc.onUserActivity),window.removeEventListener(qc.unloadevent,qc.onUserActivity),window.clearInterval(qc.everySecondTrigger),qc.api.trigger("afterTearDown"),qc}function Xc(e){if([qc.ANONYMOUS,qc.EXTERNAL].includes(qc.api.settings.get("authentication"))){if(!qc.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.");qc.connection.reconnecting||qc.connection.reset(),qc.connection.connect(qc.jid.toLowerCase())}else if(qc.api.settings.get("authentication")===qc.LOGIN){var t;const n=e?e.password:(null===(t=qc.connection)||void 0===t?void 0:t.pass)||qc.api.settings.get("password");if(!n){if(qc.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 qc.connection.setDisconnectionCause(Oc.e.Status.AUTHFAIL,void 0,!0),void qc.api.connection.disconnect()}qc.connection.reconnecting||qc.connection.reset(),qc.connection.connect(qc.jid,n)}}function Qc(){var e;return null===(e=qc.session)||void 0===e||e.destroy(),delete qc.session,qc.shouldClearCache()&&qc.api.user.settings.clear(),qc.api.trigger("clearSession",{synchronous:!0})}async function Yc(e){var t;const n=Wc.settings.get("connection_options").worker,r=Oc.e.getBareJidFromJid(e).toLowerCase(),i="converse.session-".concat(r);(null===(t=qc.session)||void 0===t?void 0:t.get("id"))!==i?(qc.session=new zo({id:i}),qc.session.browserStorage=Vc(i,n?"persistent":"session"),await new Promise(e=>qc.session.fetch({success:e,error:e})),!n&&qc.session.get("active")&&(qc.session.clear(),qc.session.save({id:i})),Kc(e),function(){if("sessionStorage"===Wc.settings.get("persistent_store"))return;if("BrowserExtLocal"===qc.api.settings.get("persistent_store"))return _n.localForage.defineDriver(hr.a).then(()=>_n.localForage.setDriver("webExtensionLocalStorage")),void(qc.storage.persistent=_n.localForage);if("BrowserExtSync"===qc.api.settings.get("persistent_store"))return _n.localForage.defineDriver(ur.a).then(()=>_n.localForage.setDriver("webExtensionSyncStorage")),void(qc.storage.persistent=_n.localForage);const e={name:qc.isTestEnv()?"converse-test-persistent":"converse-persistent",storeName:qc.bare_jid};"localStorage"===qc.api.settings.get("persistent_store")?(e.description="localStorage instance",e.driver=[_n.localForage.LOCALSTORAGE]):"IndexedDB"===qc.api.settings.get("persistent_store")&&(e.description="indexedDB instance",e.driver=[_n.localForage.INDEXEDDB]),qc.storage.persistent=_n.localForage.createInstance(e)}(),qc.api.trigger("userSessionInitialized")):Kc(e)}function Kc(e){e=qc.session.get("jid")||e,qc.api.settings.get("authentication")===qc.ANONYMOUS||Oc.e.getResourceFromJid(e)||(e=e.toLowerCase()+da.generateResource()),qc.jid=e,qc.bare_jid=Oc.e.getBareJidFromJid(e),qc.resource=Oc.e.getResourceFromJid(e),qc.domain=Oc.e.getDomainFromJid(e),qc.session.save({jid:e,bare_jid:qc.bare_jid,resource:qc.resource,domain:qc.domain,active:!0}),qc.connection.jid=e}async function Zc(){var e;await Wc.trigger("cleanup",{synchronous:!0}),qc.router.history.stop(),document.removeEventListener("visibilitychange",qc.saveWindowState),Wc.trigger("unregisteredGlobalEventHandlers"),null===(e=qc.connection)||void 0===e||e.reset(),qc.stopListening(),qc.off(),qc.promises.initialized.isResolved&&Wc.promises.add("initialized")}function el(e=0){return new Promise(Ic((e,t)=>{const n=new XMLHttpRequest;n.open("GET",Wc.settings.get("credentials_url"),!0),n.setRequestHeader("Accept","application/json, text/javascript"),n.onload=()=>{if(n.status>=200&&n.status<400){const t=JSON.parse(n.responseText);qc.setUserJID(t.jid).then(()=>{e({jid:t.jid,password:t.password})})}else t(new Error("".concat(n.status,": ").concat(n.responseText)))},n.onerror=t,n.send()},e))}qc.isUniView=function(){return["mobile","fullscreen","embedded"].includes(Wc.settings.get("view_mode"))},qc.getDefaultStore=function(){if(qc.config.get("trusted")){return"sessionStorage"===Wc.settings.get("persistent_store")?"session":"persistent"}return"session"},qc.createStore=Vc,qc.shouldClearCache=()=>!qc.config.get("trusted")||Wc.settings.get("clear_cache_on_logout")||qc.isTestEnv(),qc.initConnection=function(){const e=qc.api;if(!e.settings.get("bosh_service_url")){if(e.settings.get("authentication")===qc.PREBIND)throw new Error("authentication is set to 'prebind' but we don't have a BOSH connection");if(!e.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 t=qc.isTestEnv()?ha:da;if(("WebSocket"in window||"MozWebSocket"in window)&&e.settings.get("websocket_url"))qc.connection=new t(e.settings.get("websocket_url"),Object.assign(qc.default_connection_options,e.settings.get("connection_options")));else{if(!e.settings.get("bosh_service_url"))throw new Error("initConnection: this browser does not support websockets and bosh_service_url wasn't specified.");qc.connection=new t(e.settings.get("bosh_service_url"),Object.assign(qc.default_connection_options,e.settings.get("connection_options"),{keepalive:e.settings.get("keepalive")}))}!function(){const e={};e[Oc.e.LogLevel.DEBUG]="debug",e[Oc.e.LogLevel.INFO]="info",e[Oc.e.LogLevel.WARN]="warn",e[Oc.e.LogLevel.ERROR]="error",e[Oc.e.LogLevel.FATAL]="fatal",Oc.e.log=(t,n)=>Pn.log(n,e[t]),Oc.e.error=e=>Pn.error(e),qc.connection.xmlInput=e=>Pn.debug(e.outerHTML,"color: darkgoldenrod"),qc.connection.xmlOutput=e=>Pn.debug(e.outerHTML,"color: darkcyan")}(),e.trigger("connectionInitialized")},qc.setUserJID=async function(e){return await Yc(e),qc.api.trigger("setUserJID"),e},qc.saveWindowState=function(e){let t;const n={focus:"visible",focusin:"visible",pageshow:"visible",blur:"hidden",focusout:"hidden",pagehide:"hidden"};t=(e=e||document.createEvent("Events")).type in n?n[e.type]:document.hidden?"hidden":"visible",qc.windowState=t,Wc.trigger("windowStateChanged",{state:t})},qc.ConnectionFeedback=zo.extend({defaults:{connection_status:Oc.e.Status.DISCONNECTED,message:""},initialize(){this.on("change",()=>Wc.trigger("connfeedback",qc.connfeedback))}});const tl=window.converse||{};Object.assign(tl,{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(e){if(await Zc(),"onpagehide"in window?qc.unloadevent="pagehide":"onbeforeunload"in window?qc.unloadevent="beforeunload":"onunload"in window&&(qc.unloadevent="unload"),function(e){qc.settings={},Uc=e;const t=Fo(e,Object.keys(Fc));jr(qc.settings,Fc,t),jr(qc,Fc,t)}(e),qc.strict_plugin_dependencies=e.strict_plugin_dependencies,Pn.setLogLevel(Wc.settings.get("loglevel")),Wc.settings.get("authentication")===qc.ANONYMOUS&&Wc.settings.get("auto_login")&&!Wc.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.");qc.router.route(/^converse\?loglevel=(debug|info|warn|error|fatal)$/,"loglevel",e=>Pn.setLogLevel(e)),qc.connfeedback=new qc.ConnectionFeedback,qc.send_initial_presence=!0,await async function(){await _n.sessionStorageInitialized,qc.storage={session:_n.localForage.createInstance({name:qc.isTestEnv()?"converse-test-session":"converse-session",description:"sessionStorage instance",driver:["sessionStorageWrapper"]})}}(),await async function(){const e="converse.client-config";qc.config=new zo({id:e,trusted:!0}),qc.config.browserStorage=Vc(e,"session"),await new Promise(e=>qc.config.fetch({success:e,error:e})),qc.api.trigger("clientConfigInitialized")}(),await Bc.initialize(),function(){qc.pluggable.initialized_plugins=[];const e=Lc.concat(qc.api.settings.get("whitelisted_plugins"));qc.api.settings.get("singleton")&&["converse-bookmarks","converse-controlbox","converse-headline","converse-register"].forEach(e=>qc.api.settings.get("blacklisted_plugins").push(e)),qc.pluggable.initializePlugins({_converse:qc},e,qc.api.settings.get("blacklisted_plugins")),qc.api.trigger("pluginsInitialized")}(),document.addEventListener("visibilitychange",qc.saveWindowState),qc.saveWindowState({type:document.hidden?"blur":"focus"}),Wc.trigger("registeredGlobalEventHandlers"),!History.started&&qc.router.history.start(),Wc.settings.get("idle_presence_timeout")>0&&Wc.listen.on("addClientFeatures",()=>Wc.disco.own.features.add(Oc.e.NS.IDLE));const t=qc.pluggable.plugins;if((Wc.settings.get("auto_login")||Wc.settings.get("keepalive")&&Rc(t["converse-bosh"],"enabled"))&&await Wc.user.login(null,null,!0),Wc.trigger("initialized"),qc.isTestEnv())return qc},plugins:{add(e,t){if(t.__name__=e,void 0!==qc.pluggable.plugins[e])throw new TypeError('Error: plugin with name "'.concat(e,'" has already been ')+"registered!");qc.pluggable.plugins[e]=t}},env:{$build:Oc.a,$iq:Oc.b,$msg:Oc.c,$pres:Oc.d,utils:Go,Collection:ta,CustomElement:pc,Model:zo,Promise:Promise,Strophe:Oc.e,dayjs:Sn.a,html:Ya,log:Pn,sizzle:pr.a,sprintf:Dc.sprintf,stanza_utils:hs,u:Go}});const nl=new CustomEvent("converse-loaded",{detail:{converse:tl}});window.dispatchEvent(nl);const{Strophe:rl}=tl.env;let il,ol;rl.addNamespace("ADHOC","http://jabber.org/protocol/commands");const sl={adhoc:{async getCommands(e){let t=[];try{n=await ol.disco.items(e,rl.NS.ADHOC),t=pr()('query[xmlns="'.concat(rl.NS.DISCO_ITEMS,'"][node="').concat(rl.NS.ADHOC,'"] item'),n).map(hs.getAttributes)}catch(t){null===t?Pn.error("Error: timeout while fetching ad-hoc commands for ".concat(e)):(Pn.error("Error while fetching ad-hoc commands for ".concat(e)),Pn.error(t))}var n;return t}}};tl.plugins.add("converse-adhoc",{dependencies:["converse-disco"],initialize(){il=this._converse,ol=il.api,Object.assign(ol,sl)}});var al=n(169),cl=n.n(al);var ll=function(e){return function(t,n,r){var i=Object(t);if(!Xe(t)){var o=So(n,3);t=Qe(t),n=function(e){return o(i[e],e,i)}}var s=e(t,n,r);return s>-1?i[o?t[s]:s]:void 0}}(Ms);var ul=function(e,t){return e===t||co(e,t,uo(t))};
/**
* @module converse-chat
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/const{$msg:dl,Strophe:hl,sizzle:fl,utils:pl}=tl.env,gl=tl.env.utils;tl.plugins.add("converse-chat",{dependencies:["converse-chatboxes","converse-disco"],initialize(){const{__:e}=qc;Wc.settings.extend({allow_message_corrections:"all",allow_message_retraction:"all",allow_message_styling:!0,auto_join_private_chats:[],clear_messages_on_reconnection:!1,filter_by_resource:!1,send_chat_state_notifications:!0});const t=zo.extend({initialize(){this.rosterContactAdded=gl.getResolveablePromise()},async setRosterContact(e){const t=await Wc.contacts.get(e);t&&(this.contact=t,this.set("nickname",t.get("nickname")),this.rosterContactAdded.resolve())}});qc.Message=t.extend({defaults:()=>({msgid:gl.getUniqueId(),time:(new Date).toISOString(),is_ephemeral:!1}),async initialize(){this.checkValidity()&&(this.initialized=gl.getResolveablePromise(),"chat"===this.get("type")&&(t.prototype.initialize.apply(this,arguments),this.setRosterContact(hl.getBareJidFromJid(this.get("from")))),this.get("file")&&this.on("change:put",this.uploadFile,this),this.setTimerForEphemeralMessage(),await Wc.trigger("messageInitialized",this,{Synchronous:!0}),this.initialized.resolve())},setTimerForEphemeralMessage(){const e=()=>{this.ephemeral_timer=window.setTimeout(this.safeDestroy.bind(this),1e4)};return this.isEphemeral()?(e(),!0):(this.on("change:is_ephemeral",()=>this.isEphemeral()?e():clearTimeout(this.ephemeral_timer)),!1)},checkValidity(){return 3!==Object.keys(this.attributes).length||(this.validationError="Empty message",this.safeDestroy(),!1)},mayBeRetracted(){return"me"===this.get("sender")&&["all","own"].includes(Wc.settings.get("allow_message_retraction"))},safeDestroy(){try{this.destroy()}catch(e){Pn.error(e)}},isEphemeral(){return this.get("is_ephemeral")},getDisplayName(){return"groupchat"===this.get("type")?this.get("nick"):this.contact?this.contact.getDisplayName():this.vcard?this.vcard.getDisplayName():this.get("from")},getMessageText(){return this.get("is_encrypted")?this.get("plaintext")||this.get("body")||e("Undecryptable OMEMO message"):this.get("message")},isMeCommand(){const e=this.getMessageText();return!!e&&e.startsWith("/me ")},sendSlotRequestStanza(){if(!this.file)return Promise.reject(new Error("file is undefined"));const e=tl.env.$iq({from:qc.jid,to:this.get("slot_request_url"),type:"get"}).c("request",{xmlns:hl.NS.HTTPUPLOAD,filename:this.file.name,size:this.file.size,"content-type":this.file.type});return Wc.sendIQ(e)},async getRequestSlotURL(){let t;try{t=await this.sendSlotRequestStanza()}catch(t){return Pn.error(t),this.save({type:"error",message:e("Sorry, could not determine upload URL."),is_ephemeral:!0})}const n=t.querySelector("slot");if(!n)return this.save({type:"error",message:e("Sorry, could not determine file upload URL."),is_ephemeral:!0});this.save({get:n.querySelector("get").getAttribute("url"),put:n.querySelector("put").getAttribute("url")})},uploadFile(){const t=new XMLHttpRequest;t.onreadystatechange=()=>{t.readyState===XMLHttpRequest.DONE&&(Pn.info("Status: "+t.status),200===t.status||201===t.status?this.save({upload:qc.SUCCESS,oob_url:this.get("get"),message:this.get("get")}):t.onerror())},t.upload.addEventListener("progress",e=>{e.lengthComputable&&this.set("progress",e.loaded/e.total)},!1),t.onerror=()=>{let n;n=t.responseText?e('Sorry, could not succesfully upload your file. Your servers response: "%1$s"',t.responseText):e("Sorry, could not succesfully upload your file."),this.save({type:"error",upload:qc.FAILURE,message:n,is_ephemeral:!0})},t.open("PUT",this.get("put"),!0),t.setRequestHeader("Content-type",this.file.type),t.send(this.file)}}),qc.Messages=ta.extend({model:qc.Message,comparator:"time"}),qc.ChatBox=t.extend({messagesCollection:qc.Messages,defaults(){return{bookmarked:!1,chat_state:void 0,hidden:qc.isUniView()&&!Wc.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:qc.PRIVATE_CHAT_TYPE,url:""}},async initialize(){this.initialized=gl.getResolveablePromise(),t.prototype.initialize.apply(this,arguments);const e=this.get("jid");e&&(this.set({box_id:"box-".concat(e)}),this.initNotifications(),this.initMessages(),this.get("type")===qc.PRIVATE_CHAT_TYPE&&(this.presence=qc.presences.findWhere({jid:e})||qc.presences.create({jid:e}),await this.setRosterContact(e)),this.on("change:chat_state",this.sendChatState,this),await this.fetchMessages(),await Wc.trigger("chatBoxInitialized",this,{Synchronous:!0}),this.initialized.resolve())},getMessagesCacheKey(){return"converse.messages-".concat(this.get("jid"),"-").concat(qc.bare_jid)},initMessages(){this.messages=new this.messagesCollection,this.messages.fetched=gl.getResolveablePromise(),this.messages.fetched.then(()=>{Wc.trigger("afterMessagesFetched",this)}),this.messages.chatbox=this,this.messages.browserStorage=qc.createStore(this.getMessagesCacheKey()),this.listenTo(this.messages,"change:upload",e=>{e.get("upload")===qc.SUCCESS&&Wc.send(this.createMessageStanza(e))})},initNotifications(){this.notifications=new zo},afterMessagesFetched(){Wc.trigger("afterMessagesFetched",this)},fetchMessages(){if(this.messages.fetched_flag)return void Pn.info("Not re-fetching messages for ".concat(this.get("jid")));this.messages.fetched_flag=!0;const e=this.messages.fetched.resolve;return this.messages.fetch({add:!0,success:()=>{this.afterMessagesFetched(),e()},error:()=>{this.afterMessagesFetched(),e()}}),this.messages.fetched},async handleErrorMessageStanza(t){const n=await hs.parseMessage(t,qc);if(!await this.shouldShowErrorMessage(n))return;const r=this.getMessageReferencedByError(n);if(r){const t={error:n.error,error_condition:n.error_condition,error_text:n.error_text,error_type:n.error_type,editable:!1};n.msgid===r.get("retraction_id")?(t.retraction_id=void 0,n.error||("forbidden"===n.error_condition?t.error=e("You're not allowed to retract your message."):t.error=e("Sorry, an error occurred while trying to retract your message."))):n.error||("forbidden"===n.error_condition?t.error=e("You're not allowed to send a message."):t.error=e("Sorry, an error occurred while trying to send your message.")),r.save(t)}else this.createMessage(n)},queueMessage(e){return this.msg_chain=(this.msg_chain||this.messages.fetched).then(()=>this.onMessage(e)).catch(e=>Pn.error(e)),this.msg_chain},async onMessage(e){if(e=await e,gl.isErrorObject(e))return e.stanza&&Pn.error(e.stanza),Pn.error(e.message);const t=this.getDuplicateMessage(e);if(t)this.updateMessage(t,e);else if(!this.handleReceipt(e)&&!this.handleChatMarker(e)&&!await this.handleRetraction(e)&&(this.setEditable(e,e.time),e.chat_state&&"them"===e.sender&&this.notifications.set("chat_state",e.chat_state),gl.shouldCreateMessage(e))){const t=this.handleCorrection(e)||await this.createMessage(e);this.notifications.set({chat_state:null}),this.handleUnreadMessage(t)}},async clearMessages(){try{await this.messages.clearStore()}catch(e){this.messages.trigger("reset"),Pn.error(e)}finally{delete this.msg_chain,delete this.messages.fetched_flag,this.messages.fetched=gl.getResolveablePromise()}},async close(){try{await new Promise((e,t)=>this.destroy({success:e,error:(e,n)=>t(n)}))}catch(e){Pn.error(e)}finally{Wc.settings.get("clear_messages_on_reconnection")&&await this.clearMessages()}},announceReconnection(){Wc.trigger("chatReconnected",this)},async onReconnection(){Wc.settings.get("clear_messages_on_reconnection")&&await this.clearMessages(),this.announceReconnection()},validate(e){if(!e.jid)return"Ignored ChatBox without JID";const t=qc.auto_join_rooms.map(e=>N(e)?e.jid:e),n=Wc.settings.get("auto_join_private_chats").concat(t);if(Wc.settings.get("singleton")&&!n.includes(e.jid)&&!Wc.settings.get("auto_join_on_invite")){const t="".concat(e.jid," is not allowed because singleton is true and it's not being auto_joined");return Pn.warn(t),t}},getDisplayName(){return this.contact?this.contact.getDisplayName():this.vcard?this.vcard.getDisplayName():this.get("jid")},async createMessageFromError(e){if(e instanceof qc.TimeoutError){(await this.createMessage({type:"error",message:e.message,retry_event_id:e.retry_event_id})).error=e}},getOldestMessage(){for(let e=0;e<this.messages.length;e++){const t=this.messages.at(e);if(t.get("type")===this.get("message_type"))return t}},getMostRecentMessage(){for(let e=this.messages.length-1;e>=0;e--){const t=this.messages.at(e);if(t.get("type")===this.get("message_type"))return t}},getUpdatedMessageAttributes:(e,t)=>(({is_archived:e})=>({is_archived:e}))(t),updateMessage(e,t){const n=this.getUpdatedMessageAttributes(e,t);n&&e.save(n)},setChatState(e,t){return void 0!==this.chat_state_timeout&&(window.clearTimeout(this.chat_state_timeout),delete this.chat_state_timeout),e===qc.COMPOSING?this.chat_state_timeout=window.setTimeout(this.setChatState.bind(this),qc.TIMEOUTS.PAUSED,qc.PAUSED):e===qc.PAUSED&&(this.chat_state_timeout=window.setTimeout(this.setChatState.bind(this),qc.TIMEOUTS.INACTIVE,qc.INACTIVE)),this.set("chat_state",e,t),this},getMessageReferencedByError(e){const t=e.msgid;return t&&this.messages.models.find(e=>[e.get("msgid"),e.get("retraction_id")].includes(t))},shouldShowErrorMessage(e){if(this.getMessageReferencedByError(e)||e.body)return!0},isSameUser:(e,t)=>gl.isSameBareJID(e,t),findDanglingRetraction(e){if(!e.origin_id||!this.messages.length)return null;if(this.messages.last().get("time")>e.time){const t=Array.from(this.messages.models);return t.reverse(),t.find(({attributes:t})=>t.retracted_id===e.origin_id&&t.from===e.from&&!t.moderated_by)}},async handleRetraction(e){const t=["retracted","retracted_id","editable"];if(e.retracted){if(e.is_tombstone)return!1;const n=this.messages.findWhere({origin_id:e.retracted_id,from:e.from});return n?(n.save(Fo(e,t)),!0):(e.dangling_retraction=!0,await this.createMessage(e),!0)}{const n=this.findDanglingRetraction(e);if(n){const r=Fo(n.attributes,t),i=Object.assign({dangling_retraction:!1},e,r);return delete i.id,n.save(i),!0}}return!1},handleCorrection(e){if(!e.replace_id||!e.from)return;const t=this.messages.findWhere({msgid:e.replace_id,from:e.from});if(!t)return;const n=t.get("older_versions")||{};return e.time<t.get("time")&&t.get("edited")?(n[e.time]=e.message,t.save({older_versions:n})):(Object.keys(n).length?n[t.get("edited")]=t.get("message"):n[t.get("time")]=t.get("message"),delete(e=Object.assign(e,{older_versions:n})).id,e.time=t.get("time"),t.save(e)),t},getDuplicateMessage(e){const t=[...this.getStanzaIdQueryAttrs(e),this.getOriginIdQueryAttrs(e),this.getMessageBodyQueryAttrs(e)].filter(e=>e),n=this.messages.models;return ll(n,e=>t.reduce((t,n)=>t||ul(e.attributes,n),!1))},getOriginIdQueryAttrs:e=>e.origin_id&&{origin_id:e.origin_id,from:e.from},getStanzaIdQueryAttrs:e=>Object.keys(e).filter(e=>e.startsWith("stanza_id ")).map(t=>{const n=t.replace(/^stanza_id /,""),r={};return r["stanza_id ".concat(n)]=e[t],r}),getMessageBodyQueryAttrs(e){if(e.message&&e.msgid){const t={from:e.from,msgid:e.msgid};return e.is_encrypted||(t.message=e.message),t}},retractOwnMessage(e){this.sendRetractionMessage(e),e.save({retracted:(new Date).toISOString(),retracted_id:e.get("origin_id"),retraction_id:e.get("id"),is_ephemeral:!0,editable:!1})},sendRetractionMessage(e){const t=e.get("origin_id");if(!t)throw new Error("Can't retract message without a XEP-0359 Origin ID");const n=dl({id:gl.getUniqueId(),to:this.get("jid"),type:"chat"}).c("store",{xmlns:hl.NS.HINTS}).up().c("apply-to",{id:t,xmlns:hl.NS.FASTEN}).c("retract",{xmlns:hl.NS.RETRACT});return qc.connection.send(n)},sendMarkerForMessage(e){if(null==e?void 0:e.get("is_markable")){const t=hl.getBareJidFromJid(e.get("from"));this.sendMarker(t,e.get("msgid"),"displayed",e.get("type"))}},sendMarker(e,t,n,r){const i=dl({from:qc.connection.jid,id:gl.getUniqueId(),to:e,type:r||"chat"}).c(n,{xmlns:hl.NS.MARKERS,id:t});Wc.send(i)},handleChatMarker(e){if(hl.getBareJidFromJid(e.to)!==qc.bare_jid)return!1;if(e.is_markable)return!this.contact||e.is_archived||e.is_carbon||this.sendMarker(e.from,e.msgid,"received"),!1;if(e.marker_id){const t=this.messages.findWhere({msgid:e.marker_id}),n="marker_".concat(e.marker);return t&&!t.get(n)&&t.save({field_name:(new Date).toISOString()}),!0}},sendReceiptStanza(e,t){const n=dl({from:qc.connection.jid,id:gl.getUniqueId(),to:e,type:"chat"}).c("received",{xmlns:hl.NS.RECEIPTS,id:t}).up().c("store",{xmlns:hl.NS.HINTS}).up();Wc.send(n)},handleReceipt(e){if("them"===e.sender)if(e.is_valid_receipt_request)this.sendReceiptStanza(e.from,e.msgid);else if(e.receipt_id){const t=this.messages.findWhere({msgid:e.receipt_id});return t&&!t.get("received")&&t.save({received:(new Date).toISOString()}),!0}return!1},createMessageStanza(e){const t=dl({from:qc.connection.jid,to:this.get("jid"),type:this.get("message_type"),id:e.get("edited")&&gl.getUniqueId()||e.get("msgid")}).c("body").t(e.get("message")).up().c(qc.ACTIVE,{xmlns:hl.NS.CHATSTATES}).root();return"chat"===e.get("type")&&t.c("request",{xmlns:hl.NS.RECEIPTS}).root(),e.get("is_spoiler")&&(e.get("spoiler_hint")?t.c("spoiler",{xmlns:hl.NS.SPOILER},e.get("spoiler_hint")).root():t.c("spoiler",{xmlns:hl.NS.SPOILER}).root()),(e.get("references")||[]).forEach(e=>{const n={xmlns:hl.NS.REFERENCE,begin:e.begin,end:e.end,type:e.type};e.uri&&(n.uri=e.uri),t.c("reference",n).root()}),e.get("oob_url")&&t.c("x",{xmlns:hl.NS.OUTOFBAND}).c("url").t(e.get("oob_url")).root(),e.get("edited")&&t.c("replace",{xmlns:hl.NS.MESSAGE_CORRECT,id:e.get("msgid")}).root(),e.get("origin_id")&&t.c("origin-id",{xmlns:hl.NS.SID,id:e.get("origin_id")}).root(),t},getOutgoingMessageAttributes(e,t){const n=this.get("composing_spoiler"),r=gl.getUniqueId(),i=e?gl.httpToGeoUri(gl.shortnamesToUnicode(e),qc):void 0;return{from:qc.bare_jid,fullname:qc.xmppstatus.get("fullname"),id:r,is_only_emojis:!!e&&gl.isOnlyEmojis(e),jid:this.get("jid"),message:i,msgid:r,nickname:this.get("nickname"),sender:"me",spoiler_hint:n?t:void 0,time:(new Date).toISOString(),type:this.get("message_type"),body:i,is_spoiler:n,origin_id:r}},setEditable(e,t){if(!e.is_headline&&!gl.isEmptyMessage(e)&&"me"===e.sender)if("all"===Wc.settings.get("allow_message_corrections"))e.editable=!(e.file||e.retracted||"oob_url"in e);else if("last"===Wc.settings.get("allow_message_corrections")&&t>this.get("time_sent")){this.set({time_sent:t});const n=this.messages.findWhere({editable:!0});n&&n.save({editable:!1}),e.editable=!(e.file||e.retracted||"oob_url"in e)}},async createMessage(e,t){return e.time=e.time||(new Date).toISOString(),await this.messages.fetched,this.messages.create(e,Object.assign({wait:!0,promise:!0},t))},async sendMessage(e,t){const n=this.getOutgoingMessageAttributes(e,t);let r=this.messages.findWhere("correcting");if(r){const e=r.get("older_versions")||{};e[r.get("time")]=r.get("message"),r.save({correcting:!1,edited:(new Date).toISOString(),message:n.message,older_versions:e,references:n.references,is_only_emojis:n.is_only_emojis,origin_id:gl.getUniqueId(),received:void 0})}else this.setEditable(n,(new Date).toISOString()),r=await this.createMessage(n);return Wc.send(this.createMessageStanza(r)),Wc.trigger("sendMessage",{chatbox:this,message:r}),r},sendChatState(){if(Wc.settings.get("send_chat_state_notifications")&&this.get("chat_state")){const e=Wc.settings.get("send_chat_state_notifications");if(Array.isArray(e)&&!e.includes(this.get("chat_state")))return;Wc.send(dl({id:gl.getUniqueId(),to:this.get("jid"),type:"chat"}).c(this.get("chat_state"),{xmlns:hl.NS.CHATSTATES}).up().c("no-store",{xmlns:hl.NS.HINTS}).up().c("no-permanent-store",{xmlns:hl.NS.HINTS}))}},async sendFiles(t){var n;const r=(await Wc.disco.features.get(hl.NS.HTTPUPLOAD,qc.domain)).pop();if(!r)return void this.createMessage({message:e("Sorry, looks like file upload is not supported by your server."),type:"error",is_ephemeral:!0});const i=r.dataforms.where({FORM_TYPE:{value:hl.NS.HTTPUPLOAD,type:"hidden"}}).pop(),o=window.parseInt(null===(n=((null==i?void 0:i.attributes)||{})["max-file-size"])||void 0===n?void 0:n.value),s=null==r?void 0:r.id;s?Array.from(t).forEach(async t=>{if(!window.isNaN(o)&&window.parseInt(t.size)>o)return this.createMessage({message:e("The size of your file, %1$s, exceeds the maximum allowed by your server, which is %2$s.",t.name,cl()(o)),type:"error",is_ephemeral:!0});{const e=Object.assign(this.getOutgoingMessageAttributes(),{file:!0,progress:0,slot_request_url:s});this.setEditable(e,(new Date).toISOString());const n=await this.createMessage(e,{silent:!0});n.file=t,this.messages.trigger("add",n),n.getRequestSlotURL()}}):this.createMessage({message:e("Sorry, looks like file upload is not supported by your server."),type:"error",is_ephemeral:!0})},maybeShow(e){if(e){if(qc.isUniView()){const e=e=>!e.get("hidden")&&e.get("jid")!==this.get("jid")&&"controlbox"!==e.get("id");qc.chatboxes.filter(e).forEach(e=>gl.safeSave(e,{hidden:!0}))}gl.safeSave(this,{hidden:!1})}return qc.isUniView()&&this.get("hidden")?void 0:this.trigger("show")},isHidden(){return qc.isUniView()&&this.get("hidden")||this.isScrolledUp()||"hidden"===qc.windowState},handleUnreadMessage(e){if((null==e?void 0:e.get("body"))&&pl.isNewMessage(e))if(this.isHidden()){const t={num_unread:this.get("num_unread")+1};0===this.get("num_unread")&&(t.first_unread_id=e.get("id")),this.save(t)}else this.sendMarkerForMessage(e)},clearUnreadMsgCounter(){this.get("num_unread")>0&&this.sendMarkerForMessage(this.messages.last()),gl.safeSave(this,{num_unread:0})},isScrolledUp(){return this.get("scrolled",!0)}}),qc.handleMessageStanza=async function(e){if(hs.isServerMessage(e)){const t=e.getAttribute("from");return Pn.info("handleMessageStanza: Ignoring incoming server message from JID: ".concat(t))}const t=await hs.parseMessage(e,qc);if(gl.isErrorObject(t))return t.stanza&&Pn.error(t.stanza),Pn.error(t.message);const n=!!fl('body, encrypted[xmlns="'.concat(hl.NS.OMEMO,'"]'),e).length,r=await Wc.chats.get(t.contact_jid,{nickname:t.nick},n);await(null==r?void 0:r.queueMessage(t));const i={stanza:e,attrs:t,chatbox:r};Wc.trigger("message",i)},qc.router.route("converse/chat?jid=:jid",(function(e){if(!pl.isValidJID(e))return Pn.warn('Invalid JID "'.concat(e,'" provided in URL fragment'));Wc.chats.open(e)})),Wc.listen.on("chatBoxesFetched",(function(){Wc.settings.get("auto_join_private_chats").forEach(e=>{qc.chatboxes.where({jid:e}).length||("string"==typeof e?Wc.chats.open(e):Pn.error('Invalid jid criteria specified for "auto_join_private_chats"'))}),Wc.trigger("privateChatsAutoJoined")})),Wc.listen.on("presencesInitialized",(function(){qc.connection.addHandler(e=>fl('message > result[xmlns="'.concat(hl.NS.MAM,'"]'),e).pop()?(Pn.warn('Received a MAM message with type "chat".'),!0):(qc.handleMessageStanza(e),!0),null,"message","chat"),qc.connection.addHandler(e=>(null!==e.getAttribute("type")||qc.handleMessageStanza(e),!0),hl.NS.RECEIPTS,"message"),qc.connection.addHandler(e=>(async function(e){const t=hl.getBareJidFromJid(e.getAttribute("from"));if(pl.isSameBareJID(t,qc.bare_jid))return;const n=await Wc.chatboxes.get(t);null==n||n.handleErrorMessageStanza(e)}(e),!0),null,"message","error")})),Wc.listen.on("clearSession",async()=>{if(qc.shouldClearCache()){await Promise.all(qc.chatboxes.map(e=>e.messages&&e.messages.clearStore({silent:!0})));const e=e=>e.get("type")!==qc.CONTROLBOX_TYPE;qc.chatboxes.clearStore({silent:!0},e)}}),Object.assign(Wc,{chats:{async create(e,t){if("string"==typeof e){if(t&&!(null==t?void 0:t.fullname)){var n;const r=await Wc.contacts.get(e);t.fullname=null==r||null===(n=r.attributes)||void 0===n?void 0:n.fullname}const r=Wc.chats.get(e,t,!0);return r||void Pn.error("Could not open chatbox for JID: "+e)}return Array.isArray(e)?Promise.all(e.forEach(async n=>{var r;const i=await Wc.contacts.get(e);return t.fullname=null==i||null===(r=i.attributes)||void 0===r?void 0:r.fullname,Wc.chats.get(n,t,!0).maybeShow()})):(Pn.error("chats.create: You need to provide at least one JID"),null)},async open(e,t,n){if("string"==typeof e){const r=await Wc.chats.get(e,t,!0);return r?r.maybeShow(n):r}if(Array.isArray(e))return Promise.all(e.map(e=>Wc.chats.get(e,t,!0).then(e=>e&&e.maybeShow(n))).filter(e=>e));const r="chats.open: You need to provide at least one JID";throw Pn.error(r),new Error(r)},async get(e,t={},n=!1){async function r(e){let r=await Wc.chatboxes.get(e);return!r&&n?r=await Wc.chatboxes.create(e,t,qc.ChatBox):(r=r&&r.get("type")===qc.PRIVATE_CHAT_TYPE?r:null,r&&Object.keys(t).length&&r.save(t)),r}if(void 0===e){return(await Wc.chatboxes.get()).filter(e=>e.get("type")===qc.PRIVATE_CHAT_TYPE)}return"string"==typeof e?r(e):Promise.all(e.map(e=>r(e)))}}})}});
/**
* @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:ml,$iq:vl,utils:_l}=tl.env;tl.plugins.add("converse-disco",{initialize(){function e(){if(!qc.stream_features){const e=ml.getBareJidFromJid(qc.jid),t="converse.stream-features-".concat(e);Wc.promises.add("streamFeaturesAdded"),qc.stream_features=new ta,qc.stream_features.browserStorage=qc.createStore(t,"session")}}function t(){Wc.trigger("streamFeaturesAdded")}Wc.promises.add("discoInitialized"),Wc.promises.add("streamFeaturesAdded"),qc.DiscoEntity=zo.extend({idAttribute:"jid",initialize(e,t){this.waitUntilFeaturesDiscovered=_l.getResolveablePromise(),this.dataforms=new ta;let n="converse.dataforms-".concat(this.get("jid"));this.dataforms.browserStorage=qc.createStore(n,"session"),this.features=new ta,n="converse.features-".concat(this.get("jid")),this.features.browserStorage=qc.createStore(n,"session"),this.listenTo(this.features,"add",this.onFeatureAdded),this.fields=new ta,n="converse.fields-".concat(this.get("jid")),this.fields.browserStorage=qc.createStore(n,"session"),this.listenTo(this.fields,"add",this.onFieldAdded),this.identities=new ta,n="converse.identities-".concat(this.get("jid")),this.identities.browserStorage=qc.createStore(n,"session"),this.fetchFeatures(t),this.items=new qc.DiscoEntities,n="converse.disco-items-".concat(this.get("jid")),this.items.browserStorage=qc.createStore(n,"session"),this.items.fetch()},async getIdentity(e,t){return await this.waitUntilFeaturesDiscovered,this.identities.findWhere({category:e,type:t})},async hasFeature(e){if(await this.waitUntilFeaturesDiscovered,this.features.findWhere({var:e}))return this},onFeatureAdded(e){e.entity=this,Wc.trigger("serviceDiscovered",e)},onFieldAdded(e){e.entity=this,Wc.trigger("discoExtensionFieldDiscovered",e)},async fetchFeatures(e){if(e.ignore_cache)this.queryInfo();else{const e=this.features.browserStorage.name,t=await this.features.browserStorage.store.getItem(e);t&&0===t.length||null===t?this.queryInfo():(this.features.fetch({add:!0,success:()=>{this.waitUntilFeaturesDiscovered.resolve(this),this.trigger("featuresDiscovered")}}),this.identities.fetch({add:!0}))}},async queryInfo(){let e;try{e=await Wc.disco.info(this.get("jid"),null)}catch(e){return null===e?Pn.error("Timeout for disco#info query for ".concat(this.get("jid"))):Pn.error(e),void this.waitUntilFeaturesDiscovered.resolve(this)}this.onInfo(e)},onDiscoItems(e){pr()('query[xmlns="'.concat(ml.NS.DISCO_ITEMS,'"] item'),e).forEach(e=>{if(e.getAttribute("node"))return;const t=e.getAttribute("jid");if(void 0===this.items.get(t)){const e=qc.disco_entities.get(t);e?this.items.add(e):this.items.create({jid:t})}})},async queryForItems(){if(0===this.identities.where({category:"server"}).length)return;const e=await Wc.disco.items(this.get("jid"));this.onDiscoItems(e)},onInfo(e){Array.from(e.querySelectorAll("identity")).forEach(e=>{this.identities.create({category:e.getAttribute("category"),type:e.getAttribute("type"),name:e.getAttribute("name")})}),pr()('x[type="result"][xmlns="'.concat(ml.NS.XFORM,'"]'),e).forEach(e=>{const t={};pr()("field",e).forEach(e=>{var n;t[e.getAttribute("var")]={value:null===(n=e.querySelector("value"))||void 0===n?void 0:n.textContent,type:e.getAttribute("type")}}),this.dataforms.create(t)}),e.querySelector('feature[var="'.concat(ml.NS.DISCO_ITEMS,'"]'))&&this.queryForItems(),Array.from(e.querySelectorAll("feature")).forEach(t=>{this.features.create({var:t.getAttribute("var"),from:e.getAttribute("from")})}),pr()('x[type="result"][xmlns="jabber:x:data"] field',e).forEach(t=>{var n;this.fields.create({var:t.getAttribute("var"),value:null===(n=t.querySelector("value"))||void 0===n?void 0:n.textContent,from:e.getAttribute("from")})}),this.waitUntilFeaturesDiscovered.resolve(this),this.trigger("featuresDiscovered")}}),qc.DiscoEntities=ta.extend({model:qc.DiscoEntity,fetchEntities(){return new Promise((e,t)=>{this.fetch({add:!0,success:e,error(e,n){Pn.error(n),t(new Error("Could not fetch disco entities"))}})})}});const n=this;function r(e){const t=e.getElementsByTagName("query")[0].getAttribute("node"),r={xmlns:ml.NS.DISCO_INFO};t&&(r.node=t);const i=vl({type:"result",id:e.getAttribute("id")}),o=e.getAttribute("from");return null!==o&&i.attrs({to:o}),i.c("query",r),n._identities.forEach(e=>{const t={category:e.category,type:e.type};e.name&&(t.name=e.name),e.lang&&(t["xml:lang"]=e.lang),i.c("identity",t).up()}),n._features.forEach(e=>i.c("feature",{var:e}).up()),Wc.send(i.tree()),!0}async function i(){Wc.disco.own.identities.add("client","web","Converse"),Wc.disco.own.features.add(ml.NS.CHATSTATES),Wc.disco.own.features.add(ml.NS.DISCO_INFO),Wc.disco.own.features.add(ml.NS.ROSTERX),Wc.settings.get("message_carbons")&&Wc.disco.own.features.add(ml.NS.CARBONS),Wc.trigger("addClientFeatures"),qc.connection.addHandler(r,ml.NS.DISCO_INFO,"iq","get",null,null),qc.disco_entities=new qc.DiscoEntities;const e="converse.disco-entities-".concat(qc.bare_jid);qc.disco_entities.browserStorage=qc.createStore(e,"session");const t=await qc.disco_entities.fetchEntities();0!==t.length&&t.get(qc.domain)||qc.disco_entities.create({jid:qc.domain}),Wc.trigger("discoInitialized")}n._identities=[],n._features=[],Wc.listen.on("userSessionInitialized",async()=>{e(),qc.connfeedback.get("connection_status")===ml.Status.ATTACHED&&(await new Promise((e,t)=>qc.stream_features.fetch({success:e,error:t})),t())}),Wc.listen.on("beforeResourceBinding",(function(){e(),Array.from(qc.connection.features.childNodes).forEach(e=>{qc.stream_features.create({name:e.nodeName,xmlns:e.getAttribute("xmlns")})}),t()})),Wc.listen.on("reconnected",i),Wc.listen.on("connected",i),Wc.listen.on("beforeTearDown",async()=>{Wc.promises.add("streamFeaturesAdded"),qc.stream_features&&(await qc.stream_features.clearStore(),delete qc.stream_features)}),Wc.listen.on("clearSession",()=>{qc.shouldClearCache()&&qc.disco_entities&&(Array.from(qc.disco_entities.models).forEach(e=>e.features.clearStore()),Array.from(qc.disco_entities.models).forEach(e=>e.identities.clearStore()),Array.from(qc.disco_entities.models).forEach(e=>e.dataforms.clearStore()),Array.from(qc.disco_entities.models).forEach(e=>e.fields.clearStore()),qc.disco_entities.clearStore(),delete qc.disco_entities)}),Object.assign(Wc,{disco:{stream:{async getFeature(e,t){if(await Wc.waitUntil("streamFeaturesAdded"),!e||!t)throw new Error("name and xmlns need to be provided when calling disco.stream.getFeature");if(void 0!==qc.stream_features||Wc.connection.connected())return qc.stream_features.findWhere({name:e,xmlns:t});{const n="Tried to get feature ".concat(e," ").concat(t," but _converse.stream_features has been torn down");Pn.warn(n)}}},own:{identities:{add(e,t,r,i){for(var o=0;o<n._identities.length;o++)if(n._identities[o].category==e&&n._identities[o].type==t&&n._identities[o].name==r&&n._identities[o].lang==i)return!1;n._identities.push({category:e,type:t,name:r,lang:i})},clear(){n._identities=[]},get:()=>n._identities},features:{add(e){for(var t=0;t<n._features.length;t++)if(n._features[t]==e)return!1;n._features.push(e)},clear(){n._features=[]},get:()=>n._features}},info(e,t){const n={xmlns:ml.NS.DISCO_INFO};t&&(n.node=t);const r=vl({from:qc.connection.jid,to:e,type:"get"}).c("query",n);return Wc.sendIQ(r)},items(e,t){const n={xmlns:ml.NS.DISCO_ITEMS};return t&&(n.node=t),Wc.sendIQ(vl({from:qc.connection.jid,to:e,type:"get"}).c("query",n))},entities:{async get(e,t=!1){if(await Wc.waitUntil("discoInitialized"),!e)return qc.disco_entities;if(void 0===qc.disco_entities&&!Wc.connection.connected()){const t="Tried to look up entity ".concat(e," but _converse.disco_entities has been torn down");return void Pn.warn(t)}const n=qc.disco_entities.get(e);return n||!t?n:Wc.disco.entities.create(e)},create:(e,t)=>qc.disco_entities.create({jid:e},t)},features:{async get(e,t){if(!t)throw new TypeError("You need to provide an entity JID");await Wc.waitUntil("discoInitialized");let n=await Wc.disco.entities.get(t,!0);if(void 0===qc.disco_entities&&!Wc.connection.connected()){const n="Tried to get feature ".concat(e," for ").concat(t," but _converse.disco_entities has been torn down");return void Pn.warn(n)}n=await n.waitUntilFeaturesDiscovered;const r=[...n.items.map(t=>t.hasFeature(e)),n.hasFeature(e)];return(await Promise.all(r)).filter(N)}},supports:async(e,t)=>(await Wc.disco.features.get(e,t)).length>0,async refresh(e){if(!e)throw new TypeError("api.disco.refresh: You need to provide an entity JID");await Wc.waitUntil("discoInitialized");let t=await Wc.disco.entities.get(e);return t?(t.features.reset(),t.fields.reset(),t.identities.reset(),t.waitUntilFeaturesDiscovered.isPending||(t.waitUntilFeaturesDiscovered=_l.getResolveablePromise()),t.queryInfo()):t=await Wc.disco.entities.create(e,{ignore_cache:!0}),t.waitUntilFeaturesDiscovered},refreshFeatures:e=>Wc.refresh(e),async getFeatures(e){if(!e)throw new TypeError("api.disco.getFeatures: You need to provide an entity JID");await Wc.waitUntil("discoInitialized");let t=await Wc.disco.entities.get(e,!0);return t=await t.waitUntilFeaturesDiscovered,t.features},async getFields(e){if(!e)throw new TypeError("api.disco.getFields: You need to provide an entity JID");await Wc.waitUntil("discoInitialized");let t=await Wc.disco.entities.get(e,!0);return t=await t.waitUntilFeaturesDiscovered,t.fields},async getIdentity(e,t,n){const r=await Wc.disco.entities.get(n,!0);if(void 0!==r||Wc.connection.connected())return r.getIdentity(e,t);{const t="Tried to look up category ".concat(e," for ").concat(n," but _converse.disco_entities has been torn down");Pn.warn(t)}}}})}});const bl=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|\\-__\\-|\\:\\-Þ|\\:\\-Þ|\\<\\/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|\\:Þ|\\:Þ|\\:\\-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"),yl=/(?:\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 wl(){const e=El(['<img class="emoji"\n draggable="false"\n title="','"\n alt="','"\n src="','">']);return wl=function(){return e},e}function Sl(){const e=El(['<img class="emoji"\n draggable="false"\n title="','"\n alt="','"\n src="',"/72x72/",'.png"/>']);return Sl=function(){return e},e}function xl(){const e=El(['<span title="','">',"</span>"]);return xl=function(){return e},e}function El(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}
/**
* @module converse-emoji
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/const Al=tl.env.utils;tl.emojis={initialized:!1,initialized_promise:Al.getResolveablePromise()};const Cl={"*\\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",":-Þ":"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",":Þ":"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 jl(e){if(e.indexOf("-")>-1){const t=[],n=e.split("-");for(let e=0;e<n.length;e++){let r=parseInt(n[e],16);if(r>=65536&&r<=1114111){const e=Math.floor((r-65536)/1024)+55296,t=(r-65536)%1024+56320;r=String.fromCharCode(e)+String.fromCharCode(t)}else r=String.fromCharCode(r);t.push(r)}return t.join("")}return function(e){let t="string"==typeof e?parseInt(e,16):e;return t<65536?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}(e)}function Ol(){var e;return tl.emojis.toned||(tl.emojis.toned=(e=Object.values(tl.emojis.json.people).filter(e=>e.sn.includes("_tone")).map(e=>e.sn.replace(/_tone[1-5]/,"")),[...new Set(e)])),tl.emojis.toned}function Tl(e){return e.replace(bl,(e,t,n,r)=>{if(void 0===r||""===r||!(Al.unescapeHTML(r)in Cl))return e;return r=Al.unescapeHTML(r),n+jl(Cl[r].toUpperCase())})}function kl(e,t={unicode_only:!1,add_title_wrapper:!1}){const n=e.emoji,r=e.shortname;if(n){if(t.unicode_only)return n;if(Wc.settings.get("use_system_emojis"))return t.add_title_wrapper&&r?Ya(xl(),r,n):n;{const t=Wc.settings.get("emoji_image_path");return Ya(Sl(),r,n,t,e.cp)}}return t.unicode_only?r:Ya(wl(),r,r,tl.emojis.by_sn[r].url)}function Nl(e){if(!tl.emojis.initialized)throw new Error("getShortnameReferences called before emojis are initialized. To avoid this problem, first await the converse.emojis.initilaized_promise.");return[...e.matchAll(tl.emojis.shortnames_regex)].filter(e=>e[0].length>0).map(e=>{const t=tl.emojis.by_sn[e[0]].cp;return{cp:t,begin:e.index,end:e.index+e[0].length,shortname:e[0],emoji:t?jl(t):null}})}function Il(e){const t=[];return function(e,t){const n=/\uFE0F/g,r=String.fromCharCode(8205);String(e).replace(yl,(e,i,o)=>{const s=function(e){const t=[];let n=0,r=0;for(;r<e.length;){const i=e.charCodeAt(r++);n?(t.push((65536+(n-55296<<10)+(i-56320)).toString(16)),n=0):55296<=i&&i<=56319?n=i:t.push(i.toString(16))}return t.join("-")}(e.indexOf(r)<0?e.replace(n,""):e);s&&t(s,e,o)})}(e,(e,n,r)=>{var i;t.push({begin:r,cp:e,emoji:n,end:r+n.length,shortname:(null===(i=Al.getEmojisByAtrribute("cp")[e])||void 0===i?void 0:i.sn)||""})}),t}tl.plugins.add("converse-emoji",{initialize(){const{___:e}=qc;Wc.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:e("Smileys and emotions"),people:e("People"),activity:e("Activities"),travel:e("Travel"),objects:e("Objects"),nature:e("Animals and nature"),food:e("Food and drink"),symbols:e("Symbols"),flags:e("Flags"),custom:e("Stickers")}}),qc.EmojiPicker=zo.extend({defaults:{current_category:"smileys",current_skintone:"",scroll_position:0}});const t={};Object.assign(Al,{shortnamesToEmojis:(e,t={unicode_only:!1,add_title_wrapper:!1})=>function(e,t){let n=[e];return[...Nl(e),...Il(e)].sort((e,t)=>t.begin-e.begin).forEach(e=>{const r=n.shift(),i=kl(e,t);n="string"==typeof i?[r.slice(0,e.begin)+i+r.slice(e.end),...n]:[r.slice(0,e.begin),i,r.slice(e.end),...n]}),n}(e=Tl(e),t),shortnamesToUnicode:e=>Al.shortnamesToEmojis(e,{unicode_only:!0})[0],isOnlyEmojis(e){const t=e.trim().split(/\s+/);return!(0===t.length||t.length>3)&&t.filter(e=>{const t=Il(Al.shortnamesToUnicode(e));return 1===t.length&&(e===t[0].shortname||e===t[0].emoji)}).length===t.length},getEmojisByAtrribute(e){if(t[e])return t[e];if("category"===e)return tl.emojis.json;const n=tl.emojis.list.map(t=>t[e]).filter((e,t,n)=>n.indexOf(e)==t);return t[e]={},n.forEach(n=>t[e][n]=tl.emojis.list.find(t=>t[e]===n)),t[e]}}),Object.assign(Wc,{emojis:{async initialize(){if(!tl.emojis.initialized){tl.emojis.initialized=!0;const{default:e}=await n.e(137).then(n.t.bind(null,547,3));tl.emojis.json=e,tl.emojis.by_sn=Object.keys(e).reduce((t,n)=>Object.assign(t,e[n]),{}),tl.emojis.list=Object.values(tl.emojis.by_sn),tl.emojis.list.sort((e,t)=>e.sn<t.sn?-1:e.sn>t.sn?1:0),tl.emojis.shortnames=tl.emojis.list.map(e=>e.sn);const t=()=>tl.emojis.shortnames.map(e=>e.replace(/[+]/g,"\\$&")).join("|");tl.emojis.shortnames_regex=new RegExp(t(),"gi"),tl.emojis.toned=Ol(),tl.emojis.initialized_promise.resolve()}return tl.emojis.initialized_promise}}})}});var Ml=function(e,t,n){for(var r=-1,i=e.length,o=t.length,s={};++r<i;){var a=r<o?t[r]:void 0;n(s,e[r],a)}return s};var Rl=function(e,t){return Ml(e||[],t||[],we)},Dl=Math.min;var Pl=function(e,t,n){for(var r=n?As:Es,i=e[0].length,o=e.length,s=o,a=Array(o),c=1/0,l=[];s--;){var u=e[s];s&&t&&(u=zr(u,Le(t))),c=Dl(u.length,c),a[s]=!n&&(t||i>=120&&u.length>=120)?new Vi(s&&u):void 0}u=e[0];var d=-1,h=a[0];e:for(;++d<i&&l.length<c;){var f=u[d],p=t?t(f):f;if(f=n||0!==f?f:0,!(h?Xi(h,p):r(l,p,n))){for(s=o;--s;){var g=a[s];if(!(g?Xi(g,p):r(e[s],p,n)))continue e}h&&h.push(p),l.push(f)}}return l};var Ll=function(e){return js(e)?e:[]},Fl=Ar((function(e){var t=zr(e,Ll);return t.length&&t[0]===e[0]?Pl(t):[]}));
/**
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
* @description This is the MUC utilities module.
*/
const{Strophe:zl,sizzle:Bl}=tl.env;var ql={computeAffiliationsDelta(e,t,n,r){const i=n.map(e=>e.jid),o=r.map(e=>e.jid);let s=Os(i,o).map(e=>n[Bs(i,e)]);return e||(s=s.concat(n.filter(e=>{const t=Bs(o,e.jid);return t>=0&&e.affiliation!==r[t].affiliation}))),t&&(s=s.concat(Os(o,i).map(e=>({jid:e,affiliation:"none"})))),s},parseMemberListIQ:e=>Bl('query[xmlns="'.concat(zl.NS.MUC_ADMIN,'"] item'),e).map(e=>{const t={affiliation:e.getAttribute("affiliation")},n=e.getAttribute("jid");Go.isValidJID(n)?t.jid=n:t.nick=n;const r=e.getAttribute("nick");return r&&(t.nick=r),e.getAttribute("role")&&(t.role=r),t})};
/**
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
* @description This is the form utilities module.
*/Go.webForm2xForm=function(e){const t=e.getAttribute("name");if(!t)return null;let n;return n="checkbox"===e.getAttribute("type")?e.checked?1:0:"TEXTAREA"==e.tagName?e.value.split("\n").filter(e=>e.trim()):"SELECT"==e.tagName?Go.getSelectValues(e):e.value,Go.toStanza('\n <field var="'.concat(t,'">\n ').concat(n.constructor===Array?n.map(e=>"<value>".concat(e,"</value>")):"<value>".concat(n,"</value>"),"\n </field>"))};var Hl=Go;function Ul(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function $l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ul(Object(n),!0).forEach((function(t){Wl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ul(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Wl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}
/**
* @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 Gl={},Vl=(e,t)=>e.replace(RegExp("\\"+t,"ig"),"\\"+t);Gl.escapeCharacters=e=>t=>e.split("").reduce(Vl,t),Gl.escapeRegexString=Gl.escapeCharacters("[\\^$.?*+(){}"),Gl.findFirstMatchInArray=e=>t=>{for(let n=0;n<e.length;n++)if(0===t.localeCompare(e[n],void 0,{sensitivity:"base"}))return e[n];return null};const Jl=([e,t],n,r)=>{let i=e,{begin:o,end:s}=n;const{value:a}=n;return o-=r,s=s-r-1,i="".concat(i.slice(0,o)).concat(a).concat(i.slice(s+1)),[i,[...t,$l($l({},n),{},{begin:o,end:s})]]};Gl.reduceTextFromReferences=(e,t)=>t.reduce(Jl,[e,[]]);var Xl=Gl;function Ql(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Yl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}
/**
* @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 Kl=["moderator","participant","visitor"],Zl=["owner","admin","member","outcast","none"];tl.MUC_TRAFFIC_STATES=["entered","exited"],tl.MUC_ROLE_CHANGES=["op","deop","voice","mute"];const eu=["301","303","333","307","321","322"],tu={moderator:1,participant:2,visitor:3,none:2},{Strophe:nu,$iq:ru,$build:iu,$msg:ou,$pres:su,sizzle:au}=tl.env;nu.addNamespace("MUC_ADMIN",nu.NS.MUC+"#admin"),nu.addNamespace("MUC_OWNER",nu.NS.MUC+"#owner"),nu.addNamespace("MUC_REGISTER","jabber:iq:register"),nu.addNamespace("MUC_ROOMCONF",nu.NS.MUC+"#roomconfig"),nu.addNamespace("MUC_USER",nu.NS.MUC+"#user"),nu.addNamespace("MUC_HATS","xmpp:prosody.im/protocol/hats:1"),tl.MUC_NICK_CHANGED_CODE="303",tl.ROOM_FEATURES=["passwordprotected","unsecured","hidden","publicroom","membersonly","open","persistent","temporary","nonanonymous","semianonymous","moderated","unmoderated","mam_enabled"],tl.ROOMSTATUS={CONNECTED:0,CONNECTING:1,NICKNAME_REQUIRED:2,PASSWORD_REQUIRED:3,DISCONNECTED:4,ENTERED:5,DESTROYED:6},tl.plugins.add("converse-muc",{dependencies:["converse-chatboxes","converse-chat","converse-disco","converse-controlbox"],overrides:{ChatBoxes:{model(e,t){const{_converse:n}=this.__super__;return e&&e.type==n.CHATROOMS_TYPE?new n.ChatRoom(e,t):this.__super__.model.apply(this,arguments)}}},initialize(){const{__:e,___:t}=qc;if(Wc.settings.extend({allow_muc:!0,allow_muc_invitations:!0,auto_join_on_invite:!1,auto_join_rooms:[],auto_register_muc_nickname:!1,hide_muc_participants:!1,locked_muc_domain:!1,muc_domain:void 0,muc_fetch_members:!0,muc_history_max_stanzas:void 0,muc_instant_rooms:!0,muc_nickname_from_jid:!1,muc_send_probes:!1,muc_show_join_leave:!0,muc_show_logs_before_join:!1}),Wc.promises.add(["roomsAutoJoined"]),Wc.settings.get("locked_muc_domain")&&"string"!=typeof Wc.settings.get("muc_domain"))throw new Error("Config Error: it makes no sense to set locked_muc_domain to true when muc_domain is not set");qc.muc={info_messages:{100:e("This groupchat is not anonymous"),102:e("This groupchat now shows unavailable members"),103:e("This groupchat does not show unavailable members"),104:e("The groupchat configuration has changed"),170:e("Groupchat logging is now enabled"),171:e("Groupchat logging is now disabled"),172:e("This groupchat is now no longer anonymous"),173:e("This groupchat is now semi-anonymous"),174:e("This groupchat is now fully-anonymous"),201:e("A new groupchat has been created")},new_nickname_messages:{210:t("Your nickname has been automatically set to %1$s"),303:t("Your nickname has been changed to %1$s")},disconnect_messages:{301:e("You have been banned from this groupchat"),333:e("You have exited this groupchat due to a technical problem"),307:e("You have been kicked from this groupchat"),321:e("You have been removed from this groupchat because of an affiliation change"),322:e("You have been removed from this groupchat because the groupchat has changed to members-only and you're not a member"),332:e("You have been removed from this groupchat because the service hosting it is being shut down")}},qc.router.route("converse/room?jid=:jid",(async function(e){if(!Hl.isValidMUCJID(e))return Pn.warn('invalid jid "'.concat(e,'" provided in url fragment'));await Wc.waitUntil("roomsAutoJoined"),Wc.settings.get("allow_bookmarks")&&await Wc.waitUntil("bookmarksInitialized"),Wc.rooms.open(e)})),qc.getDefaultMUCNickname=function(){if(!qc.xmppstatus)throw new Error("Can't call _converse.getDefaultMUCNickname before the statusInitialized has been fired.");const e=qc.xmppstatus.getNickname();return e||(Wc.settings.get("muc_nickname_from_jid")?nu.unescapeNode(nu.getNodeFromJid(qc.bare_jid)):void 0)},qc.ChatRoomMessage=qc.Message.extend({initialize(){this.checkValidity()&&(this.get("file")&&this.on("change:put",this.uploadFile,this),this.setTimerForEphemeralMessage()||this.setOccupant(),Wc.trigger("chatRoomMessageInitialized",this))},mayBeModerated(){return["all","moderator"].includes(Wc.settings.get("allow_message_retraction"))&&this.collection.chatbox.canModerateMessages()},checkValidity(){const e=qc.Message.prototype.checkValidity.call(this);return!e&&this.collection.chatbox.debouncedRejoin(),e},onOccupantRemoved(){var e;this.stopListening(this.occupant),delete this.occupant;const t=null==this||null===(e=this.collection)||void 0===e?void 0:e.chatbox;if(!t)return Pn.error("Could not get collection.chatbox for message: ".concat(JSON.stringify(this.toJSON())));this.listenTo(t.occupants,"add",this.onOccupantAdded)},onOccupantAdded(e){if(e.get("nick")===nu.getResourceFromJid(this.get("from"))){var t;this.occupant=e,this.trigger("occupantAdded"),this.listenTo(this.occupant,"destroy",this.onOccupantRemoved);const n=null==this||null===(t=this.collection)||void 0===t?void 0:t.chatbox;if(!n)return Pn.error("Could not get collection.chatbox for message: ".concat(JSON.stringify(this.toJSON())));this.stopListening(n.occupants,"add",this.onOccupantAdded)}},setOccupant(){var e;if("groupchat"!==this.get("type"))return;const t=null==this||null===(e=this.collection)||void 0===e?void 0:e.chatbox;if(!t)return Pn.error("Could not get collection.chatbox for message: ".concat(JSON.stringify(this.toJSON())));const n=nu.getResourceFromJid(this.get("from"));if(this.occupant=t.occupants.findWhere({nick:n}),!this.occupant&&Wc.settings.get("muc_send_probes")){this.occupant=t.occupants.create({nick:n,type:"unavailable"});const e="".concat(t.get("jid"),"/").concat(n);Wc.user.presence.send("probe",e)}this.occupant?this.listenTo(this.occupant,"destroy",this.onOccupantRemoved):this.listenTo(t.occupants,"add",this.onOccupantAdded)}});const n=zo.extend({defaults:()=>({connection_status:tl.ROOMSTATUS.DISCONNECTED})});if(qc.ChatRoomMessages=ta.extend({model:qc.ChatRoomMessage,comparator:"time"}),qc.ChatRoom=qc.ChatBox.extend({messagesCollection:qc.ChatRoomMessages,defaults(){return{num_unread_general:0,bookmarked:!1,chat_state:void 0,hidden:qc.isUniView()&&!Wc.settings.get("singleton"),hidden_occupants:!!Wc.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:qc.CHATROOMS_TYPE}},async initialize(){this.initialized=Hl.getResolveablePromise(),this.debouncedRejoin=Ic(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 Wc.trigger("chatRoomInitialized",this,{Synchronous:!0}),this.initialized.resolve()},async restoreFromCache(){return this.session.get("connection_status")===tl.ROOMSTATUS.ENTERED&&await this.isJoined()?(await new Promise(e=>this.features.fetch({success:e,error:e})),await this.fetchOccupants().catch(e=>Pn.error(e)),await this.fetchMessages().catch(e=>Pn.error(e)),!0):(await this.clearCache(),!1)},async join(e,t){if(this.session.get("connection_status")===tl.ROOMSTATUS.ENTERED)return this;if(await this.refreshDiscoInfo(),!(e=await this.getAndPersistNickname(e)))return Hl.safeSave(this.session,{connection_status:tl.ROOMSTATUS.NICKNAME_REQUIRED}),Wc.settings.get("muc_show_logs_before_join")&&await this.fetchMessages(),this;const n=su({from:qc.connection.jid,to:this.getRoomJIDAndNick()}).c("x",{xmlns:nu.NS.MUC}).c("history",{maxstanzas:this.features.get("mam_enabled")?0:Wc.settings.get("muc_history_max_stanzas")}).up();return(t=t||this.get("password"))&&n.cnode(nu.xmlElement("password",[],t)),this.session.save("connection_status",tl.ROOMSTATUS.CONNECTING),Wc.send(n),this},async clearCache(){this.session.save("connection_status",tl.ROOMSTATUS.DISCONNECTED),this.occupants.length?this.occupants.filter(e=>!e.isMember()).forEach(e=>e.destroy()):this.occupants.clearStore(),Wc.settings.get("clear_messages_on_reconnection")&&await this.clearMessages()},onOccupantAdded(e){Wc.settings.get("muc_show_join_leave")&&this.session.get("connection_status")===tl.ROOMSTATUS.ENTERED&&"online"===e.get("show")&&this.updateNotifications(e.get("nick"),"entered")},onOccupantRemoved(e){Wc.settings.get("muc_show_join_leave")&&this.session.get("connection_status")===tl.ROOMSTATUS.ENTERED&&"online"===e.get("show")&&this.updateNotifications(e.get("nick"),"exited")},onOccupantShowChanged(e){!e.get("states").includes("303")&&Wc.settings.get("muc_show_join_leave")&&("offline"===e.get("show")?this.updateNotifications(e.get("nick"),"exited"):"online"===e.get("show")&&this.updateNotifications(e.get("nick"),"entered"))},rejoin(){return this.clearCache(),this.join()},async onConnectionStatusChanged(){this.session.get("connection_status")===tl.ROOMSTATUS.ENTERED&&(await this.occupants.fetchMembers(),await this.fetchMessages(),Wc.trigger("enteredNewRoom",this),Wc.settings.get("auto_register_muc_nickname")&&await Wc.disco.supports(nu.NS.MUC_REGISTER,this.get("jid"))&&this.registerNickname())},async onReconnection(){this.registerHandlers(),await this.rejoin(),this.announceReconnection()},restoreSession(){const e="muc.session-".concat(qc.bare_jid,"-").concat(this.get("jid"));return this.session=new n({id:e}),this.session.browserStorage=qc.createStore(e,"session"),new Promise(e=>this.session.fetch({success:e,error:e}))},initDiscoModels(){let e="converse.muc-features-".concat(qc.bare_jid,"-").concat(this.get("jid"));this.features=new zo(Object.assign({id:e},Rl(tl.ROOM_FEATURES,tl.ROOM_FEATURES.map(()=>!1)))),this.features.browserStorage=qc.createStore(e,"session"),e="converse.muc-config-{_converse.bare_jid}-".concat(this.get("jid")),this.config=new zo,this.config.browserStorage=qc.createStore(e,"session")},initOccupants(){this.occupants=new qc.ChatRoomOccupants;const e="converse.occupants-".concat(qc.bare_jid).concat(this.get("jid"));this.occupants.browserStorage=qc.createStore(e,"session"),this.occupants.chatroom=this},fetchOccupants(){return this.occupants.fetched=new Promise(e=>{this.occupants.fetch({add:!0,silent:!0,success:e,error:e})}),this.occupants.fetched},handleAffiliationChangedMessage(e){const t=au('x[xmlns="'.concat(nu.NS.MUC_USER,'"] item'),e).pop();if(t){const n=e.getAttribute("from"),r=e.getAttribute("type"),i=t.getAttribute("affiliation"),o=t.getAttribute("jid"),s={from:n,type:r,affiliation:i,nick:nu.getNodeFromJid(o),states:[],show:"unavailable"==r?"offline":"online",role:t.getAttribute("role"),jid:nu.getBareJidFromJid(o),resource:nu.getResourceFromJid(o)},a=this.occupants.findOccupant({jid:s.jid});a?a.save(s):this.occupants.create(s)}},async handleErrorMessageStanza(t){const n=await hs.parseMUCMessage(t,this,qc);if(!await this.shouldShowErrorMessage(n))return;const r=this.getMessageReferencedByError(n);if(r){const t={error:n.error,error_condition:n.error_condition,error_text:n.error_text,error_type:n.error_type,editable:!1};n.msgid===r.get("retraction_id")?(t.retraction_id=void 0,n.error||("forbidden"===n.error_condition?t.error=e("You're not allowed to retract your message."):"not-acceptable"===n.error_condition?t.error=e("Your retraction was not delivered because you're not present in the groupchat."):t.error=e("Sorry, an error occurred while trying to retract your message."))):n.error||("forbidden"===n.error_condition?t.error=e("Your message was not delivered because you weren't allowed to send it."):"not-acceptable"===n.error_condition?t.error=e("Your message was not delivered because you're not present in the groupchat."):t.error=e("Sorry, an error occurred while trying to send your message.")),r.save(t)}else this.createMessage(n)},async handleMessageStanza(e){if(hs.isArchived(e))return Pn.warn('Received a MAM message with type "groupchat"');this.createInfoMessages(e),this.fetchFeaturesIfConfigurationChanged(e);const t=await hs.parseMUCMessage(e,this,qc),n={stanza:e,attrs:t,chatbox:this};return Wc.trigger("message",n),t&&this.queueMessage(t)},registerHandlers(){const e=this.get("jid");this.removeHandlers(),this.presence_handler=qc.connection.addHandler(e=>this.onPresence(e)||!0,null,"presence",null,null,e,{ignoreNamespaceFragment:!0,matchBareFromJid:!0}),this.message_handler=qc.connection.addHandler(e=>!!this.handleMessageStanza(e)||!0,null,"message","groupchat",null,e,{matchBareFromJid:!0}),this.affiliation_message_handler=qc.connection.addHandler(e=>this.handleAffiliationChangedMessage(e)||!0,nu.NS.MUC_USER,"message",null,null,e)},removeHandlers(){return this.message_handler&&(qc.connection&&qc.connection.deleteHandler(this.message_handler),delete this.message_handler),this.presence_handler&&(qc.connection&&qc.connection.deleteHandler(this.presence_handler),delete this.presence_handler),this.affiliation_message_handler&&(qc.connection&&qc.connection.deleteHandler(this.affiliation_message_handler),delete this.affiliation_message_handler),this},invitesAllowed(){return Wc.settings.get("allow_muc_invitations")&&(this.features.get("open")||"owner"===this.getOwnAffiliation())},getDisplayName(){const e=this.get("name");return e||("hidden"===Wc.settings.get("locked_muc_domain")?nu.getNodeFromJid(this.get("jid")):this.get("jid"))},sendTimedMessage(e){"function"==typeof e.tree&&(e=e.tree());let t=e.getAttribute("id");t||(t=this.getUniqueId("sendIQ"),e.setAttribute("id",t));const n=Hl.getResolveablePromise(),r=qc.connection.addTimedHandler(qc.STANZA_TIMEOUT,()=>(qc.connection.deleteHandler(i),n.reject(new qc.TimeoutError("Timeout Error: No response from server")),!1)),i=qc.connection.addHandler(e=>{r&&qc.connection.deleteTimedHandler(r),"groupchat"===e.getAttribute("type")?n.resolve(e):n.reject(e)},null,"message",["error","groupchat"],t);return Wc.send(e),n},async retractOwnMessage(t){const n=t.get("origin_id");if(!n)throw new Error("Can't retract message without a XEP-0359 Origin ID");const r=t.get("editable"),i=ou({id:Hl.getUniqueId(),to:this.get("jid"),type:"groupchat"}).c("store",{xmlns:nu.NS.HINTS}).up().c("apply-to",{id:n,xmlns:nu.NS.FASTEN}).c("retract",{xmlns:nu.NS.RETRACT});t.set({retracted:(new Date).toISOString(),retracted_id:n,retraction_id:i.nodeTree.getAttribute("id"),editable:!1});try{await this.sendTimedMessage(i)}catch(n){throw t.save({editable:r,error_type:"timeout",error:e("A timeout happened while while trying to retract your message."),retracted:void 0,retracted_id:void 0}),n}},async retractOtherMessage(e,t){const n=e.get("editable");e.save({moderated:"retracted",moderated_by:qc.bare_jid,moderated_id:e.get("msgid"),moderation_reason:t,editable:!1});const r=await this.sendRetractionIQ(e,t);return(null===r||Hl.isErrorStanza(r))&&e.save({editable:n,moderated:void 0,moderated_by:void 0,moderated_id:void 0,moderation_reason:void 0}),r},sendRetractionIQ(e,t){const n=ru({to:this.get("jid"),type:"set"}).c("apply-to",{id:e.get("stanza_id ".concat(this.get("jid"))),xmlns:nu.NS.FASTEN}).c("moderate",{xmlns:nu.NS.MODERATE}).c("retract",{xmlns:nu.NS.RETRACT}).up().c("reason").t(t||"");return Wc.sendIQ(n,null,!1)},sendDestroyIQ(e,t){const n=iu("destroy");t&&n.attrs({jid:t});const r=ru({to:this.get("jid"),type:"set"}).c("query",{xmlns:nu.NS.MUC_OWNER}).cnode(n.node);return e&&e.length>0&&r.c("reason",e),Wc.sendIQ(r)},async leave(e){if(this.features.destroy(),this.occupants.clearStore(),qc.disco_entities){const e=qc.disco_entities.get(this.get("jid"));e&&await new Promise((t,n)=>e.destroy({success:t,error:n}))}Wc.connection.connected()&&Wc.user.presence.send("unavailable",this.getRoomJIDAndNick(),e),Hl.safeSave(this.session,{connection_status:tl.ROOMSTATUS.DISCONNECTED}),this.removeHandlers()},async close(){return await new Promise(e=>this.session.destroy({success:e,error:(t,n)=>{Pn.error(n),e()}})),await new Promise(e=>this.features.destroy({success:e,error:(t,n)=>{Pn.error(n),e()}})),qc.ChatBox.prototype.close.call(this)},canModerateMessages(){const e=this.getOwnOccupant();return e&&e.isModerator()&&Wc.disco.supports(nu.NS.MODERATE,this.get("jid"))},getAllKnownNicknames(){return[...new Set([...this.occupants.map(e=>e.get("nick")),...this.messages.map(e=>e.get("nick"))])].filter(e=>e)},getAllKnownNicknamesRegex(){const e=this.getAllKnownNicknames().join("|"),t=Xl.escapeRegexString(e);return RegExp("(?:\\p{P}|\\p{Z}|^)@(".concat(t,")(?![\\w@-])"),"uig")},getOccupantByJID(e){return this.occupants.findOccupant({jid:e})},getOccupantByNickname(e){return this.occupants.findOccupant({nick:e})},parseTextForReferences(e){if(!e||!/([!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65\u{10100}-\u{10102}\u{1039F}\u{103D0}\u{1056F}\u{10857}\u{1091F}\u{1093F}\u{10A50}-\u{10A58}\u{10A7F}\u{10AF0}-\u{10AF6}\u{10B39}-\u{10B3F}\u{10B99}-\u{10B9C}\u{10EAD}\u{10F55}-\u{10F59}\u{11047}-\u{1104D}\u{110BB}\u{110BC}\u{110BE}-\u{110C1}\u{11140}-\u{11143}\u{11174}\u{11175}\u{111C5}-\u{111C8}\u{111CD}\u{111DB}\u{111DD}-\u{111DF}\u{11238}-\u{1123D}\u{112A9}\u{1144B}-\u{1144F}\u{1145A}\u{1145B}\u{1145D}\u{114C6}\u{115C1}-\u{115D7}\u{11641}-\u{11643}\u{11660}-\u{1166C}\u{1173C}-\u{1173E}\u{1183B}\u{11944}-\u{11946}\u{119E2}\u{11A3F}-\u{11A46}\u{11A9A}-\u{11A9C}\u{11A9E}-\u{11AA2}\u{11C41}-\u{11C45}\u{11C70}\u{11C71}\u{11EF7}\u{11EF8}\u{11FFF}\u{12470}-\u{12474}\u{16A6E}\u{16A6F}\u{16AF5}\u{16B37}-\u{16B3B}\u{16B44}\u{16E97}-\u{16E9A}\u{16FE2}\u{1BC9F}\u{1DA87}-\u{1DA8B}\u{1E95E}\u{1E95F}]|[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]|^)(@[\x2D0-9A-Z_a-z\u017F\u212A]+(?:\.[0-9A-Z_a-z\u017F\u212A]+)*)/giu.test(e))return[e,[]];const t=Xl.findFirstMatchInArray(this.getAllKnownNicknames()),n=e=>{const t=this.get("jid"),n=this.getOccupant(e)||this.getOccupant(t),r=n&&n.get("jid")||"".concat(t,"/").concat(e);return encodeURI("xmpp:".concat(r))},r=this.getAllKnownNicknamesRegex(),i=[...e.matchAll(r)].filter(e=>!e[0].startsWith("/")).map(e=>{let r=e[0].indexOf("@");"@"===e[0][r+1]&&(r+=1);const i=e.index+r,o=i+e[0].length-r,s=t(e[1]);return{begin:i,end:o,value:s,type:"mention",uri:n(s)}}),[o,s]=Xl.reduceTextFromReferences(e,i);return[o,s]},getOutgoingMessageAttributes(e,t){const n=this.get("composing_spoiler"),[r,i]=this.parseTextForReferences(e),o=Hl.getUniqueId(),s=r?Hl.httpToGeoUri(Hl.shortnamesToUnicode(r),qc):void 0;return{body:s,is_spoiler:n,origin_id:o,references:i,id:o,msgid:o,from:"".concat(this.get("jid"),"/").concat(this.get("nick")),fullname:this.get("nick"),is_only_emojis:!!r&&Hl.isOnlyEmojis(r),message:s,nick:this.get("nick"),sender:"me",spoiler_hint:n?t:void 0,type:"groupchat"}},getRoomJIDAndNick(){const e=this.get("nick");return nu.getBareJidFromJid(this.get("jid"))+(null!==e?"/".concat(e):"")},sendChatState(){if(!Wc.settings.get("send_chat_state_notifications")||!this.get("chat_state")||this.session.get("connection_status")!==tl.ROOMSTATUS.ENTERED||this.features.get("moderated")&&"visitor"===this.getOwnRole())return;const e=Wc.settings.get("send_chat_state_notifications");if(Array.isArray(e)&&!e.includes(this.get("chat_state")))return;const t=this.get("chat_state");t!==qc.GONE&&Wc.send(ou({to:this.get("jid"),type:"groupchat"}).c(t,{xmlns:nu.NS.CHATSTATES}).up().c("no-store",{xmlns:nu.NS.HINTS}).up().c("no-permanent-store",{xmlns:nu.NS.HINTS}))},directInvite(e,t){this.features.get("membersonly")&&this.updateMemberLists([{jid:e,affiliation:"member",reason:t}]);const n={xmlns:"jabber:x:conference",jid:this.get("jid")};null!==t&&(n.reason=t),this.get("password")&&(n.password=this.get("password"));const r=ou({from:qc.connection.jid,to:e,id:Hl.getUniqueId()}).c("x",n);Wc.send(r),Wc.trigger("roomInviteSent",{room:this,recipient:e,reason:t})},refreshDiscoInfo(){return Wc.disco.refresh(this.get("jid")).then(()=>this.getDiscoInfo()).catch(e=>Pn.error(e))},getDiscoInfo(){return Wc.disco.getIdentity("conference","text",this.get("jid")).then(e=>this.save({name:null==e?void 0:e.get("name")})).then(()=>this.getDiscoInfoFields()).then(()=>this.getDiscoInfoFeatures()).catch(e=>Pn.error(e))},async getDiscoInfoFields(){const e=(await Wc.disco.getFields(this.get("jid"))).reduce((e,t)=>{const n=t.get("var");return n&&n.startsWith("muc#roominfo_")&&(e[n.replace("muc#roominfo_","")]=t.get("value")),e},{});this.config.save(e)},async getDiscoInfoFeatures(){const e=await Wc.disco.getFeatures(this.get("jid")),t=Object.assign(Rl(tl.ROOM_FEATURES,tl.ROOM_FEATURES.map(()=>!1)),{fetched:(new Date).toISOString()});e.each(e=>{const n=e.get("var");n.startsWith("muc_")?t[n.replace("muc_","")]=!0:n===nu.NS.MAM&&(t.mam_enabled=!0)}),this.features.save(t)},setAffiliation(e,t){return t=t.filter(t=>void 0===t.affiliation||t.affiliation===e),Promise.all(t.map(t=>this.sendAffiliationIQ(e,t)))},addFieldValue(e){const t=e.getAttribute("type");if("fixed"===t)return e;const n=e.getAttribute("var").replace("muc#roomconfig_",""),r=this.get("roomconfig");if(n in r){let i;switch(t){case"boolean":i=[r[n]?1:0];break;case"list-multi":i=r[n];break;default:i=[r[n]]}e.innerHTML=i.map(e=>iu("value").t(e)).join("")}return e},async autoConfigureChatRoom(){const e=await this.fetchRoomConfiguration(),t=au("field",e).map(e=>this.addFieldValue(e));if(t.length)return this.sendConfiguration(t)},fetchRoomConfiguration(){return Wc.sendIQ(ru({to:this.get("jid"),type:"get"}).c("query",{xmlns:nu.NS.MUC_OWNER}))},sendConfiguration(e=[]){const t=ru({to:this.get("jid"),type:"set"}).c("query",{xmlns:nu.NS.MUC_OWNER}).c("x",{xmlns:nu.NS.XFORM,type:"submit"});return e.forEach(e=>t.cnode(e).up()),Wc.sendIQ(t)},getOwnRole(){var e,t;return null===(e=this.getOwnOccupant())||void 0===e||null===(t=e.attributes)||void 0===t?void 0:t.role},getOwnAffiliation(){var e,t;return null===(e=this.getOwnOccupant())||void 0===e||null===(t=e.attributes)||void 0===t?void 0:t.affiliation},getOwnOccupant(){return this.occupants.findWhere({jid:qc.bare_jid})},sendAffiliationIQ(e,t){const n=ru({to:this.get("jid"),type:"set"}).c("query",{xmlns:nu.NS.MUC_ADMIN}).c("item",{affiliation:t.affiliation||e,nick:t.nick,jid:t.jid});return void 0!==t.reason&&n.c("reason",t.reason),Wc.sendIQ(n)},setAffiliations(e){const t=[...new Set(e.map(e=>e.affiliation))];return Promise.all(t.map(t=>this.setAffiliation(t,e)))},setRole(e,t,n,r,i){const o=iu("item",{nick:e.get("nick"),role:t}),s=ru({to:this.get("jid"),type:"set"}).c("query",{xmlns:nu.NS.MUC_ADMIN}).cnode(o.node);return null!==n&&s.c("reason",n),Wc.sendIQ(s).then(r).catch(i)},getOccupant(e){return Hl.isValidJID(e)?this.getOccupantByJID(e):this.getOccupantByNickname(e)},getOccupantsWithRole(e){return this.getOccupantsSortedBy("nick").filter(t=>t.get("role")===e).map(e=>({jid:e.get("jid"),nick:e.get("nick"),role:e.get("role")}))},getOccupantsWithAffiliation(e){return this.getOccupantsSortedBy("nick").filter(t=>t.get("affiliation")===e).map(e=>({jid:e.get("jid"),nick:e.get("nick"),affiliation:e.get("affiliation")}))},getOccupantsSortedBy(e){return Array.from(this.occupants.models).sort((t,n)=>t.get(e)<n.get(e)?-1:t.get(e)>n.get(e)?1:0)},async getAffiliationList(e){const t=ru({to:this.get("jid"),type:"get"}).c("query",{xmlns:nu.NS.MUC_ADMIN}).c("item",{affiliation:e}),n=await Wc.sendIQ(t,null,!1);if(null===n){const t="Error: timeout while fetching ".concat(e," list for MUC ").concat(this.get("jid")),r=new Error(t);return Pn.warn(t),Pn.warn(n),r}if(Hl.isErrorStanza(n)){const t="Error: not allowed to fetch ".concat(e," list for MUC ").concat(this.get("jid")),r=new Error(t);return Pn.warn(t),Pn.warn(n),r}return ql.parseMemberListIQ(n).filter(e=>e).sort((e,t)=>e.nick<t.nick?-1:e.nick>t.nick?1:0)},async updateMemberLists(e){const t=(await Promise.all(["member","admin","owner"].map(e=>this.getAffiliationList(e)))).reduce((e,t)=>Hl.isErrorObject(t)?e:[...t,...e],[]);await this.setAffiliations(ql.computeAffiliationsDelta(!0,!1,e,t)),await this.occupants.fetchMembers()},async getAndPersistNickname(e){return(e=e||this.get("nick")||await this.getReservedNick()||qc.getDefaultMUCNickname())&&this.save({nick:e},{silent:!0}),e},async getReservedNick(){const e=ru({to:this.get("jid"),from:qc.connection.jid,type:"get"}).c("query",{xmlns:nu.NS.DISCO_INFO,node:"x-roomuser-item"}),t=await Wc.sendIQ(e,null,!1);if(Hl.isErrorObject(t))throw t;const n=t.querySelector('query[node="x-roomuser-item"] identity');return n?n.getAttribute("name"):null},async registerNickname(){const t=this.get("nick"),n=this.get("jid");let r,i;try{r=await Wc.sendIQ(ru({to:n,from:qc.connection.jid,type:"get"}).c("query",{xmlns:nu.NS.MUC_REGISTER}))}catch(t){return au('not-allowed[xmlns="'.concat(nu.NS.STANZAS,'"]'),t).length?i=e("You're not allowed to register yourself in this groupchat."):au('registration-required[xmlns="'.concat(nu.NS.STANZAS,'"]'),t).length&&(i=e("You're not allowed to register in this groupchat because it's members-only.")),Pn.error(t),i}const o=au("field required",r).map(e=>e.parentElement);if(o.length>1&&"muc#register_roomnick"!==o[0].getAttribute("var"))return Pn.error("Can't register the user register in the groupchat ".concat(n," due to the required fields"));try{await Wc.sendIQ(ru({to:n,from:qc.connection.jid,type:"set"}).c("query",{xmlns:nu.NS.MUC_REGISTER}).c("x",{xmlns:nu.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(t))}catch(t){return au('service-unavailable[xmlns="'.concat(nu.NS.STANZAS,'"]'),t).length?i=e("Can't register your nickname in this groupchat, it doesn't support registration."):au('bad-request[xmlns="'.concat(nu.NS.STANZAS,'"]'),t).length&&(i=e("Can't register your nickname in this groupchat, invalid data form supplied.")),Pn.error(i),Pn.error(t),i}},updateOccupantsOnPresence(e){var t,n;const r=hs.parseMUCPresence(e);if("error"===r.type||!r.jid&&!r.nick)return!0;const i=this.occupants.findOccupant(r);if("unavailable"===r.type&&i&&!r.states.includes(tl.MUC_NICK_CHANGED_CODE)&&!["admin","owner","member"].includes(r.affiliation))return i.set(r),void i.destroy();const o=r.jid||"",s=Object.assign(r,{jid:nu.getBareJidFromJid(o)||(null==i||null===(t=i.attributes)||void 0===t?void 0:t.jid),resource:nu.getResourceFromJid(o)||(null==i||null===(n=i.attributes)||void 0===n?void 0:n.resource)});i?i.save(s):this.occupants.create(s)},fetchFeaturesIfConfigurationChanged(e){const t=["104","170","171","172","173","174"];au("status",e).filter(e=>t.includes(e.getAttribute("status"))).length&&this.refreshDiscoInfo()},isSameUser(e,t){const n=nu.getBareJidFromJid(e),r=nu.getBareJidFromJid(t),i=nu.getResourceFromJid(e),o=nu.getResourceFromJid(t);if(Hl.isSameBareJID(e,t))return n!==this.get("jid")||i===o;return(n===this.get("jid")?this.occupants.findOccupant({nick:i}):this.occupants.findOccupant({jid:n}))===(r===this.get("jid")?this.occupants.findOccupant({nick:o}):this.occupants.findOccupant({jid:r}))},async isSubjectHidden(){return(await Wc.user.settings.get("mucs_with_hidden_subject",[])).includes(this.get("jid"))},async toggleSubjectHiddenState(){const e=this.get("jid"),t=await Wc.user.settings.get("mucs_with_hidden_subject",[]);t.includes(this.get("jid"))?Wc.user.settings.set("mucs_with_hidden_subject",t.filter(t=>t!==e)):Wc.user.settings.set("mucs_with_hidden_subject",[...t,e])},async handleSubjectChange(t){if("string"==typeof t.subject&&!t.thread&&!t.message){const n=t.subject,r=t.nick;if(Hl.safeSave(this,{subject:{author:r,text:t.subject||""}}),!t.is_delayed&&r){const i=e(n?"Topic set by %1$s":"Topic cleared by %1$s",r),o=this.messages.last();(null==o?void 0:o.get("nick"))===t.nick&&"info"===(null==o?void 0:o.get("type"))&&(null==o?void 0:o.get("message"))===i||this.createMessage({message:i,nick:t.nick,type:"info"}),await this.isSubjectHidden()&&this.toggleSubjectHiddenState()}return!0}return!1},setSubject(e=""){Wc.send(ou({to:this.get("jid"),from:qc.connection.jid,type:"groupchat"}).c("subject",{xmlns:"jabber:client"}).t(e).tree())},ignorableCSN(e){return e.chat_state&&!e.body&&(e.is_delayed||this.isOwnMessage(e))},isOwnMessage(e){let t;return t=Mn(e)?e.getAttribute("from"):e instanceof qc.Message?e.get("from"):e.from,nu.getResourceFromJid(t)==this.get("nick")},getUpdatedMessageAttributes(e,t){const n=qc.ChatBox.prototype.getUpdatedMessageAttributes.call(this,e,t);if(this.isOwnMessage(t)){const r=Object.keys(t).filter(e=>e.startsWith("stanza_id"));Object.assign(n,Fo(t,r)),e.get("received")||(n.received=(new Date).toISOString())}return n},async isJoined(){const e=this.get("jid"),t=ru({to:"".concat(e,"/").concat(this.get("nick")),type:"get"}).c("ping",{xmlns:nu.NS.PING});try{await Wc.sendIQ(t)}catch(t){return null===t?Pn.warn("isJoined: Timeout error while checking whether we're joined to MUC: ".concat(e)):Pn.warn("isJoined: Apparently we're no longer connected to MUC: ".concat(e)),!1}return!0},async rejoinIfNecessary(){if(!await this.isJoined())return this.rejoin(),!0},async shouldShowErrorMessage(e){return("not-acceptable"!==e.error_condition||!await this.rejoinIfNecessary())&&qc.ChatBox.prototype.shouldShowErrorMessage.call(this,e)},findDanglingModeration(e){if(!this.messages.length)return null;if(this.messages.last().get("time")>e.time){const t=Array.from(this.messages.models),n=e["stanza_id ".concat(this.get("jid"))];return n?(t.reverse(),t.find(({attributes:e})=>"retracted"===e.moderated&&e.moderated_id===n&&e.moderated_by)):null}},async handleModeration(e){const t=["editable","moderated","moderated_by","moderated_id","moderation_reason"];if("retracted"===e.moderated){const n={};n["stanza_id ".concat(this.get("jid"))]=e.moderated_id;const r=this.messages.findWhere(n);return r?(r.save(Fo(e,t)),!0):(e.dangling_moderation=!0,await this.createMessage(e),!0)}{const n=this.findDanglingModeration(e);if(n){const r=Fo(n.attributes,t),i=Object.assign({dangling_moderation:!1},e,r);return delete i.id,n.save(i),!0}}return!1},removeNotification(e,t){const n=this.notifications.toJSON();(t=Array.isArray(t)?t:[t]).forEach(t=>{const r=Array.from(n[t]||[]);if(r.includes(e)){const n=r.indexOf(e);r.splice(n,1),this.notifications.set(t,Array.from(r))}})},updateNotifications(e,t){const n=this.notifications.toJSON(),r=n[t]||[];if(r.includes(e))return;const i=(i,o)=>(i[o]=o===t?[...r,e]:(n[o]||[]).filter(t=>t!==e),i),o=tl.CHAT_STATES.reduce(i,{}),s=tl.MUC_TRAFFIC_STATES.reduce(i,{}),a=tl.MUC_ROLE_CHANGES.reduce(i,{});this.notifications.set(Object.assign(o,s,a)),window.setTimeout(()=>this.removeNotification(e,t),1e4)},async onMessage(e){if(e=await e,Hl.isErrorObject(e))return e.stanza&&Pn.error(e.stanza),Pn.error(e.message);const t=this.getDuplicateMessage(e);if(t)return this.updateMessage(t,e);if(!(e.is_valid_receipt_request||e.is_marker||this.ignorableCSN(e))){if(await this.handleRetraction(e)||await this.handleModeration(e)||await this.handleSubjectChange(e))return this.removeNotification(e.nick,["composing","paused"]);if(this.setEditable(e,e.time),e.chat_state&&this.updateNotifications(e.nick,e.chat_state),Hl.shouldCreateGroupchatMessage(e)){const t=this.handleCorrection(e)||await this.createMessage(e);this.removeNotification(e.nick,["composing","paused"]),this.handleUnreadMessage(t)}}},handleModifyError(e){var t;const n=null===(t=e.querySelector("error text"))||void 0===t?void 0:t.textContent;if(n)if(this.session.get("connection_status")===tl.ROOMSTATUS.CONNECTING)this.setDisconnectionMessage(n);else{const e={type:"error",message:n,is_ephemeral:!0};this.createMessage(e)}},handleDisconnection(e){var t;const n=null!==e.querySelector("status[code='110']"),r=au('x[xmlns="'.concat(nu.NS.MUC_USER,'"]'),e).pop();if(!r)return;const i=au("status",r).map(e=>e.getAttribute("code")),o=Fl(i,Object.keys(qc.muc.disconnect_messages));if(!(n&&o.length>0))return;const s=r.querySelector("item"),a=s?null===(t=s.querySelector("reason"))||void 0===t?void 0:t.textContent:void 0,c=s?Rc(s.querySelector("actor"),"getAttribute","nick"):void 0,l=qc.muc.disconnect_messages[o[0]];this.setDisconnectionMessage(l,a,c)},getActionInfoMessage:(t,n,r)=>"301"===t?r?e("%1$s has been banned by %2$s",n,r):e("%1$s has been banned",n):"303"===t?e("%1$s's nickname has changed",n):"307"===t?r?e("%1$s has been kicked out by %2$s",n,r):e("%1$s has been kicked out",n):"321"===t?e("%1$s has been removed because of an affiliation change",n):"322"===t?e("%1$s has been removed for not being a member",n):void 0,createAffiliationChangeMessage(t){const n=t._previousAttributes.affiliation;if(!n)return;const r=t.get("affiliation");"admin"===n?this.createMessage({type:"info",message:e("%1$s is no longer an admin of this groupchat",t.get("nick"))}):"owner"===n?this.createMessage({type:"info",message:e("%1$s is no longer an owner of this groupchat",t.get("nick"))}):"outcast"===n&&this.createMessage({type:"info",message:e("%1$s is no longer banned from this groupchat",t.get("nick"))}),"none"===r&&"member"===n&&this.createMessage({type:"info",message:e("%1$s is no longer a member of this groupchat",t.get("nick"))}),"member"===r?this.createMessage({type:"info",message:e("%1$s is now a member of this groupchat",t.get("nick"))}):"admin"!==r&&"owner"!=r||this.createMessage({type:"info",message:e("%1$s is now an %2$s of this groupchat",t.get("nick"),r)})},createRoleChangeMessage(e,t){if("none"===t||e.changed.affiliation)return;const n=e._previousAttributes.role;"moderator"===n?this.updateNotifications(e.get("nick"),"deop"):"visitor"===n&&this.updateNotifications(e.get("nick"),"voice"),"visitor"===e.get("role")?this.updateNotifications(e.get("nick"),"mute"):"moderator"===e.get("role")&&(["owner","admin"].includes(e.get("affiliation"))||this.updateNotifications(e.get("nick"),"op"))},createInfoMessage(t,n,r){const i={type:"info"};if("110"!==t&&("100"!==t||r)){if(t in qc.muc.info_messages)i.message=qc.muc.info_messages[t];else if(!r&&eu.includes(t)){var o,s;const e=nu.getResourceFromJid(n.getAttribute("from")),r=n.querySelector('x[xmlns="'.concat(nu.NS.MUC_USER,'"] item'));i.actor=r?null===(o=r.querySelector("actor"))||void 0===o?void 0:o.getAttribute("nick"):void 0,i.reason=r?null===(s=r.querySelector("reason"))||void 0===s?void 0:s.textContent:void 0,i.message=this.getActionInfoMessage(t,e,i.actor)}else if(r&&t in qc.muc.new_nickname_messages){let o;r&&"210"===t?o=nu.getResourceFromJid(n.getAttribute("from")):r&&"303"===t&&(o=n.querySelector('x[xmlns="'.concat(nu.NS.MUC_USER,'"] item')).getAttribute("nick")),this.save("nick",o),i.message=e(qc.muc.new_nickname_messages[t],o)}if(i.message){if("201"===t&&this.messages.findWhere(i))return;if(t in qc.muc.info_messages&&this.messages.length&&this.messages.pop().get("message")===i.message)return;this.createMessage(i)}}},createInfoMessages(e){const t=au('x[xmlns="'.concat(nu.NS.MUC_USER,'"] status'),e).map(e=>e.getAttribute("code"));t.includes("333")&&t.includes("307")&&t.splice(t.indexOf("307"),1);const n=t.includes("110");t.forEach(t=>this.createInfoMessage(t,e,n))},setDisconnectionMessage(e,t,n){this.save({disconnection_message:e,disconnection_reason:t,disconnection_actor:n}),this.session.save({connection_status:tl.ROOMSTATUS.DISCONNECTED})},onNicknameClash(t){if(Wc.settings.get("muc_nickname_from_jid")){const e=t.getAttribute("from").split("/")[1];if(e===qc.getDefaultMUCNickname())this.join(e+"-2");else{const t=e.lastIndexOf("-"),n=e.substring(t+1,e.length);this.join(e.substring(0,t+1)+String(Number(n)+1))}}else this.save({nickname_validation_message:e("The nickname you chose is reserved or currently in use, please choose a different one.")}),this.session.save({connection_status:tl.ROOMSTATUS.NICKNAME_REQUIRED})},onErrorPresence(t){var n;const r=t.querySelector("error"),i=r.getAttribute("type"),o=null===(n=au('text[xmlns="'.concat(nu.NS.STANZAS,'"]'),r).pop())||void 0===n?void 0:n.textContent;if("modify"===i)this.handleModifyError(t);else if("auth"===i){if(au('not-authorized[xmlns="'.concat(nu.NS.STANZAS,'"]'),r).length&&(this.save({password_validation_message:o||e("Password incorrect")}),this.session.save({connection_status:tl.ROOMSTATUS.PASSWORD_REQUIRED})),r.querySelector("registration-required")){const t=e("You are not on the member list of this groupchat.");this.setDisconnectionMessage(t,o)}else if(r.querySelector("forbidden")){const t=e("You have been banned from this groupchat.");this.setDisconnectionMessage(t,o)}}else if("cancel"===i)if(r.querySelector("not-allowed")){const t=e("You are not allowed to create new groupchats.");this.setDisconnectionMessage(t,o)}else if(r.querySelector("not-acceptable")){const t=e("Your nickname doesn't conform to this groupchat's policies.");this.setDisconnectionMessage(t,o)}else if(au('gone[xmlns="'.concat(nu.NS.STANZAS,'"]'),r).length){var s;const e=null===(s=au('gone[xmlns="'.concat(nu.NS.STANZAS,'"]'),r).pop())||void 0===s?void 0:s.textContent.replace(/^xmpp:/,"").replace(/\?join$/,"");this.save({moved_jid:e,destroyed_reason:o}),this.session.save({connection_status:tl.ROOMSTATUS.DESTROYED})}else if(r.querySelector("conflict"))this.onNicknameClash(t);else if(r.querySelector("item-not-found")){const t=e("This groupchat does not (yet) exist.");this.setDisconnectionMessage(t,o)}else if(r.querySelector("service-unavailable")){const t=e("This groupchat has reached its maximum number of participants.");this.setDisconnectionMessage(t,o)}else if(r.querySelector("remote-server-not-found")){const t=e("Remote server not found"),n=o?e('The explanation given is: "%1$s".',o):void 0;this.setDisconnectionMessage(t,n)}},onPresence(e){if("error"===e.getAttribute("type"))return this.onErrorPresence(e);this.createInfoMessages(e),e.querySelector("status[code='110']")?(this.onOwnPresence(e),"none"!==this.getOwnRole()&&this.session.get("connection_status")===tl.ROOMSTATUS.CONNECTING&&this.session.save("connection_status",tl.ROOMSTATUS.CONNECTED)):this.updateOccupantsOnPresence(e)},onOwnPresence(e){if("unavailable"!==e.getAttribute("type")){const t=this.session.get("connection_status");t!==tl.ROOMSTATUS.ENTERED?(this.session.save("connection_status",tl.ROOMSTATUS.ENTERED,{silent:!0}),this.updateOccupantsOnPresence(e),this.session.trigger("change:connection_status",this.session,t)):this.updateOccupantsOnPresence(e)}else this.updateOccupantsOnPresence(e);if("unavailable"===e.getAttribute("type"))this.handleDisconnection(e);else{if(e.querySelector("status[code='201']"))if(this.get("auto_configure"))this.autoConfigureChatRoom().then(()=>this.refreshDiscoInfo());else{if(!Wc.settings.get("muc_instant_rooms"))return void this.trigger("configurationNeeded");this.sendConfiguration().then(()=>this.refreshDiscoInfo())}else this.features.get("fetched")||("owner"===this.getOwnAffiliation()&&this.get("auto_configure")?this.autoConfigureChatRoom().then(()=>this.refreshDiscoInfo()):this.getDiscoInfo())}this.session.save({connection_status:tl.ROOMSTATUS.ENTERED})},isUserMentioned(e){const t=this.get("nick");if(e.get("references").length){return e.get("references").filter(e=>"mention"===e.type).map(e=>e.value).includes(t)}return new RegExp("\\b".concat(t,"\\b")).test(e.get("message"))},handleUnreadMessage(e){if((null==e?void 0:e.get("body"))&&Hl.isNewMessage(e))if(this.isHidden()){const t={num_unread_general:this.get("num_unread_general")+1};0===this.get("num_unread_general")&&(t.first_unread_id=e.get("id")),this.isUserMentioned(e)&&(t.num_unread=this.get("num_unread")+1),this.save(t)}else this.sendMarkerForMessage(e)},clearUnreadMsgCounter(){(this.get("num_unread_general")>0||this.get("num_unread")>0)&&this.sendMarkerForMessage(this.messages.last()),Hl.safeSave(this,{num_unread:0,num_unread_general:0})}}),qc.ChatRoomOccupant=zo.extend({defaults:{hats:[],show:"offline",states:[]},initialize(e){this.set(Object.assign({id:Hl.getUniqueId()},e)),this.on("change:image_hash",this.onAvatarChanged,this)},onAvatarChanged(){const e=this.get("image_hash"),t=[];this.get("jid")&&t.push(qc.vcards.findWhere({jid:this.get("jid")})),t.push(qc.vcards.findWhere({jid:this.get("from")})),t.filter(e=>e).forEach(t=>{e&&t.get("image_hash")!==e&&Wc.vcard.update(t,!0)})},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"))||"moderator"===this.get("role")},isSelf(){return this.get("states").includes("110")}}),qc.ChatRoomOccupants=ta.extend({model:qc.ChatRoomOccupant,comparator(e,t){const n=e.get("role")||"none",r=t.get("role")||"none";if(tu[n]===tu[r]){const n=e.getDisplayName().toLowerCase(),r=t.getDisplayName().toLowerCase();return n<r?-1:n>r?1:0}return tu[n]<tu[r]?-1:1},getAutoFetchedAffiliationLists(){const e=Wc.settings.get("muc_fetch_members");return Array.isArray(e)?e:e?["member","admin","owner"]:[]},async fetchMembers(){const e=this.getAutoFetchedAffiliationLists();if(0===e.length)return;const t=await Promise.all(e.map(e=>this.chatroom.getAffiliationList(e))),n=t.reduce((e,t)=>Hl.isErrorObject(t)?e:[...t,...e],[]),r=e.filter(n=>!Hl.isErrorObject(t[e.indexOf(n)])),i=n.map(e=>e.jid).filter(e=>void 0!==e),o=n.map(e=>!e.jid&&e.nick||void 0).filter(e=>void 0!==e);this.filter(e=>r.includes(e.get("affiliation"))&&!o.includes(e.get("nick"))&&!i.includes(e.get("jid"))).forEach(e=>{e.get("jid")!==qc.bare_jid&&("offline"===e.get("show")?e.destroy():e.save("affiliation",null))}),n.forEach(e=>{const t=e.jid?this.findOccupant({jid:e.jid}):this.findOccupant({nick:e.nick});t?t.save(e):this.create(e)}),Wc.trigger("membersFetched")},findOccupant(e){const t=nu.getBareJidFromJid(e.jid);return t&&this.findWhere({jid:t})||this.findWhere({nick:e.nick})}}),qc.RoomsPanelModel=zo.extend({defaults:function(){return{muc_domain:Wc.settings.get("muc_domain"),nick:qc.getDefaultMUCNickname()}},setDomain(e){Wc.settings.get("locked_muc_domain")||this.save("muc_domain",nu.getDomainFromJid(e))}}),qc.onDirectMUCInvitation=async function(t){const n=au('x[xmlns="jabber:x:conference"]',t).pop(),r=nu.getBareJidFromJid(t.getAttribute("from")),i=n.getAttribute("jid"),o=n.getAttribute("reason");let s;if(Wc.settings.get("auto_join_on_invite"))s=!0;else{let t=qc.roster.get(r);t=t?t.getDisplayName():r,s=o?confirm(e('%1$s has invited you to join a groupchat: %2$s, and left the following reason: "%3$s"',t,i,o)):confirm(e("%1$s has invited you to join a groupchat: %2$s",t,i))}if(!0===s){(await async function(e,t){t.type=qc.CHATROOMS_TYPE,t.id=e;const n=await Wc.rooms.get(e,t,!0);return n.maybeShow(!0),n}(i,{password:n.getAttribute("password")})).session.get("connection_status")===tl.ROOMSTATUS.DISCONNECTED&&qc.chatboxes.get(i).rejoin()}},Wc.settings.get("allow_muc_invitations")){const e=function(){qc.connection.addHandler(e=>(qc.onDirectMUCInvitation(e),!0),"jabber:x:conference","message")};Wc.listen.on("connected",e),Wc.listen.on("reconnected",e)}function r(){return qc.chatboxes.filter(e=>e.get("type")===qc.CHATROOMS_TYPE).forEach(e=>e.session.save({connection_status:tl.ROOMSTATUS.DISCONNECTED}))}Wc.listen.on("beforeTearDown",()=>{qc.chatboxes.where({type:qc.CHATROOMS_TYPE}).forEach(e=>Hl.safeSave(e.session,{connection_status:tl.ROOMSTATUS.DISCONNECTED}))}),Wc.listen.on("windowStateChanged",(async function(e){if("visible"===e.state&&Wc.connection.connected()){(await Wc.rooms.get()).forEach(e=>e.rejoinIfNecessary())}})),Wc.listen.on("addClientFeatures",()=>{Wc.settings.get("allow_muc")&&Wc.disco.own.features.add(nu.NS.MUC),Wc.settings.get("allow_muc_invitations")&&Wc.disco.own.features.add("jabber:x:conference")}),Wc.listen.on("chatBoxesFetched",(async function(){await Promise.all(Wc.settings.get("auto_join_rooms").map(e=>"string"==typeof e?qc.chatboxes.where({jid:e}).length?Promise.resolve():Wc.rooms.open(e):N(e)?Wc.rooms.open(e.jid,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ql(Object(n),!0).forEach((function(t){Yl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ql(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},e)):(Pn.error('Invalid muc criteria specified for "auto_join_rooms"'),Promise.resolve()))),Wc.trigger("roomsAutoJoined")})),Wc.listen.on("beforeResourceBinding",()=>{qc.connection.addHandler(e=>{const t=nu.getBareJidFromJid(e.getAttribute("from"));return qc.chatboxes.get(t)||Wc.waitUntil("chatBoxesFetched").then(async()=>{const n=qc.chatboxes.get(t);n&&(await n.initialized,n.message_handler.run(e))}),!0},null,"message","groupchat")}),Wc.listen.on("disconnected",r),Wc.listen.on("statusInitialized",()=>{window.addEventListener(qc.unloadevent,()=>{!Wc.connection.isType("websocket")||Wc.settings.get("enable_smacks")&&qc.session.get("smacks_stream_id")||r()})}),tl.env.muc_utils=ql,Object.assign(Wc,{rooms:{create(e,t={}){if(!(t="string"==typeof t?{nick:t}:t||{}).nick&&Wc.settings.get("muc_nickname_from_jid")&&(t.nick=nu.getNodeFromJid(qc.bare_jid)),void 0===e)throw new TypeError("rooms.create: You need to provide at least one JID");return"string"==typeof e?Wc.rooms.get(Hl.getJIDFromURI(e),t,!0):e.map(e=>Wc.rooms.get(Hl.getJIDFromURI(e),t,!0))},async open(e,t={},n=!1){if(await Wc.waitUntil("chatBoxesFetched"),void 0===e){const e="rooms.open: You need to provide at least one JID";throw Pn.error(e),new TypeError(e)}if("string"==typeof e){const r=await Wc.rooms.get(e,t,!0);return r&&r.maybeShow(n),r}{const r=await Promise.all(e.map(e=>Wc.rooms.get(e,t,!0)));return r.forEach(e=>e.maybeShow(n)),r}},async get(e,t={},n=!1){async function r(e){e=Hl.getJIDFromURI(e);let r=await Wc.chatboxes.get(e);return!r&&n?r=await Wc.chatboxes.create(e,t,qc.ChatRoom):(r=r&&r.get("type")===qc.CHATROOMS_TYPE?r:null,r&&Object.keys(t).length&&r.save(t)),r}if(void 0===e){return(await Wc.chatboxes.get()).filter(e=>e.get("type")===qc.CHATROOMS_TYPE)}return"string"==typeof e?r(e):Promise.all(e.map(e=>r(e)))}}})}});
/**
* @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:cu,$iq:lu,sizzle:uu}=tl.env,du=tl.env.utils;function hu(e){return uu('event[xmlns="'.concat(cu.NS.PUBSUB,'#event"] items[node="').concat(cu.NS.BOOKMARKS,'"]'),e).length&&Wc.waitUntil("bookmarksInitialized").then(()=>qc.bookmarks.createBookmarksFromStanza(e)).catch(e=>Pn.fatal(e)),!0}cu.addNamespace("BOOKMARKS","storage:bookmarks"),tl.plugins.add("converse-bookmarks",{dependencies:["converse-chatboxes","converse-muc"],overrides:{ChatRoom:{getDisplayName(){const{_converse:e}=this.__super__;if(this.get("bookmarked")&&e.bookmarks){const t=e.bookmarks.findWhere({jid:this.get("jid")});if(t)return t.get("name")}return this.__super__.getDisplayName.apply(this,arguments)},getAndPersistNickname(e){const{_converse:t}=this.__super__;return e=e||t.getNicknameFromBookmark(this.get("jid")),this.__super__.getAndPersistNickname.call(this,e)}}},initialize(){const{__:e}=qc;Wc.settings.extend({allow_bookmarks:!0,allow_public_bookmarks:!1,muc_respect_autojoin:!0}),Wc.promises.add("bookmarksInitialized"),qc.getNicknameFromBookmark=function(e){if(!qc.bookmarks||!Wc.settings.get("allow_bookmarks"))return null;const t=qc.bookmarks.findWhere({jid:e});return t?t.get("nick"):void 0},qc.Bookmark=zo.extend({idAttribute:"jid",getDisplayName(){return cu.xmlunescape(this.get("name"))}}),qc.Bookmarks=ta.extend({model:qc.Bookmark,comparator:e=>e.get("name").toLowerCase(),initialize(){this.on("add",e=>this.openBookmarkedRoom(e).then(e=>this.markRoomAsBookmarked(e)).catch(e=>Pn.fatal(e))),this.on("remove",this.markRoomAsUnbookmarked,this),this.on("remove",this.sendBookmarkStanza,this);const e="converse.room-bookmarks".concat(qc.bare_jid);this.fetched_flag=e+"fetched",this.browserStorage=qc.createStore(e)},async openBookmarkedRoom(e){if(Wc.settings.get("muc_respect_autojoin")&&e.get("autojoin")){(await Wc.rooms.create(e.get("jid"),{nick:e.get("nick")})).maybeShow()}return e},fetchBookmarks(){const e=du.getResolveablePromise();return window.sessionStorage.getItem(this.fetched_flag)?this.fetch({success:()=>e.resolve(),error:()=>e.resolve()}):this.fetchBookmarksFromServer(e),e},createBookmark(e){this.create(e),this.sendBookmarkStanza().catch(t=>this.onBookmarkError(t,e))},sendBookmarkStanza(){const e=lu({type:"set",from:qc.connection.jid}).c("pubsub",{xmlns:cu.NS.PUBSUB}).c("publish",{node:cu.NS.BOOKMARKS}).c("item",{id:"current"}).c("storage",{xmlns:cu.NS.BOOKMARKS});return this.forEach(t=>{e.c("conference",{name:t.get("name"),autojoin:t.get("autojoin"),jid:t.get("jid")}).c("nick").t(t.get("nick")).up().up()}),e.up().up().up(),e.c("publish-options").c("x",{xmlns:cu.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"),Wc.sendIQ(e)},onBookmarkError(t,n){Pn.error("Error while trying to add bookmark"),Pn.error(t),Wc.alert("error",e("Error"),[e("Sorry, something went wrong while trying to save your bookmark.")]),this.findWhere({jid:n.jid}).destroy()},fetchBookmarksFromServer(e){const t=lu({from:qc.connection.jid,type:"get"}).c("pubsub",{xmlns:cu.NS.PUBSUB}).c("items",{node:cu.NS.BOOKMARKS});Wc.sendIQ(t).then(t=>this.onBookmarksReceived(e,t)).catch(t=>this.onBookmarksReceivedError(e,t))},markRoomAsBookmarked(e){const t=qc.chatboxes.get(e.get("jid"));void 0!==t&&t.save("bookmarked",!0)},markRoomAsUnbookmarked(e){const t=qc.chatboxes.get(e.get("jid"));void 0!==t&&t.save("bookmarked",!1)},createBookmarksFromStanza(e){const t=cu.NS.BOOKMARKS,n='items[node="'.concat(t,'"] item storage[xmlns="').concat(t,'"] conference');uu(n,e).forEach(e=>{var t;const n=e.getAttribute("jid"),r=this.get(n),i={jid:n,name:e.getAttribute("name")||n,autojoin:"true"===e.getAttribute("autojoin"),nick:(null===(t=e.querySelector("nick"))||void 0===t?void 0:t.textContent)||""};r?r.save(i):this.create(i)})},onBookmarksReceived(e,t){if(this.createBookmarksFromStanza(t),window.sessionStorage.setItem(this.fetched_flag,!0),void 0!==e)return e.resolve()},onBookmarksReceivedError(t,n){if(null===n)Pn.error("Error: timeout while fetching bookmarks"),Wc.alert("error",e("Timeout Error"),[e("The server did not return your bookmarks within the allowed time. You can reload the page to request them again.")]);else{if(t)return n.querySelector('error[type="cancel"] item-not-found')?(window.sessionStorage.setItem(this.fetched_flag,!0),t.resolve()):(Pn.error("Error while fetching bookmarks"),Pn.error(n),t.reject(new Error("Could not fetch bookmarks")));Pn.error("Error while fetching bookmarks"),Pn.error(n)}},getUnopenedBookmarks(){return this.filter(e=>!qc.chatboxes.get(e.get("jid")))}}),qc.BookmarksList=zo.extend({defaults:{"toggle-state":qc.OPENED}}),qc.checkBookmarksSupport=async function(){const e=await Wc.disco.getIdentity("pubsub","pep",qc.bare_jid);return qc.allow_public_bookmarks?!!e:Wc.disco.supports(cu.NS.PUBSUB+"#publish-options",qc.bare_jid)};const t=async function(){Wc.settings.get("allow_bookmarks")&&await qc.checkBookmarksSupport()&&(qc.bookmarks=new qc.Bookmarks,await qc.bookmarks.fetchBookmarks(),Wc.trigger("bookmarksInitialized"))};Wc.listen.on("addClientFeatures",()=>{Wc.settings.get("allow_bookmarks")&&Wc.disco.own.features.add(cu.NS.BOOKMARKS+"+notify")}),Wc.listen.on("clearSession",()=>{void 0!==qc.bookmarks&&(qc.bookmarks.clearStore({silent:!0}),window.sessionStorage.removeItem(qc.bookmarks.fetched_flag),delete qc.bookmarks)}),Wc.listen.on("reconnected",t),Wc.listen.on("connected",async()=>{const{connection:e}=qc;e.addHandler(hu,null,"message","headline",null,qc.bare_jid),await Promise.all([Wc.waitUntil("chatBoxesFetched")]),t()})}});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:fu}=tl.env;tl.plugins.add("converse-bosh",{enabled:()=>!qc.api.settings.get("blacklisted_plugins").includes("converse-bosh"),initialize(){Wc.settings.extend({bosh_service_url:void 0,prebind_url:null}),qc.startNewPreboundBOSHSession=function(){if(!Wc.settings.get("prebind_url"))throw new Error("startNewPreboundBOSHSession: If you use prebind then you MUST supply a prebind_url");const e=new XMLHttpRequest;e.open("GET",Wc.settings.get("prebind_url"),!0),e.setRequestHeader("Accept","application/json, text/javascript"),e.onload=async function(){if(e.status>=200&&e.status<400){const t=JSON.parse(e.responseText),n=await qc.setUserJID(t.jid);qc.connection.attach(n,t.sid,t.rid,qc.connection.onConnectStatusChanged)}else e.onerror()},e.onerror=function(){delete qc.connection,Wc.trigger("noResumeableBOSHSession",qc)},e.send()},qc.restoreBOSHSession=async function(){const e=(await async function(){const e="converse.bosh-session";if(qc.bosh_session||(qc.bosh_session=new zo({id:e}),qc.bosh_session.browserStorage=qc.createStore(e,"session"),await new Promise(e=>qc.bosh_session.fetch({success:e,error:e}))),qc.jid){if(qc.bosh_session.get("jid")!==qc.jid){const e=await qc.setUserJID(qc.jid);qc.bosh_session.clear({silent:!0}),qc.bosh_session.save({jid:e})}}else{const e=qc.bosh_session.get("jid");e&&await qc.setUserJID(e)}return qc.bosh_session}()).get("jid");if(e&&qc.connection._proto instanceof fu.Bosh)try{return qc.connection.restore(e,qc.connection.onConnectStatusChanged),!0}catch(t){return!qc.isTestEnv()&&Pn.warn("Could not restore session for jid: "+e+" Error message: "+t.message),!1}return!1},Wc.listen.on("clearSession",()=>{if(void 0===qc.bosh_session){const e="converse.bosh-session";sessionStorage.removeItem(e),sessionStorage.removeItem("".concat(e,"-").concat(e))}else qc.bosh_session.destroy(),delete qc.bosh_session}),Wc.listen.on("setUserJID",()=>{void 0!==qc.bosh_session&&qc.bosh_session.save({jid:qc.jid})}),Wc.listen.on("addClientFeatures",()=>Wc.disco.own.features.add(fu.NS.BOSH)),Object.assign(Wc,{tokens:{get:e=>void 0===qc.connection?null:"rid"===e.toLowerCase()?qc.connection.rid||qc.connection._proto.rid:"sid"===e.toLowerCase()?qc.connection.sid||qc.connection._proto.sid:void 0}})}});var pu=n(7);
/**
* @module converse-caps
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/const{Strophe:gu,$build:mu}=tl.env;function vu(e,t){return e.sort((e,n)=>e[t]>n[t]?-1:1)}function _u(e){const t=e.api.disco.own.identities.get(),n=e.api.disco.own.features.get();t.length>1&&(vu(t,"category"),vu(t,"type"),vu(t,"lang"));let r=t.reduce((e,t)=>{var n;return"".concat(e).concat(t.category,"/").concat(t.type,"/").concat(null!==(n=null==t?void 0:t.lang)&&void 0!==n?n:"","/").concat(t.name,"<")},"");return n.sort(),r=n.reduce((e,t)=>"".concat(e).concat(t,"<"),r),pu.a.b64_sha1(r)}
/**
* @module converse-carbons
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
* @description Implements support for XEP-0280 Message Carbons
*/
function bu(e){var t,n;e&&(null===(n=qc.session)||void 0===n||n.set({carbons_enabled:!1}));if(!Wc.settings.get("message_carbons")||(null===(t=qc.session)||void 0===t?void 0:t.get("carbons_enabled")))return;const r=new Oc.e.Builder("iq",{from:qc.connection.jid,id:"enablecarbons",type:"set"}).c("enable",{xmlns:Oc.e.NS.CARBONS});qc.connection.addHandler(e=>{e.querySelectorAll("error").length>0?Pn.warn("An error occurred while trying to enable message carbons."):(qc.session.set({carbons_enabled:!0}),Pn.debug("Message carbons have been enabled.")),qc.session.save()},null,"iq",null,"enablecarbons"),qc.connection.send(r)}gu.addNamespace("CAPS","http://jabber.org/protocol/caps"),tl.plugins.add("converse-caps",{overrides:{XMPPStatus:{constructPresence(){const e=this.__super__.constructPresence.apply(this,arguments);var t;return e.root().cnode((t=this.__super__._converse,mu("c",{xmlns:gu.NS.CAPS,hash:"sha-1",node:"https://conversejs.org",ver:_u(t)}).nodeTree)),e}}}}),tl.plugins.add("converse-carbons",{initialize(){Wc.settings.extend({message_carbons:!0}),Wc.listen.on("afterResourceBinding",bu)}});
/**
* @module converse-chatboxes
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const{Strophe:yu}=tl.env;yu.addNamespace("MESSAGE_CORRECT","urn:xmpp:message-correct:0"),yu.addNamespace("RECEIPTS","urn:xmpp:receipts"),yu.addNamespace("REFERENCE","urn:xmpp:reference:0"),yu.addNamespace("MARKERS","urn:xmpp:chat-markers:0"),tl.plugins.add("converse-chatboxes",{dependencies:["converse-emoji","converse-roster","converse-vcard"],initialize(){async function e(e,t,n){let r;e=yu.getBareJidFromJid(e.toLowerCase()),Object.assign(t,{jid:e,id:e});try{r=new n(t,{collection:qc.chatboxes})}catch(e){return Pn.error(e),null}return await r.initialized,r.isValid()?(qc.chatboxes.add(r),r):(r.destroy(),null)}Wc.promises.add(["chatBoxesFetched","chatBoxesInitialized","privateChatsAutoJoined"]),qc.ChatBoxes=ta.extend({comparator:"time_opened",model:(e,t)=>new qc.ChatBox(e,t),onChatBoxesFetched(e){e.filter(e=>!e.isValid()).forEach(e=>e.destroy()),Wc.trigger("chatBoxesFetched")},onConnected(e){e||(this.browserStorage=qc.createStore("converse.chatboxes-".concat(qc.bare_jid)),this.fetch({add:!0,success:e=>this.onChatBoxesFetched(e)}))}}),Wc.listen.on("addClientFeatures",()=>{Wc.disco.own.features.add(yu.NS.MESSAGE_CORRECT),Wc.disco.own.features.add(yu.NS.HTTPUPLOAD),Wc.disco.own.features.add(yu.NS.OUTOFBAND)}),Wc.listen.on("pluginsInitialized",()=>{qc.chatboxes=new qc.ChatBoxes,Wc.trigger("chatBoxesInitialized")}),Wc.listen.on("presencesInitialized",e=>qc.chatboxes.onConnected(e)),Wc.listen.on("reconnected",()=>qc.chatboxes.forEach(e=>e.onReconnection())),Object.assign(Wc,{chatboxes:{create:async(t=[],n={},r)=>(await Wc.waitUntil("chatBoxesFetched"),"string"==typeof t?e(t,n,r):Promise.all(t.map(t=>e(t,n,r)))),get:async e=>(await Wc.waitUntil("chatBoxesFetched"),void 0===e?qc.chatboxes.models:"string"==typeof e?qc.chatboxes.get(e.toLowerCase()):(e=e.map(e=>e.toLowerCase()),qc.chatboxes.models.filter(t=>e.includes(t.get("jid")))))}})}}),tl.plugins.add("converse-headlines",{dependencies:["converse-chat"],overrides:{ChatBoxes:{model(e,t){const{_converse:n}=this.__super__;return e.type==n.HEADLINES_TYPE?new n.HeadlinesBox(e,t):this.__super__.model.apply(this,arguments)}}},initialize(){function e(){qc.connection.addHandler(e=>async function(e){if(hs.isHeadline(e)||hs.isServerMessage(e)){const t=e.getAttribute("from");if(t.includes("@")&&!qc.roster.get(t)&&!Wc.settings.get("allow_non_roster_messaging"))return;if(null===e.querySelector("body"))return;const n=qc.chatboxes.create({id:t,jid:t,type:qc.HEADLINES_TYPE,from:t}),r=await hs.parseMessage(e,qc);await n.createMessage(r),Wc.trigger("message",{chatbox:n,stanza:e,attrs:r})}}(e)||!0,null,"message")}qc.HeadlinesBox=qc.ChatBox.extend({defaults(){return{bookmarked:!1,hidden:["mobile","fullscreen"].includes(Wc.settings.get("view_mode")),message_type:"headline",num_unread:0,time_opened:this.get("time_opened")||(new Date).getTime(),type:qc.HEADLINES_TYPE}},async initialize(){this.set({box_id:"box-".concat(this.get("jid"))}),this.initMessages(),await this.fetchMessages(),Wc.trigger("headlinesBoxInitialized",this)}}),Wc.listen.on("connected",e),Wc.listen.on("reconnected",e),Object.assign(Wc,{headlines:{async get(e,t={},n=!1){async function r(e){let r=await Wc.chatboxes.get(e);return!r&&n?r=await Wc.chatboxes.create(e,t,qc.HeadlinesBox):(r=r&&r.get("type")===qc.HEADLINES_TYPE?r:null,r&&Object.keys(t).length&&r.save(t)),r}if(void 0===e){return(await Wc.chatboxes.get()).filter(e=>e.get("type")===qc.HEADLINES_TYPE)}return"string"==typeof e?r(e):Promise.all(e.map(e=>r(e)))}}})}});
/**
* @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:wu,$build:Su}=tl.env;wu.addNamespace("RSM","http://jabber.org/protocol/rsm");const xu=["after","before","index","max"],Eu=e=>Number(e),Au=e=>e.toString(),Cu={after:Au,before:Au,count:Eu,first:Au,index:Eu,last:Au,max:Eu},ju=e=>void 0===e,Ou=Object.keys(Cu);class Tu{static getQueryParameters(e={}){return Fo(e,xu)}static parseXMLResult(e){const t={};for(var n=0;n<Ou.length;n++){const r=Ou[n],i=e.getElementsByTagName(r)[0];ju(i)||null===i||(t[r]=Cu[r](wu.getText(i)),"first"==r&&(t.index=Cu.index(i.getAttribute("index"))))}return t}constructor(e={}){this.query=Tu.getQueryParameters(e),this.result=e.xml?Tu.parseXMLResult(e.xml):{}}toXML(){const e=Su("set",{xmlns:wu.NS.RSM});return xu.reduce((e,t)=>ju(this.query[t])?e:e.c(t).t((this.query[t]||"").toString()).up(),e).tree()}next(e,t){const n=Object.assign({},this.query,{after:this.result.last,before:t,max:e});return new Tu(n)}previous(e,t){const n=Object.assign({},this.query,{after:t,before:this.result.first,max:e});return new Tu(n)}}function ku(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Nu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ku(Object(n),!0).forEach((function(t){Iu(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ku(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Iu(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}
/**
* @module converse-mam
* @description XEP-0313 Message Archive Management
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/qc.RSM_ATTRIBUTES=Ou,qc.RSM=Tu;const{Strophe:Mu,$iq:Ru,dayjs:Du}=tl.env,{NS:Pu}=Mu,Lu=tl.env.utils,Fu={fetchNewestMessages(){if(this.disable_mam)return;const e=this.getMostRecentMessage();if(e&&!Wc.settings.get("clear_messages_on_reconnection")){const t=e.get("stanza_id ".concat(this.get("jid")));t?this.fetchArchivedMessages({after:t},"forwards"):this.fetchArchivedMessages({start:e.get("time")},"forwards")}else this.fetchArchivedMessages({before:""})},async handleMAMResult(e,t,n,r){await Wc.emojis.initialize();const i=this.get("type")===qc.CHATROOMS_TYPE;e.messages=e.messages.map(e=>i?hs.parseMUCMessage(e,this,qc):hs.parseMessage(e,qc));const o={query:t,chatbox:this,messages:e.messages};if(await Wc.trigger("MAMResult",o,{synchronous:!0}),e.messages.forEach(e=>this.queueMessage(e)),e.error){const t=e.error.retry_event_id=Lu.getUniqueId();Wc.listen.once(t,()=>this.fetchArchivedMessages(n,r)),this.createMessageFromError(e.error)}},async fetchArchivedMessages(e={},t){if(this.disable_mam)return;const n=this.get("type")===qc.CHATROOMS_TYPE,r=n?this.get("jid"):qc.bare_jid;if(!await Wc.disco.supports(Pu.MAM,r))return;const i=Wc.settings.get("archived_messages_page_size"),o=Object.assign({groupchat:n,max:i,with:this.get("jid")},e),s=await Wc.archive.query(o);return await this.handleMAMResult(s,o,e,t),t&&s.rsm&&!s.complete?("forwards"===t?e=s.rsm.next(i,e.before).query:"backwards"===t&&(e=s.rsm.previous(i,e.after).query),this.fetchArchivedMessages(e,t)):void 0}};tl.plugins.add("converse-mam",{dependencies:["converse-disco","converse-muc"],initialize(){function e(e){Wc.settings.get("muc_show_logs_before_join")&&e.features.get("mam_enabled")&&!e.get("prejoin_mam_fetched")&&(e.fetchNewestMessages(),e.save({prejoin_mam_fetched:!0}))}Wc.settings.extend({archived_messages_page_size:"50",message_archiving:void 0,message_archiving_timeout:2e4}),Object.assign(qc.ChatBox.prototype,Fu),qc.onMAMError=function(e){(null==e?void 0:e.querySelectorAll("feature-not-implemented").length)?Pn.warn("Message Archive Management (XEP-0313) not supported by ".concat(e.getAttribute("from"))):(Pn.error("Error while trying to set archiving preferences for ".concat(e.getAttribute("from"),".")),Pn.error(e))},qc.onMAMPreferences=function(e,t){const n=pr()('prefs[xmlns="'.concat(Pu.MAM,'"]'),e).pop();if(n.getAttribute("default")!==Wc.settings.get("message_archiving")){const e=Ru({type:"set"}).c("prefs",{xmlns:Pu.MAM,default:Wc.settings.get("message_archiving")});Array.from(n.children).forEach(t=>e.cnode(t).up()),Wc.sendIQ(e).then(()=>t.save({preferences:{default:Wc.settings.get("message_archiving")}})).catch(qc.onMAMError)}else t.save({preferences:{default:Wc.settings.get("message_archiving")}})},Wc.listen.on("addClientFeatures",()=>Wc.disco.own.features.add(Pu.MAM)),Wc.listen.on("serviceDiscovered",(function(e){const t=e.get("preferences")||{};e.get("var")===Pu.MAM&&void 0!==Wc.settings.get("message_archiving")&&t.default!==Wc.settings.get("message_archiving")&&Wc.sendIQ(Ru({type:"get"}).c("prefs",{xmlns:Pu.MAM})).then(t=>qc.onMAMPreferences(t,e)).catch(qc.onMAMError)})),Wc.listen.on("chatRoomViewInitialized",t=>{Wc.settings.get("muc_show_logs_before_join")&&(e(t.model),t.model.features.on("change:mam_enabled",()=>e(t.model)))}),Wc.listen.on("enteredNewRoom",e=>e.features.get("mam_enabled")&&e.fetchNewestMessages()),Wc.listen.on("chatReconnected",e=>{e.get("type")===qc.PRIVATE_CHAT_TYPE&&e.fetchNewestMessages()}),Wc.listen.on("afterMessagesFetched",e=>{e.get("type")!==qc.PRIVATE_CHAT_TYPE||qc.connection.restored||e.fetchNewestMessages()}),Object.assign(Wc,{archive:{async query(e){if(!Wc.connection.connected())throw new Error("Can't call `api.archive.query` before having established an XMPP session");const t={type:"set"};if(e&&e.groupchat){if(!e.with)throw new Error('You need to specify a "with" value containing the chat room JID, when querying groupchat messages.');t.to=e.with}const n=t.to||qc.bare_jid;if(!await Wc.disco.supports(Pu.MAM,n))return Pn.warn("Did not fetch MAM archive for ".concat(n," because it doesn't support ").concat(Pu.MAM)),{messages:[]};const r=Lu.getUniqueId(),i=Ru(t).c("query",{xmlns:Pu.MAM,queryid:r});if(e){i.c("x",{xmlns:Pu.XFORM,type:"submit"}).c("field",{var:"FORM_TYPE",type:"hidden"}).c("value").t(Pu.MAM).up().up(),e.with&&!e.groupchat&&i.c("field",{var:"with"}).c("value").t(e.with).up().up(),["start","end"].forEach(t=>{if(e[t]){const n=Du(e[t]);if(!n.isValid())throw new TypeError("archive.query: invalid date provided for: ".concat(t));i.c("field",{var:t}).c("value").t(n.toISOString()).up().up()}}),i.up();const t=new Tu(e);Object.keys(t.query).length&&i.cnode(t.toXML())}const o=[],s=qc.connection.addHandler(t=>{const n=pr()('message > result[xmlns="'.concat(Pu.MAM,'"]'),t).pop();if(void 0===n||n.getAttribute("queryid")!==r)return!0;const i=t.getAttribute("from")||qc.bare_jid;if(e.groupchat){if(i!==e.with)return Pn.warn("Ignoring alleged groupchat MAM message from ".concat(t.getAttribute("from"))),!0}else if(i!==qc.bare_jid)return Pn.warn("Ignoring alleged MAM message from ".concat(t.getAttribute("from"))),!0;return o.push(t),!0},Pu.MAM);let a;const c=await Wc.sendIQ(i,Wc.settings.get("message_archiving_timeout"),!1);if(null===c){const{__:e}=qc,t=e("Timeout while trying to fetch archived messages.");return Pn.error(t),a=new qc.TimeoutError(t),{messages:o,error:a}}if(Lu.isErrorStanza(c)){const{__:e}=qc,t=e("An error occurred while querying for archived messages.");return Pn.error(t),Pn.error(c),a=new Error(t),{messages:o,error:a}}let l;qc.connection.deleteHandler(s);const u=c&&pr()('fin[xmlns="'.concat(Pu.MAM,'"]'),c).pop(),d="true"===(null==u?void 0:u.getAttribute("complete")),h=pr()('set[xmlns="'.concat(Pu.RSM,'"]'),u).pop();return h&&(l=new Tu(Nu(Nu({},e),{},{xml:h}))),{messages:o,rsm:l,complete:d}}}})}});
/**
* @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:zu,$iq:Bu}=tl.env,qu=tl.env.utils;zu.addNamespace("PING","urn:xmpp:ping"),tl.plugins.add("converse-ping",{initialize(){let e;function t(t){e=new Date;const n=t.getAttribute("from"),r=t.getAttribute("id"),i=Bu({type:"result",to:n,id:r});return qc.connection.sendIQ(i),!0}Wc.settings.extend({ping_interval:60}),setTimeout(()=>{if(Wc.settings.get("ping_interval")>0){const t=new Date;return e||(e=t),!((t-e)/1e3>Wc.settings.get("ping_interval"))||Wc.ping()}},1e3);const n=function(){void 0!==qc.connection.disco&&Wc.disco.own.features.add(zu.NS.PING),qc.connection.addHandler(t,zu.NS.PING,"iq","get"),qc.connection.addHandler(()=>{if(Wc.settings.get("ping_interval")>0)return e=new Date,!0})};Wc.listen.on("connected",n),Wc.listen.on("reconnected",n),Wc.listen.on("windowStateChanged",(function(e){"visible"===e.state&&Wc.connection.connected()&&Wc.ping(null,5e3)})),Object.assign(Wc,{async ping(t,n){if(e=new Date,t=t||zu.getDomainFromJid(qc.bare_jid),qc.connection){const e=Bu({type:"get",to:t,id:qu.getUniqueId("ping")}).c("ping",{xmlns:zu.NS.PING}),r=await Wc.sendIQ(e,n||1e4,!1);return null===r?(Pn.warn("Timeout while pinging ".concat(t)),t===zu.getDomainFromJid(qc.bare_jid)&&Wc.connection.reconnect()):qu.isErrorStanza(r)&&(Pn.error("Error while pinging ".concat(t)),Pn.error(r)),!0}return!1}})}});
/**
* @module converse-pubsub
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const{Strophe:Hu,$iq:Uu}=tl.env;Hu.addNamespace("PUBSUB_ERROR",Hu.NS.PUBSUB+"#errors"),tl.plugins.add("converse-pubsub",{dependencies:["converse-disco"],initialize(){Object.assign(qc.api,{pubsub:{async publish(e,t,n,r,i=!0){const o=Uu({from:qc.bare_jid,type:"set",to:e}).c("pubsub",{xmlns:Hu.NS.PUBSUB}).c("publish",{node:t}).cnode(n.tree()).up().up();r&&(e=e||qc.bare_jid,await Wc.disco.supports(Hu.NS.PUBSUB+"#publish-options",e)?(o.c("publish-options").c("x",{xmlns:Hu.NS.XFORM,type:"submit"}).c("field",{var:"FORM_TYPE",type:"hidden"}).c("value").t("".concat(Hu.NS.PUBSUB,"#publish-options")).up().up(),Object.keys(r).forEach(e=>o.c("field",{var:e}).c("value").t(r[e]).up().up())):Pn.warn("_converse.api.publish: ".concat(e," does not support #publish-options, ")+"so we didn't set them even though they were provided."));try{await Wc.sendIQ(o)}catch(e){if(!(e instanceof Element&&i&&e.querySelector('precondition-not-met[xmlns="'.concat(Hu.NS.PUBSUB_ERROR,'"]'))))throw e;{const e=o.nodeTree;e.querySelector("publish-options").outerHTML="",Pn.warn("PubSub: Republishing without publish options. ".concat(e.outerHTML)),await Wc.sendIQ(e)}}}}})}});var $u=function(e){return"number"==typeof e||Ee(e)&&"[object Number]"==k(e)};var Wu=function(e){return $u(e)&&e!=+e};
/**
* @module converse-status
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/const{Strophe:Gu,$build:Vu,$pres:Ju}=tl.env;tl.plugins.add("converse-status",{initialize(){function e(e){Wc.trigger("statusInitialized",e)}function t(t){if(t=void 0!==qc.xmppstatus&&t)e(t);else{const n="converse.xmppstatus-".concat(qc.bare_jid);qc.xmppstatus=new qc.XMPPStatus({id:n}),qc.xmppstatus.browserStorage=qc.createStore(n,"session"),qc.xmppstatus.fetch({success:()=>e(t),error:()=>e(t),silent:!0})}}Wc.settings.extend({auto_away:0,auto_xa:0,csi_waiting_time:0,default_state:"online",priority:0}),Wc.promises.add(["statusInitialized"]),qc.XMPPStatus=zo.extend({defaults:()=>({status:Wc.settings.get("default_state")}),initialize(){this.on("change",e=>{N(e.changed)&&("status"in e.changed||"status_message"in e.changed)&&Wc.user.presence.send(this.get("status"),null,this.get("status_message"))})},getNickname:()=>qc.nickname,getFullname:()=>"",constructPresence(e,t=null,n){let r;e="string"==typeof e?e:this.get("status")||Wc.settings.get("default_state"),n="string"==typeof n?n:this.get("status_message");const i={to:t};"unavailable"===e||"probe"===e||"error"===e||"unsubscribe"===e||"unsubscribed"===e||"subscribe"===e||"subscribed"===e?(i.type=e,r=Ju(i)):"offline"===e?(i.type="unavailable",r=Ju(i)):r="online"===e?Ju(i):Ju(i).c("show").t(e).up(),n&&r.c("status").t(n).up();const o=Wc.settings.get("priority");if(r.c("priority").t(Wu(Number(o))?0:o).up(),qc.idle){const e=new Date;e.setSeconds(e.getSeconds()-qc.idle_seconds),r.c("idle",{xmlns:Gu.NS.IDLE,since:e.toISOString()})}return r}}),qc.sendCSI=function(e){Wc.send(Vu(e,{xmlns:Gu.NS.CSI})),qc.inactive=e===qc.INACTIVE},qc.onUserActivity=function(){var e;qc.idle_seconds>0&&(qc.idle_seconds=0),(null===(e=qc.connection)||void 0===e?void 0:e.authenticated)&&(qc.inactive&&qc.sendCSI(qc.ACTIVE),qc.idle&&(qc.idle=!1,Wc.user.presence.send()),!0===qc.auto_changed_status&&(qc.auto_changed_status=!1,qc.xmppstatus.set("status",Wc.settings.get("default_state"))))},qc.onEverySecond=function(){var e;if(!(null===(e=qc.connection)||void 0===e?void 0:e.authenticated))return;const t=qc.xmppstatus.get("status");qc.idle_seconds++,Wc.settings.get("csi_waiting_time")>0&&qc.idle_seconds>Wc.settings.get("csi_waiting_time")&&!qc.inactive&&qc.sendCSI(qc.INACTIVE),Wc.settings.get("idle_presence_timeout")>0&&qc.idle_seconds>Wc.settings.get("idle_presence_timeout")&&!qc.idle&&(qc.idle=!0,Wc.user.presence.send()),Wc.settings.get("auto_away")>0&&qc.idle_seconds>Wc.settings.get("auto_away")&&"away"!==t&&"xa"!==t&&"dnd"!==t?(qc.auto_changed_status=!0,qc.xmppstatus.set("status","away")):Wc.settings.get("auto_xa")>0&&qc.idle_seconds>Wc.settings.get("auto_xa")&&"xa"!==t&&"dnd"!==t&&(qc.auto_changed_status=!0,qc.xmppstatus.set("status","xa"))},qc.registerIntervalHandler=function(){if(Wc.settings.get("auto_away")<1&&Wc.settings.get("auto_xa")<1&&Wc.settings.get("csi_waiting_time")<1&&Wc.settings.get("idle_presence_timeout")<1)return;qc.idle_seconds=0,qc.auto_changed_status=!1;const{unloadevent:e}=qc;window.addEventListener("click",qc.onUserActivity),window.addEventListener("focus",qc.onUserActivity),window.addEventListener("keypress",qc.onUserActivity),window.addEventListener("mousemove",qc.onUserActivity),window.addEventListener(e,qc.onUserActivity,{once:!0,passive:!0}),window.addEventListener(e,()=>{var e;return null===(e=qc.session)||void 0===e?void 0:e.save("active",!1)}),qc.everySecondTrigger=window.setInterval(qc.onEverySecond,1e3)},Wc.listen.on("presencesInitialized",e=>{e||qc.registerIntervalHandler()}),Wc.listen.on("clearSession",()=>{qc.shouldClearCache()&&qc.xmppstatus&&(qc.xmppstatus.destroy(),delete qc.xmppstatus,Wc.promises.add(["statusInitialized"]))}),Wc.listen.on("connected",()=>t(!1)),Wc.listen.on("reconnected",()=>t(!0)),Object.assign(qc.api.user,{presence:{async send(e,t,n){await Wc.waitUntil("statusInitialized"),Wc.send(qc.xmppstatus.constructPresence(e,t,n))}},status:{get:async()=>(await Wc.waitUntil("statusInitialized"),qc.xmppstatus.get("status")),async set(e,t){const n={status:e};if(!Object.keys(qc.STATUS_WEIGHTS).includes(e))throw new Error("Invalid availability value. See https://xmpp.org/rfcs/rfc3921.html#rfc.section.2.2.2.1");"string"==typeof t&&(n.status_message=t),await Wc.waitUntil("statusInitialized"),qc.xmppstatus.save(n)},message:{get:async()=>(await Wc.waitUntil("statusInitialized"),qc.xmppstatus.get("status_message")),async set(e){await Wc.waitUntil("statusInitialized"),qc.xmppstatus.save({status_message:e})}}}})}});var Xu=function(e){return function(t){return null==e?void 0:po(e,t)}};var Qu=function(e,t){for(var n,r=-1,i=e.length;++r<i;){var o=t(e[r]);void 0!==o&&(n=void 0===n?o:n+o)}return n};var Yu=function(e){return e&&e.length?Qu(e,vr):0};
/**
* @module converse-roster
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/const{Strophe:Ku,$iq:Zu,$pres:ed,dayjs:td,sizzle:nd}=tl.env,rd=tl.env.utils;tl.plugins.add("converse-roster",{dependencies:["converse-status"],initialize(){const{__:e}=qc;Wc.settings.extend({allow_contact_requests:!0,auto_subscribe:!1,synchronize_availability:!0}),Wc.promises.add(["cachedRoster","roster","rosterContactsFetched","rosterGroupsFetched","rosterInitialized"]),qc.HEADER_CURRENT_CONTACTS=e("My contacts"),qc.HEADER_PENDING_CONTACTS=e("Pending contacts"),qc.HEADER_REQUESTING_CONTACTS=e("Contact requests"),qc.HEADER_UNGROUPED=e("Ungrouped"),qc.HEADER_UNREAD=e("New messages");const t={};t[qc.HEADER_UNREAD]=0,t[qc.HEADER_REQUESTING_CONTACTS]=1,t[qc.HEADER_CURRENT_CONTACTS]=2,t[qc.HEADER_UNGROUPED]=3,t[qc.HEADER_PENDING_CONTACTS]=4,qc.registerPresenceHandler=function(){qc.unregisterPresenceHandler(),qc.presence_ref=qc.connection.addHandler(e=>(qc.roster.presenceHandler(e),!0),null,"presence",null)},qc.rejectPresenceSubscription=function(e,t){const n=ed({to:e,type:"unsubscribed"});t&&""!==t&&n.c("status").t(t),Wc.send(n)},qc.sendInitialPresence=function(){qc.send_initial_presence&&Wc.user.presence.send()},qc.populateRoster=async function(e=!1){e&&(qc.send_initial_presence=!0);try{await qc.rostergroups.fetchRosterGroups(),Wc.trigger("rosterGroupsFetched"),await qc.roster.fetchRosterContacts(),Wc.trigger("rosterContactsFetched")}catch(e){Pn.error(e)}finally{qc.sendInitialPresence()}};const n=zo.extend({idAttribute:"name"}),r=ta.extend({model:n});function i(e){const t=qc.roster&&qc.roster.findWhere({jid:e.get("jid")});void 0!==t&&t.save({num_unread:e.get("num_unread")})}async function o(){qc.presences&&await qc.presences.clearStore()}qc.Presence=zo.extend({defaults:{show:"offline"},initialize(){this.resources=new r;const e="converse.identities-".concat(this.get("jid"));this.resources.browserStorage=qc.createStore(e,"session"),this.listenTo(this.resources,"update",this.onResourcesChanged),this.listenTo(this.resources,"change",this.onResourcesChanged)},onResourcesChanged(){var e;const t=this.getHighestPriorityResource(),n=(null==t||null===(e=t.attributes)||void 0===e?void 0:e.show)||"offline";this.get("show")!==n&&this.save({show:n})},getHighestPriorityResource(){return this.resources.sortBy(e=>"".concat(e.get("priority"),"-").concat(e.get("timestamp"))).reverse()[0]},addResource(e){const t=e.getAttribute("from"),n=Ku.getResourceFromJid(t),r=nd('delay[xmlns="'.concat(Ku.NS.DELAY,'"]'),e).pop(),i=Xu(e.querySelector("priority"))("textContent")||0,o=this.resources.get(n),s={name:n,priority:Wu(parseInt(i,10))?0:parseInt(i,10),show:Xu(e.querySelector("show"))("textContent")||"online",timestamp:r?td(r.getAttribute("stamp")).toISOString():(new Date).toISOString()};o?o.save(s):this.resources.create(s)},removeResource(e){const t=this.resources.get(e);t&&t.destroy()}}),qc.Presences=ta.extend({model:qc.Presence}),qc.RosterContact=zo.extend({defaults:{chat_state:void 0,image:qc.DEFAULT_IMAGE,image_type:qc.DEFAULT_IMAGE_TYPE,num_unread:0,status:void 0},async initialize(e){this.initialized=rd.getResolveablePromise(),this.setPresence();const{jid:t}=e,n=Ku.getBareJidFromJid(t).toLowerCase();e.jid=n,this.set(Object.assign({groups:[],id:n,jid:n,user_id:Ku.getNodeFromJid(t)},e)),this.listenTo(this.presence,"change:show",()=>Wc.trigger("contactPresenceChanged",this)),this.listenTo(this.presence,"change:show",()=>this.trigger("presenceChanged")),await Wc.trigger("rosterContactInitialized",this,{Synchronous:!0}),this.initialized.resolve()},setPresence(){const e=this.get("jid");this.presence=qc.presences.findWhere({jid:e})||qc.presences.create({jid:e})},openChat(){const e=this.attributes;Wc.chats.open(e.jid,e,!0)},getFilterCriteria(){const e=this.get("nickname"),t=this.get("jid");let n=this.getDisplayName();return n=n.includes(t)?n:n.concat(" ".concat(t)),n=n.includes(e)?n:n.concat(" ".concat(e)),n.toLowerCase()},getDisplayName(){return this.get("nickname")?this.get("nickname"):this.get("jid")},getFullname(){return this.get("jid")},subscribe(e){const t=ed({to:this.get("jid"),type:"subscribe"});e&&""!==e&&t.c("status").t(e).up();const n=qc.xmppstatus.getNickname()||qc.xmppstatus.getFullname();return n&&t.c("nick",{xmlns:Ku.NS.NICK}).t(n).up(),Wc.send(t),this.save("ask","subscribe"),this},ackSubscribe(){Wc.send(ed({type:"subscribe",to:this.get("jid")}))},ackUnsubscribe(){Wc.send(ed({type:"unsubscribe",to:this.get("jid")})),this.removeFromRoster(),this.destroy()},unauthorize(e){return qc.rejectPresenceSubscription(this.get("jid"),e),this},authorize(e){const t=ed({to:this.get("jid"),type:"subscribed"});return e&&""!==e&&t.c("status").t(e),Wc.send(t),this},removeFromRoster(){const e=Zu({type:"set"}).c("query",{xmlns:Ku.NS.ROSTER}).c("item",{jid:this.get("jid"),subscription:"remove"});return Wc.sendIQ(e)}}),qc.RosterContacts=ta.extend({model:qc.RosterContact,comparator(e,t){const n=e.presence.get("show")||"offline",r=t.presence.get("show")||"offline";if(qc.STATUS_WEIGHTS[n]===qc.STATUS_WEIGHTS[r]){const n=e.getDisplayName().toLowerCase(),r=t.getDisplayName().toLowerCase();return n<r?-1:n>r?1:0}return qc.STATUS_WEIGHTS[n]<qc.STATUS_WEIGHTS[r]?-1:1},onConnected(){this.registerRosterHandler(),this.registerRosterXHandler()},registerRosterHandler(){qc.connection.addHandler(e=>(qc.roster.onRosterPush(e),!0),Ku.NS.ROSTER,"iq","set")},registerRosterXHandler(){let e=0;qc.connection.addHandler((function(t){return window.setTimeout((function(){qc.connection.flush(),qc.roster.subscribeToSuggestedItems.bind(qc.roster)(t)}),e),e+=250*t.querySelectorAll("item").length,!0}),Ku.NS.ROSTERX,"message",null)},async fetchRosterContacts(){const e=await new Promise((e,t)=>{this.fetch({add:!0,silent:!0,success:e,error:(e,n)=>t(n)})});if(rd.isErrorObject(e)&&(Pn.error(e),qc.session.set("roster_cached",!1),this.data.save("version",void 0)),!qc.session.get("roster_cached"))return qc.send_initial_presence=!0,qc.roster.fetchFromServer();Wc.trigger("cachedRoster",e)},subscribeToSuggestedItems:e=>(Array.from(e.querySelectorAll("item")).forEach(e=>{"add"===e.getAttribute("action")&&qc.roster.addAndSubscribe(e.getAttribute("jid"),qc.xmppstatus.getNickname()||qc.xmppstatus.getFullname())}),!0),isSelf:e=>rd.isSameBareJID(e,qc.connection.jid),async addAndSubscribe(e,t,n,r,i){const o=await this.addContactToRoster(e,t,n,i);o instanceof qc.RosterContact&&o.subscribe(r)},sendContactAddIQ(e,t,n){t=t||null;const r=Zu({type:"set"}).c("query",{xmlns:Ku.NS.ROSTER}).c("item",{jid:e,name:t});return n.forEach(e=>r.c("group").t(e).up()),Wc.sendIQ(r)},async addContactToRoster(t,n,r,i){await Wc.waitUntil("rosterContactsFetched"),r=r||[];try{await this.sendContactAddIQ(t,n,r)}catch(r){return Pn.error(r),alert(e("Sorry, there was an error while trying to add %1$s as a contact.",n||t)),r}return this.create(Object.assign({ask:void 0,nickname:n,groups:r,jid:t,requesting:!1,subscription:"none"},i),{sort:!1})},async subscribeBack(e,t){const n=this.get(e);if(n instanceof qc.RosterContact)n.authorize().subscribe();else{var r;const n=(null===(r=nd('nick[xmlns="'.concat(Ku.NS.NICK,'"]'),t).pop())||void 0===r?void 0:r.textContent)||null,i=await this.addContactToRoster(e,n,[],{subscription:"from"});i instanceof qc.RosterContact&&i.authorize().subscribe()}},getNumOnlineContacts(){const e=["offline","unavailable"];return Yu(this.models.filter(t=>!e.includes(t.presence.get("show"))))},onRosterPush(e){const t=e.getAttribute("id"),n=e.getAttribute("from");if(n&&n!==qc.bare_jid)return void Pn.warn("Ignoring roster illegitimate roster push message from ".concat(e.getAttribute("from")));Wc.send(Zu({type:"result",id:t,from:qc.connection.jid}));const r=nd('query[xmlns="'.concat(Ku.NS.ROSTER,'"]'),e).pop();this.data.save("version",r.getAttribute("ver"));const i=nd("item",r);if(i.length>1)throw Pn.error(e),new Error('Roster push query may not contain more than one "item" element.');if(0===i.length)return Pn.warn(e),void Pn.warn('Received a roster push stanza without an "item" element.');this.updateContact(i.pop()),Wc.trigger("rosterPush",e)},rosterVersioningSupported(){return Wc.disco.stream.getFeature("ver","urn:xmpp:features:rosterver")&&this.data.get("version")},async fetchFromServer(){const e=Zu({type:"get",id:rd.getUniqueId("roster")}).c("query",{xmlns:Ku.NS.ROSTER});this.rosterVersioningSupported()&&e.attrs({ver:this.data.get("version")});const t=await Wc.sendIQ(e,null,!1);if("error"!==t.getAttribute("type")){const e=nd('query[xmlns="'.concat(Ku.NS.ROSTER,'"]'),t).pop();if(e){nd("item",e).forEach(e=>this.updateContact(e)),this.data.save("version",e.getAttribute("ver"))}}else if(!rd.isServiceUnavailableError(t))return Pn.error(t),void Pn.error("Error while trying to fetch roster from the server");qc.session.save("roster_cached",!0),Wc.trigger("roster",t)},updateContact(e){const t=e.getAttribute("jid"),n=this.get(t),r=e.getAttribute("subscription"),i=e.getAttribute("ask"),o=Array.from(e.getElementsByTagName("group")).map(e=>e.textContent);if(n){if("remove"===r)return n.destroy();n.save({subscription:r,ask:i,nickname:e.getAttribute("name"),requesting:null,groups:o})}else{if("none"===r&&null===i||"remove"===r)return;this.create({ask:i,nickname:e.getAttribute("name"),groups:o,jid:t,subscription:r},{sort:!1})}},createRequestingContact(e){var t;const n={jid:Ku.getBareJidFromJid(e.getAttribute("from")),subscription:"none",ask:null,requesting:!0,nickname:(null===(t=nd('nick[xmlns="'.concat(Ku.NS.NICK,'"]'),e).pop())||void 0===t?void 0:t.textContent)||null};Wc.trigger("contactRequest",this.create(n))},handleIncomingSubscription(t){const n=t.getAttribute("from"),r=Ku.getBareJidFromJid(n),i=this.get(r);Wc.settings.get("allow_contact_requests")||qc.rejectPresenceSubscription(n,e("This client does not allow presence subscriptions")),Wc.settings.get("auto_subscribe")?i&&"to"===i.get("subscription")?i.authorize():this.subscribeBack(r,t):i?("none"!==i.get("subscription")||"subscribe"===i.get("ask"))&&i.authorize():this.createRequestingContact(t)},handleOwnPresence(e){const t=e.getAttribute("from"),n=Ku.getResourceFromJid(t),r=e.getAttribute("type");if(qc.connection.jid!==t&&"unavailable"!==r&&(!0===Wc.settings.get("synchronize_availability")||Wc.settings.get("synchronize_availability")===n)){const t=Xu(e.querySelector("show"))("textContent")||"online";qc.xmppstatus.save({status:t},{silent:!0});const n=Xu(e.querySelector("status"))("textContent");n&&qc.xmppstatus.save({status_message:n})}qc.jid===t&&"unavailable"===r&&Wc.user.presence.send()},presenceHandler(e){const t=e.getAttribute("type");if("error"===t)return!0;const n=e.getAttribute("from"),r=Ku.getBareJidFromJid(n);if(this.isSelf(r))return this.handleOwnPresence(e);if(nd('query[xmlns="'.concat(Ku.NS.MUC,'"]'),e).length)return;const i=Xu(e.querySelector("status"))("textContent"),o=this.get(r);if(o&&i!==o.get("status")&&o.save({status:i}),"subscribed"===t&&o)o.ackSubscribe();else if("unsubscribed"===t&&o)o.ackUnsubscribe();else{if("unsubscribe"===t)return;if("subscribe"===t)this.handleIncomingSubscription(e);else if("unavailable"===t&&o){const e=Ku.getResourceFromJid(n);o.presence.removeResource(e)}else o&&o.presence.addResource(e)}}}),qc.RosterGroup=zo.extend({initialize(t){this.set(Object.assign({description:e("Click to hide these contacts"),state:qc.OPENED},t)),this.contacts=new qc.RosterContacts}}),qc.RosterGroups=ta.extend({model:qc.RosterGroup,comparator(e,n){e=e.get("name"),n=n.get("name");const r=t,i=Object.keys(t),o=i.includes(e),s=i.includes(n);if(!o&&!s)return e.toLowerCase()<n.toLowerCase()?-1:e.toLowerCase()>n.toLowerCase()?1:0;if(o&&s)return r[e]<r[n]?-1:r[e]>r[n]?1:0;if(!o&&s){const e=qc.HEADER_CURRENT_CONTACTS;return r[e]<r[n]?-1:r[e]>r[n]?1:0}if(o&&!s){const t=qc.HEADER_CURRENT_CONTACTS;return r[e]<r[t]?-1:r[e]>r[t]?1:0}},fetchRosterGroups(){return new Promise(e=>{this.fetch({success:e,silent:!0})})}}),qc.unregisterPresenceHandler=function(){void 0!==qc.presence_ref&&(qc.connection.deleteHandler(qc.presence_ref),delete qc.presence_ref)},Wc.listen.on("chatBoxesInitialized",()=>{qc.chatboxes.on("change:num_unread",i),qc.chatboxes.on("add",e=>{e.get("type")===qc.PRIVATE_CHAT_TYPE&&e.setRosterContact(e.get("jid"))})}),Wc.listen.on("beforeTearDown",()=>qc.unregisterPresenceHandler()),Wc.waitUntil("rosterContactsFetched").then(()=>{qc.roster.on("add",e=>{const t=qc.chatboxes.findWhere({jid:e.get("jid")});t&&t.setRosterContact(e.get("jid"))})}),Wc.listen.on("streamResumptionFailed",()=>qc.session.set("roster_cached",!1)),Wc.listen.on("clearSession",async()=>{await o(),qc.shouldClearCache()&&(qc.rostergroups&&(await qc.rostergroups.clearStore(),delete qc.rostergroups),qc.roster&&(Rc(qc,"roster.data.destroy"),await qc.roster.clearStore(),delete qc.roster))}),Wc.listen.on("statusInitialized",async e=>{if(e)!qc.connection.hasResumed()&&await o();else{qc.presences=new qc.Presences;const e="converse.presences-".concat(qc.bare_jid);qc.presences.browserStorage=qc.createStore(e,"session"),qc.presences.fetch()}Wc.trigger("presencesInitialized",e)}),Wc.listen.on("presencesInitialized",async e=>{e?Wc.trigger("rosterReadyAfterReconnection"):await async function(){await Wc.waitUntil("VCardsInitialized"),qc.roster=new qc.RosterContacts;let e="converse.contacts-".concat(qc.bare_jid);qc.roster.browserStorage=qc.createStore(e),qc.roster.data=new zo,e="converse-roster-model-".concat(qc.bare_jid),qc.roster.data.id=e,qc.roster.data.browserStorage=qc.createStore(e),qc.roster.data.fetch(),e="converse.roster.groups".concat(qc.bare_jid),qc.rostergroups=new qc.RosterGroups,qc.rostergroups.browserStorage=qc.createStore(e),Wc.trigger("rosterInitialized")}(),qc.roster.onConnected(),qc.registerPresenceHandler(),qc.populateRoster(!qc.connection.restored)}),Object.assign(qc.api,{contacts:{async get(e){await Wc.waitUntil("rosterContactsFetched");const t=e=>qc.roster.get(Ku.getBareJidFromJid(e));if(void 0===e)e=qc.roster.pluck("jid");else if("string"==typeof e)return t(e);return e.map(t)},async add(e,t){if(await Wc.waitUntil("rosterContactsFetched"),"string"!=typeof e||!e.includes("@"))throw new TypeError("contacts.add: invalid jid");return qc.roster.addAndSubscribe(e,t)}}})}});
/**
* @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:id}=tl.env,od=tl.env.utils;function sd(){return!(Wc.connection.isType("bosh")&&!qc.isTestEnv())&&Wc.disco.stream.getFeature("sm",id.NS.SM)}function ad(e){if(!qc.session.get("smacks_enabled"))return!0;const t=parseInt(e.getAttribute("h"),10),n=qc.session.get("num_stanzas_handled_by_server"),r=t-n;if(r<0){const e="New reported stanza count lower than previous. "+"New: ".concat(t," - Previous: ").concat(n);Pn.error(e)}const i=qc.session.get("unacked_stanzas");if(r>i.length){const e="Higher reported acknowledge count than unacknowledged stanzas. "+"Reported Acknowledged Count: ".concat(r," -")+"Unacknowledged Stanza Count: ".concat(i.length," -")+"New: ".concat(t," - Previous: ").concat(n);Pn.error(e)}return qc.session.save({num_stanzas_handled_by_server:t,num_stanzas_since_last_ack:0,unacked_stanzas:i.slice(r)}),!0}function cd(){if(qc.session.get("smacks_enabled")){const e=qc.session.get("num_stanzas_handled"),t=od.toStanza('<a xmlns="'.concat(id.NS.SM,'" h="').concat(e,'"/>'));Wc.send(t)}return!0}function ld(e){if(qc.session.get("smacks_enabled")&&(od.isTagEqual(e,"iq")||od.isTagEqual(e,"presence")||od.isTagEqual(e,"message"))){const e=qc.session.get("num_stanzas_handled");qc.session.save("num_stanzas_handled",e+1)}return!0}function ud(){qc.session.save({smacks_enabled:qc.session.get("smacks_enabled")||!1,num_stanzas_handled:qc.session.get("num_stanzas_handled")||0,num_stanzas_handled_by_server:qc.session.get("num_stanzas_handled_by_server")||0,num_stanzas_since_last_ack:qc.session.get("num_stanzas_since_last_ack")||0,unacked_stanzas:qc.session.get("unacked_stanzas")||[]})}function dd(){qc.session&&qc.session.save({smacks_enabled:!1,num_stanzas_handled:0,num_stanzas_handled_by_server:0,num_stanzas_since_last_ack:0,unacked_stanzas:[]})}function hd(e){const t={smacks_enabled:!0};return["1","true"].includes(e.getAttribute("resume"))&&(t.smacks_stream_id=e.getAttribute("id")),qc.session.save(t),!0}function fd(e){return e.querySelector("item-not-found")?Pn.warn("Could not resume previous SMACKS session, session id not found. A new session will be established."):(Pn.error("Failed to enable stream management"),Pn.error(e.outerHTML)),dd(),Wc.trigger("streamResumptionFailed"),!0}function pd(e){hd(e),ad(e),function(){const e=qc.session.get("unacked_stanzas");qc.session.save("unacked_stanzas",[]),e.forEach(e=>Wc.send(e))}(),qc.connection.do_bind=!1,qc.connection.authenticated=!0,qc.connection.restored=!0,qc.connection._changeConnectStatus(id.Status.CONNECTED,null)}async function gd(){if(Wc.settings.get("enable_smacks")&&!qc.session.get("smacks_enabled")&&await sd()){const e=od.getResolveablePromise();qc.connection._addSysHandler(t=>e.resolve(hd(t)),id.NS.SM,"enabled"),qc.connection._addSysHandler(t=>e.resolve(fd(t)),id.NS.SM,"failed");const t=Wc.connection.isType("websocket")||qc.isTestEnv(),n=od.toStanza('<enable xmlns="'.concat(id.NS.SM,'" resume="').concat(t,'"/>'));Wc.send(n),qc.connection.flush(),await e}}id.addNamespace("SM","urn:xmpp:sm:3");const md=[];async function vd(){if(!Wc.settings.get("enable_smacks"))return;if(!await sd())return;const e=qc.connection;for(;md.length;)e.deleteHandler(md.pop());md.push(e.addHandler(ld)),md.push(e.addHandler(cd,id.NS.SM,"r")),md.push(e.addHandler(ad,id.NS.SM,"a")),qc.session.get("smacks_stream_id")?await async function(){const e=od.getResolveablePromise();qc.connection._addSysHandler(t=>e.resolve(pd(t)),id.NS.SM,"resumed"),qc.connection._addSysHandler(t=>e.resolve(fd(t)),id.NS.SM,"failed");const t=qc.session.get("smacks_stream_id"),n=qc.session.get("num_stanzas_handled"),r=od.toStanza('<resume xmlns="'.concat(id.NS.SM,'" h="').concat(n,'" previd="').concat(t,'"/>'));Wc.send(r),qc.connection.flush(),await e}():dd()}function _d(e){if(qc.session){if(qc.session.get("smacks_enabled")&&(od.isTagEqual(e,"iq")||od.isTagEqual(e,"presence")||od.isTagEqual(e,"message"))){const t=id.serialize(e);qc.session.save("unacked_stanzas",(qc.session.get("unacked_stanzas")||[]).concat([t]));const n=Wc.settings.get("smacks_max_unacked_stanzas");if(n>0){const e=qc.session.get("num_stanzas_since_last_ack")+1;e%n==0&&Wc.send(od.toStanza('<r xmlns="'.concat(id.NS.SM,'"/>'))),qc.session.save({num_stanzas_since_last_ack:e})}}}else Pn.warn("No _converse.session!")}tl.plugins.add("converse-smacks",{initialize(){Wc.settings.extend({enable_smacks:!0,smacks_max_unacked_stanzas:5}),Wc.listen.on("afterResourceBinding",gd),Wc.listen.on("beforeResourceBinding",vd),Wc.listen.on("send",_d),Wc.listen.on("userSessionInitialized",ud)}});
/**
* @module converse-vcard
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const{Strophe:bd,$iq:yd,dayjs:wd}=tl.env,Sd=tl.env.utils;tl.plugins.add("converse-vcard",{dependencies:["converse-status","converse-roster"],overrides:{XMPPStatus:{getNickname(){const{_converse:e}=this.__super__,t=this.__super__.getNickname.apply(this);return!t&&e.xmppstatus.vcard?e.xmppstatus.vcard.get("nickname"):t},getFullname(){const{_converse:e}=this.__super__,t=this.__super__.getFullname.apply(this);return!t&&e.xmppstatus.vcard?e.xmppstatus.vcard.get("fullname"):t}},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 e(e,t,n){const r=yd(t?{type:e,to:t}:{type:e});return n?r.cnode(n):r.c("vCard",{xmlns:bd.NS.VCARD}),r}async function t(t,n){const r=bd.getBareJidFromJid(n)===t.bare_jid?null:n;let i;try{i=await Wc.sendIQ(e("get",r))}catch(i){return{stanza:i,jid:n,vcard_error:(new Date).toISOString()}}return async function(e,t){const n=t.querySelector("vCard");let r={};var i,o,s,a,c,l,u;if(null!==n&&(r={stanza:t,fullname:null===(i=n.querySelector("FN"))||void 0===i?void 0:i.textContent,nickname:null===(o=n.querySelector("NICKNAME"))||void 0===o?void 0:o.textContent,image:null===(s=n.querySelector("PHOTO BINVAL"))||void 0===s?void 0:s.textContent,image_type:null===(a=n.querySelector("PHOTO TYPE"))||void 0===a?void 0:a.textContent,url:null===(c=n.querySelector("URL"))||void 0===c?void 0:c.textContent,role:null===(l=n.querySelector("ROLE"))||void 0===l?void 0:l.textContent,email:null===(u=n.querySelector("EMAIL USERID"))||void 0===u?void 0:u.textContent,vcard_updated:(new Date).toISOString(),vcard_error:void 0}),r.image){const e=Sd.base64ToArrayBuffer(r.image),t=await crypto.subtle.digest("SHA-1",e);r.image_hash=Sd.arrayBufferToHex(t)}return r}(0,i)}async function n(e){let t;if(e instanceof qc.Message){if("error"===e.get("type"))return;t=e.get("from")}else t=e.get("jid");await Wc.waitUntil("VCardsInitialized"),e.vcard=qc.vcards.findWhere({jid:t}),e.vcard||(e.vcard=qc.vcards.create({jid:t})),e.vcard.on("change",()=>e.trigger("vcard:change"))}async function r(e){await Wc.waitUntil("VCardsInitialized"),["error","info"].includes(e.get("type"))||(e.vcard=function(e){var t;const n=null==e||null===(t=e.collection)||void 0===t?void 0:t.chatbox,r=bd.getResourceFromJid(e.get("from"));if(n&&n.get("nick")===r)return qc.xmppstatus.vcard;{const t=e.occupant&&e.occupant.get("jid")||e.get("from");return t?qc.vcards.findWhere({jid:t})||qc.vcards.create({jid:t}):void Pn.error("Could not assign VCard for message because no JID found! msgid: ".concat(e.get("msgid")))}}(e))}Wc.promises.add("VCardsInitialized"),qc.VCard=zo.extend({defaults:{image:qc.DEFAULT_IMAGE,image_type:qc.DEFAULT_IMAGE_TYPE},set(e,t,n){let r;return"object"==typeof e?(r=e,n=t):(r={})[e]=t,"image"in r&&!r.image?(r.image=qc.DEFAULT_IMAGE,r.image_type=qc.DEFAULT_IMAGE_TYPE,zo.prototype.set.call(this,r,n)):zo.prototype.set.apply(this,arguments)},getDisplayName(){return this.get("nickname")||this.get("fullname")||this.get("jid")}}),qc.VCards=ta.extend({model:qc.VCard,initialize(){this.on("add",e=>e.get("jid")&&Wc.vcard.update(e))}}),qc.initVCardCollection=async function(){qc.vcards=new qc.VCards,qc.vcards.browserStorage=qc.createStore("".concat(qc.bare_jid,"-converse.vcards")),await new Promise(e=>{qc.vcards.fetch({success:e,error:e},{silent:!0})});const e=qc.vcards;if(qc.session){const t=qc.session.get("bare_jid");qc.xmppstatus.vcard=e.findWhere({jid:t})||e.create({jid:t})}Wc.trigger("VCardsInitialized")},Wc.listen.on("chatBoxInitialized",e=>n(e)),Wc.listen.on("chatRoomInitialized",e=>n(e)),Wc.listen.on("chatRoomMessageInitialized",e=>r(e)),Wc.listen.on("addClientFeatures",()=>Wc.disco.own.features.add(bd.NS.VCARD)),Wc.listen.on("clearSession",()=>{qc.shouldClearCache()&&(Wc.promises.add("VCardsInitialized"),qc.vcards&&(qc.vcards.clearStore(),delete qc.vcards))}),Wc.listen.on("messageInitialized",e=>n(e)),Wc.listen.on("rosterContactInitialized",e=>n(e)),Wc.listen.on("statusInitialized",qc.initVCardCollection),Object.assign(qc.api,{vcard:{async set(t,n){if(!t)throw Error("No jid provided for the VCard data");const r=document.createElement("div"),i=Sd.toStanza('\n <vCard xmlns="vcard-temp">\n <FN>'.concat(n.fn,"</FN>\n <NICKNAME>").concat(n.nickname,"</NICKNAME>\n <URL>").concat(n.url,"</URL>\n <ROLE>").concat(n.role,"</ROLE>\n <EMAIL><INTERNET/><PREF/><USERID>").concat(n.email,"</USERID></EMAIL>\n <PHOTO>\n <TYPE>").concat(n.image_type,"</TYPE>\n <BINVAL>").concat(n.image,"</BINVAL>\n </PHOTO>\n </vCard>"),r);let o;try{o=await Wc.sendIQ(e("set",t,i))}catch(e){throw e}return await Wc.vcard.update(t,!0),o},get(e,n){if("string"==typeof e)return t(qc,e);if(!n&&e.get("vcard_updated")&&wd(e.get("vcard_error")).isSame(new Date,"day"))return Promise.resolve({});{const n=e.get("jid");return n||Pn.error("No JID to get vcard for"),t(qc,n)}},async update(e,t){const n=await this.get(e,t);(e="string"==typeof e?qc.vcards.findWhere({jid:e}):e)?(delete n.stanza,e.save(n)):Pn.error("Could not find a VCard model for ".concat(e))}}})}});var xd=n(67),Ed=n.n(xd);function Ad(e,t){return"string"==typeof e&&t.includes(e)}function Cd(e,t){return"string"!=typeof e||"en"!==e&&!t(e)?
/**
* @module i18n
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
* @description This is the internationalization module
*/
function(e){var t,n;if(window.navigator.userLanguage&&(t=jd(window.navigator.userLanguage,e)),window.navigator.languages&&!t)for(n=0;n<window.navigator.languages.length&&!t;n++)t=jd(window.navigator.languages[n],e);return window.navigator.browserLanguage&&!t&&(t=jd(window.navigator.browserLanguage,e)),window.navigator.language&&!t&&(t=jd(window.navigator.language,e)),window.navigator.systemLanguage&&!t&&(t=jd(window.navigator.systemLanguage,e)),t||"en"}(t)||"en":e}function jd(e,t){if(t(e))return e;var n=e.split("-")[0];return n!==e&&t(n)?n:void 0}let Od;Object.assign(Bc,{getLocale:(e,t)=>Cd(e,e=>Ad(e,t)),translate(e){if(!Od)return Ed.a.sprintf.apply(Ed.a,arguments);const t=Od.translate(e);return arguments.length>1?t.fetch.apply(t,[].slice.call(arguments,1)):t.fetch()},async initialize(){if(qc.isTestEnv())qc.locale="en";else try{qc.locale=Bc.getLocale(Wc.settings.get("i18n"),Wc.settings.get("locales")),await async function(e){const{api:t,locale:r}=e,i=r.toLowerCase().replace("_","-");if(!Ad(r,t.settings.get("locales"))||"en"===r)return;const{default:o}=await n(494)("./".concat(r,"/LC_MESSAGES/converse.po"));await n(495)("./".concat(i)),Sn.a.locale(Cd(i,e=>Sn.a.locale(e))),Od=new Ed.a(o)}(qc)}catch(e){Pn.fatal(e.message),qc.locale="en"}},__:(...e)=>Bc.translate(...e)});const Td=Bc.__,kd={};Wc.elements={registry:kd,define:function(e,t){this.registry[e]=t},register:function(){Object.keys(kd).forEach(e=>{customElements.get(e)||customElements.define(e,kd[e])})}};
/**
* @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 Nd=tl.env.utils,Id=function(e,t){return RegExp(Pd.regExpEscape(t.trim()),"i").test(e)},Md=function(e,t){return RegExp("^"+Pd.regExpEscape(t.trim()),"i").test(e)},Rd=function(e,t){const n=e.query.toLowerCase(),r=e.label.toLowerCase().indexOf(n),i=t.label.toLowerCase().indexOf(n);return r===i?function(e,t){return e.length!==t.length?e.length-t.length:e<t?-1:1}(e,t):(-1===r?1/0:r)<(-1===i?1/0:i)?-1:1},Dd=(e,t)=>{t=t.trim();const n=document.createElement("li");n.setAttribute("aria-selected","false");const r=new RegExp("("+t+")","ig");return(t?e.split(r):[e]).forEach(e=>{if(t&&e.match(r)){const t=document.createElement("mark");t.textContent=e,n.appendChild(t)}else n.appendChild(document.createTextNode(e))}),n},Pd={getElement:(e,t)=>"string"==typeof e?(t||document).querySelector(e):e||null,bind(e,t){if(e)for(var n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const r=t[n];n.split(/\s+/).forEach(t=>e.addEventListener(t,r))}},unbind(e,t){if(e)for(var n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const r=t[n];n.split(/\s+/).forEach(t=>e.removeEventListener(t,r))}},regExpEscape:e=>e.replace(/[-\\^$*+?.()|[\]{}]/g,"\\$&"),isMention:(e,t)=>t.includes(e[0])||Nd.isMentionBoundary(e[0])&&t.includes(e[1])};class Ld extends String{constructor(e,t){super();const n=Array.isArray(e)?{label:e[0],value:e[1]}:"object"==typeof e&&"label"in e&&"value"in e?e:{label:e,value:e};this.label=n.label||n.value,this.value=n.value,this.query=t}get lenth(){return this.label.length}toString(){return""+this.label}valueOf(){return this.toString()}}class Fd{constructor(e,t={}){this.is_opened=!1,Nd.hasClass("suggestion-box",e)?this.container=e:this.container=e.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:!1,ac_triggers:[],include_triggers:[],min_chars:2,max_items:10,auto_evaluate:!0,auto_first:!1,data:e=>e,filter:Id,sort:!1!==t.sort&&Rd,item:Dd},t),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")||t.list||[]}bindEvents(){const e={blur:()=>this.close({reason:"blur"})};this.auto_evaluate&&(e.input=()=>this.evaluate()),this._events={input:e,form:{submit:()=>this.close({reason:"submit"})},ul:{mousedown:e=>this.onMouseDown(e),mouseover:e=>this.onMouseOver(e)}},Pd.bind(this.input,this._events.input),Pd.bind(this.input.form,this._events.form),Pd.bind(this.ul,this._events.ul)}set list(e){if(Array.isArray(e)||"function"==typeof e)this._list=e;else if("string"==typeof e&&e.includes(","))this._list=e.split(/\s*,\s*/);else{var t;const n=(null===(t=Pd.getElement(e))||void 0===t?void 0:t.children)||[];this._list=Array.from(n).filter(e=>!e.disabled).map(e=>{const t=e.textContent.trim(),n=e.value||t,r=e.label||t;return""!==n?{label:r,value:n}:null}).filter(e=>e)}document.activeElement===this.input&&this.evaluate()}get list(){return this._list}get selected(){return this.index>-1}get opened(){return this.is_opened}close(e){this.opened&&(this.ul.setAttribute("hidden",""),this.is_opened=!1,this.index=-1,this.trigger("suggestion-box-close",e||{}))}insertValue(e){this.match_current_word?Nd.replaceCurrentWord(this.input,e.value):this.input.value=e.value}open(){this.ul.removeAttribute("hidden"),this.is_opened=!0,this.auto_first&&-1===this.index&&this.goto(0),this.trigger("suggestion-box-open")}destroy(){Pd.unbind(this.input,this._events.input),Pd.unbind(this.input.form,this._events.form),this.input.removeAttribute("aria-autocomplete")}next(){const e=this.ul.children.length;this.goto(this.index<e-1?this.index+1:e?0:-1)}previous(){const e=this.ul.children.length,t=this.index-1;this.goto(this.selected&&-1!==t?t:e-1)}goto(e){const t=this.ul.children;this.selected&&t[this.index].setAttribute("aria-selected","false"),this.index=e,e>-1&&t.length>0&&(t[e].setAttribute("aria-selected","true"),t[e].focus(),this.status.textContent=t[e].textContent,this.ul.scrollTop=t[e].offsetTop-this.ul.clientHeight+t[e].clientHeight,this.trigger("suggestion-box-highlight",{text:this.suggestions[this.index]}))}select(e){if(e?this.index=Nd.siblingIndex(e):e=this.ul.children[this.index],e){const e=this.suggestions[this.index];this.insertValue(e),this.close({reason:"select"}),this.auto_completing=!1,this.trigger("suggestion-box-selectcomplete",{text:e})}}onMouseOver(e){const t=Nd.ancestor(e.target,"li");t&&this.goto(Array.prototype.slice.call(this.ul.children).indexOf(t))}onMouseDown(e){if(0!==e.button)return;const t=Nd.ancestor(e.target,"li");t&&(e.preventDefault(),this.select(t,e.target))}onKeyDown(e){if(this.opened){if([tl.keycodes.ENTER,tl.keycodes.TAB].includes(e.keyCode)&&this.selected)return e.preventDefault(),e.stopPropagation(),this.select(),!0;if(e.keyCode===tl.keycodes.ESCAPE)return this.close({reason:"esc"}),!0;if([tl.keycodes.UP_ARROW,tl.keycodes.DOWN_ARROW].includes(e.keyCode))return e.preventDefault(),e.stopPropagation(),this[e.keyCode===tl.keycodes.UP_ARROW?"previous":"next"](),!0}if(![tl.keycodes.SHIFT,tl.keycodes.META,tl.keycodes.META_RIGHT,tl.keycodes.ESCAPE,tl.keycodes.ALT].includes(e.keyCode))if(this.ac_triggers.includes(e.key))"Tab"===e.key&&e.preventDefault(),this.auto_completing=!0;else if("Backspace"===e.key){const t=Nd.getCurrentWord(e.target,e.target.selectionEnd-1);Pd.isMention(t,this.ac_triggers)&&(this.auto_completing=!0)}}async evaluate(e){const t=this.selected&&e&&(e.keyCode===tl.keycodes.UP_ARROW||e.keyCode===tl.keycodes.DOWN_ARROW);if(!this.auto_evaluate&&!this.auto_completing||t)return;const n="function"==typeof this._list?await this._list():this._list;if(0===n.length)return;let r=this.match_current_word?Nd.getCurrentWord(this.input):this.input.value;const i=Pd.isMention(r,this.ac_triggers);i&&(this.auto_completing=!0,this.include_triggers.includes(e.key)||(r=Nd.isMentionBoundary(r[0])?r.slice("2"):r.slice("1"))),(i||r.length)&&r.length>=this.min_chars?(this.index=-1,this.ul.innerHTML="",this.suggestions=n.map(e=>new Ld(this.data(e,r),r)).filter(e=>this.filter(e,r)),!1!==this.sort&&(this.suggestions=this.suggestions.sort(this.sort)),this.suggestions=this.suggestions.slice(0,this.max_items),this.suggestions.forEach(e=>this.ul.appendChild(this.item(e,r))),0===this.ul.children.length?this.close({reason:"nomatches"}):this.open()):(this.close({reason:"nomatches"}),i||(this.auto_completing=!1))}}function zd(){const e=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 zd=function(){return e},e}function Bd(){const e=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 Bd=function(){return e},e}function qd(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Object.assign(Fd.prototype,mi),tl.plugins.add("converse-autocomplete",{initialize(){const e=this._converse;e.FILTER_CONTAINS=Id,e.FILTER_STARTSWITH=Md,e.AutoComplete=Fd}});var Hd=e=>{const t=Td("Click to toggle the bookmarks list"),n=Td("Bookmarks");return Ya(zd(),e.hidden?"":"hidden",t,e.toggleBookmarksList,e.toggle_state===e._converse.OPENED?"fa-caret-down":"fa-caret-right",n,e.toggle_state!==e._converse.OPENED?"hidden":"",e.bookmarks.map(t=>(e=>{const t=Td("Unbookmark this groupchat"),n=Td("Click to open this groupchat");return Ya(Bd(),e.is_hidden(e.bm)?"hidden":"",e.bm.get("jid"),e.bm.get("jid"),n,e.openRoom,e.bm.getDisplayName(),e.bm.get("bookmarked")?"button-on":"",e.bm.get("jid"),e.bm.getDisplayName(),t,e.removeBookmark)})(Object.assign({bm:t},e))))};function Ud(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\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 Ud=function(){return e},e}const $d=/^\s*</,Wd=("undefined"!=typeof Element&&Element.prototype,function(e){this.cid=gi("view"),this._domEvents=[],this.preinitialize.apply(this,arguments),jr(this,Fo(e,Vd)),this._ensureElement(),this.initialize.apply(this,arguments)});Wd.extend=Xr;const Gd=/^(\S+)\s*(.*)$/,Vd=["model","collection","el","id","attributes","className","tagName","events"];Object.assign(Wd.prototype,mi,{tagName:"div",$:function(e){return this.el.querySelectorAll(e)},preinitialize:function(){},initialize:function(){},render:function(){return M(this.beforeRender)&&this.beforeRender(),M(this.toHTML)&&Xa(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(e){return this.undelegateEvents(),this._setElement(e),this.delegateEvents(),this},_setElement:function(e){if("string"==typeof e)if($d.test(e)){const t=document.createElement("div");t.innerHTML=e,this.el=t.firstChild}else this.el=document.querySelector(e);else e&&!Mn(e)&&e.length?this.el=e[0]:this.el=e},delegateEvents:function(e){if(e||(e=Jr(this,"events")),!e)return this;this.undelegateEvents();for(const t in e){let n=e[t];if(M(n)||(n=this[n]),!n)continue;const r=t.match(Gd);this.delegate(r[1],r[2],n.bind(this))}return this},delegate:function(e,t,n){const r=this.el;if(!r)return this;if("function"==typeof t&&(n=t,t=null),-1!==["focus","blur"].indexOf(e)){const r=this.el.querySelectorAll(t);for(let t=0,i=r.length;t<i;t++){const i=r[t];i.addEventListener(e,n,!1),this._domEvents.push({el:i,eventName:e,handler:n})}return n}const i=t?function(e){let i=e.target||e.srcElement;for(;i&&i!=r;i=i.parentNode)i.matches(t)&&(e.delegateTarget=i,n(e))}:n;return this.el.addEventListener(e,i,!1),this._domEvents.push({el:this.el,eventName:e,handler:i,listener:n,selector:t}),this},undelegateEvents:function(){if(this.el){for(let e=0,t=this._domEvents.length;e<t;e++){const t=this._domEvents[e];t.el.removeEventListener(t.eventName,t.handler,!1)}this._domEvents.length=0}return this},undelegate:function(e,t,n){if("function"==typeof t&&(n=t,t=null),this.el){const r=this._domEvents.slice();let i=r.length;for(;i--;){const o=r[i];!(o.eventName!==e||n&&o.listener!==n||t&&o.selector!==t)&&(o.el.removeEventListener(o.eventName,o.handler,!1),this._domEvents.splice(i,1))}}return this},_createElement:function(e){return document.createElement(e)},_ensureElement:function(){if(this.el)this.setElement(Jr(this,"el"));else{const e=jr({},Jr(this,"attributes"));this.id&&(e.id=Jr(this,"id")),this.className&&(e.class=Jr(this,"className")),this.setElement(this._createElement(Jr(this,"tagName"))),this._setAttributes(e)}},_setAttributes:function(e){for(const t in e)t in this.el?this.el[t]=e[t]:this.el.setAttribute(t,e[t])}});var Jd=Ar((function(e,t,n){var r=-1,i="function"==typeof t,o=Xe(e)?Array(e.length):[];return gs(e,(function(e){o[++r]=i?_r(t,e,n):Mc(e,t,n)})),o}));
/**
* @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:Xd}=tl.env,Qd=tl.env.utils;tl.plugins.add("converse-bookmark-views",{dependencies:["converse-chatboxes","converse-muc","converse-muc-views"],initialize(){Wc.settings.extend({hide_open_bookmarks:!0}),Object.assign(qc,{removeBookmarkViaEvent(e){e.preventDefault();const t=e.target.getAttribute("data-bookmark-name"),n=e.target.getAttribute("data-room-jid");confirm(Td('Are you sure you want to remove the bookmark "%1$s"?',t))&&Jd(qc.bookmarks.where({jid:n}),zo.prototype.destroy)},addBookmarkViaEvent(e){e.preventDefault();const t=e.target.getAttribute("data-room-jid");Wc.rooms.open(t,{bring_to_foreground:!0}),qc.chatboxviews.get(t).renderBookmarkForm()}});const e={setBookmarkState(){if(void 0!==qc.bookmarks){qc.bookmarks.where({jid:this.model.get("jid")}).length?this.model.save("bookmarked",!0):this.model.save("bookmarked",!1)}},renderBookmarkForm(){if(this.hideChatRoomContents(),!this.bookmark_form){this.bookmark_form=new qc.MUCBookmarkForm({model:this.model,chatroomview:this}),this.el.querySelector(".chatroom-body").insertAdjacentElement("beforeend",this.bookmark_form.el)}Qd.showElement(this.bookmark_form.el)},toggleBookmark(e){null==e||e.preventDefault();const t=qc.bookmarks.where({jid:this.model.get("jid")});t.length?t.forEach(e=>e.destroy()):this.renderBookmarkForm()}};Object.assign(qc.ChatRoomView.prototype,e),qc.MUCBookmarkForm=Wd.extend({className:"muc-bookmark-form chatroom-form-container",initialize(e){this.chatroomview=e.chatroomview,this.render()},toHTML(){return(e=>{const t=Td("Bookmark this groupchat"),n=Td("Would you like this groupchat to be automatically joined upon startup?"),r=Td("Cancel"),i=Td("The name for this bookmark:"),o=Td("What should your nickname for this groupchat be?"),s=Td("Save");return Ya(Ud(),e.onSubmit,t,i,e.name,o,e.nick||"",n,s,r,e.onCancel)})(Object.assign(this.model.toJSON(),{onCancel:e=>this.closeBookmarkForm(e),onSubmit:e=>this.onBookmarkFormSubmitted(e)}))},onBookmarkFormSubmitted(e){var t,n,r;e.preventDefault(),qc.bookmarks.createBookmark({jid:this.model.get("jid"),autojoin:(null===(t=e.target.querySelector('input[name="autojoin"]'))||void 0===t?void 0:t.checked)||!1,name:null===(n=e.target.querySelector("input[name=name]"))||void 0===n?void 0:n.value,nick:null===(r=e.target.querySelector("input[name=nick]"))||void 0===r?void 0:r.value}),this.closeBookmarkForm(e)},closeBookmarkForm(e){e.preventDefault(),this.chatroomview.closeForm()}}),qc.BookmarksView=Wd.extend({tagName:"span",initialize(){this.listenTo(this.model,"add",this.render),this.listenTo(this.model,"remove",this.render),this.listenTo(qc.chatboxes,"add",this.render),this.listenTo(qc.chatboxes,"remove",this.render);const e="converse.room-bookmarks".concat(qc.bare_jid,"-list-model");this.list_model=new qc.BookmarksList({id:e}),this.list_model.browserStorage=qc.createStore(e);const t=()=>{this.render(),this.insertIntoControlBox()};this.list_model.fetch({success:t,error:t})},toHTML(){return Hd({_converse:qc,bookmarks:this.model,hidden:this.model.getUnopenedBookmarks().length&&!0,is_hidden:e=>!(!Wc.settings.get("hide_open_bookmarks")||!qc.chatboxes.get(e.get("jid"))),openRoom:e=>this.openRoom(e),removeBookmark:e=>this.removeBookmark(e),toggleBookmarksList:e=>this.toggleBookmarksList(e),toggle_state:this.list_model.get("toggle-state")})},insertIntoControlBox(){const e=qc.chatboxviews.get("controlbox");if(void 0!==e&&!Qd.rootContains(qc.root,this.el)){const t=e.el.querySelector(".list-container--bookmarks");t&&t.parentNode.replaceChild(this.el,t)}},openRoom(e){e.preventDefault();const t=e.target.textContent,n=e.target.getAttribute("data-room-jid"),r={name:t||Xd.unescapeNode(Xd.getNodeFromJid(n))||n};Wc.rooms.open(n,r,!0)},removeBookmark:qc.removeBookmarkViaEvent,toggleBookmarksList(e){e&&e.preventDefault&&e.preventDefault();const t=e.target.matches(".fa")?e.target:e.target.querySelector(".fa");Qd.hasClass("fa-caret-down",t)?(Qd.slideIn(this.el.querySelector(".bookmarks")),this.list_model.save({"toggle-state":qc.CLOSED}),t.classList.remove("fa-caret-down"),t.classList.add("fa-caret-right")):(t.classList.remove("fa-caret-right"),t.classList.add("fa-caret-down"),Qd.slideOut(this.el.querySelector(".bookmarks")),this.list_model.save({"toggle-state":qc.OPENED}))}});Wc.listen.on("getHeadingButtons",(e,t)=>{if(qc.allow_bookmarks&&e.model.get("type")===qc.CHATROOMS_TYPE){const n=e.model.get("bookmarked"),r={i18n_title:Td(n?"Unbookmark this groupchat":"Bookmark this groupchat"),i18n_text:Td(n?"Unbookmark":"Bookmark"),handler:t=>e.toggleBookmark(t),a_class:"toggle-bookmark",icon_class:"fa-bookmark",name:"bookmark"},i=t.map(e=>e.name).indexOf("details"),o=qc.checkBookmarksSupport().then(e=>e?r:"");return i>-1?[...t.slice(0,i),o,...t.slice(i)]:[o,...t]}return t}),Wc.listen.on("bookmarksInitialized",(async function(){await Wc.waitUntil("roomsPanelRendered"),qc.bookmarksview=new qc.BookmarksView({model:qc.bookmarks}),Wc.trigger("bookmarkViewsInitialized")})),Wc.listen.on("chatRoomViewInitialized",e=>e.setBookmarkState())}});var Yd=n(34),Kd=n.n(Yd);function Zd(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['<div class="alert ','" role="alert"><p>',"</p></div>"]);return Zd=function(){return e},e}function eh(){const e=nh(['<button type="button" class="close" data-dismiss="modal" aria-label="','"><span aria-hidden="true">×</span></button>']);return eh=function(){return e},e}function th(){const e=nh(['<button type="button" class="btn btn-secondary" data-dismiss="modal">',"</button>"]);return th=function(){return e},e}function nh(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const rh=Ya(th(),Td("Close")),ih=Ya(eh(),Td("Close"));function oh(){const e=ah(["<p>","</p>"]);return oh=function(){return e},e}function sh(){const e=ah(['\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 sh=function(){return e},e}function ah(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function ch(){const e=dh(["<p>","</p>"]);return ch=function(){return e},e}function lh(){const e=dh(['\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">×</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 lh=function(){return e},e}function uh(){const e=dh(['\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 uh=function(){return e},e}function dh(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var hh=e=>Ya(lh(),e.level||"",e.title,e.messages.map(e=>Ya(ch(),e)),e.fields.map(e=>(e=>Ya(uh(),e.label||"",e.name,e.challenge_failed?"error":"",e.required,e.placeholder))(e)),Td("OK"),Td("Cancel"));
/**
* @module converse-modal
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/const{sizzle:fh}=tl.env,ph=tl.env.utils;let gh;const mh=Wd.extend({className:"modal",events:{"click .nav-item .nav-link":"switchTab"},initialize(){this.render(),this.el.setAttribute("tabindex","-1"),this.el.setAttribute("role","dialog"),this.el.setAttribute("aria-hidden","true");const e=this.el.querySelector(".modal-title").getAttribute("id");e&&this.el.setAttribute("aria-labelledby",e),this.insertIntoDOM();const t=Kd.a.Modal;this.modal=new t(this.el,{backdrop:!0,keyboard:!0}),this.el.addEventListener("hide.bs.modal",()=>ph.removeClass("selected",this.trigger_el),!1)},insertIntoDOM(){gh.chatboxviews.el.querySelector("#converse-modals").insertAdjacentElement("beforeEnd",this.el)},switchTab(e){e.stopPropagation(),e.preventDefault(),fh(".nav-link.active",this.el).forEach(e=>{ph.removeClass("active",this.el.querySelector(e.getAttribute("href"))),ph.removeClass("active",e)}),ph.addClass("active",e.target),ph.addClass("active",this.el.querySelector(e.target.getAttribute("href")))},alert(e,t="primary"){const n=this.el.querySelector(".modal-alert");if(null===n)return void Pn.error("Could not find a .modal-alert element in the modal to show an alert message in!");var r;Xa((r={type:"alert-".concat(t),message:e},Ya(Zd(),r.type,r.message)),n);const i=n.firstElementChild;setTimeout(()=>{ph.addClass("fade-out",i),setTimeout(()=>ph.removeElement(i),600)},5e3)},show(e){e&&(e.preventDefault(),this.trigger_el=e.target,this.trigger_el.classList.add("selected")),this.modal.show()}});tl.env.BootstrapModal=mh;const vh=mh.extend({events:{"submit .confirm":"onConfimation"},initialize(){this.confirmation=ph.getResolveablePromise(),mh.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change",this.render),this.el.addEventListener("closed.bs.modal",()=>this.confirmation.reject(),!1)},toHTML(){return hh(this.model.toJSON())},afterRender(){this.close_handler_registered||(this.el.addEventListener("closed.bs.modal",()=>{this.confirmation.isResolved||this.confirmation.reject()},!1),this.close_handler_registered=!0)},onConfimation(e){e.preventDefault();const t=new FormData(e.target),n=(this.model.get("fields")||[]).map(e=>{const n=t.get(e.name).trim();return e.value=n,e.challenge&&(e.challenge_failed=n!==e.challenge),e});if(n.filter(e=>e.challenge_failed).length)return this.model.set("fields",n),void this.model.trigger("change");this.confirmation.resolve(n),this.modal.hide()}}),_h=mh.extend({initialize(){mh.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change",this.render)},toHTML(){return e=Object.assign({__:Td},this.model.toJSON()),Ya(sh(),e.level,e.title,ih,e.messages.map(e=>Ya(oh(),e)));var e}});function bh(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\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 bh=function(){return e},e}tl.plugins.add("converse-modal",{initialize(){let e;gh=this._converse,gh.api.listen.on("disconnect",()=>{const e=document.querySelector("#converse-modals");e&&(e.innerHTML="")}),Object.assign(gh.api,{async confirm(e,t=[],n=[]){"string"==typeof t&&(t=[t]);const r=new zo({title:e,messages:t,fields:n,type:"confirm"}),i=new vh({model:r});let o;i.show();try{o=await i.confirmation}catch(e){o=!1}return i.remove(),o},async prompt(e,t=[],n=""){"string"==typeof t&&(t=[t]);const r=new zo({title:e,messages:t,fields:[{name:"reason",placeholder:n}],type:"prompt"}),i=new vh({model:r});let o;i.show();try{var s;o=null===(s=(await i.confirmation).pop())||void 0===s?void 0:s.value}catch(e){o=!1}return i.remove(),o},alert(t,n,r){let i;if("string"==typeof r&&(r=[r]),"error"===t?i="alert-danger":"info"===t?i="alert-info":"warn"===t&&(i="alert-warning"),void 0===e){const t=new zo({title:n,messages:r,level:i,type:"alert"});e=new _h({model:t})}else e.model.set({title:n,messages:r,level:i});e.show()}})}});var yh=mh.extend({toHTML(){return e={src:this.src,onload:e=>e.target.parentElement.style.height="".concat(e.target.height,"px")},Ya(bh(),Td("Image: "),e.src,e.src,ih,e.src,e.onload,rh);var e}}),wh=n(35),Sh=n.n(wh);
/**
* @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,Eh=Oa((...e)=>t=>{let n=xh.get(t);void 0===n&&(n={lastRenderedIndex:2147483647,values:[]},xh.set(t,n));const r=n.values;let i=r.length;n.values=e;for(let o=0;o<e.length&&!(o>n.lastRenderedIndex);o++){const s=e[o];if(Da(s)||"function"!=typeof s.then){t.setValue(s),n.lastRenderedIndex=o;break}o<i&&s===r[o]||(n.lastRenderedIndex=2147483647,i=0,Promise.resolve(s).then(e=>{const r=n.values.indexOf(s);r>-1&&r<n.lastRenderedIndex&&(n.lastRenderedIndex=r,t.setValue(e),t.commit())}))}});function Ah(){const e=jh(["",""]);return Ah=function(){return e},e}function Ch(){const e=jh(["",""]);return Ch=function(){return e},e}function jh(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const Oh=Oa((e,t,n)=>r=>r.setValue(function(e,t,n){const r=new Qh(e,t,n,!1);return Ya(Ch(),Eh(async function(e){return await e.addTemplates(),e.payload}(r),Ya(Ah(),r)))}(e,t,n)));function Th(){const e=Dh(['<span class="styling-directive">*</span><b>','</b><span class="styling-directive">*</span>']);return Th=function(){return e},e}function kh(){const e=Dh(['<span class="styling-directive">~</span><del>','</del><span class="styling-directive">~</span>']);return kh=function(){return e},e}function Nh(){const e=Dh(["<blockquote>","</blockquote>"]);return Nh=function(){return e},e}function Ih(){const e=Dh(['<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 Ih=function(){return e},e}function Mh(){const e=Dh(['<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 Mh=function(){return e},e}function Rh(){const e=Dh(['<span class="styling-directive">_</span><i>','</i><span class="styling-directive">_</span>']);return Rh=function(){return e},e}function Dh(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}
/**
* @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 Ph=["*","_","~","`","```",">"],Lh={"*":{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"}},Fh=["_",">","`","~"],zh={emphasis:(e,t,n)=>Ya(Rh(),Oh(e,t,n)),preformatted:e=>Ya(Mh(),e),preformatted_block:e=>Ya(Ih(),e),quote:(e,t,n)=>Ya(Nh(),Oh(e,t,n)),strike:(e,t,n)=>Ya(kh(),Oh(e,t,n)),strong:(e,t,n)=>Ya(Th(),Oh(e,t,n))};function Bh(e,t,n=!0){let r;if(!/(^```\s*\n|^```\s*$)/.test(e.slice(t))||0!==t&&"\n"!==e[t-1]&&">"!==e[t-1]){if(!Ph.includes(e.slice(t,t+1))||e[t]===e[t+1])return null;if(r=e.slice(t,t+1),!function(e,t,n,r){if(r){const r=RegExp(Fh.includes(e)?"^(\\p{L}|\\p{N})".concat(e):"^(\\p{L}|\\p{N})\\".concat(e),"u");if(n>1&&r.test(t.slice(n-1)))return!1}else{const r=RegExp(Fh.includes(e)?"^".concat(e,"(\\p{L}|\\p{N})"):"^\\".concat(e,"(\\p{L}|\\p{N})"),"u");if(n<t.length-1&&r.test(t.slice(n)))return!1}return!0}(r,e,t,n))return null}else r=e.slice(t,t+3);return r}function qh(e,t,n){const r=Lh[e].type;return t===n.length||Bh(n,t,!1)===e||"span"===r&&"\n"===n[t]}function Hh(e,t){const n=Bh(e,t),r=n?function(e,t,n){if(!e)return 0;const r=n;if(n+=e.length,Uh(e))return(n+=t.slice(n).split(/\n[^>]/).shift().length)-r;if("span"===Lh[e].type){const r=t.slice(n+1).split("\n").shift();let i=0,o=r.indexOf(e);for(;-1!==o;){if(qh(e,n+1+o,t))return o+1+2*e.length;o=r.indexOf(e,i++)}return 0}{const r=t.slice(n+1);let i,o=r.indexOf(e);for(;-1!==o;){if(qh(e,n+1+o,t))return o+1+2*e.length;o=r.indexOf(e,i++)}return 0}}(n,e,t):0;return r>0?{d:n,length:r}:{}}const Uh=e=>[">","&gt;"].includes(e);function $h(e,t,n,r){const i=zh[Lh[e].name];return Uh(e)?i(t.replace(/\n>/g,"\n").replace(/\n$/,""),n,r):i(t,n,r)}function Wh(){const e=Vh(['<span class="mention">',"</span>"]);return Wh=function(){return e},e}function Gh(){const e=Vh(['<span class="mention mention--self badge badge-info">',"</span>"]);return Gh=function(){return e},e}function Vh(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const Jh=tl.env.utils,Xh=e=>"string"==typeof e;class Qh extends String{constructor(e,t,n=0,r,i,o){super(e),this.model=t,this.offset=n,this.onImgClick=o,this.onImgLoad=i,this.references=[],this.show_images=r,this.payload=[]}addHyperlinks(e,t){const n=[];try{const t={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|xmpp:|mailto:|www\.)/gi};Sh.a.withinString(e,(e,t,r)=>(n.push({url:e,start:t,end:r}),e),t)}catch(e){return void Pn.debug(e)}n.forEach(n=>{const r=e.slice(n.start,n.end),i=Jh.filterQueryParamsFromURL(r);this.addTemplateResult(n.start+t,n.end+t,this.show_images&&Jh.isImageURL(r)&&Jh.isImageDomainAllowed(r)?Jh.convertToImageTag(i,this.onImgLoad,this.onImgClick):Jh.convertUrlToHyperlink(i))})}addMapURLs(e,t){const n=/geo:([\-0-9.]+),([\-0-9.]+)(?:,([\-0-9.]+))?(?:\?(.*))?/g,r=e.matchAll(n);for(const e of r)this.addTemplateResult(e.index+t,e.index+e.input.length+t,Jh.convertUrlToHyperlink(e.input.replace(n,qc.geouri_replacement)))}addEmojis(e,t){[...Nl(e.toString()),...Il(e.toString())].forEach(e=>{this.addTemplateResult(e.begin+t,e.end+t,kl(e,{add_title_wrapper:!0}))})}addMentions(e,t){var n;if(t+=this.offset,!this.model.collection)return void Pn.debug("addMentions: ignoring dangling model");const r=this.model.collection.chatbox.get("nick");null===(n=this.model.get("references"))||void 0===n||n.forEach(n=>{const i=Number(n.begin)-t;if(i>=e.length)return;const o=Number(n.end)-t,s=e.slice(i,o);var a;s===r?this.addTemplateResult(i,o,(a={mention:s},Ya(Gh(),a.mention))):this.addTemplateResult(i,o,(e=>Ya(Wh(),e.mention))({mention:s}))})}addStyling(){if(this.model.get("is_unstyled")||!Wc.settings.get("allow_message_styling"))return;let e=0;const t=[];if(function(e){for(let t=0;t<Ph.length;t++)if(e.includes(Ph[t]))return!0}(this))for(;e<this.length;){const{d:n,length:r}=Hh(this,e);if(n&&r){const i="```"===n?e+n.length+1:e+n.length,o=Uh(n)?e+r+1:e+r,s=Uh(n)?o:o-n.length;t.push({begin:e,template:$h(n,this.slice(i,s),this.model,e+n.length),end:o}),e=o}e++}t.forEach(e=>this.addTemplateResult(e.begin,e.end,e.template))}trimMeMessage(){0===this.offset&&this.isMeCommand()&&(this.payload[0]=this.payload[0].substring(4))}addReferences(e){const t=this.marshall();let n=0;for(const r of t)r&&(Xh(r)?(e.call(this,r,n),n+=r.length):n=r.end)}async addTemplates(){await Wc.trigger("beforeMessageBodyTransformed",this,{Synchronous:!0}),this.addStyling(),this.addReferences(this.addMentions),this.addReferences(this.addHyperlinks),this.addReferences(this.addMapURLs),await Wc.emojis.initialize(),this.addReferences(this.addEmojis),await Wc.trigger("afterMessageBodyTransformed",this,{Synchronous:!0}),this.payload=this.marshall(),this.trimMeMessage(),this.payload=this.payload.map(e=>Xh(e)?e:e.template)}addTemplateResult(e,t,n){this.references.push({begin:e,end:t,template:n})}isMeCommand(){const e=this.toString();return!!e&&e.startsWith("/me ")}static replaceText(e){return Tl(e.replace(/\n\n+/g,"\n\n"))}marshall(){let e=[this.toString()];return this.references.sort((e,t)=>t.begin-e.begin).forEach(t=>{const n=e.shift();e=[n.slice(0,t.begin),t,n.slice(t.end),...e]}),e.reduce((e,t)=>Xh(t)?[...e,Qh.replaceText(t)]:[...e,t],[])}}function Yh(){const e=Zh(["",""]);return Yh=function(){return e},e}function Kh(){const e=Zh(["",""]);return Kh=function(){return e},e}function Zh(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const ef=tl.env.utils;class tf{constructor(e){var t;this.model=e.model,this.component=e,this.chatview=null===(t=ef.ancestor(this.component,"converse-chat-message"))||void 0===t?void 0:t.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 e=Wc.settings.get("show_images_inline"),t=new Qh(this.text,this.model,0,e,()=>this.scrollDownOnImageLoad(),e=>this.component.showImageModal(e));return await t.addTemplates(),t.payload}render(){return Ya(Kh(),Eh(this.transform(),Ya(Yh(),this.text)))}}const nf=Oa(e=>t=>{var n;const r=new tf(e);t.setValue(r.render());const i=e.model;null===(n=i.collection)||void 0===n||n.trigger("rendered",i)});function rf(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <audio controls src="','"></audio>\n <a target="_blank" rel="noopener" href="','">',"</a>\n"]);return rf=function(){return e},e}Wc.elements.define("converse-chat-message-body",class extends pc{static get properties(){return{model:{type:Object},is_me_message:{type:Boolean},text:{type:String}}}showImageModal(e){e.preventDefault(),void 0===this.image_modal&&(this.image_modal=new yh),this.image_modal.src=e.target.src,this.image_modal.render(),this.image_modal.show(e)}render(){return nf(this)}});function of(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['<a target="_blank" rel="noopener" href="','">',"</a>"]);return of=function(){return e},e}var sf=e=>Ya(of(),e.url,e.label_download),af=n(170),cf=n.n(af),lf=n(171),uf=n.n(lf),df=n(64),hf=n.n(df),ff=n(172),pf=n.n(ff),gf=n(173),mf=n.n(gf),vf=n(174),_f=n.n(vf),bf=n(65),yf=n.n(bf);function wf(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['<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 wf=function(){return e},e}const Sf=Oa((e,t,n,r)=>i=>{i.setValue(Ya(wf(),t,e,r,(function(){const o=tl.env.utils;o.isURLWithImageExtension(e)?(i.setValue(o.convertUrlToHyperlink(t)),i.commit()):(i.setValue(Sf("".concat(e,".png"),t,n,r)),i.commit())}),n))});function xf(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["",""]);return xf=function(){return e},e}var Ef=n(175),Af=n.n(Ef);function Cf(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['<video controls preload="metadata" src="','" style="max-height: 50vh"></video>']);return Cf=function(){return e},e}function jf(){const e=Tf(['<a target="_blank" rel="noopener" href="','">',"</a>"]);return jf=function(){return e},e}function Of(){const e=Tf(['\n <a target="_blank"\n rel="noopener"\n @click=','\n href="','">',"</a>"]);return Of=function(){return e},e}function Tf(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}
/**
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
* @description This is the DOM/HTML utilities module.
*/const kf=["http","https","xmpp","mailto"];function Nf(e,t){return{"muc#roomconfig_lang":"language","muc#roomconfig_roomsecret":(null==t?void 0:t.new_password)?"new-password":"current-password"}[e]}const If={"text-private":"password","text-single":"text",fixed:"label",boolean:"checkbox",hidden:"hidden","jid-multi":"textarea","list-single":"dropdown","list-multi":"dropdown"};function Mf(e){try{return e instanceof Sh.a?e:new Sh.a(e)}catch(e){return Pn.debug(e),null}}function Rf(e,t){const n=Mf(t);if(null===n||!function(e){return"http:"===window.location.protocol||"https:"===window.location.protocol&&"https"===e.protocol().toLowerCase()}(n))return!1;const r=n.filename().toLowerCase();return!!e.filter(e=>r.endsWith(e)).length}function Df(e){try{return decodeURI(e.filename())}catch(t){return Pn.debug(t),e.filename()}}function Pf(e,t){const{__:n}=e;return r={url:t.toString(),label_download:n('Download audio file "%1$s"',Df(t))},Ya(rf(),r.url,r.url,r.label_download);var r}function Lf(e,t){e.classList.remove("visible"),M(t)&&t()}Go.isAudioURL=e=>Rf([".ogg",".mp3",".m4a"],e),Go.isVideoURL=e=>Rf([".mp4",".webm"],e),Go.isURLWithImageExtension=e=>Rf([".jpg",".jpeg",".png",".gif",".bmp",".tiff",".svg"],e),Go.isImageURL=e=>{const t=Wc.settings.get("image_urls_regex");return(null==t?void 0:t.test(e))||Go.isURLWithImageExtension(e)},Go.isImageDomainAllowed=e=>{const t=Wc.settings.get("show_images_inline");if(!Array.isArray(t))return!0;try{const n=Mf(e).domain();return t.includes(n)}catch(e){return Pn.debug(e),!0}},Go.getOOBURLMarkup=function(e,t){const n=Mf(t);return null===n?t:Go.isVideoURL(n)?(r={url:t},Ya(Cf(),r.url)):Go.isAudioURL(n)?Pf(e,n):Go.isImageURL(n)?function(e,t){const{__:n}=e;return sf({url:t.toString(),label_download:n('Download image file "%1$s"',Df(t))})}(e,n):function(e,t){const{__:n}=e;return sf({url:t.toString(),label_download:n('Download file "%1$s"',Df(t))})}(e,n);var r},Go.applyDragResistance=function(e,t){if(void 0===e)return;if(void 0===t)return e;return e!==t&&Math.abs(e-t)<10?t:e},Go.calculateElementHeight=function(e){return Array.from(e.children).reduce((e,t)=>e+t.offsetHeight,0)},Go.getNextElement=function(e,t="*"){let n=e.nextElementSibling;for(;null!==n&&!pr.a.matchesSelector(n,t);)n=n.nextElementSibling;return n},Go.getPreviousElement=function(e,t="*"){let n=e.previousElementSibling;for(;null!==n&&!pr.a.matchesSelector(n,t);)n=n.previousElementSibling;return n},Go.getFirstChildElement=function(e,t="*"){let n=e.firstElementChild;for(;null!==n&&!pr.a.matchesSelector(n,t);)n=n.nextElementSibling;return n},Go.getLastChildElement=function(e,t="*"){let n=e.lastElementChild;for(;null!==n&&!pr.a.matchesSelector(n,t);)n=n.previousElementSibling;return n},Go.hasClass=function(e,t){return t instanceof Element&&t.classList.contains(e)},Go.toggleClass=function(e,t){Go.hasClass(e,t)?Go.removeClass(e,t):Go.addClass(e,t)},Go.addClass=function(e,t){return t instanceof Element&&t.classList.add(e),t},Go.removeClass=function(e,t){return t instanceof Element&&t.classList.remove(e),t},Go.removeElement=function(e){return e instanceof Element&&e.parentNode&&e.parentNode.removeChild(e),e},Go.getElementFromTemplateResult=function(e){const t=document.createElement("div");return Xa(e,t),t.firstElementChild},Go.showElement=e=>{Go.removeClass("collapsed",e),Go.removeClass("hidden",e)},Go.hideElement=function(e){return e instanceof Element&&e.classList.add("hidden"),e},Go.ancestor=function(e,t){let n=e;for(;null!==n&&!pr.a.matchesSelector(n,t);)n=n.parentElement;return n},Go.nextUntil=function(e,t){const n=[];let r=e.nextElementSibling;for(;null!==r&&!r.matches(t);)n.push(r),r=r.nextElementSibling;return n},Go.unescapeHTML=function(e){var t=document.createElement("div");return t.innerHTML=e,t.innerText},Go.escapeHTML=function(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")},Go.convertToImageTag=function(e,t,n){return r={url:e,onClick:n,onLoad:t},Ya(xf(),Sf(r.url,r.url,r.onLoad,r.onClick));var r},Go.convertURIoHyperlink=function(e,t){let n=e.normalize()._string;const r=e._parts.urn?n:e.readable(),i=t||r;return e._parts.protocol||n.startsWith("http://")||n.startsWith("https://")||(n="http://"+n),"xmpp"===e._parts.protocol&&"join"===e._parts.query?Ya(Of(),e=>Wc.rooms.open(e.target.href),n,i):Ya(jf(),n,i)},Go.convertUrlToHyperlink=function(e){const t=RegExp("^w{3}.","ig").test(e)?"http://".concat(e):e,n=Mf(e);return null===n||!function(e){try{return!!new URL(e)}catch(e){return!1}}(t)||!function(e,t=kf){return!!t.includes(e)}(n._parts.protocol)&&n._parts.protocol?e:this.convertURIoHyperlink(n,e)},Go.filterQueryParamsFromURL=function(e){const t=Wc.settings.get("filter_url_query_params");return t?Mf(e).removeQuery(t).toString():e},Go.addHyperlinks=function(e){const t=[],n={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|xmpp:|mailto:|www\.)/gi};try{Sh.a.withinString(e,(e,n,r)=>(t.push({url:e,start:n,end:r}),e),n)}catch(t){return Pn.debug(t),[e]}let r=[e];return t.length?t.sort((e,t)=>t.start-e.start).forEach(e=>{const t=r.shift(),n=t.slice(e.start,e.end);r=[t.slice(0,e.start),Go.convertUrlToHyperlink(n),t.slice(e.end),...r]}):r=[e],r},Go.httpToGeoUri=function(e,t){return e.replace(t.api.settings.get("geouri_regex"),"geo:$1,$2")},Go.slideInAllElements=function(e,t=300){return Promise.all(Array.from(e).map(e=>Go.slideIn(e,t)))},Go.slideToggleElement=function(e,t){return Go.hasClass("collapsed",e)||Go.hasClass("hidden",e)?Go.slideOut(e,t):Go.slideIn(e,t)},Go.slideOut=function(e,t=200){return new Promise((n,r)=>{if(!e){const e="An element needs to be passed in to slideOut";return Pn.warn(e),void r(new Error(e))}const i=e.getAttribute("data-slider-marker");i&&(e.removeAttribute("data-slider-marker"),window.cancelAnimationFrame(i));const o=Go.calculateElementHeight(e);if(window.converse_disable_effects)return e.style.height=o+"px",function(e){e.removeAttribute("data-slider-marker"),e.classList.remove("collapsed"),e.style.overflow="",e.style.height=""}(e),void n();if(!Go.hasClass("collapsed",e)&&!Go.hasClass("hidden",e))return void n();const s=t/17;let a=0;e.style.height="0",e.style.overflow="hidden",e.classList.remove("hidden"),e.classList.remove("collapsed"),e.setAttribute("data-slider-marker",window.requestAnimationFrame((function t(){a+=o/s,a<o?(e.style.height=a+"px",e.setAttribute("data-slider-marker",window.requestAnimationFrame(t))):(e.removeAttribute("data-slider-marker"),e.style.height=Go.calculateElementHeight(e)+"px",e.style.overflow="",e.style.height="",n())})))})},Go.slideIn=function(e,t=200){return new Promise((n,r)=>{if(!e){const e="An element needs to be passed in to slideIn";return Pn.warn(e),r(new Error(e))}if(Go.hasClass("collapsed",e))return n(e);if(window.converse_disable_effects)return e.classList.add("collapsed"),e.style.height="",n(e);const i=e.getAttribute("data-slider-marker");i&&(e.removeAttribute("data-slider-marker"),window.cancelAnimationFrame(i));const o=e.offsetHeight,s=t/17;let a=o;e.style.overflow="hidden",e.setAttribute("data-slider-marker",window.requestAnimationFrame((function t(){a-=o/s,a>0?(e.style.height=a+"px",e.setAttribute("data-slider-marker",window.requestAnimationFrame(t))):(e.removeAttribute("data-slider-marker"),e.classList.add("collapsed"),e.style.height="",n(e))})))})},Go.isInDOM=function(e){return document.querySelector("body").contains(e)},Go.isVisible=function(e){return null!==e&&(!Go.hasClass("hidden",e)&&(e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0))},Go.fadeIn=function(e,t){if(e||Pn.warn("An element needs to be passed in to fadeIn"),window.converse_disable_effects)return e.classList.remove("hidden"),Lf(e,t);Go.hasClass("hidden",e)?(e.classList.add("visible"),e.classList.remove("hidden"),e.addEventListener("webkitAnimationEnd",()=>Lf(e,t)),e.addEventListener("animationend",()=>Lf(e,t)),e.addEventListener("oanimationend",()=>Lf(e,t))):Lf(e,t)},Go.xForm2webForm=function(e,t,n){if("list-single"===e.getAttribute("type")||"list-multi"===e.getAttribute("type")){const t=Go.queryChildren(e,"value").map(e=>null==e?void 0:e.textContent),n=Go.queryChildren(e,"option").map(n=>{var r;const i=null===(r=n.querySelector("value"))||void 0===r?void 0:r.textContent;return Af()({value:i,label:n.getAttribute("label"),selected:t.includes(i),required:!!e.querySelector("required")})});return pf()({id:Go.getUniqueId(),name:e.getAttribute("var"),label:e.getAttribute("label"),options:n.join(""),multiple:"list-multi"===e.getAttribute("type"),required:!!e.querySelector("required")})}if("fixed"===e.getAttribute("type")){var r;return'<p class="form-help">'+(null===(r=e.querySelector("value"))||void 0===r?void 0:r.textContent)+"</p>"}var i,o,s;if("jid-multi"===e.getAttribute("type"))return mf()({name:e.getAttribute("var"),label:e.getAttribute("label")||"",value:null===(i=e.querySelector("value"))||void 0===i?void 0:i.textContent,required:!!e.querySelector("required")});if("boolean"===e.getAttribute("type")){var a;const t=null===(a=e.querySelector("value"))||void 0===a?void 0:a.textContent;return uf()({id:Go.getUniqueId(),name:e.getAttribute("var"),label:e.getAttribute("label")||"",checked:"1"===t||"true"===t?'checked="1"':"",required:!!e.querySelector("required")})}if("url"===e.getAttribute("var"))return _f()({label:e.getAttribute("label")||"",value:null===(o=e.querySelector("value"))||void 0===o?void 0:o.textContent});if("username"===e.getAttribute("var"))return yf()({domain:" @"+n.domain,name:e.getAttribute("var"),type:If[e.getAttribute("type")],label:e.getAttribute("label")||"",value:null===(s=e.querySelector("value"))||void 0===s?void 0:s.textContent,required:!!e.querySelector("required")});if("ocr"===e.getAttribute("var")){const n=e.querySelector("uri"),r=pr()('data[cid="'+n.textContent.replace(/^cid:/,"")+'"]',t)[0];return cf()({label:e.getAttribute("label"),name:e.getAttribute("var"),data:null==r?void 0:r.textContent,type:n.getAttribute("type"),required:!!e.querySelector("required")})}{var c;const t=e.getAttribute("var");return hf()({id:Go.getUniqueId(),label:e.getAttribute("label")||"",name:t,fixed_username:null==n?void 0:n.fixed_username,autocomplete:Nf(t,n),placeholder:null,required:!!e.querySelector("required"),type:If[e.getAttribute("type")],value:null===(c=e.querySelector("value"))||void 0===c?void 0:c.textContent})}};var Ff=Go;const{keycodes:zf}=tl;function Bf(e){let t=0;do{isNaN(e.offsetTop)||(t+=e.offsetTop)}while(e=e.offsetParent);return t}function qf(e){let t=0;do{isNaN(e.offsetLeft)||(t+=e.offsetLeft)}while(e=e.offsetParent);return t}class Hf{static get DIRECTION(){return{down:"down",end:"end",home:"home",left:"left",right:"right",up:"up"}}static get DEFAULTS(){return{home:["".concat(zf.SHIFT,"+").concat(zf.UP_ARROW)],end:["".concat(zf.SHIFT,"+").concat(zf.DOWN_ARROW)],up:[zf.UP_ARROW],down:[zf.DOWN_ARROW],left:[zf.LEFT_ARROW,"".concat(zf.SHIFT,"+").concat(zf.TAB)],right:[zf.RIGHT_ARROW,zf.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(e,t){return e.reduce((e,n)=>{const r=t(n);return r<e.distance?{distance:r,element:n}:e},{distance:1/0}).element}constructor(e,t){this.doc=window.document,this.container=e,this.scroll_container=t.scroll_container||e,this.options=Object.assign({},Hf.DEFAULTS,t),this.init()}init(){this.selected=null,this.keydownHandler=null,this.elements={},this.keys={},this.options.down.forEach(e=>this.keys[e]=Hf.DIRECTION.down),this.options.end.forEach(e=>this.keys[e]=Hf.DIRECTION.end),this.options.home.forEach(e=>this.keys[e]=Hf.DIRECTION.home),this.options.left.forEach(e=>this.keys[e]=Hf.DIRECTION.left),this.options.right.forEach(e=>this.keys[e]=Hf.DIRECTION.right),this.options.up.forEach(e=>this.keys[e]=Hf.DIRECTION.up)}enable(){this.getElements(),this.keydownHandler=e=>this.handleKeydown(e),this.doc.addEventListener("keydown",this.keydownHandler),this.enabled=!0}disable(){this.keydownHandler&&this.doc.removeEventListener("keydown",this.keydownHandler),this.unselect(),this.elements={},this.enabled=!1}destroy(){this.disable(),this.container.domNavigator&&delete this.container.domNavigator}getNextElement(e){let t;if(e===Hf.DIRECTION.home)t=this.getElements(e)[0];else if(e===Hf.DIRECTION.end)t=Array.from(this.getElements(e)).pop();else if(this.selected)if(e===Hf.DIRECTION.right){const n=this.getElements(e);t=n.slice(n.indexOf(this.selected))[1]}else if(e==Hf.DIRECTION.left){const n=this.getElements(e);t=n.slice(0,n.indexOf(this.selected)).pop()||this.selected}else if(e==Hf.DIRECTION.down){const e=this.selected.offsetLeft,n=this.selected.offsetTop+this.selected.offsetHeight,r=this.elementsAfter(0,n),i=t=>Math.abs(t.offsetLeft-e)+Math.abs(t.offsetTop-n);t=Hf.getClosestElement(r,i)}else{if(e!=Hf.DIRECTION.up)throw new Error("getNextElement: invalid direction value");{const e=this.selected.offsetLeft,n=this.selected.offsetTop-1,r=this.elementsBefore(1/0,n),i=t=>Math.abs(e-t.offsetLeft)+Math.abs(n-t.offsetTop);t=Hf.getClosestElement(r,i)}}else t=e===Hf.DIRECTION.right||e===Hf.DIRECTION.down?this.getElements(e)[1]:this.getElements(e)[0];return this.options.jump_to_picked&&t&&t.matches(this.options.jump_to_picked)&&e===this.options.jump_to_picked_direction&&(t=this.container.querySelector(this.options.jump_to_picked_selector)||t),t}select(e,t){e&&e!==this.selected&&(this.unselect(),t&&this.scrollTo(e,t),e.matches("input")?e.focus():Ff.addClass(this.options.selected,e),this.selected=e,this.options.onSelected&&this.options.onSelected(e))}unselect(){this.selected&&(Ff.removeClass(this.options.selected,this.selected),delete this.selected)}scrollTo(e,t){if(this.inScrollContainerViewport(e)){if(!function(e){const t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=window.innerHeight&&t.right<=window.innerWidth}(e))switch(t){case Hf.DIRECTION.left:document.body.scrollLeft=qf(e)-document.body.offsetLeft;break;case Hf.DIRECTION.up:document.body.scrollTop=Bf(e)-document.body.offsetTop;break;case Hf.DIRECTION.right:document.body.scrollLeft=qf(e)-document.body.offsetLeft-(document.documentElement.clientWidth-e.offsetWidth);break;case Hf.DIRECTION.down:document.body.scrollTop=Bf(e)-document.body.offsetTop-(document.documentElement.clientHeight-e.offsetHeight)}}else{const n=this.scroll_container;if(!n.contains(e))return;switch(t){case Hf.DIRECTION.left:n.scrollLeft=e.offsetLeft-n.offsetLeft,n.scrollTop=e.offsetTop-n.offsetTop;break;case Hf.DIRECTION.up:n.scrollTop=e.offsetTop-n.offsetTop;break;case Hf.DIRECTION.right:n.scrollLeft=e.offsetLeft-n.offsetLeft-(n.offsetWidth-e.offsetWidth),n.scrollTop=e.offsetTop-n.offsetTop-(n.offsetHeight-e.offsetHeight);break;case Hf.DIRECTION.down:n.scrollTop=e.offsetTop-n.offsetTop-(n.offsetHeight-e.offsetHeight)}}}inScrollContainerViewport(e){const t=this.scroll_container;return!(e.offsetLeft-t.scrollLeft<t.offsetLeft)&&(!(e.offsetTop-t.scrollTop<t.offsetTop)&&(!(e.offsetLeft+e.offsetWidth-t.scrollLeft>t.offsetLeft+t.offsetWidth)&&!(e.offsetTop+e.offsetHeight-t.scrollTop>t.offsetTop+t.offsetHeight)))}getElements(e){const t=this.options.getSelector?this.options.getSelector(e):this.options.selector;return this.elements[t]||(this.elements[t]=Array.from(this.container.querySelectorAll(t))),this.elements[t]}elementsAfter(e,t){return this.getElements(Hf.DIRECTION.down).filter(n=>n.offsetLeft>=e&&n.offsetTop>=t)}elementsBefore(e,t){return this.getElements(Hf.DIRECTION.up).filter(n=>n.offsetLeft<=e&&n.offsetTop<=t)}handleKeydown(e){const t=zf,n=e.shiftKey?this.keys["".concat(t.SHIFT,"+").concat(e.which)]:this.keys[e.which];if(n){e.preventDefault(),e.stopPropagation();const t=this.getNextElement(n,e);this.select(t,n)}}}var Uf=Hf;function $f(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\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 $f=function(){return e},e}const Wf=tl.env.utils;class Gf extends pc{firstUpdated(){this.menu=this.querySelector(".dropdown-menu"),this.dropdown=this.firstElementChild,this.button=this.dropdown.querySelector("button"),this.dropdown.addEventListener("click",e=>this.toggleMenu(e)),this.dropdown.addEventListener("keyup",e=>this.handleKeyUp(e)),document.addEventListener("click",e=>!this.contains(e.composedPath()[0])&&this.hideMenu(e))}hideMenu(){var e,t;Wf.removeClass("show",this.menu),null===(e=this.button)||void 0===e||e.setAttribute("aria-expanded",!1),null===(t=this.button)||void 0===t||t.blur()}showMenu(){Wf.addClass("show",this.menu),this.button.setAttribute("aria-expanded",!0)}toggleMenu(e){e.preventDefault(),Wf.hasClass("show",this.menu)?this.hideMenu():this.showMenu()}handleKeyUp(e){e.keyCode===tl.keycodes.ESCAPE?this.hideMenu():e.keyCode===tl.keycodes.DOWN_ARROW&&this.navigator&&!this.navigator.enabled&&this.enableArrowNavigation(e)}}function Vf(){const e=Qf(['<converse-dropdown class="chat-msg__actions" .items=',"></converse-dropdown>"]);return Vf=function(){return e},e}function Jf(){const e=Qf(['\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 Jf=function(){return e},e}function Xf(){const e=Qf(["",""]);return Xf=function(){return e},e}function Qf(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Wc.elements.define("converse-dropdown",class extends Gf{static get properties(){return{icon_classes:{type:String},items:{type:Array}}}render(){const e=this.icon_classes||"fa fa-bars";return Ya($f(),e,this.items.map(e=>Eh(e,"")))}hideMenu(){super.hideMenu(),this.navigator.disable()}firstUpdated(){super.firstUpdated(),this.initArrowNavigation()}initArrowNavigation(){if(!this.navigator){const e={selector:".dropdown-item",onSelected:e=>e.focus()};this.navigator=new Uf(this.menu,e)}}enableArrowNavigation(e){e&&(e.preventDefault(),e.stopPropagation()),this.navigator.enable(),this.navigator.select(this.menu.firstElementChild)}handleKeyUp(e){super.handleKeyUp(e),e.keyCode!==tl.keycodes.DOWN_ARROW||this.navigator.enabled||this.enableArrowNavigation(e)}});class Yf extends pc{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 Ya(Xf(),Eh(this.renderActions(),""))}static getActionsDropdownItem(e){return Ya(Jf(),e.button_class,e.handler,e.icon_class,Wc.settings.get("assets_path"),e.i18n_text)}onMessageEditButtonClicked(e){e.preventDefault(),this.chatview.onMessageEditButtonClicked(this.model)}onMessageRetractButtonClicked(e){e.preventDefault(),this.chatview.onMessageRetractButtonClicked(this.model)}async renderActions(){const e=[];this.editable&&e.push({i18n_text:this.correcting?Td("Cancel Editing"):Td("Edit"),handler:e=>this.onMessageEditButtonClicked(e),button_class:"chat-msg__action-edit",icon_class:"fa fa-pencil-alt",name:"edit"});const t="groupchat"===this.model.get("type")&&await this.model.mayBeModerated();!this.is_retracted&&(this.model.mayBeRetracted()||t)&&e.push({i18n_text:Td("Retract"),handler:e=>this.onMessageRetractButtonClicked(e),button_class:"chat-msg__action-retract",icon_class:"fas fa-trash-alt",name:"retract"});const n=e.map(e=>Yf.getActionsDropdownItem(e));return n.length?Ya(Vf(),n):""}}function Kf(){const e=ep(['<p class="older-msg"><time>',"</time>: ","</p>"]);return Kf=function(){return e},e}function Zf(){const e=ep(['\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 Zf=function(){return e},e}function ep(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Wc.elements.define("converse-message-actions",Yf);var tp=mh.extend({id:"message-versions-modal",toHTML(){return e=this.model.toJSON(),Ya(Zf(),Td("Message versions"),ih,Object.keys(e.older_versions).map(t=>Ya(Kf(),Sn()(t).format("MMM D, YYYY, HH:mm:ss"),e.older_versions[t])),e.message,rh);var e}}),np=n(176),rp=n.n(np);function ip(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <svg xmlns="http://www.w3.org/2000/svg" class="avatar ','" width="','" height="','">\n <image width="','" height="','" preserveAspectRatio="xMidYMid meet" href="','"/>\n </svg>']);return ip=function(){return e},e}var op=e=>{return Ya(ip(),e.classes,e.width,e.height,e.width,e.height,(t=e.image,n=e.image_type,t.startsWith("data:")?t:"data:".concat(n,";base64,").concat(t)));var t,n};const sp=Oa(e=>t=>{const n={classes:e.classes?"".concat(e.classes," avatar"):"avatar",height:e.width||36,image:e.image,image_type:e.image_type,width:e.height||36};t.setValue(op(n))});function ap(){const e=hp(['\n <time timestamp="','" class="chat-msg__time">','</time>&nbsp;\n <span class="chat-msg__author">',"","</span>&nbsp;"]);return ap=function(){return e},e}function cp(){const e=hp(['<span class="fa fa-lock"></span>']);return cp=function(){return e},e}function lp(){const e=hp(['\n <span class="chat-msg__heading">\n <span class="chat-msg__author">',"</span>\n ","\n ","\n </span>"]);return lp=function(){return e},e}function up(){const e=hp(['<div class="message separator"><hr class="separator"><span class="separator-text">',"</span></div>"]);return up=function(){return e},e}function dp(){const e=hp(["\n ",'\n <div class="message chat-msg ','"\n data-isodate="','"\n data-msgid="','"\n data-from="','"\n data-encrypted="','">\n\n \x3c!-- Anchor to allow us to scroll the message into view --\x3e\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 dp=function(){return e},e}function hp(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function fp(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['<span class="spinner fa fa-spinner centered ','"/>']);return fp=function(){return e},e}var pp=(e={})=>Ya(fp(),e.classes||"");function gp(){const e=kp(['<span class="badge badge-secondary">',"</span>"]);return gp=function(){return e},e}function mp(){const e=kp(["\n ",'\n <time timestamp="','" class="chat-msg__time">',"</time>\n "]);return mp=function(){return e},e}function vp(){const e=kp(['<div class="chat-msg__media">',"</div>"]);return vp=function(){return e},e}function _p(){const e=kp(['<i title="','" class="fa fa-edit chat-msg__edit-modal" @click=',"></i>"]);return _p=function(){return e},e}function bp(){const e=kp(['<span class="fa fa-check chat-msg__receipt"></span>']);return bp=function(){return e},e}function yp(){const e=kp(['<div class="chat-msg__subject">',"</div>"]);return yp=function(){return e},e}function wp(){const e=kp(["\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 wp=function(){return e},e}function Sp(){const e=kp(['\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 Sp=function(){return e},e}function xp(){const e=kp(['<q class="chat-msg--retracted__reason">',"</q>"]);return xp=function(){return e},e}function Ep(){const e=kp(["\n <div>","</div>\n ","\n "]);return Ep=function(){return e},e}function Ap(){const e=kp(['\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 Ap=function(){return e},e}function Cp(){const e=kp(['<a class="retry" @click=',">","</a>"]);return Cp=function(){return e},e}function jp(){const e=kp(['<q class="reason">',"</q>"]);return jp=function(){return e},e}function Op(){const e=kp(['<q class="reason">',"</q>"]);return Op=function(){return e},e}function Tp(){const e=kp(['\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 e},e}function kp(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const{Strophe:Np}=tl.env,Ip=tl.env.utils;class Mp extends pc{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 e=Wc.settings.get("time_format");return this.pretty_time=Sn()(this.edited||this.time).format(e),this.show_spinner?pp():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",e=>{const t=this.model.collection.chatbox;Object.assign(this,Xp(t,this.model)),Object.keys(e.changed).filter(e=>Object.keys(Mp.properties).includes(e)).forEach(t=>this[t]=e.changed[t])});const e=this.model.vcard;e&&this.listenTo(e,"change",()=>this.requestUpdate())}updated(){var e;(this.show_spinner||this.model.get("file")&&!this.model.get("oob_url")||["error","info"].includes(this.message_type))&&(null===(e=this.model.collection)||void 0===e||e.trigger("rendered",this.model))}renderInfoMessage(){const e=Sn()(this.model.get("time")).toISOString(),t=Td("Retry");return Ya(Tp(),this.message_type,e,this.data_name,this.data_value,this.model.getMessageText(),this.reason?Ya(Op(),this.reason):"",this.error_text?Ya(jp(),this.error_text):"",this.retry_event_id?Ya(Cp(),this.onRetryClicked,t):"")}renderFileProgress(){const e=Td("Uploading file:"),t=this.model.file.name,n=rp()(this.model.file.size);return Ya(Ap(),sp(this.getAvatarData()),e,t,n,this.progress)}renderChatMessage(){return(e=>{const t=Td("New messages");return Ya(dp(),e.is_first_unread?Ya(up(),t):"",e.getExtraMessageClasses(),e.time,e.msgid,e.from,e.is_encrypted,e.msgid,e.shouldShowAvatar()?sp(e.getAvatarData()):"",e.sender,e.is_me_message?"chat-msg__content--action":"",e.is_me_message?"":Ya(lp(),e.username,e.renderAvatarByline(),e.is_encrypted?Ya(cp()):""),e.message_type,e.received?"chat-msg__body--received":"",e.is_delayed?"chat-msg__body--delayed":"",e.is_me_message?Ya(ap(),e.edited||e.time,e.pretty_time,e.is_me_message?"**":"",e.username):"",e.is_retracted?e.renderRetraction():e.renderMessageText(),e.chatview,e.model,e.correcting,e.editable,e.is_retracted,e.message_type)})(this)}shouldShowAvatar(){return Wc.settings.get("show_message_avatar")&&!this.is_me_message&&"headline"!==this.type}getAvatarData(){var e,t;return{classes:"chat-msg__avatar",height:36,width:36,image:"data:"+((null===(e=this.model.vcard)||void 0===e?void 0:e.get("image_type"))||qc.DEFAULT_IMAGE_TYPE)+";base64,"+((null===(t=this.model.vcard)||void 0===t?void 0:t.get("image"))||qc.DEFAULT_IMAGE)}}async onRetryClicked(){this.show_spinner=!0,await Wc.trigger(this.retry_event_id,{synchronous:!0}),this.model.destroy(),this.parentElement.removeChild(this)}isFollowup(){const e=this.model.collection.models,t=e.indexOf(this.model),n=t?e[t-1]:null;if(null===n)return!1;const r=Sn()(this.time);return this.from===n.get("from")&&!this.is_me_message&&!n.isMeCommand()&&"info"!==this.message_type&&"info"!==n.get("type")&&r.isBefore(Sn()(n.get("time")).add(10,"minutes"))&&!!this.is_encrypted==!!n.get("is_encrypted")}getExtraMessageClasses(){const e=[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(e=>e);return"groupchat"===this.message_type&&(this.occupant_role&&e.push(this.occupant_role),this.occupant_affiliation&&e.push(this.occupant_affiliation),"them"===this.sender&&this.has_mentions&&e.push("mentioned")),this.correcting&&e.push("correcting"),e.filter(e=>e).join(" ")}getRetractionText(){if("groupchat"===this.message_type&&this.moderated_by){const e=this.moderated_by,t=this.model.collection.chatbox;this.model.mod||(this.model.mod=t.occupants.findOccupant({jid:e})||t.occupants.findOccupant({nick:Np.getResourceFromJid(e)}));const n=this.model.mod?this.model.mod.getDisplayName():"A moderator";return Td("%1$s has removed this message",n)}return Td("%1$s has removed this message",this.model.getDisplayName())}renderRetraction(){const e=this.is_retracted?this.getRetractionText():null;return Ya(Ep(),e,this.moderation_reason?Ya(xp(),this.moderation_reason):"")}renderMessageText(){const e=Td("This message has been edited"),t=Td("Show more"),n="groupchat"===this.message_type,r=Td("Show less"),i=Ya(Sp(),this.spoiler_hint,this.toggleSpoilerMessage,this.is_spoiler_visible?"fa-eye-slash":"fa-eye",this.is_spoiler_visible?r:t),o=this.is_spoiler?"spoiler ".concat(this.is_spoiler_visible?"":"hidden"):"";return Ya(wp(),this.is_spoiler?i:"",this.subject?Ya(yp(),this.subject):"",this.is_only_emojis?"chat-msg__text--larger":"",o,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||n?"":Ya(bp()),this.edited?Ya(_p(),e,this.showMessageVersionsModal):"",this.oob_url?Ya(vp(),Ip.getOOBURLMarkup(qc,this.oob_url)):"",this.error_text||this.error)}renderAvatarByline(){return Ya(mp(),this.hats.map(e=>Ya(gp(),e.title)),this.edited||this.time,this.pretty_time)}showMessageVersionsModal(e){e.preventDefault(),void 0===this.message_versions_modal&&(this.message_versions_modal=new tp({model:this.model})),this.message_versions_modal.show(e)}toggleSpoilerMessage(e){null==e||e.preventDefault(),this.model.save({is_spoiler_visible:!this.model.get("is_spoiler_visible")})}}function Rp(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\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 Rp=function(){return e},e}Wc.elements.define("converse-chat-message",Mp);
/**
* @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 Dp=(e,t)=>{const n=e.startNode.parentNode,r=void 0===t?e.endNode:t.startNode,i=n.insertBefore(Sa(),r);n.insertBefore(Sa(),r);const o=new za(e.options);return o.insertAfterNode(i),o},Pp=(e,t)=>(e.setValue(t),e.commit(),e),Lp=(e,t,n)=>{const r=e.startNode.parentNode,i=n?n.startNode:e.endNode,o=t.endNode.nextSibling;o!==i&&pa(r,t.startNode,o,i)},Fp=e=>{ga(e.startNode.parentNode,e.startNode,e.endNode.nextSibling)},zp=(e,t,n)=>{const r=new Map;for(let i=t;i<=n;i++)r.set(e[i],i);return r},Bp=new WeakMap,qp=new WeakMap,Hp=Oa((e,t,n)=>{let r;return void 0===n?n=t:void 0!==t&&(r=t),t=>{if(!(t instanceof za))throw new Error("repeat can only be used in text bindings");const i=Bp.get(t)||[],o=qp.get(t)||[],s=[],a=[],c=[];let l,u,d=0;for(const t of e)c[d]=r?r(t,d):d,a[d]=n(t,d),d++;let h=0,f=i.length-1,p=0,g=a.length-1;for(;h<=f&&p<=g;)if(null===i[h])h++;else if(null===i[f])f--;else if(o[h]===c[p])s[p]=Pp(i[h],a[p]),h++,p++;else if(o[f]===c[g])s[g]=Pp(i[f],a[g]),f--,g--;else if(o[h]===c[g])s[g]=Pp(i[h],a[g]),Lp(t,i[h],s[g+1]),h++,g--;else if(o[f]===c[p])s[p]=Pp(i[f],a[p]),Lp(t,i[f],i[h]),f--,p++;else if(void 0===l&&(l=zp(c,p,g),u=zp(o,h,f)),l.has(o[h]))if(l.has(o[f])){const e=u.get(c[p]),n=void 0!==e?i[e]:null;if(null===n){const e=Dp(t,i[h]);Pp(e,a[p]),s[p]=e}else s[p]=Pp(n,a[p]),Lp(t,n,i[h]),i[e]=null;p++}else Fp(i[f]),f--;else Fp(i[h]),h++;for(;p<=g;){const e=Dp(t,s[g+1]);Pp(e,a[p]),s[p++]=e}for(;h<=f;){const e=i[h++];null!==e&&Fp(e)}Bp.set(t,s),qp.set(t,c)}});function Up(){const e=Gp(['<div class="empty-history-feedback form-help"><span>',"</span></div>"]);return Up=function(){return e},e}function $p(){const e=Gp(["",""]);return $p=function(){return e},e}function Wp(){const e=Gp(["\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 Wp=function(){return e},e}function Gp(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const Vp=Td("No message history available.");function Jp(e){const t=e.collection.models,n=t.indexOf(e),r=t[n-1];if(!r||Sn()(e.get("time")).isAfter(Sn()(r.get("time")),"day")){const t=Sn()(e.get("time")).startOf("day");return i={type:"date",time:t.toISOString(),datestring:t.format("dddd MMM Do YYYY")},Ya(Rp(),i.time,i.time,i.datestring)}var i}function Xp(e,t){return{has_mentions:"groupchat"===t.get("type")&&"them"===t.get("sender")&&e.isUserMentioned(t),hats:qc.getHats(t),is_first_unread:e.get("first_unread_id")===t.get("id"),is_me_message:t.isMeCommand(),is_retracted:t.get("retracted")||"retracted"===t.get("moderated"),username:t.getDisplayName()}}qc.getHats=function(e){if("groupchat"===e.get("type")){var t;const n=Wc.settings.get("muc_hats").filter(e=>e).map(e=>e.toLowerCase());let r=[];n.includes("vcard_roles")&&(r=e.vcard?e.vcard.get("role"):null,r=r?r.split(",").filter(e=>e).map(e=>({title:e})):[]);const i=[...e.occupant?[e.occupant.get("role")]:[],...e.occupant?[e.occupant.get("affiliation")]:[]].filter(e=>e).filter(e=>n.includes(e.toLowerCase())).map(e=>({title:e}));return[...n.includes("xep317")&&(null===(t=e.occupant)||void 0===t?void 0:t.get("hats"))||[],...r,...i]}return[]};Wc.elements.define("converse-message-history",class extends pc{static get properties(){return{chatview:{type:Object},messages:{type:Array}}}render(){const e=this.messages;return e.length?Ya($p(),Hp(e,e=>e.get("id"),e=>this.renderMessage(e))):Ya(Up(),Vp)}renderMessage(e){if(e.get("dangling_retraction")||e.get("is_only_key"))return"";const t=Jp(e);var n;return[...t?[t]:[],(n=Object.assign(e.toJSON(),Xp(this.chatview.model,e),{chatview:this.chatview,model:e}),Ya(Wp(),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.type||"",n.moderated_by||"",n.moderation_reason||"",n.msgid,n.model.occupant?n.model.occupant.get("affiliation"):"",n.model.occupant?n.model.occupant.get("role"):"",n.oob_url||"",n.pretty_type,n.progress||0,n.reason||"",n.received||"",n.retry_event_id||"",n.sender,n.spoiler_hint||"",n.subject||"",n.time,n.username))]}});var Qp=n(18),Yp=n.n(Qp);
/**
* @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 Kp=new WeakMap,Zp=Oa(e=>t=>{if(!(t instanceof za))throw new Error("unsafeHTML can only be used in text bindings");const n=Kp.get(t);if(void 0!==n&&Da(e)&&e===n.value&&t.value===n.fragment)return;const r=document.createElement("template");r.innerHTML=e;const i=document.importNode(r.content,!0);t.setValue(i),Kp.set(t,{value:e,fragment:i})});function eg(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["\n <converse-message-history\n .chatview=","\n .messages=",'>\n </converse-message-history>\n <div class="chat-content__notifications">',"</div>\n "]);return eg=function(){return e},e}function tg(){const e=rg(['<svg .style="','"> <use href="','"> </use> </svg>']);return tg=function(){return e},e}function ng(){const e=rg(["\n :host {\n display: inline-block;\n padding: 0;\n margin: 0;\n }\n "]);return ng=function(){return e},e}function rg(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}
/**
* @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)
*/Wc.elements.define("converse-chat-content",class extends pc{static get properties(){return{chatview:{type:Object},messages:{type:Array},notifications:{type:String}}}render(){const e=Yp.a.filterXSS(this.notifications,{whiteList:{}});return Ya(eg(),this.chatview,this.messages,Zp(e))}});function ig(){const e=sg(['<div class="message chat-','" data-isodate="','">',"</div>"]);return ig=function(){return e},e}function og(){const e=sg(['<converse-icon class="fas fa-times close-chat-help"\n @click=','\n path-prefix="','"\n size="1em"></converse-icon>']);return og=function(){return e},e}function sg(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}customElements.define("converse-icon",class extends pc{static get properties(){return{color:String,class_name:{attribute:"class"},style:String,size:String}}static get styles(){return dc(ng())}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 Ya(tg(),this.getStyles(),this.getSource())}});function ag(){const e=mg(["<converse-emoji-picker-content\n .chatview=","\n .model=",'\n .search_results="','"\n current_skintone="','"\n query="','"></converse-emoji-picker-content>']);return ag=function(){return e},e}function cg(){const e=mg(['\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 cg=function(){return e},e}function lg(){const e=mg(['\n <li data-skintone="','" class="emoji-skintone ','">\n <a class="pick-skintone" href="#" data-skintone="','" @click=',">","</a>\n </li>"]);return lg=function(){return e},e}function ug(){const e=mg(["\n <span ?hidden=",' class="emoji-lists__container emoji-lists__container--browse">\n ',"\n </span>"]);return ug=function(){return e},e}function dg(){const e=mg(['\n <a id="emoji-picker-','" class="emoji-category__heading" data-category="','">','</a>\n <ul class="emoji-picker" data-category="','">\n ',"\n </ul>"]);return dg=function(){return e},e}function hg(){const e=mg(["\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 hg=function(){return e},e}function fg(){const e=mg(['\n <li class="emoji insert-emoji ','" data-emoji="','" title="','">\n <a href="#" @click=',' data-emoji="','">',"</a>\n </li>\n "]);return fg=function(){return e},e}function pg(){const e=mg(["<ul>","</ul>"]);return pg=function(){return e},e}function gg(){const e=mg(['\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 gg=function(){return e},e}function mg(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Wc.elements.define("converse-chat-help",class extends pc{static get properties(){return{chat_type:{type:String},messages:{type:Array},model:{type:Object},type:{type:String}}}render(){const e=(new Date).toISOString();return[Ya(og(),this.close,Wc.settings.get("assets_path")),...this.messages.map(t=>this.renderHelpMessage({isodate:e,markup:Yp.a.filterXSS(t,{whiteList:{strong:[]}})}))]}close(){this.model.set({show_help_messages:!1})}renderHelpMessage(e){return Ya(ig(),this.type,e.isodate,Zp(e.markup))}});const vg=tl.env.utils,_g=e=>{const t=Wc.settings.get("emoji_categories");return Ya(pg(),Object.keys(t).map(n=>t[n]?(e=>Ya(gg(),e.category,e.category,e.current_category===e.category?"picked":"",Td(qc.emoji_category_labels[e.category]),e.onCategoryPicked,e.category,e.category,e.emoji))(Object.assign({category:n,emoji:e.sn2Emoji(t[n])},e)):""))},bg=e=>Ya(fg(),e.shouldBeHidden(e.emoji.sn)?"hidden":"",e.emoji.sn,e.emoji.sn,e.insertEmoji,e.emoji.sn,vg.shortnamesToEmojis(e.emoji.sn)),yg=e=>{const t=Wc.settings.get("emoji_categories");return Ya(ug(),e.query,Object.keys(t).map(n=>t[n]?(e=>Ya(dg(),e.category,e.category,Td(Wc.settings.get("emoji_category_labels")[e.category]),e.category,Object.values(tl.emojis.json[e.category]).map(t=>bg(Object.assign({emoji:t},e)))))(Object.assign({category:n},e)):""))},wg=e=>{const t=Td("Search");return Ya(cg(),t,e.query||"",e.onSearchInputKeyDown,e.onSearchInputBlurred,e.onSearchInputFocus,e.query?"":_g(e),e.render_emojis?Ya(ag(),e.chatview,e.model,e.search_results,e.current_skintone,e.query):"",["tone1","tone2","tone3","tone4","tone5"].map(t=>(e=>Ya(lg(),e.skintone,e.current_skintone===e.skintone?"picked":"",e.skintone,e.onSkintonePicked,vg.shortnamesToEmojis(":"+e.skintone+":")))(Object.assign({skintone:t},e))))};function Sg(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <div class="emoji-picker__lists">\n ',"\n ","\n </div>\n "]);return Sg=function(){return e},e}function xg(){const e=Ag(["\n <converse-emoji-picker\n .chatview=","\n .model=","\n ?render_emojis=",'\n current_category="','"\n current_skintone="','"\n query="','"\n ></converse-emoji-picker>']);return xg=function(){return e},e}function Eg(){const e=Ag(['\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 Eg=function(){return e},e}function Ag(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Wc.elements.define("converse-emoji-picker-content",class extends pc{static get properties(){return{chatview:{type:Object},search_results:{type:Array},current_skintone:{type:String},model:{type:Object},query:{type:String}}}render(){const e={current_skintone:this.current_skintone,insertEmoji:e=>this.insertEmoji(e),query:this.query,search_results:this.search_results,shouldBeHidden:e=>this.shouldBeHidden(e)};return Ya(Sg(),(e=>{const t=Td("Search results");return Ya(hg(),!e.query,t,e.search_results.map(t=>bg(Object.assign({emoji:t},e))))})(e),yg(e))}firstUpdated(){this.initIntersectionObserver()}initIntersectionObserver(){if(window.IntersectionObserver){if(this.observer)this.observer.disconnect();else{const e={root:this.querySelector(".emoji-picker__lists"),threshold:[.1]},t=e=>this.setCategoryOnVisibilityChange(e);this.observer=new IntersectionObserver(t,e)}pr()(".emoji-picker",this).forEach(e=>this.observer.observe(e))}}setCategoryOnVisibilityChange(e){const t=this.parentElement.navigator.selected,n=e.filter(e=>e.target.contains(t)).pop();let r;if(r=n||e.reduce((e,t)=>t.intersectionRatio>=((null==e?void 0:e.intersectionRatio)||0)?t:e,null),r&&r.isIntersecting){const e=r.target.getAttribute("data-category");e!==this.model.get("current_category")&&(this.parentElement.preserve_scroll=!0,this.model.save({current_category:e}))}}insertEmoji(e){e.preventDefault(),e.stopPropagation();const t="IMG"===e.target.nodeName?e.target.parentElement:e.target;this.parentElement.insertIntoTextArea(t.getAttribute("data-emoji"))}shouldBeHidden(e){if(e.includes("_tone")){if(!this.current_skintone||!e.includes(this.current_skintone))return!0}else if(this.current_skintone&&tl.emojis.toned.includes(e))return!0;return!(!this.query||qc.FILTER_CONTAINS(e,this.query))}});const Cg=tl.env.utils;function jg(){const e=Fg(["",""]);return jg=function(){return e},e}function Og(){const e=Fg(['\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 Og=function(){return e},e}function Tg(){const e=Fg(['\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 e},e}function kg(){const e=Fg(['\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 kg=function(){return e},e}function Ng(){const e=Fg(["",""]);return Ng=function(){return e},e}function Ig(){const e=Fg(['<span class="right message-limit" title="','">',"</span>"]);return Ig=function(){return e},e}function Mg(){const e=Fg(['\n <button class="toggle-call" @click=',' title="','">\n <converse-icon class="fa fa-phone" path-prefix="/dist" size="1em"></converse-icon>\n </button>']);return Mg=function(){return e},e}function Rg(){const e=Fg(["<converse-emoji-dropdown .chatview=","></converse-dropdown>"]);return Rg=function(){return e},e}function Dg(){const e=Fg(['<button type="submit" class="btn send-button fa fa-paper-plane" title="','"></button>']);return Dg=function(){return e},e}function Pg(){const e=Fg(['<span class="toolbar-buttons">',"</span>"]);return Pg=function(){return e},e}function Lg(){const e=Fg(["\n ","\n ","\n "]);return Lg=function(){return e},e}function Fg(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Wc.elements.define("converse-emoji-dropdown",class extends Gf{static get properties(){return{chatview:{type:Object}}}constructor(){super(),this.render_emojis=!1}initModel(){return this.init_promise||(this.init_promise=(async()=>{await Wc.emojis.initialize();const e="converse.emoji-".concat(qc.bare_jid,"-").concat(this.chatview.model.get("jid"));this.model=new qc.EmojiPicker({id:e}),this.model.browserStorage=qc.createStore(e),await new Promise(e=>this.model.fetch({success:e,error:e})),this.model.set({autocompleting:null,ac_position:null})})()),this.init_promise}render(){return Ya(Eg(),Td("Insert emojis"),Wc.settings.get("assets_path"),Eh(this.initModel().then(()=>Ya(xg(),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=!1}toggleMenu(e){e.stopPropagation(),e.preventDefault(),Cg.hasClass("show",this.menu)?Cg.ancestor(e.target,".toggle-emojis")&&this.hideMenu():this.showMenu()}async showMenu(){await this.initModel(),this.render_emojis||(this.render_emojis=!0,await this.requestUpdate()),super.showMenu(),setTimeout(()=>{var e;return null===(e=this.querySelector(".emoji-search"))||void 0===e?void 0:e.focus()})}}),Wc.elements.define("converse-emoji-picker",class extends pc{static get properties(){return{chatview:{type:Object},current_category:{type:String,reflect:!0},current_skintone:{type:String,reflect:!0},model:{type:Object},query:{type:String,reflet:!0},render_emojis:{type:Boolean}}}firstUpdated(){this.listenTo(this.model,"change",e=>this.onModelChanged(e.changed)),this.initArrowNavigation()}constructor(){super(),this._search_results=[],this.debouncedFilter=Ic(e=>this.model.set({query:e.value}),250),this.registerEvents()}get search_results(){return this._search_results}set search_results(e){this._search_results=e,this.requestUpdate()}render(){return wg({chatview:this.chatview,current_category:this.current_category,current_skintone:this.current_skintone,model:this.model,onCategoryPicked:e=>this.chooseCategory(e),onSearchInputBlurred:e=>this.chatview.emitFocused(e),onSearchInputFocus:e=>this.onSearchInputFocus(e),onSearchInputKeyDown:e=>this.onKeyDown(e),onSkintonePicked:e=>this.chooseSkinTone(e),query:this.query,search_results:this.search_results,render_emojis:this.render_emojis,sn2Emoji:e=>Cg.shortnamesToEmojis(this.getTonedShortname(e))})}updated(e){e.has("query")&&this.updateSearchResults(e),e.has("current_category")&&this.setScrollPosition()}onModelChanged(e){"current_category"in e&&(this.current_category=e.current_category),"current_skintone"in e&&(this.current_skintone=e.current_skintone),"query"in e&&(this.query=e.query)}setScrollPosition(){if(this.preserve_scroll)return void(this.preserve_scroll=!1);const e=this.querySelector(".emoji-lists__container--browse"),t=this.querySelector("#emoji-picker-".concat(this.current_category));t&&(e.scrollTop=t.offsetTop-3*t.offsetHeight+4)}updateSearchResults(e){const t=e.get("query"),n=qc.FILTER_CONTAINS;if(this.query){if(this.query===t)return this.search_results;t&&this.query.includes(t)?this.search_results=this.search_results.filter(e=>n(e.sn,this.query)):this.search_results=tl.emojis.list.filter(e=>n(e.sn,this.query))}else this.search_results.length&&(this.search_results=[]);this.requestUpdate()}registerEvents(){this.onGlobalKeyDown=e=>this._onGlobalKeyDown(e),document.querySelector("body").addEventListener("keydown",this.onGlobalKeyDown)}connectedCallback(){super.connectedCallback(),this.registerEvents()}disconnectedCallback(){document.querySelector("body").removeEventListener("keydown",this.onGlobalKeyDown),super.disconnectedCallback()}_onGlobalKeyDown(e){this.navigator&&(e.keyCode===tl.keycodes.ENTER&&this.navigator.selected&&Cg.isVisible(this)?this.onEnterPressed(e):e.keyCode===tl.keycodes.DOWN_ARROW&&!this.navigator.enabled&&Cg.isVisible(this)&&this.enableArrowNavigation(e))}setCategoryForElement(e){const t=this.current_category,n=(null==e?void 0:e.getAttribute("data-category"))||t;t!==n&&this.model.save({current_category:n})}insertIntoTextArea(e){this.chatview.onEmojiReceivedFromPicker(e),this.model.set({autocompleting:null,query:"",ac_position:null})}chooseSkinTone(e){e.preventDefault(),e.stopPropagation();const t=("IMG"===e.target.nodeName?e.target.parentElement:e.target).getAttribute("data-skintone").trim();this.current_skintone===t?this.model.save({current_skintone:""}):this.model.save({current_skintone:t})}chooseCategory(e){e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation();const t=e.target.matches("li")?e.target:Cg.ancestor(e.target,"li");this.setCategoryForElement(t),this.navigator.select(t),!this.navigator.enabled&&this.navigator.enable()}onKeyDown(e){if(e.keyCode===tl.keycodes.TAB)if(e.target.value){e.preventDefault();const t=tl.emojis.shortnames.find(t=>qc.FILTER_CONTAINS(t,e.target.value));t&&this.model.set({query:t})}else this.navigator.enabled||this.enableArrowNavigation(e);else e.keyCode!==tl.keycodes.DOWN_ARROW||this.navigator.enabled?e.keyCode===tl.keycodes.ENTER?this.onEnterPressed(e):e.keyCode===tl.keycodes.ESCAPE?(Cg.ancestor(this,"converse-emoji-dropdown").hideMenu(),this.chatview.el.querySelector(".chat-textarea").focus(),e.stopPropagation(),e.preventDefault()):e.keyCode!==tl.keycodes.ENTER&&e.keyCode!==tl.keycodes.DOWN_ARROW&&this.debouncedFilter(e.target):this.enableArrowNavigation(e)}onEnterPressed(e){e.emoji_keypress_handled||(e.preventDefault(),e.stopPropagation(),e.emoji_keypress_handled=!0,tl.emojis.shortnames.includes(e.target.value)?this.insertIntoTextArea(e.target.value):1===this.search_results.length?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(e){this.chatview.emitBlurred(e),this.disableArrowNavigation()}getTonedShortname(e){return tl.emojis.toned.includes(e)&&this.current_skintone?"".concat(e.slice(0,e.length-1),"_").concat(this.current_skintone,":"):e}initArrowNavigation(){if(!this.navigator){const e="li:not(.hidden):not(.emoji-skintone), .emoji-search",t={jump_to_picked:".emoji-category",jump_to_picked_selector:".emoji-category.picked",jump_to_picked_direction:Uf.DIRECTION.down,picked_selector:".picked",scroll_container:this.querySelector(".emoji-picker__lists"),getSelector:t=>{if(t===Uf.DIRECTION.down){const t=this.navigator.selected&&this.navigator.selected.getAttribute("data-category");return t?'ul[data-category="'.concat(t,'"] li:not(.hidden):not(.emoji-skintone), .emoji-search'):e}return e},onSelected:e=>{e.matches(".insert-emoji")&&this.setCategoryForElement(e.parentElement),e.matches(".insert-emoji, .emoji-category")&&e.firstElementChild.focus(),e.matches(".emoji-search")&&e.focus()}};this.navigator=new Uf(this,t)}}disableArrowNavigation(){this.navigator.disable()}enableArrowNavigation(e){var t,n;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),null==e||null===(n=e.stopPropagation)||void 0===n||n.call(e),this.disableArrowNavigation(),this.navigator.enable(),this.navigator.handleKeydown(e)}});const zg=tl.env.Strophe;window.customElements.define("converse-chat-toolbar",class extends pc{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 e=Td("Send the message");return Ya(Lg(),this.show_toolbar?Ya(Pg(),Eh(this.getButtons(),"")):"",this.show_send_button?Ya(Dg(),e):"")}getButtons(){const e=[];if(this.show_emoji_button&&e.push(Ya(Rg(),this.chatview)),this.show_call_button){const t=Td("Start a call");e.push(Ya(Mg(),this.toggleCall,t))}const t=Td("Message characters remaining");Wc.settings.get("message_limit")&&e.push(Ya(Ig(),t,this.message_limit)),this.show_spoiler_button&&e.push(this.getSpoilerButton());const n=Wc.disco.supports(zg.NS.HTTPUPLOAD,qc.domain);if(e.push(Ya(Ng(),Eh(n.then(e=>this.getHTTPUploadButton(e)),""))),this.show_occupants_toggle){const t=Td("Hide participants"),n=Td("Show participants");e.push(Ya(kg(),this.hidden_occupants?n:t,this.toggleOccupants,this.hidden_occupants?"fa-angle-double-left":"fa-angle-double-right",Wc.settings.get("assets_path")))}return qc.api.hook("getToolbarButtons",this,e)}getHTTPUploadButton(e){if(e){const e=Td("Choose a file to send");return Ya(Tg(),e,this.toggleFileUpload,Wc.settings.get("assets_path"),this.onFileSelection)}return""}getSpoilerButton(){const e=this.model;if(!this.is_groupchat&&0===e.presence.resources.length)return;let t;t=this.composing_spoiler?Td("Click to write as a normal (non-spoiler) message"):Td("Click to write your message as a spoiler");const n=Ya(Og(),t,this.toggleComposeSpoilerMessage,this.composing_spoiler?"fa-eye-slash":"fa-eye",Wc.settings.get("assets_path"));if(this.is_groupchat)return n;{const t=e.get("jid"),r=Promise.all(e.presence.resources.map(e=>Wc.disco.supports(zg.NS.SPOILER,"".concat(t,"/").concat(e.get("name"))))).then(e=>e.reduce((e,t)=>e&&t,!0));return Ya(jg(),Eh(r.then(()=>n),""))}}toggleFileUpload(e){var t,n;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),null==e||null===(n=e.stopPropagation)||void 0===n||n.call(e),this.querySelector(".fileupload").click()}onFileSelection(e){this.model.sendFiles(e.target.files)}toggleComposeSpoilerMessage(e){var t,n;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),null==e||null===(n=e.stopPropagation)||void 0===n||n.call(e),this.model.set("composing_spoiler",!this.model.get("composing_spoiler"))}toggleOccupants(e){var t,n;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),null==e||null===(n=e.stopPropagation)||void 0===n||n.call(e),this.model.save({hidden_occupants:!this.model.get("hidden_occupants")})}toggleCall(e){var t,n;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),null==e||null===(n=e.stopPropagation)||void 0===n||n.call(e),Wc.trigger("callButtonClicked",{connection:qc.connection,model:this.model})}});class Bg extends HTMLElement{async connectedCallback(){await Wc.waitUntil("initialized"),tl.insertInto(this)}}function qg(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\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 qg=function(){return e},e}customElements.define("converse-root",Bg);
/**
* @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 Hg=new WeakMap,Ug=Oa(e=>t=>{if(!(t instanceof za))throw new Error("unsafeSVG can only be used in text bindings");const n=Hg.get(t);if(void 0!==n&&Da(e)&&e===n.value&&t.value===n.fragment)return;const r=document.createElement("template");r.innerHTML=`<svg>${e}</svg>`;const i=r.content,o=i.firstChild;i.removeChild(o),pa(i,o.firstChild);const s=document.importNode(i,!0);t.setValue(s),Hg.set(t,{value:e,fragment:s})});function $g(){const e=Gg(["",""]);return $g=function(){return e},e}function Wg(){const e=Gg(["",""]);return Wg=function(){return e},e}function Gg(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Vg(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <div class="converse-chatboxes row no-gutters"></div>\n <div id="converse-modals" class="modals"></div>\n <converse-fontawesome></converse-fontawesome>\n']);return Vg=function(){return e},e}window.customElements.define("converse-fontawesome",class extends pc{constructor(){super();const e=n.e(138).then(n.t.bind(null,548,7));this.data=e.then(e=>Ya(Wg(),Ug(e.default())))}render(){return Ya($g(),Eh(this.data,""))}});var Jg=function(e,t,n){var r=null==e?0:e.length;return r?(t=n||void 0===t?1:di(t),Ao(e,t<0?0:t,r)):[]};var Xg=function(e,t){var n=[];return gs(e,(function(e,r,i){t(e,r,i)&&n.push(e)})),n};var Qg=function(e,t){return(ke(e)?ot:Xg)(e,So(t,3))};var Yg=function(e){return e&&e.length?e[0]:void 0};var Kg=function(e){return"function"==typeof e?e:vr};var Zg=function(e,t){return(ke(e)?ve:gs)(e,Kg(t))};var em=function(e,t){return zr(t,(function(t){return e[t]}))};var tm=function(e){return null==e?[]:em(e,Qe(e))},nm=Math.max;var rm=function(e,t,n,r){e=Xe(e)?e:tm(e),n=n&&!r?di(n):0;var i=e.length;return n<0&&(n=nm(i+n,0)),Zt(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&xs(e,t,n)>-1};var im=function(e){return(null==e?0:e.length)?Ao(e,0,-1):[]};var om=function(e,t){return(ke(e)?zr:Js)(e,So(t,3))};var sm=function(e,t,n){for(var r=-1,i=e.length;++r<i;){var o=e[r],s=t(o);if(null!=s&&(void 0===a?s==s&&!kr(s):n(s,a)))var a=s,c=o}return c};var am=function(e,t){return e>t};var cm=function(e){return e&&e.length?sm(e,vr,am):void 0};var lm=function(e,t){return e<t};var um=function(e){return e&&e.length?sm(e,vr,lm):void 0};var dm=function(e,t,n,r){var i=-1,o=null==e?0:e.length;for(r&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n};var hm=function(e,t,n,r,i){return i(e,(function(e,i,o){n=r?(r=!1,e):t(n,e,i,o)})),n};var fm=function(e,t,n){var r=ke(e)?dm:hm,i=arguments.length<3;return r(e,So(t,4),n,i,gs)};var pm=function(e,t,n,r){var i=null==e?0:e.length;for(r&&i&&(n=e[--i]);i--;)n=t(n,e[i],i,e);return n},gm=Li(!0);var mm=ps((function(e,t){return e&&gm(e,t,Qe)}),!0);var vm=function(e,t,n){var r=ke(e)?pm:hm,i=arguments.length<3;return r(e,So(t,4),n,i,mm)};var _m=function(e){if("function"!=typeof e)throw new TypeError("Expected a function");return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}};var bm=function(e,t){return(ke(e)?ot:Xg)(e,_m(So(t,3)))};var ym=function(e,t){if("function"!=typeof e)throw new TypeError("Expected a function");return t=void 0===t?t:di(t),Ar(e,t)},wm=Math.floor,Sm=Math.random;var xm=function(e,t){return e+wm(Sm()*(t-e+1))};var Em=function(e){var t=e.length;return t?e[xm(0,t-1)]:void 0};var Am=function(e){return Em(tm(e))};var Cm=function(e){return(ke(e)?Em:Am)(e)};var jm=function(e,t){var n=-1,r=e.length,i=r-1;for(t=void 0===t?r:t;++n<t;){var o=xm(n,i),s=e[o];e[o]=e[n],e[n]=s}return e.length=t,e};var Om=function(e){return jm(it(e))};var Tm=function(e){return jm(tm(e))};var km=function(e){return(ke(e)?Om:Tm)(e)},Nm=bo("length"),Im=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var Mm=function(e){return Im.test(e)},Rm="[\\ud800-\\udfff]",Dm="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Pm="\\ud83c[\\udffb-\\udfff]",Lm="[^\\ud800-\\udfff]",Fm="(?:\\ud83c[\\udde6-\\uddff]){2}",zm="[\\ud800-\\udbff][\\udc00-\\udfff]",Bm="(?:"+Dm+"|"+Pm+")"+"?",qm="[\\ufe0e\\ufe0f]?"+Bm+("(?:\\u200d(?:"+[Lm,Fm,zm].join("|")+")[\\ufe0e\\ufe0f]?"+Bm+")*"),Hm="(?:"+[Lm+Dm+"?",Dm,Fm,zm,Rm].join("|")+")",Um=RegExp(Pm+"(?="+Pm+")|"+Hm+qm,"g");var $m=function(e){for(var t=Um.lastIndex=0;Um.test(e);)++t;return t};var Wm=function(e){return Mm(e)?$m(e):Nm(e)};var Gm=function(e){if(null==e)return 0;if(Xe(e))return Zt(e)?Wm(e):e.length;var t=Ot(e);return"[object Map]"==t||"[object Set]"==t?e.size:Je(e).length};var Vm=function(e){var t=null==e?0:e.length;return t?Ao(e,1,t):[]};var Jm=function(e,t,n){return e&&e.length?(t=n||void 0===t?1:di(t),Ao(e,0,t<0?0:t)):[]};var Xm=function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n};var Qm=function(e){return e.split("")},Ym="[\\ud800-\\udfff]",Km="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Zm="[^\\ud800-\\udfff]",ev="(?:\\ud83c[\\udde6-\\uddff]){2}",tv="[\\ud800-\\udbff][\\udc00-\\udfff]",nv="(?:"+Km+"|\\ud83c[\\udffb-\\udfff])"+"?",rv="[\\ufe0e\\ufe0f]?"+nv+("(?:\\u200d(?:"+[Zm,ev,tv].join("|")+")[\\ufe0e\\ufe0f]?"+nv+")*"),iv="(?:"+[Zm+Km+"?",Km,ev,tv,Ym].join("|")+")",ov=RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|"+iv+rv,"g");var sv=function(e){return e.match(ov)||[]};var av=function(e){return Mm(e)?sv(e):Qm(e)},cv=w?w.iterator:void 0;var lv=function(e){if(!e)return[];if(Xe(e))return Zt(e)?av(e):it(e);if(cv&&e[cv])return Xm(e[cv]());var t=Ot(e);return("[object Map]"==t?Yi:"[object Set]"==t?Ki:tm)(e)},uv=Ar((function(e,t){return js(e)?Cs(e,t):[]}));
/*!
* Copyright (c) JC Brand <jc@opkode.com>
*/
const dv=function(e){this.views={},this.keys=()=>Object.keys(this.views),this.getAll=()=>this.views,this.get=e=>this.views[e],this.xget=e=>this.keys().filter(t=>t!==e).reduce((e,t)=>(e[t]=this.views[t],e),{}),this.add=(e,t)=>(this.views[e]=t,t),this.remove=e=>{void 0===e&&(new Wd).remove.apply(this);const t=this.views[e];if(t)return delete this.views[e],t.remove(),t},this.removeAll=()=>(this.keys().forEach(e=>this.remove(e)),this),Wd.apply(this,Array.prototype.slice.apply(arguments))},hv={includes:rm,difference:Os,drop:Jg,every:Ns,filter:Qg,find:ll,first:Yg,forEach:Zg,head:Yg,indexOf:Bs,initial:im,invoke:Rc,isEmpty:ri,last:Eo,lastIndexOf:Ws,map:om,max:cm,min:um,reduce:fm,reduceRight:vm,reject:bm,rest:ym,sample:Cm,shuffle:km,size:Gm,some:Vs,sortBy:Zs,tail:Vm,take:Jm,toArray:lv,without:uv};Object.keys(hv).forEach(e=>{dv.prototype[e]=function(){const t=Array.prototype.slice.call(arguments);return t.unshift(this.views),hv[e].apply(this,t)}}),Object.assign(dv.prototype,Wd.prototype),dv.extend=Wd.extend;const fv=dv.extend({listItems:"model",sortEvent:"change",sortImmediatelyOnAdd:!1,listSelector:".ordered-items",ItemView:void 0,subviewIndex:"id",initialize(){this.sortEventually=Ic(()=>this.sortAndPositionAllItems(),100),this.items=go(this,this.listItems),this.items.on("remove",this.removeView,this),this.items.on("reset",this.removeAll,this),this.items.on("add",(e,t)=>{this.sortImmediatelyOnAdd?this.sortAndPositionAllItems():this.sortEventually()}),this.sortEvent&&this.items.on(this.sortEvent,this.sortEventually,this)},createItemView(e){let t=this.get(e.get(this.subviewIndex));return t?(t.model=e,t.initialize()):(t=new this.ItemView({model:e}),this.add(e.get(this.subviewIndex),t)),t.render(),t},removeView(e){this.remove(e.get(this.subviewIndex))},sortAndPositionAllItems(){if(!this.items.length)return;this.items.sort();const e=this.el.querySelector(this.listSelector),t=document.createElement("div");e.parentNode.replaceChild(t,e),this.items.forEach(t=>{let n=this.get(t.get(this.subviewIndex));n||(n=this.createItemView(t)),e.insertAdjacentElement("beforeend",n.el)}),t.parentNode.replaceChild(e,t)}}),pv=tl.env.utils,gv=Wd.extend({renderAvatar(e){const t=(e=e||this.el).querySelector("canvas.avatar, svg.avatar");if(null!==t&&this.model.vcard){const e={classes:t.getAttribute("class"),width:t.getAttribute("width"),height:t.getAttribute("height"),image_type:this.model.vcard.get("image_type"),image:this.model.vcard.get("image")};t.outerHTML=pv.getElementFromTemplateResult(op(e)).outerHTML}}}),mv=dv.extend({_ensureElement(){if(this.el)this.setElement(Jr(this,"el"),!1);else{let e=qc.root.querySelector("#conversejs");if(null===e){e=document.createElement("div"),e.setAttribute("id","conversejs"),pv.addClass("theme-".concat(Wc.settings.get("theme")),e);const t=qc.root.querySelector("body");t?t.appendChild(e):qc.root.appendChild(e)}this.setElement(e,!1)}},initialize(){this.listenTo(this.model,"destroy",this.removeChat);const e=document.getElementById("conversejs-bg");e&&!e.innerHTML.trim()&&Xa(Ya(qg()),e),document.querySelector("body").classList.add("converse-".concat(Wc.settings.get("view_mode"))),this.el.classList.add("converse-".concat(Wc.settings.get("view_mode"))),Wc.settings.get("singleton")&&this.el.classList.add("converse-singleton"),this.render()},render(){this._ensureElement(),Xa(Ya(Vg()),this.el),this.row_el=this.el.querySelector(".row")},insertRowColumn(e){this.row_el.insertAdjacentElement("afterBegin",e)},removeChat(e){this.remove(e.get("id"))},closeAllChatBoxes(){return Promise.all(this.map(e=>e.close({name:"closeAllChatBoxes"})))}});
/**
* @module converse-chatboxviews
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/function vv(){qc.chatboxviews=new qc.ChatBoxViews({model:qc.chatboxes}),Wc.trigger("chatBoxViewsInitialized")}function _v(){const e=.01*window.innerHeight;document.documentElement.style.setProperty("--vh","".concat(e,"px"))}function bv(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\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 bv=function(){return e},e}tl.plugins.add("converse-chatboxviews",{dependencies:["converse-chatboxes","converse-vcard"],initialize(){Wc.elements.register(),Wc.promises.add(["chatBoxViewsInitialized"]),Wc.settings.extend({animate:!0,theme:"default"}),qc.ViewWithAvatar=gv,qc.ChatBoxViews=mv,Wc.listen.on("chatBoxesInitialized",vv),Wc.listen.on("cleanup",()=>delete qc.chatboxviews),Wc.listen.on("clearSession",()=>qc.chatboxviews.closeAllChatBoxes()),Wc.listen.on("chatBoxViewsInitialized",_v),window.addEventListener("resize",_v),Object.assign(tl,{insertInto(e){var t;const n=null===(t=qc.chatboxviews)||void 0===t?void 0:t.el;if(n&&!e.contains(n))e.insertAdjacentElement("afterBegin",n),Wc.chatviews.get().filter(e=>"controlbox"!==e.model.get("id")).forEach(e=>e.maintainScrollTop());else if(!n)throw new Error("Cannot insert non-existing #conversejs element into the DOM")}})}});var yv=e=>Ya(bv(),e.show_send_button?"chat-content-sendbutton":"",e.markScrolled);function wv(){const e=jv(['<p class="chat-head__desc">',"</p>"]);return wv=function(){return e},e}function Sv(){const e=jv(["<converse-dropdown .items=","></converse-dropdown>"]);return Sv=function(){return e},e}function xv(){const e=jv(['<a href="','" target="_blank" rel="noopener" class="user">',"</a>"]);return xv=function(){return e},e}function Ev(){const e=jv(['<span class="mr-2">',"</span>"]);return Ev=function(){return e},e}function Av(){const e=jv(['<div class="chatbox-navback"><i class="fa fa-arrow-left"></i></div>']);return Av=function(){return e},e}function Cv(){const e=jv(['\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 Cv=function(){return e},e}function jv(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Ov(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <div class="new-msgs-indicator hidden">▼ ',' ▼</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 Ov=function(){return e},e}function Tv(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["\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 Tv=function(){return e},e}function kv(){const e=qv(["<p><label>",":</label> ","</p>"]);return kv=function(){return e},e}function Nv(){const e=qv(["<p><label>",':</label> <a href="mailto:','">',"</a></p>"]);return Nv=function(){return e},e}function Iv(){const e=qv(["<p><label>",':</label> <a target="_blank" rel="noopener" href="','">',"</a></p>"]);return Iv=function(){return e},e}function Mv(){const e=qv(["<p><label>",":</label> ","</p>"]);return Mv=function(){return e},e}function Rv(){const e=qv(["<p><label>",":</label> ","</p>"]);return Rv=function(){return e},e}function Dv(){const e=qv(['<div class="mb-4">',"</div>"]);return Dv=function(){return e},e}function Pv(){const e=qv(['\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 Pv=function(){return e},e}function Lv(){const e=qv(['\n <button type="button" @click="','" class="btn btn-danger remove-contact">\n <i class="far fa-trash-alt"></i>',"\n </button>\n "]);return Lv=function(){return e},e}function Fv(){const e=qv(['<li class="list-group-item"> '," </li>"]);return Fv=function(){return e},e}function zv(){const e=qv(['\n <hr/>\n <ul class="list-group fingerprints">\n <li class="list-group-item active">',"</li>\n ","\n </ul>\n "]);return zv=function(){return e},e}function Bv(){const e=qv(['\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 Bv=function(){return e},e}function qv(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const Hv=e=>{const t=Td("OMEMO Fingerprints"),n=Td("No OMEMO-enabled devices found"),r=e.view.devicelist.devices;return Ya(zv(),t,r.length?r.map(t=>(e=>{const t=Td("Trusted"),n=Td("Untrusted");return e.device.get("bundle")&&e.device.get("bundle").fingerprint?Ya(Bv(),-1!==e.device.get("trusted")?"btn-primary active":"btn-secondary",e.device.get("id"),-1!==e.device.get("trusted"),t,-1!==e.device.get("trusted")?"btn-primary active":"btn-secondary",e.device.get("id"),-1===e.device.get("trusted"),n,e.utils.formatFingerprint(e.device.get("bundle").fingerprint)):""})(Object.assign({device:t},e))):Ya(Fv(),n))};var Uv=e=>{const t=Td("XMPP Address"),n=Td("Email"),r=Td("Full Name"),i=Td("Nickname"),o=Td("The User's Profile Image"),s=Td("Refresh"),a=Td("Role"),c=Td("URL"),l={alt_text:o,extra_classes:"mb-3",height:"120",width:"120"};return Ya(Pv(),e.display_name,ih,e.image?Ya(Dv(),op(Object.assign(e,l))):"",e.fullname?Ya(Rv(),r,e.fullname):"",t,e.jid,e.jid,e.nickname?Ya(Mv(),i,e.nickname):"",e.url?Ya(Iv(),c,e.url,e.url):"",e.email?Ya(Nv(),n,e.email,e.email):"",e.role?Ya(kv(),a,e.role):"",e._converse.pluggable.plugins["converse-omemo"].enabled(e._converse)?Hv(e):"",rh,s,e.allow_contact_removal&&e.is_roster_contact?(e=>{const t=Td("Remove as contact");return Ya(Lv(),e.removeContact,t)})(e):"")};function $v(){const e=Jv(['<a href="#"\n class="dropdown-item ','"\n @click=','\n title="','"><i class="fa ','"></i>',"</a>"]);return $v=function(){return e},e}function Wv(){const e=Jv(['<a href="#"\n class="chatbox-btn '," fa ",'"\n @click=','\n title="','"></a>']);return Wv=function(){return e},e}function Gv(){const e=Jv(["\n <converse-chat-content\n .chatview=","\n .messages=","\n notifications=",">\n </converse-chat-content>"]);return Gv=function(){return e},e}function Vv(){const e=Jv(["<converse-chat-help\n .model=","\n .messages=","\n ?hidden=",'\n type="info"\n chat_type="','"></converse-chat-help>']);return Vv=function(){return e},e}function Jv(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}
/**
* @module converse-chatview
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/const{Strophe:Xv,dayjs:Qv}=tl.env,Yv=tl.env.utils,Kv=Wd.extend({length:200,className:"chatbox hidden",is_chatroom:!1,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",e=>e.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(),Wc.trigger("chatBoxViewInitialized",this)},initDebounced(){this.markScrolled=Ic(this._markScrolled,100),this.debouncedScrollDown=Ic(this.scrollDown,100),Wc.settings.get("debounced_content_rendering")?(this.renderChatHistory=Ic(()=>this.renderChatContent(!1),100),this.renderNotifications=Ic(()=>this.renderChatContent(!0),100)):(this.renderChatHistory=()=>this.renderChatContent(!1),this.renderNotifications=()=>this.renderChatContent(!0))},render(){const e=yv(Object.assign(this.model.toJSON(),{markScrolled:e=>this.markScrolled(e)}));return Xa(e,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(e){this.renderChatHistory(),Yv.isNewMessage(e)&&("me"===e.get("sender")?this.model.set("scrolled",!1):this.model.get("scrolled",!0)&&this.showNewMessagesIndicator())},getNotifications(){return this.model.notifications.get("chat_state")===qc.COMPOSING?Td("%1$s is typing",this.model.getDisplayName()):this.model.notifications.get("chat_state")===qc.PAUSED?Td("%1$s has stopped typing",this.model.getDisplayName()):this.model.notifications.get("chat_state")===qc.GONE?Td("%1$s has gone away",this.model.getDisplayName()):""},getHelpMessages:()=>["<strong>/clear</strong>: ".concat(Td("Remove messages")),"<strong>/close</strong>: ".concat(Td("Close this chat")),"<strong>/me</strong>: ".concat(Td("Write in the third person")),"<strong>/help</strong>: ".concat(Td("Show this menu"))],renderHelpMessages(){Xa(Ya(Vv(),this.model,this.getHelpMessages(),!this.model.get("show_help_messages"),this.model.get("type")),this.help_container)},renderChatContent(e=!1){this.tpl_chat_content||(this.tpl_chat_content=e=>Ya(Gv(),this,e.messages,e.notifications));const t=this.model.messages.models,n=e?t:Array.from(t);Xa(this.tpl_chat_content({messages:n,notifications:this.getNotifications()}),this.msgs_container)},renderToolbar(){if(!Wc.settings.get("show_toolbar"))return this;const e=Object.assign({model:this.model,chatview:this},this.model.toJSON(),this.getToolbarOptions());return Xa((e=>{const t=Wc.settings.get("message_limit"),n=Wc.settings.get("visible_toolbar_buttons").call,r=Wc.settings.get("visible_toolbar_buttons").emoji,i=Wc.settings.get("show_send_button"),o=Wc.settings.get("visible_toolbar_buttons").spoiler,s=Wc.settings.get("show_toolbar");return Ya(Tv(),e.chatview,e.model,e.composing_spoiler,e.hidden_occupants,e.is_groupchat,n,r,e.show_occupants_toggle,i,o,s,t)})(e),this.el.querySelector(".chat-toolbar")),Wc.trigger("renderToolbar",this),this},renderMessageForm(){var e,t;const n=this.el.querySelector(".message-form-container");var r;Xa((r=Object.assign(this.model.toJSON(),{hint_value:null===(e=this.el.querySelector(".spoiler-hint"))||void 0===e?void 0:e.value,label_message:this.model.get("composing_spoiler")?Td("Hidden message"):Td("Message"),label_spoiler_hint:Td("Optional hint"),message_value:null===(t=this.el.querySelector(".chat-textarea"))||void 0===t?void 0:t.value,show_send_button:Wc.settings.get("show_send_button"),show_toolbar:Wc.settings.get("show_toolbar"),unread_msgs:Td("You have unread messages")}),Ya(Ov(),r.unread_msgs,r.label_spoiler_hint||"",r.hint_value||"",r.composing_spoiler?"":"hidden",r.show_send_button?"chat-textarea-send-button":"",r.composing_spoile?"spoiler":"",r.label_message,r.message_value||"")),n),this.el.addEventListener("focusin",e=>this.emitFocused(e)),this.el.addEventListener("focusout",e=>this.emitBlurred(e)),this.renderToolbar()},showControlBox(){var e;null===(e=qc.chatboxviews.get("controlbox"))||void 0===e||e.show(),this.hide()},showUserDetailsModal(e){e.preventDefault(),void 0===this.user_details_modal&&(this.user_details_modal=new qc.UserDetailsModal({model:this.model})),this.user_details_modal.show(e)},onDragOver(e){e.preventDefault()},onDrop(e){0!=e.dataTransfer.files.length&&(e.preventDefault(),this.model.sendFiles(e.dataTransfer.files))},async renderHeading(){const e=await this.generateHeadingTemplate();Xa(e,this.el.querySelector(".chat-head-chatbox"))},async getHeadingStandaloneButton(e){const t=await e;return Ya(Wv(),t.a_class,t.icon_class,t.handler,t.i18n_title)},async getHeadingDropdownItem(e){const t=await e;return Ya($v(),t.a_class,t.handler,t.i18n_title,t.icon_class,t.i18n_text)},async generateHeadingTemplate(){var e;const t=null===(e=this.model)||void 0===e?void 0:e.vcard,n=t?t.toJSON():{},r=await this.getHeadingButtons(),i=r.filter(e=>e.standalone),o=r.filter(e=>!e.standalone);return(e=>{const t={alt_text:Td("The User's Profile Image"),extra_classes:"",height:40,width:40};return Ya(Cv(),e.status?"":"chatbox-title--no-desc",e._converse.api.settings.get("singleton")?"":Ya(Av()),e.type!==e._converse.HEADLINES_TYPE?Ya(Ev(),op(Object.assign({},e,t))):"",e.jid,e.url?Ya(xv(),e.url,e.display_name):e.display_name,e.dropdown_btns.length?Ya(Sv(),e.dropdown_btns):"",e.standalone_btns.length?(e=>e.standalone_btns.reverse().map(e=>Eh(e,"")))(e):"",e.status?Ya(wv(),e.status):"")})(Object.assign(n,this.model.toJSON(),{_converse:qc,dropdown_btns:o.map(e=>this.getHeadingDropdownItem(e)),standalone_btns:i.map(e=>this.getHeadingStandaloneButton(e)),display_name:this.model.getDisplayName()}))},getHeadingButtons(){const e=[{a_class:"show-user-details-modal",handler:e=>this.showUserDetailsModal(e),i18n_text:Td("Details"),i18n_title:Td("See more information about this person"),icon_class:"fa-id-card",name:"details",standalone:"overlayed"===Wc.settings.get("view_mode")}];return Wc.settings.get("singleton")||e.push({a_class:"close-chatbox-button",handler:e=>this.close(e),i18n_text:Td("Close"),i18n_title:Td("Close and end this conversation"),icon_class:"fa-times",name:"close",standalone:"overlayed"===Wc.settings.get("view_mode")}),qc.api.hook("getHeadingButtons",this,e)},getToolbarOptions:()=>({}),maybeScrollDown(e){!(!(null==e?void 0:e.get("is_archived"))&&"me"===(null==e?void 0:e.get("sender")))&&this.model.get("scrolled")||this.model.isHidden()||this.debouncedScrollDown()},scrollDown(e){var t,n;if(null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),null==e||null===(n=e.stopPropagation)||void 0===n||n.call(e),this.model.get("scrolled")&&Yv.safeSave(this.model,{scrolled:!1,scrollTop:null}),this.msgs_container.scrollTo){const e=this.msgs_container.scrollTop?"smooth":"auto";this.msgs_container.scrollTo({top:this.msgs_container.scrollHeight,behavior:e})}else this.msgs_container.scrollTop=this.msgs_container.scrollHeight;this.onScrolledDown()},maintainScrollTop(){const e=this.model.get("scrollTop");e?this.msgs_container.scrollTop=e:this.scrollDown()},insertIntoDOM(){return qc.chatboxviews.insertRowColumn(this.el),Wc.trigger("chatBoxInsertedIntoDOM",this),this},addSpinner(e=!1){if(null===this.el.querySelector(".spinner")){const t=Yv.getElementFromTemplateResult(pp());e?(this.content.insertAdjacentElement("beforeend",t),this.scrollDown()):this.content.insertAdjacentElement("afterbegin",t)}},clearSpinner(){this.content.querySelectorAll(".spinner").forEach(Yv.removeElement)},onStatusMessageChanged(e){this.renderHeading(),Wc.trigger("contactStatusMessageChanged",{contact:e.attributes,message:e.get("status")})},markFollowups(e){const t=e.getAttribute("data-from"),n=e.previousElementSibling,r=Qv(e.getAttribute("data-isodate")),i=e.nextElementSibling;Yv.hasClass("chat-msg--action",e)||Yv.hasClass("chat-msg--action",n)||Yv.hasClass("chat-info",e)||Yv.hasClass("chat-info",n)||n.getAttribute("data-from")!==t||!r.isBefore(Qv(n.getAttribute("data-isodate")).add(10,"minutes"))||e.getAttribute("data-encrypted")!==n.getAttribute("data-encrypted")||Yv.addClass("chat-msg--followup",e),i&&(!Yv.hasClass("chat-msg--action",e)&&Yv.hasClass("chat-info",e)&&i.getAttribute("data-from")===t&&Qv(i.getAttribute("data-isodate")).isBefore(r.add(10,"minutes"))&&e.getAttribute("data-encrypted")===i.getAttribute("data-encrypted")?Yv.addClass("chat-msg--followup",i):Yv.removeClass("chat-msg--followup",i))},parseMessageForCommands(e){const t=e.replace(/^\s*/,"").match(/^\/(.*)\s*$/);if(t){if("clear"===t[1])return this.clearMessages(),!0;if("close"===t[1])return this.close(),!0;if("help"===t[1])return this.model.set({show_help_messages:!0}),!0}},async onFormSubmitted(e){var t;e.preventDefault();const n=this.el.querySelector(".chat-textarea"),r=n.value.trim();if(Wc.settings.get("message_limit")&&r.length>Wc.settings.get("message_limit")||!r.replace(/\s/g,"").length)return;if(!qc.connection.authenticated){const e=Td("Sorry, the connection has been lost, and your message could not be sent");return Wc.alert("error",Td("Error"),e),void Wc.connection.reconnect()}let i,o={};this.model.get("composing_spoiler")&&(o=this.el.querySelector("form.sendXMPPMessage input.spoiler-hint"),i=o.value),Yv.addClass("disabled",n),n.setAttribute("disabled","disabled"),null===(t=this.el.querySelector("converse-emoji-dropdown"))||void 0===t||t.hideMenu();const s=this.parseMessageForCommands(r),a=s?null:await this.model.sendMessage(r,i);(s||a)&&(o.value="",n.value="",Yv.removeClass("correcting",n),n.style.height="auto",this.updateCharCounter(n.value)),a&&Wc.trigger("messageSend",a),"overlayed"===Wc.settings.get("view_mode")&&(this.msgs_container.parentElement.style.display="none"),n.removeAttribute("disabled"),Yv.removeClass("disabled",n),"overlayed"===Wc.settings.get("view_mode")&&(this.msgs_container.parentElement.style.display=""),this.model.setChatState(qc.ACTIVE,{silent:!0}),n.focus()},updateCharCounter(e){if(Wc.settings.get("message_limit")){const t=this.el.querySelector(".message-limit"),n=Wc.settings.get("message_limit")-e.length;t.textContent=n,n<1?Yv.addClass("error",t):Yv.removeClass("error",t)}},onPaste(e){if(0!==e.clipboardData.files.length)return e.preventDefault(),void this.model.sendFiles(Array.from(e.clipboardData.files));this.updateCharCounter(e.clipboardData.getData("text/plain"))},autocompleteInPicker(e,t){const n=this.el.querySelector("converse-emoji-dropdown"),r=this.el.querySelector("converse-emoji-picker");if(r&&n)return r.model.set({ac_position:e.selectionStart,autocompleting:t,query:t}),n.showMenu(),!0},onEmojiReceivedFromPicker(e){const t=this.el.querySelector("converse-emoji-picker").model,n=t.get("autocompleting"),r=t.get("ac_position");this.insertIntoTextArea(e,n,!1,r)},onKeyUp(e){this.updateCharCounter(e.target.value)},onKeyDown(e){if(!e.ctrlKey){if(!e.shiftKey&&!e.altKey&&!e.metaKey)if(e.keyCode===tl.keycodes.TAB){const t=Yv.getCurrentWord(e.target,null,/(:.*?:)/g);t.startsWith(":")&&this.autocompleteInPicker(e.target,t)&&(e.preventDefault(),e.stopPropagation())}else{if(e.keyCode===tl.keycodes.FORWARD_SLASH)return;if(e.keyCode===tl.keycodes.ESCAPE)return this.onEscapePressed(e);if(e.keyCode===tl.keycodes.ENTER)return this.onEnterPressed(e);if(e.keyCode!==tl.keycodes.UP_ARROW||e.target.selectionEnd){if(e.keyCode===tl.keycodes.DOWN_ARROW&&e.target.selectionEnd===e.target.value.length&&Yv.hasClass("correcting",this.el.querySelector(".chat-textarea")))return this.editLaterMessage()}else{const e=this.el.querySelector(".chat-textarea");if(!e.value||Yv.hasClass("correcting",e))return this.editEarlierMessage()}}[tl.keycodes.SHIFT,tl.keycodes.META,tl.keycodes.META_RIGHT,tl.keycodes.ESCAPE,tl.keycodes.ALT].includes(e.keyCode)||this.model.get("chat_state")!==qc.COMPOSING&&this.model.setChatState(qc.COMPOSING)}},getOwnMessages(){return this.model.messages.filter({sender:"me"})},onEnterPressed(e){return this.onFormSubmitted(e)},onEscapePressed(e){e.preventDefault();const t=this.model.messages.findLastIndex("correcting"),n=t>=0?this.model.messages.at(t):null;n&&n.save("correcting",!1),this.insertIntoTextArea("",!0,!1)},async onMessageRetractButtonClicked(e){if("me"!==e.get("sender"))return Pn.error("onMessageRetractButtonClicked called for someone else's message!");const t=Td("Be aware that other XMPP/Jabber clients (and servers) may not yet support retractions and that this message may not be removed everywhere."),n=[Td("Are you sure you want to retract this message?")];Wc.settings.get("show_retraction_warning")&&(n[1]=t),await Wc.confirm(Td("Confirm"),n)&&this.model.retractOwnMessage(e)},onMessageEditButtonClicked(e){var t;const n=this.model.messages.findWhere("correcting"),r=null===(t=this.el.querySelector(".chat-textarea"))||void 0===t?void 0:t.value;(!r||n&&n.get("message")===r||confirm(Td("You have an unsent message which will be lost if you continue. Are you sure?")))&&(n!==e?(null==n||n.save("correcting",!1),e.save("correcting",!0),this.insertIntoTextArea(Yv.prefixMentions(e),!0,!0)):(e.save("correcting",!1),this.insertIntoTextArea("",!0,!1)))},editLaterMessage(){let e,t=this.model.messages.findLastIndex("correcting");if(t>=0)for(this.model.messages.at(t).save("correcting",!1);t<this.model.messages.length-1;){t+=1;const n=this.model.messages.at(t);if(n.get("editable")){e=n;break}}e?(this.insertIntoTextArea(Yv.prefixMentions(e),!0,!0),e.save("correcting",!0)):this.insertIntoTextArea("",!0,!1)},editEarlierMessage(){let e,t=this.model.messages.findLastIndex("correcting");if(t>=0)for(this.model.messages.at(t).save("correcting",!1);t>0;){t-=1;const n=this.model.messages.at(t);if(n.get("editable")){e=n;break}}e=e||this.getOwnMessages().reverse().find(e=>e.get("editable")),e&&(this.insertIntoTextArea(Yv.prefixMentions(e),!0,!0),e.save("correcting",!0))},inputChanged(e){const t=e.target.scrollHeight+"px";e.target.style.height!=t&&(e.target.style.height="auto",e.target.style.height=t)},async clearMessages(e){return e&&e.preventDefault&&e.preventDefault(),!0===confirm(Td("Are you sure you want to clear the messages from this conversation?"))&&await this.model.clearMessages(),this},insertIntoTextArea(e,t=!1,n=!1,r){const i=this.el.querySelector(".chat-textarea");if(n?Yv.addClass("correcting",i):Yv.removeClass("correcting",i),t)i.value=r&&"string"==typeof t?i.value.replace(new RegExp(t,"g"),(n,i)=>i==r-t.length?e+" ":n):e;else{let t=i.value;t&&" "!==t[t.length-1]&&(t+=" "),i.value=t+e+" "}this.updateCharCounter(i.value),Yv.placeCaretAtEnd(i)},onPresenceChanged(e){const t=e.get("show"),n=this.model.getDisplayName();let r;Yv.isVisible(this.el)&&("offline"===t?r=Td("%1$s has gone offline",n):"away"===t?r=Td("%1$s has gone away",n):"dnd"===t?r=Td("%1$s is busy",n):"online"===t&&(r=Td("%1$s is online",n)),r&&this.model.createMessage({message:r,type:"info"}))},async close(e){return e&&e.preventDefault&&e.preventDefault(),qc.router.history.getFragment()==="converse/chat?jid="+this.model.get("jid")&&qc.router.navigate(""),Wc.connection.connected()&&(this.model.setChatState(qc.INACTIVE),this.model.sendChatState()),await this.model.close(),this.remove(),Wc.trigger("chatBoxClosed",this),this},emitBlurred(e){this.el.contains(document.activeElement)||this.el.contains(e.relatedTarget)||Wc.trigger("chatBoxBlurred",this,e)},emitFocused(e){this.el.contains(e.relatedTarget)||Wc.trigger("chatBoxFocused",this,e)},focus(){const e=this.el.getElementsByClassName("chat-textarea")[0];return e&&document.activeElement!==e&&e.focus(),this},maybeFocus(){Wc.settings.get("auto_focus")&&this.focus()},hide(){return this.el.classList.add("hidden"),this},afterShown(){this.model.clearUnreadMsgCounter(),this.model.setChatState(qc.ACTIVE),this.scrollDown(),this.maybeFocus()},show(){this.model.get("hidden")?Pn.debug("Not showing chat ".concat(this.model.get("jid")," because it's set as hidden")):Yv.isVisible(this.el)?this.maybeFocus():Wc.settings.get("animate")?Yv.fadeIn(this.el,()=>this.afterShown()):(Yv.showElement(this.el),this.afterShown())},showNewMessagesIndicator(){Yv.showElement(this.el.querySelector(".new-msgs-indicator"))},hideNewMessagesIndicator(){const e=this.el.querySelector(".new-msgs-indicator");null!==e&&e.classList.add("hidden")},_markScrolled:function(e){let t=!0,n=null;this.msgs_container.scrollTop+this.msgs_container.clientHeight>=this.msgs_container.scrollHeight-62?(t=!1,this.onScrolledDown()):0===this.msgs_container.scrollTop?Wc.trigger("chatBoxScrolledUp",this):n=e.target.scrollTop,Yv.safeSave(this.model,{scrolled:t,scrollTop:n})},viewUnreadMessages(){this.model.save({scrolled:!1,scrollTop:null}),this.scrollDown()},onScrolledDown(){if(this.hideNewMessagesIndicator(),!this.model.isHidden()){this.model.clearUnreadMsgCounter();const e=window.location.hash;e&&this.model.messages.get(e.slice(1))&&qc.router.history.navigate()}Wc.trigger("chatBoxScrolledDown",{chatbox:this.model})},onWindowStateChanged(e){"visible"===e?this.model.isHidden()||this.model.get("num_unread",0)&&this.model.clearUnreadMsgCounter():"hidden"===e&&(this.model.setChatState(qc.INACTIVE,{silent:!0}),this.model.sendChatState())}});let Zv;tl.plugins.add("converse-chatview",{dependencies:["converse-chatboxviews","converse-chat","converse-disco","converse-modal"],initialize(){Wc.settings.extend({auto_focus:!0,debounced_content_rendering:!0,filter_url_query_params:null,image_urls_regex:null,message_limit:0,muc_hats:["xep317"],show_images_inline:!0,show_message_avatar:!0,show_retraction_warning:!0,show_send_button:!0,show_toolbar:!0,time_format:"HH:mm",use_system_emojis:!0,visible_toolbar_buttons:{call:!1,clear:!0,emoji:!0,spoiler:!0}}),qc.ChatBoxView=Kv,qc.UserDetailsModal=mh.extend({id:"user-details-modal",events:{"click button.refresh-contact":"refreshContact","click .fingerprint-trust .btn input":"toggleDeviceTrust"},initialize(){mh.prototype.initialize.apply(this,arguments),this.model.rosterContactAdded.then(()=>this.registerContactEventHandlers()),this.listenTo(this.model,"change",this.render),this.registerContactEventHandlers(),Wc.trigger("userDetailsModalInitialized",this.model)},toHTML(){var e;const t=null===(e=this.model)||void 0===e?void 0:e.vcard,n=t?t.toJSON():{};return Uv(Object.assign(this.model.toJSON(),n,{_converse:qc,allow_contact_removal:Wc.settings.get("allow_contact_removal"),display_name:this.model.getDisplayName(),is_roster_contact:void 0!==this.model.contact,removeContact:e=>this.removeContact(e),view:this,utils:Yv}))},registerContactEventHandlers(){void 0!==this.model.contact&&(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(e){e&&e.preventDefault&&e.preventDefault();const t=this.el.querySelector(".fa-refresh");Yv.addClass("fa-spin",t);try{await Wc.vcard.update(this.model.contact.vcard,!0)}catch(e){Pn.fatal(e),this.alert(Td("Sorry, something went wrong while trying to refresh"),"danger")}Yv.removeClass("fa-spin",t)},removeContact(e){if(e&&e.preventDefault&&e.preventDefault(),!Wc.settings.get("allow_contact_removal"))return;!0===confirm(Td("Are you sure you want to remove this contact?"))&&(this.modal.hide(),setTimeout(()=>{this.model.contact.removeFromRoster(()=>this.model.contact.destroy(),e=>{Pn.error(e),Wc.alert("error",Td("Error"),[Td("Sorry, there was an error while trying to remove %1$s as a contact.",this.model.contact.getDisplayName())])})},1))}}),Wc.listen.on("chatBoxViewsInitialized",()=>{const e=qc.chatboxviews;qc.chatboxes.on("add",async t=>{e.get(t.get("id"))||t.get("type")!==qc.PRIVATE_CHAT_TYPE||(await t.initialized,e.add(t.get("id"),new qc.ChatBoxView({model:t})))})}),Wc.listen.on("windowStateChanged",(function(e){qc.chatboxviews&&qc.chatboxviews.forEach(t=>{"controlbox"!==t.model.get("id")&&t.onWindowStateChanged(e.state)})})),Wc.listen.on("connected",()=>Wc.disco.own.features.add(Xv.NS.SPOILER)),Object.assign(Wc,{chatviews:{get:e=>void 0===e?Object.values(qc.chatboxviews.getAll()):"string"==typeof e?qc.chatboxviews.get(e):e.map(e=>qc.chatboxviews.get(e))}})}});let e_=0;function t_(e){Zv=e}function n_(){Zv=null,e_=0}const r_=Symbol("haunted.phase"),i_=Symbol("haunted.hook"),o_=Symbol("haunted.update"),s_=Symbol("haunted.commit"),a_=Symbol("haunted.effects"),c_=Symbol("haunted.layoutEffects");class l_{constructor(e,t){this.update=e,this.host=t,this[i_]=new Map,this[a_]=[],this[c_]=[]}run(e){t_(this);let t=e();return n_(),t}_runEffects(e){let t=this[e];t_(this);for(let e of t)e.call(this);n_()}runEffects(){this._runEffects(a_)}runLayoutEffects(){this._runEffects(c_)}teardown(){this[i_].forEach(e=>{"function"==typeof e.teardown&&e.teardown()})}}const u_=Promise.resolve().then.bind(Promise.resolve());function d_(){let e,t=[];function n(){e=null;let n=t;t=[];for(var r=0,i=n.length;r<i;r++)n[r]()}return function(r){t.push(r),null==e&&(e=u_(n))}}const h_=d_(),f_=d_();class p_{constructor(e,t){this.renderer=e,this.host=t,this.state=new l_(this.update.bind(this),t),this[r_]=null,this._updateQueued=!1}update(){this._updateQueued||(h_(()=>{let e=this.handlePhase(o_);f_(()=>{this.handlePhase(s_,e),f_(()=>{this.handlePhase(a_)})}),this._updateQueued=!1}),this._updateQueued=!0)}handlePhase(e,t){switch(this[r_]=e,e){case s_:return this.commit(t),void this.runEffects(c_);case o_:return this.render();case a_:return this.runEffects(a_)}this[r_]=null}render(){return this.state.run(()=>this.renderer.call(this.host,this.host))}runEffects(e){this.state._runEffects(e)}teardown(){this.state.teardown()}}function g_(e){class t extends p_{constructor(e,t,n){super(e,n||t),this.frag=t}commit(t){e(t,this.frag)}}return function(e,n,r){const i=(r||n||{}).baseElement||HTMLElement,{observedAttributes:o=[],useShadowDOM:s=!0,shadowRootInit:a={}}=r||n||{};class c extends i{constructor(){super(),!1===s?this._scheduler=new t(e,this):(this.attachShadow({mode:"open",...a}),this._scheduler=new t(e,this.shadowRoot,this))}static get observedAttributes(){return e.observedAttributes||o||[]}connectedCallback(){this._scheduler.update()}disconnectedCallback(){this._scheduler.teardown()}attributeChangedCallback(e,t,n){if(t===n)return;let r=""===n||n;Reflect.set(this,((e="")=>e.replace(/-+([a-z])?/g,(e,t)=>t?t.toUpperCase():""))(e),r)}}const l=new Proxy(i.prototype,{getPrototypeOf:e=>e,set(e,t,n,r){let i;if(t in e){if(i=Object.getOwnPropertyDescriptor(e,t),i&&i.set)return i.set.call(r,n),!0;Reflect.set(e,t,n)}return i="symbol"==typeof t||"_"===t[0]?{enumerable:!0,configurable:!0,writable:!0,value:n}:function(e){let t=e;return Object.freeze({enumerable:!0,configurable:!0,get:()=>t,set(e){t=e,this._scheduler.update()}})}(n),Object.defineProperty(r,t,i),i.set&&i.set.call(r,n),!0}});return Object.setPrototypeOf(c.prototype,l),c}}class m_{constructor(e,t){this.id=e,this.state=t}}function v_(e,...t){let n=e_++,r=Zv[i_],i=r.get(n);return i||(i=new e(n,Zv,...t),r.set(n,i)),i.update(...t)}function __(e){return v_.bind(null,e)}function b_(e){return __(class extends m_{constructor(t,n,r,i){super(t,n),e(n,this)}update(e,t){this.callback=e,this.lastValues=this.values,this.values=t}call(){this.values&&!this.hasChanged()||this.run()}run(){this.teardown(),this._teardown=this.callback.call(this.state)}teardown(){"function"==typeof this._teardown&&this._teardown()}hasChanged(){return!this.lastValues||this.values.some((e,t)=>this.lastValues[t]!==e)}})}function y_(e,t){e[a_].push(t)}b_(y_);const w_=__(class extends m_{constructor(e,t,n){super(e,t),this._updater=this._updater.bind(this),this._ranEffect=!1,this._unsubscribe=null,y_(t,this)}update(e){if(this.state.virtual)throw new Error("can't be used with virtual components");return this.Context!==e&&(this._subscribe(e),this.Context=e),this.value}call(){this._ranEffect||(this._ranEffect=!0,this._unsubscribe&&this._unsubscribe(),this._subscribe(this.Context),this.state.update())}_updater(e){this.value=e,this.state.update()}_subscribe(e){const t={Context:e,callback:this._updater};this.state.host.dispatchEvent(new CustomEvent("haunted.context",{detail:t,bubbles:!0,cancelable:!0,composed:!0}));const{unsubscribe:n,value:r}=t;this.value=n?r:e.defaultValue,this._unsubscribe=n}teardown(){this._unsubscribe&&this._unsubscribe()}});__(class extends m_{constructor(e,t,n,r){super(e,t),this.value=n(),this.values=r}update(e,t){return this.hasChanged(t)&&(this.values=t,this.value=e()),this.value}hasChanged(e=[]){return e.some((e,t)=>this.values[t]!==e)}});b_((function(e,t){e[c_].push(t)})),__(class extends m_{constructor(e,t,n){super(e,t),this.updater=this.updater.bind(this),"function"==typeof n&&(n=n()),this.makeArgs(n)}update(){return this.args}updater(e){if("function"==typeof e){const t=e,[n]=this.args;e=t(n)}this.makeArgs(e),this.state.update()}makeArgs(e){this.args=Object.freeze([e,this.updater])}}),__(class extends m_{constructor(e,t,n,r,i){super(e,t),this.dispatch=this.dispatch.bind(this),this.currentState=void 0!==i?i(r):r}update(e){return this.reducer=e,[this.currentState,this.dispatch]}dispatch(e){this.currentState=this.reducer(this.currentState,e),this.state.update()}});const S_=Array.prototype.includes;const{component:x_,createContext:E_}=function({render:e}){const t=g_(e),n=function(e){return t=>{const n={Provider:class extends HTMLElement{constructor(){super(),this.listeners=new Set,this.addEventListener("haunted.context",this)}disconnectedCallback(){this.removeEventListener("haunted.context",this)}handleEvent(e){const{detail:t}=e;t.Context===n&&(t.value=this.value,t.unsubscribe=this.unsubscribe.bind(this,t.callback),this.listeners.add(t.callback),e.stopPropagation())}unsubscribe(e){this.listeners.delete(e)}set value(e){this._value=e;for(let t of this.listeners)t(e)}get value(){return this._value}},Consumer:e((function({render:e}){return e(w_(n))})),defaultValue:t};return n}}(t);return{component:t,createContext:n}}({render:Xa});!function(){const e=new WeakMap,t=new WeakMap;class n extends p_{constructor(e,t){super(e,t),this.state.virtual=!0}render(){return this.state.run(()=>this.renderer.apply(this.host,this.args))}commit(e){this.host.setValue(e),this.host.commit()}teardown(){super.teardown();let n=t.get(this);e.delete(n)}}}();function A_(){const e=O_(['\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 A_=function(){return e},e}function C_(){const e=O_(['<p class="byline">messaging freedom</p>']);return C_=function(){return e},e}function j_(){const e=O_(['\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 j_=function(){return e},e}function O_(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function T_(){const e=N_(['<a class="chatbox-btn close-chatbox-button fa fa-times"></a>']);return T_=function(){return e},e}function k_(){const e=N_(['\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 k_=function(){return e},e}function N_(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Wc.elements.define("converse-brand-heading",x_(e=>{const t="fullscreen"===Wc.settings.get("view_mode");return Ya(j_(),t?"brand-name-wrapper--fullscreen":"",t?Ya(C_()):"",t?Ya(A_(),e.version_name):"")},{useShadowDOM:!1}));var I_=n(177),M_=n.n(I_);function R_(){const e=H_(['\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 R_=function(){return e},e}function D_(){const e=H_(["<p>","</p>"]);return D_=function(){return e},e}function P_(){const e=H_(['<input class="btn btn-primary login-anon" type="submit" value="','">']);return P_=function(){return e},e}function L_(){const e=H_(["\n ","\n ","\n ","\n "]);return L_=function(){return e},e}function F_(){const e=H_(['\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 F_=function(){return e},e}function z_(){const e=H_(['\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 z_=function(){return e},e}function B_(){const e=H_(['\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 B_=function(){return e},e}function q_(){const e=H_(['\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 q_=function(){return e},e}function H_(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const U_=e=>{const t=Td("Log in"),n=Td("XMPP Address");return Ya(F_(),n,!!Wc.settings.get("auto_focus"),e.placeholder_username,e.authentication!==e.EXTERNAL?(()=>{const e=Td("Password");return Ya(B_(),e,e)})():"",e.show_trust_checkbox?(e=>{const t=Td("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."),n=Td("This is a trusted device");return Ya(q_(),e,n,t)})("off"!==e.show_trust_checkbox):"",t,qc.allow_registration&&!Wc.settings.get("auto_login")&&qc.pluggable.plugins["converse-register"].enabled(qc)?(()=>{const e=Td("Create an account"),t=Td("Don't have a chat account?");return Ya(z_(),t,e)})():"")};var $_=e=>Ya(R_(),e.conn_feedback_subject?e.conn_feedback_class:"hidden",e.conn_feedback_subject,e.conn_feedback_message?"":"hidden",e.conn_feedback_message,"CONNECTING"===qc.CONNECTION_STATUS[e.connection_status]?pp({classes:"hor_centered"}):(e=>{const t=Td("Disconnected"),n=Td("Click here to log in anonymously");return Ya(L_(),e.authentication==e.LOGIN||e.authentication==e.EXTERNAL?U_(e):"",e.authentication==e.ANONYMOUS?Ya(P_(),n):"",e.authentication==e.PREBIND?Ya(D_(),t):"")})(e));function W_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function G_(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}
/**
* @module converse-controlbox
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/const{Strophe:V_,dayjs:J_}=tl.env,X_=tl.env.utils,Q_={Error:"error",Connecting:"info","Connection failure":"error",Authenticating:"info","Authentication failure":"error",Connected:"info",Disconnected:"error",Disconnecting:"warn",Attached:"info",Redirect:"info",Reconnecting:"warn"},Y_={0:"Error",1:"Connecting",2:"Connection failure",3:"Authenticating",4:"Authentication failure",5:"Connected",6:"Disconnected",7:"Disconnecting",8:"Attached",9:"Redirect",10:"Reconnecting"},K_=[0,1,2,3,4,7,10];tl.plugins.add("converse-controlbox",{dependencies:["converse-modal","converse-chatboxes","converse-chat","converse-rosterview","converse-chatview"],enabled:e=>!e.api.settings.get("singleton"),overrides:{ChatBoxes:{model(e,t){const{_converse:n}=this.__super__;return e&&"controlbox"==e.id?new n.ControlBox(e,t):this.__super__.model.apply(this,arguments)}}},initialize(){function e(){const e=new qc.ControlBox({id:"controlbox"});return qc.chatboxes.add(e)}Wc.settings.extend({allow_logout:!0,allow_user_trust_override:!0,default_domain:void 0,locked_domain:void 0,show_controlbox_by_default:!1,sticky_controlbox:!1}),Wc.promises.add("controlBoxInitialized"),qc.ControlBox=qc.ChatBox.extend({defaults(){return{bookmarked:!1,box_id:"controlbox",chat_state:void 0,closed:!Wc.settings.get("show_controlbox_by_default"),num_unread:0,time_opened:this.get("time_opened")||(new Date).getTime(),type:qc.CONTROLBOX_TYPE,url:""}},initialize(){"controlbox"===this.get("id")?this.set({time_opened:J_(0).valueOf()}):qc.ChatBox.prototype.initialize.apply(this,arguments)},validate(e){return e.type===qc.CONTROLBOX_TYPE?"embedded"===Wc.settings.get("view_mode")&&Wc.settings.get("singleton")?"Controlbox not relevant in embedded view mode":void 0:qc.ChatBox.prototype.validate.call(this,e)},maybeShow(e){return e||"controlbox"!==this.get("id")?qc.ChatBox.prototype.maybeShow.call(this,e):this},onReconnection:function(){}}),qc.ControlBoxView=qc.ChatBoxView.extend({tagName:"div",className:"chatbox",id:"controlbox",events:{"click a.close-chatbox-button":"close"},initialize(){void 0===qc.controlboxtoggle&&(qc.controlboxtoggle=new qc.ControlBoxToggle),qc.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(),Wc.trigger("controlBoxInitialized",this)},render(){this.model.get("connected")&&void 0===this.model.get("closed")&&this.model.set("closed",!Wc.settings.get("show_controlbox_by_default"));const e=(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?W_(Object(n),!0).forEach((function(t){G_(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):W_(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({sticky_controlbox:Wc.settings.get("sticky_controlbox")},this.model.toJSON()),Ya(k_(),t.sticky_controlbox?"":Ya(T_())));var t;Xa(e,this.el),this.model.get("closed")?this.hide():this.show();const n=(null==qc?void 0:qc.connection)||{};return n.connected&&n.authenticated&&!n.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 qc.LoginPanel({model:new qc.LoginPanelModel});const e=this.el.querySelector(".controlbox-panes");e.innerHTML="",e.appendChild(this.loginpanel.render().el)}return this.loginpanel.initPopovers(),this},renderControlBoxPane(){this.loginpanel&&(this.loginpanel.remove(),delete this.loginpanel),this.controlbox_pane&&X_.isVisible(this.controlbox_pane.el)||(this.el.classList.remove("logged-out"),this.controlbox_pane=new qc.ControlBoxPane,this.el.querySelector(".controlbox-panes").insertAdjacentElement("afterBegin",this.controlbox_pane.el))},async close(e){if(e&&e.preventDefault&&e.preventDefault(),"closeAllChatBoxes"===(null==e?void 0:e.name)&&(qc.disconnection_cause!==qc.LOGOUT||Wc.settings.get("show_controlbox_by_default")))return;if(Wc.settings.get("sticky_controlbox"))return;const t=(null==qc?void 0:qc.connection)||{};return t.connected&&!t.disconnecting?await new Promise((e,t)=>this.model.save({closed:!0},{success:e,error:t,wait:!0})):this.model.trigger("hide"),Wc.trigger("controlBoxClosed",this),this},ensureClosedState(){this.model.get("closed")?this.hide():this.show()},hide(e){if(!Wc.settings.get("sticky_controlbox"))return X_.addClass("hidden",this.el),Wc.trigger("chatBoxClosed",this),Wc.connection.connected()||qc.controlboxtoggle.render(),qc.controlboxtoggle.show(e),this},onControlBoxToggleHidden(){this.model.set("closed",!1),this.el.classList.remove("hidden"),Wc.trigger("controlBoxOpened",this)},show(){return qc.controlboxtoggle.hide(()=>this.onControlBoxToggleHidden()),this},showHelpMessages(){}}),qc.LoginPanelModel=zo.extend({defaults:{errors:[]}}),qc.LoginPanel=Wd.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(qc.connfeedback,"change",this.render),this.render()},toHTML(){const e=qc.connfeedback.get("connection_status");let t,n;return K_.includes(e)&&(n=Y_[e],t=Q_[n]),$_(Object.assign(this.model.toJSON(),{_converse:qc,ANONYMOUS:qc.ANONYMOUS,EXTERNAL:qc.EXTERNAL,LOGIN:qc.LOGIN,PREBIND:qc.PREBIND,auto_login:Wc.settings.get("auto_login"),authentication:Wc.settings.get("authentication"),connection_status:e,conn_feedback_class:t,conn_feedback_subject:n,conn_feedback_message:qc.connfeedback.get("message"),placeholder_username:(Wc.settings.get("locked_domain")||Wc.settings.get("default_domain"))&&Td("Username")||Td("user@domain"),show_trust_checkbox:Wc.settings.get("allow_user_trust_override")}))},initPopovers(){Array.from(this.el.querySelectorAll("[data-title]")).forEach(e=>{new Kd.a.Popover(e,{trigger:"mobile"===Wc.settings.get("view_mode")?"click":"hover",dismissible:"mobile"===Wc.settings.get("view_mode"),container:this.el.parentElement.parentElement.parentElement})})},validate(){const e=this.el.querySelector("form").querySelector("input[name=jid]");return!e.value||Wc.settings.get("locked_domain")||Wc.settings.get("default_domain")||X_.isValidJID(e.value)?(e.setCustomValidity(""),!0):(e.setCustomValidity(Td("Please enter a valid XMPP address")),!1)},authenticate(e){if(e&&e.preventDefault&&e.preventDefault(),Wc.settings.get("authentication")===qc.ANONYMOUS)return this.connect(qc.jid,null);if(!this.validate())return;const t=new FormData(e.target);qc.config.save({trusted:!!t.get("trusted")});let n=t.get("jid");if(Wc.settings.get("locked_domain")){const e="@"+Wc.settings.get("locked_domain");n.endsWith(e)&&(n=n.substr(0,n.length-e.length)),n=V_.escapeNode(n)+e}else Wc.settings.get("default_domain")&&!n.includes("@")&&(n=n+"@"+Wc.settings.get("default_domain"));this.connect(n,t.get("password"))},connect(e,t){["converse/login","converse/register"].includes(qc.router.history.getFragment())&&qc.router.navigate("",{replace:!0}),qc.connection&&qc.connection.reset(),Wc.user.login(e,t)}}),qc.ControlBoxPane=Wd.extend({tagName:"div",className:"controlbox-pane",initialize(){Wc.trigger("controlBoxPaneInitialized",this)}}),qc.ControlBoxToggle=Wd.extend({tagName:"a",className:"toggle-controlbox hidden",id:"toggle-controlbox",events:{click:"onClick"},attributes:{href:"#"},initialize(){qc.chatboxviews.insertRowColumn(this.render().el),Wc.waitUntil("initialized").then(this.render.bind(this)).catch(e=>Pn.fatal(e))},render(){return this.el.innerHTML=M_()({label_toggle:Wc.connection.connected()?Td("Chat Contacts"):Td("Toggle chat")}),this},hide(e){X_.isVisible(this.el)&&(X_.hideElement(this.el),e())},show(e){X_.isVisible(this.el)||X_.fadeIn(this.el,e)},showControlBox(){let t=qc.chatboxes.get("controlbox");t||(t=e()),Wc.connection.connected()?t.save({closed:!1}):t.trigger("show")},onClick(e){if(e.preventDefault(),X_.isVisible(qc.root.querySelector("#controlbox"))){const e=qc.chatboxes.get("controlbox");Wc.connection.connected?e.save({closed:!0}):e.trigger("hide")}else this.showControlBox()}}),Wc.listen.on("cleanup",()=>delete qc.controlboxtoggle),Wc.listen.on("chatBoxViewsInitialized",()=>{qc.chatboxes.on("add",e=>{if(e.get("type")===qc.CONTROLBOX_TYPE){const t=qc.chatboxviews,n=t.get(e.get("id"));n?(n.model=e,n.initialize()):t.add(e.get("id"),new qc.ControlBoxView({model:e}))}})}),Wc.listen.on("clearSession",()=>{const e=null==qc?void 0:qc.chatboxviews,t=e&&e.get("controlbox");t&&(X_.safeSave(t.model,{connected:!1}),(null==t?void 0:t.controlbox_pane)&&(t.controlbox_pane.remove(),delete t.controlbox_pane))}),Wc.waitUntil("chatBoxViewsInitialized").then(e).catch(e=>Pn.fatal(e)),Wc.listen.on("chatBoxesFetched",()=>{(qc.chatboxes.get("controlbox")||e()).save({connected:!0})});const t=function(){const e=qc.chatboxviews.get("controlbox");return e.model.set({connected:!1}),e};Wc.listen.on("disconnected",()=>t().renderLoginPanel()),Wc.listen.on("will-reconnect",t),Object.assign(Wc,{controlbox:{async open(){await Wc.waitUntil("chatBoxesFetched");const e=await Wc.chatboxes.get("controlbox")||Wc.chatboxes.create("controlbox",{},qc.Controlbox);return e.trigger("show"),e},get:()=>qc.chatboxviews.get("controlbox")}})}});var Z_=n(178),eb=n.n(Z_);
/**
* @module converse-dragresize
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const tb=tl.env.utils;function nb(e,t){const n=t.el.querySelector(".box-flyout"),r=document.createElement("div");r.innerHTML=eb()(),n.insertBefore(r,n.firstChild)}function rb(){const e=ob(['<span class="message-count badge badge-light">',"</span>"]);return rb=function(){return e},e}function ib(){const e=ob(['\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 ib=function(){return e},e}function ob(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}tl.plugins.add("converse-dragresize",{dependencies:["converse-chatview","converse-headlines-view","converse-muc-views"],enabled:e=>"overlayed"==e.api.settings.get("view_mode"),overrides:{ChatBox:{initialize(){const e=this.__super__.initialize.apply(this,arguments),t=this.get("height"),n=this.get("width");return("controlbox"===this.get("id")?e=>this.set(e):e=>this.save(e))({height:tb.applyDragResistance(t,this.get("default_height")),width:tb.applyDragResistance(n,this.get("default_width"))}),e}},ChatBoxView:{events:{"mousedown .dragresize-top":"onStartVerticalResize","mousedown .dragresize-left":"onStartHorizontalResize","mousedown .dragresize-topleft":"onStartDiagonalResize"},render(){const e=this.__super__.render.apply(this,arguments);return nb(this.__super__._converse,this),this.setWidth(),e}},HeadlinesBoxView:{events:{"mousedown .dragresize-top":"onStartVerticalResize","mousedown .dragresize-left":"onStartHorizontalResize","mousedown .dragresize-topleft":"onStartDiagonalResize"},render(){const e=this.__super__.render.apply(this,arguments);return nb(this.__super__._converse,this),this.setWidth(),e}},ControlBoxView:{events:{"mousedown .dragresize-top":"onStartVerticalResize","mousedown .dragresize-left":"onStartHorizontalResize","mousedown .dragresize-topleft":"onStartDiagonalResize"},render(){const e=this.__super__.render.apply(this,arguments);return nb(this.__super__._converse,this),this.setWidth(),e},renderLoginPanel(){const e=this.__super__.renderLoginPanel.apply(this,arguments);return this.initDragResize().setDimensions(),e},renderControlBoxPane(){const e=this.__super__.renderControlBoxPane.apply(this,arguments);return this.initDragResize().setDimensions(),e}},ChatRoomView:{events:{"mousedown .dragresize-top":"onStartVerticalResize","mousedown .dragresize-left":"onStartHorizontalResize","mousedown .dragresize-topleft":"onStartDiagonalResize"},render(){const e=this.__super__.render.apply(this,arguments);return nb(this.__super__._converse,this),this.setWidth(),e}}},initialize(){Wc.settings.extend({allow_dragresize:!0});const e={initDragResize(){var e;const t=this,n=Ic(()=>t.setDimensions());window.addEventListener("resize",t.debouncedSetDimensions),this.listenTo(this.model,"destroy",()=>window.removeEventListener("resize",n));const r=this.el.querySelector(".box-flyout"),i=window.getComputedStyle(r);if(void 0===this.model.get("height")){const e=parseInt(i.height.replace(/px$/,""),10),t=parseInt(i.width.replace(/px$/,""),10);this.model.set("height",e),this.model.set("default_height",e),this.model.set("width",t),this.model.set("default_width",t)}const o=i["min-width"],s=i["min-height"];return this.model.set("min_width",o.endsWith("px")?Number(o.replace(/px$/,"")):0),this.model.set("min_height",s.endsWith("px")?Number(s.replace(/px$/,"")):0),this.prev_pageY=0,this.prev_pageX=0,(null===(e=qc.connection)||void 0===e?void 0:e.connected)&&(this.height=this.model.get("height"),this.width=this.model.get("width")),this},resizeChatBox(e){let t;0===qc.resizing.direction.indexOf("top")&&(t=e.pageY-this.prev_pageY,t&&(this.height=this.height-t>(this.model.get("min_height")||0)?this.height-t:this.model.get("min_height"),this.prev_pageY=e.pageY,this.setChatBoxHeight(this.height))),qc.resizing.direction.includes("left")&&(t=this.prev_pageX-e.pageX,t&&(this.width=this.width+t>(this.model.get("min_width")||0)?this.width+t:this.model.get("min_width"),this.prev_pageX=e.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(e){e=e?tb.applyDragResistance(e,this.model.get("default_height"))+"px":"";const t=this.el.querySelector(".box-flyout");null!==t&&(t.style.height=e)},setChatBoxWidth(e){e=e?tb.applyDragResistance(e,this.model.get("default_width"))+"px":"",this.el.style.width=e;const t=this.el.querySelector(".box-flyout");null!==t&&(t.style.width=e)},adjustToViewport(){const e=Math.max(document.documentElement.clientWidth,window.innerWidth||0),t=Math.max(document.documentElement.clientHeight,window.innerHeight||0);e<=480?(this.model.set("height",void 0),this.model.set("width",void 0)):e<=this.model.get("width")?this.model.set("width",void 0):t<=this.model.get("height")&&this.model.set("height",void 0)},onStartVerticalResize(e,t=!0){if(!Wc.settings.get("allow_dragresize"))return!0;e.preventDefault();const n=this.el.querySelector(".box-flyout"),r=window.getComputedStyle(n);this.height=parseInt(r.height.replace(/px$/,""),10),qc.resizing={chatbox:this,direction:"top"},this.prev_pageY=e.pageY,t&&Wc.trigger("startVerticalResize",this)},onStartHorizontalResize(e,t=!0){if(!Wc.settings.get("allow_dragresize"))return!0;e.preventDefault();const n=this.el.querySelector(".box-flyout"),r=window.getComputedStyle(n);this.width=parseInt(r.width.replace(/px$/,""),10),qc.resizing={chatbox:this,direction:"left"},this.prev_pageX=e.pageX,t&&Wc.trigger("startHorizontalResize",this)},onStartDiagonalResize(e){this.onStartHorizontalResize(e,!1),this.onStartVerticalResize(e,!1),qc.resizing.direction="topleft",Wc.trigger("startDiagonalResize",this)}};function t(e){if(!qc.resizing||!Wc.settings.get("allow_dragresize"))return!0;e.preventDefault(),qc.resizing.chatbox.resizeChatBox(e)}function n(e){if(!qc.resizing||!Wc.settings.get("allow_dragresize"))return!0;e.preventDefault();const t=tb.applyDragResistance(qc.resizing.chatbox.height,qc.resizing.chatbox.model.get("default_height")),n=tb.applyDragResistance(qc.resizing.chatbox.width,qc.resizing.chatbox.model.get("default_width"));Wc.connection.connected()?(qc.resizing.chatbox.model.save({height:t}),qc.resizing.chatbox.model.save({width:n})):(qc.resizing.chatbox.model.set({height:t}),qc.resizing.chatbox.model.set({width:n})),qc.resizing=null}Object.assign(qc.ChatBoxView.prototype,e),tb.applyDragResistance=function(e,t){if(void 0===e)return;if(void 0===t)return e;return e!==t&&Math.abs(e-t)<10?t:e},Wc.listen.on("registeredGlobalEventHandlers",(function(){document.addEventListener("mousemove",t),document.addEventListener("mouseup",n)})),Wc.listen.on("unregisteredGlobalEventHandlers",(function(){document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",n)})),Wc.listen.on("beforeShowingChatView",e=>e.initDragResize().setDimensions())}}),
/**
* @module converse-singleton
* @copyright JC Brand
* @license Mozilla Public License (MPLv2)
* @description A plugin which restricts Converse to only one chat.
*/
tl.plugins.add("converse-singleton",{enabled:e=>e.api.settings.get("singleton"),initialize(){if(Wc.settings.extend({allow_logout:!1,allow_muc_invitations:!1,hide_muc_server:!0}),!Array.isArray(Wc.settings.get("auto_join_rooms"))&&!Array.isArray(Wc.settings.get("auto_join_private_chats")))throw new Error("converse-singleton: auto_join_rooms must be an Array");if(Wc.settings.get("auto_join_rooms").length>1||Wc.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.")}}),
/**
* @module converse-fullscreen
* @license Mozilla Public License (MPLv2)
* @copyright 2020, the Converse.js contributors
*/
tl.plugins.add("converse-fullscreen",{enabled:e=>e.isUniView(),initialize(){Wc.settings.extend({chatview_avatar_height:50,chatview_avatar_width:50,hide_open_bookmarks:!0,show_controlbox_by_default:!0,sticky_controlbox:!0})}}),
/**
* @module converse-mam-views
* @description
* Views for XEP-0313 Message Archive Management
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
tl.plugins.add("converse-mam-views",{dependencies:["converse-mam","converse-chatview","converse-muc-views"],initialize(){Wc.listen.on("chatBoxScrolledUp",async e=>{if(e.model.messages.length){const t=e.model.get("type")===qc.CHATROOMS_TYPE,n=e.model.getOldestMessage();if(n){const r=t?e.model.get("jid"):qc.bare_jid,i=n&&n.get("stanza_id ".concat(r));e.addSpinner(),i?await e.model.fetchArchivedMessages({before:i}):await e.model.fetchArchivedMessages({end:n.get("time")}),e.clearSpinner(),qc.router.history.navigate("#".concat(n.get("msgid")))}}})}});function sb(){const e=cb(["<converse-minimized-chat\n .model=","\n title=","\n type=","\n num_unread=","></converse-minimized-chat>"]);return sb=function(){return e},e}function ab(){const e=cb(['<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 ab=function(){return e},e}function cb(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Wc.elements.define("converse-minimized-chat",class extends pc{static get properties(){return{model:{type:Object},title:{type:String},type:{type:String},num_unread:{type:Number}}}render(){return(e=>{const t=Td("Click to restore this chat");return Ya(ib(),e.type,t,e.restore,e.num_unread?Ya(rb(),e.num_unread):"",e.title,e.close)})({close:e=>this.close(e),num_unread:this.num_unread,restore:e=>this.restore(e),title:this.title,type:this.type})}close(e){null==e||e.preventDefault();const t=qc.chatboxviews.get(this.model.get("id"));t?t.close():(this.model.destroy(),Wc.trigger("chatBoxClosed",this))}restore(e){null==e||e.preventDefault(),this.model.maximize()}});
/**
* @module converse-minimize
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const{dayjs:lb}=tl.env,ub=tl.env.utils;function db(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\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="','"\n autocomplete="off"\n @keydown=',"\n @keyup=",'\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 ']);return db=function(){return e},e}tl.plugins.add("converse-minimize",{dependencies:["converse-chatview","converse-controlbox","converse-muc-views","converse-headlines-view","converse-dragresize"],enabled:e=>"overlayed"===e.api.settings.get("view_mode"),overrides:{ChatBox:{initialize(){this.__super__.initialize.apply(this,arguments),this.on("show",this.maximize,this),"controlbox"!==this.get("id")&&this.save({minimized:this.get("minimized")||!1,time_minimized:this.get("time_minimized")||lb()})},maybeShow(e){return!e&&this.get("minimized")?this:this.__super__.maybeShow.apply(this,arguments)},isHidden(){return this.__super__.isHidden.call(this)||this.get("minimized")}},ChatBoxView:{show(){const{_converse:e}=this.__super__;return"overlayed"===e.api.settings.get("view_mode")&&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(e){if(!this.model.get("minimized"))return this.__super__.setChatBoxHeight.call(this,e)},setChatBoxWidth(e){if(!this.model.get("minimized"))return this.__super__.setChatBoxWidth.call(this,e)}}},initialize(){Wc.settings.extend({no_trimming:!1});const e={maximize(){ub.safeSave(this,{minimized:!1,time_opened:(new Date).getTime()})},minimize(){ub.safeSave(this,{minimized:!0,time_minimized:(new Date).toISOString()})}};Object.assign(qc.ChatBox.prototype,e);const t={onMaximized(){const{_converse:e}=this.__super__;return this.insertIntoDOM(),this.model.isScrolledUp()||this.model.clearUnreadMsgCounter(),this.model.setChatState(e.ACTIVE),this.show(),Wc.trigger("chatBoxMaximized",this),this},onMinimized(e){const{_converse:t}=this.__super__;return e&&e.preventDefault&&e.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(t.INACTIVE),this.hide(),Wc.trigger("chatBoxMinimized",this),this},minimize(e){return e&&e.preventDefault&&e.preventDefault(),this.model.minimize(),this},onMinimizedChanged(e){e.get("minimized")?this.onMinimized():this.onMaximized()}};Object.assign(qc.ChatBoxView.prototype,t);const n={getChatBoxWidth(e){if("controlbox"===e.model.get("id")){const e=this.get("controlbox");return e&&ub.isVisible(e.el)?ub.getOuterWidth(e.el,!0):ub.getOuterWidth(qc.controlboxtoggle.el,!0)}return!e.model.get("minimized")&&ub.isVisible(e.el)?ub.getOuterWidth(e.el,!0):0},getShownChats(){return this.filter(e=>!e.model.get("minimized")&&!e.model.get("closed")&&ub.isVisible(e.el))},getMinimizedWidth(){var e;const t=null===(e=qc.minimized_chats)||void 0===e?void 0:e.el;return this.model.pluck("minimized").includes(!0)?ub.getOuterWidth(t,!0):0},getBoxesWidth(e){const t=e?e.model.get("id"):null,n=e?ub.getOuterWidth(e.el,!0):0;return Object.values(this.xget(t)).reduce((e,t)=>e+this.getChatBoxWidth(t),n)},async trimChats(e){var t;if(Wc.settings.get("no_trimming")||!Wc.connection.connected()||"overlayed"!==Wc.settings.get("view_mode"))return;const n=this.getShownChats();if(n.length<=1)return;const r=ub.getOuterWidth(document.querySelector("body"),!0);if(this.getChatBoxWidth(n[0])!==r&&(await Wc.waitUntil("minimizedChatsInitialized"),null===(t=qc.minimized_chats)||void 0===t?void 0:t.el))for(;this.getMinimizedWidth()+this.getBoxesWidth(e)>r;){const t=e?e.model.get("id"):null,n=this.getOldestMaximizedChat([t]);if(!n)break;{const e=this.get(n.get("id"));e&&e.hide(),n.minimize()}}},getOldestMaximizedChat(e){e.push("controlbox");let t=0,n=this.model.sort().at(t);for(;e.includes(n.get("id"))||!0===n.get("minimized");)if(t++,n=this.model.at(t),!n)return null;return n}};Object.assign(qc.ChatBoxViews.prototype,n),Wc.promises.add("minimizedChatsInitialized"),qc.MinimizedChatsToggle=zo.extend({defaults:{collapsed:!1}}),qc.MinimizedChats=Wd.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 e=this.model.where({minimized:!0}),t=e.reduce((e,t)=>e+t.get("num_unread"),0),n=e.reduce((e,t)=>e+(t.get("minimized")?1:0),0),r={chats:e,num_unread:t,num_minimized:n,collapsed:this.minchats.get("collapsed")};var i;r.toggle=e=>this.toggle(e),Xa((i=r,Ya(ab(),i.chats.length?"":"hidden",i.toggle,i.num_minimized,Td("Minimized"),i.num_unread?"":"unread-message-count-hidden",i.num_unread,i.collapsed?"hidden":"",i.chats.map(e=>Ya(sb(),e,e.getDisplayName(),e.get("type"),e.get("num_unread"))))),this.el),this.el.parentElement||qc.chatboxviews.insertRowColumn(this.el)},async initToggle(){const e="converse.minchatstoggle-".concat(qc.bare_jid);this.minchats=new qc.MinimizedChatsToggle({id:e}),this.minchats.browserStorage=qc.createStore(e),await new Promise(e=>this.minchats.fetch({success:e,error:e}))},toggle(e){null==e||e.preventDefault(),this.minchats.save({collapsed:!this.minchats.get("collapsed")})}}),Wc.listen.on("chatBoxInsertedIntoDOM",e=>qc.chatboxviews.trimChats(e)),Wc.listen.on("connected",()=>{return null===(e=qc.minimized_chats)||void 0===e||e.remove(),qc.minimized_chats=new qc.MinimizedChats({model:qc.chatboxes}),void Wc.trigger("minimizedChatsInitialized");var e}),Wc.listen.on("controlBoxOpened",e=>qc.chatboxviews.trimChats(e)),Wc.listen.on("chatBoxViewInitialized",e=>e.listenTo(e.model,"change:minimized",e.onMinimizedChanged)),Wc.listen.on("chatRoomViewInitialized",e=>{e.listenTo(e.model,"change:minimized",e.onMinimizedChanged),e.model.get("minimized")&&e.hide()}),Wc.listen.on("getHeadingButtons",(e,t)=>e.model.get("type")===qc.CHATROOMS_TYPE?function(e,t){const n={a_class:"toggle-chatbox-button",handler:t=>e.minimize(t),i18n_text:Td("Minimize"),i18n_title:Td("Minimize this groupchat"),icon_class:"fa-minus",name:"minimize",standalone:"overlayed"===qc.api.settings.get("view_mode")},r=t.map(e=>e.name).indexOf("signout");return r>-1?[...t.slice(0,r),n,...t.slice(r)]:[n,...t]}(e,t):function(e,t){const n={a_class:"toggle-chatbox-button",handler:t=>e.minimize(t),i18n_text:Td("Minimize"),i18n_title:Td("Minimize this chat"),icon_class:"fa-minus",name:"minimize",standalone:"overlayed"===qc.api.settings.get("view_mode")},r=t.map(e=>e.name).indexOf("close");return r>-1?[...t.slice(0,r),n,...t.slice(r)]:[n,...t]}(e,t));const r=Ic(()=>qc.chatboxviews.trimChats(),250);Wc.listen.on("registeredGlobalEventHandlers",()=>window.addEventListener("resize",r)),Wc.listen.on("unregisteredGlobalEventHandlers",()=>window.removeEventListener("resize",r))}});function hb(){const e=_b(['<span class="badge badge-secondary">',"</span>"]);return hb=function(){return e},e}function fb(){const e=_b(['<span class="badge badge-info">',"</span>"]);return fb=function(){return e},e}function pb(){const e=_b(['<span class="badge badge-info">',"</span>"]);return pb=function(){return e},e}function gb(){const e=_b(['<span class="badge badge-info">',"</span>"]);return gb=function(){return e},e}function mb(){const e=_b(['<span class="badge badge-groupchat">',"</span>"]);return mb=function(){return e},e}function vb(){const e=_b(['\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 vb=function(){return e},e}function _b(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Wc.elements.define("converse-autocomplete",class extends pc{static get properties(){return{getAutoCompleteList:{type:Function},auto_evaluate:{type:Boolean},auto_first:{type:Boolean},filter:{type:String},include_triggers:{type:String},min_chars:{type:Number},name:{type:String},placeholder:{type:String},triggers:{type:String}}}constructor(){super(),this.auto_evaluate=!0,this.auto_first=!1,this.filter="contains",this.include_triggers="",this.match_current_word=!1,this.max_items=10,this.min_chars=1,this.triggers=""}render(){return Ya(db(),this.name,this.onKeyDown,this.onKeyUp,this.placeholder)}firstUpdated(){this.auto_complete=new Fd(this.firstElementChild,{ac_triggers:this.triggers.split(" "),auto_evaluate:this.auto_evaluate,auto_first:this.auto_first,filter:"contains"==this.filter?Id:Md,include_triggers:[],list:()=>this.getAutoCompleteList(),match_current_word:!0,max_items:this.max_items,min_chars:this.min_chars}),this.auto_complete.on("suggestion-box-selectcomplete",()=>this.auto_completing=!1)}onKeyDown(e){this.auto_complete.onKeyDown(e)}onKeyUp(e){this.auto_complete.evaluate(e)}});var bb=e=>{const t=Td("Owner"),n=Td("Admin"),r=Td("Member"),i=Td("Moderator"),o=Td("Visitor");return Ya(vb(),e.id,(e=>{const t=Td("This user is a moderator."),n=Td("This user can send messages in this groupchat."),r=Td("This user can NOT send messages in this groupchat."),i="".concat(e.jid," ")||!1;return"moderator"===e.role?"".concat(i).concat(t," ").concat(e.hint_occupant):"participant"===e.role?"".concat(i).concat(n," ").concat(e.hint_occupant):"visitor"===e.role?"".concat(i).concat(r," ").concat(e.hint_occupant):["visitor","participant","moderator"].includes(e.role)?void 0:"".concat(i).concat(e.hint_occupant)})(e),e.show,e.hint_show,e.nick||e.jid,"owner"===e.affiliation?Ya(mb(),t):"","admin"===e.affiliation?Ya(gb(),n):"","member"===e.affiliation?Ya(pb(),r):"","moderator"===e.role?Ya(fb(),i):"","visitor"===e.role?Ya(hb(),o):"")};function yb(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\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 yb=function(){return e},e}const wb={offline:"Offline",unavailable:"Unavailable",xa:"Extended Away",away:"Away",dnd:"Do not disturb",chat:"Chattty",online:"Online"};const Sb=tl.env.utils;function xb(){const e=jb(['<div class="form-group">',"</div>"]);return xb=function(){return e},e}function Eb(){const e=jb(['<label class="roomid-policy-error">',"</label>"]);return Eb=function(){return e},e}function Ab(){const e=jb(['\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 Ab=function(){return e},e}function Cb(){const e=jb(['\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 Cb=function(){return e},e}function jb(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Wc.elements.define("converse-muc-sidebar",class extends pc{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(e=>{const t=e=>Td("Click to mention %1$s in your message.",e.get("nick")),n=Td("Participants"),r=e.occupants.map(e=>bb(Object.assign({jid:"",hint_show:wb[e.get("show")],hint_occupant:t(e)},e.toJSON())));return Ya(yb(),n,r)})(Object.assign(this.chatroom.toJSON(),{occupants:[...this.occupants.models]}))}shouldShow(){return!this.chatroom.get("hidden_occupants")&&this.chatroom.session.get("connection_status")===tl.ROOMSTATUS.ENTERED}setVisibility(){this.shouldShow()?Sb.showElement(this):Sb.hideElement(this)}});var Ob=e=>{const t=Td("Join"),n=Td("Enter a new Groupchat");return Ya(Ab(),n,ih,e.label_room_address,e.muc_roomid_policy_error_msg?Ya(Eb(),e.muc_roomid_policy_error_msg):"",e.chatroom_placeholder,e.muc_roomid_policy_hint?Ya(xb(),Zp(Yp.a.filterXSS(e.muc_roomid_policy_hint,{whiteList:{b:[],br:[],em:[]}}))):"",e._converse.locked_muc_nickname?"":(e=>{const t=Td("Nickname"),n=Td("This field is required");return Ya(Cb(),t,n,e.nick||"")})(e),t||"",e.muc_roomid_policy_error_msg)},Tb=n(23);const kb=tl.env.utils;var Nb=mh.extend({id:"add-chatroom-modal",events:{"submit form.add-chatroom":"openChatRoom","keyup .roomjid-input":"checkRoomidPolicy","change .roomjid-input":"checkRoomidPolicy"},initialize(){mh.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change:muc_domain",this.render),this.muc_roomid_policy_error_msg=null},toHTML(){let e="";if(!Wc.settings.get("locked_muc_domain")){const t=this.model.get("muc_domain")||Wc.settings.get("muc_domain");e=t?"name@".concat(t):Td("name@conference.example.org")}return Ob(Object.assign(this.model.toJSON(),{_converse:qc,label_room_address:Wc.settings.get("muc_domain")?Td("Groupchat name"):Td("Groupchat address"),chatroom_placeholder:e,muc_roomid_policy_error_msg:this.muc_roomid_policy_error_msg,muc_roomid_policy_hint:Wc.settings.get("muc_roomid_policy_hint")}))},afterRender(){this.el.addEventListener("shown.bs.modal",()=>{this.el.querySelector('input[name="chatroom"]').focus()},!1)},parseRoomDataFromEvent(e){const t=new FormData(e),n=t.get("chatroom");let r;if(Wc.settings.get("locked_muc_nickname")){if(r=qc.getDefaultMUCNickname(),!r)throw new Error("Using locked_muc_nickname but no nickname found!")}else r=t.get("nickname").trim();return{jid:n,nick:r}},openChatRoom(e){e.preventDefault();const t=this.parseRoomDataFromEvent(e.target);let n;""===t.nick&&(t.nick=void 0),Wc.settings.get("locked_muc_domain")||Wc.settings.get("muc_domain")&&!kb.isValidJID(t.jid)?n="".concat(Tb.b.escapeNode(t.jid),"@").concat(Wc.settings.get("muc_domain")):(n=t.jid,this.model.setDomain(n)),Wc.rooms.open(n,Object.assign(t,{jid:n}),!0),this.modal.hide(),e.target.reset()},checkRoomidPolicy(){if(Wc.settings.get("muc_roomid_policy")&&Wc.settings.get("muc_domain")){let e=this.el.querySelector(".roomjid-input").value;!tl.locked_muc_domain&&kb.isValidJID(e)||(e="".concat(Tb.b.escapeNode(e),"@").concat(Wc.settings.get("muc_domain")));const t=Tb.b.getNodeFromJid(e),n=Tb.b.getDomainFromJid(e);Wc.settings.get("muc_domain")!==n||Wc.settings.get("muc_roomid_policy").test(t)?this.muc_roomid_policy_error_msg=null:this.muc_roomid_policy_error_msg=Td("Groupchat id is invalid."),this.render()}}});function Ib(){const e=Rb(['<div class="error error-feedback">',"</div>"]);return Ib=function(){return e},e}function Mb(){const e=Rb(['\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 Mb=function(){return e},e}function Rb(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const Db=tl.env.utils;var Pb=mh.extend({id:"muc-invite-modal",initialize(){mh.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change",this.render),this.initInviteWidget()},toHTML(){return(e=>{const t=Td("Invite"),n=Td("Invite someone to this groupchat"),r=Td("user@example.org"),i=Td("Please enter a valid XMPP address"),o=Td("XMPP Address"),s=Td("Optional reason for the invitation");return Ya(Mb(),n,ih,e.submitInviteForm,o,e.invalid_invite_jid?Ya(Ib(),i):"",r,s,t)})(Object.assign(this.model.toJSON(),{submitInviteForm:e=>this.submitInviteForm(e)}))},initInviteWidget(){this.invite_auto_complete&&this.invite_auto_complete.destroy();const e=qc.roster.map(e=>({label:e.getDisplayName(),value:e.get("jid")})),t=this.el.querySelector(".suggestion-box").parentElement;this.invite_auto_complete=new qc.AutoComplete(t,{min_chars:1,list:e})},submitInviteForm(e){e.preventDefault();const t=new FormData(e.target),n=t.get("invitee_jids"),r=t.get("reason");Db.isValidJID(n)?(this.chatroomview.model.directInvite(n,r),this.modal.hide()):this.model.set({invalid_invite_jid:!0})}});function Lb(){const e=Hb(['<li class="list-group-item active">',"</li>"]);return Lb=function(){return e},e}function Fb(){const e=Hb(['<li class="list-group-item"> '," </li>"]);return Fb=function(){return e},e}function zb(){const e=Hb(['\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title" id="list-chatrooms-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 zb=function(){return e},e}function Bb(){const e=Hb(['\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 Bb=function(){return e},e}function qb(){const e=Hb(['\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 qb=function(){return e},e}function Hb(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Ub=e=>{const t=Td("Query for Groupchats");return Ya(zb(),t,ih,e.show_form?(e=>{const t=Td("Show groupchats"),n=Td("Server address");return Ya(qb(),e.submitForm,n,e.setDomainFromEvent,e.muc_domain||"",e.server_placeholder,t)})(e):"",e.loading_items?Ya(Fb(),pp()):"",e.feedback_text?Ya(Lb(),e.feedback_text):"",Hp(e.items,e=>e.jid,t=>((e,t)=>{const n=Td("Show more information on this groupchat"),r=Td("Click to open this groupchat");return Ya(Bb(),e.openRoom,t.jid,t.name,r,t.name||t.jid,e.toggleRoomInfo,t.jid,n)})(e,t)),rh)},$b=n(179),Wb=n.n($b);const Gb=tl.env.utils;function Vb(e){const t=Gb.ancestor(e.target,".room-item"),n=t.querySelector("div.room-info");n?(Gb.slideIn(n).then(Gb.removeElement),t.querySelector("a.room-info").classList.remove("selected")):(t.insertAdjacentElement("beforeend",Gb.getElementFromTemplateResult(pp())),Wc.disco.info(e.target.getAttribute("data-room-jid"),null).then(e=>function(e,t){var n,r;e.querySelector("span.spinner").remove(),e.querySelector("a.room-info").classList.add("selected"),e.insertAdjacentHTML("beforeEnd",Wb()({jid:t.getAttribute("from"),desc:null===(n=Yg(pr()('field[var="muc#roominfo_description"] value',t)))||void 0===n?void 0:n.textContent,occ:null===(r=Yg(pr()('field[var="muc#roominfo_occupants"] value',t)))||void 0===r?void 0:r.textContent,hidden:pr()('feature[var="muc_hidden"]',t).length,membersonly:pr()('feature[var="muc_membersonly"]',t).length,moderated:pr()('feature[var="muc_moderated"]',t).length,nonanonymous:pr()('feature[var="muc_nonanonymous"]',t).length,open:pr()('feature[var="muc_open"]',t).length,passwordprotected:pr()('feature[var="muc_passwordprotected"]',t).length,persistent:pr()('feature[var="muc_persistent"]',t).length,publicroom:pr()('feature[var="muc_publicroom"]',t).length,semianonymous:pr()('feature[var="muc_semianonymous"]',t).length,temporary:pr()('feature[var="muc_temporary"]',t).length,unmoderated:pr()('feature[var="muc_unmoderated"]',t).length,label_desc:Td("Description:"),label_jid:Td("Groupchat Address (JID):"),label_occ:Td("Participants:"),label_features:Td("Features:"),label_requires_auth:Td("Requires authentication"),label_hidden:Td("Hidden"),label_requires_invite:Td("Requires an invitation"),label_moderated:Td("Moderated"),label_non_anon:Td("Non-anonymous"),label_open_room:Td("Open"),label_permanent_room:Td("Permanent"),label_public:Td("Public"),label_semi_anon:Td("Semi-anonymous"),label_temp_room:Td("Temporary"),label_unmoderated:Td("Unmoderated")}))}(t,e)).catch(e=>Pn.error(e)))}var Jb=mh.extend({id:"list-chatrooms-modal",initialize(){this.items=[],this.loading_items=!1,mh.prototype.initialize.apply(this,arguments),Wc.settings.get("muc_domain")&&!this.model.get("muc_domain")&&this.model.save("muc_domain",Wc.settings.get("muc_domain")),this.listenTo(this.model,"change:muc_domain",this.onDomainChange),this.el.addEventListener("shown.bs.modal",()=>Wc.settings.get("locked_muc_domain")?this.updateRoomsList():this.el.querySelector('input[name="server"]').focus())},toHTML(){const e=this.model.get("muc_domain")||Wc.settings.get("muc_domain");return Ub(Object.assign(this.model.toJSON(),{show_form:!Wc.settings.get("locked_muc_domain"),server_placeholder:e||Td("conference.example.org"),items:this.items,loading_items:this.loading_items,openRoom:e=>this.openRoom(e),setDomainFromEvent:e=>this.setDomainFromEvent(e),submitForm:e=>this.showRooms(e),toggleRoomInfo:e=>this.toggleRoomInfo(e)}))},openRoom(e){e.preventDefault();const t=e.target.getAttribute("data-room-jid"),n=e.target.getAttribute("data-room-name");this.modal.hide(),Wc.rooms.open(t,{name:n},!0)},toggleRoomInfo(e){e.preventDefault(),Vb(e)},onDomainChange(){Wc.settings.get("auto_list_rooms")&&this.updateRoomsList()},onRoomsFound(e){this.loading_items=!1;const t=e?pr()("query item",e):[];return t.length?(this.model.set({feedback_text:Td("Groupchats found")},{silent:!0}),this.items=t.map(hs.getAttributes)):(this.items=[],this.model.set({feedback_text:Td("No groupchats found")},{silent:!0})),this.render(),!0},updateRoomsList(){const e=Object(Tb.a)({to:this.model.get("muc_domain"),from:qc.connection.jid,type:"get"}).c("query",{xmlns:Tb.b.NS.DISCO_ITEMS});Wc.sendIQ(e).then(e=>this.onRoomsFound(e)).catch(()=>this.onRoomsFound())},showRooms(e){e.preventDefault(),this.loading_items=!0,this.render();const t=new FormData(e.target);this.model.setDomain(t.get("server")),this.updateRoomsList()},setDomainFromEvent(e){this.model.setDomain(e.target.value)},setNick(e){this.model.save({nick:e.target.value})}});function Xb(){const e=my(['<li class="list-group-item">',"</li>"]);return Xb=function(){return e},e}function Qb(){const e=my(['<li class="list-group-item"> '," </li>"]);return Qb=function(){return e},e}function Yb(){const e=my(['<div class="row"><div class="col pt-2"><p class="helptext pb-3">',"</p></div></div>"]);return Yb=function(){return e},e}function Kb(){const e=my(['<input class="form-control" .value="','" @keyup=',' type="text" name="filter" placeholder="','"/>']);return Kb=function(){return e},e}function Zb(){const e=my(['<li class="list-group-item">',"</li>"]);return Zb=function(){return e},e}function ey(){const e=my(['<li class="list-group-item">',"</li>"]);return ey=function(){return e},e}function ty(){const e=my(['<li class="list-group-item"> '," </li>"]);return ty=function(){return e},e}function ny(){const e=my(['<div class="row"><div class="col pt-2"><p class="helptext pb-3">',"</p></div></div>"]);return ny=function(){return e},e}function ry(){const e=my(['<input class="form-control" .value="','" @keyup=',' type="text" name="filter" placeholder="','"/>']);return ry=function(){return e},e}function iy(){const e=my(['\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 iy=function(){return e},e}function oy(){const e=my(['\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 oy=function(){return e},e}function sy(){const e=my(['<a href="#" data-form="affiliation-form" class="toggle-form right fa fa-wrench" @click=',"></a>"]);return sy=function(){return e},e}function ay(){const e=my(['\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 ay=function(){return e},e}function cy(){const e=my(['<option value="','" ?selected=',">","</option>"]);return cy=function(){return e},e}function ly(){const e=my(['\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 ly=function(){return e},e}function uy(){const e=my(['<a href="#" data-form="role-form" class="toggle-form right fa fa-wrench" @click=',"></a>"]);return uy=function(){return e},e}function dy(){const e=my(['\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 dy=function(){return e},e}function hy(){const e=my(['<option value="','" ?selected=',">","</option>"]);return hy=function(){return e},e}function fy(){const e=my(['\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 fy=function(){return e},e}function py(){const e=my(['\n <option value="','"\n ?selected=','\n title="','">',"</option>\n"]);return py=function(){return e},e}function gy(){const e=my(['\n <option value="','"\n ?selected=','\n title="','">',"</option>\n"]);return gy=function(){return e},e}function my(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function vy(e){return"moderator"===e?Td("Moderators are privileged users who can change the roles of other users (except those with admin or owner affiliations."):"participant"===e?Td("The default role, implies that you can read and write messages."):"visitor"==e?Td("Visitors aren't allowed to write messages in a moderated multi-user chat."):void 0}function _y(e){return"owner"===e?Td("Owner is the highest affiliation. Owners can modify roles and affiliations of all other users."):"admin"===e?Td("Admin is the 2nd highest affiliation. Admins can modify roles and affiliations of all other users except owners."):"outcast"===e?Td('To ban a user, you give them the affiliation of "outcast".'):void 0}const by=e=>Ya(dy(),e.item.nick,e.item.jid,e.item.nick,e.item.role,e.assignable_roles.length?Ya(uy(),e.toggleForm):"",e.assignable_roles.length?(e=>{const t=Td("Change role"),n=Td("New Role"),r=Td("Reason");return Ya(fy(),e.assignRole,e.item.jid,e.item.nick,n,e.assignable_roles.map(t=>Ya(hy(),t,t===e.item.role,t)),r,t)})(e):""),yy=e=>Ya(ay(),e.item.nick,e.item.jid,e.item.nick,e.item.affiliation,e.assignable_affiliations.length?Ya(sy(),e.toggleForm):"",e.assignable_affiliations.length?(e=>{const t=Td("Change affiliation"),n=Td("New affiliation"),r=Td("Reason");return Ya(ly(),e.assignAffiliation,e.item.jid,e.item.nick,n,e.assignable_affiliations.map(t=>Ya(cy(),t,t===e.item.affiliation,t)),r,t)})(e):"");var wy=e=>{const t=Td("Affiliation"),n=Td("Moderator Tools"),r=Td("No users with that affiliation found."),i=Td("No users with that role found."),o=Td("Type here to filter the search results"),s=Td("Role"),a=Td("Show users"),c=Td("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."),l=Td("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."),u=e.queryable_roles.length&&e.queryable_affiliations.length;return Ya(iy(),n,ih,u?(e=>Ya(oy(),e.switchTab,e.switchTab))(e):"",e.queryable_affiliations.length?"active":"",e.queryAffiliation,l,t,e.queryable_affiliations.map(t=>(e=>Ya(py(),e.item||"",e.item===e.affiliation,_y(e.item),e.item))(Object.assign({item:t},e))),a,Array.isArray(e.users_with_affiliation)&&e.users_with_affiliation.length>5?Ya(ry(),e.affiliations_filter,e.filterAffiliationResults,o):"",_y(e.affiliation)?Ya(ny(),_y(e.affiliation)):"",e.loading_users_with_affiliation?Ya(ty(),pp()):"",Array.isArray(e.users_with_affiliation)&&0===e.users_with_affiliation.length?Ya(ey(),r):"",e.users_with_affiliation instanceof Error?Ya(Zb(),e.users_with_affiliation.message):(e.users_with_affiliation||[]).map(t=>(t.nick||t.jid).match(new RegExp(e.affiliations_filter,"i"))?yy(Object.assign({item:t},e)):""),!u&&e.queryable_roles.length?"active":"",e.queryRole,c,s,e.queryable_roles.map(t=>(e=>Ya(gy(),e.item||"",e.item===e.role,vy(e.item),e.item))(Object.assign({item:t},e))),a,Array.isArray(e.users_with_role)&&e.users_with_role.length>5?Ya(Kb(),e.roles_filter,e.filterRoleResults,o):"",vy(e.role)?Ya(Yb(),vy(e.role)):"",e.loading_users_with_role?Ya(Qb(),pp()):"",e.users_with_role&&0===e.users_with_role.length?Ya(Xb(),i):"",(e.users_with_role||[]).map(t=>t.nick.match(e.roles_filter)?by(Object.assign({item:t},e)):""))};const{Strophe:Sy}=tl.env,xy=tl.env.utils;let Ey;var Ay=mh.extend({id:"converse-modtools-modal",initialize(e){Ey=e._converse,this.chatroomview=e.chatroomview,mh.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=!0,this.users_with_affiliation=null,this.render();const e=this.chatroomview.model,t=this.model.get("affiliation");this.shouldFetchAffiliationsList()?this.users_with_affiliation=await e.getAffiliationList(t):this.users_with_affiliation=e.getOccupantsWithAffiliation(t),this.loading_users_with_affiliation=!1,this.render()})},toHTML(){const e=this.chatroomview.model.occupants.findWhere({jid:Ey.bare_jid});return wy(Object.assign(this.model.toJSON(),{affiliations_filter:this.affiliations_filter,assignAffiliation:e=>this.assignAffiliation(e),assignRole:e=>this.assignRole(e),assignable_affiliations:this.getAssignableAffiliations(e),assignable_roles:this.getAssignableRoles(e),filterAffiliationResults:e=>this.filterAffiliationResults(e),filterRoleResults:e=>this.filterRoleResults(e),loading_users_with_affiliation:this.loading_users_with_affiliation,queryAffiliation:e=>this.queryAffiliation(e),queryRole:e=>this.queryRole(e),queryable_affiliations:Zl.filter(e=>!Ey.modtools_disable_query.includes(e)),queryable_roles:Kl.filter(e=>!Ey.modtools_disable_query.includes(e)),roles_filter:this.roles_filter,switchTab:e=>this.switchTab(e),toggleForm:e=>this.toggleForm(e),users_with_affiliation:this.users_with_affiliation,users_with_role:this.users_with_role}))},getAssignableAffiliations(e){let t=Wc.settings.get("modtools_disable_assign");return Array.isArray(t)||(t=t?Zl:[]),"owner"===e.get("affiliation")?Zl.filter(e=>!t.includes(e)):"admin"===e.get("affiliation")?Zl.filter(e=>!["owner","admin",...t].includes(e)):[]},getAssignableRoles(e){let t=Wc.settings.get("modtools_disable_assign");return Array.isArray(t)||(t=t?Kl:[]),"moderator"===e.get("role")?Kl.filter(e=>!t.includes(e)):[]},shouldFetchAffiliationsList(){const e=this.model.get("affiliation");return"none"!==e&&!this.chatroomview.model.occupants.getAutoFetchedAffiliationLists().includes(e)},toggleForm(e){e.stopPropagation(),e.preventDefault();const t=e.target.getAttribute("data-form"),n=xy.ancestor(e.target,".list-group-item").querySelector(".".concat(t));xy.hasClass("hidden",n)?xy.removeClass("hidden",n):xy.addClass("hidden",n)},filterRoleResults(e){this.roles_filter=e.target.value,this.render()},filterAffiliationResults(e){this.affiliations_filter=e.target.value,this.render()},queryRole(e){e.stopPropagation(),e.preventDefault();const t=new FormData(e.target).get("role");this.model.set({role:null},{silent:!0}),this.model.set({role:t})},queryAffiliation(e){e.stopPropagation(),e.preventDefault();const t=new FormData(e.target).get("affiliation");this.model.set({affiliation:null},{silent:!0}),this.model.set({affiliation:t})},async assignAffiliation(e){e.stopPropagation(),e.preventDefault();const t=new FormData(e.target),n=t.get("affiliation"),r={jid:t.get("jid"),reason:t.get("reason")},i=this.model.get("affiliation");try{await this.chatroomview.model.setAffiliation(n,[r])}catch(e){return null===e?this.alert(Td("Timeout error while trying to set the affiliation"),"danger"):pr()('not-allowed[xmlns="'.concat(Sy.NS.STANZAS,'"]'),e).length?this.alert(Td("Sorry, you're not allowed to make that change"),"danger"):this.alert(Td("Sorry, something went wrong while trying to set the affiliation"),"danger"),void Pn.error(e)}this.alert(Td("Affiliation changed"),"primary"),await this.chatroomview.model.occupants.fetchMembers(),this.model.set({affiliation:null},{silent:!0}),this.model.set({affiliation:i})},assignRole(e){e.stopPropagation(),e.preventDefault();const t=new FormData(e.target),n=this.chatroomview.model.getOccupant(t.get("jid")||t.get("nick")),r=t.get("role"),i=t.get("reason"),o=this.model.get("role");this.chatroomview.model.setRole(n,r,i,()=>{this.alert(Td("Role changed"),"primary"),this.model.set({role:null},{silent:!0}),this.model.set({role:o})},e=>{pr()('not-allowed[xmlns="'.concat(Sy.NS.STANZAS,'"]'),e).length?this.alert(Td("You're not allowed to make that change"),"danger"):(this.alert(Td("Sorry, something went wrong while trying to set the role"),"danger"),xy.isErrorObject(e)&&Pn.error(e))})}});function Cy(){const e=qy(['<li class="feature" ><span class="fa fa-database"></span>'," - <em>","</em></li>"]);return Cy=function(){return e},e}function jy(){const e=qy(['<li class="feature" ><span class="fa fa-info-circle"></span>'," - <em>","</em></li>"]);return jy=function(){return e},e}function Oy(){const e=qy(['<li class="feature" ><span class="fa fa-gavel"></span>'," - <em>","</em></li>"]);return Oy=function(){return e},e}function Ty(){const e=qy(['<li class="feature" ><span class="fa fa-user-secret"></span>'," - <em>","</em></li>"]);return Ty=function(){return e},e}function ky(){const e=qy(['<li class="feature" ><span class="fa fa-id-card"></span>'," - <em>","</em></li>"]);return ky=function(){return e},e}function Ny(){const e=qy(['<li class="feature" ><span class="fa fa-snowflake-o"></span>'," - <em>","</em></li>"]);return Ny=function(){return e},e}function Iy(){const e=qy(['<li class="feature" ><span class="fa fa-save"></span>'," - <em>","</em></li>"]);return Iy=function(){return e},e}function My(){const e=qy(['<li class="feature" ><span class="fa fa-globe"></span>'," - <em>","</em></li>"]);return My=function(){return e},e}function Ry(){const e=qy(['<li class="feature" ><span class="fa fa-address-book"></span>'," - <em>","</em></li>"]);return Ry=function(){return e},e}function Dy(){const e=qy(['<li class="feature" ><span class="fa fa-eye"></span>'," - <em>","</em></li>"]);return Dy=function(){return e},e}function Py(){const e=qy(['<li class="feature" ><span class="fa fa-eye-slash"></span>'," - <em>","</em></li>"]);return Py=function(){return e},e}function Ly(){const e=qy(['<li class="feature" ><span class="fa fa-unlock"></span>'," - <em>","</em></li>"]);return Ly=function(){return e},e}function Fy(){const e=qy(['<li class="feature" ><span class="fa fa-lock"></span>'," - <em>","</em></li>"]);return Fy=function(){return e},e}function zy(){const e=qy(['\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title" id="room-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 zy=function(){return e},e}function By(){const e=qy(['\n <p class="room-info"><strong>',"</strong>: ",'</p>\n <p class="room-info"><strong>',"</strong>: ","</p>\n "]);return By=function(){return e},e}function qy(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Hy=e=>{const t=Td("Groupchat address (JID)"),n=Td("Message archiving"),r=Td("Messages are archived on the server"),i=Td("Description"),o=Td("Features"),s=Td("Hidden"),a=Td("This groupchat is not publicly searchable"),c=Td("This groupchat is restricted to members only"),l=Td("Members only"),u=Td("Moderated"),d=Td("Participants entering this groupchat need to request permission to write"),h=Td("Name"),f=Td("This groupchat does not require a password upon entry"),p=Td("No password required"),g=Td("Not anonymous"),m=Td("All other groupchat participants can see your XMPP address"),v=Td("Not moderated"),_=Td("Participants entering this groupchat can write right away"),b=Td("Online users"),y=Td("Open"),w=Td("Anyone can join this groupchat"),S=Td("This groupchat requires a password before entry"),x=Td("Password protected"),E=Td("Persistent"),A=Td("This groupchat persists even if it's unoccupied"),C=Td("Public"),j=Td("Semi-anonymous"),O=Td("Only moderators can see your XMPP address"),T=Td("Temporary"),k=Td("This groupchat will disappear once the last person leaves");return Ya(zy(),e.display_name,ih,h,e.name,t,e.jid,i,e.config.description,e.subject?(e=>{const t=Td("Topic"),n=Td("Topic author");return Ya(By(),t,Zp(Yp.a.filterXSS(e.subject.text,{whiteList:{}})),n,e.subject&&e.subject.author)})(e):"",b,e.num_occupants,o,e.features.passwordprotected?Ya(Fy(),x,S):"",e.features.unsecured?Ya(Ly(),p,f):"",e.features.hidden?Ya(Py(),s,a):"",e.features.public_room?Ya(Dy(),C,e.__("This groupchat is publicly searchable")):"",e.features.membersonly?Ya(Ry(),l,c):"",e.features.open?Ya(My(),y,w):"",e.features.persistent?Ya(Iy(),E,A):"",e.features.temporary?Ya(Ny(),T,k):"",e.features.nonanonymous?Ya(ky(),g,m):"",e.features.semianonymous?Ya(Ty(),j,O):"",e.features.moderated?Ya(Oy(),u,d):"",e.features.unmoderated?Ya(jy(),v,_):"",e.features.mam_enabled?Ya(Cy(),n,r):"",rh)},Uy=mh.extend({id:"room-details-modal",initialize(){mh.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 Hy(Object.assign(this.model.toJSON(),{config:this.model.config.toJSON(),display_name:Td("Groupchat info for %1$s",this.model.getDisplayName()),features:this.model.features.toJSON(),num_occupants:this.model.occupants.length}))}});function $y(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\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 $y=function(){return e},e}function Wy(){const e=Jy(['<div class="muc-bottom-panel"></div>']);return Wy=function(){return e},e}function Gy(){const e=Jy(['<div class="muc-bottom-panel">',"</div>"]);return Gy=function(){return e},e}function Vy(){const e=Jy(['\n <div class="emoji-picker__container dropup"></div>\n <div class="message-form-container">']);return Vy=function(){return e},e}function Jy(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Xy=e=>{const t=Td("You're not allowed to send messages in this room");return e.entered?e.can_edit?Ya(Vy()):Ya(Gy(),t):Ya(Wy())};function Qy(){const e=Zy(['<p class="destroyed-reason">"','"</p>']);return Qy=function(){return e},e}function Yy(){const e=Zy(['\n <div class="alert alert-danger">\n <h3 class="alert-heading disconnect-msg">',"</h3>\n ","\n ","\n </div>"]);return Yy=function(){return e},e}function Ky(){const e=Zy(['\n <p class="moved-label">','</p>\n <p class="moved-link"><a class="switch-chat" href="#">',"</a></p>"]);return Ky=function(){return e},e}function Zy(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var ew=(e,t)=>{const n=Td("This groupchat no longer exists");return Ya(Yy(),n,t?Ya(Qy(),t):"",e?(e=>{const t=Td("The conversation has moved. Click below to enter.");return Ya(Ky(),t,e)})(e):"")};function tw(){const e=rw(['<p class="disconnect-msg">',"</p>"]);return tw=function(){return e},e}function nw(){const e=rw(['\n <div class="alert alert-danger">\n <h3 class="alert-heading disconnect-msg">',"</h3>\n ","\n </div>"]);return nw=function(){return e},e}function rw(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function iw(){const e=lw(['<p class="chat-head__desc" title="','">',"</p>"]);return iw=function(){return e},e}function ow(){const e=lw(["<converse-dropdown .items=","></converse-dropdown>"]);return ow=function(){return e},e}function sw(){const e=lw(['<i class="fa fa-bookmark chatbox-title__text--bookmarked" title="','"></i>']);return sw=function(){return e},e}function aw(){const e=lw(['<div class="chatbox-navback"><i class="fa fa-arrow-left"></i></div>']);return aw=function(){return e},e}function cw(){const e=lw(['\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 cw=function(){return e},e}function lw(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const uw=tl.env.utils;var dw=e=>{const t=Td("Hide the groupchat topic"),n=Td("This groupchat is bookmarked"),r=e.subject?uw.addHyperlinks(e.subject.text):"",i=r&&!e.subject_hidden;return Ya(cw(),i?"":"chatbox-title--no-desc",e._converse.api.settings.get("singleton")?"":Ya(aw()),"hidden"!==e._converse.locked_muc_domain?e.jid:"",e.title,e.bookmarked?Ya(sw(),n):"",e.standalone_btns.length?(e=>e.standalone_btns.reverse().map(e=>Eh(e,"")))(e):"",e.dropdown_btns.length?Ya(ow(),e.dropdown_btns):"",i?Ya(iw(),t,r):"")};function hw(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\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 hw=function(){return e},e}function fw(){const e=gw(['<p class="form-help">',"</p>"]);return fw=function(){return e},e}function pw(){const e=gw(['\n <form class="converse-form chatroom-form" autocomplete="off" @submit=','>\n <fieldset class="form-group">\n <legend>',"</legend>\n ","\n \x3c!-- Fields are generated internally, with xForm2webForm --\x3e\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 pw=function(){return e},e}function gw(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function mw(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\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 mw=function(){return e},e}function vw(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\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="#list-chatrooms-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 vw=function(){return e},e}
/**
* @module converse-muc-views
* @copyright 2020, the Converse.js contributors
* @description XEP-0045 Multi-User Chat Views
* @license Mozilla Public License (MPLv2)
*/
const{Strophe:_w,sizzle:bw,$pres:yw}=tl.env,ww=tl.env.utils,Sw=["owner"],xw=["admin","ban","deop","destroy","member","op","revoke"],Ew=["kick","mute","voice","modtools"],Aw=["nick"],Cw={deop:"participant",kick:"none",mute:"visitor",op:"moderator",voice:"participant"},jw={admin:"admin",ban:"outcast",member:"member",owner:"owner",revoke:"none"},Ow=Kv.extend({length:300,tagName:"div",className:"chatbox chatroom hidden",is_chatroom:!0,events:{"click .chatbox-navback":"showControlBox","click .hide-occupants":"hideOccupants","click .new-msgs-indicator":"viewUnreadMessages","click .occupant-nick":function(e){this.insertIntoTextArea(e.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",Ic(()=>this.renderHeading(),250)),this.listenTo(this.model,"change:composing_spoiler",this.renderMessageForm),this.listenTo(this.model,"change:hidden",e=>e.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(e=>this.onOccupantAdded(e)),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 e=await qc.api.user.settings.getModel();this.listenTo(e,"change:mucs_with_hidden_subject",this.renderHeading),this.onConnectionStatusChanged(),this.model.maybeShow(),this.scrollDown(),Wc.trigger("chatRoomViewInitialized",this)},async render(){const e=!this.shouldShowSidebar();var t;this.el.setAttribute("id",this.model.get("box_id")),Xa((t={sidebar_hidden:e,model:this.model,occupants:this.model.occupants,show_sidebar:!this.model.get("hidden_occupants")&&this.model.session.get("connection_status")===tl.ROOMSTATUS.ENTERED,markScrolled:e=>this.markScrolled(e),muc_show_logs_before_join:Wc.settings.get("muc_show_logs_before_join"),show_send_button:qc.show_send_button},Ya($y(),t.show_send_button?"chat-content-sendbutton":"",t.markScrolled,t.sidebar_hidden?"hidden":"",t.occupants,t.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(),Wc.settings.get("muc_show_logs_before_join")||this.model.session.get("connection_status")===tl.ROOMSTATUS.ENTERED||this.showSpinner(),await this.renderHeading(),!this.model.get("hidden")&&this.show()},getNotifications(){const e=this.model.notifications.toJSON();return(Wc.settings.get("muc_show_join_leave")?[...tl.CHAT_STATES,...tl.MUC_TRAFFIC_STATES,...tl.MUC_ROLE_CHANGES]:tl.CHAT_STATES).reduce((t,n)=>{const r=e[n];if(!(null==r?void 0:r.length))return t;const i=r.map(e=>{var t;return(null===(t=this.model.getOccupant(e))||void 0===t?void 0:t.getDisplayName())||e});if(1===i.length){if("composing"===n)return"".concat(t).concat(Td("%1$s is typing",i[0]),"\n");if("paused"===n)return"".concat(t).concat(Td("%1$s has stopped typing",i[0]),"\n");if(n===qc.GONE)return"".concat(t).concat(Td("%1$s has gone away",i[0]),"\n");if("entered"===n)return"".concat(t).concat(Td("%1$s has entered the groupchat",i[0]),"\n");if("exited"===n)return"".concat(t).concat(Td("%1$s has left the groupchat",i[0]),"\n");if("op"===n)return"".concat(t).concat(Td("%1$s is now a moderator",i[0]),"\n");if("deop"===n)return"".concat(t).concat(Td("%1$s is no longer a moderator",i[0]),"\n");if("voice"===n)return"".concat(t).concat(Td("%1$s has been given a voice",i[0]),"\n");if("mute"===n)return"".concat(t).concat(Td("%1$s has been muted",i[0]),"\n")}else if(i.length>1){let e;if(i.length>3)e="".concat(Array.from(i).slice(0,2).join(", ")," and others");else{const t=i.pop();e=Td("%1$s and %2$s",i.join(", "),t)}if("composing"===n)return"".concat(t).concat(Td("%1$s are typing",e),"\n");if("paused"===n)return"".concat(t).concat(Td("%1$s have stopped typing",e),"\n");if(n===qc.GONE)return"".concat(t).concat(Td("%1$s have gone away",e),"\n");if("entered"===n)return"".concat(t).concat(Td("%1$s have entered the groupchat",e),"\n");if("exited"===n)return"".concat(t).concat(Td("%1$s have left the groupchat",e),"\n");if("op"===n)return"".concat(t).concat(Td("%1$s are now moderators",i[0]),"\n");if("deop"===n)return"".concat(t).concat(Td("%1$s are no longer moderators",i[0]),"\n");if("voice"===n)return"".concat(t).concat(Td("%1$s have been given voices",i[0]),"\n");if("mute"===n)return"".concat(t).concat(Td("%1$s have been muted",i[0]),"\n")}return t},"")},getHelpMessages(){const e=Wc.settings.get("muc_disable_slash_commands"),t=Array.isArray(e)?e:[];return["<strong>/admin</strong>: ".concat(Td("Change user's affiliation to admin")),"<strong>/ban</strong>: ".concat(Td("Ban user by changing their affiliation to outcast")),"<strong>/clear</strong>: ".concat(Td("Clear the chat area")),"<strong>/close</strong>: ".concat(Td("Close this groupchat")),"<strong>/deop</strong>: ".concat(Td("Change user role to participant")),"<strong>/destroy</strong>: ".concat(Td("Remove this groupchat")),"<strong>/help</strong>: ".concat(Td("Show this menu")),"<strong>/kick</strong>: ".concat(Td("Kick user from groupchat")),"<strong>/me</strong>: ".concat(Td("Write in 3rd person")),"<strong>/member</strong>: ".concat(Td("Grant membership to a user")),"<strong>/modtools</strong>: ".concat(Td("Opens up the moderator tools GUI")),"<strong>/mute</strong>: ".concat(Td("Remove user's ability to post messages")),"<strong>/nick</strong>: ".concat(Td("Change your nickname")),"<strong>/op</strong>: ".concat(Td("Grant moderator role to user")),"<strong>/owner</strong>: ".concat(Td("Grant ownership of this groupchat")),"<strong>/register</strong>: ".concat(Td("Register your nickname")),"<strong>/revoke</strong>: ".concat(Td("Revoke the user's current affiliation")),"<strong>/subject</strong>: ".concat(Td("Set groupchat subject")),"<strong>/topic</strong>: ".concat(Td("Set groupchat subject (alias for /subject)")),"<strong>/voice</strong>: ".concat(Td("Allow muted user to post messages"))].filter(e=>t.every(t=>!e.startsWith(t+"<",9))).filter(e=>this.getAllowedCommands().some(t=>e.startsWith(t+"<",9)))},async renderHeading(){const e=await this.generateHeadingTemplate();Xa(e,this.el.querySelector(".chat-head-chatroom"))},renderBottomPanel(){const e=this.el.querySelector(".bottom-panel"),t=this.model.session.get("connection_status")===tl.ROOMSTATUS.ENTERED,n=t&&!(this.model.features.get("moderated")&&"visitor"===this.model.getOwnRole());Xa(Xy({can_edit:n,entered:t}),e),t&&n&&(this.renderMessageForm(),this.initMentionAutoComplete())},onStartResizeOccupants(e){this.resizing=!0,this.el.addEventListener("mousemove",this.onMouseMove),this.el.addEventListener("mouseup",this.onMouseUp);const t=this.el.querySelector("converse-muc-sidebar"),n=window.getComputedStyle(t);this.width=parseInt(n.width.replace(/px$/,""),10),this.prev_pageX=e.pageX},onMouseMove(e){if(this.resizing){e.preventDefault();const t=this.prev_pageX-e.pageX;this.resizeSidebarView(t,e.pageX),this.prev_pageX=e.pageX}},onMouseUp(e){if(this.resizing){e.preventDefault(),this.resizing=!1,this.el.removeEventListener("mousemove",this.onMouseMove),this.el.removeEventListener("mouseup",this.onMouseUp);const t=this.el.querySelector("converse-muc-sidebar").getBoundingClientRect(),n={occupants_width:this.calculateSidebarWidth(t,0)};qc.connection.connected?this.model.save(n):this.model.set(n)}},resizeSidebarView(e,t){const n=this.el.querySelector("converse-muc-sidebar"),r=n.getBoundingClientRect();if(this.is_minimum)this.is_minimum=r.left<t;else if(this.is_maximum)this.is_maximum=r.left>t;else{const t=this.calculateSidebarWidth(r,e);n.style.flex="0 0 "+t+"px"}},calculateSidebarWidth(e,t){let n=e.width+t;const r=this.el.clientWidth;return n<.2*r?(n=.2*r,this.is_minimum=!0):n>.75*r?(n=.75*r,this.is_maximum=!0):r-n<250?(n=r-250,this.is_maximum=!0):(this.is_maximum=!1,this.is_minimum=!1),n},getAutoCompleteList(){return this.model.getAllKnownNicknames().map(e=>({label:e,value:"@".concat(e)}))},getAutoCompleteListItem(e,t){t=t.trim();const n=document.createElement("li");if(n.setAttribute("aria-selected","false"),Wc.settings.get("muc_mention_autocomplete_show_avatar")){const t=document.createElement("img");let r="data:"+qc.DEFAULT_IMAGE_TYPE+";base64,"+qc.DEFAULT_IMAGE;if(qc.vcards){const t=qc.vcards.findWhere({nickname:e});t&&(r="data:"+t.get("image_type")+";base64,"+t.get("image"))}t.setAttribute("src",r),t.setAttribute("width","22"),t.setAttribute("class","avatar avatar-autocomplete"),n.appendChild(t)}const r=new RegExp("("+t+")","ig");return(t?e.split(r):[e]).forEach(e=>{if(t&&e.match(r)){const t=document.createElement("mark");t.textContent=e,n.appendChild(t)}else n.appendChild(document.createTextNode(e))}),n},initMentionAutoComplete(){this.mention_auto_complete=new qc.AutoComplete(this.el,{auto_first:!0,auto_evaluate:!1,min_chars:Wc.settings.get("muc_mention_autocomplete_min_chars"),match_current_word:!0,list:()=>this.getAutoCompleteList(),filter:"contains"==Wc.settings.get("muc_mention_autocomplete_filter")?qc.FILTER_CONTAINS:qc.FILTER_STARTSWITH,ac_triggers:["Tab","@"],include_triggers:[],item:this.getAutoCompleteListItem}),this.mention_auto_complete.on("suggestion-box-selectcomplete",()=>this.auto_completing=!1)},submitNickname(e){e.preventDefault();const t=e.target.nick.value.trim();t&&this.model.join(t)},onKeyDown(e){if(!this.mention_auto_complete.onKeyDown(e))return qc.ChatBoxView.prototype.onKeyDown.call(this,e)},onKeyUp(e){return this.mention_auto_complete.evaluate(e),qc.ChatBoxView.prototype.onKeyUp.call(this,e)},async onMessageRetractButtonClicked(e){const t=Td("Be aware that other XMPP/Jabber clients (and servers) may not yet support retractions and that this message may not be removed everywhere.");if(e.mayBeRetracted()){const n=[Td("Are you sure you want to retract this message?")];Wc.settings.get("show_retraction_warning")&&(n[1]=t),await Wc.confirm(Td("Confirm"),n)&&this.model.retractOwnMessage(e)}else if(await e.mayBeModerated())if("me"===e.get("sender")){let n=[Td("Are you sure you want to retract this message?")];Wc.settings.get("show_retraction_warning")&&(n=[n[0],t,n[1]]),await Wc.confirm(Td("Confirm"),n)&&this.retractOtherMessage(e)}else{let n=[Td("You are about to retract this message."),Td("You may optionally include a message, explaining the reason for the retraction.")];Wc.settings.get("show_retraction_warning")&&(n=[n[0],t,n[1]]);const r=await Wc.prompt(Td("Message Retraction"),n,Td("Optional reason"));!1!==r&&this.retractOtherMessage(e,r)}else{const e=Td("Sorry, you're not allowed to retract this message");Wc.alert("error",Td("Error"),e)}},async retractOtherMessage(e,t){const n=await this.model.retractOtherMessage(e,t);if(null===n){const e=Td("A timeout occurred while trying to retract the message");Wc.alert("error",Td("Error"),e),Pn(e,_w.LogLevel.WARN)}else if(ww.isErrorStanza(n)){const e=Td("Sorry, you're not allowed to retract this message.");Wc.alert("error",Td("Error"),e),Pn(e,_w.LogLevel.WARN),Pn(n,_w.LogLevel.WARN)}},showModeratorToolsModal(e){if(this.verifyRoles(["moderator"])){if(void 0===this.model.modtools_modal){const t=new zo({affiliation:e});this.modtools_modal=new Ay({model:t,_converse:qc,chatroomview:this})}else this.modtools_modal.set("affiliation",e);this.modtools_modal.show()}},showRoomDetailsModal(e){e.preventDefault(),void 0===this.model.room_details_modal&&(this.model.room_details_modal=new Uy({model:this.model})),this.model.room_details_modal.show(e)},showChatStateNotification(e){if("me"!==e.get("sender"))return qc.ChatBoxView.prototype.showChatStateNotification.apply(this,arguments)},shouldShowSidebar(){return!this.model.get("hidden_occupants")&&this.model.session.get("connection_status")===tl.ROOMSTATUS.ENTERED},onSidebarToggle(){var e;this.renderToolbar(),null===(e=this.el.querySelector(".occupants"))||void 0===e||e.setVisibility()},onOccupantAffiliationChanged(e){e.get("jid")===qc.bare_jid&&this.renderHeading()},onOccupantRoleChanged(e){e.get("jid")===qc.bare_jid&&this.renderBottomPanel()},getHeadingButtons(e){const t=[];t.push({i18n_text:Td("Details"),i18n_title:Td("Show more information about this groupchat"),handler:e=>this.showRoomDetailsModal(e),a_class:"show-room-details-modal",icon_class:"fa-info-circle",name:"details"}),"owner"===this.model.getOwnAffiliation()&&t.push({i18n_text:Td("Configure"),i18n_title:Td("Configure this groupchat"),handler:e=>this.getAndRenderConfigurationForm(e),a_class:"configure-chatroom-button",icon_class:"fa-wrench",name:"configure"}),this.model.invitesAllowed()&&t.push({i18n_text:Td("Invite"),i18n_title:Td("Invite someone to join this groupchat"),handler:e=>this.showInviteModal(e),a_class:"open-invite-modal",icon_class:"fa-user-plus",name:"invite"});const n=this.model.get("subject");if(n&&n.text&&t.push({i18n_text:Td(e?"Show topic":"Hide topic"),i18n_title:Td(e?"Show the topic message in the heading":"Hide the topic in the heading"),handler:e=>this.toggleTopic(e),a_class:"hide-topic",icon_class:"fa-minus-square",name:"toggle-topic"}),this.model.session.get("connection_status")===tl.ROOMSTATUS.ENTERED){const e=this.getAllowedCommands();e.includes("modtools")&&t.push({i18n_text:Td("Moderate"),i18n_title:Td("Moderate this groupchat"),handler:()=>this.showModeratorToolsModal(),a_class:"moderate-chatroom-button",icon_class:"fa-user-cog",name:"moderate"}),e.includes("destroy")&&t.push({i18n_text:Td("Destroy"),i18n_title:Td("Remove this groupchat"),handler:e=>this.destroy(e),a_class:"destroy-chatroom-button",icon_class:"fa-trash",name:"destroy"})}return Wc.settings.get("singleton")||t.push({i18n_text:Td("Leave"),i18n_title:Td("Leave and close this groupchat"),handler:async e=>{e.stopPropagation();const t=[Td("Are you sure you want to leave this groupchat?")];await Wc.confirm(Td("Confirm"),t)&&this.close(e)},a_class:"close-chatbox-button",standalone:"overlayed"===Wc.settings.get("view_mode"),icon_class:"fa-sign-out-alt",name:"signout"}),qc.api.hook("getHeadingButtons",this,t)},async generateHeadingTemplate(){const e=await this.model.isSubjectHidden(),t=await this.getHeadingButtons(e),n=t.filter(e=>e.standalone),r=t.filter(e=>!e.standalone);return dw(Object.assign(this.model.toJSON(),{_converse:qc,subject_hidden:e,dropdown_btns:r.map(e=>this.getHeadingDropdownItem(e)),standalone_btns:n.map(e=>this.getHeadingStandaloneButton(e)),title:this.model.getDisplayName()}))},toggleTopic(){this.model.toggleSubjectHiddenState()},showInviteModal(e){e.preventDefault(),void 0===this.muc_invite_modal&&(this.muc_invite_modal=new Pb({model:new zo}),this.muc_invite_modal.chatroomview=this),this.muc_invite_modal.show(e)},afterShown(){ww.isPersistableModel(this.model)&&this.model.clearUnreadMsgCounter(),this.scrollDown()},onConnectionStatusChanged(){const e=this.model.session.get("connection_status");e===tl.ROOMSTATUS.NICKNAME_REQUIRED?this.renderNicknameForm():e===tl.ROOMSTATUS.PASSWORD_REQUIRED?this.renderPasswordForm():e===tl.ROOMSTATUS.CONNECTING?this.showSpinner():e===tl.ROOMSTATUS.ENTERED?(this.renderBottomPanel(),this.hideSpinner(),this.maybeFocus()):e===tl.ROOMSTATUS.DISCONNECTED?this.showDisconnectMessage():e===tl.ROOMSTATUS.DESTROYED&&this.showDestroyedMessage()},getToolbarOptions(){return Object.assign(qc.ChatBoxView.prototype.getToolbarOptions.apply(this,arguments),{is_groupchat:!0,label_hide_occupants:Td("Hide the list of participants"),show_occupants_toggle:qc.visible_toolbar_buttons.toggle_occupants})},async close(){return this.hide(),qc.router.history.getFragment()==="converse/room?jid="+this.model.get("jid")&&qc.router.navigate(""),await this.model.leave(),qc.ChatBoxView.prototype.close.apply(this,arguments)},hideOccupants(e){e&&(e.preventDefault(),e.stopPropagation()),this.model.save({hidden_occupants:!0}),this.scrollDown()},verifyRoles(e,t,n=!0){if(!Array.isArray(e))throw new TypeError("roles must be an Array");if(!e.length)return!0;if(t=t||this.model.occupants.findWhere({jid:qc.bare_jid})){const n=t.get("role");if(e.includes(n))return!0}if(n){const e=Td("Forbidden: you do not have the necessary role in order to do that.");this.model.createMessage({message:e,type:"error"})}return!1},verifyAffiliations(e,t,n=!0){if(!Array.isArray(e))throw new TypeError("affiliations must be an Array");if(!e.length)return!0;if(t=t||this.model.occupants.findWhere({jid:qc.bare_jid})){const n=t.get("affiliation");if(e.includes(n))return!0}if(n){const e=Td("Forbidden: you do not have the necessary affiliation in order to do that.");this.model.createMessage({message:e,type:"error"})}return!1},validateRoleOrAffiliationChangeArgs(e,t){if(!t){const t=Td('Error: the "%1$s" command takes two arguments, the user\'s nickname and optionally a reason.',e);return this.model.createMessage({message:t,type:"error"}),!1}return!0},getNickOrJIDFromCommandArgs(e){if(ww.isValidJID(e.trim()))return e.trim();e.startsWith("@")||(e="@"+e);const[t,n]=this.model.parseTextForReferences(e);if(!n.length){const e=Td("Error: couldn't find a groupchat participant based on your arguments");return void this.model.createMessage({message:e,type:"error"})}if(n.length>1){const e=Td("Error: found multiple groupchat participant based on your arguments");return void this.model.createMessage({message:e,type:"error"})}const r=n.pop().value,i=e.split(r,2)[1];if(!i||i.startsWith(" "))return r;{const e=Td("Error: couldn't find a groupchat participant based on your arguments");this.model.createMessage({message:e,type:"error"})}},setAffiliation(e,t,n){const r=jw[e];if(!r)throw Error("ChatRoomView#setAffiliation called with invalid command: ".concat(e));if(!this.verifyAffiliations(n))return!1;if(!this.validateRoleOrAffiliationChangeArgs(e,t))return!1;const i=this.getNickOrJIDFromCommandArgs(t);if(!i)return!1;let o;const s=t.split(i,2)[1].trim(),a=this.model.getOccupant(i);if(a)o=a.get("jid");else{if(!ww.isValidJID(i)){const e=Td("Couldn't find a participant with that nickname. They might have left the groupchat.");return void this.model.createMessage({message:e,type:"error"})}o=i}const c={jid:o,reason:s};a&&Wc.settings.get("auto_register_muc_nickname")&&(c.nick=a.get("nick")),this.model.setAffiliation(r,[c]).then(()=>this.model.occupants.fetchMembers()).catch(e=>this.onCommandError(e))},getReason:e=>e.includes(",")?e.slice(e.indexOf(",")+1).trim():null,setRole(e,t,n=[],r=[]){const i=Cw[e];if(!i)throw Error("ChatRoomView#setRole called with invalid command: ".concat(e));if(!this.verifyAffiliations(n)||!this.verifyRoles(r))return!1;if(!this.validateRoleOrAffiliationChangeArgs(e,t))return!1;const o=this.getNickOrJIDFromCommandArgs(t);if(!o)return!1;const s=t.split(o,2)[1].trim(),a=this.model.getOccupant(o);return this.model.setRole(a,i,s,void 0,this.onCommandError.bind(this)),!0},onCommandError(e){Pn.fatal(e);const t=Td("Sorry, an error happened while running the command.")+" "+Td("Check your browser's developer console for details.");this.model.createMessage({message:t,type:"error"})},getAllowedCommands(){let e=["clear","help","me","nick","register"];(this.model.config.get("changesubject")||["owner","admin"].includes(this.model.getOwnAffiliation()))&&(e=[...e,"subject","topic"]);const t=this.model.occupants.findWhere({jid:qc.bare_jid});return this.verifyAffiliations(["owner"],t,!1)?e=e.concat(Sw).concat(xw):this.verifyAffiliations(["admin"],t,!1)&&(e=e.concat(xw)),this.verifyRoles(["moderator"],t,!1)?e=e.concat(Ew).concat(Aw):this.verifyRoles(["visitor","participant","moderator"],t,!1)||(e=e.concat(Aw)),e.sort(),Array.isArray(Wc.settings.get("muc_disable_slash_commands"))?e.filter(e=>!Wc.settings.get("muc_disable_slash_commands").includes(e)):e},async destroy(){const e=[Td("Are you sure you want to destroy this groupchat?")];let t=[{name:"challenge",label:Td("Please enter the XMPP address of this groupchat to confirm"),challenge:this.model.get("jid"),placeholder:Td("name@example.org"),required:!0},{name:"reason",label:Td("Optional reason for destroying this groupchat"),placeholder:Td("Reason")},{name:"newjid",label:Td("Optional XMPP address for a new groupchat that replaces this one"),placeholder:Td("replacement@example.org")}];try{var n,r;t=await Wc.confirm(Td("Confirm"),e,t);const i=null===(n=t.filter(e=>"reason"===e.name).pop())||void 0===n?void 0:n.value,o=null===(r=t.filter(e=>"newjid"===e.name).pop())||void 0===r?void 0:r.value;return this.model.sendDestroyIQ(i,o).then(()=>this.close())}catch(e){Pn.error(e)}},parseMessageForCommands(e){if(Wc.settings.get("muc_disable_slash_commands")&&!Array.isArray(Wc.settings.get("muc_disable_slash_commands")))return qc.ChatBoxView.prototype.parseMessageForCommands.apply(this,arguments);const t=((e=e.replace(/^\s*/,"")).match(/^\/([a-zA-Z]*) ?/)||[""]).pop().toLowerCase();if(!t)return!1;const n=e.slice(("/"+t).length+1).trim();if(!this.getAllowedCommands().includes(t))return!1;switch(t){case"admin":this.setAffiliation(t,n,["owner"]);break;case"ban":this.setAffiliation(t,n,["admin","owner"]);break;case"modtools":this.showModeratorToolsModal(n);break;case"deop":this.setRole(t,n,["admin","owner"]);break;case"destroy":if(!this.verifyAffiliations(["owner"]))break;this.destroy().catch(e=>this.onCommandError(e));break;case"help":this.model.set({show_help_messages:!0});break;case"kick":case"mute":this.setRole(t,n,[],["moderator"]);break;case"member":this.setAffiliation(t,n,["admin","owner"]);break;case"nick":if(!this.verifyRoles(["visitor","participant","moderator"]))break;if(0===n.length){const e=Td('Your nickname is "%1$s"',this.model.get("nick"));this.model.createMessage({message:e,type:"error"})}else{const e=_w.getBareJidFromJid(this.model.get("jid"));Wc.send(yw({from:qc.connection.jid,to:"".concat(e,"/").concat(n),id:ww.getUniqueId()}).tree())}break;case"owner":this.setAffiliation(t,n,["owner"]);break;case"op":this.setRole(t,n,["admin","owner"]);break;case"register":n.length>1?this.model.createMessage({message:Td("Error: invalid number of arguments"),type:"error"}):this.model.registerNickname().then(e=>{e&&this.model.createMessage({message:e,type:"error"})});break;case"revoke":this.setAffiliation(t,n,["admin","owner"]);break;case"topic":case"subject":this.model.setSubject(n);break;case"voice":this.setRole(t,n,[],["moderator"]);break;default:return qc.ChatBoxView.prototype.parseMessageForCommands.apply(this,arguments)}return!0},renderConfigurationForm(e){if(this.hideChatRoomContents(),this.model.save("config_stanza",e.outerHTML),!this.config_form){this.config_form=new qc.MUCConfigForm({model:this.model,chatroomview:this}),this.el.querySelector(".chatroom-body").insertAdjacentElement("beforeend",this.config_form.el)}ww.showElement(this.config_form.el)},renderNicknameForm(){const e=(e=>{const t=Td("Nickname"),n=Td("Enter groupchat"),r=Wc.settings.get("muc_show_logs_before_join")?Td("Choose a nickname to enter"):Td("Please choose your nickname");return Ya(hw(),r,e.nickname_validation_message,e.nick||"",e.nickname_validation_message?"error":"",t,n)})(this.model.toJSON());if(Wc.settings.get("muc_show_logs_before_join")){const t=this.el.querySelector(".muc-bottom-panel");Xa(e,t),ww.addClass("muc-bottom-panel--nickname",t)}else{const t=this.el.querySelector(".muc-nickname-form"),n=ww.getElementFromTemplateResult(e);if(t)bw(".spinner",this.el).forEach(ww.removeElement),t.outerHTML=n.outerHTML;else{this.hideChatRoomContents(),this.el.querySelector(".chatroom-body").insertAdjacentElement("beforeend",n)}}ww.safeSave(this.model.session,{connection_status:tl.ROOMSTATUS.NICKNAME_REQUIRED})},closeForm(){bw(".chatroom-form-container",this.el).forEach(e=>ww.addClass("hidden",e)),this.renderAfterTransition()},getAndRenderConfigurationForm(){this.config_form&&ww.isVisible(this.config_form.el)?this.closeForm():(this.showSpinner(),this.model.fetchRoomConfiguration().then(e=>this.renderConfigurationForm(e)).catch(e=>Pn.error(e)))},hideChatRoomContents(){const e=this.el.querySelector(".chatroom-body");null!==e&&[].forEach.call(e.children,e=>e.classList.add("hidden"))},renderPasswordForm(){this.hideChatRoomContents();const e=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",e);else{this.password_form=new qc.MUCPasswordForm({model:new zo({validation_message:e}),chatroomview:this}),this.el.querySelector(".chatroom-body").insertAdjacentElement("beforeend",this.password_form.el)}ww.showElement(this.password_form.el),this.model.session.save("connection_status",tl.ROOMSTATUS.PASSWORD_REQUIRED)},showDestroyedMessage(){ww.hideElement(this.el.querySelector(".chat-area")),ww.hideElement(this.el.querySelector(".occupants")),bw(".spinner",this.el).forEach(ww.removeElement);const e=this.model.get("destroyed_reason"),t=this.model.get("moved_jid");this.model.save({destroyed_reason:void 0,moved_jid:void 0});const n=this.el.querySelector(".disconnect-container");Xa(ew(t,e),n);const r=n.querySelector("a.switch-chat");r&&r.addEventListener("click",async e=>{e.preventDefault(),(await Wc.rooms.get(t,null,!0)).maybeShow(!0),this.model.destroy()}),ww.showElement(n)},showDisconnectMessage(){const e=this.model.get("disconnection_message");if(!e)return;ww.hideElement(this.el.querySelector(".chat-area")),ww.hideElement(this.el.querySelector(".occupants")),bw(".spinner",this.el).forEach(ww.removeElement);const t=[e],n=this.model.get("disconnection_actor");n&&t.push(Td("This action was done by %1$s.",n));const r=this.model.get("disconnection_reason");r&&t.push(Td('The reason given is: "%1$s".',r)),this.model.save({disconnection_message:void 0,disconnection_reason:void 0,disconnection_actor:void 0});const i=this.el.querySelector(".disconnect-container");Xa((e=>Ya(nw(),e[0],e.slice(1).map(e=>Ya(tw(),e))))(t),i),ww.showElement(i)},onOccupantAdded(e){e.get("jid")===qc.bare_jid&&(this.renderHeading(),this.renderBottomPanel())},getPreviousJoinOrLeaveNotification(e,t){const n=(new Date).toISOString().split("T")[0];for(;null!==e;){var r;if(!e.classList.contains("chat-info"))return;const i=e.getAttribute("data-isodate");if(i&&i.split("T")[0]!==n)return;const o=(null===(r=e)||void 0===r?void 0:r.dataset)||{};if(o.join===t||o.leave===t||o.leavejoin===t||o.joinleave===t)return e;e=e.previousElementSibling}},renderAfterTransition(){const e=this.model.session.get("connection_status");if(e==tl.ROOMSTATUS.NICKNAME_REQUIRED)this.renderNicknameForm();else if(e==tl.ROOMSTATUS.PASSWORD_REQUIRED)this.renderPasswordForm();else if(e==tl.ROOMSTATUS.ENTERED){var t;this.hideChatRoomContents(),ww.showElement(this.el.querySelector(".chat-area")),null===(t=this.el.querySelector(".occupants"))||void 0===t||t.setVisibility(),this.scrollDown()}},showSpinner(){bw(".spinner",this.el).forEach(ww.removeElement),this.hideChatRoomContents(),this.el.querySelector(".chatroom-body").insertAdjacentElement("afterbegin",ww.getElementFromTemplateResult(pp()))},hideSpinner(){const e=this.el.querySelector(".spinner");return null!==e&&(ww.removeElement(e),this.renderAfterTransition()),this}}),Tw=Wd.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 e={heading_chatrooms:Td("Groupchats"),title_new_room:Td("Add a new groupchat"),title_list_rooms:Td("Query for groupchats")},Ya(vw(),e.heading_chatrooms,e.title_list_rooms,e.title_new_room);var e},showAddRoomModal(e){void 0===this.add_room_modal&&(this.add_room_modal=new Nb({model:this.model})),this.add_room_modal.show(e)},showMUCListModal(e){void 0===this.muc_list_modal&&(this.muc_list_modal=new Jb({model:this.model})),this.muc_list_modal.show(e)}});function kw(){const e=Iw(['\n <div class="list-container list-container--headline ','">\n <div class="items-list rooms-list headline-list">\n ',"\n </div>\n </div>\n"]);return kw=function(){return e},e}function Nw(){const e=Iw(['\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 Nw=function(){return e},e}function Iw(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}tl.plugins.add("converse-muc-views",{dependencies:["converse-autocomplete","converse-modal","converse-controlbox","converse-chatview"],overrides:{ControlBoxView:{renderControlBoxPane(){this.__super__.renderControlBoxPane.apply(this,arguments),Wc.settings.get("allow_muc")&&this.renderRoomsPanel()}}},initialize(){const{_converse:e}=this;Wc.promises.add(["roomsPanelRendered"]),Wc.settings.extend({auto_list_rooms:!1,cache_muc_messages:!0,locked_muc_nickname:!1,modtools_disable_query:[],modtools_disable_assign:!1,muc_disable_slash_commands:!1,muc_mention_autocomplete_filter:"contains",muc_mention_autocomplete_min_chars:0,muc_mention_autocomplete_show_avatar:!0,muc_roomid_policy:null,muc_roomid_policy_hint:null,roomconfig_whitelist:[],show_retraction_warning:!0,visible_toolbar_buttons:{toggle_occupants:!0}}),e.ChatRoomView=Ow,e.RoomsPanel=Tw;const t={renderRoomsPanel(){if(this.roomspanel&&ww.isInDOM(this.roomspanel.el))return this.roomspanel;const t="converse.roomspanel".concat(e.bare_jid);return this.roomspanel=new e.RoomsPanel({model:new(e.RoomsPanelModel.extend({id:t,browserStorage:e.createStore(t)}))}),this.roomspanel.model.fetch(),this.el.querySelector(".controlbox-pane").insertAdjacentElement("beforeEnd",this.roomspanel.render().el),Wc.trigger("roomsPanelRendered"),this.roomspanel},getRoomsPanel(){return this.roomspanel&&ww.isInDOM(this.roomspanel.el)?this.roomspanel:this.renderRoomsPanel()}};function n(e,t){t.getRoomsPanel().model.save("muc_domain",_w.getDomainFromJid(e))}function r(t){t.model.get("connected")&&(t.getRoomsPanel().model.get("muc_domain")||(void 0===Wc.settings.get("muc_domain")?function(t){function r(e){e&&e.get("var")===_w.NS.MUC&&e.entity.getIdentity("conference","text").then(r=>{r&&n(e.get("from"),t)})}Wc.waitUntil("discoInitialized").then(()=>{Wc.listen.on("serviceDiscovered",r),e.disco_entities.each(e=>r(e.features.findWhere({var:_w.NS.MUC})))}).catch(e=>Pn.error(e))}(t):n(Wc.settings.get("muc_domain"),t)))}e.ControlBoxView&&Object.assign(e.ControlBoxView.prototype,t),e.MUCConfigForm=Wd.extend({className:"chatroom-form-container muc-config-form",initialize(e){this.chatroomview=e.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 e,t;const n=ww.toStanza(this.model.get("config_stanza")),r=Wc.settings.get("roomconfig_whitelist");let i=bw("field",n);r.length&&(i=i.filter(e=>r.includes(e.getAttribute("var"))));const o={new_password:!this.model.features.get("passwordprotected"),fixed_username:this.model.get("jid")};return(e=>{const t=Td("Save"),n=Td("Cancel");return Ya(pw(),e.submitConfigForm,e.title,e.title!==e.instructions?Ya(fw(),e.instructions):"",e.fields.map(e=>Zp(e)),t,n,e.closeConfigForm)})({closeConfigForm:e=>this.closeConfigForm(e),fields:i.map(e=>ww.xForm2webForm(e,n,o)),instructions:null===(e=n.querySelector("instructions"))||void 0===e?void 0:e.textContent,submitConfigForm:e=>this.submitConfigForm(e),title:null===(t=n.querySelector("title"))||void 0===t?void 0:t.textContent})},async submitConfigForm(e){e.preventDefault();const t=bw(":input:not([type=button]):not([type=submit])",e.target).map(ww.webForm2xForm).filter(e=>e);try{await this.model.sendConfiguration(t)}catch(e){Pn.error(e);const t=Td("Sorry, an error occurred while trying to submit the config form.")+" "+Td("Check your browser's developer console for details.");Wc.alert("error",Td("Error"),t)}await this.model.refreshDiscoInfo(),this.chatroomview.closeForm()},closeConfigForm(e){e.preventDefault(),this.chatroomview.closeForm()}}),e.MUCPasswordForm=Wd.extend({className:"chatroom-form-container muc-password-form",initialize(e){this.chatroomview=e.chatroomview,this.listenTo(this.model,"change:validation_message",this.render),this.render()},toHTML(){return(e=>{const t=Td("This groupchat requires a password"),n=Td("Password: "),r=Td("Submit");return Ya(mw(),e.submitPassword,t,e.validation_message,e.jid,e.validation_message?"error":"",n,r)})({jid:this.model.get("jid"),submitPassword:e=>this.submitPassword(e),validation_message:this.model.get("validation_message")})},submitPassword(e){e.preventDefault();const t=this.el.querySelector("input[type=password]").value;this.chatroomview.model.join(this.chatroomview.model.get("nick"),t),this.model.set("validation_message",null)}}),Wc.listen.on("chatBoxViewsInitialized",()=>{e.chatboxviews.delegate("click","a.open-chatroom",(function(e){e.preventDefault(),Wc.rooms.open(e.target.href)})),e.chatboxes.on("add",(async function(t){const n=e.chatboxviews;if(!n.get(t.get("id"))&&t.get("type")===e.CHATROOMS_TYPE&&t.isValid())return await t.initialized,n.add(t.get("id"),new e.ChatRoomView({model:t}))}))}),Wc.listen.on("clearSession",()=>{const t=e.chatboxviews.get("controlbox");t&&t.roomspanel&&(t.roomspanel.model.destroy(),t.roomspanel.remove(),delete t.roomspanel)}),Wc.listen.on("controlBoxInitialized",e=>{Wc.settings.get("allow_muc")&&(r(e),e.model.on("change:connected",()=>r(e)))}),Object.assign(e.api,{roomviews:{get(t){if(Array.isArray(t)){return Wc.chatviews.get(t).filter(t=>t.model.get("type")===e.CHATROOMS_TYPE)}{const n=Wc.chatviews.get(t);return n.model.get("type")===e.CHATROOMS_TYPE?n:null}},close(t){let n;return void 0===t?n=e.chatboxviews:"string"==typeof t?n=[e.chatboxviews.get(t)].filter(e=>e):Array.isArray(t)&&(n=t.map(t=>e.chatboxviews.get(t))),Promise.all(n.map(e=>e.is_chatroom&&e.model&&e.close()))}}})}});var Mw=e=>Ya(kw(),e.headlineboxes.length?"":"hidden",e.headlineboxes.map(t=>(e=>Ya(Nw(),e.headlinebox.get("jid"),e.headlinebox.get("jid"),e.open_title,e.headlinebox.get("jid")))(Object.assign({headlinebox:t},e))));function Rw(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <div class="d-flex controlbox-padded ','">\n <span class="w-100 controlbox-heading controlbox-heading--headline">',"</span>\n </div>\n ","\n"]);return Rw=function(){return e},e}
/**
* @module converse-headlines-view
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const Dw=tl.env.utils,Pw=Kv.extend({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=!0,this.listenTo(this.model,"change:hidden",e=>e.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(),Wc.trigger("headlinesBoxViewInitialized",this)},render(){this.el.setAttribute("id",this.model.get("box_id"));const e=yv(Object.assign(this.model.toJSON(),{info_close:"",label_personal_message:"",show_send_button:!1,show_toolbar:!1,unread_msgs:""}));return Xa(e,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 e=[];return Wc.settings.get("singleton")||e.push({a_class:"close-chatbox-button",handler:e=>this.close(e),i18n_text:Td("Close"),i18n_title:Td("Close these announcements"),icon_class:"fa-times",name:"close",standalone:"overlayed"===Wc.settings.get("view_mode")}),qc.api.hook("getHeadingButtons",this,e)},renderMessageForm:function(){},afterShown:function(){}}),Lw=Wd.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 e={heading_headline:Td("Announcements"),headlineboxes:this.model.filter(e=>e.get("type")===qc.HEADLINES_TYPE),open_title:Td("Click to open this server message")},Ya(Rw(),e.headlineboxes.length?"":"hidden",e.heading_headline,Mw(e));var e},renderIfHeadline(e){return e&&e.get("type")===qc.HEADLINES_TYPE&&this.render()},openHeadline(e){e.preventDefault();const t=e.target.getAttribute("data-headline-jid");qc.chatboxes.get(t).maybeShow(!0)},insertIntoDOM(){const e=qc.chatboxviews.get("controlbox");e&&e.el.querySelector(".controlbox-pane").insertAdjacentElement("beforeEnd",this.el)}});tl.plugins.add("converse-headlines-view",{dependencies:["converse-headlines","converse-chatview"],overrides:{ControlBoxView:{renderControlBoxPane(){this.__super__.renderControlBoxPane.apply(this,arguments),this.renderHeadlinesPanel()}}},initialize(){const e={renderHeadlinesPanel(){return this.headlinepanel&&Dw.isInDOM(this.headlinepanel.el)||(this.headlinepanel=new qc.HeadlinesPanel({model:qc.chatboxes}),Wc.trigger("headlinesPanelRendered")),this.headlinepanel}};qc.ControlBoxView&&Object.assign(qc.ControlBoxView.prototype,e),qc.HeadlinesBoxView=Pw,qc.HeadlinesPanel=Lw,Wc.listen.on("chatBoxViewsInitialized",()=>{const e=qc.chatboxviews;qc.chatboxes.on("add",t=>{e.get(t.get("id"))||t.get("type")!==qc.HEADLINES_TYPE||e.add(t.get("id"),new qc.HeadlinesBoxView({model:t}))})})}});var Fw=n(180),zw=n.n(Fw);
/**
* @module converse-notification
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const{Strophe:Bw}=tl.env,qw=tl.env.utils,Hw="Notification"in window;let Uw;function $w(){if(Wc.settings.get("show_tab_notifications")){var e;Uw=null!==(e=Uw)&&void 0!==e?e:new tl.env.Favico({type:"circle",animation:"pop"});const t=qc.chatboxes.models.reduce((e,t)=>e+(t.get("num_unread")||0),0);Uw.badge(t)}}function Ww(){const e=Yw(['\n <fieldset class="form-group">\n <ul class="list-group">\n <li class="list-group-item active">',":</li>\n ","\n </ul>\n </fieldset>"]);return Ww=function(){return e},e}function Gw(){const e=Yw(['<div class="alert alert-','" role="alert">',"</div>"]);return Gw=function(){return e},e}function Vw(){const e=Yw(["\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 Vw=function(){return e},e}function Jw(){const e=Yw(['\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 Jw=function(){return e},e}function Xw(){const e=Yw(['<div class="alert alert-','" role="alert">',"</div>"]);return Xw=function(){return e},e}function Qw(){const e=Yw(["\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 \x3c!-- Fields are generated internally, with xForm2webForm --\x3e\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 Qw=function(){return e},e}function Yw(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}tl.env.Favico=zw.a,tl.plugins.add("converse-notification",{dependencies:["converse-chatboxes"],initialize(){Wc.settings.extend({chatstate_notification_blacklist:[],notification_delay:5e3,notification_icon:"logo/conversejs-filled.svg",notify_all_room_messages:!1,notify_nicknames_without_references:!1,play_sounds:!0,show_chat_state_notifications:!1,show_desktop_notifications:!0,show_tab_notifications:!0,sounds_path:Wc.settings.get("assets_path")+"/sounds/"}),qc.shouldNotifyOfGroupMessage=function(e){if(!(null==e?void 0:e.body))return!1;const t=e.from,n=e.from_muc,r=Wc.settings.get("notify_all_room_messages"),i=qc.chatboxes.get(n),o=Bw.getResourceFromJid(t),s=o&&Bw.unescapeNode(o)||"";let a=!1;const c=i.get("nick");Wc.settings.get("notify_nicknames_without_references")&&(a=new RegExp("\\b".concat(c,"\\b")).test(e.body));const l=e.references.map(e=>e.value).includes(c),u=s!==c,d=!0===r||Array.isArray(r)&&r.includes(n)||l||a;return u&&!!d},qc.isMessageToHiddenChat=function(e){var t,n;return null!==(t=null===(n=qc.chatboxes.get(e.from))||void 0===n?void 0:n.isHidden())&&void 0!==t&&t},qc.shouldNotifyOfMessage=function(e){const{attrs:t,stanza:n}=e;if(!t||null!==n.querySelector("forwarded"))return!1;if("groupchat"===t.type)return qc.shouldNotifyOfGroupMessage(t);if(t.is_headline)return qc.isMessageToHiddenChat(t);const r=Bw.getBareJidFromJid(t.from)===qc.bare_jid;return!qw.isOnlyChatStateNotification(n)&&!qw.isOnlyMessageDeliveryReceipt(n)&&!r&&("all"===Wc.settings.get("show_desktop_notifications")||qc.isMessageToHiddenChat(t))},qc.playSoundNotification=function(){if(Wc.settings.get("play_sounds")&&void 0!==window.Audio){const e=new Audio(Wc.settings.get("sounds_path")+"msg_received.ogg"),t=e.canPlayType("audio/ogg");if("probably"===t)return e.play();const n=new Audio(Wc.settings.get("sounds_path")+"msg_received.mp3"),r=n.canPlayType("audio/mp3");"probably"===r?n.play():"maybe"===t?e.play():"maybe"===r&&n.play()}},qc.areDesktopNotificationsEnabled=function(){return Hw&&Wc.settings.get("show_desktop_notifications")&&"granted"===Notification.permission},qc.showMessageNotification=function(e){const{attrs:t}=e;if(t.is_error)return;if(!qc.areDesktopNotificationsEnabled())return;let n,r;const i=t.from,o=Bw.getBareJidFromJid(i);if("headline"===t.type){if(o.includes("@")&&!Wc.settings.get("allow_non_roster_messaging"))return;n=Td("Notification from %1$s",o)}else if(o.includes("@"))if("groupchat"===t.type)n=Td("%1$s says",Bw.getResourceFromJid(i));else{if(void 0===qc.roster)return void Pn.error("Could not send notification, because roster is undefined");if(r=qc.roster.get(o),void 0!==r)n=Td("%1$s says",r.getDisplayName());else{if(!Wc.settings.get("allow_non_roster_messaging"))return;n=Td("%1$s says",o)}}else n=Td("Notification from %1$s",o);const s=t.is_encrypted?Td("Encrypted message received"):t.body;if(!s)return;const a=new Notification(n,{body:s,lang:qc.locale,icon:Wc.settings.get("notification_icon"),requireInteraction:!qc.notification_delay});Wc.settings.get("notification_delay")&&setTimeout(a.close.bind(a),Wc.settings.get("notification_delay")),a.onclick=function(e){e.preventDefault(),window.focus(),qc.chatboxes.get(o).maybeShow(!0)},a.onclick.bind(qc)},qc.showChatStateNotification=function(e){if(qc.chatstate_notification_blacklist.includes(e.jid))return;const t=e.chat_status;let n=null;if("offline"===t?n=Td("has gone offline"):"away"===t?n=Td("has gone away"):"dnd"===t?n=Td("is busy"):"online"===t&&(n=Td("has come online")),null===n)return;const r=new Notification(e.getDisplayName(),{body:n,lang:qc.locale,icon:qc.notification_icon});setTimeout(r.close.bind(r),5e3)},qc.showContactRequestNotification=function(e){const t=new Notification(e.getDisplayName(),{body:Td("wants to be your contact"),lang:qc.locale,icon:qc.notification_icon});setTimeout(t.close.bind(t),5e3)},qc.showFeedbackNotification=function(e){if("error"===e.klass||"warn"===e.klass){const t=new Notification(e.subject,{body:e.message,lang:qc.locale,icon:qc.notification_icon});setTimeout(t.close.bind(t),5e3)}},qc.handleChatStateNotification=function(e){qc.areDesktopNotificationsEnabled()&&Wc.settings.get("show_chat_state_notifications")&&qc.showChatStateNotification(e)},qc.handleMessageNotification=function(e){if(!qc.shouldNotifyOfMessage(e))return!1;Wc.trigger("messageNotification",e),qc.playSoundNotification(),qc.showMessageNotification(e)},qc.handleContactRequestNotification=function(e){qc.areDesktopNotificationsEnabled(!0)&&qc.showContactRequestNotification(e)},qc.handleFeedback=function(e){qc.areDesktopNotificationsEnabled(!0)&&qc.showFeedbackNotification(e)},qc.requestPermission=function(){Hw&&!["denied","granted"].includes(Notification.permission)&&Notification.requestPermission()},Wc.listen.on("clearSession",()=>Uw=null),Wc.waitUntil("chatBoxesInitialized").then(()=>qc.chatboxes.on("change:num_unread",$w)),Wc.listen.on("pluginsInitialized",(function(){Wc.listen.on("contactRequest",qc.handleContactRequestNotification),Wc.listen.on("contactPresenceChanged",qc.handleChatStateNotification),Wc.listen.on("message",qc.handleMessageNotification),Wc.listen.on("feedback",qc.handleFeedback),Wc.listen.on("connected",qc.requestPermission)}))}});const{Strophe:Kw,$iq:Zw}=tl.env,eS=tl.env.utils,tS=(e,t)=>Ya(Jw(),e.toggleCommandForm,t.node,t.jid,t.name,t.name,t.name||t.jid,t.node===e.showform?((e,t)=>{const n=Td("Hide"),r=Td("Execute");return Ya(Qw(),e.runCommand,t.alert?Ya(Xw(),t.alert_type,t.alert):"",t.node,t.jid,t.instructions,t.fields.map(e=>Zp(e)),r,n,e.hideCommandForm)})(e,t):"");async function nS(){const e=[...await Wc.rooms.get(),...await Wc.contacts.get()];return[...new Set(e.map(e=>Kw.getDomainFromJid(e.get("jid"))))]}function rS(){const e=oS(['\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 rS=function(){return e},e}function iS(){const e=oS(['\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 iS=function(){return e},e}function oS(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Wc.elements.define("converse-adhoc-commands",class extends pc{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(e=>{const t=Td("On which entity do you want to run commands?"),n=Td("Certain XMPP services and entities allow privileged users to execute ad-hoc commands on them."),r=Td("Commands found"),i=Td("List available commands"),o=Td("XMPP Address"),s=Td("No commands found");return Ya(Vw(),e.alert?Ya(Gw(),e.alert_type,e.alert):"",e.fetchCommands,t,n,nS,o,i,"list-commands"===e.view?Ya(Ww(),e.commands.length?r:s,e.commands.map(t=>tS(e,t))):"")})({alert:this.alert,alert_type:this.alert_type,commands:this.commands,fetchCommands:e=>this.fetchCommands(e),hideCommandForm:e=>this.hideCommandForm(e),runCommand:e=>this.runCommand(e),showform:this.showform,toggleCommandForm:e=>this.toggleCommandForm(e),view:this.view})}async fetchCommands(e){e.preventDefault(),delete this.alert_type,delete this.alert;const t=new FormData(e.target).get("jid").trim();let n;try{n=await Wc.disco.supports(Kw.NS.ADHOC,t)}catch(e){Pn.error(e)}if(n)try{this.commands=await Wc.adhoc.getCommands(t),this.view="list-commands"}catch(e){return Pn.error(e),this.alert_type="danger",this.alert=Td("Sorry, an error occurred while looking for commands on that entity."),this.commands=[],void Pn.error(e)}else this.alert_type="danger",this.alert=Td("The specified entity doesn't support ad-hoc commands")}async toggleCommandForm(e){e.preventDefault();const t=e.target.getAttribute("data-command-node"),n=this.commands.filter(e=>e.node===t)[0];this.showform!==t&&await async function(e){const t=e.node,n=e.jid,r=Zw({type:"set",to:n}).c("command",{xmlns:Kw.NS.ADHOC,node:t,action:"execute"});try{var i;const t=await Wc.sendIQ(r),n=pr()('command[xmlns="'.concat(Kw.NS.ADHOC,'"]'),t).pop();e.sessionid=n.getAttribute("sessionid"),e.instructions=null===(i=pr()('x[type="form"][xmlns="jabber:x:data"] instructions',n).pop())||void 0===i?void 0:i.textContent,e.fields=pr()('x[type="form"][xmlns="jabber:x:data"] field',n).map(e=>eS.xForm2webForm(e,n))}catch(t){null===t?Pn.error("Error: timeout while trying to execute command for ".concat(n)):(Pn.error("Error while trying to execute command for ".concat(n)),Pn.error(t)),e.fields=[]}}(n),this.showform=t}hideCommandForm(e){e.preventDefault(),this.showform=""}async runCommand(e){e.preventDefault();const t=new FormData(e.target),n=t.get("command_jid").trim(),r=t.get("command_node").trim(),i=this.commands.filter(e=>e.node===r)[0],o=pr()(":input:not([type=button]):not([type=submit])",e.target).filter(e=>!["command_jid","command_node"].includes(e.getAttribute("name"))).map(eS.webForm2xForm).filter(e=>e),s=Zw({to:n,type:"set"}).c("command",{sessionid:i.sessionid,node:i.node,xmlns:Kw.NS.ADHOC}).c("x",{xmlns:Kw.NS.XFORM,type:"submit"});let a;o.forEach(e=>s.cnode(e).up());try{a=await Wc.sendIQ(s)}catch(e){i.alert_type="danger",i.alert=Td("Sorry, an error occurred while trying to execute the command. See the developer console for details"),Pn.error("Error while trying to execute an ad-hoc command"),Pn.error(e)}var c;a?i.alert=null===(c=a.querySelector("note"))||void 0===c?void 0:c.textContent:i.alert="Done";i.alert_type="primary",this.nonce=eS.getUniqueId()}});var sS=e=>{const t=Td("Settings"),n=Td("%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">'),r=Td("%1$s Translate %2$s it into your own language",'<a target="_blank" rel="nofollow" href="https://hosted.weblate.org/projects/conversejs/#languages">',"</a>"),i=Wc.settings.get("show_client_info"),o=Wc.settings.get("allow_adhoc_commands"),s=i&&o;return Ya(rS(),t,ih,s?(e=>{const t=Td("About"),n=Td("Commands");return Ya(iS(),e.switchTab,t,e.switchTab,n)})(e):"",i?"active":"",e.version_name,Zp(Yp.a.filterXSS(n,{whiteList:{a:[]}})),Zp(Yp.a.filterXSS(r,{whiteList:{a:[]}})),!i&&o?"active":"")};let aS;var cS=mh.extend({id:"converse-client-info-modal",initialize(e){aS=e._converse,mh.prototype.initialize.apply(this,arguments)},toHTML(){return sS(Object.assign(this.model.toJSON(),this.model.vcard.toJSON(),{version_name:aS.VERSION_NAME}))}});function lS(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\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 lS=function(){return e},e}function uS(){const e=fS(['<a class="controlbox-heading__btn logout fa fa-sign-out-alt align-self-center" title="','"></a>']);return uS=function(){return e},e}function dS(){const e=fS(['<a class="controlbox-heading__btn show-client-info fa fa-cog align-self-center" title="','" @click=',"></a>"]);return dS=function(){return e},e}function hS(){const e=fS(['\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 hS=function(){return e},e}function fS(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function pS(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <a class="change-avatar" @click=',' title="','">\n ',"\n </a>\n <input @change=",' class="hidden" name="image" type="file"/>\n ']);return pS=function(){return e},e}const gS=Td("Your avatar image");function mS(){const e=ES(['\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 mS=function(){return e},e}function vS(){const e=ES(['\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 vS=function(){return e},e}function _S(){const e=ES(['\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 _S=function(){return e},e}function bS(){const e=ES(['\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 bS=function(){return e},e}function yS(){const e=ES(["\n ","\n"]);return yS=function(){return e},e}function wS(){const e=ES(['\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 wS=function(){return e},e}function SS(){const e=ES(['\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 SS=function(){return e},e}function xS(){const e=ES(['\n <span class="fingerprint">',"</span>"]);return xS=function(){return e},e}function ES(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Wc.elements.define("converse-image-picker",class extends pc{static get properties(){return{height:{type:Number},image:{type:String},width:{type:Number}}}render(){const e={height:this.height,image:this.image,width:this.width};return Ya(pS(),this.openFileSelection,gS,sp(e),this.updateFilePreview)}openFileSelection(e){e.preventDefault(),this.querySelector('input[type="file"]').click()}updateFilePreview(e){const t=e.target.files[0],n=new FileReader;n.onloadend=()=>this.image=n.result,n.readAsDataURL(t)}});const AS=tl.env.utils,CS=e=>Ya(yS(),e.device.get("bundle")&&e.device.get("bundle").fingerprint?(e=>{const t=Td("Checkbox for selecting the following fingerprint");return Ya(SS(),e.device.get("id"),t,AS.formatFingerprint(e.device.get("bundle").fingerprint))})(e):(e=>{const t=Td("Device without a fingerprint"),n=Td("Checkbox for selecting the following device");return Ya(wS(),e.device.get("id"),n,t)})(e)),jS=e=>{const t=Td("This device's OMEMO fingerprint"),n=Td("Generate new keys and fingerprint");return Ya(_S(),t,e.view.current_device&&e.view.current_device.get("bundle")&&e.view.current_device.get("bundle").fingerprint?(e=>Ya(xS(),AS.formatFingerprint(e.view.current_device.get("bundle").fingerprint)))(e):pp(),n,e.view.other_devices.length?(e=>{const t=Td("Other OMEMO-enabled devices"),n=Td("Checkbox to select fingerprints of all other OMEMO devices"),r=Td("Remove checked devices and close"),i=Td("Select all");return Ya(bS(),i,n,t,e.view.other_devices.map(t=>CS(Object.assign({device:t},e))),r)})(e):"")};
/**
* @module converse-profile
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const OS=tl.env.utils;tl.plugins.add("converse-profile",{dependencies:["converse-status","converse-modal","converse-vcard","converse-chatboxviews"],initialize(){Wc.settings.extend({allow_adhoc_commands:!0,show_client_info:!0}),qc.ProfileModal=mh.extend({id:"user-profile-modal",events:{"submit .profile-form":"onFormSubmitted"},initialize(){this.listenTo(this.model,"change",this.render),mh.prototype.initialize.apply(this,arguments),Wc.trigger("profileModalInitialized",this.model)},toHTML(){return(e=>{const t=Td("Your Profile"),n=Td("Email"),r=Td("Full Name"),i=Td("XMPP Address (JID)"),o=Td("Nickname"),s=Td("Role"),a=Td("Save and close"),c=Td("Use commas to separate multiple roles. Your roles are shown next to your name on your chat messages."),l=Td("URL"),u=Td("OMEMO"),d=Td("Profile"),h=Ya(vS(),d,u);return Ya(mS(),t,ih,qc.pluggable.plugins["converse-omemo"].enabled(qc)&&h||"",e.image,e.width,e.height,i,e.jid,r,e.fullname||"",o,e.nickname||"",l,e.url||"",n,e.email||"",s,e.role||"",c,a,qc.pluggable.plugins["converse-omemo"].enabled(qc)&&jS(e)||"")})(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=pr()(".nav-item .nav-link",this.el).map(e=>new Kd.a.Tab(e))},async setVCard(e){try{await Wc.vcard.set(qc.bare_jid,e)}catch(e){return Pn.fatal(e),void this.alert([Td("Sorry, an error happened while trying to save your profile data."),Td("You can check your browser's developer console for any error output.")].join(" "))}this.modal.hide()},onFormSubmitted(e){e.preventDefault();const t=new FileReader,n=new FormData(e.target),r=n.get("image"),i={fn:n.get("fn"),nickname:n.get("nickname"),role:n.get("role"),email:n.get("email"),url:n.get("url")};r.size?(t.onloadend=()=>{Object.assign(i,{image:btoa(t.result),image_type:r.type}),this.setVCard(i)},t.readAsBinaryString(r)):(Object.assign(i,{image:this.model.vcard.get("image"),image_type:this.model.vcard.get("image_type")}),this.setVCard(i))}}),qc.ChatStatusModal=mh.extend({id:"modal-status-change",events:{"submit form#set-xmpp-status":"onFormSubmitted","click .clear-input":"clearStatusMessage"},toHTML(){return e=Object.assign(this.model.toJSON(),this.model.vcard.toJSON(),{label_away:Td("Away"),label_busy:Td("Busy"),label_cancel:Td("Cancel"),label_close:Td("Close"),label_custom_status:Td("Custom status"),label_offline:Td("Offline"),label_online:Td("Online"),label_save:Td("Save"),label_xa:Td("Away for long"),modal_title:Td("Change chat status"),placeholder_status_message:Td("Personal status message")}),Ya(lS(),e.modal_title,ih,"online"===e.status,e.label_online,"busy"===e.status,e.label_busy,"away"===e.status,e.label_away,"xa"===e.status,e.label_xa,e.status_message||"",e.placeholder_status_message,e.status_message?"":"hidden",e.label_save);var e},afterRender(){this.el.addEventListener("shown.bs.modal",()=>{this.el.querySelector('input[name="status_message"]').focus()},!1)},clearStatusMessage(e){e&&e.preventDefault&&(e.preventDefault(),OS.hideElement(this.el.querySelector(".clear-input"))),this.el.querySelector('input[name="status_message"]').value=""},onFormSubmitted(e){e.preventDefault();const t=new FormData(e.target);this.model.save({status_message:t.get("status_message"),status:t.get("chat_status")}),this.modal.hide()}}),qc.XMPPStatusView=qc.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 e=this.model.get("status")||"offline";return(e=>{const t=Td("Log out"),n=Td("Click to change your chat status"),r=Td("Show details about this chat client"),i=Wc.settings.get("show_client_info")||Wc.settings.get("allow_adhoc_commands");return Ya(hS(),e.fullname,i?Ya(dS(),r,e.showUserSettingsModal):"",Wc.settings.get("allow_logout")?Ya(uS(),t):"",n,e.chat_status,e.chat_status,"online"===e.chat_status&&"fa fa-circle chat-status chat-status--online","dnd"===e.chat_status&&"fa fa-minus-circle chat-status chat-status--busy","away"===e.chat_status&&"fa fa-circle chat-status chat-status--away","xa"===e.chat_status&&"far fa-circle chat-status chat-status--xa ","offline"===e.chat_status&&"fa fa-circle chat-status chat-status--offline",e.status_message)})(Object.assign(this.model.toJSON(),this.model.vcard.toJSON(),{chat_status:e,fullname:this.model.vcard.get("fullname")||qc.bare_jid,showUserSettingsModal:e=>this.showUserSettingsModal(e),status_message:this.model.get("status_message")||Td("I am %1$s",this.getPrettyStatus(e))}))},afterRender(){this.renderAvatar()},showProfileModal(e){e.preventDefault(),void 0===this.profile_modal&&(this.profile_modal=new qc.ProfileModal({model:this.model})),this.profile_modal.show(e)},showStatusChangeModal(e){e.preventDefault(),void 0===this.status_modal&&(this.status_modal=new qc.ChatStatusModal({model:this.model})),this.status_modal.show(e)},showUserSettingsModal(e){e.preventDefault(),void 0===this.user_settings_modal&&(this.user_settings_modal=new cS({model:this.model,_converse:qc})),this.user_settings_modal.show(e)},logOut(e){e.preventDefault(),!0===confirm(Td("Are you sure you want to log out?"))&&Wc.user.logout()},getPrettyStatus:e=>"chat"===e?Td("online"):"dnd"===e?Td("busy"):"xa"===e?Td("away for long"):"away"===e?Td("away"):"offline"===e?Td("offline"):Td(e)||Td("online")}),Wc.listen.on("controlBoxPaneInitialized",async e=>{await Wc.waitUntil("VCardsInitialized"),qc.xmppstatusview=new qc.XMPPStatusView({model:qc.xmppstatus}),e.el.insertAdjacentElement("afterBegin",qc.xmppstatusview.render().el)})}});var TS=function(){var e=arguments.length;if(!e)return[];for(var t=Array(e-1),n=arguments[0],r=e;r--;)t[r-1]=arguments[r];return dt(ke(n)?it(n):[n],No(t,1))},kS=Math.ceil,NS=Math.max;var IS=function(e,t,n,r){for(var i=-1,o=NS(kS((t-e)/(n||1)),0),s=Array(o);o--;)s[r?o:++i]=e,e+=n;return s};var MS=function(e){return function(t,n,r){return r&&"number"!=typeof r&&Cr(t,n,r)&&(n=r=void 0),t=ui(t),void 0===n?(n=t,t=0):n=ui(n),r=void 0===r?t<n?1:-1:ui(r),IS(t,n,r,e)}}();function RS(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}
/**
* @module converse-omemo
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/(['\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 RS=function(){return e},e}const{Strophe:DS,sizzle:PS,$build:LS,$iq:FS,$msg:zS}=tl.env,BS=tl.env.utils;DS.addNamespace("OMEMO_DEVICELIST",DS.NS.OMEMO+".devicelist"),DS.addNamespace("OMEMO_VERIFICATION",DS.NS.OMEMO+".verification"),DS.addNamespace("OMEMO_WHITELISTED",DS.NS.OMEMO+".whitelisted"),DS.addNamespace("OMEMO_BUNDLES",DS.NS.OMEMO+".bundles");const qS={name:"AES-GCM",length:128};class HS extends Error{constructor(e,t){super(e,t),this.name="IQError",this.iq=t}}function US(e,t){return t.is_encrypted&&t.encrypted.key?!0===t.encrypted.prekey?async function(e){const t=VS(e.from,parseInt(e.encrypted.device_id,10)),n=BS.base64ToArrayBuffer(e.encrypted.key);let r;try{r=await t.decryptPreKeyWhisperMessage(n,"binary")}catch(t){return Pn.error("".concat(t.name," ").concat(t.message)),Object.assign(e,XS(t))}try{const t=await JS(e,r);return await qc.omemo_store.generateMissingPreKeys(),await qc.omemo_store.publishBundle(),t?Object.assign(e,{plaintext:t}):Object.assign(e,{is_only_key:!0})}catch(t){return Pn.error("".concat(t.name," ").concat(t.message)),Object.assign(e,XS(t))}}(t):async function(e){const t=e.from_muc?e.from_real_jid:e.from;t||Object.assign(e,{error_text:Td("Sorry, could not decrypt a received OMEMO because we don't have the JID for that user."),error_type:"Decryption",is_ephemeral:!1,is_error:!0,type:"error"});const n=VS(t,parseInt(e.encrypted.device_id,10)),r=BS.base64ToArrayBuffer(e.encrypted.key);try{const t=await n.decryptWhisperMessage(r,"binary"),i=await JS(e,t);return Object.assign(e,{plaintext:i})}catch(t){return Pn.error("".concat(t.name," ").concat(t.message)),Object.assign(e,XS(t))}}(t):t}function $S(){qc.chatboxes.on("add",e=>{ix(e),e.get("type")===qc.CHATROOMS_TYPE&&(e.occupants.on("add",t=>async function(e,t){if(t.isSelf()||!e.features.get("nonanonymous")||!e.features.get("membersonly"))return;if(e.get("omemo_active")){await qc.contactHasOMEMOSupport(t.get("jid"))||(e.createMessage({message:Td("%1$s doesn't appear to have a client that supports OMEMO. Encrypted chat will no longer be possible in this grouchat.",t.get("nick")),type:"error"}),e.save({omemo_active:!1,omemo_supported:!1}))}}(e,t)),e.features.on("change",()=>ix(e)))})}function WS(e){e.listenTo(e.model.messages,"add",t=>{t.get("is_encrypted")&&!t.get("is_error")&&e.model.save("omemo_supported",!0)}),e.listenTo(e.model,"change:omemo_supported",()=>{var t;!e.model.get("omemo_supported")&&e.model.get("omemo_active")?e.model.set("omemo_active",!1):null===(t=e.el.querySelector("converse-chat-toolbar"))||void 0===t||t.requestUpdate()}),e.listenTo(e.model,"change:omemo_active",()=>{e.el.querySelector("converse-chat-toolbar").requestUpdate()})}const GS=tl.env.omemo={async encryptMessage(e){const t=crypto.getRandomValues(new window.Uint8Array(12)),n=await crypto.subtle.generateKey(qS,!0,["encrypt","decrypt"]),r={name:"AES-GCM",iv:t,tagLength:128},i=await crypto.subtle.encrypt(r,n,BS.stringToArrayBuffer(e)),o=i.byteLength-16,s=i.slice(0,o),a=i.slice(o),c=await crypto.subtle.exportKey("raw",n);return{key:c,tag:a,key_and_tag:BS.appendArrayBuffer(c,a),payload:BS.arrayBufferToBase64(s),iv:BS.arrayBufferToBase64(t)}},async decryptMessage(e){const t=await crypto.subtle.importKey("raw",e.key,qS,!0,["encrypt","decrypt"]),n=BS.appendArrayBuffer(BS.base64ToArrayBuffer(e.payload),e.tag),r={name:"AES-GCM",iv:BS.base64ToArrayBuffer(e.iv),tagLength:128};return BS.arrayBufferToString(await crypto.subtle.decrypt(r,t,n))}};function VS(e,t){const n=new libsignal.SignalProtocolAddress(e,t);return new window.libsignal.SessionCipher(qc.omemo_store,n)}async function JS(e,t){const n=e.encrypted,r=qc.devicelists.getDeviceList(e.from);await r._devices_promise;let i=r.get(n.device_id);if(i||(i=await r.devices.create({id:n.device_id,jid:e.from},{promise:!0})),n.payload){const e=t.slice(0,16),r=t.slice(16),o=await GS.decryptMessage(Object.assign(n,{key:e,tag:r}));return i.save("active",!0),o}}function XS(e){return"debug"===Wc.settings.get("loglevel")?{error_text:Td("Sorry, could not decrypt a received OMEMO message due to an error.")+" ".concat(e.name," ").concat(e.message),error_type:"Decryption",is_ephemeral:!0,is_error:!0,type:"error"}:{}}function QS(e){const t=e.querySelector("signedPreKeyPublic"),n=e.querySelector("signedPreKeySignature"),r=PS("prekeys > preKeyPublic",e).map(e=>({id:parseInt(e.getAttribute("preKeyId"),10),key:e.textContent}));return{identity_key:e.querySelector("identityKey").textContent.trim(),signed_prekey:{id:parseInt(t.getAttribute("signedPreKeyId"),10),public_key:t.textContent,signature:n.textContent},prekeys:r}}async function YS(e){var t;if(null===(t=e.get("bundle"))||void 0===t?void 0:t.fingerprint)return;const n=await e.getBundle();n.fingerprint=BS.arrayBufferToHex(BS.base64ToArrayBuffer(n.identity_key)),e.save("bundle",n),e.trigger("change:bundle")}async function KS(e){await Wc.waitUntil("OMEMOInitialized");const t=qc.devicelists.get(e)||qc.devicelists.create({jid:e});return await t.fetchDevices(),t.devices}async function ZS(e){if(!e.get("bundle"))return Pn.error("Could not build an OMEMO session for device ".concat(e.get("id")," because we don't have its bundle")),null;const t=new libsignal.SignalProtocolAddress(e.get("jid"),e.get("id")),n=await qc.omemo_store.loadSession(t.toString());if(n)return n;try{return await async function(e){const t=new libsignal.SignalProtocolAddress(e.get("jid"),e.get("id")),n=new libsignal.SessionBuilder(qc.omemo_store,t),r=e.getRandomPreKey(),i=await e.getBundle();return n.processPreKey({registrationId:parseInt(e.get("id"),10),identityKey:BS.base64ToArrayBuffer(i.identity_key),signedPreKey:{keyId:i.signed_prekey.id,publicKey:BS.base64ToArrayBuffer(i.signed_prekey.public_key),signature:BS.base64ToArrayBuffer(i.signed_prekey.signature)},preKey:{keyId:r.id,publicKey:BS.base64ToArrayBuffer(r.key)}})}(e)}catch(t){return Pn.error("Could not build an OMEMO session for device ".concat(e.get("id"))),Pn.error(t),null}}function ex(){qc.connection.addHandler(e=>{try{PS('event[xmlns="'.concat(DS.NS.PUBSUB,'#event"]'),e).length&&(function(e){const t=PS('items[node="'.concat(DS.NS.OMEMO_DEVICELIST,'"]'),e).pop();if(!t)return;const n='item list[xmlns="'.concat(DS.NS.OMEMO,'"] device'),r=PS(n,t).map(e=>e.getAttribute("id")),i=e.getAttribute("from"),o=qc.devicelists.getDeviceList(i),s=o.devices;Os(s.pluck("id"),r).forEach(e=>{i===qc.bare_jid&&e===qc.omemo_store.get("device_id")||s.get(e).save("active",!1)}),r.forEach(e=>{const t=s.get(e);t?t.save("active",!0):s.create({id:e,jid:i})}),BS.isSameBareJID(i,qc.bare_jid)&&o.publishCurrentDevice(r)}(e),function(e){const t=PS("items",e).pop();if(!t||!t.getAttribute("node").startsWith(DS.NS.OMEMO_BUNDLES))return;const n=t.getAttribute("node").split(":")[1],r=e.getAttribute("from"),i=PS("item > bundle",t).pop(),o=qc.devicelists.getDeviceList(r);(o.devices.get(n)||o.devices.create({id:n,jid:r})).save({bundle:QS(i)})}(e))}catch(e){Pn.error(e.message)}return!0},null,"message","headline")}function tx(){if(void 0===qc.omemo_store){const e="converse.omemosession-".concat(qc.bare_jid);qc.omemo_store=new qc.OMEMOStore({id:e}),qc.omemo_store.browserStorage=qc.createStore(e)}return qc.omemo_store.fetchSession()}async function nx(){await new Promise((e,t)=>qc.devicelists.fetch({success:e,error:(e,n)=>t(n)}));let e=qc.devicelists.get(qc.bare_jid);return e?e.fetchDevices():e=await qc.devicelists.create({jid:qc.bare_jid},{promise:!0}),e._devices_promise}async function rx(){if(!qc.config.get("trusted")||Wc.settings.get("clear_cache_on_logout"))return void Pn.warn("Not initializing OMEMO, since this browser is not trusted or clear_cache_on_logout is set to true");qc.devicelists=new qc.DeviceLists;const e="converse.devicelists-".concat(qc.bare_jid);qc.devicelists.browserStorage=qc.createStore(e);try{await nx(),await tx(),await qc.omemo_store.publishBundle()}catch(e){return Pn.error("Could not initialize OMEMO support"),void Pn.error(e)}Wc.trigger("OMEMOInitialized")}async function ix(e){let t;e.get("type")===qc.CHATROOMS_TYPE?(await Wc.waitUntil("OMEMOInitialized"),t=e.features.get("nonanonymous")&&e.features.get("membersonly")):e.get("type")===qc.PRIVATE_CHAT_TYPE&&(t=await qc.contactHasOMEMOSupport(e.get("jid"))),e.set("omemo_supported",t),t&&Wc.settings.get("omemo_default")&&e.set("omemo_active",!0)}function ox(e){e.stopPropagation(),e.preventDefault();const t=BS.ancestor(e.target,"converse-chat-toolbar");if(!t.model.get("omemo_supported")){let e;return e=t.model.get("type")===qc.CHATROOMS_TYPE?[Td("Cannot use end-to-end encryption in this groupchat, either the groupchat has some anonymity or not all participants support OMEMO.")]:[Td("Cannot use end-to-end encryption because %1$s uses a client that doesn't support OMEMO.",t.model.contact.getDisplayName())],Wc.alert("error",Td("Error"),e)}t.model.save({omemo_active:!t.model.get("omemo_active")})}function sx(e,t){const n=e.model;let r;if(n.get("type")===qc.CHATROOMS_TYPE&&n.get("omemo_supported")){const e=Td("Messages are being sent in plaintext"),t=Td("Messages are sent encrypted");r=n.get("omemo_active")?t:e}else r=Td("This groupchat needs to be members-only and non-anonymous in order to support OMEMO encrypted messages");return t.push(Ya(RS(),r,!n.get("omemo_supported"),ox,n.get("omemo_active")?"fa-lock":"fa-unlock",Wc.settings.get("assets_path"),n.get("omemo_active")?"var(--info-color)":"var(--error-color)")),t}const ax={encryptKey:(e,t)=>VS(t.get("jid"),t.get("id")).encrypt(e).then(e=>({payload:e,device:t})),handleMessageSendError(e){if("IQError"===e.name){this.save("omemo_supported",!1);const t=[];PS('presence-subscription-required[xmlns="'.concat(DS.NS.PUBSUB_ERROR,'"]'),e.iq).length?t.push(Td("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",e.iq.getAttribute("from"))):PS('remote-server-not-found[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]',e.iq).length?t.push(Td("Sorry, we're unable to send an encrypted message because the remote server for %1$s could not be found",e.iq.getAttribute("from"))):(t.push(Td("Unable to send an encrypted message due to an unexpected error.")),t.push(e.iq.outerHTML)),Wc.alert("error",Td("Error"),t),Pn.error(e)}else{if(!e.user_facing)throw e;Wc.alert("error",Td("Error"),[e.message]),Pn.error(e)}}};tl.plugins.add("converse-omemo",{enabled:e=>window.libsignal&&e.config.get("trusted")&&!Wc.settings.get("clear_cache_on_logout")&&!e.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=Ic(this.render,50),this.devicelist=qc.devicelists.get(qc.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 e=qc.omemo_store.get("device_id");if(e&&(this.current_device=this.devicelist.devices.get(e)),this.other_devices=this.devicelist.devices.filter(t=>t.get("id")!==e),this.__super__.beforeRender)return this.__super__.beforeRender.apply(this,arguments)},selectAll(e){let t=BS.ancestor(e.target,"li");for(;t;)t.querySelector('input[type="checkbox"]').checked=e.target.checked,t=t.nextElementSibling},removeSelectedFingerprints(e){e.preventDefault(),e.stopPropagation(),e.target.querySelector(".select-all").checked=!1;const t=PS('.fingerprint-removal-item input[type="checkbox"]:checked',e.target).map(e=>e.value);this.devicelist.removeOwnDevices(t).then(this.modal.hide).catch(e=>{Pn.error(e),qc.api.alert(DS.LogLevel.ERROR,Td("Error"),[Td("Sorry, an error occurred while trying to remove the devices.")])})},generateOMEMODeviceBundle(e){e.preventDefault(),confirm(Td("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."))&&Wc.omemo.bundle.generate()}},UserDetailsModal:{events:{"click .fingerprint-trust .btn input":"toggleDeviceTrust"},initialize(){const e=this.model.get("jid");return this.devicelist=qc.devicelists.getDeviceList(e),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(e){const t=e.target;this.devicelist.devices.get(t.getAttribute("name")).save("trusted",parseInt(t.value,10))}},ChatBox:{async sendMessage(e,t){if(this.get("omemo_active")&&e){const n=this.getOutgoingMessageAttributes(e,t);let r,i;n.is_encrypted=!0,n.plaintext=n.message;try{const e=await qc.getBundlesAndBuildSessions(this);r=await this.createMessage(n),i=await qc.createOMEMOMessageStanza(this,r,e)}catch(e){return this.handleMessageSendError(e),null}return qc.api.send(i),r}return this.__super__.sendMessage.apply(this,arguments)}}},initialize(){Wc.settings.extend({omemo_default:!1}),Wc.promises.add(["OMEMOInitialized"]),qc.NUM_PREKEYS=100,Object.assign(qc.ChatBox.prototype,ax),qc.generateFingerprints=async function(e){const t=await KS(e);return Promise.all(t.map(e=>YS(e)))},qc.getDeviceForContact=function(e,t){return KS(e).then(e=>e.get(t))},qc.contactHasOMEMOSupport=async function(e){return(await KS(e)).length>0},qc.getBundlesAndBuildSessions=async function(e){const t=Td("Sorry, no devices found to which we can send an OMEMO encrypted message.");let n;if(e.get("type")===qc.CHATROOMS_TYPE){const t=await Promise.all(e.occupants.map(e=>KS(e.get("jid"))));n=t.reduce((e,t)=>TS(e,t.models),[])}else if(e.get("type")===qc.PRIVATE_CHAT_TYPE){const r=await KS(e.get("jid"));if(0===r.length){const e=new Error(t);throw e.user_facing=!0,e}const i=qc.devicelists.get(qc.bare_jid).devices;n=[...i.models,...r.models]}const r=qc.omemo_store.get("device_id");n=n.filter(e=>e.get("id")!==r),await Promise.all(n.map(e=>e.getBundle()));const i=n.filter(e=>e).map(e=>ZS(e));if(await Promise.all(i),i.includes(null)&&(n=n.filter(e=>i[n.indexOf(e)]),0===n.length)){const e=new Error(t);throw e.user_facing=!0,e}return n},qc.createOMEMOMessageStanza=function(e,t,n){const r=Td("This is an OMEMO encrypted message which your client doesnt seem to support. Find more information on https://conversations.im/omemo");if(!t.get("message"))throw new Error("No message body to encrypt!");const i=zS({from:qc.connection.jid,to:e.get("jid"),type:e.get("message_type"),id:t.get("msgid")}).c("body").t(r).up();return"chat"===t.get("type")&&i.c("request",{xmlns:DS.NS.RECEIPTS}).up(),i.c("encrypted",{xmlns:DS.NS.OMEMO}).c("header",{sid:qc.omemo_store.get("device_id")}),GS.encryptMessage(t.get("message")).then(t=>{const r=n.filter(e=>-1!=e.get("trusted")&&e.get("active")).map(n=>e.encryptKey(t.key_and_tag,n));return Promise.all(r).then(e=>function(e,t,n){for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)){const i=t[r].payload,o=t[r].device,s=3==parseInt(i.type,10);e.c("key",{rid:o.get("id")}).t(btoa(i.body)),s&&e.attrs({prekey:s}),e.up(),r==t.length-1&&e.c("iv").t(n).up().up()}return Promise.resolve(e)}(i,e,t.iv)).then(e=>(e.c("payload").t(t.payload).up().up(),e.c("store",{xmlns:DS.NS.HINTS}),e))})},qc.OMEMOStore=zo.extend({Direction:{SENDING:1,RECEIVING:2},getIdentityKeyPair(){const e=this.get("identity_keypair");return Promise.resolve({privKey:BS.base64ToArrayBuffer(e.privKey),pubKey:BS.base64ToArrayBuffer(e.pubKey)})},getLocalRegistrationId(){return Promise.resolve(parseInt(this.get("device_id"),10))},isTrustedIdentity(e,t,n){if(null==e)throw new Error("Can't check identity key for invalid key");if(!(t instanceof ArrayBuffer))throw new Error("Expected identity_key to be an ArrayBuffer");const r=this.get("identity_key"+e);return void 0===r?Promise.resolve(!0):Promise.resolve(BS.arrayBufferToBase64(t)===r)},loadIdentityKey(e){if(null==e)throw new Error("Can't load identity_key for invalid identifier");return Promise.resolve(BS.base64ToArrayBuffer(this.get("identity_key"+e)))},saveIdentity(e,t){if(null==e)throw new Error("Can't save identity_key for invalid identifier");const n=new libsignal.SignalProtocolAddress.fromString(e),r=this.get("identity_key"+n.getName()),i=BS.arrayBufferToBase64(t);return this.save("identity_key"+n.getName(),i),r&&i!==r?Promise.resolve(!0):Promise.resolve(!1)},getPreKeys(){return this.get("prekeys")||{}},loadPreKey(e){const t=this.getPreKeys()[e];return t?Promise.resolve({privKey:BS.base64ToArrayBuffer(t.privKey),pubKey:BS.base64ToArrayBuffer(t.pubKey)}):Promise.resolve()},storePreKey(e,t){const n={};return n[e]={pubKey:BS.arrayBufferToBase64(t.pubKey),privKey:BS.arrayBufferToBase64(t.privKey)},this.save("prekeys",Object.assign(this.getPreKeys(),n)),Promise.resolve()},removePreKey(e){return this.save("prekeys",Ro(this.getPreKeys(),e)),Promise.resolve()},loadSignedPreKey(e){const t=this.get("signed_prekey");return t?Promise.resolve({privKey:BS.base64ToArrayBuffer(t.privKey),pubKey:BS.base64ToArrayBuffer(t.pubKey)}):Promise.resolve()},storeSignedPreKey(e){if("object"!=typeof e)throw new Error("storeSignedPreKey: expected an object");return this.save("signed_prekey",{id:e.keyId,privKey:BS.arrayBufferToBase64(e.keyPair.privKey),pubKey:BS.arrayBufferToBase64(e.keyPair.pubKey),signature:BS.arrayBufferToBase64(e.signature)}),Promise.resolve()},removeSignedPreKey(e){return this.get("signed_prekey").id===e&&(this.unset("signed_prekey"),this.save()),Promise.resolve()},loadSession(e){return Promise.resolve(this.get("session"+e))},storeSession(e,t){return Promise.resolve(this.save("session"+e,t))},removeSession(e){return Promise.resolve(this.unset("session"+e))},removeAllSessions(e){const t=Object.keys(this.attributes).filter(t=>!!t.startsWith("session"+e)&&t),n={};return t.forEach(e=>{n[e]=void 0}),this.save(n),Promise.resolve()},publishBundle(){const e=this.get("signed_prekey"),t="".concat(DS.NS.OMEMO_BUNDLES,":").concat(this.get("device_id")),n=LS("item").c("bundle",{xmlns:DS.NS.OMEMO}).c("signedPreKeyPublic",{signedPreKeyId:e.id}).t(e.pubKey).up().c("signedPreKeySignature").t(e.signature).up().c("identityKey").t(this.get("identity_keypair").pubKey).up().c("prekeys");Object.values(this.get("prekeys")).forEach((e,t)=>n.c("preKeyPublic",{preKeyId:t}).t(e.pubKey).up());return Wc.pubsub.publish(null,t,n,{"pubsub#access_model":"open"},!1)},async generateMissingPreKeys(){const e=Os(Jd(MS(0,qc.NUM_PREKEYS),Number.prototype.toString),Object.keys(this.getPreKeys()));if(e.length<1)return Pn.warn("No missing prekeys to generate for our own device"),Promise.resolve();(await Promise.all(e.map(e=>libsignal.KeyHelper.generatePreKey(parseInt(e,10))))).forEach(e=>this.storePreKey(e.keyId,e.keyPair));const t=Object.keys(this.getPreKeys()).map(e=>({id:e.keyId,key:BS.arrayBufferToBase64(e.pubKey)})),n=qc.devicelists.get(qc.bare_jid).devices.get(this.get("device_id")),r=await n.getBundle();n.save("bundle",Object.assign(r,{prekeys:t}))},async generateBundle(){const e=await libsignal.KeyHelper.generateIdentityKeyPair(),t={},n=BS.arrayBufferToBase64(e.pubKey),r=function(){const e=qc.devicelists.get(qc.bare_jid).devices.pluck("id");let t=libsignal.KeyHelper.generateRegistrationId(),n=0;for(;e.includes(t);)if(t=libsignal.KeyHelper.generateRegistrationId(),n++,10===n)throw new Error("Unable to generate a unique device ID");return t.toString()}();t.identity_key=n,t.device_id=r,this.save({device_id:r,identity_keypair:{privKey:BS.arrayBufferToBase64(e.privKey),pubKey:n},identity_key:n});const i=await libsignal.KeyHelper.generateSignedPreKey(e,0);qc.omemo_store.storeSignedPreKey(i),t.signed_prekey={id:i.keyId,public_key:BS.arrayBufferToBase64(i.keyPair.privKey),signature:BS.arrayBufferToBase64(i.signature)};const o=await Promise.all(MS(0,qc.NUM_PREKEYS).map(e=>libsignal.KeyHelper.generatePreKey(e)));o.forEach(e=>qc.omemo_store.storePreKey(e.keyId,e.keyPair));const s=qc.devicelists.get(qc.bare_jid),a=await s.devices.create({id:t.device_id,jid:qc.bare_jid},{promise:!0}),c=o.map(e=>({id:e.keyId,key:BS.arrayBufferToBase64(e.keyPair.pubKey)}));t.prekeys=c,a.save("bundle",t)},fetchSession(){return void 0===this._setup_promise&&(this._setup_promise=new Promise((e,t)=>{this.fetch({success:()=>{qc.omemo_store.get("device_id")?e():this.generateBundle().then(e).catch(t)},error:(n,r)=>{Pn.warn("Could not fetch OMEMO session from cache, we'll generate a new one."),Pn.warn(r),this.generateBundle().then(e).catch(t)}})})),this._setup_promise}}),qc.Device=zo.extend({defaults:{trusted:0,active:!0},getRandomPreKey(){const e=this.get("bundle");return e.prekeys[BS.getRandomInt(e.prekeys.length)]},async fetchBundleFromServer(){const e=FS({type:"get",from:qc.bare_jid,to:this.get("jid")}).c("pubsub",{xmlns:DS.NS.PUBSUB}).c("items",{node:"".concat(DS.NS.OMEMO_BUNDLES,":").concat(this.get("id"))});let t;try{t=await Wc.sendIQ(e)}catch(t){return Pn.error("Could not fetch bundle for device ".concat(this.get("id")," from ").concat(this.get("jid"))),Pn.error(t),null}if(t.querySelector("error"))throw new HS("Could not fetch bundle",t);const n=PS('items[node="'.concat(DS.NS.OMEMO_BUNDLES,":").concat(this.get("id"),'"]'),t).pop(),r=QS(PS('bundle[xmlns="'.concat(DS.NS.OMEMO,'"]'),n).pop());return this.save("bundle",r),r},getBundle(){return this.get("bundle")?Promise.resolve(this.get("bundle"),this):this.fetchBundleFromServer()}}),qc.Devices=ta.extend({model:qc.Device}),qc.DeviceList=zo.extend({idAttribute:"jid",initialize(){this.devices=new qc.Devices;const e="converse.devicelist-".concat(qc.bare_jid,"-").concat(this.get("jid"));this.devices.browserStorage=qc.createStore(e),this.fetchDevices()},async onDevicesFound(e){if(0===e.length){let e;try{e=await this.fetchDevicesFromServer()}catch(e){null===e?Pn.error("Timeout error while fetching devices for ".concat(this.get("jid"))):(Pn.error("Could not fetch devices for ".concat(this.get("jid"))),Pn.error(e)),this.destroy()}this.get("jid")===qc.bare_jid&&await this.publishCurrentDevice(e)}},fetchDevices(){return void 0===this._devices_promise&&(this._devices_promise=new Promise(e=>{this.devices.fetch({success:t=>e(this.onDevicesFound(t)),error:(t,n)=>{Pn.error(n),e()}})})),this._devices_promise},async getOwnDeviceId(){let e=qc.omemo_store.get("device_id");return this.devices.findWhere({id:e})||(await qc.omemo_store.generateBundle(),e=qc.omemo_store.get("device_id")),e},async publishCurrentDevice(e){if(this.get("jid")===qc.bare_jid){if(await tx(),qc.omemo_store)return e.includes(await this.getOwnDeviceId())?void 0:this.publishDevices();Pn.warn("publishCurrentDevice: omemo_store is not defined, likely a timing issue")}},async fetchDevicesFromServer(){const e=FS({type:"get",from:qc.bare_jid,to:this.get("jid")}).c("pubsub",{xmlns:DS.NS.PUBSUB}).c("items",{node:DS.NS.OMEMO_DEVICELIST});let t;try{t=await Wc.sendIQ(e)}catch(e){return Pn.error(e),[]}const n='list[xmlns="'.concat(DS.NS.OMEMO,'"] device'),r=PS(n,t).map(e=>e.getAttribute("id"));return await Promise.all(r.map(e=>this.devices.create({id:e,jid:this.get("jid")},{promise:!0}))),r},publishDevices(){const e=LS("item",{id:"current"}).c("list",{xmlns:DS.NS.OMEMO});this.devices.filter(e=>e.get("active")).forEach(t=>e.c("device",{id:t.get("id")}).up());return Wc.pubsub.publish(null,DS.NS.OMEMO_DEVICELIST,e,{"pubsub#access_model":"open"},!1)},removeOwnDevices(e){if(this.get("jid")!==qc.bare_jid)throw new Error("Cannot remove devices from someone else's device list");return e.forEach(e=>this.devices.get(e).destroy()),this.publishDevices()}}),qc.DeviceLists=ta.extend({model:qc.DeviceList,getDeviceList(e){return this.get(e)||this.create({jid:e})}}),Wc.waitUntil("chatBoxesInitialized").then($S),Wc.listen.on("parseMessage",US),Wc.listen.on("parseMUCMessage",US),Wc.listen.on("chatBoxViewInitialized",WS),Wc.listen.on("chatRoomViewInitialized",WS),Wc.listen.on("connected",ex),Wc.listen.on("getToolbarButtons",sx),Wc.listen.on("statusInitialized",rx),Wc.listen.on("addClientFeatures",()=>Wc.disco.own.features.add("".concat(DS.NS.OMEMO_DEVICELIST,"+notify"))),Wc.listen.on("userDetailsModalInitialized",e=>{const t=e.get("jid");qc.generateFingerprints(t).catch(e=>Pn.error(e))}),Wc.listen.on("profileModalInitialized",()=>{qc.generateFingerprints(qc.bare_jid).catch(e=>Pn.error(e))}),Wc.listen.on("afterTearDown",()=>delete qc.omemo_store),Wc.listen.on("clearSession",()=>{qc.shouldClearCache()&&qc.devicelists&&(qc.devicelists.clearStore(),delete qc.devicelists)}),Object.assign(qc.api,{omemo:{bundle:{generate:async()=>{const e=qc.devicelists.get(qc.bare_jid),t=qc.omemo_store.get("device_id");if(t){const n=e.devices.get(t);qc.omemo_store.unset(t),n&&await new Promise(e=>n.destroy({success:e,error:e})),e.devices.trigger("remove")}await qc.omemo_store.generateBundle(),await e.publishDevices();const n=YS(e.devices.get(qc.omemo_store.get("device_id")));return await qc.omemo_store.publishBundle(),n}}}})}});
/**
* @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:cx,$iq:lx}=tl.env;cx.addNamespace("PUSH","urn:xmpp:push:0"),tl.plugins.add("converse-push",{initialize(){async function e(e){e=e||qc.bare_jid;const t=qc.session.get("push_enabled")||[];if(t.includes(e))return;const n=Wc.settings.get("push_app_servers").filter(e=>!e.disable),r=Wc.settings.get("push_app_servers").filter(e=>e.disable),i=n.map(t=>async function(e,t){if(!t.jid||!t.node)return;if(!await Wc.disco.getIdentity("pubsub","push",t.jid))return Pn.warn('Not enabling push the service "'.concat(t.jid,"\", it doesn't have the right disco identtiy."));const n=await Promise.all([Wc.disco.supports(cx.NS.PUSH,t.jid),Wc.disco.supports(cx.NS.PUSH,e)]);if(!n[0]&&!n[1])return void Pn.warn('Not enabling push app server "'.concat(t.jid,'", no disco support from your server.'));const r=lx({type:"set"});return e!==qc.bare_jid&&r.attrs({to:e}),r.c("enable",{xmlns:cx.NS.PUSH,jid:t.jid,node:t.node}),t.secret&&r.c("x",{xmlns:cx.NS.XFORM,type:"submit"}).c("field",{var:"FORM_TYPE"}).c("value").t("".concat(cx.NS.PUBSUB,"#publish-options")).up().up().c("field",{var:"secret"}).c("value").t(t.secret),Wc.sendIQ(r)}(e,t)),o=r.map(t=>async function(e,t){if(!t.jid)return;if(!await Wc.disco.supports(cx.NS.PUSH,e||qc.bare_jid))return void Pn.warn('Not disabling push app server "'.concat(t.jid,'", no disco support from your server.'));const n=lx({type:"set"});e!==qc.bare_jid&&n.attrs({to:e}),n.c("disable",{xmlns:cx.NS.PUSH,jid:t.jid}),t.node&&n.attrs({node:t.node}),Wc.sendIQ(n).catch(e=>{Pn.error("Could not disable push app server for ".concat(t.jid)),Pn.error(e)})}(e,t));try{await Promise.all(i.concat(o))}catch(e){Pn.error("Could not enable or disable push App Server"),e&&Pn.error(e)}finally{t.push(e)}qc.session.save("push_enabled",t)}function t(t){t.get("type")==qc.CHATROOMS_TYPE&&e(cx.getDomainFromJid(t.get("jid")))}Wc.settings.extend({push_app_servers:[],enable_muc_push:!1}),Wc.listen.on("statusInitialized",()=>e()),Wc.settings.get("enable_muc_push")&&Wc.listen.on("chatBoxesInitialized",()=>qc.chatboxes.on("add",t))}});var ux=n(181),dx=n.n(ux),hx=n(182),fx=n.n(hx),px=n(183),gx=n.n(px);
/**
* @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:mx,sizzle:vx,$iq:_x}=tl.env,bx=tl.env.utils;mx.addNamespace("REGISTER","jabber:iq:register");const yx=Object.keys(mx.Status).reduce((e,t)=>Math.max(e,mx.Status[t]),0);function wx(){const e=Cx(['\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 wx=function(){return e},e}function Sx(){const e=Cx(['\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 Sx=function(){return e},e}function xx(){const e=Cx(['<span class="list-item-badge badge badge--muc msgs-indicator">',"</span>"]);return xx=function(){return e},e}function Ex(){const e=Cx(['\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 Ex=function(){return e},e}function Ax(){const e=Cx(['\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 Ax=function(){return e},e}function Cx(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}mx.Status.REGIFAIL=yx+1,mx.Status.REGISTERED=yx+2,mx.Status.CONFLICT=yx+3,mx.Status.NOTACCEPTABLE=yx+5,tl.plugins.add("converse-register",{enabled:()=>!0,overrides:{ControlBoxView:{renderLoginPanel(){return this.__super__.renderLoginPanel.apply(this,arguments),this.renderRegistrationPanel(),this}}},initialize(){function e(e){Wc.waitUntil("controlBoxInitialized").then(()=>{qc.chatboxes.get("controlbox").set({"active-form":e})}).catch(e=>Pn.fatal(e))}qc.CONNECTION_STATUS[mx.Status.REGIFAIL]="REGIFAIL",qc.CONNECTION_STATUS[mx.Status.REGISTERED]="REGISTERED",qc.CONNECTION_STATUS[mx.Status.CONFLICT]="CONFLICT",qc.CONNECTION_STATUS[mx.Status.NOTACCEPTABLE]="NOTACCEPTABLE",Wc.settings.extend({allow_registration:!0,domain_placeholder:Td(" e.g. conversejs.org"),providers_link:"https://compliance.conversations.im/",registration_domain:""}),Object.assign(qc.ControlBoxView.prototype,{showLoginOrRegisterForm(){this.registerpanel&&("register"==this.model.get("active-form")?(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(Wc.settings.get("allow_registration")){this.registerpanel=new qc.RegisterPanel({model:this.model}),this.registerpanel.render(),this.registerpanel.el.classList.add("hidden");const e=this.el.querySelector("#converse-login-panel");e&&e.insertAdjacentElement("afterend",this.registerpanel.el),this.showLoginOrRegisterForm()}return this}}),qc.router.route("converse/login",()=>e("login")),qc.router.route("converse/register",()=>e("register")),qc.RegisterPanel=Wd.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(),Wc.listen.on("connectionInitialized",()=>this.registerHooks())},render(){return this.model.set("registration_form_rendered",!1),this.el.innerHTML=dx()({__:Td,default_domain:Wc.settings.get("registration_domain"),label_register:Td("Fetch registration form"),help_providers:Td("Tip: A list of public XMPP providers is available"),help_providers_link:Td("here"),href_providers:Wc.settings.get("providers_link"),domain_placeholder:Wc.settings.get("domain_placeholder")}),Wc.settings.get("registration_domain")&&this.fetchRegistrationForm(Wc.settings.get("registration_domain")),this},registerHooks(){const e=qc.connection,t=e._connect_cb.bind(e);e._connect_cb=(e,n,r)=>{this._registering?this.getRegistrationFields(e,n)&&(this._registering=!1):t(e,n,r)}},getRegistrationFields(e,t){const n=qc.connection;n.connected=!0;const r=n._proto._reqToData(e);if(!r)return;if(n._proto._connect_cb(r)===mx.Status.CONNFAIL)return this.showValidationError(Td("Sorry, we're unable to connect to your chosen provider.")),!1;const i=r.getElementsByTagName("register"),o=r.getElementsByTagName("mechanism");if(0===i.length&&0===o.length)return n._proto._no_auth_received(t),!1;if(0===i.length)return n._changeConnectStatus(mx.Status.REGIFAIL),this.showValidationError(Td("Sorry, the given provider does not support in band account registration. Please try with a different provider.")),!0;n._addSysHandler(this.onRegistrationFields.bind(this),null,"iq",null,null);const s=_x({type:"get"}).c("query",{xmlns:mx.NS.REGISTER}).tree();return s.setAttribute("id",n.getUniqueId("sendIQ")),n.send(s),n.connected=!1,!0},onRegistrationFields(e){return"error"===e.getAttribute("type")?(qc.connection._changeConnectStatus(mx.Status.REGIFAIL,Td('Something went wrong while establishing a connection with "%1$s". Are you sure it exists?',this.domain)),!1):1!==e.getElementsByTagName("query").length?(qc.connection._changeConnectStatus(mx.Status.REGIFAIL,"unknown"),!1):(this.setFields(e),this.model.get("registration_form_rendered")||this.renderRegistrationForm(e),!1)},reset(e){const t={fields:{},urls:[],title:"",instructions:"",registered:!1,_registering:!1,domain:null,form_type:null};Object.assign(this,t),e&&Object.assign(this,Fo(e,Object.keys(t)))},onFormSubmission(e){e&&e.preventDefault&&e.preventDefault(),null===e.target.querySelector("input[name=domain]")?this.submitRegistrationForm(e.target):this.onProviderChosen(e.target)},onProviderChosen(e){const t=e.querySelector("input[name=domain]"),n=null==t?void 0:t.value;n?(e.querySelector("input[type=submit]").classList.add("hidden"),this.fetchRegistrationForm(n.trim())):t.classList.add("error")},async fetchRegistrationForm(e){var t;return this.model.get("registration_form_rendered")||this.renderRegistrationRequest(),this.reset({domain:mx.getDomainFromJid(e),_registering:!0}),await qc.initConnection(this.domain),null===(t=qc.connection)||void 0===t||t.connect(this.domain,"",e=>this.onConnectStatusChanged(e)),!1},renderRegistrationRequest(){this.clearRegistrationForm().insertAdjacentHTML("beforeend",gx()({__:qc.__,cancel:Wc.settings.get("registration_domain")}))},giveFeedback(e,t){let n=this.el.querySelector(".reg-feedback");null!==n&&n.parentNode.removeChild(n);const r=this.el.querySelector("form");r.insertAdjacentHTML("afterbegin",'<span class="reg-feedback"></span>'),n=r.querySelector(".reg-feedback"),n.textContent=e,t&&n.classList.add(t)},clearRegistrationForm(){const e=this.el.querySelector("form");return e.innerHTML="",this.model.set("registration_form_rendered",!1),e},showSpinner(){const e=this.el.querySelector("form");return Xa(pp(),e),this.model.set("registration_form_rendered",!1),this},onConnectStatusChanged(e){Pn.debug("converse-register: onConnectStatusChanged"),[mx.Status.DISCONNECTED,mx.Status.CONNFAIL,mx.Status.REGIFAIL,mx.Status.NOTACCEPTABLE,mx.Status.CONFLICT].includes(e)?(Pn.error("Problem during registration: Strophe.Status is ".concat(qc.CONNECTION_STATUS[e])),this.abortRegistration()):e===mx.Status.REGISTERED&&(Pn.debug("Registered successfully."),qc.connection.reset(),this.showSpinner(),["converse/login","converse/register"].includes(qc.router.history.getFragment())&&qc.router.navigate("",{replace:!0}),this.fields.password&&this.fields.username?(qc.connection.connect(this.fields.username.toLowerCase()+"@"+this.domain.toLowerCase(),this.fields.password,qc.onConnectStatusChanged),this.giveFeedback(Td("Now logging you in"),"info")):(qc.chatboxviews.get("controlbox").renderLoginPanel(),qc.giveFeedback(Td("Registered successfully"))),this.reset())},renderLegacyRegistrationForm(e){Object.keys(this.fields).forEach(t=>{"username"===t?e.insertAdjacentHTML("beforeend",yf()({domain:" @".concat(this.domain),name:t,type:"text",label:t,value:"",required:!0})):e.insertAdjacentHTML("beforeend",hf()({label:t,name:t,placeholder:t,required:!0,type:"password"===t||"email"===t?t:"text",value:""}))}),this.urls.forEach(t=>e.insertAdjacentHTML("afterend",'<a target="blank" rel="noopener" href="'+t+'">'+t+"</a>"))},renderRegistrationForm(e){const t=this.el.querySelector("form");t.innerHTML=fx()({__:Td,domain:this.domain,title:this.title,instructions:this.instructions,registration_domain:Wc.settings.get("registration_domain")});const n=t.querySelector("fieldset.buttons");"xform"===this.form_type?e.querySelectorAll("field").forEach(t=>{n.insertAdjacentHTML("beforebegin",Hl.xForm2webForm(t,e,{domain:this.domain}))}):this.renderLegacyRegistrationForm(t),this.fields||t.querySelector(".button-primary").classList.add("hidden"),t.classList.remove("hidden"),this.model.set("registration_form_rendered",!0)},showValidationError(e){const t=this.el.querySelector("form");let n=t.querySelector(".form-errors");if(null===n){n='<div class="form-errors hidden"></div>';const e=t.querySelector("p.instructions");null===e?t.insertAdjacentHTML("afterbegin",n):e.insertAdjacentHTML("afterend",n),n=t.querySelector(".form-errors")}else n.innerHTML="";n.insertAdjacentHTML("beforeend",'<p class="form-help error">'+e+"</p>"),n.classList.remove("hidden")},reportErrors(e){const t=e.querySelectorAll("error");if(t.forEach(e=>this.showValidationError(e.textContent)),!t.length){const e=Td("The provider rejected your registration attempt. Please check the values you entered for correctness.");this.showValidationError(e)}},renderProviderChoiceForm(e){e&&e.preventDefault&&e.preventDefault(),qc.connection._proto._abortAllRequests(),qc.connection.reset(),this.render()},abortRegistration(){qc.connection._proto._abortAllRequests(),qc.connection.reset(),this.model.get("registration_form_rendered")?Wc.settings.get("registration_domain")&&this.model.get("registration_form_rendered")&&this.fetchRegistrationForm(Wc.settings.get("registration_domain")):this.render()},submitRegistrationForm(e){if(Array.from(this.el.querySelectorAll("input.required")).reduce((e,t)=>""===t.value?(t.classList.add("error"),e+1):e,0))return;const t=vx(":input:not([type=button]):not([type=submit])",e),n=_x({type:"set",id:bx.getUniqueId()}).c("query",{xmlns:mx.NS.REGISTER});if("xform"===this.form_type){n.c("x",{xmlns:mx.NS.XFORM,type:"submit"}),t.map(e=>Hl.webForm2xForm(e)).filter(e=>e).forEach(e=>n.cnode(e).up())}else t.forEach(e=>n.c(e.getAttribute("name"),{},e.value));qc.connection._addSysHandler(this._onRegisterIQ.bind(this),null,"iq",null,null),qc.connection.send(n),this.setFields(n.tree())},setFields(e){const t=e.querySelector("query"),n=vx('x[xmlns="'.concat(mx.NS.XFORM,'"]'),t);n.length>0?this._setFieldsFromXForm(n.pop()):this._setFieldsFromLegacy(t)},_setFieldsFromLegacy(e){[].forEach.call(e.children,e=>{"instructions"!==e.tagName.toLowerCase()?"x"!==e.tagName.toLowerCase()?this.fields[e.tagName.toLowerCase()]=mx.getText(e):"jabber:x:oob"===e.getAttribute("xmlns")&&this.urls.concat(vx("url",e).map(e=>e.textContent)):this.instructions=mx.getText(e)}),this.form_type="legacy"},_setFieldsFromXForm(e){var t,n;this.title=null===(t=e.querySelector("title"))||void 0===t?void 0:t.textContent,this.instructions=null===(n=e.querySelector("instructions"))||void 0===n?void 0:n.textContent,e.querySelectorAll("field").forEach(e=>{const t=e.getAttribute("var");var n,r;t?this.fields[t.toLowerCase()]=null!==(n=null===(r=e.querySelector("value"))||void 0===r?void 0:r.textContent)&&void 0!==n?n:"":Pn.warn("Found field we couldn't parse")}),this.form_type="xform"},_onRegisterIQ(e){if("error"===e.getAttribute("type")){Pn.error("Registration failed."),this.reportErrors(e);let t=e.getElementsByTagName("error");if(1!==t.length)return qc.connection._changeConnectStatus(mx.Status.REGIFAIL,"unknown"),!1;t=t[0].firstElementChild.tagName.toLowerCase(),"conflict"===t?qc.connection._changeConnectStatus(mx.Status.CONFLICT,t):"not-acceptable"===t?qc.connection._changeConnectStatus(mx.Status.NOTACCEPTABLE,t):qc.connection._changeConnectStatus(mx.Status.REGIFAIL,t)}else qc.connection._changeConnectStatus(mx.Status.REGISTERED,null);return!1}}),Wc.listen.on("controlBoxInitialized",e=>{e.model.on("change:active-form",e.showLoginOrRegisterForm,e)})}});const jx=e=>{const t=Td("Leave this groupchat");return Ya(Sx(),e.currently_open(e.room)?"open":"",e.room.get("num_unread_general")?"unread-msgs":"",e.room.get("jid"),e.room.get("num_unread")?(e=>Ya(xx(),e.room.get("num_unread")))(e):"",e.room.get("jid"),Td("Click to open this groupchat"),e.openRoom,e.room.getDisplayName(),e.allow_bookmarks?(e=>{const t=Td("Bookmark this groupchat"),n=Td("Unbookmark this groupchat");return e.bookmarked?Ya(Ax(),e.room.get("jid"),e.room.getDisplayName(),e.removeBookmark,e.bookmarked?n:t):Ya(Ex(),e.room.get("jid"),e.room.getDisplayName(),e.addBookmark,e.bookmarked?n:t)})(e):"",e.room.get("jid"),Td("Show more information on this groupchat"),e.showRoomDetailsModal,e.room.get("jid"),e.room.getDisplayName(),t,e.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:Ox}=tl.env,Tx=tl.env.utils;function kx(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\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 kx=function(){return e},e}tl.plugins.add("converse-roomslist",{dependencies:["converse-singleton","converse-controlbox","converse-muc","converse-bookmarks"],initialize(){Wc.promises.add("roomsListInitialized"),qc.RoomsList=zo.extend({defaults:{"toggle-state":qc.OPENED}}),qc.RoomsListView=Wd.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 e="converse.roomslist".concat(qc.bare_jid);this.list_model=new qc.RoomsList({id:e}),this.list_model.browserStorage=qc.createStore(e),this.list_model.fetch(),this.render(),this.insertIntoControlBox()},renderIfChatRoom(e){Tx.isChatRoom(e)&&this.render()},renderIfRelevantChange(e){const t=["bookmarked","hidden","name","num_unread","num_unread_general"],n=e.changed||{};Tx.isChatRoom(e)&&Object.keys(n).filter(e=>t.includes(e)).length&&this.render()},toHTML(){return(e=>{const t=Td("Click to toggle the list of open groupchats");return Ya(wx(),e.rooms.length?"":"hidden",t,e.toggleRoomsList,e.toggle_state===e._converse.OPENED?"fa-caret-down":"fa-caret-right",Td("Open Groupchats"),e.collapsed&&"collapsed",e.rooms.map(t=>jx(Object.assign({room:t},e))))})({_converse:qc,addBookmark:e=>this.addBookmark(e),allow_bookmarks:qc.allow_bookmarks&&qc.bookmarks,closeRoom:e=>this.closeRoom(e),collapsed:this.list_model.get("toggle-state")!==qc.OPENED,currently_open:e=>qc.isUniView()&&!e.get("hidden"),openRoom:e=>this.openRoom(e),removeBookmark:e=>this.removeBookmark(e),rooms:this.model.filter(e=>e.get("type")===qc.CHATROOMS_TYPE),showRoomDetailsModal:e=>this.showRoomDetailsModal(e),toggleRoomsList:e=>this.toggleRoomsList(e),toggle_state:this.list_model.get("toggle-state")})},insertIntoControlBox(){const e=qc.chatboxviews.get("controlbox");if(void 0!==e&&!Tx.rootContains(qc.root,this.el)){const t=e.el.querySelector(".list-container--openrooms");t&&t.parentNode.replaceChild(this.el,t)}},showRoomDetailsModal(e){const t=e.target.getAttribute("data-room-jid"),n=qc.chatboxes.get(t);e.preventDefault(),void 0===n.room_details_modal&&(n.room_details_modal=new Uy({model:n})),n.room_details_modal.show(e)},async openRoom(e){e.preventDefault();const t=e.target.textContent,n=e.target.getAttribute("data-room-jid"),r={name:t||Ox.unescapeNode(Ox.getNodeFromJid(n))||n};await Wc.rooms.open(n,r,!0),Wc.chatviews.get(n).maybeFocus()},closeRoom(e){e.preventDefault();const t=e.target.getAttribute("data-room-name"),n=e.target.getAttribute("data-room-jid");confirm(Td("Are you sure you want to leave the groupchat %1$s?",t))&&qc.chatboxviews.get(n).close()},removeBookmark:qc.removeBookmarkViaEvent,addBookmark:qc.addBookmarkViaEvent,toggleRoomsList(e){e&&e.preventDefault&&e.preventDefault();const t=e.target.matches(".fa")?e.target:e.target.querySelector(".fa");t.classList.contains("fa-caret-down")?Tx.slideIn(this.el.querySelector(".open-rooms-list")).then(()=>{this.list_model.save({"toggle-state":qc.CLOSED}),t.classList.remove("fa-caret-down"),t.classList.add("fa-caret-right")}):Tx.slideOut(this.el.querySelector(".open-rooms-list")).then(()=>{this.list_model.save({"toggle-state":qc.OPENED}),t.classList.remove("fa-caret-right"),t.classList.add("fa-caret-down")})}});const e=function(){qc.rooms_list_view=new qc.RoomsListView({model:qc.chatboxes}),Wc.trigger("roomsListInitialized")};Wc.listen.on("connected",async()=>{qc.allow_bookmarks?await Wc.waitUntil("bookmarksInitialized"):await Promise.all([Wc.waitUntil("chatBoxesFetched"),Wc.waitUntil("roomsPanelRendered")]),e()}),Wc.listen.on("reconnected",e)}});var Nx=n(184),Ix=n.n(Nx),Mx=n(185),Rx=n.n(Mx),Dx=n(186),Px=n.n(Dx),Lx=n(187),Fx=n.n(Lx);function zx(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\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 zx=function(){return e},e}var Bx=n(188),qx=n.n(Bx);
/**
* @module converse-rosterview
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const{Strophe:Hx}=tl.env,Ux=tl.env.utils;tl.plugins.add("converse-rosterview",{dependencies:["converse-roster","converse-modal","converse-chatboxviews"],initialize(){Wc.settings.extend({autocomplete_add_contact:!0,allow_chat_pending_contacts:!0,allow_contact_removal:!0,hide_offline_users:!1,roster_groups:!0,xhr_user_search_url:null}),Wc.promises.add("rosterViewInitialized");const e={dnd:Td("This contact is busy"),online:Td("This contact is online"),offline:Td("This contact is offline"),unavailable:Td("This contact is unavailable"),xa:Td("This contact is away for an extended period"),away:Td("This contact is away")};function t(){Wc.settings.get("authentication")!==qc.ANONYMOUS&&(qc.rosterview=new qc.RosterView({model:qc.rostergroups}),qc.rosterview.render(),Wc.trigger("rosterViewInitialized"))}qc.AddContactModal=mh.extend({id:"add-contact-modal",events:{"submit form":"addContactFromForm"},initialize(){mh.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change",this.render)},toHTML(){const e=Wc.settings.get("xhr_user_search_url")?Td("Contact name"):Td("Optional nickname");return(e=>{const t=Td("name@example.org"),n=Td("Add"),r=Td("Please enter a valid XMPP address"),i=Td("Add a Contact"),o=Td("XMPP Address"),s=Td("Nickname");return Ya(kx(),i,ih,o,!e._converse.xhr_user_search_url,e.jid||"",t,s,e.nickname||"",s,r,n)})(Object.assign(this.model.toJSON(),{_converse:qc,label_nickname:e}))},afterRender(){"string"==typeof Wc.settings.get("xhr_user_search_url")?this.initXHRAutoComplete():this.initJIDAutoComplete();const e=this.el.querySelector('input[name="jid"]');this.el.addEventListener("shown.bs.modal",()=>e.focus(),!1)},initJIDAutoComplete(){if(!Wc.settings.get("autocomplete_add_contact"))return;const e=this.el.querySelector(".suggestion-box__jid").parentElement;this.jid_auto_complete=new qc.AutoComplete(e,{data:(e,t)=>"".concat(t.slice(0,t.indexOf("@")),"@").concat(e),filter:qc.FILTER_STARTSWITH,list:[...new Set(qc.roster.map(e=>Hx.getDomainFromJid(e.get("jid"))))]})},initXHRAutoComplete(){if(!Wc.settings.get("autocomplete_add_contact"))return this.initXHRFetch();const e=this.el.querySelector(".suggestion-box__name").parentElement;this.name_auto_complete=new qc.AutoComplete(e,{auto_evaluate:!1,filter:qc.FILTER_STARTSWITH,list:[]});const t=new window.XMLHttpRequest;t.onload=()=>{if(t.responseText){const e=t.responseText;this.name_auto_complete.list=JSON.parse(e).map(e=>({label:e.fullname||e.jid,value:e.jid})),this.name_auto_complete.auto_completing=!0,this.name_auto_complete.evaluate()}};const n=this.el.querySelector('input[name="name"]');n.addEventListener("input",Ic(()=>{t.open("GET","".concat(Wc.settings.get("xhr_user_search_url"),"q=").concat(encodeURIComponent(n.value)),!0),t.send()},300)),this.name_auto_complete.on("suggestion-box-selectcomplete",e=>{this.el.querySelector('input[name="name"]').value=e.text.label,this.el.querySelector('input[name="jid"]').value=e.text.value})},initXHRFetch(){this.xhr=new window.XMLHttpRequest,this.xhr.onload=()=>{if(this.xhr.responseText){const e=this.xhr.responseText,t=JSON.parse(e).map(e=>({label:e.fullname||e.jid,value:e.jid}));if(1!==t.length){const e=this.el.querySelector(".invalid-feedback");return e.textContent=Td("Sorry, could not find a contact with that name"),void Ux.addClass("d-block",e)}const n=t[0].value;if(this.validateSubmission(n)){const e=this.el.querySelector("form"),r=t[0].label;this.afterSubmission(e,n,r)}}}},validateSubmission(e){const t=this.el.querySelector(".invalid-feedback");return!e||Bo(e.split("@")).length<2?(Ux.addClass("is-invalid",this.el.querySelector('input[name="jid"]')),Ux.addClass("d-block",t),!1):qc.roster.get(Hx.getBareJidFromJid(e))?(t.textContent=Td("This contact has already been added"),Ux.addClass("d-block",t),!1):(Ux.removeClass("d-block",t),!0)},afterSubmission(e,t,n){qc.roster.addAndSubscribe(t,n),this.model.clear(),this.modal.hide()},addContactFromForm(e){e.preventDefault();const t=new FormData(e.target),n=(t.get("jid")||"").trim();if(!n&&"string"==typeof Wc.settings.get("xhr_user_search_url")){const e=this.el.querySelector('input[name="name"]');return this.xhr.open("GET","".concat(Wc.settings.get("xhr_user_search_url"),"q=").concat(encodeURIComponent(e.value)),!0),void this.xhr.send()}this.validateSubmission(n)&&this.afterSubmission(e.target,n,t.get("name"))}}),qc.RosterFilter=zo.extend({initialize(){this.set({filter_text:"",filter_type:"contacts",chat_state:"online"})}}),qc.RosterFilterView=Wd.extend({tagName:"span",initialize(){this.listenTo(this.model,"change:filter_type",this.render),this.listenTo(this.model,"change:filter_text",this.render)},toHTML(){return e=Object.assign(this.model.toJSON(),{visible:this.shouldBeVisible(),placeholder:Td("Filter"),title_contact_filter:Td("Filter by contact name"),title_group_filter:Td("Filter by group name"),title_status_filter:Td("Filter by status"),label_any:Td("Any"),label_unread_messages:Td("Unread"),label_online:Td("Online"),label_chatty:Td("Chatty"),label_busy:Td("Busy"),label_away:Td("Away"),label_xa:Td("Extended Away"),label_offline:Td("Offline"),changeChatStateFilter:e=>this.changeChatStateFilter(e),changeTypeFilter:e=>this.changeTypeFilter(e),clearFilter:e=>this.clearFilter(e),liveFilter:e=>this.liveFilter(e),submitFilter:e=>this.submitFilter(e)}),Ya(zx(),e.visible?"fade-in":"hidden",e.submitFilter,e.changeTypeFilter,"contacts"===e.filter_type?"selected":"",e.title_contact_filter,e.changeTypeFilter,"groups"===e.filter_type?"selected":"",e.title_group_filter,e.changeTypeFilter,"state"===e.filter_type?"selected":"",e.title_status_filter,e.filter_text||"",e.liveFilter,"state"===e.filter_type?"hidden":"",e.placeholder,e.filter_text&&"state"!==e.filter_type?"":"hidden",e.clearFilter,"state"!==e.filter_type?"hidden":"",e.changeChatStateFilter,e.label_any,"unread_messages"===e.chat_state,e.label_unread_messages,"online"===e.chat_state,e.label_online,"chat"===e.chat_state,e.label_chatty,"dnd"===e.chat_state,e.label_busy,"away"===e.chat_state,e.label_away,"xa"===e.chat_state,e.label_xa,"offline"===e.chat_state,e.label_offline);var e},changeChatStateFilter(e){e&&e.preventDefault(),this.model.save({chat_state:this.el.querySelector(".state-type").value})},changeTypeFilter(e){e&&e.preventDefault();const t=e.target.dataset.type;"state"===t?this.model.save({filter_type:t,chat_state:this.el.querySelector(".state-type").value}):this.model.save({filter_type:t,filter_text:this.el.querySelector(".roster-filter").value})},liveFilter:Ic((function(){this.model.save({filter_text:this.el.querySelector(".roster-filter").value})}),250),submitFilter(e){e&&e.preventDefault(),this.liveFilter()},isActive(){return"state"===this.model.get("filter_type")||this.model.get("filter_text")},shouldBeVisible(){return qc.roster&&qc.roster.length>=5||this.isActive()},clearFilter(e){e&&e.preventDefault(),this.model.save({filter_text:""})}}),qc.RosterContactView=qc.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=Ic(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 Ux.hideElement(this.el),this;const t=this.model.get("ask"),n=this.model.presence.get("show"),r=this.model.get("requesting"),i=this.model.get("subscription"),o=this.model.get("jid");if(["current-xmpp-contact","pending-xmpp-contact","requesting-xmpp-contact"].concat(Object.keys(e)).forEach(e=>Ux.removeClass(e,this.el)),this.el.classList.add(n),this.el.setAttribute("data-status",n),this.highlight(),qc.isUniView()){const e=qc.chatboxes.get(this.model.get("jid"));e&&(e.get("hidden")?this.el.classList.remove("open"):this.el.classList.add("open"))}if("subscribe"===t||"from"===i){const e=this.model.getDisplayName();this.el.classList.add("pending-xmpp-contact"),this.el.innerHTML=Rx()(Object.assign(this.model.toJSON(),{display_name:e,desc_remove:Td("Click to remove %1$s as a contact",e),allow_chat_pending_contacts:Wc.settings.get("allow_chat_pending_contacts")}))}else if(!0===r){const e=this.model.getDisplayName();this.el.classList.add("requesting-xmpp-contact"),this.el.innerHTML=Px()(Object.assign(this.model.toJSON(),{display_name:e,desc_accept:Td("Click to accept the contact request from %1$s",e),desc_decline:Td("Click to decline the contact request from %1$s",e),allow_chat_pending_contacts:Wc.settings.get("allow_chat_pending_contacts")}))}else("both"===i||"to"===i||qc.rosterview.isSelf(o))&&(this.el.classList.add("current-xmpp-contact"),this.el.classList.remove(uv(["both","to"],i)[0]),this.el.classList.add(i),this.renderRosterItem(this.model));return this},highlight(){if(qc.isUniView()){const e=qc.chatboxes.get(this.model.get("jid"));e&&e.get("hidden")||!e?this.el.classList.remove("open"):this.el.classList.add("open")}},renderRosterItem(t){const n=t.presence.get("show")||"offline";let r;r="online"===n?"fa fa-circle chat-status chat-status--online":"away"===n?"fa fa-circle chat-status chat-status--away":"xa"===n?"far fa-circle chat-status chat-status-xa":"dnd"===n?"fa fa-minus-circle chat-status chat-status--busy":"fa fa-times-circle chat-status chat-status--offline";const i=t.getDisplayName();return this.el.innerHTML=qx()(Object.assign(t.toJSON(),{show:n,display_name:i,status_icon:r,desc_status:e[n],desc_chat:Td("Click to chat with %1$s (XMPP address: %2$s)",i,t.get("jid")),desc_remove:Td("Click to remove %1$s as a contact",i),allow_contact_removal:Wc.settings.get("allow_contact_removal"),num_unread:t.get("num_unread")||0,classes:""})),this.renderAvatar(),this},mayBeShown(){const e=this.model.presence.get("show");return!Wc.settings.get("hide_offline_users")||"offline"!==e||("subscribe"===this.model.get("ask")||"from"===this.model.get("subscription")||!0===this.model.get("requesting"))},openChat(e){e&&e.preventDefault&&e.preventDefault(),this.model.openChat()},async removeContact(e){if(e&&e.preventDefault&&e.preventDefault(),Wc.settings.get("allow_contact_removal")&&confirm(Td("Are you sure you want to remove this contact?")))try{await this.model.removeFromRoster(),this.remove(),this.model.collection&&this.model.destroy()}catch(e){Pn.error(e),Wc.alert("error",Td("Error"),[Td("Sorry, there was an error while trying to remove %1$s as a contact.",this.model.getDisplayName())])}},async acceptRequest(e){e&&e.preventDefault&&e.preventDefault(),await qc.roster.sendContactAddIQ(this.model.get("jid"),this.model.getFullname(),[]),this.model.authorize().subscribe()},declineRequest(e){return e&&e.preventDefault&&e.preventDefault(),!0===confirm(Td("Are you sure you want to decline this contact request?"))&&this.model.unauthorize().destroy(),this}}),qc.RosterGroupView=fv.extend({tagName:"div",className:"roster-group hidden",events:{"click a.group-toggle":"toggle"},sortImmediatelyOnAdd:!0,ItemView:qc.RosterContactView,listItems:"model.contacts",listSelector:".roster-group-contacts",sortEvent:"presenceChanged",initialize(){fv.prototype.initialize.apply(this,arguments),this.model.get("name")===qc.HEADER_UNREAD&&this.listenTo(this.model.contacts,"change:num_unread",e=>!this.model.get("unread_messages")&&this.removeContact(e)),this.model.get("name")===qc.HEADER_REQUESTING_CONTACTS&&this.listenTo(this.model.contacts,"change:requesting",e=>!e.get("requesting")&&this.removeContact(e)),this.model.get("name")===qc.HEADER_PENDING_CONTACTS&&this.listenTo(this.model.contacts,"change:subscription",e=>"from"!==e.get("subscription")&&this.removeContact(e)),this.listenTo(this.model.contacts,"remove",this.onRemove),this.listenTo(qc.roster,"change:groups",this.onContactGroupChange),qc.rosterview.on("rosterContactsFetchedAndProcessed",()=>this.sortAndPositionAllItems())},render(){return this.el.setAttribute("data-group",this.model.get("name")),this.el.innerHTML=Ix()({label_group:this.model.get("name"),desc_group_toggle:this.model.get("description"),toggle_state:this.model.get("state"),_converse:qc}),this.contacts_el=this.el.querySelector(".roster-group-contacts"),this},show(){return Ux.showElement(this.el),this.model.get("state")===qc.OPENED&&Object.values(this.getAll()).filter(e=>e.mayBeShown()).forEach(e=>Ux.showElement(e.el)),this},collapse(){return Ux.slideIn(this.contacts_el)},filterOutContacts(e=[]){let t=0;this.model.contacts.forEach(n=>{const r=this.get(n.get("id"));e.includes(n)?Ux.hideElement(r.el):r.mayBeShown()&&(Ux.showElement(r.el),t+=1)}),t?Ux.showElement(this.el):Ux.hideElement(this.el)},getFilterMatches(e,t){if(0===e.length)return[];e=e.toLowerCase();const n=this.model.contacts;if("state"===t){return[qc.HEADER_REQUESTING_CONTACTS,qc.HEADER_UNREAD].includes(this.model.get("name"))?[]:"unread_messages"===e?n.filter({num_unread:0}):"online"===e?n.filter(e=>["offline","unavailable"].includes(e.presence.get("show"))):n.filter(t=>!t.presence.get("show").includes(e))}return n.filter(t=>!t.getFilterCriteria().includes(e))},filter(e,t){null==e&&(e="state"===(t=t||qc.rosterview.filter_view.model.get("filter_type"))?qc.rosterview.filter_view.model.get("chat_state"):qc.rosterview.filter_view.model.get("filter_text")),this.filterOutContacts(this.getFilterMatches(e,t))},async toggle(e){e&&e.preventDefault&&e.preventDefault();const t=e.target.matches(".fa")?e.target:e.target.querySelector(".fa");Ux.hasClass("fa-caret-down",t)?(this.model.save({state:qc.CLOSED}),await this.collapse(),t.classList.remove("fa-caret-down"),t.classList.add("fa-caret-right")):(t.classList.remove("fa-caret-right"),t.classList.add("fa-caret-down"),this.model.save({state:qc.OPENED}),this.filter(),Ux.showElement(this.el),Ux.slideOut(this.contacts_el))},onContactGroupChange(e){const t=e.get("groups").includes(this.model.get("name")),n=e.get("id"),r=!this.get(n);t&&!r?this.items.trigger("add",e):t||this.removeContact(e)},removeContact(e){this.model.contacts.remove(e,{silent:!0}),this.onRemove(e)},onRemove(e){this.remove(e.get("jid")),0===this.model.contacts.length&&this.remove()}}),qc.RosterView=fv.extend({tagName:"div",id:"converse-roster",className:"controlbox-section",ItemView:qc.RosterGroupView,listItems:"model",listSelector:".roster-contacts",sortEvent:null,subviewIndex:"name",sortImmediatelyOnAdd:!0,events:{"click a.controlbox-heading__btn.add-contact":"showAddContactModal","click a.controlbox-heading__btn.sync-contacts":"syncContacts"},initialize(){fv.prototype.initialize.apply(this,arguments),this.listenTo(qc.roster,"add",this.onContactAdded),this.listenTo(qc.roster,"change:groups",this.onContactAdded),this.listenTo(qc.roster,"change",this.onContactChange),this.listenTo(qc.roster,"destroy",this.update),this.listenTo(qc.roster,"remove",this.update),qc.presences.on("change:show",()=>{this.update(),this.updateFilter()}),this.listenTo(this.model,"reset",this.reset),Wc.listen.on("rosterGroupsFetched",this.sortAndPositionAllItems.bind(this)),Wc.listen.on("rosterContactsFetched",()=>{qc.roster.each(e=>this.addRosterContact(e,{silent:!0})),this.update(),this.updateFilter(),this.trigger("rosterContactsFetchedAndProcessed")}),this.createRosterFilter()},render(){this.el.innerHTML=Fx()({allow_contact_requests:qc.allow_contact_requests,heading_contacts:Td("Contacts"),title_add_contact:Td("Add a contact"),title_sync_contacts:Td("Re-sync your contacts")});const e=this.el.querySelector(".roster-filter-form");return this.el.replaceChild(this.filter_view.render().el,e),this.roster_el=this.el.querySelector(".roster-contacts"),this},showAddContactModal(e){void 0===this.add_contact_modal&&(this.add_contact_modal=new qc.AddContactModal({model:new zo})),this.add_contact_modal.show(e)},createRosterFilter(){const e=new qc.RosterFilter;e.id="_converse.rosterfilter-".concat(qc.bare_jid),e.browserStorage=qc.createStore(e.id),this.filter_view=new qc.RosterFilterView({model:e}),this.listenTo(this.filter_view.model,"change",this.updateFilter),this.filter_view.model.fetch()},updateFilter:Ic((function(){const e=this.filter_view.model.get("filter_type");"state"===e?this.filter(this.filter_view.model.get("chat_state"),e):this.filter(this.filter_view.model.get("filter_text"),e)}),100),update(){return Ux.isVisible(this.roster_el)||Ux.showElement(this.roster_el),this.filter_view.render(),this},filter(e,t){const n=Object.values(this.getAll());n.forEach(e=>e.model.contacts.length>0&&e.show().filter("")),e=e.toLowerCase(),"groups"===t?n.forEach(t=>{t.model.get("name").toLowerCase().includes(e)?t.model.contacts.length>0&&Ux.slideOut(t.el):Ux.slideIn(t.el)}):n.forEach(n=>n.filter(e,t))},async syncContacts(e){e.preventDefault(),Ux.addClass("fa-spin",e.target),qc.roster.data.save("version",null),await qc.roster.fetchFromServer(),Wc.user.presence.send(),Ux.removeClass("fa-spin",e.target)},reset(){return this.removeAll(),this.render().update(),this},onContactAdded(e){this.addRosterContact(e),this.update(),this.updateFilter()},onContactChange(e){this.update(),Vr(e.changed,"subscription")&&("from"===e.changed.subscription?this.addContactToGroup(e,qc.HEADER_PENDING_CONTACTS):["both","to"].includes(e.get("subscription"))&&this.addExistingContact(e)),Vr(e.changed,"num_unread")&&e.get("num_unread")&&this.addContactToGroup(e,qc.HEADER_UNREAD),Vr(e.changed,"ask")&&"subscribe"===e.changed.ask&&this.addContactToGroup(e,qc.HEADER_PENDING_CONTACTS),Vr(e.changed,"subscription")&&"true"===e.changed.requesting&&this.addContactToGroup(e,qc.HEADER_REQUESTING_CONTACTS),this.updateFilter()},getGroup(e){const t=this.get(e);return t?t.model:this.model.create({name:e})},addContactToGroup(e,t,n){this.getGroup(t).contacts.add(e,n),this.sortAndPositionAllItems()},addExistingContact(e,t){let n;Wc.settings.get("roster_groups")?(n=e.get("groups"),n=0===n.length?[qc.HEADER_UNGROUPED]:n):n=[qc.HEADER_CURRENT_CONTACTS],e.get("num_unread")&&n.push(qc.HEADER_UNREAD),n.forEach(n=>this.addContactToGroup(e,n,t))},isSelf:e=>Ux.isSameBareJID(e,qc.connection.jid),addRosterContact(e,t){const n=e.get("jid");if("both"===e.get("subscription")||"to"===e.get("subscription")||this.isSelf(n))this.addExistingContact(e,t);else{if(!qc.allow_contact_requests)return void Pn.debug("Not adding requesting or pending contact ".concat(n," ")+"because allow_contact_requests is false");"subscribe"===e.get("ask")||"from"===e.get("subscription")?this.addContactToGroup(e,qc.HEADER_PENDING_CONTACTS,t):!0===e.get("requesting")&&this.addContactToGroup(e,qc.HEADER_REQUESTING_CONTACTS,t)}return this}}),Wc.listen.on("chatBoxesInitialized",()=>{function e(e){const t=qc.roster&&qc.roster.findWhere({jid:e.get("jid")});void 0!==t&&t.trigger("highlight")}qc.chatboxes.on("destroy",t=>e(t)),qc.chatboxes.on("change:hidden",t=>e(t))}),Wc.listen.on("controlBoxInitialized",e=>{function t(){e.model.get("connected")&&Wc.settings.get("authentication")!==qc.ANONYMOUS&&Wc.waitUntil("rosterViewInitialized").then(()=>e.controlbox_pane.el.insertAdjacentElement("beforeEnd",qc.rosterview.el)).catch(e=>Pn.fatal(e))}t(),e.model.on("change:connected",t)}),Wc.listen.on("rosterInitialized",t),Wc.listen.on("rosterReadyAfterReconnection",t),Wc.listen.on("afterTearDown",()=>{tl.rosterview&&(tl.rosterview.model.off().reset(),tl.rosterview.each(e=>e.removeAll().remove()),tl.rosterview.removeAll().remove(),delete tl.rosterview)})}});n(501);
/**
* @description Converse.js (A browser based XMPP chat client)
* @copyright 2020, The Converse developers
* @license Mozilla Public License (MPLv2)
*/const $x=["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}},tl.env._=i.a;const Wx=tl.initialize;tl.initialize=function(e,t){return Array.isArray(e.whitelisted_plugins)?e.whitelisted_plugins=e.whitelisted_plugins.concat($x):e.whitelisted_plugins=$x,Wx(e,t)};t.default=tl}]);
//# sourceMappingURL=converse.min.js.map