mirror of
https://github.com/YunoHost-Apps/converse_ynh.git
synced 2024-09-03 18:25:53 +02:00
591 lines
1 MiB
JavaScript
591 lines
1 MiB
JavaScript
|
!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:"local
|
|||
|
/*!
|
|||
|
* 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,j=i.document,A=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?"<EFBFBD>":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(j.childNodes),j.childNodes),R[j.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.d
|
|||
|
/*!
|
|||
|
* 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
|
|||
|
/**
|
|||
|
* @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]",j="[object Float32Array]",A="[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]",je="[A-Z\\xc0-\\xd6\\xd8-\\xde]",Ae="(?:"+be+"|"+ye+")",Ce="(?:"+je+"|"+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([je+"?"+be+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[ge,je,"$"].join("|")+")",Ce+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[ge,je+Ae,"$"].join("|")+")",je+"?"+Ae+"+(?:['’](?:d|ll|m|re|s|t|ve))?",je+"+(?:['’](?: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[j]=Be[A]=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[j]=qe[A]=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&
|
|||
|
/**
|
|||
|
* @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
|
|||
|
/*!
|
|||
|
* 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 olszt
|
|||
|
/**
|
|||
|
* @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",
|
|||
|
/**
|
|||
|
* @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
|
|||
|
/**
|
|||
|
* @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=Aa(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=Aa(r,o),s=r[o]}l.forEach(e=>e.parentNode.removeChild(e))}const ja=e=>{let t=11===e.nodeType?0:1;const n=document.createTreeWalker(e,133,null,!1);for(;n.nextNode();)t++;return t},Aa=(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=` ${ma} `;class Ra{constructor(e,t,n,r){this.strings=e,this.values=t,this.type=n,this.processor=r}getHTML(){const e=this.strings.length-1;let t="",n=!1;for(let r=0;r<e;r++){const e=this.strings[r],i=e.lastIndexOf("\x3c!--");n=(i>-1||n)&&-1===e.indexOf("--\x3e",i+1);const o=xa.exec(e);t+=null===o?e+(n?Ma:va):e.substr(0,o.index)+o[1]+o[2]+"$lit$"+o[3]+ma}return t+=this.strings[e],t}getTemplateElement(){const e=document.createElement("template");return e.innerHTML=this.getHTML(),e}}
|
|||
|
/**
|
|||
|
* @license
|
|||
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|||
|
* This code may only be used under the BSD style license found at
|
|||
|
* http://polymer.github.io/LICENSE.txt
|
|||
|
* The complete set of authors may be found at
|
|||
|
* http://polymer.github.io/AUTHORS.txt
|
|||
|
* The complete set of contributors may be found at
|
|||
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
|||
|
* Code distributed by Google as part of the polymer project is also
|
|||
|
* subject to an additional IP rights grant found at
|
|||
|
* http://polymer.github.io/PATENTS.txt
|
|||
|
*/
|
|||
|
const Da=e=>null===e||!("object"==typeof e||"function"==typeof e),Pa=e=>Array.isArray(e)||!(!e||!e[Symbol.iterator]);class za{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 La(this)}_getValue(){const e=this.strings,t=e.length-1;let n="";for(let r=0;r<t;r++){n+=e[r];const t=this.parts[r];if(void 0!==t){const e=t.value;if(Da(e)||!Pa(e))n+="string"==typeof e?e:String(e);else for(const t of e)n+="string"==typeof t?t:String(t)}}return n+=e[t],n}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}}class La{constructor(e){this.value=void 0,this.committer=e}setValue(e){e===Ta||Da(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 Fa{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&&(Da(e)?e!==this.value&&this.__commitText(e):e instanceof Ra?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):Pa(e)?this.__commitIterable(e):e===Na?(this.value=Na,this.clear()):this.__commitText(e))}__insert(e){this.endNode.parentNode.insertBefore(e,this.endNode)}__commitNode(e){this.value!==e&&(this.clear(),this.__insert(e),this.value=e)}__commitText(e){const t=this.startNode.nextSibling,n="string"==typeof(e=null==e?"":e)?e:String(e);t===this.endNode.previousSibling&&3===t.nodeType?t.data=n:this.__commitNode(document.createTextNode(n)),this.value=e}__commitTemplateResult(e){const t=this.options.templateFactory(e);if(this.value instanceof Ia&&this.value.template===t)this.value.update(e.values);else{const n=new Ia(t,e.processor,this.options),r=n._clone();n.update(e.values),this.__commitNode(r),this.value=n}}__commitIterable(e){Array.isArray(this.value)||(this.value=[],this.clear());const t=this.value;let n,r=0;for(const i of e)n=t[r],void 0===n&&(n=new Fa(this.options),t.push(n),0===r?n.appendIntoPart(this):n.insertAfterPart(t[r-1])),n.setValue(i),n.commit(),r++;r<t.length&&(t.length=r,this.clear(n&&n.endNode))}clear(e=this.startNode){ga(this.startNode.parentNode,e.nextSibling,this.endNode)}}class Ba{constructor(e,t,n){if(this.value=void 0,this.__pendingValue=void 0,2!==n.length||""!==n[0]||""!==n[1])throw new Error("Boolean attributes can only contain a single expression");this.element=e,this.name=t,this.strings=n}setValue(e){this.__pendingValue=e}commit(){for(;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 qa extends za{constructor(e,t,n){super(e,t,n),this.single=2===n.length&&""===n[0]&&""===n[1]}_createPart(){return new Ua(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}}class Ua extends La{}let Ha=!1;(()=>{try{const e={get capture(){return Ha=!0,!1}};window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(e){}})();class $a{constructor(e,t,n){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=t,this.eventContext=n,this.__boundHandleEvent=e=>this.handleEvent(e)}setValue(e){this.__pendingValue=e}commit(){for(;Oa(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=Ta,e(t
|
|||
|
/**
|
|||
|
* @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 Va(e){let t=Ga.get(e.type);void 0===t&&(t={stringsArray:new WeakMap,keyString:new Map},Ga.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 Ga=new Map,Ja=new WeakMap,Qa=(e,t,n)=>{let r=Ja.get(t);void 0===r&&(ga(t,t.firstChild),Ja.set(t,r=new Fa(Object.assign({templateFactory:Va},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 Ya=new
|
|||
|
/**
|
|||
|
* @license
|
|||
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|||
|
* This code may only be used under the BSD style license found at
|
|||
|
* http://polymer.github.io/LICENSE.txt
|
|||
|
* The complete set of authors may be found at
|
|||
|
* http://polymer.github.io/AUTHORS.txt
|
|||
|
* The complete set of contributors may be found at
|
|||
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
|||
|
* Code distributed by Google as part of the polymer project is also
|
|||
|
* subject to an additional IP rights grant found at
|
|||
|
* http://polymer.github.io/PATENTS.txt
|
|||
|
*/
|
|||
|
class{handleAttributeExpressions(e,t,n,r){const i=t[0];if("."===i){return new qa(e,t.slice(1),n).parts}return"@"===i?[new $a(e,t.slice(1),r.eventContext)]:"?"===i?[new Ba(e,t.slice(1),n)]:new za(e,t,n).parts}handleTextExpression(e){return new Fa(e)}};
|
|||
|
/**
|
|||
|
* @license
|
|||
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|||
|
* This code may only be used under the BSD style license found at
|
|||
|
* http://polymer.github.io/LICENSE.txt
|
|||
|
* The complete set of authors may be found at
|
|||
|
* http://polymer.github.io/AUTHORS.txt
|
|||
|
* The complete set of contributors may be found at
|
|||
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
|||
|
* Code distributed by Google as part of the polymer project is also
|
|||
|
* subject to an additional IP rights grant found at
|
|||
|
* http://polymer.github.io/PATENTS.txt
|
|||
|
*/"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.2.1");const Ka=(e,...t)=>new Ra(e,t,"html",Ya),Xa=(e,t)=>`${e}--${t}`;let Za=!0;void 0===window.ShadyCSS?Za=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),Za=!1);const ec=e=>t=>{const n=Xa(t.type,e);let r=Ga.get(n);void 0===r&&(r={stringsArray:new WeakMap,keyString:new Map},Ga.set(n,r));let i=r.stringsArray.get(t.strings);if(void 0!==i)return i;const o=t.strings.join(ma);if(i=r.keyString.get(o),void 0===i){const n=t.getTemplateElement();Za&&window.ShadyCSS.prepareTemplateDom(n,e),i=new ba(t,n),r.keyString.set(o,i)}return r.stringsArray.set(t.strings,i),i},tc=["html","svg"],nc=new Set,rc=(e,t,n)=>{nc.add(e);const r=n?n.element:document.createElement("template"),i=t.querySelectorAll("style"),{length:o}=i;if(0===o)return void window.ShadyCSS.prepareTemplateStyles(r,e);const s=document.createElement("style");for(let e=0;e<o;e++){const t=i[e];t.parentNode.removeChild(t),s.textContent+=t.textContent}(e=>{tc.forEach(t=>{const n=Ga.get(Xa(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=Aa(i),a=0,c=-1;for(;o.nextNode();){for(c++,o.currentNode===n&&(a=ja(t),n.parentNode.insertBefore(t,n));-1!==s&&i[s].index===c;){if(a>0){for(;-1!==s;)i[s].index+=a,s=Aa(i,s);return}s=Aa(i,s)}}}(n,s,a.firstChild):a.insertBefore(s,a.firstChild),window.ShadyCSS.prepareTemplateStyles(r,e);const c=a.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==c)t.insertBefore(c.cloneNode(!0),t.firstChild);else if(n){a.insertBefore(s,a.firstChild);const e=new Set;e.add(s),Ea(n,e)}};window.JSCompiler_renameProperty=(e,t)=>e;const ic={toAttribute(e,t){switch(t){case Boolean:return e?"":null;case Object:case Array:return null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){switch(t){case Boolean:return null!==e;case Number:return null===e?null:Number(e);case Object:case Array:return JSON.parse(e)}return e}},oc=(e,t)=>t!==e&&(t==t||e==e),sc={attribute:!0,type:String,converter:ic,reflect:!1,hasChanged:oc};class ac extends HTMLElement{constructor(){super(),this._updateState=0,this._instanceProperties=void 0,this._updatePromise=new Promise(e=>this._enableUpdatingResolver=e),this._changedProperties=new Map,this._reflectingProperties=void 0,this.initialize()}static get observedAttributes(){this.finalize();const e=[];return this._classProperties.forEach((t,n)=>{const r=this._attributeNameForProperty(n,t);void 0!==r&&(this._attributeToPropertyMap.set(r,n),e.push(r))}),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const e=Object.getPrototypeOf(this)._classProperties;void 0!==e&&e.forEach((e,t)=>this._classProperties.set(t,e))}}static createProperty(e,t=sc){if(this._ensureClassProperties(),this._classProperties.set(e,t),t.noAccessor||this.prototype.hasOwnProperty(e))return;const n="symbol"==typeof e?Symbol():"__"+e,r=this.getPropertyDescriptor(e,n,t);void 0!==r&&Object.defineProperty(this.prototype,e,r)}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(n){const r=this[e];this[t]=n,this._requestUpdate(e,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||sc}static finalize(){const e=Object.getPrototypeOf(this);if(e.hasOwnProperty("finalized")||e.finalize(),this.finalized=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const e=this.properties,t=[...Object.getOwnPropertyNames(e),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]];for(
|
|||
|
/**
|
|||
|
@license
|
|||
|
Copyright (c) 2019 The Polymer Project Authors. All rights reserved.
|
|||
|
This code may only be used under the BSD style license found at
|
|||
|
http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
|
|||
|
http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
|
|||
|
found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
|
|||
|
part of the polymer project is also subject to an additional IP rights grant
|
|||
|
found at http://polymer.github.io/PATENTS.txt
|
|||
|
*/
|
|||
|
const cc="adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,lc=Symbol();class uc{constructor(e,t){if(t!==lc)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return void 0===this._styleSheet&&(cc?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}}const dc=(e,...t)=>{const n=t.reduce((t,n,r)=>t+(e=>{if(e instanceof uc)return e.cssText;if("number"==typeof e)return e;throw new Error(`Value passed to 'css' function must be a 'css' function result: ${e}. Use 'unsafeCSS' to pass non-literal values, but\n take care to ensure page security.`)})(n)+e[r+1],e[0]);return new uc(n,lc)};
|
|||
|
/**
|
|||
|
* @license
|
|||
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|||
|
* This code may only be used under the BSD style license found at
|
|||
|
* http://polymer.github.io/LICENSE.txt
|
|||
|
* The complete set of authors may be found at
|
|||
|
* http://polymer.github.io/AUTHORS.txt
|
|||
|
* The complete set of contributors may be found at
|
|||
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
|||
|
* Code distributed by Google as part of the polymer project is also
|
|||
|
* subject to an additional IP rights grant found at
|
|||
|
* http://polymer.github.io/PATENTS.txt
|
|||
|
*/
|
|||
|
(window.litElementVersions||(window.litElementVersions=[])).push("2.3.1");const hc={};class fc extends ac{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const e=this.getStyles();if(void 0===e)this._styles=[];else if(Array.isArray(e)){const t=(e,n)=>e.reduceRight((e,n)=>Array.isArray(n)?t(n,e):(e.add(n),e),n),n=t(e,new Set),r=[];n.forEach(e=>r.unshift(e)),this._styles=r}else this._styles=[e]}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow({mode:"open"})}adoptStyles(){const e=this.constructor._styles;0!==e.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?cc?this.renderRoot.adoptedStyleSheets=e.map(e=>e.styleSheet):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map(e=>e.cssText),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(e){const t=this.render();super.update(e),t!==hc&&this.constructor.render(t,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(e=>{const t=document.createElement("style");t.textContent=e.cssText,this.renderRoot.appendChild(t)}))}render(){return hc}}fc.finalized=!0,fc.render=(e,t,n)=>{if(!n||"object"!=typeof n||!n.scopeName)throw new Error("The `scopeName` option is required.");const r=n.scopeName,i=Ja.has(t),o=Za&&11===t.nodeType&&!!t.host,s=o&&!nc.has(r),a=s?document.createDocumentFragment():t;if(Qa(e,a,Object.assign({templateFactory:ec(r)},n)),s){const e=Ja.get(a);Ja.delete(a);const n=e.value instanceof Ia?e.value.template:void 0;rc(r,a,n),ga(t,t.firstChild),t.appendChild(a),Ja.set(t,e)}!i&&o&&window.ShadyCSS.styleElement(t.host)};class pc extends fc{constructor(){super(),Object.assign(this,mi)}createRenderRoot(){return this}disconnectedCallback(){super.disconnectedCallback(),this.stopListening()}}const gc=function(){this.handlers=[],this.checkUrl=this.checkUrl.bind(this),"undefined"!=typeof window&&(this.location=window.location,this.history=window.history)};gc.extend=Qr;const mc=/^[#\/]|\s+$/g,vc=/^\/+|\/+$/g,_c=/#.*$/;gc.started=!1,Object.assign(gc.prototype,mi,{interval:50,atRoot:function(){return this.location.pathname.replace(/[^\/]$/,"$&/")===this.root&&!this.getSearch()},matchRoot:function(){return this.decodeFragment(this.location.pathname).slice(0,this.root.length-1)+"/"===this.root},decodeFragment:function(e){return decodeURI(e.replace(/%25/g,"%2525"))},getSearch:function(){const e=this.location.href.replace(/#.*/,"").match(/\?.+/);return e?e[0]:""},getHash:function(e){const t=(e||this).location.href.match(/#(.*)$/);return t?t[1]:""},getPath:function(){const e=this.decodeFragment(this.location.pathname+this.getSearch()).slice(this.root.length-1);return"/"===e.charAt(0)?e.slice(1):e},getFragment:function(e){return null==e&&(e=this._usePushState||!this._wantsHashChange?this.getPath():this.getHash()),e.replace(mc,"")},start:function(e){if(gc.started)throw new Error("history has already been started");if(gc.started=!0,this.options=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(vc,"/"),this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){const e=this.root.slice(0,-1)||"/";return this.location.replace(e+"#"+this.getPath()),!0}this._hasPushState&&this.atRoot()&&this.
|
|||
|
/**
|
|||
|
* @module converse-core
|
|||
|
* @copyright The Converse.js contributors
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
*/
|
|||
|
Sn.a.extend(yn.a),kc.e.addNamespace("CARBONS","urn:xmpp:carbons:2"),kc.e.addNamespace("CHATSTATES","http://jabber.org/protocol/chatstates"),kc.e.addNamespace("CSI","urn:xmpp:csi:0"),kc.e.addNamespace("DELAY","urn:xmpp:delay"),kc.e.addNamespace("FASTEN","urn:xmpp:fasten:0"),kc.e.addNamespace("FORWARD","urn:xmpp:forward:0"),kc.e.addNamespace("HINTS","urn:xmpp:hints"),kc.e.addNamespace("HTTPUPLOAD","urn:xmpp:http:upload:0"),kc.e.addNamespace("IDLE","urn:xmpp:idle:1"),kc.e.addNamespace("MAM","urn:xmpp:mam:2"),kc.e.addNamespace("MODERATE","urn:xmpp:message-moderate:0"),kc.e.addNamespace("NICK","http://jabber.org/protocol/nick"),kc.e.addNamespace("OMEMO","eu.siacs.conversations.axolotl"),kc.e.addNamespace("OUTOFBAND","jabber:x:oob"),kc.e.addNamespace("PUBSUB","http://jabber.org/protocol/pubsub"),kc.e.addNamespace("REGISTER","jabber:iq:register"),kc.e.addNamespace("RETRACT","urn:xmpp:message-retract:0"),kc.e.addNamespace("ROSTERX","http://jabber.org/protocol/rosterx"),kc.e.addNamespace("RSM","http://jabber.org/protocol/rsm"),kc.e.addNamespace("SID","urn:xmpp:sid:0"),kc.e.addNamespace("SPOILER","urn:xmpp:spoiler:0"),kc.e.addNamespace("STANZAS","urn:ietf:params:xml:ns:xmpp-stanzas"),kc.e.addNamespace("VCARD","vcard-temp"),kc.e.addNamespace("VCARDUPDATE","vcard-temp:x:update"),kc.e.addNamespace("XFORM","jabber:x:data");class Pc extends Error{}const zc=["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"],Lc={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:[]},Fc={};Fc[kc.e.Status.ATTACHED]="ATTACHED",Fc[kc.e.Status.AUTHENTICATING]="AUTHENTICATING",Fc[kc.e.Status.AUTHFAIL]="AUTHFAIL",Fc[kc.e.Status.CONNECTED]="CONNECTED",Fc[kc.e.Status.CONNECTING]="CONNECTING",Fc[kc.e.Status.CONNFAIL]="CONNFAIL",Fc[kc.e.Status.DISCONNECTED]="DISCONNECTED",Fc[kc.e.Status.DISCONNECTING]="DISCONNECTING",Fc[kc.e.Status.ERROR]="ERROR",Fc[kc.e.Status.RECONNECTING]="RECONNECTING",Fc[kc.e.Status.REDIRECT]="REDIRECT";const Bc={initialize(){},__:(...e)=>Object(Dc.sprintf)(...e)},qc={log:Pn,CONNECTION_STATUS:Fc,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:{explicit
|
|||
|
/**
|
|||
|
* @module converse-chat
|
|||
|
* @copyright 2020, the Converse.js contributors
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
*/const{$msg:dl,Strophe:hl,sizzle:fl,utils:pl}=tl.env,gl=tl.env.utils;tl.plugins.add("converse-chat",{dependencies:["converse-chatboxes","converse-disco"],initialize(){const{__:e}=qc;Wc.settings.extend({allow_message_corrections:"all",allow_message_retraction:"all",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=gl.getResolveablePromise()},async setRosterContact(e){const t=await Wc.contacts.get(e);t&&(this.contact=t,this.set("nickname",t.get("nickname")),this.rosterContactAdded.resolve())}});qc.Message=t.extend({defaults:()=>({msgid:gl.getUniqueId(),time:(new Date).toISOString(),is_ephemeral:!1}),async initialize(){this.checkValidity()&&(this.initialized=gl.getResolveablePromise(),"chat"===this.get("type")&&(t.prototype.initialize.apply(this,arguments),this.setRosterContact(hl.getBareJidFromJid(this.get("from")))),this.get("file")&&this.on("change:put",this.uploadFile,this),this.setTimerForEphemeralMessage(),await Wc.trigger("messageInitialized",this,{Synchronous:!0}),this.initialized.resolve())},setTimerForEphemeralMessage(){const e=()=>{this.ephemeral_timer=window.setTimeout(this.safeDestroy.bind(this),1e4)};return this.isEphemeral()?(e(),!0):(this.on("change:is_ephemeral",()=>this.isEphemeral()?e():clearTimeout(this.ephemeral_timer)),!1)},checkValidity(){return 3!==Object.keys(this.attributes).length||(this.validationError="Empty message",this.safeDestroy(),!1)},mayBeRetracted(){return"me"===this.get("sender")&&["all","own"].includes(Wc.settings.get("allow_message_retraction"))},safeDestroy(){try{this.destroy()}catch(e){Pn.error(e)}},isEphemeral(){return this.get("is_ephemeral")},getDisplayName(){return"groupchat"===this.get("type")?this.get("nick"):this.contact?this.contact.getDisplayName():this.vcard?this.vcard.getDisplayName():this.get("from")},getMessageText(){return this.get("is_encrypted")?this.get("plaintext")||this.get("body")||e("Undecryptable OMEMO message"):this.get("message")},isMeCommand(){const e=this.getMessageText();return!!e&&e.startsWith("/me ")},sendSlotRequestStanza(){if(!this.file)return Promise.reject(new Error("file is undefined"));const e=tl.env.$iq({from:qc.jid,to:this.get("slot_request_url"),type:"get"}).c("request",{xmlns:hl.NS.HTTPUPLOAD,filename:this.file.name,size:this.file.size,"content-type":this.file.type});return Wc.sendIQ(e)},async getRequestSlotURL(){let t;try{t=await this.sendSlotRequestStanza()}catch(t){return Pn.error(t),this.save({type:"error",message:e("Sorry, could not determine upload URL."),is_ephemeral:!0})}const n=t.querySelector("slot");if(!n)return this.save({type:"error",message:e("Sorry, could not determine file upload URL."),is_ephemeral:!0});this.save({get:n.querySelector("get").getAttribute("url"),put:n.querySelector("put").getAttribute("url")})},uploadFile(){const t=new XMLHttpRequest;t.onreadystatechange=()=>{t.readyState===XMLHttpRequest.DONE&&(Pn.info("Status: "+t.status),200===t.status||201===t.status?this.save({upload:qc.SUCCESS,oob_url:this.get("get"),message:this.get("get")}):t.onerror())},t.upload.addEventListener("progress",e=>{e.lengthComputable&&this.set("progress",e.loaded/e.total)},!1),t.onerror=()=>{let n;n=t.responseText?e('Sorry, could not succesfully upload your file. Your server’s response: "%1$s"',t.responseText):e("Sorry, could not succesfully upload your file."),this.save({type:"error",upload:qc.FAILURE,message:n,is_ephemeral:!0})},t.open("PUT",this.get("put"),!0),t.setRequestHeader("Content-type",this.file.type),t.send(this.file)}}),qc.Messages=ta.extend({model:qc.Message,comparator:"time"}),qc.ChatBox=t.extend({messagesCollection:qc.Messages,defaults(){return{bookmarked:!1,chat_state:void 0,hidden:qc.isUniView()&&!Wc.settings.get("singleton"),message_type:"chat",nickname:void 0,num_unread:0,time_sent:new Date(0).toISOString(),time_opened:this.get("time_opened")||(new Date).getTime(),type:qc.PRIVATE_CHAT_TYPE,url:""}},async initialize(){this.initialized=gl.getResolveablePromise(),t.prototype.initialize.apply(this,ar
|
|||
|
/**
|
|||
|
* @module converse-disco
|
|||
|
* @copyright The Converse.js contributors
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
* @description Converse plugin which add support for XEP-0030: Service Discovery
|
|||
|
*/
|
|||
|
const{Strophe:ml,$iq:vl,utils:_l}=tl.env;tl.plugins.add("converse-disco",{initialize(){function e(){if(!qc.stream_features){const e=ml.getBareJidFromJid(qc.jid),t="converse.stream-features-".concat(e);Wc.promises.add("streamFeaturesAdded"),qc.stream_features=new ta,qc.stream_features.browserStorage=qc.createStore(t,"session")}}function t(){Wc.trigger("streamFeaturesAdded")}Wc.promises.add("discoInitialized"),Wc.promises.add("streamFeaturesAdded"),qc.DiscoEntity=Fo.extend({idAttribute:"jid",initialize(e,t){this.waitUntilFeaturesDiscovered=_l.getResolveablePromise(),this.dataforms=new ta;let n="converse.dataforms-".concat(this.get("jid"));this.dataforms.browserStorage=qc.createStore(n,"session"),this.features=new ta,n="converse.features-".concat(this.get("jid")),this.features.browserStorage=qc.createStore(n,"session"),this.listenTo(this.features,"add",this.onFeatureAdded),this.fields=new ta,n="converse.fields-".concat(this.get("jid")),this.fields.browserStorage=qc.createStore(n,"session"),this.listenTo(this.fields,"add",this.onFieldAdded),this.identities=new ta,n="converse.identities-".concat(this.get("jid")),this.identities.browserStorage=qc.createStore(n,"session"),this.fetchFeatures(t),this.items=new qc.DiscoEntities,n="converse.disco-items-".concat(this.get("jid")),this.items.browserStorage=qc.createStore(n,"session"),this.items.fetch()},async getIdentity(e,t){return await this.waitUntilFeaturesDiscovered,this.identities.findWhere({category:e,type:t})},async hasFeature(e){if(await this.waitUntilFeaturesDiscovered,this.features.findWhere({var:e}))return this},onFeatureAdded(e){e.entity=this,Wc.trigger("serviceDiscovered",e)},onFieldAdded(e){e.entity=this,Wc.trigger("discoExtensionFieldDiscovered",e)},async fetchFeatures(e){if(e.ignore_cache)this.queryInfo();else{const e=this.features.browserStorage.name,t=await this.features.browserStorage.store.getItem(e);t&&0===t.length||null===t?this.queryInfo():(this.features.fetch({add:!0,success:()=>{this.waitUntilFeaturesDiscovered.resolve(this),this.trigger("featuresDiscovered")}}),this.identities.fetch({add:!0}))}},async queryInfo(){let e;try{e=await Wc.disco.info(this.get("jid"),null)}catch(e){return null===e?Pn.error("Timeout for disco#info query for ".concat(this.get("jid"))):Pn.error(e),void this.waitUntilFeaturesDiscovered.resolve(this)}this.onInfo(e)},onDiscoItems(e){pr()('query[xmlns="'.concat(ml.NS.DISCO_ITEMS,'"] item'),e).forEach(e=>{if(e.getAttribute("node"))return;const t=e.getAttribute("jid");if(void 0===this.items.get(t)){const e=qc.disco_entities.get(t);e?this.items.add(e):this.items.create({jid:t})}})},async queryForItems(){if(0===this.identities.where({category:"server"}).length)return;const e=await Wc.disco.items(this.get("jid"));this.onDiscoItems(e)},onInfo(e){Array.from(e.querySelectorAll("identity")).forEach(e=>{this.identities.create({category:e.getAttribute("category"),type:e.getAttribute("type"),name:e.getAttribute("name")})}),pr()('x[type="result"][xmlns="'.concat(ml.NS.XFORM,'"]'),e).forEach(e=>{const t={};pr()("field",e).forEach(e=>{var n;t[e.getAttribute("var")]={value:null===(n=e.querySelector("value"))||void 0===n?void 0:n.textContent,type:e.getAttribute("type")}}),this.dataforms.create(t)}),e.querySelector('feature[var="'.concat(ml.NS.DISCO_ITEMS,'"]'))&&this.queryForItems(),Array.from(e.querySelectorAll("feature")).forEach(t=>{this.features.create({var:t.getAttribute("var"),from:e.getAttribute("from")})}),pr()('x[type="result"][xmlns="jabber:x:data"] field',e).forEach(t=>{var n;this.fields.create({var:t.getAttribute("var"),value:null===(n=t.querySelector("value"))||void 0===n?void 0:n.textContent,from:e.getAttribute("from")})}),this.waitUntilFeaturesDiscovered.resolve(this),this.trigger("featuresDiscovered")}}),qc.DiscoEntities=ta.extend({model:qc.DiscoEntity,fetchEntities(){return new Promise((e,t)=>{this.fetch({add:!0,success:e,error(e,n){Pn.error(n),t(new Error("Could not fetch disco entities"))}})})}});const n=this;function r(e){const t=e.getElementsByTagName("query")[0].getAttribute("node"),r={xmlns:ml.NS.DISCO_INFO};t&&(r.node=t);const i=v
|
|||
|
/**
|
|||
|
* @module converse-emoji
|
|||
|
* @copyright 2020, the Converse.js contributors
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
*/const jl=tl.env.utils;tl.emojis={initialized:!1,initialized_promise:jl.getResolveablePromise()};const Al={"*\\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 Cl(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 kl(){var e;return tl.emojis.toned||(tl.emojis.toned=(e=Object.values(tl.emojis.json.people).filter(e=>e.sn.includes("_tone")).map(e=>e.sn.replace(/_tone[1-5]/,"")),[...new Set(e)])),tl.emojis.toned}function Ol(e){return e.replace(bl,(e,t,n,r)=>{if(void 0===r||""===r||!(jl.unescapeHTML(r)in Al))return e;return r=jl.unescapeHTML(r),n+Cl(Al[r].toUpperCase())})}function Tl(e,t={unicode_only:!1,add_title_wrapper:!1}){const n=e.emoji,r=e.shortname;if(n){if(t.unicode_only)return n;if(Wc.settings.get("use_system_emojis"))return t.add_title_wrapper&&r?Ka(xl(),r,n):n;{const t=Wc.settings.get("emoji_image_path");return Ka(Sl(),r,n,t,e.cp)}}return t.unicode_only?r:Ka(wl(),r,r,tl.emojis.by_sn[r].url)}function Nl(e){if(!tl.emojis.initialized)throw new Error("getShortnameReferences called before emojis are initialized. To avoid this problem, first await the converse.emojis.initilaized_promise.");return[...e.matchAll(tl.emojis.shortnames_regex)].filter(e=>e[0].length>0).map(e=>{const t=tl.emojis.by_sn[e[0]].cp;return{cp:t,begin:e.index,end:e.index+e[0].length,shortname:e[0],emoji:t?Cl(t):null}})}function Il(e){const t=[];return function(e,t){const n=/\uFE0F/g,r=String.fromCharCode(8205);String(e).replace(yl,(e,i,o)=>{const s=function(e){const t=[];let n=0,r=0;for(;r<e.length;){const i=e.charCodeAt(r++);n?(t.push((65536+(n-55296<<10)+(i-56320)).toString(16)),n=0):55296<=i&&i<=56319?n=i:t.push(i.toString(16))}return t.join("-")}(e.indexOf(r)<0?e.replace(n,""):e);s&&t(s,e,o)})}(e,(e,n,r)=>{var i;t.push({begin:r,cp:e,emoji:n,end:r+n.length,shortname:(null===(i=jl.getEmojisByAtrribute("cp")[e])||void 0===i?void 0:i.sn)||""})}),t}tl.plugins.add("converse-emoji",{initialize(){const{___:e}=qc;Wc.settings.extend({emoji_image_path:"https://twemoji.maxcdn.com/v/12.1.6/",emoji_categories:{smileys:":grinning:",people:":thumbsup:",activity:":soccer:",travel:":motorcycle:",objects:":bomb:",nature:":rainb
|
|||
|
/**
|
|||
|
* @copyright The Converse.js contributors
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
* @description This is the MUC utilities module.
|
|||
|
*/
|
|||
|
const{Strophe:Fl,sizzle:Bl}=tl.env;var ql={computeAffiliationsDelta(e,t,n,r){const i=n.map(e=>e.jid),o=r.map(e=>e.jid);let s=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=>Bl('query[xmlns="'.concat(Fl.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");return r&&(t.nick=r),e.getAttribute("role")&&(t.role=r),t})};
|
|||
|
/**
|
|||
|
* @copyright 2020, the Converse.js contributors
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
* @description This is the form utilities module.
|
|||
|
*/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 Ul=Vo;function Hl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function $l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Hl(Object(n),!0).forEach((function(t){Wl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hl(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Wl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}
|
|||
|
/**
|
|||
|
* @copyright 2020, the Converse.js contributors
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
* @description Pure functions to help funcitonally parse messages.
|
|||
|
* @todo Other parsing helpers can be made more abstract and placed here.
|
|||
|
*/const Vl={mention_regex:/(?:\s|^)([@][\w_-]+(?:\.\w+)*)/gi,matchRegexInText:e=>t=>e.matchAll(t)},Gl=(e,t)=>e.replace(RegExp("\\"+t,"ig"),"\\"+t);Vl.escapeCharacters=e=>t=>e.split("").reduce(Gl,t),Vl.escapeRegexString=Vl.escapeCharacters("[\\^$.?*+(){}"),Vl.findFirstMatchInArray=e=>t=>{for(let n=0;n<e.length;n++)if(0===t.localeCompare(e[n],void 0,{sensitivity:"base"}))return e[n];return null};const Jl=([e,t],n,r)=>{let i=e,{begin:o,end:s}=n;const{value:a}=n;return o-=r,s=s-r-1,i="".concat(i.slice(0,o)).concat(a).concat(i.slice(s+1)),[i,[...t,$l($l({},n),{},{begin:o,end:s})]]};Vl.reduceTextFromReferences=(e,t)=>t.reduce(Jl,[e,[]]);var Ql=Vl;function Yl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Kl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}
|
|||
|
/**
|
|||
|
* @module converse-muc
|
|||
|
* @copyright The Converse.js contributors
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
* @description Implements the non-view logic for XEP-0045 Multi-User Chat
|
|||
|
*/const Xl=["moderator","participant","visitor"],Zl=["owner","admin","member","outcast","none"];tl.MUC_TRAFFIC_STATES=["entered","exited"],tl.MUC_ROLE_CHANGES=["op","deop","voice","mute"];const eu=["301","303","333","307","321","322"],tu={moderator:1,participant:2,visitor:3,none:2},{Strophe:nu,$iq:ru,$build:iu,$msg:ou,$pres:su,sizzle:au}=tl.env;nu.addNamespace("MUC_ADMIN",nu.NS.MUC+"#admin"),nu.addNamespace("MUC_OWNER",nu.NS.MUC+"#owner"),nu.addNamespace("MUC_REGISTER","jabber:iq:register"),nu.addNamespace("MUC_ROOMCONF",nu.NS.MUC+"#roomconfig"),nu.addNamespace("MUC_USER",nu.NS.MUC+"#user"),nu.addNamespace("MUC_HATS","xmpp:prosody.im/protocol/hats:1"),tl.MUC_NICK_CHANGED_CODE="303",tl.ROOM_FEATURES=["passwordprotected","unsecured","hidden","publicroom","membersonly","open","persistent","temporary","nonanonymous","semianonymous","moderated","unmoderated","mam_enabled"],tl.ROOMSTATUS={CONNECTED:0,CONNECTING:1,NICKNAME_REQUIRED:2,PASSWORD_REQUIRED:3,DISCONNECTED:4,ENTERED:5,DESTROYED:6},tl.plugins.add("converse-muc",{dependencies:["converse-chatboxes","converse-chat","converse-disco","converse-controlbox"],overrides:{ChatBoxes:{model(e,t){const{_converse:n}=this.__super__;return e&&e.type==n.CHATROOMS_TYPE?new n.ChatRoom(e,t):this.__super__.model.apply(this,arguments)}}},initialize(){const{__:e,___:t}=qc;if(Wc.settings.extend({allow_muc:!0,allow_muc_invitations:!0,auto_join_on_invite:!1,auto_join_rooms:[],auto_register_muc_nickname:!1,hide_muc_participants:!1,locked_muc_domain:!1,muc_domain:void 0,muc_fetch_members:!0,muc_history_max_stanzas:void 0,muc_instant_rooms:!0,muc_nickname_from_jid:!1,muc_send_probes:!1,muc_show_join_leave:!0,muc_show_logs_before_join:!1}),Wc.promises.add(["roomsAutoJoined"]),Wc.settings.get("locked_muc_domain")&&"string"!=typeof Wc.settings.get("muc_domain"))throw new Error("Config Error: it makes no sense to set locked_muc_domain to true when muc_domain is not set");qc.muc={info_messages:{100:e("This groupchat is not anonymous"),102:e("This groupchat now shows unavailable members"),103:e("This groupchat does not show unavailable members"),104:e("The groupchat configuration has changed"),170:e("Groupchat logging is now enabled"),171:e("Groupchat logging is now disabled"),172:e("This groupchat is now no longer anonymous"),173:e("This groupchat is now semi-anonymous"),174:e("This groupchat is now fully-anonymous"),201:e("A new groupchat has been created")},new_nickname_messages:{210:t("Your nickname has been automatically set to %1$s"),303:t("Your nickname has been changed to %1$s")},disconnect_messages:{301:e("You have been banned from this groupchat"),333:e("You have exited this groupchat due to a technical problem"),307:e("You have been kicked from this groupchat"),321:e("You have been removed from this groupchat because of an affiliation change"),322:e("You have been removed from this groupchat because the groupchat has changed to members-only and you're not a member"),332:e("You have been removed from this groupchat because the service hosting it is being shut down")}},qc.router.route("converse/room?jid=:jid",(async function(e){if(!Ul.isValidMUCJID(e))return Pn.warn('invalid jid "'.concat(e,'" provided in url fragment'));await Wc.waitUntil("roomsAutoJoined"),Wc.settings.get("allow_bookmarks")&&await Wc.waitUntil("bookmarksInitialized"),Wc.rooms.open(e)})),qc.getDefaultMUCNickname=function(){if(!qc.xmppstatus)throw new Error("Can't call _converse.getDefaultMUCNickname before the statusInitialized has been fired.");const e=qc.xmppstatus.getNickname();return e||(Wc.settings.get("muc_nickname_from_jid")?nu.unescapeNode(nu.getNodeFromJid(qc.bare_jid)):void 0)},qc.ChatRoomMessage=qc.Message.extend({initialize(){this.checkValidity()&&(this.get("file")&&this.on("change:put",this.uploadFile,this),this.setTimerForEphemeralMessage()||this.setOccupant(),Wc.trigger("chatRoomMessageInitialized",this))},mayBeModerated(){return["all","moderator"].includes(Wc.settings.get("allow_message_retraction"))&&this.collection.chatbox.canModerateMessages()},checkValidity(){const e=qc.Message.prototype.checkValidity.cal
|
|||
|
/**
|
|||
|
* @module converse-bookmarks
|
|||
|
* @description
|
|||
|
* Converse.js plugin which adds views for bookmarks specified in XEP-0048.
|
|||
|
* @copyright 2020, the Converse.js contributors
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
*/
|
|||
|
const{Strophe:cu,$iq:lu,sizzle:uu}=tl.env,du=tl.env.utils;function hu(e){return uu('event[xmlns="'.concat(cu.NS.PUBSUB,'#event"] items[node="').concat(cu.NS.BOOKMARKS,'"]'),e).length&&Wc.waitUntil("bookmarksInitialized").then(()=>qc.bookmarks.createBookmarksFromStanza(e)).catch(e=>Pn.fatal(e)),!0}cu.addNamespace("BOOKMARKS","storage:bookmarks"),tl.plugins.add("converse-bookmarks",{dependencies:["converse-chatboxes","converse-muc"],overrides:{ChatRoom:{getDisplayName(){const{_converse:e}=this.__super__;if(this.get("bookmarked")&&e.bookmarks){const t=e.bookmarks.findWhere({jid:this.get("jid")});if(t)return t.get("name")}return this.__super__.getDisplayName.apply(this,arguments)},getAndPersistNickname(e){const{_converse:t}=this.__super__;return e=e||t.getNicknameFromBookmark(this.get("jid")),this.__super__.getAndPersistNickname.call(this,e)}}},initialize(){const{__:e}=qc;Wc.settings.extend({allow_bookmarks:!0,allow_public_bookmarks:!1,muc_respect_autojoin:!0}),Wc.promises.add("bookmarksInitialized"),qc.getNicknameFromBookmark=function(e){if(!qc.bookmarks||!Wc.settings.get("allow_bookmarks"))return null;const t=qc.bookmarks.findWhere({jid:e});return t?t.get("nick"):void 0},qc.Bookmark=Fo.extend({idAttribute:"jid",getDisplayName(){return cu.xmlunescape(this.get("name"))}}),qc.Bookmarks=ta.extend({model:qc.Bookmark,comparator:e=>e.get("name").toLowerCase(),initialize(){this.on("add",e=>this.openBookmarkedRoom(e).then(e=>this.markRoomAsBookmarked(e)).catch(e=>Pn.fatal(e))),this.on("remove",this.markRoomAsUnbookmarked,this),this.on("remove",this.sendBookmarkStanza,this);const e="converse.room-bookmarks".concat(qc.bare_jid);this.fetched_flag=e+"fetched",this.browserStorage=qc.createStore(e)},async openBookmarkedRoom(e){if(Wc.settings.get("muc_respect_autojoin")&&e.get("autojoin")){(await Wc.rooms.create(e.get("jid"),{nick:e.get("nick")})).maybeShow()}return e},fetchBookmarks(){const e=du.getResolveablePromise();return window.sessionStorage.getItem(this.fetched_flag)?this.fetch({success:()=>e.resolve(),error:()=>e.resolve()}):this.fetchBookmarksFromServer(e),e},createBookmark(e){this.create(e),this.sendBookmarkStanza().catch(t=>this.onBookmarkError(t,e))},sendBookmarkStanza(){const e=lu({type:"set",from:qc.connection.jid}).c("pubsub",{xmlns:cu.NS.PUBSUB}).c("publish",{node:cu.NS.BOOKMARKS}).c("item",{id:"current"}).c("storage",{xmlns:cu.NS.BOOKMARKS});return this.forEach(t=>{e.c("conference",{name:t.get("name"),autojoin:t.get("autojoin"),jid:t.get("jid")}).c("nick").t(t.get("nick")).up().up()}),e.up().up().up(),e.c("publish-options").c("x",{xmlns:cu.NS.XFORM,type:"submit"}).c("field",{var:"FORM_TYPE",type:"hidden"}).c("value").t("http://jabber.org/protocol/pubsub#publish-options").up().up().c("field",{var:"pubsub#persist_items"}).c("value").t("true").up().up().c("field",{var:"pubsub#access_model"}).c("value").t("whitelist"),Wc.sendIQ(e)},onBookmarkError(t,n){Pn.error("Error while trying to add bookmark"),Pn.error(t),Wc.alert("error",e("Error"),[e("Sorry, something went wrong while trying to save your bookmark.")]),this.findWhere({jid:n.jid}).destroy()},fetchBookmarksFromServer(e){const t=lu({from:qc.connection.jid,type:"get"}).c("pubsub",{xmlns:cu.NS.PUBSUB}).c("items",{node:cu.NS.BOOKMARKS});Wc.sendIQ(t).then(t=>this.onBookmarksReceived(e,t)).catch(t=>this.onBookmarksReceivedError(e,t))},markRoomAsBookmarked(e){const t=qc.chatboxes.get(e.get("jid"));void 0!==t&&t.save("bookmarked",!0)},markRoomAsUnbookmarked(e){const t=qc.chatboxes.get(e.get("jid"));void 0!==t&&t.save("bookmarked",!1)},createBookmarksFromStanza(e){const t=cu.NS.BOOKMARKS,n='items[node="'.concat(t,'"] item storage[xmlns="').concat(t,'"] conference');uu(n,e).forEach(e=>{var t;const n=e.getAttribute("jid"),r=this.get(n),i={jid:n,name:e.getAttribute("name")||n,autojoin:"true"===e.getAttribute("autojoin"),nick:(null===(t=e.querySelector("nick"))||void 0===t?void 0:t.textContent)||""};r?r.save(i):this.create(i)})},onBookmarksReceived(e,t){if(this.createBookmarksFromStanza(t),window.sessionStorage.setItem(this.fetched_flag,!0),void 0!==e)return e.resolve()},onBookmarks
|
|||
|
/**
|
|||
|
* @module converse-bosh
|
|||
|
* @copyright The Converse.js contributors
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
* @description Converse.js plugin which add support for XEP-0206: XMPP Over BOSH
|
|||
|
*/const{Strophe:fu}=tl.env;tl.plugins.add("converse-bosh",{enabled:()=>!qc.api.settings.get("blacklisted_plugins").includes("converse-bosh"),initialize(){Wc.settings.extend({bosh_service_url:void 0,prebind_url:null}),qc.startNewPreboundBOSHSession=function(){if(!Wc.settings.get("prebind_url"))throw new Error("startNewPreboundBOSHSession: If you use prebind then you MUST supply a prebind_url");const e=new XMLHttpRequest;e.open("GET",Wc.settings.get("prebind_url"),!0),e.setRequestHeader("Accept","application/json, text/javascript"),e.onload=async function(){if(e.status>=200&&e.status<400){const t=JSON.parse(e.responseText),n=await qc.setUserJID(t.jid);qc.connection.attach(n,t.sid,t.rid,qc.connection.onConnectStatusChanged)}else e.onerror()},e.onerror=function(){delete qc.connection,Wc.trigger("noResumeableBOSHSession",qc)},e.send()},qc.restoreBOSHSession=async function(){const e=(await async function(){const e="converse.bosh-session";if(qc.bosh_session||(qc.bosh_session=new Fo({id:e}),qc.bosh_session.browserStorage=qc.createStore(e,"session"),await new Promise(e=>qc.bosh_session.fetch({success:e,error:e}))),qc.jid){if(qc.bosh_session.get("jid")!==qc.jid){const e=await qc.setUserJID(qc.jid);qc.bosh_session.clear({silent:!0}),qc.bosh_session.save({jid:e})}}else{const e=qc.bosh_session.get("jid");e&&await qc.setUserJID(e)}return qc.bosh_session}()).get("jid");if(e&&qc.connection._proto instanceof fu.Bosh)try{return qc.connection.restore(e,qc.connection.onConnectStatusChanged),!0}catch(t){return!qc.isTestEnv()&&Pn.warn("Could not restore session for jid: "+e+" Error message: "+t.message),!1}return!1},Wc.listen.on("clearSession",()=>{if(void 0===qc.bosh_session){const e="converse.bosh-session";sessionStorage.removeItem(e),sessionStorage.removeItem("".concat(e,"-").concat(e))}else qc.bosh_session.destroy(),delete qc.bosh_session}),Wc.listen.on("setUserJID",()=>{void 0!==qc.bosh_session&&qc.bosh_session.save({jid:qc.jid})}),Wc.listen.on("addClientFeatures",()=>Wc.disco.own.features.add(fu.NS.BOSH)),Object.assign(Wc,{tokens:{get:e=>void 0===qc.connection?null:"rid"===e.toLowerCase()?qc.connection.rid||qc.connection._proto.rid:"sid"===e.toLowerCase()?qc.connection.sid||qc.connection._proto.sid:void 0}})}});var pu=n(6);
|
|||
|
/**
|
|||
|
* @module converse-caps
|
|||
|
* @copyright 2020, the Converse.js contributors
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
*/const{Strophe:gu,$build:mu}=tl.env;function vu(e,t){return e.sort((e,n)=>e[t]>n[t]?-1:1)}function _u(e){const t=e.api.disco.own.identities.get(),n=e.api.disco.own.features.get();t.length>1&&(vu(t,"category"),vu(t,"type"),vu(t,"lang"));let r=t.reduce((e,t)=>{var n;return"".concat(e).concat(t.category,"/").concat(t.type,"/").concat(null!==(n=null==t?void 0:t.lang)&&void 0!==n?n:"","/").concat(t.name,"<")},"");return n.sort(),r=n.reduce((e,t)=>"".concat(e).concat(t,"<"),r),pu.a.b64_sha1(r)}
|
|||
|
/**
|
|||
|
* @module converse-carbons
|
|||
|
* @copyright The Converse.js contributors
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
* @description Implements support for XEP-0280 Message Carbons
|
|||
|
*/
|
|||
|
function bu(e){var t,n;e&&(null===(n=qc.session)||void 0===n||n.set({carbons_enabled:!1}));if(!Wc.settings.get("message_carbons")||(null===(t=qc.session)||void 0===t?void 0:t.get("carbons_enabled")))return;const r=new kc.e.Builder("iq",{from:qc.connection.jid,id:"enablecarbons",type:"set"}).c("enable",{xmlns:kc.e.NS.CARBONS});qc.connection.addHandler(e=>{e.querySelectorAll("error").length>0?Pn.warn("An error occurred while trying to enable message carbons."):(qc.session.set({carbons_enabled:!0}),Pn.debug("Message carbons have been enabled.")),qc.session.save()},null,"iq",null,"enablecarbons"),qc.connection.send(r)}gu.addNamespace("CAPS","http://jabber.org/protocol/caps"),tl.plugins.add("converse-caps",{overrides:{XMPPStatus:{constructPresence(){const e=this.__super__.constructPresence.apply(this,arguments);var t;return e.root().cnode((t=this.__super__._converse,mu("c",{xmlns:gu.NS.CAPS,hash:"sha-1",node:"https://conversejs.org",ver:_u(t)}).nodeTree)),e}}}}),tl.plugins.add("converse-carbons",{initialize(){Wc.settings.extend({message_carbons:!0}),Wc.listen.on("afterResourceBinding",bu)}});
|
|||
|
/**
|
|||
|
* @module converse-chatboxes
|
|||
|
* @copyright 2020, the Converse.js contributors
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
*/
|
|||
|
const{Strophe:yu}=tl.env;yu.addNamespace("MESSAGE_CORRECT","urn:xmpp:message-correct:0"),yu.addNamespace("RECEIPTS","urn:xmpp:receipts"),yu.addNamespace("REFERENCE","urn:xmpp:reference:0"),yu.addNamespace("MARKERS","urn:xmpp:chat-markers:0"),tl.plugins.add("converse-chatboxes",{dependencies:["converse-emoji","converse-roster","converse-vcard"],initialize(){async function e(e,t,n){let r;e=yu.getBareJidFromJid(e.toLowerCase()),Object.assign(t,{jid:e,id:e});try{r=new n(t,{collection:qc.chatboxes})}catch(e){return Pn.error(e),null}return await r.initialized,r.isValid()?(qc.chatboxes.add(r),r):(r.destroy(),null)}Wc.promises.add(["chatBoxesFetched","chatBoxesInitialized","privateChatsAutoJoined"]),qc.ChatBoxes=ta.extend({comparator:"time_opened",model:(e,t)=>new qc.ChatBox(e,t),onChatBoxesFetched(e){e.filter(e=>!e.isValid()).forEach(e=>e.destroy()),Wc.trigger("chatBoxesFetched")},onConnected(e){e||(this.browserStorage=qc.createStore("converse.chatboxes-".concat(qc.bare_jid)),this.fetch({add:!0,success:e=>this.onChatBoxesFetched(e)}))}}),Wc.listen.on("addClientFeatures",()=>{Wc.disco.own.features.add(yu.NS.MESSAGE_CORRECT),Wc.disco.own.features.add(yu.NS.HTTPUPLOAD),Wc.disco.own.features.add(yu.NS.OUTOFBAND)}),Wc.listen.on("pluginsInitialized",()=>{qc.chatboxes=new qc.ChatBoxes,Wc.trigger("chatBoxesInitialized")}),Wc.listen.on("presencesInitialized",e=>qc.chatboxes.onConnected(e)),Wc.listen.on("reconnected",()=>qc.chatboxes.forEach(e=>e.onReconnection())),Object.assign(Wc,{chatboxes:{create:async(t=[],n={},r)=>(await Wc.waitUntil("chatBoxesFetched"),"string"==typeof t?e(t,n,r):Promise.all(t.map(t=>e(t,n,r)))),get:async e=>(await Wc.waitUntil("chatBoxesFetched"),void 0===e?qc.chatboxes.models:"string"==typeof e?qc.chatboxes.get(e.toLowerCase()):(e=e.map(e=>e.toLowerCase()),qc.chatboxes.models.filter(t=>e.includes(t.get("jid")))))}})}}),tl.plugins.add("converse-headlines",{dependencies:["converse-chat"],overrides:{ChatBoxes:{model(e,t){const{_converse:n}=this.__super__;return e.type==n.HEADLINES_TYPE?new n.HeadlinesBox(e,t):this.__super__.model.apply(this,arguments)}}},initialize(){function e(){qc.connection.addHandler(e=>async function(e){if(hs.isHeadline(e)||hs.isServerMessage(e)){const t=e.getAttribute("from");if(t.includes("@")&&!qc.roster.get(t)&&!Wc.settings.get("allow_non_roster_messaging"))return;if(null===e.querySelector("body"))return;const n=qc.chatboxes.create({id:t,jid:t,type:qc.HEADLINES_TYPE,from:t}),r=await hs.parseMessage(e,qc);await n.createMessage(r),Wc.trigger("message",{chatbox:n,stanza:e,attrs:r})}}(e)||!0,null,"message")}qc.HeadlinesBox=qc.ChatBox.extend({defaults(){return{bookmarked:!1,hidden:["mobile","fullscreen"].includes(Wc.settings.get("view_mode")),message_type:"headline",num_unread:0,time_opened:this.get("time_opened")||(new Date).getTime(),type:qc.HEADLINES_TYPE}},async initialize(){this.set({box_id:"box-".concat(this.get("jid"))}),this.initMessages(),await this.fetchMessages(),Wc.trigger("headlinesBoxInitialized",this)}}),Wc.listen.on("connected",e),Wc.listen.on("reconnected",e),Object.assign(Wc,{headlines:{async get(e,t={},n=!1){async function r(e){let r=await Wc.chatboxes.get(e);return!r&&n?r=await Wc.chatboxes.create(e,t,qc.HeadlinesBox):(r=r&&r.get("type")===qc.HEADLINES_TYPE?r:null,r&&Object.keys(t).length&&r.save(t)),r}if(void 0===e){return(await Wc.chatboxes.get()).filter(e=>e.get("type")===qc.HEADLINES_TYPE)}return"string"==typeof e?r(e):Promise.all(e.map(e=>r(e)))}}})}});
|
|||
|
/**
|
|||
|
* @module converse-rsm
|
|||
|
* @copyright The Converse.js contributors
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
* @description XEP-0059 Result Set Management
|
|||
|
* Some code taken from the Strophe RSM plugin, licensed under the MIT License
|
|||
|
* Copyright 2006-2017 Strophe (https://github.com/strophe/strophejs)
|
|||
|
*/
|
|||
|
const{Strophe:wu,$build:Su}=tl.env;wu.addNamespace("RSM","http://jabber.org/protocol/rsm");const xu=["after","before","index","max"],Eu=e=>Number(e),ju=e=>e.toString(),Au={after:ju,before:ju,count:Eu,first:ju,index:Eu,last:ju,max:Eu},Cu=e=>void 0===e,ku=Object.keys(Au);class Ou{static getQueryParameters(e={}){return Lo(e,xu)}static parseXMLResult(e){const t={};for(var n=0;n<ku.length;n++){const r=ku[n],i=e.getElementsByTagName(r)[0];Cu(i)||null===i||(t[r]=Au[r](wu.getText(i)),"first"==r&&(t.index=Au.index(i.getAttribute("index"))))}return t}constructor(e={}){this.query=Ou.getQueryParameters(e),this.result=e.xml?Ou.parseXMLResult(e.xml):{}}toXML(){const e=Su("set",{xmlns:wu.NS.RSM});return xu.reduce((e,t)=>Cu(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 Ou(n)}previous(e,t){const n=Object.assign({},this.query,{after:t,before:this.result.first,max:e});return new Ou(n)}}function Tu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Nu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Tu(Object(n),!0).forEach((function(t){Iu(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Tu(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Iu(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}
|
|||
|
/**
|
|||
|
* @module converse-mam
|
|||
|
* @description XEP-0313 Message Archive Management
|
|||
|
* @copyright 2020, the Converse.js contributors
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
*/qc.RSM_ATTRIBUTES=ku,qc.RSM=Ou;const{Strophe:Mu,$iq:Ru,dayjs:Du}=tl.env,{NS:Pu}=Mu,zu=tl.env.utils,Lu={fetchNewestMessages(){if(this.disable_mam)return;const e=this.getMostRecentMessage();if(e&&!Wc.settings.get("clear_messages_on_reconnection")){const t=e.get("stanza_id ".concat(this.get("jid")));t?this.fetchArchivedMessages({after:t},"forwards"):this.fetchArchivedMessages({start:e.get("time")},"forwards")}else this.fetchArchivedMessages({before:""})},async handleMAMResult(e,t,n,r){await Wc.emojis.initialize();const i=this.get("type")===qc.CHATROOMS_TYPE;e.messages=e.messages.map(e=>i?hs.parseMUCMessage(e,this,qc):hs.parseMessage(e,qc));const o={query:t,chatbox:this,messages:e.messages};if(await Wc.trigger("MAMResult",o,{synchronous:!0}),e.messages.forEach(e=>this.queueMessage(e)),e.error){const t=e.error.retry_event_id=zu.getUniqueId();Wc.listen.once(t,()=>this.fetchArchivedMessages(n,r)),this.createMessageFromError(e.error)}},async fetchArchivedMessages(e={},t){if(this.disable_mam)return;const n=this.get("type")===qc.CHATROOMS_TYPE,r=n?this.get("jid"):qc.bare_jid;if(!await Wc.disco.supports(Pu.MAM,r))return;const i=Wc.settings.get("archived_messages_page_size"),o=Object.assign({groupchat:n,max:i,with:this.get("jid")},e),s=await Wc.archive.query(o);return await this.handleMAMResult(s,o,e,t),t&&s.rsm&&!s.complete?("forwards"===t?e=s.rsm.next(i,e.before).query:"backwards"===t&&(e=s.rsm.previous(i,e.after).query),this.fetchArchivedMessages(e,t)):void 0}};tl.plugins.add("converse-mam",{dependencies:["converse-disco","converse-muc"],initialize(){function e(e){Wc.settings.get("muc_show_logs_before_join")&&e.features.get("mam_enabled")&&!e.get("prejoin_mam_fetched")&&(e.fetchNewestMessages(),e.save({prejoin_mam_fetched:!0}))}Wc.settings.extend({archived_messages_page_size:"50",message_archiving:void 0,message_archiving_timeout:2e4}),Object.assign(qc.ChatBox.prototype,Lu),qc.onMAMError=function(e){(null==e?void 0:e.querySelectorAll("feature-not-implemented").length)?Pn.warn("Message Archive Management (XEP-0313) not supported by ".concat(e.getAttribute("from"))):(Pn.error("Error while trying to set archiving preferences for ".concat(e.getAttribute("from"),".")),Pn.error(e))},qc.onMAMPreferences=function(e,t){const n=pr()('prefs[xmlns="'.concat(Pu.MAM,'"]'),e).pop();if(n.getAttribute("default")!==Wc.settings.get("message_archiving")){const e=Ru({type:"set"}).c("prefs",{xmlns:Pu.MAM,default:Wc.settings.get("message_archiving")});Array.from(n.children).forEach(t=>e.cnode(t).up()),Wc.sendIQ(e).then(()=>t.save({preferences:{default:Wc.settings.get("message_archiving")}})).catch(qc.onMAMError)}else t.save({preferences:{default:Wc.settings.get("message_archiving")}})},Wc.listen.on("addClientFeatures",()=>Wc.disco.own.features.add(Pu.MAM)),Wc.listen.on("serviceDiscovered",(function(e){const t=e.get("preferences")||{};e.get("var")===Pu.MAM&&void 0!==Wc.settings.get("message_archiving")&&t.default!==Wc.settings.get("message_archiving")&&Wc.sendIQ(Ru({type:"get"}).c("prefs",{xmlns:Pu.MAM})).then(t=>qc.onMAMPreferences(t,e)).catch(qc.onMAMError)})),Wc.listen.on("chatRoomViewInitialized",t=>{Wc.settings.get("muc_show_logs_before_join")&&(e(t.model),t.model.features.on("change:mam_enabled",()=>e(t.model)))}),Wc.listen.on("enteredNewRoom",e=>e.features.get("mam_enabled")&&e.fetchNewestMessages()),Wc.listen.on("chatReconnected",e=>{e.get("type")===qc.PRIVATE_CHAT_TYPE&&e.fetchNewestMessages()}),Wc.listen.on("afterMessagesFetched",e=>{e.get("type")!==qc.PRIVATE_CHAT_TYPE||qc.connection.restored||e.fetchNewestMessages()}),Object.assign(Wc,{archive:{async query(e){if(!Wc.connection.connected())throw new Error("Can't call `api.archive.query` before having established an XMPP session");const t={type:"set"};if(e&&e.groupchat){if(!e.with)throw new Error('You need to specify a "with" value containing the chat room JID, when querying groupchat messages.');t.to=e.with}const n=t.to||qc.bare_jid;if(!await Wc.disco.supports(Pu.MAM,n))return Pn.warn("Did not fetch MAM archive for ".concat(n," because it doesn't support ").concat(Pu.MAM)),{messages:[]};c
|
|||
|
/**
|
|||
|
* @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:Fu,$iq:Bu}=tl.env,qu=tl.env.utils;Fu.addNamespace("PING","urn:xmpp:ping"),tl.plugins.add("converse-ping",{initialize(){let e;function t(t){e=new Date;const n=t.getAttribute("from"),r=t.getAttribute("id"),i=Bu({type:"result",to:n,id:r});return qc.connection.sendIQ(i),!0}Wc.settings.extend({ping_interval:60}),setTimeout(()=>{if(Wc.settings.get("ping_interval")>0){const t=new Date;return e||(e=t),!((t-e)/1e3>Wc.settings.get("ping_interval"))||Wc.ping()}},1e3);const n=function(){void 0!==qc.connection.disco&&Wc.disco.own.features.add(Fu.NS.PING),qc.connection.addHandler(t,Fu.NS.PING,"iq","get"),qc.connection.addHandler(()=>{if(Wc.settings.get("ping_interval")>0)return e=new Date,!0})};Wc.listen.on("connected",n),Wc.listen.on("reconnected",n),Wc.listen.on("windowStateChanged",(function(e){"visible"===e.state&&Wc.connection.connected()&&Wc.ping(null,5e3)})),Object.assign(Wc,{async ping(t,n){if(e=new Date,t=t||Fu.getDomainFromJid(qc.bare_jid),qc.connection){const e=Bu({type:"get",to:t,id:qu.getUniqueId("ping")}).c("ping",{xmlns:Fu.NS.PING}),r=await Wc.sendIQ(e,n||1e4,!1);return null===r?(Pn.warn("Timeout while pinging ".concat(t)),t===Fu.getDomainFromJid(qc.bare_jid)&&Wc.connection.reconnect()):qu.isErrorStanza(r)&&(Pn.error("Error while pinging ".concat(t)),Pn.error(r)),!0}return!1}})}});
|
|||
|
/**
|
|||
|
* @module converse-pubsub
|
|||
|
* @copyright The Converse.js contributors
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
*/
|
|||
|
const{Strophe:Uu,$iq:Hu}=tl.env;Uu.addNamespace("PUBSUB_ERROR",Uu.NS.PUBSUB+"#errors"),tl.plugins.add("converse-pubsub",{dependencies:["converse-disco"],initialize(){Object.assign(qc.api,{pubsub:{async publish(e,t,n,r,i=!0){const o=Hu({from:qc.bare_jid,type:"set",to:e}).c("pubsub",{xmlns:Uu.NS.PUBSUB}).c("publish",{node:t}).cnode(n.tree()).up().up();r&&(e=e||qc.bare_jid,await Wc.disco.supports(Uu.NS.PUBSUB+"#publish-options",e)?(o.c("publish-options").c("x",{xmlns:Uu.NS.XFORM,type:"submit"}).c("field",{var:"FORM_TYPE",type:"hidden"}).c("value").t("".concat(Uu.NS.PUBSUB,"#publish-options")).up().up(),Object.keys(r).forEach(e=>o.c("field",{var:e}).c("value").t(r[e]).up().up())):Pn.warn("_converse.api.publish: ".concat(e," does not support #publish-options, ")+"so we didn't set them even though they were provided."));try{await Wc.sendIQ(o)}catch(e){if(!(e instanceof Element&&i&&e.querySelector('precondition-not-met[xmlns="'.concat(Uu.NS.PUBSUB_ERROR,'"]'))))throw e;{const e=o.nodeTree;e.querySelector("publish-options").outerHTML="",Pn.warn("PubSub: Republishing without publish options. ".concat(e.outerHTML)),await Wc.sendIQ(e)}}}}})}});var $u=function(e){return"number"==typeof e||Ee(e)&&"[object Number]"==T(e)};var Wu=function(e){return $u(e)&&e!=+e};
|
|||
|
/**
|
|||
|
* @module converse-status
|
|||
|
* @copyright The Converse.js contributors
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
*/const{Strophe:Vu,$build:Gu,$pres:Ju}=tl.env;tl.plugins.add("converse-status",{initialize(){function e(e){Wc.trigger("statusInitialized",e)}function t(t){if(t=void 0!==qc.xmppstatus&&t)e(t);else{const n="converse.xmppstatus-".concat(qc.bare_jid);qc.xmppstatus=new qc.XMPPStatus({id:n}),qc.xmppstatus.browserStorage=qc.createStore(n,"session"),qc.xmppstatus.fetch({success:()=>e(t),error:()=>e(t),silent:!0})}}Wc.settings.extend({auto_away:0,auto_xa:0,csi_waiting_time:0,default_state:"online",priority:0}),Wc.promises.add(["statusInitialized"]),qc.XMPPStatus=Fo.extend({defaults:()=>({status:Wc.settings.get("default_state")}),initialize(){this.on("change",e=>{N(e.changed)&&("status"in e.changed||"status_message"in e.changed)&&Wc.user.presence.send(this.get("status"),null,this.get("status_message"))})},getNickname:()=>qc.nickname,getFullname:()=>"",constructPresence(e,t=null,n){let r;e="string"==typeof e?e:this.get("status")||Wc.settings.get("default_state"),n="string"==typeof n?n:this.get("status_message");const i={to:t};"unavailable"===e||"probe"===e||"error"===e||"unsubscribe"===e||"unsubscribed"===e||"subscribe"===e||"subscribed"===e?(i.type=e,r=Ju(i)):"offline"===e?(i.type="unavailable",r=Ju(i)):r="online"===e?Ju(i):Ju(i).c("show").t(e).up(),n&&r.c("status").t(n).up();const o=Wc.settings.get("priority");if(r.c("priority").t(Wu(Number(o))?0:o).up(),qc.idle){const e=new Date;e.setSeconds(e.getSeconds()-qc.idle_seconds),r.c("idle",{xmlns:Vu.NS.IDLE,since:e.toISOString()})}return r}}),qc.sendCSI=function(e){Wc.send(Gu(e,{xmlns:Vu.NS.CSI})),qc.inactive=e===qc.INACTIVE},qc.onUserActivity=function(){var e;qc.idle_seconds>0&&(qc.idle_seconds=0),(null===(e=qc.connection)||void 0===e?void 0:e.authenticated)&&(qc.inactive&&qc.sendCSI(qc.ACTIVE),qc.idle&&(qc.idle=!1,Wc.user.presence.send()),!0===qc.auto_changed_status&&(qc.auto_changed_status=!1,qc.xmppstatus.set("status",Wc.settings.get("default_state"))))},qc.onEverySecond=function(){var e;if(!(null===(e=qc.connection)||void 0===e?void 0:e.authenticated))return;const t=qc.xmppstatus.get("status");qc.idle_seconds++,Wc.settings.get("csi_waiting_time")>0&&qc.idle_seconds>Wc.settings.get("csi_waiting_time")&&!qc.inactive&&qc.sendCSI(qc.INACTIVE),Wc.settings.get("idle_presence_timeout")>0&&qc.idle_seconds>Wc.settings.get("idle_presence_timeout")&&!qc.idle&&(qc.idle=!0,Wc.user.presence.send()),Wc.settings.get("auto_away")>0&&qc.idle_seconds>Wc.settings.get("auto_away")&&"away"!==t&&"xa"!==t&&"dnd"!==t?(qc.auto_changed_status=!0,qc.xmppstatus.set("status","away")):Wc.settings.get("auto_xa")>0&&qc.idle_seconds>Wc.settings.get("auto_xa")&&"xa"!==t&&"dnd"!==t&&(qc.auto_changed_status=!0,qc.xmppstatus.set("status","xa"))},qc.registerIntervalHandler=function(){if(Wc.settings.get("auto_away")<1&&Wc.settings.get("auto_xa")<1&&Wc.settings.get("csi_waiting_time")<1&&Wc.settings.get("idle_presence_timeout")<1)return;qc.idle_seconds=0,qc.auto_changed_status=!1;const{unloadevent:e}=qc;window.addEventListener("click",qc.onUserActivity),window.addEventListener("focus",qc.onUserActivity),window.addEventListener("keypress",qc.onUserActivity),window.addEventListener("mousemove",qc.onUserActivity),window.addEventListener(e,qc.onUserActivity,{once:!0,passive:!0}),window.addEventListener(e,()=>{var e;return null===(e=qc.session)||void 0===e?void 0:e.save("active",!1)}),qc.everySecondTrigger=window.setInterval(qc.onEverySecond,1e3)},Wc.listen.on("presencesInitialized",e=>{e||qc.registerIntervalHandler()}),Wc.listen.on("clearSession",()=>{qc.shouldClearCache()&&qc.xmppstatus&&(qc.xmppstatus.destroy(),delete qc.xmppstatus,Wc.promises.add(["statusInitialized"]))}),Wc.listen.on("connected",()=>t(!1)),Wc.listen.on("reconnected",()=>t(!0)),Object.assign(qc.api.user,{presence:{async send(e,t,n){await Wc.waitUntil("statusInitialized"),Wc.send(qc.xmppstatus.constructPresence(e,t,n))}},status:{get:async()=>(await Wc.waitUntil("statusInitialized"),qc.xmppstatus.get("status")),async set(e,t){const n={status:e};if(!Object.keys(qc.STATUS_WEIGHTS).includes(e))throw new Error("Invalid availability value. See https://xmpp.or
|
|||
|
/**
|
|||
|
* @module converse-roster
|
|||
|
* @copyright The Converse.js contributors
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
*/const{Strophe:Xu,$iq:Zu,$pres:ed,dayjs:td,sizzle:nd}=tl.env,rd=tl.env.utils;tl.plugins.add("converse-roster",{dependencies:["converse-status"],initialize(){const{__:e}=qc;Wc.settings.extend({allow_contact_requests:!0,auto_subscribe:!1,synchronize_availability:!0}),Wc.promises.add(["cachedRoster","roster","rosterContactsFetched","rosterGroupsFetched","rosterInitialized"]),qc.HEADER_CURRENT_CONTACTS=e("My contacts"),qc.HEADER_PENDING_CONTACTS=e("Pending contacts"),qc.HEADER_REQUESTING_CONTACTS=e("Contact requests"),qc.HEADER_UNGROUPED=e("Ungrouped"),qc.HEADER_UNREAD=e("New messages");const t={};t[qc.HEADER_UNREAD]=0,t[qc.HEADER_REQUESTING_CONTACTS]=1,t[qc.HEADER_CURRENT_CONTACTS]=2,t[qc.HEADER_UNGROUPED]=3,t[qc.HEADER_PENDING_CONTACTS]=4,qc.registerPresenceHandler=function(){qc.unregisterPresenceHandler(),qc.presence_ref=qc.connection.addHandler(e=>(qc.roster.presenceHandler(e),!0),null,"presence",null)},qc.rejectPresenceSubscription=function(e,t){const n=ed({to:e,type:"unsubscribed"});t&&""!==t&&n.c("status").t(t),Wc.send(n)},qc.sendInitialPresence=function(){qc.send_initial_presence&&Wc.user.presence.send()},qc.populateRoster=async function(e=!1){e&&(qc.send_initial_presence=!0);try{await qc.rostergroups.fetchRosterGroups(),Wc.trigger("rosterGroupsFetched"),await qc.roster.fetchRosterContacts(),Wc.trigger("rosterContactsFetched")}catch(e){Pn.error(e)}finally{qc.sendInitialPresence()}};const n=Fo.extend({idAttribute:"name"}),r=ta.extend({model:n});function i(e){const t=qc.roster&&qc.roster.findWhere({jid:e.get("jid")});void 0!==t&&t.save({num_unread:e.get("num_unread")})}async function o(){qc.presences&&await qc.presences.clearStore()}qc.Presence=Fo.extend({defaults:{show:"offline"},initialize(){this.resources=new r;const e="converse.identities-".concat(this.get("jid"));this.resources.browserStorage=qc.createStore(e,"session"),this.listenTo(this.resources,"update",this.onResourcesChanged),this.listenTo(this.resources,"change",this.onResourcesChanged)},onResourcesChanged(){var e;const t=this.getHighestPriorityResource(),n=(null==t||null===(e=t.attributes)||void 0===e?void 0:e.show)||"offline";this.get("show")!==n&&this.save({show:n})},getHighestPriorityResource(){return this.resources.sortBy(e=>"".concat(e.get("priority"),"-").concat(e.get("timestamp"))).reverse()[0]},addResource(e){const t=e.getAttribute("from"),n=Xu.getResourceFromJid(t),r=nd('delay[xmlns="'.concat(Xu.NS.DELAY,'"]'),e).pop(),i=Qu(e.querySelector("priority"))("textContent")||0,o=this.resources.get(n),s={name:n,priority:Wu(parseInt(i,10))?0:parseInt(i,10),show:Qu(e.querySelector("show"))("textContent")||"online",timestamp:r?td(r.getAttribute("stamp")).toISOString():(new Date).toISOString()};o?o.save(s):this.resources.create(s)},removeResource(e){const t=this.resources.get(e);t&&t.destroy()}}),qc.Presences=ta.extend({model:qc.Presence}),qc.RosterContact=Fo.extend({defaults:{chat_state:void 0,image:qc.DEFAULT_IMAGE,image_type:qc.DEFAULT_IMAGE_TYPE,num_unread:0,status:void 0},async initialize(e){this.initialized=rd.getResolveablePromise(),this.setPresence();const{jid:t}=e,n=Xu.getBareJidFromJid(t).toLowerCase();e.jid=n,this.set(Object.assign({groups:[],id:n,jid:n,user_id:Xu.getNodeFromJid(t)},e)),this.listenTo(this.presence,"change:show",()=>Wc.trigger("contactPresenceChanged",this)),this.listenTo(this.presence,"change:show",()=>this.trigger("presenceChanged")),await Wc.trigger("rosterContactInitialized",this,{Synchronous:!0}),this.initialized.resolve()},setPresence(){const e=this.get("jid");this.presence=qc.presences.findWhere({jid:e})||qc.presences.create({jid:e})},openChat(){const e=this.attributes;Wc.chats.open(e.jid,e,!0)},getFilterCriteria(){const e=this.get("nickname"),t=this.get("jid");let n=this.getDisplayName();return n=n.includes(t)?n:n.concat(" ".concat(t)),n=n.includes(e)?n:n.concat(" ".concat(e)),n.toLowerCase()},getDisplayName(){return this.get("nickname")?this.get("nickname"):this.get("jid")},getFullname(){return this.get("jid")},subscribe(e){const t=ed({to:this.get("jid"),type:"subscribe"});e&&""!==e&&t.c("status").t(e).up();const n=q
|
|||
|
/**
|
|||
|
* @module converse-smacks
|
|||
|
* @copyright The Converse.js contributors
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
* @description Converse.js plugin which adds support for XEP-0198: Stream Management
|
|||
|
*/
|
|||
|
const{Strophe:id}=tl.env,od=tl.env.utils;function sd(){return!(Wc.connection.isType("bosh")&&!qc.isTestEnv())&&Wc.disco.stream.getFeature("sm",id.NS.SM)}function ad(e){if(!qc.session.get("smacks_enabled"))return!0;const t=parseInt(e.getAttribute("h"),10),n=qc.session.get("num_stanzas_handled_by_server"),r=t-n;if(r<0){const e="New reported stanza count lower than previous. "+"New: ".concat(t," - Previous: ").concat(n);Pn.error(e)}const i=qc.session.get("unacked_stanzas");if(r>i.length){const e="Higher reported acknowledge count than unacknowledged stanzas. "+"Reported Acknowledged Count: ".concat(r," -")+"Unacknowledged Stanza Count: ".concat(i.length," -")+"New: ".concat(t," - Previous: ").concat(n);Pn.error(e)}return qc.session.save({num_stanzas_handled_by_server:t,num_stanzas_since_last_ack:0,unacked_stanzas:i.slice(r)}),!0}function cd(){if(qc.session.get("smacks_enabled")){const e=qc.session.get("num_stanzas_handled"),t=od.toStanza('<a xmlns="'.concat(id.NS.SM,'" h="').concat(e,'"/>'));Wc.send(t)}return!0}function ld(e){if(qc.session.get("smacks_enabled")&&(od.isTagEqual(e,"iq")||od.isTagEqual(e,"presence")||od.isTagEqual(e,"message"))){const e=qc.session.get("num_stanzas_handled");qc.session.save("num_stanzas_handled",e+1)}return!0}function ud(){qc.session.save({smacks_enabled:qc.session.get("smacks_enabled")||!1,num_stanzas_handled:qc.session.get("num_stanzas_handled")||0,num_stanzas_handled_by_server:qc.session.get("num_stanzas_handled_by_server")||0,num_stanzas_since_last_ack:qc.session.get("num_stanzas_since_last_ack")||0,unacked_stanzas:qc.session.get("unacked_stanzas")||[]})}function dd(){qc.session&&qc.session.save({smacks_enabled:!1,num_stanzas_handled:0,num_stanzas_handled_by_server:0,num_stanzas_since_last_ack:0,unacked_stanzas:[]})}function hd(e){const t={smacks_enabled:!0};return["1","true"].includes(e.getAttribute("resume"))&&(t.smacks_stream_id=e.getAttribute("id")),qc.session.save(t),!0}function fd(e){return e.querySelector("item-not-found")?Pn.warn("Could not resume previous SMACKS session, session id not found. A new session will be established."):(Pn.error("Failed to enable stream management"),Pn.error(e.outerHTML)),dd(),Wc.trigger("streamResumptionFailed"),!0}function pd(e){hd(e),ad(e),function(){const e=qc.session.get("unacked_stanzas");qc.session.save("unacked_stanzas",[]),e.forEach(e=>Wc.send(e))}(),qc.connection.do_bind=!1,qc.connection.authenticated=!0,qc.connection.restored=!0,qc.connection._changeConnectStatus(id.Status.CONNECTED,null)}async function gd(){if(Wc.settings.get("enable_smacks")&&!qc.session.get("smacks_enabled")&&await sd()){const e=od.getResolveablePromise();qc.connection._addSysHandler(t=>e.resolve(hd(t)),id.NS.SM,"enabled"),qc.connection._addSysHandler(t=>e.resolve(fd(t)),id.NS.SM,"failed");const t=Wc.connection.isType("websocket")||qc.isTestEnv(),n=od.toStanza('<enable xmlns="'.concat(id.NS.SM,'" resume="').concat(t,'"/>'));Wc.send(n),qc.connection.flush(),await e}}id.addNamespace("SM","urn:xmpp:sm:3");const md=[];async function vd(){if(!Wc.settings.get("enable_smacks"))return;if(!await sd())return;const e=qc.connection;for(;md.length;)e.deleteHandler(md.pop());md.push(e.addHandler(ld)),md.push(e.addHandler(cd,id.NS.SM,"r")),md.push(e.addHandler(ad,id.NS.SM,"a")),qc.session.get("smacks_stream_id")?await async function(){const e=od.getResolveablePromise();qc.connection._addSysHandler(t=>e.resolve(pd(t)),id.NS.SM,"resumed"),qc.connection._addSysHandler(t=>e.resolve(fd(t)),id.NS.SM,"failed");const t=qc.session.get("smacks_stream_id"),n=qc.session.get("num_stanzas_handled"),r=od.toStanza('<resume xmlns="'.concat(id.NS.SM,'" h="').concat(n,'" previd="').concat(t,'"/>'));Wc.send(r),qc.connection.flush(),await e}():dd()}function _d(e){if(qc.session){if(qc.session.get("smacks_enabled")&&(od.isTagEqual(e,"iq")||od.isTagEqual(e,"presence")||od.isTagEqual(e,"message"))){const t=id.serialize(e);qc.session.save("unacked_stanzas",(qc.session.get("unacked_stanzas")||[]).concat([t]));const n=Wc.settings.get("smacks_max_unacked_stanzas");if(n>0){const e=qc.session.get("num_stanzas_since_las
|
|||
|
/**
|
|||
|
* @module converse-vcard
|
|||
|
* @copyright The Converse.js contributors
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
*/
|
|||
|
const{Strophe:bd,$iq:yd,dayjs:wd}=tl.env,Sd=tl.env.utils;tl.plugins.add("converse-vcard",{dependencies:["converse-status","converse-roster"],overrides:{XMPPStatus:{getNickname(){const{_converse:e}=this.__super__,t=this.__super__.getNickname.apply(this);return!t&&e.xmppstatus.vcard?e.xmppstatus.vcard.get("nickname"):t},getFullname(){const{_converse:e}=this.__super__,t=this.__super__.getFullname.apply(this);return!t&&e.xmppstatus.vcard?e.xmppstatus.vcard.get("fullname"):t}},RosterContact:{getDisplayName(){return!this.get("nickname")&&this.vcard?this.vcard.getDisplayName():this.__super__.getDisplayName.apply(this)},getFullname(){return this.vcard?this.vcard.get("fullname"):this.__super__.getFullname.apply(this)}}},initialize(){function e(e,t,n){const r=yd(t?{type:e,to:t}:{type:e});return n?r.cnode(n):r.c("vCard",{xmlns:bd.NS.VCARD}),r}async function t(t,n){const r=bd.getBareJidFromJid(n)===t.bare_jid?null:n;let i;try{i=await Wc.sendIQ(e("get",r))}catch(i){return{stanza:i,jid:n,vcard_error:(new Date).toISOString()}}return async function(e,t){const n=t.querySelector("vCard");let r={};var i,o,s,a,c,l,u;if(null!==n&&(r={stanza:t,fullname:null===(i=n.querySelector("FN"))||void 0===i?void 0:i.textContent,nickname:null===(o=n.querySelector("NICKNAME"))||void 0===o?void 0:o.textContent,image:null===(s=n.querySelector("PHOTO BINVAL"))||void 0===s?void 0:s.textContent,image_type:null===(a=n.querySelector("PHOTO TYPE"))||void 0===a?void 0:a.textContent,url:null===(c=n.querySelector("URL"))||void 0===c?void 0:c.textContent,role:null===(l=n.querySelector("ROLE"))||void 0===l?void 0:l.textContent,email:null===(u=n.querySelector("EMAIL USERID"))||void 0===u?void 0:u.textContent,vcard_updated:(new Date).toISOString(),vcard_error:void 0}),r.image){const e=Sd.base64ToArrayBuffer(r.image),t=await crypto.subtle.digest("SHA-1",e);r.image_hash=Sd.arrayBufferToHex(t)}return r}(0,i)}async function n(e){let t;if(e instanceof qc.Message){if("error"===e.get("type"))return;t=e.get("from")}else t=e.get("jid");await Wc.waitUntil("VCardsInitialized"),e.vcard=qc.vcards.findWhere({jid:t}),e.vcard||(e.vcard=qc.vcards.create({jid:t})),e.vcard.on("change",()=>e.trigger("vcard:change"))}async function r(e){await Wc.waitUntil("VCardsInitialized"),["error","info"].includes(e.get("type"))||(e.vcard=function(e){var t;const n=null==e||null===(t=e.collection)||void 0===t?void 0:t.chatbox,r=bd.getResourceFromJid(e.get("from"));if(n&&n.get("nick")===r)return qc.xmppstatus.vcard;{const t=e.occupant&&e.occupant.get("jid")||e.get("from");return t?qc.vcards.findWhere({jid:t})||qc.vcards.create({jid:t}):void Pn.error("Could not assign VCard for message because no JID found! msgid: ".concat(e.get("msgid")))}}(e))}Wc.promises.add("VCardsInitialized"),qc.VCard=Fo.extend({defaults:{image:qc.DEFAULT_IMAGE,image_type:qc.DEFAULT_IMAGE_TYPE},set(e,t,n){let r;return"object"==typeof e?(r=e,n=t):(r={})[e]=t,"image"in r&&!r.image?(r.image=qc.DEFAULT_IMAGE,r.image_type=qc.DEFAULT_IMAGE_TYPE,Fo.prototype.set.call(this,r,n)):Fo.prototype.set.apply(this,arguments)},getDisplayName(){return this.get("nickname")||this.get("fullname")||this.get("jid")}}),qc.VCards=ta.extend({model:qc.VCard,initialize(){this.on("add",e=>e.get("jid")&&Wc.vcard.update(e))}}),qc.initVCardCollection=async function(){qc.vcards=new qc.VCards,qc.vcards.browserStorage=qc.createStore("".concat(qc.bare_jid,"-converse.vcards")),await new Promise(e=>{qc.vcards.fetch({success:e,error:e},{silent:!0})});const e=qc.vcards;if(qc.session){const t=qc.session.get("bare_jid");qc.xmppstatus.vcard=e.findWhere({jid:t})||e.create({jid:t})}Wc.trigger("VCardsInitialized")},Wc.listen.on("chatBoxInitialized",e=>n(e)),Wc.listen.on("chatRoomInitialized",e=>n(e)),Wc.listen.on("chatRoomMessageInitialized",e=>r(e)),Wc.listen.on("addClientFeatures",()=>Wc.disco.own.features.add(bd.NS.VCARD)),Wc.listen.on("clearSession",()=>{qc.shouldClearCache()&&(Wc.promises.add("VCardsInitialized"),qc.vcards&&(qc.vcards.clearStore(),delete qc.vcards))}),Wc.listen.on("messageInitialized",e=>n(e)),Wc.listen.on("rosterContactInitialized",e=>n(e)),Wc.listen.on("
|
|||
|
/**
|
|||
|
* @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=Cd(window.navigator.userLanguage,e)),window.navigator.languages&&!t)for(n=0;n<window.navigator.languages.length&&!t;n++)t=Cd(window.navigator.languages[n],e);return window.navigator.browserLanguage&&!t&&(t=Cd(window.navigator.browserLanguage,e)),window.navigator.language&&!t&&(t=Cd(window.navigator.language,e)),window.navigator.systemLanguage&&!t&&(t=Cd(window.navigator.systemLanguage,e)),t||"en"}(t)||"en":e}function Cd(e,t){if(t(e))return e;var n=e.split("-")[0];return n!==e&&t(n)?n:void 0}let kd;Object.assign(Bc,{getLocale:(e,t)=>Ad(e,e=>jd(e,t)),translate(e){if(!kd)return Ed.a.sprintf.apply(Ed.a,arguments);const t=kd.translate(e);return arguments.length>1?t.fetch.apply(t,[].slice.call(arguments,1)):t.fetch()},async initialize(){if(qc.isTestEnv())qc.locale="en";else try{qc.locale=Bc.getLocale(Wc.settings.get("i18n"),Wc.settings.get("locales")),await async function(e){const{api:t,locale:r}=e,i=r.toLowerCase().replace("_","-");if(!jd(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(Ad(i,e=>Sn.a.locale(e))),kd=new Ed.a(o)}(qc)}catch(e){Pn.fatal(e.message),qc.locale="en"}},__:(...e)=>Bc.translate(...e)});const Od=Bc.__,Td={};Wc.elements={registry:Td,define:function(e,t){this.registry[e]=t},register:function(){Object.keys(Td).forEach(e=>{customElements.get(e)||customElements.define(e,Td[e])})}};
|
|||
|
/**
|
|||
|
* @module converse-autocomplete
|
|||
|
* @copyright Lea Verou and the Converse.js contributors
|
|||
|
* @description
|
|||
|
* Converse.js plugin which started as a fork of Lea Verou's Awesomplete
|
|||
|
* https://leaverou.github.io/awesomplete/
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
*/
|
|||
|
const Nd=tl.env.utils,Id=function(e,t){return RegExp(Pd.regExpEscape(t.trim()),"i").test(e)},Md=function(e,t){return RegExp("^"+Pd.regExpEscape(t.trim()),"i").test(e)},Rd=function(e,t){const n=e.query.toLowerCase(),r=e.label.toLowerCase().indexOf(n),i=t.label.toLowerCase().indexOf(n);return r===i?function(e,t){return e.length!==t.length?e.length-t.length:e<t?-1:1}(e,t):(-1===r?1/0:r)<(-1===i?1/0:i)?-1:1},Dd=(e,t)=>{t=t.trim();const n=document.createElement("li");n.setAttribute("aria-selected","false");const r=new RegExp("("+t+")","ig");return(t?e.split(r):[e]).forEach(e=>{if(t&&e.match(r)){const t=document.createElement("mark");t.textContent=e,n.appendChild(t)}else n.appendChild(document.createTextNode(e))}),n},Pd={getElement:(e,t)=>"string"==typeof e?(t||document).querySelector(e):e||null,bind(e,t){if(e)for(var n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const r=t[n];n.split(/\s+/).forEach(t=>e.addEventListener(t,r))}},unbind(e,t){if(e)for(var n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const r=t[n];n.split(/\s+/).forEach(t=>e.removeEventListener(t,r))}},regExpEscape:e=>e.replace(/[-\\^$*+?.()|[\]{}]/g,"\\$&")};class zd 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 Ld{constructor(e,t={}){this.is_opened=!1,Nd.hasClass("suggestion-box",e)?this.container=e:this.container=e.querySelector(".suggestion-box"),this.input=this.container.querySelector(".suggestion-box__input"),this.input.setAttribute("aria-autocomplete","list"),this.ul=this.container.querySelector(".suggestion-box__results"),this.status=this.container.querySelector(".suggestion-box__additions"),Object.assign(this,{match_current_word:!1,ac_triggers:[],include_triggers:[],min_chars:2,max_items:10,auto_evaluate:!0,auto_first:!1,data:e=>e,filter:Id,sort:!1!==t.sort&&Rd,item:Dd},t),this.index=-1,this.bindEvents(),this.input.hasAttribute("list")?(this.list="#"+this.input.getAttribute("list"),this.input.removeAttribute("list")):this.list=this.input.getAttribute("data-list")||t.list||[]}bindEvents(){const e={blur:()=>this.close({reason:"blur"})};this.auto_evaluate&&(e.input=()=>this.evaluate()),this._events={input:e,form:{submit:()=>this.close({reason:"submit"})},ul:{mousedown:e=>this.onMouseDown(e),mouseover:e=>this.onMouseOver(e)}},Pd.bind(this.input,this._events.input),Pd.bind(this.input.form,this._events.form),Pd.bind(this.ul,this._events.ul)}set list(e){if(Array.isArray(e)||"function"==typeof e)this._list=e;else if("string"==typeof e&&e.includes(","))this._list=e.split(/\s*,\s*/);else{var t;const n=(null===(t=Pd.getElement(e))||void 0===t?void 0:t.children)||[];this._list=Array.from(n).filter(e=>!e.disabled).map(e=>{const t=e.textContent.trim(),n=e.value||t,r=e.label||t;return""!==n?{label:r,value:n}:null}).filter(e=>e)}document.activeElement===this.input&&this.evaluate()}get list(){return this._list}get selected(){return this.index>-1}get opened(){return this.is_opened}close(e){this.opened&&(this.ul.setAttribute("hidden",""),this.is_opened=!1,this.index=-1,this.trigger("suggestion-box-close",e||{}))}insertValue(e){this.match_current_word?Nd.replaceCurrentWord(this.input,e.value):this.input.value=e.value}open(){this.ul.removeAttribute("hidden"),this.is_opened=!0,this.auto_first&&-1===this.index&&this.goto(0),this.trigger("suggestion-box-open")}destroy(){Pd.unbind(this.input,this._events.input),Pd.unbind(this.input.form,this._events.form),this.input.removeAttribute("aria-autocomplete")}next(){const e=this.ul.children.length;this.goto(this.index<e-1?this.index+1:e?0:-1)}previous(){const e=this.ul.children.length,t=this.index-1;this.goto(this.selected&&-1!==t?t:e-1)}goto(e){const t=this.ul.children;this.selected&&t[this.index].setAttribute("aria-selected","false"),this.index=e,e>-1&&t.length>0&&(t[e].setAttribute("aria-selected","true"),t[e].focus(),this.statu
|
|||
|
/**
|
|||
|
* @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:Qd}=tl.env,Yd=tl.env.utils;tl.plugins.add("converse-bookmark-views",{dependencies:["converse-chatboxes","converse-muc","converse-muc-views"],initialize(){Wc.settings.extend({hide_open_bookmarks:!0}),Object.assign(qc,{removeBookmarkViaEvent(e){e.preventDefault();const t=e.target.getAttribute("data-bookmark-name"),n=e.target.getAttribute("data-room-jid");confirm(Od('Are you sure you want to remove the bookmark "%1$s"?',t))&&Jd(qc.bookmarks.where({jid:n}),Fo.prototype.destroy)},addBookmarkViaEvent(e){e.preventDefault();const t=e.target.getAttribute("data-room-jid");Wc.rooms.open(t,{bring_to_foreground:!0}),qc.chatboxviews.get(t).renderBookmarkForm()}});const e={setBookmarkState(){if(void 0!==qc.bookmarks){qc.bookmarks.where({jid:this.model.get("jid")}).length?this.model.save("bookmarked",!0):this.model.save("bookmarked",!1)}},renderBookmarkForm(){if(this.hideChatRoomContents(),!this.bookmark_form){this.bookmark_form=new qc.MUCBookmarkForm({model:this.model,chatroomview:this}),this.el.querySelector(".chatroom-body").insertAdjacentElement("beforeend",this.bookmark_form.el)}Yd.showElement(this.bookmark_form.el)},toggleBookmark(e){null==e||e.preventDefault();const t=qc.bookmarks.where({jid:this.model.get("jid")});t.length?t.forEach(e=>e.destroy()):this.renderBookmarkForm()}};Object.assign(qc.ChatRoomView.prototype,e),qc.MUCBookmarkForm=Wd.extend({className:"muc-bookmark-form chatroom-form-container",initialize(e){this.chatroomview=e.chatroomview,this.render()},toHTML(){return(e=>{const t=Od("Bookmark this groupchat"),n=Od("Would you like this groupchat to be automatically joined upon startup?"),r=Od("Cancel"),i=Od("The name for this bookmark:"),o=Od("What should your nickname for this groupchat be?"),s=Od("Save");return Ka(Hd(),e.onSubmit,t,i,e.name,o,e.nick||"",n,s,r,e.onCancel)})(Object.assign(this.model.toJSON(),{onCancel:e=>this.closeBookmarkForm(e),onSubmit:e=>this.onBookmarkFormSubmitted(e)}))},onBookmarkFormSubmitted(e){var t,n,r;e.preventDefault(),qc.bookmarks.createBookmark({jid:this.model.get("jid"),autojoin:(null===(t=e.target.querySelector('input[name="autojoin"]'))||void 0===t?void 0:t.checked)||!1,name:null===(n=e.target.querySelector("input[name=name]"))||void 0===n?void 0:n.value,nick:null===(r=e.target.querySelector("input[name=nick]"))||void 0===r?void 0:r.value}),this.closeBookmarkForm(e)},closeBookmarkForm(e){e.preventDefault(),this.chatroomview.closeForm()}}),qc.BookmarksView=Wd.extend({tagName:"span",initialize(){this.listenTo(this.model,"add",this.render),this.listenTo(this.model,"remove",this.render),this.listenTo(qc.chatboxes,"add",this.render),this.listenTo(qc.chatboxes,"remove",this.render);const e="converse.room-bookmarks".concat(qc.bare_jid,"-list-model");this.list_model=new qc.BookmarksList({id:e}),this.list_model.browserStorage=qc.createStore(e);const t=()=>{this.render(),this.insertIntoControlBox()};this.list_model.fetch({success:t,error:t})},toHTML(){return Ud({_converse:qc,bookmarks:this.model,hidden:this.model.getUnopenedBookmarks().length&&!0,is_hidden:e=>!(!Wc.settings.get("hide_open_bookmarks")||!qc.chatboxes.get(e.get("jid"))),openRoom:e=>this.openRoom(e),removeBookmark:e=>this.removeBookmark(e),toggleBookmarksList:e=>this.toggleBookmarksList(e),toggle_state:this.list_model.get("toggle-state")})},insertIntoControlBox(){const e=qc.chatboxviews.get("controlbox");if(void 0!==e&&!Yd.rootContains(qc.root,this.el)){const t=e.el.querySelector(".list-container--bookmarks");t&&t.parentNode.replaceChild(this.el,t)}},openRoom(e){e.preventDefault();const t=e.target.textContent,n=e.target.getAttribute("data-room-jid"),r={name:t||Qd.unescapeNode(Qd.getNodeFromJid(n))||n};Wc.rooms.open(n,r,!0)},removeBookmark:qc.removeBookmarkViaEvent,toggleBookmarksList(e){e&&e.preventDefault&&e.preventDefault();const t=e.target.matches(".fa")?e.target:e.target.querySelector(".fa");Yd.hasClass("fa-caret-down",t)?(Yd.slideIn(this.el.querySelector(".bookmarks")),this.list_model.save({"toggle-state":qc.CLOSED}),t.classList.remove("fa-caret-down"),t.classList.add("fa-caret-right")):(t.classList.remove("fa-car
|
|||
|
/**
|
|||
|
* @module converse-modal
|
|||
|
* @copyright The Converse.js contributors
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
*/const{sizzle:fh}=tl.env,ph=tl.env.utils;let gh;const mh=Wd.extend({className:"modal",events:{"click .nav-item .nav-link":"switchTab"},initialize(){this.render(),this.el.setAttribute("tabindex","-1"),this.el.setAttribute("role","dialog"),this.el.setAttribute("aria-hidden","true");const e=this.el.querySelector(".modal-title").getAttribute("id");e&&this.el.setAttribute("aria-labelledby",e),this.insertIntoDOM();const t=Xd.a.Modal;this.modal=new t(this.el,{backdrop:!0,keyboard:!0}),this.el.addEventListener("hide.bs.modal",()=>ph.removeClass("selected",this.trigger_el),!1)},insertIntoDOM(){gh.chatboxviews.el.querySelector("#converse-modals").insertAdjacentElement("beforeEnd",this.el)},switchTab(e){e.stopPropagation(),e.preventDefault(),fh(".nav-link.active",this.el).forEach(e=>{ph.removeClass("active",this.el.querySelector(e.getAttribute("href"))),ph.removeClass("active",e)}),ph.addClass("active",e.target),ph.addClass("active",this.el.querySelector(e.target.getAttribute("href")))},alert(e,t="primary"){const n=this.el.querySelector(".modal-alert");if(null===n)return void Pn.error("Could not find a .modal-alert element in the modal to show an alert message in!");var r;Qa((r={type:"alert-".concat(t),message:e},Ka(Zd(),r.type,r.message)),n);const i=n.firstElementChild;setTimeout(()=>{ph.addClass("fade-out",i),setTimeout(()=>ph.removeElement(i),600)},5e3)},show(e){e&&(e.preventDefault(),this.trigger_el=e.target,this.trigger_el.classList.add("selected")),this.modal.show()}});tl.env.BootstrapModal=mh;const vh=mh.extend({events:{"submit .confirm":"onConfimation"},initialize(){this.confirmation=ph.getResolveablePromise(),mh.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change",this.render),this.el.addEventListener("closed.bs.modal",()=>this.confirmation.reject(),!1)},toHTML(){return hh(this.model.toJSON())},afterRender(){this.close_handler_registered||(this.el.addEventListener("closed.bs.modal",()=>{this.confirmation.isResolved||this.confirmation.reject()},!1),this.close_handler_registered=!0)},onConfimation(e){e.preventDefault();const t=new FormData(e.target),n=(this.model.get("fields")||[]).map(e=>{const n=t.get(e.name).trim();return e.value=n,e.challenge&&(e.challenge_failed=n!==e.challenge),e});if(n.filter(e=>e.challenge_failed).length)return this.model.set("fields",n),void this.model.trigger("change");this.confirmation.resolve(n),this.modal.hide()}}),_h=mh.extend({initialize(){mh.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change",this.render)},toHTML(){return e=Object.assign({__:Od},this.model.toJSON()),Ka(sh(),e.level,e.title,ih,e.messages.map(e=>Ka(oh(),e)));var e}});function bh(){const e=function(e,t){t||(t=e.slice(0));return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <div class="modal-dialog fit-content" role="document">\n <div class="modal-content fit-content">\n <div class="modal-header">\n <h4 class="modal-title" id="message-versions-modal-label">','<a target="_blank" rel="noopener" href="','">',"</a></h4>\n ",'\n </div>\n <div class="modal-body modal-body--image fit-content">\n <img class="chat-image" src="','" @load=','>\n </div>\n <div class="modal-footer">',"</div>\n </div>\n </div>"]);return bh=function(){return e},e}tl.plugins.add("converse-modal",{initialize(){let e;gh=this._converse,gh.api.listen.on("disconnect",()=>{const e=document.querySelector("#converse-modals");e&&(e.innerHTML="")}),Object.assign(gh.api,{async confirm(e,t=[],n=[]){"string"==typeof t&&(t=[t]);const r=new Fo({title:e,messages:t,fields:n,type:"confirm"}),i=new vh({model:r});let o;i.show();try{o=await i.confirmation}catch(e){o=!1}return i.remove(),o},async prompt(e,t=[],n=""){"string"==typeof t&&(t=[t]);const r=new Fo({title:e,messages:t,fields:[{name:"reason",placeholder:n}],type:"prompt"}),i=new vh({model:r});let o;i.show();try{var s;o=null===(s=(await i.confirmation).pop())||void 0===s?void
|
|||
|
/**
|
|||
|
* @license
|
|||
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|||
|
* This code may only be used under the BSD style license found at
|
|||
|
* http://polymer.github.io/LICENSE.txt
|
|||
|
* The complete set of authors may be found at
|
|||
|
* http://polymer.github.io/AUTHORS.txt
|
|||
|
* The complete set of contributors may be found at
|
|||
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
|||
|
* Code distributed by Google as part of the polymer project is also
|
|||
|
* subject to an additional IP rights grant found at
|
|||
|
* http://polymer.github.io/PATENTS.txt
|
|||
|
*/
|
|||
|
const xh=new WeakMap,Eh=ka((...e)=>t=>{let n=xh.get(t);void 0===n&&(n={lastRenderedIndex:2147483647,values:[]},xh.set(t,n));const r=n.values;let i=r.length;n.values=e;for(let o=0;o<e.length&&!(o>n.lastRenderedIndex);o++){const s=e[o];if(Da(s)||"function"!=typeof s.then){t.setValue(s),n.lastRenderedIndex=o;break}o<i&&s===r[o]||(n.lastRenderedIndex=2147483647,i=0,Promise.resolve(s).then(e=>{const r=n.values.indexOf(s);r>-1&&r<n.lastRenderedIndex&&(n.lastRenderedIndex=r,t.setValue(e),t.commit())}))}});function jh(){const e=Oh(["",""]);return jh=function(){return e},e}function Ah(){const e=Oh(["",""]);return Ah=function(){return e},e}function Ch(){const e=Oh(['<span class="mention">',"</span>"]);return Ch=function(){return e},e}function kh(){const e=Oh(['<span class="mention mention--self badge badge-info">',"</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)}}))}const Th=tl.env.utils;class Nh extends String{constructor(e){super(e),this.references=[]}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 Ol(e.replace(/\n\n+/g,"\n\n"))}marshall(){let e=[this.toString()];this.references.sort((e,t)=>t.begin-e.begin).forEach(t=>{const n=e.shift();e=[n.slice(0,t.begin),t.template,n.slice(t.end),...e]}),this.isMeCommand()&&(e[0]=e[0].substring(4));return e.reduce((e,t)=>"string"==typeof t?[...e,Nh.replaceText(t)]:[...e,t],[])}}function Ih(e,t){var n;if(!t.collection)return void Pn.debug("addReferences: ignoring dangling model");const r=t.collection.chatbox.get("nick");null===(n=t.get("references"))||void 0===n||n.forEach(t=>{const n=e.slice(t.begin,t.end);var i;n===r?e.addTemplateResult(t.begin,t.end,(i={mention:n},Ka(kh(),i.mention))):e.addTemplateResult(t.begin,t.end,(e=>Ka(Ch(),e.mention))({mention:n}))})}class Mh{constructor(e){var t;this.model=e.model,this.component=e,this.chatview=null===(t=Th.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=new Nh(this.text);return await Wc.trigger("beforeMessageBodyTransformed",this.model,e,{Synchronous:!0}),function(e,t,n){const r=[];try{const t={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|xmpp:|mailto:|www\.)/gi};Sh.a.withinString(e,(e,t,n)=>(r.push({url:e,start:t,end:n}),e),t)}catch(e){return void Pn.debug(e)}const i=Wc.settings.get("show_images_inline");r.forEach(r=>{const o=e.slice(r.start,r.end),s=Th.filterQueryParamsFromURL(o);e.addTemplateResult(r.start,r.end,i&&Th.isImageURL(o)&&Th.isImageDomainAllowed(o)?Th.convertToImageTag(s,t,n):Th.convertUrlToHyperlink(s))})}(e,()=>this.scrollDownOnImageLoad(),e=>this.component.showImageModal(e)),function(e){const t=/geo:([\-0-9.]+),([\-0-9.]+)(?:,([\-0-9.]+))?(?:\?(.*))?/g,n=e.matchAll(t);for(const r of n)e.addTemplateResult(r.index,r.index+r.input.length,Th.convertUrlToHyperlink(r.input.replace(t,qc.geouri_replacement)))}(e),await async function(e){await Wc.emojis.initialize(),[...Nl(e.toString()),...Il(e.toString())].forEach(t=>{e.addTemplateResult(t.begin,t.end,Tl(t,{add_title_wrapper:!0}))})}(e),Ih(e,this.model),await Wc.trigger("afterMessageBodyTransformed",this.model,e,{Synchronous:!0}),e.marshall()}render(){return Ka(Ah(),Eh(this.transform(),Ka(jh(),this.text)))}}const Rh=ka(e=>t=>{var n;const r=new Mh(e);t.setValue(r.render());const i=e.model;null===(n=i.collection)||void 0===n||n.trigger("rendered",i)});function Dh(){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 Dh=function(){return e},e}Wc.elements.define("converse-chat-message-body",class extends pc{static get properties(){return{model:{type:Object},is_m
|
|||
|
/**
|
|||
|
* @copyright 2020, the Converse.js contributors
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
* @description This is the DOM/HTML utilities module.
|
|||
|
*/const cf=["http","https","xmpp","mailto"];function lf(e,t){return{"muc#roomconfig_lang":"language","muc#roomconfig_roomsecret":(null==t?void 0:t.new_password)?"new-password":"current-password"}[e]}const uf={"text-private":"password","text-single":"text",fixed:"label",boolean:"checkbox",hidden:"hidden","jid-multi":"textarea","list-single":"dropdown","list-multi":"dropdown"};function df(e){try{return e instanceof Sh.a?e:new Sh.a(e)}catch(e){return Pn.debug(e),null}}function hf(e,t){const n=df(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 ff(e){try{return decodeURI(e.filename())}catch(t){return Pn.debug(t),e.filename()}}function pf(e,t){const{__:n}=e;return r={url:t.toString(),label_download:n('Download audio file "%1$s"',ff(t))},Ka(Dh(),r.url,r.url,r.label_download);var r}function gf(e,t){e.classList.remove("visible"),M(t)&&t()}Vo.isAudioURL=e=>hf([".ogg",".mp3",".m4a"],e),Vo.isVideoURL=e=>hf([".mp4",".webm"],e),Vo.isURLWithImageExtension=e=>hf([".jpg",".jpeg",".png",".gif",".bmp",".tiff",".svg"],e),Vo.isImageURL=e=>{const t=Wc.settings.get("image_urls_regex");return(null==t?void 0:t.test(e))||Vo.isURLWithImageExtension(e)},Vo.isImageDomainAllowed=e=>{const t=Wc.settings.get("show_images_inline");if(!Array.isArray(t))return!0;try{const n=df(e).domain();return t.includes(n)}catch(e){return Pn.debug(e),!0}},Vo.getOOBURLMarkup=function(e,t){const n=df(t);return null===n?t:Vo.isVideoURL(n)?(r={url:t},Ka(rf(),r.url)):Vo.isAudioURL(n)?pf(e,n):Vo.isImageURL(n)?function(e,t){const{__:n}=e;return zh({url:t.toString(),label_download:n('Download image file "%1$s"',ff(t))})}(e,n):function(e,t){const{__:n}=e;return zh({url:t.toString(),label_download:n('Download file "%1$s"',ff(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 Qa(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,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},Vo.convertToImageTag=function(e,t,n){return r={url:e,onClick:n,onLoad:t},Ka(ef(),Zh(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
|
|||
|
/**
|
|||
|
* @license
|
|||
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|||
|
* This code may only be used under the BSD style license found at
|
|||
|
* http://polymer.github.io/LICENSE.txt
|
|||
|
* The complete set of authors may be found at
|
|||
|
* http://polymer.github.io/AUTHORS.txt
|
|||
|
* The complete set of contributors may be found at
|
|||
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
|||
|
* Code distributed by Google as part of the polymer project is also
|
|||
|
* subject to an additional IP rights grant found at
|
|||
|
* http://polymer.github.io/PATENTS.txt
|
|||
|
*/
|
|||
|
const dp=(e,t)=>{const n=e.startNode.parentNode,r=void 0===t?e.endNode:t.startNode,i=n.insertBefore(Sa(),r);n.insertBefore(Sa(),r);const o=new Fa(e.options);return o.insertAfterNode(i),o},hp=(e,t)=>(e.setValue(t),e.commit(),e),fp=(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)},pp=e=>{ga(e.startNode.parentNode,e.startNode,e.endNode.nextSibling)},gp=(e,t,n)=>{const r=new Map;for(let i=t;i<=n;i++)r.set(e[i],i);return r},mp=new WeakMap,vp=new WeakMap,_p=ka((e,t,n)=>{let r;return void 0===n?n=t:void 0!==t&&(r=t),t=>{if(!(t instanceof Fa))throw new Error("repeat can only be used in text bindings");const i=mp.get(t)||[],o=vp.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]=hp(i[h],a[p]),h++,p++;else if(o[f]===c[g])s[g]=hp(i[f],a[g]),f--,g--;else if(o[h]===c[g])s[g]=hp(i[h],a[g]),fp(t,i[h],s[g+1]),h++,g--;else if(o[f]===c[p])s[p]=hp(i[f],a[p]),fp(t,i[f],i[h]),f--,p++;else if(void 0===l&&(l=gp(c,p,g),u=gp(o,h,f)),l.has(o[h]))if(l.has(o[f])){const e=u.get(c[p]),n=void 0!==e?i[e]:null;if(null===n){const e=dp(t,i[h]);hp(e,a[p]),s[p]=e}else s[p]=hp(n,a[p]),fp(t,n,i[h]),i[e]=null;p++}else pp(i[f]),f--;else pp(i[h]),h++;for(;p<=g;){const e=dp(t,s[g+1]);hp(e,a[p]),s[p++]=e}for(;h<=f;){const e=i[h++];null!==e&&pp(e)}mp.set(t,s),vp.set(t,c)}});function bp(){const e=Sp(['<div class="empty-history-feedback form-help"><span>',"</span></div>"]);return bp=function(){return e},e}function yp(){const e=Sp(["",""]);return yp=function(){return e},e}function wp(){const e=Sp(["\n <converse-chat-message\n .chatview=","\n .hats=","\n .model=","\n ?correcting=","\n ?editable=","\n ?has_mentions=","\n ?is_delayed=","\n ?is_encrypted=","\n ?is_first_unread=","\n ?is_me_message=","\n ?is_only_emojis=","\n ?is_retracted=","\n ?is_spoiler=","\n ?is_spoiler_visible=","\n ?retractable=","\n edited=","\n error=","\n error_text=","\n filename=","\n filesize=","\n from=","\n message_type=","\n moderated_by=","\n moderation_reason=","\n msgid=","\n occupant_affiliation=","\n occupant_role=","\n oob_url=","\n pretty_type=","\n progress=","\n reason=","\n received=","\n retry_event_id=","\n sender=","\n spoiler_hint=","\n subject=","\n time=","\n username=","></converse-chat-message>\n"]);return wp=function(){return e},e}function Sp(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const xp=Od("No message history available.");function Ep(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")},Ka(up(),i.time,i.time,i.datestring)}var i}function jp(e,t){return{has_mentions:"groupchat"===t.get("type")&&"them"===t.get("sender")&&e.isUserMentioned(t),hats:qc.getHats(t),is_first_unread:e.get("first_unread_id")===t.get("id"),is_me_message:t.isMeCommand(),is_retracted:t.get("retracted")||"retracted"===t.get("moderated"),username:t.getDisplayName()}}qc.getHats=function(e){if("groupchat"===e.get("type")){var t;const n=Wc.settings.get("muc_hats").filter(e=>e).map(e=>e.toLowerCase());let r=[];n.includes("vcard_roles")&&(r=e.vcard?e.vcard.get("role"):null,r=r?r.split(",").filter(e=>e).map(e=>({title:e})):[]);const i=[...e.occupant?[e.occupant.get("role")]:[],...e.occupant?[e.occupant.get("affiliation")]:[]].filter(e=>e).filter(e=>n.includes(e.toLowerCase())).map(e=>({title:e}));return[...n.includes("xep317")&&(null===(t=e.occupant)||void 0===t?void 0:t.get("hats"))||[],...r,...i]}return[]};Wc.elements.define("converse-message-history",class extends
|
|||
|
/**
|
|||
|
* @license
|
|||
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|||
|
* This code may only be used under the BSD style license found at
|
|||
|
* http://polymer.github.io/LICENSE.txt
|
|||
|
* The complete set of authors may be found at
|
|||
|
* http://polymer.github.io/AUTHORS.txt
|
|||
|
* The complete set of contributors may be found at
|
|||
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
|||
|
* Code distributed by Google as part of the polymer project is also
|
|||
|
* subject to an additional IP rights grant found at
|
|||
|
* http://polymer.github.io/PATENTS.txt
|
|||
|
*/
|
|||
|
const kp=new WeakMap,Op=ka(e=>t=>{if(!(t instanceof Fa))throw new Error("unsafeHTML can only be used in text bindings");const n=kp.get(t);if(void 0!==n&&Da(e)&&e===n.value&&t.value===n.fragment)return;const r=document.createElement("template");r.innerHTML=e;const i=document.importNode(r.content,!0);t.setValue(i),kp.set(t,{value:e,fragment:i})});function Tp(){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 Tp=function(){return e},e}function Np(){const e=Mp(['<svg .style="','"> <use href="','"> </use> </svg>']);return Np=function(){return e},e}function Ip(){const e=Mp(["\n :host {\n display: inline-block;\n padding: 0;\n margin: 0;\n }\n "]);return Ip=function(){return e},e}function Mp(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}
|
|||
|
/**
|
|||
|
* @module icons.js
|
|||
|
* @copyright Alfredo Medrano Sánchez and the Converse.js contributors
|
|||
|
* @description
|
|||
|
* Component inspired by the one from fa-icons
|
|||
|
* https://github.com/obsidiansoft-io/fa-icons/blob/master/LICENSE
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
*/Wc.elements.define("converse-chat-content",class extends pc{static get properties(){return{chatview:{type:Object},messages:{type:Array},notifications:{type:String}}}render(){const e=Cp.a.filterXSS(this.notifications,{whiteList:{}});return Ka(Tp(),this.chatview,this.messages,Op(e))}});function Rp(){const e=Pp(['<div class="message chat-','" data-isodate="','">',"</div>"]);return Rp=function(){return e},e}function Dp(){const e=Pp(['<converse-icon class="fas fa-times close-chat-help"\n @click=','\n path-prefix="','"\n size="1em"></converse-icon>']);return Dp=function(){return e},e}function Pp(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}customElements.define("converse-icon",class extends pc{static get properties(){return{color:String,class_name:{attribute:"class"},style:String,size:String}}static get styles(){return dc(Ip())}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 Ka(Np(),this.getStyles(),this.getSource())}});function zp(){const e=Vp(["<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 Lp(){const e=Vp(['\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 Lp=function(){return e},e}function Fp(){const e=Vp(['\n <li data-skintone="','" class="emoji-skintone ','">\n <a class="pick-skintone" href="#" data-skintone="','" @click=',">","</a>\n </li>"]);return Fp=function(){return e},e}function Bp(){const e=Vp(["\n <span ?hidden=",' class="emoji-lists__container emoji-lists__container--browse">\n ',"\n </span>"]);return Bp=function(){return e},e}function qp(){const e=Vp(['\n <a id="emoji-picker-','" class="emoji-category__heading" data-category="','">','</a>\n <ul class="emoji-picker" data-category="','">\n ',"\n </ul>"]);return qp=function(){return e},e}function Up(){const e=Vp(["\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 Up=function(){return e},e}function Hp(){const e=Vp(['\n <li class="emoji insert-emoji ','" data-emoji="','" title="','">\n <a href="#" @click=',' data-emoji="','">',"</a>\n </li>\n "]);return Hp=function(){return e},e}function $p(){const e=Vp(["<ul>","</ul>"]);return $p=function(){return e},e}function Wp(){const e=Vp(['\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 Wp=function(){return e},e}function Vp(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Wc.elements.define("converse-chat-help",class extends pc{static get properties(){return{chat_type:{type:String},mes
|
|||
|
/**
|
|||
|
* @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 _g=new WeakMap,bg=ka(e=>t=>{if(!(t instanceof Fa))throw new Error("unsafeSVG can only be used in text bindings");const n=_g.get(t);if(void 0!==n&&Da(e)&&e===n.value&&t.value===n.fragment)return;const r=document.createElement("template");r.innerHTML=`<svg>${e}</svg>`;const i=r.content,o=i.firstChild;i.removeChild(o),pa(i,o.firstChild);const s=document.importNode(i,!0);t.setValue(s),_g.set(t,{value:e,fragment:s})});function yg(){const e=Sg(["",""]);return yg=function(){return e},e}function wg(){const e=Sg(["",""]);return wg=function(){return e},e}function Sg(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function xg(){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 xg=function(){return e},e}window.customElements.define("converse-fontawesome",class extends pc{constructor(){super();const e=n.e(138).then(n.t.bind(null,540,7));this.data=e.then(e=>Ka(wg(),bg(e.default())))}render(){return Ka(yg(),Eh(this.data,""))}});var Eg=function(e,t,n){var r=null==e?0:e.length;return r?(t=n||void 0===t?1:di(t),jo(e,t<0?0:t,r)):[]};var jg=function(e,t){var n=[];return gs(e,(function(e,r,i){t(e,r,i)&&n.push(e)})),n};var Ag=function(e,t){return(Te(e)?ot:jg)(e,So(t,3))};var Cg=function(e){return e&&e.length?e[0]:void 0};var kg=function(e){return"function"==typeof e?e:vr};var Og=function(e,t){return(Te(e)?ve:gs)(e,kg(t))};var Tg=function(e,t){return Fr(t,(function(t){return e[t]}))};var Ng=function(e){return null==e?[]:Tg(e,Ye(e))},Ig=Math.max;var Mg=function(e,t,n,r){e=Qe(e)?e:Ng(e),n=n&&!r?di(n):0;var i=e.length;return n<0&&(n=Ig(i+n,0)),Zt(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&xs(e,t,n)>-1};var Rg=function(e){return(null==e?0:e.length)?jo(e,0,-1):[]};var Dg=function(e,t){return(Te(e)?Fr:Js)(e,So(t,3))};var Pg=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 zg=function(e,t){return e>t};var Lg=function(e){return e&&e.length?Pg(e,vr,zg):void 0};var Fg=function(e,t){return e<t};var Bg=function(e){return e&&e.length?Pg(e,vr,Fg):void 0};var qg=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 Ug=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 Hg=function(e,t,n){var r=Te(e)?qg:Ug,i=arguments.length<3;return r(e,So(t,4),n,i,gs)};var $g=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},Wg=zi(!0);var Vg=ps((function(e,t){return e&&Wg(e,t,Ye)}),!0);var Gg=function(e,t,n){var r=Te(e)?$g:Ug,i=arguments.length<3;return r(e,So(t,4),n,i,Vg)};var Jg=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 Qg=function(e,t){return(Te(e)?ot:jg)(e,Jg(So(t,3)))};var Yg=function(e,t){if("function"!=typeof e)throw new TypeError("Expected a function");return t=void 0===t?t:di(t),jr(e,t)},Kg=Math.floor,Xg=Math.random;var Zg=function(e,t){return e+Kg(Xg()*(t-e+1))};var em=function(e){var t=e.length;return t?e[Zg(0,t-1)]:void 0};var tm=function(e){return em(Ng(e))};var nm=function(e){return(Te(e)?em:tm)(e)};var rm=function(e,t){var n=-1,r=e.length,i=r-1;for(t=void 0===t?r:t;++n<t;){var o=Zg(n,i),s=e[o];e[o]=e[n],e[n]=s}return e.length=t,e};var im=function(e){return rm(it(e))};var om=function(e){return rm(Ng(e))};var sm=function(e){return(Te(e)?im:om)(e)},am=bo("length"),cm=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var lm=function(e){return cm.test(e)},um="[\\ud800-\\udfff]",dm="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",hm="\\ud83c[\\udffb-\\udfff]",fm="[^
|
|||
|
/*!
|
|||
|
* Copyright (c) JC Brand <jc@opkode.com>
|
|||
|
*/
|
|||
|
const qm=function(e){this.views={},this.keys=()=>Object.keys(this.views),this.getAll=()=>this.views,this.get=e=>this.views[e],this.xget=e=>this.keys().filter(t=>t!==e).reduce((e,t)=>(e[t]=this.views[t],e),{}),this.add=(e,t)=>(this.views[e]=t,t),this.remove=e=>{void 0===e&&(new Wd).remove.apply(this);const t=this.views[e];if(t)return delete this.views[e],t.remove(),t},this.removeAll=()=>(this.keys().forEach(e=>this.remove(e)),this),Wd.apply(this,Array.prototype.slice.apply(arguments))},Um={includes:Mg,difference:ks,drop:Eg,every:Ns,filter:Ag,find:ll,first:Cg,forEach:Og,head:Cg,indexOf:Bs,initial:Rg,invoke:Rc,isEmpty:ri,last:Eo,lastIndexOf:Ws,map:Dg,max:Lg,min:Bg,reduce:Hg,reduceRight:Gg,reject:Qg,rest:Yg,sample:nm,shuffle:sm,size:Sm,some:Gs,sortBy:Zs,tail:xm,take:Em,toArray:Fm,without:Bm};Object.keys(Um).forEach(e=>{qm.prototype[e]=function(){const t=Array.prototype.slice.call(arguments);return t.unshift(this.views),Um[e].apply(this,t)}}),Object.assign(qm.prototype,Wd.prototype),qm.extend=Wd.extend;const Hm=qm.extend({listItems:"model",sortEvent:"change",sortImmediatelyOnAdd:!1,listSelector:".ordered-items",ItemView:void 0,subviewIndex:"id",initialize(){this.sortEventually=Ic(()=>this.sortAndPositionAllItems(),100),this.items=go(this,this.listItems),this.items.on("remove",this.removeView,this),this.items.on("reset",this.removeAll,this),this.items.on("add",(e,t)=>{this.sortImmediatelyOnAdd?this.sortAndPositionAllItems():this.sortEventually()}),this.sortEvent&&this.items.on(this.sortEvent,this.sortEventually,this)},createItemView(e){let t=this.get(e.get(this.subviewIndex));return t?(t.model=e,t.initialize()):(t=new this.ItemView({model:e}),this.add(e.get(this.subviewIndex),t)),t.render(),t},removeView(e){this.remove(e.get(this.subviewIndex))},sortAndPositionAllItems(){if(!this.items.length)return;this.items.sort();const e=this.el.querySelector(this.listSelector),t=document.createElement("div");e.parentNode.replaceChild(t,e),this.items.forEach(t=>{let n=this.get(t.get(this.subviewIndex));n||(n=this.createItemView(t)),e.insertAdjacentElement("beforeend",n.el)}),t.parentNode.replaceChild(e,t)}}),$m=tl.env.utils,Wm=Wd.extend({renderAvatar(e){const t=(e=e||this.el).querySelector("canvas.avatar, svg.avatar");if(null!==t&&this.model.vcard){const e={classes:t.getAttribute("class"),width:t.getAttribute("width"),height:t.getAttribute("height"),image_type:this.model.vcard.get("image_type"),image:this.model.vcard.get("image")};t.outerHTML=$m.getElementFromTemplateResult(Df(e)).outerHTML}}}),Vm=qm.extend({_ensureElement(){if(this.el)this.setElement(Jr(this,"el"),!1);else{let e=qc.root.querySelector("#conversejs");if(null===e){e=document.createElement("div"),e.setAttribute("id","conversejs"),$m.addClass("theme-".concat(Wc.settings.get("theme")),e);const t=qc.root.querySelector("body");t?t.appendChild(e):qc.root.appendChild(e)}this.setElement(e,!1)}},initialize(){this.listenTo(this.model,"destroy",this.removeChat);const e=document.getElementById("conversejs-bg");e&&!e.innerHTML.trim()&&Qa(Ka(vg()),e),document.querySelector("body").classList.add("converse-".concat(Wc.settings.get("view_mode"))),this.el.classList.add("converse-".concat(Wc.settings.get("view_mode"))),Wc.settings.get("singleton")&&this.el.classList.add("converse-singleton"),this.render()},render(){this._ensureElement(),Qa(Ka(xg()),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 Gm(){qc.chatboxviews=new qc.ChatBoxViews({model:qc.chatboxes}),Wc.trigger("chatBoxViewsInitialized")}function Jm(){const e=.01*window.innerHeight;document.documentElement.style.setProperty("--vh","".concat(e,"px"))}function Qm(){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 Qm=function(){return e},e}tl.plugins.add("converse-chatboxviews",{dependencies:["converse-chatboxes","converse-vcard"],initialize(){Wc.elements.register(),Wc.promises.add(["chatBoxViewsInitialized"]),Wc.settings.extend({animate:!0,theme:"default"}),qc.ViewWithAvatar=Wm,qc.ChatBoxViews=Vm,Wc.listen.on("chatBoxesInitialized",Gm),Wc.listen.on("cleanup",()=>delete qc.chatboxviews),Wc.listen.on("clearSession",()=>qc.chatboxviews.closeAllChatBoxes()),Wc.listen.on("chatBoxViewsInitialized",Jm),window.addEventListener("resize",Jm),Object.assign(tl,{insertInto(e){var t;const n=null===(t=qc.chatboxviews)||void 0===t?void 0:t.el;if(n&&!e.contains(n))e.insertAdjacentElement("afterBegin",n),Wc.chatviews.get().filter(e=>"controlbox"!==e.model.get("id")).forEach(e=>e.maintainScrollTop());else if(!n)throw new Error("Cannot insert non-existing #conversejs element into the DOM")}})}});var Ym=e=>Ka(Qm(),e.show_send_button?"chat-content-sendbutton":"",e.markScrolled);function Km(){const e=rv(['<p class="chat-head__desc">',"</p>"]);return Km=function(){return e},e}function Xm(){const e=rv(["<converse-dropdown .items=","></converse-dropdown>"]);return Xm=function(){return e},e}function Zm(){const e=rv(['<a href="','" target="_blank" rel="noopener" class="user">',"</a>"]);return Zm=function(){return e},e}function ev(){const e=rv(['<span class="mr-2">',"</span>"]);return ev=function(){return e},e}function tv(){const e=rv(['<div class="chatbox-navback"><i class="fa fa-arrow-left"></i></div>']);return tv=function(){return e},e}function nv(){const e=rv(['\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 nv=function(){return e},e}function rv(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function iv(){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 iv=function(){return e},e}function ov(){co
|
|||
|
/**
|
|||
|
* @module converse-chatview
|
|||
|
* @copyright 2020, the Converse.js contributors
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
*/const{Strophe:jv,dayjs:Av}=tl.env,Cv=tl.env.utils,kv=Wd.extend({length:200,className:"chatbox hidden",is_chatroom:!1,events:{"click .chatbox-navback":"showControlBox","click .new-msgs-indicator":"viewUnreadMessages","click .send-button":"onFormSubmitted","click .toggle-clear":"clearMessages","input .chat-textarea":"inputChanged","keydown .chat-textarea":"onKeyDown","keyup .chat-textarea":"onKeyUp","paste .chat-textarea":"onPaste"},async initialize(){this.initDebounced(),this.listenTo(this.model,"change:composing_spoiler",this.renderMessageForm),this.listenTo(this.model,"change:hidden",e=>e.get("hidden")?this.hide():this.show()),this.listenTo(this.model,"change:status",this.onStatusMessageChanged),this.listenTo(this.model,"destroy",this.remove),this.listenTo(this.model,"show",this.show),this.listenTo(this.model,"vcard:change",this.renderHeading),this.model.contact&&this.listenTo(this.model.contact,"destroy",this.renderHeading),this.model.rosterContactAdded&&this.model.rosterContactAdded.then(()=>{this.listenTo(this.model.contact,"change:nickname",this.renderHeading),this.renderHeading()}),this.listenTo(this.model.presence,"change:show",this.onPresenceChanged),this.render(),this.listenTo(this.model.messages,"add",this.onMessageAdded),this.listenTo(this.model.messages,"remove",this.renderChatHistory),this.listenTo(this.model.messages,"rendered",this.maybeScrollDown),this.listenTo(this.model.messages,"reset",this.renderChatHistory),this.listenTo(this.model.notifications,"change",this.renderNotifications),this.listenTo(this.model,"change:show_help_messages",this.renderHelpMessages),await this.model.messages.fetched,this.insertIntoDOM(),this.model.maybeShow(),this.scrollDown(),Wc.trigger("chatBoxViewInitialized",this)},initDebounced(){this.markScrolled=Ic(this._markScrolled,100),this.debouncedScrollDown=Ic(this.scrollDown,100),Wc.settings.get("debounced_content_rendering")?(this.renderChatHistory=Ic(()=>this.renderChatContent(!1),100),this.renderNotifications=Ic(()=>this.renderChatContent(!0),100)):(this.renderChatHistory=()=>this.renderChatContent(!1),this.renderNotifications=()=>this.renderChatContent(!0))},render(){const e=Ym(Object.assign(this.model.toJSON(),{markScrolled:e=>this.markScrolled(e)}));return Qa(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(),Cv.isNewMessage(e)&&("me"===e.get("sender")?this.model.set("scrolled",!1):this.model.get("scrolled",!0)&&this.showNewMessagesIndicator())},getNotifications(){return this.model.notifications.get("chat_state")===qc.COMPOSING?Od("%1$s is typing",this.model.getDisplayName()):this.model.notifications.get("chat_state")===qc.PAUSED?Od("%1$s has stopped typing",this.model.getDisplayName()):this.model.notifications.get("chat_state")===qc.GONE?Od("%1$s has gone away",this.model.getDisplayName()):""},getHelpMessages:()=>["<strong>/clear</strong>: ".concat(Od("Remove messages")),"<strong>/close</strong>: ".concat(Od("Close this chat")),"<strong>/me</strong>: ".concat(Od("Write in the third person")),"<strong>/help</strong>: ".concat(Od("Show this menu"))],renderHelpMessages(){Qa(Ka(xv(),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=>Ka(Sv(),this,e.messages,e.notifications));const t=this.model.messages.models,n=e?t:Array.from(t);Qa(this.tpl_chat_content({messages:n,notifications:this.getNotifications()}),this.msgs_container)},renderToolbar(){if(!Wc.settings.get("show_toolbar"))return this;const e=Object.assign({model:this.model,chatview:this},this.model.toJSON(),this.getToolbarOptions());return Qa((e=>{const t=Wc.settings.get("message_limit"),n=Wc.settings.get("visible_toolbar_buttons").call,r=Wc.setting
|
|||
|
/**
|
|||
|
* @module converse-controlbox
|
|||
|
* @copyright 2020, the Converse.js contributors
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
*/const{Strophe:x_,dayjs:E_}=tl.env,j_=tl.env.utils,A_={Error:"error",Connecting:"info","Connection failure":"error",Authenticating:"info","Authentication failure":"error",Connected:"info",Disconnected:"error",Disconnecting:"warn",Attached:"info",Redirect:"info",Reconnecting:"warn"},C_={0:"Error",1:"Connecting",2:"Connection failure",3:"Authenticating",4:"Authentication failure",5:"Connected",6:"Disconnected",7:"Disconnecting",8:"Attached",9:"Redirect",10:"Reconnecting"},k_=[0,1,2,3,4,7,10];tl.plugins.add("converse-controlbox",{dependencies:["converse-modal","converse-chatboxes","converse-chat","converse-rosterview","converse-chatview"],enabled:e=>!e.api.settings.get("singleton"),overrides:{ChatBoxes:{model(e,t){const{_converse:n}=this.__super__;return e&&"controlbox"==e.id?new n.ControlBox(e,t):this.__super__.model.apply(this,arguments)}}},initialize(){function e(){const e=new qc.ControlBox({id:"controlbox"});return qc.chatboxes.add(e)}Wc.settings.extend({allow_logout:!0,allow_user_trust_override:!0,default_domain:void 0,locked_domain:void 0,show_controlbox_by_default:!1,sticky_controlbox:!1}),Wc.promises.add("controlBoxInitialized"),qc.ControlBox=qc.ChatBox.extend({defaults(){return{bookmarked:!1,box_id:"controlbox",chat_state:void 0,closed:!Wc.settings.get("show_controlbox_by_default"),num_unread:0,time_opened:this.get("time_opened")||(new Date).getTime(),type:qc.CONTROLBOX_TYPE,url:""}},initialize(){"controlbox"===this.get("id")?this.set({time_opened:E_(0).valueOf()}):qc.ChatBox.prototype.initialize.apply(this,arguments)},validate(e){return e.type===qc.CONTROLBOX_TYPE?"embedded"===Wc.settings.get("view_mode")&&Wc.settings.get("singleton")?"Controlbox not relevant in embedded view mode":void 0:qc.ChatBox.prototype.validate.call(this,e)},maybeShow(e){return e||"controlbox"!==this.get("id")?qc.ChatBox.prototype.maybeShow.call(this,e):this},onReconnection:function(){}}),qc.ControlBoxView=qc.ChatBoxView.extend({tagName:"div",className:"chatbox",id:"controlbox",events:{"click a.close-chatbox-button":"close"},initialize(){void 0===qc.controlboxtoggle&&(qc.controlboxtoggle=new qc.ControlBoxToggle),qc.controlboxtoggle.el.insertAdjacentElement("afterend",this.el),this.listenTo(this.model,"change:connected",this.onConnected),this.listenTo(this.model,"destroy",this.hide),this.listenTo(this.model,"hide",this.hide),this.listenTo(this.model,"show",this.show),this.listenTo(this.model,"change:closed",this.ensureClosedState),this.render(),Wc.trigger("controlBoxInitialized",this)},render(){this.model.get("connected")&&void 0===this.model.get("closed")&&this.model.set("closed",!Wc.settings.get("show_controlbox_by_default"));const e=(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?w_(Object(n),!0).forEach((function(t){S_(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w_(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({sticky_controlbox:Wc.settings.get("sticky_controlbox")},this.model.toJSON()),Ka(s_(),t.sticky_controlbox?"":Ka(o_())));var t;Qa(e,this.el),this.model.get("closed")?this.hide():this.show();const n=(null==qc?void 0:qc.connection)||{};return n.connected&&n.authenticated&&!n.disconnecting?this.model.get("connected")&&this.renderControlBoxPane():this.renderLoginPanel(),this},onConnected(){this.model.get("connected")&&this.render()},renderLoginPanel(){if(this.el.classList.add("logged-out"),this.loginpanel)this.loginpanel.render();else{this.loginpanel=new qc.LoginPanel({model:new qc.LoginPanelModel});const e=this.el.querySelector(".controlbox-panes");e.innerHTML="",e.appendChild(this.loginpanel.render().el)}return this.loginpanel.initPopovers(),this},renderControlBoxPane(){this.loginpanel&&(this.loginpanel.remove(),delete this.loginpanel),this.controlbox_pane&&j_.isVisible(this.controlbox_pane.el)||(this.el.classList.remove("logged-out"),this.controlbox_pane=new qc.ControlBoxPane,this.el.querySelector(".controlbox-panes").insertAdjacentElement("afterBegin",this.
|
|||
|
/**
|
|||
|
* @module converse-dragresize
|
|||
|
* @copyright 2020, the Converse.js contributors
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
*/
|
|||
|
const N_=tl.env.utils;function I_(e,t){const n=t.el.querySelector(".box-flyout"),r=document.createElement("div");r.innerHTML=T_()(),n.insertBefore(r,n.firstChild)}function M_(){const e=D_(['<span class="message-count badge badge-light">',"</span>"]);return M_=function(){return e},e}function R_(){const e=D_(['\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 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)}}))}tl.plugins.add("converse-dragresize",{dependencies:["converse-chatview","converse-headlines-view","converse-muc-views"],enabled:e=>"overlayed"==e.api.settings.get("view_mode"),overrides:{ChatBox:{initialize(){const e=this.__super__.initialize.apply(this,arguments),t=this.get("height"),n=this.get("width");return("controlbox"===this.get("id")?e=>this.set(e):e=>this.save(e))({height:N_.applyDragResistance(t,this.get("default_height")),width:N_.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 I_(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 I_(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 I_(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 I_(this.__super__._converse,this),this.setWidth(),e}}},initialize(){Wc.settings.extend({allow_dragresize:!0});const e={initDragResize(){var e;const t=this,n=Ic(()=>t.setDimensions());window.addEventListener("resize",t.debouncedSetDimensions),this.listenTo(this.model,"destroy",()=>window.removeEventListener("resize",n));const r=this.el.querySelector(".box-flyout"),i=window.getComputedStyle(r);if(void 0===this.model.get("height")){const e=parseInt(i.height.replace(/px$/,""),10),t=parseInt(i.width.replace(/px$/,""),10);this.model.set("height",e),this.model.set("default_height",e),this.model.set("width",t),this.model.set("default_width",t)}const o=i["min-width"],s=i["min-height"];return this.model.set("min_width",o.endsWith("px")?Number(o.replace(/px$/,"")):0),this.model.set("min_height",s.endsWith("px")?Number(s.replace(/px$/,"")):0),this.prev_pageY=0,this.prev_pageX=0,(null===(e=qc.connection)||void 0===e?void 0:e.connected)&&(this.height=this.model.get("height"),this.width=this.model.get("width")),this},resizeChatBox(e){let t;0===qc.resizing.direction.indexOf("top")&&(t=e.pageY-this.prev_pageY,t&&(this.height=this.height-t>(this.model.get("min_height")||0)?this.height-t:this.model.get("min_height"),this.prev_pageY=e.pageY,this.setChatBoxHeight(this.height))),qc.resizing.direction.includes("left")&&(t=this.prev_pageX-e.pageX,t&&(this.width=this.width+t>(th
|
|||
|
/**
|
|||
|
* @module converse-singleton
|
|||
|
* @copyright JC Brand
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
* @description A plugin which restricts Converse to only one chat.
|
|||
|
*/
|
|||
|
tl.plugins.add("converse-singleton",{enabled:e=>e.api.settings.get("singleton"),initialize(){if(Wc.settings.extend({allow_logout:!1,allow_muc_invitations:!1,hide_muc_server:!0}),!Array.isArray(Wc.settings.get("auto_join_rooms"))&&!Array.isArray(Wc.settings.get("auto_join_private_chats")))throw new Error("converse-singleton: auto_join_rooms must be an Array");if(Wc.settings.get("auto_join_rooms").length>1||Wc.settings.get("auto_join_private_chats").length>1)throw new Error("It doesn't make sense to have singleton set to true and auto_join_rooms or auto_join_private_chats set to more then one, since only one chat room may be open at any time.")}}),
|
|||
|
/**
|
|||
|
* @module converse-fullscreen
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
* @copyright 2020, the Converse.js contributors
|
|||
|
*/
|
|||
|
tl.plugins.add("converse-fullscreen",{enabled:e=>e.isUniView(),initialize(){Wc.settings.extend({chatview_avatar_height:50,chatview_avatar_width:50,hide_open_bookmarks:!0,show_controlbox_by_default:!0,sticky_controlbox:!0})}}),
|
|||
|
/**
|
|||
|
* @module converse-mam-views
|
|||
|
* @description
|
|||
|
* Views for XEP-0313 Message Archive Management
|
|||
|
* @copyright 2020, the Converse.js contributors
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
*/
|
|||
|
tl.plugins.add("converse-mam-views",{dependencies:["converse-mam","converse-chatview","converse-muc-views"],initialize(){Wc.listen.on("chatBoxScrolledUp",async e=>{if(e.model.messages.length){const t=e.model.get("type")===qc.CHATROOMS_TYPE,n=e.model.getOldestMessage();if(n){const r=t?e.model.get("jid"):qc.bare_jid,i=n&&n.get("stanza_id ".concat(r));e.addSpinner(),i?await e.model.fetchArchivedMessages({before:i}):await e.model.fetchArchivedMessages({end:n.get("time")}),e.clearSpinner(),qc.router.history.navigate("#".concat(n.get("msgid")))}}})}});function P_(){const e=L_(["<converse-minimized-chat\n .model=","\n title=","\n type=","\n num_unread=","></converse-minimized-chat>"]);return P_=function(){return e},e}function z_(){const e=L_(['<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 z_=function(){return e},e}function L_(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}Wc.elements.define("converse-minimized-chat",class extends pc{static get properties(){return{model:{type:Object},title:{type:String},type:{type:String},num_unread:{type:Number}}}render(){return(e=>{const t=Od("Click to restore this chat");return Ka(R_(),e.type,t,e.restore,e.num_unread?Ka(M_(),e.num_unread):"",e.title,e.close)})({close:e=>this.close(e),num_unread:this.num_unread,restore:e=>this.restore(e),title:this.title,type:this.type})}close(e){null==e||e.preventDefault();const t=qc.chatboxviews.get(this.model.get("id"));t?t.close():(this.model.destroy(),Wc.trigger("chatBoxClosed",this))}restore(e){null==e||e.preventDefault(),this.model.maximize()}});
|
|||
|
/**
|
|||
|
* @module converse-minimize
|
|||
|
* @copyright 2020, the Converse.js contributors
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
*/
|
|||
|
const{dayjs:F_}=tl.env,B_=tl.env.utils;function q_(){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 q_=function(){return e},e}tl.plugins.add("converse-minimize",{dependencies:["converse-chatview","converse-controlbox","converse-muc-views","converse-headlines-view","converse-dragresize"],enabled:e=>"overlayed"===e.api.settings.get("view_mode"),overrides:{ChatBox:{initialize(){this.__super__.initialize.apply(this,arguments),this.on("show",this.maximize,this),"controlbox"!==this.get("id")&&this.save({minimized:this.get("minimized")||!1,time_minimized:this.get("time_minimized")||F_()})},maybeShow(e){return!e&&this.get("minimized")?this:this.__super__.maybeShow.apply(this,arguments)},isHidden(){return this.__super__.isHidden.call(this)||this.get("minimized")}},ChatBoxView:{show(){const{_converse:e}=this.__super__;return"overlayed"===e.api.settings.get("view_mode")&&this.model.get("minimized")?(this.model.minimize(),this):this.__super__.show.apply(this,arguments)},isNewMessageHidden(){return this.model.get("minimized")||this.__super__.isNewMessageHidden.apply(this,arguments)},setChatBoxHeight(e){if(!this.model.get("minimized"))return this.__super__.setChatBoxHeight.call(this,e)},setChatBoxWidth(e){if(!this.model.get("minimized"))return this.__super__.setChatBoxWidth.call(this,e)}}},initialize(){Wc.settings.extend({no_trimming:!1});const e={maximize(){B_.safeSave(this,{minimized:!1,time_opened:(new Date).getTime()})},minimize(){B_.safeSave(this,{minimized:!0,time_minimized:(new Date).toISOString()})}};Object.assign(qc.ChatBox.prototype,e);const t={onMaximized(){const{_converse:e}=this.__super__;return this.insertIntoDOM(),this.model.isScrolledUp()||this.model.clearUnreadMsgCounter(),this.model.setChatState(e.ACTIVE),this.show(),Wc.trigger("chatBoxMaximized",this),this},onMinimized(e){const{_converse:t}=this.__super__;return e&&e.preventDefault&&e.preventDefault(),this.model.collection&&this.model.collection.browserStorage?this.model.save({scroll:this.content.scrollTop}):this.model.set({scroll:this.content.scrollTop}),this.model.setChatState(t.INACTIVE),this.hide(),Wc.trigger("chatBoxMinimized",this),this},minimize(e){return e&&e.preventDefault&&e.preventDefault(),this.model.minimize(),this},onMinimizedChanged(e){e.get("minimized")?this.onMinimized():this.onMaximized()}};Object.assign(qc.ChatBoxView.prototype,t);const n={getChatBoxWidth(e){if("controlbox"===e.model.get("id")){const e=this.get("controlbox");return e&&B_.isVisible(e.el)?B_.getOuterWidth(e.el,!0):B_.getOuterWidth(qc.controlboxtoggle.el,!0)}return!e.model.get("minimized")&&B_.isVisible(e.el)?B_.getOuterWidth(e.el,!0):0},getShownChats(){return this.filter(e=>!e.model.get("minimized")&&!e.model.get("closed")&&B_.isVisible(e.el))},getMinimizedWidth(){var e;const t=null===(e=qc.minimized_chats)||void 0===e?void 0:e.el;return this.model.pluck("minimized").includes(!0)?B_.getOuterWidth(t,!0):0},getBoxesWidth(e){const t=e?e.model.get("id"):null,n=e?B_.getOuterWidth(e.el,!0):0;return Object.values(this.xget(t)).reduce((e,t)=>e+this.getChatBoxWidth(t),n)},async trimChats(e){var t;if(Wc.settings.get("no_trimming")||!Wc.connection.connected()||"overlayed"!==Wc.settings.get("view_mode"))return;const n=this.getShownChats();if(n.length<=1)return;const r=B_.getOuterWidth(document.querySelector("body"),!0);if(this.getChatBoxWidth(n[0])!==r&&(await Wc.waitUntil("minimizedChatsInitialized"),null===(t
|
|||
|
/**
|
|||
|
* @module converse-muc-views
|
|||
|
* @copyright 2020, the Converse.js contributors
|
|||
|
* @description XEP-0045 Multi-User Chat Views
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
*/
|
|||
|
const{Strophe:Gy,sizzle:Jy,$pres:Qy}=tl.env,Yy=tl.env.utils,Ky=["owner"],Xy=["admin","ban","deop","destroy","member","op","revoke"],Zy=["kick","mute","voice","modtools"],ew=["nick"],tw={deop:"participant",kick:"none",mute:"visitor",op:"moderator",voice:"participant"},nw={admin:"admin",ban:"outcast",member:"member",owner:"owner",revoke:"none"},rw=kv.extend({length:300,tagName:"div",className:"chatbox chatroom hidden",is_chatroom:!0,events:{"click .chatbox-navback":"showControlBox","click .hide-occupants":"hideOccupants","click .new-msgs-indicator":"viewUnreadMessages","click .occupant-nick":function(e){this.insertIntoTextArea(e.target.textContent)},"click .send-button":"onFormSubmitted","dragover .chat-textarea":"onDragOver","drop .chat-textarea":"onDrop","input .chat-textarea":"inputChanged","keydown .chat-textarea":"onKeyDown","keyup .chat-textarea":"onKeyUp","mousedown .dragresize-occupants-left":"onStartResizeOccupants","paste .chat-textarea":"onPaste","submit .muc-nickname-form":"submitNickname"},async initialize(){this.initDebounced(),this.listenTo(this.model,"change",Ic(()=>this.renderHeading(),250)),this.listenTo(this.model,"change:composing_spoiler",this.renderMessageForm),this.listenTo(this.model,"change:hidden",e=>e.get("hidden")?this.hide():this.show()),this.listenTo(this.model,"change:hidden_occupants",this.onSidebarToggle),this.listenTo(this.model,"configurationNeeded",this.getAndRenderConfigurationForm),this.listenTo(this.model,"destroy",this.hide),this.listenTo(this.model,"show",this.show),this.listenTo(this.model.features,"change:moderated",this.renderBottomPanel),this.listenTo(this.model.features,"change:open",this.renderHeading),this.listenTo(this.model.messages,"rendered",this.maybeScrollDown),this.listenTo(this.model.session,"change:connection_status",this.onConnectionStatusChanged),this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),await this.render(),this.listenTo(this.model,"change:show_help_messages",this.renderHelpMessages),this.listenTo(this.model.messages,"add",this.onMessageAdded),this.listenTo(this.model.messages,"change",this.renderChatHistory),this.listenTo(this.model.messages,"remove",this.renderChatHistory),this.listenTo(this.model.messages,"reset",this.renderChatHistory),this.listenTo(this.model.notifications,"change",this.renderNotifications),this.model.occupants.forEach(e=>this.onOccupantAdded(e)),this.listenTo(this.model.occupants,"add",this.onOccupantAdded),this.listenTo(this.model.occupants,"change",this.renderChatHistory),this.listenTo(this.model.occupants,"change:affiliation",this.onOccupantAffiliationChanged),this.listenTo(this.model.occupants,"change:role",this.onOccupantRoleChanged),this.listenTo(this.model.occupants,"change:show",this.showJoinOrLeaveNotification),this.listenTo(this.model.occupants,"remove",this.onOccupantRemoved),this.renderChatContent(),this.insertIntoDOM();const e=await qc.api.user.settings.getModel();this.listenTo(e,"change:mucs_with_hidden_subject",this.renderHeading),this.onConnectionStatusChanged(),this.model.maybeShow(),this.scrollDown(),Wc.trigger("chatRoomViewInitialized",this)},async render(){const e=!this.shouldShowSidebar();var t;this.el.setAttribute("id",this.model.get("box_id")),Qa((t={sidebar_hidden:e,model:this.model,occupants:this.model.occupants,show_sidebar:!this.model.get("hidden_occupants")&&this.model.session.get("connection_status")===tl.ROOMSTATUS.ENTERED,markScrolled:e=>this.markScrolled(e),muc_show_logs_before_join:Wc.settings.get("muc_show_logs_before_join"),show_send_button:qc.show_send_button},Ka(by(),t.show_send_button?"chat-content-sendbutton":"",t.markScrolled,t.sidebar_hidden?"hidden":"",t.occupants,t.model)),this.el),this.notifications=this.el.querySelector(".chat-content__notifications"),this.content=this.el.querySelector(".chat-content"),this.msgs_container=this.el.querySelector(".chat-content__messages"),this.help_container=this.el.querySelector(".chat-content__help"),this.renderBottomPanel(),Wc.settings.get("muc_show_logs_before_join")||this.model.session.get("connection_status")===tl.RO
|
|||
|
/**
|
|||
|
* @module converse-headlines-view
|
|||
|
* @copyright 2020, the Converse.js contributors
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
*/
|
|||
|
const uw=tl.env.utils,dw=kv.extend({className:"chatbox headlines hidden",events:{"click .close-chatbox-button":"close","click .toggle-chatbox-button":"minimize","keypress textarea.chat-textarea":"onKeyDown"},async initialize(){this.initDebounced(),this.model.disable_mam=!0,this.listenTo(this.model,"change:hidden",e=>e.get("hidden")?this.hide():this.show()),this.listenTo(this.model,"destroy",this.remove),this.listenTo(this.model,"show",this.show),this.render(),this.listenTo(this.model.messages,"add",this.onMessageAdded),this.listenTo(this.model.messages,"remove",this.renderChatHistory),this.listenTo(this.model.messages,"rendered",this.maybeScrollDown),this.listenTo(this.model.messages,"reset",this.renderChatHistory),await this.model.messages.fetched,this.insertIntoDOM(),this.model.maybeShow(),this.scrollDown(),Wc.trigger("headlinesBoxViewInitialized",this)},render(){this.el.setAttribute("id",this.model.get("box_id"));const e=Ym(Object.assign(this.model.toJSON(),{info_close:"",label_personal_message:"",show_send_button:!1,show_toolbar:!1,unread_msgs:""}));return Qa(e,this.el),this.content=this.el.querySelector(".chat-content"),this.msgs_container=this.el.querySelector(".chat-content__messages"),this.renderChatContent(),this.renderHeading(),this},getNotifications:()=>[],getHeadingButtons(){const e=[];return Wc.settings.get("singleton")||e.push({a_class:"close-chatbox-button",handler:e=>this.close(e),i18n_text:Od("Close"),i18n_title:Od("Close these announcements"),icon_class:"fa-times",name:"close",standalone:"overlayed"===Wc.settings.get("view_mode")}),qc.api.hook("getHeadingButtons",this,e)},renderMessageForm:function(){},afterShown:function(){}}),hw=Wd.extend({tagName:"div",className:"controlbox-section",id:"headline",events:{"click .open-headline":"openHeadline"},initialize(){this.listenTo(this.model,"add",this.renderIfHeadline),this.listenTo(this.model,"remove",this.renderIfHeadline),this.listenTo(this.model,"destroy",this.renderIfHeadline),this.render(),this.insertIntoDOM()},toHTML(){return e={heading_headline:Od("Announcements"),headlineboxes:this.model.filter(e=>e.get("type")===qc.HEADLINES_TYPE),open_title:Od("Click to open this server message")},Ka(lw(),e.headlineboxes.length?"":"hidden",e.heading_headline,cw(e));var e},renderIfHeadline(e){return e&&e.get("type")===qc.HEADLINES_TYPE&&this.render()},openHeadline(e){e.preventDefault();const t=e.target.getAttribute("data-headline-jid");qc.chatboxes.get(t).maybeShow(!0)},insertIntoDOM(){const e=qc.chatboxviews.get("controlbox");e&&e.el.querySelector(".controlbox-pane").insertAdjacentElement("beforeEnd",this.el)}});tl.plugins.add("converse-headlines-view",{dependencies:["converse-headlines","converse-chatview"],overrides:{ControlBoxView:{renderControlBoxPane(){this.__super__.renderControlBoxPane.apply(this,arguments),this.renderHeadlinesPanel()}}},initialize(){const e={renderHeadlinesPanel(){return this.headlinepanel&&uw.isInDOM(this.headlinepanel.el)||(this.headlinepanel=new qc.HeadlinesPanel({model:qc.chatboxes}),Wc.trigger("headlinesPanelRendered")),this.headlinepanel}};qc.ControlBoxView&&Object.assign(qc.ControlBoxView.prototype,e),qc.HeadlinesBoxView=dw,qc.HeadlinesPanel=hw,Wc.listen.on("chatBoxViewsInitialized",()=>{const e=qc.chatboxviews;qc.chatboxes.on("add",t=>{e.get(t.get("id"))||t.get("type")!==qc.HEADLINES_TYPE||e.add(t.get("id"),new qc.HeadlinesBoxView({model:t}))})})}});var fw=n(175),pw=n.n(fw);
|
|||
|
/**
|
|||
|
* @module converse-notification
|
|||
|
* @copyright 2020, the Converse.js contributors
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
*/
|
|||
|
const{Strophe:gw}=tl.env,mw=tl.env.utils,vw="Notification"in window;let _w;function bw(){if(Wc.settings.get("update_title")){var e;_w=null!==(e=_w)&&void 0!==e?e:new tl.env.Favico({type:"circle",animation:"pop"});const t=qc.chatboxes.models.reduce((e,t)=>e+(t.get("num_unread")||0),0);_w.badge(t)}}function yw(){const e=Aw(['\n <fieldset class="form-group">\n <ul class="list-group">\n <li class="list-group-item active">',":</li>\n ","\n </ul>\n </fieldset>"]);return yw=function(){return e},e}function ww(){const e=Aw(['<div class="alert alert-','" role="alert">',"</div>"]);return ww=function(){return e},e}function Sw(){const e=Aw(["\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 Sw=function(){return e},e}function xw(){const e=Aw(['\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 xw=function(){return e},e}function Ew(){const e=Aw(['<div class="alert alert-','" role="alert">',"</div>"]);return Ew=function(){return e},e}function jw(){const e=Aw(["\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 jw=function(){return e},e}function Aw(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}tl.env.Favico=pw.a,tl.plugins.add("converse-notification",{dependencies:["converse-chatboxes"],initialize(){Wc.settings.extend({update_title:!0,notify_all_room_messages:!1,show_desktop_notifications:!0,show_chat_state_notifications:!1,chatstate_notification_blacklist:[],play_sounds:!0,sounds_path:Wc.settings.get("assets_path")+"/sounds/",notification_icon:"logo/conversejs-filled.svg",notification_delay:5e3,notify_nicknames_without_references:!1}),qc.shouldNotifyOfGroupMessage=function(e){if(!(null==e?void 0:e.body))return!1;const t=e.from,n=e.from_muc,r=Wc.settings.get("notify_all_room_messages"),i=qc.chatboxes.get(n),o=gw.getResourceFromJid(t),s=o&&gw.unescapeNode(o)||"";let a=!1;const c=i.get("nick");Wc.settings.get("notify_nicknames_without_references")&&(a=new RegExp("\\b".concat(c,"\\b")).test(e.body));const l=e.references.map(e=>e.value).includes(c),u=s!==c,d=!0===r||Array.isArray(r)&&r.includes(n)||l||a;return u&&!!d},qc.isMessageToHiddenChat=function(e){var t,n;return null!==(t=null===(n=qc.chatboxes.get(e.from))||void 0===n?void 0:n.isHidden())&&void 0!==t&&t},qc.shouldNotifyOfMessage=function(e){const{attrs:t,stanza:n}=e;if(!t||null!==n.querySelector("forwarded"))return!1;if("groupchat"===t.type)return qc.shouldNotifyOfGroupMessage(t);if(t.is_headline)return q
|
|||
|
/**
|
|||
|
* @module converse-profile
|
|||
|
* @copyright The Converse.js contributors
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
*/
|
|||
|
const rS=tl.env.utils;tl.plugins.add("converse-profile",{dependencies:["converse-status","converse-modal","converse-vcard","converse-chatboxviews"],initialize(){Wc.settings.extend({allow_adhoc_commands:!0,show_client_info:!0}),qc.ProfileModal=mh.extend({id:"user-profile-modal",events:{"submit .profile-form":"onFormSubmitted"},initialize(){this.listenTo(this.model,"change",this.render),mh.prototype.initialize.apply(this,arguments),Wc.trigger("profileModalInitialized",this.model)},toHTML(){return(e=>{const t=Od("Your Profile"),n=Od("Email"),r=Od("Full Name"),i=Od("XMPP Address (JID)"),o=Od("Nickname"),s=Od("Role"),a=Od("Save and close"),c=Od("Use commas to separate multiple roles. Your roles are shown next to your name on your chat messages."),l=Od("URL"),u=Od("OMEMO"),d=Od("Profile"),h=Ka(Vw(),d,u);return Ka(Ww(),t,ih,qc.pluggable.plugins["converse-omemo"].enabled(qc)&&h||"",e.image,e.width,e.height,i,e.jid,r,e.fullname||"",o,e.nickname||"",l,e.url||"",n,e.email||"",s,e.role||"",c,a,qc.pluggable.plugins["converse-omemo"].enabled(qc)&&nS(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 Xd.a.Tab(e))},async setVCard(e){try{await Wc.vcard.set(qc.bare_jid,e)}catch(e){return Pn.fatal(e),void this.alert([Od("Sorry, an error happened while trying to save your profile data."),Od("You can check your browser's developer console for any error output.")].join(" "))}this.modal.hide()},onFormSubmitted(e){e.preventDefault();const t=new FileReader,n=new FormData(e.target),r=n.get("image"),i={fn:n.get("fn"),nickname:n.get("nickname"),role:n.get("role"),email:n.get("email"),url:n.get("url")};r.size?(t.onloadend=()=>{Object.assign(i,{image:btoa(t.result),image_type:r.type}),this.setVCard(i)},t.readAsBinaryString(r)):(Object.assign(i,{image:this.model.vcard.get("image"),image_type:this.model.vcard.get("image_type")}),this.setVCard(i))}}),qc.ChatStatusModal=mh.extend({id:"modal-status-change",events:{"submit form#set-xmpp-status":"onFormSubmitted","click .clear-input":"clearStatusMessage"},toHTML(){return e=Object.assign(this.model.toJSON(),this.model.vcard.toJSON(),{label_away:Od("Away"),label_busy:Od("Busy"),label_cancel:Od("Cancel"),label_close:Od("Close"),label_custom_status:Od("Custom status"),label_offline:Od("Offline"),label_online:Od("Online"),label_save:Od("Save"),label_xa:Od("Away for long"),modal_title:Od("Change chat status"),placeholder_status_message:Od("Personal status message")}),Ka(Lw(),e.modal_title,ih,"online"===e.status,e.label_online,"busy"===e.status,e.label_busy,"away"===e.status,e.label_away,"xa"===e.status,e.label_xa,e.status_message||"",e.placeholder_status_message,e.status_message?"":"hidden",e.label_save);var e},afterRender(){this.el.addEventListener("shown.bs.modal",()=>{this.el.querySelector('input[name="status_message"]').focus()},!1)},clearStatusMessage(e){e&&e.preventDefault&&(e.preventDefault(),rS.hideElement(this.el.querySelector(".clear-input"))),this.el.querySelector('input[name="status_message"]').value=""},onFormSubmitted(e){e.preventDefault();const t=new FormData(e.target);this.model.save({status_message:t.get("status_message"),status:t.get("chat_status")}),this.modal.hide()}}),qc.XMPPStatusView=qc.ViewWithAvatar.extend({tagName:"div",events:{"click a.show-profile":"showProfileModal","click a.change-status":"showStatusChangeModal","click .logout":"logOut"},initialize(){this.listenTo(this.model,"change",this.render),this.listenTo(this.model.vcard,"change",this.render)},toHTML(){const e=this.model.get("status")||"offline";return(e=>{const t=Od("Log out"),n=Od("Click to change your chat status"),r=Od("Show details about this chat client"),i=Wc.settings.get("show_client_info")||Wc.settings.get("allow_adhoc_commands");return Ka(qw(),e.fullname,i?Ka(Bw(),r,e.showUserSettingsModal):"",Wc.settings.get("allow_logout")?Ka(Fw(),t):"",n,e.chat_status,e.cha
|
|||
|
/**
|
|||
|
* @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 lS=function(){return e},e}const{Strophe:uS,sizzle:dS,$build:hS,$iq:fS,$msg:pS}=tl.env,gS=tl.env.utils;uS.addNamespace("OMEMO_DEVICELIST",uS.NS.OMEMO+".devicelist"),uS.addNamespace("OMEMO_VERIFICATION",uS.NS.OMEMO+".verification"),uS.addNamespace("OMEMO_WHITELISTED",uS.NS.OMEMO+".whitelisted"),uS.addNamespace("OMEMO_BUNDLES",uS.NS.OMEMO+".bundles");const mS={name:"AES-GCM",length:128};class vS extends Error{constructor(e,t){super(e,t),this.name="IQError",this.iq=t}}function _S(e,t){return t.is_encrypted&&t.encrypted.key?!0===t.encrypted.prekey?async function(e){const t=SS(e.from,parseInt(e.encrypted.device_id,10)),n=gS.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,ES(t))}try{const t=await xS(e,r);return await qc.omemo_store.generateMissingPreKeys(),await qc.omemo_store.publishBundle(),t?Object.assign(e,{plaintext:t}):Object.assign(e,{is_only_key:!0})}catch(t){return Pn.error("".concat(t.name," ").concat(t.message)),Object.assign(e,ES(t))}}(t):async function(e){const t=e.from_muc?e.from_real_jid:e.from;t||Object.assign(e,{error_text:Od("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=SS(t,parseInt(e.encrypted.device_id,10)),r=gS.base64ToArrayBuffer(e.encrypted.key);try{const t=await n.decryptWhisperMessage(r,"binary"),i=await xS(e,t);return Object.assign(e,{plaintext:i})}catch(t){return Pn.error("".concat(t.name," ").concat(t.message)),Object.assign(e,ES(t))}}(t):t}function bS(){qc.chatboxes.on("add",e=>{MS(e),e.get("type")===qc.CHATROOMS_TYPE&&(e.occupants.on("add",t=>async function(e,t){if(t.isSelf()||!e.features.get("nonanonymous")||!e.features.get("membersonly"))return;if(e.get("omemo_active")){await qc.contactHasOMEMOSupport(t.get("jid"))||(e.createMessage({message:Od("%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",()=>MS(e)))})}function yS(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 wS=tl.env.omemo={async encryptMessage(e){const t=crypto.getRandomValues(new window.Uint8Array(12)),n=await crypto.subtle.generateKey(mS,!0,["encrypt","decrypt"]),r={name:"AES-GCM",iv:t,tagLength:128},i=await crypto.subtle.encrypt(r,n,gS.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:gS.appendArrayBuffer(c,a),payload:gS.arrayBufferToBase64(s),iv:gS.arrayBufferToBase64(t)}},async decryptMessage(e){const t=await crypto.subtle.importKey("raw",e.key,mS,!0,["encrypt","decrypt"]),n=gS.appendArrayBuffer(gS.base64ToArrayBuffer(e.payload),e.tag),r={name:"AES-GCM",iv:gS.base64ToArrayBuffer(e.iv),tagLength:128};return gS.arrayBufferToString(await crypto.subtle.decrypt(r,t,n))}};function SS(e,t){const n=new libsignal.SignalProtocolAddress(e,t);return new window.libsignal.SessionCipher(qc.omemo_store,n)}async function xS(e,t){const n=e.encrypted,r=qc.devicelists.getDeviceList(e.from);await r._devices_promise;let i=r.get(n.device_id);if(i||(i=await r.devices.create({id:n.device_id,jid:e.from},{promise:!0})),n.payloa
|
|||
|
/**
|
|||
|
* @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:zS,$iq:LS}=tl.env;zS.addNamespace("PUSH","urn:xmpp:push:0"),tl.plugins.add("converse-push",{initialize(){async function e(e){e=e||qc.bare_jid;const t=qc.session.get("push_enabled")||[];if(t.includes(e))return;const n=Wc.settings.get("push_app_servers").filter(e=>!e.disable),r=Wc.settings.get("push_app_servers").filter(e=>e.disable),i=n.map(t=>async function(e,t){if(!t.jid||!t.node)return;if(!await Wc.disco.getIdentity("pubsub","push",t.jid))return Pn.warn('Not enabling push the service "'.concat(t.jid,"\", it doesn't have the right disco identtiy."));const n=await Promise.all([Wc.disco.supports(zS.NS.PUSH,t.jid),Wc.disco.supports(zS.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=LS({type:"set"});return e!==qc.bare_jid&&r.attrs({to:e}),r.c("enable",{xmlns:zS.NS.PUSH,jid:t.jid,node:t.node}),t.secret&&r.c("x",{xmlns:zS.NS.XFORM,type:"submit"}).c("field",{var:"FORM_TYPE"}).c("value").t("".concat(zS.NS.PUBSUB,"#publish-options")).up().up().c("field",{var:"secret"}).c("value").t(t.secret),Wc.sendIQ(r)}(e,t)),o=r.map(t=>async function(e,t){if(!t.jid)return;if(!await Wc.disco.supports(zS.NS.PUSH,e||qc.bare_jid))return void Pn.warn('Not disabling push app server "'.concat(t.jid,'", no disco support from your server.'));const n=LS({type:"set"});e!==qc.bare_jid&&n.attrs({to:e}),n.c("disable",{xmlns:zS.NS.PUSH,jid:t.jid}),t.node&&n.attrs({node:t.node}),Wc.sendIQ(n).catch(e=>{Pn.error("Could not disable push app server for ".concat(t.jid)),Pn.error(e)})}(e,t));try{await Promise.all(i.concat(o))}catch(e){Pn.error("Could not enable or disable push App Server"),e&&Pn.error(e)}finally{t.push(e)}qc.session.save("push_enabled",t)}function t(t){t.get("type")==qc.CHATROOMS_TYPE&&e(zS.getDomainFromJid(t.get("jid")))}Wc.settings.extend({push_app_servers:[],enable_muc_push:!1}),Wc.listen.on("statusInitialized",()=>e()),Wc.settings.get("enable_muc_push")&&Wc.listen.on("chatBoxesInitialized",()=>qc.chatboxes.on("add",t))}});var FS=n(176),BS=n.n(FS),qS=n(177),US=n.n(qS),HS=n(178),$S=n.n(HS);
|
|||
|
/**
|
|||
|
* @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:WS,sizzle:VS,$iq:GS}=tl.env,JS=tl.env.utils;WS.addNamespace("REGISTER","jabber:iq:register");const QS=Object.keys(WS.Status).reduce((e,t)=>Math.max(e,WS.Status[t]),0);function YS(){const e=tx(['\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 YS=function(){return e},e}function KS(){const e=tx(['\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 KS=function(){return e},e}function XS(){const e=tx(['<span class="list-item-badge badge badge--muc msgs-indicator">',"</span>"]);return XS=function(){return e},e}function ZS(){const e=tx(['\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 ZS=function(){return e},e}function ex(){const e=tx(['\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 ex=function(){return e},e}function tx(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}WS.Status.REGIFAIL=QS+1,WS.Status.REGISTERED=QS+2,WS.Status.CONFLICT=QS+3,WS.Status.NOTACCEPTABLE=QS+5,tl.plugins.add("converse-register",{enabled:()=>!0,overrides:{ControlBoxView:{renderLoginPanel(){return this.__super__.renderLoginPanel.apply(this,arguments),this.renderRegistrationPanel(),this}}},initialize(){function e(e){Wc.waitUntil("controlBoxInitialized").then(()=>{qc.chatboxes.get("controlbox").set({"active-form":e})}).catch(e=>Pn.fatal(e))}qc.CONNECTION_STATUS[WS.Status.REGIFAIL]="REGIFAIL",qc.CONNECTION_STATUS[WS.Status.REGISTERED]="REGISTERED",qc.CONNECTION_STATUS[WS.Status.CONFLICT]="CONFLICT",qc.CONNECTION_STATUS[WS.Status.NOTACCEPTABLE]="NOTACCEPTABLE",Wc.settings.extend({allow_registration:!0,domain_placeholder:Od(" e.g. conversejs.org"),providers_link:"https://compliance.conversations.im/",registration_domain:""}),Object.assign(qc.ControlBoxView.prototype,{showLoginOrRegisterForm(){this.registerpanel&&("register"==this.model.get("active-form")?(this.loginpanel.el.classList.add("hidden"),this.registerpanel.el.classList.remove("hidden")):(this.loginpanel.el.classList.remove("hidden"),this.registerpanel.el.classList.add("hidden")))},renderRegistrationPanel(){if(Wc.settings.get("allow_registration")){this.registerpanel=new qc.RegisterPanel({model:this.model}),this.registerpanel.render(),this.registerpanel.el.classList.add("hidden");const e=this.el.querySelector("#converse-login-panel");e&&e.insertAdjacentElement("afterend",this.registerpanel.el),this.showLoginOrRegisterForm()}return this}}),qc.router.route("converse/login",()=>e("login")),qc.router.route("converse/register",()=>e("register")),qc.RegisterPanel=Wd.extend({tagName:"div",id:"converse-register-panel",className:"controlbox-pane fade-in",events:{"submit form#converse-register":"onFormSubmission","click .button-cancel":"renderProviderChoiceForm"},initialize(){this.reset(),Wc.listen.on("connectionInitialized",()=>this.registerHooks())},render(){r
|
|||
|
/**
|
|||
|
* @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:rx}=tl.env,ix=tl.env.utils;function ox(){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 ox=function(){return e},e}tl.plugins.add("converse-roomslist",{dependencies:["converse-singleton","converse-controlbox","converse-muc","converse-bookmarks"],initialize(){Wc.promises.add("roomsListInitialized"),qc.RoomsList=Fo.extend({defaults:{"toggle-state":qc.OPENED}}),qc.RoomsListView=Wd.extend({tagName:"span",initialize(){this.listenTo(this.model,"add",this.renderIfChatRoom),this.listenTo(this.model,"remove",this.renderIfChatRoom),this.listenTo(this.model,"destroy",this.renderIfChatRoom),this.listenTo(this.model,"change",this.renderIfRelevantChange);const e="converse.roomslist".concat(qc.bare_jid);this.list_model=new qc.RoomsList({id:e}),this.list_model.browserStorage=qc.createStore(e),this.list_model.fetch(),this.render(),this.insertIntoControlBox()},renderIfChatRoom(e){ix.isChatRoom(e)&&this.render()},renderIfRelevantChange(e){const t=["bookmarked","hidden","name","num_unread","num_unread_general"],n=e.changed||{};ix.isChatRoom(e)&&Object.keys(n).filter(e=>t.includes(e)).length&&this.render()},toHTML(){return(e=>{const t=Od("Click to toggle the list of open groupchats");return Ka(YS(),e.rooms.length?"":"hidden",t,e.toggleRoomsList,e.toggle_state===e._converse.OPENED?"fa-caret-down":"fa-caret-right",Od("Open Groupchats"),e.collapsed&&"collapsed",e.rooms.map(t=>nx(Object.assign({room:t},e))))})({_converse:qc,addBookmark:e=>this.addBookmark(e),allow_bookmarks:qc.allow_bookmarks&&qc.bookmarks,closeRoom:e=>this.closeRoom(e),collapsed:this.list_model.get("toggle-state")!==qc.OPENED,currently_open:e=>
|
|||
|
/**
|
|||
|
* @module converse-rosterview
|
|||
|
* @copyright 2020, the Converse.js contributors
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
*/
|
|||
|
const{Strophe:vx}=tl.env,_x=tl.env.utils;tl.plugins.add("converse-rosterview",{dependencies:["converse-roster","converse-modal","converse-chatboxviews"],initialize(){Wc.settings.extend({autocomplete_add_contact:!0,allow_chat_pending_contacts:!0,allow_contact_removal:!0,hide_offline_users:!1,roster_groups:!0,xhr_user_search_url:null}),Wc.promises.add("rosterViewInitialized");const e={dnd:Od("This contact is busy"),online:Od("This contact is online"),offline:Od("This contact is offline"),unavailable:Od("This contact is unavailable"),xa:Od("This contact is away for an extended period"),away:Od("This contact is away")};function t(){Wc.settings.get("authentication")!==qc.ANONYMOUS&&(qc.rosterview=new qc.RosterView({model:qc.rostergroups}),qc.rosterview.render(),Wc.trigger("rosterViewInitialized"))}qc.AddContactModal=mh.extend({id:"add-contact-modal",events:{"submit form":"addContactFromForm"},initialize(){mh.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change",this.render)},toHTML(){const e=Wc.settings.get("xhr_user_search_url")?Od("Contact name"):Od("Optional nickname");return(e=>{const t=Od("name@example.org"),n=Od("Add"),r=Od("Please enter a valid XMPP address"),i=Od("Add a Contact"),o=Od("XMPP Address"),s=Od("Nickname");return Ka(ox(),i,ih,o,!e._converse.xhr_user_search_url,e.jid||"",t,s,e.nickname||"",s,r,n)})(Object.assign(this.model.toJSON(),{_converse:qc,label_nickname:e}))},afterRender(){"string"==typeof Wc.settings.get("xhr_user_search_url")?this.initXHRAutoComplete():this.initJIDAutoComplete();const e=this.el.querySelector('input[name="jid"]');this.el.addEventListener("shown.bs.modal",()=>e.focus(),!1)},initJIDAutoComplete(){if(!Wc.settings.get("autocomplete_add_contact"))return;const e=this.el.querySelector(".suggestion-box__jid").parentElement;this.jid_auto_complete=new qc.AutoComplete(e,{data:(e,t)=>"".concat(t.slice(0,t.indexOf("@")),"@").concat(e),filter:qc.FILTER_STARTSWITH,list:[...new Set(qc.roster.map(e=>vx.getDomainFromJid(e.get("jid"))))]})},initXHRAutoComplete(){if(!Wc.settings.get("autocomplete_add_contact"))return this.initXHRFetch();const e=this.el.querySelector(".suggestion-box__name").parentElement;this.name_auto_complete=new qc.AutoComplete(e,{auto_evaluate:!1,filter:qc.FILTER_STARTSWITH,list:[]});const t=new window.XMLHttpRequest;t.onload=()=>{if(t.responseText){const e=t.responseText;this.name_auto_complete.list=JSON.parse(e).map(e=>({label:e.fullname||e.jid,value:e.jid})),this.name_auto_complete.auto_completing=!0,this.name_auto_complete.evaluate()}};const n=this.el.querySelector('input[name="name"]');n.addEventListener("input",Ic(()=>{t.open("GET","".concat(Wc.settings.get("xhr_user_search_url"),"q=").concat(encodeURIComponent(n.value)),!0),t.send()},300)),this.name_auto_complete.on("suggestion-box-selectcomplete",e=>{this.el.querySelector('input[name="name"]').value=e.text.label,this.el.querySelector('input[name="jid"]').value=e.text.value})},initXHRFetch(){this.xhr=new window.XMLHttpRequest,this.xhr.onload=()=>{if(this.xhr.responseText){const e=this.xhr.responseText,t=JSON.parse(e).map(e=>({label:e.fullname||e.jid,value:e.jid}));if(1!==t.length){const e=this.el.querySelector(".invalid-feedback");return e.textContent=Od("Sorry, could not find a contact with that name"),void _x.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?(_x.addClass("is-invalid",this.el.querySelector('input[name="jid"]')),_x.addClass("d-block",t),!1):qc.roster.get(vx.getBareJidFromJid(e))?(t.textContent=Od("This contact has already been added"),_x.addClass("d-block",t),!1):(_x.removeClass("d-block",t),!0)},afterSubmission(e,t,n){qc.roster.addAndSubscribe(t,n),this.model.clear(),this.modal.hide()},addContactFromForm(e){e.preventDefault();const t=new FormData(e.target),n=(t.get("jid")||"").trim();if(!n&&"string"==typeof Wc.settings.get("xhr_user_search_url")){const e=this.el.querySelecto
|
|||
|
/**
|
|||
|
* @description Converse.js (A browser based XMPP chat client)
|
|||
|
* @copyright 2020, The Converse developers
|
|||
|
* @license Mozilla Public License (MPLv2)
|
|||
|
*/const bx=["converse-autocomplete","converse-bookmark-views","converse-chatboxviews","converse-chatview","converse-controlbox","converse-dragresize","converse-fullscreen","converse-mam-views","converse-minimize","converse-modal","converse-muc-views","converse-headlines-view","converse-notification","converse-omemo","converse-profile","converse-push","converse-register","converse-roomslist","converse-rosterview","converse-singleton"];i.a.templateSettings={escape:/\{\{\{([\s\S]+?)\}\}\}/g,evaluate:/\{\[([\s\S]+?)\]\}/g,interpolate:/\{\{([\s\S]+?)\}\}/g,imports:{_:i.a}},tl.env._=i.a;const yx=tl.initialize;tl.initialize=function(e,t){return Array.isArray(e.whitelisted_plugins)?e.whitelisted_plugins=e.whitelisted_plugins.concat(bx):e.whitelisted_plugins=bx,yx(e,t)};t.default=tl}]);
|
|||
|
//# sourceMappingURL=converse.min.js.map
|