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

598 lines
1.0 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=321)}([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,"f",(function(){return w})),n.d(t,"e",(function(){return f.a}));var r=n(8);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(6);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(23);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.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<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.c()),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){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(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||{},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),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)}}setProtocol(){const e=this.options.protocol||"";this.options.worker?this._proto=new w.WorkerWebsocket(this):0===this.service.indexOf("ws:")||0===this.service.indexOf("wss:")||0===e.indexOf("ws")?this._proto=new w.Websocket(this):this._proto=new w.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=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){const t=new e;this.mechanisms[t.mechname]=t}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;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)));if(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=e[n],this._sasl_mechanism.onStart(this);const r=v("auth",{xmlns:w.NS.SASL,mechanism:this._sasl_mechanism.mechname});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")){w.warn("Resource binding failed.");let t;return 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.authenticated=!0,this.jid=w.getText(e[0]),this.do_session?this._establishSession():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 this.authenticated=!1,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.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}},w.SASLAnonymous=class extends w.SASLMechanism{constructor(e="ANONYMOUS",t=!1,n=20){super(e,t,n)}test(e){return null===e.authcid}},w.SASLPlain=class extends w.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,p(o)}},w.SASLSHA1=class extends w.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="+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(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+="",p(t)}},w.SASLExternal=class extends w.SASLMechanism{constructor(e="EXTERNAL",t=!0,n=10){super(e,t,n)}onChallenge(e){return e.authcid===e.authzid?"":e.authzid}},w.SASLXOAuth2=class extends w.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,p(t)}};t.g={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){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,j=0,C=0,k=he(),O=he(),T=he(),N=he(),I=function(e,t){return e===t&&(g=!0),0},M={}.hasOwnProperty,R=[],D=R.pop,P=R.push,z=R.push,L=R.slice,F=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]",U="(?:\\\\[\\da-fA-F]{1,6}"+q+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",H="\\["+q+"*("+U+")(?:"+q+"*([*^$|!~]?=)"+q+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+U+"))|)"+q+"*\\]",$=":("+U+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+H+")*)|.*)\\)|)",W=new RegExp(q+"+","g"),V=new RegExp("^"+q+"+|((?:^|[^\\\\])(?:\\\\.)*)"+q+"+$","g"),G=new RegExp("^"+q+"*,"+q+"*"),J=new RegExp("^"+q+"*([>+~]|"+q+")"+q+"*"),Q=new RegExp(q+"|>"),Y=new RegExp($),K=new RegExp("^"+U+"$"),X={ID:new RegExp("^#("+U+")"),CLASS:new RegExp("^\\.("+U+")"),TAG:new RegExp("^("+U+"|[*])"),ATTR:new RegExp("^"+H),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{z.apply(R=L.call(A.childNodes),A.childNodes),R[A.childNodes.length].nodeType}catch(e){z={apply:R.length?function(e,t){P.apply(e,L.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 z.apply(n,t.getElementsByTagName(e)),n;if((i=l[3])&&s.getElementsByClassName&&t.getElementsByClassName)return z.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&&(Q.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 z.apply(n,p.querySelectorAll(f)),n}catch(t){N(e,!0)}finally{c===E&&t.removeAttribute("id")}}}return h(e.replace(V,"$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?F(p,e)-F(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?F(p,e)-F(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:X,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 X.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&Y.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=k[e+" "];return t||(t=new RegExp("(^|"+q+")"+e+"("+q+"|$)"))&&k(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]===j&&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]=[j,f,b];break}}else if(_&&(b=f=(l=(u=(d=(h=t)[E]||(h[E]={}))[h.uniqueID]||(d[h.uniqueID]={}))[e]||[])[0]===j&&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]=[j,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=F(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(V,"$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 K.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=C++;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=[j,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]===j&&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 je(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 Ce(e,t,n,r,i,o){return r&&!r[E]&&(r=Ce(r)),i&&!i[E]&&(i=Ce(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:je(g,h,e,a,c),v=n?i||(o?e:p||r)?[]:s:m;if(n&&n(m,v,a,c),r)for(l=je(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?F(o,d):h[u])>-1&&(o[l]=!(s[l]=d))}}else v=je(v===s?v.splice(p,v.length):v),i?i(null,s,v,c):z.apply(s,v)}))}function ke(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 F(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 Ce(c>1&&Ae(d),c>1&&xe(e.slice(0,c-1).concat({value:" "===e[c-2].type?"*":""})).replace(V,"$1"),n,c<r&&ke(e.slice(c,r)),r<i&&ke(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=O[e+" "];if(u)return t?0:u.slice(0);for(s=e,c=[],l=a.preFilter;s;){for(o in n&&!(r=G.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(V," ")}),s=s.slice(n.length)),a.filter)!(r=X[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):O(e,c).slice(0)},d=de.compile=function(e,t){var n,r=[],i=[],o=T[e+" "];if(!o){for(t||(t=u(e)),n=t.length;n--;)(o=ke(t[n]))[E]?r.push(o):i.push(o);(o=T(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=j+=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&&(j=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=je(y)}z.apply(c,y),l&&!i&&y.length>0&&p+t.length>1&&de.uniqueSort(c)}return l&&(j=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=X.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 z.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 Oe=i.Sizzle;de.noConflict=function(){return i.Sizzle===de&&(i.Sizzle=Oe),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(152),n(65),n(488);var r=n(0);n.d(t,"e",(function(){return r.f})),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.g.$build,e.$iq=r.g.$iq,e.$msg=r.g.$msg,e.$pres=r.g.$pres,e.Strophe=r.g.Strophe;const{b64_sha1:i}=r.e}).call(this,n(16))},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(59),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(491),i=n(135),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(323)}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(92).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(92).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(16))},function(e,t,n){var r=n(94),i="object"==typeof self&&self&&self.Object===Object&&self,o=r||i||Function("return this")();e.exports=o},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(59),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(66)(e))},function(e,t){var n=Array.isArray;e.exports=n},function(e,t,n){var r=n(142)("wks"),i=n(143),o=n(10).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 j=/<!--[\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(j,"")},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="";e: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)for(var p=1,g=e.charAt(l-p);" "===g||"="===g;){if("="===g){c=f;continue e}g=e.charAt(l-++p)}}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){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){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(4),i=n(156),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(66)(e))},function(e,t){e.exports=function(e){return null!=e&&"object"==typeof e}},function(e,t,n){var r=n(45),i=n(330),o=n(331),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(348),i=n(351);e.exports=function(e,t){var n=i(e,t);return r(n)?n:void 0}},function(e,t,n){var r=n(38);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){"use strict";const r=n(325),i=n(326);e.exports={atob:r,btoa:i}},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 j={_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}},C="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",k=/^~~local_forage_type~([^~]+)~/,O="__lfsc__:".length,T=O+"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=C.indexOf(e[t]),r=C.indexOf(e[t+1]),i=C.indexOf(e[t+2]),o=C.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+=C[n[t]>>2],r+=C[(3&n[t])<<4|n[t+1]>>4],r+=C[(15&n[t+1])<<2|n[t+2]>>6],r+=C[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,O))return JSON.parse(e);var t,n=e.substring(T),r=e.substring(O,T);if("blob"===r&&k.test(n)){var i=n.match(k);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 z(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(z.apply(i,[e,a,n,r-1]));s(t)}}))}))})).catch(s)}));return a(o,n),o}function L(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 F={_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 z.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(L(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 U={_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}},H=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={},V={},G={INDEXEDDB:j,WEBSQL:F,LOCALSTORAGE:U},J=[G.INDEXEDDB._driver,G.WEBSQL._driver,G.LOCALSTORAGE._driver],Q=["dropInstance"],Y=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Q),K={description:"",driver:J.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function X(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),G)if(G.hasOwnProperty(n)){var r=G[n],i=r._driver;this[n]=i,W[i]||this.defineDriver(r)}this._defaultConfig=Z({},K),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=Y.concat("_initStorage"),c=0,l=o.length;c<l;c++){var u=o[c];if((!H(Q,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=Q.length;n<r;n++){var i=Q[n];e[i]||(e[i]=t(i))}}();var d=function(n){W[r]&&console.info("Redefining LocalForage driver: "+r),W[r]=e,V[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!!V[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=Y.length;e<t;e++)X(this,Y[e])},e.prototype.createInstance=function(t){return new e(t)},e}());t.exports=ee},{3:3}]},{},[4])(4)}).call(this,n(16))},,function(e,t,n){var r=n(58),i=n(68);e.exports=function(e){return null!=e&&i(e.length)&&!r(e)}},function(e,t,n){var r=n(10),i=n(15),o=n(54),s=n(28),a=n(56),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(37),i=n(138);e.exports=n(29)?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(79)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},function(e,t,n){var r=n(96),i=n(100),o=n(26);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",j=function(e){e.focus?e.focus():e.setActive()},C=function(e,t){e.classList.add(t)},k=function(e,t){e.classList.remove(t)},O=function(e,t){return e.classList.contains(t)},T=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])&&O(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},z=function(t){var n=x?e.getComputedStyle(t)[A]:0;return n="number"!=typeof(n=parseFloat(n))||isNaN(n)?0:1e3*n},L=function(e,t){var n=0;z(e)?D(e,E,(function(e){!n&&t(e),n=1})):setTimeout((function(){!n&&t(),n=1}),17)},F=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,j=O(o,"popover"),C=N(".arrow",o),k=S.top+A/2-g/2<0,T=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>=_,z=S[b]+p+E>=v;s="right"===(s=(s="bottom"===(s=(s=(s===b||"right"===s)&&D&&z?y:s)===y&&R?"bottom":s)&&P?y:s)===b&&D?"right":s)&&z?b:s,-1===o.className.indexOf(s)&&(o.className=o.className.replace(w,s)),h=C.offsetWidth,f=C.offsetHeight,s===b||"right"===s?(l=s===b?S[b]+x.x-p-(j?h:0):S[b]+x.x+E,k?(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-(j?.9*f:f/2))):s!==y&&"bottom"!==s||(c=s===y?S.top+x.y-g-(j?f:0):S.top+x.y+A,T?(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-(j?h:h/2))),o[m].top=c+"px",o[m][b]=l+"px",u&&(C[m].top=u+"px"),d&&(C[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(){F.call(n,"closed","alert"),R(e,"click",r),n[p].removeChild(n)};this.close=function(){n&&e&&O(n,"show")&&(F.call(n,"close","alert"),k(n,"show"),n&&(O(n,"fade")?L(n,i):i()))},"Alert"in e||M(e,"click",r),e.Alert=t};s[v](["Alert",q,'[data-dismiss="alert"]']);var U=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=T(i[p],"btn"),s=i.getElementsByTagName("INPUT")[0];if(s){if("checkbox"===s.type&&(s[r]?(k(i,_),s[h](r),s.removeAttribute(r),s[r]=!1):(C(i,_),s[h](r),s[f](r,r),s[r]=!0),n||(n=!0,F.call(s,"change","button"),F.call(e,"change","button"))),"radio"===s.type&&!n&&(!s[r]||0===t.screenX&&0==t.screenY)){C(i,_),C(i,"focus"),s[f](r,r),s[r]=!0,F.call(s,"change","button"),F.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&&O(u,_)&&(k(u,_),d.removeAttribute(r),d[r]=!1,F.call(d,"change","button"))}}setTimeout((function(){n=!1}),50)}}},o=function(e){C(e[l][p],"focus")},s=function(e){k(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=T(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=T(e,"btn"),m=d[g];for(c=0;c<m;c++)!O(d[c],_)&&N("input:checked",d[c])&&C(d[c],_);e.Button=this};s[v](["Button",U,"["+a+'="buttons"]']);var H=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){F.call(e,"hide","collapse"),e.isAnimating=!0,e[m].height=e.scrollHeight+"px",k(e,"collapse"),k(e,"show"),C(e,"collapsing"),e.offsetWidth,e[m].height="0px",L(e,(function(){e.isAnimating=!1,e[f]("aria-expanded","false"),t[f]("aria-expanded","false"),k(e,"collapsing"),C(e,"collapse"),e[m].height="",F.call(e,"hidden","collapse")}))};this.toggle=function(e){e.preventDefault(),O(c,"show")?l.hide():l.show()},this.hide=function(){c.isAnimating||(d(c,e),C(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),C(r,"collapsed")),i=e,F.call(t=c,"show","collapse"),t.isAnimating=!0,C(t,"collapsing"),k(t,"collapse"),t[m].height=t.scrollHeight+"px",L(t,(function(){t.isAnimating=!1,t[f]("aria-expanded","true"),i[f]("aria-expanded","true"),k(t,"collapsing"),C(t,"collapse"),C(t,"show"),t[m].height="",F.call(t,"shown","collapse")})),k(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",H,"["+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]&&j(c[l])),(c[g]&&h||!c[g]&&(d||u)||!d)&&e.open&&27===i&&(r.toggle(),o=null)},w=function(){F.call(i,"show","dropdown",o),C(s,"show"),C(i,"show"),e[f]("aria-expanded",!0),F.call(i,"shown","dropdown",o),e.open=!0,R(e,"click",_),setTimeout((function(){j(s.getElementsByTagName("INPUT")[0]||e),d()}),1)},S=function(){F.call(i,"hide","dropdown",o),k(s,"show"),k(i,"show"),e[f]("aria-expanded",!1),F.call(i,"hidden","dropdown",o),e.open=!1,d(),j(e),setTimeout((function(){M(e,"click",_)}),1)};e.open=!1,this.toggle=function(){O(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=O(n,"modal")?n:a;if(O(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]=!!O(c,"fade"),this.content=o.content,c.isAnimating=!1;var d,v,_,y,w,E=this,A=null,I=T(r,"fixed-top").concat(T(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)},U=function(){j(c),c.isAnimating=!1,F.call(c,"shown","modal",A),M(e,"resize",E.update,P),M(c,"click",W),M(t,"keydown",$)},H=function(){c[m].display="",n&&j(n),F.call(c,"hidden","modal"),T(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=""}(),k(t[i],"modal-open"),_&&O(_,"fade")?(k(_,"show"),L(_,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&&O(c,"show")&&E.hide()},W=function(e){if(!c.isAnimating){var t=e[l];O(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(){O(c,"show")?this.hide():this.show()},this.show=function(){O(c,"show")||c.isAnimating||(clearTimeout(w),w=setTimeout((function(){c.isAnimating=!0,F.call(c,"show","modal",A);var e,n=T(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),_&&!O(_,"show")&&(_.offsetWidth,y=z(_),C(_,"show")),setTimeout((function(){c[m].display="block",B(),D(),C(t[i],"modal-open"),C(c,"show"),c[f]("aria-hidden",!1),O(c,"fade")?L(c,U):U()}),x&&_&&y?y:1)}),1))},this.hide=function(){!c.isAnimating&&O(c,"show")&&(clearTimeout(w),w=setTimeout((function(){c.isAnimating=!0,F.call(c,"hide","modal"),_=N(".modal-backdrop"),y=_&&z(_),k(c,"show"),c[f]("aria-hidden",!0),setTimeout((function(){O(c,"fade")?L(c,H):H()}),x&&_&&y?y:2)}),2))},this.setContent=function(e){N(".modal-content",c).innerHTML=e},this.update=function(){O(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||O(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 V=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,j=r.title||n[h]("data-title")||null,T=r.content||n[h]("data-content")||null;if(T||this.template){var D=null,z=0,q=this.placement,U=function(e){null!==D&&e[l]===N(".close",D)&&A.hide()},H=function(r){"click"!=A.trigger&&"focus"!=A.trigger||!A.dismissible&&r(n,"blur",A.hide),A.dismissible&&r(t,"click",U),r(e,"resize",A.hide,P)},$=function(){H(M),F.call(n,"shown","popover")},W=function(){H(R),A.container.removeChild(D),z=null,D=null,F.call(n,"hidden","popover")};this.toggle=function(){null===D?A.show():A.hide()},this.show=function(){clearTimeout(z),z=setTimeout((function(){null===D&&(q=A.placement,function(){j=r.title||n[h]("data-title"),T=(T=r.content||n[h]("data-content"))?T.trim():null,D=t.createElement("div");var e=t.createElement("div");if(e[f]("class","arrow"),D.appendChild(e),null!==T&&null===A.template){if(D[f]("role","tooltip"),null!==j){var i=t.createElement("h3");i[f]("class","popover-header"),i.innerHTML=A.dismissible?j+_:j,D.appendChild(i)}var o=t.createElement("div");o[f]("class","popover-body"),o.innerHTML=A.dismissible&&null===j?T+_:T,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),!O(D,"show")&&C(D,"show"),F.call(n,"show","popover"),A[u]?L(D,$):$())}),20)},this.hide=function(){clearTimeout(z),z=setTimeout((function(){D&&null!==D&&O(D,"show")&&(F.call(n,"hide","popover"),k(D,"show"),A[u]?L(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",V,"["+a+'="popover"]']);var G=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="",k(v,"collapsing"),d.isAnimating=!1},S=function(){v?c?w():setTimeout((function(){v[m].height=l+"px",v.offsetWidth,L(v,w)}),50):d.isAnimating=!1,F.call(r,"shown","tab",i)},E=function(){v&&(o[m].float=b,s[m].float=b,a=o.scrollHeight),C(s,_),F.call(r,"show","tab",i),k(o,_),F.call(i,"hidden","tab",r),v&&(l=s.scrollHeight,c=l===a,C(v,"collapsing"),v[m].height=a+"px",v.offsetHeight,o[m].float="",s[m].float=""),O(s,"fade")?setTimeout((function(){C(s,"show"),L(s,S)}),20):S()};if(d){d.isAnimating=!1;var A=function(){var e,t=T(d,_);return 1!==t[g]||O(t[0][p],"dropdown")?t[g]>1&&(e=t[t[g]-1]):e=t[0],e},j=function(){return N(A()[h]("href"))};this.show=function(){s=N((r=r||e)[h]("href")),i=A(),o=j(),d.isAnimating=!0,k(i,_),i[f]("aria-selected","false"),C(r,_),r[f]("aria-selected","true"),y&&(O(e[p],"dropdown-menu")?O(y,_)||C(y,_):O(y,_)&&k(y,_)),F.call(i,"hide","tab",r),O(o,"fade")?(k(o,"show"),L(o,E)):E()},"Tab"in e||M(e,"click",(function(e){e.preventDefault(),r=e.currentTarget,!d.isAnimating&&!O(r,_)&&u.show()})),u.height&&(v=j()[p]),e.Tab=u}};s[v](["Tab",G,"["+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(){k(a,"showing"),C(a,"show"),F.call(a,"shown","toast"),o.autohide&&o.hide()},u=function(){C(a,"hide"),F.call(a,"hidden","toast")},d=function(){k(a,"show"),o.animation?L(a,u):u()},f=function(){clearTimeout(s),s=null,C(a,"hide"),R(e,"click",o.hide),e.Toast=null,e=null,a=null};this.show=function(){a&&(F.call(a,"show","toast"),o.animation&&C(a,"fade"),k(a,"hide"),C(a,"showing"),o.animation?L(a,l):l())},this.hide=function(e){a&&O(a,"show")&&(F.call(a,"hide","toast"),e?d():s=setTimeout(d,o[c]))},this.dispose=function(){a&&O(a,"show")&&(k(a,"show"),o.animation?L(a,f):f())},"Toast"in e||M(e,"click",o.hide),e.Toast=o};s[v](["Toast",J,'[data-dismiss="toast"]']);var Q=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,j=n[h]("title")||n[h]("data-title")||n[h]("data-original-title");if(j&&""!=j){var T=function(){M(e,"resize",S.hide,P),F.call(n,"shown","tooltip")},D=function(){R(e,"resize",S.hide,P),S.container.removeChild(A),A=null,x=null,F.call(n,"hidden","tooltip")};this.show=function(){clearTimeout(x),x=setTimeout((function(){null===A&&(E=S.placement,!1!==function(){if((j=n[h]("title")||n[h]("data-title")||n[h]("data-original-title"))&&""!==j){(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=j,S.container.appendChild(A),A[f]("class","tooltip bs-tooltip-"+E+" "+S[u])}}()&&(B(n,A,E,S.container),!O(A,"show")&&C(A,"show"),F.call(n,"show","tooltip"),S[u]?L(A,T):T()))}),20)},this.hide=function(){clearTimeout(x),x=setTimeout((function(){A&&O(A,"show")&&(F.call(n,"hide","tooltip"),k(A,"show"),S[u]?L(A,D):D())}),S[c])},this.toggle=function(){A?S.hide():S.show()},"Tooltip"in n||(n[f]("data-original-title",j),n.removeAttribute("title"),M(n,d[0],S.show),M(n,d[1],S.hide)),n.Tooltip=S}};s[v](["Tooltip",Q,"["+a+'="tooltip"]']);var Y=function(e,t){for(var n=0,r=t[g];n<r;n++)new e(t[n])},K=o.initCallback=function(e){e=e||t;for(var n=0,r=s[g];n<r;n++)Y(s[n][1],e.querySelectorAll(s[n][2]))};return t[i]?K():M(t,"DOMContentLoaded",(function(){K()})),{Alert:q,Button:U,Collapse:H,Dropdown:$,Modal:W,Popover:V,Tab:G,Toast:J,Tooltip:Q}})?r.apply(t,i):r)||(e.exports=o)}).call(this,n(16))},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(153),n(154),n(155)):(i=[n(153),n(154),n(155)],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 j=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):j.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(111),i=n(26),o=n(112),s=n(67),a=n(89),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(44);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(22),i=n(446),o=n(447),s=Object.defineProperty;t.f=n(29)?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]",j="[object Float64Array]",C="[object Int8Array]",k="[object Int16Array]",O="[object Int32Array]",T="[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,z=/[&<>"']/g,L=RegExp(P.source),F=RegExp(z.source),B=/<%-([\s\S]+?)%>/g,q=/<%([\s\S]+?)%>/g,U=/<%=([\s\S]+?)%>/g,H=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$=/^\w*$/,W=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,V=/[\\^$.*+?()[\]{}|]/g,G=RegExp(V.source),J=/^\s+|\s+$/g,Q=/^\s+/,Y=/\s+$/,K=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,X=/\{\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]",je="(?:"+be+"|"+ye+")",Ce="(?:"+Ae+"|"+ye+")",ke="(?:"+me+"|"+we+")"+"?",Oe="[\\ufe0e\\ufe0f]?"+ke+("(?:\\u200d(?:"+[Se,xe,Ee].join("|")+")[\\ufe0e\\ufe0f]?"+ke+")*"),Te="(?:"+[_e,xe,Ee].join("|")+")"+Oe,Ne="(?:"+[Se+me+"?",me,xe,Ee,pe].join("|")+")",Ie=RegExp("[']","g"),Me=RegExp(me,"g"),Re=RegExp(we+"(?="+we+")|"+Ne+Oe,"g"),De=RegExp([Ae+"?"+be+"+(?:['](?:d|ll|m|re|s|t|ve))?(?="+[ge,Ae,"$"].join("|")+")",Ce+"+(?:['](?:D|LL|M|RE|S|T|VE))?(?="+[ge,Ae+je,"$"].join("|")+")",Ae+"?"+je+"+(?:['](?: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,Te].join("|"),"g"),Pe=RegExp("[\\u200d\\ud800-\\udfff"+he+"\\ufe0e\\ufe0f]"),ze=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Le=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Fe=-1,Be={};Be[A]=Be[j]=Be[C]=Be[k]=Be[O]=Be[T]=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[j]=qe[C]=qe[k]=qe[O]=qe[g]=qe[m]=qe[v]=qe[_]=qe[b]=qe[y]=qe[w]=qe[T]=qe["[object Uint8ClampedArray]"]=qe[N]=qe[I]=!0,qe[h]=qe[f]=qe[S]=!1;var Ue={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},He=parseFloat,$e=parseInt,We="object"==typeof e&&e&&e.Object===Object&&e,Ve="object"==typeof self&&self&&self.Object===Object&&self,Ge=We||Ve||Function("return this")(),Je=t&&!t.nodeType&&t,Qe=Je&&"object"==typeof r&&r&&!r.nodeType&&r,Ye=Qe&&Qe.exports===Je,Ke=Ye&&We.process,Xe=function(){try{var e=Qe&&Qe.require&&Qe.require("util").types;return e||Ke&&Ke.binding&&Ke.binding("util")}catch(e){}}(),Ze=Xe&&Xe.isArrayBuffer,et=Xe&&Xe.isDate,tt=Xe&&Xe.isMap,nt=Xe&&Xe.isRegExp,rt=Xe&&Xe.isSet,it=Xe&&Xe.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?kt(e,t)/n:NaN}function At(e){return function(t){return null==t?void 0:t[e]}}function jt(e){return function(t){return null==e?void 0:e[t]}}function Ct(e,t,n,r,i){return i(e,(function(e,i,o){n=r?(r=!1,e):t(n,e,i,o)})),n}function kt(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 Ot(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Tt(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=jt({"À":"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"}),zt=jt({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function Lt(e){return"\\"+Ue[e]}function Ft(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 Ut(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 Ht(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 Ft(e)?function(e){var t=Re.lastIndex=0;for(;Re.test(e);)++t;return t}(e):_t(e)}function Vt(e){return Ft(e)?function(e){return e.match(Re)||[]}(e):function(e){return e.split("")}(e)}var Gt=jt({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"});var Jt=function e(t){var n,r=(t=null==t?Ge:Jt.defaults(Ge.Object(),t,Jt.pick(Ge,Le))).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,je=(n=/[^.]+$/.exec(Se&&Se.keys&&Se.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Ce=we.toString,ke=xe.call(ge),Oe=Ge._,Te=me("^"+xe.call(Ee).replace(V,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ne=Ye?t.Buffer:void 0,Re=t.Symbol,Pe=t.Uint8Array,Ue=Ne?Ne.allocUnsafe:void 0,We=qt(ge.getPrototypeOf,ge),Ve=ge.create,Je=we.propertyIsEnumerable,Qe=be.splice,Ke=Re?Re.isConcatSpreadable:void 0,Xe=Re?Re.iterator:void 0,_t=Re?Re.toStringTag:void 0,jt=function(){try{var e=Zi(ge,"defineProperty");return e({},"",{}),e}catch(e){}}(),Qt=t.clearTimeout!==Ge.clearTimeout&&t.clearTimeout,Yt=i&&i.now!==Ge.Date.now&&i.now,Kt=t.setTimeout!==Ge.setTimeout&&t.setTimeout,Xt=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=Co(hn),wn=Co(fn),Sn=Co(pn),xn=Co(gn),En=Co(mn),An=Re?Re.prototype:void 0,jn=An?An.valueOf:void 0,Cn=An?An.toString:void 0;function kn(e){if($s(e)&&!Ms(e)&&!(e instanceof In)){if(e instanceof Nn)return e;if(Ee.call(e,"__wrapped__"))return ko(e)}return new Nn(e)}var On=function(){function e(){}return function(t){if(!Hs(t))return{};if(Ve)return Ve(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function Tn(){}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 zn(e){var t=this.__data__=new Rn(e);this.size=t.size}function Ln(e,t){var n=Ms(e),r=!n&&Is(e),i=!n&&!r&&zs(e),o=!n&&!r&&!i&&Xs(e),s=n||r||i||o,a=s?Ot(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 Fn(e){var t=e.length;return t?e[Pr(0,t-1)]:void 0}function Bn(e,t){return Eo(vi(e),Qn(t,0,e.length))}function qn(e){return Eo(vi(e))}function Un(e,t,n){(void 0!==n&&!Os(e[t],n)||void 0===n&&!(t in e))&&Gn(e,t,n)}function Hn(e,t,n){var r=e[t];Ee.call(e,t)&&Os(r,n)&&(void 0!==n||t in e)||Gn(e,t,n)}function $n(e,t){for(var n=e.length;n--;)if(Os(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 Vn(e,t){return e&&_i(t,ya(t),e)}function Gn(e,t,n){"__proto__"==t&&jt?jt(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 Qn(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}function Yn(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(!Hs(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(zs(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,Vn(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 j:case C:case k:case O:case T: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,jn?ge(jn.call(i)):{}}var i}(e,M,a)}}o||(o=new zn);var D=o.get(e);if(D)return D;o.set(e,s),Qs(e)?e.forEach((function(r){s.add(Yn(r,t,n,r,e,o))})):Ws(e)&&e.forEach((function(r,i){s.set(i,Yn(r,t,n,i,e,o))}));var P=S?void 0:(h?l?Vi:Wi:l?wa:ya)(e);return at(P||e,(function(r,i){P&&(r=e[i=r]),Hn(s,i,Yn(r,t,n,i,e,o))})),s}function Kn(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 Xn(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,Tt(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}kn.templateSettings={escape:B,evaluate:q,interpolate:U,variable:"",imports:{_:kn}},kn.prototype=Tn.prototype,kn.prototype.constructor=kn,Nn.prototype=On(Tn.prototype),Nn.prototype.constructor=Nn,In.prototype=On(Tn.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():Qe.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=Ki(this,e).delete(e);return this.size-=t?1:0,t},Dn.prototype.get=function(e){return Ki(this,e).get(e)},Dn.prototype.has=function(e){return Ki(this,e).has(e)},Dn.prototype.set=function(e,t){var n=Ki(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)},zn.prototype.clear=function(){this.__data__=new Rn,this.size=0},zn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},zn.prototype.get=function(e){return this.__data__.get(e)},zn.prototype.has=function(e){return this.__data__.has(e)},zn.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&&!Ks(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[jo(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=Ce.call(e);r&&(t?e[_t]=n:delete e[_t]);return i}(e):function(e){return Ce.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,Tt(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[jo(Fo(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,j=f==p;if(j&&zs(e)){if(!zs(t))return!1;s=!0,S=!1}if(j&&!S)return o||(o=new zn),s||Xs(e)?Hi(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 Os(+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=Ht),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=Hi(a(e),a(t),r,i,o,s);return s.delete(e),f;case w:if(jn)return jn.call(e)==jn.call(t)}return!1}(e,t,f,n,r,i,o);if(!(1&n)){var C=S&&Ee.call(e,"__wrapped__"),k=A&&Ee.call(t,"__wrapped__");if(C||k){var O=C?e.value():e,T=k?t.value():t;return o||(o=new zn),i(O,T,n,r,o)}}if(!j)return!1;return o||(o=new zn),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 zn;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!(!Hs(e)||(t=e,je&&je in t))&&(Bs(e)?Te:se).test(Co(e));var t}function xr(e){return"function"==typeof e?e:null==e?Va:"object"==typeof e?Ms(e)?Or(e[0],e[1]):kr(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(!Hs(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 jr(e,t){return e<t}function Cr(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 kr(e){var t=Xi(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 Or(e,t){return co(e)&&fo(t)?po(jo(e),t):function(n){var r=ga(n,e);return void 0===r&&r===t?ma(n,e):yr(t,r,3)}}function Tr(e,t,n,r,i){e!==t&&sr(t,(function(o,s){if(i||(i=new zn),Hs(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 Un(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&&zs(c),p=!h&&!f&&Xs(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=[]:Gs(c)||Is(c)?(u=a,Is(a)?u=sa(a):Hs(a)&&!Bs(a)||(u=io(c))):d=!1}d&&(s.set(c,u),i(u,c,r,o,s),s.delete(c));Un(e,n,u)}(e,t,s,n,Tr,r,i);else{var a=r?r(_o(e,s),o,s+"",e,t,i):void 0;void 0===a&&(a=o),Un(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})):[Va];var r=-1;return t=ft(t,Tt(Yi())),function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(Cr(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,Tt(n)));++o<s;)for(var c=0,l=t[o],u=n?n(l):l;(c=i(a,u,c,r))>-1;)a!==e&&Qe.call(a,c,1),Qe.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)?Qe.call(e,i,1):Zr(e,i)}}return e}function Pr(e,t){return e+Zt(un()*(t-e+1))}function zr(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 Lr(e,t){return wo(go(e,t,Va),e+"")}function Fr(e){return Fn(Oa(e))}function Br(e,t){var n=Oa(e);return Eo(n,Qn(t,0,n.length))}function qr(e,t,n,r){if(!Hs(e))return e;for(var i=-1,o=(t=ai(t,e)).length,s=o-1,a=e;null!=a&&++i<o;){var c=jo(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=Hs(u)?u:so(t[i+1])?[]:{})}Hn(a,c,l),a=a[c]}return e}var Ur=_n?function(e,t){return _n.set(e,t),e}:Va,Hr=jt?function(e,t){return jt(e,"toString",{configurable:!0,enumerable:!1,value:Ha(t),writable:!0})}:Va;function $r(e){return Eo(Oa(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 Vr(e,t){var n;return er(e,(function(e,r,i){return!(n=t(e,r,i))})),!!n}function Gr(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&&!Ks(s)&&(n?s<=t:s<t)?r=o+1:i=o}return i}return Jr(e,t,Va,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=Ks(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=Ks(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 Qr(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||!Os(a,c)){var c=a;o[i++]=0===s?0:s}}return o}function Yr(e){return"number"==typeof e?e:Ks(e)?NaN:+e}function Kr(e){if("string"==typeof e)return e;if(Ms(e))return ft(e,Kr)+"";if(Ks(e))return Cn?Cn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Xr(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:zi(e);if(l)return Ht(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[jo(Fo(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?Xr(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 Xr(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:Va}function ai(e,t){return Ms(e)?e:co(e,t)?[e]:Ao(aa(e))}var ci=Lr;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=Qt||function(e){return Ge.clearTimeout(e)};function di(e,t){if(t)return e.slice();var n=e.length,r=Ue?Ue(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=Ks(e),s=void 0!==t,a=null===t,c=t==t,l=Ks(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?Gn(n,a,c):Hn(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,Yi(r,2),o)}}function yi(e){return Lr((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=Ft(t=aa(t))?Vt(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=On(e.prototype),r=e.apply(n,t);return Hs(r)?r:n}}function ji(e){return function(t,n,r){var i=ge(t);if(!Ds(t)){var o=Yi(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 Ci(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?Gi(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 ki(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=Qi(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=Ut(b,w);return Di(e,t,ki,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!==Ge&&this instanceof v&&(A=m||Ai(A)),A.apply(E,b)}}function Oi(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 Ti(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=Kr(n),r=Kr(r)):(n=Yr(n),r=Yr(r)),i=e(n,r)}return i}}function Ni(e){return $i((function(t){return t=ft(t,Tt(Yi())),Lr((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?" ":Kr(t)).length;if(n<2)return n?zr(t,e):t;var r=zr(t,Xt(e/Wt(t)));return Ft(t)?li(Vt(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(Xt((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 zi=gn&&1/Ht(new gn([,-0]))[1]==1/0?function(e){return new gn(e)}:Ka;function Li(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 Fi(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:Gi(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?Ut(e[3],s):t[4]}(c=t[5])&&(l=e[5],e[5]=l?mi(l,c,t[6]):c,e[6]=l?Ut(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=Qi(o);c--;)a[c]=arguments[c];var u=s<3&&a[0]!==l&&a[s-1]!==l?[]:Ut(a,l);if((s-=u.length)<n)return Di(e,t,ki,o.placeholder,void 0,a,u,void 0,void 0,n-s);var d=this&&this!==Ge&&this instanceof o?i:e;return ot(d,this,a)}}(e,t,u):32!=t&&33!=t||a.length?ki.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!==Ge&&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!==Ge&&this instanceof t?i:e;return o.apply(r?n:this,arguments)}}(e,t,n);return So((g?Ur:bo)(v,m),e,t)}function Bi(e,t,n,r){return void 0===e||Os(e,we[n])&&!Ee.call(r,n)?t:e}function qi(e,t,n,r,i,o){return Hs(e)&&Hs(t)&&(o.set(t,e),Tr(e,t,void 0,qi,o),o.delete(t)),e}function Ui(e){return Gs(e)?void 0:e}function Hi(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 Vi(e){return hr(e,wa,to)}var Gi=_n?function(e){return _n.get(e)}:Ka;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 Qi(e){return(Ee.call(kn,"placeholder")?kn:e).placeholder}function Yi(){var e=kn.iteratee||Ga;return e=e===Ga?xr:e,arguments.length?e(arguments[0],arguments[1]):e}function Ki(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 Xi(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=jo(t[r]);if(!(o=null!=e&&n(e,s)))break;e=e[s]}return o||++r!=i?o:!!(i=null==e?0:e.length)&&Us(i)&&so(s,i)&&(Ms(e)||Is(e))}function io(e){return"function"!=typeof e.constructor||ho(e)?{}:On(We(e))}function oo(e){return Ms(e)||Is(e)||!!(Ke&&e&&e[Ke])}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(!Hs(n))return!1;var r=typeof t;return!!("number"==r?Ds(n)&&so(t,n.length):"string"==r&&t in n)&&Os(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&&!Ks(e))||($.test(e)||!H.test(e)||null!=t&&e in ge(t))}function lo(e){var t=Ji(e),n=kn[t];if("function"!=typeof n||!(t in In.prototype))return!1;if(e===n)return!0;var r=Gi(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?Co(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&&!Hs(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(Ur),yo=Kt||function(e,t){return Ge.setTimeout(e,t)},wo=xo(Hr);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(K,"{\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(X);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 jo(e){if("string"==typeof e||Ks(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Co(e){if(null!=e){try{return xe.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function ko(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 Oo=Lr((function(e,t){return Ps(e)?Zn(e,or(t,1,Ps,!0)):[]})),To=Lr((function(e,t){var n=Fo(t);return Ps(n)&&(n=void 0),Ps(e)?Zn(e,or(t,1,Ps,!0),Yi(n,2)):[]})),No=Lr((function(e,t){var n=Fo(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,Yi(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,Yi(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=Lr((function(e){var t=ft(e,oi);return t.length&&t[0]===e[0]?vr(t):[]})),zo=Lr((function(e){var t=Fo(e),n=ft(e,oi);return t===Fo(n)?t=void 0:n.pop(),n.length&&n[0]===e[0]?vr(n,Yi(t,2)):[]})),Lo=Lr((function(e){var t=Fo(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 Fo(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var Bo=Lr(qo);function qo(e,t){return e&&e.length&&t&&t.length?Rr(e,t):e}var Uo=$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 Ho(e){return null==e?e:dn.call(e)}var $o=Lr((function(e){return Xr(or(e,1,Ps,!0))})),Wo=Lr((function(e){var t=Fo(e);return Ps(t)&&(t=void 0),Xr(or(e,1,Ps,!0),Yi(t,2))})),Vo=Lr((function(e){var t=Fo(e);return t="function"==typeof t?t:void 0,Xr(or(e,1,Ps,!0),void 0,t)}));function Go(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})),Ot(t,(function(t){return ft(e,At(t))}))}function Jo(e,t){if(!e||!e.length)return[];var n=Go(e);return null==t?n:ft(n,(function(e){return ot(t,void 0,e)}))}var Qo=Lr((function(e,t){return Ps(e)?Zn(e,t):[]})),Yo=Lr((function(e){return ri(ut(e,Ps))})),Ko=Lr((function(e){var t=Fo(e);return Ps(t)&&(t=void 0),ri(ut(e,Ps),Yi(t,2))})),Xo=Lr((function(e){var t=Fo(e);return t="function"==typeof t?t:void 0,ri(ut(e,Ps),void 0,t)})),Zo=Lr(Go);var es=Lr((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=kn(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]:Gn(e,n,1)}));var os=ji(Io),ss=ji(Mo);function as(e,t){return(Ms(e)?at:er)(e,Yi(t,3))}function cs(e,t){return(Ms(e)?ct:tr)(e,Yi(t,3))}var ls=bi((function(e,t,n){Ee.call(e,n)?e[n].push(t):Gn(e,n,[t])}));var us=Lr((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){Gn(e,n,t)}));function hs(e,t){return(Ms(e)?ft:Cr)(e,Yi(t,3))}var fs=bi((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]}));var ps=Lr((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=Yt||function(){return Ge.Date.now()};function ms(e,t,n){return t=n?void 0:t,Fi(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=Lr((function(e,t,n){var r=1;if(n.length){var i=Ut(n,Qi(_s));r|=32}return Fi(e,r,t,n,i)})),bs=Lr((function(e,t,n){var r=3;if(n.length){var i=Ut(n,Qi(bs));r|=32}return Fi(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,Hs(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=Lr((function(e,t){return Xn(e,1,t)})),Ss=Lr((function(e,t,n){return Xn(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],Tt(Yi())):ft(or(t,1),Tt(Yi()))).length;return Lr((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)}))})),js=Lr((function(e,t){return Fi(e,32,void 0,t,Ut(t,Qi(js)))})),Cs=Lr((function(e,t){return Fi(e,64,void 0,t,Ut(t,Qi(Cs)))})),ks=$i((function(e,t){return Fi(e,256,void 0,void 0,void 0,t)}));function Os(e,t){return e===t||e!=e&&t!=t}var Ts=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?Tt(Ze):function(e){return $s(e)&&fr(e)==x};function Ds(e){return null!=e&&Us(e.length)&&!Bs(e)}function Ps(e){return $s(e)&&Ds(e)}var zs=tn||oc,Ls=et?Tt(et):function(e){return $s(e)&&fr(e)==d};function Fs(e){if(!$s(e))return!1;var t=fr(e);return t==h||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!Gs(e)}function Bs(e){if(!Hs(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 Us(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function Hs(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function $s(e){return null!=e&&"object"==typeof e}var Ws=tt?Tt(tt):function(e){return $s(e)&&no(e)==g};function Vs(e){return"number"==typeof e||$s(e)&&fr(e)==m}function Gs(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)==ke}var Js=nt?Tt(nt):function(e){return $s(e)&&fr(e)==_};var Qs=rt?Tt(rt):function(e){return $s(e)&&no(e)==b};function Ys(e){return"string"==typeof e||!Ms(e)&&$s(e)&&fr(e)==y}function Ks(e){return"symbol"==typeof e||$s(e)&&fr(e)==w}var Xs=it?Tt(it):function(e){return $s(e)&&Us(e.length)&&!!Be[fr(e)]};var Zs=Ri(jr),ea=Ri((function(e,t){return e<=t}));function ta(e){if(!e)return[];if(Ds(e))return Ys(e)?Vt(e):vi(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=no(e);return(t==g?Bt:t==b?Ht:Oa)(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?Qn(ra(e),0,4294967295):0}function oa(e){if("number"==typeof e)return e;if(Ks(e))return NaN;if(Hs(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Hs(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?"":Kr(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)&&Hn(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=Lr((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||Os(u,we[l])&&!Ee.call(e,l))&&(e[l]=o[l])}return e})),pa=Lr((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=Oi((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Ce.call(t)),e[t]=n}),Ha(Va)),_a=Oi((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Ce.call(t)),Ee.call(e,t)?e[t].push(n):e[t]=[n]}),Yi),ba=Lr(_r);function ya(e){return Ds(e)?Ln(e):Er(e)}function wa(e){return Ds(e)?Ln(e,!0):Ar(e)}var Sa=yi((function(e,t,n){Tr(e,t,n)})),xa=yi((function(e,t,n,r){Tr(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,Vi(e),n),r&&(n=Yn(n,7,Ui));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 ja(e,t){if(null==e)return{};var n=ft(Vi(e),(function(e){return[e]}));return t=Yi(t),Mr(e,n,(function(e,n){return t(e,n[0])}))}var Ca=Li(ya),ka=Li(wa);function Oa(e){return null==e?[]:Nt(e,ya(e))}var Ta=Ei((function(e,t,n){return t=t.toLowerCase(),e+(n?Na(t):t)}));function Na(e){return Fa(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 za=Ei((function(e,t,n){return e+(n?" ":"")+Fa(t)}));var La=Ei((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Fa=xi("toUpperCase");function Ba(e,t,n){return e=aa(e),void 0===(t=n?void 0:t)?function(e){return ze.test(e)}(e)?function(e){return e.match(De)||[]}(e):function(e){return e.match(ee)||[]}(e):e.match(t)||[]}var qa=Lr((function(e,t){try{return ot(e,void 0,t)}catch(e){return Fs(e)?e:new he(e)}})),Ua=$i((function(e,t){return at(t,(function(t){t=jo(t),Gn(e,t,_s(e[t],e))})),e}));function Ha(e){return function(){return e}}var $a=Ci(),Wa=Ci(!0);function Va(e){return e}function Ga(e){return xr("function"==typeof e?e:Yn(e,1))}var Ja=Lr((function(e,t){return function(n){return _r(n,e,t)}})),Qa=Lr((function(e,t){return function(n){return _r(e,n,t)}}));function Ya(e,t,n){var r=ya(t),i=ur(t,r);null!=n||Hs(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=ur(t,ya(t)));var o=!(Hs(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 Ka(){}var Xa=Ni(ft),Za=Ni(lt),ec=Ni(vt);function tc(e){return co(e)?At(jo(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=Ti((function(e,t){return e+t}),0),ac=Pi("ceil"),cc=Ti((function(e,t){return e/t}),1),lc=Pi("floor");var uc,dc=Ti((function(e,t){return e*t}),1),hc=Pi("round"),fc=Ti((function(e,t){return e-t}),0);return kn.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)}},kn.ary=ms,kn.assign=ca,kn.assignIn=la,kn.assignInWith=ua,kn.assignWith=da,kn.at=ha,kn.before=vs,kn.bind=_s,kn.bindAll=Ua,kn.bindKey=bs,kn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Ms(e)?e:[e]},kn.chain=ts,kn.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(Xt(i/t));o<i;)a[s++]=Wr(e,o,o+=t);return a},kn.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},kn.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))},kn.cond=function(e){var t=null==e?0:e.length,n=Yi();return e=t?ft(e,(function(e){if("function"!=typeof e[1])throw new _e(o);return[n(e[0]),e[1]]})):[],Lr((function(n){for(var r=-1;++r<t;){var i=e[r];if(ot(i[0],this,n))return ot(i[1],this,n)}}))},kn.conforms=function(e){return function(e){var t=ya(e);return function(n){return Kn(n,e,t)}}(Yn(e,1))},kn.constant=Ha,kn.countBy=is,kn.create=function(e,t){var n=On(e);return null==t?n:Vn(n,t)},kn.curry=function e(t,n,r){var i=Fi(t,8,void 0,void 0,void 0,void 0,void 0,n=r?void 0:n);return i.placeholder=e.placeholder,i},kn.curryRight=function e(t,n,r){var i=Fi(t,16,void 0,void 0,void 0,void 0,void 0,n=r?void 0:n);return i.placeholder=e.placeholder,i},kn.debounce=ys,kn.defaults=fa,kn.defaultsDeep=pa,kn.defer=ws,kn.delay=Ss,kn.difference=Oo,kn.differenceBy=To,kn.differenceWith=No,kn.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):[]},kn.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):[]},kn.dropRightWhile=function(e,t){return e&&e.length?ti(e,Yi(t,3),!0,!0):[]},kn.dropWhile=function(e,t){return e&&e.length?ti(e,Yi(t,3),!0):[]},kn.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)):[]},kn.filter=function(e,t){return(Ms(e)?ut:ir)(e,Yi(t,3))},kn.flatMap=function(e,t){return or(hs(e,t),1)},kn.flatMapDeep=function(e,t){return or(hs(e,t),1/0)},kn.flatMapDepth=function(e,t,n){return n=void 0===n?1:ra(n),or(hs(e,t),n)},kn.flatten=Ro,kn.flattenDeep=function(e){return(null==e?0:e.length)?or(e,1/0):[]},kn.flattenDepth=function(e,t){return(null==e?0:e.length)?or(e,t=void 0===t?1:ra(t)):[]},kn.flip=function(e){return Fi(e,512)},kn.flow=$a,kn.flowRight=Wa,kn.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},kn.functions=function(e){return null==e?[]:ur(e,ya(e))},kn.functionsIn=function(e){return null==e?[]:ur(e,wa(e))},kn.groupBy=ls,kn.initial=function(e){return(null==e?0:e.length)?Wr(e,0,-1):[]},kn.intersection=Po,kn.intersectionBy=zo,kn.intersectionWith=Lo,kn.invert=va,kn.invertBy=_a,kn.invokeMap=us,kn.iteratee=Ga,kn.keyBy=ds,kn.keys=ya,kn.keysIn=wa,kn.map=hs,kn.mapKeys=function(e,t){var n={};return t=Yi(t,3),cr(e,(function(e,r,i){Gn(n,t(e,r,i),e)})),n},kn.mapValues=function(e,t){var n={};return t=Yi(t,3),cr(e,(function(e,r,i){Gn(n,r,t(e,r,i))})),n},kn.matches=function(e){return kr(Yn(e,1))},kn.matchesProperty=function(e,t){return Or(e,Yn(t,1))},kn.memoize=xs,kn.merge=Sa,kn.mergeWith=xa,kn.method=Ja,kn.methodOf=Qa,kn.mixin=Ya,kn.negate=Es,kn.nthArg=function(e){return e=ra(e),Lr((function(t){return Nr(t,e)}))},kn.omit=Ea,kn.omitBy=function(e,t){return ja(e,Es(Yi(t)))},kn.once=function(e){return vs(2,e)},kn.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))},kn.over=Xa,kn.overArgs=As,kn.overEvery=Za,kn.overSome=ec,kn.partial=js,kn.partialRight=Cs,kn.partition=fs,kn.pick=Aa,kn.pickBy=ja,kn.property=tc,kn.propertyOf=function(e){return function(t){return null==e?void 0:dr(e,t)}},kn.pull=Bo,kn.pullAll=qo,kn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Rr(e,t,Yi(n,2)):e},kn.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?Rr(e,t,void 0,n):e},kn.pullAt=Uo,kn.range=nc,kn.rangeRight=rc,kn.rearg=ks,kn.reject=function(e,t){return(Ms(e)?ut:ir)(e,Es(Yi(t,3)))},kn.remove=function(e,t){var n=[];if(!e||!e.length)return n;var r=-1,i=[],o=e.length;for(t=Yi(t,3);++r<o;){var s=e[r];t(s,r,e)&&(n.push(s),i.push(r))}return Dr(e,i),n},kn.rest=function(e,t){if("function"!=typeof e)throw new _e(o);return Lr(e,t=void 0===t?t:ra(t))},kn.reverse=Ho,kn.sampleSize=function(e,t,n){return t=(n?ao(e,t,n):void 0===t)?1:ra(t),(Ms(e)?Bn:Br)(e,t)},kn.set=function(e,t,n){return null==e?e:qr(e,t,n)},kn.setWith=function(e,t,n,r){return r="function"==typeof r?r:void 0,null==e?e:qr(e,t,n,r)},kn.shuffle=function(e){return(Ms(e)?qn:$r)(e)},kn.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)):[]},kn.sortBy=ps,kn.sortedUniq=function(e){return e&&e.length?Qr(e):[]},kn.sortedUniqBy=function(e,t){return e&&e.length?Qr(e,Yi(t,2)):[]},kn.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=Kr(t))&&Ft(e)?li(Vt(e),0,n):e.split(t,n):[]},kn.spread=function(e,t){if("function"!=typeof e)throw new _e(o);return t=null==t?0:sn(ra(t),0),Lr((function(n){var r=n[t],i=li(n,0,t);return r&&pt(i,r),ot(e,this,i)}))},kn.tail=function(e){var t=null==e?0:e.length;return t?Wr(e,1,t):[]},kn.take=function(e,t,n){return e&&e.length?Wr(e,0,(t=n||void 0===t?1:ra(t))<0?0:t):[]},kn.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):[]},kn.takeRightWhile=function(e,t){return e&&e.length?ti(e,Yi(t,3),!1,!0):[]},kn.takeWhile=function(e,t){return e&&e.length?ti(e,Yi(t,3)):[]},kn.tap=function(e,t){return t(e),e},kn.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new _e(o);return Hs(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),ys(e,t,{leading:r,maxWait:t,trailing:i})},kn.thru=ns,kn.toArray=ta,kn.toPairs=Ca,kn.toPairsIn=ka,kn.toPath=function(e){return Ms(e)?ft(e,jo):Ks(e)?[e]:vi(Ao(aa(e)))},kn.toPlainObject=sa,kn.transform=function(e,t,n){var r=Ms(e),i=r||zs(e)||Xs(e);if(t=Yi(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Hs(e)&&Bs(o)?On(We(e)):{}}return(i?at:cr)(e,(function(e,r,i){return t(n,e,r,i)})),n},kn.unary=function(e){return ms(e,1)},kn.union=$o,kn.unionBy=Wo,kn.unionWith=Vo,kn.uniq=function(e){return e&&e.length?Xr(e):[]},kn.uniqBy=function(e,t){return e&&e.length?Xr(e,Yi(t,2)):[]},kn.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Xr(e,void 0,t):[]},kn.unset=function(e,t){return null==e||Zr(e,t)},kn.unzip=Go,kn.unzipWith=Jo,kn.update=function(e,t,n){return null==e?e:ei(e,t,si(n))},kn.updateWith=function(e,t,n,r){return r="function"==typeof r?r:void 0,null==e?e:ei(e,t,si(n),r)},kn.values=Oa,kn.valuesIn=function(e){return null==e?[]:Nt(e,wa(e))},kn.without=Qo,kn.words=Ba,kn.wrap=function(e,t){return js(si(t),e)},kn.xor=Yo,kn.xorBy=Ko,kn.xorWith=Xo,kn.zip=Zo,kn.zipObject=function(e,t){return ii(e||[],t||[],Hn)},kn.zipObjectDeep=function(e,t){return ii(e||[],t||[],qr)},kn.zipWith=es,kn.entries=Ca,kn.entriesIn=ka,kn.extend=la,kn.extendWith=ua,Ya(kn,kn),kn.add=sc,kn.attempt=qa,kn.camelCase=Ta,kn.capitalize=Na,kn.ceil=ac,kn.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),Qn(oa(e),t,n)},kn.clone=function(e){return Yn(e,4)},kn.cloneDeep=function(e){return Yn(e,5)},kn.cloneDeepWith=function(e,t){return Yn(e,5,t="function"==typeof t?t:void 0)},kn.cloneWith=function(e,t){return Yn(e,4,t="function"==typeof t?t:void 0)},kn.conformsTo=function(e,t){return null==t||Kn(e,t,ya(t))},kn.deburr=Ia,kn.defaultTo=function(e,t){return null==e||e!=e?t:e},kn.divide=cc,kn.endsWith=function(e,t,n){e=aa(e),t=Kr(t);var r=e.length,i=n=void 0===n?r:Qn(ra(n),0,r);return(n-=t.length)>=0&&e.slice(n,i)==t},kn.eq=Os,kn.escape=function(e){return(e=aa(e))&&F.test(e)?e.replace(z,zt):e},kn.escapeRegExp=function(e){return(e=aa(e))&&G.test(e)?e.replace(V,"\\$&"):e},kn.every=function(e,t,n){var r=Ms(e)?lt:nr;return n&&ao(e,t,n)&&(t=void 0),r(e,Yi(t,3))},kn.find=os,kn.findIndex=Io,kn.findKey=function(e,t){return bt(e,Yi(t,3),cr)},kn.findLast=ss,kn.findLastIndex=Mo,kn.findLastKey=function(e,t){return bt(e,Yi(t,3),lr)},kn.floor=lc,kn.forEach=as,kn.forEachRight=cs,kn.forIn=function(e,t){return null==e?e:sr(e,Yi(t,3),wa)},kn.forInRight=function(e,t){return null==e?e:ar(e,Yi(t,3),wa)},kn.forOwn=function(e,t){return e&&cr(e,Yi(t,3))},kn.forOwnRight=function(e,t){return e&&lr(e,Yi(t,3))},kn.get=ga,kn.gt=Ts,kn.gte=Ns,kn.has=function(e,t){return null!=e&&ro(e,t,gr)},kn.hasIn=ma,kn.head=Do,kn.identity=Va,kn.includes=function(e,t,n,r){e=Ds(e)?e:Oa(e),n=n&&!r?ra(n):0;var i=e.length;return n<0&&(n=sn(i+n,0)),Ys(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&wt(e,t,n)>-1},kn.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)},kn.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)},kn.invoke=ba,kn.isArguments=Is,kn.isArray=Ms,kn.isArrayBuffer=Rs,kn.isArrayLike=Ds,kn.isArrayLikeObject=Ps,kn.isBoolean=function(e){return!0===e||!1===e||$s(e)&&fr(e)==u},kn.isBuffer=zs,kn.isDate=Ls,kn.isElement=function(e){return $s(e)&&1===e.nodeType&&!Gs(e)},kn.isEmpty=function(e){if(null==e)return!0;if(Ds(e)&&(Ms(e)||"string"==typeof e||"function"==typeof e.splice||zs(e)||Xs(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},kn.isEqual=function(e,t){return yr(e,t)},kn.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},kn.isError=Fs,kn.isFinite=function(e){return"number"==typeof e&&nn(e)},kn.isFunction=Bs,kn.isInteger=qs,kn.isLength=Us,kn.isMap=Ws,kn.isMatch=function(e,t){return e===t||wr(e,t,Xi(t))},kn.isMatchWith=function(e,t,n){return n="function"==typeof n?n:void 0,wr(e,t,Xi(t),n)},kn.isNaN=function(e){return Vs(e)&&e!=+e},kn.isNative=function(e){if(uo(e))throw new he("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Sr(e)},kn.isNil=function(e){return null==e},kn.isNull=function(e){return null===e},kn.isNumber=Vs,kn.isObject=Hs,kn.isObjectLike=$s,kn.isPlainObject=Gs,kn.isRegExp=Js,kn.isSafeInteger=function(e){return qs(e)&&e>=-9007199254740991&&e<=9007199254740991},kn.isSet=Qs,kn.isString=Ys,kn.isSymbol=Ks,kn.isTypedArray=Xs,kn.isUndefined=function(e){return void 0===e},kn.isWeakMap=function(e){return $s(e)&&no(e)==S},kn.isWeakSet=function(e){return $s(e)&&"[object WeakSet]"==fr(e)},kn.join=function(e,t){return null==e?"":rn.call(e,t)},kn.kebabCase=Ma,kn.last=Fo,kn.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)},kn.lowerCase=Ra,kn.lowerFirst=Da,kn.lt=Zs,kn.lte=ea,kn.max=function(e){return e&&e.length?rr(e,Va,pr):void 0},kn.maxBy=function(e,t){return e&&e.length?rr(e,Yi(t,2),pr):void 0},kn.mean=function(e){return Et(e,Va)},kn.meanBy=function(e,t){return Et(e,Yi(t,2))},kn.min=function(e){return e&&e.length?rr(e,Va,jr):void 0},kn.minBy=function(e,t){return e&&e.length?rr(e,Yi(t,2),jr):void 0},kn.stubArray=ic,kn.stubFalse=oc,kn.stubObject=function(){return{}},kn.stubString=function(){return""},kn.stubTrue=function(){return!0},kn.multiply=dc,kn.nth=function(e,t){return e&&e.length?Nr(e,ra(t)):void 0},kn.noConflict=function(){return Ge._===this&&(Ge._=Oe),this},kn.noop=Ka,kn.now=gs,kn.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(Xt(i),n)},kn.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},kn.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},kn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),ln(aa(e).replace(Q,""),t||0)},kn.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+He("1e-"+((i+"").length-1))),t)}return Pr(e,t)},kn.reduce=function(e,t,n){var r=Ms(e)?gt:Ct,i=arguments.length<3;return r(e,Yi(t,4),n,i,er)},kn.reduceRight=function(e,t,n){var r=Ms(e)?mt:Ct,i=arguments.length<3;return r(e,Yi(t,4),n,i,tr)},kn.repeat=function(e,t,n){return t=(n?ao(e,t,n):void 0===t)?1:ra(t),zr(aa(e),t)},kn.replace=function(){var e=arguments,t=aa(e[0]);return e.length<3?t:t.replace(e[1],e[2])},kn.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[jo(t[r])];void 0===o&&(r=i,o=n),e=Bs(o)?o.call(e):o}return e},kn.round=hc,kn.runInContext=e,kn.sample=function(e){return(Ms(e)?Fn:Fr)(e)},kn.size=function(e){if(null==e)return 0;if(Ds(e))return Ys(e)?Wt(e):e.length;var t=no(e);return t==g||t==b?e.size:Er(e).length},kn.snakeCase=Pa,kn.some=function(e,t,n){var r=Ms(e)?vt:Vr;return n&&ao(e,t,n)&&(t=void 0),r(e,Yi(t,3))},kn.sortedIndex=function(e,t){return Gr(e,t)},kn.sortedIndexBy=function(e,t,n){return Jr(e,t,Yi(n,2))},kn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=Gr(e,t);if(r<n&&Os(e[r],t))return r}return-1},kn.sortedLastIndex=function(e,t){return Gr(e,t,!0)},kn.sortedLastIndexBy=function(e,t,n){return Jr(e,t,Yi(n,2),!0)},kn.sortedLastIndexOf=function(e,t){if(null==e?0:e.length){var n=Gr(e,t,!0)-1;if(Os(e[n],t))return n}return-1},kn.startCase=za,kn.startsWith=function(e,t,n){return e=aa(e),n=null==n?0:Qn(ra(n),0,e.length),t=Kr(t),e.slice(n,n+t.length)==t},kn.subtract=fc,kn.sum=function(e){return e&&e.length?kt(e,Va):0},kn.sumBy=function(e,t){return e&&e.length?kt(e,Yi(t,2)):0},kn.template=function(e,t,n){var r=kn.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===U?ne:ue).source+"|"+(t.evaluate||ue).source+"|$","g"),f="//# sourceURL="+(Ee.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Fe+"]")+"\n";e.replace(h,(function(t,n,r,s,a,c){return r||(r=s),d+=e.slice(l,c).replace(de,Lt),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,Fs(g))throw g;return g},kn.times=function(e,t){if((e=ra(e))<1||e>9007199254740991)return[];var n=4294967295,r=an(e,4294967295);e-=4294967295;for(var i=Ot(r,t=Yi(t));++n<e;)t(n);return i},kn.toFinite=na,kn.toInteger=ra,kn.toLength=ia,kn.toLower=function(e){return aa(e).toLowerCase()},kn.toNumber=oa,kn.toSafeInteger=function(e){return e?Qn(ra(e),-9007199254740991,9007199254740991):0===e?e:0},kn.toString=aa,kn.toUpper=function(e){return aa(e).toUpperCase()},kn.trim=function(e,t,n){if((e=aa(e))&&(n||void 0===t))return e.replace(J,"");if(!e||!(t=Kr(t)))return e;var r=Vt(e),i=Vt(t);return li(r,Mt(r,i),Rt(r,i)+1).join("")},kn.trimEnd=function(e,t,n){if((e=aa(e))&&(n||void 0===t))return e.replace(Y,"");if(!e||!(t=Kr(t)))return e;var r=Vt(e);return li(r,0,Rt(r,Vt(t))+1).join("")},kn.trimStart=function(e,t,n){if((e=aa(e))&&(n||void 0===t))return e.replace(Q,"");if(!e||!(t=Kr(t)))return e;var r=Vt(e);return li(r,Mt(r,Vt(t))).join("")},kn.truncate=function(e,t){var n=30,r="...";if(Hs(t)){var i="separator"in t?t.separator:i;n="length"in t?ra(t.length):n,r="omission"in t?Kr(t.omission):r}var o=(e=aa(e)).length;if(Ft(e)){var s=Vt(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(Kr(i),a)!=a){var h=c.lastIndexOf(i);h>-1&&(c=c.slice(0,h))}return c+r},kn.unescape=function(e){return(e=aa(e))&&L.test(e)?e.replace(P,Gt):e},kn.uniqueId=function(e){var t=++Ae;return aa(e)+t},kn.upperCase=La,kn.upperFirst=Fa,kn.each=as,kn.eachRight=cs,kn.first=Do,Ya(kn,(uc={},cr(kn,(function(e,t){Ee.call(kn.prototype,t)||(uc[t]=e)})),uc),{chain:!1}),kn.VERSION="4.17.20",at(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){kn[e].placeholder=kn})),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:Yi(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(Va)},In.prototype.find=function(e){return this.filter(e).head()},In.prototype.findLast=function(e){return this.reverse().find(e)},In.prototype.invokeMap=Lr((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(Yi(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=kn[r?"take"+("last"==t?"Right":""):t],o=r||/^find/.test(t);i&&(kn.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(kn,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);kn.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=kn[t];if(n){var r=n.name+"";Ee.call(bn,r)||(bn[r]=[]),bn[r].push({name:t,func:n})}})),bn[ki(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},kn.prototype.at=rs,kn.prototype.chain=function(){return ts(this)},kn.prototype.commit=function(){return new Nn(this.value(),this.__chain__)},kn.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__++]}},kn.prototype.plant=function(e){for(var t,n=this;n instanceof Tn;){var r=ko(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},kn.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:[Ho],thisArg:void 0}),new Nn(t,this.__chain__)}return this.thru(Ho)},kn.prototype.toJSON=kn.prototype.valueOf=kn.prototype.value=function(){return ni(this.__wrapped__,this.__actions__)},kn.prototype.first=kn.prototype.head,Xe&&(kn.prototype[Xe]=function(){return this}),kn}();Ge._=Jt,void 0===(i=function(){return Jt}.call(t,n,t,r))||(r.exports=i)}).call(this)}).call(this,n(16),n(43)(e))},function(e,t,n){e.exports=n(332)},function(e,t,n){e.exports=n(346)},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){var r=n(20),i=n(19);e.exports=function(e){return"symbol"==typeof e||i(e)&&"[object Symbol]"==r(e)}},function(e,t,n){var r=n(9).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(71),i=n(17);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(383),i=n(384),o=n(385),s=n(386),a=n(387);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(46);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(21)(Object,"create");e.exports=r},function(e,t,n){var r=n(401);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(12),i=n(78),o=n(424),s=n(135);e.exports=function(e,t){return r(e)?e:i(e,t)?[e]:o(s(e))}},function(e,t,n){var r=n(55);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(20),i=n(17);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(16))},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(16))},function(e,t,n){var r={escape:n(7)};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(7)};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(40)],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(8),i=n(0);i.f.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.f.NS.FRAMING,to:this._conn.domain,version:"1.0"})}_checkStreamError(e,t){let n;if(n=e.getElementsByTagNameNS?e.getElementsByTagNameNS(i.f.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.f.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.f.Status.CONNFAIL))return i.f.Status.CONNFAIL}_handleStreamStart(e){let t=!1;const n=e.getAttribute("xmlns");"string"!=typeof n?t="Missing xmlns in <open />":n!==i.f.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.f.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.f.Status.REDIRECT,"Received see-other-uri, resetting connection"),this._conn.reset(),this._conn.service=n,this._connect())}else this._conn._changeConnectStatus(i.f.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.f.NS.FRAMING});this._conn.xmlOutput(t.tree());const n=i.f.serialize(t);this._conn.rawOutput(n);try{this.socket.send(n)}catch(e){i.f.warn("Couldn't send <close /> tag.")}}setTimeout(()=>this._conn._doDisconnect,0)}_doDisconnect(){i.f.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.f.debug(e.message)}this.socket=null}_emptyQueue(){return!0}_onClose(e){this._conn.connected&&!this._conn.disconnecting?(i.f.error("Websocket closed unexpectedly"),this._conn._doDisconnect()):e&&1006===e.code&&!this._conn.connected&&this.socket?(i.f.error("Websocket closed unexcectedly"),this._conn._changeConnectStatus(i.f.Status.CONNFAIL,"The WebSocket connection could not be established or was disconnected."),this._conn._doDisconnect()):i.f.debug("Websocket closed")}_no_auth_received(e){i.f.error("Server did not offer a supported authentication mechanism"),this._conn._changeConnectStatus(i.f.Status.CONNFAIL,i.f.ErrorCondition.NO_AUTH_MECH),e&&e.call(this._conn),this._conn._doDisconnect()}_onDisconnectTimeout(){}_abortAllRequests(){}_onError(e){i.f.error("Websocket error "+e),this._conn._changeConnectStatus(i.f.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.f.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.f.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.f.serialize(t))):void this._conn._dataRecv(t,e.data)}_onOpen(){i.f.debug("Websocket open");const e=this._buildStream();this._conn.xmlOutput(e.tree());const t=i.f.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(328);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(17),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(71),i=n(73);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(21)(n(9),"Map");e.exports=r},function(e,t,n){var r=n(393),i=n(400),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(53),i=n(36);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(12),i=n(44),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(38),i=n(10).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(452),i=n(81);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(142)("keys"),i=n(143);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(460),__esModule:!0}},function(e,t,n){var r=n(37).f,i=n(56),o=n(13)("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(55);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(362),i=n(30);e.exports=function(e){return null==e?[]:r(e,i(e))}},function(e,t,n){var r=n(107),i=n(363),o=n(74),s=n(48),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,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(324).XMLReader,u=t.DOMImplementation=n(93).DOMImplementation;t.XMLSerializer=n(93).XMLSerializer,t.DOMParser=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 j(){}function C(e,t){for(var n=e.length;n--;)if(e[n]===t)return n}function k(e,t,n,r){if(r?t[C(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 O(e,t,n){var r=C(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 T(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 z(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 L(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 F(){this._nsMap={}}function B(){}function q(){}function U(){}function H(){}function $(){}function W(){}function V(){}function G(){}function J(){}function Q(){}function Y(){}function K(){}function X(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 j=e.internalSubset;j&&t.push(" [",j,"]"),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),j.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 k(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),k(this._ownerElement,this,e,t),t},removeNamedItem:function(e){var t=this.getNamedItem(e);return O(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var n=this.getNamedItemNS(e,t);return O(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}},T.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 L(this,e,t)},replaceChild:function(e,t){this.insertBefore(e,t),t&&this.removeChild(t)},removeChild:function(e){return z(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 j,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),L(this,e,t),e.ownerDocument=this,e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),z(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 F;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.childNodes=new x,(t.attributes=new j)._ownerElement=t,t},createDocumentFragment:function(){var e=new Q;return e.ownerDocument=this,e.childNodes=new x,e},createTextNode:function(e){var t=new U;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new H;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 Y;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 F,r=t.split(":"),i=n.attributes=new j;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),F.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=F.prototype.getElementsByTagName,R.prototype.getElementsByTagNameNS=F.prototype.getElementsByTagNameNS,r(F,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),U.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(U,q),H.prototype={nodeName:"#comment",nodeType:h},r(H,q),$.prototype={nodeName:"#cdata-section",nodeType:c},r($,q),W.prototype.nodeType=p,r(W,N),V.prototype.nodeType=m,r(V,N),G.prototype.nodeType=u,r(G,N),J.prototype.nodeType=l,r(J,N),Q.prototype.nodeName="#document-fragment",Q.prototype.nodeType=g,r(Q,N),Y.prototype.nodeType=d,r(Y,N),K.prototype.serializeToString=function(e,t,n){return X.call(e,t,n)},N.prototype.toString=X;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=T,t.XMLSerializer=K},function(e,t,n){(function(t){var n="object"==typeof t&&t&&t.Object===Object&&t;e.exports=n}).call(this,n(16))},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(337),i=n(97),o=n(12),s=n(98),a=n(34),c=n(99),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(338),i=n(19),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(9),i=n(339),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(43)(e))},function(e,t,n){var r=n(340),i=n(341),o=n(342),s=o&&o.isTypedArray,a=s?i(s):r;e.exports=a},function(e,t,n){var r=n(101),i=n(343),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(104),i=n(46),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(105);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(21),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(35),i=n(353),o=n(108);e.exports=function(e,t){return o(i(e,t,r),e+"")}},function(e,t,n){var r=n(354),i=n(109)(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(96),i=n(357),o=n(26);e.exports=function(e){return o(e)?r(e,!0):i(e)}},function(e,t,n){var r=n(359),i=n(360),o=n(361);e.exports=function(e,t,n){return t==t?o(e,t,n):r(e,i,n)}},function(e,t,n){var r=n(20),i=n(12),o=n(19);e.exports=function(e){return"string"==typeof e||!i(e)&&o(e)&&"[object String]"==r(e)}},function(e,t,n){var r=n(35),i=n(114),o=i?function(e,t){return i.set(e,t),e}:r;e.exports=o},function(e,t,n){var r=n(115),i=r&&new r;e.exports=i},function(e,t,n){var r=n(21)(n(9),"WeakMap");e.exports=r},function(e,t,n){var r=n(117),i=n(118),o=n(366),s=n(47),a=n(119),c=n(74),l=n(377),u=n(48),d=n(9);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 j(){for(var C=arguments.length,k=Array(C),O=C;O--;)k[O]=arguments[O];if(x)var T=c(j),N=o(k,T);if(f&&(k=r(k,f,p,x)),g&&(k=i(k,g,m,x)),C-=N,x&&C<b){var I=u(k,T);return a(t,n,e,j.placeholder,h,k,I,v,_,b-C)}var M=w?h:this,R=S?M[t]:t;return C=k.length,v?k=l(k,v):E&&C>1&&k.reverse(),y&&_<C&&(k.length=_),this&&this!==d&&this instanceof j&&(R=A||s(R)),R.apply(M,k)}}},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(367),i=n(123),o=n(124);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(114),i=n(368),o=r?function(e){return r.get(e)}:i;e.exports=o},function(e,t,n){var r=n(71),i=n(73);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(113),i=n(109)(r);e.exports=i},function(e,t,n){var r=n(373),i=n(374),o=n(108),s=n(375);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(49),i=n(388),o=n(389),s=n(390),a=n(391),c=n(392);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(405),i=n(19);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(406),i=n(409),o=n(410);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(129),i=n(12);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(417),i=n(131),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(418),i=n(75),o=n(419),s=n(420),a=n(115),c=n(20),l=n(106),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(17);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(427);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(442)),i=l(n(448)),o=l(n(456)),s=l(n(459)),a=l(n(86));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(487);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(81);e.exports=function(e){return Object(r(e))}},function(e,t,n){var r=n(451),i=n(144);e.exports=Object.keys||function(e){return r(e,i)}},function(e,t,n){var r=n(83),i=Math.min;e.exports=function(e){return e>0?i(r(e),9007199254740991):0}},function(e,t,n){var r=n(15),i=n(10),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(85)?"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(85),i=n(27),o=n(464),s=n(28),a=n(39),c=n(465),l=n(87),u=n(468),d=n(13)("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,j=A[d]||A["@@iterator"]||g&&A[g],C=j||w(g),k=g?x?w("entries"):C:void 0,O="Array"==t&&A.entries||j;if(O&&(y=u(O.call(new e)))!==Object.prototype&&y.next&&(l(y,S,!0),r||"function"==typeof y[d]||s(y,d,f)),x&&j&&"values"!==j.name&&(E=!0,C=function(){return j.call(this)}),r&&!v||!h&&!E&&A[d]||s(A,d,C),a[t]=C,a[S]=f,g)if(_={values:x?C:w("values"),keys:m?C:w("keys"),entries:k},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(10).document;e.exports=r&&r.documentElement},function(e,t,n){var r=n(57),i=n(13)("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(22),i=n(55),o=n(13)("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(54),a=n(479),c=n(146),l=n(80),u=n(10),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(57)(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(22),i=n(38),o=n(88);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(8),i=n(0);i.f.Request=class{constructor(e,t,n,r){this.id=++i.f._requestId,this.xmlData=e,this.data=i.f.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.f.error("invalid response received"),i.f.error("responseText: "+this.xhr.responseText),i.f.error("responseXML: "+i.f.serialize(this.xhr.responseXML)),new Error("parsererror")}else if(this.xhr.responseText){if(i.f.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.f.error("invalid response received: "+e.querySelector("parsererror").textContent),i.f.error("responseText: "+this.xhr.responseText);const t=new Error;throw t.name=i.f.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.f.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.f.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.f.NS.BOSH});n&&r.attrs({route:n});const o=this._conn._connect_cb;this._requests.push(new i.f.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.f.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.f.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.f.getBareJidFromJid(s.jid)===i.f.getBareJidFromJid(e)||null===i.f.getNodeFromJid(e)&&i.f.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.f.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.f.Status.CONNFAIL,t)):this._conn._changeConnectStatus(i.f.Status.CONNFAIL,"unknown"),this._conn._doDisconnect(t),i.f.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.f.warn("request errored, status: "+e+", number of errors: "+this.errors),this.errors>4&&this._conn._onDisconnectTimeout()}_no_auth_received(e){i.f.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.f.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.f.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.f.NS.BOSH}):t.cnode(e[n]).up());delete this._conn._data,this._conn._data=[],this._requests.push(new i.f.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.f.SECONDARY_TIMEOUT*this.wait)&&this._throttledRequestHandler(),e>Math.floor(i.f.TIMEOUT*this.wait)&&(i.f.warn("Request "+this._requests[0].id+" timed out, over "+Math.floor(i.f.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.f.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.f.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.f.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.f.SECONDARY_TIMEOUT*this.wait))&&this._restartRequest(0),this._conn.nextValidRid(Number(n.rid)+1),i.f.debug("request id "+n.id+"."+n.sends+" got 200"),t(n),this.errors=0}else 0===r||r>=400&&r<600||r>=12e3?(i.f.error("request id "+n.id+"."+n.sends+" error "+r+" happened"),this._hitError(r),this._callProtocolErrorHandlers(n),r>=400&&r<500&&(this._conn._changeConnectStatus(i.f.Status.DISCONNECTING,null),this._conn._doDisconnect())):i.f.error("request id "+n.id+"."+n.sends+" error "+r+" happened");o||s?s&&!this._conn.connected&&this._conn._changeConnectStatus(i.f.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.f.TIMEOUT*this.wait),a=null!==n.dead&&n.timeDead()>Math.floor(i.f.SECONDARY_TIMEOUT*this.wait),c=4===n.xhr.readyState&&(r<1||r>=500);if((s||a||c)&&(a&&i.f.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.f.Request(n.xmlData,n.origFunc,n.rid,n.sends),n=this._requests[t]),0===n.xhr.readyState){i.f.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.f.error("XHR open failed: "+e.toString()),this._conn.connected||this._conn._changeConnectStatus(i.f.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.f.TIMEOUT*this.wait),Math.pow(n.sends,3));setTimeout((function(){e()}),t)}else e();n.sends++,this._conn.xmlOutput!==i.f.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.f.Connection.prototype.rawOutput&&this._conn.rawOutput(n.data)}else i.f.debug("_processRequest: "+(0===t?"first":"second")+" request has readyState of "+n.xhr.readyState)}_removeRequest(e){i.f.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.f.debug("_sendTerminate was called");const t=this._buildBody().attrs({type:"terminate"});e&&t.cnode(e.tree());const n=new i.f.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.f.debug("_throttledRequestHandler called with "+this._requests.length+" requests"):i.f.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.f.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(43)(e),n(16))},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";t.a=function(){return!1}},function(e,t,n){"use strict";(function(e){var r=n(4),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(66)(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(327),i=n(67);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(20),i=n(19);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(70),i=n(380),o=n(433),s=n(435);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(100),i=n(132),o=n(26),s=n(112),a=n(438);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(137),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(137),o=(r=i)&&r.__esModule?r:{default:r};t.default=(0,o.default)("webExtensionLocalStorage","local")},function(e,t,n){var r={escape:n(7)};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(7)};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(7)};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(7)};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(7)};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(7)};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){var r={escape:n(7)};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(7);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(7)};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(7)};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(7)};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(7)};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(7)};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(7)};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(7)};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(7)};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(7)};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(498),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 j=e.indexOf(">",x+3),C=e.substring(x+2,j),k=y.pop();j<0?(C=e.substring(x+2).replace(/[\s<].*/,""),i.error("end tag name: "+C+" is not complete:"+k.tagName),j=x+1+C.length):C.match(/\s</)&&(C=C.replace(/[\s<].*/,""),i.error("end tag name: "+C+" maybe not complete"),j=x+1+C.length);var O=k.localNSMap,T=k.tagName==C;if(T||k.tagName&&k.tagName.toLowerCase()==C.toLowerCase()){if(r.endElement(k.uri,k.localName,C),O)for(var N in O)r.endPrefixMapping(N);T||i.fatalError("end tag name: "+C+" is not match the current start tagName:"+k.tagName)}else y.push(k);j++;break;case"?":b&&g(x),j=f(e,x,r);break;case"!":b&&g(x),j=h(e,x,r,i);break;default:b&&g(x);var I=new p,M=y[y.length-1].currentNSMap,R=(j=a(e,x,I,M,o,i),I.length);if(!I.closed&&u(e,j,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 z=I[P];g(z.offset),z.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?j++:j=l(e,j,I.tagName,o,r)}}catch(e){i.error("element parse error: "+e),j=-1}j>S?S=j: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(329);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(17),i=n(44),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(45),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(95),i=n(333),o=n(345),s=n(12);e.exports=function(e,t){return(s(e)?r:i)(e,o(t))}},function(e,t,n){var r=n(334),i=n(344)(r);e.exports=i},function(e,t,n){var r=n(335),i=n(30);e.exports=function(e,t){return e&&r(e,t,i)}},function(e,t,n){var r=n(336)();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(20),i=n(19);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(20),i=n(68),o=n(19),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(94),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(43)(e))},function(e,t,n){var r=n(102)(Object.keys,Object);e.exports=r},function(e,t,n){var r=n(26);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(35);e.exports=function(e){return"function"==typeof e?e:r}},function(e,t,n){var r=n(347),i=n(352),o=n(110),s=i((function(e,t){r(t,o(t),e)}));e.exports=s},function(e,t,n){var r=n(103),i=n(104);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(58),i=n(349),o=n(17),s=n(106),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(350),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(9)["__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(107),i=n(356);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(69),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(355),i=n(105),o=n(35),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(46),i=n(26),o=n(34),s=n(17);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(17),i=n(101),o=n(358),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(70);e.exports=function(e,t){return r(t,(function(t){return e[t]}))}},function(e,t,n){var r=n(113),i=n(364),o=n(365),s=n(116),a=n(378),c=n(120),l=n(379),u=n(123),d=n(124),h=n(67),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(47),i=n(9);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(69),i=n(47),o=n(116),s=n(119),a=n(74),c=n(48),l=n(9);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(72),i=n(120),o=n(369),s=n(371);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(370),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(72),i=n(121),o=n(73),s=n(12),a=n(19),c=n(372),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(72),i=n(121),o=n(122);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(95),i=n(376),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(111);e.exports=function(e,t){return!!(null==e?0:e.length)&&r(e,t,0)>-1}},function(e,t,n){var r=n(122),i=n(34),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(69),i=n(47),o=n(9);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(117),i=n(118),o=n(48),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(381),i=n(422),o=n(35),s=n(12),a=n(431);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(382),i=n(421),o=n(134);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(125),i=n(126);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(50),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(50);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(50);e.exports=function(e){return r(this.__data__,e)>-1}},function(e,t,n){var r=n(50);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(49);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(49),i=n(75),o=n(76);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(394),i=n(49),o=n(75);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(395),i=n(396),o=n(397),s=n(398),a=n(399);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(51);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(51),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(51),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(51);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(52);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(52);e.exports=function(e){return r(this,e).get(e)}},function(e,t,n){var r=n(52);e.exports=function(e){return r(this,e).has(e)}},function(e,t,n){var r=n(52);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(125),i=n(127),o=n(411),s=n(415),a=n(132),c=n(12),l=n(98),u=n(99),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,j=E?t.value():t;return g||(g=new r),p(A,j,n,f,g)}}return!!S&&(g||(g=new r),s(e,t,n,f,p,g))}},function(e,t,n){var r=n(76),i=n(407),o=n(408);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(45),i=n(412),o=n(46),s=n(127),a=n(413),c=n(414),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(9).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(416),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(128),i=n(130),o=n(30);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(21)(n(9),"DataView");e.exports=r},function(e,t,n){var r=n(21)(n(9),"Promise");e.exports=r},function(e,t,n){var r=n(21)(n(9),"Set");e.exports=r},function(e,t,n){var r=n(133),i=n(30);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(126),i=n(423),o=n(428),s=n(78),a=n(133),c=n(134),l=n(36);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(77);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(425),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(426);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(76);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(45),i=n(70),o=n(12),s=n(44),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(429),i=n(430);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(53),i=n(97),o=n(12),s=n(34),a=n(68),c=n(36);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(136),i=n(432),o=n(78),s=n(36);e.exports=function(e){return o(e)?r(s(e)):i(e)}},function(e,t,n){var r=n(77);e.exports=function(e){return function(t){return r(t,e)}}},function(e,t,n){var r=n(77),i=n(434),o=n(53);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(103),i=n(53),o=n(34),s=n(17),a=n(36);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(128),i=n(436),o=n(110);e.exports=function(e){return r(e,o,i)}},function(e,t,n){var r=n(129),i=n(437),o=n(130),s=n(131),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(102)(Object.getPrototypeOf,Object);e.exports=r},function(e,t,n){var r=n(439),i=n(440),o=n(441);e.exports=function(e){return i(e)?o(e):r(e)}},function(e,t,n){var r=n(136)("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(443),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(444),__esModule:!0}},function(e,t,n){n(445);var r=n(15).Object;e.exports=function(e,t,n){return r.defineProperty(e,t,n)}},function(e,t,n){var r=n(27);r(r.S+r.F*!n(29),"Object",{defineProperty:n(37).f})},function(e,t,n){e.exports=!n(29)&&!n(79)((function(){return 7!=Object.defineProperty(n(80)("div"),"a",{get:function(){return 7}}).a}))},function(e,t,n){var r=n(38);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(449),__esModule:!0}},function(e,t,n){n(450),e.exports=n(15).Object.keys},function(e,t,n){var r=n(139),i=n(140);n(455)("keys",(function(){return function(e){return i(r(e))}}))},function(e,t,n){var r=n(56),i=n(82),o=n(453)(!1),s=n(84)("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(57);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t,n){var r=n(82),i=n(141),o=n(454);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(83),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(27),i=n(15),o=n(79);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(457)},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(458),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(j([])));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=j,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:j(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 C()}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 j(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:C}}function C(){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(86),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(461),n(462),n(469),n(473),n(485),n(486),e.exports=n(15).Promise},function(e,t){},function(e,t,n){"use strict";var r=n(463)(!0);n(145)(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(83),i=n(81);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(28)},function(e,t,n){"use strict";var r=n(466),i=n(138),o=n(87),s={};n(28)(s,n(13)("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(22),i=n(467),o=n(144),s=n(84)("IE_PROTO"),a=function(){},c=function(){var e,t=n(80)("iframe"),r=o.length;for(t.style.display="none",n(146).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(37),i=n(22),o=n(140);e.exports=n(29)?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(56),i=n(139),o=n(84)("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(470);for(var r=n(10),i=n(28),o=n(39),s=n(13)("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(471),i=n(472),o=n(39),s=n(82);e.exports=n(145)(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(85),c=n(10),l=n(54),u=n(147),d=n(27),h=n(38),f=n(55),p=n(474),g=n(475),m=n(148),v=n(149).set,_=n(480)(),b=n(88),y=n(150),w=n(481),S=n(151),x=c.TypeError,E=c.process,A=E&&E.versions,j=A&&A.v8||"",C=c.Promise,k="process"==u(E),O=function(){},T=i=b.f,N=!!function(){try{var e=C.resolve(1),t=(e.constructor={})[n(13)("species")]=function(e){e(O,O)};return(k||"function"==typeof PromiseRejectionEvent)&&e.then(O)instanceof t&&0!==j.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(){k?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=k||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;k?E.emit("rejectionHandled",e):(t=c.onrejectionhandled)&&t({promise:e,reason:e._v})}))},z=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))},L=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(L,r,1),l(z,r,1))}catch(e){z.call(r,e)}})):(n._v=e,n._s=1,M(n,!1))}catch(e){z.call({_w:n,_d:!1},e)}}};N||(C=function(e){p(this,C,"Promise","_h"),f(e),r.call(this);try{e(l(L,this,1),l(z,this,1))}catch(e){z.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(482)(C.prototype,{then:function(e,t){var n=T(m(this,C));return n.ok="function"!=typeof e||e,n.fail="function"==typeof t&&t,n.domain=k?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(L,e,1),this.reject=l(z,e,1)},b.f=T=function(e){return e===C||e===s?new o(e):i(e)}),d(d.G+d.W+d.F*!N,{Promise:C}),n(87)(C,"Promise"),n(483)("Promise"),s=n(15).Promise,d(d.S+d.F*!N,"Promise",{reject:function(e){var t=T(this);return(0,t.reject)(e),t.promise}}),d(d.S+d.F*(a||!N),"Promise",{resolve:function(e){return S(a&&this===s?C:this,e)}}),d(d.S+d.F*!(N&&n(484)((function(e){C.all(e).catch(O)}))),"Promise",{all:function(e){var t=this,n=T(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=T(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(54),i=n(476),o=n(477),s=n(22),a=n(141),c=n(478),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(22);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(39),i=n(13)("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(147),i=n(13)("iterator"),o=n(39);e.exports=n(15).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(10),i=n(149).set,o=r.MutationObserver||r.WebKitMutationObserver,s=r.process,a=r.Promise,c="process"==n(57)(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(10).navigator;e.exports=r&&r.userAgent||""},function(e,t,n){var r=n(28);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(10),i=n(15),o=n(37),s=n(29),a=n(13)("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(13)("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(27),i=n(15),o=n(10),s=n(148),a=n(151);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(27),i=n(88),o=n(150);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(86),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(65);var r=n(0);const i={};i.debug=r.f.LogLevel.DEBUG,i.info=r.f.LogLevel.INFO,i.warn=r.f.LogLevel.WARN,i.error=r.f.LogLevel.ERROR,i.fatal=r.f.LogLevel.FATAL,r.f.WorkerWebsocket=class extends r.f.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.f.log(r.f.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.f.Status.ATTACHED?(this._conn.jid=t,this._conn.authenticated=!0,this._conn.connected=!0,this._conn.restored=!0,this._conn._changeConnectStatus(r.f.Status.ATTACHED)):e===r.f.Status.ATTACHFAIL&&(this._conn.authenticated=!1,this._conn.connected=!1,this._conn.restored=!1,this._conn._changeConnectStatus(r.f.Status.ATTACHFAIL))}_disconnect(e,t){t&&this._conn.send(t);const n=Object(r.a)("close",{xmlns:r.f.NS.FRAMING});this._conn.xmlOutput(n.tree());const i=r.f.serialize(n);this._conn.rawOutput(i),this.worker.port.postMessage(["send",i]),this._conn._doDisconnect()}_onClose(e){this._conn.connected&&!this._conn.disconnecting?(r.f.error("Websocket closed unexpectedly"),this._conn._doDisconnect()):e&&1006===e.code&&!this._conn.connected?(r.f.error("Websocket closed unexcectedly"),this._conn._changeConnectStatus(r.f.Status.CONNFAIL,"The WebSocket connection could not be established or was disconnected."),this._conn._doDisconnect()):r.f.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.f.log(r.f.LogLevel.ERROR,e)}else if("log"===n){const e=t[1],n=t[2];r.f.log(i[e],n)}else r.f.log(r.f.LogLevel.ERROR,"Found unhandled service worker message: ".concat(t))}}},function(e,t,n){var r={"./af/LC_MESSAGES/converse.po":[499,139],"./ar/LC_MESSAGES/converse.po":[500,140],"./bg/LC_MESSAGES/converse.po":[501,141],"./ca/LC_MESSAGES/converse.po":[502,142],"./cs/LC_MESSAGES/converse.po":[503,143],"./da/LC_MESSAGES/converse.po":[504,144],"./de/LC_MESSAGES/converse.po":[505,147],"./eo/LC_MESSAGES/converse.po":[506,148],"./es/LC_MESSAGES/converse.po":[507,149],"./eu/LC_MESSAGES/converse.po":[508,150],"./fi/LC_MESSAGES/converse.po":[509,151],"./fr/LC_MESSAGES/converse.po":[510,152],"./gl/LC_MESSAGES/converse.po":[511,153],"./he/LC_MESSAGES/converse.po":[512,154],"./hi/LC_MESSAGES/converse.po":[513,155],"./hu/LC_MESSAGES/converse.po":[514,156],"./id/LC_MESSAGES/converse.po":[515,157],"./it/LC_MESSAGES/converse.po":[516,158],"./ja/LC_MESSAGES/converse.po":[517,159],"./lt/LC_MESSAGES/converse.po":[518,160],"./mr/LC_MESSAGES/converse.po":[519,161],"./nb/LC_MESSAGES/converse.po":[520,162],"./nl/LC_MESSAGES/converse.po":[521,163],"./nl_BE/LC_MESSAGES/converse.po":[522,164],"./oc/LC_MESSAGES/converse.po":[523,165],"./pl/LC_MESSAGES/converse.po":[524,166],"./pt/LC_MESSAGES/converse.po":[525,167],"./pt_BR/LC_MESSAGES/converse.po":[526,168],"./ro/LC_MESSAGES/converse.po":[527,169],"./ru/LC_MESSAGES/converse.po":[528,170],"./sv/LC_MESSAGES/converse.po":[529,171],"./th/LC_MESSAGES/converse.po":[530,172],"./tr/LC_MESSAGES/converse.po":[531,173],"./uk/LC_MESSAGES/converse.po":[532,174],"./vi/LC_MESSAGES/converse.po":[533,175],"./zh_CN/LC_MESSAGES/converse.po":[534,176],"./zh_TW/LC_MESSAGES/converse.po":[535,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=489,e.exports=i},function(e,t,n){var r={"./af":[184,0],"./af.js":[184,0],"./ar":[191,1],"./ar-dz":[185,2],"./ar-dz.js":[185,2],"./ar-kw":[186,3],"./ar-kw.js":[186,3],"./ar-ly":[187,4],"./ar-ly.js":[187,4],"./ar-ma":[188,5],"./ar-ma.js":[188,5],"./ar-sa":[189,6],"./ar-sa.js":[189,6],"./ar-tn":[190,7],"./ar-tn.js":[190,7],"./ar.js":[191,1],"./az":[192,8],"./az.js":[192,8],"./be":[193,9],"./be.js":[193,9],"./bg":[194,10],"./bg.js":[194,10],"./bi":[195,11],"./bi.js":[195,11],"./bm":[196,12],"./bm.js":[196,12],"./bn":[197,13],"./bn.js":[197,13],"./bo":[198,14],"./bo.js":[198,14],"./br":[199,15],"./br.js":[199,15],"./bs":[200,16],"./bs.js":[200,16],"./ca":[201,17],"./ca.js":[201,17],"./cs":[202,18],"./cs.js":[202,18],"./cv":[203,19],"./cv.js":[203,19],"./cy":[204,20],"./cy.js":[204,20],"./da":[205,21],"./da.js":[205,21],"./de":[208,22],"./de-at":[206,23],"./de-at.js":[206,23],"./de-ch":[207,24],"./de-ch.js":[207,24],"./de.js":[208,22],"./dv":[209,25],"./dv.js":[209,25],"./el":[210,26],"./el.js":[210,26],"./en":[220,27],"./en-SG":[211,28],"./en-SG.js":[211,28],"./en-au":[212,29],"./en-au.js":[212,29],"./en-ca":[213,30],"./en-ca.js":[213,30],"./en-gb":[214,31],"./en-gb.js":[214,31],"./en-ie":[215,32],"./en-ie.js":[215,32],"./en-il":[216,33],"./en-il.js":[216,33],"./en-in":[217,34],"./en-in.js":[217,34],"./en-nz":[218,35],"./en-nz.js":[218,35],"./en-tt":[219,36],"./en-tt.js":[219,36],"./en.js":[220,27],"./eo":[221,37],"./eo.js":[221,37],"./es":[225,38],"./es-do":[222,39],"./es-do.js":[222,39],"./es-pr":[223,40],"./es-pr.js":[223,40],"./es-us":[224,41],"./es-us.js":[224,41],"./es.js":[225,38],"./et":[226,42],"./et.js":[226,42],"./eu":[227,43],"./eu.js":[227,43],"./fa":[228,44],"./fa.js":[228,44],"./fi":[229,45],"./fi.js":[229,45],"./fo":[230,46],"./fo.js":[230,46],"./fr":[233,47],"./fr-ca":[231,48],"./fr-ca.js":[231,48],"./fr-ch":[232,49],"./fr-ch.js":[232,49],"./fr.js":[233,47],"./fy":[234,50],"./fy.js":[234,50],"./ga":[235,51],"./ga.js":[235,51],"./gd":[236,52],"./gd.js":[236,52],"./gl":[237,53],"./gl.js":[237,53],"./gom-latn":[238,54],"./gom-latn.js":[238,54],"./gu":[239,55],"./gu.js":[239,55],"./he":[240,56],"./he.js":[240,56],"./hi":[241,57],"./hi.js":[241,57],"./hr":[242,58],"./hr.js":[242,58],"./ht":[243,59],"./ht.js":[243,59],"./hu":[244,60],"./hu.js":[244,60],"./hy-am":[245,61],"./hy-am.js":[245,61],"./id":[246,62],"./id.js":[246,62],"./index.d.ts":[536,145],"./is":[247,63],"./is.js":[247,63],"./it":[249,64],"./it-ch":[248,65],"./it-ch.js":[248,65],"./it.js":[249,64],"./ja":[250,66],"./ja.js":[250,66],"./jv":[251,67],"./jv.js":[251,67],"./ka":[252,68],"./ka.js":[252,68],"./kk":[253,69],"./kk.js":[253,69],"./km":[254,70],"./km.js":[254,70],"./kn":[255,71],"./kn.js":[255,71],"./ko":[256,72],"./ko.js":[256,72],"./ku":[257,73],"./ku.js":[257,73],"./ky":[258,74],"./ky.js":[258,74],"./lb":[259,75],"./lb.js":[259,75],"./lo":[260,76],"./lo.js":[260,76],"./lt":[261,77],"./lt.js":[261,77],"./lv":[262,78],"./lv.js":[262,78],"./me":[263,79],"./me.js":[263,79],"./mi":[264,80],"./mi.js":[264,80],"./mk":[265,81],"./mk.js":[265,81],"./ml":[266,82],"./ml.js":[266,82],"./mn":[267,83],"./mn.js":[267,83],"./mr":[268,84],"./mr.js":[268,84],"./ms":[270,85],"./ms-my":[269,86],"./ms-my.js":[269,86],"./ms.js":[270,85],"./mt":[271,87],"./mt.js":[271,87],"./my":[272,88],"./my.js":[272,88],"./nb":[273,89],"./nb.js":[273,89],"./ne":[274,90],"./ne.js":[274,90],"./nl":[276,91],"./nl-be":[275,92],"./nl-be.js":[275,92],"./nl.js":[276,91],"./nn":[277,93],"./nn.js":[277,93],"./oc-lnc":[278,94],"./oc-lnc.js":[278,94],"./pa-in":[279,95],"./pa-in.js":[279,95],"./pl":[280,96],"./pl.js":[280,96],"./pt":[282,97],"./pt-br":[281,98],"./pt-br.js":[281,98],"./pt.js":[282,97],"./ro":[283,99],"./ro.js":[283,99],"./ru":[284,100],"./ru.js":[284,100],"./rw":[285,101],"./rw.js":[285,101],"./sd":[286,102],"./sd.js":[286,102],"./se":[287,103],"./se.js":[287,103],"./si":[288,104],"./si.js":[288,104],"./sk":[289,105],"./sk.js":[289,105],"./sl":[290,106],"./sl.js":[290,106],"./sq":[291,107],"./sq.js":[291,107],"./sr":[293,108],"./sr-cyrl":[292,109],"./sr-cyrl.js":[292,109],"./sr.js":[293,108],"./ss":[294,110],"./ss.js":[294,110],"./sv":[295,111],"./sv.js":[295,111],"./sw":[296,112],"./sw.js":[296,112],"./ta":[297,113],"./ta.js":[297,113],"./te":[298,114],"./te.js":[298,114],"./tet":[299,115],"./tet.js":[299,115],"./tg":[300,116],"./tg.js":[300,116],"./th":[301,117],"./th.js":[301,117],"./tk":[302,118],"./tk.js":[302,118],"./tl-ph":[303,119],"./tl-ph.js":[303,119],"./tlh":[304,120],"./tlh.js":[304,120],"./tr":[305,121],"./tr.js":[305,121],"./types.d.ts":[537,146],"./tzl":[306,122],"./tzl.js":[306,122],"./tzm":[308,123],"./tzm-latn":[307,124],"./tzm-latn.js":[307,124],"./tzm.js":[308,123],"./ug-cn":[309,125],"./ug-cn.js":[309,125],"./uk":[310,126],"./uk.js":[310,126],"./ur":[311,127],"./ur.js":[311,127],"./uz":[313,128],"./uz-latn":[312,129],"./uz-latn.js":[312,129],"./uz.js":[313,128],"./vi":[314,130],"./vi.js":[314,130],"./x-pseudo":[315,131],"./x-pseudo.js":[315,131],"./yo":[316,132],"./yo.js":[316,132],"./zh":[320,133],"./zh-cn":[317,134],"./zh-cn.js":[317,134],"./zh-hk":[318,135],"./zh-hk.js":[318,135],"./zh-tw":[319,136],"./zh-tw.js":[319,136],"./zh.js":[320,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=490,e.exports=i},function(e,t,n){var r=n(492)({"&":"&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){var r=n(494);"string"==typeof r&&(r=[[e.i,r,""]]);var i={hmr:!0,transform:void 0,insertInto:void 0};n(496)(r,i);r.locals&&(e.exports=r.locals)},function(e,t,n){(t=n(495)(!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(497);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(63),i=n.n(r),o=(n(322),n(65),n(24));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(4),w=y.a.Symbol,S=Object.prototype,x=S.hasOwnProperty,E=S.toString,A=w?w.toStringTag:void 0;var j=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},C=Object.prototype.toString;var k=function(e){return C.call(e)},O=w?w.toStringTag:void 0;var T=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":O&&O in Object(e)?j(e):k(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=T(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},z=Function.prototype.toString;var L=function(e){if(null!=e){try{return z.call(e)}catch(e){}try{return e+""}catch(e){}}return""},F=/^\[object .+?Constructor\]$/,B=Function.prototype,q=Object.prototype,U=B.toString,H=q.hasOwnProperty,$=RegExp("^"+U.call(H).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var W=function(e){return!(!N(e)||P(e))&&(M(e)?$:F).test(L(e))};var V=function(e,t){return null==e?void 0:e[t]};var G=function(e,t){var n=V(e,t);return W(n)?n:void 0},J=G(y.a,"Map"),Q=G(Object,"create");var Y=function(){this.__data__=Q?Q(null):{},this.size=0};var K=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},X=Object.prototype.hasOwnProperty;var Z=function(e){var t=this.__data__;if(Q){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return X.call(t,e)?t[e]:void 0},ee=Object.prototype.hasOwnProperty;var te=function(e){var t=this.__data__;return Q?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]=Q&&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=Y,re.prototype.delete=K,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=G(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]"==T(e)},je=Object.prototype,Ce=je.hasOwnProperty,ke=je.propertyIsEnumerable,Oe=Ae(function(){return arguments}())?Ae:function(e){return Ee(e)&&Ce.call(e,"callee")&&!ke.call(e,"callee")},Te=Array.isArray,Ne=n(18),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[T(e)]};var ze=function(e){return function(t){return e(t)}},Le=n(11),Fe=Le.a&&Le.a.isTypedArray,Be=Fe?ze(Fe):Pe,qe=Object.prototype.hasOwnProperty;var Ue=function(e,t){var n=Te(e),r=!n&&Oe(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},He=Object.prototype;var $e=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||He)};var We=function(e,t){return function(n){return e(t(n))}},Ve=We(Object.keys,Object),Ge=Object.prototype.hasOwnProperty;var Je=function(e){if(!$e(e))return Ve(e);var t=[];for(var n in Object(e))Ge.call(e,n)&&"constructor"!=n&&t.push(n);return t};var Qe=function(e){return null!=e&&Re(e.length)&&!M(e)};var Ye=function(e){return Qe(e)?Ue(e):Je(e)};var Ke=function(e,t){return e&&Se(t,Ye(t),e)};var Xe=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 Xe(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 Qe(e)?Ue(e,!0):et(e)};var nt=function(e,t){return e&&Se(t,tt(t),e)},rt=n(157);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 Te(e)?r:dt(r,n(e))};var mt=function(e){return gt(e,Ye,lt)};var vt=function(e){return gt(e,tt,ft)},_t=G(y.a,"DataView"),bt=G(y.a,"Promise"),yt=G(y.a,"Set"),wt=G(y.a,"WeakMap"),St=L(_t),xt=L(J),Et=L(bt),At=L(yt),jt=L(wt),Ct=T;(_t&&"[object DataView]"!=Ct(new _t(new ArrayBuffer(1)))||J&&"[object Map]"!=Ct(new J)||bt&&"[object Promise]"!=Ct(bt.resolve())||yt&&"[object Set]"!=Ct(new yt)||wt&&"[object WeakMap]"!=Ct(new wt))&&(Ct=function(e){var t=T(e),n="[object Object]"==t?e.constructor:void 0,r=n?L(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 jt:return"[object WeakMap]"}return t});var kt=Ct,Ot=Object.prototype.hasOwnProperty;var Tt=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ot.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,zt=Pt?Pt.valueOf:void 0;var Lt=function(e){return zt?Object(zt.call(e)):{}};var Ft=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 Ft(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 Lt(e)}},qt=Object.create,Ut=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 Ht=function(e){return"function"!=typeof e.constructor||$e(e)?{}:Ut(ht(e))};var $t=function(e){return Ee(e)&&"[object Map]"==kt(e)},Wt=Le.a&&Le.a.isMap,Vt=Wt?ze(Wt):$t;var Gt=function(e){return Ee(e)&&"[object Set]"==kt(e)},Jt=Le.a&&Le.a.isSet,Qt=Jt?ze(Jt):Gt,Yt={};Yt["[object Arguments]"]=Yt["[object Array]"]=Yt["[object ArrayBuffer]"]=Yt["[object DataView]"]=Yt["[object Boolean]"]=Yt["[object Date]"]=Yt["[object Float32Array]"]=Yt["[object Float64Array]"]=Yt["[object Int8Array]"]=Yt["[object Int16Array]"]=Yt["[object Int32Array]"]=Yt["[object Map]"]=Yt["[object Number]"]=Yt["[object Object]"]=Yt["[object RegExp]"]=Yt["[object Set]"]=Yt["[object String]"]=Yt["[object Symbol]"]=Yt["[object Uint8Array]"]=Yt["[object Uint8ClampedArray]"]=Yt["[object Uint16Array]"]=Yt["[object Uint32Array]"]=!0,Yt["[object Error]"]=Yt["[object Function]"]=Yt["[object WeakMap]"]=!1;var Kt=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=Te(t);if(d){if(a=Tt(t),!c)return it(t,a)}else{var h=kt(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?{}:Ht(t),!c)return l?pt(t,nt(a,t)):ut(t,Ke(a,t))}else{if(!Yt[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),Qt(t)?t.forEach((function(i){a.add(e(i,n,r,i,t,s))})):Vt(t)&&t.forEach((function(i,o){a.set(o,e(i,n,r,o,t,s))}));var g=u?l?vt:mt:l?keysIn:Ye,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 Xt=function(e){return Kt(e,5)};var Zt=function(e){return"string"==typeof e||!Te(e)&&Ee(e)&&"[object String]"==T(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=Xt(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(158),yn=n.n(bn),wn=n(3),Sn=n.n(wn),xn=Function.prototype,En=Object.prototype,An=xn.toString,jn=En.hasOwnProperty,Cn=An.call(Object);var kn=function(e){if(!Ee(e)||"[object Object]"!=T(e))return!1;var t=ht(e);if(null===t)return!0;var n=jn.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&An.call(n)==Cn};var On,Tn,Nn,In,Mn=function(e){return Ee(e)&&1===e.nodeType&&!kn(e)};const Rn={debug:0,info:1,warn:2,error:3,fatal:4},Dn=Object.assign({debug:null!==(On=console)&&void 0!==On&&On.log?console.log.bind(console):function(){},error:null!==(Tn=console)&&void 0!==Tn&&Tn.log?console.log.bind(console):function(){},info:null!==(Nn=console)&&void 0!==Nn&&Nn.log?console.log.bind(console):function(){},warn:null!==(In=console)&&void 0!==In&&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)}},zn=n(159),Ln=n.n(zn),Fn=n(41),Bn=n.n(Fn),qn=n(42),Un=n.n(qn),Hn=n(33),$n=n.n(Hn),Wn=n(160),Vn=n.n(Wn),Gn=n(58),Jn=n.n(Gn),Qn=n(161),Yn=n.n(Qn),Kn=n(30),Xn=n.n(Kn),Zn=n(90),er=n.n(Zn),tr=n(162),nr=n.n(tr),rr=n(163),ir=n.n(rr),or=n(89),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=[]}Un()(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,Ln()(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]=Un()(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()(Xn()(this.allowed_plugins),e.__name__)&&($n()(this.initialized_plugins,e.__name__)||(Vn()(e.enabled)&&e.enabled||Jn()(e.enabled)&&e.enabled(this.plugged)||Yn()(e.enabled))&&(Un()(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),Un()(e,r)}},lr=n(164),ur=n.n(lr),dr=n(165),hr=n.n(dr),fr=n(1),pr=n.n(fr),gr=n(0);var mr=function(e,t){var n=Ut(e);return null==t?n:Ke(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 jr=function(e,t,n){if(!N(n))return!1;var r=typeof t;return!!("number"==r?Qe(n)&&Me(t,n.length):"string"==r&&t in n)&&a(n[t],e)};var Cr=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&&jr(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)})),kr=Object.prototype.hasOwnProperty;var Or=function(e,t){return null!=e&&kr.call(e,t)};var Tr=function(e){return"symbol"==typeof e||Ee(e)&&"[object Symbol]"==T(e)},Nr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ir=/^\w*$/;var Mr=function(e,t){if(Te(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Tr(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,zr=/\\(\\)?/g,Lr=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(zr,"$1"):n||e)})),t}));var Fr=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 Ur=function e(t){if("string"==typeof t)return t;if(Te(t))return Fr(t,e)+"";if(Tr(t))return qr?qr.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n};var Hr=function(e){return null==e?"":Ur(e)};var $r=function(e,t){return Te(e)?e:Mr(e,t)?[e]:Lr(Hr(e))};var Wr=function(e){if("string"==typeof e||Tr(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t};var Vr=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)&&(Te(e)||Oe(e))};var Gr=function(e,t){return null!=e&&Vr(e,t,Or)};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 Qr(e,t){const n=this;let r;return r=e&&Gr(e,"constructor")?e.constructor:function(){return n.apply(this,arguments)},Cr(r,n,t),r.prototype=mr(n.prototype,e),r.prototype.constructor=r,r.__super__=n.prototype,r}function Yr(){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 Kr(){throw new Error('A "url" property or function must be specified')}function Xr(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")||Kr()),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)}(Cr(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(Qe(e)&&(Te(e)||"string"==typeof e||"function"==typeof e.splice||Object(Ne.a)(e)||Be(e)||Oe(e)))return!e.length;var t=kt(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(Tr(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 Hr(e)+t};const mi={},vi=/\s+/;let _i;const bi=function(e,t,n,r,i){let o,s=0;if(n&&"object"==typeof n){void 0!==r&&"context"in i&&void 0===i.context&&(i.context=r);for(o=Ye(n);s<o.length;s++)t=bi(e,t,o[s],n[o[s]],i)}else if(n&&vi.test(n))for(o=n.split(vi);s<o.length;s++)t=e(t,o[s],r,i);else t=e(t,n,r,i);return t};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 ji(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]:Ye(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]:Ye(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=Ye(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}},ji=function(e,t){this.id=e._listenId,this.listener=e,this.obj=t,this.interop=!0,this.count=0,this._events=void 0};ji.prototype.on=mi.on,ji.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()},ji.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 Ci=function(e){return Kt(e,4)},ki=Object.prototype,Oi=ki.hasOwnProperty,Ti=Ar((function(e,t){e=Object(e);var n=-1,r=t.length,i=r>2?t[2]:void 0;for(i&&jr(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,ki[u])&&!Oi.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=Hr(e))&&Di.test(e)?e.replace(Ri,Mi):e};var zi=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}},Li=zi();var Fi=function(e,t){return e&&Li(e,t,Ye)};var Bi=function(e,t,n,r){return Fi(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),{})}},Ui=Object.prototype.toString,Hi=qi((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Ui.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 Vi(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new fe;++t<n;)this.add(e[t])}Vi.prototype.add=Vi.prototype.push=$i,Vi.prototype.has=Wi;var Gi=Vi;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 Qi=function(e,t){return e.has(t)};var Yi=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 Gi: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(!Qi(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 Ki=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n};var Xi=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=Ki;case"[object Set]":var l=1&r;if(c||(c=Xi),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=Yi(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=Te(e),a=Te(t),c=s?"[object Array]":kt(e),l=a?"[object Array]":kt(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)?Yi(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=Ye(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&&Vr(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?Te(e)?_o(e[0],e[1]):fo(e):wo(e)};var xo=function(e){return So("function"==typeof e?e:Kt(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 jo=function(e,t){return t.length<2?e:po(e,Ao(t,0,-1))};var Co=function(e,t){return t=$r(t,e),null==(e=jo(e,t))||delete e[Wr(Eo(t))]};var ko=function(e){return kn(e)?void 0:e},Oo=w?w.isConcatSpreadable:void 0;var To=function(e){return Te(e)||Oe(e)||!!(Oo&&e&&e[Oo])};var No=function e(t,n,r,i,o){var s=-1,a=t.length;for(r||(r=To),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=Fr(t,(function(t){return t=$r(t,e),r||(r=t.length>1),t})),Se(e,vt(e),n),r&&(n=Kt(n,7,ko));for(var i=t.length;i--;)Co(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 zo=function(e,t){return Po(e,t,(function(t,n){return vo(e,n)}))},Lo=Mo((function(e,t){return null==e?{}:zo(e,t)}));const Fo=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=Ti(Cr({},r,n),r),this.set(n,t),this.changed={},this.initialize.apply(this,arguments)};Fo.extend=Qr,Object.assign(Fo.prototype,mi,{changed:null,validationError:null,idAttribute:"id",cidPrefix:"c",preinitialize:function(){},initialize:function(){},toJSON:function(e){return Ci(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 Hi(this.attributes)},pick:function(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),Lo(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=Ci(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,Cr({},t,{unset:!0}))},clear:function(e){const t={};for(const e in this.attributes)t[e]=void 0;return this.set(t,Cr({},e,{unset:!0}))},hasChanged:function(e){return null==e?!ri(this.changed):Gr(this.changed,e)},changedAttributes:function(e){if(!e)return!!this.hasChanged()&&Ci(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 Ci(this._previousAttributes)},fetch:function(e){e=Cr({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)},Xr(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=Cr({validate:!0,parse:!0},n)).wait,o=n.promise,s=o&&Yr();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=Cr({},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)},Xr(this,n),r&&i&&(this.attributes=Cr({},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?Ci(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):(Xr(this,e),o=this.sync("delete",this,e)),r||i(),o},url:function(){const e=Jr(this,"urlRoot")||Jr(this.collection,"url")||Kr();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({},Cr({},e,{validate:!0}))},_validate:function(e,t){if(!t.validate||!this.validate)return!0;e=Cr({},this.attributes,e);const n=this.validationError=this.validate(e,t)||null;return!n||(this.trigger("invalid",this,n,Cr(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.g.Strophe,Uo={isTagEqual:function(e,t){if(e.nodeTree)return Uo.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")}},Ho=new DOMParser,$o=Ho.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
*/Uo.getJIDFromURI=function(e){return e.startsWith("xmpp:")&&e.endsWith("?join")?e.replace(/^xmpp:/,"").replace(/\?join$/,""):e},Uo.toStanza=function(e){const t=Ho.parseFromString(e,"text/xml");if(t.getElementsByTagNameNS($o,"parsererror").length)throw new Error("Parser Error: ".concat(e));return t.firstElementChild},Uo.getLongestSubstring=function(e,t){return t.reduce((function(t,n){return e.startsWith(n)&&n.length>t.length?n:t}),"")},Uo.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},Uo.isValidJID=function(e){return"string"==typeof e&&(2===Bo(e.split("@")).length&&!e.startsWith("@")&&!e.endsWith("@"))},Uo.isValidMUCJID=function(e){return!e.startsWith("@")&&!e.endsWith("@")},Uo.isSameBareJID=function(e,t){return"string"==typeof e&&"string"==typeof t&&qo.getBareJidFromJid(e).toLowerCase()===qo.getBareJidFromJid(t).toLowerCase()},Uo.isSameDomain=function(e,t){return"string"==typeof e&&"string"==typeof t&&qo.getDomainFromJid(e).toLowerCase()===qo.getDomainFromJid(t).toLowerCase()},Uo.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 Fo&&(e=e.attributes),!(e.is_delayed&&e.is_archived))},Uo.shouldCreateMessage=function(e){return e.retracted||!Uo.isEmptyMessage(e)},Uo.shouldCreateGroupchatMessage=function(e){return e.nick&&(Uo.shouldCreateMessage(e)||e.is_tombstone)},Uo.isEmptyMessage=function(e){return e instanceof Fo&&(e=e.attributes),!(e.oob_url||e.file||e.is_encrypted&&e.plaintext||e.message)},Uo.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 Fo&&(e=e.attributes),e.chat_state&&Uo.isEmptyMessage(e))},Uo.isOnlyMessageDeliveryReceipt=function(e){return e instanceof Element?null===e.querySelector("body")&&null!==e.querySelector("received"):(e instanceof Fo&&(e=e.attributes),e.received&&Uo.isEmptyMessage(e))},Uo.isChatRoom=function(e){return e&&"chatroom"===e.get("type")},Uo.isErrorObject=function(e){return e instanceof Error},Uo.isErrorStanza=function(e){return!!Mn(e)&&"error"===e.getAttribute("type")},Uo.isForbiddenError=function(e){return!!Mn(e)&&pr()('error[type="auth"] forbidden[xmlns="'.concat(qo.NS.STANZAS,'"]'),e).length>0},Uo.isServiceUnavailableError=function(e){return!!Mn(e)&&pr()('error[type="cancel"] service-unavailable[xmlns="'.concat(qo.NS.STANZAS,'"]'),e).length>0},Uo.merge=function e(t,n){for(const r in n)N(t[r])?e(t[r],n[r]):t[r]=n[r]},Uo.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},Uo.stringToElement=function(e){var t=document.createElement("div");return t.innerHTML=e,t.firstElementChild},Uo.matchesSelector=function(e,t){const n=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;return!!n&&n.call(e,t)},Uo.queryChildren=function(e,t){return Array.from(e.childNodes).filter(e=>Uo.matchesSelector(e,t))},Uo.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.")}},Uo.isOfType=function(e,t){return t.get("type")==e},Uo.isInstance=function(e,t){return t instanceof e},Uo.getAttribute=function(e,t){return t.get(e)},Uo.contains.not=function(e,t){return function(n){return!Uo.contains(e,t)(n)}},Uo.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)},Uo.createFragmentFromText=function(e){var t,n=document.createDocumentFragment(),r=document.createElement("body");for(r.innerHTML=e;t=r.firstChild;)n.appendChild(t);return n},Uo.isPersistableModel=function(e){return e.collection&&e.collection.browserStorage},Uo.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},Uo.interpolate=function(e,t){return e.replace(/{{{([^{}]*)}}}/g,(e,n)=>{var r=t[n];return"string"==typeof r||"number"==typeof r?r:e})},Uo.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))},Uo.safeSave=function(e,t,n){Uo.isPersistableModel(e)?e.save(t,n):e.set(t,n)},Uo.siblingIndex=function(e){for(var t=0;e=e.previousElementSibling;t++);return t},Uo.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},Uo.isMentionBoundary=e=>"@"!==e&&RegExp("(\\p{Z}|\\p{P})","u").test(e),Uo.replaceCurrentWord=function(e,t){const n=e.selectionEnd||void 0,r=Eo(e.value.slice(0,n).split(/\s/)),i=e.value,o=Uo.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},Uo.triggerEvent=function(e,t,n="Event",r=!0,i=!0){const o=document.createEvent(n);o.initEvent(t,r,i),e.dispatchEvent(o)},Uo.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},Uo.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},Uo.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},Uo.arrayBufferToHex=function(e){return Array.prototype.map.call(new Uint8Array(e),e=>("00"+e.toString(16)).slice(-2)).join("")},Uo.arrayBufferToString=function(e){return new TextDecoder("utf-8").decode(e)},Uo.stringToArrayBuffer=function(e){return new TextEncoder("utf-8").encode(e).buffer},Uo.arrayBufferToBase64=function(e){return btoa(new Uint8Array(e).reduce((e,t)=>e+String.fromCharCode(t),""))},Uo.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},Uo.getRandomInt=function(e){return Math.floor(Math.random()*Math.floor(e))},Uo.placeCaretAtEnd=function(e){e!==document.activeElement&&e.focus();const t=2*e.value.length;setTimeout(()=>e.setSelectionRange(t,t),1),this.scrollTop=999999},Uo.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},Uo.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=Uo.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 Vo=Uo;const Go=gr.g.Strophe,Jo=gr.g.$msg,{NS:Qo}=Go;function Yo(e){const t=pr()('spoiler[xmlns="'.concat(Go.NS.SPOILER,'"]'),e).pop();return{is_spoiler:!!t,spoiler_hint:null==t?void 0:t.textContent}}function Ko(e){const t=pr()('x[xmlns="'.concat(Go.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 Xo(e,t){const n=pr()('replace[xmlns="'.concat(Go.NS.MESSAGE_CORRECT,'"]'),e).pop();if(n){const e=n.getAttribute("id"),r=e;if(e){const n=pr()('delay[xmlns="'.concat(Go.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(Go.NS.OMEMO,'"]'),e).pop(),i={is_encrypted:!!r};if(!r||Gc.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(Go.NS.RECEIPTS,'"]'),e).length}function ts(e){const t=pr()('received[xmlns="'.concat(Go.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(Qo.CHATSTATES,'"],\n paused[xmlns="').concat(Qo.CHATSTATES,'"],\n inactive[xmlns="').concat(Qo.CHATSTATES,'"],\n active[xmlns="').concat(Qo.CHATSTATES,'"],\n gone[xmlns="').concat(Qo.CHATSTATES,'"]'),e).pop())||void 0===t?void 0:t.nodeName}function rs(e){const t=Go.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(Go.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(Go.NS.MAM,'"]'),t).pop();if(i){const e=t.getAttribute("from")||Hc.bare_jid;n["stanza_id ".concat(e)]=i.getAttribute("id")}const o=pr()('origin-id[xmlns="'.concat(Go.NS.SID,'"]'),e).pop();return o&&(n.origin_id=o.getAttribute("id")),n}function os(e,t){const n=pr()('> apply-to[xmlns="'.concat(Go.NS.FASTEN,'"]'),e).pop();if(n){const e=n.getAttribute("id");if(pr()('> retract[xmlns="'.concat(Go.NS.RETRACT,'"]'),n).pop()){const n=pr()('delay[xmlns="'.concat(Go.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(Go.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(Go.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){Gc.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(Go.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(Go.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(Go.NS.MARKERS,'"],\n displayed[xmlns="').concat(Go.NS.MARKERS,'"],\n received[xmlns="').concat(Go.NS.MARKERS,'"]'),e).pop(),isArchived:e=>!!pr()('message > result[xmlns="'.concat(Go.NS.MAM,'"]'),e).pop(),getAttributes:e=>e.getAttributeNames().reduce((t,n)=>(t[n]=Go.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=Go.getResourceFromJid(l);if(Gc.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(Go.NS.CARBONS,'"] > forwarded[xmlns="').concat(Go.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(Go.NS.MAM,'"] > forwarded[xmlns="').concat(Go.NS.FORWARD,'"] > message');l=(e=pr()(t,e).pop()).getAttribute("to"),h=e.getAttribute("from")}}const p=Go.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?Go.getBareJidFromJid(l):p,_=await Gc.contacts.get(b),void 0===_&&!Gc.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(Go.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:Go.getBareJidFromJid(e.getAttribute("from")),is_carbon:rs(d),is_delayed:!!y,is_markable:!!pr()('markable[xmlns="'.concat(Go.NS.MARKERS,'"]'),e).length,is_marker:!!w,is_unstyled:!!pr()('unstyled[xmlns="'.concat(Go.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),Ko(e),Yo(e),Xo(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 Gc.emojis.initialize(),x=Object.assign({message:x.body||x.error,is_only_emojis:!!x.body&&Vo.isOnlyEmojis(x.body),is_valid_receipt_request:es(e,x)},x),x.id=x.origin_id||x["stanza_id ".concat(x.from)]||Vo.getUniqueId(),Gc.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(Qo.MAM,'"] > forwarded[xmlns="').concat(Qo.FORWARD,'"] > message'),u=e;if(e=pr()(l,e).pop()||e,pr()('message > forwarded[xmlns="'.concat(Go.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(Go.NS.DELAY,'"]'),u).pop(),h=e.getAttribute("from"),f=Go.unescapeNode(Go.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:Go.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(Go.NS.MARKERS,'"]'),e).length,is_marker:!!p,is_unstyled:!!pr()('unstyled[xmlns="'.concat(Go.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),Ko(e),Yo(e),Xo(e,u),is(e,u),os(e,u),function(e){const t=pr()('apply-to[xmlns="'.concat(Go.NS.FASTEN,'"]'),e).pop();if(t){const e=t.getAttribute("id"),r=pr()('moderated[xmlns="'.concat(Go.NS.MODERATE,'"]'),t).pop();if(r){var n;if(pr()('retract[xmlns="'.concat(Go.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(Go.NS.MODERATE,'"]'),e).pop();if(t){var r;if(pr()('retracted[xmlns="'.concat(Go.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 Gc.emojis.initialize(),m=Object.assign({is_only_emojis:!!m.body&&Vo.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)]||Vo.getUniqueId(),Gc.hook("parseMUCMessage",e,m))},parseMUCPresence(e){const t=e.getAttribute("from"),n=e.getAttribute("type"),r={from:t,nick:Go.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")===Go.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")===Go.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")===Go.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(!Qe(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(Fi);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=Te(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 js=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=Fr(t,ze(n))),r?(o=As,s=!1):t.length>=200&&(o=Qi,s=!1,t=new Gi(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 Cs=function(e){return Ee(e)&&Qe(e)},ks=Ar((function(e,t){return Cs(e)?js(e,No(t,1,Cs,!0)):[]}));var Os=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 Ts=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=Te(e)?Os:Ts;return n&&jr(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)},zs=Object.prototype.hasOwnProperty,Ls=vs((function(e,t,n){zs.call(e,n)?e[n].push(t):be(e,n,[t])})),Fs=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=Fs(r+i,0)),xs(e,t,i)},qs=vs((function(e,t,n){be(e,n,t)}));var Us=function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r},Hs=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?Hs(r+i,0):$s(i,r-1)),t==t?Us(e,t,i):ys(e,ws,i,!0)};var Vs=function(e,t){var n;return gs(e,(function(e,r,i){return!(n=t(e,r,i))})),!!n};var Gs=function(e,t,n){var r=Te(e)?Ji:Vs;return n&&jr(e,t,n)&&(t=void 0),r(e,So(t,3))};var Js=function(e,t){var n=-1,r=Qe(e)?Array(e.length):[];return gs(e,(function(e,i,o){r[++n]=t(e,i,o)})),r};var Qs=function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e};var Ys=function(e,t){if(e!==t){var n=void 0!==e,r=null===e,i=e==e,o=Tr(e),s=void 0!==t,a=null===t,c=t==t,l=Tr(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 Ks=function(e,t,n){for(var r=-1,i=e.criteria,o=t.criteria,s=i.length,a=n.length;++r<s;){var c=Ys(i[r],o[r]);if(c)return r>=a?c:c*("desc"==n[r]?-1:1)}return e.index-t.index};var Xs=function(e,t,n){var r=-1;t=Fr(t.length?t:[vr],ze(So));var i=Js(e,(function(e,n,i){return{criteria:Fr(t,(function(t){return t(e)})),index:++r,value:e}}));return Qs(i,(function(e,t){return Ks(e,t,n)}))},Zs=Ar((function(e,t){if(null==e)return[];var n=t.length;return n>1&&jr(e,t[0],t[1])?t=[]:n>2&&jr(t[0],t[1],t[2])&&(t=[t[0]]),Xs(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,Cr({silent:!0},t))};ta.extend=Qr;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:Fo,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,Cr({merge:!1},t,ra))},remove:function(e,t){t=Cr({},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=Cr({},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||Gs(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?Ci(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,Cr({silent:!0},t)),t.silent||this.trigger("reset",this,t),e},push:function(e,t){return this.add(e,Cr({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,Cr({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 ks(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 Gs(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 Ls(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=Cr({parse:!0},e)).success,n=this,r=e.promise&&Yr();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)},Xr(this,e),r||this.sync("read",this,e)},create:function(e,t){const n=(t=t?Ci(t):{}).wait,r=t.promise,i=r&&Yr();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?Ci(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 Fo},_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(40);class da extends gr.f.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 Gc.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."):(Gc.settings.set("websocket_url",s.pop()),Gc.settings.set("bosh_service_url",o.pop()),this.service=Gc.settings.get("websocket_url")||Gc.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(Gc.settings.get("discover_connection_methods")){const t=gr.f.getDomainFromJid(e);await this.discoverConnectionMethods(t)}super.connect(e,t,n||this.onConnectStatusChanged,59)}async reconnect(){const{__:e}=Hc;return Pn.debug("RECONNECTING: the connection has dropped, attempting to reconnect."),this.setConnectionStatus(gr.f.Status.RECONNECTING,e("The connection has dropped, attempting to reconnect.")),Gc.trigger("will-reconnect"),this.reconnecting=!0,await Yc(),Gc.user.login()}async onConnected(e){delete this.reconnecting,this.flush(),await Hc.setUserJID(this.jid),await Gc.trigger("afterResourceBinding",e,{synchronous:!0}),e?Gc.trigger("reconnected"):Gc.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,Hc.connfeedback.set({connection_status:e,message:t})}async finishDisconnection(){Pn.debug("DISCONNECTED"),delete this.reconnecting,this.reset(),Yc(),await Xc(),delete Hc.connection,Gc.trigger("disconnected")}onDisconnected(){if(!Gc.settings.get("auto_reconnect"))return this.finishDisconnection();{const e=this.disconnection_reason;if(this.disconnection_cause===gr.f.Status.AUTHFAIL)return Gc.settings.get("credentials_url")||Gc.settings.get("authentication")===Hc.ANONYMOUS?Gc.connection.reconnect():this.finishDisconnection();if(this.disconnection_cause===Hc.LOGOUT||e===gr.f.ErrorCondition.NO_AUTH_MECH||"host-unknown"===e||"remote-connection-failed"===e)return this.finishDisconnection();Gc.connection.reconnect()}}onConnectStatusChanged(e,t){const{__:n}=Hc;var r;if(Pn.debug("Status changed to: ".concat(Hc.CONNECTION_STATUS[e])),e===gr.f.Status.ATTACHFAIL)this.setConnectionStatus(e),null===(r=this.worker_attach_promise)||void 0===r||r.resolve(!1);else if(e===gr.f.Status.CONNECTED||e===gr.f.Status.ATTACHED){var i,o;if(null!==(i=this.worker_attach_promise)&&void 0!==i&&i.isResolved&&this.status===gr.f.Status.ATTACHED)return;this.setConnectionStatus(e),null===(o=this.worker_attach_promise)||void 0===o||o.resolve(!0),Hc.send_initial_presence=!0,this.setDisconnectionCause(),this.reconnecting?(Pn.debug(e===gr.f.Status.CONNECTED?"Reconnected":"Reattached"),this.onConnected(!0)):(Pn.debug(e===gr.f.Status.CONNECTED?"Connected":"Attached"),this.restored&&(Hc.send_initial_presence=!1),this.onConnected())}else if(e===gr.f.Status.DISCONNECTED)this.setDisconnectionCause(e,t),this.onDisconnected();else if(e===gr.f.Status.BINDREQUIRED)this.bind();else if(e===gr.f.Status.ERROR)this.setConnectionStatus(e,n("An error occurred while connecting to the chat server."));else if(e===gr.f.Status.CONNECTING)this.setConnectionStatus(e);else if(e===gr.f.Status.AUTHENTICATING)this.setConnectionStatus(e);else if(e===gr.f.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.f.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.f.getDomainFromJid(this.jid),'"')):void 0!==t&&t===(null===gr.f||void 0===gr.f||null===(s=gr.f.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.f.Status.DISCONNECTING&&this.setDisconnectionCause(e,t)}isType(e){return"websocket"===e.toLowerCase()?this._proto instanceof gr.f.Websocket:"bosh"===e.toLowerCase()?gr.f.Bosh&&this._proto instanceof gr.f.Bosh:void 0}hasResumed(){var e;return null!==(e=Gc.settings.get("connection_options"))&&void 0!==e&&e.worker||this.isType("bosh")?Hc.connfeedback.get("connection_status")===gr.f.Status.ATTACHED:!this.do_bind}restoreWorkerSession(){return this.attach(this.onConnectStatusChanged),this.worker_attach_promise=Vo.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.f.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.f.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 Gc.trigger("beforeResourceBinding",{synchronous:!0}),this.authenticated=!0,Hc.no_connection_on_bind||this._changeConnectStatus(gr.f.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=ja(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=ja(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},ja=(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 Ca=new WeakMap,ka=e=>(...t)=>{const n=e(...t);return Ca.set(n,!0),n},Oa=e=>"function"==typeof e&&Ca.has(e),Ta={},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=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:e=>e}),Ra=` ${ma} `;class Da{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?Ra: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");let t=this.getHTML();return void 0!==Ma&&(t=Ma.createHTML(t)),e.innerHTML=t,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 Pa=e=>null===e||!("object"==typeof e||"function"==typeof e),za=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,n=this.parts;if(1===t&&""===e[0]&&""===e[1]){const e=n[0].value;if("symbol"==typeof e)return String(e);if("string"==typeof e||!za(e))return e}let r="";for(let i=0;i<t;i++){r+=e[i];const t=n[i];if(void 0!==t){const e=t.value;if(Pa(e)||!za(e))r+="string"==typeof e?e:String(e);else for(const t of e)r+="string"==typeof t?t:String(t)}}return r+=e[t],r}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===Ta||Pa(e)&&e===this.value||(this.value=e,Oa(e)||(this.committer.dirty=!0))}commit(){for(;Oa(this.value);){const e=this.value;this.value=Ta,e(this)}this.value!==Ta&&this.committer.commit()}}class Ba{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(;Oa(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=Ta,e(this)}const e=this.__pendingValue;e!==Ta&&(Pa(e)?e!==this.value&&this.__commitText(e):e instanceof Da?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):za(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 Ba(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 qa{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(;Oa(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=Ta,e(this)}if(this.__pendingValue===Ta)return;const e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=Ta}}class Ua 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 $a=!1;(()=>{try{const e={get capture(){return $a=!0,!1}};window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(e){}})();class Wa{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(;Oa(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=Ta,e(this)}if(this.__pendingValue===Ta)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=Va(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=Ta}handleEvent(e){"function"==typeof this.value?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}}const Va=e=>e&&($a?{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=Ja.get(e.type);void 0===t&&(t={stringsArray:new WeakMap,keyString:new Map},Ja.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 Ja=new Map,Qa=new WeakMap,Ya=(e,t,n)=>{let r=Qa.get(t);void 0===r&&(ga(t,t.firstChild),Qa.set(t,r=new Ba(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 Ka=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 Ua(e,t.slice(1),n).parts}if("@"===i)return[new Wa(e,t.slice(1),r.eventContext)];if("?"===i)return[new qa(e,t.slice(1),n)];return new La(e,t,n).parts}handleTextExpression(e){return new Ba(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.3.0");const Xa=(e,...t)=>new Da(e,t,"html",Ka),Za=(e,t)=>`${e}--${t}`;let ec=!0;void 0===window.ShadyCSS?ec=!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."),ec=!1);const tc=e=>t=>{const n=Za(t.type,e);let r=Ja.get(n);void 0===r&&(r={stringsArray:new WeakMap,keyString:new Map},Ja.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();ec&&window.ShadyCSS.prepareTemplateDom(n,e),i=new ba(t,n),r.keyString.set(o,i)}return r.stringsArray.set(t.strings,i),i},nc=["html","svg"],rc=new Set,ic=(e,t,n)=>{rc.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=>{nc.forEach(t=>{const n=Ja.get(Za(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=ja(i),a=0,c=-1;for(;o.nextNode();){c++;for(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=ja(i,s);return}s=ja(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 oc={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}},sc=(e,t)=>t!==e&&(t==t||e==e),ac={attribute:!0,type:String,converter:oc,reflect:!1,hasChanged:sc};class cc extends HTMLElement{constructor(){super(),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=ac){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(r){const i=this[e];this[t]=r,this.requestUpdateInternal(e,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||ac}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=sc){return n(e,t)}static _propertyValueFromAttribute(e,t){const n=t.type,r=t.converter||oc,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||oc.toAttribute)(e,n)}initialize(){this._updateState=0,this._updatePromise=new Promise(e=>this._enableUpdatingResolver=e),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_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=ac){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}}requestUpdateInternal(e,t,n){let r=!0;if(void 0!==e){const i=this.constructor;n=n||i.getPropertyOptions(e),i._valueHasChanged(this[e],t,n.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,t),!0!==n.reflect||16&this._updateState||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,n))):r=!1}!this._hasRequestedUpdate&&r&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,t){return this.requestUpdateInternal(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(){if(!this._hasRequestedUpdate)return;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){}}cc.finalized=!0;const lc=Element.prototype;lc.msMatchesSelector||lc.webkitMatchesSelector;
/**
@license
Copyright (c) 2019 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at
http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
part of the polymer project is also subject to an additional IP rights grant
found at http://polymer.github.io/PATENTS.txt
*/
const uc=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,dc=Symbol();class hc{constructor(e,t){if(t!==dc)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return void 0===this._styleSheet&&(uc?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}}const fc=(e,...t)=>{const n=t.reduce((t,n,r)=>t+(e=>{if(e instanceof hc)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 hc(n,dc)};
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/
(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");const pc={};class gc extends cc{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const e=this.getStyles();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=void 0===e?[]:[e];this._styles=this._styles.map(e=>{if(e instanceof CSSStyleSheet&&!uc){const t=Array.prototype.slice.call(e.cssRules).reduce((e,t)=>e+t.cssText,"");return new hc(String(t),dc)}return 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?uc?this.renderRoot.adoptedStyleSheets=e.map(e=>e instanceof CSSStyleSheet?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!==pc&&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 pc}}gc.finalized=!0,gc.render=(e,t,n)=>{if(!n||"object"!=typeof n||!n.scopeName)throw new Error("The `scopeName` option is required.");const r=n.scopeName,i=Qa.has(t),o=ec&&11===t.nodeType&&!!t.host,s=o&&!rc.has(r),a=s?document.createDocumentFragment():t;if(Ya(e,a,Object.assign({templateFactory:tc(r)},n)),s){const e=Qa.get(a);Qa.delete(a);const n=e.value instanceof Ia?e.value.template:void 0;ic(r,a,n),ga(t,t.firstChild),t.appendChild(a),Qa.set(t,e)}!i&&o&&window.ShadyCSS.styleElement(t.host)};class mc extends gc{constructor(){super(),Object.assign(this,mi)}createRenderRoot(){return this}disconnectedCallback(){super.disconnectedCallback(),this.stopListening()}}const vc=function(){this.handlers=[],this.checkUrl=this.checkUrl.bind(this),"undefined"!=typeof window&&(this.location=window.location,this.history=window.history)};vc.extend=Qr;const _c=/^[#\/]|\s+$/g,bc=/^\/+|\/+$/g,yc=/#.*$/;vc.started=!1,Object.assign(vc.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(_c,"")},start:function(e){if(vc.started)throw new Error("history has already been started");if(vc.started=!0,this.options=Cr({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(bc,"/"),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),vc.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),Gs(this.handlers,(function(t){if(t.route.test(e))return t.callback(e),!0})))},navigate:function(e,t){if(!vc.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(yc,"");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 wc=vc;var Sc=function(e){return Ee(e)&&"[object RegExp]"==T(e)},xc=Le.a&&Le.a.isRegExp,Ec=xc?ze(xc):Sc;const Ac=function(e={}){this.history=e.history||new wc,this.preinitialize.apply(this,arguments),e.routes&&(this.routes=e.routes),this._bindRoutes(),this.initialize.apply(this,arguments)};Ac.extend=Qr;const jc=/\((.*?)\)/g,Cc=/(\(\?)?:\w+/g,kc=/\*\w+/g,Oc=/[\-{}\[\]+?.,\\\^$|#\s]/g;Object.assign(Ac.prototype,mi,{preinitialize:function(){},initialize:function(){},route:function(e,t,n){return Ec(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=Ye(this.routes);for(;null!=(e=t.pop());)this.route(e,this.routes[e])},_routeToRegExp:function(e){return e=e.replace(Oc,"\\$&").replace(jc,"(?:$1)?").replace(Cc,(function(e,t){return t?e:"([^/?]+)"})).replace(kc,"([^?]*?)"),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 Tc=n(2),Nc=function(){return y.a.Date.now()},Ic=Math.max,Mc=Math.min;var Rc=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=Nc();if(g(e))return v(e);a=setTimeout(m,function(e){var n=t-(e-c);return d?Mc(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=Nc(),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)?Ic(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(Nc())},_};var Dc=function(e,t,n){t=$r(t,e);var r=null==(e=jo(e,t))?e:e[Wr(Eo(t))];return null==r?void 0:_r(r,e,n)},Pc=Ar(Dc),zc=n(91);
/**
* @module converse-core
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
Sn.a.extend(yn.a),Tc.e.addNamespace("CARBONS","urn:xmpp:carbons:2"),Tc.e.addNamespace("CHATSTATES","http://jabber.org/protocol/chatstates"),Tc.e.addNamespace("CSI","urn:xmpp:csi:0"),Tc.e.addNamespace("DELAY","urn:xmpp:delay"),Tc.e.addNamespace("FASTEN","urn:xmpp:fasten:0"),Tc.e.addNamespace("FORWARD","urn:xmpp:forward:0"),Tc.e.addNamespace("HINTS","urn:xmpp:hints"),Tc.e.addNamespace("HTTPUPLOAD","urn:xmpp:http:upload:0"),Tc.e.addNamespace("IDLE","urn:xmpp:idle:1"),Tc.e.addNamespace("MAM","urn:xmpp:mam:2"),Tc.e.addNamespace("MODERATE","urn:xmpp:message-moderate:0"),Tc.e.addNamespace("NICK","http://jabber.org/protocol/nick"),Tc.e.addNamespace("OMEMO","eu.siacs.conversations.axolotl"),Tc.e.addNamespace("OUTOFBAND","jabber:x:oob"),Tc.e.addNamespace("PUBSUB","http://jabber.org/protocol/pubsub"),Tc.e.addNamespace("REGISTER","jabber:iq:register"),Tc.e.addNamespace("RETRACT","urn:xmpp:message-retract:0"),Tc.e.addNamespace("ROSTERX","http://jabber.org/protocol/rosterx"),Tc.e.addNamespace("RSM","http://jabber.org/protocol/rsm"),Tc.e.addNamespace("SID","urn:xmpp:sid:0"),Tc.e.addNamespace("SPOILER","urn:xmpp:spoiler:0"),Tc.e.addNamespace("STANZAS","urn:ietf:params:xml:ns:xmpp-stanzas"),Tc.e.addNamespace("STYLING","urn:xmpp:styling:0"),Tc.e.addNamespace("VCARD","vcard-temp"),Tc.e.addNamespace("VCARDUPDATE","vcard-temp:x:update"),Tc.e.addNamespace("XFORM","jabber:x:data");class Lc extends Error{}const Fc=["converse-adhoc","converse-bookmarks","converse-bosh","converse-caps","converse-carbons","converse-chat","converse-chatboxes","converse-disco","converse-emoji","converse-headlines","converse-mam","converse-muc","converse-ping","converse-pubsub","converse-roster","converse-smacks","converse-status","converse-vcard"],Bc={allow_non_roster_messaging:!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:[]},qc={};qc[Tc.e.Status.ATTACHED]="ATTACHED",qc[Tc.e.Status.AUTHENTICATING]="AUTHENTICATING",qc[Tc.e.Status.AUTHFAIL]="AUTHFAIL",qc[Tc.e.Status.CONNECTED]="CONNECTED",qc[Tc.e.Status.CONNECTING]="CONNECTING",qc[Tc.e.Status.CONNFAIL]="CONNFAIL",qc[Tc.e.Status.DISCONNECTED]="DISCONNECTED",qc[Tc.e.Status.DISCONNECTING]="DISCONNECTING",qc[Tc.e.Status.ERROR]="ERROR",qc[Tc.e.Status.RECONNECTING]="RECONNECTING",qc[Tc.e.Status.REDIRECT]="REDIRECT";const Uc={initialize(){},__:(...e)=>Object(zc.sprintf)(...e)},Hc={log:Pn,CONNECTION_STATUS:qc,templates:{},promises:{initialized:Vo.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 Ac,TimeoutError:Lc,isTestEnv:()=>"montague.lit/http-bind"===Wc.bosh_service_url,__:(...e)=>Uc.__(...e),___:e=>e};let $c;Hc.VERSION_NAME="v7.0.3dev",Object.assign(Hc,mi),cr.enable(Hc,"_converse","pluggable");let Wc={};function Vc(){var e;if(!Hc.bare_jid){const e="No JID to fetch user settings for";throw Pn.error(e),Error(e)}if(null===(e=$c)||void 0===e||!e.fetched){const e="converse.user-settings.".concat(Hc.bare_jid);$c=new Fo({id:e}),$c.browserStorage=Qc(e),$c.fetched=$c.fetch({promise:!0})}return $c.fetched}const Gc=Hc.api={connection:{connected(){var e;return(null==Hc||null===(e=Hc.connection)||void 0===e?void 0:e.connected)&&!0},disconnect(){Hc.connection&&Hc.connection.disconnect()},async reconnect(){const e=Hc.connfeedback.get("connection_status");if(Gc.settings.get("authentication")===Hc.ANONYMOUS&&(await Yc(),await Xc()),e===Tc.e.Status.CONNFAIL?Gc.connection.isType("websocket")&&Gc.settings.get("bosh_service_url")?(await Hc.setUserJID(Hc.bare_jid),Hc.connection._proto._doDisconnect(),Hc.connection._proto=new Tc.e.Bosh(Hc.connection),Hc.connection.service=Gc.settings.get("bosh_service_url")):Gc.connection.isType("bosh")&&Gc.settings.get("websocket_url")&&(Gc.settings.get("authentication")===Hc.ANONYMOUS?await Hc.setUserJID(Gc.settings.get("jid")):await Hc.setUserJID(Hc.bare_jid),Hc.connection._proto._doDisconnect(),Hc.connection._proto=new Tc.e.Websocket(Hc.connection),Hc.connection.service=Gc.settings.get("websocket_url")):e===Tc.e.Status.AUTHFAIL&&Gc.settings.get("authentication")===Hc.ANONYMOUS&&await Hc.setUserJID(Gc.settings.get("jid")),!Hc.connection.reconnecting)return Hc.connection.reconnect();Hc.connection.debouncedReconnect()},isType:e=>Hc.connection.isType(e)},async trigger(e){if(!Hc._events)return;const t=Array.from(arguments),n=t.pop();if(n&&n.synchronous){const n=Hc._events[e]||[];await Promise.all(n.map(e=>e.callback.apply(e.ctx,t.splice(1))))}else Hc.trigger.apply(Hc,arguments);const r=Hc.promises[e];void 0!==r&&r.resolve()},hook(e,t,n){const r=Hc._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:()=>Hc.connection.jid,async login(e,t,n=!1){var r,i;if(e=e||Hc.jid,(null===(r=Hc.connection)||void 0===r||!r.jid||e&&!Vo.isSameDomain(Hc.connection.jid,e))&&await Hc.initConnection(),null!==(i=Gc.settings.get("connection_options"))&&void 0!==i&&i.worker&&await Hc.connection.restoreWorkerSession())return;e&&(e=await Hc.setUserJID(e));const o=Hc.pluggable.plugins["converse-bosh"];if(o&&o.enabled()){if(await Hc.restoreBOSHSession())return;if(Gc.settings.get("authentication")===Hc.PREBIND&&(!n||Gc.settings.get("auto_login")))return Hc.startNewPreboundBOSHSession()}t=t||Gc.settings.get("password");!async function(e,t){const{api:n}=Hc;n.settings.get("authentication")===Hc.LOGIN?e?Kc(e):Hc.api.settings.get("credentials_url")?Kc(await async function(){let e,t=0;for(;!e;){try{e=await nl(t)}catch(e){Pn.error("Could not fetch login credentials"),Pn.error(e)}t=2e3}return e}()):Hc.jid&&(Hc.api.settings.get("password")||Hc.connection.pass)?Kc():!Hc.isTestEnv()&&"credentials"in navigator?Kc(await async function(){try{const e=await navigator.credentials.get({password:!0});if(e&&"password"==e.type&&Vo.isValidJID(e.id))return await Hc.setUserJID(e.id),{jid:e.id,password:e.password}}catch(e){Pn.error(e)}}()):!Hc.isTestEnv()&&Pn.warn("attemptNonPreboundSession: Couldn't find credentials to log in with"):![Hc.ANONYMOUS,Hc.EXTERNAL].includes(Hc.api.settings.get("authentication"))||t&&!Hc.api.settings.get("auto_login")||Kc()}(e&&t?{jid:e,password:t}:null,n)},logout(){const e=Vo.getResolveablePromise(),t=()=>{Object.keys(Hc.promises).forEach(Jc),delete Hc.jid,Gc.trigger("logout"),e.resolve()};return Hc.connection.setDisconnectionCause(Hc.LOGOUT,void 0,!0),void 0!==Hc.connection?(Gc.listen.once("disconnected",()=>t()),Hc.connection.disconnect()):t(),e},settings:{getModel:async()=>(await Vc(),$c),get:async(e,t)=>(await Vc(),void 0===$c.get(e)?t:$c.get(e)),async set(e,t){if(await Vc(),N(e))return $c.save(e,{promise:!0});{const n={};return n[e]=t,$c.save(n,{promise:!0})}},async clear(){await Vc(),$c.clear()}}},settings:{extend(e){Vo.merge(Bc,e);const t=Object.keys(Lo(e,Object.keys(Bc))),n=Lo(Wc,t),r=Cr(Lo(e,t),n);Vo.merge(Hc.settings,r),Vo.merge(Hc,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(Bc).includes(e))return Hc[e]},set(e,t){const n={};N(e)?(Cr(Hc,Lo(e,Object.keys(Bc))),Cr(Hc.settings,Lo(e,Object.keys(Bc)))):"string"==typeof e&&(n[e]=t,Cr(Hc,Lo(n,Object.keys(Bc))),Cr(Hc.settings,Lo(n,Object.keys(Bc))))}},promises:{add(e,t=!0){(e=Array.isArray(e)?e:[e]).forEach(e=>{const n=Vo.getResolveablePromise();n.replace=t,Hc.promises[e]=n})}},listen:{once:Hc.once.bind(Hc),on:Hc.on.bind(Hc),not:Hc.off.bind(Hc),stanza(e,t,n){M(t)?(n=t,t={}):t=t||{},Hc.connection.addHandler(n,t.ns,e,t.type,t.id,t.from,t)}},waitUntil(e){if(M(e))return Vo.waitUntil(e);{const t=Hc.promises[e];return void 0===t?null:t}},send:e=>Gc.connection.connected()?("string"==typeof e&&(e=Vo.toStanza(e)),"iq"===e.tagName?Gc.sendIQ(e):(Hc.connection.send(e),void Gc.trigger("send",e))):(Pn.warn("Not sending stanza because we're not connected!"),void Pn.warn(Tc.e.serialize(e))),sendIQ(e,t=Hc.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||Hc.STANZA_TIMEOUT,n?(o=new Promise((n,r)=>Hc.connection.sendIQ(e,n,r,t)),o.catch(n=>{if(null===n)throw new Lc("Timeout error after ".concat(t,"ms for the following IQ stanza: ").concat(Tc.e.serialize(e)))})):o=new Promise(n=>Hc.connection.sendIQ(e,n,n,t))):(Hc.connection.sendIQ(e),o=Promise.resolve()),Gc.trigger("send",e),o}};function Jc(e){const t=Hc.promises[e];if(!t)throw new Error("Tried to replace non-existing promise: ".concat(e));if(t.replace){const n=Vo.getResolveablePromise();n.replace=t.replace,Hc.promises[e]=n}else Pn.debug('Not replacing promise "'.concat(e,'"'))}function Qc(e,t){const n=Hc.storage[t||Hc.getDefaultStore()];return new _n(e,n)}async function Yc(){return await Hc.api.trigger("beforeTearDown",{synchronous:!0}),window.removeEventListener("click",Hc.onUserActivity),window.removeEventListener("focus",Hc.onUserActivity),window.removeEventListener("keypress",Hc.onUserActivity),window.removeEventListener("mousemove",Hc.onUserActivity),window.removeEventListener(Hc.unloadevent,Hc.onUserActivity),window.clearInterval(Hc.everySecondTrigger),Hc.api.trigger("afterTearDown"),Hc}function Kc(e){if([Hc.ANONYMOUS,Hc.EXTERNAL].includes(Hc.api.settings.get("authentication"))){if(!Hc.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.");Hc.connection.reconnecting||Hc.connection.reset(),Hc.connection.connect(Hc.jid.toLowerCase())}else if(Hc.api.settings.get("authentication")===Hc.LOGIN){var t;const n=e?e.password:(null===(t=Hc.connection)||void 0===t?void 0:t.pass)||Hc.api.settings.get("password");if(!n){if(Hc.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 Hc.connection.setDisconnectionCause(Tc.e.Status.AUTHFAIL,void 0,!0),void Hc.api.connection.disconnect()}Hc.connection.reconnecting||Hc.connection.reset(),Hc.connection.connect(Hc.jid,n)}}function Xc(){var e;return null===(e=Hc.session)||void 0===e||e.destroy(),delete Hc.session,Hc.shouldClearCache()&&Hc.api.user.settings.clear(),Hc.api.trigger("clearSession",{synchronous:!0})}async function Zc(e){var t;const n=Gc.settings.get("connection_options").worker,r=Tc.e.getBareJidFromJid(e).toLowerCase(),i="converse.session-".concat(r);(null===(t=Hc.session)||void 0===t?void 0:t.get("id"))!==i?(Hc.session=new Fo({id:i}),Hc.session.browserStorage=Qc(i,n?"persistent":"session"),await new Promise(e=>Hc.session.fetch({success:e,error:e})),!n&&Hc.session.get("active")&&(Hc.session.clear(),Hc.session.save({id:i})),el(e),function(){if("sessionStorage"===Gc.settings.get("persistent_store"))return;if("BrowserExtLocal"===Hc.api.settings.get("persistent_store"))return _n.localForage.defineDriver(hr.a).then(()=>_n.localForage.setDriver("webExtensionLocalStorage")),void(Hc.storage.persistent=_n.localForage);if("BrowserExtSync"===Hc.api.settings.get("persistent_store"))return _n.localForage.defineDriver(ur.a).then(()=>_n.localForage.setDriver("webExtensionSyncStorage")),void(Hc.storage.persistent=_n.localForage);const e={name:Hc.isTestEnv()?"converse-test-persistent":"converse-persistent",storeName:Hc.bare_jid};"localStorage"===Hc.api.settings.get("persistent_store")?(e.description="localStorage instance",e.driver=[_n.localForage.LOCALSTORAGE]):"IndexedDB"===Hc.api.settings.get("persistent_store")&&(e.description="indexedDB instance",e.driver=[_n.localForage.INDEXEDDB]),Hc.storage.persistent=_n.localForage.createInstance(e)}(),Hc.api.trigger("userSessionInitialized")):el(e)}function el(e){e=Hc.session.get("jid")||e,Hc.api.settings.get("authentication")===Hc.ANONYMOUS||Tc.e.getResourceFromJid(e)||(e=e.toLowerCase()+da.generateResource()),Hc.jid=e,Hc.bare_jid=Tc.e.getBareJidFromJid(e),Hc.resource=Tc.e.getResourceFromJid(e),Hc.domain=Tc.e.getDomainFromJid(e),Hc.session.save({jid:e,bare_jid:Hc.bare_jid,resource:Hc.resource,domain:Hc.domain,active:!0}),Hc.connection.jid=e}async function tl(){var e;await Gc.trigger("cleanup",{synchronous:!0}),Hc.router.history.stop(),document.removeEventListener("visibilitychange",Hc.saveWindowState),Gc.trigger("unregisteredGlobalEventHandlers"),null===(e=Hc.connection)||void 0===e||e.reset(),Hc.stopListening(),Hc.off(),Hc.promises.initialized.isResolved&&Gc.promises.add("initialized")}function nl(e=0){return new Promise(Rc((e,t)=>{const n=new XMLHttpRequest;n.open("GET",Gc.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);Hc.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))}Hc.isUniView=function(){return["mobile","fullscreen","embedded"].includes(Gc.settings.get("view_mode"))},Hc.getDefaultStore=function(){if(Hc.config.get("trusted")){return"sessionStorage"===Gc.settings.get("persistent_store")?"session":"persistent"}return"session"},Hc.createStore=Qc,Hc.shouldClearCache=()=>!Hc.config.get("trusted")||Gc.settings.get("clear_cache_on_logout")||Hc.isTestEnv(),Hc.initConnection=function(){const e=Hc.api;if(!e.settings.get("bosh_service_url")){if(e.settings.get("authentication")===Hc.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=Hc.isTestEnv()?ha:da;if(("WebSocket"in window||"MozWebSocket"in window)&&e.settings.get("websocket_url"))Hc.connection=new t(e.settings.get("websocket_url"),Object.assign(Hc.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.");Hc.connection=new t(e.settings.get("bosh_service_url"),Object.assign(Hc.default_connection_options,e.settings.get("connection_options"),{keepalive:e.settings.get("keepalive")}))}!function(){const e={};e[Tc.e.LogLevel.DEBUG]="debug",e[Tc.e.LogLevel.INFO]="info",e[Tc.e.LogLevel.WARN]="warn",e[Tc.e.LogLevel.ERROR]="error",e[Tc.e.LogLevel.FATAL]="fatal",Tc.e.log=(t,n)=>Pn.log(n,e[t]),Tc.e.error=e=>Pn.error(e),Hc.connection.xmlInput=e=>Pn.debug(e.outerHTML,"color: darkgoldenrod"),Hc.connection.xmlOutput=e=>Pn.debug(e.outerHTML,"color: darkcyan")}(),e.trigger("connectionInitialized")},Hc.setUserJID=async function(e){return await Zc(e),Hc.api.trigger("setUserJID"),e},Hc.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",Hc.windowState=t,Gc.trigger("windowStateChanged",{state:t})},Hc.ConnectionFeedback=Fo.extend({defaults:{connection_status:Tc.e.Status.DISCONNECTED,message:""},initialize(){this.on("change",()=>Gc.trigger("connfeedback",Hc.connfeedback))}});const rl=window.converse||{};Object.assign(rl,{CHAT_STATES:["active","composing","gone","inactive","paused"],keycodes:{TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESCAPE:27,LEFT_ARROW:37,UP_ARROW:38,RIGHT_ARROW:39,DOWN_ARROW:40,FORWARD_SLASH:47,AT:50,META:91,META_RIGHT:93},async initialize(e){if(await tl(),"onpagehide"in window?Hc.unloadevent="pagehide":"onbeforeunload"in window?Hc.unloadevent="beforeunload":"onunload"in window&&(Hc.unloadevent="unload"),function(e){Hc.settings={},Wc=e;const t=Lo(e,Object.keys(Bc));Cr(Hc.settings,Bc,t),Cr(Hc,Bc,t)}(e),Hc.strict_plugin_dependencies=e.strict_plugin_dependencies,Pn.setLogLevel(Gc.settings.get("loglevel")),Gc.settings.get("authentication")===Hc.ANONYMOUS&&Gc.settings.get("auto_login")&&!Gc.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.");Hc.router.route(/^converse\?loglevel=(debug|info|warn|error|fatal)$/,"loglevel",e=>Pn.setLogLevel(e)),Hc.connfeedback=new Hc.ConnectionFeedback,Hc.send_initial_presence=!0,await async function(){await _n.sessionStorageInitialized,Hc.storage={session:_n.localForage.createInstance({name:Hc.isTestEnv()?"converse-test-session":"converse-session",description:"sessionStorage instance",driver:["sessionStorageWrapper"]})}}(),await async function(){const e="converse.client-config";Hc.config=new Fo({id:e,trusted:!0}),Hc.config.browserStorage=Qc(e,"session"),await new Promise(e=>Hc.config.fetch({success:e,error:e})),Hc.api.trigger("clientConfigInitialized")}(),await Uc.initialize(),function(){Hc.pluggable.initialized_plugins=[];const e=Fc.concat(Hc.api.settings.get("whitelisted_plugins"));Hc.api.settings.get("singleton")&&["converse-bookmarks","converse-controlbox","converse-headline","converse-register"].forEach(e=>Hc.api.settings.get("blacklisted_plugins").push(e)),Hc.pluggable.initializePlugins({_converse:Hc},e,Hc.api.settings.get("blacklisted_plugins")),Hc.api.trigger("pluginsInitialized")}(),document.addEventListener("visibilitychange",Hc.saveWindowState),Hc.saveWindowState({type:document.hidden?"blur":"focus"}),Gc.trigger("registeredGlobalEventHandlers"),!History.started&&Hc.router.history.start(),Gc.settings.get("idle_presence_timeout")>0&&Gc.listen.on("addClientFeatures",()=>Gc.disco.own.features.add(Tc.e.NS.IDLE));const t=Hc.pluggable.plugins;if((Gc.settings.get("auto_login")||Gc.settings.get("keepalive")&&Pc(t["converse-bosh"],"enabled"))&&await Gc.user.login(null,null,!0),Gc.trigger("initialized"),Hc.isTestEnv())return Hc},plugins:{add(e,t){if(t.__name__=e,void 0!==Hc.pluggable.plugins[e])throw new TypeError('Error: plugin with name "'.concat(e,'" has already been ')+"registered!");Hc.pluggable.plugins[e]=t}},env:{$build:Tc.a,$iq:Tc.b,$msg:Tc.c,$pres:Tc.d,utils:Vo,Collection:ta,CustomElement:mc,Model:Fo,Promise:Promise,Strophe:Tc.e,dayjs:Sn.a,html:Xa,log:Pn,sizzle:pr.a,sprintf:zc.sprintf,stanza_utils:hs,u:Vo}});const il=new CustomEvent("converse-loaded",{detail:{converse:rl}});window.dispatchEvent(il);const{Strophe:ol}=rl.env;let sl,al;ol.addNamespace("ADHOC","http://jabber.org/protocol/commands");const cl={adhoc:{async getCommands(e){let t=[];try{n=await al.disco.items(e,ol.NS.ADHOC),t=pr()('query[xmlns="'.concat(ol.NS.DISCO_ITEMS,'"][node="').concat(ol.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}}};rl.plugins.add("converse-adhoc",{dependencies:["converse-disco"],initialize(){sl=this._converse,al=sl.api,Object.assign(al,cl)}});var ll=n(60),ul=n.n(ll);var dl=function(e){return function(t,n,r){var i=Object(t);if(!Qe(t)){var o=So(n,3);t=Ye(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 hl=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:fl,Strophe:pl,sizzle:gl,utils:ml}=rl.env,vl=rl.env.utils;rl.plugins.add("converse-chat",{dependencies:["converse-chatboxes","converse-disco"],initialize(){const{__:e}=Hc;Gc.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=Fo.extend({initialize(){this.rosterContactAdded=vl.getResolveablePromise()},async setRosterContact(e){const t=await Gc.contacts.get(e);t&&(this.contact=t,this.set("nickname",t.get("nickname")),this.rosterContactAdded.resolve())}});Hc.Message=t.extend({defaults:()=>({msgid:vl.getUniqueId(),time:(new Date).toISOString(),is_ephemeral:!1}),async initialize(){this.checkValidity()&&(this.initialized=vl.getResolveablePromise(),"chat"===this.get("type")&&(t.prototype.initialize.apply(this,arguments),this.setRosterContact(pl.getBareJidFromJid(this.get("from")))),this.get("file")&&this.on("change:put",this.uploadFile,this),this.setTimerForEphemeralMessage(),await Gc.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(Gc.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=rl.env.$iq({from:Hc.jid,to:this.get("slot_request_url"),type:"get"}).c("request",{xmlns:pl.NS.HTTPUPLOAD,filename:this.file.name,size:this.file.size,"content-type":this.file.type});return Gc.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:Hc.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:Hc.FAILURE,message:n,is_ephemeral:!0})},t.open("PUT",this.get("put"),!0),t.setRequestHeader("Content-type",this.file.type),t.send(this.file)}}),Hc.Messages=ta.extend({model:Hc.Message,comparator:"time"}),Hc.ChatBox=t.extend({messagesCollection:Hc.Messages,defaults(){return{bookmarked:!1,chat_state:void 0,hidden:Hc.isUniView()&&!Gc.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:Hc.PRIVATE_CHAT_TYPE,url:""}},async initialize(){this.initialized=vl.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")===Hc.PRIVATE_CHAT_TYPE&&(this.presence=Hc.presences.findWhere({jid:e})||Hc.presences.create({jid:e}),await this.setRosterContact(e)),this.on("change:chat_state",this.sendChatState,this),await this.fetchMessages(),await Gc.trigger("chatBoxInitialized",this,{Synchronous:!0}),this.initialized.resolve())},getMessagesCacheKey(){return"converse.messages-".concat(this.get("jid"),"-").concat(Hc.bare_jid)},initMessages(){this.messages=new this.messagesCollection,this.messages.fetched=vl.getResolveablePromise(),this.messages.fetched.then(()=>{Gc.trigger("afterMessagesFetched",this)}),this.messages.chatbox=this,this.messages.browserStorage=Hc.createStore(this.getMessagesCacheKey()),this.listenTo(this.messages,"change:upload",e=>{e.get("upload")===Hc.SUCCESS&&Gc.send(this.createMessageStanza(e))})},initNotifications(){this.notifications=new Fo},afterMessagesFetched(){Gc.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,Hc);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,vl.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),vl.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=vl.getResolveablePromise()}},async close(){try{await new Promise((e,t)=>this.destroy({success:e,error:(e,n)=>t(n)}))}catch(e){Pn.error(e)}finally{Gc.settings.get("clear_messages_on_reconnection")&&await this.clearMessages()}},announceReconnection(){Gc.trigger("chatReconnected",this)},async onReconnection(){Gc.settings.get("clear_messages_on_reconnection")&&await this.clearMessages(),this.announceReconnection()},validate(e){if(!e.jid)return"Ignored ChatBox without JID";const t=Hc.auto_join_rooms.map(e=>N(e)?e.jid:e),n=Gc.settings.get("auto_join_private_chats").concat(t);if(Gc.settings.get("singleton")&&!n.includes(e.jid)&&!Gc.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 Hc.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===Hc.COMPOSING?this.chat_state_timeout=window.setTimeout(this.setChatState.bind(this),Hc.TIMEOUTS.PAUSED,Hc.PAUSED):e===Hc.PAUSED&&(this.chat_state_timeout=window.setTimeout(this.setChatState.bind(this),Hc.TIMEOUTS.INACTIVE,Hc.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)=>vl.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(Lo(e,t)),!0):(e.dangling_retraction=!0,await this.createMessage(e),!0)}{const n=this.findDanglingRetraction(e);if(n){const r=Lo(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 dl(n,e=>t.reduce((t,n)=>t||hl(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=fl({id:vl.getUniqueId(),to:this.get("jid"),type:"chat"}).c("store",{xmlns:pl.NS.HINTS}).up().c("apply-to",{id:t,xmlns:pl.NS.FASTEN}).c("retract",{xmlns:pl.NS.RETRACT});return Hc.connection.send(n)},sendMarkerForMessage(e){if(null!=e&&e.get("is_markable")){const t=pl.getBareJidFromJid(e.get("from"));this.sendMarker(t,e.get("msgid"),"displayed",e.get("type"))}},sendMarker(e,t,n,r){const i=fl({from:Hc.connection.jid,id:vl.getUniqueId(),to:e,type:r||"chat"}).c(n,{xmlns:pl.NS.MARKERS,id:t});Gc.send(i)},handleChatMarker(e){if(pl.getBareJidFromJid(e.to)!==Hc.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=fl({from:Hc.connection.jid,id:vl.getUniqueId(),to:e,type:"chat"}).c("received",{xmlns:pl.NS.RECEIPTS,id:t}).up().c("store",{xmlns:pl.NS.HINTS}).up();Gc.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=fl({from:Hc.connection.jid,to:this.get("jid"),type:this.get("message_type"),id:e.get("edited")&&vl.getUniqueId()||e.get("msgid")}).c("body").t(e.get("message")).up().c(Hc.ACTIVE,{xmlns:pl.NS.CHATSTATES}).root();return"chat"===e.get("type")&&t.c("request",{xmlns:pl.NS.RECEIPTS}).root(),e.get("is_spoiler")&&(e.get("spoiler_hint")?t.c("spoiler",{xmlns:pl.NS.SPOILER},e.get("spoiler_hint")).root():t.c("spoiler",{xmlns:pl.NS.SPOILER}).root()),(e.get("references")||[]).forEach(e=>{const n={xmlns:pl.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:pl.NS.OUTOFBAND}).c("url").t(e.get("oob_url")).root(),e.get("edited")&&t.c("replace",{xmlns:pl.NS.MESSAGE_CORRECT,id:e.get("msgid")}).root(),e.get("origin_id")&&t.c("origin-id",{xmlns:pl.NS.SID,id:e.get("origin_id")}).root(),t},getOutgoingMessageAttributes(e,t){const n=this.get("composing_spoiler"),r=vl.getUniqueId(),i=e?vl.httpToGeoUri(vl.shortnamesToUnicode(e),Hc):void 0;return{from:Hc.bare_jid,fullname:Hc.xmppstatus.get("fullname"),id:r,is_only_emojis:!!e&&vl.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&&!vl.isEmptyMessage(e)&&"me"===e.sender)if("all"===Gc.settings.get("allow_message_corrections"))e.editable=!(e.file||e.retracted||"oob_url"in e);else if("last"===Gc.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){e.time=e.time||(new Date).toISOString(),await this.messages.fetched;return 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:vl.getUniqueId(),received:void 0})}else this.setEditable(n,(new Date).toISOString()),r=await this.createMessage(n);return Gc.send(this.createMessageStanza(r)),Gc.trigger("sendMessage",{chatbox:this,message:r}),r},sendChatState(){if(Gc.settings.get("send_chat_state_notifications")&&this.get("chat_state")){const e=Gc.settings.get("send_chat_state_notifications");if(Array.isArray(e)&&!e.includes(this.get("chat_state")))return;Gc.send(fl({id:vl.getUniqueId(),to:this.get("jid"),type:"chat"}).c(this.get("chat_state"),{xmlns:pl.NS.CHATSTATES}).up().c("no-store",{xmlns:pl.NS.HINTS}).up().c("no-permanent-store",{xmlns:pl.NS.HINTS}))}},async sendFiles(t){var n;const r=(await Gc.disco.features.get(pl.NS.HTTPUPLOAD,Hc.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:pl.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,ul()(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(Hc.isUniView()){const e=e=>!e.get("hidden")&&e.get("jid")!==this.get("jid")&&"controlbox"!==e.get("id");Hc.chatboxes.filter(e).forEach(e=>vl.safeSave(e,{hidden:!0}))}vl.safeSave(this,{hidden:!1})}return Hc.isUniView()&&this.get("hidden")?void 0:this.trigger("show")},isHidden(){return Hc.isUniView()&&this.get("hidden")||this.isScrolledUp()||"hidden"===Hc.windowState},handleUnreadMessage(e){if(null!=e&&e.get("body")&&ml.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()),vl.safeSave(this,{num_unread:0})},isScrolledUp(){return this.get("scrolled",!0)}}),Hc.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,Hc);if(vl.isErrorObject(t))return t.stanza&&Pn.error(t.stanza),Pn.error(t.message);const n=!!gl('body, encrypted[xmlns="'.concat(pl.NS.OMEMO,'"]'),e).length,r=await Gc.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};Gc.trigger("message",i)},Hc.router.route("converse/chat?jid=:jid",(function(e){if(!ml.isValidJID(e))return Pn.warn('Invalid JID "'.concat(e,'" provided in URL fragment'));Gc.chats.open(e)})),Gc.listen.on("chatBoxesFetched",(function(){Gc.settings.get("auto_join_private_chats").forEach(e=>{Hc.chatboxes.where({jid:e}).length||("string"==typeof e?Gc.chats.open(e):Pn.error('Invalid jid criteria specified for "auto_join_private_chats"'))}),Gc.trigger("privateChatsAutoJoined")})),Gc.listen.on("presencesInitialized",(function(){Hc.connection.addHandler(e=>gl('message > result[xmlns="'.concat(pl.NS.MAM,'"]'),e).pop()?(Pn.warn('Received a MAM message with type "chat".'),!0):(Hc.handleMessageStanza(e),!0),null,"message","chat"),Hc.connection.addHandler(e=>(null!==e.getAttribute("type")||Hc.handleMessageStanza(e),!0),pl.NS.RECEIPTS,"message"),Hc.connection.addHandler(e=>(async function(e){const t=pl.getBareJidFromJid(e.getAttribute("from"));if(ml.isSameBareJID(t,Hc.bare_jid))return;const n=await Gc.chatboxes.get(t);null==n||n.handleErrorMessageStanza(e)}(e),!0),null,"message","error")})),Gc.listen.on("clearSession",async()=>{if(Hc.shouldClearCache()){await Promise.all(Hc.chatboxes.map(e=>e.messages&&e.messages.clearStore({silent:!0})));const e=e=>e.get("type")!==Hc.CONTROLBOX_TYPE;Hc.chatboxes.clearStore({silent:!0},e)}}),Object.assign(Gc,{chats:{async create(e,t){if("string"==typeof e){if(t&&(null==t||!t.fullname)){var n;const r=await Gc.contacts.get(e);t.fullname=null==r||null===(n=r.attributes)||void 0===n?void 0:n.fullname}const r=Gc.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 Gc.contacts.get(e);return t.fullname=null==i||null===(r=i.attributes)||void 0===r?void 0:r.fullname,Gc.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 Gc.chats.get(e,t,!0);return r?r.maybeShow(n):r}if(Array.isArray(e))return Promise.all(e.map(e=>Gc.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 Gc.chatboxes.get(e);return!r&&n?r=await Gc.chatboxes.create(e,t,Hc.ChatBox):(r=r&&r.get("type")===Hc.PRIVATE_CHAT_TYPE?r:null,r&&Object.keys(t).length&&r.save(t)),r}if(void 0===e){return(await Gc.chatboxes.get()).filter(e=>e.get("type")===Hc.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:_l,$iq:bl,utils:yl}=rl.env;rl.plugins.add("converse-disco",{initialize(){function e(){if(!Hc.stream_features){const e=_l.getBareJidFromJid(Hc.jid),t="converse.stream-features-".concat(e);Gc.promises.add("streamFeaturesAdded"),Hc.stream_features=new ta,Hc.stream_features.browserStorage=Hc.createStore(t,"session")}}function t(){Gc.trigger("streamFeaturesAdded")}Gc.promises.add("discoInitialized"),Gc.promises.add("streamFeaturesAdded"),Hc.DiscoEntity=Fo.extend({idAttribute:"jid",initialize(e,t){this.waitUntilFeaturesDiscovered=yl.getResolveablePromise(),this.dataforms=new ta;let n="converse.dataforms-".concat(this.get("jid"));this.dataforms.browserStorage=Hc.createStore(n,"session"),this.features=new ta,n="converse.features-".concat(this.get("jid")),this.features.browserStorage=Hc.createStore(n,"session"),this.listenTo(this.features,"add",this.onFeatureAdded),this.fields=new ta,n="converse.fields-".concat(this.get("jid")),this.fields.browserStorage=Hc.createStore(n,"session"),this.listenTo(this.fields,"add",this.onFieldAdded),this.identities=new ta,n="converse.identities-".concat(this.get("jid")),this.identities.browserStorage=Hc.createStore(n,"session"),this.fetchFeatures(t),this.items=new Hc.DiscoEntities,n="converse.disco-items-".concat(this.get("jid")),this.items.browserStorage=Hc.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,Gc.trigger("serviceDiscovered",e)},onFieldAdded(e){e.entity=this,Gc.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 Gc.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(_l.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=Hc.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 Gc.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(_l.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(_l.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")}}),Hc.DiscoEntities=ta.extend({model:Hc.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:_l.NS.DISCO_INFO};t&&(r.node=t);const i=bl({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()),Gc.send(i.tree()),!0}async function i(){Gc.disco.own.identities.add("client","web","Converse"),Gc.disco.own.features.add(_l.NS.CHATSTATES),Gc.disco.own.features.add(_l.NS.DISCO_INFO),Gc.disco.own.features.add(_l.NS.ROSTERX),Gc.settings.get("message_carbons")&&Gc.disco.own.features.add(_l.NS.CARBONS),Gc.trigger("addClientFeatures"),Hc.connection.addHandler(r,_l.NS.DISCO_INFO,"iq","get",null,null),Hc.disco_entities=new Hc.DiscoEntities;const e="converse.disco-entities-".concat(Hc.bare_jid);Hc.disco_entities.browserStorage=Hc.createStore(e,"session");const t=await Hc.disco_entities.fetchEntities();0!==t.length&&t.get(Hc.domain)||Hc.disco_entities.create({jid:Hc.domain}),Gc.trigger("discoInitialized")}n._identities=[],n._features=[],Gc.listen.on("userSessionInitialized",async()=>{e(),Hc.connfeedback.get("connection_status")===_l.Status.ATTACHED&&(await new Promise((e,t)=>Hc.stream_features.fetch({success:e,error:t})),t())}),Gc.listen.on("beforeResourceBinding",(function(){e(),Array.from(Hc.connection.features.childNodes).forEach(e=>{Hc.stream_features.create({name:e.nodeName,xmlns:e.getAttribute("xmlns")})}),t()})),Gc.listen.on("reconnected",i),Gc.listen.on("connected",i),Gc.listen.on("beforeTearDown",async()=>{Gc.promises.add("streamFeaturesAdded"),Hc.stream_features&&(await Hc.stream_features.clearStore(),delete Hc.stream_features)}),Gc.listen.on("clearSession",()=>{Hc.shouldClearCache()&&Hc.disco_entities&&(Array.from(Hc.disco_entities.models).forEach(e=>e.features.clearStore()),Array.from(Hc.disco_entities.models).forEach(e=>e.identities.clearStore()),Array.from(Hc.disco_entities.models).forEach(e=>e.dataforms.clearStore()),Array.from(Hc.disco_entities.models).forEach(e=>e.fields.clearStore()),Hc.disco_entities.clearStore(),delete Hc.disco_entities)}),Object.assign(Gc,{disco:{stream:{async getFeature(e,t){if(await Gc.waitUntil("streamFeaturesAdded"),!e||!t)throw new Error("name and xmlns need to be provided when calling disco.stream.getFeature");if(void 0!==Hc.stream_features||Gc.connection.connected())return Hc.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:_l.NS.DISCO_INFO};t&&(n.node=t);const r=bl({from:Hc.connection.jid,to:e,type:"get"}).c("query",n);return Gc.sendIQ(r)},items(e,t){const n={xmlns:_l.NS.DISCO_ITEMS};return t&&(n.node=t),Gc.sendIQ(bl({from:Hc.connection.jid,to:e,type:"get"}).c("query",n))},entities:{async get(e,t=!1){if(await Gc.waitUntil("discoInitialized"),!e)return Hc.disco_entities;if(void 0===Hc.disco_entities&&!Gc.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=Hc.disco_entities.get(e);return n||!t?n:Gc.disco.entities.create(e)},create:(e,t)=>Hc.disco_entities.create({jid:e},t)},features:{async get(e,t){if(!t)throw new TypeError("You need to provide an entity JID");await Gc.waitUntil("discoInitialized");let n=await Gc.disco.entities.get(t,!0);if(void 0===Hc.disco_entities&&!Gc.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 Gc.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 Gc.waitUntil("discoInitialized");let t=await Gc.disco.entities.get(e);return t?(t.features.reset(),t.fields.reset(),t.identities.reset(),t.waitUntilFeaturesDiscovered.isPending||(t.waitUntilFeaturesDiscovered=yl.getResolveablePromise()),t.queryInfo()):t=await Gc.disco.entities.create(e,{ignore_cache:!0}),t.waitUntilFeaturesDiscovered},refreshFeatures:e=>Gc.refresh(e),async getFeatures(e){if(!e)throw new TypeError("api.disco.getFeatures: You need to provide an entity JID");await Gc.waitUntil("discoInitialized");let t=await Gc.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 Gc.waitUntil("discoInitialized");let t=await Gc.disco.entities.get(e,!0);return t=await t.waitUntilFeaturesDiscovered,t.fields},async getIdentity(e,t,n){const r=await Gc.disco.entities.get(n,!0);if(void 0!==r||Gc.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 wl=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"),Sl=/(?:\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 xl(){const e=jl(['<img class="emoji"\n draggable="false"\n title="','"\n alt="','"\n src="','">']);return xl=function(){return e},e}function El(){const e=jl(['<img class="emoji"\n draggable="false"\n title="','"\n alt="','"\n src="',"/72x72/",'.png"/>']);return El=function(){return e},e}function Al(){const e=jl(['<span title="','">',"</span>"]);return Al=function(){return e},e}function jl(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 Cl=rl.env.utils;rl.emojis={initialized:!1,initialized_promise:Cl.getResolveablePromise()};const kl={"*\\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 Ol(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 Tl(){var e;return rl.emojis.toned||(rl.emojis.toned=(e=Object.values(rl.emojis.json.people).filter(e=>e.sn.includes("_tone")).map(e=>e.sn.replace(/_tone[1-5]/,"")),[...new Set(e)])),rl.emojis.toned}function Nl(e){return e.replace(wl,(e,t,n,r)=>{if(void 0===r||""===r||!(Cl.unescapeHTML(r)in kl))return e;r=Cl.unescapeHTML(r);return n+Ol(kl[r].toUpperCase())})}function Il(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(Gc.settings.get("use_system_emojis"))return t.add_title_wrapper&&r?Xa(Al(),r,n):n;{const t=Gc.settings.get("emoji_image_path");return Xa(El(),r,n,t,e.cp)}}return t.unicode_only?r:Xa(xl(),r,r,rl.emojis.by_sn[r].url)}function Ml(e){if(!rl.emojis.initialized)throw new Error("getShortnameReferences called before emojis are initialized. To avoid this problem, first await the converse.emojis.initilaized_promise.");return[...e.matchAll(rl.emojis.shortnames_regex)].filter(e=>e[0].length>0).map(e=>{const t=rl.emojis.by_sn[e[0]].cp;return{cp:t,begin:e.index,end:e.index+e[0].length,shortname:e[0],emoji:t?Ol(t):null}})}function Rl(e){const t=[];return function(e,t){const n=/\uFE0F/g,r=String.fromCharCode(8205);String(e).replace(Sl,(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=Cl.getEmojisByAtrribute("cp")[e])||void 0===i?void 0:i.sn)||""})}),t}rl.plugins.add("converse-emoji",{initialize(){const{___:e}=Hc;Gc.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")}}),Hc.EmojiPicker=Fo.extend({defaults:{current_category:"smileys",current_skintone:"",scroll_position:0}});const t={};Object.assign(Cl,{shortnamesToEmojis:(e,t={unicode_only:!1,add_title_wrapper:!1})=>function(e,t){let n=[e];return[...Ml(e),...Rl(e)].sort((e,t)=>t.begin-e.begin).forEach(e=>{const r=n.shift(),i=Il(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=Nl(e),t),shortnamesToUnicode:e=>Cl.shortnamesToEmojis(e,{unicode_only:!0})[0],isOnlyEmojis(e){const t=e.trim().split(/\s+/);if(0===t.length||t.length>3)return!1;return t.filter(e=>{const t=Rl(Cl.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 rl.emojis.json;const n=rl.emojis.list.map(t=>t[e]).filter((e,t,n)=>n.indexOf(e)==t);return t[e]={},n.forEach(n=>t[e][n]=rl.emojis.list.find(t=>t[e]===n)),t[e]}}),Object.assign(Gc,{emojis:{async initialize(){if(!rl.emojis.initialized){rl.emojis.initialized=!0;const{default:e}=await n.e(137).then(n.t.bind(null,539,3));rl.emojis.json=e,rl.emojis.by_sn=Object.keys(e).reduce((t,n)=>Object.assign(t,e[n]),{}),rl.emojis.list=Object.values(rl.emojis.by_sn),rl.emojis.list.sort((e,t)=>e.sn<t.sn?-1:e.sn>t.sn?1:0),rl.emojis.shortnames=rl.emojis.list.map(e=>e.sn);const t=()=>rl.emojis.shortnames.map(e=>e.replace(/[+]/g,"\\$&")).join("|");rl.emojis.shortnames_regex=new RegExp(t(),"gi"),rl.emojis.toned=Tl(),rl.emojis.initialized_promise.resolve()}return rl.emojis.initialized_promise}}})}});var Dl=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 Pl=function(e,t){return Dl(e||[],t||[],we)},zl=Math.min;var Ll=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=Fr(u,ze(t))),c=zl(u.length,c),a[s]=!n&&(t||i>=120&&u.length>=120)?new Gi(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?Qi(h,p):r(l,p,n))){for(s=o;--s;){var g=a[s];if(!(g?Qi(g,p):r(e[s],p,n)))continue e}h&&h.push(p),l.push(f)}}return l};var Fl=function(e){return Cs(e)?e:[]},Bl=Ar((function(e){var t=Fr(e,Fl);return t.length&&t[0]===e[0]?Ll(t):[]}));
/**
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
* @description This is the MUC utilities module.
*/
const{Strophe:ql,sizzle:Ul}=rl.env;var Hl={computeAffiliationsDelta(e,t,n,r){const i=n.map(e=>e.jid),o=r.map(e=>e.jid);let s=ks(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(ks(o,i).map(e=>({jid:e,affiliation:"none"})))),s},parseMemberListIQ:e=>Ul('query[xmlns="'.concat(ql.NS.MUC_ADMIN,'"] item'),e).map(e=>{const t={affiliation:e.getAttribute("affiliation")},n=e.getAttribute("jid");Vo.isValidJID(n)?t.jid=n:t.nick=n;const r=e.getAttribute("nick");r&&(t.nick=r);return 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.
*/Vo.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?Vo.getSelectValues(e):e.value,Vo.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 $l=Vo;
/**
* @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 Wl={},Vl=(e,t)=>e.replace(RegExp("\\"+t,"ig"),"\\"+t);Wl.escapeCharacters=e=>t=>e.split("").reduce(Vl,t),Wl.escapeRegexString=Wl.escapeCharacters("[\\^$.?*+(){}"),Wl.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 Gl=([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,{...n,begin:o,end:s}]]};Wl.reduceTextFromReferences=(e,t)=>t.reduce(Gl,[e,[]]);var Jl=Wl;
/**
* @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 Ql=["moderator","participant","visitor"],Yl=["owner","admin","member","outcast","none"];rl.MUC_TRAFFIC_STATES=["entered","exited"],rl.MUC_ROLE_CHANGES=["op","deop","voice","mute"];const Kl=["301","303","333","307","321","322"],Xl={moderator:1,participant:2,visitor:3,none:2},{Strophe:Zl,$iq:eu,$build:tu,$msg:nu,$pres:ru,sizzle:iu}=rl.env;Zl.addNamespace("MUC_ADMIN",Zl.NS.MUC+"#admin"),Zl.addNamespace("MUC_OWNER",Zl.NS.MUC+"#owner"),Zl.addNamespace("MUC_REGISTER","jabber:iq:register"),Zl.addNamespace("MUC_ROOMCONF",Zl.NS.MUC+"#roomconfig"),Zl.addNamespace("MUC_USER",Zl.NS.MUC+"#user"),Zl.addNamespace("MUC_HATS","xmpp:prosody.im/protocol/hats:1"),rl.MUC_NICK_CHANGED_CODE="303",rl.ROOM_FEATURES=["passwordprotected","unsecured","hidden","publicroom","membersonly","open","persistent","temporary","nonanonymous","semianonymous","moderated","unmoderated","mam_enabled"],rl.ROOMSTATUS={CONNECTED:0,CONNECTING:1,NICKNAME_REQUIRED:2,PASSWORD_REQUIRED:3,DISCONNECTED:4,ENTERED:5,DESTROYED:6},rl.plugins.add("converse-muc",{dependencies:["converse-chatboxes","converse-chat","converse-disco","converse-controlbox"],overrides:{ChatBoxes:{model(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}=Hc;if(Gc.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}),Gc.promises.add(["roomsAutoJoined"]),Gc.settings.get("locked_muc_domain")&&"string"!=typeof Gc.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");Hc.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")}},Hc.router.route("converse/room?jid=:jid",(async function(e){if(!$l.isValidMUCJID(e))return Pn.warn('invalid jid "'.concat(e,'" provided in url fragment'));await Gc.waitUntil("roomsAutoJoined"),Gc.settings.get("allow_bookmarks")&&await Gc.waitUntil("bookmarksInitialized"),Gc.rooms.open(e)})),Hc.getDefaultMUCNickname=function(){if(!Hc.xmppstatus)throw new Error("Can't call _converse.getDefaultMUCNickname before the statusInitialized has been fired.");const e=Hc.xmppstatus.getNickname();return e||(Gc.settings.get("muc_nickname_from_jid")?Zl.unescapeNode(Zl.getNodeFromJid(Hc.bare_jid)):void 0)},Hc.ChatRoomMessage=Hc.Message.extend({initialize(){this.checkValidity()&&(this.get("file")&&this.on("change:put",this.uploadFile,this),this.setTimerForEphemeralMessage()||this.setOccupant(),Gc.trigger("chatRoomMessageInitialized",this))},mayBeModerated(){return["all","moderator"].includes(Gc.settings.get("allow_message_retraction"))&&this.collection.chatbox.canModerateMessages()},checkValidity(){const e=Hc.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")===Zl.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=Zl.getResourceFromJid(this.get("from"));if(this.occupant=t.occupants.findWhere({nick:n}),!this.occupant&&Gc.settings.get("muc_send_probes")){this.occupant=t.occupants.create({nick:n,type:"unavailable"});const e="".concat(t.get("jid"),"/").concat(n);Gc.user.presence.send("probe",e)}this.occupant?this.listenTo(this.occupant,"destroy",this.onOccupantRemoved):this.listenTo(t.occupants,"add",this.onOccupantAdded)}});const n=Fo.extend({defaults:()=>({connection_status:rl.ROOMSTATUS.DISCONNECTED})});if(Hc.ChatRoomMessages=ta.extend({model:Hc.ChatRoomMessage,comparator:"time"}),Hc.ChatRoom=Hc.ChatBox.extend({messagesCollection:Hc.ChatRoomMessages,defaults(){return{num_unread_general:0,bookmarked:!1,chat_state:void 0,hidden:Hc.isUniView()&&!Gc.settings.get("singleton"),hidden_occupants:!!Gc.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:Hc.CHATROOMS_TYPE}},async initialize(){this.initialized=$l.getResolveablePromise(),this.debouncedRejoin=Rc(this.rejoin,250),this.set("box_id","box-".concat(this.get("jid"))),this.initNotifications(),this.initMessages(),this.initOccupants(),this.initDiscoModels(),this.registerHandlers(),this.on("change:chat_state",this.sendChatState,this),await this.restoreSession(),this.session.on("change:connection_status",this.onConnectionStatusChanged,this),this.listenTo(this.occupants,"add",this.onOccupantAdded),this.listenTo(this.occupants,"remove",this.onOccupantRemoved),this.listenTo(this.occupants,"change:show",this.onOccupantShowChanged),this.listenTo(this.occupants,"change:affiliation",this.createAffiliationChangeMessage),this.listenTo(this.occupants,"change:role",this.createRoleChangeMessage);await this.restoreFromCache()||this.join(),await Gc.trigger("chatRoomInitialized",this,{Synchronous:!0}),this.initialized.resolve()},async restoreFromCache(){return this.session.get("connection_status")===rl.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")===rl.ROOMSTATUS.ENTERED)return this;if(await this.refreshDiscoInfo(),!(e=await this.getAndPersistNickname(e)))return $l.safeSave(this.session,{connection_status:rl.ROOMSTATUS.NICKNAME_REQUIRED}),Gc.settings.get("muc_show_logs_before_join")&&await this.fetchMessages(),this;const n=ru({from:Hc.connection.jid,to:this.getRoomJIDAndNick()}).c("x",{xmlns:Zl.NS.MUC}).c("history",{maxstanzas:this.features.get("mam_enabled")?0:Gc.settings.get("muc_history_max_stanzas")}).up();return(t=t||this.get("password"))&&n.cnode(Zl.xmlElement("password",[],t)),this.session.save("connection_status",rl.ROOMSTATUS.CONNECTING),Gc.send(n),this},async clearCache(){this.session.save("connection_status",rl.ROOMSTATUS.DISCONNECTED),this.occupants.length?this.occupants.filter(e=>!e.isMember()).forEach(e=>e.destroy()):this.occupants.clearStore(),Gc.settings.get("clear_messages_on_reconnection")&&await this.clearMessages()},onOccupantAdded(e){Gc.settings.get("muc_show_join_leave")&&this.session.get("connection_status")===rl.ROOMSTATUS.ENTERED&&"online"===e.get("show")&&this.updateNotifications(e.get("nick"),"entered")},onOccupantRemoved(e){Gc.settings.get("muc_show_join_leave")&&this.session.get("connection_status")===rl.ROOMSTATUS.ENTERED&&"online"===e.get("show")&&this.updateNotifications(e.get("nick"),"exited")},onOccupantShowChanged(e){!e.get("states").includes("303")&&Gc.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")===rl.ROOMSTATUS.ENTERED&&(await this.occupants.fetchMembers(),await this.fetchMessages(),Gc.trigger("enteredNewRoom",this),Gc.settings.get("auto_register_muc_nickname")&&await Gc.disco.supports(Zl.NS.MUC_REGISTER,this.get("jid"))&&this.registerNickname())},async onReconnection(){this.registerHandlers(),await this.rejoin(),this.announceReconnection()},restoreSession(){const e="muc.session-".concat(Hc.bare_jid,"-").concat(this.get("jid"));return this.session=new n({id:e}),this.session.browserStorage=Hc.createStore(e,"session"),new Promise(e=>this.session.fetch({success:e,error:e}))},initDiscoModels(){let e="converse.muc-features-".concat(Hc.bare_jid,"-").concat(this.get("jid"));this.features=new Fo(Object.assign({id:e},Pl(rl.ROOM_FEATURES,rl.ROOM_FEATURES.map(()=>!1)))),this.features.browserStorage=Hc.createStore(e,"session"),e="converse.muc-config-{_converse.bare_jid}-".concat(this.get("jid")),this.config=new Fo,this.config.browserStorage=Hc.createStore(e,"session")},initOccupants(){this.occupants=new Hc.ChatRoomOccupants;const e="converse.occupants-".concat(Hc.bare_jid).concat(this.get("jid"));this.occupants.browserStorage=Hc.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=iu('x[xmlns="'.concat(Zl.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:Zl.getNodeFromJid(o),states:[],show:"unavailable"==r?"offline":"online",role:t.getAttribute("role"),jid:Zl.getBareJidFromJid(o),resource:Zl.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,Hc);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,Hc),n={stanza:e,attrs:t,chatbox:this};return Gc.trigger("message",n),t&&this.queueMessage(t)},registerHandlers(){const e=this.get("jid");this.removeHandlers(),this.presence_handler=Hc.connection.addHandler(e=>this.onPresence(e)||!0,null,"presence",null,null,e,{ignoreNamespaceFragment:!0,matchBareFromJid:!0}),this.message_handler=Hc.connection.addHandler(e=>!!this.handleMessageStanza(e)||!0,null,"message","groupchat",null,e,{matchBareFromJid:!0}),this.affiliation_message_handler=Hc.connection.addHandler(e=>this.handleAffiliationChangedMessage(e)||!0,Zl.NS.MUC_USER,"message",null,null,e)},removeHandlers(){return this.message_handler&&(Hc.connection&&Hc.connection.deleteHandler(this.message_handler),delete this.message_handler),this.presence_handler&&(Hc.connection&&Hc.connection.deleteHandler(this.presence_handler),delete this.presence_handler),this.affiliation_message_handler&&(Hc.connection&&Hc.connection.deleteHandler(this.affiliation_message_handler),delete this.affiliation_message_handler),this},invitesAllowed(){return Gc.settings.get("allow_muc_invitations")&&(this.features.get("open")||"owner"===this.getOwnAffiliation())},getDisplayName(){const e=this.get("name");return e||("hidden"===Gc.settings.get("locked_muc_domain")?Zl.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=$l.getResolveablePromise(),r=Hc.connection.addTimedHandler(Hc.STANZA_TIMEOUT,()=>(Hc.connection.deleteHandler(i),n.reject(new Hc.TimeoutError("Timeout Error: No response from server")),!1)),i=Hc.connection.addHandler(e=>{r&&Hc.connection.deleteTimedHandler(r),"groupchat"===e.getAttribute("type")?n.resolve(e):n.reject(e)},null,"message",["error","groupchat"],t);return Gc.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=nu({id:$l.getUniqueId(),to:this.get("jid"),type:"groupchat"}).c("store",{xmlns:Zl.NS.HINTS}).up().c("apply-to",{id:n,xmlns:Zl.NS.FASTEN}).c("retract",{xmlns:Zl.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:Hc.bare_jid,moderated_id:e.get("msgid"),moderation_reason:t,editable:!1});const r=await this.sendRetractionIQ(e,t);return(null===r||$l.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=eu({to:this.get("jid"),type:"set"}).c("apply-to",{id:e.get("stanza_id ".concat(this.get("jid"))),xmlns:Zl.NS.FASTEN}).c("moderate",{xmlns:Zl.NS.MODERATE}).c("retract",{xmlns:Zl.NS.RETRACT}).up().c("reason").t(t||"");return Gc.sendIQ(n,null,!1)},sendDestroyIQ(e,t){const n=tu("destroy");t&&n.attrs({jid:t});const r=eu({to:this.get("jid"),type:"set"}).c("query",{xmlns:Zl.NS.MUC_OWNER}).cnode(n.node);return e&&e.length>0&&r.c("reason",e),Gc.sendIQ(r)},async leave(e){if(this.features.destroy(),this.occupants.clearStore(),Hc.disco_entities){const e=Hc.disco_entities.get(this.get("jid"));e&&await new Promise((t,n)=>e.destroy({success:t,error:n}))}Gc.connection.connected()&&Gc.user.presence.send("unavailable",this.getRoomJIDAndNick(),e),$l.safeSave(this.session,{connection_status:rl.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()}})),Hc.ChatBox.prototype.close.call(this)},canModerateMessages(){const e=this.getOwnOccupant();return e&&e.isModerator()&&Gc.disco.supports(Zl.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=Jl.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||!/(\p{P}|\p{Z}|^)([@][\w_-]+(?:\.\w+)*)/giu.test(e))return[e,[]];const t=Jl.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]=Jl.reduceTextFromReferences(e,i);return[o,s]},getOutgoingMessageAttributes(e,t){const n=this.get("composing_spoiler"),[r,i]=this.parseTextForReferences(e),o=$l.getUniqueId(),s=r?$l.httpToGeoUri($l.shortnamesToUnicode(r),Hc):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&&$l.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 Zl.getBareJidFromJid(this.get("jid"))+(null!==e?"/".concat(e):"")},sendChatState(){if(!Gc.settings.get("send_chat_state_notifications")||!this.get("chat_state")||this.session.get("connection_status")!==rl.ROOMSTATUS.ENTERED||this.features.get("moderated")&&"visitor"===this.getOwnRole())return;const e=Gc.settings.get("send_chat_state_notifications");if(Array.isArray(e)&&!e.includes(this.get("chat_state")))return;const t=this.get("chat_state");t!==Hc.GONE&&Gc.send(nu({to:this.get("jid"),type:"groupchat"}).c(t,{xmlns:Zl.NS.CHATSTATES}).up().c("no-store",{xmlns:Zl.NS.HINTS}).up().c("no-permanent-store",{xmlns:Zl.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=nu({from:Hc.connection.jid,to:e,id:$l.getUniqueId()}).c("x",n);Gc.send(r),Gc.trigger("roomInviteSent",{room:this,recipient:e,reason:t})},refreshDiscoInfo(){return Gc.disco.refresh(this.get("jid")).then(()=>this.getDiscoInfo()).catch(e=>Pn.error(e))},getDiscoInfo(){return Gc.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 Gc.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 Gc.disco.getFeatures(this.get("jid")),t=Object.assign(Pl(rl.ROOM_FEATURES,rl.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===Zl.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=>tu("value").t(e)).join("")}return e},async autoConfigureChatRoom(){const e=await this.fetchRoomConfiguration(),t=iu("field",e).map(e=>this.addFieldValue(e));if(t.length)return this.sendConfiguration(t)},fetchRoomConfiguration(){return Gc.sendIQ(eu({to:this.get("jid"),type:"get"}).c("query",{xmlns:Zl.NS.MUC_OWNER}))},sendConfiguration(e=[]){const t=eu({to:this.get("jid"),type:"set"}).c("query",{xmlns:Zl.NS.MUC_OWNER}).c("x",{xmlns:Zl.NS.XFORM,type:"submit"});return e.forEach(e=>t.cnode(e).up()),Gc.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:Hc.bare_jid})},sendAffiliationIQ(e,t){const n=eu({to:this.get("jid"),type:"set"}).c("query",{xmlns:Zl.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),Gc.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=tu("item",{nick:e.get("nick"),role:t}),s=eu({to:this.get("jid"),type:"set"}).c("query",{xmlns:Zl.NS.MUC_ADMIN}).cnode(o.node);return null!==n&&s.c("reason",n),Gc.sendIQ(s).then(r).catch(i)},getOccupant(e){return $l.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=eu({to:this.get("jid"),type:"get"}).c("query",{xmlns:Zl.NS.MUC_ADMIN}).c("item",{affiliation:e}),n=await Gc.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($l.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 Hl.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)=>$l.isErrorObject(t)?e:[...t,...e],[]);await this.setAffiliations(Hl.computeAffiliationsDelta(!0,!1,e,t)),await this.occupants.fetchMembers()},async getAndPersistNickname(e){return(e=e||this.get("nick")||await this.getReservedNick()||Hc.getDefaultMUCNickname())&&this.save({nick:e},{silent:!0}),e},async getReservedNick(){const e=eu({to:this.get("jid"),from:Hc.connection.jid,type:"get"}).c("query",{xmlns:Zl.NS.DISCO_INFO,node:"x-roomuser-item"}),t=await Gc.sendIQ(e,null,!1);if($l.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 Gc.sendIQ(eu({to:n,from:Hc.connection.jid,type:"get"}).c("query",{xmlns:Zl.NS.MUC_REGISTER}))}catch(t){return iu('not-allowed[xmlns="'.concat(Zl.NS.STANZAS,'"]'),t).length?i=e("You're not allowed to register yourself in this groupchat."):iu('registration-required[xmlns="'.concat(Zl.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=iu("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 Gc.sendIQ(eu({to:n,from:Hc.connection.jid,type:"set"}).c("query",{xmlns:Zl.NS.MUC_REGISTER}).c("x",{xmlns:Zl.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 iu('service-unavailable[xmlns="'.concat(Zl.NS.STANZAS,'"]'),t).length?i=e("Can't register your nickname in this groupchat, it doesn't support registration."):iu('bad-request[xmlns="'.concat(Zl.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(rl.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:Zl.getBareJidFromJid(o)||(null==i||null===(t=i.attributes)||void 0===t?void 0:t.jid),resource:Zl.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"];iu("status",e).filter(e=>t.includes(e.getAttribute("status"))).length&&this.refreshDiscoInfo()},isSameUser(e,t){const n=Zl.getBareJidFromJid(e),r=Zl.getBareJidFromJid(t),i=Zl.getResourceFromJid(e),o=Zl.getResourceFromJid(t);if($l.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 Gc.user.settings.get("mucs_with_hidden_subject",[])).includes(this.get("jid"))},async toggleSubjectHiddenState(){const e=this.get("jid"),t=await Gc.user.settings.get("mucs_with_hidden_subject",[]);t.includes(this.get("jid"))?Gc.user.settings.set("mucs_with_hidden_subject",t.filter(t=>t!==e)):Gc.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($l.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=""){Gc.send(nu({to:this.get("jid"),from:Hc.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 Hc.Message?e.get("from"):e.from,Zl.getResourceFromJid(t)==this.get("nick")},getUpdatedMessageAttributes(e,t){const n=Hc.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,Lo(t,r)),e.get("received")||(n.received=(new Date).toISOString())}return n},async isJoined(){const e=this.get("jid"),t=eu({to:"".concat(e,"/").concat(this.get("nick")),type:"get"}).c("ping",{xmlns:Zl.NS.PING});try{await Gc.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())&&Hc.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(Lo(e,t)),!0):(e.dangling_moderation=!0,await this.createMessage(e),!0)}{const n=this.findDanglingModeration(e);if(n){const r=Lo(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=rl.CHAT_STATES.reduce(i,{}),s=rl.MUC_TRAFFIC_STATES.reduce(i,{}),a=rl.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,$l.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),$l.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")===rl.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=iu('x[xmlns="'.concat(Zl.NS.MUC_USER,'"]'),e).pop();if(!r)return;const i=iu("status",r).map(e=>e.getAttribute("code")),o=Bl(i,Object.keys(Hc.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?Pc(s.querySelector("actor"),"getAttribute","nick"):void 0,l=Hc.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 Hc.muc.info_messages)i.message=Hc.muc.info_messages[t];else if(!r&&Kl.includes(t)){var o,s;const e=Zl.getResourceFromJid(n.getAttribute("from")),r=n.querySelector('x[xmlns="'.concat(Zl.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 Hc.muc.new_nickname_messages){let o;r&&"210"===t?o=Zl.getResourceFromJid(n.getAttribute("from")):r&&"303"===t&&(o=n.querySelector('x[xmlns="'.concat(Zl.NS.MUC_USER,'"] item')).getAttribute("nick")),this.save("nick",o),i.message=e(Hc.muc.new_nickname_messages[t],o)}if(i.message){if("201"===t&&this.messages.findWhere(i))return;if(t in Hc.muc.info_messages&&this.messages.length&&this.messages.pop().get("message")===i.message)return;this.createMessage(i)}}},createInfoMessages(e){const t=iu('x[xmlns="'.concat(Zl.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:rl.ROOMSTATUS.DISCONNECTED})},onNicknameClash(t){if(Gc.settings.get("muc_nickname_from_jid")){const e=t.getAttribute("from").split("/")[1];if(e===Hc.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:rl.ROOMSTATUS.NICKNAME_REQUIRED})},onErrorPresence(t){var n;const r=t.querySelector("error"),i=r.getAttribute("type"),o=null===(n=iu('text[xmlns="'.concat(Zl.NS.STANZAS,'"]'),r).pop())||void 0===n?void 0:n.textContent;if("modify"===i)this.handleModifyError(t);else if("auth"===i){if(iu('not-authorized[xmlns="'.concat(Zl.NS.STANZAS,'"]'),r).length&&(this.save({password_validation_message:o||e("Password incorrect")}),this.session.save({connection_status:rl.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(iu('gone[xmlns="'.concat(Zl.NS.STANZAS,'"]'),r).length){var s;const e=null===(s=iu('gone[xmlns="'.concat(Zl.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:rl.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")===rl.ROOMSTATUS.CONNECTING&&this.session.save("connection_status",rl.ROOMSTATUS.CONNECTED)):this.updateOccupantsOnPresence(e)},onOwnPresence(e){if("unavailable"!==e.getAttribute("type")){const t=this.session.get("connection_status");t!==rl.ROOMSTATUS.ENTERED?(this.session.save("connection_status",rl.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(!Gc.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:rl.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&&e.get("body")&&$l.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()),$l.safeSave(this,{num_unread:0,num_unread_general:0})}}),Hc.ChatRoomOccupant=Fo.extend({defaults:{hats:[],show:"offline",states:[]},initialize(e){this.set(Object.assign({id:$l.getUniqueId()},e)),this.on("change:image_hash",this.onAvatarChanged,this)},onAvatarChanged(){const e=this.get("image_hash"),t=[];this.get("jid")&&t.push(Hc.vcards.findWhere({jid:this.get("jid")})),t.push(Hc.vcards.findWhere({jid:this.get("from")})),t.filter(e=>e).forEach(t=>{e&&t.get("image_hash")!==e&&Gc.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")}}),Hc.ChatRoomOccupants=ta.extend({model:Hc.ChatRoomOccupant,comparator(e,t){const n=e.get("role")||"none",r=t.get("role")||"none";if(Xl[n]===Xl[r]){const n=e.getDisplayName().toLowerCase(),r=t.getDisplayName().toLowerCase();return n<r?-1:n>r?1:0}return Xl[n]<Xl[r]?-1:1},getAutoFetchedAffiliationLists(){const e=Gc.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)=>$l.isErrorObject(t)?e:[...t,...e],[]),r=e.filter(n=>!$l.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")!==Hc.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)}),Gc.trigger("membersFetched")},findOccupant(e){const t=Zl.getBareJidFromJid(e.jid);return t&&this.findWhere({jid:t})||this.findWhere({nick:e.nick})}}),Hc.RoomsPanelModel=Fo.extend({defaults:function(){return{muc_domain:Gc.settings.get("muc_domain"),nick:Hc.getDefaultMUCNickname()}},setDomain(e){Gc.settings.get("locked_muc_domain")||this.save("muc_domain",Zl.getDomainFromJid(e))}}),Hc.onDirectMUCInvitation=async function(t){const n=iu('x[xmlns="jabber:x:conference"]',t).pop(),r=Zl.getBareJidFromJid(t.getAttribute("from")),i=n.getAttribute("jid"),o=n.getAttribute("reason");let s;if(Gc.settings.get("auto_join_on_invite"))s=!0;else{let t=Hc.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=Hc.CHATROOMS_TYPE,t.id=e;const n=await Gc.rooms.get(e,t,!0);return n.maybeShow(!0),n}(i,{password:n.getAttribute("password")})).session.get("connection_status")===rl.ROOMSTATUS.DISCONNECTED&&Hc.chatboxes.get(i).rejoin()}},Gc.settings.get("allow_muc_invitations")){const e=function(){Hc.connection.addHandler(e=>(Hc.onDirectMUCInvitation(e),!0),"jabber:x:conference","message")};Gc.listen.on("connected",e),Gc.listen.on("reconnected",e)}function r(){return Hc.chatboxes.filter(e=>e.get("type")===Hc.CHATROOMS_TYPE).forEach(e=>e.session.save({connection_status:rl.ROOMSTATUS.DISCONNECTED}))}Gc.listen.on("beforeTearDown",()=>{Hc.chatboxes.where({type:Hc.CHATROOMS_TYPE}).forEach(e=>$l.safeSave(e.session,{connection_status:rl.ROOMSTATUS.DISCONNECTED}))}),Gc.listen.on("windowStateChanged",(async function(e){if("visible"===e.state&&Gc.connection.connected()){(await Gc.rooms.get()).forEach(e=>e.rejoinIfNecessary())}})),Gc.listen.on("addClientFeatures",()=>{Gc.settings.get("allow_muc")&&Gc.disco.own.features.add(Zl.NS.MUC),Gc.settings.get("allow_muc_invitations")&&Gc.disco.own.features.add("jabber:x:conference")}),Gc.listen.on("chatBoxesFetched",(async function(){await Promise.all(Gc.settings.get("auto_join_rooms").map(e=>"string"==typeof e?Hc.chatboxes.where({jid:e}).length?Promise.resolve():Gc.rooms.open(e):N(e)?Gc.rooms.open(e.jid,{...e}):(Pn.error('Invalid muc criteria specified for "auto_join_rooms"'),Promise.resolve()))),Gc.trigger("roomsAutoJoined")})),Gc.listen.on("beforeResourceBinding",()=>{Hc.connection.addHandler(e=>{const t=Zl.getBareJidFromJid(e.getAttribute("from"));return Hc.chatboxes.get(t)||Gc.waitUntil("chatBoxesFetched").then(async()=>{const n=Hc.chatboxes.get(t);n&&(await n.initialized,n.message_handler.run(e))}),!0},null,"message","groupchat")}),Gc.listen.on("disconnected",r),Gc.listen.on("statusInitialized",()=>{window.addEventListener(Hc.unloadevent,()=>{!Gc.connection.isType("websocket")||Gc.settings.get("enable_smacks")&&Hc.session.get("smacks_stream_id")||r()})}),rl.env.muc_utils=Hl,Object.assign(Gc,{rooms:{create(e,t={}){if(!(t="string"==typeof t?{nick:t}:t||{}).nick&&Gc.settings.get("muc_nickname_from_jid")&&(t.nick=Zl.getNodeFromJid(Hc.bare_jid)),void 0===e)throw new TypeError("rooms.create: You need to provide at least one JID");return"string"==typeof e?Gc.rooms.get($l.getJIDFromURI(e),t,!0):e.map(e=>Gc.rooms.get($l.getJIDFromURI(e),t,!0))},async open(e,t={},n=!1){if(await Gc.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 Gc.rooms.get(e,t,!0);return r&&r.maybeShow(n),r}{const r=await Promise.all(e.map(e=>Gc.rooms.get(e,t,!0)));return r.forEach(e=>e.maybeShow(n)),r}},async get(e,t={},n=!1){async function r(e){e=$l.getJIDFromURI(e);let r=await Gc.chatboxes.get(e);return!r&&n?r=await Gc.chatboxes.create(e,t,Hc.ChatRoom):(r=r&&r.get("type")===Hc.CHATROOMS_TYPE?r:null,r&&Object.keys(t).length&&r.save(t)),r}if(void 0===e){return(await Gc.chatboxes.get()).filter(e=>e.get("type")===Hc.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:ou,$iq:su,sizzle:au}=rl.env,cu=rl.env.utils;function lu(e){return au('event[xmlns="'.concat(ou.NS.PUBSUB,'#event"] items[node="').concat(ou.NS.BOOKMARKS,'"]'),e).length&&Gc.waitUntil("bookmarksInitialized").then(()=>Hc.bookmarks.createBookmarksFromStanza(e)).catch(e=>Pn.fatal(e)),!0}ou.addNamespace("BOOKMARKS","storage:bookmarks"),rl.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}=Hc;Gc.settings.extend({allow_bookmarks:!0,allow_public_bookmarks:!1,muc_respect_autojoin:!0}),Gc.promises.add("bookmarksInitialized"),Hc.getNicknameFromBookmark=function(e){if(!Hc.bookmarks||!Gc.settings.get("allow_bookmarks"))return null;const t=Hc.bookmarks.findWhere({jid:e});return t?t.get("nick"):void 0},Hc.Bookmark=Fo.extend({idAttribute:"jid",getDisplayName(){return ou.xmlunescape(this.get("name"))}}),Hc.Bookmarks=ta.extend({model:Hc.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(Hc.bare_jid);this.fetched_flag=e+"fetched",this.browserStorage=Hc.createStore(e)},async openBookmarkedRoom(e){if(Gc.settings.get("muc_respect_autojoin")&&e.get("autojoin")){(await Gc.rooms.create(e.get("jid"),{nick:e.get("nick")})).maybeShow()}return e},fetchBookmarks(){const e=cu.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=su({type:"set",from:Hc.connection.jid}).c("pubsub",{xmlns:ou.NS.PUBSUB}).c("publish",{node:ou.NS.BOOKMARKS}).c("item",{id:"current"}).c("storage",{xmlns:ou.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:ou.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"),Gc.sendIQ(e)},onBookmarkError(t,n){Pn.error("Error while trying to add bookmark"),Pn.error(t),Gc.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=su({from:Hc.connection.jid,type:"get"}).c("pubsub",{xmlns:ou.NS.PUBSUB}).c("items",{node:ou.NS.BOOKMARKS});Gc.sendIQ(t).then(t=>this.onBookmarksReceived(e,t)).catch(t=>this.onBookmarksReceivedError(e,t))},markRoomAsBookmarked(e){const t=Hc.chatboxes.get(e.get("jid"));void 0!==t&&t.save("bookmarked",!0)},markRoomAsUnbookmarked(e){const t=Hc.chatboxes.get(e.get("jid"));void 0!==t&&t.save("bookmarked",!1)},createBookmarksFromStanza(e){const t=ou.NS.BOOKMARKS,n='items[node="'.concat(t,'"] item storage[xmlns="').concat(t,'"] conference');au(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"),Gc.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=>!Hc.chatboxes.get(e.get("jid")))}}),Hc.BookmarksList=Fo.extend({defaults:{"toggle-state":Hc.OPENED}}),Hc.checkBookmarksSupport=async function(){const e=await Gc.disco.getIdentity("pubsub","pep",Hc.bare_jid);return Hc.allow_public_bookmarks?!!e:Gc.disco.supports(ou.NS.PUBSUB+"#publish-options",Hc.bare_jid)};const t=async function(){Gc.settings.get("allow_bookmarks")&&await Hc.checkBookmarksSupport()&&(Hc.bookmarks=new Hc.Bookmarks,await Hc.bookmarks.fetchBookmarks(),Gc.trigger("bookmarksInitialized"))};Gc.listen.on("addClientFeatures",()=>{Gc.settings.get("allow_bookmarks")&&Gc.disco.own.features.add(ou.NS.BOOKMARKS+"+notify")}),Gc.listen.on("clearSession",()=>{void 0!==Hc.bookmarks&&(Hc.bookmarks.clearStore({silent:!0}),window.sessionStorage.removeItem(Hc.bookmarks.fetched_flag),delete Hc.bookmarks)}),Gc.listen.on("reconnected",t),Gc.listen.on("connected",async()=>{const{connection:e}=Hc;e.addHandler(lu,null,"message","headline",null,Hc.bare_jid),await Promise.all([Gc.waitUntil("chatBoxesFetched")]),t()})}});n(152);
/**
* @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:uu}=rl.env;rl.plugins.add("converse-bosh",{enabled:()=>!Hc.api.settings.get("blacklisted_plugins").includes("converse-bosh"),initialize(){Gc.settings.extend({bosh_service_url:void 0,prebind_url:null}),Hc.startNewPreboundBOSHSession=function(){if(!Gc.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",Gc.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 Hc.setUserJID(t.jid);Hc.connection.attach(n,t.sid,t.rid,Hc.connection.onConnectStatusChanged)}else e.onerror()},e.onerror=function(){delete Hc.connection,Gc.trigger("noResumeableBOSHSession",Hc)},e.send()},Hc.restoreBOSHSession=async function(){const e=(await async function(){const e="converse.bosh-session";if(Hc.bosh_session||(Hc.bosh_session=new Fo({id:e}),Hc.bosh_session.browserStorage=Hc.createStore(e,"session"),await new Promise(e=>Hc.bosh_session.fetch({success:e,error:e}))),Hc.jid){if(Hc.bosh_session.get("jid")!==Hc.jid){const e=await Hc.setUserJID(Hc.jid);Hc.bosh_session.clear({silent:!0}),Hc.bosh_session.save({jid:e})}}else{const e=Hc.bosh_session.get("jid");e&&await Hc.setUserJID(e)}return Hc.bosh_session}()).get("jid");if(e&&Hc.connection._proto instanceof uu.Bosh)try{return Hc.connection.restore(e,Hc.connection.onConnectStatusChanged),!0}catch(t){return!Hc.isTestEnv()&&Pn.warn("Could not restore session for jid: "+e+" Error message: "+t.message),!1}return!1},Gc.listen.on("clearSession",()=>{if(void 0===Hc.bosh_session){const e="converse.bosh-session";sessionStorage.removeItem(e),sessionStorage.removeItem("".concat(e,"-").concat(e))}else Hc.bosh_session.destroy(),delete Hc.bosh_session}),Gc.listen.on("setUserJID",()=>{void 0!==Hc.bosh_session&&Hc.bosh_session.save({jid:Hc.jid})}),Gc.listen.on("addClientFeatures",()=>Gc.disco.own.features.add(uu.NS.BOSH)),Object.assign(Gc,{tokens:{get:e=>void 0===Hc.connection?null:"rid"===e.toLowerCase()?Hc.connection.rid||Hc.connection._proto.rid:"sid"===e.toLowerCase()?Hc.connection.sid||Hc.connection._proto.sid:void 0}})}});var du=n(6);
/**
* @module converse-caps
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/const{Strophe:hu,$build:fu}=rl.env;function pu(e,t){return e.sort((e,n)=>e[t]>n[t]?-1:1)}function gu(e){const t=e.api.disco.own.identities.get(),n=e.api.disco.own.features.get();t.length>1&&(pu(t,"category"),pu(t,"type"),pu(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),du.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 mu(e){var t,n;e&&(null===(n=Hc.session)||void 0===n||n.set({carbons_enabled:!1}));if(!Gc.settings.get("message_carbons")||null!==(t=Hc.session)&&void 0!==t&&t.get("carbons_enabled"))return;const r=new Tc.e.Builder("iq",{from:Hc.connection.jid,id:"enablecarbons",type:"set"}).c("enable",{xmlns:Tc.e.NS.CARBONS});Hc.connection.addHandler(e=>{e.querySelectorAll("error").length>0?Pn.warn("An error occurred while trying to enable message carbons."):(Hc.session.set({carbons_enabled:!0}),Pn.debug("Message carbons have been enabled.")),Hc.session.save()},null,"iq",null,"enablecarbons"),Hc.connection.send(r)}hu.addNamespace("CAPS","http://jabber.org/protocol/caps"),rl.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,fu("c",{xmlns:hu.NS.CAPS,hash:"sha-1",node:"https://conversejs.org",ver:gu(t)}).nodeTree)),e}}}}),rl.plugins.add("converse-carbons",{initialize(){Gc.settings.extend({message_carbons:!0}),Gc.listen.on("afterResourceBinding",mu)}});
/**
* @module converse-chatboxes
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const{Strophe:vu}=rl.env;vu.addNamespace("MESSAGE_CORRECT","urn:xmpp:message-correct:0"),vu.addNamespace("RECEIPTS","urn:xmpp:receipts"),vu.addNamespace("REFERENCE","urn:xmpp:reference:0"),vu.addNamespace("MARKERS","urn:xmpp:chat-markers:0"),rl.plugins.add("converse-chatboxes",{dependencies:["converse-emoji","converse-roster","converse-vcard"],initialize(){async function e(e,t,n){let r;e=vu.getBareJidFromJid(e.toLowerCase()),Object.assign(t,{jid:e,id:e});try{r=new n(t,{collection:Hc.chatboxes})}catch(e){return Pn.error(e),null}return await r.initialized,r.isValid()?(Hc.chatboxes.add(r),r):(r.destroy(),null)}Gc.promises.add(["chatBoxesFetched","chatBoxesInitialized","privateChatsAutoJoined"]),Hc.ChatBoxes=ta.extend({comparator:"time_opened",model:(e,t)=>new Hc.ChatBox(e,t),onChatBoxesFetched(e){e.filter(e=>!e.isValid()).forEach(e=>e.destroy()),Gc.trigger("chatBoxesFetched")},onConnected(e){e||(this.browserStorage=Hc.createStore("converse.chatboxes-".concat(Hc.bare_jid)),this.fetch({add:!0,success:e=>this.onChatBoxesFetched(e)}))}}),Gc.listen.on("addClientFeatures",()=>{Gc.disco.own.features.add(vu.NS.MESSAGE_CORRECT),Gc.disco.own.features.add(vu.NS.HTTPUPLOAD),Gc.disco.own.features.add(vu.NS.OUTOFBAND)}),Gc.listen.on("pluginsInitialized",()=>{Hc.chatboxes=new Hc.ChatBoxes,Gc.trigger("chatBoxesInitialized")}),Gc.listen.on("presencesInitialized",e=>Hc.chatboxes.onConnected(e)),Gc.listen.on("reconnected",()=>Hc.chatboxes.forEach(e=>e.onReconnection())),Object.assign(Gc,{chatboxes:{create:async(t=[],n={},r)=>(await Gc.waitUntil("chatBoxesFetched"),"string"==typeof t?e(t,n,r):Promise.all(t.map(t=>e(t,n,r)))),get:async e=>(await Gc.waitUntil("chatBoxesFetched"),void 0===e?Hc.chatboxes.models:"string"==typeof e?Hc.chatboxes.get(e.toLowerCase()):(e=e.map(e=>e.toLowerCase()),Hc.chatboxes.models.filter(t=>e.includes(t.get("jid")))))}})}}),rl.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(){Hc.connection.addHandler(e=>async function(e){if(hs.isHeadline(e)||hs.isServerMessage(e)){const t=e.getAttribute("from");if(t.includes("@")&&!Hc.roster.get(t)&&!Gc.settings.get("allow_non_roster_messaging"))return;if(null===e.querySelector("body"))return;const n=Hc.chatboxes.create({id:t,jid:t,type:Hc.HEADLINES_TYPE,from:t}),r=await hs.parseMessage(e,Hc);await n.createMessage(r),Gc.trigger("message",{chatbox:n,stanza:e,attrs:r})}}(e)||!0,null,"message")}Hc.HeadlinesBox=Hc.ChatBox.extend({defaults(){return{bookmarked:!1,hidden:["mobile","fullscreen"].includes(Gc.settings.get("view_mode")),message_type:"headline",num_unread:0,time_opened:this.get("time_opened")||(new Date).getTime(),type:Hc.HEADLINES_TYPE}},async initialize(){this.set({box_id:"box-".concat(this.get("jid"))}),this.initMessages(),await this.fetchMessages(),Gc.trigger("headlinesBoxInitialized",this)}}),Gc.listen.on("connected",e),Gc.listen.on("reconnected",e),Object.assign(Gc,{headlines:{async get(e,t={},n=!1){async function r(e){let r=await Gc.chatboxes.get(e);return!r&&n?r=await Gc.chatboxes.create(e,t,Hc.HeadlinesBox):(r=r&&r.get("type")===Hc.HEADLINES_TYPE?r:null,r&&Object.keys(t).length&&r.save(t)),r}if(void 0===e){return(await Gc.chatboxes.get()).filter(e=>e.get("type")===Hc.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:_u,$build:bu}=rl.env;_u.addNamespace("RSM","http://jabber.org/protocol/rsm");const yu=["after","before","index","max"],wu=e=>Number(e),Su=e=>e.toString(),xu={after:Su,before:Su,count:wu,first:Su,index:wu,last:Su,max:wu},Eu=e=>void 0===e,Au=Object.keys(xu);class ju{static getQueryParameters(e={}){return Lo(e,yu)}static parseXMLResult(e){const t={};for(var n=0;n<Au.length;n++){const r=Au[n],i=e.getElementsByTagName(r)[0];Eu(i)||null===i||(t[r]=xu[r](_u.getText(i)),"first"==r&&(t.index=xu.index(i.getAttribute("index"))))}return t}constructor(e={}){this.query=ju.getQueryParameters(e),this.result=e.xml?ju.parseXMLResult(e.xml):{}}toXML(){const e=bu("set",{xmlns:_u.NS.RSM});return yu.reduce((e,t)=>Eu(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 ju(n)}previous(e,t){const n=Object.assign({},this.query,{after:t,before:this.result.first,max:e});return new ju(n)}}Hc.RSM_ATTRIBUTES=Au,Hc.RSM=ju;
/**
* @module converse-mam
* @description XEP-0313 Message Archive Management
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const{Strophe:Cu,$iq:ku,dayjs:Ou}=rl.env,{NS:Tu}=Cu,Nu=rl.env.utils,Iu={fetchNewestMessages(){if(this.disable_mam)return;const e=this.getMostRecentMessage();if(e&&!Gc.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 Gc.emojis.initialize();const i=this.get("type")===Hc.CHATROOMS_TYPE;e.messages=e.messages.map(e=>i?hs.parseMUCMessage(e,this,Hc):hs.parseMessage(e,Hc));const o={query:t,chatbox:this,messages:e.messages};if(await Gc.trigger("MAMResult",o,{synchronous:!0}),e.messages.forEach(e=>this.queueMessage(e)),e.error){const t=e.error.retry_event_id=Nu.getUniqueId();Gc.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")===Hc.CHATROOMS_TYPE,r=n?this.get("jid"):Hc.bare_jid;if(!await Gc.disco.supports(Tu.MAM,r))return;const i=Gc.settings.get("archived_messages_page_size"),o=Object.assign({groupchat:n,max:i,with:this.get("jid")},e),s=await Gc.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}};rl.plugins.add("converse-mam",{dependencies:["converse-disco","converse-muc"],initialize(){function e(e){Gc.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}))}Gc.settings.extend({archived_messages_page_size:"50",message_archiving:void 0,message_archiving_timeout:2e4}),Object.assign(Hc.ChatBox.prototype,Iu),Hc.onMAMError=function(e){null!=e&&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))},Hc.onMAMPreferences=function(e,t){const n=pr()('prefs[xmlns="'.concat(Tu.MAM,'"]'),e).pop();if(n.getAttribute("default")!==Gc.settings.get("message_archiving")){const e=ku({type:"set"}).c("prefs",{xmlns:Tu.MAM,default:Gc.settings.get("message_archiving")});Array.from(n.children).forEach(t=>e.cnode(t).up()),Gc.sendIQ(e).then(()=>t.save({preferences:{default:Gc.settings.get("message_archiving")}})).catch(Hc.onMAMError)}else t.save({preferences:{default:Gc.settings.get("message_archiving")}})},Gc.listen.on("addClientFeatures",()=>Gc.disco.own.features.add(Tu.MAM)),Gc.listen.on("serviceDiscovered",(function(e){const t=e.get("preferences")||{};e.get("var")===Tu.MAM&&void 0!==Gc.settings.get("message_archiving")&&t.default!==Gc.settings.get("message_archiving")&&Gc.sendIQ(ku({type:"get"}).c("prefs",{xmlns:Tu.MAM})).then(t=>Hc.onMAMPreferences(t,e)).catch(Hc.onMAMError)})),Gc.listen.on("chatRoomViewInitialized",t=>{Gc.settings.get("muc_show_logs_before_join")&&(e(t.model),t.model.features.on("change:mam_enabled",()=>e(t.model)))}),Gc.listen.on("enteredNewRoom",e=>e.features.get("mam_enabled")&&e.fetchNewestMessages()),Gc.listen.on("chatReconnected",e=>{e.get("type")===Hc.PRIVATE_CHAT_TYPE&&e.fetchNewestMessages()}),Gc.listen.on("afterMessagesFetched",e=>{e.get("type")!==Hc.PRIVATE_CHAT_TYPE||Hc.connection.restored||e.fetchNewestMessages()}),Object.assign(Gc,{archive:{async query(e){if(!Gc.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||Hc.bare_jid;if(!await Gc.disco.supports(Tu.MAM,n))return Pn.warn("Did not fetch MAM archive for ".concat(n," because it doesn't support ").concat(Tu.MAM)),{messages:[]};const r=Nu.getUniqueId(),i=ku(t).c("query",{xmlns:Tu.MAM,queryid:r});if(e){i.c("x",{xmlns:Tu.XFORM,type:"submit"}).c("field",{var:"FORM_TYPE",type:"hidden"}).c("value").t(Tu.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=Ou(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 ju(e);Object.keys(t.query).length&&i.cnode(t.toXML())}const o=[],s=Hc.connection.addHandler(t=>{const n=pr()('message > result[xmlns="'.concat(Tu.MAM,'"]'),t).pop();if(void 0===n||n.getAttribute("queryid")!==r)return!0;const i=t.getAttribute("from")||Hc.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!==Hc.bare_jid)return Pn.warn("Ignoring alleged MAM message from ".concat(t.getAttribute("from"))),!0;return o.push(t),!0},Tu.MAM);let a;const c=await Gc.sendIQ(i,Gc.settings.get("message_archiving_timeout"),!1);if(null===c){const{__:e}=Hc,t=e("Timeout while trying to fetch archived messages.");return Pn.error(t),a=new Hc.TimeoutError(t),{messages:o,error:a}}if(Nu.isErrorStanza(c)){const{__:e}=Hc,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;Hc.connection.deleteHandler(s);const u=c&&pr()('fin[xmlns="'.concat(Tu.MAM,'"]'),c).pop(),d="true"===(null==u?void 0:u.getAttribute("complete")),h=pr()('set[xmlns="'.concat(Tu.RSM,'"]'),u).pop();return h&&(l=new ju({...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:Mu,$iq:Ru}=rl.env,Du=rl.env.utils;Mu.addNamespace("PING","urn:xmpp:ping"),rl.plugins.add("converse-ping",{initialize(){let e;function t(t){e=new Date;const n=t.getAttribute("from"),r=t.getAttribute("id"),i=Ru({type:"result",to:n,id:r});return Hc.connection.sendIQ(i),!0}Gc.settings.extend({ping_interval:60}),setTimeout(()=>{if(Gc.settings.get("ping_interval")>0){const t=new Date;return e||(e=t),!((t-e)/1e3>Gc.settings.get("ping_interval"))||Gc.ping()}},1e3);const n=function(){void 0!==Hc.connection.disco&&Gc.disco.own.features.add(Mu.NS.PING),Hc.connection.addHandler(t,Mu.NS.PING,"iq","get"),Hc.connection.addHandler(()=>{if(Gc.settings.get("ping_interval")>0)return e=new Date,!0})};Gc.listen.on("connected",n),Gc.listen.on("reconnected",n),Gc.listen.on("windowStateChanged",(function(e){"visible"===e.state&&Gc.connection.connected()&&Gc.ping(null,5e3)})),Object.assign(Gc,{async ping(t,n){if(e=new Date,t=t||Mu.getDomainFromJid(Hc.bare_jid),Hc.connection){const e=Ru({type:"get",to:t,id:Du.getUniqueId("ping")}).c("ping",{xmlns:Mu.NS.PING}),r=await Gc.sendIQ(e,n||1e4,!1);return null===r?(Pn.warn("Timeout while pinging ".concat(t)),t===Mu.getDomainFromJid(Hc.bare_jid)&&Gc.connection.reconnect()):Du.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:Pu,$iq:zu}=rl.env;Pu.addNamespace("PUBSUB_ERROR",Pu.NS.PUBSUB+"#errors"),rl.plugins.add("converse-pubsub",{dependencies:["converse-disco"],initialize(){Object.assign(Hc.api,{pubsub:{async publish(e,t,n,r,i=!0){const o=zu({from:Hc.bare_jid,type:"set",to:e}).c("pubsub",{xmlns:Pu.NS.PUBSUB}).c("publish",{node:t}).cnode(n.tree()).up().up();r&&(e=e||Hc.bare_jid,await Gc.disco.supports(Pu.NS.PUBSUB+"#publish-options",e)?(o.c("publish-options").c("x",{xmlns:Pu.NS.XFORM,type:"submit"}).c("field",{var:"FORM_TYPE",type:"hidden"}).c("value").t("".concat(Pu.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 Gc.sendIQ(o)}catch(e){if(!(e instanceof Element&&i&&e.querySelector('precondition-not-met[xmlns="'.concat(Pu.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 Gc.sendIQ(e)}}}}})}});var Lu=function(e){return"number"==typeof e||Ee(e)&&"[object Number]"==T(e)};var Fu=function(e){return Lu(e)&&e!=+e};
/**
* @module converse-status
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/const{Strophe:Bu,$build:qu,$pres:Uu}=rl.env;rl.plugins.add("converse-status",{initialize(){function e(e){Gc.trigger("statusInitialized",e)}function t(t){if(t=void 0!==Hc.xmppstatus&&t)e(t);else{const n="converse.xmppstatus-".concat(Hc.bare_jid);Hc.xmppstatus=new Hc.XMPPStatus({id:n}),Hc.xmppstatus.browserStorage=Hc.createStore(n,"session"),Hc.xmppstatus.fetch({success:()=>e(t),error:()=>e(t),silent:!0})}}Gc.settings.extend({auto_away:0,auto_xa:0,csi_waiting_time:0,default_state:"online",priority:0}),Gc.promises.add(["statusInitialized"]),Hc.XMPPStatus=Fo.extend({defaults:()=>({status:Gc.settings.get("default_state")}),initialize(){this.on("change",e=>{N(e.changed)&&("status"in e.changed||"status_message"in e.changed)&&Gc.user.presence.send(this.get("status"),null,this.get("status_message"))})},getNickname:()=>Hc.nickname,getFullname:()=>"",constructPresence(e,t=null,n){let r;e="string"==typeof e?e:this.get("status")||Gc.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=Uu(i)):"offline"===e?(i.type="unavailable",r=Uu(i)):r="online"===e?Uu(i):Uu(i).c("show").t(e).up(),n&&r.c("status").t(n).up();const o=Gc.settings.get("priority");if(r.c("priority").t(Fu(Number(o))?0:o).up(),Hc.idle){const e=new Date;e.setSeconds(e.getSeconds()-Hc.idle_seconds),r.c("idle",{xmlns:Bu.NS.IDLE,since:e.toISOString()})}return r}}),Hc.sendCSI=function(e){Gc.send(qu(e,{xmlns:Bu.NS.CSI})),Hc.inactive=e===Hc.INACTIVE},Hc.onUserActivity=function(){var e;Hc.idle_seconds>0&&(Hc.idle_seconds=0),null!==(e=Hc.connection)&&void 0!==e&&e.authenticated&&(Hc.inactive&&Hc.sendCSI(Hc.ACTIVE),Hc.idle&&(Hc.idle=!1,Gc.user.presence.send()),!0===Hc.auto_changed_status&&(Hc.auto_changed_status=!1,Hc.xmppstatus.set("status",Gc.settings.get("default_state"))))},Hc.onEverySecond=function(){var e;if(null===(e=Hc.connection)||void 0===e||!e.authenticated)return;const t=Hc.xmppstatus.get("status");Hc.idle_seconds++,Gc.settings.get("csi_waiting_time")>0&&Hc.idle_seconds>Gc.settings.get("csi_waiting_time")&&!Hc.inactive&&Hc.sendCSI(Hc.INACTIVE),Gc.settings.get("idle_presence_timeout")>0&&Hc.idle_seconds>Gc.settings.get("idle_presence_timeout")&&!Hc.idle&&(Hc.idle=!0,Gc.user.presence.send()),Gc.settings.get("auto_away")>0&&Hc.idle_seconds>Gc.settings.get("auto_away")&&"away"!==t&&"xa"!==t&&"dnd"!==t?(Hc.auto_changed_status=!0,Hc.xmppstatus.set("status","away")):Gc.settings.get("auto_xa")>0&&Hc.idle_seconds>Gc.settings.get("auto_xa")&&"xa"!==t&&"dnd"!==t&&(Hc.auto_changed_status=!0,Hc.xmppstatus.set("status","xa"))},Hc.registerIntervalHandler=function(){if(Gc.settings.get("auto_away")<1&&Gc.settings.get("auto_xa")<1&&Gc.settings.get("csi_waiting_time")<1&&Gc.settings.get("idle_presence_timeout")<1)return;Hc.idle_seconds=0,Hc.auto_changed_status=!1;const{unloadevent:e}=Hc;window.addEventListener("click",Hc.onUserActivity),window.addEventListener("focus",Hc.onUserActivity),window.addEventListener("keypress",Hc.onUserActivity),window.addEventListener("mousemove",Hc.onUserActivity),window.addEventListener(e,Hc.onUserActivity,{once:!0,passive:!0}),window.addEventListener(e,()=>{var e;return null===(e=Hc.session)||void 0===e?void 0:e.save("active",!1)}),Hc.everySecondTrigger=window.setInterval(Hc.onEverySecond,1e3)},Gc.listen.on("presencesInitialized",e=>{e||Hc.registerIntervalHandler()}),Gc.listen.on("clearSession",()=>{Hc.shouldClearCache()&&Hc.xmppstatus&&(Hc.xmppstatus.destroy(),delete Hc.xmppstatus,Gc.promises.add(["statusInitialized"]))}),Gc.listen.on("connected",()=>t(!1)),Gc.listen.on("reconnected",()=>t(!0)),Object.assign(Hc.api.user,{presence:{async send(e,t,n){await Gc.waitUntil("statusInitialized"),Gc.send(Hc.xmppstatus.constructPresence(e,t,n))}},status:{get:async()=>(await Gc.waitUntil("statusInitialized"),Hc.xmppstatus.get("status")),async set(e,t){const n={status:e};if(!Object.keys(Hc.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 Gc.waitUntil("statusInitialized"),Hc.xmppstatus.save(n)},message:{get:async()=>(await Gc.waitUntil("statusInitialized"),Hc.xmppstatus.get("status_message")),async set(e){await Gc.waitUntil("statusInitialized"),Hc.xmppstatus.save({status_message:e})}}}})}});var Hu=function(e){return function(t){return null==e?void 0:po(e,t)}};var $u=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 Wu=function(e){return e&&e.length?$u(e,vr):0};
/**
* @module converse-roster
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/const{Strophe:Vu,$iq:Gu,$pres:Ju,dayjs:Qu,sizzle:Yu}=rl.env,Ku=rl.env.utils;rl.plugins.add("converse-roster",{dependencies:["converse-status"],initialize(){const{__:e}=Hc;Gc.settings.extend({allow_contact_requests:!0,auto_subscribe:!1,synchronize_availability:!0}),Gc.promises.add(["cachedRoster","roster","rosterContactsFetched","rosterGroupsFetched","rosterInitialized"]),Hc.HEADER_CURRENT_CONTACTS=e("My contacts"),Hc.HEADER_PENDING_CONTACTS=e("Pending contacts"),Hc.HEADER_REQUESTING_CONTACTS=e("Contact requests"),Hc.HEADER_UNGROUPED=e("Ungrouped"),Hc.HEADER_UNREAD=e("New messages");const t={};t[Hc.HEADER_UNREAD]=0,t[Hc.HEADER_REQUESTING_CONTACTS]=1,t[Hc.HEADER_CURRENT_CONTACTS]=2,t[Hc.HEADER_UNGROUPED]=3,t[Hc.HEADER_PENDING_CONTACTS]=4,Hc.registerPresenceHandler=function(){Hc.unregisterPresenceHandler(),Hc.presence_ref=Hc.connection.addHandler(e=>(Hc.roster.presenceHandler(e),!0),null,"presence",null)},Hc.rejectPresenceSubscription=function(e,t){const n=Ju({to:e,type:"unsubscribed"});t&&""!==t&&n.c("status").t(t),Gc.send(n)},Hc.sendInitialPresence=function(){Hc.send_initial_presence&&Gc.user.presence.send()},Hc.populateRoster=async function(e=!1){e&&(Hc.send_initial_presence=!0);try{await Hc.rostergroups.fetchRosterGroups(),Gc.trigger("rosterGroupsFetched"),await Hc.roster.fetchRosterContacts(),Gc.trigger("rosterContactsFetched")}catch(e){Pn.error(e)}finally{Hc.sendInitialPresence()}};const n=Fo.extend({idAttribute:"name"}),r=ta.extend({model:n});function i(e){const t=Hc.roster&&Hc.roster.findWhere({jid:e.get("jid")});void 0!==t&&t.save({num_unread:e.get("num_unread")})}async function o(){Hc.presences&&await Hc.presences.clearStore()}Hc.Presence=Fo.extend({defaults:{show:"offline"},initialize(){this.resources=new r;const e="converse.identities-".concat(this.get("jid"));this.resources.browserStorage=Hc.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=Vu.getResourceFromJid(t),r=Yu('delay[xmlns="'.concat(Vu.NS.DELAY,'"]'),e).pop(),i=Hu(e.querySelector("priority"))("textContent")||0,o=this.resources.get(n),s={name:n,priority:Fu(parseInt(i,10))?0:parseInt(i,10),show:Hu(e.querySelector("show"))("textContent")||"online",timestamp:r?Qu(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()}}),Hc.Presences=ta.extend({model:Hc.Presence}),Hc.RosterContact=Fo.extend({defaults:{chat_state:void 0,image:Hc.DEFAULT_IMAGE,image_type:Hc.DEFAULT_IMAGE_TYPE,num_unread:0,status:void 0},async initialize(e){this.initialized=Ku.getResolveablePromise(),this.setPresence();const{jid:t}=e,n=Vu.getBareJidFromJid(t).toLowerCase();e.jid=n,this.set(Object.assign({groups:[],id:n,jid:n,user_id:Vu.getNodeFromJid(t)},e)),this.listenTo(this.presence,"change:show",()=>Gc.trigger("contactPresenceChanged",this)),this.listenTo(this.presence,"change:show",()=>this.trigger("presenceChanged")),await Gc.trigger("rosterContactInitialized",this,{Synchronous:!0}),this.initialized.resolve()},setPresence(){const e=this.get("jid");this.presence=Hc.presences.findWhere({jid:e})||Hc.presences.create({jid:e})},openChat(){const e=this.attributes;Gc.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=Ju({to:this.get("jid"),type:"subscribe"});e&&""!==e&&t.c("status").t(e).up();const n=Hc.xmppstatus.getNickname()||Hc.xmppstatus.getFullname();return n&&t.c("nick",{xmlns:Vu.NS.NICK}).t(n).up(),Gc.send(t),this.save("ask","subscribe"),this},ackSubscribe(){Gc.send(Ju({type:"subscribe",to:this.get("jid")}))},ackUnsubscribe(){Gc.send(Ju({type:"unsubscribe",to:this.get("jid")})),this.removeFromRoster(),this.destroy()},unauthorize(e){return Hc.rejectPresenceSubscription(this.get("jid"),e),this},authorize(e){const t=Ju({to:this.get("jid"),type:"subscribed"});return e&&""!==e&&t.c("status").t(e),Gc.send(t),this},removeFromRoster(){const e=Gu({type:"set"}).c("query",{xmlns:Vu.NS.ROSTER}).c("item",{jid:this.get("jid"),subscription:"remove"});return Gc.sendIQ(e)}}),Hc.RosterContacts=ta.extend({model:Hc.RosterContact,comparator(e,t){const n=e.presence.get("show")||"offline",r=t.presence.get("show")||"offline";if(Hc.STATUS_WEIGHTS[n]===Hc.STATUS_WEIGHTS[r]){const n=e.getDisplayName().toLowerCase(),r=t.getDisplayName().toLowerCase();return n<r?-1:n>r?1:0}return Hc.STATUS_WEIGHTS[n]<Hc.STATUS_WEIGHTS[r]?-1:1},onConnected(){this.registerRosterHandler(),this.registerRosterXHandler()},registerRosterHandler(){Hc.connection.addHandler(e=>(Hc.roster.onRosterPush(e),!0),Vu.NS.ROSTER,"iq","set")},registerRosterXHandler(){let e=0;Hc.connection.addHandler((function(t){return window.setTimeout((function(){Hc.connection.flush(),Hc.roster.subscribeToSuggestedItems.bind(Hc.roster)(t)}),e),e+=250*t.querySelectorAll("item").length,!0}),Vu.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(Ku.isErrorObject(e)&&(Pn.error(e),Hc.session.set("roster_cached",!1),this.data.save("version",void 0)),!Hc.session.get("roster_cached"))return Hc.send_initial_presence=!0,Hc.roster.fetchFromServer();Gc.trigger("cachedRoster",e)},subscribeToSuggestedItems:e=>(Array.from(e.querySelectorAll("item")).forEach(e=>{"add"===e.getAttribute("action")&&Hc.roster.addAndSubscribe(e.getAttribute("jid"),Hc.xmppstatus.getNickname()||Hc.xmppstatus.getFullname())}),!0),isSelf:e=>Ku.isSameBareJID(e,Hc.connection.jid),async addAndSubscribe(e,t,n,r,i){const o=await this.addContactToRoster(e,t,n,i);o instanceof Hc.RosterContact&&o.subscribe(r)},sendContactAddIQ(e,t,n){t=t||null;const r=Gu({type:"set"}).c("query",{xmlns:Vu.NS.ROSTER}).c("item",{jid:e,name:t});return n.forEach(e=>r.c("group").t(e).up()),Gc.sendIQ(r)},async addContactToRoster(t,n,r,i){await Gc.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 Hc.RosterContact)n.authorize().subscribe();else{var r;const n=(null===(r=Yu('nick[xmlns="'.concat(Vu.NS.NICK,'"]'),t).pop())||void 0===r?void 0:r.textContent)||null,i=await this.addContactToRoster(e,n,[],{subscription:"from"});i instanceof Hc.RosterContact&&i.authorize().subscribe()}},getNumOnlineContacts(){const e=["offline","unavailable"];return Wu(this.models.filter(t=>!e.includes(t.presence.get("show"))))},onRosterPush(e){const t=e.getAttribute("id"),n=e.getAttribute("from");if(n&&n!==Hc.bare_jid)return void Pn.warn("Ignoring roster illegitimate roster push message from ".concat(e.getAttribute("from")));Gc.send(Gu({type:"result",id:t,from:Hc.connection.jid}));const r=Yu('query[xmlns="'.concat(Vu.NS.ROSTER,'"]'),e).pop();this.data.save("version",r.getAttribute("ver"));const i=Yu("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()),Gc.trigger("rosterPush",e)},rosterVersioningSupported(){return Gc.disco.stream.getFeature("ver","urn:xmpp:features:rosterver")&&this.data.get("version")},async fetchFromServer(){const e=Gu({type:"get",id:Ku.getUniqueId("roster")}).c("query",{xmlns:Vu.NS.ROSTER});this.rosterVersioningSupported()&&e.attrs({ver:this.data.get("version")});const t=await Gc.sendIQ(e,null,!1);if("error"!==t.getAttribute("type")){const e=Yu('query[xmlns="'.concat(Vu.NS.ROSTER,'"]'),t).pop();if(e){Yu("item",e).forEach(e=>this.updateContact(e)),this.data.save("version",e.getAttribute("ver"))}}else if(!Ku.isServiceUnavailableError(t))return Pn.error(t),void Pn.error("Error while trying to fetch roster from the server");Hc.session.save("roster_cached",!0),Gc.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:Vu.getBareJidFromJid(e.getAttribute("from")),subscription:"none",ask:null,requesting:!0,nickname:(null===(t=Yu('nick[xmlns="'.concat(Vu.NS.NICK,'"]'),e).pop())||void 0===t?void 0:t.textContent)||null};Gc.trigger("contactRequest",this.create(n))},handleIncomingSubscription(t){const n=t.getAttribute("from"),r=Vu.getBareJidFromJid(n),i=this.get(r);Gc.settings.get("allow_contact_requests")||Hc.rejectPresenceSubscription(n,e("This client does not allow presence subscriptions")),Gc.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=Vu.getResourceFromJid(t),r=e.getAttribute("type");if(Hc.connection.jid!==t&&"unavailable"!==r&&(!0===Gc.settings.get("synchronize_availability")||Gc.settings.get("synchronize_availability")===n)){const t=Hu(e.querySelector("show"))("textContent")||"online";Hc.xmppstatus.save({status:t},{silent:!0});const n=Hu(e.querySelector("status"))("textContent");n&&Hc.xmppstatus.save({status_message:n})}Hc.jid===t&&"unavailable"===r&&Gc.user.presence.send()},presenceHandler(e){const t=e.getAttribute("type");if("error"===t)return!0;const n=e.getAttribute("from"),r=Vu.getBareJidFromJid(n);if(this.isSelf(r))return this.handleOwnPresence(e);if(Yu('query[xmlns="'.concat(Vu.NS.MUC,'"]'),e).length)return;const i=Hu(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=Vu.getResourceFromJid(n);o.presence.removeResource(e)}else o&&o.presence.addResource(e)}}}),Hc.RosterGroup=Fo.extend({initialize(t){this.set(Object.assign({description:e("Click to hide these contacts"),state:Hc.OPENED},t)),this.contacts=new Hc.RosterContacts}}),Hc.RosterGroups=ta.extend({model:Hc.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=Hc.HEADER_CURRENT_CONTACTS;return r[e]<r[n]?-1:r[e]>r[n]?1:0}if(o&&!s){const t=Hc.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})})}}),Hc.unregisterPresenceHandler=function(){void 0!==Hc.presence_ref&&(Hc.connection.deleteHandler(Hc.presence_ref),delete Hc.presence_ref)},Gc.listen.on("chatBoxesInitialized",()=>{Hc.chatboxes.on("change:num_unread",i),Hc.chatboxes.on("add",e=>{e.get("type")===Hc.PRIVATE_CHAT_TYPE&&e.setRosterContact(e.get("jid"))})}),Gc.listen.on("beforeTearDown",()=>Hc.unregisterPresenceHandler()),Gc.waitUntil("rosterContactsFetched").then(()=>{Hc.roster.on("add",e=>{const t=Hc.chatboxes.findWhere({jid:e.get("jid")});t&&t.setRosterContact(e.get("jid"))})}),Gc.listen.on("streamResumptionFailed",()=>Hc.session.set("roster_cached",!1)),Gc.listen.on("clearSession",async()=>{await o(),Hc.shouldClearCache()&&(Hc.rostergroups&&(await Hc.rostergroups.clearStore(),delete Hc.rostergroups),Hc.roster&&(Pc(Hc,"roster.data.destroy"),await Hc.roster.clearStore(),delete Hc.roster))}),Gc.listen.on("statusInitialized",async e=>{if(e)!Hc.connection.hasResumed()&&await o();else{Hc.presences=new Hc.Presences;const e="converse.presences-".concat(Hc.bare_jid);Hc.presences.browserStorage=Hc.createStore(e,"session"),Hc.presences.fetch()}Gc.trigger("presencesInitialized",e)}),Gc.listen.on("presencesInitialized",async e=>{e?Gc.trigger("rosterReadyAfterReconnection"):await async function(){await Gc.waitUntil("VCardsInitialized"),Hc.roster=new Hc.RosterContacts;let e="converse.contacts-".concat(Hc.bare_jid);Hc.roster.browserStorage=Hc.createStore(e),Hc.roster.data=new Fo,e="converse-roster-model-".concat(Hc.bare_jid),Hc.roster.data.id=e,Hc.roster.data.browserStorage=Hc.createStore(e),Hc.roster.data.fetch(),e="converse.roster.groups".concat(Hc.bare_jid),Hc.rostergroups=new Hc.RosterGroups,Hc.rostergroups.browserStorage=Hc.createStore(e),Gc.trigger("rosterInitialized")}(),Hc.roster.onConnected(),Hc.registerPresenceHandler(),Hc.populateRoster(!Hc.connection.restored)}),Object.assign(Hc.api,{contacts:{async get(e){await Gc.waitUntil("rosterContactsFetched");const t=e=>Hc.roster.get(Vu.getBareJidFromJid(e));if(void 0===e)e=Hc.roster.pluck("jid");else if("string"==typeof e)return t(e);return e.map(t)},async add(e,t){if(await Gc.waitUntil("rosterContactsFetched"),"string"!=typeof e||!e.includes("@"))throw new TypeError("contacts.add: invalid jid");return Hc.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:Xu}=rl.env,Zu=rl.env.utils;function ed(){return!(Gc.connection.isType("bosh")&&!Hc.isTestEnv())&&Gc.disco.stream.getFeature("sm",Xu.NS.SM)}function td(e){if(!Hc.session.get("smacks_enabled"))return!0;const t=parseInt(e.getAttribute("h"),10),n=Hc.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=Hc.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 Hc.session.save({num_stanzas_handled_by_server:t,num_stanzas_since_last_ack:0,unacked_stanzas:i.slice(r)}),!0}function nd(){if(Hc.session.get("smacks_enabled")){const e=Hc.session.get("num_stanzas_handled"),t=Zu.toStanza('<a xmlns="'.concat(Xu.NS.SM,'" h="').concat(e,'"/>'));Gc.send(t)}return!0}function rd(e){if(Hc.session.get("smacks_enabled")&&(Zu.isTagEqual(e,"iq")||Zu.isTagEqual(e,"presence")||Zu.isTagEqual(e,"message"))){const e=Hc.session.get("num_stanzas_handled");Hc.session.save("num_stanzas_handled",e+1)}return!0}function id(){Hc.session.save({smacks_enabled:Hc.session.get("smacks_enabled")||!1,num_stanzas_handled:Hc.session.get("num_stanzas_handled")||0,num_stanzas_handled_by_server:Hc.session.get("num_stanzas_handled_by_server")||0,num_stanzas_since_last_ack:Hc.session.get("num_stanzas_since_last_ack")||0,unacked_stanzas:Hc.session.get("unacked_stanzas")||[]})}function od(){Hc.session&&Hc.session.save({smacks_enabled:!1,num_stanzas_handled:0,num_stanzas_handled_by_server:0,num_stanzas_since_last_ack:0,unacked_stanzas:[]})}function sd(e){const t={smacks_enabled:!0};return["1","true"].includes(e.getAttribute("resume"))&&(t.smacks_stream_id=e.getAttribute("id")),Hc.session.save(t),!0}function ad(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)),od(),Gc.trigger("streamResumptionFailed"),!0}function cd(e){sd(e),td(e),function(){const e=Hc.session.get("unacked_stanzas");Hc.session.save("unacked_stanzas",[]),e.forEach(e=>Gc.send(e))}(),Hc.connection.do_bind=!1,Hc.connection.authenticated=!0,Hc.connection.restored=!0,Hc.connection._changeConnectStatus(Xu.Status.CONNECTED,null)}async function ld(){if(Gc.settings.get("enable_smacks")&&!Hc.session.get("smacks_enabled")&&await ed()){const e=Zu.getResolveablePromise();Hc.connection._addSysHandler(t=>e.resolve(sd(t)),Xu.NS.SM,"enabled"),Hc.connection._addSysHandler(t=>e.resolve(ad(t)),Xu.NS.SM,"failed");const t=Gc.connection.isType("websocket")||Hc.isTestEnv(),n=Zu.toStanza('<enable xmlns="'.concat(Xu.NS.SM,'" resume="').concat(t,'"/>'));Gc.send(n),Hc.connection.flush(),await e}}Xu.addNamespace("SM","urn:xmpp:sm:3");const ud=[];async function dd(){if(!Gc.settings.get("enable_smacks"))return;if(!await ed())return;const e=Hc.connection;for(;ud.length;)e.deleteHandler(ud.pop());ud.push(e.addHandler(rd)),ud.push(e.addHandler(nd,Xu.NS.SM,"r")),ud.push(e.addHandler(td,Xu.NS.SM,"a")),Hc.session.get("smacks_stream_id")?await async function(){const e=Zu.getResolveablePromise();Hc.connection._addSysHandler(t=>e.resolve(cd(t)),Xu.NS.SM,"resumed"),Hc.connection._addSysHandler(t=>e.resolve(ad(t)),Xu.NS.SM,"failed");const t=Hc.session.get("smacks_stream_id"),n=Hc.session.get("num_stanzas_handled"),r=Zu.toStanza('<resume xmlns="'.concat(Xu.NS.SM,'" h="').concat(n,'" previd="').concat(t,'"/>'));Gc.send(r),Hc.connection.flush(),await e}():od()}function hd(e){if(Hc.session){if(Hc.session.get("smacks_enabled")&&(Zu.isTagEqual(e,"iq")||Zu.isTagEqual(e,"presence")||Zu.isTagEqual(e,"message"))){const t=Xu.serialize(e);Hc.session.save("unacked_stanzas",(Hc.session.get("unacked_stanzas")||[]).concat([t]));const n=Gc.settings.get("smacks_max_unacked_stanzas");if(n>0){const e=Hc.session.get("num_stanzas_since_last_ack")+1;e%n==0&&Gc.send(Zu.toStanza('<r xmlns="'.concat(Xu.NS.SM,'"/>'))),Hc.session.save({num_stanzas_since_last_ack:e})}}}else Pn.warn("No _converse.session!")}rl.plugins.add("converse-smacks",{initialize(){Gc.settings.extend({enable_smacks:!0,smacks_max_unacked_stanzas:5}),Gc.listen.on("afterResourceBinding",ld),Gc.listen.on("beforeResourceBinding",dd),Gc.listen.on("send",hd),Gc.listen.on("userSessionInitialized",id)}});
/**
* @module converse-vcard
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const{Strophe:fd,$iq:pd,dayjs:gd}=rl.env,md=rl.env.utils;rl.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=pd(t?{type:e,to:t}:{type:e});return n?r.cnode(n):r.c("vCard",{xmlns:fd.NS.VCARD}),r}async function t(t,n){const r=fd.getBareJidFromJid(n)===t.bare_jid?null:n;let i;try{i=await Gc.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=md.base64ToArrayBuffer(r.image),t=await crypto.subtle.digest("SHA-1",e);r.image_hash=md.arrayBufferToHex(t)}return r}(0,i)}async function n(e){let t;if(e instanceof Hc.Message){if("error"===e.get("type"))return;t=e.get("from")}else t=e.get("jid");await Gc.waitUntil("VCardsInitialized"),e.vcard=Hc.vcards.findWhere({jid:t}),e.vcard||(e.vcard=Hc.vcards.create({jid:t})),e.vcard.on("change",()=>e.trigger("vcard:change"))}async function r(e){await Gc.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=fd.getResourceFromJid(e.get("from"));if(n&&n.get("nick")===r)return Hc.xmppstatus.vcard;{const t=e.occupant&&e.occupant.get("jid")||e.get("from");return t?Hc.vcards.findWhere({jid:t})||Hc.vcards.create({jid:t}):void Pn.error("Could not assign VCard for message because no JID found! msgid: ".concat(e.get("msgid")))}}(e))}Gc.promises.add("VCardsInitialized"),Hc.VCard=Fo.extend({defaults:{image:Hc.DEFAULT_IMAGE,image_type:Hc.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=Hc.DEFAULT_IMAGE,r.image_type=Hc.DEFAULT_IMAGE_TYPE,Fo.prototype.set.call(this,r,n)):Fo.prototype.set.apply(this,arguments)},getDisplayName(){return this.get("nickname")||this.get("fullname")||this.get("jid")}}),Hc.VCards=ta.extend({model:Hc.VCard,initialize(){this.on("add",e=>e.get("jid")&&Gc.vcard.update(e))}}),Hc.initVCardCollection=async function(){Hc.vcards=new Hc.VCards,Hc.vcards.browserStorage=Hc.createStore("".concat(Hc.bare_jid,"-converse.vcards")),await new Promise(e=>{Hc.vcards.fetch({success:e,error:e},{silent:!0})});const e=Hc.vcards;if(Hc.session){const t=Hc.session.get("bare_jid");Hc.xmppstatus.vcard=e.findWhere({jid:t})||e.create({jid:t})}Gc.trigger("VCardsInitialized")},Gc.listen.on("chatBoxInitialized",e=>n(e)),Gc.listen.on("chatRoomInitialized",e=>n(e)),Gc.listen.on("chatRoomMessageInitialized",e=>r(e)),Gc.listen.on("addClientFeatures",()=>Gc.disco.own.features.add(fd.NS.VCARD)),Gc.listen.on("clearSession",()=>{Hc.shouldClearCache()&&(Gc.promises.add("VCardsInitialized"),Hc.vcards&&(Hc.vcards.clearStore(),delete Hc.vcards))}),Gc.listen.on("messageInitialized",e=>n(e)),Gc.listen.on("rosterContactInitialized",e=>n(e)),Gc.listen.on("statusInitialized",Hc.initVCardCollection),Object.assign(Hc.api,{vcard:{async set(t,n){if(!t)throw Error("No jid provided for the VCard data");const r=document.createElement("div"),i=md.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 Gc.sendIQ(e("set",t,i))}catch(e){throw e}return await Gc.vcard.update(t,!0),o},get(e,n){if("string"==typeof e)return t(Hc,e);if(!n&&e.get("vcard_updated")&&gd(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(Hc,n)}},async update(e,t){const n=await this.get(e,t);(e="string"==typeof e?Hc.vcards.findWhere({jid:e}):e)?(delete n.stanza,e.save(n)):Pn.error("Could not find a VCard model for ".concat(e))}}})}});var vd=n(64),_d=n.n(vd);function bd(e,t){return"string"==typeof e&&t.includes(e)}function yd(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=wd(window.navigator.userLanguage,e)),window.navigator.languages&&!t)for(n=0;n<window.navigator.languages.length&&!t;n++)t=wd(window.navigator.languages[n],e);return window.navigator.browserLanguage&&!t&&(t=wd(window.navigator.browserLanguage,e)),window.navigator.language&&!t&&(t=wd(window.navigator.language,e)),window.navigator.systemLanguage&&!t&&(t=wd(window.navigator.systemLanguage,e)),t||"en"}(t)||"en":e}function wd(e,t){if(t(e))return e;var n=e.split("-")[0];return n!==e&&t(n)?n:void 0}let Sd;Object.assign(Uc,{getLocale:(e,t)=>yd(e,e=>bd(e,t)),translate(e){if(!Sd)return _d.a.sprintf.apply(_d.a,arguments);const t=Sd.translate(e);return arguments.length>1?t.fetch.apply(t,[].slice.call(arguments,1)):t.fetch()},async initialize(){if(Hc.isTestEnv())Hc.locale="en";else try{Hc.locale=Uc.getLocale(Gc.settings.get("i18n"),Gc.settings.get("locales")),await async function(e){const{api:t,locale:r}=e,i=r.toLowerCase().replace("_","-");if(!bd(r,t.settings.get("locales"))||"en"===r)return;const{default:o}=await n(489)("./".concat(r,"/LC_MESSAGES/converse.po"));await n(490)("./".concat(i)),Sn.a.locale(yd(i,e=>Sn.a.locale(e))),Sd=new _d.a(o)}(Hc)}catch(e){Pn.fatal(e.message),Hc.locale="en"}},__:(...e)=>Uc.translate(...e)});const xd=Uc.__,Ed={};Gc.elements={registry:Ed,define:function(e,t){this.registry[e]=t},register:function(){Object.keys(Ed).forEach(e=>{customElements.get(e)||customElements.define(e,Ed[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 Ad=rl.env.utils,jd=function(e,t){return RegExp(Td.regExpEscape(t.trim()),"i").test(e)},Cd=function(e,t){return RegExp("^"+Td.regExpEscape(t.trim()),"i").test(e)},kd=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},Od=(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},Td={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])||Ad.isMentionBoundary(e[0])&&t.includes(e[1])};class Nd 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 Id{constructor(e,t={}){this.is_opened=!1,Ad.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:jd,sort:!1!==t.sort&&kd,item:Od},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)}},Td.bind(this.input,this._events.input),Td.bind(this.input.form,this._events.form),Td.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=Td.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?Ad.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(){Td.unbind(this.input,this._events.input),Td.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=Ad.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=Ad.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=Ad.ancestor(e.target,"li");t&&(e.preventDefault(),this.select(t,e.target))}onKeyDown(e){if(this.opened){if([rl.keycodes.ENTER,rl.keycodes.TAB].includes(e.keyCode)&&this.selected)return e.preventDefault(),e.stopPropagation(),this.select(),!0;if(e.keyCode===rl.keycodes.ESCAPE)return this.close({reason:"esc"}),!0;if([rl.keycodes.UP_ARROW,rl.keycodes.DOWN_ARROW].includes(e.keyCode))return e.preventDefault(),e.stopPropagation(),this[e.keyCode===rl.keycodes.UP_ARROW?"previous":"next"](),!0}if(![rl.keycodes.SHIFT,rl.keycodes.META,rl.keycodes.META_RIGHT,rl.keycodes.ESCAPE,rl.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=Ad.getCurrentWord(e.target,e.target.selectionEnd-1);Td.isMention(t,this.ac_triggers)&&(this.auto_completing=!0)}}async evaluate(e){const t=this.selected&&e&&(e.keyCode===rl.keycodes.UP_ARROW||e.keyCode===rl.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?Ad.getCurrentWord(this.input):this.input.value;const i=Td.isMention(r,this.ac_triggers);i&&(this.auto_completing=!0,this.include_triggers.includes(e.key)||(r=Ad.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 Nd(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 Md(){const e=Dd(['\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 Md=function(){return e},e}function Rd(){const e=Dd(['\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 Rd=function(){return e},e}function Dd(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Object.assign(Id.prototype,mi),rl.plugins.add("converse-autocomplete",{initialize(){const e=this._converse;e.FILTER_CONTAINS=jd,e.FILTER_STARTSWITH=Cd,e.AutoComplete=Id}});var Pd=e=>{const t=xd("Click to toggle the bookmarks list"),n=xd("Bookmarks");return Xa(Md(),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=xd("Unbookmark this groupchat"),n=xd("Click to open this groupchat");return Xa(Rd(),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 zd(){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 zd=function(){return e},e}const Ld=/^\s*</,Fd=("undefined"!=typeof Element&&Element.prototype,function(e){this.cid=gi("view"),this._domEvents=[],this.preinitialize.apply(this,arguments),Cr(this,Lo(e,qd)),this._ensureElement(),this.initialize.apply(this,arguments)});Fd.extend=Qr;const Bd=/^(\S+)\s*(.*)$/,qd=["model","collection","el","id","attributes","className","tagName","events"];Object.assign(Fd.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)&&Ya(this.toHTML(),this.el),M(this.afterRender)&&this.afterRender(),this},remove:function(){return this._removeElement(),this.stopListening(),this},_removeElement:function(){this.undelegateEvents(),this.el.parentNode&&this.el.parentNode.removeChild(this.el)},setElement:function(e){return this.undelegateEvents(),this._setElement(e),this.delegateEvents(),this},_setElement:function(e){if("string"==typeof e)if(Ld.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(Bd);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=Cr({},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 Ud=Ar((function(e,t,n){var r=-1,i="function"==typeof t,o=Qe(e)?Array(e.length):[];return gs(e,(function(e){o[++r]=i?_r(t,e,n):Dc(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:Hd}=rl.env,$d=rl.env.utils;rl.plugins.add("converse-bookmark-views",{dependencies:["converse-chatboxes","converse-muc","converse-muc-views"],initialize(){Gc.settings.extend({hide_open_bookmarks:!0}),Object.assign(Hc,{removeBookmarkViaEvent(e){e.preventDefault();const t=e.target.getAttribute("data-bookmark-name"),n=e.target.getAttribute("data-room-jid");confirm(xd('Are you sure you want to remove the bookmark "%1$s"?',t))&&Ud(Hc.bookmarks.where({jid:n}),Fo.prototype.destroy)},addBookmarkViaEvent(e){e.preventDefault();const t=e.target.getAttribute("data-room-jid");Gc.rooms.open(t,{bring_to_foreground:!0}),Hc.chatboxviews.get(t).renderBookmarkForm()}});const e={setBookmarkState(){if(void 0!==Hc.bookmarks){Hc.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 Hc.MUCBookmarkForm({model:this.model,chatroomview:this});this.el.querySelector(".chatroom-body").insertAdjacentElement("beforeend",this.bookmark_form.el)}$d.showElement(this.bookmark_form.el)},toggleBookmark(e){null==e||e.preventDefault();const t=Hc.bookmarks.where({jid:this.model.get("jid")});t.length?t.forEach(e=>e.destroy()):this.renderBookmarkForm()}};Object.assign(Hc.ChatRoomView.prototype,e),Hc.MUCBookmarkForm=Fd.extend({className:"muc-bookmark-form chatroom-form-container",initialize(e){this.chatroomview=e.chatroomview,this.render()},toHTML(){return(e=>{const t=xd("Bookmark this groupchat"),n=xd("Would you like this groupchat to be automatically joined upon startup?"),r=xd("Cancel"),i=xd("The name for this bookmark:"),o=xd("What should your nickname for this groupchat be?"),s=xd("Save");return Xa(zd(),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(),Hc.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()}}),Hc.BookmarksView=Fd.extend({tagName:"span",initialize(){this.listenTo(this.model,"add",this.render),this.listenTo(this.model,"remove",this.render),this.listenTo(Hc.chatboxes,"add",this.render),this.listenTo(Hc.chatboxes,"remove",this.render);const e="converse.room-bookmarks".concat(Hc.bare_jid,"-list-model");this.list_model=new Hc.BookmarksList({id:e}),this.list_model.browserStorage=Hc.createStore(e);const t=()=>{this.render(),this.insertIntoControlBox()};this.list_model.fetch({success:t,error:t})},toHTML(){return Pd({_converse:Hc,bookmarks:this.model,hidden:this.model.getUnopenedBookmarks().length&&!0,is_hidden:e=>!(!Gc.settings.get("hide_open_bookmarks")||!Hc.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=Hc.chatboxviews.get("controlbox");if(void 0!==e&&!$d.rootContains(Hc.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||Hd.unescapeNode(Hd.getNodeFromJid(n))||n};Gc.rooms.open(n,r,!0)},removeBookmark:Hc.removeBookmarkViaEvent,toggleBookmarksList(e){e&&e.preventDefault&&e.preventDefault();const t=e.target.matches(".fa")?e.target:e.target.querySelector(".fa");$d.hasClass("fa-caret-down",t)?($d.slideIn(this.el.querySelector(".bookmarks")),this.list_model.save({"toggle-state":Hc.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"),$d.slideOut(this.el.querySelector(".bookmarks")),this.list_model.save({"toggle-state":Hc.OPENED}))}});Gc.listen.on("getHeadingButtons",(e,t)=>{if(Hc.allow_bookmarks&&e.model.get("type")===Hc.CHATROOMS_TYPE){const n=e.model.get("bookmarked"),r={i18n_title:xd(n?"Unbookmark this groupchat":"Bookmark this groupchat"),i18n_text:xd(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=Hc.checkBookmarksSupport().then(e=>e?r:"");return i>-1?[...t.slice(0,i),o,...t.slice(i)]:[o,...t]}return t}),Gc.listen.on("bookmarksInitialized",(async function(){await Gc.waitUntil("roomsPanelRendered"),Hc.bookmarksview=new Hc.BookmarksView({model:Hc.bookmarks}),Gc.trigger("bookmarkViewsInitialized")})),Gc.listen.on("chatRoomViewInitialized",e=>e.setBookmarkState())}});var Wd=n(31),Vd=n.n(Wd);function Gd(){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 Gd=function(){return e},e}function Jd(){const e=Yd(['<button type="button" class="close" data-dismiss="modal" aria-label="','"><span aria-hidden="true">×</span></button>']);return Jd=function(){return e},e}function Qd(){const e=Yd(['<button type="button" class="btn btn-secondary" data-dismiss="modal">',"</button>"]);return Qd=function(){return e},e}function Yd(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const Kd=Xa(Qd(),xd("Close")),Xd=Xa(Jd(),xd("Close"));function Zd(){const e=th(["<p>","</p>"]);return Zd=function(){return e},e}function eh(){const e=th(['\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 eh=function(){return e},e}function th(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function nh(){const e=oh(["<p>","</p>"]);return nh=function(){return e},e}function rh(){const e=oh(['\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 rh=function(){return e},e}function ih(){const e=oh(['\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 ih=function(){return e},e}function oh(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var sh=e=>Xa(rh(),e.level||"",e.title,e.messages.map(e=>Xa(nh(),e)),e.fields.map(e=>(e=>Xa(ih(),e.label||"",e.name,e.challenge_failed?"error":"",e.required,e.placeholder))(e)),xd("OK"),xd("Cancel"));
/**
* @module converse-modal
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/const{sizzle:ah}=rl.env,ch=rl.env.utils;let lh;const uh=Fd.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=Vd.a.Modal;this.modal=new t(this.el,{backdrop:!0,keyboard:!0}),this.el.addEventListener("hide.bs.modal",()=>ch.removeClass("selected",this.trigger_el),!1)},insertIntoDOM(){lh.chatboxviews.el.querySelector("#converse-modals").insertAdjacentElement("beforeEnd",this.el)},switchTab(e){e.stopPropagation(),e.preventDefault(),ah(".nav-link.active",this.el).forEach(e=>{ch.removeClass("active",this.el.querySelector(e.getAttribute("href"))),ch.removeClass("active",e)}),ch.addClass("active",e.target),ch.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;Ya((r={type:"alert-".concat(t),message:e},Xa(Gd(),r.type,r.message)),n);const i=n.firstElementChild;setTimeout(()=>{ch.addClass("fade-out",i),setTimeout(()=>ch.removeElement(i),600)},5e3)},show(e){e&&(e.preventDefault(),this.trigger_el=e.target,this.trigger_el.classList.add("selected")),this.modal.show()}});rl.env.BootstrapModal=uh;const dh=uh.extend({events:{"submit .confirm":"onConfimation"},initialize(){this.confirmation=ch.getResolveablePromise(),uh.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change",this.render),this.el.addEventListener("closed.bs.modal",()=>this.confirmation.reject(),!1)},toHTML(){return sh(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()}}),hh=uh.extend({initialize(){uh.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change",this.render)},toHTML(){return e=Object.assign({__:xd},this.model.toJSON()),Xa(eh(),e.level,e.title,Xd,e.messages.map(e=>Xa(Zd(),e)));var e}});function fh(){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 fh=function(){return e},e}rl.plugins.add("converse-modal",{initialize(){let e;lh=this._converse,lh.api.listen.on("disconnect",()=>{const e=document.querySelector("#converse-modals");e&&(e.innerHTML="")}),Object.assign(lh.api,{async confirm(e,t=[],n=[]){"string"==typeof t&&(t=[t]);const r=new Fo({title:e,messages:t,fields:n,type:"confirm"}),i=new dh({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 Fo({title:e,messages:t,fields:[{name:"reason",placeholder:n}],type:"prompt"}),i=new dh({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 Fo({title:n,messages:r,level:i,type:"alert"});e=new hh({model:t})}else e.model.set({title:n,messages:r,level:i});e.show()}})}});var ph=uh.extend({toHTML(){return e={src:this.src,onload:e=>e.target.parentElement.style.height="".concat(e.target.height,"px")},Xa(fh(),xd("Image: "),e.src,e.src,Xd,e.src,e.onload,Kd);var e}}),gh=n(32),mh=n.n(gh);
/**
* @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 vh=new WeakMap,_h=ka((...e)=>t=>{let n=vh.get(t);void 0===n&&(n={lastRenderedIndex:2147483647,values:[]},vh.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(Pa(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 bh(){const e=wh(["",""]);return bh=function(){return e},e}function yh(){const e=wh(["",""]);return yh=function(){return e},e}function wh(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const Sh=ka((e,t,n)=>r=>r.setValue(function(e,t,n){const r=new $h(e,t,n,!1);return Xa(yh(),_h(async function(e){return await e.addTemplates(),e.payload}(r),Xa(bh(),r)))}(e,t,n)));function xh(){const e=Oh(['<span class="styling-directive">*</span><b>','</b><span class="styling-directive">*</span>']);return xh=function(){return e},e}function Eh(){const e=Oh(['<span class="styling-directive">~</span><del>','</del><span class="styling-directive">~</span>']);return Eh=function(){return e},e}function Ah(){const e=Oh(["<blockquote>","</blockquote>"]);return Ah=function(){return e},e}function jh(){const e=Oh(['<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 jh=function(){return e},e}function Ch(){const e=Oh(['<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 Ch=function(){return e},e}function kh(){const e=Oh(['<span class="styling-directive">_</span><i>','</i><span class="styling-directive">_</span>']);return kh=function(){return e},e}function Oh(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 Th=["*","_","~","`","```",">"],Nh={"*":{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"}},Ih=["_",">","`","~"],Mh={emphasis:(e,t,n)=>Xa(kh(),Sh(e,t,n)),preformatted:e=>Xa(Ch(),e),preformatted_block:e=>Xa(jh(),e),quote:(e,t,n)=>Xa(Ah(),Sh(e,t,n)),strike:(e,t,n)=>Xa(Eh(),Sh(e,t,n)),strong:(e,t,n)=>Xa(xh(),Sh(e,t,n))};function Rh(e,t,n=!0){let r;if(!/(^```\s*\n|^```\s*$)/.test(e.slice(t))||0!==t&&"\n"!==e[t-1]&&">"!==e[t-1]){if(!Th.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(Ih.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(Ih.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 Dh(e,t,n){const r=Nh[e].type;return t===n.length||Rh(n,t,!1)===e||"span"===r&&"\n"===n[t]}function Ph(e,t){const n=Rh(e,t),r=n?function(e,t,n){if(!e)return 0;const r=n;if(n+=e.length,zh(e))return(n+=t.slice(n).split(/\n[^>]/).shift().length)-r;if("span"===Nh[e].type){const r=t.slice(n+1).split("\n").shift();let i=0,o=r.indexOf(e);for(;-1!==o;){if(Dh(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(Dh(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 zh=e=>[">","&gt;"].includes(e);function Lh(e,t,n,r){const i=Mh[Nh[e].name];return zh(e)?i(t.replace(/\n>/g,"\n").replace(/\n$/,""),n,r):i(t,n,r)}function Fh(){const e=qh(['<span class="mention">',"</span>"]);return Fh=function(){return e},e}function Bh(){const e=qh(['<span class="mention mention--self badge badge-info">',"</span>"]);return Bh=function(){return e},e}function qh(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const Uh=rl.env.utils,Hh=e=>"string"==typeof e;class $h 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};mh.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=Uh.filterQueryParamsFromURL(r);this.addTemplateResult(n.start+t,n.end+t,this.show_images&&Uh.isImageURL(r)&&Uh.isImageDomainAllowed(r)?Uh.convertToImageTag(i,this.onImgLoad,this.onImgClick):Uh.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,Uh.convertUrlToHyperlink(e.input.replace(n,Hc.geouri_replacement)))}addEmojis(e,t){[...Ml(e.toString()),...Rl(e.toString())].forEach(e=>{this.addTemplateResult(e.begin+t,e.end+t,Il(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},Xa(Bh(),a.mention))):this.addTemplateResult(i,o,(e=>Xa(Fh(),e.mention))({mention:s}))})}addStyling(){if(this.model.get("is_unstyled")||!Gc.settings.get("allow_message_styling"))return;let e=0;const t=[];if(function(e){for(let t=0;t<Th.length;t++)if(e.includes(Th[t]))return!0}(this))for(;e<this.length;){const{d:n,length:r}=Ph(this,e);if(n&&r){const i="```"===n?e+n.length+1:e+n.length,o=zh(n)?e+r+1:e+r,s=zh(n)?o:o-n.length;t.push({begin:e,template:Lh(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&&(Hh(r)?(e.call(this,r,n),n+=r.length):n=r.end)}async addTemplates(){await Gc.trigger("beforeMessageBodyTransformed",this,{Synchronous:!0}),this.addStyling(),this.addReferences(this.addMentions),this.addReferences(this.addHyperlinks),this.addReferences(this.addMapURLs),await Gc.emojis.initialize(),this.addReferences(this.addEmojis),await Gc.trigger("afterMessageBodyTransformed",this,{Synchronous:!0}),this.payload=this.marshall(),this.trimMeMessage(),this.payload=this.payload.map(e=>Hh(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 Nl(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)=>Hh(t)?[...e,$h.replaceText(t)]:[...e,t],[])}}function Wh(){const e=Gh(["",""]);return Wh=function(){return e},e}function Vh(){const e=Gh(["",""]);return Vh=function(){return e},e}function Gh(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const Jh=rl.env.utils;class Qh{constructor(e){var t;this.model=e.model,this.component=e,this.chatview=null===(t=Jh.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=Gc.settings.get("show_images_inline"),t=new $h(this.text,this.model,0,e,()=>this.scrollDownOnImageLoad(),e=>this.component.showImageModal(e));return await t.addTemplates(),t.payload}render(){return Xa(Vh(),_h(this.transform(),Xa(Wh(),this.text)))}}const Yh=ka(e=>t=>{var n;const r=new Qh(e);t.setValue(r.render());const i=e.model;null===(n=i.collection)||void 0===n||n.trigger("rendered",i)});function Kh(){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 Kh=function(){return e},e}Gc.elements.define("converse-chat-message-body",class extends mc{static get properties(){return{model:{type:Object},is_me_message:{type:Boolean},text:{type:String}}}showImageModal(e){e.preventDefault(),void 0===this.image_modal&&(this.image_modal=new ph),this.image_modal.src=e.target.src,this.image_modal.render(),this.image_modal.show(e)}render(){return Yh(this)}});function Xh(){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 Xh=function(){return e},e}var Zh=e=>Xa(Xh(),e.url,e.label_download),ef=n(166),tf=n.n(ef),nf=n(167),rf=n.n(nf),of=n(61),sf=n.n(of),af=n(168),cf=n.n(af),lf=n(169),uf=n.n(lf),df=n(170),hf=n.n(df),ff=n(62),pf=n.n(ff);function gf(){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 gf=function(){return e},e}const mf=ka((e,t,n,r)=>i=>{i.setValue(Xa(gf(),t,e,r,(function(){const o=rl.env.utils;o.isURLWithImageExtension(e)?(i.setValue(o.convertUrlToHyperlink(t)),i.commit()):(i.setValue(mf("".concat(e,".png"),t,n,r)),i.commit())}),n))});function vf(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["",""]);return vf=function(){return e},e}var _f=n(171),bf=n.n(_f);function yf(){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 yf=function(){return e},e}function wf(){const e=xf(['<a target="_blank" rel="noopener" href="','">',"</a>"]);return wf=function(){return e},e}function Sf(){const e=xf(['\n <a target="_blank"\n rel="noopener"\n @click=','\n href="','">',"</a>"]);return Sf=function(){return e},e}function xf(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 Ef=["http","https","xmpp","mailto"];function Af(e,t){return{"muc#roomconfig_lang":"language","muc#roomconfig_roomsecret":null!=t&&t.new_password?"new-password":"current-password"}[e]}const jf={"text-private":"password","text-single":"text",fixed:"label",boolean:"checkbox",hidden:"hidden","jid-multi":"textarea","list-single":"dropdown","list-multi":"dropdown"};function Cf(e){try{return e instanceof mh.a?e:new mh.a(e)}catch(e){return Pn.debug(e),null}}function kf(e,t){const n=Cf(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 Of(e){try{return decodeURI(e.filename())}catch(t){return Pn.debug(t),e.filename()}}function Tf(e,t){const{__:n}=e;return r={url:t.toString(),label_download:n('Download audio file "%1$s"',Of(t))},Xa(Kh(),r.url,r.url,r.label_download);var r}function Nf(e,t){e.classList.remove("visible"),M(t)&&t()}Vo.isAudioURL=e=>kf([".ogg",".mp3",".m4a"],e),Vo.isVideoURL=e=>kf([".mp4",".webm"],e),Vo.isURLWithImageExtension=e=>kf([".jpg",".jpeg",".png",".gif",".bmp",".tiff",".svg"],e),Vo.isImageURL=e=>{const t=Gc.settings.get("image_urls_regex");return(null==t?void 0:t.test(e))||Vo.isURLWithImageExtension(e)},Vo.isImageDomainAllowed=e=>{const t=Gc.settings.get("show_images_inline");if(!Array.isArray(t))return!0;try{const n=Cf(e).domain();return t.includes(n)}catch(e){return Pn.debug(e),!0}},Vo.getOOBURLMarkup=function(e,t){const n=Cf(t);return null===n?t:Vo.isVideoURL(n)?(r={url:t},Xa(yf(),r.url)):Vo.isAudioURL(n)?Tf(e,n):Vo.isImageURL(n)?function(e,t){const{__:n}=e;return Zh({url:t.toString(),label_download:n('Download image file "%1$s"',Of(t))})}(e,n):function(e,t){const{__:n}=e;return Zh({url:t.toString(),label_download:n('Download file "%1$s"',Of(t))})}(e,n);var r},Vo.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},Vo.calculateElementHeight=function(e){return Array.from(e.children).reduce((e,t)=>e+t.offsetHeight,0)},Vo.getNextElement=function(e,t="*"){let n=e.nextElementSibling;for(;null!==n&&!pr.a.matchesSelector(n,t);)n=n.nextElementSibling;return n},Vo.getPreviousElement=function(e,t="*"){let n=e.previousElementSibling;for(;null!==n&&!pr.a.matchesSelector(n,t);)n=n.previousElementSibling;return n},Vo.getFirstChildElement=function(e,t="*"){let n=e.firstElementChild;for(;null!==n&&!pr.a.matchesSelector(n,t);)n=n.nextElementSibling;return n},Vo.getLastChildElement=function(e,t="*"){let n=e.lastElementChild;for(;null!==n&&!pr.a.matchesSelector(n,t);)n=n.previousElementSibling;return n},Vo.hasClass=function(e,t){return t instanceof Element&&t.classList.contains(e)},Vo.toggleClass=function(e,t){Vo.hasClass(e,t)?Vo.removeClass(e,t):Vo.addClass(e,t)},Vo.addClass=function(e,t){return t instanceof Element&&t.classList.add(e),t},Vo.removeClass=function(e,t){return t instanceof Element&&t.classList.remove(e),t},Vo.removeElement=function(e){return e instanceof Element&&e.parentNode&&e.parentNode.removeChild(e),e},Vo.getElementFromTemplateResult=function(e){const t=document.createElement("div");return Ya(e,t),t.firstElementChild},Vo.showElement=e=>{Vo.removeClass("collapsed",e),Vo.removeClass("hidden",e)},Vo.hideElement=function(e){return e instanceof Element&&e.classList.add("hidden"),e},Vo.ancestor=function(e,t){let n=e;for(;null!==n&&!pr.a.matchesSelector(n,t);)n=n.parentElement;return n},Vo.nextUntil=function(e,t){const n=[];let r=e.nextElementSibling;for(;null!==r&&!r.matches(t);)n.push(r),r=r.nextElementSibling;return n},Vo.unescapeHTML=function(e){var t=document.createElement("div");return t.innerHTML=e,t.innerText},Vo.escapeHTML=function(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")},Vo.convertToImageTag=function(e,t,n){return r={url:e,onClick:n,onLoad:t},Xa(vf(),mf(r.url,r.url,r.onLoad,r.onClick));var r},Vo.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?Xa(Sf(),e=>Gc.rooms.open(e.target.href),n,i):Xa(wf(),n,i)},Vo.convertUrlToHyperlink=function(e){const t=RegExp("^w{3}.","ig").test(e)?"http://".concat(e):e,n=Cf(e);return null===n||!function(e){try{return!!new URL(e)}catch(e){return!1}}(t)||!function(e,t=Ef){return!!t.includes(e)}(n._parts.protocol)&&n._parts.protocol?e:this.convertURIoHyperlink(n,e)},Vo.filterQueryParamsFromURL=function(e){const t=Gc.settings.get("filter_url_query_params");if(!t)return e;return Cf(e).removeQuery(t).toString()},Vo.addHyperlinks=function(e){const t=[],n={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|xmpp:|mailto:|www\.)/gi};try{mh.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),Vo.convertUrlToHyperlink(n),t.slice(e.end),...r]}):r=[e],r},Vo.httpToGeoUri=function(e,t){return e.replace(t.api.settings.get("geouri_regex"),"geo:$1,$2")},Vo.slideInAllElements=function(e,t=300){return Promise.all(Array.from(e).map(e=>Vo.slideIn(e,t)))},Vo.slideToggleElement=function(e,t){return Vo.hasClass("collapsed",e)||Vo.hasClass("hidden",e)?Vo.slideOut(e,t):Vo.slideIn(e,t)},Vo.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=Vo.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(!Vo.hasClass("collapsed",e)&&!Vo.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=Vo.calculateElementHeight(e)+"px",e.style.overflow="",e.style.height="",n())})))})},Vo.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(Vo.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))})))})},Vo.isInDOM=function(e){return document.querySelector("body").contains(e)},Vo.isVisible=function(e){return null!==e&&(!Vo.hasClass("hidden",e)&&(e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0))},Vo.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"),Nf(e,t);Vo.hasClass("hidden",e)?(e.classList.add("visible"),e.classList.remove("hidden"),e.addEventListener("webkitAnimationEnd",()=>Nf(e,t)),e.addEventListener("animationend",()=>Nf(e,t)),e.addEventListener("oanimationend",()=>Nf(e,t))):Nf(e,t)},Vo.xForm2webForm=function(e,t,n){if("list-single"===e.getAttribute("type")||"list-multi"===e.getAttribute("type")){const t=Vo.queryChildren(e,"value").map(e=>null==e?void 0:e.textContent),n=Vo.queryChildren(e,"option").map(n=>{var r;const i=null===(r=n.querySelector("value"))||void 0===r?void 0:r.textContent;return bf()({value:i,label:n.getAttribute("label"),selected:t.includes(i),required:!!e.querySelector("required")})});return cf()({id:Vo.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 uf()({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 rf()({id:Vo.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 hf()({label:e.getAttribute("label")||"",value:null===(o=e.querySelector("value"))||void 0===o?void 0:o.textContent});if("username"===e.getAttribute("var"))return pf()({domain:" @"+n.domain,name:e.getAttribute("var"),type:jf[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 tf()({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 sf()({id:Vo.getUniqueId(),label:e.getAttribute("label")||"",name:t,fixed_username:null==n?void 0:n.fixed_username,autocomplete:Af(t,n),placeholder:null,required:!!e.querySelector("required"),type:jf[e.getAttribute("type")],value:null===(c=e.querySelector("value"))||void 0===c?void 0:c.textContent})}};var If=Vo;const{keycodes:Mf}=rl;function Rf(e){let t=0;do{isNaN(e.offsetTop)||(t+=e.offsetTop)}while(e=e.offsetParent);return t}function Df(e){let t=0;do{isNaN(e.offsetLeft)||(t+=e.offsetLeft)}while(e=e.offsetParent);return t}class Pf{static get DIRECTION(){return{down:"down",end:"end",home:"home",left:"left",right:"right",up:"up"}}static get DEFAULTS(){return{home:["".concat(Mf.SHIFT,"+").concat(Mf.UP_ARROW)],end:["".concat(Mf.SHIFT,"+").concat(Mf.DOWN_ARROW)],up:[Mf.UP_ARROW],down:[Mf.DOWN_ARROW],left:[Mf.LEFT_ARROW,"".concat(Mf.SHIFT,"+").concat(Mf.TAB)],right:[Mf.RIGHT_ARROW,Mf.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({},Pf.DEFAULTS,t),this.init()}init(){this.selected=null,this.keydownHandler=null,this.elements={},this.keys={},this.options.down.forEach(e=>this.keys[e]=Pf.DIRECTION.down),this.options.end.forEach(e=>this.keys[e]=Pf.DIRECTION.end),this.options.home.forEach(e=>this.keys[e]=Pf.DIRECTION.home),this.options.left.forEach(e=>this.keys[e]=Pf.DIRECTION.left),this.options.right.forEach(e=>this.keys[e]=Pf.DIRECTION.right),this.options.up.forEach(e=>this.keys[e]=Pf.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===Pf.DIRECTION.home)t=this.getElements(e)[0];else if(e===Pf.DIRECTION.end)t=Array.from(this.getElements(e)).pop();else if(this.selected)if(e===Pf.DIRECTION.right){const n=this.getElements(e);t=n.slice(n.indexOf(this.selected))[1]}else if(e==Pf.DIRECTION.left){const n=this.getElements(e);t=n.slice(0,n.indexOf(this.selected)).pop()||this.selected}else if(e==Pf.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=Pf.getClosestElement(r,i)}else{if(e!=Pf.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=Pf.getClosestElement(r,i)}}else t=e===Pf.DIRECTION.right||e===Pf.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():If.addClass(this.options.selected,e),this.selected=e,this.options.onSelected&&this.options.onSelected(e))}unselect(){this.selected&&(If.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 Pf.DIRECTION.left:document.body.scrollLeft=Df(e)-document.body.offsetLeft;break;case Pf.DIRECTION.up:document.body.scrollTop=Rf(e)-document.body.offsetTop;break;case Pf.DIRECTION.right:document.body.scrollLeft=Df(e)-document.body.offsetLeft-(document.documentElement.clientWidth-e.offsetWidth);break;case Pf.DIRECTION.down:document.body.scrollTop=Rf(e)-document.body.offsetTop-(document.documentElement.clientHeight-e.offsetHeight)}}else{const n=this.scroll_container;if(!n.contains(e))return;switch(t){case Pf.DIRECTION.left:n.scrollLeft=e.offsetLeft-n.offsetLeft,n.scrollTop=e.offsetTop-n.offsetTop;break;case Pf.DIRECTION.up:n.scrollTop=e.offsetTop-n.offsetTop;break;case Pf.DIRECTION.right:n.scrollLeft=e.offsetLeft-n.offsetLeft-(n.offsetWidth-e.offsetWidth),n.scrollTop=e.offsetTop-n.offsetTop-(n.offsetHeight-e.offsetHeight);break;case Pf.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(Pf.DIRECTION.down).filter(n=>n.offsetLeft>=e&&n.offsetTop>=t)}elementsBefore(e,t){return this.getElements(Pf.DIRECTION.up).filter(n=>n.offsetLeft<=e&&n.offsetTop<=t)}handleKeydown(e){const t=Mf,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 zf=Pf;function Lf(){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 Lf=function(){return e},e}const Ff=rl.env.utils;class Bf extends mc{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;Ff.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(){Ff.addClass("show",this.menu),this.button.setAttribute("aria-expanded",!0)}toggleMenu(e){e.preventDefault(),Ff.hasClass("show",this.menu)?this.hideMenu():this.showMenu()}handleKeyUp(e){e.keyCode===rl.keycodes.ESCAPE?this.hideMenu():e.keyCode===rl.keycodes.DOWN_ARROW&&this.navigator&&!this.navigator.enabled&&this.enableArrowNavigation(e)}}function qf(){const e=$f(['<converse-dropdown class="chat-msg__actions" .items=',"></converse-dropdown>"]);return qf=function(){return e},e}function Uf(){const e=$f(['\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 Uf=function(){return e},e}function Hf(){const e=$f(["",""]);return Hf=function(){return e},e}function $f(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Gc.elements.define("converse-dropdown",class extends Bf{static get properties(){return{icon_classes:{type:String},items:{type:Array}}}render(){const e=this.icon_classes||"fa fa-bars";return Xa(Lf(),e,this.items.map(e=>_h(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 zf(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!==rl.keycodes.DOWN_ARROW||this.navigator.enabled||this.enableArrowNavigation(e)}});class Wf extends mc{static get properties(){return{chatview:{type:Object},model:{type:Object},editable:{type:Boolean},correcting:{type:Boolean},message_type:{type:String},is_retracted:{type:Boolean}}}render(){return Xa(Hf(),_h(this.renderActions(),""))}static getActionsDropdownItem(e){return Xa(Uf(),e.button_class,e.handler,e.icon_class,Gc.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?xd("Cancel Editing"):xd("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:xd("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=>Wf.getActionsDropdownItem(e));return n.length?Xa(qf(),n):""}}function Vf(){const e=Jf(['<p class="older-msg"><time>',"</time>: ","</p>"]);return Vf=function(){return e},e}function Gf(){const e=Jf(['\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 Gf=function(){return e},e}function Jf(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Gc.elements.define("converse-message-actions",Wf);var Qf=uh.extend({id:"message-versions-modal",toHTML(){return e=this.model.toJSON(),Xa(Gf(),xd("Message versions"),Xd,Object.keys(e.older_versions).map(t=>Xa(Vf(),Sn()(t).format("MMM D, YYYY, HH:mm:ss"),e.older_versions[t])),e.message,Kd);var e}});function Yf(){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 slice" href="','"/>\n </svg>']);return Yf=function(){return e},e}var Kf=e=>{return Xa(Yf(),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 Xf=ka(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(Kf(n))});function Zf(){const e=ip(['\n <time timestamp="','" class="chat-msg__time">','</time>&nbsp;\n <span class="chat-msg__author">',"","</span>&nbsp;"]);return Zf=function(){return e},e}function ep(){const e=ip(['<span class="fa fa-lock"></span>']);return ep=function(){return e},e}function tp(){const e=ip(['\n <span class="chat-msg__heading">\n <span class="chat-msg__author">',"</span>\n ","\n ","\n </span>"]);return tp=function(){return e},e}function np(){const e=ip(['<div class="message separator"><hr class="separator"><span class="separator-text">',"</span></div>"]);return np=function(){return e},e}function rp(){const e=ip(["\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 rp=function(){return e},e}function ip(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function op(){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 op=function(){return e},e}var sp=(e={})=>Xa(op(),e.classes||"");function ap(){const e=Sp(['<span class="badge badge-secondary">',"</span>"]);return ap=function(){return e},e}function cp(){const e=Sp(["\n ",'\n <time timestamp="','" class="chat-msg__time">',"</time>\n "]);return cp=function(){return e},e}function lp(){const e=Sp(['<div class="chat-msg__media">',"</div>"]);return lp=function(){return e},e}function up(){const e=Sp(['<i title="','" class="fa fa-edit chat-msg__edit-modal" @click=',"></i>"]);return up=function(){return e},e}function dp(){const e=Sp(['<span class="fa fa-check chat-msg__receipt"></span>']);return dp=function(){return e},e}function hp(){const e=Sp(['<div class="chat-msg__subject">',"</div>"]);return hp=function(){return e},e}function fp(){const e=Sp(["\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 fp=function(){return e},e}function pp(){const e=Sp(['\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 pp=function(){return e},e}function gp(){const e=Sp(['<q class="chat-msg--retracted__reason">',"</q>"]);return gp=function(){return e},e}function mp(){const e=Sp(["\n <div>","</div>\n ","\n "]);return mp=function(){return e},e}function vp(){const e=Sp(['\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 vp=function(){return e},e}function _p(){const e=Sp(['<a class="retry" @click=',">","</a>"]);return _p=function(){return e},e}function bp(){const e=Sp(['<q class="reason">',"</q>"]);return bp=function(){return e},e}function yp(){const e=Sp(['<q class="reason">',"</q>"]);return yp=function(){return e},e}function wp(){const e=Sp(['\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 wp=function(){return e},e}function Sp(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const{Strophe:xp}=rl.env,Ep=rl.env.utils;class Ap extends mc{static get properties(){return{chatview:{type:Object},correcting:{type:Boolean},editable:{type:Boolean},edited:{type:String},error:{type:String},error_text:{type:String},from:{type:String},has_mentions:{type:Boolean},hats:{type:Array},is_delayed:{type:Boolean},is_encrypted:{type:Boolean},is_first_unread:{type:Boolean},is_me_message:{type:Boolean},is_only_emojis:{type:Boolean},is_retracted:{type:Boolean},is_spoiler:{type:Boolean},is_spoiler_visible:{type:Boolean},message_type:{type:String},model:{type:Object},moderated_by:{type:String},moderation_reason:{type:String},msgid:{type:String},occupant_affiliation:{type:String},occupant_role:{type:String},oob_url:{type:String},progress:{type:Number},reason:{type:String},received:{type:String},retractable:{type:Boolean},retry_event_id:{type:String},sender:{type:String},show_spinner:{type:Boolean},spoiler_hint:{type:String},subject:{type:String},time:{type:String},username:{type:String}}}render(){const e=Gc.settings.get("time_format");return this.pretty_time=Sn()(this.edited||this.time).format(e),this.show_spinner?sp():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,qp(t,this.model)),Object.keys(e.changed).filter(e=>Object.keys(Ap.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=xd("Retry");return Xa(wp(),this.message_type,e,this.data_name,this.data_value,this.model.getMessageText(),this.reason?Xa(yp(),this.reason):"",this.error_text?Xa(bp(),this.error_text):"",this.retry_event_id?Xa(_p(),this.onRetryClicked,t):"")}renderFileProgress(){const e=xd("Uploading file:"),t=this.model.file.name,n=ul()(this.model.file.size);return Xa(vp(),Xf(this.getAvatarData()),e,t,n,this.progress)}renderChatMessage(){return(e=>{const t=xd("New messages");return Xa(rp(),e.is_first_unread?Xa(np(),t):"",e.getExtraMessageClasses(),e.time,e.msgid,e.from,e.is_encrypted,e.msgid,e.shouldShowAvatar()?Xf(e.getAvatarData()):"",e.sender,e.is_me_message?"chat-msg__content--action":"",e.is_me_message?"":Xa(tp(),e.username,e.renderAvatarByline(),e.is_encrypted?Xa(ep()):""),e.message_type,e.received?"chat-msg__body--received":"",e.is_delayed?"chat-msg__body--delayed":"",e.is_me_message?Xa(Zf(),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 Gc.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"))||Hc.DEFAULT_IMAGE_TYPE)+";base64,"+((null===(t=this.model.vcard)||void 0===t?void 0:t.get("image"))||Hc.DEFAULT_IMAGE)}}async onRetryClicked(){this.show_spinner=!0,await Gc.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:xp.getResourceFromJid(e)}));const n=this.model.mod?this.model.mod.getDisplayName():"A moderator";return xd("%1$s has removed this message",n)}return xd("%1$s has removed this message",this.model.getDisplayName())}renderRetraction(){const e=this.is_retracted?this.getRetractionText():null;return Xa(mp(),e,this.moderation_reason?Xa(gp(),this.moderation_reason):"")}renderMessageText(){const e=xd("This message has been edited"),t=xd("Show more"),n="groupchat"===this.message_type,r=xd("Show less"),i=Xa(pp(),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 Xa(fp(),this.is_spoiler?i:"",this.subject?Xa(hp(),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?"":Xa(dp()),this.edited?Xa(up(),e,this.showMessageVersionsModal):"",this.oob_url?Xa(lp(),Ep.getOOBURLMarkup(Hc,this.oob_url)):"",this.error_text||this.error)}renderAvatarByline(){return Xa(cp(),this.hats.map(e=>Xa(ap(),e.title)),this.edited||this.time,this.pretty_time)}showMessageVersionsModal(e){e.preventDefault(),void 0===this.message_versions_modal&&(this.message_versions_modal=new Qf({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 jp(){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 jp=function(){return e},e}Gc.elements.define("converse-chat-message",Ap);
/**
* @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 Cp=(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 Ba(e.options);return o.insertAfterNode(i),o},kp=(e,t)=>(e.setValue(t),e.commit(),e),Op=(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)},Tp=e=>{ga(e.startNode.parentNode,e.startNode,e.endNode.nextSibling)},Np=(e,t,n)=>{const r=new Map;for(let i=t;i<=n;i++)r.set(e[i],i);return r},Ip=new WeakMap,Mp=new WeakMap,Rp=ka((e,t,n)=>{let r;return void 0===n?n=t:void 0!==t&&(r=t),t=>{if(!(t instanceof Ba))throw new Error("repeat can only be used in text bindings");const i=Ip.get(t)||[],o=Mp.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]=kp(i[h],a[p]),h++,p++;else if(o[f]===c[g])s[g]=kp(i[f],a[g]),f--,g--;else if(o[h]===c[g])s[g]=kp(i[h],a[g]),Op(t,i[h],s[g+1]),h++,g--;else if(o[f]===c[p])s[p]=kp(i[f],a[p]),Op(t,i[f],i[h]),f--,p++;else if(void 0===l&&(l=Np(c,p,g),u=Np(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=Cp(t,i[h]);kp(e,a[p]),s[p]=e}else s[p]=kp(n,a[p]),Op(t,n,i[h]),i[e]=null;p++}else Tp(i[f]),f--;else Tp(i[h]),h++;for(;p<=g;){const e=Cp(t,s[g+1]);kp(e,a[p]),s[p++]=e}for(;h<=f;){const e=i[h++];null!==e&&Tp(e)}Ip.set(t,s),Mp.set(t,c)}});function Dp(){const e=Lp(['<div class="empty-history-feedback form-help"><span>',"</span></div>"]);return Dp=function(){return e},e}function Pp(){const e=Lp(["",""]);return Pp=function(){return e},e}function zp(){const e=Lp(["\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 zp=function(){return e},e}function Lp(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const Fp=xd("No message history available.");function Bp(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")},Xa(jp(),i.time,i.time,i.datestring)}var i}function qp(e,t){return{has_mentions:"groupchat"===t.get("type")&&"them"===t.get("sender")&&e.isUserMentioned(t),hats:Hc.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()}}Hc.getHats=function(e){if("groupchat"===e.get("type")){var t;const n=Gc.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[]};Gc.elements.define("converse-message-history",class extends mc{static get properties(){return{chatview:{type:Object},messages:{type:Array}}}render(){const e=this.messages;return e.length?Xa(Pp(),Rp(e,e=>e.get("id"),e=>this.renderMessage(e))):Xa(Dp(),Fp)}renderMessage(e){if(e.get("dangling_retraction")||e.get("is_only_key"))return"";const t=Bp(e);var n;return[...t?[t]:[],(n=Object.assign(e.toJSON(),qp(this.chatview.model,e),{chatview:this.chatview,model:e}),Xa(zp(),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 Up=n(14),Hp=n.n(Up);
/**
* @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 $p=new WeakMap,Wp=ka(e=>t=>{if(!(t instanceof Ba))throw new Error("unsafeHTML can only be used in text bindings");const n=$p.get(t);if(void 0!==n&&Pa(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),$p.set(t,{value:e,fragment:i})});function Vp(){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 Vp=function(){return e},e}function Gp(){const e=Qp(['<svg .style="','"> <use href="','"> </use> </svg>']);return Gp=function(){return e},e}function Jp(){const e=Qp(["\n :host {\n display: inline-block;\n padding: 0;\n margin: 0;\n }\n "]);return Jp=function(){return e},e}function Qp(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)
*/Gc.elements.define("converse-chat-content",class extends mc{static get properties(){return{chatview:{type:Object},messages:{type:Array},notifications:{type:String}}}render(){const e=Hp.a.filterXSS(this.notifications,{whiteList:{}});return Xa(Vp(),this.chatview,this.messages,Wp(e))}});function Yp(){const e=Xp(['<div class="message chat-','" data-isodate="','">',"</div>"]);return Yp=function(){return e},e}function Kp(){const e=Xp(['<converse-icon class="fas fa-times close-chat-help"\n @click=','\n path-prefix="','"\n size="1em"></converse-icon>']);return Kp=function(){return e},e}function Xp(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}customElements.define("converse-icon",class extends mc{static get properties(){return{color:String,class_name:{attribute:"class"},style:String,size:String}}static get styles(){return fc(Jp())}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 Xa(Gp(),this.getStyles(),this.getSource())}});function Zp(){const e=cg(["<converse-emoji-picker-content\n .chatview=","\n .model=",'\n .search_results="','"\n current_skintone="','"\n query="','"></converse-emoji-picker-content>']);return Zp=function(){return e},e}function eg(){const e=cg(['\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 eg=function(){return e},e}function tg(){const e=cg(['\n <li data-skintone="','" class="emoji-skintone ','">\n <a class="pick-skintone" href="#" data-skintone="','" @click=',">","</a>\n </li>"]);return tg=function(){return e},e}function ng(){const e=cg(["\n <span ?hidden=",' class="emoji-lists__container emoji-lists__container--browse">\n ',"\n </span>"]);return ng=function(){return e},e}function rg(){const e=cg(['\n <a id="emoji-picker-','" class="emoji-category__heading" data-category="','">','</a>\n <ul class="emoji-picker" data-category="','">\n ',"\n </ul>"]);return rg=function(){return e},e}function ig(){const e=cg(["\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 ig=function(){return e},e}function og(){const e=cg(['\n <li class="emoji insert-emoji ','" data-emoji="','" title="','">\n <a href="#" @click=',' data-emoji="','">',"</a>\n </li>\n "]);return og=function(){return e},e}function sg(){const e=cg(["<ul>","</ul>"]);return sg=function(){return e},e}function ag(){const e=cg(['\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 ag=function(){return e},e}function cg(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Gc.elements.define("converse-chat-help",class extends mc{static get properties(){return{chat_type:{type:String},messages:{type:Array},model:{type:Object},type:{type:String}}}render(){const e=(new Date).toISOString();return[Xa(Kp(),this.close,Gc.settings.get("assets_path")),...this.messages.map(t=>this.renderHelpMessage({isodate:e,markup:Hp.a.filterXSS(t,{whiteList:{strong:[]}})}))]}close(){this.model.set({show_help_messages:!1})}renderHelpMessage(e){return Xa(Yp(),this.type,e.isodate,Wp(e.markup))}});const lg=rl.env.utils,ug=e=>{const t=Gc.settings.get("emoji_categories");return Xa(sg(),Object.keys(t).map(n=>t[n]?(e=>Xa(ag(),e.category,e.category,e.current_category===e.category?"picked":"",xd(Hc.emoji_category_labels[e.category]),e.onCategoryPicked,e.category,e.category,e.emoji))(Object.assign({category:n,emoji:e.sn2Emoji(t[n])},e)):""))},dg=e=>Xa(og(),e.shouldBeHidden(e.emoji.sn)?"hidden":"",e.emoji.sn,e.emoji.sn,e.insertEmoji,e.emoji.sn,lg.shortnamesToEmojis(e.emoji.sn)),hg=e=>{const t=Gc.settings.get("emoji_categories");return Xa(ng(),e.query,Object.keys(t).map(n=>t[n]?(e=>Xa(rg(),e.category,e.category,xd(Gc.settings.get("emoji_category_labels")[e.category]),e.category,Object.values(rl.emojis.json[e.category]).map(t=>dg(Object.assign({emoji:t},e)))))(Object.assign({category:n},e)):""))},fg=e=>{const t=xd("Search");return Xa(eg(),t,e.query||"",e.onSearchInputKeyDown,e.onSearchInputBlurred,e.onSearchInputFocus,e.query?"":ug(e),e.render_emojis?Xa(Zp(),e.chatview,e.model,e.search_results,e.current_skintone,e.query):"",["tone1","tone2","tone3","tone4","tone5"].map(t=>(e=>Xa(tg(),e.skintone,e.current_skintone===e.skintone?"picked":"",e.skintone,e.onSkintonePicked,lg.shortnamesToEmojis(":"+e.skintone+":")))(Object.assign({skintone:t},e))))};function pg(){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 pg=function(){return e},e}function gg(){const e=vg(["\n <converse-emoji-picker\n .chatview=","\n .model=","\n ?render_emojis=",'\n current_category="','"\n current_skintone="','"\n query="','"\n ></converse-emoji-picker>']);return gg=function(){return e},e}function mg(){const e=vg(['\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 mg=function(){return e},e}function vg(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Gc.elements.define("converse-emoji-picker-content",class extends mc{static get properties(){return{chatview:{type:Object},search_results:{type:Array},current_skintone:{type:String},model:{type:Object},query:{type:String}}}render(){const 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 Xa(pg(),(e=>{const t=xd("Search results");return Xa(ig(),!e.query,t,e.search_results.map(t=>dg(Object.assign({emoji:t},e))))})(e),hg(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&&rl.emojis.toned.includes(e))return!0;return!(!this.query||Hc.FILTER_CONTAINS(e,this.query))}});const _g=rl.env.utils;function bg(){const e=Tg(["",""]);return bg=function(){return e},e}function yg(){const e=Tg(['\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 yg=function(){return e},e}function wg(){const e=Tg(['\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 wg=function(){return e},e}function Sg(){const e=Tg(['\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 Sg=function(){return e},e}function xg(){const e=Tg(["",""]);return xg=function(){return e},e}function Eg(){const e=Tg(['<span class="right message-limit" title="','">',"</span>"]);return Eg=function(){return e},e}function Ag(){const e=Tg(['\n <button class="toggle-call" @click=',' title="','">\n <converse-icon class="fa fa-phone" path-prefix="/dist" size="1em"></converse-icon>\n </button>']);return Ag=function(){return e},e}function jg(){const e=Tg(["<converse-emoji-dropdown .chatview=","></converse-dropdown>"]);return jg=function(){return e},e}function Cg(){const e=Tg(['<button type="submit" class="btn send-button fa fa-paper-plane" title="','"></button>']);return Cg=function(){return e},e}function kg(){const e=Tg(['<span class="toolbar-buttons">',"</span>"]);return kg=function(){return e},e}function Og(){const e=Tg(["\n ","\n ","\n "]);return Og=function(){return e},e}function Tg(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Gc.elements.define("converse-emoji-dropdown",class extends Bf{static get properties(){return{chatview:{type:Object}}}constructor(){super(),this.render_emojis=!1}initModel(){return this.init_promise||(this.init_promise=(async()=>{await Gc.emojis.initialize();const e="converse.emoji-".concat(Hc.bare_jid,"-").concat(this.chatview.model.get("jid"));this.model=new Hc.EmojiPicker({id:e}),this.model.browserStorage=Hc.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 Xa(mg(),xd("Insert emojis"),Gc.settings.get("assets_path"),_h(this.initModel().then(()=>Xa(gg(),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(),_g.hasClass("show",this.menu)?_g.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()})}}),Gc.elements.define("converse-emoji-picker",class extends mc{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=Rc(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 fg({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=>_g.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=Hc.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=rl.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===rl.keycodes.ENTER&&this.navigator.selected&&_g.isVisible(this)?this.onEnterPressed(e):e.keyCode===rl.keycodes.DOWN_ARROW&&!this.navigator.enabled&&_g.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:_g.ancestor(e.target,"li");this.setCategoryForElement(t),this.navigator.select(t),!this.navigator.enabled&&this.navigator.enable()}onKeyDown(e){if(e.keyCode===rl.keycodes.TAB)if(e.target.value){e.preventDefault();const t=rl.emojis.shortnames.find(t=>Hc.FILTER_CONTAINS(t,e.target.value));t&&this.model.set({query:t})}else this.navigator.enabled||this.enableArrowNavigation(e);else e.keyCode!==rl.keycodes.DOWN_ARROW||this.navigator.enabled?e.keyCode===rl.keycodes.ENTER?this.onEnterPressed(e):e.keyCode===rl.keycodes.ESCAPE?(_g.ancestor(this,"converse-emoji-dropdown").hideMenu(),this.chatview.el.querySelector(".chat-textarea").focus(),e.stopPropagation(),e.preventDefault()):e.keyCode!==rl.keycodes.ENTER&&e.keyCode!==rl.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,rl.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 rl.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:zf.DIRECTION.down,picked_selector:".picked",scroll_container:this.querySelector(".emoji-picker__lists"),getSelector:t=>{if(t===zf.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 zf(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 Ng=rl.env.Strophe;window.customElements.define("converse-chat-toolbar",class extends mc{static get properties(){return{chatview:{type:Object},composing_spoiler:{type:Boolean},hidden_occupants:{type:Boolean},is_groupchat:{type:Boolean},message_limit:{type:Number},model:{type:Object},show_call_button:{type:Boolean},show_emoji_button:{type:Boolean},show_occupants_toggle:{type:Boolean},show_send_button:{type:Boolean},show_spoiler_button:{type:Boolean},show_toolbar:{type:Boolean}}}render(){const e=xd("Send the message");return Xa(Og(),this.show_toolbar?Xa(kg(),_h(this.getButtons(),"")):"",this.show_send_button?Xa(Cg(),e):"")}getButtons(){const e=[];if(this.show_emoji_button&&e.push(Xa(jg(),this.chatview)),this.show_call_button){const t=xd("Start a call");e.push(Xa(Ag(),this.toggleCall,t))}const t=xd("Message characters remaining");Gc.settings.get("message_limit")&&e.push(Xa(Eg(),t,this.message_limit)),this.show_spoiler_button&&e.push(this.getSpoilerButton());const n=Gc.disco.supports(Ng.NS.HTTPUPLOAD,Hc.domain);if(e.push(Xa(xg(),_h(n.then(e=>this.getHTTPUploadButton(e)),""))),this.show_occupants_toggle){const t=xd("Hide participants"),n=xd("Show participants");e.push(Xa(Sg(),this.hidden_occupants?n:t,this.toggleOccupants,this.hidden_occupants?"fa-angle-double-left":"fa-angle-double-right",Gc.settings.get("assets_path")))}return Hc.api.hook("getToolbarButtons",this,e)}getHTTPUploadButton(e){if(e){const e=xd("Choose a file to send");return Xa(wg(),e,this.toggleFileUpload,Gc.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?xd("Click to write as a normal (non-spoiler) message"):xd("Click to write your message as a spoiler");const n=Xa(yg(),t,this.toggleComposeSpoilerMessage,this.composing_spoiler?"fa-eye-slash":"fa-eye",Gc.settings.get("assets_path"));if(this.is_groupchat)return n;{const t=e.get("jid"),r=Promise.all(e.presence.resources.map(e=>Gc.disco.supports(Ng.NS.SPOILER,"".concat(t,"/").concat(e.get("name"))))).then(e=>e.reduce((e,t)=>e&&t,!0));return Xa(bg(),_h(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),Gc.trigger("callButtonClicked",{connection:Hc.connection,model:this.model})}});class Ig extends HTMLElement{async connectedCallback(){await Gc.waitUntil("initialized"),rl.insertInto(this)}}function Mg(){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 Mg=function(){return e},e}customElements.define("converse-root",Ig);
/**
* @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 Rg=new WeakMap,Dg=window.navigator.userAgent.indexOf("Trident/")>0,Pg=ka(e=>t=>{if(!(t instanceof Ba))throw new Error("unsafeSVG can only be used in text bindings");const n=Rg.get(t);if(void 0!==n&&Pa(e)&&e===n.value&&t.value===n.fragment)return;const r=document.createElement("template"),i=r.content;let o;Dg?(r.innerHTML=`<svg>${e}</svg>`,o=i.firstChild):(o=document.createElementNS("http://www.w3.org/2000/svg","svg"),i.appendChild(o),o.innerHTML=e),i.removeChild(o),pa(i,o.firstChild);const s=document.importNode(i,!0);t.setValue(s),Rg.set(t,{value:e,fragment:s})});function zg(){const e=Fg(["",""]);return zg=function(){return e},e}function Lg(){const e=Fg(["",""]);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)}}))}function Bg(){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 Bg=function(){return e},e}window.customElements.define("converse-fontawesome",class extends mc{constructor(){super();const e=n.e(138).then(n.t.bind(null,540,7));this.data=e.then(e=>Xa(Lg(),Pg(e.default())))}render(){return Xa(zg(),_h(this.data,""))}});var qg=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 Ug=function(e,t){var n=[];return gs(e,(function(e,r,i){t(e,r,i)&&n.push(e)})),n};var Hg=function(e,t){return(Te(e)?ot:Ug)(e,So(t,3))};var $g=function(e){return e&&e.length?e[0]:void 0};var Wg=function(e){return"function"==typeof e?e:vr};var Vg=function(e,t){return(Te(e)?ve:gs)(e,Wg(t))};var Gg=function(e,t){return Fr(t,(function(t){return e[t]}))};var Jg=function(e){return null==e?[]:Gg(e,Ye(e))},Qg=Math.max;var Yg=function(e,t,n,r){e=Qe(e)?e:Jg(e),n=n&&!r?di(n):0;var i=e.length;return n<0&&(n=Qg(i+n,0)),Zt(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&xs(e,t,n)>-1};var Kg=function(e){return(null==e?0:e.length)?Ao(e,0,-1):[]};var Xg=function(e,t){return(Te(e)?Fr:Js)(e,So(t,3))};var Zg=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&&!Tr(s):n(s,a)))var a=s,c=o}return c};var em=function(e,t){return e>t};var tm=function(e){return e&&e.length?Zg(e,vr,em):void 0};var nm=function(e,t){return e<t};var rm=function(e){return e&&e.length?Zg(e,vr,nm):void 0};var im=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 om=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 sm=function(e,t,n){var r=Te(e)?im:om,i=arguments.length<3;return r(e,So(t,4),n,i,gs)};var am=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},cm=zi(!0);var lm=ps((function(e,t){return e&&cm(e,t,Ye)}),!0);var um=function(e,t,n){var r=Te(e)?am:om,i=arguments.length<3;return r(e,So(t,4),n,i,lm)};var dm=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 hm=function(e,t){return(Te(e)?ot:Ug)(e,dm(So(t,3)))};var fm=function(e,t){if("function"!=typeof e)throw new TypeError("Expected a function");return t=void 0===t?t:di(t),Ar(e,t)},pm=Math.floor,gm=Math.random;var mm=function(e,t){return e+pm(gm()*(t-e+1))};var vm=function(e){var t=e.length;return t?e[mm(0,t-1)]:void 0};var _m=function(e){return vm(Jg(e))};var bm=function(e){return(Te(e)?vm:_m)(e)};var ym=function(e,t){var n=-1,r=e.length,i=r-1;for(t=void 0===t?r:t;++n<t;){var o=mm(n,i),s=e[o];e[o]=e[n],e[n]=s}return e.length=t,e};var wm=function(e){return ym(it(e))};var Sm=function(e){return ym(Jg(e))};var xm=function(e){return(Te(e)?wm:Sm)(e)},Em=bo("length"),Am=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var jm=function(e){return Am.test(e)},Cm="[\\ud800-\\udfff]",km="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Om="\\ud83c[\\udffb-\\udfff]",Tm="[^\\ud800-\\udfff]",Nm="(?:\\ud83c[\\udde6-\\uddff]){2}",Im="[\\ud800-\\udbff][\\udc00-\\udfff]",Mm="(?:"+km+"|"+Om+")"+"?",Rm="[\\ufe0e\\ufe0f]?"+Mm+("(?:\\u200d(?:"+[Tm,Nm,Im].join("|")+")[\\ufe0e\\ufe0f]?"+Mm+")*"),Dm="(?:"+[Tm+km+"?",km,Nm,Im,Cm].join("|")+")",Pm=RegExp(Om+"(?="+Om+")|"+Dm+Rm,"g");var zm=function(e){for(var t=Pm.lastIndex=0;Pm.test(e);)++t;return t};var Lm=function(e){return jm(e)?zm(e):Em(e)};var Fm=function(e){if(null==e)return 0;if(Qe(e))return Zt(e)?Lm(e):e.length;var t=kt(e);return"[object Map]"==t||"[object Set]"==t?e.size:Je(e).length};var Bm=function(e){var t=null==e?0:e.length;return t?Ao(e,1,t):[]};var qm=function(e,t,n){return e&&e.length?(t=n||void 0===t?1:di(t),Ao(e,0,t<0?0:t)):[]};var Um=function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n};var Hm=function(e){return e.split("")},$m="[\\ud800-\\udfff]",Wm="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Vm="[^\\ud800-\\udfff]",Gm="(?:\\ud83c[\\udde6-\\uddff]){2}",Jm="[\\ud800-\\udbff][\\udc00-\\udfff]",Qm="(?:"+Wm+"|\\ud83c[\\udffb-\\udfff])"+"?",Ym="[\\ufe0e\\ufe0f]?"+Qm+("(?:\\u200d(?:"+[Vm,Gm,Jm].join("|")+")[\\ufe0e\\ufe0f]?"+Qm+")*"),Km="(?:"+[Vm+Wm+"?",Wm,Gm,Jm,$m].join("|")+")",Xm=RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|"+Km+Ym,"g");var Zm=function(e){return e.match(Xm)||[]};var ev=function(e){return jm(e)?Zm(e):Hm(e)},tv=w?w.iterator:void 0;var nv=function(e){if(!e)return[];if(Qe(e))return Zt(e)?ev(e):it(e);if(tv&&e[tv])return Um(e[tv]());var t=kt(e);return("[object Map]"==t?Ki:"[object Set]"==t?Xi:Jg)(e)},rv=Ar((function(e,t){return Cs(e)?js(e,t):[]}));
/*!
* Copyright (c) JC Brand <jc@opkode.com>
*/
const iv=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 Fd).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),Fd.apply(this,Array.prototype.slice.apply(arguments))},ov={includes:Yg,difference:ks,drop:qg,every:Ns,filter:Hg,find:dl,first:$g,forEach:Vg,head:$g,indexOf:Bs,initial:Kg,invoke:Pc,isEmpty:ri,last:Eo,lastIndexOf:Ws,map:Xg,max:tm,min:rm,reduce:sm,reduceRight:um,reject:hm,rest:fm,sample:bm,shuffle:xm,size:Fm,some:Gs,sortBy:Zs,tail:Bm,take:qm,toArray:nv,without:rv};Object.keys(ov).forEach(e=>{iv.prototype[e]=function(){const t=Array.prototype.slice.call(arguments);return t.unshift(this.views),ov[e].apply(this,t)}}),Object.assign(iv.prototype,Fd.prototype),iv.extend=Fd.extend;const sv=iv.extend({listItems:"model",sortEvent:"change",sortImmediatelyOnAdd:!1,listSelector:".ordered-items",ItemView:void 0,subviewIndex:"id",initialize(){this.sortEventually=Rc(()=>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)}}),av=rl.env.utils,cv=Fd.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=av.getElementFromTemplateResult(Kf(e)).outerHTML}}}),lv=iv.extend({_ensureElement(){if(this.el)this.setElement(Jr(this,"el"),!1);else{let e=Hc.root.querySelector("#conversejs");if(null===e){e=document.createElement("div"),e.setAttribute("id","conversejs"),av.addClass("theme-".concat(Gc.settings.get("theme")),e);const t=Hc.root.querySelector("body");t?t.appendChild(e):Hc.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()&&Ya(Xa(Mg()),e);document.querySelector("body").classList.add("converse-".concat(Gc.settings.get("view_mode"))),this.el.classList.add("converse-".concat(Gc.settings.get("view_mode"))),Gc.settings.get("singleton")&&this.el.classList.add("converse-singleton"),this.render()},render(){this._ensureElement(),Ya(Xa(Bg()),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 uv(){Hc.chatboxviews=new Hc.ChatBoxViews({model:Hc.chatboxes}),Gc.trigger("chatBoxViewsInitialized")}function dv(){const e=.01*window.innerHeight;document.documentElement.style.setProperty("--vh","".concat(e,"px"))}function hv(){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 hv=function(){return e},e}rl.plugins.add("converse-chatboxviews",{dependencies:["converse-chatboxes","converse-vcard"],initialize(){Gc.elements.register(),Gc.promises.add(["chatBoxViewsInitialized"]),Gc.settings.extend({animate:!0,theme:"default"}),Hc.ViewWithAvatar=cv,Hc.ChatBoxViews=lv,Gc.listen.on("chatBoxesInitialized",uv),Gc.listen.on("cleanup",()=>delete Hc.chatboxviews),Gc.listen.on("clearSession",()=>Hc.chatboxviews.closeAllChatBoxes()),Gc.listen.on("chatBoxViewsInitialized",dv),window.addEventListener("resize",dv),Object.assign(rl,{insertInto(e){var t;const n=null===(t=Hc.chatboxviews)||void 0===t?void 0:t.el;if(n&&!e.contains(n))e.insertAdjacentElement("afterBegin",n),Gc.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 fv=e=>Xa(hv(),e.show_send_button?"chat-content-sendbutton":"",e.markScrolled);function pv(){const e=yv(['<p class="chat-head__desc">',"</p>"]);return pv=function(){return e},e}function gv(){const e=yv(["<converse-dropdown .items=","></converse-dropdown>"]);return gv=function(){return e},e}function mv(){const e=yv(['<a href="','" target="_blank" rel="noopener" class="user">',"</a>"]);return mv=function(){return e},e}function vv(){const e=yv(['<span class="mr-2">',"</span>"]);return vv=function(){return e},e}function _v(){const e=yv(['<div class="chatbox-navback"><i class="fa fa-arrow-left"></i></div>']);return _v=function(){return e},e}function bv(){const e=yv(['\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 bv=function(){return e},e}function yv(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function wv(){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 wv=function(){return e},e}function Sv(){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 Sv=function(){return e},e}function xv(){const e=Rv(["<p><label>",":</label> ","</p>"]);return xv=function(){return e},e}function Ev(){const e=Rv(["<p><label>",':</label> <a href="mailto:','">',"</a></p>"]);return Ev=function(){return e},e}function Av(){const e=Rv(["<p><label>",':</label> <a target="_blank" rel="noopener" href="','">',"</a></p>"]);return Av=function(){return e},e}function jv(){const e=Rv(["<p><label>",":</label> ","</p>"]);return jv=function(){return e},e}function Cv(){const e=Rv(["<p><label>",":</label> ","</p>"]);return Cv=function(){return e},e}function kv(){const e=Rv(['<div class="mb-4">',"</div>"]);return kv=function(){return e},e}function Ov(){const e=Rv(['\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 Ov=function(){return e},e}function Tv(){const e=Rv(['\n <button type="button" @click="','" class="btn btn-danger remove-contact">\n <i class="far fa-trash-alt"></i>',"\n </button>\n "]);return Tv=function(){return e},e}function Nv(){const e=Rv(['<li class="list-group-item"> '," </li>"]);return Nv=function(){return e},e}function Iv(){const e=Rv(['\n <hr/>\n <ul class="list-group fingerprints">\n <li class="list-group-item active">',"</li>\n ","\n </ul>\n "]);return Iv=function(){return e},e}function Mv(){const e=Rv(['\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 Mv=function(){return e},e}function Rv(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const Dv=e=>{const t=xd("OMEMO Fingerprints"),n=xd("No OMEMO-enabled devices found"),r=e.view.devicelist.devices;return Xa(Iv(),t,r.length?r.map(t=>(e=>{const t=xd("Trusted"),n=xd("Untrusted");return e.device.get("bundle")&&e.device.get("bundle").fingerprint?Xa(Mv(),-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))):Xa(Nv(),n))};var Pv=e=>{const t=xd("XMPP Address"),n=xd("Email"),r=xd("Full Name"),i=xd("Nickname"),o=xd("The User's Profile Image"),s=xd("Refresh"),a=xd("Role"),c=xd("URL"),l={alt_text:o,extra_classes:"mb-3",height:"120",width:"120"};return Xa(Ov(),e.display_name,Xd,e.image?Xa(kv(),Kf(Object.assign(e,l))):"",e.fullname?Xa(Cv(),r,e.fullname):"",t,e.jid,e.jid,e.nickname?Xa(jv(),i,e.nickname):"",e.url?Xa(Av(),c,e.url,e.url):"",e.email?Xa(Ev(),n,e.email,e.email):"",e.role?Xa(xv(),a,e.role):"",e._converse.pluggable.plugins["converse-omemo"].enabled(e._converse)?Dv(e):"",Kd,s,e.allow_contact_removal&&e.is_roster_contact?(e=>{const t=xd("Remove as contact");return Xa(Tv(),e.removeContact,t)})(e):"")};function zv(){const e=qv(['<a href="#"\n class="dropdown-item ','"\n @click=','\n title="','"><i class="fa ','"></i>',"</a>"]);return zv=function(){return e},e}function Lv(){const e=qv(['<a href="#"\n class="chatbox-btn '," fa ",'"\n @click=','\n title="','"></a>']);return Lv=function(){return e},e}function Fv(){const e=qv(["\n <converse-chat-content\n .chatview=","\n .messages=","\n notifications=",">\n </converse-chat-content>"]);return Fv=function(){return e},e}function Bv(){const e=qv(["<converse-chat-help\n .model=","\n .messages=","\n ?hidden=",'\n type="info"\n chat_type="','"></converse-chat-help>']);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)}}))}
/**
* @module converse-chatview
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/const{Strophe:Uv,dayjs:Hv}=rl.env,$v=rl.env.utils,Wv=Fd.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(),Gc.trigger("chatBoxViewInitialized",this)},initDebounced(){this.markScrolled=Rc(this._markScrolled,100),this.debouncedScrollDown=Rc(this.scrollDown,100),Gc.settings.get("debounced_content_rendering")?(this.renderChatHistory=Rc(()=>this.renderChatContent(!1),100),this.renderNotifications=Rc(()=>this.renderChatContent(!0),100)):(this.renderChatHistory=()=>this.renderChatContent(!1),this.renderNotifications=()=>this.renderChatContent(!0))},render(){const e=fv(Object.assign(this.model.toJSON(),{markScrolled:e=>this.markScrolled(e)}));return Ya(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(),$v.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")===Hc.COMPOSING?xd("%1$s is typing",this.model.getDisplayName()):this.model.notifications.get("chat_state")===Hc.PAUSED?xd("%1$s has stopped typing",this.model.getDisplayName()):this.model.notifications.get("chat_state")===Hc.GONE?xd("%1$s has gone away",this.model.getDisplayName()):""},getHelpMessages:()=>["<strong>/clear</strong>: ".concat(xd("Remove messages")),"<strong>/close</strong>: ".concat(xd("Close this chat")),"<strong>/me</strong>: ".concat(xd("Write in the third person")),"<strong>/help</strong>: ".concat(xd("Show this menu"))],renderHelpMessages(){Ya(Xa(Bv(),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=>Xa(Fv(),this,e.messages,e.notifications));const t=this.model.messages.models,n=e?t:Array.from(t);Ya(this.tpl_chat_content({messages:n,notifications:this.getNotifications()}),this.msgs_container)},renderToolbar(){if(!Gc.settings.get("show_toolbar"))return this;const e=Object.assign({model:this.model,chatview:this},this.model.toJSON(),this.getToolbarOptions());return Ya((e=>{const t=Gc.settings.get("message_limit"),n=Gc.settings.get("visible_toolbar_buttons").call,r=Gc.settings.get("visible_toolbar_buttons").emoji,i=Gc.settings.get("show_send_button"),o=Gc.settings.get("visible_toolbar_buttons").spoiler,s=Gc.settings.get("show_toolbar");return Xa(Sv(),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")),Gc.trigger("renderToolbar",this),this},renderMessageForm(){var e,t;const n=this.el.querySelector(".message-form-container");var r;Ya((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")?xd("Hidden message"):xd("Message"),label_spoiler_hint:xd("Optional hint"),message_value:null===(t=this.el.querySelector(".chat-textarea"))||void 0===t?void 0:t.value,show_send_button:Gc.settings.get("show_send_button"),show_toolbar:Gc.settings.get("show_toolbar"),unread_msgs:xd("You have unread messages")}),Xa(wv(),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=Hc.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 Hc.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();Ya(e,this.el.querySelector(".chat-head-chatbox"))},async getHeadingStandaloneButton(e){const t=await e;return Xa(Lv(),t.a_class,t.icon_class,t.handler,t.i18n_title)},async getHeadingDropdownItem(e){const t=await e;return Xa(zv(),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:xd("The User's Profile Image"),extra_classes:"",height:40,width:40};return Xa(bv(),e.status?"":"chatbox-title--no-desc",e._converse.api.settings.get("singleton")?"":Xa(_v()),e.type!==e._converse.HEADLINES_TYPE?Xa(vv(),Kf(Object.assign({},e,t))):"",e.jid,e.url?Xa(mv(),e.url,e.display_name):e.display_name,e.dropdown_btns.length?Xa(gv(),e.dropdown_btns):"",e.standalone_btns.length?(e=>e.standalone_btns.reverse().map(e=>_h(e,"")))(e):"",e.status?Xa(pv(),e.status):"")})(Object.assign(n,this.model.toJSON(),{_converse:Hc,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:xd("Details"),i18n_title:xd("See more information about this person"),icon_class:"fa-id-card",name:"details",standalone:"overlayed"===Gc.settings.get("view_mode")}];return Gc.settings.get("singleton")||e.push({a_class:"close-chatbox-button",handler:e=>this.close(e),i18n_text:xd("Close"),i18n_title:xd("Close and end this conversation"),icon_class:"fa-times",name:"close",standalone:"overlayed"===Gc.settings.get("view_mode")}),Hc.api.hook("getHeadingButtons",this,e)},getToolbarOptions:()=>({}),maybeScrollDown(e){!(!(null!=e&&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")&&$v.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 Hc.chatboxviews.insertRowColumn(this.el),Gc.trigger("chatBoxInsertedIntoDOM",this),this},addSpinner(e=!1){if(null===this.el.querySelector(".spinner")){const t=$v.getElementFromTemplateResult(sp());e?(this.content.insertAdjacentElement("beforeend",t),this.scrollDown()):this.content.insertAdjacentElement("afterbegin",t)}},clearSpinner(){this.content.querySelectorAll(".spinner").forEach($v.removeElement)},onStatusMessageChanged(e){this.renderHeading(),Gc.trigger("contactStatusMessageChanged",{contact:e.attributes,message:e.get("status")})},markFollowups(e){const t=e.getAttribute("data-from"),n=e.previousElementSibling,r=Hv(e.getAttribute("data-isodate")),i=e.nextElementSibling;$v.hasClass("chat-msg--action",e)||$v.hasClass("chat-msg--action",n)||$v.hasClass("chat-info",e)||$v.hasClass("chat-info",n)||n.getAttribute("data-from")!==t||!r.isBefore(Hv(n.getAttribute("data-isodate")).add(10,"minutes"))||e.getAttribute("data-encrypted")!==n.getAttribute("data-encrypted")||$v.addClass("chat-msg--followup",e),i&&(!$v.hasClass("chat-msg--action",e)&&$v.hasClass("chat-info",e)&&i.getAttribute("data-from")===t&&Hv(i.getAttribute("data-isodate")).isBefore(r.add(10,"minutes"))&&e.getAttribute("data-encrypted")===i.getAttribute("data-encrypted")?$v.addClass("chat-msg--followup",i):$v.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(Gc.settings.get("message_limit")&&r.length>Gc.settings.get("message_limit")||!r.replace(/\s/g,"").length)return;if(!Hc.connection.authenticated){const e=xd("Sorry, the connection has been lost, and your message could not be sent");return Gc.alert("error",xd("Error"),e),void Gc.connection.reconnect()}let i,o={};this.model.get("composing_spoiler")&&(o=this.el.querySelector("form.sendXMPPMessage input.spoiler-hint"),i=o.value),$v.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="",$v.removeClass("correcting",n),n.style.height="auto",this.updateCharCounter(n.value)),a&&Gc.trigger("messageSend",a),"overlayed"===Gc.settings.get("view_mode")&&(this.msgs_container.parentElement.style.display="none"),n.removeAttribute("disabled"),$v.removeClass("disabled",n),"overlayed"===Gc.settings.get("view_mode")&&(this.msgs_container.parentElement.style.display=""),this.model.setChatState(Hc.ACTIVE,{silent:!0}),n.focus()},updateCharCounter(e){if(Gc.settings.get("message_limit")){const t=this.el.querySelector(".message-limit"),n=Gc.settings.get("message_limit")-e.length;t.textContent=n,n<1?$v.addClass("error",t):$v.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===rl.keycodes.TAB){const t=$v.getCurrentWord(e.target,null,/(:.*?:)/g);t.startsWith(":")&&this.autocompleteInPicker(e.target,t)&&(e.preventDefault(),e.stopPropagation())}else{if(e.keyCode===rl.keycodes.FORWARD_SLASH)return;if(e.keyCode===rl.keycodes.ESCAPE)return this.onEscapePressed(e);if(e.keyCode===rl.keycodes.ENTER)return this.onEnterPressed(e);if(e.keyCode!==rl.keycodes.UP_ARROW||e.target.selectionEnd){if(e.keyCode===rl.keycodes.DOWN_ARROW&&e.target.selectionEnd===e.target.value.length&&$v.hasClass("correcting",this.el.querySelector(".chat-textarea")))return this.editLaterMessage()}else{const e=this.el.querySelector(".chat-textarea");if(!e.value||$v.hasClass("correcting",e))return this.editEarlierMessage()}}[rl.keycodes.SHIFT,rl.keycodes.META,rl.keycodes.META_RIGHT,rl.keycodes.ESCAPE,rl.keycodes.ALT].includes(e.keyCode)||this.model.get("chat_state")!==Hc.COMPOSING&&this.model.setChatState(Hc.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=xd("Be aware that other XMPP/Jabber clients (and servers) may not yet support retractions and that this message may not be removed everywhere."),n=[xd("Are you sure you want to retract this message?")];Gc.settings.get("show_retraction_warning")&&(n[1]=t);await Gc.confirm(xd("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(xd("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($v.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($v.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($v.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){e&&e.preventDefault&&e.preventDefault();return!0===confirm(xd("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?$v.addClass("correcting",i):$v.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),$v.placeCaretAtEnd(i)},onPresenceChanged(e){const t=e.get("show"),n=this.model.getDisplayName();let r;$v.isVisible(this.el)&&("offline"===t?r=xd("%1$s has gone offline",n):"away"===t?r=xd("%1$s has gone away",n):"dnd"===t?r=xd("%1$s is busy",n):"online"===t&&(r=xd("%1$s is online",n)),r&&this.model.createMessage({message:r,type:"info"}))},async close(e){return e&&e.preventDefault&&e.preventDefault(),Hc.router.history.getFragment()==="converse/chat?jid="+this.model.get("jid")&&Hc.router.navigate(""),Gc.connection.connected()&&(this.model.setChatState(Hc.INACTIVE),this.model.sendChatState()),await this.model.close(),this.remove(),Gc.trigger("chatBoxClosed",this),this},emitBlurred(e){this.el.contains(document.activeElement)||this.el.contains(e.relatedTarget)||Gc.trigger("chatBoxBlurred",this,e)},emitFocused(e){this.el.contains(e.relatedTarget)||Gc.trigger("chatBoxFocused",this,e)},focus(){const e=this.el.getElementsByClassName("chat-textarea")[0];return e&&document.activeElement!==e&&e.focus(),this},maybeFocus(){Gc.settings.get("auto_focus")&&this.focus()},hide(){return this.el.classList.add("hidden"),this},afterShown(){this.model.clearUnreadMsgCounter(),this.model.setChatState(Hc.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")):$v.isVisible(this.el)?this.maybeFocus():Gc.settings.get("animate")?$v.fadeIn(this.el,()=>this.afterShown()):($v.showElement(this.el),this.afterShown())},showNewMessagesIndicator(){$v.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?Gc.trigger("chatBoxScrolledUp",this):n=e.target.scrollTop,$v.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))&&Hc.router.history.navigate()}Gc.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(Hc.INACTIVE,{silent:!0}),this.model.sendChatState())}});let Vv;rl.plugins.add("converse-chatview",{dependencies:["converse-chatboxviews","converse-chat","converse-disco","converse-modal"],initialize(){Gc.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}}),Hc.ChatBoxView=Wv,Hc.UserDetailsModal=uh.extend({id:"user-details-modal",events:{"click button.refresh-contact":"refreshContact","click .fingerprint-trust .btn input":"toggleDeviceTrust"},initialize(){uh.prototype.initialize.apply(this,arguments),this.model.rosterContactAdded.then(()=>this.registerContactEventHandlers()),this.listenTo(this.model,"change",this.render),this.registerContactEventHandlers(),Gc.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 Pv(Object.assign(this.model.toJSON(),n,{_converse:Hc,allow_contact_removal:Gc.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:$v}))},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");$v.addClass("fa-spin",t);try{await Gc.vcard.update(this.model.contact.vcard,!0)}catch(e){Pn.fatal(e),this.alert(xd("Sorry, something went wrong while trying to refresh"),"danger")}$v.removeClass("fa-spin",t)},removeContact(e){if(e&&e.preventDefault&&e.preventDefault(),!Gc.settings.get("allow_contact_removal"))return;!0===confirm(xd("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),Gc.alert("error",xd("Error"),[xd("Sorry, there was an error while trying to remove %1$s as a contact.",this.model.contact.getDisplayName())])})},1))}}),Gc.listen.on("chatBoxViewsInitialized",()=>{const e=Hc.chatboxviews;Hc.chatboxes.on("add",async t=>{e.get(t.get("id"))||t.get("type")!==Hc.PRIVATE_CHAT_TYPE||(await t.initialized,e.add(t.get("id"),new Hc.ChatBoxView({model:t})))})}),Gc.listen.on("windowStateChanged",(function(e){Hc.chatboxviews&&Hc.chatboxviews.forEach(t=>{"controlbox"!==t.model.get("id")&&t.onWindowStateChanged(e.state)})})),Gc.listen.on("connected",()=>Gc.disco.own.features.add(Uv.NS.SPOILER)),Object.assign(Gc,{chatviews:{get:e=>void 0===e?Object.values(Hc.chatboxviews.getAll()):"string"==typeof e?Hc.chatboxviews.get(e):e.map(e=>Hc.chatboxviews.get(e))}})}});let Gv=0;function Jv(e){Vv=e}function Qv(){Vv=null,Gv=0}const Yv=Symbol("haunted.phase"),Kv=Symbol("haunted.hook"),Xv=Symbol("haunted.update"),Zv=Symbol("haunted.commit"),e_=Symbol("haunted.effects"),t_=Symbol("haunted.layoutEffects");class n_{constructor(e,t){this.update=e,this.host=t,this[Kv]=new Map,this[e_]=[],this[t_]=[]}run(e){Jv(this);let t=e();return Qv(),t}_runEffects(e){let t=this[e];Jv(this);for(let e of t)e.call(this);Qv()}runEffects(){this._runEffects(e_)}runLayoutEffects(){this._runEffects(t_)}teardown(){this[Kv].forEach(e=>{"function"==typeof e.teardown&&e.teardown()})}}const r_=Promise.resolve().then.bind(Promise.resolve());function i_(){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=r_(n))}}const o_=i_(),s_=i_();class a_{constructor(e,t){this.renderer=e,this.host=t,this.state=new n_(this.update.bind(this),t),this[Yv]=null,this._updateQueued=!1}update(){this._updateQueued||(o_(()=>{let e=this.handlePhase(Xv);s_(()=>{this.handlePhase(Zv,e),s_(()=>{this.handlePhase(e_)})}),this._updateQueued=!1}),this._updateQueued=!0)}handlePhase(e,t){switch(this[Yv]=e,e){case Zv:return this.commit(t),void this.runEffects(t_);case Xv:return this.render();case e_:return this.runEffects(e_)}this[Yv]=null}render(){return this.state.run(()=>this.renderer.call(this.host,this.host))}runEffects(e){this.state._runEffects(e)}teardown(){this.state.teardown()}}function c_(e){class t extends a_{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;return t in e?(i=Object.getOwnPropertyDescriptor(e,t),i&&i.set?(i.set.call(r,n),!0):(Reflect.set(e,t,n,r),!0)):(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 l_{constructor(e,t){this.id=e,this.state=t}}function u_(e,...t){let n=Gv++,r=Vv[Kv],i=r.get(n);return i||(i=new e(n,Vv,...t),r.set(n,i)),i.update(...t)}function d_(e){return u_.bind(null,e)}function h_(e){return d_(class extends l_{constructor(t,n,r,i){super(t,n),e(n,this)}update(e,t){this.callback=e,this.values=t}call(){this.values&&!this.hasChanged()||this.run(),this.lastValues=this.values}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 f_(e,t){e[e_].push(t)}h_(f_);const p_=d_(class extends l_{constructor(e,t,n){super(e,t),this._updater=this._updater.bind(this),this._ranEffect=!1,this._unsubscribe=null,f_(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()}});d_(class extends l_{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)}});h_((function(e,t){e[t_].push(t)})),d_(class extends l_{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])}}),d_(class extends l_{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 g_=Array.prototype.includes;const{component:m_,createContext:v_}=function({render:e}){const t=c_(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(p_(n))})),defaultValue:t};return n}}(t);return{component:t,createContext:n}}({render:Ya});!function(){const e=new WeakMap,t=new WeakMap;class n extends a_{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 __(){const e=w_(['\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 __=function(){return e},e}function b_(){const e=w_(['<p class="byline">messaging freedom</p>']);return b_=function(){return e},e}function y_(){const e=w_(['\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 y_=function(){return e},e}function w_(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function S_(){const e=E_(['<a class="chatbox-btn close-chatbox-button fa fa-times"></a>']);return S_=function(){return e},e}function x_(){const e=E_(['\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 x_=function(){return e},e}function E_(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Gc.elements.define("converse-brand-heading",m_(e=>{const t="fullscreen"===Gc.settings.get("view_mode");return Xa(y_(),t?"brand-name-wrapper--fullscreen":"",t?Xa(b_()):"",t?Xa(__(),e.version_name):"")},{useShadowDOM:!1}));var A_=n(172),j_=n.n(A_);function C_(){const e=D_(['\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 C_=function(){return e},e}function k_(){const e=D_(["<p>","</p>"]);return k_=function(){return e},e}function O_(){const e=D_(['<input class="btn btn-primary login-anon" type="submit" value="','">']);return O_=function(){return e},e}function T_(){const e=D_(["\n ","\n ","\n ","\n "]);return T_=function(){return e},e}function N_(){const e=D_(['\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 N_=function(){return e},e}function I_(){const e=D_(['\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 I_=function(){return e},e}function M_(){const e=D_(['\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 M_=function(){return e},e}function R_(){const e=D_(['\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 R_=function(){return e},e}function D_(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const P_=e=>{const t=xd("Log in"),n=xd("XMPP Address");return Xa(N_(),n,!!Gc.settings.get("auto_focus"),e.placeholder_username,e.authentication!==e.EXTERNAL?(()=>{const e=xd("Password");return Xa(M_(),e,e)})():"",e.show_trust_checkbox?(e=>{const t=xd("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=xd("This is a trusted device");return Xa(R_(),e,n,t)})("off"!==e.show_trust_checkbox):"",t,Hc.allow_registration&&!Gc.settings.get("auto_login")&&Hc.pluggable.plugins["converse-register"].enabled(Hc)?(()=>{const e=xd("Create an account"),t=xd("Don't have a chat account?");return Xa(I_(),t,e)})():"")};var z_=e=>Xa(C_(),e.conn_feedback_subject?e.conn_feedback_class:"hidden",e.conn_feedback_subject,e.conn_feedback_message?"":"hidden",e.conn_feedback_message,"CONNECTING"===Hc.CONNECTION_STATUS[e.connection_status]?sp({classes:"hor_centered"}):(e=>{const t=xd("Disconnected"),n=xd("Click here to log in anonymously");return Xa(T_(),e.authentication==e.LOGIN||e.authentication==e.EXTERNAL?P_(e):"",e.authentication==e.ANONYMOUS?Xa(O_(),n):"",e.authentication==e.PREBIND?Xa(k_(),t):"")})(e));
/**
* @module converse-controlbox
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/const{Strophe:L_,dayjs:F_}=rl.env,B_=rl.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"},U_={0:"Error",1:"Connecting",2:"Connection failure",3:"Authenticating",4:"Authentication failure",5:"Connected",6:"Disconnected",7:"Disconnecting",8:"Attached",9:"Redirect",10:"Reconnecting"},H_=[0,1,2,3,4,7,10];rl.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 Hc.ControlBox({id:"controlbox"});return Hc.chatboxes.add(e)}Gc.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}),Gc.promises.add("controlBoxInitialized"),Hc.ControlBox=Hc.ChatBox.extend({defaults(){return{bookmarked:!1,box_id:"controlbox",chat_state:void 0,closed:!Gc.settings.get("show_controlbox_by_default"),num_unread:0,time_opened:this.get("time_opened")||(new Date).getTime(),type:Hc.CONTROLBOX_TYPE,url:""}},initialize(){"controlbox"===this.get("id")?this.set({time_opened:F_(0).valueOf()}):Hc.ChatBox.prototype.initialize.apply(this,arguments)},validate(e){return e.type===Hc.CONTROLBOX_TYPE?"embedded"===Gc.settings.get("view_mode")&&Gc.settings.get("singleton")?"Controlbox not relevant in embedded view mode":void 0:Hc.ChatBox.prototype.validate.call(this,e)},maybeShow(e){return e||"controlbox"!==this.get("id")?Hc.ChatBox.prototype.maybeShow.call(this,e):this},onReconnection:function(){}}),Hc.ControlBoxView=Hc.ChatBoxView.extend({tagName:"div",className:"chatbox",id:"controlbox",events:{"click a.close-chatbox-button":"close"},initialize(){void 0===Hc.controlboxtoggle&&(Hc.controlboxtoggle=new Hc.ControlBoxToggle),Hc.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(),Gc.trigger("controlBoxInitialized",this)},render(){this.model.get("connected")&&void 0===this.model.get("closed")&&this.model.set("closed",!Gc.settings.get("show_controlbox_by_default"));const e=(t={sticky_controlbox:Gc.settings.get("sticky_controlbox"),...this.model.toJSON()},Xa(x_(),t.sticky_controlbox?"":Xa(S_())));var t;Ya(e,this.el),this.model.get("closed")?this.hide():this.show();const n=(null==Hc?void 0:Hc.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 Hc.LoginPanel({model:new Hc.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&&B_.isVisible(this.controlbox_pane.el)||(this.el.classList.remove("logged-out"),this.controlbox_pane=new Hc.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)&&(Hc.disconnection_cause!==Hc.LOGOUT||Gc.settings.get("show_controlbox_by_default")))return;if(Gc.settings.get("sticky_controlbox"))return;const t=(null==Hc?void 0:Hc.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"),Gc.trigger("controlBoxClosed",this),this},ensureClosedState(){this.model.get("closed")?this.hide():this.show()},hide(e){if(!Gc.settings.get("sticky_controlbox"))return B_.addClass("hidden",this.el),Gc.trigger("chatBoxClosed",this),Gc.connection.connected()||Hc.controlboxtoggle.render(),Hc.controlboxtoggle.show(e),this},onControlBoxToggleHidden(){this.model.set("closed",!1),this.el.classList.remove("hidden"),Gc.trigger("controlBoxOpened",this)},show(){return Hc.controlboxtoggle.hide(()=>this.onControlBoxToggleHidden()),this},showHelpMessages(){}}),Hc.LoginPanelModel=Fo.extend({defaults:{errors:[]}}),Hc.LoginPanel=Fd.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(Hc.connfeedback,"change",this.render),this.render()},toHTML(){const e=Hc.connfeedback.get("connection_status");let t,n;return H_.includes(e)&&(n=U_[e],t=q_[n]),z_(Object.assign(this.model.toJSON(),{_converse:Hc,ANONYMOUS:Hc.ANONYMOUS,EXTERNAL:Hc.EXTERNAL,LOGIN:Hc.LOGIN,PREBIND:Hc.PREBIND,auto_login:Gc.settings.get("auto_login"),authentication:Gc.settings.get("authentication"),connection_status:e,conn_feedback_class:t,conn_feedback_subject:n,conn_feedback_message:Hc.connfeedback.get("message"),placeholder_username:(Gc.settings.get("locked_domain")||Gc.settings.get("default_domain"))&&xd("Username")||xd("user@domain"),show_trust_checkbox:Gc.settings.get("allow_user_trust_override")}))},initPopovers(){Array.from(this.el.querySelectorAll("[data-title]")).forEach(e=>{new Vd.a.Popover(e,{trigger:"mobile"===Gc.settings.get("view_mode")?"click":"hover",dismissible:"mobile"===Gc.settings.get("view_mode"),container:this.el.parentElement.parentElement.parentElement})})},validate(){const e=this.el.querySelector("form").querySelector("input[name=jid]");return!e.value||Gc.settings.get("locked_domain")||Gc.settings.get("default_domain")||B_.isValidJID(e.value)?(e.setCustomValidity(""),!0):(e.setCustomValidity(xd("Please enter a valid XMPP address")),!1)},authenticate(e){if(e&&e.preventDefault&&e.preventDefault(),Gc.settings.get("authentication")===Hc.ANONYMOUS)return this.connect(Hc.jid,null);if(!this.validate())return;const t=new FormData(e.target);Hc.config.save({trusted:!!t.get("trusted")});let n=t.get("jid");if(Gc.settings.get("locked_domain")){const e="@"+Gc.settings.get("locked_domain");n.endsWith(e)&&(n=n.substr(0,n.length-e.length)),n=L_.escapeNode(n)+e}else Gc.settings.get("default_domain")&&!n.includes("@")&&(n=n+"@"+Gc.settings.get("default_domain"));this.connect(n,t.get("password"))},connect(e,t){["converse/login","converse/register"].includes(Hc.router.history.getFragment())&&Hc.router.navigate("",{replace:!0}),Hc.connection&&Hc.connection.reset(),Gc.user.login(e,t)}}),Hc.ControlBoxPane=Fd.extend({tagName:"div",className:"controlbox-pane",initialize(){Gc.trigger("controlBoxPaneInitialized",this)}}),Hc.ControlBoxToggle=Fd.extend({tagName:"a",className:"toggle-controlbox hidden",id:"toggle-controlbox",events:{click:"onClick"},attributes:{href:"#"},initialize(){Hc.chatboxviews.insertRowColumn(this.render().el),Gc.waitUntil("initialized").then(this.render.bind(this)).catch(e=>Pn.fatal(e))},render(){return this.el.innerHTML=j_()({label_toggle:Gc.connection.connected()?xd("Chat Contacts"):xd("Toggle chat")}),this},hide(e){B_.isVisible(this.el)&&(B_.hideElement(this.el),e())},show(e){B_.isVisible(this.el)||B_.fadeIn(this.el,e)},showControlBox(){let t=Hc.chatboxes.get("controlbox");t||(t=e()),Gc.connection.connected()?t.save({closed:!1}):t.trigger("show")},onClick(e){if(e.preventDefault(),B_.isVisible(Hc.root.querySelector("#controlbox"))){const e=Hc.chatboxes.get("controlbox");Gc.connection.connected?e.save({closed:!0}):e.trigger("hide")}else this.showControlBox()}}),Gc.listen.on("cleanup",()=>delete Hc.controlboxtoggle),Gc.listen.on("chatBoxViewsInitialized",()=>{Hc.chatboxes.on("add",e=>{if(e.get("type")===Hc.CONTROLBOX_TYPE){const t=Hc.chatboxviews,n=t.get(e.get("id"));n?(n.model=e,n.initialize()):t.add(e.get("id"),new Hc.ControlBoxView({model:e}))}})}),Gc.listen.on("clearSession",()=>{const e=null==Hc?void 0:Hc.chatboxviews,t=e&&e.get("controlbox");t&&(B_.safeSave(t.model,{connected:!1}),null!=t&&t.controlbox_pane&&(t.controlbox_pane.remove(),delete t.controlbox_pane))}),Gc.waitUntil("chatBoxViewsInitialized").then(e).catch(e=>Pn.fatal(e)),Gc.listen.on("chatBoxesFetched",()=>{(Hc.chatboxes.get("controlbox")||e()).save({connected:!0})});const t=function(){const e=Hc.chatboxviews.get("controlbox");return e.model.set({connected:!1}),e};Gc.listen.on("disconnected",()=>t().renderLoginPanel()),Gc.listen.on("will-reconnect",t),Object.assign(Gc,{controlbox:{async open(){await Gc.waitUntil("chatBoxesFetched");const e=await Gc.chatboxes.get("controlbox")||Gc.chatboxes.create("controlbox",{},Hc.Controlbox);return e.trigger("show"),e},get:()=>Hc.chatboxviews.get("controlbox")}})}});var $_=n(173),W_=n.n($_);
/**
* @module converse-dragresize
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const V_=rl.env.utils;function G_(e,t){const n=t.el.querySelector(".box-flyout"),r=document.createElement("div");r.innerHTML=W_()(),n.insertBefore(r,n.firstChild)}function J_(){const e=Y_(['<span class="message-count badge badge-light">',"</span>"]);return J_=function(){return e},e}function Q_(){const e=Y_(['\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 Q_=function(){return e},e}function Y_(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}rl.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:V_.applyDragResistance(t,this.get("default_height")),width:V_.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 G_(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 G_(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 G_(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 G_(this.__super__._converse,this),this.setWidth(),e}}},initialize(){Gc.settings.extend({allow_dragresize:!0});const e={initDragResize(){var e;const t=this,n=Rc(()=>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=Hc.connection)&&void 0!==e&&e.connected&&(this.height=this.model.get("height"),this.width=this.model.get("width")),this},resizeChatBox(e){let t;0===Hc.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))),Hc.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?V_.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?V_.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(!Gc.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),Hc.resizing={chatbox:this,direction:"top"},this.prev_pageY=e.pageY,t&&Gc.trigger("startVerticalResize",this)},onStartHorizontalResize(e,t=!0){if(!Gc.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),Hc.resizing={chatbox:this,direction:"left"},this.prev_pageX=e.pageX,t&&Gc.trigger("startHorizontalResize",this)},onStartDiagonalResize(e){this.onStartHorizontalResize(e,!1),this.onStartVerticalResize(e,!1),Hc.resizing.direction="topleft",Gc.trigger("startDiagonalResize",this)}};function t(e){if(!Hc.resizing||!Gc.settings.get("allow_dragresize"))return!0;e.preventDefault(),Hc.resizing.chatbox.resizeChatBox(e)}function n(e){if(!Hc.resizing||!Gc.settings.get("allow_dragresize"))return!0;e.preventDefault();const t=V_.applyDragResistance(Hc.resizing.chatbox.height,Hc.resizing.chatbox.model.get("default_height")),n=V_.applyDragResistance(Hc.resizing.chatbox.width,Hc.resizing.chatbox.model.get("default_width"));Gc.connection.connected()?(Hc.resizing.chatbox.model.save({height:t}),Hc.resizing.chatbox.model.save({width:n})):(Hc.resizing.chatbox.model.set({height:t}),Hc.resizing.chatbox.model.set({width:n})),Hc.resizing=null}Object.assign(Hc.ChatBoxView.prototype,e),V_.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},Gc.listen.on("registeredGlobalEventHandlers",(function(){document.addEventListener("mousemove",t),document.addEventListener("mouseup",n)})),Gc.listen.on("unregisteredGlobalEventHandlers",(function(){document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",n)})),Gc.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.
*/
rl.plugins.add("converse-singleton",{enabled:e=>e.api.settings.get("singleton"),initialize(){if(Gc.settings.extend({allow_logout:!1,allow_muc_invitations:!1,hide_muc_server:!0}),!Array.isArray(Gc.settings.get("auto_join_rooms"))&&!Array.isArray(Gc.settings.get("auto_join_private_chats")))throw new Error("converse-singleton: auto_join_rooms must be an Array");if(Gc.settings.get("auto_join_rooms").length>1||Gc.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
*/
rl.plugins.add("converse-fullscreen",{enabled:e=>e.isUniView(),initialize(){Gc.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)
*/
rl.plugins.add("converse-mam-views",{dependencies:["converse-mam","converse-chatview","converse-muc-views"],initialize(){Gc.listen.on("chatBoxScrolledUp",async e=>{if(e.model.messages.length){const t=e.model.get("type")===Hc.CHATROOMS_TYPE,n=e.model.getOldestMessage();if(n){const r=t?e.model.get("jid"):Hc.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(),Hc.router.history.navigate("#".concat(n.get("msgid")))}}})}});function K_(){const e=Z_(["<converse-minimized-chat\n .model=","\n title=","\n type=","\n num_unread=","></converse-minimized-chat>"]);return K_=function(){return e},e}function X_(){const e=Z_(['<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 X_=function(){return e},e}function Z_(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Gc.elements.define("converse-minimized-chat",class extends mc{static get properties(){return{model:{type:Object},title:{type:String},type:{type:String},num_unread:{type:Number}}}render(){return(e=>{const t=xd("Click to restore this chat");return Xa(Q_(),e.type,t,e.restore,e.num_unread?Xa(J_(),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=Hc.chatboxviews.get(this.model.get("id"));t?t.close():(this.model.destroy(),Gc.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:eb}=rl.env,tb=rl.env.utils;function nb(){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 nb=function(){return e},e}rl.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")||eb()})},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(){Gc.settings.extend({no_trimming:!1});const e={maximize(){tb.safeSave(this,{minimized:!1,time_opened:(new Date).getTime()})},minimize(){tb.safeSave(this,{minimized:!0,time_minimized:(new Date).toISOString()})}};Object.assign(Hc.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(),Gc.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(),Gc.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(Hc.ChatBoxView.prototype,t);const n={getChatBoxWidth(e){if("controlbox"===e.model.get("id")){const e=this.get("controlbox");return e&&tb.isVisible(e.el)?tb.getOuterWidth(e.el,!0):tb.getOuterWidth(Hc.controlboxtoggle.el,!0)}return!e.model.get("minimized")&&tb.isVisible(e.el)?tb.getOuterWidth(e.el,!0):0},getShownChats(){return this.filter(e=>!e.model.get("minimized")&&!e.model.get("closed")&&tb.isVisible(e.el))},getMinimizedWidth(){var e;const t=null===(e=Hc.minimized_chats)||void 0===e?void 0:e.el;return this.model.pluck("minimized").includes(!0)?tb.getOuterWidth(t,!0):0},getBoxesWidth(e){const t=e?e.model.get("id"):null,n=e?tb.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(Gc.settings.get("no_trimming")||!Gc.connection.connected()||"overlayed"!==Gc.settings.get("view_mode"))return;const n=this.getShownChats();if(n.length<=1)return;const r=tb.getOuterWidth(document.querySelector("body"),!0);if(this.getChatBoxWidth(n[0])===r)return;await Gc.waitUntil("minimizedChatsInitialized");if(null===(t=Hc.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(Hc.ChatBoxViews.prototype,n),Gc.promises.add("minimizedChatsInitialized"),Hc.MinimizedChatsToggle=Fo.extend({defaults:{collapsed:!1}}),Hc.MinimizedChats=Fd.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),Ya((i=r,Xa(X_(),i.chats.length?"":"hidden",i.toggle,i.num_minimized,xd("Minimized"),i.num_unread?"":"unread-message-count-hidden",i.num_unread,i.collapsed?"hidden":"",i.chats.map(e=>Xa(K_(),e,e.getDisplayName(),e.get("type"),e.get("num_unread"))))),this.el),this.el.parentElement||Hc.chatboxviews.insertRowColumn(this.el)},async initToggle(){const e="converse.minchatstoggle-".concat(Hc.bare_jid);this.minchats=new Hc.MinimizedChatsToggle({id:e}),this.minchats.browserStorage=Hc.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")})}}),Gc.listen.on("chatBoxInsertedIntoDOM",e=>Hc.chatboxviews.trimChats(e)),Gc.listen.on("connected",()=>{return null===(e=Hc.minimized_chats)||void 0===e||e.remove(),Hc.minimized_chats=new Hc.MinimizedChats({model:Hc.chatboxes}),void Gc.trigger("minimizedChatsInitialized");var e}),Gc.listen.on("controlBoxOpened",e=>Hc.chatboxviews.trimChats(e)),Gc.listen.on("chatBoxViewInitialized",e=>e.listenTo(e.model,"change:minimized",e.onMinimizedChanged)),Gc.listen.on("chatRoomViewInitialized",e=>{e.listenTo(e.model,"change:minimized",e.onMinimizedChanged),e.model.get("minimized")&&e.hide()}),Gc.listen.on("getHeadingButtons",(e,t)=>e.model.get("type")===Hc.CHATROOMS_TYPE?function(e,t){const n={a_class:"toggle-chatbox-button",handler:t=>e.minimize(t),i18n_text:xd("Minimize"),i18n_title:xd("Minimize this groupchat"),icon_class:"fa-minus",name:"minimize",standalone:"overlayed"===Hc.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:xd("Minimize"),i18n_title:xd("Minimize this chat"),icon_class:"fa-minus",name:"minimize",standalone:"overlayed"===Hc.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=Rc(()=>Hc.chatboxviews.trimChats(),250);Gc.listen.on("registeredGlobalEventHandlers",()=>window.addEventListener("resize",r)),Gc.listen.on("unregisteredGlobalEventHandlers",()=>window.removeEventListener("resize",r))}});function rb(){const e=lb(['<span class="badge badge-secondary">',"</span>"]);return rb=function(){return e},e}function ib(){const e=lb(['<span class="badge badge-info">',"</span>"]);return ib=function(){return e},e}function ob(){const e=lb(['<span class="badge badge-info">',"</span>"]);return ob=function(){return e},e}function sb(){const e=lb(['<span class="badge badge-info">',"</span>"]);return sb=function(){return e},e}function ab(){const e=lb(['<span class="badge badge-groupchat">',"</span>"]);return ab=function(){return e},e}function cb(){const e=lb(['\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 cb=function(){return e},e}function lb(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Gc.elements.define("converse-autocomplete",class extends mc{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 Xa(nb(),this.name,this.onKeyDown,this.onKeyUp,this.placeholder)}firstUpdated(){this.auto_complete=new Id(this.firstElementChild,{ac_triggers:this.triggers.split(" "),auto_evaluate:this.auto_evaluate,auto_first:this.auto_first,filter:"contains"==this.filter?jd:Cd,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 ub=e=>{const t=xd("Owner"),n=xd("Admin"),r=xd("Member"),i=xd("Moderator"),o=xd("Visitor");return Xa(cb(),e.id,(e=>{const t=xd("This user is a moderator."),n=xd("This user can send messages in this groupchat."),r=xd("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?Xa(ab(),t):"","admin"===e.affiliation?Xa(sb(),n):"","member"===e.affiliation?Xa(ob(),r):"","moderator"===e.role?Xa(ib(),i):"","visitor"===e.role?Xa(rb(),o):"")};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="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 db=function(){return e},e}const hb={offline:"Offline",unavailable:"Unavailable",xa:"Extended Away",away:"Away",dnd:"Do not disturb",chat:"Chattty",online:"Online"};const fb=rl.env.utils;function pb(){const e=_b(['<div class="form-group">',"</div>"]);return pb=function(){return e},e}function gb(){const e=_b(['<label class="roomid-policy-error">',"</label>"]);return gb=function(){return e},e}function mb(){const e=_b(['\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 mb=function(){return e},e}function vb(){const e=_b(['\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 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)}}))}Gc.elements.define("converse-muc-sidebar",class extends mc{static get properties(){return{chatroom:{type:Object},occupants:{type:Object}}}connectedCallback(){super.connectedCallback(),this.listenTo(this.occupants,"add",this.requestUpdate),this.listenTo(this.occupants,"remove",this.requestUpdate),this.listenTo(this.occupants,"change",this.requestUpdate)}render(){return(e=>{const t=e=>xd("Click to mention %1$s in your message.",e.get("nick")),n=xd("Participants"),r=e.occupants.map(e=>ub(Object.assign({jid:"",hint_show:hb[e.get("show")],hint_occupant:t(e)},e.toJSON())));return Xa(db(),n,r)})(Object.assign(this.chatroom.toJSON(),{occupants:[...this.occupants.models]}))}shouldShow(){return!this.chatroom.get("hidden_occupants")&&this.chatroom.session.get("connection_status")===rl.ROOMSTATUS.ENTERED}setVisibility(){this.shouldShow()?fb.showElement(this):fb.hideElement(this)}});var bb=e=>{const t=xd("Join"),n=xd("Enter a new Groupchat");return Xa(mb(),n,Xd,e.label_room_address,e.muc_roomid_policy_error_msg?Xa(gb(),e.muc_roomid_policy_error_msg):"",e.chatroom_placeholder,e.muc_roomid_policy_hint?Xa(pb(),Wp(Hp.a.filterXSS(e.muc_roomid_policy_hint,{whiteList:{b:[],br:[],em:[]}}))):"",e._converse.locked_muc_nickname?"":(e=>{const t=xd("Nickname"),n=xd("This field is required");return Xa(vb(),t,n,e.nick||"")})(e),t||"",e.muc_roomid_policy_error_msg)};const yb=rl.env.utils;var wb=uh.extend({id:"add-chatroom-modal",events:{"submit form.add-chatroom":"openChatRoom","keyup .roomjid-input":"checkRoomidPolicy","change .roomjid-input":"checkRoomidPolicy"},initialize(){uh.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(!Gc.settings.get("locked_muc_domain")){const t=this.model.get("muc_domain")||Gc.settings.get("muc_domain");e=t?"name@".concat(t):xd("name@conference.example.org")}return bb(Object.assign(this.model.toJSON(),{_converse:Hc,label_room_address:Gc.settings.get("muc_domain")?xd("Groupchat name"):xd("Groupchat address"),chatroom_placeholder:e,muc_roomid_policy_error_msg:this.muc_roomid_policy_error_msg,muc_roomid_policy_hint:Gc.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(Gc.settings.get("locked_muc_nickname")){if(r=Hc.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),Gc.settings.get("locked_muc_domain")||Gc.settings.get("muc_domain")&&!yb.isValidJID(t.jid)?n="".concat(Tc.e.escapeNode(t.jid),"@").concat(Gc.settings.get("muc_domain")):(n=t.jid,this.model.setDomain(n)),Gc.rooms.open(n,Object.assign(t,{jid:n}),!0),this.modal.hide(),e.target.reset()},checkRoomidPolicy(){if(Gc.settings.get("muc_roomid_policy")&&Gc.settings.get("muc_domain")){let e=this.el.querySelector(".roomjid-input").value;!rl.locked_muc_domain&&yb.isValidJID(e)||(e="".concat(Tc.e.escapeNode(e),"@").concat(Gc.settings.get("muc_domain")));const t=Tc.e.getNodeFromJid(e),n=Tc.e.getDomainFromJid(e);Gc.settings.get("muc_domain")!==n||Gc.settings.get("muc_roomid_policy").test(t)?this.muc_roomid_policy_error_msg=null:this.muc_roomid_policy_error_msg=xd("Groupchat id is invalid."),this.render()}}});function Sb(){const e=Eb(['<div class="error error-feedback">',"</div>"]);return Sb=function(){return e},e}function xb(){const e=Eb(['\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 xb=function(){return e},e}function Eb(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const Ab=rl.env.utils;var jb=uh.extend({id:"muc-invite-modal",initialize(){uh.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change",this.render),this.initInviteWidget()},toHTML(){return(e=>{const t=xd("Invite"),n=xd("Invite someone to this groupchat"),r=xd("user@example.org"),i=xd("Please enter a valid XMPP address"),o=xd("XMPP Address"),s=xd("Optional reason for the invitation");return Xa(xb(),n,Xd,e.submitInviteForm,o,e.invalid_invite_jid?Xa(Sb(),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=Hc.roster.map(e=>({label:e.getDisplayName(),value:e.get("jid")})),t=this.el.querySelector(".suggestion-box").parentElement;this.invite_auto_complete=new Hc.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");Ab.isValidJID(n)?(this.chatroomview.model.directInvite(n,r),this.modal.hide()):this.model.set({invalid_invite_jid:!0})}});function Cb(){const e=Ib(['<li class="list-group-item active">',"</li>"]);return Cb=function(){return e},e}function kb(){const e=Ib(['<li class="list-group-item"> '," </li>"]);return kb=function(){return e},e}function Ob(){const e=Ib(['\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 Ob=function(){return e},e}function Tb(){const e=Ib(['\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 Tb=function(){return e},e}function Nb(){const e=Ib(['\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 Nb=function(){return e},e}function Ib(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Mb=e=>{const t=xd("Query for Groupchats");return Xa(Ob(),t,Xd,e.show_form?(e=>{const t=xd("Show groupchats"),n=xd("Server address");return Xa(Nb(),e.submitForm,n,e.setDomainFromEvent,e.muc_domain||"",e.server_placeholder,t)})(e):"",e.loading_items?Xa(kb(),sp()):"",e.feedback_text?Xa(Cb(),e.feedback_text):"",Rp(e.items,e=>e.jid,t=>((e,t)=>{const n=xd("Show more information on this groupchat"),r=xd("Click to open this groupchat");return Xa(Tb(),e.openRoom,t.jid,t.name,r,t.name||t.jid,e.toggleRoomInfo,t.jid,n)})(e,t)),Kd)},Rb=n(174),Db=n.n(Rb);const Pb=rl.env.utils;function zb(e){const t=Pb.ancestor(e.target,".room-item"),n=t.querySelector("div.room-info");n?(Pb.slideIn(n).then(Pb.removeElement),t.querySelector("a.room-info").classList.remove("selected")):(t.insertAdjacentElement("beforeend",Pb.getElementFromTemplateResult(sp())),Gc.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",Db()({jid:t.getAttribute("from"),desc:null===(n=$g(pr()('field[var="muc#roominfo_description"] value',t)))||void 0===n?void 0:n.textContent,occ:null===(r=$g(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:xd("Description:"),label_jid:xd("Groupchat Address (JID):"),label_occ:xd("Participants:"),label_features:xd("Features:"),label_requires_auth:xd("Requires authentication"),label_hidden:xd("Hidden"),label_requires_invite:xd("Requires an invitation"),label_moderated:xd("Moderated"),label_non_anon:xd("Non-anonymous"),label_open_room:xd("Open"),label_permanent_room:xd("Permanent"),label_public:xd("Public"),label_semi_anon:xd("Semi-anonymous"),label_temp_room:xd("Temporary"),label_unmoderated:xd("Unmoderated")}))}(t,e)).catch(e=>Pn.error(e)))}var Lb=uh.extend({id:"list-chatrooms-modal",initialize(){this.items=[],this.loading_items=!1,uh.prototype.initialize.apply(this,arguments),Gc.settings.get("muc_domain")&&!this.model.get("muc_domain")&&this.model.save("muc_domain",Gc.settings.get("muc_domain")),this.listenTo(this.model,"change:muc_domain",this.onDomainChange),this.el.addEventListener("shown.bs.modal",()=>Gc.settings.get("locked_muc_domain")?this.updateRoomsList():this.el.querySelector('input[name="server"]').focus())},toHTML(){const e=this.model.get("muc_domain")||Gc.settings.get("muc_domain");return Mb(Object.assign(this.model.toJSON(),{show_form:!Gc.settings.get("locked_muc_domain"),server_placeholder:e||xd("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(),Gc.rooms.open(t,{name:n},!0)},toggleRoomInfo(e){e.preventDefault(),zb(e)},onDomainChange(){Gc.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:xd("Groupchats found")},{silent:!0}),this.items=t.map(hs.getAttributes)):(this.items=[],this.model.set({feedback_text:xd("No groupchats found")},{silent:!0})),this.render(),!0},updateRoomsList(){const e=Object(Tc.b)({to:this.model.get("muc_domain"),from:Hc.connection.jid,type:"get"}).c("query",{xmlns:Tc.e.NS.DISCO_ITEMS});Gc.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 Fb(){const e=sy(['<li class="list-group-item">',"</li>"]);return Fb=function(){return e},e}function Bb(){const e=sy(['<li class="list-group-item"> '," </li>"]);return Bb=function(){return e},e}function qb(){const e=sy(['<div class="row"><div class="col pt-2"><p class="helptext pb-3">',"</p></div></div>"]);return qb=function(){return e},e}function Ub(){const e=sy(['<input class="form-control" .value="','" @keyup=',' type="text" name="filter" placeholder="','"/>']);return Ub=function(){return e},e}function Hb(){const e=sy(['<li class="list-group-item">',"</li>"]);return Hb=function(){return e},e}function $b(){const e=sy(['<li class="list-group-item">',"</li>"]);return $b=function(){return e},e}function Wb(){const e=sy(['<li class="list-group-item"> '," </li>"]);return Wb=function(){return e},e}function Vb(){const e=sy(['<div class="row"><div class="col pt-2"><p class="helptext pb-3">',"</p></div></div>"]);return Vb=function(){return e},e}function Gb(){const e=sy(['<input class="form-control" .value="','" @keyup=',' type="text" name="filter" placeholder="','"/>']);return Gb=function(){return e},e}function Jb(){const e=sy(['\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 Jb=function(){return e},e}function Qb(){const e=sy(['\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 Qb=function(){return e},e}function Yb(){const e=sy(['<a href="#" data-form="affiliation-form" class="toggle-form right fa fa-wrench" @click=',"></a>"]);return Yb=function(){return e},e}function Kb(){const e=sy(['\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 Kb=function(){return e},e}function Xb(){const e=sy(['<option value="','" ?selected=',">","</option>"]);return Xb=function(){return e},e}function Zb(){const e=sy(['\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 Zb=function(){return e},e}function ey(){const e=sy(['<a href="#" data-form="role-form" class="toggle-form right fa fa-wrench" @click=',"></a>"]);return ey=function(){return e},e}function ty(){const e=sy(['\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 ty=function(){return e},e}function ny(){const e=sy(['<option value="','" ?selected=',">","</option>"]);return ny=function(){return e},e}function ry(){const e=sy(['\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 ry=function(){return e},e}function iy(){const e=sy(['\n <option value="','"\n ?selected=','\n title="','">',"</option>\n"]);return iy=function(){return e},e}function oy(){const e=sy(['\n <option value="','"\n ?selected=','\n title="','">',"</option>\n"]);return oy=function(){return e},e}function sy(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function ay(e){return"moderator"===e?xd("Moderators are privileged users who can change the roles of other users (except those with admin or owner affiliations."):"participant"===e?xd("The default role, implies that you can read and write messages."):"visitor"==e?xd("Visitors aren't allowed to write messages in a moderated multi-user chat."):void 0}function cy(e){return"owner"===e?xd("Owner is the highest affiliation. Owners can modify roles and affiliations of all other users."):"admin"===e?xd("Admin is the 2nd highest affiliation. Admins can modify roles and affiliations of all other users except owners."):"outcast"===e?xd('To ban a user, you give them the affiliation of "outcast".'):void 0}const ly=e=>Xa(ty(),e.item.nick,e.item.jid,e.item.nick,e.item.role,e.assignable_roles.length?Xa(ey(),e.toggleForm):"",e.assignable_roles.length?(e=>{const t=xd("Change role"),n=xd("New Role"),r=xd("Reason");return Xa(ry(),e.assignRole,e.item.jid,e.item.nick,n,e.assignable_roles.map(t=>Xa(ny(),t,t===e.item.role,t)),r,t)})(e):""),uy=e=>Xa(Kb(),e.item.nick,e.item.jid,e.item.nick,e.item.affiliation,e.assignable_affiliations.length?Xa(Yb(),e.toggleForm):"",e.assignable_affiliations.length?(e=>{const t=xd("Change affiliation"),n=xd("New affiliation"),r=xd("Reason");return Xa(Zb(),e.assignAffiliation,e.item.jid,e.item.nick,n,e.assignable_affiliations.map(t=>Xa(Xb(),t,t===e.item.affiliation,t)),r,t)})(e):"");var dy=e=>{const t=xd("Affiliation"),n=xd("Moderator Tools"),r=xd("No users with that affiliation found."),i=xd("No users with that role found."),o=xd("Type here to filter the search results"),s=xd("Role"),a=xd("Show users"),c=xd("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=xd("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 Xa(Jb(),n,Xd,u?(e=>Xa(Qb(),e.switchTab,e.switchTab))(e):"",e.queryable_affiliations.length?"active":"",e.queryAffiliation,l,t,e.queryable_affiliations.map(t=>(e=>Xa(iy(),e.item||"",e.item===e.affiliation,cy(e.item),e.item))(Object.assign({item:t},e))),a,Array.isArray(e.users_with_affiliation)&&e.users_with_affiliation.length>5?Xa(Gb(),e.affiliations_filter,e.filterAffiliationResults,o):"",cy(e.affiliation)?Xa(Vb(),cy(e.affiliation)):"",e.loading_users_with_affiliation?Xa(Wb(),sp()):"",Array.isArray(e.users_with_affiliation)&&0===e.users_with_affiliation.length?Xa($b(),r):"",e.users_with_affiliation instanceof Error?Xa(Hb(),e.users_with_affiliation.message):(e.users_with_affiliation||[]).map(t=>(t.nick||t.jid).match(new RegExp(e.affiliations_filter,"i"))?uy(Object.assign({item:t},e)):""),!u&&e.queryable_roles.length?"active":"",e.queryRole,c,s,e.queryable_roles.map(t=>(e=>Xa(oy(),e.item||"",e.item===e.role,ay(e.item),e.item))(Object.assign({item:t},e))),a,Array.isArray(e.users_with_role)&&e.users_with_role.length>5?Xa(Ub(),e.roles_filter,e.filterRoleResults,o):"",ay(e.role)?Xa(qb(),ay(e.role)):"",e.loading_users_with_role?Xa(Bb(),sp()):"",e.users_with_role&&0===e.users_with_role.length?Xa(Fb(),i):"",(e.users_with_role||[]).map(t=>t.nick.match(e.roles_filter)?ly(Object.assign({item:t},e)):""))};const{Strophe:hy}=rl.env,fy=rl.env.utils;let py;var gy=uh.extend({id:"converse-modtools-modal",initialize(e){py=e._converse,this.chatroomview=e.chatroomview,uh.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:py.bare_jid});return dy(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:Yl.filter(e=>!py.modtools_disable_query.includes(e)),queryable_roles:Ql.filter(e=>!py.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=Gc.settings.get("modtools_disable_assign");return Array.isArray(t)||(t=t?Yl:[]),"owner"===e.get("affiliation")?Yl.filter(e=>!t.includes(e)):"admin"===e.get("affiliation")?Yl.filter(e=>!["owner","admin",...t].includes(e)):[]},getAssignableRoles(e){let t=Gc.settings.get("modtools_disable_assign");return Array.isArray(t)||(t=t?Ql:[]),"moderator"===e.get("role")?Ql.filter(e=>!t.includes(e)):[]},shouldFetchAffiliationsList(){const e=this.model.get("affiliation");if("none"===e)return!1;return!this.chatroomview.model.occupants.getAutoFetchedAffiliationLists().includes(e)},toggleForm(e){e.stopPropagation(),e.preventDefault();const t=e.target.getAttribute("data-form"),n=fy.ancestor(e.target,".list-group-item").querySelector(".".concat(t));fy.hasClass("hidden",n)?fy.removeClass("hidden",n):fy.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(xd("Timeout error while trying to set the affiliation"),"danger"):pr()('not-allowed[xmlns="'.concat(hy.NS.STANZAS,'"]'),e).length?this.alert(xd("Sorry, you're not allowed to make that change"),"danger"):this.alert(xd("Sorry, something went wrong while trying to set the affiliation"),"danger"),void Pn.error(e)}this.alert(xd("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(xd("Role changed"),"primary"),this.model.set({role:null},{silent:!0}),this.model.set({role:o})},e=>{pr()('not-allowed[xmlns="'.concat(hy.NS.STANZAS,'"]'),e).length?this.alert(xd("You're not allowed to make that change"),"danger"):(this.alert(xd("Sorry, something went wrong while trying to set the role"),"danger"),fy.isErrorObject(e)&&Pn.error(e))})}});function my(){const e=Ny(['<li class="feature" ><span class="fa fa-database"></span>'," - <em>","</em></li>"]);return my=function(){return e},e}function vy(){const e=Ny(['<li class="feature" ><span class="fa fa-info-circle"></span>'," - <em>","</em></li>"]);return vy=function(){return e},e}function _y(){const e=Ny(['<li class="feature" ><span class="fa fa-gavel"></span>'," - <em>","</em></li>"]);return _y=function(){return e},e}function by(){const e=Ny(['<li class="feature" ><span class="fa fa-user-secret"></span>'," - <em>","</em></li>"]);return by=function(){return e},e}function yy(){const e=Ny(['<li class="feature" ><span class="fa fa-id-card"></span>'," - <em>","</em></li>"]);return yy=function(){return e},e}function wy(){const e=Ny(['<li class="feature" ><span class="fa fa-snowflake-o"></span>'," - <em>","</em></li>"]);return wy=function(){return e},e}function Sy(){const e=Ny(['<li class="feature" ><span class="fa fa-save"></span>'," - <em>","</em></li>"]);return Sy=function(){return e},e}function xy(){const e=Ny(['<li class="feature" ><span class="fa fa-globe"></span>'," - <em>","</em></li>"]);return xy=function(){return e},e}function Ey(){const e=Ny(['<li class="feature" ><span class="fa fa-address-book"></span>'," - <em>","</em></li>"]);return Ey=function(){return e},e}function Ay(){const e=Ny(['<li class="feature" ><span class="fa fa-eye"></span>'," - <em>","</em></li>"]);return Ay=function(){return e},e}function jy(){const e=Ny(['<li class="feature" ><span class="fa fa-eye-slash"></span>'," - <em>","</em></li>"]);return jy=function(){return e},e}function Cy(){const e=Ny(['<li class="feature" ><span class="fa fa-unlock"></span>'," - <em>","</em></li>"]);return Cy=function(){return e},e}function ky(){const e=Ny(['<li class="feature" ><span class="fa fa-lock"></span>'," - <em>","</em></li>"]);return ky=function(){return e},e}function Oy(){const e=Ny(['\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 Oy=function(){return e},e}function Ty(){const e=Ny(['\n <p class="room-info"><strong>',"</strong>: ",'</p>\n <p class="room-info"><strong>',"</strong>: ","</p>\n "]);return Ty=function(){return e},e}function Ny(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Iy=e=>{const t=xd("Groupchat address (JID)"),n=xd("Message archiving"),r=xd("Messages are archived on the server"),i=xd("Description"),o=xd("Features"),s=xd("Hidden"),a=xd("This groupchat is not publicly searchable"),c=xd("This groupchat is restricted to members only"),l=xd("Members only"),u=xd("Moderated"),d=xd("Participants entering this groupchat need to request permission to write"),h=xd("Name"),f=xd("This groupchat does not require a password upon entry"),p=xd("No password required"),g=xd("Not anonymous"),m=xd("All other groupchat participants can see your XMPP address"),v=xd("Not moderated"),_=xd("Participants entering this groupchat can write right away"),b=xd("Online users"),y=xd("Open"),w=xd("Anyone can join this groupchat"),S=xd("This groupchat requires a password before entry"),x=xd("Password protected"),E=xd("Persistent"),A=xd("This groupchat persists even if it's unoccupied"),j=xd("Public"),C=xd("Semi-anonymous"),k=xd("Only moderators can see your XMPP address"),O=xd("Temporary"),T=xd("This groupchat will disappear once the last person leaves");return Xa(Oy(),e.display_name,Xd,h,e.name,t,e.jid,i,e.config.description,e.subject?(e=>{const t=xd("Topic"),n=xd("Topic author");return Xa(Ty(),t,Wp(Hp.a.filterXSS(e.subject.text,{whiteList:{}})),n,e.subject&&e.subject.author)})(e):"",b,e.num_occupants,o,e.features.passwordprotected?Xa(ky(),x,S):"",e.features.unsecured?Xa(Cy(),p,f):"",e.features.hidden?Xa(jy(),s,a):"",e.features.public_room?Xa(Ay(),j,e.__("This groupchat is publicly searchable")):"",e.features.membersonly?Xa(Ey(),l,c):"",e.features.open?Xa(xy(),y,w):"",e.features.persistent?Xa(Sy(),E,A):"",e.features.temporary?Xa(wy(),O,T):"",e.features.nonanonymous?Xa(yy(),g,m):"",e.features.semianonymous?Xa(by(),C,k):"",e.features.moderated?Xa(_y(),u,d):"",e.features.unmoderated?Xa(vy(),v,_):"",e.features.mam_enabled?Xa(my(),n,r):"",Kd)},My=uh.extend({id:"room-details-modal",initialize(){uh.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 Iy(Object.assign(this.model.toJSON(),{config:this.model.config.toJSON(),display_name:xd("Groupchat info for %1$s",this.model.getDisplayName()),features:this.model.features.toJSON(),num_occupants:this.model.occupants.length}))}});function Ry(){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 Ry=function(){return e},e}function Dy(){const e=Ly(['<div class="muc-bottom-panel"></div>']);return Dy=function(){return e},e}function Py(){const e=Ly(['<div class="muc-bottom-panel">',"</div>"]);return Py=function(){return e},e}function zy(){const e=Ly(['\n <div class="emoji-picker__container dropup"></div>\n <div class="message-form-container">']);return zy=function(){return e},e}function Ly(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Fy=e=>{const t=xd("You're not allowed to send messages in this room");return e.entered?e.can_edit?Xa(zy()):Xa(Py(),t):Xa(Dy())};function By(){const e=Hy(['<p class="destroyed-reason">"','"</p>']);return By=function(){return e},e}function qy(){const e=Hy(['\n <div class="alert alert-danger">\n <h3 class="alert-heading disconnect-msg">',"</h3>\n ","\n ","\n </div>"]);return qy=function(){return e},e}function Uy(){const e=Hy(['\n <p class="moved-label">','</p>\n <p class="moved-link"><a class="switch-chat" href="#">',"</a></p>"]);return Uy=function(){return e},e}function Hy(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var $y=(e,t)=>{const n=xd("This groupchat no longer exists");return Xa(qy(),n,t?Xa(By(),t):"",e?(e=>{const t=xd("The conversation has moved. Click below to enter.");return Xa(Uy(),t,e)})(e):"")};function Wy(){const e=Gy(['<p class="disconnect-msg">',"</p>"]);return Wy=function(){return e},e}function Vy(){const e=Gy(['\n <div class="alert alert-danger">\n <h3 class="alert-heading disconnect-msg">',"</h3>\n ","\n </div>"]);return Vy=function(){return e},e}function Gy(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Jy(){const e=Zy(['<p class="chat-head__desc" title="','">',"</p>"]);return Jy=function(){return e},e}function Qy(){const e=Zy(["<converse-dropdown .items=","></converse-dropdown>"]);return Qy=function(){return e},e}function Yy(){const e=Zy(['<i class="fa fa-bookmark chatbox-title__text--bookmarked" title="','"></i>']);return Yy=function(){return e},e}function Ky(){const e=Zy(['<div class="chatbox-navback"><i class="fa fa-arrow-left"></i></div>']);return Ky=function(){return e},e}function Xy(){const e=Zy(['\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 Xy=function(){return e},e}function Zy(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const ew=rl.env.utils;var tw=e=>{const t=xd("Hide the groupchat topic"),n=xd("This groupchat is bookmarked"),r=e.subject?ew.addHyperlinks(e.subject.text):"",i=r&&!e.subject_hidden;return Xa(Xy(),i?"":"chatbox-title--no-desc",e._converse.api.settings.get("singleton")?"":Xa(Ky()),"hidden"!==e._converse.locked_muc_domain?e.jid:"",e.title,e.bookmarked?Xa(Yy(),n):"",e.standalone_btns.length?(e=>e.standalone_btns.reverse().map(e=>_h(e,"")))(e):"",e.dropdown_btns.length?Xa(Qy(),e.dropdown_btns):"",i?Xa(Jy(),t,r):"")};function nw(){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 nw=function(){return e},e}function rw(){const e=ow(['<p class="form-help">',"</p>"]);return rw=function(){return e},e}function iw(){const e=ow(['\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 iw=function(){return e},e}function ow(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function sw(){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 sw=function(){return e},e}function aw(){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 aw=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:cw,sizzle:lw,$pres:uw}=rl.env,dw=rl.env.utils,hw=["owner"],fw=["admin","ban","deop","destroy","member","op","revoke"],pw=["kick","mute","voice","modtools"],gw=["nick"],mw={deop:"participant",kick:"none",mute:"visitor",op:"moderator",voice:"participant"},vw={admin:"admin",ban:"outcast",member:"member",owner:"owner",revoke:"none"},_w=Wv.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",Rc(()=>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 Hc.api.user.settings.getModel();this.listenTo(e,"change:mucs_with_hidden_subject",this.renderHeading),this.onConnectionStatusChanged(),this.model.maybeShow(),this.scrollDown(),Gc.trigger("chatRoomViewInitialized",this)},async render(){const e=!this.shouldShowSidebar();var t;this.el.setAttribute("id",this.model.get("box_id")),Ya((t={sidebar_hidden:e,model:this.model,occupants:this.model.occupants,show_sidebar:!this.model.get("hidden_occupants")&&this.model.session.get("connection_status")===rl.ROOMSTATUS.ENTERED,markScrolled:e=>this.markScrolled(e),muc_show_logs_before_join:Gc.settings.get("muc_show_logs_before_join"),show_send_button:Hc.show_send_button},Xa(Ry(),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(),Gc.settings.get("muc_show_logs_before_join")||this.model.session.get("connection_status")===rl.ROOMSTATUS.ENTERED||this.showSpinner(),await this.renderHeading(),!this.model.get("hidden")&&this.show()},getNotifications(){const e=this.model.notifications.toJSON();return(Gc.settings.get("muc_show_join_leave")?[...rl.CHAT_STATES,...rl.MUC_TRAFFIC_STATES,...rl.MUC_ROLE_CHANGES]:rl.CHAT_STATES).reduce((t,n)=>{const r=e[n];if(null==r||!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(xd("%1$s is typing",i[0]),"\n");if("paused"===n)return"".concat(t).concat(xd("%1$s has stopped typing",i[0]),"\n");if(n===Hc.GONE)return"".concat(t).concat(xd("%1$s has gone away",i[0]),"\n");if("entered"===n)return"".concat(t).concat(xd("%1$s has entered the groupchat",i[0]),"\n");if("exited"===n)return"".concat(t).concat(xd("%1$s has left the groupchat",i[0]),"\n");if("op"===n)return"".concat(t).concat(xd("%1$s is now a moderator",i[0]),"\n");if("deop"===n)return"".concat(t).concat(xd("%1$s is no longer a moderator",i[0]),"\n");if("voice"===n)return"".concat(t).concat(xd("%1$s has been given a voice",i[0]),"\n");if("mute"===n)return"".concat(t).concat(xd("%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=xd("%1$s and %2$s",i.join(", "),t)}if("composing"===n)return"".concat(t).concat(xd("%1$s are typing",e),"\n");if("paused"===n)return"".concat(t).concat(xd("%1$s have stopped typing",e),"\n");if(n===Hc.GONE)return"".concat(t).concat(xd("%1$s have gone away",e),"\n");if("entered"===n)return"".concat(t).concat(xd("%1$s have entered the groupchat",e),"\n");if("exited"===n)return"".concat(t).concat(xd("%1$s have left the groupchat",e),"\n");if("op"===n)return"".concat(t).concat(xd("%1$s are now moderators",i[0]),"\n");if("deop"===n)return"".concat(t).concat(xd("%1$s are no longer moderators",i[0]),"\n");if("voice"===n)return"".concat(t).concat(xd("%1$s have been given voices",i[0]),"\n");if("mute"===n)return"".concat(t).concat(xd("%1$s have been muted",i[0]),"\n")}return t},"")},getHelpMessages(){const e=Gc.settings.get("muc_disable_slash_commands"),t=Array.isArray(e)?e:[];return["<strong>/admin</strong>: ".concat(xd("Change user's affiliation to admin")),"<strong>/ban</strong>: ".concat(xd("Ban user by changing their affiliation to outcast")),"<strong>/clear</strong>: ".concat(xd("Clear the chat area")),"<strong>/close</strong>: ".concat(xd("Close this groupchat")),"<strong>/deop</strong>: ".concat(xd("Change user role to participant")),"<strong>/destroy</strong>: ".concat(xd("Remove this groupchat")),"<strong>/help</strong>: ".concat(xd("Show this menu")),"<strong>/kick</strong>: ".concat(xd("Kick user from groupchat")),"<strong>/me</strong>: ".concat(xd("Write in 3rd person")),"<strong>/member</strong>: ".concat(xd("Grant membership to a user")),"<strong>/modtools</strong>: ".concat(xd("Opens up the moderator tools GUI")),"<strong>/mute</strong>: ".concat(xd("Remove user's ability to post messages")),"<strong>/nick</strong>: ".concat(xd("Change your nickname")),"<strong>/op</strong>: ".concat(xd("Grant moderator role to user")),"<strong>/owner</strong>: ".concat(xd("Grant ownership of this groupchat")),"<strong>/register</strong>: ".concat(xd("Register your nickname")),"<strong>/revoke</strong>: ".concat(xd("Revoke the user's current affiliation")),"<strong>/subject</strong>: ".concat(xd("Set groupchat subject")),"<strong>/topic</strong>: ".concat(xd("Set groupchat subject (alias for /subject)")),"<strong>/voice</strong>: ".concat(xd("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();Ya(e,this.el.querySelector(".chat-head-chatroom"))},renderBottomPanel(){const e=this.el.querySelector(".bottom-panel"),t=this.model.session.get("connection_status")===rl.ROOMSTATUS.ENTERED,n=t&&!(this.model.features.get("moderated")&&"visitor"===this.model.getOwnRole());Ya(Fy({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)};Hc.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"),Gc.settings.get("muc_mention_autocomplete_show_avatar")){const t=document.createElement("img");let r="data:"+Hc.DEFAULT_IMAGE_TYPE+";base64,"+Hc.DEFAULT_IMAGE;if(Hc.vcards){const t=Hc.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 Hc.AutoComplete(this.el,{auto_first:!0,auto_evaluate:!1,min_chars:Gc.settings.get("muc_mention_autocomplete_min_chars"),match_current_word:!0,list:()=>this.getAutoCompleteList(),filter:"contains"==Gc.settings.get("muc_mention_autocomplete_filter")?Hc.FILTER_CONTAINS:Hc.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 Hc.ChatBoxView.prototype.onKeyDown.call(this,e)},onKeyUp(e){return this.mention_auto_complete.evaluate(e),Hc.ChatBoxView.prototype.onKeyUp.call(this,e)},async onMessageRetractButtonClicked(e){const t=xd("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=[xd("Are you sure you want to retract this message?")];Gc.settings.get("show_retraction_warning")&&(n[1]=t),await Gc.confirm(xd("Confirm"),n)&&this.model.retractOwnMessage(e)}else if(await e.mayBeModerated())if("me"===e.get("sender")){let n=[xd("Are you sure you want to retract this message?")];Gc.settings.get("show_retraction_warning")&&(n=[n[0],t,n[1]]),await Gc.confirm(xd("Confirm"),n)&&this.retractOtherMessage(e)}else{let n=[xd("You are about to retract this message."),xd("You may optionally include a message, explaining the reason for the retraction.")];Gc.settings.get("show_retraction_warning")&&(n=[n[0],t,n[1]]);const r=await Gc.prompt(xd("Message Retraction"),n,xd("Optional reason"));!1!==r&&this.retractOtherMessage(e,r)}else{const e=xd("Sorry, you're not allowed to retract this message");Gc.alert("error",xd("Error"),e)}},async retractOtherMessage(e,t){const n=await this.model.retractOtherMessage(e,t);if(null===n){const e=xd("A timeout occurred while trying to retract the message");Gc.alert("error",xd("Error"),e),Pn(e,cw.LogLevel.WARN)}else if(dw.isErrorStanza(n)){const e=xd("Sorry, you're not allowed to retract this message.");Gc.alert("error",xd("Error"),e),Pn(e,cw.LogLevel.WARN),Pn(n,cw.LogLevel.WARN)}},showModeratorToolsModal(e){if(this.verifyRoles(["moderator"])){if(void 0===this.model.modtools_modal){const t=new Fo({affiliation:e});this.modtools_modal=new gy({model:t,_converse:Hc,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 My({model:this.model})),this.model.room_details_modal.show(e)},showChatStateNotification(e){if("me"!==e.get("sender"))return Hc.ChatBoxView.prototype.showChatStateNotification.apply(this,arguments)},shouldShowSidebar(){return!this.model.get("hidden_occupants")&&this.model.session.get("connection_status")===rl.ROOMSTATUS.ENTERED},onSidebarToggle(){var e;this.renderToolbar(),null===(e=this.el.querySelector(".occupants"))||void 0===e||e.setVisibility()},onOccupantAffiliationChanged(e){e.get("jid")===Hc.bare_jid&&this.renderHeading()},onOccupantRoleChanged(e){e.get("jid")===Hc.bare_jid&&this.renderBottomPanel()},getHeadingButtons(e){const t=[];t.push({i18n_text:xd("Details"),i18n_title:xd("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:xd("Configure"),i18n_title:xd("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:xd("Invite"),i18n_title:xd("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");n&&n.text&&t.push({i18n_text:xd(e?"Show topic":"Hide topic"),i18n_title:xd(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"});if(this.model.session.get("connection_status")===rl.ROOMSTATUS.ENTERED){const e=this.getAllowedCommands();e.includes("modtools")&&t.push({i18n_text:xd("Moderate"),i18n_title:xd("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:xd("Destroy"),i18n_title:xd("Remove this groupchat"),handler:e=>this.destroy(e),a_class:"destroy-chatroom-button",icon_class:"fa-trash",name:"destroy"})}return Gc.settings.get("singleton")||t.push({i18n_text:xd("Leave"),i18n_title:xd("Leave and close this groupchat"),handler:async e=>{e.stopPropagation();const t=[xd("Are you sure you want to leave this groupchat?")];await Gc.confirm(xd("Confirm"),t)&&this.close(e)},a_class:"close-chatbox-button",standalone:"overlayed"===Gc.settings.get("view_mode"),icon_class:"fa-sign-out-alt",name:"signout"}),Hc.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 tw(Object.assign(this.model.toJSON(),{_converse:Hc,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 jb({model:new Fo}),this.muc_invite_modal.chatroomview=this),this.muc_invite_modal.show(e)},afterShown(){dw.isPersistableModel(this.model)&&this.model.clearUnreadMsgCounter(),this.scrollDown()},onConnectionStatusChanged(){const e=this.model.session.get("connection_status");e===rl.ROOMSTATUS.NICKNAME_REQUIRED?this.renderNicknameForm():e===rl.ROOMSTATUS.PASSWORD_REQUIRED?this.renderPasswordForm():e===rl.ROOMSTATUS.CONNECTING?this.showSpinner():e===rl.ROOMSTATUS.ENTERED?(this.renderBottomPanel(),this.hideSpinner(),this.maybeFocus()):e===rl.ROOMSTATUS.DISCONNECTED?this.showDisconnectMessage():e===rl.ROOMSTATUS.DESTROYED&&this.showDestroyedMessage()},getToolbarOptions(){return Object.assign(Hc.ChatBoxView.prototype.getToolbarOptions.apply(this,arguments),{is_groupchat:!0,label_hide_occupants:xd("Hide the list of participants"),show_occupants_toggle:Hc.visible_toolbar_buttons.toggle_occupants})},async close(){return this.hide(),Hc.router.history.getFragment()==="converse/room?jid="+this.model.get("jid")&&Hc.router.navigate(""),await this.model.leave(),Hc.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:Hc.bare_jid})){const n=t.get("role");if(e.includes(n))return!0}if(n){const e=xd("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:Hc.bare_jid})){const n=t.get("affiliation");if(e.includes(n))return!0}if(n){const e=xd("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=xd('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(dw.isValidJID(e.trim()))return e.trim();e.startsWith("@")||(e="@"+e);const[t,n]=this.model.parseTextForReferences(e);if(!n.length){const e=xd("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=xd("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=xd("Error: couldn't find a groupchat participant based on your arguments");this.model.createMessage({message:e,type:"error"})}},setAffiliation(e,t,n){const r=vw[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(!dw.isValidJID(i)){const e=xd("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&&Gc.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=mw[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=xd("Sorry, an error happened while running the command.")+" "+xd("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:Hc.bare_jid});return this.verifyAffiliations(["owner"],t,!1)?e=e.concat(hw).concat(fw):this.verifyAffiliations(["admin"],t,!1)&&(e=e.concat(fw)),this.verifyRoles(["moderator"],t,!1)?e=e.concat(pw).concat(gw):this.verifyRoles(["visitor","participant","moderator"],t,!1)||(e=e.concat(gw)),e.sort(),Array.isArray(Gc.settings.get("muc_disable_slash_commands"))?e.filter(e=>!Gc.settings.get("muc_disable_slash_commands").includes(e)):e},async destroy(){const e=[xd("Are you sure you want to destroy this groupchat?")];let t=[{name:"challenge",label:xd("Please enter the XMPP address of this groupchat to confirm"),challenge:this.model.get("jid"),placeholder:xd("name@example.org"),required:!0},{name:"reason",label:xd("Optional reason for destroying this groupchat"),placeholder:xd("Reason")},{name:"newjid",label:xd("Optional XMPP address for a new groupchat that replaces this one"),placeholder:xd("replacement@example.org")}];try{var n,r;t=await Gc.confirm(xd("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(Gc.settings.get("muc_disable_slash_commands")&&!Array.isArray(Gc.settings.get("muc_disable_slash_commands")))return Hc.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=xd('Your nickname is "%1$s"',this.model.get("nick"));this.model.createMessage({message:e,type:"error"})}else{const e=cw.getBareJidFromJid(this.model.get("jid"));Gc.send(uw({from:Hc.connection.jid,to:"".concat(e,"/").concat(n),id:dw.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:xd("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 Hc.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 Hc.MUCConfigForm({model:this.model,chatroomview:this});this.el.querySelector(".chatroom-body").insertAdjacentElement("beforeend",this.config_form.el)}dw.showElement(this.config_form.el)},renderNicknameForm(){const e=(e=>{const t=xd("Nickname"),n=xd("Enter groupchat"),r=Gc.settings.get("muc_show_logs_before_join")?xd("Choose a nickname to enter"):xd("Please choose your nickname");return Xa(nw(),r,e.nickname_validation_message,e.nick||"",e.nickname_validation_message?"error":"",t,n)})(this.model.toJSON());if(Gc.settings.get("muc_show_logs_before_join")){const t=this.el.querySelector(".muc-bottom-panel");Ya(e,t),dw.addClass("muc-bottom-panel--nickname",t)}else{const t=this.el.querySelector(".muc-nickname-form"),n=dw.getElementFromTemplateResult(e);if(t)lw(".spinner",this.el).forEach(dw.removeElement),t.outerHTML=n.outerHTML;else{this.hideChatRoomContents();this.el.querySelector(".chatroom-body").insertAdjacentElement("beforeend",n)}}dw.safeSave(this.model.session,{connection_status:rl.ROOMSTATUS.NICKNAME_REQUIRED})},closeForm(){lw(".chatroom-form-container",this.el).forEach(e=>dw.addClass("hidden",e)),this.renderAfterTransition()},getAndRenderConfigurationForm(){this.config_form&&dw.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 Hc.MUCPasswordForm({model:new Fo({validation_message:e}),chatroomview:this});this.el.querySelector(".chatroom-body").insertAdjacentElement("beforeend",this.password_form.el)}dw.showElement(this.password_form.el),this.model.session.save("connection_status",rl.ROOMSTATUS.PASSWORD_REQUIRED)},showDestroyedMessage(){dw.hideElement(this.el.querySelector(".chat-area")),dw.hideElement(this.el.querySelector(".occupants")),lw(".spinner",this.el).forEach(dw.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");Ya($y(t,e),n);const r=n.querySelector("a.switch-chat");r&&r.addEventListener("click",async e=>{e.preventDefault();(await Gc.rooms.get(t,null,!0)).maybeShow(!0),this.model.destroy()}),dw.showElement(n)},showDisconnectMessage(){const e=this.model.get("disconnection_message");if(!e)return;dw.hideElement(this.el.querySelector(".chat-area")),dw.hideElement(this.el.querySelector(".occupants")),lw(".spinner",this.el).forEach(dw.removeElement);const t=[e],n=this.model.get("disconnection_actor");n&&t.push(xd("This action was done by %1$s.",n));const r=this.model.get("disconnection_reason");r&&t.push(xd('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");Ya((e=>Xa(Vy(),e[0],e.slice(1).map(e=>Xa(Wy(),e))))(t),i),dw.showElement(i)},onOccupantAdded(e){e.get("jid")===Hc.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==rl.ROOMSTATUS.NICKNAME_REQUIRED)this.renderNicknameForm();else if(e==rl.ROOMSTATUS.PASSWORD_REQUIRED)this.renderPasswordForm();else if(e==rl.ROOMSTATUS.ENTERED){var t;this.hideChatRoomContents(),dw.showElement(this.el.querySelector(".chat-area")),null===(t=this.el.querySelector(".occupants"))||void 0===t||t.setVisibility(),this.scrollDown()}},showSpinner(){lw(".spinner",this.el).forEach(dw.removeElement),this.hideChatRoomContents();this.el.querySelector(".chatroom-body").insertAdjacentElement("afterbegin",dw.getElementFromTemplateResult(sp()))},hideSpinner(){const e=this.el.querySelector(".spinner");return null!==e&&(dw.removeElement(e),this.renderAfterTransition()),this}}),bw=Fd.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:xd("Groupchats"),title_new_room:xd("Add a new groupchat"),title_list_rooms:xd("Query for groupchats")},Xa(aw(),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 wb({model:this.model})),this.add_room_modal.show(e)},showMUCListModal(e){void 0===this.muc_list_modal&&(this.muc_list_modal=new Lb({model:this.model})),this.muc_list_modal.show(e)}});function yw(){const e=Sw(['\n <div class="list-container list-container--headline ','">\n <div class="items-list rooms-list headline-list">\n ',"\n </div>\n </div>\n"]);return yw=function(){return e},e}function ww(){const e=Sw(['\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 ww=function(){return e},e}function Sw(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}rl.plugins.add("converse-muc-views",{dependencies:["converse-autocomplete","converse-modal","converse-controlbox","converse-chatview"],overrides:{ControlBoxView:{renderControlBoxPane(){this.__super__.renderControlBoxPane.apply(this,arguments),Gc.settings.get("allow_muc")&&this.renderRoomsPanel()}}},initialize(){const{_converse:e}=this;Gc.promises.add(["roomsPanelRendered"]),Gc.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=_w,e.RoomsPanel=bw;const t={renderRoomsPanel(){if(this.roomspanel&&dw.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),Gc.trigger("roomsPanelRendered"),this.roomspanel},getRoomsPanel(){return this.roomspanel&&dw.isInDOM(this.roomspanel.el)?this.roomspanel:this.renderRoomsPanel()}};function n(e,t){t.getRoomsPanel().model.save("muc_domain",cw.getDomainFromJid(e))}function r(t){t.model.get("connected")&&(t.getRoomsPanel().model.get("muc_domain")||(void 0===Gc.settings.get("muc_domain")?function(t){function r(e){e&&e.get("var")===cw.NS.MUC&&e.entity.getIdentity("conference","text").then(r=>{r&&n(e.get("from"),t)})}Gc.waitUntil("discoInitialized").then(()=>{Gc.listen.on("serviceDiscovered",r),e.disco_entities.each(e=>r(e.features.findWhere({var:cw.NS.MUC})))}).catch(e=>Pn.error(e))}(t):n(Gc.settings.get("muc_domain"),t)))}e.ControlBoxView&&Object.assign(e.ControlBoxView.prototype,t),e.MUCConfigForm=Fd.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=dw.toStanza(this.model.get("config_stanza")),r=Gc.settings.get("roomconfig_whitelist");let i=lw("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=xd("Save"),n=xd("Cancel");return Xa(iw(),e.submitConfigForm,e.title,e.title!==e.instructions?Xa(rw(),e.instructions):"",e.fields.map(e=>Wp(e)),t,n,e.closeConfigForm)})({closeConfigForm:e=>this.closeConfigForm(e),fields:i.map(e=>dw.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=lw(":input:not([type=button]):not([type=submit])",e.target).map(dw.webForm2xForm).filter(e=>e);try{await this.model.sendConfiguration(t)}catch(e){Pn.error(e);const t=xd("Sorry, an error occurred while trying to submit the config form.")+" "+xd("Check your browser's developer console for details.");Gc.alert("error",xd("Error"),t)}await this.model.refreshDiscoInfo(),this.chatroomview.closeForm()},closeConfigForm(e){e.preventDefault(),this.chatroomview.closeForm()}}),e.MUCPasswordForm=Fd.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=xd("This groupchat requires a password"),n=xd("Password: "),r=xd("Submit");return Xa(sw(),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)}}),Gc.listen.on("chatBoxViewsInitialized",()=>{e.chatboxviews.delegate("click","a.open-chatroom",(function(e){e.preventDefault(),Gc.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}))}))}),Gc.listen.on("clearSession",()=>{const t=e.chatboxviews.get("controlbox");t&&t.roomspanel&&(t.roomspanel.model.destroy(),t.roomspanel.remove(),delete t.roomspanel)}),Gc.listen.on("controlBoxInitialized",e=>{Gc.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 Gc.chatviews.get(t).filter(t=>t.model.get("type")===e.CHATROOMS_TYPE)}{const n=Gc.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 xw=e=>Xa(yw(),e.headlineboxes.length?"":"hidden",e.headlineboxes.map(t=>(e=>Xa(ww(),e.headlinebox.get("jid"),e.headlinebox.get("jid"),e.open_title,e.headlinebox.get("jid")))(Object.assign({headlinebox:t},e))));function Ew(){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 Ew=function(){return e},e}
/**
* @module converse-headlines-view
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const Aw=rl.env.utils,jw=Wv.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(),Gc.trigger("headlinesBoxViewInitialized",this)},render(){this.el.setAttribute("id",this.model.get("box_id"));const e=fv(Object.assign(this.model.toJSON(),{info_close:"",label_personal_message:"",show_send_button:!1,show_toolbar:!1,unread_msgs:""}));return Ya(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 Gc.settings.get("singleton")||e.push({a_class:"close-chatbox-button",handler:e=>this.close(e),i18n_text:xd("Close"),i18n_title:xd("Close these announcements"),icon_class:"fa-times",name:"close",standalone:"overlayed"===Gc.settings.get("view_mode")}),Hc.api.hook("getHeadingButtons",this,e)},renderMessageForm:function(){},afterShown:function(){}}),Cw=Fd.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:xd("Announcements"),headlineboxes:this.model.filter(e=>e.get("type")===Hc.HEADLINES_TYPE),open_title:xd("Click to open this server message")},Xa(Ew(),e.headlineboxes.length?"":"hidden",e.heading_headline,xw(e));var e},renderIfHeadline(e){return e&&e.get("type")===Hc.HEADLINES_TYPE&&this.render()},openHeadline(e){e.preventDefault();const t=e.target.getAttribute("data-headline-jid");Hc.chatboxes.get(t).maybeShow(!0)},insertIntoDOM(){const e=Hc.chatboxviews.get("controlbox");e&&e.el.querySelector(".controlbox-pane").insertAdjacentElement("beforeEnd",this.el)}});rl.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&&Aw.isInDOM(this.headlinepanel.el)||(this.headlinepanel=new Hc.HeadlinesPanel({model:Hc.chatboxes}),Gc.trigger("headlinesPanelRendered")),this.headlinepanel}};Hc.ControlBoxView&&Object.assign(Hc.ControlBoxView.prototype,e),Hc.HeadlinesBoxView=jw,Hc.HeadlinesPanel=Cw,Gc.listen.on("chatBoxViewsInitialized",()=>{const e=Hc.chatboxviews;Hc.chatboxes.on("add",t=>{e.get(t.get("id"))||t.get("type")!==Hc.HEADLINES_TYPE||e.add(t.get("id"),new Hc.HeadlinesBoxView({model:t}))})})}});var kw=n(175),Ow=n.n(kw);
/**
* @module converse-notification
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const{Strophe:Tw}=rl.env,Nw=rl.env.utils,Iw="Notification"in window;let Mw;function Rw(){if(Gc.settings.get("show_tab_notifications")){var e;Mw=null!==(e=Mw)&&void 0!==e?e:new rl.env.Favico({type:"circle",animation:"pop"});const t=Hc.chatboxes.models.reduce((e,t)=>e+(t.get("num_unread")||0),0);Mw.badge(t)}}function Dw(){const e=qw(['\n <fieldset class="form-group">\n <ul class="list-group">\n <li class="list-group-item active">',":</li>\n ","\n </ul>\n </fieldset>"]);return Dw=function(){return e},e}function Pw(){const e=qw(['<div class="alert alert-','" role="alert">',"</div>"]);return Pw=function(){return e},e}function zw(){const e=qw(["\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 zw=function(){return e},e}function Lw(){const e=qw(['\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 Lw=function(){return e},e}function Fw(){const e=qw(['<div class="alert alert-','" role="alert">',"</div>"]);return Fw=function(){return e},e}function Bw(){const e=qw(["\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 Bw=function(){return e},e}function qw(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}rl.env.Favico=Ow.a,rl.plugins.add("converse-notification",{dependencies:["converse-chatboxes"],initialize(){Gc.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:Gc.settings.get("assets_path")+"/sounds/"}),Hc.shouldNotifyOfGroupMessage=function(e){if(null==e||!e.body)return!1;const t=e.from,n=e.from_muc,r=Gc.settings.get("notify_all_room_messages"),i=Hc.chatboxes.get(n),o=Tw.getResourceFromJid(t),s=o&&Tw.unescapeNode(o)||"";let a=!1;const c=i.get("nick");Gc.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},Hc.isMessageToHiddenChat=function(e){var t,n;return null!==(t=null===(n=Hc.chatboxes.get(e.from))||void 0===n?void 0:n.isHidden())&&void 0!==t&&t},Hc.shouldNotifyOfMessage=function(e){const{attrs:t,stanza:n}=e;if(!t||null!==n.querySelector("forwarded"))return!1;if("groupchat"===t.type)return Hc.shouldNotifyOfGroupMessage(t);if(t.is_headline)return Hc.isMessageToHiddenChat(t);const r=Tw.getBareJidFromJid(t.from)===Hc.bare_jid;return!Nw.isOnlyChatStateNotification(n)&&!Nw.isOnlyMessageDeliveryReceipt(n)&&!r&&("all"===Gc.settings.get("show_desktop_notifications")||Hc.isMessageToHiddenChat(t))},Hc.playSoundNotification=function(){if(Gc.settings.get("play_sounds")&&void 0!==window.Audio){const e=new Audio(Gc.settings.get("sounds_path")+"msg_received.ogg"),t=e.canPlayType("audio/ogg");if("probably"===t)return e.play();const n=new Audio(Gc.settings.get("sounds_path")+"msg_received.mp3"),r=n.canPlayType("audio/mp3");"probably"===r?n.play():"maybe"===t?e.play():"maybe"===r&&n.play()}},Hc.areDesktopNotificationsEnabled=function(){return Iw&&Gc.settings.get("show_desktop_notifications")&&"granted"===Notification.permission},Hc.showMessageNotification=function(e){const{attrs:t}=e;if(t.is_error)return;if(!Hc.areDesktopNotificationsEnabled())return;let n,r;const i=t.from,o=Tw.getBareJidFromJid(i);if("headline"===t.type){if(o.includes("@")&&!Gc.settings.get("allow_non_roster_messaging"))return;n=xd("Notification from %1$s",o)}else if(o.includes("@"))if("groupchat"===t.type)n=xd("%1$s says",Tw.getResourceFromJid(i));else{if(void 0===Hc.roster)return void Pn.error("Could not send notification, because roster is undefined");if(r=Hc.roster.get(o),void 0!==r)n=xd("%1$s says",r.getDisplayName());else{if(!Gc.settings.get("allow_non_roster_messaging"))return;n=xd("%1$s says",o)}}else n=xd("Notification from %1$s",o);const s=t.is_encrypted?xd("Encrypted message received"):t.body;if(!s)return;const a=new Notification(n,{body:s,lang:Hc.locale,icon:Gc.settings.get("notification_icon"),requireInteraction:!Hc.notification_delay});Gc.settings.get("notification_delay")&&setTimeout(a.close.bind(a),Gc.settings.get("notification_delay")),a.onclick=function(e){e.preventDefault(),window.focus();Hc.chatboxes.get(o).maybeShow(!0)},a.onclick.bind(Hc)},Hc.showChatStateNotification=function(e){if(Hc.chatstate_notification_blacklist.includes(e.jid))return;const t=e.chat_status;let n=null;if("offline"===t?n=xd("has gone offline"):"away"===t?n=xd("has gone away"):"dnd"===t?n=xd("is busy"):"online"===t&&(n=xd("has come online")),null===n)return;const r=new Notification(e.getDisplayName(),{body:n,lang:Hc.locale,icon:Hc.notification_icon});setTimeout(r.close.bind(r),5e3)},Hc.showContactRequestNotification=function(e){const t=new Notification(e.getDisplayName(),{body:xd("wants to be your contact"),lang:Hc.locale,icon:Hc.notification_icon});setTimeout(t.close.bind(t),5e3)},Hc.showFeedbackNotification=function(e){if("error"===e.klass||"warn"===e.klass){const t=new Notification(e.subject,{body:e.message,lang:Hc.locale,icon:Hc.notification_icon});setTimeout(t.close.bind(t),5e3)}},Hc.handleChatStateNotification=function(e){Hc.areDesktopNotificationsEnabled()&&Gc.settings.get("show_chat_state_notifications")&&Hc.showChatStateNotification(e)},Hc.handleMessageNotification=function(e){if(!Hc.shouldNotifyOfMessage(e))return!1;Gc.trigger("messageNotification",e),Hc.playSoundNotification(),Hc.showMessageNotification(e)},Hc.handleContactRequestNotification=function(e){Hc.areDesktopNotificationsEnabled(!0)&&Hc.showContactRequestNotification(e)},Hc.handleFeedback=function(e){Hc.areDesktopNotificationsEnabled(!0)&&Hc.showFeedbackNotification(e)},Hc.requestPermission=function(){Iw&&!["denied","granted"].includes(Notification.permission)&&Notification.requestPermission()},Gc.listen.on("clearSession",()=>Mw=null),Gc.waitUntil("chatBoxesInitialized").then(()=>Hc.chatboxes.on("change:num_unread",Rw)),Gc.listen.on("pluginsInitialized",(function(){Gc.listen.on("contactRequest",Hc.handleContactRequestNotification),Gc.listen.on("contactPresenceChanged",Hc.handleChatStateNotification),Gc.listen.on("message",Hc.handleMessageNotification),Gc.listen.on("feedback",Hc.handleFeedback),Gc.listen.on("connected",Hc.requestPermission)}))}});const{Strophe:Uw,$iq:Hw}=rl.env,$w=rl.env.utils,Ww=(e,t)=>Xa(Lw(),e.toggleCommandForm,t.node,t.jid,t.name,t.name,t.name||t.jid,t.node===e.showform?((e,t)=>{const n=xd("Hide"),r=xd("Execute");return Xa(Bw(),e.runCommand,t.alert?Xa(Fw(),t.alert_type,t.alert):"",t.node,t.jid,t.instructions,t.fields.map(e=>Wp(e)),r,n,e.hideCommandForm)})(e,t):"");async function Vw(){const e=[...await Gc.rooms.get(),...await Gc.contacts.get()];return[...new Set(e.map(e=>Uw.getDomainFromJid(e.get("jid"))))]}function Gw(){const e=Qw(['\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 Gw=function(){return e},e}function Jw(){const e=Qw(['\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 Jw=function(){return e},e}function Qw(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Gc.elements.define("converse-adhoc-commands",class extends mc{static get properties(){return{alert:{type:String},alert_type:{type:String},nonce:{type:String},showform:{type:String},view:{type:String}}}constructor(){super(),this.view="choose-service",this.showform="",this.commands=[]}render(){return(e=>{const t=xd("On which entity do you want to run commands?"),n=xd("Certain XMPP services and entities allow privileged users to execute ad-hoc commands on them."),r=xd("Commands found"),i=xd("List available commands"),o=xd("XMPP Address"),s=xd("No commands found");return Xa(zw(),e.alert?Xa(Pw(),e.alert_type,e.alert):"",e.fetchCommands,t,n,Vw,o,i,"list-commands"===e.view?Xa(Dw(),e.commands.length?r:s,e.commands.map(t=>Ww(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 Gc.disco.supports(Uw.NS.ADHOC,t)}catch(e){Pn.error(e)}if(n)try{this.commands=await Gc.adhoc.getCommands(t),this.view="list-commands"}catch(e){return Pn.error(e),this.alert_type="danger",this.alert=xd("Sorry, an error occurred while looking for commands on that entity."),this.commands=[],void Pn.error(e)}else this.alert_type="danger",this.alert=xd("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=Hw({type:"set",to:n}).c("command",{xmlns:Uw.NS.ADHOC,node:t,action:"execute"});try{var i;const t=await Gc.sendIQ(r),n=pr()('command[xmlns="'.concat(Uw.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=>$w.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($w.webForm2xForm).filter(e=>e),s=Hw({to:n,type:"set"}).c("command",{sessionid:i.sessionid,node:i.node,xmlns:Uw.NS.ADHOC}).c("x",{xmlns:Uw.NS.XFORM,type:"submit"});let a;o.forEach(e=>s.cnode(e).up());try{a=await Gc.sendIQ(s)}catch(e){i.alert_type="danger",i.alert=xd("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=$w.getUniqueId()}});var Yw=e=>{const t=xd("Settings"),n=xd("%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=xd("%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=Gc.settings.get("show_client_info"),o=Gc.settings.get("allow_adhoc_commands"),s=i&&o;return Xa(Gw(),t,Xd,s?(e=>{const t=xd("About"),n=xd("Commands");return Xa(Jw(),e.switchTab,t,e.switchTab,n)})(e):"",i?"active":"",e.version_name,Wp(Hp.a.filterXSS(n,{whiteList:{a:[]}})),Wp(Hp.a.filterXSS(r,{whiteList:{a:[]}})),!i&&o?"active":"")};let Kw;var Xw=uh.extend({id:"converse-client-info-modal",initialize(e){Kw=e._converse,uh.prototype.initialize.apply(this,arguments)},toHTML(){return Yw(Object.assign(this.model.toJSON(),this.model.vcard.toJSON(),{version_name:Kw.VERSION_NAME}))}});function Zw(){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 Zw=function(){return e},e}function eS(){const e=rS(['<a class="controlbox-heading__btn logout fa fa-sign-out-alt align-self-center" title="','"></a>']);return eS=function(){return e},e}function tS(){const e=rS(['<a class="controlbox-heading__btn show-client-info fa fa-cog align-self-center" title="','" @click=',"></a>"]);return tS=function(){return e},e}function nS(){const e=rS(['\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 nS=function(){return e},e}function rS(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function iS(){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 iS=function(){return e},e}const oS=xd("Your avatar image");function sS(){const e=pS(['\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 sS=function(){return e},e}function aS(){const e=pS(['\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 aS=function(){return e},e}function cS(){const e=pS(['\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 cS=function(){return e},e}function lS(){const e=pS(['\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 lS=function(){return e},e}function uS(){const e=pS(["\n ","\n"]);return uS=function(){return e},e}function dS(){const e=pS(['\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 dS=function(){return e},e}function hS(){const e=pS(['\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 hS=function(){return e},e}function fS(){const e=pS(['\n <span class="fingerprint">',"</span>"]);return fS=function(){return e},e}function pS(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Gc.elements.define("converse-image-picker",class extends mc{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 Xa(iS(),this.openFileSelection,oS,Xf(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 gS=rl.env.utils,mS=e=>Xa(uS(),e.device.get("bundle")&&e.device.get("bundle").fingerprint?(e=>{const t=xd("Checkbox for selecting the following fingerprint");return Xa(hS(),e.device.get("id"),t,gS.formatFingerprint(e.device.get("bundle").fingerprint))})(e):(e=>{const t=xd("Device without a fingerprint"),n=xd("Checkbox for selecting the following device");return Xa(dS(),e.device.get("id"),n,t)})(e)),vS=e=>{const t=xd("This device's OMEMO fingerprint"),n=xd("Generate new keys and fingerprint");return Xa(cS(),t,e.view.current_device&&e.view.current_device.get("bundle")&&e.view.current_device.get("bundle").fingerprint?(e=>Xa(fS(),gS.formatFingerprint(e.view.current_device.get("bundle").fingerprint)))(e):sp(),n,e.view.other_devices.length?(e=>{const t=xd("Other OMEMO-enabled devices"),n=xd("Checkbox to select fingerprints of all other OMEMO devices"),r=xd("Remove checked devices and close"),i=xd("Select all");return Xa(lS(),i,n,t,e.view.other_devices.map(t=>mS(Object.assign({device:t},e))),r)})(e):"")};
/**
* @module converse-profile
* @copyright The Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const _S=rl.env.utils;rl.plugins.add("converse-profile",{dependencies:["converse-status","converse-modal","converse-vcard","converse-chatboxviews"],initialize(){Gc.settings.extend({allow_adhoc_commands:!0,show_client_info:!0}),Hc.ProfileModal=uh.extend({id:"user-profile-modal",events:{"submit .profile-form":"onFormSubmitted"},initialize(){this.listenTo(this.model,"change",this.render),uh.prototype.initialize.apply(this,arguments),Gc.trigger("profileModalInitialized",this.model)},toHTML(){return(e=>{const t=xd("Your Profile"),n=xd("Email"),r=xd("Full Name"),i=xd("XMPP Address (JID)"),o=xd("Nickname"),s=xd("Role"),a=xd("Save and close"),c=xd("Use commas to separate multiple roles. Your roles are shown next to your name on your chat messages."),l=xd("URL"),u=xd("OMEMO"),d=xd("Profile"),h=Xa(aS(),d,u);return Xa(sS(),t,Xd,Hc.pluggable.plugins["converse-omemo"].enabled(Hc)&&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,Hc.pluggable.plugins["converse-omemo"].enabled(Hc)&&vS(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 Vd.a.Tab(e))},async setVCard(e){try{await Gc.vcard.set(Hc.bare_jid,e)}catch(e){return Pn.fatal(e),void this.alert([xd("Sorry, an error happened while trying to save your profile data."),xd("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))}}),Hc.ChatStatusModal=uh.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:xd("Away"),label_busy:xd("Busy"),label_cancel:xd("Cancel"),label_close:xd("Close"),label_custom_status:xd("Custom status"),label_offline:xd("Offline"),label_online:xd("Online"),label_save:xd("Save"),label_xa:xd("Away for long"),modal_title:xd("Change chat status"),placeholder_status_message:xd("Personal status message")}),Xa(Zw(),e.modal_title,Xd,"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(),_S.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()}}),Hc.XMPPStatusView=Hc.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=xd("Log out"),n=xd("Click to change your chat status"),r=xd("Show details about this chat client"),i=Gc.settings.get("show_client_info")||Gc.settings.get("allow_adhoc_commands");return Xa(nS(),e.fullname,i?Xa(tS(),r,e.showUserSettingsModal):"",Gc.settings.get("allow_logout")?Xa(eS(),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")||Hc.bare_jid,showUserSettingsModal:e=>this.showUserSettingsModal(e),status_message:this.model.get("status_message")||xd("I am %1$s",this.getPrettyStatus(e))}))},afterRender(){this.renderAvatar()},showProfileModal(e){e.preventDefault(),void 0===this.profile_modal&&(this.profile_modal=new Hc.ProfileModal({model:this.model})),this.profile_modal.show(e)},showStatusChangeModal(e){e.preventDefault(),void 0===this.status_modal&&(this.status_modal=new Hc.ChatStatusModal({model:this.model})),this.status_modal.show(e)},showUserSettingsModal(e){e.preventDefault(),void 0===this.user_settings_modal&&(this.user_settings_modal=new Xw({model:this.model,_converse:Hc})),this.user_settings_modal.show(e)},logOut(e){e.preventDefault();!0===confirm(xd("Are you sure you want to log out?"))&&Gc.user.logout()},getPrettyStatus:e=>"chat"===e?xd("online"):"dnd"===e?xd("busy"):"xa"===e?xd("away for long"):"away"===e?xd("away"):"offline"===e?xd("offline"):xd(e)||xd("online")}),Gc.listen.on("controlBoxPaneInitialized",async e=>{await Gc.waitUntil("VCardsInitialized"),Hc.xmppstatusview=new Hc.XMPPStatusView({model:Hc.xmppstatus}),e.el.insertAdjacentElement("afterBegin",Hc.xmppstatusview.render().el)})}});var bS=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(Te(n)?it(n):[n],No(t,1))},yS=Math.ceil,wS=Math.max;var SS=function(e,t,n,r){for(var i=-1,o=wS(yS((t-e)/(n||1)),0),s=Array(o);o--;)s[r?o:++i]=e,e+=n;return s};var xS=function(e){return function(t,n,r){return r&&"number"!=typeof r&&jr(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),SS(t,n,r,e)}}();function ES(){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 ES=function(){return e},e}const{Strophe:AS,sizzle:jS,$build:CS,$iq:kS,$msg:OS}=rl.env,TS=rl.env.utils;AS.addNamespace("OMEMO_DEVICELIST",AS.NS.OMEMO+".devicelist"),AS.addNamespace("OMEMO_VERIFICATION",AS.NS.OMEMO+".verification"),AS.addNamespace("OMEMO_WHITELISTED",AS.NS.OMEMO+".whitelisted"),AS.addNamespace("OMEMO_BUNDLES",AS.NS.OMEMO+".bundles");const NS={name:"AES-GCM",length:128};class IS extends Error{constructor(e,t){super(e,t),this.name="IQError",this.iq=t}}function MS(e,t){return t.is_encrypted&&t.encrypted.key?!0===t.encrypted.prekey?async function(e){const t=zS(e.from,parseInt(e.encrypted.device_id,10)),n=TS.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,FS(t))}try{const t=await LS(e,r);return await Hc.omemo_store.generateMissingPreKeys(),await Hc.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,FS(t))}}(t):async function(e){const t=e.from_muc?e.from_real_jid:e.from;t||Object.assign(e,{error_text:xd("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=zS(t,parseInt(e.encrypted.device_id,10)),r=TS.base64ToArrayBuffer(e.encrypted.key);try{const t=await n.decryptWhisperMessage(r,"binary"),i=await LS(e,t);return Object.assign(e,{plaintext:i})}catch(t){return Pn.error("".concat(t.name," ").concat(t.message)),Object.assign(e,FS(t))}}(t):t}function RS(){Hc.chatboxes.on("add",e=>{JS(e),e.get("type")===Hc.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 Hc.contactHasOMEMOSupport(t.get("jid"))||(e.createMessage({message:xd("%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",()=>JS(e)))})}function DS(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 PS=rl.env.omemo={async encryptMessage(e){const t=crypto.getRandomValues(new window.Uint8Array(12)),n=await crypto.subtle.generateKey(NS,!0,["encrypt","decrypt"]),r={name:"AES-GCM",iv:t,tagLength:128},i=await crypto.subtle.encrypt(r,n,TS.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:TS.appendArrayBuffer(c,a),payload:TS.arrayBufferToBase64(s),iv:TS.arrayBufferToBase64(t)}},async decryptMessage(e){const t=await crypto.subtle.importKey("raw",e.key,NS,!0,["encrypt","decrypt"]),n=TS.appendArrayBuffer(TS.base64ToArrayBuffer(e.payload),e.tag),r={name:"AES-GCM",iv:TS.base64ToArrayBuffer(e.iv),tagLength:128};return TS.arrayBufferToString(await crypto.subtle.decrypt(r,t,n))}};function zS(e,t){const n=new libsignal.SignalProtocolAddress(e,t);return new window.libsignal.SessionCipher(Hc.omemo_store,n)}async function LS(e,t){const n=e.encrypted,r=Hc.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 PS.decryptMessage(Object.assign(n,{key:e,tag:r}));return i.save("active",!0),o}}function FS(e){return"debug"===Gc.settings.get("loglevel")?{error_text:xd("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 BS(e){const t=e.querySelector("signedPreKeyPublic"),n=e.querySelector("signedPreKeySignature"),r=jS("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 qS(e){var t;if(null!==(t=e.get("bundle"))&&void 0!==t&&t.fingerprint)return;const n=await e.getBundle();n.fingerprint=TS.arrayBufferToHex(TS.base64ToArrayBuffer(n.identity_key)),e.save("bundle",n),e.trigger("change:bundle")}async function US(e){await Gc.waitUntil("OMEMOInitialized");const t=Hc.devicelists.get(e)||Hc.devicelists.create({jid:e});return await t.fetchDevices(),t.devices}async function HS(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 Hc.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(Hc.omemo_store,t),r=e.getRandomPreKey(),i=await e.getBundle();return n.processPreKey({registrationId:parseInt(e.get("id"),10),identityKey:TS.base64ToArrayBuffer(i.identity_key),signedPreKey:{keyId:i.signed_prekey.id,publicKey:TS.base64ToArrayBuffer(i.signed_prekey.public_key),signature:TS.base64ToArrayBuffer(i.signed_prekey.signature)},preKey:{keyId:r.id,publicKey:TS.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 $S(){Hc.connection.addHandler(e=>{try{jS('event[xmlns="'.concat(AS.NS.PUBSUB,'#event"]'),e).length&&(function(e){const t=jS('items[node="'.concat(AS.NS.OMEMO_DEVICELIST,'"]'),e).pop();if(!t)return;const n='item list[xmlns="'.concat(AS.NS.OMEMO,'"] device'),r=jS(n,t).map(e=>e.getAttribute("id")),i=e.getAttribute("from"),o=Hc.devicelists.getDeviceList(i),s=o.devices;ks(s.pluck("id"),r).forEach(e=>{i===Hc.bare_jid&&e===Hc.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})}),TS.isSameBareJID(i,Hc.bare_jid)&&o.publishCurrentDevice(r)}(e),function(e){const t=jS("items",e).pop();if(!t||!t.getAttribute("node").startsWith(AS.NS.OMEMO_BUNDLES))return;const n=t.getAttribute("node").split(":")[1],r=e.getAttribute("from"),i=jS("item > bundle",t).pop(),o=Hc.devicelists.getDeviceList(r);(o.devices.get(n)||o.devices.create({id:n,jid:r})).save({bundle:BS(i)})}(e))}catch(e){Pn.error(e.message)}return!0},null,"message","headline")}function WS(){if(void 0===Hc.omemo_store){const e="converse.omemosession-".concat(Hc.bare_jid);Hc.omemo_store=new Hc.OMEMOStore({id:e}),Hc.omemo_store.browserStorage=Hc.createStore(e)}return Hc.omemo_store.fetchSession()}async function VS(){await new Promise((e,t)=>Hc.devicelists.fetch({success:e,error:(e,n)=>t(n)}));let e=Hc.devicelists.get(Hc.bare_jid);return e?e.fetchDevices():e=await Hc.devicelists.create({jid:Hc.bare_jid},{promise:!0}),e._devices_promise}async function GS(){if(!Hc.config.get("trusted")||Gc.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");Hc.devicelists=new Hc.DeviceLists;const e="converse.devicelists-".concat(Hc.bare_jid);Hc.devicelists.browserStorage=Hc.createStore(e);try{await VS(),await WS(),await Hc.omemo_store.publishBundle()}catch(e){return Pn.error("Could not initialize OMEMO support"),void Pn.error(e)}Gc.trigger("OMEMOInitialized")}async function JS(e){let t;e.get("type")===Hc.CHATROOMS_TYPE?(await Gc.waitUntil("OMEMOInitialized"),t=e.features.get("nonanonymous")&&e.features.get("membersonly")):e.get("type")===Hc.PRIVATE_CHAT_TYPE&&(t=await Hc.contactHasOMEMOSupport(e.get("jid"))),e.set("omemo_supported",t),t&&Gc.settings.get("omemo_default")&&e.set("omemo_active",!0)}function QS(e){e.stopPropagation(),e.preventDefault();const t=TS.ancestor(e.target,"converse-chat-toolbar");if(!t.model.get("omemo_supported")){let e;return e=t.model.get("type")===Hc.CHATROOMS_TYPE?[xd("Cannot use end-to-end encryption in this groupchat, either the groupchat has some anonymity or not all participants support OMEMO.")]:[xd("Cannot use end-to-end encryption because %1$s uses a client that doesn't support OMEMO.",t.model.contact.getDisplayName())],Gc.alert("error",xd("Error"),e)}t.model.save({omemo_active:!t.model.get("omemo_active")})}function YS(e,t){const n=e.model;let r;if(n.get("type")===Hc.CHATROOMS_TYPE&&n.get("omemo_supported")){const e=xd("Messages are being sent in plaintext"),t=xd("Messages are sent encrypted");r=n.get("omemo_active")?t:e}else r=xd("This groupchat needs to be members-only and non-anonymous in order to support OMEMO encrypted messages");return t.push(Xa(ES(),r,!n.get("omemo_supported"),QS,n.get("omemo_active")?"fa-lock":"fa-unlock",Gc.settings.get("assets_path"),n.get("omemo_active")?"var(--info-color)":"var(--error-color)")),t}const KS={encryptKey:(e,t)=>zS(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=[];jS('presence-subscription-required[xmlns="'.concat(AS.NS.PUBSUB_ERROR,'"]'),e.iq).length?t.push(xd("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"))):jS('remote-server-not-found[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]',e.iq).length?t.push(xd("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(xd("Unable to send an encrypted message due to an unexpected error.")),t.push(e.iq.outerHTML)),Gc.alert("error",xd("Error"),t),Pn.error(e)}else{if(!e.user_facing)throw e;Gc.alert("error",xd("Error"),[e.message]),Pn.error(e)}}};rl.plugins.add("converse-omemo",{enabled:e=>window.libsignal&&e.config.get("trusted")&&!Gc.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=Rc(this.render,50),this.devicelist=Hc.devicelists.get(Hc.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=Hc.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=TS.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=jS('.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),Hc.api.alert(AS.LogLevel.ERROR,xd("Error"),[xd("Sorry, an error occurred while trying to remove the devices.")])})},generateOMEMODeviceBundle(e){e.preventDefault(),confirm(xd("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."))&&Gc.omemo.bundle.generate()}},UserDetailsModal:{events:{"click .fingerprint-trust .btn input":"toggleDeviceTrust"},initialize(){const e=this.model.get("jid");return this.devicelist=Hc.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 Hc.getBundlesAndBuildSessions(this);r=await this.createMessage(n),i=await Hc.createOMEMOMessageStanza(this,r,e)}catch(e){return this.handleMessageSendError(e),null}return Hc.api.send(i),r}return this.__super__.sendMessage.apply(this,arguments)}}},initialize(){Gc.settings.extend({omemo_default:!1}),Gc.promises.add(["OMEMOInitialized"]),Hc.NUM_PREKEYS=100,Object.assign(Hc.ChatBox.prototype,KS),Hc.generateFingerprints=async function(e){const t=await US(e);return Promise.all(t.map(e=>qS(e)))},Hc.getDeviceForContact=function(e,t){return US(e).then(e=>e.get(t))},Hc.contactHasOMEMOSupport=async function(e){return(await US(e)).length>0},Hc.getBundlesAndBuildSessions=async function(e){const t=xd("Sorry, no devices found to which we can send an OMEMO encrypted message.");let n;if(e.get("type")===Hc.CHATROOMS_TYPE){const t=await Promise.all(e.occupants.map(e=>US(e.get("jid"))));n=t.reduce((e,t)=>bS(e,t.models),[])}else if(e.get("type")===Hc.PRIVATE_CHAT_TYPE){const r=await US(e.get("jid"));if(0===r.length){const e=new Error(t);throw e.user_facing=!0,e}const i=Hc.devicelists.get(Hc.bare_jid).devices;n=[...i.models,...r.models]}const r=Hc.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=>HS(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},Hc.createOMEMOMessageStanza=function(e,t,n){const r=xd("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=OS({from:Hc.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:AS.NS.RECEIPTS}).up(),i.c("encrypted",{xmlns:AS.NS.OMEMO}).c("header",{sid:Hc.omemo_store.get("device_id")}),PS.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:AS.NS.HINTS}),e))})},Hc.OMEMOStore=Fo.extend({Direction:{SENDING:1,RECEIVING:2},getIdentityKeyPair(){const e=this.get("identity_keypair");return Promise.resolve({privKey:TS.base64ToArrayBuffer(e.privKey),pubKey:TS.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(TS.arrayBufferToBase64(t)===r)},loadIdentityKey(e){if(null==e)throw new Error("Can't load identity_key for invalid identifier");return Promise.resolve(TS.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=TS.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:TS.base64ToArrayBuffer(t.privKey),pubKey:TS.base64ToArrayBuffer(t.pubKey)}):Promise.resolve()},storePreKey(e,t){const n={};return n[e]={pubKey:TS.arrayBufferToBase64(t.pubKey),privKey:TS.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:TS.base64ToArrayBuffer(t.privKey),pubKey:TS.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:TS.arrayBufferToBase64(e.keyPair.privKey),pubKey:TS.arrayBufferToBase64(e.keyPair.pubKey),signature:TS.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(AS.NS.OMEMO_BUNDLES,":").concat(this.get("device_id")),n=CS("item").c("bundle",{xmlns:AS.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 Gc.pubsub.publish(null,t,n,{"pubsub#access_model":"open"},!1)},async generateMissingPreKeys(){const e=ks(Ud(xS(0,Hc.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:TS.arrayBufferToBase64(e.pubKey)})),n=Hc.devicelists.get(Hc.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=TS.arrayBufferToBase64(e.pubKey),r=function(){const e=Hc.devicelists.get(Hc.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:TS.arrayBufferToBase64(e.privKey),pubKey:n},identity_key:n});const i=await libsignal.KeyHelper.generateSignedPreKey(e,0);Hc.omemo_store.storeSignedPreKey(i),t.signed_prekey={id:i.keyId,public_key:TS.arrayBufferToBase64(i.keyPair.privKey),signature:TS.arrayBufferToBase64(i.signature)};const o=await Promise.all(xS(0,Hc.NUM_PREKEYS).map(e=>libsignal.KeyHelper.generatePreKey(e)));o.forEach(e=>Hc.omemo_store.storePreKey(e.keyId,e.keyPair));const s=Hc.devicelists.get(Hc.bare_jid),a=await s.devices.create({id:t.device_id,jid:Hc.bare_jid},{promise:!0}),c=o.map(e=>({id:e.keyId,key:TS.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:()=>{Hc.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}}),Hc.Device=Fo.extend({defaults:{trusted:0,active:!0},getRandomPreKey(){const e=this.get("bundle");return e.prekeys[TS.getRandomInt(e.prekeys.length)]},async fetchBundleFromServer(){const e=kS({type:"get",from:Hc.bare_jid,to:this.get("jid")}).c("pubsub",{xmlns:AS.NS.PUBSUB}).c("items",{node:"".concat(AS.NS.OMEMO_BUNDLES,":").concat(this.get("id"))});let t;try{t=await Gc.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 IS("Could not fetch bundle",t);const n=jS('items[node="'.concat(AS.NS.OMEMO_BUNDLES,":").concat(this.get("id"),'"]'),t).pop(),r=BS(jS('bundle[xmlns="'.concat(AS.NS.OMEMO,'"]'),n).pop());return this.save("bundle",r),r},getBundle(){return this.get("bundle")?Promise.resolve(this.get("bundle"),this):this.fetchBundleFromServer()}}),Hc.Devices=ta.extend({model:Hc.Device}),Hc.DeviceList=Fo.extend({idAttribute:"jid",initialize(){this.devices=new Hc.Devices;const e="converse.devicelist-".concat(Hc.bare_jid,"-").concat(this.get("jid"));this.devices.browserStorage=Hc.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")===Hc.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=Hc.omemo_store.get("device_id");return this.devices.findWhere({id:e})||(await Hc.omemo_store.generateBundle(),e=Hc.omemo_store.get("device_id")),e},async publishCurrentDevice(e){if(this.get("jid")===Hc.bare_jid){if(await WS(),Hc.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=kS({type:"get",from:Hc.bare_jid,to:this.get("jid")}).c("pubsub",{xmlns:AS.NS.PUBSUB}).c("items",{node:AS.NS.OMEMO_DEVICELIST});let t;try{t=await Gc.sendIQ(e)}catch(e){return Pn.error(e),[]}const n='list[xmlns="'.concat(AS.NS.OMEMO,'"] device'),r=jS(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=CS("item",{id:"current"}).c("list",{xmlns:AS.NS.OMEMO});this.devices.filter(e=>e.get("active")).forEach(t=>e.c("device",{id:t.get("id")}).up());return Gc.pubsub.publish(null,AS.NS.OMEMO_DEVICELIST,e,{"pubsub#access_model":"open"},!1)},removeOwnDevices(e){if(this.get("jid")!==Hc.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()}}),Hc.DeviceLists=ta.extend({model:Hc.DeviceList,getDeviceList(e){return this.get(e)||this.create({jid:e})}}),Gc.waitUntil("chatBoxesInitialized").then(RS),Gc.listen.on("parseMessage",MS),Gc.listen.on("parseMUCMessage",MS),Gc.listen.on("chatBoxViewInitialized",DS),Gc.listen.on("chatRoomViewInitialized",DS),Gc.listen.on("connected",$S),Gc.listen.on("getToolbarButtons",YS),Gc.listen.on("statusInitialized",GS),Gc.listen.on("addClientFeatures",()=>Gc.disco.own.features.add("".concat(AS.NS.OMEMO_DEVICELIST,"+notify"))),Gc.listen.on("userDetailsModalInitialized",e=>{const t=e.get("jid");Hc.generateFingerprints(t).catch(e=>Pn.error(e))}),Gc.listen.on("profileModalInitialized",()=>{Hc.generateFingerprints(Hc.bare_jid).catch(e=>Pn.error(e))}),Gc.listen.on("afterTearDown",()=>delete Hc.omemo_store),Gc.listen.on("clearSession",()=>{Hc.shouldClearCache()&&Hc.devicelists&&(Hc.devicelists.clearStore(),delete Hc.devicelists)}),Object.assign(Hc.api,{omemo:{bundle:{generate:async()=>{const e=Hc.devicelists.get(Hc.bare_jid),t=Hc.omemo_store.get("device_id");if(t){const n=e.devices.get(t);Hc.omemo_store.unset(t),n&&await new Promise(e=>n.destroy({success:e,error:e})),e.devices.trigger("remove")}await Hc.omemo_store.generateBundle(),await e.publishDevices();const n=qS(e.devices.get(Hc.omemo_store.get("device_id")));return await Hc.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:XS,$iq:ZS}=rl.env;XS.addNamespace("PUSH","urn:xmpp:push:0"),rl.plugins.add("converse-push",{initialize(){async function e(e){e=e||Hc.bare_jid;const t=Hc.session.get("push_enabled")||[];if(t.includes(e))return;const n=Gc.settings.get("push_app_servers").filter(e=>!e.disable),r=Gc.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 Gc.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([Gc.disco.supports(XS.NS.PUSH,t.jid),Gc.disco.supports(XS.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=ZS({type:"set"});return e!==Hc.bare_jid&&r.attrs({to:e}),r.c("enable",{xmlns:XS.NS.PUSH,jid:t.jid,node:t.node}),t.secret&&r.c("x",{xmlns:XS.NS.XFORM,type:"submit"}).c("field",{var:"FORM_TYPE"}).c("value").t("".concat(XS.NS.PUBSUB,"#publish-options")).up().up().c("field",{var:"secret"}).c("value").t(t.secret),Gc.sendIQ(r)}(e,t)),o=r.map(t=>async function(e,t){if(!t.jid)return;if(!await Gc.disco.supports(XS.NS.PUSH,e||Hc.bare_jid))return void Pn.warn('Not disabling push app server "'.concat(t.jid,'", no disco support from your server.'));const n=ZS({type:"set"});e!==Hc.bare_jid&&n.attrs({to:e}),n.c("disable",{xmlns:XS.NS.PUSH,jid:t.jid}),t.node&&n.attrs({node:t.node}),Gc.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)}Hc.session.save("push_enabled",t)}function t(t){t.get("type")==Hc.CHATROOMS_TYPE&&e(XS.getDomainFromJid(t.get("jid")))}Gc.settings.extend({push_app_servers:[],enable_muc_push:!1}),Gc.listen.on("statusInitialized",()=>e()),Gc.settings.get("enable_muc_push")&&Gc.listen.on("chatBoxesInitialized",()=>Hc.chatboxes.on("add",t))}});var ex=n(176),tx=n.n(ex),nx=n(177),rx=n.n(nx),ix=n(178),ox=n.n(ix);
/**
* @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:sx,sizzle:ax,$iq:cx}=rl.env,lx=rl.env.utils;sx.addNamespace("REGISTER","jabber:iq:register");const ux=Object.keys(sx.Status).reduce((e,t)=>Math.max(e,sx.Status[t]),0);function dx(){const e=mx(['\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 dx=function(){return e},e}function hx(){const e=mx(['\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 hx=function(){return e},e}function fx(){const e=mx(['<span class="list-item-badge badge badge--muc msgs-indicator">',"</span>"]);return fx=function(){return e},e}function px(){const e=mx(['\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 px=function(){return e},e}function gx(){const e=mx(['\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 gx=function(){return e},e}function mx(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}sx.Status.REGIFAIL=ux+1,sx.Status.REGISTERED=ux+2,sx.Status.CONFLICT=ux+3,sx.Status.NOTACCEPTABLE=ux+5,rl.plugins.add("converse-register",{enabled:()=>!0,overrides:{ControlBoxView:{renderLoginPanel(){return this.__super__.renderLoginPanel.apply(this,arguments),this.renderRegistrationPanel(),this}}},initialize(){function e(e){Gc.waitUntil("controlBoxInitialized").then(()=>{Hc.chatboxes.get("controlbox").set({"active-form":e})}).catch(e=>Pn.fatal(e))}Hc.CONNECTION_STATUS[sx.Status.REGIFAIL]="REGIFAIL",Hc.CONNECTION_STATUS[sx.Status.REGISTERED]="REGISTERED",Hc.CONNECTION_STATUS[sx.Status.CONFLICT]="CONFLICT",Hc.CONNECTION_STATUS[sx.Status.NOTACCEPTABLE]="NOTACCEPTABLE",Gc.settings.extend({allow_registration:!0,domain_placeholder:xd(" e.g. conversejs.org"),providers_link:"https://compliance.conversations.im/",registration_domain:""}),Object.assign(Hc.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(Gc.settings.get("allow_registration")){this.registerpanel=new Hc.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}}),Hc.router.route("converse/login",()=>e("login")),Hc.router.route("converse/register",()=>e("register")),Hc.RegisterPanel=Fd.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(),Gc.listen.on("connectionInitialized",()=>this.registerHooks())},render(){return this.model.set("registration_form_rendered",!1),this.el.innerHTML=tx()({__:xd,default_domain:Gc.settings.get("registration_domain"),label_register:xd("Fetch registration form"),help_providers:xd("Tip: A list of public XMPP providers is available"),help_providers_link:xd("here"),href_providers:Gc.settings.get("providers_link"),domain_placeholder:Gc.settings.get("domain_placeholder")}),Gc.settings.get("registration_domain")&&this.fetchRegistrationForm(Gc.settings.get("registration_domain")),this},registerHooks(){const e=Hc.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=Hc.connection;n.connected=!0;const r=n._proto._reqToData(e);if(!r)return;if(n._proto._connect_cb(r)===sx.Status.CONNFAIL)return this.showValidationError(xd("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(sx.Status.REGIFAIL),this.showValidationError(xd("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=cx({type:"get"}).c("query",{xmlns:sx.NS.REGISTER}).tree();return s.setAttribute("id",n.getUniqueId("sendIQ")),n.send(s),n.connected=!1,!0},onRegistrationFields(e){return"error"===e.getAttribute("type")?(Hc.connection._changeConnectStatus(sx.Status.REGIFAIL,xd('Something went wrong while establishing a connection with "%1$s". Are you sure it exists?',this.domain)),!1):1!==e.getElementsByTagName("query").length?(Hc.connection._changeConnectStatus(sx.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,Lo(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:sx.getDomainFromJid(e),_registering:!0}),await Hc.initConnection(this.domain),null===(t=Hc.connection)||void 0===t||t.connect(this.domain,"",e=>this.onConnectStatusChanged(e)),!1},renderRegistrationRequest(){this.clearRegistrationForm().insertAdjacentHTML("beforeend",ox()({__:Hc.__,cancel:Gc.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 Ya(sp(),e),this.model.set("registration_form_rendered",!1),this},onConnectStatusChanged(e){Pn.debug("converse-register: onConnectStatusChanged"),[sx.Status.DISCONNECTED,sx.Status.CONNFAIL,sx.Status.REGIFAIL,sx.Status.NOTACCEPTABLE,sx.Status.CONFLICT].includes(e)?(Pn.error("Problem during registration: Strophe.Status is ".concat(Hc.CONNECTION_STATUS[e])),this.abortRegistration()):e===sx.Status.REGISTERED&&(Pn.debug("Registered successfully."),Hc.connection.reset(),this.showSpinner(),["converse/login","converse/register"].includes(Hc.router.history.getFragment())&&Hc.router.navigate("",{replace:!0}),this.fields.password&&this.fields.username?(Hc.connection.connect(this.fields.username.toLowerCase()+"@"+this.domain.toLowerCase(),this.fields.password,Hc.onConnectStatusChanged),this.giveFeedback(xd("Now logging you in"),"info")):(Hc.chatboxviews.get("controlbox").renderLoginPanel(),Hc.giveFeedback(xd("Registered successfully"))),this.reset())},renderLegacyRegistrationForm(e){Object.keys(this.fields).forEach(t=>{"username"===t?e.insertAdjacentHTML("beforeend",pf()({domain:" @".concat(this.domain),name:t,type:"text",label:t,value:"",required:!0})):e.insertAdjacentHTML("beforeend",sf()({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=rx()({__:xd,domain:this.domain,title:this.title,instructions:this.instructions,registration_domain:Gc.settings.get("registration_domain")});const n=t.querySelector("fieldset.buttons");"xform"===this.form_type?e.querySelectorAll("field").forEach(t=>{n.insertAdjacentHTML("beforebegin",$l.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=xd("The provider rejected your registration attempt. Please check the values you entered for correctness.");this.showValidationError(e)}},renderProviderChoiceForm(e){e&&e.preventDefault&&e.preventDefault(),Hc.connection._proto._abortAllRequests(),Hc.connection.reset(),this.render()},abortRegistration(){Hc.connection._proto._abortAllRequests(),Hc.connection.reset(),this.model.get("registration_form_rendered")?Gc.settings.get("registration_domain")&&this.model.get("registration_form_rendered")&&this.fetchRegistrationForm(Gc.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=ax(":input:not([type=button]):not([type=submit])",e),n=cx({type:"set",id:lx.getUniqueId()}).c("query",{xmlns:sx.NS.REGISTER});if("xform"===this.form_type){n.c("x",{xmlns:sx.NS.XFORM,type:"submit"});t.map(e=>$l.webForm2xForm(e)).filter(e=>e).forEach(e=>n.cnode(e).up())}else t.forEach(e=>n.c(e.getAttribute("name"),{},e.value));Hc.connection._addSysHandler(this._onRegisterIQ.bind(this),null,"iq",null,null),Hc.connection.send(n),this.setFields(n.tree())},setFields(e){const t=e.querySelector("query"),n=ax('x[xmlns="'.concat(sx.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()]=sx.getText(e):"jabber:x:oob"===e.getAttribute("xmlns")&&this.urls.concat(ax("url",e).map(e=>e.textContent)):this.instructions=sx.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 Hc.connection._changeConnectStatus(sx.Status.REGIFAIL,"unknown"),!1;t=t[0].firstElementChild.tagName.toLowerCase(),"conflict"===t?Hc.connection._changeConnectStatus(sx.Status.CONFLICT,t):"not-acceptable"===t?Hc.connection._changeConnectStatus(sx.Status.NOTACCEPTABLE,t):Hc.connection._changeConnectStatus(sx.Status.REGIFAIL,t)}else Hc.connection._changeConnectStatus(sx.Status.REGISTERED,null);return!1}}),Gc.listen.on("controlBoxInitialized",e=>{e.model.on("change:active-form",e.showLoginOrRegisterForm,e)})}});const vx=e=>{const t=xd("Leave this groupchat");return Xa(hx(),e.currently_open(e.room)?"open":"",e.room.get("num_unread_general")?"unread-msgs":"",e.room.get("jid"),e.room.get("num_unread")?(e=>Xa(fx(),e.room.get("num_unread")))(e):"",e.room.get("jid"),xd("Click to open this groupchat"),e.openRoom,e.room.getDisplayName(),e.allow_bookmarks?(e=>{const t=xd("Bookmark this groupchat"),n=xd("Unbookmark this groupchat");return e.bookmarked?Xa(gx(),e.room.get("jid"),e.room.getDisplayName(),e.removeBookmark,e.bookmarked?n:t):Xa(px(),e.room.get("jid"),e.room.getDisplayName(),e.addBookmark,e.bookmarked?n:t)})(e):"",e.room.get("jid"),xd("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:_x}=rl.env,bx=rl.env.utils;function yx(){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 yx=function(){return e},e}rl.plugins.add("converse-roomslist",{dependencies:["converse-singleton","converse-controlbox","converse-muc","converse-bookmarks"],initialize(){Gc.promises.add("roomsListInitialized"),Hc.RoomsList=Fo.extend({defaults:{"toggle-state":Hc.OPENED}}),Hc.RoomsListView=Fd.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(Hc.bare_jid);this.list_model=new Hc.RoomsList({id:e}),this.list_model.browserStorage=Hc.createStore(e),this.list_model.fetch(),this.render(),this.insertIntoControlBox()},renderIfChatRoom(e){bx.isChatRoom(e)&&this.render()},renderIfRelevantChange(e){const t=["bookmarked","hidden","name","num_unread","num_unread_general"],n=e.changed||{};bx.isChatRoom(e)&&Object.keys(n).filter(e=>t.includes(e)).length&&this.render()},toHTML(){return(e=>{const t=xd("Click to toggle the list of open groupchats");return Xa(dx(),e.rooms.length?"":"hidden",t,e.toggleRoomsList,e.toggle_state===e._converse.OPENED?"fa-caret-down":"fa-caret-right",xd("Open Groupchats"),e.collapsed&&"collapsed",e.rooms.map(t=>vx(Object.assign({room:t},e))))})({_converse:Hc,addBookmark:e=>this.addBookmark(e),allow_bookmarks:Hc.allow_bookmarks&&Hc.bookmarks,closeRoom:e=>this.closeRoom(e),collapsed:this.list_model.get("toggle-state")!==Hc.OPENED,currently_open:e=>Hc.isUniView()&&!e.get("hidden"),openRoom:e=>this.openRoom(e),removeBookmark:e=>this.removeBookmark(e),rooms:this.model.filter(e=>e.get("type")===Hc.CHATROOMS_TYPE),showRoomDetailsModal:e=>this.showRoomDetailsModal(e),toggleRoomsList:e=>this.toggleRoomsList(e),toggle_state:this.list_model.get("toggle-state")})},insertIntoControlBox(){const e=Hc.chatboxviews.get("controlbox");if(void 0!==e&&!bx.rootContains(Hc.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=Hc.chatboxes.get(t);e.preventDefault(),void 0===n.room_details_modal&&(n.room_details_modal=new My({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||_x.unescapeNode(_x.getNodeFromJid(n))||n};await Gc.rooms.open(n,r,!0),Gc.chatviews.get(n).maybeFocus()},closeRoom(e){e.preventDefault();const t=e.target.getAttribute("data-room-name"),n=e.target.getAttribute("data-room-jid");confirm(xd("Are you sure you want to leave the groupchat %1$s?",t))&&Hc.chatboxviews.get(n).close()},removeBookmark:Hc.removeBookmarkViaEvent,addBookmark:Hc.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")?bx.slideIn(this.el.querySelector(".open-rooms-list")).then(()=>{this.list_model.save({"toggle-state":Hc.CLOSED}),t.classList.remove("fa-caret-down"),t.classList.add("fa-caret-right")}):bx.slideOut(this.el.querySelector(".open-rooms-list")).then(()=>{this.list_model.save({"toggle-state":Hc.OPENED}),t.classList.remove("fa-caret-right"),t.classList.add("fa-caret-down")})}});const e=function(){Hc.rooms_list_view=new Hc.RoomsListView({model:Hc.chatboxes}),Gc.trigger("roomsListInitialized")};Gc.listen.on("connected",async()=>{Hc.allow_bookmarks?await Gc.waitUntil("bookmarksInitialized"):await Promise.all([Gc.waitUntil("chatBoxesFetched"),Gc.waitUntil("roomsPanelRendered")]),e()}),Gc.listen.on("reconnected",e)}});var wx=n(179),Sx=n.n(wx),xx=n(180),Ex=n.n(xx),Ax=n(181),jx=n.n(Ax),Cx=n(182),kx=n.n(Cx);function Ox(){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 Ox=function(){return e},e}var Tx=n(183),Nx=n.n(Tx);
/**
* @module converse-rosterview
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
const{Strophe:Ix}=rl.env,Mx=rl.env.utils;rl.plugins.add("converse-rosterview",{dependencies:["converse-roster","converse-modal","converse-chatboxviews"],initialize(){Gc.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}),Gc.promises.add("rosterViewInitialized");const e={dnd:xd("This contact is busy"),online:xd("This contact is online"),offline:xd("This contact is offline"),unavailable:xd("This contact is unavailable"),xa:xd("This contact is away for an extended period"),away:xd("This contact is away")};function t(){Gc.settings.get("authentication")!==Hc.ANONYMOUS&&(Hc.rosterview=new Hc.RosterView({model:Hc.rostergroups}),Hc.rosterview.render(),Gc.trigger("rosterViewInitialized"))}Hc.AddContactModal=uh.extend({id:"add-contact-modal",events:{"submit form":"addContactFromForm"},initialize(){uh.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change",this.render)},toHTML(){const e=Gc.settings.get("xhr_user_search_url")?xd("Contact name"):xd("Optional nickname");return(e=>{const t=xd("name@example.org"),n=xd("Add"),r=xd("Please enter a valid XMPP address"),i=xd("Add a Contact"),o=xd("XMPP Address"),s=xd("Nickname");return Xa(yx(),i,Xd,o,!e._converse.xhr_user_search_url,e.jid||"",t,s,e.nickname||"",s,r,n)})(Object.assign(this.model.toJSON(),{_converse:Hc,label_nickname:e}))},afterRender(){"string"==typeof Gc.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(!Gc.settings.get("autocomplete_add_contact"))return;const e=this.el.querySelector(".suggestion-box__jid").parentElement;this.jid_auto_complete=new Hc.AutoComplete(e,{data:(e,t)=>"".concat(t.slice(0,t.indexOf("@")),"@").concat(e),filter:Hc.FILTER_STARTSWITH,list:[...new Set(Hc.roster.map(e=>Ix.getDomainFromJid(e.get("jid"))))]})},initXHRAutoComplete(){if(!Gc.settings.get("autocomplete_add_contact"))return this.initXHRFetch();const e=this.el.querySelector(".suggestion-box__name").parentElement;this.name_auto_complete=new Hc.AutoComplete(e,{auto_evaluate:!1,filter:Hc.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",Rc(()=>{t.open("GET","".concat(Gc.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=xd("Sorry, could not find a contact with that name"),void Mx.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?(Mx.addClass("is-invalid",this.el.querySelector('input[name="jid"]')),Mx.addClass("d-block",t),!1):Hc.roster.get(Ix.getBareJidFromJid(e))?(t.textContent=xd("This contact has already been added"),Mx.addClass("d-block",t),!1):(Mx.removeClass("d-block",t),!0)},afterSubmission(e,t,n){Hc.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 Gc.settings.get("xhr_user_search_url")){const e=this.el.querySelector('input[name="name"]');return this.xhr.open("GET","".concat(Gc.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"))}}),Hc.RosterFilter=Fo.extend({initialize(){this.set({filter_text:"",filter_type:"contacts",chat_state:"online"})}}),Hc.RosterFilterView=Fd.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:xd("Filter"),title_contact_filter:xd("Filter by contact name"),title_group_filter:xd("Filter by group name"),title_status_filter:xd("Filter by status"),label_any:xd("Any"),label_unread_messages:xd("Unread"),label_online:xd("Online"),label_chatty:xd("Chatty"),label_busy:xd("Busy"),label_away:xd("Away"),label_xa:xd("Extended Away"),label_offline:xd("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)}),Xa(Ox(),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:Rc((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 Hc.roster&&Hc.roster.length>=5||this.isActive()},clearFilter(e){e&&e.preventDefault(),this.model.save({filter_text:""})}}),Hc.RosterContactView=Hc.ViewWithAvatar.extend({tagName:"li",className:"list-item d-flex hidden controlbox-padded",events:{"click .accept-xmpp-request":"acceptRequest","click .decline-xmpp-request":"declineRequest","click .open-chat":"openChat","click .remove-xmpp-contact":"removeContact"},async initialize(){await this.model.initialized,this.debouncedRender=Rc(this.render,50),this.listenTo(this.model,"change",this.debouncedRender),this.listenTo(this.model,"destroy",this.remove),this.listenTo(this.model,"highlight",this.highlight),this.listenTo(this.model,"remove",this.remove),this.listenTo(this.model,"vcard:change",this.debouncedRender),this.listenTo(this.model.presence,"change:show",this.debouncedRender),this.render()},render(){if(!this.mayBeShown())return Mx.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=>Mx.removeClass(e,this.el)),this.el.classList.add(n),this.el.setAttribute("data-status",n),this.highlight(),Hc.isUniView()){const e=Hc.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=Ex()(Object.assign(this.model.toJSON(),{display_name:e,desc_remove:xd("Click to remove %1$s as a contact",e),allow_chat_pending_contacts:Gc.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=jx()(Object.assign(this.model.toJSON(),{display_name:e,desc_accept:xd("Click to accept the contact request from %1$s",e),desc_decline:xd("Click to decline the contact request from %1$s",e),allow_chat_pending_contacts:Gc.settings.get("allow_chat_pending_contacts")}))}else("both"===i||"to"===i||Hc.rosterview.isSelf(o))&&(this.el.classList.add("current-xmpp-contact"),this.el.classList.remove(rv(["both","to"],i)[0]),this.el.classList.add(i),this.renderRosterItem(this.model));return this},highlight(){if(Hc.isUniView()){const e=Hc.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=Nx()(Object.assign(t.toJSON(),{show:n,display_name:i,status_icon:r,desc_status:e[n],desc_chat:xd("Click to chat with %1$s (XMPP address: %2$s)",i,t.get("jid")),desc_remove:xd("Click to remove %1$s as a contact",i),allow_contact_removal:Gc.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!Gc.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(),Gc.settings.get("allow_contact_removal")&&confirm(xd("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),Gc.alert("error",xd("Error"),[xd("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 Hc.roster.sendContactAddIQ(this.model.get("jid"),this.model.getFullname(),[]),this.model.authorize().subscribe()},declineRequest(e){e&&e.preventDefault&&e.preventDefault();return!0===confirm(xd("Are you sure you want to decline this contact request?"))&&this.model.unauthorize().destroy(),this}}),Hc.RosterGroupView=sv.extend({tagName:"div",className:"roster-group hidden",events:{"click a.group-toggle":"toggle"},sortImmediatelyOnAdd:!0,ItemView:Hc.RosterContactView,listItems:"model.contacts",listSelector:".roster-group-contacts",sortEvent:"presenceChanged",initialize(){sv.prototype.initialize.apply(this,arguments),this.model.get("name")===Hc.HEADER_UNREAD&&this.listenTo(this.model.contacts,"change:num_unread",e=>!this.model.get("unread_messages")&&this.removeContact(e)),this.model.get("name")===Hc.HEADER_REQUESTING_CONTACTS&&this.listenTo(this.model.contacts,"change:requesting",e=>!e.get("requesting")&&this.removeContact(e)),this.model.get("name")===Hc.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(Hc.roster,"change:groups",this.onContactGroupChange),Hc.rosterview.on("rosterContactsFetchedAndProcessed",()=>this.sortAndPositionAllItems())},render(){return this.el.setAttribute("data-group",this.model.get("name")),this.el.innerHTML=Sx()({label_group:this.model.get("name"),desc_group_toggle:this.model.get("description"),toggle_state:this.model.get("state"),_converse:Hc}),this.contacts_el=this.el.querySelector(".roster-group-contacts"),this},show(){return Mx.showElement(this.el),this.model.get("state")===Hc.OPENED&&Object.values(this.getAll()).filter(e=>e.mayBeShown()).forEach(e=>Mx.showElement(e.el)),this},collapse(){return Mx.slideIn(this.contacts_el)},filterOutContacts(e=[]){let t=0;this.model.contacts.forEach(n=>{const r=this.get(n.get("id"));e.includes(n)?Mx.hideElement(r.el):r.mayBeShown()&&(Mx.showElement(r.el),t+=1)}),t?Mx.showElement(this.el):Mx.hideElement(this.el)},getFilterMatches(e,t){if(0===e.length)return[];e=e.toLowerCase();const n=this.model.contacts;if("state"===t){return[Hc.HEADER_REQUESTING_CONTACTS,Hc.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||Hc.rosterview.filter_view.model.get("filter_type"))?Hc.rosterview.filter_view.model.get("chat_state"):Hc.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");Mx.hasClass("fa-caret-down",t)?(this.model.save({state:Hc.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:Hc.OPENED}),this.filter(),Mx.showElement(this.el),Mx.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()}}),Hc.RosterView=sv.extend({tagName:"div",id:"converse-roster",className:"controlbox-section",ItemView:Hc.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(){sv.prototype.initialize.apply(this,arguments),this.listenTo(Hc.roster,"add",this.onContactAdded),this.listenTo(Hc.roster,"change:groups",this.onContactAdded),this.listenTo(Hc.roster,"change",this.onContactChange),this.listenTo(Hc.roster,"destroy",this.update),this.listenTo(Hc.roster,"remove",this.update),Hc.presences.on("change:show",()=>{this.update(),this.updateFilter()}),this.listenTo(this.model,"reset",this.reset),Gc.listen.on("rosterGroupsFetched",this.sortAndPositionAllItems.bind(this)),Gc.listen.on("rosterContactsFetched",()=>{Hc.roster.each(e=>this.addRosterContact(e,{silent:!0})),this.update(),this.updateFilter(),this.trigger("rosterContactsFetchedAndProcessed")}),this.createRosterFilter()},render(){this.el.innerHTML=kx()({allow_contact_requests:Hc.allow_contact_requests,heading_contacts:xd("Contacts"),title_add_contact:xd("Add a contact"),title_sync_contacts:xd("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 Hc.AddContactModal({model:new Fo})),this.add_contact_modal.show(e)},createRosterFilter(){const e=new Hc.RosterFilter;e.id="_converse.rosterfilter-".concat(Hc.bare_jid),e.browserStorage=Hc.createStore(e.id),this.filter_view=new Hc.RosterFilterView({model:e}),this.listenTo(this.filter_view.model,"change",this.updateFilter),this.filter_view.model.fetch()},updateFilter:Rc((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 Mx.isVisible(this.roster_el)||Mx.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&&Mx.slideOut(t.el):Mx.slideIn(t.el)}):n.forEach(n=>n.filter(e,t))},async syncContacts(e){e.preventDefault(),Mx.addClass("fa-spin",e.target),Hc.roster.data.save("version",null),await Hc.roster.fetchFromServer(),Gc.user.presence.send(),Mx.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(),Gr(e.changed,"subscription")&&("from"===e.changed.subscription?this.addContactToGroup(e,Hc.HEADER_PENDING_CONTACTS):["both","to"].includes(e.get("subscription"))&&this.addExistingContact(e)),Gr(e.changed,"num_unread")&&e.get("num_unread")&&this.addContactToGroup(e,Hc.HEADER_UNREAD),Gr(e.changed,"ask")&&"subscribe"===e.changed.ask&&this.addContactToGroup(e,Hc.HEADER_PENDING_CONTACTS),Gr(e.changed,"subscription")&&"true"===e.changed.requesting&&this.addContactToGroup(e,Hc.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;Gc.settings.get("roster_groups")?(n=e.get("groups"),n=0===n.length?[Hc.HEADER_UNGROUPED]:n):n=[Hc.HEADER_CURRENT_CONTACTS],e.get("num_unread")&&n.push(Hc.HEADER_UNREAD),n.forEach(n=>this.addContactToGroup(e,n,t))},isSelf:e=>Mx.isSameBareJID(e,Hc.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(!Hc.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,Hc.HEADER_PENDING_CONTACTS,t):!0===e.get("requesting")&&this.addContactToGroup(e,Hc.HEADER_REQUESTING_CONTACTS,t)}return this}}),Gc.listen.on("chatBoxesInitialized",()=>{function e(e){const t=Hc.roster&&Hc.roster.findWhere({jid:e.get("jid")});void 0!==t&&t.trigger("highlight")}Hc.chatboxes.on("destroy",t=>e(t)),Hc.chatboxes.on("change:hidden",t=>e(t))}),Gc.listen.on("controlBoxInitialized",e=>{function t(){e.model.get("connected")&&Gc.settings.get("authentication")!==Hc.ANONYMOUS&&Gc.waitUntil("rosterViewInitialized").then(()=>e.controlbox_pane.el.insertAdjacentElement("beforeEnd",Hc.rosterview.el)).catch(e=>Pn.fatal(e))}t(),e.model.on("change:connected",t)}),Gc.listen.on("rosterInitialized",t),Gc.listen.on("rosterReadyAfterReconnection",t),Gc.listen.on("afterTearDown",()=>{rl.rosterview&&(rl.rosterview.model.off().reset(),rl.rosterview.each(e=>e.removeAll().remove()),rl.rosterview.removeAll().remove(),delete rl.rosterview)})}});n(493);
/**
* @description Converse.js (A browser based XMPP chat client)
* @copyright 2020, The Converse developers
* @license Mozilla Public License (MPLv2)
*/const Rx=["converse-autocomplete","converse-bookmark-views","converse-chatboxviews","converse-chatview","converse-controlbox","converse-dragresize","converse-fullscreen","converse-mam-views","converse-minimize","converse-modal","converse-muc-views","converse-headlines-view","converse-notification","converse-omemo","converse-profile","converse-push","converse-register","converse-roomslist","converse-rosterview","converse-singleton"];i.a.templateSettings={escape:/\{\{\{([\s\S]+?)\}\}\}/g,evaluate:/\{\[([\s\S]+?)\]\}/g,interpolate:/\{\{([\s\S]+?)\}\}/g,imports:{_:i.a}},rl.env._=i.a;const Dx=rl.initialize;rl.initialize=function(e,t){return Array.isArray(e.whitelisted_plugins)?e.whitelisted_plugins=e.whitelisted_plugins.concat(Rx):e.whitelisted_plugins=Rx,Dx(e,t)};t.default=rl}]);
//# sourceMappingURL=converse.min.js.map