1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/converse_ynh.git synced 2024-09-03 18:25:53 +02:00
converse_ynh/sources/dist/converse.min.js

2250 lines
1 MiB
JavaScript
Raw Normal View History

2021-11-11 22:06:49 +01:00
/*! For license information please see converse.min.js.LICENSE.txt */
2022-01-03 11:54:10 +01:00
(()=>{var e,t,n,s,i={4567:(e,t,n)=>{"use strict";const s=n(4095),i=n(257);e.exports={atob:s,btoa:i}},4095:e=>{"use strict";function t(e){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e);return t<0?void 0:t}e.exports=function(e){if((e=(e=`${e}`).replace(/[ \t\n\f\r]/g,"")).length%4==0&&(e=e.replace(/==?$/,"")),e.length%4==1||/[^+/0-9A-Za-z]/.test(e))return null;let n="",s=0,i=0;for(let r=0;r<e.length;r++)s<<=6,s|=t(e[r]),i+=6,24===i&&(n+=String.fromCharCode((16711680&s)>>16),n+=String.fromCharCode((65280&s)>>8),n+=String.fromCharCode(255&s),s=i=0);return 12===i?(s>>=4,n+=String.fromCharCode(s)):18===i&&(s>>=2,n+=String.fromCharCode((65280&s)>>8),n+=String.fromCharCode(255&s)),n}},257:e=>{"use strict";function t(e){if(e>=0&&e<64)return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[e]}e.exports=function(e){let n;for(e=`${e}`,n=0;n<e.length;n++)if(e.charCodeAt(n)>255)return null;let s="";for(n=0;n<e.length;n+=3){const i=[void 0,void 0,void 0,void 0];i[0]=e.charCodeAt(n)>>2,i[1]=(3&e.charCodeAt(n))<<4,e.length>n+1&&(i[1]|=e.charCodeAt(n+1)>>4,i[2]=(15&e.charCodeAt(n+1))<<2),e.length>n+2&&(i[2]|=e.charCodeAt(n+2)>>6,i[3]=63&e.charCodeAt(n+2));for(let e=0;e<i.length;e++)void 0===i[e]?s+="=":s+=t(i[e])}return s}},6561:(e,t,n)=>{e.exports={default:n(1966),__esModule:!0}},5460:(e,t,n)=>{e.exports={default:n(4064),__esModule:!0}},9251:(e,t,n)=>{e.exports={default:n(9791),__esModule:!0}},1683:(e,t,n)=>{"use strict";t.__esModule=!0;var s,i=(s=n(9251))&&s.__esModule?s:{default:s};t.default=function(e){return function(){var t=e.apply(this,arguments);return new i.default((function(e,n){return function s(r,o){try{var a=t[r](o),c=a.value}catch(e){return void n(e)}if(!a.done)return i.default.resolve(c).then((function(e){s("next",e)}),(function(e){s("throw",e)}));e(c)}("next")}))}}},8339:(e,t,n)=>{"use strict";t.__esModule=!0;var s,i=(s=n(6561))&&s.__esModule?s:{default:s};t.default=function(e,t,n){return t in e?(0,i.default)(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},342:(e,t,n)=>{var s=function(){return this}()||Function("return this")(),i=s.regeneratorRuntime&&Object.getOwnPropertyNames(s).indexOf("regeneratorRuntime")>=0,r=i&&s.regeneratorRuntime;if(s.regeneratorRuntime=void 0,e.exports=n(5987),i)s.regeneratorRuntime=r;else try{delete s.regeneratorRuntime}catch(e){s.regeneratorRuntime=void 0}},5987:e=>{!function(t){"use strict";var n,s=Object.prototype,i=s.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",c=r.toStringTag||"@@toStringTag",l=t.regeneratorRuntime;if(l)e.exports=l;else{(l=t.regeneratorRuntime=e.exports).wrap=b;var d="suspendedStart",u="suspendedYield",h="executing",f="completed",m={},g={};g[o]=function(){return this};var p=Object.getPrototypeOf,v=p&&p(p(N([])));v&&v!==s&&i.call(v,o)&&(g=v);var y=x.prototype=w.prototype=Object.create(g);S.prototype=y.constructor=x,x.constructor=S,x[c]=S.displayName="GeneratorFunction",l.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===S||"GeneratorFunction"===(t.displayName||t.name))},l.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,c in e||(e[c]="GeneratorFunction")),e.prototype=Object.create(y),e},l.awrap=function(e){return{__await:e}},E(A.prototype),A.prototype[a]=function(){return this},l.AsyncIterator=A,l.async=function(e,t,n,s){var i=new A(b(e,t,n,s));return l.isGeneratorFunction(t)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},E(y),y[c]="Generator",y[o]=function(){return this},y.toString=function(){return"[object Generator]"},l.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var s=t.pop();if(s in e)return n.value=s,n.done=!1,n}return n.done=!0,n}},l.values=N,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(k),!e)for(var t in this)"t"===t.charAt(0)&&i.call(this
2021-03-19 19:26:15 +01:00
draggable="false"
2021-11-11 22:06:49 +01:00
title="${s}"
2021-03-19 19:26:15 +01:00
alt="${n}"
2022-01-03 11:54:10 +01:00
src="${t}/72x72/${e.cp}.png"/>`}}return t.unicode_only?s:el`<img class="emoji"
2021-03-19 19:26:15 +01:00
draggable="false"
2021-11-11 22:06:49 +01:00
title="${s}"
alt="${s}"
2022-01-03 11:54:10 +01:00
src="${$l.emojis.by_sn[s].url}">`}function fu(e){if(!$l.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($l.emojis.shortnames_regex)].filter((e=>e[0].length>0)).map((e=>{const t=$l.emojis.by_sn[e[0]].cp;return{cp:t,begin:e.index,end:e.index+e[0].length,shortname:e[0],emoji:t?du(t):null}}))}function mu(e){const t=[];return function(e,n){const s=/\uFE0F/g,i=String.fromCharCode(8205);String(e).replace(au,((e,n,r)=>{const o=function(e){const t=[];let n=0,s=0;for(;s<e.length;){const i=e.charCodeAt(s++);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(i)<0?e.replace(s,""):e);o&&((e,n,s)=>{var i;t.push({begin:s,cp:e,emoji:n,end:s+n.length,shortname:(null===(i=cu.getEmojisByAtrribute("cp")[e])||void 0===i?void 0:i.sn)||""})})(o,e,r)}))}(e),t}$l.plugins.add("converse-emoji",{initialize(){const{___:e}=wa;jl.settings.extend({emoji_image_path:"https://twemoji.maxcdn.com/v/12.1.6/",emoji_categories:{smileys:":grinning:",people:":thumbsup:",activity:":soccer:",travel:":motorcycle:",objects:":bomb:",nature:":rainbow:",food:":hotdog:",symbols:":musical_note:",flags:":flag_ac:",custom:null},emoji_category_labels:{smileys:e("Smileys and emotions"),people:e("People"),activity:e("Activities"),travel:e("Travel"),objects:e("Objects"),nature:e("Animals and nature"),food:e("Food and drink"),symbols:e("Symbols"),flags:e("Flags"),custom:e("Stickers")}}),wa.EmojiPicker=Xo.extend({defaults:{current_category:"smileys",current_skintone:"",scroll_position:0}});const t={};Object.assign(cu,{shortnamesToEmojis:(e,t={unicode_only:!1,add_title_wrapper:!1})=>function(e,t){let n=[e];return[...fu(e),...mu(e)].sort(((e,t)=>t.begin-e.begin)).forEach((e=>{const s=n.shift(),i=hu(e,t);n="string"==typeof i?[s.slice(0,e.begin)+i+s.slice(e.end),...n]:[s.slice(0,e.begin),i,s.slice(e.end),...n]})),n}(e=uu(e),t),shortnamesToUnicode:e=>cu.shortnamesToEmojis(e,{unicode_only:!0})[0],isOnlyEmojis(e){const t=e.trim().split(/\s+/);return!(0===t.length||t.length>3)&&t.filter((e=>{const t=mu(cu.shortnamesToUnicode(e));return 1===t.length&&(e===t[0].shortname||e===t[0].emoji)})).length===t.length},getEmojisByAtrribute(e){if(t[e])return t[e];if("category"===e)return $l.emojis.json;const n=$l.emojis.list.map((t=>t[e])).filter(((e,t,n)=>n.indexOf(e)==t));return t[e]={},n.forEach((n=>t[e][n]=$l.emojis.list.find((t=>t[e]===n)))),t[e]}}),Object.assign(jl,{emojis:{async initialize(){if(!$l.emojis.initialized){$l.emojis.initialized=!0;const{default:t}=await n.e(4610).then(n.t.bind(n,7530,19));$l.emojis.json=t,$l.emojis.by_sn=Object.keys(t).reduce(((e,n)=>Object.assign(e,t[n])),{}),$l.emojis.list=Object.values($l.emojis.by_sn),$l.emojis.list.sort(((e,t)=>e.sn<t.sn?-1:e.sn>t.sn?1:0)),$l.emojis.shortnames=$l.emojis.list.map((e=>e.sn));const s=()=>$l.emojis.shortnames.map((e=>e.replace(/[+]/g,"\\$&"))).join("|");$l.emojis.shortnames_regex=new RegExp(s(),"gi"),$l.emojis.toned=($l.emojis.toned||($l.emojis.toned=(e=Object.values($l.emojis.json.people).filter((e=>e.sn.includes("_tone"))).map((e=>e.sn.replace(/_tone[1-5]/,""))),[...new Set(e)])),$l.emojis.toned),$l.emojis.initialized_promise.resolve()}var e;return $l.emojis.initialized_promise}}})}});const gu={initialize(){this.checkValidity()&&(this.get("file")&&this.on("change:put",this.uploadFile,this),this.setTimerForEphemeralMessage()||this.setOccupant(),jl.trigger("chatRoomMessageInitialized",this))},getDisplayName(){var e;return(null===(e=this.occupant)||void 0===e?void 0:e.getDisplayName())||this.get("nick")},mayBeModerated(){if(void 0!==this.get("from_muc"))return["all","moderator"].includes(jl.settings.get("allow_message_retraction"))&&this.get(`stanza_id ${this.get("from_muc")}`)&&this.collection.chatbox.canModerateMessages()},checkValidity(){const e=wa.Message.prototype.checkValidity.call(this);return!e&&this.collection.chatbox.debouncedRejoin(),e},onOccupantRemoved(){var e;this.stopListeni
2021-03-19 19:26:15 +01:00
<form class="converse-form chatroom-form" @submit=${e.onSubmit}>
<legend>${t}</legend>
<fieldset class="form-group">
<label for="converse_muc_bookmark_name">${i}</label>
<input class="form-control" type="text" value="${e.name}" name="name" required="required" id="converse_muc_bookmark_name"/>
</fieldset>
<fieldset class="form-group">
2021-11-11 22:06:49 +01:00
<label for="converse_muc_bookmark_nick">${r}</label>
2021-03-19 19:26:15 +01:00
<input class="form-control" type="text" name="nick" value="${e.nick||""}" id="converse_muc_bookmark_nick"/>
</fieldset>
<fieldset class="form-group form-check">
<input class="form-check-input" id="converse_muc_bookmark_autojoin" type="checkbox" name="autojoin"/>
<label class="form-check-label" for="converse_muc_bookmark_autojoin">${n}</label>
</fieldset>
<fieldset class="form-group">
<input class="btn btn-primary" type="submit" value="${o}">
2021-11-11 22:06:49 +01:00
<input class="btn btn-secondary button-cancel" type="button" value="${s}" @click=${e.onCancel}>
2021-03-19 19:26:15 +01:00
</fieldset>
</form>
2022-01-03 11:54:10 +01:00
`})(Object.assign(this.model.toJSON(),{onCancel:e=>this.closeBookmarkForm(e),onSubmit:e=>this.onBookmarkFormSubmitted(e)}))}onBookmarkFormSubmitted(e){var t,n,s;e.preventDefault(),wa.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===(s=e.target.querySelector("input[name=nick]"))||void 0===s?void 0:s.value}),this.closeBookmarkForm(e)}closeBookmarkForm(e){e.preventDefault(),this.model.session.save("view",null)}}jl.elements.define("converse-muc-bookmark-form",_g);const wg=_g,Sg=Je((function(e,t,n){var s=-1,i="function"==typeof t,r=Ze(e)?Array(e.length):[];return ls(e,(function(e){r[++s]=i?ze(t,e,n):Ca(e,t,n)})),r}));function xg(e,t){if(jl.settings.get("allow_bookmarks")&&e.model.get("type")===wa.CHATROOMS_TYPE){const n=e.model.get("bookmarked"),s={i18n_title:Eh(n?"Unbookmark this groupchat":"Bookmark this groupchat"),i18n_text:Eh(n?"Unbookmark":"Bookmark"),handler:t=>e.toggleBookmark(t),a_class:"toggle-bookmark",icon_class:"fa-bookmark",name:"bookmark"},i=t.map((e=>e.name)).indexOf("details"),r=Nh().then((e=>e?s:null));return i>-1?[...t.slice(0,i),r,...t.slice(i)]:[r,...t]}return t}function Eg(e){e.preventDefault();const t=e.target.getAttribute("data-bookmark-name"),n=e.target.getAttribute("data-room-jid");confirm(Eh('Are you sure you want to remove the bookmark "%1$s"?',t))&&Sg(wa.bookmarks.where({jid:n}),Xo.prototype.destroy)}async function Ag(e){e.preventDefault();const t=e.target.getAttribute("data-room-jid");(await jl.rooms.open(t,{bring_to_foreground:!0})).session.save("view",$l.MUC.VIEWS.BOOKMARK)}function Cg(e){e.preventDefault();const{Strophe:t}=$l.env,n=e.target.textContent,s=e.target.getAttribute("data-room-jid"),i={name:n||t.unescapeNode(t.getNodeFromJid(s))||s};jl.rooms.open(s,i,!0)}const Tg=e=>{const t=e.bm.get("jid"),n=!(!jl.settings.get("hide_open_bookmarks")||!wa.chatboxes.get(t)),s=Eh("Unbookmark this groupchat"),i=Eh("Click to open this groupchat");return el`
2021-11-11 22:06:49 +01:00
<div class="list-item controlbox-padded room-item available-chatroom d-flex flex-row ${n?"hidden":""}" data-room-jid="${t}">
<a class="list-item-link open-room w-100" data-room-jid="${t}"
title="${i}"
2022-01-03 11:54:10 +01:00
@click=${Cg}>${e.bm.getDisplayName()}</a>
2021-11-11 22:06:49 +01:00
<a class="list-item-action remove-bookmark fa fa-bookmark align-self-center ${e.bm.get("bookmarked")?"button-on":""}"
data-room-jid="${t}"
data-bookmark-name="${e.bm.getDisplayName()}"
title="${s}"
2022-01-03 11:54:10 +01:00
@click=${Eg}></a>
2021-11-11 22:06:49 +01:00
</div>
2022-01-03 11:54:10 +01:00
`};"undefined"!=typeof Element&&Element.prototype;const kg=/^(\S+)\s*(.*)$/,jg=["model","collection","events"];class Ng extends HTMLElement{constructor(e){var t,n,s;super(),s={},(n="events")in(t=this)?Object.defineProperty(t,n,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[n]=s,this.cid=Ts("view"),this._domEvents=[],Ct(this,jo(e,jg))}createRenderRoot(){return this}connectedCallback(){this._initialized||(this.preinitialize.apply(this,arguments),this.initialize.apply(this,arguments),this._initialized=!0),this.delegateEvents()}disconnectedCallback(){this.undelegateEvents(),this.stopListening()}preinitialize(){}initialize(){}render(){return ve(this.beforeRender)&&this.beforeRender(),ve(this.toHTML)&&il(this.toHTML(),this),ve(this.afterRender)&&this.afterRender(),this}delegateEvents(){if(!this.events)return this;this.undelegateEvents();for(const e in this.events){let t=this.events[e];if(ve(t)||(t=this[t]),!t)continue;const n=e.match(kg);this.delegate(n[1],n[2],t.bind(this))}return this}delegate(e,t,n){const s=this;if(!s)return this;if("function"==typeof t&&(n=t,t=null),-1!==["focus","blur"].indexOf(e)){const s=this.querySelectorAll(t);for(let t=0,i=s.length;t<i;t++){const i=s[t];i.addEventListener(e,n,!1),this._domEvents.push({el:i,eventName:e,handler:n})}return n}const i=t?function(e){let i=e.target||e.srcElement;for(;i&&i!=s;i=i.parentNode)i.matches(t)&&(e.delegateTarget=i,n(e))}:n;return this.addEventListener(e,i,!1),this._domEvents.push({el:this,eventName:e,handler:i,listener:n,selector:t}),this}undelegateEvents(){if(this){for(let e=0,t=this._domEvents.length;e<t;e++){const t=this._domEvents[e];t.el.removeEventListener(t.eventName,t.handler,!1)}this._domEvents.length=0}return this}undelegate(e,t,n){if("function"==typeof t&&(n=t,t=null),this){const s=this._domEvents.slice();let i=s.length;for(;i--;){const r=s[i];!(r.eventName!==e||n&&r.listener!==n||t&&r.selector!==t)&&(r.el.removeEventListener(r.eventName,r.handler,!1),this._domEvents.splice(i,1))}}return this}}Object.assign(Ng.prototype,ks);const Og=$l.env.utils;class $g extends Ng{async initialize(){await jl.waitUntil("bookmarksInitialized"),this.listenTo(wa.bookmarks,"add",this.render),this.listenTo(wa.bookmarks,"remove",this.render),this.listenTo(wa.chatboxes,"add",this.render),this.listenTo(wa.chatboxes,"remove",this.render);const e=`converse.bookmarks-list-model-${wa.bare_jid}`;this.model=new wa.BookmarksList({id:e}),_o(this.model,e),this.model.fetch({success:()=>this.render(),error:(e,t)=>{M.error(t),this.render()}})}render(){il((e=>{const t=!!wa.bookmarks.getUnopenedBookmarks().length,n=Eh("Click to toggle the bookmarks list"),s=Eh("Bookmarks");return el`
2021-11-11 22:06:49 +01:00
<div class="list-container list-container--bookmarks ${t?"":"hidden"}">
<a class="list-toggle bookmarks-toggle controlbox-padded"
title="${n}"
@click=${e.toggleBookmarksList}>
2022-01-03 11:54:10 +01:00
<span class="fa ${e.toggle_state===wa.OPENED?"fa-caret-down":"fa-caret-right"}">
2021-11-11 22:06:49 +01:00
</span> ${s}</a>
2022-01-03 11:54:10 +01:00
<div class="items-list bookmarks rooms-list ${e.toggle_state!==wa.OPENED?"hidden":""}">
${wa.bookmarks.map((t=>Tg(Object.assign({bm:t},e))))}
2021-11-11 22:06:49 +01:00
</div>
</div>
2022-01-03 11:54:10 +01:00
`})({toggleBookmarksList:e=>this.toggleBookmarksList(e),toggle_state:this.model.get("toggle-state")}),this)}toggleBookmarksList(e){var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e);const n=e.target.matches(".fa")?e.target:e.target.querySelector(".fa");Og.hasClass("fa-caret-down",n)?(Og.slideIn(this.querySelector(".bookmarks")),this.model.save({"toggle-state":wa.CLOSED}),n.classList.remove("fa-caret-down"),n.classList.add("fa-caret-right")):(n.classList.remove("fa-caret-right"),n.classList.add("fa-caret-down"),Og.slideOut(this.querySelector(".bookmarks")),this.model.save({"toggle-state":wa.OPENED}))}}jl.elements.define("converse-bookmarks",$g);const{u:Ig}=$l.env,Mg={setBookmarkState(){void 0!==wa.bookmarks&&(wa.bookmarks.where({jid:this.model.get("jid")}).length?this.model.save("bookmarked",!0):this.model.save("bookmarked",!1))},renderBookmarkForm(){this.bookmark_form||(this.bookmark_form=new wa.MUCBookmarkForm({model:this.model,chatroomview:this}),this.querySelector(".chatroom-body").insertAdjacentElement("beforeend",this.bookmark_form.el)),Ig.showElement(this.bookmark_form.el)},toggleBookmark(e){null==e||e.preventDefault();const t=wa.bookmarks.where({jid:this.model.get("jid")});t.length?t.forEach((e=>e.destroy())):this.model.session.set("view",$l.MUC.VIEWS.BOOKMARK)}};var Rg=n(5251),Dg={};Dg.styleTagTransform=vg(),Dg.setAttributes=fg(),Dg.insert=ug().bind(null,"head"),Dg.domAPI=lg(),Dg.insertStyleElement=gg(),ag()(Rg.Z,Dg),Rg.Z&&Rg.Z.locals&&Rg.Z.locals,$l.plugins.add("converse-bookmark-views",{dependencies:["converse-chatboxes","converse-muc","converse-muc-views"],initialize(){jl.settings.extend({hide_open_bookmarks:!0}),wa.removeBookmarkViaEvent=Eg,wa.addBookmarkViaEvent=Ag,Object.assign(wa.ChatRoomView.prototype,Mg),wa.MUCBookmarkForm=wg,wa.BookmarksView=$g,jl.listen.on("getHeadingButtons",xg),jl.listen.on("chatRoomViewInitialized",(e=>e.setBookmarkState()))}});const Lg=e=>(...t)=>({_$litDirective$:e,values:t});class zg{constructor(e){}T(e,t,n){this.Σdt=e,this.M=t,this.Σct=n}S(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}const{et:Pg}=pl,Fg=()=>document.createComment(""),Ug=(e,t,n)=>{var s;const i=e.A.parentNode,r=void 0===t?e.B:t.A;if(void 0===n){const t=i.insertBefore(Fg(),r),s=i.insertBefore(Fg(),r);n=new Pg(t,s,e,e.options)}else{const t=n.B.nextSibling,o=n.M!==e;if(o&&(null===(s=n.Q)||void 0===s||s.call(n,e),n.M=e),t!==r||o){let e=n.A;for(;e!==t;){const t=e.nextSibling;i.insertBefore(e,r),e=t}}}return n},Bg=(e,t,n=e)=>(e.I(t,n),e),qg={},Hg=e=>{var t;null===(t=e.P)||void 0===t||t.call(e,!1,!0);let n=e.A;const s=e.B.nextSibling;for(;n!==s;){const e=n.nextSibling;n.remove(),n=e}},Gg=(e,t,n)=>{const s=new Map;for(let i=t;i<=n;i++)s.set(e[i],i);return s},Wg=Lg(class extends zg{constructor(e){if(super(e),2!==e.type)throw Error("repeat() can only be used in text expressions")}Mt(e,t,n){let s;void 0===n?n=t:void 0!==t&&(s=t);const i=[],r=[];let o=0;for(const t of e)i[o]=s?s(t,o):o,r[o]=n(t,o),o++;return{values:r,keys:i}}render(e,t,n){return this.Mt(e,t,n).values}update(e,[t,n,s]){var i;const r=(e=>e.H)(e),{values:o,keys:a}=this.Mt(t,n,s);if(!r)return this.Pt=a,o;const c=null!==(i=this.Pt)&&void 0!==i?i:this.Pt=[],l=[];let d,u,h=0,f=r.length-1,m=0,g=o.length-1;for(;h<=f&&m<=g;)if(null===r[h])h++;else if(null===r[f])f--;else if(c[h]===a[m])l[m]=Bg(r[h],o[m]),h++,m++;else if(c[f]===a[g])l[g]=Bg(r[f],o[g]),f--,g--;else if(c[h]===a[g])l[g]=Bg(r[h],o[g]),Ug(e,l[g+1],r[h]),h++,g--;else if(c[f]===a[m])l[m]=Bg(r[f],o[m]),Ug(e,r[h],r[f]),f--,m++;else if(void 0===d&&(d=Gg(a,m,g),u=Gg(c,h,f)),d.has(c[h]))if(d.has(c[f])){const t=u.get(a[m]),n=void 0!==t?r[t]:null;if(null===n){const t=Ug(e,r[h]);Bg(t,o[m]),l[m]=t}else l[m]=Bg(n,o[m]),Ug(e,r[h],n),r[t]=null;m++}else Hg(r[f]),f--;else Hg(r[h]),h++;for(;m<=g;){const t=Ug(e,l[g+1]);Bg(t,o[m]),l[m++]=t}for(;h<=f;){const e=r[h++];null!==e&&Hg(e)}return this.Pt=a,((e,t=qg)=>{e.H=t})(e,l),tl}});function Vg(e){const{CONTROLBOX_TYPE:t}=wa,n="overlayed"===jl.settings.get("view_mode")&&e.get("minimized");return e.get("type")===t||!(e.get("hidden")||n)}j
2021-11-11 22:06:49 +01:00
<div class="inner-content converse-brand row">
<div class="converse-brand__padding"></div>
<div class="converse-brand__heading">
<svg height="200px"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 364 364"
version="1.1">
<title>Logo Converse</title>
<defs>
<linearGradient id="gradient" x1="92.14" y1="27.64" x2="267.65" y2="331.62" gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="#fff1d1"/>
<stop offset="0.05" stop-color="#fae8c1"/>
<stop offset="0.15" stop-color="#f0d5a1"/>
<stop offset="0.27" stop-color="#e7c687"/>
<stop offset="0.4" stop-color="#e1bb72"/>
<stop offset="0.54" stop-color="#dcb264"/>
<stop offset="0.71" stop-color="#daad5c"/>
<stop offset="1" stop-color="#d9ac59"/>
</linearGradient>
<filter id="shadow">
<feGaussianBlur in="SourceAlpha" stdDeviation="2.3" result="blur1"/>
<feOffset in="blur1" dx="3" dy="3" result="blur2"/>
<feColorMatrix in="blur2" type="matrix" result="blur3"
values="1 0 0 0 0.1
0 1 0 0 0.1
0 0 1 0 0.1
0 0 0 1 0"/>
<feMerge>
<feMergeNode in="blur3"/>
<feMergeNode in="SourceGraphic"/>
</feMerge>
</filter>
</defs>
<g filter="url(#shadow)">
<path d="M221.46,103.71c0,18.83-29.36,18.83-29.12,0C192.1,84.88,221.46,84.88,221.46,103.71Z" fill="#d9ac59"/>
<path d="M179.9,4.15A175.48,175.48,0,1,0,355.38,179.63,175.48,175.48,0,0,0,179.9,4.15Zm-40.79,264.5c-.23-17.82,27.58-17.82,27.58,0S138.88,286.48,139.11,268.65ZM218.6,168.24A79.65,79.65,0,0,1,205.15,174a12.76,12.76,0,0,0-6.29,4.65L167.54,222a1.36,1.36,0,0,1-2.46-.8v-35.8a2.58,2.58,0,0,0-3.06-2.53c-15.43,3-30.23,7.7-42.73,19.94-38.8,38-29.42,105.69,16.09,133.16a162.25,162.25,0,0,1-91.47-67.27C-3.86,182.26,34.5,47.25,138.37,25.66c46.89-9.75,118.25,5.16,123.73,62.83C265.15,120.64,246.56,152.89,218.6,168.24Z" fill="url(#gradient)"/>
</g>
</svg>
<span class="converse-brand__text">
<span>converse<span class="subdued">.js</span></span>
<p class="byline">messaging freedom</p>
</span>
</div>
2022-01-03 11:54:10 +01:00
${"overlayed"===jl.settings.get("view_mode")?el`<div class="converse-brand__padding"></div>`:""}
</div>`,t),document.querySelector("body").classList.add(`converse-${jl.settings.get("view_mode")}`),jl.trigger("chatBoxViewsInitialized")}render(){return(()=>{const{chatboxes:e,CONTROLBOX_TYPE:t,CHATROOMS_TYPE:n,HEADLINES_TYPE:s}=wa,i=jl.settings.get("view_mode"),r=null==wa?void 0:wa.connection,o=!(null!=r&&r.connected)||!(null!=r&&r.authenticated)||(null==r?void 0:r.disconnecting);return el`
${o||"overlayed"!==i?"":el`<converse-minimized-chats></converse-minimized-chats>`}
${Wg(e.filter(Vg),(e=>e.get("jid")),(e=>e.get("type")===t?el`
${"overlayed"===i?el`<converse-controlbox-toggle class="${e.get("closed")?"":"hidden"}"></converse-controlbox-toggle>`:""}
2021-11-11 22:06:49 +01:00
<converse-controlbox
id="controlbox"
2022-01-03 11:54:10 +01:00
class="chatbox ${"overlayed"===i&&e.get("closed")?"hidden":""} ${o?"logged-out":""}"
2021-11-11 22:06:49 +01:00
style="${e.get("width")?`width: ${e.get("width")}`:""}"></converse-controlbox>
2022-01-03 11:54:10 +01:00
`:e.get("type")===n?el`
2021-11-11 22:06:49 +01:00
<converse-muc jid="${e.get("jid")}" class="chatbox chatroom"></converse-muc>
2022-01-03 11:54:10 +01:00
`:e.get("type")===s?el`
2021-11-11 22:06:49 +01:00
<converse-headlines jid="${e.get("jid")}" class="chatbox headlines"></converse-headlines>
2022-01-03 11:54:10 +01:00
`:el`
2021-11-11 22:06:49 +01:00
<converse-chat jid="${e.get("jid")}" class="chatbox"></converse-chat>
`))}
2022-01-03 11:54:10 +01:00
`})()}});function Jg(){const e=.01*window.innerHeight;document.documentElement.style.setProperty("--vh",`${e}px`)}var Qg=n(6931),Zg={};Zg.styleTagTransform=vg(),Zg.setAttributes=fg(),Zg.insert=ug().bind(null,"head"),Zg.domAPI=lg(),Zg.insertStyleElement=gg(),ag()(Qg.Z,Zg),Qg.Z&&Qg.Z.locals&&Qg.Z.locals,$l.plugins.add("converse-chatboxviews",{dependencies:["converse-chatboxes","converse-vcard"],initialize(){jl.promises.add(["chatBoxViewsInitialized"]),jl.settings.extend({animate:!0,theme:"default"}),wa.chatboxviews=new class{constructor(){this.views={}}add(e,t){this.views[e]=t}get(e){return this.views[e]}xget(e){return this.keys().filter((t=>t!==e)).reduce(((e,t)=>(e[t]=this.views[t],e)),{})}getAll(){return Object.values(this.views)}keys(){return Object.keys(this.views)}remove(e){delete this.views[e]}map(e){return Object.values(this.views).map(e)}forEach(e){return Object.values(this.views).forEach(e)}filter(e){return Object.values(this.views).filter(e)}closeAllChatBoxes(){return Promise.all(Object.values(this.views).map((e=>e.close({name:"closeAllChatBoxes"}))))}},jl.listen.on("chatBoxesInitialized",(()=>{wa.chatboxes.on("destroy",(e=>wa.chatboxviews.remove(e.get("jid"))))})),jl.listen.on("cleanup",(()=>delete wa.chatboxviews)),jl.listen.on("clearSession",(()=>wa.chatboxviews.closeAllChatBoxes())),jl.listen.on("chatBoxViewsInitialized",Jg),window.addEventListener("resize",Jg),Object.assign($l,{insertInto(e){var t;const n=null===(t=wa.chatboxviews)||void 0===t?void 0:t.el;if(n&&!e.contains(n))e.insertAdjacentElement("afterBegin",n);else if(!n)throw new Error("Cannot insert non-existing #conversejs element into the DOM")}})}});var Kg=n(1505),Yg=n.n(Kg);const Xg=/^\s*</,ep=("undefined"!=typeof Element&&Element.prototype,function(e){this.cid=Ts("view"),this._domEvents=[],this.preinitialize.apply(this,arguments),Ct(this,jo(e,np)),this._ensureElement(),this.initialize.apply(this,arguments)});ep.extend=Ws;const tp=/^(\S+)\s*(.*)$/,np=["model","collection","el","id","attributes","className","tagName","events"];Object.assign(ep.prototype,ks,{tagName:"div",$:function(e){return this.el.querySelectorAll(e)},preinitialize:function(){},initialize:function(){},render:function(){return ve(this.beforeRender)&&this.beforeRender(),ve(this.toHTML)&&il(this.toHTML(),this.el),ve(this.afterRender)&&this.afterRender(),this},remove:function(){return this._removeElement(),this.stopListening(),this},_removeElement:function(){this.undelegateEvents(),this.el.parentNode&&this.el.parentNode.removeChild(this.el)},setElement:function(e){return this.undelegateEvents(),this._setElement(e),this.delegateEvents(),this},_setElement:function(e){if("string"==typeof e)if(Xg.test(e)){const t=document.createElement("div");t.innerHTML=e,this.el=t.firstChild}else this.el=document.querySelector(e);else e&&!T(e)&&e.length?this.el=e[0]:this.el=e},delegateEvents:function(e){if(e||(e=Gs(this,"events")),!e)return this;this.undelegateEvents();for(const t in e){let n=e[t];if(ve(n)||(n=this[n]),!n)continue;const s=t.match(tp);this.delegate(s[1],s[2],n.bind(this))}return this},delegate:function(e,t,n){const s=this.el;if(!s)return this;if("function"==typeof t&&(n=t,t=null),-1!==["focus","blur"].indexOf(e)){const s=this.el.querySelectorAll(t);for(let t=0,i=s.length;t<i;t++){const i=s[t];i.addEventListener(e,n,!1),this._domEvents.push({el:i,eventName:e,handler:n})}return n}const i=t?function(e){let i=e.target||e.srcElement;for(;i&&i!=s;i=i.parentNode)i.matches(t)&&(e.delegateTarget=i,n(e))}:n;return this.el.addEventListener(e,i,!1),this._domEvents.push({el:this.el,eventName:e,handler:i,listener:n,selector:t}),this},undelegateEvents:function(){if(this.el){for(let e=0,t=this._domEvents.length;e<t;e++){const t=this._domEvents[e];t.el.removeEventListener(t.eventName,t.handler,!1)}this._domEvents.length=0}return this},undelegate:function(e,t,n){if("function"==typeof t&&(n=t,t=null),this.el){const s=this._domEvents.slice();let i=s.length;for(;i--;){const r=s[i];!(r.eventName!==e||n&&r.listener!==n||t&&r.selector!==t)&&(r.el.removeEventListener(r.eventName,r.handler,!1),this._domEve
2021-11-11 22:06:49 +01:00
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header ${e.level}">
<h5 class="modal-title">${e.title}</h5>
2022-01-03 11:54:10 +01:00
${lp}
2021-11-11 22:06:49 +01:00
</div>
<div class="modal-body">
<span class="modal-alert"></span>
2022-01-03 11:54:10 +01:00
${e.messages.map((e=>el`<p>${e}</p>`))}
2021-11-11 22:06:49 +01:00
</div>
</div>
2022-01-03 11:54:10 +01:00
</div>`)(Object.assign({__:Eh},this.model.toJSON()))}}),up=ap.extend({id:"confirm-modal",events:{"submit .confirm":"onConfimation"},initialize(){this.confirmation=ji(),ap.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change",this.render),this.el.addEventListener("closed.bs.modal",(()=>this.confirmation.reject()),!1)},toHTML(){return(e=>el`
2021-03-19 19:26:15 +01:00
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header ${e.level||""}">
<h5 class="modal-title">${e.title}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<span class="modal-alert"></span>
<form class="converse-form converse-form--modal confirm" action="#">
<div class="form-group">
2022-01-03 11:54:10 +01:00
${e.messages.map((e=>el`<p>${e}</p>`))}
2021-03-19 19:26:15 +01:00
</div>
2022-01-03 11:54:10 +01:00
${e.fields.map((e=>(e=>el`
2021-03-19 19:26:15 +01:00
<div class="form-group">
<label>
${e.label||""}
<input type="text"
name="${e.name}"
class="${e.challenge_failed?"error":""} form-control form-control--labeled"
?required="${e.required}"
placeholder="${e.placeholder}" />
</label>
</div>
2021-11-11 22:06:49 +01:00
`)(e)))}
2021-03-19 19:26:15 +01:00
<div class="form-group">
2022-01-03 11:54:10 +01:00
<button type="submit" class="btn btn-primary">${Eh("OK")}</button>
<input type="button" class="btn btn-secondary" data-dismiss="modal" value="${Eh("Cancel")}"/>
2021-03-19 19:26:15 +01:00
</div>
</form>
</div>
</div>
</div>
2022-01-03 11:54:10 +01:00
`)(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()}});let hp=[];const fp={modal:{show(e,t,n){const s=this.get(e.id)||this.create(e,t);return s.show(n),s},get:e=>hp.filter((t=>t.id==e)).pop(),create(e,t){const n=new e(t);return hp.push(n),n},remove(e){hp=hp.filter((t=>t!==e)),e.remove()},removeAll(){hp.forEach((e=>e.remove())),hp=[]}},async confirm(e,t=[],n=[]){"string"==typeof t&&(t=[t]);const s=new Xo({title:e,messages:t,fields:n,type:"confirm"}),i=new up({model:s});let r;i.show();try{r=await i.confirmation}catch(e){r=!1}return i.remove(),r},async prompt(e,t=[],n=""){"string"==typeof t&&(t=[t]);const s=new Xo({title:e,messages:t,fields:[{name:"reason",placeholder:n}],type:"prompt"}),i=new up({model:s});let r;i.show();try{var o;r=null===(o=(await i.confirmation).pop())||void 0===o?void 0:o.value}catch(e){r=!1}return i.remove(),r},alert(e,t,n){let s;"string"==typeof n&&(n=[n]),"error"===e?s="alert-danger":"info"===e?s="alert-info":"warn"===e&&(s="alert-warning");const i=new Xo({title:t,messages:n,level:s,type:"alert"});fp.modal.show(dp,{model:i})}},mp=fp;$l.env.BootstrapModal=ap,$l.plugins.add("converse-modal",{initialize(){jl.listen.on("disconnect",(()=>{const e=document.querySelector("#converse-modals");e&&(e.innerHTML="")})),jl.listen.on("clearSession",(()=>jl.modal.removeAll())),Object.assign(wa.api,mp)}});const gp=(e,t)=>{var n,s;const i=e.N;if(void 0===i)return!1;for(const e of i)null===(s=(n=e).O)||void 0===s||s.call(n,t,!1),gp(e,t);return!0},pp=e=>{let t,n;do{if(void 0===(t=e.M))break;n=t.N,n.delete(e),e=t}while(0===(null==n?void 0:n.size))},vp=e=>{for(let t;t=e.M;e=t){let n=t.N;if(void 0===n)t.N=n=new Set;else if(n.has(e))break;n.add(e),_p(t)}};function yp(e){void 0!==this.N?(pp(this),this.M=e,vp(this)):this.M=e}function bp(e,t=!1,n=0){const s=this.H,i=this.N;if(void 0!==i&&0!==i.size)if(t)if(Array.isArray(s))for(let e=n;e<s.length;e++)gp(s[e],!1),pp(s[e]);else null!=s&&(gp(s,!1),pp(s));else gp(this,e)}const _p=e=>{var t,n,s,i;2==e.type&&(null!==(t=(s=e).P)&&void 0!==t||(s.P=bp),null!==(n=(i=e).Q)&&void 0!==n||(i.Q=yp))};class wp extends zg{constructor(){super(...arguments),this.isConnected=!0,this.ut=tl,this.N=void 0}T(e,t,n){super.T(e,t,n),vp(this)}O(e,t=!0){this.at(e),t&&(gp(this,e),pp(this))}at(e){var t,n;e!==this.isConnected&&(e?(this.isConnected=!0,this.ut!==tl&&(this.setValue(this.ut),this.ut=tl),null===(t=this.reconnected)||void 0===t||t.call(this)):(this.isConnected=!1,null===(n=this.disconnected)||void 0===n||n.call(this)))}S(e,t){if(!this.isConnected)throw Error(`AsyncDirective ${this.constructor.name} was rendered while its tree was disconnected.`);return super.S(e,t)}setValue(e){if(this.isConnected)if((e=>void 0===this.Σdt.strings)())this.Σdt.I(e,this);else{const t=[...this.Σdt.H];t[this.Σct]=e,this.Σdt.I(t,this,0)}else this.ut=e}disconnected(){}reconnected(){}}const Sp=e=>!(e=>null===e||"object"!=typeof e&&"function"!=typeof e)(e)&&"function"==typeof e.then,xp=Lg(class extends wp{constructor(){super(...arguments),this.Ct=2147483647,this.Rt=[]}render(...e){var t;return null!==(t=e.find((e=>!Sp(e))))&&void 0!==t?t:tl}update(e,t){const n=this.Rt;let s=n.length;this.Rt=t;for(let e=0;e<t.length&&!(e>this.Ct);e++){const i=t[e];if(!Sp(i))return this.Ct=e,i;e<s&&i===n[e]||(this.Ct=2147483647,s=0,Promise.resolve(i).then((e=>{const t=this.Rt.indexOf(i);t>-1&&t<this.Ct&&(this.Ct=t,this.setValue(e))})))}return tl}});var Ep=n(4166),Ap={};Ap.styleTagTransform=vg(),Ap.setAttributes=fg(),Ap.insert=ug().bind(null,"head"),Ap.domAPI=lg(),Ap.insertStyleElement=gg(),ag()(Ep.Z,Ap),Ep.Z&&Ep
2021-11-11 22:06:49 +01:00
class="chat-msg__actions ${e?"dropup dropup--left":"dropleft"}"
.items=${t}
2022-01-03 11:54:10 +01:00
></converse-dropdown>`:""}static getActionsDropdownItem(e){return el`
2021-11-11 22:06:49 +01:00
<button class="chat-msg__action ${e.button_class}" @click=${e.handler}>
<converse-icon
class="${e.icon_class}"
2022-01-03 11:54:10 +01:00
path-prefix="${jl.settings.get("assets_path")}"
2021-11-11 22:06:49 +01:00
color="var(--text-color-lighten-15-percent)"
size="1em"
></converse-icon>
${e.i18n_text}
</button>
2022-01-03 11:54:10 +01:00
`}onMessageEditButtonClicked(e){var t,n;e.preventDefault();const s=this.model.collection.findWhere("correcting"),i=null===(t=Tp.ancestor(this,".chatbox"))||void 0===t||null===(n=t.querySelector(".chat-textarea"))||void 0===n?void 0:n.value;(!i||s&&s.get("message")===i||confirm(Eh("You have an unsent message which will be lost if you continue. Are you sure?")))&&(s!==this.model?(null==s||s.save("correcting",!1),this.model.save("correcting",!0)):this.model.save("correcting",!1))}async onDirectMessageRetractButtonClicked(){if("me"!==this.model.get("sender"))return M.error("onMessageRetractButtonClicked called for someone else's message!");const e=Eh("Be aware that other XMPP/Jabber clients (and servers) may not yet support retractions and that this message may not be removed everywhere."),t=[Eh("Are you sure you want to retract this message?")];jl.settings.get("show_retraction_warning")&&(t[1]=e),await jl.confirm(Eh("Confirm"),t)&&this.model.collection.chatbox.retractOwnMessage(this.model)}async retractOtherMessage(e){const t=this.model.collection.chatbox,n=await t.retractOtherMessage(this.model,e);if(null===n){const e=Eh("A timeout occurred while trying to retract the message");jl.alert("error",Eh("Error"),e),M(e,Cp.LogLevel.WARN)}else if(Tp.isErrorStanza(n)){const e=Eh("Sorry, you're not allowed to retract this message.");jl.alert("error",Eh("Error"),e),M(e,Cp.LogLevel.WARN),M(n,Cp.LogLevel.WARN)}}async onMUCMessageRetractButtonClicked(){const e=Eh("Be aware that other XMPP/Jabber clients (and servers) may not yet support retractions and that this message may not be removed everywhere.");if(this.model.mayBeRetracted()){const t=[Eh("Are you sure you want to retract this message?")];jl.settings.get("show_retraction_warning")&&(t[1]=e),await jl.confirm(Eh("Confirm"),t)&&this.model.collection.chatbox.retractOwnMessage(this.model)}else if(await this.model.mayBeModerated())if("me"===this.model.get("sender")){let t=[Eh("Are you sure you want to retract this message?")];jl.settings.get("show_retraction_warning")&&(t=[t[0],e,t[1]]),await jl.confirm(Eh("Confirm"),t)&&this.retractOtherMessage()}else{let t=[Eh("You are about to retract this message."),Eh("You may optionally include a message, explaining the reason for the retraction.")];jl.settings.get("show_retraction_warning")&&(t=[t[0],e,t[1]]);const n=await jl.prompt(Eh("Message Retraction"),t,Eh("Optional reason"));!1!==n&&this.retractOtherMessage(n)}else{const e=Eh("Sorry, you're not allowed to retract this message");jl.alert("error",Eh("Error"),e)}}onMessageRetractButtonClicked(e){var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),this.model.collection.chatbox.get("type")===wa.CHATROOMS_TYPE?this.onMUCMessageRetractButtonClicked():this.onDirectMessageRetractButtonClicked()}onMediaToggleClicked(e){var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),this.hasHiddenMedia(this.getMediaURLs())?this.model.save({hide_url_previews:!1,url_preview_transition:"fade-in"}):(this.model.get("ogp_metadata")||[]).length?this.model.set("url_preview_transition","fade-out"):this.model.save({hide_url_previews:!0,url_preview_transition:"fade-in"})}hasHiddenMedia(e){if("boolean"==typeof this.model.get("hide_url_previews"))return this.model.get("hide_url_previews");const t=jl.settings.get("render_media");return Array.isArray(t)?e.reduce(((e,n)=>e||!zl(t,n)),!1):!t}getMediaURLs(){const e=(this.model.get("ogp_metadata")||[]).map((e=>({url:e["og:image"],is_image:!0}))).filter((e=>Bl(e))),t=Ed(this.model.get("media_urls")||[],this.model.get("body")).filter((e=>Bl(e)));return[...new Set([...t.map((e=>e.url)),...e.map((e=>e.url))])]}addMediaRenderingToggle(e){const t=this.getMediaURLs();if(t.length){const n=this.hasHiddenMedia(t);e.push({i18n_text:Eh(n?"Show media":"Hide media"),handler:e=>this.onMediaToggleClicked(e),button_class:"chat-msg__action-hide-previews",icon_class:n?"fas fa-eye":"fas fa-eye-slash",name:"hide"})}}async getActionButtons(){const e=[];this.model.get("editable")&&e.push({i18n_text:this.model.get("correcting")?Eh("Cancel Editing"):Eh("Edit"),handler
2021-03-19 19:26:15 +01:00
<div class="modal-dialog fit-content" role="document">
<div class="modal-content fit-content">
<div class="modal-header">
2022-01-03 11:54:10 +01:00
<h4 class="modal-title" id="message-versions-modal-label">${Eh("Image: ")}<a target="_blank" rel="noopener" href="${e.src}">${e.src}</a></h4>
${lp}
2021-03-19 19:26:15 +01:00
</div>
<div class="modal-body modal-body--image fit-content">
<img class="chat-image" src="${e.src}" @load=${e.onload}>
</div>
2022-01-03 11:54:10 +01:00
<div class="modal-footer">${cp}</div>
2021-11-11 22:06:49 +01:00
</div>
2022-01-03 11:54:10 +01:00
</div>`)({src:this.src,onload:e=>e.target.parentElement.style.height=`${e.target.height}px`})}}),Np=(e,t)=>el`<audio controls src="${e}"></audio>${t?"":el`<a target="_blank" rel="noopener" href="${e}">${e}</a>`}`;class Op{constructor(e){e.toString().indexOf("ArrayBuffer")>0&&(e=new Uint8Array(e)),this.data=e,this.len=this.data.length,this.pos=0}readByte(){if(this.pos>=this.data.length)throw new Error("Attempted to read past end of stream.");return this.data instanceof Uint8Array?this.data[this.pos++]:255&this.data.charCodeAt(this.pos++)}readBytes(e){const t=[];for(let n=0;n<e;n++)t.push(this.readByte());return t}read(e){let t="";for(let n=0;n<e;n++)t+=String.fromCharCode(this.readByte());return t}readUnsigned(){const e=this.readBytes(2);return(e[1]<<8)+e[0]}}function $p(e){return e.reduce((function(e,t){return 2*e+t}),0)}function Ip(e){const t=[];for(let n=7;n>=0;n--)t.push(!!(e&1<<n));return t}function Mp(e){let t,n;n="";do{t=e.readByte(),n+=e.read(t)}while(0!==t);return n}function Rp(e,t){const n=[];for(let s=0;s<t;s++)n.push(e.readBytes(3));return n}function Dp(e,t){const n={};switch(n.sentinel=e.readByte(),String.fromCharCode(n.sentinel)){case"!":n.type="ext",function(e,t,n){switch(t.label=e.readByte(),t.label){case 249:t.extType="gce",function(t){e.readByte();const s=Ip(e.readByte());t.reserved=s.splice(0,3),t.disposalMethod=$p(s.splice(0,3)),t.userInput=s.shift(),t.transparencyGiven=s.shift(),t.delayTime=e.readUnsigned(),t.transparencyIndex=e.readByte(),t.terminator=e.readByte(),null==n||n.gce(t)}(t);break;case 254:t.extType="com",function(t){t.comment=Mp(e),n.com&&n.com(t)}(t);break;case 1:t.extType="pte",function(t){e.readByte(),t.ptHeader=e.readBytes(12),t.ptData=Mp(e),n.pte&&n.pte(t)}(t);break;case 255:t.extType="app",function(t){switch(e.readByte(),t.identifier=e.read(8),t.authCode=e.read(3),t.identifier){case"NETSCAPE":!function(t){e.readByte(),t.unknown=e.readByte(),t.iterations=e.readUnsigned(),t.terminator=e.readByte(),n.app&&n.app.NETSCAPE&&n.app.NETSCAPE(t)}(t);break;default:!function(t){t.appData=Mp(e),n.app&&n.app[t.identifier]&&n.app[t.identifier](t)}(t)}}(t);break;default:t.extType="unknown",function(t){t.data=Mp(e),n.unknown&&n.unknown(t)}(t)}}(e,n,t);break;case",":n.type="img",function(e,t,n){t.leftPos=e.readUnsigned(),t.topPos=e.readUnsigned(),t.width=e.readUnsigned(),t.height=e.readUnsigned();const s=Ip(e.readByte());t.lctFlag=s.shift(),t.interlaced=s.shift(),t.sorted=s.shift(),t.reserved=s.splice(0,2),t.lctSize=$p(s.splice(0,3)),t.lctFlag&&(t.lct=Rp(e,1<<t.lctSize+1)),t.lzwMinCodeSize=e.readByte();const i=Mp(e);t.pixels=function(e,t){let n=0;function s(e){let s=0;for(let i=0;i<e;i++)t.charCodeAt(n>>3)&1<<(7&n)&&(s|=1<<i),n++;return s}const i=[],r=1<<e,o=r+1;let a=e+1,c=[];const l=function(){c=[],a=e+1;for(let e=0;e<r;e++)c[e]=[e];c[r]=[],c[o]=null};let d,u;for(;;)if(u=d,d=s(a),d!==r){if(d===o)break;if(d<c.length)u!==r&&c.push(c[u].concat(c[d][0]));else{if(d!==c.length)throw new Error("Invalid LZW code.");c.push(c[u].concat(c[u][0]))}i.push.apply(i,c[d]),c.length===1<<a&&a<12&&a++}else l();return i}(t.lzwMinCodeSize,i),t.interlaced&&(t.pixels=function(e,t){const n=new Array(e.length),s=e.length/t;function i(s,i){const r=e.slice(i*t,(i+1)*t);n.splice.apply(n,[s*t,t].concat(r))}const r=[0,4,2,1],o=[8,8,4,2];let a=0;for(let e=0;e<4;e++)for(let t=r[e];t<s;t+=o[e])i(t,a),a++;return n}(t.pixels,t.width)),null==n||n(t)}(e,n,null==t?void 0:t.img);break;case";":n.type="eof",null==t||t.eof(n);break;default:throw new Error("Unknown block: 0x"+n.sentinel.toString(16))}"eof"!==n.type&&setTimeout((()=>Dp(e,t)),0)}class Lp{constructor(e,t){this.options=Object.assign({width:null,height:null,autoplay:!0,loop:!0,show_progress_bar:!0,progress_bg_color:"rgba(0,0,0,0.4)",progress_color:"rgba(255,0,22,.8)",progress_bar_height:5},t),this.el=e,this.gif_el=e.querySelector("img"),this.canvas=e.querySelector("canvas"),this.ctx=this.canvas.getContext("2d"),this.offscreenCanvas=document.createElement("canvas"),this.ctx_scaled=!1,this.disposal_method=null,this.disposal_restore_from_idx=null,this.frame=null,this.frame
2021-11-11 22:06:49 +01:00
<div class="form-group">
2022-01-03 11:54:10 +01:00
${"hidden"!==e.type?el`<label for="${e.id}">${e.label}</label>`:""}
2021-11-11 22:06:49 +01:00
<!-- This is a hack to prevent Chrome from auto-filling the username in
any of the other input fields in the MUC configuration form. -->
2022-01-03 11:54:10 +01:00
${"password"===e.type&&e.fixed_username?el`
2021-11-11 22:06:49 +01:00
<input class="hidden-username" type="text" autocomplete="username" value="${e.fixed_username}"></input>
`:""}
<input
autocomplete="${e.autocomplete||""}"
class="form-control"
id="${e.id}"
name="${e.name}"
placeholder="${e.placeholder||""}"
type="${e.type}"
value="${e.value||""}"
?required=${e.required} />
2022-01-03 11:54:10 +01:00
</div>`,Fp=e=>el`
2021-11-11 22:06:49 +01:00
<label>${e.label}
<a class="form-url" target="_blank" rel="noopener" href="${e.value}">${e.value}</a>
2022-01-03 11:54:10 +01:00
</label>`,Up=e=>el`
2021-11-11 22:06:49 +01:00
<div class="form-group">
2022-01-03 11:54:10 +01:00
${e.label?el`<label>${e.label}</label>`:""}
2021-11-11 22:06:49 +01:00
<div class="input-group">
<div class="input-group-prepend">
<input name="${e.name}"
type="${e.type}"
value="${e.value||""}"
?required="${e.required}" />
<div class="input-group-text col" title="${e.domain}">${e.domain}</div>
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
</div>
2022-01-03 11:54:10 +01:00
</div>`;function Bp(e){e.preventDefault(),jl.rooms.open(e.target.href)}const qp=(e,t)=>{let n;try{n=e.normalize()._string}catch(e){return M.error(e),t}const s=e._parts.urn?n:e.readable(),i=t||s;return e._parts.protocol||n.startsWith("http://")||n.startsWith("https://")||(n="http://"+n),"xmpp"===e._parts.protocol&&"join"===e._parts.query?el`
2021-03-19 19:26:15 +01:00
<a target="_blank"
rel="noopener"
2022-01-03 11:54:10 +01:00
@click=${Bp}
href="${n}">${i}</a>`:el`<a target="_blank" rel="noopener" href="${n}">${i}</a>`},Hp=(e,t)=>el`<video controls preload="metadata" src="${e}"></video>${t?"":el`<a target="_blank" rel="noopener" href="${e}">${e}</a>`}`,{sizzle:Gp}=$l.env,Wp=["http","https","xmpp","mailto"];function Vp(e,t){return{"muc#roomconfig_lang":"language","muc#roomconfig_roomsecret":null!=t&&t.new_password?"new-password":"current-password"}[e]}const Jp={"text-private":"password","text-single":"text",fixed:"label",boolean:"checkbox",hidden:"hidden","jid-multi":"textarea","list-single":"dropdown","list-multi":"dropdown"},Qp={"xs:anyURI":"url","xs:byte":"number","xs:date":"date","xs:dateTime":"datetime","xs:int":"number","xs:integer":"number","xs:time":"time"};function Zp(e){const t=Jp[e.getAttribute("type")];if("text"==t){const n=e.getElementsByTagNameNS("http://jabber.org/protocol/xdata-validate","validate");if(1===n.length){const e=n[0].getAttribute("datatype");return Qp[e]||t}}return t}function Kp(e){const t=Dl(e);return null===t?e:Wl(t)?Hp(e):Gl(t)?Np(e):(Vl(t),zp(t.toString(),function(e){try{return decodeURI(e.filename())}catch(t){return M.debug(t),e.filename()}}(t)))}function Yp(e){const t=RegExp("^w{3}.","ig").test(e)?`http://${e}`:e,n=Dl(e);return null===n||!function(e){try{return!!new URL(e)}catch(e){return!1}}(t)||!function(e,t=Wp){return!!t.includes(e)}(n._parts.protocol)&&n._parts.protocol?e:qp(n,e)}function Xp(e,t){e.classList.remove("visible"),ve(t)&&t()}ha.calculateElementHeight=function(e){return Array.from(e.children).reduce(((e,t)=>e+t.offsetHeight),0)},ha.getNextElement=function(e,t="*"){let n=e.nextElementSibling;for(;null!==n&&!Gp.matchesSelector(n,t);)n=n.nextElementSibling;return n},ha.getPreviousElement=function(e,t="*"){let n=e.previousElementSibling;for(;null!==n&&!Gp.matchesSelector(n,t);)n=n.previousElementSibling;return n},ha.getFirstChildElement=function(e,t="*"){let n=e.firstElementChild;for(;null!==n&&!Gp.matchesSelector(n,t);)n=n.nextElementSibling;return n},ha.getLastChildElement=function(e,t="*"){let n=e.lastElementChild;for(;null!==n&&!Gp.matchesSelector(n,t);)n=n.previousElementSibling;return n},ha.hasClass=function(e,t){return t instanceof Element&&t.classList.contains(e)},ha.toggleClass=function(e,t){ha.hasClass(e,t)?ha.removeClass(e,t):ha.addClass(e,t)},ha.addClass=function(e,t){return t instanceof Element&&t.classList.add(e),t},ha.removeClass=function(e,t){return t instanceof Element&&t.classList.remove(e),t},ha.removeElement=function(e){return e instanceof Element&&e.parentNode&&e.parentNode.removeChild(e),e},ha.getElementFromTemplateResult=function(e){const t=document.createElement("div");return il(e,t),t.firstElementChild},ha.showElement=e=>{ha.removeClass("collapsed",e),ha.removeClass("hidden",e)},ha.hideElement=function(e){return e instanceof Element&&e.classList.add("hidden"),e},ha.ancestor=function(e,t){let n=e;for(;null!==n&&!Gp.matchesSelector(n,t);)n=n.parentElement;return n},ha.nextUntil=function(e,t){const n=[];let s=e.nextElementSibling;for(;null!==s&&!s.matches(t);)n.push(s),s=s.nextElementSibling;return n},ha.unescapeHTML=function(e){var t=document.createElement("div");return t.innerHTML=e,t.innerText},ha.escapeHTML=function(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")},ha.slideInAllElements=function(e,t=300){return Promise.all(Array.from(e).map((e=>ha.slideIn(e,t))))},ha.slideToggleElement=function(e,t){return ha.hasClass("collapsed",e)||ha.hasClass("hidden",e)?ha.slideOut(e,t):ha.slideIn(e,t)},ha.slideOut=function(e,t=200){return new Promise(((n,s)=>{if(!e){const e="An element needs to be passed in to slideOut";return M.warn(e),void s(new Error(e))}const i=e.getAttribute("data-slider-marker");i&&(e.removeAttribute("data-slider-marker"),window.cancelAnimationFrame(i));const r=ha.calculateElementHeight(e);if(window.converse_disable_effects)return e.style.height=r+"px",function(e){e.removeAttribute("data-slider-marker"),e.classList.remove("collapsed"),e.style.overflow="",e.style.height=""}(e),void n();if(!ha.hasClass("collapsed"
2021-11-11 22:06:49 +01:00
<div class="form-group">
<label for="${e.id}">${e.label}</label>
<select class="form-control" id="${e.id}" name="${e.name}" ?multiple="${e.multiple}">
2022-01-03 11:54:10 +01:00
${null===(t=e.options)||void 0===t?void 0:t.map((e=>(e=>el`<option value="${e.value}" ?selected="${e.selected}">${e.label}</option>`)(e)))}
2021-11-11 22:06:49 +01:00
</select>
2022-01-03 11:54:10 +01:00
</div>`})({options:ha.queryChildren(e,"option").map((n=>{var s;const i=null===(s=n.querySelector("value"))||void 0===s?void 0:s.textContent;return{value:i,label:n.getAttribute("label"),selected:t.includes(i),required:!!e.querySelector("required")}})),id:ha.getUniqueId(),label:e.getAttribute("label"),multiple:"list-multi"===e.getAttribute("type"),name:e.getAttribute("var"),required:!!e.querySelector("required")})}var s,i,r,o;if("fixed"===e.getAttribute("type"))return(e=>el`<p class="form-help">${e.text}</p>`)({text:null===(s=e.querySelector("value"))||void 0===s?void 0:s.textContent});if("jid-multi"===e.getAttribute("type"))return(e=>el`
2021-11-11 22:06:49 +01:00
<label class="label-ta">${e.label}</label>
<textarea name="${e.name}">${e.value}</textarea>
2022-01-03 11:54:10 +01:00
`)({name:e.getAttribute("var"),label:e.getAttribute("label")||"",value:null===(i=e.querySelector("value"))||void 0===i?void 0:i.textContent,required:!!e.querySelector("required")});if("boolean"===e.getAttribute("type")){var a;const t=null===(a=e.querySelector("value"))||void 0===a?void 0:a.textContent;return(e=>el`
2021-11-11 22:06:49 +01:00
<fieldset class="form-group">
<input id="${e.id}" name="${e.name}" type="checkbox" ?checked=${e.checked} ?required=${e.required} />
<label class="form-check-label" for="${e.id}">${e.label}</label>
2022-01-03 11:54:10 +01:00
</fieldset>`)({id:ha.getUniqueId(),name:e.getAttribute("var"),label:e.getAttribute("label")||"",checked:"1"===t||"true"===t?'checked="1"':"",required:!!e.querySelector("required")})}if("url"===e.getAttribute("var"))return Fp({label:e.getAttribute("label")||"",value:null===(r=e.querySelector("value"))||void 0===r?void 0:r.textContent});if("username"===e.getAttribute("var"))return Up({domain:" @"+n.domain,name:e.getAttribute("var"),type:Zp(e),label:e.getAttribute("label")||"",value:null===(o=e.querySelector("value"))||void 0===o?void 0:o.textContent,required:!!e.querySelector("required")});if("ocr"===e.getAttribute("var")){const n=e.querySelector("uri"),s=Gp('data[cid="'+n.textContent.replace(/^cid:/,"")+'"]',t)[0];return(e=>el`
2021-11-11 22:06:49 +01:00
<fieldset class="form-group">
2022-01-03 11:54:10 +01:00
${e.label?el`<label>${e.label}</label>`:""}
2021-11-11 22:06:49 +01:00
<img src="data:${e.type};base64,${e.data}">
<input name="${e.name}" type="text" ?required="${e.required}" />
</fieldset>
2022-01-03 11:54:10 +01:00
`)({label:e.getAttribute("label"),name:e.getAttribute("var"),data:null==s?void 0:s.textContent,type:n.getAttribute("type"),required:!!e.querySelector("required")})}{var c;const t=e.getAttribute("var");return Pp({id:ha.getUniqueId(),label:e.getAttribute("label")||"",name:t,fixed_username:null==n?void 0:n.fixed_username,autocomplete:Vp(t,n),placeholder:null,required:!!e.querySelector("required"),type:Zp(e),value:null===(c=e.querySelector("value"))||void 0===c?void 0:c.textContent})}},Object.assign(ha,{getOOBURLMarkup:Kp});const ev=ha;var tv=n(4903),nv={};nv.styleTagTransform=vg(),nv.setAttributes=fg(),nv.insert=ug().bind(null,"head"),nv.domAPI=lg(),nv.insertStyleElement=gg(),ag()(tv.Z,nv),tv.Z&&tv.Z.locals&&tv.Z.locals,jl.elements.define("converse-gif",class extends ig{static get properties(){return{autoplay:{type:Boolean},noloop:{type:Boolean},progress_color:{type:String},fallback:{type:String},src:{type:String}}}constructor(){super(),this.autoplay=!1,this.noloop=!1,this.fallback="url"}initGIF(){const e={autoplay:this.autoplay,loop:!this.noloop};this.progress_color&&(e.progress_color=this.progress_color),this.supergif=new Lp(this,e)}updated(e){this.supergif&&!e.has("src")?(e.has("autoplay")&&(this.supergif.options.autoplay=this.autoplay),e.has("noloop")&&(this.supergif.options.loop=!this.noloop),e.has("progress_color")&&(this.supergif.options.progress_color=this.progress_color)):this.initGIF()}render(){var e;return null!==(e=this.supergif)&&void 0!==e&&e.load_error&&["url","empty"].includes(this.fallback)?this.renderErrorFallback():el`<canvas class="gif-canvas"
2021-11-11 22:06:49 +01:00
@mouseover=${()=>this.setHover()}
@mouseleave=${()=>this.unsetHover()}
2022-01-03 11:54:10 +01:00
@click=${e=>this.onControlsClicked(e)}><img class="gif" src="${this.src}"></a></canvas>`}renderErrorFallback(){return"url"===this.fallback?Yp(this.src):"empty"===this.fallback?"":void 0}setHover(){this.supergif&&(this.supergif.hovering=!0,this.hover_timeout&&clearTimeout(this.hover_timeout),this.hover_timeout=setTimeout((()=>this.unsetHover()),2e3))}unsetHover(){this.supergif&&(this.supergif.hovering=!1)}onControlsClicked(e){e.preventDefault(),this.supergif.playing?this.supergif.pause():(this.supergif.options.loop=!0,this.supergif.play())}});const sv=(e,t)=>el`<converse-gif autoplay noloop fallback='empty' src=${e}></converse-gif>${t?"":el`<a target="_blank" rel="noopener" href="${e}">${e}</a>`}`,{URI:iv}=$l.env,rv=Lg(class extends wp{render(e,t,n,s){return t?el`<a href="${t}" class="chat-image__link" target="_blank" rel="noopener">${this.renderImage(e,t,n,s)}</a>`:this.renderImage(e,t,n,s)}renderImage(e,t,n,s){return el`<img class="chat-image img-thumbnail"
2021-11-11 22:06:49 +01:00
src="${e}"
@click=${s}
@error=${()=>this.onError(e,t,n,s)}
2022-01-03 11:54:10 +01:00
@load=${n}/></a>`}onError(e,t,n,s){if(ql(e))t&&this.setValue(Yp(t));else{const i=new iv(e),r=i.filename();i.filename(`${r}.png`),this.setValue(rv(i.toString(),t,n,s))}}}),ov=e=>el`${rv(e.url,e.href,e.onLoad,e.onClick)}`,av=Lg(class extends zg{render(e,t,n){const s=new yv(e,t,Object.assign(n,{show_images:!1,embed_videos:!1,embed_audio:!1}));return el`${xp(async function(e){try{await e.addTemplates()}catch(e){M.error(e)}return e.payload}(s),el`${s}`)}`}}),cv=["*","_","~","`"],lv=[...cv,"```",">"],dv={"*":{name:"strong",type:"span"},_:{name:"emphasis",type:"span"},"~":{name:"strike",type:"span"},"`":{name:"preformatted",type:"span"},"```":{name:"preformatted_block",type:"block"},">":{name:"quote",type:"block"}},uv=["_",">","`","~"],hv={emphasis:(e,t,n)=>el`<span class="styling-directive">_</span><i>${av(e,t,n)}</i><span class="styling-directive">_</span>`,preformatted:e=>el`<span class="styling-directive">\`</span><code>${e}</code><span class="styling-directive">\`</span>`,preformatted_block:e=>el`<div class="styling-directive">\`\`\`</div><code class="block">${e}</code><div class="styling-directive">\`\`\`</div>`,quote:(e,t,n)=>el`<blockquote>${av(e,t,n)}</blockquote>`,strike:(e,t,n)=>el`<span class="styling-directive">~</span><del>${av(e,t,n)}</del><span class="styling-directive">~</span>`,strong:(e,t,n)=>el`<span class="styling-directive">*</span><b>${av(e,t,n)}</b><span class="styling-directive">*</span>`};function fv(e,t,n=!0){let s;if(!/(^```\s*\n|^```\s*$)/.test(e.slice(t))||0!==t&&"\n"!==e[t-1]&&">"!==e[t-1]){if(!lv.includes(e.slice(t,t+1)))return null;if(s=e.slice(t,t+1),!function(e,t,n,s){if(s){const s=RegExp(uv.includes(e)?`^(\\p{L}|\\p{N})${e}`:`^(\\p{L}|\\p{N})\\${e}`,"u");if(n>1&&s.test(t.slice(n-1)))return!1;if(gv(e)&&n>0&&"\n"!==t[n-1])return!1;if(cv.includes(e)&&t[n+1]===e)return!1}else{const s=RegExp(uv.includes(e)?`^${e}(\\p{L}|\\p{N})`:`^\\${e}(\\p{L}|\\p{N})`,"u");if(n<t.length-1&&s.test(t.slice(n)))return!1;if(cv.includes(e)&&t[n-1]===e)return!1}return!0}(s,e,t,n))return null}else s=e.slice(t,t+3);return s}function mv(e,t){const n=fv(e,t),s=n?function(e,t,n){if(!e)return 0;const s=n;if(n+=e.length,gv(e))return(n+=t.slice(n).split(/\n[^>]/).shift().length)-s;if("span"===dv[e].type){const s=t.slice(n).split("\n").shift();let i=0,r=s.indexOf(e);for(;-1!==r;){if(fv(t,n+r,!1)===e)return r+2*e.length;r=s.indexOf(e,i++)}return 0}{const s=t.slice(n+1);let i=0,r=s.indexOf(e);for(;-1!==r;){if(fv(t,n+1+r,!1)===e)return r+1+2*e.length;r=s.indexOf(e,i++)}return 0}}(n,e,t):0;return s>0?{d:n,length:s}:{}}const gv=e=>[">","&gt;"].includes(e);function pv(e,t,n,s){const i=hv[dv[e].name];return gv(e)?i(t.replace(/\n>/g,"\n").replace(/\n$/,""),n,s):i(t,n,s)}const vv=e=>"string"==typeof e;class yv extends String{constructor(e,t=0,n={}){super(e),this.embed_audio=null==n?void 0:n.embed_audio,this.embed_videos=null==n?void 0:n.embed_videos,this.mentions=(null==n?void 0:n.mentions)||[],this.media_urls=null==n?void 0:n.media_urls,this.nick=null==n?void 0:n.nick,this.offset=t,this.onImgClick=null==n?void 0:n.onImgClick,this.onImgLoad=null==n?void 0:n.onImgLoad,this.options=n,this.payload=[],this.references=[],this.render_styling=null==n?void 0:n.render_styling,this.show_images=null==n?void 0:n.show_images,this.hide_media_urls=null==n?void 0:n.hide_media_urls}shouldRenderMedia(e,t){let n;return"image"===t?n=this.show_images:"audio"===t?n=this.embed_audio:"video"===t&&(n=this.embed_videos),"boolean"==typeof n?n:Pl(e,t)}addHyperlinks(e,t){const n=t+this.offset;Ed(this.media_urls||ed(e).media_urls||[],e,n).filter((e=>!e.is_encrypted)).forEach((e=>{const n=e.url,s=Fl(n);let i;i=Hl(n)&&this.shouldRenderMedia(n,"image")?sv(s,this.hide_media_urls):Vl(n)&&this.shouldRenderMedia(n,"image")?ov({url:s,href:this.hide_media_urls?null:s,onClick:this.onImgClick,onLoad:this.onImgLoad}):Wl(n)&&this.shouldRenderMedia(n,"video")?Hp(s,this.hide_media_urls):Gl(n)&&this.shouldRenderMedia(n,"audio")?Np(s,this.hide_media_urls):Yp(s),this.addTemplateResult(e.start+t,e.end+t,i)}))}addMapURLs(e,t){const n=/geo:([\-0-9.]+),([\-0-9.]+)(?:,([
2021-11-11 22:06:49 +01:00
<button type="button" class="btn btn--transparent btn--standalone" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<converse-icon color="${this.color}" size="1em" class="${this.icon_classes}">
2021-03-19 19:26:15 +01:00
</button>
2021-11-11 22:06:49 +01:00
<div class="dropdown-menu">
2022-01-03 11:54:10 +01:00
${this.items.map((e=>xp(e,"")))}
2021-11-11 22:06:49 +01:00
</div>
2022-01-03 11:54:10 +01:00
`}firstUpdated(){super.firstUpdated(),this.initArrowNavigation()}hideMenu(){var e;super.hideMenu(),null===(e=this.navigator)||void 0===e||e.disable()}initArrowNavigation(){if(!this.navigator){const e={selector:".dropdown-item",onSelected:e=>e.focus()};this.navigator=new jv(this.menu,e)}}enableArrowNavigation(e){e&&(e.preventDefault(),e.stopPropagation()),this.navigator.enable(),this.navigator.select(this.menu.firstElementChild)}handleKeyUp(e){super.handleKeyUp(e),e.keyCode!==$l.keycodes.DOWN_ARROW||this.navigator.enabled||this.enableArrowNavigation(e)}}jl.elements.define("converse-dropdown",Mv);const Rv=e=>{return e.image?el`
<svg xmlns="http://www.w3.org/2000/svg" class="avatar ${e.classes}" width="${e.width}" height="${e.height}">
<image width="${e.width}" height="${e.height}" preserveAspectRatio="xMidYMid meet" href="${t=e.image,n=e.image_type,t.startsWith("data:")?t:`data:${n};base64,${t}`}"/>
</svg>`:"";var t,n};var Dv=n(5222),Lv={};Lv.styleTagTransform=vg(),Lv.setAttributes=fg(),Lv.insert=ug().bind(null,"head"),Lv.domAPI=lg(),Lv.insertStyleElement=gg(),ag()(Dv.Z,Lv),Dv.Z&&Dv.Z.locals&&Dv.Z.locals,jl.elements.define("converse-avatar",class extends ig{static get properties(){return{data:{type:Object},width:{type:String},height:{type:String},nonce:{type:String}}}constructor(){super(),this.width=36,this.height=36}render(){var e,t;const n=(null===(e=this.data)||void 0===e?void 0:e.image_type)||wa.DEFAULT_IMAGE_TYPE;let s;var i,r;null!==(t=this.data)&&void 0!==t&&t.data_uri?s=null===(i=this.data)||void 0===i?void 0:i.data_uri:s="data:"+n+";base64,"+((null===(r=this.data)||void 0===r?void 0:r.image)||wa.DEFAULT_IMAGE);return Rv({classes:this.getAttribute("class"),height:this.height,width:this.width,image:s,image_type:n})}});const{dayjs:zv}=$l.env;jl.elements.define("converse-message-versions",class extends ig{static get properties(){return{model:{type:Object}}}render(){const e=this.model.get("older_versions"),t=this.model.get("message");return el`
2021-11-11 22:06:49 +01:00
<h4>Older versions</h4>
2022-01-03 11:54:10 +01:00
${Object.keys(e).map((t=>el`<p class="older-msg"><time>${zv(t).format("MMM D, YYYY, HH:mm:ss")}</time>: ${e[t]}</p>`))}
2021-11-11 22:06:49 +01:00
<hr/>
<h4>Current version</h4>
2022-01-03 11:54:10 +01:00
<p>${t}</p>`}});const Pv=ap.extend({id:"message-versions-modal",toHTML(){return(e=>el`
2021-03-19 19:26:15 +01:00
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
2022-01-03 11:54:10 +01:00
<h4 class="modal-title" id="message-versions-modal-label">${Eh("Message versions")}</h4>
${lp}
2021-03-19 19:26:15 +01:00
</div>
<div class="modal-body">
2021-11-11 22:06:49 +01:00
<converse-message-versions .model=${e}></converse-message-versions>
2021-03-19 19:26:15 +01:00
</div>
2022-01-03 11:54:10 +01:00
<div class="modal-footer">${cp}</div>
2021-03-19 19:26:15 +01:00
</div>
</div>
2022-01-03 11:54:10 +01:00
`)(this.model)}});var Fv=n(1551),Uv={};Uv.styleTagTransform=vg(),Uv.setAttributes=fg(),Uv.insert=ug().bind(null,"head"),Uv.domAPI=lg(),Uv.insertStyleElement=gg(),ag()(Fv.Z,Uv),Fv.Z&&Fv.Z.locals&&Fv.Z.locals;const Bv=ap.extend({id:"muc-occupant",initialize(){ap.prototype.initialize.apply(this,arguments),this.model&&this.listenTo(this.model,"change",this.render),jl.trigger("occupantModalInitialized",{model:this.model,message:this.message})},toHTML(){var e,t,n,s;const i=this.model??this.message,r=null==i?void 0:i.get("jid");return(e=>{var t,n;return el`
2021-11-11 22:06:49 +01:00
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="user-details-modal-label">${e.display_name}</h5>
2022-01-03 11:54:10 +01:00
${lp}
2021-11-11 22:06:49 +01:00
</div>
2022-01-03 11:54:10 +01:00
<div class="modal-body" class="d-flex">
<div class="row">
<div class="col-auto">
<converse-avatar
class="avatar modal-avatar"
.data=${null===(t=e.vcard)||void 0===t?void 0:t.attributes}
nonce=${null===(n=e.vcard)||void 0===n?void 0:n.get("vcard_updated")}
height="120" width="120"></converse-avatar>
</div>
<div class="col">
<ul class="occupant-details">
<li>
${e.nick?el`<div class="row"><strong>${Eh("Nickname")}:</strong></div><div class="row">${e.nick}</div>`:""}
</li>
<li>
${e.jid?el`<div class="row"><strong>${Eh("XMPP Address")}:</strong></div><div class="row">${e.jid}</div>`:""}
</li>
<li>
${e.affiliation?el`<div class="row"><strong>${Eh("Affiliation")}:</strong></div><div class="row">${e.affiliation}</div>`:""}
</li>
<li>
${e.role?el`<div class="row"><strong>${Eh("Roles")}:</strong></div><div class="row">${e.role}</div>`:""}
</li>
<li>
${e.hats?el`<div class="row"><strong>${Eh("Hats")}:</strong></div><div class="row">${e.hats}</div>`:""}
</li>
<li>
${e.occupant_id?el`<div class="row"><strong>${Eh("Occupant Id")}:</strong></div><div class="row">${e.occupant_id}</div>`:""}
</li>
</ul>
</div>
</div>
2021-11-11 22:06:49 +01:00
</div>
<div class="modal-footer">
2022-01-03 11:54:10 +01:00
${cp}
2021-11-11 22:06:49 +01:00
</div>
</div>
</div>
2022-01-03 11:54:10 +01:00
`})({jid:r,vcard:wa.vcards.findWhere({jid:r}),display_name:null==i?void 0:i.getDisplayName(),nick:i.get("nick"),occupant_id:i.get("occupant_id"),role:null===(e=this.model)||void 0===e?void 0:e.get("role"),affiliation:null===(t=this.model)||void 0===t?void 0:t.get("affiliation"),hats:null!==(n=this.model)&&void 0!==n&&null!==(s=n.get("hats"))&&void 0!==s&&s.length?this.model.get("hats"):null})}});wa.OccupantModal=Bv;const qv=Bv,Hv=$l.env.utils,Gv=ap.extend({id:"user-details-modal",persistent:!0,events:{"click button.refresh-contact":"refreshContact"},initialize(){ap.prototype.initialize.apply(this,arguments),this.model.rosterContactAdded.then((()=>this.registerContactEventHandlers())),this.listenTo(this.model,"change",this.render),this.registerContactEventHandlers(),jl.trigger("userDetailsModalInitialized",this.model)},toHTML(){var e;const t=null===(e=this.model)||void 0===e?void 0:e.vcard,n=t?t.toJSON():{};return(e=>{const t=Eh("XMPP Address"),n=Eh("Email"),s=Eh("Full Name"),i=Eh("Nickname"),r=Eh("The User's Profile Image"),o=Eh("Refresh"),a=Eh("Role"),c=Eh("URL"),l={alt_text:r,extra_classes:"mb-3",height:"120",width:"120"};return el`
2021-11-11 22:06:49 +01:00
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="user-details-modal-label">${e.display_name}</h5>
2022-01-03 11:54:10 +01:00
${lp}
2021-11-11 22:06:49 +01:00
</div>
<div class="modal-body">
2022-01-03 11:54:10 +01:00
${e.image?el`<div class="mb-4">${Rv(Object.assign(e,l))}</div>`:""}
${e.fullname?el`<p><label>${s}:</label> ${e.fullname}</p>`:""}
2021-11-11 22:06:49 +01:00
<p><label>${t}:</label> <a href="xmpp:${e.jid}">${e.jid}</a></p>
2022-01-03 11:54:10 +01:00
${e.nickname?el`<p><label>${i}:</label> ${e.nickname}</p>`:""}
${e.url?el`<p><label>${c}:</label> <a target="_blank" rel="noopener" href="${e.url}">${e.url}</a></p>`:""}
${e.email?el`<p><label>${n}:</label> <a href="mailto:${e.email}">${e.email}</a></p>`:""}
${e.role?el`<p><label>${a}:</label> ${e.role}</p>`:""}
2021-11-11 22:06:49 +01:00
2022-01-03 11:54:10 +01:00
<converse-omemo-fingerprints jid=${e.jid}></converse-omemo-fingerprints>
2021-11-11 22:06:49 +01:00
</div>
<div class="modal-footer">
2022-01-03 11:54:10 +01:00
${cp}
2021-11-11 22:06:49 +01:00
<button type="button" class="btn btn-info refresh-contact"><i class="fa fa-refresh"> </i>${o}</button>
2022-01-03 11:54:10 +01:00
${e.allow_contact_removal&&e.is_roster_contact?(e=>{const t=Eh("Remove as contact");return el`
2021-11-11 22:06:49 +01:00
<button type="button" @click="${e.removeContact}" class="btn btn-danger remove-contact">
<i class="far fa-trash-alt"></i>${t}
</button>
`})(e):""}
2021-03-19 19:26:15 +01:00
</div>
</div>
2021-11-11 22:06:49 +01:00
</div>
2022-01-03 11:54:10 +01:00
`})(Object.assign(this.model.toJSON(),n,{_converse:wa,allow_contact_removal:jl.settings.get("allow_contact_removal"),display_name:this.model.getDisplayName(),is_roster_contact:void 0!==this.model.contact,removeContact:e=>this.removeContact(e),view:this,utils:Hv}))},registerContactEventHandlers(){void 0!==this.model.contact&&(this.listenTo(this.model.contact,"change",this.render),this.listenTo(this.model.contact.vcard,"change",this.render),this.model.contact.on("destroy",(()=>{delete this.model.contact,this.render()})))},async refreshContact(e){e&&e.preventDefault&&e.preventDefault();const t=this.el.querySelector(".fa-refresh");Hv.addClass("fa-spin",t);try{await jl.vcard.update(this.model.contact.vcard,!0)}catch(e){M.fatal(e),this.alert(Eh("Sorry, something went wrong while trying to refresh"),"danger")}Hv.removeClass("fa-spin",t)},removeContact(e){var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),jl.settings.get("allow_contact_removal")&&!0===confirm(Eh("Are you sure you want to remove this contact?"))&&(setTimeout((()=>function(e){e.removeFromRoster((()=>e.destroy()),(t=>{t&&M.error(t),jl.alert("error",Eh("Error"),[Eh("Sorry, there was an error while trying to remove %1$s as a contact.",e.getDisplayName())])}))}(this.model.contact)),1),this.modal.hide())}});wa.UserDetailsModal=Gv;const Wv=Gv,{dayjs:Vv}=$l.env,{dayjs:Jv}=$l.env;function Qv(e){return!!Dl(e).host()}jl.elements.define("converse-image",class extends ig{static get properties(){return{href:{type:String},onImgLoad:{type:Function},text:{type:String}}}render(){const e=Fl(this.href);return Hl(this.text)&&this.shouldRenderMedia(this.text,"image")?sv(e):ov({url:this.text,href:e,onClick:this.onImgClick,onLoad:this.onImgLoad})}});const Zv=(e,t)=>e.url&&Qv(e.url)&&!Hl(e.image)?el`<a href="${e.url}" target="_blank" rel="noopener">${t(e)}</a>`:t(e),Kv=e=>el`<converse-image class="card-img-top" text="${e.image}" href="${e.url}" .onImgLoad=${e.onload}></converse-image>`;var Yv=n(5046),Xv={};Xv.styleTagTransform=vg(),Xv.setAttributes=fg(),Xv.insert=ug().bind(null,"head"),Xv.domAPI=lg(),Xv.insertStyleElement=gg(),ag()(Yv.Z,Xv),Yv.Z&&Yv.Z.locals&&Yv.Z.locals,jl.elements.define("converse-message-unfurl",class extends ig{static get properties(){return{description:{type:String},image:{type:String},jid:{type:String},title:{type:String},url:{type:String}}}initialize(){const e=va();this.listenTo(e,"change:allowed_image_domains",(()=>this.requestUpdate())),this.listenTo(e,"change:render_media",(()=>this.requestUpdate()))}render(){return(e=>{const t=(n=e.image)&&Ul(n,"allowed_image_domains")&&Qv(n);var n;const s=e.title||e.description||e.url;return t||s?el`<div class="card card--unfurl">
${t?Zv(e,Kv):""}
${s?el` <div class="card-body">
${e.title?Zv(e,(e=>el`<h5 class="card-title">${e.title}</h5>`)):""}
${e.description?el`<p class="card-text">
<converse-rich-text text=${e.description}></converse-rich-text>
</p>`:""}
${e.url?el`<p class="card-text">
<a href="${e.url}" target="_blank" rel="noopener">${Dl(e.url).domain()}</a>
</p>`:""}
</div>`:""}
</div>`:""})(Object.assign({onload:()=>this.onImageLoad()},{description:this.description||"",image:this.image||"",title:this.title||"",url:this.url||""}))}onImageLoad(){this.dispatchEvent(new CustomEvent("imageLoaded",{detail:this,bubbles:!0}))}});var ey=n(9523),ty={};ty.styleTagTransform=vg(),ty.setAttributes=fg(),ty.insert=ug().bind(null,"head"),ty.domAPI=lg(),ty.insertStyleElement=gg(),ag()(ey.Z,ty),ey.Z&&ey.Z.locals&&ey.Z.locals;const ny=(e={})=>{var t;return null!==(t=e.classes)&&void 0!==t&&t.includes("hor_centered")?el`<div class="spinner__container"><span class="spinner fa fa-spinner centered ${e.classes||""}"/></div>`:el`<span class="spinner fa fa-spinner centered ${e.classes||""}"/>`};var sy=n(7272),iy=n.n(sy);const{dayjs:ry}=$l.env;function oy(e){if(!e.isHidden()&&jl.settings.get("allow_url_history_change")){const t=window.location.hash;t&&e.messages.get(t.slice(1))&&wa.router.history.navigate()}}const ay=iy()((e=>function(e){const t=e.target;if("converse-chat-content"!==t.nodeName.toLowerCase())return;let n=!0;const s=0===Math.floor(t.scrollTop),i=Math.ceil(t.clientHeight-t.scrollTop)>=t.scrollHeight-Math.ceil(t.scrollHeight/20);s?(n=!1,oy(t.model)):i&&jl.trigger("chatBoxScrolledUp",t),t.model.get("scolled")!==n&&t.model.ui.set({scrolled:n})}(e)),50);function cy(e){if("groupchat"===e.get("type")){var t;const n=jl.settings.get("muc_hats").filter((e=>e)).map((e=>e.toLowerCase()));let s=[];n.includes("vcard_roles")&&(s=e.vcard?e.vcard.get("role"):null,s=s?s.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"))||[],...s,...i]}return[]}const{Strophe:ly,dayjs:dy}=$l.env;jl.elements.define("converse-chat-message",class extends ig{static get properties(){return{jid:{type:String},mid:{type:String}}}async initialize(){if(await this.setModels(),!this.model)return void M.error("Could not find module for converse-chat-message");const e=va();this.listenTo(e,"change:render_media",(()=>{this.model.save("hide_url_previews",void 0),this.requestUpdate()})),this.listenTo(this.chatbox,"change:first_unread_id",(()=>this.requestUpdate())),this.listenTo(this.model,"change",(()=>this.requestUpdate())),this.model.vcard&&this.listenTo(this.model.vcard,"change",(()=>this.requestUpdate())),"groupchat"===this.model.get("type")&&(this.model.occupant?this.listenTo(this.model.occupant,"change",(()=>this.requestUpdate())):this.listenTo(this.model,"occupantAdded",(()=>{this.requestUpdate(),this.listenTo(this.model.occupant,"change",(()=>this.requestUpdate()))})))}async setModels(){this.chatbox=await jl.chatboxes.get(this.jid),await this.chatbox.initialized,await this.chatbox.messages.fetched,this.model=this.chatbox.messages.get(this.mid),this.model&&this.requestUpdate()}render(){return this.model?this.show_spinner?ny():this.model.get("file")&&this.model.get("upload")!==wa.SUCCESS?this.renderFileProgress():["mep"].includes(this.model.get("type"))?this.renderMEPMessage():["error","info"].includes(this.model.get("type"))?this.renderInfoMessage():this.renderChatMessage():""}getProps(){return Object.assign(this.model.toJSON(),this.getDerivedMessageProps())}renderRetraction(){return(e=>{const t=e.isRetracted()?e.getRetractionText():null;return el`
<div class="retraction">${t}</div>
${e.model.get("moderation_reason")?el`<q class="chat-msg--retracted__reason">${e.model.get("moderation_reason")}</q>`:""}`})(this)}renderMessageText(){return(e=>{const t=Eh("Show more"),n="groupchat"===e.model.get("type"),s=Eh("Show less"),i=el`
<div class="chat-msg__spoiler-hint">
<span class="spoiler-hint">${e.model.get("spoiler_hint")}</span>
<a class="badge badge-info spoiler-toggle" href="#" @click=${e.toggleSpoilerMessage}>
<i class="fa ${e.model.get("is_spoiler_visible")?"fa-eye-slash":"fa-eye"}"></i>
${e.model.get("is_spoiler_visible")?s:t}
</a>
</div>
`,r=e.model.get("is_spoiler")?"spoiler "+(e.model.get("is_spoiler_visible")?"":"hidden"):"",o=e.model.getMessageText(),a=e.model.get("oob_url")&&o!==e.model.get("oob_url");return el`
${e.model.get("is_spoiler")?i:""}
${e.model.get("subject")?el`<div class="chat-msg__subject">${e.model.get("subject")}</div>`:""}
<span>
<converse-chat-message-body
class="chat-msg__text ${e.model.get("is_only_emojis")?"chat-msg__text--larger":""} ${r}"
.model="${e.model}"
hide_url_previews=${e.model.get("hide_url_previews")}
?is_me_message=${e.model.isMeCommand()}
text="${o}"></converse-chat-message-body>
${!e.model.get("received")||e.model.isMeCommand()||n?"":el`<span class="fa fa-check chat-msg__receipt"></span>`}
${e.model.get("edited")?(e=>{const t=Eh("This message has been edited");return el`<converse-icon title="${t}" class="fa fa-edit chat-msg__edit-modal" @click=${e.showMessageVersionsModal} size="1em"></converse-icon>`})(e):""}
</span>
${a?el`<div class="chat-msg__media">${Kp(e.model.get("oob_url"))}</div>`:""}
<div class="chat-msg__error">${e.model.get("error_text")||e.model.get("error")}</div>
`})(this)}renderMEPMessage(){return(e=>{const t=Jv(e.model.get("time")).toISOString();return el`
<div class="message chat-info message--mep ${e.getExtraMessageClasses()}"
data-isodate="${t}"
data-type="${e.data_name}"
data-value="${e.data_value}">
<div class="chat-msg__content">
<div class="chat-msg__body chat-msg__body--${e.model.get("type")} ${e.model.get("is_delayed")?"chat-msg__body--delayed":""}">
<div class="chat-info__message">
${e.isRetracted()?e.renderRetraction():el`
<converse-rich-text
.mentions=${e.model.get("references")}
render_styling
text=${e.model.getMessageText()}>
</converse-rich-text>
${e.model.get("reason")?el`<q class="reason"><converse-rich-text text=${e.model.get("reason")}></converse-rich-text></q>`:""}
`}
</div>
<converse-message-actions
?is_retracted=${e.isRetracted()}
.model=${e.model}></converse-message-actions>
</div>
</div>
</div>`})(this)}renderInfoMessage(){return(e=>{const t=Vv(e.model.get("time")).toISOString(),n=Eh("Retry");return el`
2021-11-11 22:06:49 +01:00
<div class="message chat-info chat-${e.model.get("type")}"
data-isodate="${t}"
data-type="${e.data_name}"
data-value="${e.data_value}">
<div class="chat-info__message">
<converse-rich-text
.mentions=${e.model.get("references")}
render_styling
text=${e.model.getMessageText()}>
</converse-rich-text>
</div>
2022-01-03 11:54:10 +01:00
${e.model.get("reason")?el`<q class="reason">${e.model.get("reason")}</q>`:""}
${e.model.get("error_text")?el`<q class="reason">${e.model.get("error_text")}</q>`:""}
${e.model.get("retry_event_id")?el`<a class="retry" @click=${e.onRetryClicked}>${n}</a>`:""}
</div>`})(this)}renderFileProgress(){return this.model.file?(e=>{var t,n;const s=Eh("Uploading file:"),i=e.model.file.name,r=wd()(e.model.file.size);return el`
<div class="message chat-msg">
${e.shouldShowAvatar()?el`<a class="show-msg-author-modal" @click=${e.showUserModal}>
<converse-avatar class="avatar align-self-center"
.data=${null===(t=e.model.vcard)||void 0===t?void 0:t.attributes}
nonce=${null===(n=e.model.vcard)||void 0===n?void 0:n.get("vcard_updated")}
height="40" width="40"></converse-avatar>
</a>`:""}
<div class="chat-msg__content">
<span class="chat-msg__text">${s} <strong>${i}</strong>, ${r}</span>
<progress value="${e.model.get("progress")}"/>
</div>
</div>`})(this):""}renderChatMessage(){return((e,t)=>{var n,s,i;const r=Eh("New messages"),o=e.model.isFollowup();return el`
${t.is_first_unread?el`<div class="message separator"><hr class="separator"><span class="separator-text">${r}</span></div>`:""}
2021-03-19 19:26:15 +01:00
<div class="message chat-msg ${e.getExtraMessageClasses()}"
2021-11-11 22:06:49 +01:00
data-isodate="${t.time}"
data-msgid="${t.msgid}"
data-from="${t.from}"
data-encrypted="${t.is_encrypted}">
2021-03-19 19:26:15 +01:00
<!-- Anchor to allow us to scroll the message into view -->
2021-11-11 22:06:49 +01:00
<a id="${t.msgid}"></a>
2021-03-19 19:26:15 +01:00
2022-01-03 11:54:10 +01:00
${t.should_show_avatar&&!o?el`<a class="show-msg-author-modal" @click=${e.showUserModal}>
<converse-avatar
class="avatar align-self-center"
.data=${null===(n=e.model.vcard)||void 0===n?void 0:n.attributes}
nonce=${null===(s=e.model.vcard)||void 0===s?void 0:s.get("vcard_updated")}
height="40" width="40"></converse-avatar>
</a>`:""}
2021-03-19 19:26:15 +01:00
2022-01-03 11:54:10 +01:00
<div class="chat-msg__content chat-msg__content--${t.sender} ${t.is_me_message?"chat-msg__content--action":""}">
${t.is_me_message||o?"":el`
2021-03-19 19:26:15 +01:00
<span class="chat-msg__heading">
2021-11-11 22:06:49 +01:00
<span class="chat-msg__author"><a class="show-msg-author-modal" @click=${e.showUserModal}>${t.username}</a></span>
2022-01-03 11:54:10 +01:00
${t.hats.map((e=>el`<span class="badge badge-secondary">${e.title}</span>`))}
2021-11-11 22:06:49 +01:00
<time timestamp="${e.model.get("edited")||e.model.get("time")}" class="chat-msg__time">${t.pretty_time}</time>
2022-01-03 11:54:10 +01:00
${t.is_encrypted?el`<span class="fa fa-lock"></span>`:""}
2021-03-19 19:26:15 +01:00
</span>`}
2022-01-03 11:54:10 +01:00
2021-11-11 22:06:49 +01:00
<div class="chat-msg__body chat-msg__body--${t.message_type} ${t.received?"chat-msg__body--received":""} ${t.is_delayed?"chat-msg__body--delayed":""}">
2021-03-19 19:26:15 +01:00
<div class="chat-msg__message">
2022-01-03 11:54:10 +01:00
${t.is_me_message?el`
2021-11-11 22:06:49 +01:00
<time timestamp="${t.edited||t.time}" class="chat-msg__time">${t.pretty_time}</time>&nbsp;
<span class="chat-msg__author">${t.is_me_message?"**":""}${t.username}</span>&nbsp;`:""}
${t.is_retracted?e.renderRetraction():e.renderMessageText()}
2021-03-19 19:26:15 +01:00
</div>
<converse-message-actions
.model=${e.model}
2022-01-03 11:54:10 +01:00
?is_retracted=${t.is_retracted}></converse-message-actions>
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
2022-01-03 11:54:10 +01:00
${null===(i=e.model.get("ogp_metadata"))||void 0===i?void 0:i.map((t=>{var n;return!0===e.model.get("hide_url_previews")?"":Pl(t["og:image"],"image")?el`<converse-message-unfurl
2021-11-11 22:06:49 +01:00
@animationend="${e.onUnfurlAnimationEnd}"
class="${e.model.get("url_preview_transition")}"
jid="${null===(n=e.chatbox)||void 0===n?void 0:n.get("jid")}"
description="${t["og:description"]||""}"
title="${t["og:title"]||""}"
image="${t["og:image"]||""}"
2022-01-03 11:54:10 +01:00
url="${t["og:url"]||""}"></converse-message-unfurl>`:""}))}
2021-03-19 19:26:15 +01:00
</div>
2022-01-03 11:54:10 +01:00
</div>`})(this,this.getProps())}shouldShowAvatar(){return jl.settings.get("show_message_avatar")&&!this.model.isMeCommand()&&["chat","groupchat"].includes(this.model.get("type"))}onUnfurlAnimationEnd(){"fade-out"===this.model.get("url_preview_transition")&&this.model.save({hide_url_previews:!0,url_preview_transition:"fade-in"})}async onRetryClicked(){this.show_spinner=!0,this.requestUpdate(),await jl.trigger(this.model.get("retry_event_id"),{synchronous:!0}),this.model.destroy(),this.parentElement.removeChild(this)}isRetracted(){return this.model.get("retracted")||"retracted"===this.model.get("moderated")}hasMentions(){return"groupchat"===this.model.get("type")&&"them"===this.model.get("sender")&&this.chatbox.isUserMentioned(this.model)}getOccupantAffiliation(){var e;return null===(e=this.model.occupant)||void 0===e?void 0:e.get("affiliation")}getOccupantRole(){var e;return null===(e=this.model.occupant)||void 0===e?void 0:e.get("role")}getExtraMessageClasses(){const e=[this.model.isFollowup()?"chat-msg--followup":null,this.model.get("is_delayed")?"delayed":null,this.model.isMeCommand()?"chat-msg--action":null,this.isRetracted()?"chat-msg--retracted":null,this.model.get("type"),this.shouldShowAvatar()?"chat-msg--with-avatar":null].map((e=>e));return"groupchat"===this.model.get("type")&&(e.push(this.getOccupantRole()??""),e.push(this.getOccupantAffiliation()??""),"them"===this.model.get("sender")&&this.hasMentions()&&e.push("mentioned")),this.model.get("correcting")&&e.push("correcting"),e.filter((e=>e)).join(" ")}getDerivedMessageProps(){const e=jl.settings.get("time_format");return{pretty_time:dy(this.model.get("edited")||this.model.get("time")).format(e),has_mentions:this.hasMentions(),hats:cy(this.model),is_first_unread:this.chatbox.get("first_unread_id")===this.model.get("id"),is_me_message:this.model.isMeCommand(),is_retracted:this.isRetracted(),username:this.model.getDisplayName(),should_show_avatar:this.shouldShowAvatar()}}getRetractionText(){if(["groupchat","mep"].includes(this.model.get("type"))&&this.model.get("moderated_by")){const e=this.model.get("moderated_by"),t=this.model.collection.chatbox;this.model.mod||(this.model.mod=t.occupants.findOccupant({jid:e})||t.occupants.findOccupant({nick:ly.getResourceFromJid(e)}));const n=this.model.mod?this.model.mod.getDisplayName():"A moderator";return Eh("%1$s has removed this message",n)}return Eh("%1$s has removed this message",this.model.getDisplayName())}showUserModal(e){if("me"===this.model.get("sender"))jl.modal.show(wa.ProfileModal,{model:this.model},e);else if("groupchat"===this.model.get("type"))e.preventDefault(),jl.modal.show(qv,{model:this.model.occupant,message:this.model},e);else{e.preventDefault();const t=this.model.collection.chatbox;jl.modal.show(Wv,{model:t},e)}}showMessageVersionsModal(e){e.preventDefault(),jl.modal.show(Pv,{model:this.model},e)}toggleSpoilerMessage(e){null==e||e.preventDefault(),this.model.save({is_spoiler_visible:!this.model.get("is_spoiler_visible")})}}),jl.elements.define("converse-message-history",class extends ig{static get properties(){return{model:{type:Object},messages:{type:Array}}}render(){const e=this.messages;return e.length?Wg(e,(e=>e.get("id")),(e=>el`${this.renderMessage(e)}`)):""}renderMessage(e){if(e.get("dangling_retraction")||e.get("is_only_key"))return"";const t=e.get("template_hook");if("string"==typeof t){const n=jl.hook(t,e,"");return xp(n,"")}{const t=el`<converse-chat-message
2021-11-11 22:06:49 +01:00
jid="${this.model.get("jid")}"
2022-01-03 11:54:10 +01:00
mid="${e.get("id")}"></converse-chat-message>`,n=function(e){var t;const n=null===(t=e.collection)||void 0===t?void 0:t.models;if(!n)return;const s=n.indexOf(e),i=n[s-1];if(!i||ry(e.get("time")).isAfter(ry(i.get("time")),"day")){const t=ry(e.get("time")).startOf("day");return(e=>el`
2021-11-11 22:06:49 +01:00
<div class="message date-separator" data-isodate="${e.time}">
2021-03-19 19:26:15 +01:00
<hr class="separator"/>
2021-11-11 22:06:49 +01:00
<time class="separator-text" datetime="${e.time}"><span>${e.datestring}</span></time>
2021-03-19 19:26:15 +01:00
</div>
2022-01-03 11:54:10 +01:00
`)({type:"date",time:t.toISOString(),datestring:t.format("dddd MMM Do YYYY")})}}(e);return n?[n,t]:t}}});var uy=n(8054),hy={};hy.styleTagTransform=vg(),hy.setAttributes=fg(),hy.insert=ug().bind(null,"head"),hy.domAPI=lg(),hy.insertStyleElement=gg(),ag()(uy.Z,hy),uy.Z&&uy.Z.locals&&uy.Z.locals,jl.elements.define("converse-chat-content",class extends ig{static get properties(){return{jid:{type:String}}}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("scroll",ay)}async initialize(){await this.setModels(),this.listenTo(this.model,"change:hidden_occupants",this.requestUpdate),this.listenTo(this.model.messages,"add",this.requestUpdate),this.listenTo(this.model.messages,"change",this.requestUpdate),this.listenTo(this.model.messages,"remove",this.requestUpdate),this.listenTo(this.model.messages,"rendered",this.requestUpdate),this.listenTo(this.model.messages,"reset",this.requestUpdate),this.listenTo(this.model.notifications,"change",this.requestUpdate),this.listenTo(this.model.ui,"change",this.requestUpdate),this.listenTo(this.model.ui,"change:scrolled",this.scrollDown),this.model.occupants&&this.listenTo(this.model.occupants,"change",this.requestUpdate),this.addEventListener("scroll",ay)}async setModels(){this.model=await jl.chatboxes.get(this.jid),await this.model.initialized,this.requestUpdate()}render(){var e;return this.model?el`
2021-11-11 22:06:49 +01:00
<div class="chat-content__notifications">${this.model.getNotificationsText()}</div>
2021-03-19 19:26:15 +01:00
<converse-message-history
2021-11-11 22:06:49 +01:00
.model=${this.model}
.messages=${[...this.model.messages.models]}>
2021-03-19 19:26:15 +01:00
</converse-message-history>
2022-01-03 11:54:10 +01:00
${null!==(e=this.model.ui)&&void 0!==e&&e.get("chat-content-spinner-top")?el`<span class="spinner fa fa-spinner centered"></span>`:""}
`:""}scrollDown(){if(!this.model.ui.get("scrolled")){if(this.scrollTo){const e=this.scrollTop?"smooth":"auto";this.scrollTo({top:0,behavior:e})}else this.scrollTop=0;jl.trigger("chatBoxScrolledDown",{chatbox:this.model})}}});class fy extends zg{constructor(e){if(super(e),this.vt=nl,2!==e.type)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===nl)return this.Vt=void 0,this.vt=e;if(e===tl)return e;if("string"!=typeof e)throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.vt)return this.Vt;this.vt=e;const t=[e];return t.raw=t,this.Vt={_$litType$:this.constructor.resultType,strings:t,values:[]}}}fy.directiveName="unsafeHTML",fy.resultType=1;const my=Lg(fy);jl.elements.define("converse-chat-help",class extends ig{static get properties(){return{chat_type:{type:String},messages:{type:Array},model:{type:Object},type:{type:String}}}render(){const e=(new Date).toISOString();return[el`<converse-icon class="fas fa-times close-chat-help"
2021-03-19 19:26:15 +01:00
@click=${this.close}
2022-01-03 11:54:10 +01:00
path-prefix="${jl.settings.get("assets_path")}"
size="1em"></converse-icon>`,...this.messages.map((t=>this.renderHelpMessage({isodate:e,markup:Oo().sanitize(t,{ALLOWED_TAGS:["strong"]})})))]}close(){this.model.set({show_help_messages:!1})}renderHelpMessage(e){return el`<div class="message chat-${this.type}" data-isodate="${e.isodate}">${my(e.markup)}</div>`}});const gy=$l.env.utils,py=e=>el`
2021-03-19 19:26:15 +01:00
<li class="emoji insert-emoji ${e.shouldBeHidden(e.emoji.sn)?"hidden":""}" data-emoji="${e.emoji.sn}" title="${e.emoji.sn}">
2022-01-03 11:54:10 +01:00
<a href="#" @click=${e.insertEmoji} data-emoji="${e.emoji.sn}">${gy.shortnamesToEmojis(e.emoji.sn)}</a>
2021-03-19 19:26:15 +01:00
</li>
2022-01-03 11:54:10 +01:00
`,vy=e=>{const t=Eh("Search");return el`
2021-03-19 19:26:15 +01:00
<div class="emoji-picker__header">
<input class="form-control emoji-search" name="emoji-search" placeholder="${t}"
.value=${e.query||""}
@keydown=${e.onSearchInputKeyDown}
@blur=${e.onSearchInputBlurred}
@focus=${e.onSearchInputFocus}>
2022-01-03 11:54:10 +01:00
${e.query?"":(e=>{const t=jl.settings.get("emoji_categories");return el`<ul>${Object.keys(t).map((n=>t[n]?(e=>el`
2021-11-11 22:06:49 +01:00
<li data-category="${e.category}"
class="emoji-category ${e.category} ${e.current_category===e.category?"picked":""}"
2022-01-03 11:54:10 +01:00
title="${Eh(jl.settings.get("emoji_category_labels")[e.category])}">
2021-11-11 22:06:49 +01:00
<a class="pick-category"
@click=${e.onCategoryPicked}
href="#emoji-picker-${e.category}"
data-category="${e.category}">${e.emoji} </a>
</li>
`)(Object.assign({category:n,emoji:e.sn2Emoji(t[n])},e)):""))}</ul>`})(e)}
2021-03-19 19:26:15 +01:00
</div>
2022-01-03 11:54:10 +01:00
${e.render_emojis?el`<converse-emoji-picker-content
2021-03-19 19:26:15 +01:00
.chatview=${e.chatview}
.model=${e.model}
.search_results="${e.search_results}"
current_skintone="${e.current_skintone}"
query="${e.query}"></converse-emoji-picker-content>`:""}
<div class="emoji-skintone-picker">
<label>Skin tone</label>
2022-01-03 11:54:10 +01:00
<ul>${["tone1","tone2","tone3","tone4","tone5"].map((t=>(e=>el`
2021-03-19 19:26:15 +01:00
<li data-skintone="${e.skintone}" class="emoji-skintone ${e.current_skintone===e.skintone?"picked":""}">
2022-01-03 11:54:10 +01:00
<a class="pick-skintone" href="#" data-skintone="${e.skintone}" @click=${e.onSkintonePicked}>${gy.shortnamesToEmojis(":"+e.skintone+":")}</a>
2021-11-11 22:06:49 +01:00
</li>`)(Object.assign({skintone:t},e))))}</ul>
2022-01-03 11:54:10 +01:00
</div>`},{sizzle:yy}=$l.env;jl.elements.define("converse-emoji-picker-content",class extends ig{static get properties(){return{chatview:{type:Object},search_results:{type:Array},current_skintone:{type:String},model:{type:Object},query:{type:String}}}render(){const e={current_skintone:this.current_skintone,insertEmoji:e=>this.insertEmoji(e),query:this.query,search_results:this.search_results,shouldBeHidden:e=>this.shouldBeHidden(e)};return el`
2021-03-19 19:26:15 +01:00
<div class="emoji-picker__lists">
2022-01-03 11:54:10 +01:00
${(e=>{const t=Eh("Search results");return el`
2021-03-19 19:26:15 +01:00
<span ?hidden=${!e.query} class="emoji-lists__container emojis-lists__container--search">
<a id="emoji-picker-search-results" class="emoji-category__heading">${t}</a>
<ul class="emoji-picker">
2022-01-03 11:54:10 +01:00
${e.search_results.map((t=>py(Object.assign({emoji:t},e))))}
2021-03-19 19:26:15 +01:00
</ul>
</span>
`})(e)}
2022-01-03 11:54:10 +01:00
${(e=>{const t=jl.settings.get("emoji_categories");return el`
2021-11-11 22:06:49 +01:00
<span ?hidden=${e.query} class="emoji-lists__container emoji-lists__container--browse">
2022-01-03 11:54:10 +01:00
${Object.keys(t).map((n=>t[n]?(e=>el`
<a id="emoji-picker-${e.category}" class="emoji-category__heading" data-category="${e.category}">${Eh(jl.settings.get("emoji_category_labels")[e.category])}</a>
2021-11-11 22:06:49 +01:00
<ul class="emoji-picker" data-category="${e.category}">
2022-01-03 11:54:10 +01:00
${Object.values($l.emojis.json[e.category]).map((t=>py(Object.assign({emoji:t},e))))}
2021-11-11 22:06:49 +01:00
</ul>`)(Object.assign({category:n},e)):""))}
</span>`})(e)}
2021-03-19 19:26:15 +01:00
</div>
2022-01-03 11:54:10 +01:00
`}firstUpdated(){this.initIntersectionObserver()}initIntersectionObserver(){if(window.IntersectionObserver){if(this.observer)this.observer.disconnect();else{const e={root:this.querySelector(".emoji-picker__lists"),threshold:[.1]},t=e=>this.setCategoryOnVisibilityChange(e);this.observer=new IntersectionObserver(t,e)}yy(".emoji-picker",this).forEach((e=>this.observer.observe(e)))}}setCategoryOnVisibilityChange(e){const t=this.parentElement.navigator.selected;let n;if(n=e.filter((e=>e.target.contains(t))).pop()||e.reduce(((e,t)=>t.intersectionRatio>=((null==e?void 0:e.intersectionRatio)||0)?t:e),null),n&&n.isIntersecting){const e=n.target.getAttribute("data-category");e!==this.model.get("current_category")&&(this.parentElement.preserve_scroll=!0,this.model.save({current_category:e}))}}insertEmoji(e){e.preventDefault(),e.stopPropagation();const t="IMG"===e.target.nodeName?e.target.parentElement:e.target;this.parentElement.insertIntoTextArea(t.getAttribute("data-emoji"))}shouldBeHidden(e){if(e.includes("_tone")){if(!this.current_skintone||!e.includes(this.current_skintone))return!0}else if(this.current_skintone&&$l.emojis.toned.includes(e))return!0;return!(!this.query||wa.FILTER_CONTAINS(e,this.query))}});const by=$l.env.utils;jl.elements.define("converse-emoji-dropdown",class extends Mv{static get properties(){return{chatview:{type:Object}}}constructor(){super(),this.render_emojis=!1}initModel(){return this.init_promise||(this.init_promise=(async()=>{await jl.emojis.initialize();const e=`converse.emoji-${wa.bare_jid}-${this.chatview.model.get("jid")}`;this.model=new wa.EmojiPicker({id:e}),_o(this.model,e),await new Promise((e=>this.model.fetch({success:e,error:e}))),this.model.set({autocompleting:null,ac_position:null})})()),this.init_promise}render(){return el`
2021-03-19 19:26:15 +01:00
<div class="dropup">
<button class="toggle-emojis"
2022-01-03 11:54:10 +01:00
title="${Eh("Insert emojis")}"
2021-03-19 19:26:15 +01:00
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false">
<converse-icon
class="fa fa-smile "
2022-01-03 11:54:10 +01:00
path-prefix="${jl.settings.get("assets_path")}"
2021-03-19 19:26:15 +01:00
size="1em"></converse-icon>
</button>
<div class="dropdown-menu">
2022-01-03 11:54:10 +01:00
${xp(this.initModel().then((()=>el`
2021-03-19 19:26:15 +01:00
<converse-emoji-picker
.chatview=${this.chatview}
.model=${this.model}
?render_emojis=${this.render_emojis}
current_category="${this.model.get("current_category")||""}"
current_skintone="${this.model.get("current_skintone")||""}"
query="${this.model.get("query")||""}"
2021-11-11 22:06:49 +01:00
></converse-emoji-picker>`)),"")}
2021-03-19 19:26:15 +01:00
</div>
2022-01-03 11:54:10 +01:00
</div>`}connectedCallback(){super.connectedCallback(),this.render_emojis=!1}toggleMenu(e){e.stopPropagation(),e.preventDefault(),by.hasClass("show",this.menu)?by.ancestor(e.target,".toggle-emojis")&&this.hideMenu():this.showMenu()}async showMenu(){await this.initModel(),this.render_emojis||(this.render_emojis=!0,await this.requestUpdate()),super.showMenu(),setTimeout((()=>{var e;return null===(e=this.querySelector(".emoji-search"))||void 0===e?void 0:e.focus()}))}});var _y=n(8125),wy={};wy.styleTagTransform=vg(),wy.setAttributes=fg(),wy.insert=ug().bind(null,"head"),wy.domAPI=lg(),wy.insertStyleElement=gg(),ag()(_y.Z,wy),_y.Z&&_y.Z.locals&&_y.Z.locals;const Sy=$l.env.utils;jl.elements.define("converse-emoji-picker",class extends ig{static get properties(){return{chatview:{type:Object},current_category:{type:String,reflect:!0},current_skintone:{type:String,reflect:!0},model:{type:Object},query:{type:String,reflet:!0},render_emojis:{type:Boolean}}}firstUpdated(){super.firstUpdated(),this.listenTo(this.model,"change",(e=>this.onModelChanged(e.changed))),this.initArrowNavigation()}constructor(){super(),this._search_results=[],this.debouncedFilter=gc((e=>this.model.set({query:e.value})),250)}get search_results(){return this._search_results}set search_results(e){this._search_results=e,this.requestUpdate()}render(){return vy({chatview:this.chatview,current_category:this.current_category,current_skintone:this.current_skintone,model:this.model,onCategoryPicked:e=>this.chooseCategory(e),onSearchInputBlurred:e=>this.chatview.emitFocused(e),onSearchInputFocus:e=>this.onSearchInputFocus(e),onSearchInputKeyDown:e=>this.onKeyDown(e),onSkintonePicked:e=>this.chooseSkinTone(e),query:this.query,search_results:this.search_results,render_emojis:this.render_emojis,sn2Emoji:e=>Sy.shortnamesToEmojis(this.getTonedShortname(e))})}updated(e){e.has("query")&&this.updateSearchResults(e),e.has("current_category")&&this.setScrollPosition()}onModelChanged(e){"current_category"in e&&(this.current_category=e.current_category),"current_skintone"in e&&(this.current_skintone=e.current_skintone),"query"in e&&(this.query=e.query)}setScrollPosition(){if(this.preserve_scroll)return void(this.preserve_scroll=!1);const e=this.querySelector(".emoji-lists__container--browse"),t=this.querySelector(`#emoji-picker-${this.current_category}`);t&&(e.scrollTop=t.offsetTop-3*t.offsetHeight+4)}updateSearchResults(e){const t=e.get("query"),n=wa.FILTER_CONTAINS;if(this.query){if(this.query===t)return this.search_results;t&&this.query.includes(t)?this.search_results=this.search_results.filter((e=>n(e.sn,this.query))):this.search_results=$l.emojis.list.filter((e=>n(e.sn,this.query)))}else this.search_results.length&&(this.search_results=[]);this.requestUpdate()}registerEvents(){this.onGlobalKeyDown=e=>this._onGlobalKeyDown(e),document.querySelector("body").addEventListener("keydown",this.onGlobalKeyDown)}connectedCallback(){super.connectedCallback(),this.registerEvents()}disconnectedCallback(){document.querySelector("body").removeEventListener("keydown",this.onGlobalKeyDown),super.disconnectedCallback()}_onGlobalKeyDown(e){this.navigator&&(e.keyCode===$l.keycodes.ENTER&&this.navigator.selected&&Sy.isVisible(this)?this.onEnterPressed(e):e.keyCode===$l.keycodes.DOWN_ARROW&&!this.navigator.enabled&&Sy.isVisible(this)&&this.enableArrowNavigation(e))}setCategoryForElement(e){const t=this.current_category,n=(null==e?void 0:e.getAttribute("data-category"))||t;t!==n&&this.model.save({current_category:n})}insertIntoTextArea(e){const t=this.model.get("autocompleting"),n=this.model.get("ac_position");this.chatview.getMessageForm().insertIntoTextArea(e,t,!1,n),this.model.set({autocompleting:null,query:"",ac_position:null})}chooseSkinTone(e){e.preventDefault(),e.stopPropagation();const t=("IMG"===e.target.nodeName?e.target.parentElement:e.target).getAttribute("data-skintone").trim();this.current_skintone===t?this.model.save({current_skintone:""}):this.model.save({current_skintone:t})}chooseCategory(e){e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation();
2021-11-11 22:06:49 +01:00
<a href="#" class="dropdown-item ${t.a_class}" @click=${t.handler} title="${t.i18n_title}">
<converse-icon size="1em" color="var(--text-color-lighten-15-percent)" class="fa ${t.icon_class}"></converse-icon>
${t.i18n_text}
</a>
2022-01-03 11:54:10 +01:00
`:""}async function Ty(e){const t=await e;return el`
2021-11-11 22:06:49 +01:00
<a
href="#"
class="chatbox-btn ${t.a_class} fa ${t.icon_class}"
@click=${t.handler}
title="${t.i18n_title}"
></a>
2022-01-03 11:54:10 +01:00
`}async function ky(e){!0===confirm(Eh("Are you sure you want to clear the messages from this conversation?"))&&await e.clearMessages()}function jy(e,t){const n=t.replace(/^\s*/,"").match(/^\/(.*)\s*$/);if(n){if("clear"===n[1])return ky(e),!0;var s;if("close"===n[1])return null===(s=wa.chatboxviews.get(e.get("jid")))||void 0===s||s.close(),!0;if("help"===n[1])return e.set({show_help_messages:!1},{silent:!0}),e.set({show_help_messages:!0}),!0}}function Ny(e){if(e.target.value){const t=e.target.scrollHeight+"px";e.target.style.height!=t&&(e.target.style.height="auto",e.target.style.height=t)}else e.target.style=""}window.customElements.define("converse-chat-toolbar",class extends ig{static get properties(){return{composing_spoiler:{type:Boolean},hidden_occupants:{type:Boolean},is_groupchat:{type:Boolean},message_limit:{type:Number},model:{type:Object},show_call_button:{type:Boolean},show_emoji_button:{type:Boolean},show_send_button:{type:Boolean},show_spoiler_button:{type:Boolean}}}connectedCallback(){super.connectedCallback(),this.listenTo(this.model,"change:composing_spoiler",this.requestUpdate)}render(){return el`
<span class="toolbar-buttons">${xp((e=this).getButtons(),"")}</span>
${e.show_send_button?function(){const e=Eh("Send the message");return el`<button type="submit" class="btn send-button" title="${e}">
<converse-icon color="var(--toolbar-btn-text-color)" class="fa fa-paper-plane" size="1em"></converse-icon>
</button>`}():""}
`;var e}firstUpdated(){jl.trigger("renderToolbar",this)}getButtons(){var e;const t=[];if(this.show_emoji_button){const e=wa.chatboxviews.get(this.model.get("jid"));t.push(el`<converse-emoji-dropdown .chatview=${e}></converse-emoji-dropdown>`)}if(this.show_call_button){const e=Eh("Start a call");t.push(el`
2021-11-11 22:06:49 +01:00
<button class="toggle-call" @click=${this.toggleCall} title="${e}">
2021-03-19 19:26:15 +01:00
<converse-icon class="fa fa-phone" path-prefix="/dist" size="1em"></converse-icon>
2022-01-03 11:54:10 +01:00
</button>`)}jl.settings.get("message_limit")&&t.push(el`
2021-11-11 22:06:49 +01:00
<converse-message-limit-indicator .model=${this.model} class="right">
2022-01-03 11:54:10 +01:00
</converse-message-limit-indicator>`),this.show_spoiler_button&&t.push(this.getSpoilerButton());const n=jl.disco.supports(Ay.NS.HTTPUPLOAD,wa.domain);if(t.push(el`${xp(n.then((e=>this.getHTTPUploadButton(e))),"")}`),this.is_groupchat&&null!==(e=jl.settings.get("visible_toolbar_buttons"))&&void 0!==e&&e.toggle_occupants){const e=Eh("Hide participants"),n=Eh("Show participants");t.push(el`
2021-03-19 19:26:15 +01:00
<button class="toggle_occupants right"
2021-11-11 22:06:49 +01:00
title="${this.hidden_occupants?n:e}"
2021-03-19 19:26:15 +01:00
@click=${this.toggleOccupants}>
<converse-icon class="fa ${this.hidden_occupants?"fa-angle-double-left":"fa-angle-double-right"}"
2022-01-03 11:54:10 +01:00
path-prefix="${jl.settings.get("assets_path")}" size="1em"></converse-icon>
</button>`)}return wa.api.hook("getToolbarButtons",this,t)}getHTTPUploadButton(e){if(e){const e=Eh("Choose a file to send");return el`
2021-03-19 19:26:15 +01:00
<button title="${e}" @click=${this.toggleFileUpload}>
<converse-icon class="fa fa-paperclip"
2022-01-03 11:54:10 +01:00
path-prefix="${jl.settings.get("assets_path")}"
2021-03-19 19:26:15 +01:00
size="1em"></converse-icon>
</button>
2022-01-03 11:54:10 +01:00
<input type="file" @change=${this.onFileSelection} class="fileupload" multiple="" style="display:none"/>`}return""}getSpoilerButton(){var e;const t=this.model;if(!(this.is_groupchat||null!==(e=t.presence)&&void 0!==e&&e.resources.length))return;let n;n=this.composing_spoiler?Eh("Click to write as a normal (non-spoiler) message"):Eh("Click to write your message as a spoiler");const s=el`
2021-03-19 19:26:15 +01:00
<button class="toggle-compose-spoiler"
2021-11-11 22:06:49 +01:00
title="${n}"
2021-03-19 19:26:15 +01:00
@click=${this.toggleComposeSpoilerMessage}>
<converse-icon class="fa ${this.composing_spoiler?"fa-eye-slash":"fa-eye"}"
2022-01-03 11:54:10 +01:00
path-prefix="${jl.settings.get("assets_path")}"
2021-03-19 19:26:15 +01:00
size="1em"></converse-icon>
2022-01-03 11:54:10 +01:00
</button>`;if(this.is_groupchat)return s;{const e=t.get("jid"),n=Promise.all(t.presence.resources.map((t=>jl.disco.supports(Ay.NS.SPOILER,`${e}/${t.get("name")}`)))).then((e=>e.reduce(((e,t)=>e&&t),!0)));return el`${xp(n.then((()=>s)),"")}`}}toggleFileUpload(e){var t,n;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),null==e||null===(n=e.stopPropagation)||void 0===n||n.call(e),this.querySelector(".fileupload").click()}onFileSelection(e){this.model.sendFiles(e.target.files)}toggleComposeSpoilerMessage(e){var t,n;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),null==e||null===(n=e.stopPropagation)||void 0===n||n.call(e),this.model.set("composing_spoiler",!this.model.get("composing_spoiler"))}toggleOccupants(e){var t,n;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),null==e||null===(n=e.stopPropagation)||void 0===n||n.call(e),this.model.save({hidden_occupants:!this.model.get("hidden_occupants")})}toggleCall(e){var t,n;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),null==e||null===(n=e.stopPropagation)||void 0===n||n.call(e),jl.trigger("callButtonClicked",{connection:wa.connection,model:this.model})}});var Oy=n(7802),$y={};$y.styleTagTransform=vg(),$y.setAttributes=fg(),$y.insert=ug().bind(null,"head"),$y.domAPI=lg(),$y.insertStyleElement=gg(),ag()(Oy.Z,$y),Oy.Z&&Oy.Z.locals&&Oy.Z.locals,jl.elements.define("converse-chat-heading",class extends ig{initialize(){var e;this.model=wa.chatboxes.get(this.getAttribute("jid")),this.listenTo(this.model,"change:status",this.requestUpdate),this.listenTo(this.model,"vcard:add",this.requestUpdate),this.listenTo(this.model,"vcard:change",this.requestUpdate),this.model.contact&&this.listenTo(this.model.contact,"destroy",this.requestUpdate),null===(e=this.model.rosterContactAdded)||void 0===e||e.then((()=>{this.listenTo(this.model.contact,"change:nickname",this.requestUpdate),this.requestUpdate()}))}render(){return(e=>{var t,n;const s=Eh("The User's Profile Image"),i=el`<span title="${s}">
<converse-avatar
class="avatar chat-msg__avatar"
.data=${null===(t=e.model.vcard)||void 0===t?void 0:t.attributes}
nonce=${null===(n=e.model.vcard)||void 0===n?void 0:n.get("vcard_updated")}
height="40" width="40"></converse-avatar></span>`,r=e.model.getDisplayName();return el`
2021-11-11 22:06:49 +01:00
<div class="chatbox-title ${e.status?"":"chatbox-title--no-desc"}">
<div class="chatbox-title--row">
2022-01-03 11:54:10 +01:00
${wa.api.settings.get("singleton")?"":el`<converse-controlbox-navback jid="${e.jid}"></converse-controlbox-navback>`}
${e.type!==wa.HEADLINES_TYPE?el`<a class="show-msg-author-modal" @click=${e.showUserDetailsModal}>${i}</a>`:""}
2021-11-11 22:06:49 +01:00
<div class="chatbox-title__text" title="${e.jid}">
2022-01-03 11:54:10 +01:00
${e.type!==wa.HEADLINES_TYPE?el`<a class="user show-msg-author-modal" @click=${e.showUserDetailsModal}>${r}</a>`:r}
2021-11-11 22:06:49 +01:00
</div>
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
<div class="chatbox-title__buttons row no-gutters">
2022-01-03 11:54:10 +01:00
${xp(async function(e){return(await e).filter((e=>!e.standalone)).map((e=>Cy(e)))}(e.heading_buttons_promise).then((e=>e.length?el`<converse-dropdown class="dropleft" color="var(--chat-head-text-color)" .items=${e}></converse-dropdown>`:"")),"")}
${xp(async function(e){return(await e).filter((e=>e.standalone)).map((e=>Ty(e)))}(e.heading_buttons_promise).then((e=>e.reverse().map((e=>xp(e,""))))),"")}
2021-03-19 19:26:15 +01:00
</div>
</div>
2022-01-03 11:54:10 +01:00
${e.status?el`<p class="chat-head__desc">${e.status}</p>`:""}
`})(Object.assign(this.model.toJSON(),{heading_buttons_promise:this.getHeadingButtons(),model:this.model,showUserDetailsModal:e=>this.showUserDetailsModal(e)}))}showUserDetailsModal(e){e.preventDefault(),jl.modal.show(Wv,{model:this.model},e)}close(e){e.preventDefault(),this.model.close()}getHeadingButtons(){const e=[{a_class:"show-user-details-modal",handler:e=>this.showUserDetailsModal(e),i18n_text:Eh("Details"),i18n_title:Eh("See more information about this person"),icon_class:"fa-id-card",name:"details",standalone:"overlayed"===jl.settings.get("view_mode")}];jl.settings.get("singleton")||e.push({a_class:"close-chatbox-button",handler:e=>this.close(e),i18n_text:Eh("Close"),i18n_title:Eh("Close and end this conversation"),icon_class:"fa-times",name:"close",standalone:"overlayed"===jl.settings.get("view_mode")});const t=wa.chatboxviews.get(this.getAttribute("jid"));return t?wa.api.hook("getHeadingButtons",t,e):e}});const{u:Iy}=$l.env;class My extends Ng{async connectedCallback(){super.connectedCallback(),this.model=wa.chatboxes.get(this.getAttribute("jid")),await this.model.initialized,this.listenTo(this.model.messages,"change:correcting",this.onMessageCorrecting),this.render()}toHTML(){var e,t;return(e=>{const t=e.composing_spoiler?Eh("Hidden message"):Eh("Message"),n=Eh("Optional hint"),s=jl.settings.get("show_send_button");return el`
2021-11-11 22:06:49 +01:00
<form class="sendXMPPMessage">
<input type="text" placeholder="${n||""}" value="${e.hint_value||""}" class="${e.composing_spoiler?"":"hidden"} spoiler-hint"/>
<textarea
autofocus
type="text"
@drop=${e.onDrop}
2022-01-03 11:54:10 +01:00
@input=${Ny}
2021-11-11 22:06:49 +01:00
@keydown=${e.onKeyDown}
@keyup=${e.onKeyUp}
@paste=${e.onPaste}
@change=${e.onChange}
class="chat-textarea
${s?"chat-textarea-send-button":""}
${e.composing_spoiler?"spoiler":""}"
placeholder="${t}">${e.message_value||""}</textarea>
2022-01-03 11:54:10 +01:00
</form>`})(Object.assign(this.model.toJSON(),{onDrop:e=>this.onDrop(e),hint_value:null===(e=this.querySelector(".spoiler-hint"))||void 0===e?void 0:e.value,message_value:null===(t=this.querySelector(".chat-textarea"))||void 0===t?void 0:t.value,onChange:e=>this.model.set({draft:e.target.value}),onKeyDown:e=>this.onKeyDown(e),onKeyUp:e=>this.onKeyUp(e),onPaste:e=>this.onPaste(e),viewUnreadMessages:e=>this.viewUnreadMessages(e)}))}insertIntoTextArea(e,t=!1,n=!1,s){const i=this.querySelector(".chat-textarea");if(n?Iy.addClass("correcting",i):Iy.removeClass("correcting",i),t)i.value=s&&"string"==typeof t?i.value.replace(new RegExp(t,"g"),((n,i)=>i==s-t.length?e+" ":n)):e;else{let t=i.value;t&&" "!==t[t.length-1]&&(t+=" "),i.value=t+e+" "}const r=document.createEvent("HTMLEvents");r.initEvent("change",!1,!0),i.dispatchEvent(r),Iy.placeCaretAtEnd(i)}onMessageCorrecting(e){if(e.get("correcting"))this.insertIntoTextArea(Iy.prefixMentions(e),!0,!0);else{const t=this.model.messages.findWhere("correcting");t&&t!==e?this.insertIntoTextArea(Iy.prefixMentions(e),!0,!0):this.insertIntoTextArea("",!0,!1)}}onEscapePressed(e){e.preventDefault();const t=this.model.messages.findLastIndex("correcting"),n=t>=0?this.model.messages.at(t):null;n&&n.save("correcting",!1),this.insertIntoTextArea("",!0,!1)}onPaste(e){if(e.stopPropagation(),0!==e.clipboardData.files.length)return e.preventDefault(),void this.model.sendFiles(Array.from(e.clipboardData.files));this.model.set({draft:e.clipboardData.getData("text/plain")})}onKeyUp(e){this.model.set({draft:e.target.value})}onKeyDown(e){if(!e.ctrlKey){if(!e.shiftKey&&!e.altKey&&!e.metaKey)if(e.keyCode===$l.keycodes.TAB){const t=Iy.getCurrentWord(e.target,null,/(:.*?:)/g);t.startsWith(":")&&(e.preventDefault(),e.stopPropagation(),this.model.trigger("emoji-picker-autocomplete",e.target,t))}else{if(e.keyCode===$l.keycodes.FORWARD_SLASH)return;if(e.keyCode===$l.keycodes.ESCAPE)return this.onEscapePressed(e,this);if(e.keyCode===$l.keycodes.ENTER)return this.onFormSubmitted(e);if(e.keyCode!==$l.keycodes.UP_ARROW||e.target.selectionEnd){if(e.keyCode===$l.keycodes.DOWN_ARROW&&e.target.selectionEnd===e.target.value.length&&Iy.hasClass("correcting",this.querySelector(".chat-textarea")))return this.model.editLaterMessage()}else{const e=this.querySelector(".chat-textarea");if(!e.value||Iy.hasClass("correcting",e))return this.model.editEarlierMessage()}}[$l.keycodes.SHIFT,$l.keycodes.META,$l.keycodes.META_RIGHT,$l.keycodes.ESCAPE,$l.keycodes.ALT].includes(e.keyCode)||this.model.get("chat_state")!==wa.COMPOSING&&this.model.setChatState(wa.COMPOSING)}}parseMessageForCommands(e){return jy(this.model,e)}async onFormSubmitted(e){var t,n;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e);const s=this.querySelector(".chat-textarea"),i=s.value.trim();if(jl.settings.get("message_limit")&&i.length>jl.settings.get("message_limit")||!i.replace(/\s/g,"").length)return;if(!wa.connection.authenticated){const e=Eh("Sorry, the connection has been lost, and your message could not be sent");return jl.alert("error",Eh("Error"),e),void jl.connection.reconnect()}let r,o={};this.model.get("composing_spoiler")&&(o=this.querySelector("form.sendXMPPMessage input.spoiler-hint"),r=o.value),Iy.addClass("disabled",s),s.setAttribute("disabled","disabled"),null===(n=this.querySelector("converse-emoji-dropdown"))||void 0===n||n.hideMenu();const a=this.parseMessageForCommands(i),c=a?null:await this.model.sendMessage({body:i,spoiler_hint:r});(a||c)&&(o.value="",s.value="",Iy.removeClass("correcting",s),s.style.height="auto",this.model.set({draft:""})),"overlayed"===jl.settings.get("view_mode")&&(wa.chatboxviews.get(this.getAttribute("jid")).querySelector(".chat-content__messages").parentElement.style.display="none"),s.removeAttribute("disabled"),Iy.removeClass("disabled",s),"overlayed"===jl.settings.get("view_mode")&&(wa.chatboxviews.get(this.getAttribute("jid")).querySelector(".chat-content__messages").parentElement.style.display=""),this.model.setChatState(wa.ACTIVE,{silent:!0}),s.focus()}}jl.elements.define("converse-message-form",
${e.model.ui.get("scrolled")&&e.model.get("num_unread")?el`<div class="new-msgs-indicator" @click=${t=>e.viewUnreadMessages(t)}>▼ ${t} ▼</div>`:""}
${jl.settings.get("show_toolbar")?el`
2021-11-11 22:06:49 +01:00
<converse-chat-toolbar
class="chat-toolbar no-text-select"
.model=${e.model}
?composing_spoiler="${e.model.get("composing_spoiler")}"
?show_call_button="${s}"
?show_emoji_button="${i}"
?show_send_button="${r}"
?show_spoiler_button="${o}"
?show_toolbar="${a}"
message_limit="${n}"></converse-chat-toolbar>`:""}
<converse-message-form jid="${e.model.get("jid")}"></converse-message-form>
2022-01-03 11:54:10 +01:00
`})({model:this.model,viewUnreadMessages:e=>this.viewUnreadMessages(e)}),this)}sendButtonClicked(e){var t;null===(t=this.querySelector("converse-message-form"))||void 0===t||t.onFormSubmitted(e)}viewUnreadMessages(e){var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),this.model.ui.set({scrolled:!1})}emitFocused(e){var t;null===(t=wa.chatboxviews.get(this.getAttribute("jid")))||void 0===t||t.emitFocused(e)}emitBlurred(e){var t;null===(t=wa.chatboxviews.get(this.getAttribute("jid")))||void 0===t||t.emitBlurred(e)}onDrop(e){0!=e.dataTransfer.files.length&&(e.preventDefault(),this.model.sendFiles(e.dataTransfer.files))}onDragOver(e){e.preventDefault()}clearMessages(e){var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),ky(this.model)}async autocompleteInPicker(e,t){await jl.emojis.initialize();const n=this.querySelector("converse-emoji-picker");if(n){n.model.set({ac_position:e.selectionStart,autocompleting:t,query:t});const s=this.querySelector("converse-emoji-dropdown");null==s||s.showMenu()}}}jl.elements.define("converse-chat-bottom-panel",Ly);class zy extends ig{static get properties(){return{jid:{type:String}}}disconnectedCallback(){super.disconnectedCallback(),wa.chatboxviews.remove(this.jid,this)}updated(){this.model&&this.jid!==this.model.get("jid")&&(this.stopListening(),wa.chatboxviews.remove(this.model.get("jid"),this),delete this.model,this.requestUpdate(),this.initialize())}close(e){var t;return null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),this.model.close(e)}maybeFocus(){jl.settings.get("auto_focus")&&this.focus()}focus(){const e=this.getElementsByClassName("chat-textarea")[0];return e&&document.activeElement!==e&&e.focus(),this}emitBlurred(e){this.contains(document.activeElement)||this.contains(e.relatedTarget)||jl.trigger("chatBoxBlurred",this,e)}emitFocused(e){this.contains(e.relatedTarget)||jl.trigger("chatBoxFocused",this,e)}getBottomPanel(){return this.model.get("type")===wa.CHATROOMS_TYPE?this.querySelector("converse-muc-bottom-panel"):this.querySelector("converse-chat-bottom-panel")}getMessageForm(){return this.model.get("type")===wa.CHATROOMS_TYPE?this.querySelector("converse-muc-message-form"):this.querySelector("converse-message-form")}scrollDown(e){var t,n;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),null==e||null===(n=e.stopPropagation)||void 0===n||n.call(e),this.model.ui.get("scrolled")&&this.model.ui.set({scrolled:!1}),oy(this.model)}onWindowStateChanged(e){"visible"===e.state?this.model.isHidden()||this.model.clearUnreadMsgCounter():"hidden"===e.state&&(this.model.setChatState(wa.INACTIVE,{silent:!0}),this.model.sendChatState())}}class Py extends zy{constructor(...e){var t,n;super(...e),(n="length")in(t=this)?Object.defineProperty(t,n,{value:200,enumerable:!0,configurable:!0,writable:!0}):t[n]=200}async initialize(){wa.chatboxviews.add(this.jid,this),this.model=wa.chatboxes.get(this.jid),this.listenTo(wa,"windowStateChanged",this.onWindowStateChanged),this.listenTo(this.model,"change:hidden",(()=>!this.model.get("hidden")&&this.afterShown())),this.listenTo(this.model,"change:show_help_messages",this.requestUpdate),await this.model.messages.fetched,!this.model.get("hidden")&&this.afterShown(),jl.trigger("chatBoxViewInitialized",this)}render(){return(e=>el`
2021-11-11 22:06:49 +01:00
<div class="flyout box-flyout">
<converse-dragresize></converse-dragresize>
2022-01-03 11:54:10 +01:00
${e.model?el`
2021-11-11 22:06:49 +01:00
<converse-chat-heading jid="${e.jid}" class="chat-head chat-head-chatbox row no-gutters"></converse-chat-heading>
<div class="chat-body">
<div class="chat-content ${e.show_send_button?"chat-content-sendbutton":""}" aria-live="polite">
<converse-chat-content
class="chat-content__messages"
jid="${e.jid}"></converse-chat-content>
2021-03-19 19:26:15 +01:00
2022-01-03 11:54:10 +01:00
${e.show_help_messages?el`<div class="chat-content__help">
2021-11-11 22:06:49 +01:00
<converse-chat-help
.model=${e.model}
.messages=${e.help_messages}
?hidden=${!e.show_help_messages}
type="info"
2022-01-03 11:54:10 +01:00
chat_type="${wa.CHATROOMS_TYPE}"
2021-11-11 22:06:49 +01:00
></converse-chat-help></div>`:""}
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
<converse-chat-bottom-panel jid="${e.jid}" class="bottom-panel"> </converse-chat-bottom-panel>
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
`:""}
</div>
2022-01-03 11:54:10 +01:00
`)(Object.assign({model:this.model,help_messages:this.getHelpMessages(),show_help_messages:this.model.get("show_help_messages")},this.model.toJSON()))}getHelpMessages(){return[`<strong>/clear</strong>: ${Eh("Remove messages")}`,`<strong>/close</strong>: ${Eh("Close this chat")}`,`<strong>/me</strong>: ${Eh("Write in the third person")}`,`<strong>/help</strong>: ${Eh("Show this menu")}`]}showControlBox(){var e;null===(e=wa.chatboxviews.get("controlbox"))||void 0===e||e.show()}afterShown(){this.model.setChatState(wa.ACTIVE),this.model.clearUnreadMsgCounter(),this.maybeFocus()}}jl.elements.define("converse-chat",Py);var Fy=n(5599),Uy={};Uy.styleTagTransform=vg(),Uy.setAttributes=fg(),Uy.insert=ug().bind(null,"head"),Uy.domAPI=lg(),Uy.insertStyleElement=gg(),ag()(Fy.Z,Uy),Fy.Z&&Fy.Z.locals&&Fy.Z.locals;const{Strophe:By}=$l.env;$l.plugins.add("converse-chatview",{dependencies:["converse-chatboxviews","converse-chat","converse-disco","converse-modal"],initialize(){jl.settings.extend({allowed_audio_domains:null,allowed_image_domains:null,allowed_video_domains:null,auto_focus:!0,debounced_content_rendering:!0,filter_url_query_params:null,image_urls_regex:null,message_limit:0,muc_hats:["xep317"],render_media:!0,show_message_avatar:!0,show_retraction_warning:!0,show_send_button:!0,show_toolbar:!0,time_format:"HH:mm",use_system_emojis:!0,visible_toolbar_buttons:{call:!1,clear:!0,emoji:!0,spoiler:!0}}),wa.ChatBoxView=Py,jl.listen.on("connected",(()=>jl.disco.own.features.add(By.NS.SPOILER))),jl.listen.on("chatBoxClosed",(e=>{return t=e.get("jid"),void(wa.router.history.getFragment()===`converse/chat?jid=${t}`&&wa.router.navigate(""));var t}))}}),jl.elements.define("converse-brand-byline",class extends ig{render(){const e="fullscreen"===jl.settings.get("view_mode");return el`
${e?el`
<p class="brand-subtitle">${wa.VERSION_NAME}</p>
2021-11-11 22:06:49 +01:00
<p class="brand-subtitle">
<a target="_blank" rel="nofollow" href="https://conversejs.org">Open Source</a> XMPP chat client
brought to you by <a target="_blank" rel="nofollow" href="https://opkode.com">Opkode</a>
</p>
<p class="brand-subtitle">
<a target="_blank" rel="nofollow" href="https://hosted.weblate.org/projects/conversejs/#languages"
>Translate</a
>
it into your own language
</p>
`:""}
2022-01-03 11:54:10 +01:00
`}}),jl.elements.define("converse-brand-logo",class extends ig{render(){const e="fullscreen"===jl.settings.get("view_mode");return el`
2021-11-11 22:06:49 +01:00
<a class="brand-heading" href="https://conversejs.org" target="_blank" rel="noopener">
<span class="brand-name-wrapper ${e?"brand-name-wrapper--fullscreen":""}">
<svg
class="converse-svg-logo"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 364 364">
2021-03-19 19:26:15 +01:00
2021-11-11 22:06:49 +01:00
<title>Converse</title>
<g class="cls-1" id="g904">
<g data-name="Layer 2">
<g data-name="Layer 7">
<path
class="cls-3"
d="M221.46,103.71c0,18.83-29.36,18.83-29.12,0C192.1,84.88,221.46,84.88,221.46,103.71Z"
/>
<path
class="cls-4"
d="M179.9,4.15A175.48,175.48,0,1,0,355.38,179.63,175.48,175.48,0,0,0,179.9,4.15Zm-40.79,264.5c-.23-17.82,27.58-17.82,27.58,0S138.88,286.48,139.11,268.65ZM218.6,168.24A79.65,79.65,0,0,1,205.15,174a12.76,12.76,0,0,0-6.29,4.65L167.54,222a1.36,1.36,0,0,1-2.46-.8v-35.8a2.58,2.58,0,0,0-3.06-2.53c-15.43,3-30.23,7.7-42.73,19.94-38.8,38-29.42,105.69,16.09,133.16a162.25,162.25,0,0,1-91.47-67.27C-3.86,182.26,34.5,47.25,138.37,25.66c46.89-9.75,118.25,5.16,123.73,62.83C265.15,120.64,246.56,152.89,218.6,168.24Z"
/>
</g>
2021-03-19 19:26:15 +01:00
</g>
</g>
2021-11-11 22:06:49 +01:00
</svg>
<span class="brand-name">
<span class="brand-name__text">converse<span class="subdued">.js</span></span>
2022-01-03 11:54:10 +01:00
${e?el`
2021-11-11 22:06:49 +01:00
<p class="byline">messaging freedom</p>
`:""}
</span>
2021-03-19 19:26:15 +01:00
</span>
2021-11-11 22:06:49 +01:00
</a>
2022-01-03 11:54:10 +01:00
`}}),jl.elements.define("converse-brand-heading",class extends ig{render(){return el`
2021-11-11 22:06:49 +01:00
<converse-brand-logo></converse-brand-logo>
<converse-brand-byline></converse-brand-byline>
2022-01-03 11:54:10 +01:00
`}});const qy=e=>el`
2021-11-11 22:06:49 +01:00
<converse-brand-heading></converse-brand-heading>
<form id="converse-login" class="converse-form" method="post">
<div class="conn-feedback fade-in ${e.conn_feedback_subject?e.conn_feedback_class:"hidden"}">
<p class="feedback-subject">${e.conn_feedback_subject}</p>
<p class="feedback-message ${e.conn_feedback_message?"":"hidden"}">${e.conn_feedback_message}</p>
</div>
2022-01-03 11:54:10 +01:00
${"CONNECTING"===wa.CONNECTION_STATUS[e.connection_status]?ny({classes:"hor_centered"}):(e=>{const t=Eh("Disconnected"),n=Eh("Click here to log in anonymously");return el`
${e.authentication==e.LOGIN||e.authentication==e.EXTERNAL?(e=>{const t=Eh("Log in"),n=Eh("XMPP Address");return el`
2021-03-19 19:26:15 +01:00
<div class="form-group">
<label for="converse-login-jid">${n}:</label>
<input id="converse-login-jid"
2022-01-03 11:54:10 +01:00
?autofocus=${!!jl.settings.get("auto_focus")}
2021-03-19 19:26:15 +01:00
required
class="form-control"
type="text"
name="jid"
placeholder="${e.placeholder_username}"/>
</div>
2022-01-03 11:54:10 +01:00
${e.authentication!==e.EXTERNAL?(()=>{const e=Eh("Password");return el`
2021-03-19 19:26:15 +01:00
<div class="form-group">
<label for="converse-login-password">${e}</label>
<input id="converse-login-password" class="form-control" required="required" type="password" name="password" placeholder="${e}"/>
</div>
`})():""}
2022-01-03 11:54:10 +01:00
${e.show_trust_checkbox?(e=>{const t=Eh("To improve performance, we cache your data in this browser. Uncheck this box if this is a public computer or if you want your data to be deleted when you log out. It's important that you explicitly log out, otherwise not all cached data might be deleted. Please note, when using an untrusted device, OMEMO encryption is NOT available."),n=Eh("This is a trusted device");return el`
2021-03-19 19:26:15 +01:00
<div class="form-group form-check login-trusted">
<input id="converse-login-trusted" type="checkbox" class="form-check-input" name="trusted" ?checked=${e}>
<label for="converse-login-trusted" class="form-check-label login-trusted__desc">${n}</label>
<i class="fa fa-info-circle" data-toggle="popover"
data-title="Trusted device?"
data-content="${t}"></i>
</div>
`})("off"!==e.show_trust_checkbox):""}
2021-11-11 22:06:49 +01:00
<fieldset class="form-group buttons">
2021-03-19 19:26:15 +01:00
<input class="btn btn-primary" type="submit" value="${t}"/>
</fieldset>
2022-01-03 11:54:10 +01:00
${jl.settings.get("allow_registration")&&!jl.settings.get("auto_login")&&wa.pluggable.plugins["converse-register"].enabled(wa)?(()=>{const e=Eh("Create an account"),t=Eh("Don't have a chat account?");return el`
2021-03-19 19:26:15 +01:00
<fieldset class="switch-form">
<p>${t}</p>
<p><a class="register-account toggle-register-login" href="#converse/register">${e}</a></p>
</fieldset>
`})():""}
2021-11-11 22:06:49 +01:00
`})(e):""}
2022-01-03 11:54:10 +01:00
${e.authentication==e.ANONYMOUS?el`<input class="btn btn-primary login-anon" type="submit" value="${n}">`:""}
${e.authentication==e.PREBIND?el`<p>${t}</p>`:""}
2021-03-19 19:26:15 +01:00
`})(e)}
</form>
2022-01-03 11:54:10 +01:00
`;function Hy(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Gy=$l.env.utils,{Strophe:Wy}=$l.env,Vy=[0,1,2,3,4,7,10],Jy={0:"Error",1:"Connecting",2:"Connection failure",3:"Authenticating",4:"Authentication failure",5:"Connected",6:"Disconnected",7:"Disconnecting",8:"Attached",9:"Redirect",10:"Reconnecting"},Qy={Error:"error",Connecting:"info","Connection failure":"error",Authenticating:"info","Authentication failure":"error",Connected:"info",Disconnected:"error",Disconnecting:"warn",Attached:"info",Redirect:"info",Reconnecting:"warn"},Zy=Xo.extend({defaults:{errors:[]}});jl.elements.define("converse-login-panel",class extends Ng{constructor(...e){super(...e),Hy(this,"id","converse-login-panel"),Hy(this,"className","controlbox-pane fade-in row no-gutters"),Hy(this,"events",{"submit form#converse-login":"authenticate","change input":"validate"})}initialize(){this.model=new Zy,this.listenTo(this.model,"change",this.render),this.listenTo(wa.connfeedback,"change",this.render),this.render(),this.initPopovers()}render(){const e=wa.connfeedback.get("connection_status");let t,n;Vy.includes(e)&&(n=Jy[e],t=Qy[n]),il(qy(Object.assign(this.model.toJSON(),{_converse:wa,ANONYMOUS:wa.ANONYMOUS,EXTERNAL:wa.EXTERNAL,LOGIN:wa.LOGIN,PREBIND:wa.PREBIND,auto_login:jl.settings.get("auto_login"),authentication:jl.settings.get("authentication"),connection_status:e,conn_feedback_class:t,conn_feedback_subject:n,conn_feedback_message:wa.connfeedback.get("message"),placeholder_username:(jl.settings.get("locked_domain")||jl.settings.get("default_domain"))&&Eh("Username")||Eh("user@domain"),show_trust_checkbox:jl.settings.get("allow_user_trust_override")})),this)}initPopovers(){Array.from(this.querySelectorAll("[data-title]")).forEach((e=>{new(Yg().Popover)(e,{trigger:"mobile"===jl.settings.get("view_mode")?"click":"hover",dismissible:"mobile"===jl.settings.get("view_mode"),container:this.parentElement.parentElement.parentElement})}))}validate(){const e=this.querySelector("form").querySelector("input[name=jid]");return!e.value||jl.settings.get("locked_domain")||jl.settings.get("default_domain")||Gy.isValidJID(e.value)?(e.setCustomValidity(""),!0):(e.setCustomValidity(Eh("Please enter a valid XMPP address")),!1)}authenticate(e){if(null==e||e.preventDefault(),jl.settings.get("authentication")===wa.ANONYMOUS)return this.connect(wa.jid,null);if(!this.validate())return;const t=new FormData(e.target);wa.config.save({trusted:!!t.get("trusted")});let n=t.get("jid");if(jl.settings.get("locked_domain")){const e="@"+jl.settings.get("locked_domain");n.endsWith(e)&&(n=n.substr(0,n.length-e.length)),n=Wy.escapeNode(n)+e}else jl.settings.get("default_domain")&&!n.includes("@")&&(n=n+"@"+jl.settings.get("default_domain"));this.connect(n,t.get("password"))}connect(e,t){["converse/login","converse/register"].includes(wa.router.history.getFragment())&&wa.router.navigate("",{replace:!0}),wa.connection&&wa.connection.reset(),jl.user.login(e,t)}});const Ky=$l.env.utils;function Yy(){var e;const t=wa.chatboxes.add(new wa.ControlBox({id:"controlbox"}));return null===(e=wa.chatboxviews.get("controlbox"))||void 0===e||e.setModel(),t}function Xy(e){var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e);const n=wa.chatboxes.get("controlbox")||Yy();Ky.safeSave(n,{closed:!1})}function eb(){const e=wa.chatboxviews.get("controlbox");return e.model.set({connected:!1}),e}function tb(){const e=null==wa?void 0:wa.chatboxviews,t=e&&e.get("controlbox");t&&(Ky.safeSave(t.model,{connected:!1}),null!=t&&t.controlbox_pane&&(t.controlbox_pane.remove(),delete t.controlbox_pane))}function nb(){(wa.chatboxes.get("controlbox")||Yy()).save({connected:!0})}jl.elements.define("converse-controlbox-navback",class extends ig{static get properties(){return{jid:{type:String}}}render(){return e=this.jid,el`<i class="fa fa-arrow-left" @click=${()=>function(e){Xy();const t=wa.chatboxes.get(e);Ky.safeSave(t,{hidden:!0})}(e)}></i>`;var e}});const{dayjs:sb}=$l.env,ib=Xo.extend({defaults:()=>({bookmarked:!1,box_id:"controlbox",chat_s
2021-03-19 19:26:15 +01:00
<div class="flyout box-flyout">
2021-11-11 22:06:49 +01:00
<converse-dragresize></converse-dragresize>
2021-03-19 19:26:15 +01:00
<div class="chat-head controlbox-head">
2022-01-03 11:54:10 +01:00
${e.sticky_controlbox?"":el`
2021-11-11 22:06:49 +01:00
<a class="chatbox-btn close-chatbox-button fa fa-times" @click=${e.close}></a>
`}
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
<div class="controlbox-panes">
<div class="controlbox-pane">
2022-01-03 11:54:10 +01:00
${e.connected?el`
2021-11-11 22:06:49 +01:00
<converse-user-profile></converse-user-profile>
<converse-headlines-panel class="controlbox-section"></converse-headlines-panel>
<div id="chatrooms" class="controlbox-section">
<converse-rooms-list></converse-rooms-list>
<converse-bookmarks></converse-bookmarks>
</div>
2022-01-03 11:54:10 +01:00
${jl.settings.get("authentication")===wa.ANONYMOUS?"":el`<div id="converse-roster" class="controlbox-section"><converse-roster></converse-roster></div>`}`:"register"===e["active-form"]?el`<converse-register-panel></converse-register-panel>`:el`<converse-login-panel></converse-login-panel>`}
2021-11-11 22:06:49 +01:00
</div>
</div>
</div>
2022-01-03 11:54:10 +01:00
`)({sticky_controlbox:jl.settings.get("sticky_controlbox"),...this.model.toJSON(),close:e=>this.close(e)}),this)}afterRender(){this.model.get("connected")&&void 0===this.model.get("closed")&&this.model.set("closed",!jl.settings.get("show_controlbox_by_default"))}close(e){var t;if(null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),("closeAllChatBoxes"!==(null==e?void 0:e.name)||wa.disconnection_cause===wa.LOGOUT&&!jl.settings.get("show_controlbox_by_default"))&&!jl.settings.get("sticky_controlbox"))return ab.safeSave(this.model,{closed:!0}),jl.trigger("controlBoxClosed",this),this}afterShown(){return jl.trigger("controlBoxOpened",this),this}showHelpMessages(){}}jl.elements.define("converse-controlbox",cb);const lb=cb,{u:db}=$l.env,ub={controlbox:{async open(){await jl.waitUntil("chatBoxesFetched");const e=await jl.chatboxes.get("controlbox")||jl.chatboxes.create("controlbox",{},wa.Controlbox);return db.safeSave(e,{closed:!1}),e},get:()=>wa.chatboxviews.get("controlbox")}};var hb=n(1875),fb={};fb.styleTagTransform=vg(),fb.setAttributes=fg(),fb.insert=ug().bind(null,"head"),fb.domAPI=lg(),fb.insertStyleElement=gg(),ag()(hb.Z,fb),hb.Z&&hb.Z.locals&&hb.Z.locals,$l.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){return e&&"controlbox"==e.id?new ib(e,t):this.__super__.model.apply(this,arguments)}}},initialize(){jl.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}),jl.promises.add("controlBoxInitialized"),Object.assign(jl,ub),wa.ControlBoxView=lb,wa.ControlBox=ib,wa.ControlBoxToggle=ob,jl.listen.on("chatBoxesFetched",nb),jl.listen.on("clearSession",tb),jl.listen.on("will-reconnect",eb),jl.waitUntil("chatBoxViewsInitialized").then(Yy).catch((e=>M.fatal(e)))}});const{u:mb}=$l.env;function gb(e,t=!0){if(!jl.settings.get("allow_dragresize"))return!0;e.preventDefault();const n=mb.ancestor(e.target,".box-flyout"),s=window.getComputedStyle(n),i=n.parentElement;i.height=parseInt(s.height.replace(/px$/,""),10),wa.resizing={chatbox:i,direction:"top"},i.prev_pageY=e.pageY,t&&jl.trigger("startVerticalResize",i)}function pb(e,t=!0){if(!jl.settings.get("allow_dragresize"))return!0;e.preventDefault();const n=mb.ancestor(e.target,".box-flyout"),s=window.getComputedStyle(n),i=n.parentElement;i.width=parseInt(s.width.replace(/px$/,""),10),wa.resizing={chatbox:i,direction:"left"},i.prev_pageX=e.pageX,t&&jl.trigger("startHorizontalResize",i)}function vb(e){pb(e,!1),gb(e,!1),wa.resizing.direction="topleft",jl.trigger("startDiagonalResize",this)}function yb(e,t){if(void 0!==e)return void 0===t?e:e!==t&&Math.abs(e-t)<10?t:e}function bb(e){if(!wa.resizing||!jl.settings.get("allow_dragresize"))return!0;e.preventDefault(),wa.resizing.chatbox.resizeChatBox(e)}function _b(e){if(!wa.resizing||!jl.settings.get("allow_dragresize"))return!0;e.preventDefault();const t=yb(wa.resizing.chatbox.height,wa.resizing.chatbox.model.get("default_height")),n=yb(wa.resizing.chatbox.width,wa.resizing.chatbox.model.get("default_width"));jl.connection.connected()?(wa.resizing.chatbox.model.save({height:t}),wa.resizing.chatbox.model.save({width:n})):(wa.resizing.chatbox.model.set({height:t}),wa.resizing.chatbox.model.set({width:n})),wa.resizing=null}const wb=()=>el`
<div class="dragresize dragresize-top" @mousedown="${gb}"></div>
<div class="dragresize dragresize-topleft" @mousedown="${vb}"></div>
<div class="dragresize dragresize-left" @mousedown="${pb}"></div>
`;customElements.define("converse-dragresize",class extends ig{render(){return wb()}});const Sb={initDragResize(){var e;const t=this,n=gc((()=>t.setDimensions()));window.addEventListener("resize",t.debouncedSetDimensions),this.listenTo(this.model,"destroy",(()=>window.removeEventListener("resize",n)));const s=this.querySelector(".box-flyout"),i=window.getComputedStyle(s);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 r=i["min-width"],o=i["min-height"];return this.model.set("min_width",r.endsWith("px")?Number(r.replace(/px$/,"")):0),this.model.set("min_height",o.endsWith("px")?Number(o.replace(/px$/,"")):0),this.prev_pageY=0,this.prev_pageX=0,null!==(e=wa.connection)&&void 0!==e&&e.connected&&(this.height=this.model.get("height"),this.width=this.model.get("width")),this},resizeChatBox(e){let t;0===wa.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))),wa.resizing.direction.includes("left")&&(t=this.prev_pageX-e.pageX,t&&(this.width=this.width+t>(this.model.get("min_width")||0)?this.width+t:this.model.get("min_width"),this.prev_pageX=e.pageX,this.setChatBoxWidth(this.width)))},setDimensions(){this.adjustToViewport(),this.setChatBoxHeight(this.model.get("height")),this.setChatBoxWidth(this.model.get("width"))},setChatBoxHeight(e){e=e?yb(e,this.model.get("default_height"))+"px":"";const t=this.querySelector(".box-flyout");null!==t&&(t.style.height=e)},setChatBoxWidth(e){e=e?yb(e,this.model.get("default_width"))+"px":"",this.style.width=e;const t=this.querySelector(".box-flyout");null!==t&&(t.style.width=e)},adjustToViewport(){const e=Math.max(document.documentElement.clientWidth,window.innerWidth||0),t=Math.max(document.documentElement.clientHeight,window.innerHeight||0);e<=480?(this.model.set("height",void 0),this.model.set("width",void 0)):e<=this.model.get("width")?this.model.set("width",void 0):t<=this.model.get("height")&&this.model.set("height",void 0)}};$l.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:yb(t,this.get("default_height")),width:yb(n,this.get("default_width"))}),e}}},initialize(){jl.settings.extend({allow_dragresize:!0}),Object.assign(wa.ChatBoxView.prototype,Sb),Object.assign(wa.ChatRoomView.prototype,Sb),Object.assign(wa.ControlBoxView.prototype,Sb),jl.listen.on("registeredGlobalEventHandlers",(function(){document.addEventListener("mousemove",bb),document.addEventListener("mouseup",_b)})),jl.listen.on("unregisteredGlobalEventHandlers",(function(){document.removeEventListener("mousemove",bb),document.removeEventListener("mouseup",_b)})),jl.listen.on("beforeShowingChatView",(e=>e.initDragResize().setDimensions()))}});var xb=n(1833),Eb={};Eb.styleTagTransform=vg(),Eb.setAttributes=fg(),Eb.insert=ug().bind(null,"head"),Eb.domAPI=lg(),Eb.insertStyleElement=gg(),ag()(xb.Z,Eb),xb.Z&&xb.Z.locals&&xb.Z.locals,$l.plugins.add("converse-singleton",{enabled:e=>e.api.settings.get("singleton"),initialize(){if(jl.settings.extend({allow_logout:!1,allow_muc_invitations:!1,hide_muc_server:!0}),!Array.isArray(jl.settings.get("auto_join_rooms"))&&!Array.isArray(jl.settings.get("auto_join_private_chats")))throw new Error("converse-singleton: auto_join_rooms must be an Array");if(jl.settings.get("auto_join_rooms").length>1||jl.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
2021-11-11 22:06:49 +01:00
<div class="chatbox-title ${e.status?"":"chatbox-title--no-desc"}">
<div class="chatbox-title--row">
2022-01-03 11:54:10 +01:00
${wa.api.settings.get("singleton")?"":el`<converse-controlbox-navback jid="${e.jid}"></converse-controlbox-navback>`}
2021-11-11 22:06:49 +01:00
<div class="chatbox-title__text" title="${e.jid}">${e.display_name}</div>
</div>
<div class="chatbox-title__buttons row no-gutters">
2022-01-03 11:54:10 +01:00
${e.dropdown_btns.length?el`<converse-dropdown class="dropleft" .items=${e.dropdown_btns}></converse-dropdown>`:""}
${e.standalone_btns.length?(e=>e.standalone_btns.reverse().map((e=>xp(e,""))))(e):""}
2021-11-11 22:06:49 +01:00
</div>
</div>
2022-01-03 11:54:10 +01:00
${e.status?el`<p class="chat-head__desc">${e.status}</p>`:""}
`)(Object.assign(this.model.toJSON(),{display_name:this.model.getDisplayName(),dropdown_btns:n.map((e=>Cy(e))),standalone_btns:t.map((e=>Ty(e)))}))}getHeadingButtons(){const e=[];return jl.settings.get("singleton")||e.push({a_class:"close-chatbox-button",handler:e=>this.close(e),i18n_text:Eh("Close"),i18n_title:Eh("Close these announcements"),icon_class:"fa-times",name:"close",standalone:"overlayed"===jl.settings.get("view_mode")}),wa.api.hook("getHeadingButtons",this,e)}close(e){e.preventDefault(),this.model.close()}}),jl.elements.define("converse-headlines",class extends zy{async initialize(){wa.chatboxviews.add(this.jid,this),this.model=wa.chatboxes.get(this.jid),this.model.disable_mam=!0,this.listenTo(wa,"windowStateChanged",this.onWindowStateChanged),this.listenTo(this.model,"change:hidden",(()=>this.afterShown())),this.listenTo(this.model,"destroy",this.remove),this.listenTo(this.model.messages,"add",this.requestUpdate),this.listenTo(this.model.messages,"remove",this.requestUpdate),this.listenTo(this.model.messages,"reset",this.requestUpdate),await this.model.messages.fetched,this.model.maybeShow(),jl.trigger("headlinesBoxViewInitialized",this)}render(){return(e=>el`
2021-11-11 22:06:49 +01:00
<div class="flyout box-flyout">
<converse-dragresize></converse-dragresize>
2022-01-03 11:54:10 +01:00
${e?el`
2021-11-11 22:06:49 +01:00
<converse-headlines-heading jid="${e.get("jid")}" class="chat-head chat-head-chatbox row no-gutters">
</converse-headlines-heading>
<div class="chat-body">
<div class="chat-content" aria-live="polite">
<converse-chat-content
class="chat-content__messages"
jid="${e.get("jid")}"></converse-chat-content>
</div>
</div>`:""}
</div>
2022-01-03 11:54:10 +01:00
`)(this.model)}async close(e){var t;return null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),wa.router.history.getFragment()==="converse/chat?jid="+this.model.get("jid")&&wa.router.navigate(""),await this.model.close(e),this}getNotifications(){return[]}afterShown(){this.model.clearUnreadMsgCounter()}});class Tb extends Ng{constructor(...e){var t,n,s;super(...e),s={"click .open-headline":"openHeadline"},(n="events")in(t=this)?Object.defineProperty(t,n,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[n]=s}initialize(){this.model=wa.chatboxes,this.listenTo(this.model,"add",this.renderIfHeadline),this.listenTo(this.model,"remove",this.renderIfHeadline),this.listenTo(this.model,"destroy",this.renderIfHeadline),this.render()}toHTML(){return(e=>el`
2021-11-11 22:06:49 +01:00
<div class="controlbox-section" id="headline">
<div class="d-flex controlbox-padded ${e.headlineboxes.length?"":"hidden"}">
<span class="w-100 controlbox-heading controlbox-heading--headline">${e.heading_headline}</span>
</div>
</div>
2022-01-03 11:54:10 +01:00
${(e=>el`
2021-11-11 22:06:49 +01:00
<div class="list-container list-container--headline ${e.headlineboxes.length?"":"hidden"}">
<div class="items-list rooms-list headline-list">
2022-01-03 11:54:10 +01:00
${e.headlineboxes.map((t=>(e=>el`
2021-11-11 22:06:49 +01:00
<div class="list-item controlbox-padded d-flex flex-row"
data-headline-jid="${e.headlinebox.get("jid")}">
<a class="list-item-link open-headline available-room w-100"
data-headline-jid="${e.headlinebox.get("jid")}"
title="${e.open_title}" href="#">${e.headlinebox.get("jid")}</a>
</div>
`)(Object.assign({headlinebox:t},e))))}
</div>
</div>
`)(e)}
2022-01-03 11:54:10 +01:00
`)({heading_headline:Eh("Announcements"),headlineboxes:this.model.filter((e=>e.get("type")===wa.HEADLINES_TYPE)),open_title:Eh("Click to open this server message")})}renderIfHeadline(e){return e&&e.get("type")===wa.HEADLINES_TYPE&&this.render()}openHeadline(e){e.preventDefault();const t=e.target.getAttribute("data-headline-jid");wa.chatboxes.get(t).maybeShow(!0)}}jl.elements.define("converse-headlines-panel",Tb);var kb=n(5956),jb={};jb.styleTagTransform=vg(),jb.setAttributes=fg(),jb.insert=ug().bind(null,"head"),jb.domAPI=lg(),jb.insertStyleElement=gg(),ag()(kb.Z,jb),kb.Z&&kb.Z.locals&&kb.Z.locals,$l.plugins.add("converse-headlines-view",{dependencies:["converse-headlines","converse-chatview"],initialize(){wa.HeadlinesPanel=Tb}});var Nb=n(9679),Ob={};function $b(e,t){return e instanceof Qh?el`<converse-mam-placeholder .model=${e}></converse-mam-placeholder>`:t}async function Ib(e){if(!e.model.ui.get("chat-content-spinner-top")&&e.model.messages.length){const t=e.model.get("type")===wa.CHATROOMS_TYPE,n=e.model.getOldestMessage();if(n){const s=t?e.model.get("jid"):wa.bare_jid,i=n&&n.get(`stanza_id ${s}`);e.model.ui.set("chat-content-spinner-top",!0);try{i?await wf(e.model,{before:i}):await wf(e.model,{end:n.get("time")})}catch(t){return M.error(t),void e.model.ui.set("chat-content-spinner-top",!1)}jl.settings.get("allow_url_history_change")&&wa.router.history.navigate(`#${n.get("msgid")}`),setTimeout((()=>e.model.ui.set("chat-content-spinner-top",!1)),250)}}}Ob.styleTagTransform=vg(),Ob.setAttributes=fg(),Ob.insert=ug().bind(null,"head"),Ob.domAPI=lg(),Ob.insertStyleElement=gg(),ag()(Nb.Z,Ob),Nb.Z&&Nb.Z.locals&&Nb.Z.locals,jl.elements.define("converse-mam-placeholder",class extends ig{static get properties(){return{model:{type:Object}}}render(){return(e=this).model.get("fetching")?ny({classes:"hor_centered"}):el`<a @click="${t=>e.fetchMissingMessages(t)}" title="${Eh("Click to load missing messages")}">
2021-11-11 22:06:49 +01:00
<div class="message mam-placeholder"></div>
2022-01-03 11:54:10 +01:00
</a>`;var e}async fetchMissingMessages(e){var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),this.model.set("fetching",!0);const n={before:this.model.get("before"),start:this.model.get("start")};await wf(this.model.collection.chatbox,n),this.model.destroy()}}),$l.plugins.add("converse-mam-views",{dependencies:["converse-mam","converse-chatview","converse-muc-views"],initialize(){jl.listen.on("chatBoxScrolledUp",Ib),jl.listen.on("getMessageTemplate",$b)}});const Mb=Xo.extend({defaults:{collapsed:!1}});jl.elements.define("converse-minimized-chats",class extends ig{async initialize(){this.model=wa.chatboxes,await this.initToggle(),this.listenTo(this.minchats,"change:collapsed",this.requestUpdate),this.listenTo(this.model,"add",this.requestUpdate),this.listenTo(this.model,"change:fullname",this.requestUpdate),this.listenTo(this.model,"change:jid",this.requestUpdate),this.listenTo(this.model,"change:minimized",this.requestUpdate),this.listenTo(this.model,"change:name",this.requestUpdate),this.listenTo(this.model,"change:num_unread",this.requestUpdate),this.listenTo(this.model,"remove",this.requestUpdate),this.listenTo(wa,"connected",this.requestUpdate),this.listenTo(wa,"reconnected",this.requestUpdate),this.listenTo(wa,"disconnected",this.requestUpdate)}render(){const e=this.model.where({minimized:!0}),t=e.reduce(((e,t)=>e+t.get("num_unread")),0),n=e.reduce(((e,t)=>e+(t.get("minimized")?1:0)),0),s={chats:e,num_unread:t,num_minimized:n,collapsed:this.minchats.get("collapsed")};return s.toggle=e=>this.toggle(e),(e=>el`<div id="minimized-chats" class="${e.chats.length?"":"hidden"}">
2021-11-11 22:06:49 +01:00
<a id="toggle-minimized-chats" class="row no-gutters" @click=${e.toggle}>
2022-01-03 11:54:10 +01:00
${e.num_minimized} ${Eh("Minimized")}
2021-11-11 22:06:49 +01:00
<span class="unread-message-count ${e.num_unread?"":"unread-message-count-hidden"}" href="#">${e.num_unread}</span>
</a>
<div class="flyout minimized-chats-flyout row no-gutters ${e.collapsed?"hidden":""}">
2022-01-03 11:54:10 +01:00
${e.chats.map((e=>el`<converse-minimized-chat
2021-03-19 19:26:15 +01:00
.model=${e}
title=${e.getDisplayName()}
type=${e.get("type")}
2021-11-11 22:06:49 +01:00
num_unread=${e.get("num_unread")}></converse-minimized-chat>`))}
2021-03-19 19:26:15 +01:00
</div>
2022-01-03 11:54:10 +01:00
</div>`)(s)}async initToggle(){const e=`converse.minchatstoggle-${wa.bare_jid}`;this.minchats=new Mb({id:e}),_o(this.minchats,e,"session"),await new Promise((e=>this.minchats.fetch({success:e,error:e})))}toggle(e){null==e||e.preventDefault(),this.minchats.save({collapsed:!this.minchats.get("collapsed")})}});const Rb=$l.env.utils;function Db(e){if("controlbox"===e.model.get("id")){if(Rb.isVisible(e))return Rb.getOuterWidth(e,!0);{const e=document.querySelector("converse-controlbox-toggle");return e?Rb.getOuterWidth(e,!0):0}}return!e.model.get("minimized")&&Rb.isVisible(e)?Rb.getOuterWidth(e,!0):0}function Lb(){const e=document.querySelector("converse-minimized-chats");return wa.chatboxes.pluck("minimized").includes(!0)?Rb.getOuterWidth(e,!0):0}function zb(e){const t=e?e.model.get("id"):null,n=e?Rb.getOuterWidth(e,!0):0;return Object.values(wa.chatboxviews.xget(t)).reduce(((e,t)=>e+Db(t)),n)}function Pb(e){if(wa.isTestEnv()||jl.settings.get("no_trimming")||"overlayed"!==jl.settings.get("view_mode"))return;const t=wa.chatboxviews.filter((e=>!e.model.get("minimized")&&!e.model.get("closed")&&Rb.isVisible(e)));if(t.length<=1)return;const n=Rb.getOuterWidth(document.querySelector("body"),!0);if(Db(t[0])!==n&&document.querySelector("converse-minimized-chats"))for(;Lb()+zb(e)>n;){const t=Fb([e?e.model.get("id"):null]);if(!t)break;{const e=wa.chatboxes.get(t.get("id"));null==e||e.save("hidden",!0),Bb(t)}}}function Fb(e){e.push("controlbox");let t=0,n=wa.chatboxes.sort().at(t);for(;e.includes(n.get("id"))||!0===n.get("minimized");)if(t++,n=wa.chatboxes.at(t),!n)return null;return n}function Ub(e,t){null!=e&&e.preventDefault?e.preventDefault():t=e,Rb.safeSave(t,{hidden:!1,minimized:!1,time_opened:(new Date).getTime()})}function Bb(e,t){null!=e&&e.preventDefault?e.preventDefault():t=e,t.setChatState(wa.INACTIVE),Rb.safeSave(t,{hidden:!0,minimized:!0,time_minimized:(new Date).toISOString()})}jl.elements.define("converse-minimized-chat",class extends ig{static get properties(){return{model:{type:Object},title:{type:String},type:{type:String},num_unread:{type:Number}}}render(){return(e=>{const t=Eh("Click to restore this chat");return el`
<div class="chat-head-${e.type} chat-head row no-gutters">
<a class="restore-chat w-100 align-self-center" title="${t}" @click=${e.restore}>
${e.num_unread?el`<span class="message-count badge badge-light">${e.num_unread}</span>`:""}
${e.title}
</a>
<a class="chatbox-btn close-chatbox-button" @click=${e.close}>
<converse-icon color=${"chatroom"===e.type?"var(--chatroom-head-color)":"var(--chat-head-text-color)"} class="fas fa-times" @click=${e.close} size="1em"></converse-icon>
</a>
</div>`})({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(),this.model.close()}restore(e){null==e||e.preventDefault(),Ub(this.model)}});var qb=n(4915),Hb={};Hb.styleTagTransform=vg(),Hb.setAttributes=fg(),Hb.insert=ug().bind(null,"head"),Hb.domAPI=lg(),Hb.insertStyleElement=gg(),ag()(qb.Z,Hb),qb.Z&&qb.Z.locals&&qb.Z.locals;const{dayjs:Gb}=$l.env;$l.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("change:hidden",(e=>!e.get("hidden")&&Ub(this)),this),"controlbox"!==this.get("id")&&this.save({minimized:this.get("minimized")||!1,time_minimized:this.get("time_minimized")||Gb()})},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:{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(){function e(e){e.on("change:minimized",(()=>function(e){e.get("minimized")?function(e){jl.trigger("chatBoxMinimized",e)}(e):function(e){e.isScrolledUp()||e.clearUnreadMsgCounter(),e.setChatState(wa.ACTIVE),jl.trigger("chatBoxMaximized",e)}(e)}(e)))}jl.settings.extend({no_trimming:!1}),jl.promises.add("minimizedChatsInitialized"),wa.MinimizedChatsToggle=Mb,wa.minimize={trimChats:Pb,minimize:Bb,maximize:Ub},jl.listen.on("chatBoxViewInitialized",(e=>wa.minimize.trimChats(e))),jl.listen.on("chatRoomViewInitialized",(e=>wa.minimize.trimChats(e))),jl.listen.on("controlBoxOpened",(e=>wa.minimize.trimChats(e))),jl.listen.on("chatBoxInitialized",e),jl.listen.on("chatRoomInitialized",e),jl.listen.on("getHeadingButtons",((e,t)=>e.model.get("type")===wa.CHATROOMS_TYPE?function(e,t){const n={a_class:"toggle-chatbox-button",handler:t=>Bb(t,e.model),i18n_text:Eh("Minimize"),i18n_title:Eh("Minimize this groupchat"),icon_class:"fa-minus",name:"minimize",standalone:"overlayed"===wa.api.settings.get("view_mode")},s=t.map((e=>e.name)).indexOf("signout");return s>-1?[...t.slice(0,s),n,...t.slice(s)]:[n,...t]}(e,t):function(e,t){const n={a_class:"toggle-chatbox-button",handler:t=>Bb(t,e.model),i18n_text:Eh("Minimize"),i18n_title:Eh("Minimize this chat"),icon_class:"fa-minus",name:"minimize",standalone:"overlayed"===wa.api.settings.get("view_mode")},s=t.map((e=>e.name)).indexOf("close");return s>-1?[...t.slice(0,s),n,...t.slice(s)]:[n,...t]}(e,t)));const t=gc((()=>wa.minimize.trimChats()),250);jl.listen.on("registeredGlobalEventHandlers",(()=>window.addEventListener("resize",t))),jl.listen.on("unregisteredGlobalEventHandlers",(()=>window.removeEventListener("resize",t)))}});const Wb=$l.env.utils,Vb={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 s=t[n];n.split(/\s+/).forEach((t=>e.addEventListener(t,s)))}},unbind(e,t){if(e)for(var n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const s=t[n];n.split(/\s+/).forEach((t=>e.removeEventListener(t,s)))}},regExpEscape:e=>e.replace(/[-\\^$*+?.()|[\]{}]/g,"\\$&"),isMention:(e,t)=>t.includes(e[0])||Wb.isMentionBoundary(e[0])&&t.includes(e[1])},Jb=function(e,t){return RegExp(Vb.regExpEscape(t.trim()),"i").test(e)},Qb=function(e,t){return RegExp("^"+Vb.regExpEscape(t.trim()),"i").test(e)},Zb=function(e,t){const n=e.query.toLowerCase(),s=e.label.toLowerCase().indexOf(n),i=t.label.toLowerCase().indexOf(n);return s===i?function(e,t){return e.length!==t.length?e.length-t.length:e<t?-1:1}(e,t):(-1===s?1/0:s)<(-1===i?1/0:i)?-1:1},Kb=(e,t)=
2021-03-19 19:26:15 +01:00
<div class="suggestion-box suggestion-box__name">
<ul class="suggestion-box__results suggestion-box__results--above" hidden=""></ul>
2021-11-11 22:06:49 +01:00
<input
type="text"
name="${this.name}"
autocomplete="off"
@keydown=${this.onKeyDown}
@keyup=${this.onKeyUp}
class="form-control suggestion-box__input"
placeholder="${this.placeholder}"
/>
<span
class="suggestion-box__additions visually-hidden"
role="status"
aria-live="assertive"
aria-relevant="additions"
></span>
2021-03-19 19:26:15 +01:00
</div>
2022-01-03 11:54:10 +01:00
`}firstUpdated(){this.auto_complete=new t_(this.firstElementChild,{ac_triggers:this.triggers.split(" "),auto_evaluate:this.auto_evaluate,auto_first:this.auto_first,filter:"contains"==this.filter?Jb:Qb,include_triggers:[],list:()=>this.getAutoCompleteList(),match_current_word:!0,max_items:this.max_items,min_chars:this.min_chars}),this.auto_complete.on("suggestion-box-selectcomplete",(()=>this.auto_completing=!1))}onKeyDown(e){this.auto_complete.onKeyDown(e)}onKeyUp(e){this.auto_complete.evaluate(e)}});var n_=n(4921),s_={};s_.styleTagTransform=vg(),s_.setAttributes=fg(),s_.insert=ug().bind(null,"head"),s_.domAPI=lg(),s_.insertStyleElement=gg(),ag()(n_.Z,s_),n_.Z&&n_.Z.locals&&n_.Z.locals,wa.FILTER_CONTAINS=Jb,wa.FILTER_STARTSWITH=Qb,wa.AutoComplete=t_;function i_(e){return"moderator"===e?Eh("Moderators are privileged users who can change the roles of other users (except those with admin or owner affiliations."):"participant"===e?Eh("The default role, implies that you can read and write messages."):"visitor"==e?Eh("Visitors aren't allowed to write messages in a moderated multi-user chat."):void 0}function r_(e){return"owner"===e?Eh("Owner is the highest affiliation. Owners can modify roles and affiliations of all other users."):"admin"===e?Eh("Admin is the 2nd highest affiliation. Admins can modify roles and affiliations of all other users except owners."):"outcast"===e?Eh('To ban a user, you give them the affiliation of "outcast".'):void 0}const o_=e=>{const t=Eh("Affiliation"),n=Eh("No users with that affiliation found."),s=Eh("No users with that role found."),i=Eh("Type here to filter the search results"),r=Eh("Role"),o=Eh("Show users"),a=Eh("Roles are assigned to users to grant or deny them certain abilities in a multi-user chat. They're assigned either explicitly or implicitly as part of an affiliation. A role that's not due to an affiliation, is only valid for the duration of the user's session."),c=Eh("An affiliation is a long-lived entitlement which typically implies a certain role and which grants privileges and responsibilities. For example admins and owners automatically have the moderator role."),l=e.queryable_roles.length&&e.queryable_affiliations.length;return el`
${e.alert_message?el`<div class="alert alert-${e.alert_type}" role="alert">${e.alert_message}</div>`:""}
${l?el`
2021-11-11 22:06:49 +01:00
<ul class="nav nav-pills justify-content-center">
<li role="presentation" class="nav-item">
<a class="nav-link active" id="affiliations-tab" href="#affiliations-tabpanel" aria-controls="affiliations-tabpanel" role="tab" data-toggle="tab">Affiliations</a>
2021-03-19 19:26:15 +01:00
</li>
2021-11-11 22:06:49 +01:00
<li role="presentation" class="nav-item">
<a class="nav-link" id="roles-tab" href="#roles-tabpanel" aria-controls="roles-tabpanel" role="tab" data-toggle="tab">Roles</a>
</li>
</ul>
`:""}
<div class="tab-content">
2022-01-03 11:54:10 +01:00
${e.queryable_affiliations.length?el`
2021-11-11 22:06:49 +01:00
<div class="tab-pane tab-pane--columns ${e.queryable_affiliations.length?"active":""}" id="affiliations-tabpanel" role="tabpanel" aria-labelledby="affiliations-tab">
<form class="converse-form query-affiliation" @submit=${e.queryAffiliation}>
<p class="helptext pb-3">${c}</p>
<div class="form-group">
<label for="affiliation">
<strong>${t}:</strong>
</label>
<div class="row">
<div class="col">
<select class="custom-select select-affiliation" name="affiliation">
2022-01-03 11:54:10 +01:00
${e.queryable_affiliations.map((t=>(e=>el`
2021-11-11 22:06:49 +01:00
<option value="${e.item||""}"
?selected=${e.item===e.affiliation}
2022-01-03 11:54:10 +01:00
title="${r_(e.item)}">${e.item}</option>
2021-11-11 22:06:49 +01:00
`)(Object.assign({item:t},e))))}
</select>
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
<div class="col">
<input type="submit" class="btn btn-primary" name="users_with_affiliation" value="${o}"/>
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
</div>
<div class="row">
<div class="col mt-3">
2022-01-03 11:54:10 +01:00
${Array.isArray(e.users_with_affiliation)&&e.users_with_affiliation.length>5?el`<input class="form-control" .value="${e.affiliations_filter}" @keyup=${e.filterAffiliationResults} type="text" name="filter" placeholder="${i}"/>`:""}
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
</div>
2022-01-03 11:54:10 +01:00
${r_(e.affiliation)?el`<div class="row"><div class="col pt-2"><p class="helptext pb-3">${r_(e.affiliation)}</p></div></div>`:""}
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
</form>
<div class="scrollable-container">
<ul class="list-group list-group--users">
2022-01-03 11:54:10 +01:00
${e.loading_users_with_affiliation?el`<li class="list-group-item"> ${ny()} </li>`:""}
${Array.isArray(e.users_with_affiliation)&&0===e.users_with_affiliation.length?el`<li class="list-group-item">${n}</li>`:""}
2021-11-11 22:06:49 +01:00
2022-01-03 11:54:10 +01:00
${e.users_with_affiliation instanceof Error?el`<li class="list-group-item">${e.users_with_affiliation.message}</li>`:(e.users_with_affiliation||[]).map((t=>(t.nick||t.jid).match(new RegExp(e.affiliations_filter,"i"))?(e=>el`
2021-03-19 19:26:15 +01:00
<li class="list-group-item" data-nick="${e.item.nick}">
<ul class="list-group">
<li class="list-group-item active">
<div><strong>JID:</strong> ${e.item.jid}</div>
</li>
<li class="list-group-item">
<div><strong>Nickname:</strong> ${e.item.nick}</div>
</li>
<li class="list-group-item">
2022-01-03 11:54:10 +01:00
<div><strong>Affiliation:</strong> ${e.item.affiliation} ${e.assignable_affiliations.length?(e=>el`
2021-11-11 22:06:49 +01:00
<a href="#" data-form="affiliation-form" class="toggle-form right" color="var(--subdued-color)" @click=${e.toggleForm}>
<converse-icon class="fa fa-wrench" size="1em"></converse-icon>
</a>`)(e):""}</div>
2022-01-03 11:54:10 +01:00
${e.assignable_affiliations.length?(e=>{const t=Eh("Change affiliation"),n=Eh("New affiliation"),s=Eh("Reason");return el`
2021-11-11 22:06:49 +01:00
<form class="affiliation-form hidden" @submit=${e.assignAffiliation}>
2021-03-19 19:26:15 +01:00
<div class="form-group">
<input type="hidden" name="jid" value="${e.item.jid}"/>
<input type="hidden" name="nick" value="${e.item.nick}"/>
<div class="row">
<div class="col">
<label><strong>${n}:</strong></label>
2021-11-11 22:06:49 +01:00
<select class="custom-select select-affiliation" name="affiliation">
2022-01-03 11:54:10 +01:00
${e.assignable_affiliations.map((t=>el`<option value="${t}" ?selected=${t===e.item.affiliation}>${t}</option>`))}
2021-03-19 19:26:15 +01:00
</select>
</div>
<div class="col">
2021-11-11 22:06:49 +01:00
<label><strong>${s}:</strong></label>
2021-03-19 19:26:15 +01:00
<input class="form-control" type="text" name="reason"/>
</div>
</div>
</div>
<div class="form-group">
2021-11-11 22:06:49 +01:00
<input type="submit" class="btn btn-primary" name="change" value="${t}"/>
2021-03-19 19:26:15 +01:00
</div>
</form>
`})(e):""}
</li>
</ul>
</li>
2021-11-11 22:06:49 +01:00
`)(Object.assign({item:t},e)):""))}
</ul>
</div>
</div>`:""}
2022-01-03 11:54:10 +01:00
${e.queryable_roles.length?el`
2021-11-11 22:06:49 +01:00
<div class="tab-pane tab-pane--columns ${!l&&e.queryable_roles.length?"active":""}" id="roles-tabpanel" role="tabpanel" aria-labelledby="roles-tab">
<form class="converse-form query-role" @submit=${e.queryRole}>
<p class="helptext pb-3">${a}</p>
<div class="form-group">
<label for="role"><strong>${r}:</strong></label>
<div class="row">
<div class="col">
<select class="custom-select select-role" name="role">
2022-01-03 11:54:10 +01:00
${e.queryable_roles.map((t=>(e=>el`
2021-11-11 22:06:49 +01:00
<option value="${e.item||""}"
?selected=${e.item===e.role}
2022-01-03 11:54:10 +01:00
title="${i_(e.item)}">${e.item}</option>
2021-11-11 22:06:49 +01:00
`)(Object.assign({item:t},e))))}
</select>
</div>
<div class="col">
<input type="submit" class="btn btn-primary" name="users_with_role" value="${o}"/>
</div>
</div>
<div class="row">
<div class="col mt-3">
2022-01-03 11:54:10 +01:00
${Array.isArray(e.users_with_role)&&e.users_with_role.length>5?el`<input class="form-control" .value="${e.roles_filter}" @keyup=${e.filterRoleResults} type="text" name="filter" placeholder="${i}"/>`:""}
2021-11-11 22:06:49 +01:00
</div>
</div>
2022-01-03 11:54:10 +01:00
${i_(e.role)?el`<div class="row"><div class="col pt-2"><p class="helptext pb-3">${i_(e.role)}</p></div></div>`:""}
2021-11-11 22:06:49 +01:00
</div>
</form>
<div class="scrollable-container">
<ul class="list-group list-group--users">
2022-01-03 11:54:10 +01:00
${e.loading_users_with_role?el`<li class="list-group-item"> ${ny()} </li>`:""}
${e.users_with_role&&0===e.users_with_role.length?el`<li class="list-group-item">${s}</li>`:""}
${(e.users_with_role||[]).map((t=>t.nick.match(e.roles_filter)?(e=>el`
2021-03-19 19:26:15 +01:00
<li class="list-group-item" data-nick="${e.item.nick}">
<ul class="list-group">
<li class="list-group-item active">
<div><strong>JID:</strong> ${e.item.jid}</div>
</li>
<li class="list-group-item">
<div><strong>Nickname:</strong> ${e.item.nick}</div>
</li>
<li class="list-group-item">
2022-01-03 11:54:10 +01:00
<div><strong>Role:</strong> ${e.item.role} ${e.assignable_roles.length?(e=>el`
2021-11-11 22:06:49 +01:00
<a href="#" data-form="role-form" class="toggle-form right" color="var(--subdued-color)" @click=${e.toggleForm}>
<converse-icon class="fa fa-wrench" size="1em"></converse-icon>
</a>`)(e):""}</div>
2022-01-03 11:54:10 +01:00
${e.assignable_roles.length?(e=>{const t=Eh("Change role"),n=Eh("New Role"),s=Eh("Reason");return el`
2021-11-11 22:06:49 +01:00
<form class="role-form hidden" @submit=${e.assignRole}>
2021-03-19 19:26:15 +01:00
<div class="form-group">
<input type="hidden" name="jid" value="${e.item.jid}"/>
<input type="hidden" name="nick" value="${e.item.nick}"/>
<div class="row">
<div class="col">
<label><strong>${n}:</strong></label>
2021-11-11 22:06:49 +01:00
<select class="custom-select select-role" name="role">
2022-01-03 11:54:10 +01:00
${e.assignable_roles.map((t=>el`<option value="${t}" ?selected=${t===e.item.role}>${t}</option>`))}
2021-03-19 19:26:15 +01:00
</select>
</div>
<div class="col">
2021-11-11 22:06:49 +01:00
<label><strong>${s}:</strong></label>
2021-03-19 19:26:15 +01:00
<input class="form-control" type="text" name="reason"/>
</div>
</div>
</div>
<div class="form-group">
2021-11-11 22:06:49 +01:00
<input type="submit" class="btn btn-primary" value="${t}"/>
2021-03-19 19:26:15 +01:00
</div>
</form>
`})(e):""}
</li>
</ul>
</li>
2021-11-11 22:06:49 +01:00
`)(Object.assign({item:t},e)):""))}
</ul>
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
</div>`:""}
2022-01-03 11:54:10 +01:00
</div>`},{Strophe:a_,sizzle:c_,u:l_}=$l.env;jl.elements.define("converse-modtools",class extends ig{static get properties(){return{affiliation:{type:String},affiliations_filter:{type:String,attribute:!1},alert_message:{type:String,attribute:!1},alert_type:{type:String,attribute:!1},jid:{type:String},muc:{type:Object,attribute:!1},role:{type:String},roles_filter:{type:String,attribute:!1},users_with_affiliation:{type:Array,attribute:!1},users_with_role:{type:Array,attribute:!1}}}constructor(){super(),this.affiliation="",this.affiliations_filter="",this.role="",this.roles_filter=""}updated(e){e.has("role")&&this.onSearchRoleChange(),e.has("affiliation")&&this.onSearchAffiliationChange(),e.has("jid")&&e.get("jid")&&this.initialize()}async initialize(){this.initialized=ji();const e=await jl.rooms.get(this.jid);await e.initialized,this.muc=e,this.initialized.resolve()}render(){var e;if(null!==(e=this.muc)&&void 0!==e&&e.occupants){const e=this.muc.occupants.findWhere({jid:wa.bare_jid});return o_({affiliations_filter:this.affiliations_filter,alert_message:this.alert_message,alert_type:this.alert_type,assignAffiliation:e=>this.assignAffiliation(e),assignRole:e=>this.assignRole(e),assignable_affiliations:Iu(e),assignable_roles:Xu(e),filterAffiliationResults:e=>this.filterAffiliationResults(e),filterRoleResults:e=>this.filterRoleResults(e),loading_users_with_affiliation:this.loading_users_with_affiliation,queryAffiliation:e=>this.queryAffiliation(e),queryRole:e=>this.queryRole(e),queryable_affiliations:fh.filter((e=>!jl.settings.get("modtools_disable_query").includes(e))),queryable_roles:hh.filter((e=>!jl.settings.get("modtools_disable_query").includes(e))),roles_filter:this.roles_filter,switchTab:e=>this.switchTab(e),toggleForm:e=>this.toggleForm(e),users_with_affiliation:this.users_with_affiliation,users_with_role:this.users_with_role})}return""}async onSearchAffiliationChange(){if(this.affiliation){if(await this.initialized,this.clearAlert(),this.loading_users_with_affiliation=!0,this.users_with_affiliation=null,this.shouldFetchAffiliationsList()){const e=await $u(this.affiliation,this.jid);e instanceof Error?(this.alert(e.message,"danger"),this.users_with_affiliation=[]):this.users_with_affiliation=e}else this.users_with_affiliation=this.muc.getOccupantsWithAffiliation(this.affiliation);this.loading_users_with_affiliation=!1}}async onSearchRoleChange(){this.role&&(await this.initialized,this.clearAlert(),this.users_with_role=this.muc.getOccupantsWithRole(this.role))}shouldFetchAffiliationsList(){const e=this.affiliation;return"none"!==e&&!this.muc.occupants.getAutoFetchedAffiliationLists().includes(e)}toggleForm(e){e.stopPropagation(),e.preventDefault();const t=l_.ancestor(e.target,".toggle-form"),n=t.getAttribute("data-form"),s=l_.ancestor(t,".list-group-item").querySelector(`.${n}`);l_.hasClass("hidden",s)?l_.removeClass("hidden",s):l_.addClass("hidden",s)}filterRoleResults(e){this.roles_filter=e.target.value,this.render()}filterAffiliationResults(e){this.affiliations_filter=e.target.value}queryRole(e){e.stopPropagation(),e.preventDefault();const t=new FormData(e.target).get("role");this.role=null,this.role=t}queryAffiliation(e){e.stopPropagation(),e.preventDefault();const t=new FormData(e.target).get("affiliation");this.affiliation=null,this.affiliation=t}alert(e,t){this.alert_message=e,this.alert_type=t}clearAlert(){this.alert_message=void 0,this.alert_type=void 0}async assignAffiliation(e){e.stopPropagation(),e.preventDefault(),this.clearAlert();const t=new FormData(e.target),n=t.get("affiliation"),s={jid:t.get("jid"),reason:t.get("reason")},i=this.affiliation,r=this.muc.get("jid");try{await Ru(n,r,[s])}catch(e){return null===e?this.alert(Eh("Timeout error while trying to set the affiliation"),"danger"):c_(`not-allowed[xmlns="${a_.NS.STANZAS}"]`,e).length?this.alert(Eh("Sorry, you're not allowed to make that change"),"danger"):this.alert(Eh("Sorry, something went wrong while trying to set the affiliation"),"danger"),void M.error(e)}await this.muc.occupants.fetchMembers(),this.affiliation=null,this.affiliation=i,
2021-03-19 19:26:15 +01:00
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
2021-11-11 22:06:49 +01:00
<h5 class="modal-title" id="converse-modtools-modal-label">${t}</h5>
2022-01-03 11:54:10 +01:00
${lp}
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
<div class="modal-body d-flex flex-column">
<converse-modtools jid=${e.jid} affiliation=${e.affiliation}></converse-modtools>
2021-03-19 19:26:15 +01:00
</div>
</div>
2022-01-03 11:54:10 +01:00
</div>`})(this)}}),{Strophe:u_,$iq:h_,sizzle:f_,u:m_}=$l.env,g_={admin:"admin",ban:"outcast",member:"member",owner:"owner",revoke:"none"},p_={deop:"participant",kick:"none",mute:"visitor",op:"moderator",voice:"participant"};async function v_(e){const t=[Eh("Are you sure you want to destroy this groupchat?")];let n=[{name:"challenge",label:Eh("Please enter the XMPP address of this groupchat to confirm"),challenge:e.get("jid"),placeholder:Eh("name@example.org"),required:!0},{name:"reason",label:Eh("Optional reason for destroying this groupchat"),placeholder:Eh("Reason")},{name:"newjid",label:Eh("Optional XMPP address for a new groupchat that replaces this one"),placeholder:Eh("replacement@example.org")}];try{var s,i;n=await jl.confirm(Eh("Confirm"),t,n);const r=null===(s=n.filter((e=>"reason"===e.name)).pop())||void 0===s?void 0:s.value,o=null===(i=n.filter((e=>"newjid"===e.name)).pop())||void 0===i?void 0:i.value;return e.sendDestroyIQ(r,o).then((()=>e.close()))}catch(e){M.error(e)}}function y_(e,t){t.querySelector("converse-rooms-list").model.save("muc_domain",u_.getDomainFromJid(e))}function b_(e){e.model.get("connected")&&(e.querySelector("converse-rooms-list").model.get("muc_domain")||(void 0===jl.settings.get("muc_domain")?function(e){function t(t){t&&t.get("var")===u_.NS.MUC&&t.entity.getIdentity("conference","text").then((n=>{n&&y_(t.get("from"),e)}))}jl.waitUntil("discoInitialized").then((()=>{jl.listen.on("serviceDiscovered",t),wa.disco_entities.each((e=>t(e.features.findWhere({var:u_.NS.MUC}))))})).catch((e=>M.error(e)))}(e):y_(jl.settings.get("muc_domain"),e)))}function __(e,t){t=t.trim();const n=document.createElement("li");if(n.setAttribute("aria-selected","false"),jl.settings.get("muc_mention_autocomplete_show_avatar")){const t=document.createElement("img");let s="data:"+wa.DEFAULT_IMAGE_TYPE+";base64,"+wa.DEFAULT_IMAGE;if(wa.vcards){const t=wa.vcards.findWhere({nickname:e});t&&(s="data:"+t.get("image_type")+";base64,"+t.get("image"))}t.setAttribute("src",s),t.setAttribute("width","22"),t.setAttribute("class","avatar avatar-autocomplete"),n.appendChild(t)}const s=new RegExp("("+t+")","ig");return(t?e.split(s):[e]).forEach((e=>{if(t&&e.match(s)){const t=document.createElement("mark");t.textContent=e,n.appendChild(t)}else n.appendChild(document.createTextNode(e))})),n}async function w_(){const e=[...await jl.rooms.get(),...await jl.contacts.get()];return[...new Set(e.map((e=>u_.getDomainFromJid(e.get("jid")))))]}function S_(e,t,n,s=[],i=[]){const r=p_[t];if(!r)throw Error(`ChatRoomView#setRole called with invalid command: ${t}`);if(!e.verifyAffiliations(s)||!e.verifyRoles(i))return!1;if(!e.validateRoleOrAffiliationChangeArgs(t,n))return!1;const o=e.getNickOrJIDFromCommandArgs(n);if(!o)return!1;const a=n.split(o,2)[1].trim(),c=e.getOccupant(o);return e.setRole(c,r,a,void 0,(t=>e.onCommandError(t))),!0}function x_(e,t,n,s){const i=g_[t];if(!i)throw Error(`verifyAffiliations called with invalid command: ${t}`);if(!e.verifyAffiliations(s))return!1;if(!e.validateRoleOrAffiliationChangeArgs(t,n))return!1;const r=e.getNickOrJIDFromCommandArgs(n);if(!r)return!1;let o;const a=n.split(r,2)[1].trim(),c=e.getOccupant(r);if(c)o=c.get("jid");else{if(!m_.isValidJID(r)){const t=Eh("Couldn't find a participant with that nickname. They might have left the groupchat.");return void e.createMessage({message:t,type:"error"})}o=r}const l={jid:o,reason:a};c&&jl.settings.get("auto_register_muc_nickname")&&(l.nick=c.get("nick")),Ru(i,e.get("jid"),[l]).then((()=>e.occupants.fetchMembers())).catch((t=>e.onCommandError(t)))}function E_(e,t){if(!e.verifyRoles(["moderator"]))return;let n=jl.modal.get(d_.id);n?(n.affiliation=t,n.render()):n=jl.modal.create(d_,{affiliation:t,jid:e.get("jid")}),n.show()}const A_=e=>{const t=Eh("On which entity do you want to run commands?"),n=Eh("Certain XMPP services and entities allow privileged users to execute ad-hoc commands on them."),s=Eh("Commands found"),i=Eh("List available commands"),r=Eh("XMPP Address"),o=Eh("No commands found");return el`
${e.alert?el`<div class="alert alert-${e.alert_type}" role="alert">${e.alert}</div>`:""}
2021-11-11 22:06:49 +01:00
<form class="converse-form" @submit=${e.fetchCommands}>
2021-03-19 19:26:15 +01:00
<fieldset class="form-group">
2021-11-11 22:06:49 +01:00
<label>
${t}
<p class="form-help">${n}</p>
<converse-autocomplete
2022-01-03 11:54:10 +01:00
.getAutoCompleteList="${w_}"
2021-11-11 22:06:49 +01:00
placeholder="${r}"
name="jid"/>
</label>
2021-03-19 19:26:15 +01:00
</fieldset>
<fieldset class="form-group">
2021-11-11 22:06:49 +01:00
<input type="submit" class="btn btn-primary" value="${i}">
2021-03-19 19:26:15 +01:00
</fieldset>
2022-01-03 11:54:10 +01:00
${"list-commands"===e.view?el`
2021-03-19 19:26:15 +01:00
<fieldset class="form-group">
2021-11-11 22:06:49 +01:00
<ul class="list-group">
<li class="list-group-item active">${e.commands.length?s:o}:</li>
2022-01-03 11:54:10 +01:00
${e.commands.map((t=>((e,t)=>el`
2021-03-19 19:26:15 +01:00
<li class="room-item list-group-item">
<div class="available-chatroom d-flex flex-row">
<a class="open-room available-room w-100"
@click=${e.toggleCommandForm}
data-command-node="${t.node}"
data-command-jid="${t.jid}"
data-command-name="${t.name}"
title="${t.name}"
href="#">${t.name||t.jid}</a>
</div>
2022-01-03 11:54:10 +01:00
${t.node===e.showform?((e,t)=>{const n=Eh("Hide"),s=Eh("Execute");return el`
2021-03-19 19:26:15 +01:00
<form @submit=${e.runCommand}>
2022-01-03 11:54:10 +01:00
${t.alert?el`<div class="alert alert-${t.alert_type}" role="alert">${t.alert}</div>`:""}
2021-03-19 19:26:15 +01:00
<fieldset class="form-group">
<input type="hidden" name="command_node" value="${t.node}"/>
<input type="hidden" name="command_jid" value="${t.jid}"/>
<p class="form-help">${t.instructions}</p>
2021-11-11 22:06:49 +01:00
${t.fields}
2021-03-19 19:26:15 +01:00
</fieldset>
<fieldset>
2021-11-11 22:06:49 +01:00
<input type="submit" class="btn btn-primary" value="${s}">
2021-03-19 19:26:15 +01:00
<input type="button" class="btn btn-secondary button-cancel" value="${n}" @click=${e.hideCommandForm}>
</fieldset>
</form>
`})(e,t):""}
</li>
2021-11-11 22:06:49 +01:00
`)(e,t)))}
</ul>
</fieldset>`:""}
</form>
2022-01-03 11:54:10 +01:00
`},{Strophe:C_,$iq:T_,sizzle:k_,u:j_}=$l.env;jl.elements.define("converse-adhoc-commands",class extends ig{static get properties(){return{alert:{type:String},alert_type:{type:String},nonce:{type:String},showform:{type:String},view:{type:String}}}constructor(){super(),this.view="choose-service",this.showform="",this.commands=[]}render(){return A_({alert:this.alert,alert_type:this.alert_type,commands:this.commands,fetchCommands:e=>this.fetchCommands(e),hideCommandForm:e=>this.hideCommandForm(e),runCommand:e=>this.runCommand(e),showform:this.showform,toggleCommandForm:e=>this.toggleCommandForm(e),view:this.view})}async fetchCommands(e){e.preventDefault(),delete this.alert_type,delete this.alert;const t=new FormData(e.target).get("jid").trim();let n;try{n=await jl.disco.supports(C_.NS.ADHOC,t)}catch(e){M.error(e)}if(n)try{this.commands=await jl.adhoc.getCommands(t),this.view="list-commands"}catch(e){return M.error(e),this.alert_type="danger",this.alert=Eh("Sorry, an error occurred while looking for commands on that entity."),this.commands=[],void M.error(e)}else this.alert_type="danger",this.alert=Eh("The specified entity doesn't support ad-hoc commands")}async toggleCommandForm(e){e.preventDefault();const t=e.target.getAttribute("data-command-node"),n=this.commands.filter((e=>e.node===t))[0];this.showform!==t&&await async function(e){const t=e.node,n=e.jid,s=h_({type:"set",to:n}).c("command",{xmlns:u_.NS.ADHOC,node:t,action:"execute"});try{var i;const t=await jl.sendIQ(s),n=f_(`command[xmlns="${u_.NS.ADHOC}"]`,t).pop();e.sessionid=n.getAttribute("sessionid"),e.instructions=null===(i=f_('x[type="form"][xmlns="jabber:x:data"] instructions',n).pop())||void 0===i?void 0:i.textContent,e.fields=f_('x[type="form"][xmlns="jabber:x:data"] field',n).map((e=>m_.xForm2TemplateResult(e,n)))}catch(t){null===t?M.error(`Error: timeout while trying to execute command for ${n}`):(M.error(`Error while trying to execute command for ${n}`),M.error(t)),e.fields=[]}}(n),this.showform=t}hideCommandForm(e){e.preventDefault(),this.showform=""}async runCommand(e){e.preventDefault();const t=new FormData(e.target),n=t.get("command_jid").trim(),s=t.get("command_node").trim(),i=this.commands.filter((e=>e.node===s))[0];i.alert=null,this.nonce=j_.getUniqueId();const r=k_(":input:not([type=button]):not([type=submit])",e.target).filter((e=>!["command_jid","command_node"].includes(e.getAttribute("name")))).map(j_.webForm2xForm).filter((e=>e)),o=T_({to:n,type:"set"}).c("command",{sessionid:i.sessionid,node:i.node,xmlns:C_.NS.ADHOC}).c("x",{xmlns:C_.NS.XFORM,type:"submit"});let a;r.forEach((e=>o.cnode(e).up()));try{a=await jl.sendIQ(o)}catch(e){i.alert_type="danger",i.alert=Eh("Sorry, an error occurred while trying to execute the command. See the developer console for details"),M.error("Error while trying to execute an ad-hoc command"),M.error(e)}var c;i.alert=a?null===(c=a.querySelector("note"))||void 0===c?void 0:c.textContent:"Done",i.alert_type="primary",this.nonce=j_.getUniqueId()}}),jl.elements.define("converse-muc-message-form",class extends My{toHTML(){var e,t;return(e=>{const t=e.composing_spoiler?Eh("Hidden message"):Eh("Message"),n=Eh("Optional hint"),s=jl.settings.get("show_send_button");return el`
2021-11-11 22:06:49 +01:00
<form class="setNicknameButtonForm hidden">
<input type="submit" class="btn btn-primary" name="join" value="Join"/>
</form>
<form class="sendXMPPMessage">
<input type="text" placeholder="${n||""}" value="${e.hint_value||""}" class="${e.composing_spoiler?"":"hidden"} spoiler-hint"/>
<div class="suggestion-box">
<ul class="suggestion-box__results suggestion-box__results--above" hidden=""></ul>
<textarea
autofocus
type="text"
@drop=${e.onDrop}
2022-01-03 11:54:10 +01:00
@input=${Ny}
2021-11-11 22:06:49 +01:00
@keydown=${e.onKeyDown}
@keyup=${e.onKeyUp}
@paste=${e.onPaste}
@change=${e.onChange}
class="chat-textarea suggestion-box__input
${s?"chat-textarea-send-button":""}
${e.composing_spoiler?"spoiler":""}"
placeholder="${t}">${e.message_value||""}</textarea>
<span class="suggestion-box__additions visually-hidden" role="status" aria-live="assertive" aria-relevant="additions"></span>
</div>
2022-01-03 11:54:10 +01:00
</form>`})(Object.assign(this.model.toJSON(),{hint_value:null===(e=this.querySelector(".spoiler-hint"))||void 0===e?void 0:e.value,message_value:null===(t=this.querySelector(".chat-textarea"))||void 0===t?void 0:t.value,onChange:e=>this.model.set({draft:e.target.value}),onDrop:e=>this.onDrop(e),onKeyDown:e=>this.onKeyDown(e),onKeyUp:e=>this.onKeyUp(e),onPaste:e=>this.onPaste(e),scrolled:this.model.ui.get("scrolled"),viewUnreadMessages:e=>this.viewUnreadMessages(e)}))}afterRender(){const e=this.model.session.get("connection_status")===$l.ROOMSTATUS.ENTERED,t=e&&!(this.model.features.get("moderated")&&"visitor"===this.model.getOwnRole());e&&t&&this.initMentionAutoComplete()}initMentionAutoComplete(){this.mention_auto_complete=new wa.AutoComplete(this,{auto_first:!0,auto_evaluate:!1,min_chars:jl.settings.get("muc_mention_autocomplete_min_chars"),match_current_word:!0,list:()=>this.getAutoCompleteList(),filter:"contains"==jl.settings.get("muc_mention_autocomplete_filter")?wa.FILTER_CONTAINS:wa.FILTER_STARTSWITH,ac_triggers:["Tab","@"],include_triggers:[],item:__}),this.mention_auto_complete.on("suggestion-box-selectcomplete",(()=>this.auto_completing=!1))}parseMessageForCommands(e){return function(e,t){if(jl.settings.get("muc_disable_slash_commands")&&!Array.isArray(jl.settings.get("muc_disable_slash_commands")))return jy(e,t);const n=((t=t.replace(/^\s*/,"")).match(/^\/([a-zA-Z]*) ?/)||[""]).pop().toLowerCase();if(!n)return!1;const s=t.slice(("/"+n).length+1).trim();if(!e.getAllowedCommands().includes(n))return!1;switch(n){case"admin":x_(e,n,s,["owner"]);break;case"ban":x_(e,n,s,["admin","owner"]);break;case"modtools":E_(e,s);break;case"deop":S_(e,n,s,["admin","owner"]);break;case"destroy":if(!e.verifyAffiliations(["owner"]))break;v_(e).catch((t=>e.onCommandError(t)));break;case"help":e.set({show_help_messages:!1},{silent:!0}),e.set({show_help_messages:!0});break;case"kick":case"mute":S_(e,n,s,[],["moderator"]);break;case"member":x_(e,n,s,["admin","owner"]);break;case"nick":if(!e.verifyRoles(["visitor","participant","moderator"]))break;if(0===s.length){const t=Eh('Your nickname is "%1$s"',e.get("nick"));e.createMessage({message:t,type:"error"})}else e.setNickname(s);break;case"owner":x_(e,n,s,["owner"]);break;case"op":S_(e,n,s,["admin","owner"]);break;case"register":s.length>1?e.createMessage({message:Eh("Error: invalid number of arguments"),type:"error"}):e.registerNickname().then((t=>{t&&e.createMessage({message:t,type:"error"})}));break;case"revoke":x_(e,n,s,["admin","owner"]);break;case"topic":case"subject":e.setSubject(s);break;case"voice":S_(e,n,s,[],["moderator"]);break;default:return jy(e,t)}return!0}(this.model,e)}getAutoCompleteList(){return this.model.getAllKnownNicknames().map((e=>({label:e,value:`@${e}`})))}onKeyDown(e){this.mention_auto_complete.onKeyDown(e)||super.onKeyDown(e)}onKeyUp(e){this.mention_auto_complete.evaluate(e),super.onKeyUp(e)}});const N_=e=>{const t=Eh("Nickname"),n=Eh("Enter groupchat"),s=jl.settings.get("muc_show_logs_before_join")?Eh("Choose a nickname to enter"):Eh("Please choose your nickname"),i=e.get("nickname_validation_message");return el`
2021-11-11 22:06:49 +01:00
<div class="chatroom-form-container muc-nickname-form"
@submit=${t=>function(e,t){e.preventDefault();const n=e.target.nick.value.trim();n&&t.join(n)}(t,e)}>
<form class="converse-form chatroom-form converse-centered-form">
<fieldset class="form-group">
<label>${s}</label>
<p class="validation-message">${i}</p>
<input type="text"
required="required"
name="nick"
value="${e.get("nick")||""}"
class="form-control ${i?"error":""}"
placeholder="${t}"/>
</fieldset>
<fieldset class="form-group">
<input type="submit" class="btn btn-primary" name="join" value="${n}"/>
</fieldset>
</form>
2022-01-03 11:54:10 +01:00
</div>`};var O_=n(5655),$_={};$_.styleTagTransform=vg(),$_.setAttributes=fg(),$_.insert=ug().bind(null,"head"),$_.domAPI=lg(),$_.insertStyleElement=gg(),ag()(O_.Z,$_),O_.Z&&O_.Z.locals&&O_.Z.locals,jl.elements.define("converse-muc-bottom-panel",class extends Ly{constructor(...e){var t,n,s;super(...e),s={"click .hide-occupants":"hideOccupants","click .send-button":"sendButtonClicked"},(n="events")in(t=this)?Object.defineProperty(t,n,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[n]=s}async initialize(){await super.initialize(),this.listenTo(this.model,"change:hidden_occupants",this.debouncedRender),this.listenTo(this.model,"change:num_unread_general",this.debouncedRender),this.listenTo(this.model.features,"change:moderated",this.debouncedRender),this.listenTo(this.model.occupants,"add",this.renderIfOwnOccupant),this.listenTo(this.model.occupants,"change:role",this.renderIfOwnOccupant),this.listenTo(this.model.session,"change:connection_status",this.debouncedRender)}render(){const e=this.model.session.get("connection_status")===$l.ROOMSTATUS.ENTERED,t=e&&!(this.model.features.get("moderated")&&"visitor"===this.model.getOwnRole());il((e=>{const t=Eh("You have unread messages"),n=e.model.session.get("connection_status"),s=Eh("You're not allowed to send messages in this room");return n===$l.ROOMSTATUS.ENTERED?el`
${e.model.ui.get("scrolled")&&e.model.get("num_unread_general")?el`<div class="new-msgs-indicator" @click=${t=>e.viewUnreadMessages(t)}>▼ ${t} ▼</div>`:""}
${e.can_edit?(e=>{const t=Eh("You have unread messages"),n=jl.settings.get("message_limit"),s=jl.settings.get("visible_toolbar_buttons").call,i=jl.settings.get("visible_toolbar_buttons").emoji,r=jl.settings.get("show_send_button"),o=jl.settings.get("visible_toolbar_buttons").spoiler,a=jl.settings.get("show_toolbar");return el`
${e.model.ui.get("scrolled")&&e.model.get("num_unread")?el`<div class="new-msgs-indicator" @click=${t=>e.viewUnreadMessages(t)}>▼ ${t} ▼</div>`:""}
${a?el`
2021-11-11 22:06:49 +01:00
<converse-chat-toolbar
class="chat-toolbar no-text-select"
.model=${e.model}
?composing_spoiler="${e.model.get("composing_spoiler")}"
?hidden_occupants="${e.model.get("hidden_occupants")}"
?is_groupchat="${e.is_groupchat}"
?show_call_button="${s}"
?show_emoji_button="${i}"
?show_send_button="${r}"
?show_spoiler_button="${o}"
?show_toolbar="${a}"
message_limit="${n}"></converse-chat-toolbar>`:""}
2022-01-03 11:54:10 +01:00
<converse-muc-message-form jid=${e.model.get("jid")}></converse-muc-message-form>`})(e):el`<span class="muc-bottom-panel muc-bottom-panel--muted">${s}</span>`}`:n!=$l.ROOMSTATUS.NICKNAME_REQUIRED?"":jl.settings.get("muc_show_logs_before_join")?el`<span class="muc-bottom-panel muc-bottom-panel--nickname">${N_(e.model)}</span>`:void 0})({can_edit:t,entered:e,model:this.model,is_groupchat:!0,viewUnreadMessages:e=>this.viewUnreadMessages(e)}),this)}renderIfOwnOccupant(e){e.get("jid")===wa.bare_jid&&this.debouncedRender()}sendButtonClicked(e){var t;null===(t=this.querySelector("converse-muc-message-form"))||void 0===t||t.onFormSubmitted(e)}hideOccupants(e){var t,n;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),null==e||null===(n=e.stopPropagation)||void 0===n||n.call(e),this.model.save({hidden_occupants:!0})}});const I_={offline:"Offline",unavailable:"Unavailable",xa:"Extended Away",away:"Away",dnd:"Do not disturb",chat:"Chattty",online:"Online"},M_=(e,t)=>{var n,s;const i=e.get("affiliation"),r=I_[e.get("show")],o=Eh("Admin"),a=Eh("Member"),c=Eh("Moderator"),l=Eh("Owner"),d=Eh("Visitor"),u=e.get("role"),h=e.get("show");let f,m;return[f,m]="online"===h?["fa fa-circle","chat-status-online"]:"dnd"===h?["fa fa-minus-circle","chat-status-busy"]:"away"===h?["fa fa-circle","chat-status-away"]:["fa fa-circle","subdued-color"],el`
<li class="occupant" id="${e.id}" title="${(e=>{const t=e.get("role"),n=(e=>Eh("Click to mention %1$s in your message.",e.get("nick")))(e),s=Eh("This user is a moderator."),i=Eh("This user can send messages in this groupchat."),r=Eh("This user can NOT send messages in this groupchat."),o=e.get("jid")?`${e.get("jid")} `:"";return"moderator"===t?`${o}${s} ${n}`:"participant"===t?`${o}${i} ${n}`:"visitor"===t?`${o}${r} ${n}`:["visitor","participant","moderator"].includes(t)?void 0:`${o}${n}`})(e)}">
2021-11-11 22:06:49 +01:00
<div class="row no-gutters">
<div class="col-auto">
2022-01-03 11:54:10 +01:00
<a class="show-msg-author-modal" @click=${t=>function(e,t){jl.modal.show(qv,{model:t},e)}(t,e)}>
<converse-avatar
class="avatar chat-msg__avatar"
.data=${null===(n=e.vcard)||void 0===n?void 0:n.attributes}
nonce=${null===(s=e.vcard)||void 0===s?void 0:s.get("vcard_updated")}
height="30" width="30"></converse-avatar>
<converse-icon
title="${r}"
color="var(--${m})"
style="margin-top: -0.1em"
size="0.82em"
class="${f} chat-status chat-status--avatar"></converse-icon>
</a>
2021-11-11 22:06:49 +01:00
</div>
<div class="col occupant-nick-badge">
2022-01-03 11:54:10 +01:00
<span class="occupant-nick" @click=${t.onOccupantClicked}>${e.getDisplayName()}</span>
2021-11-11 22:06:49 +01:00
<span class="occupant-badges">
2022-01-03 11:54:10 +01:00
${"owner"===i?el`<span class="badge badge-groupchat">${l}</span>`:""}
${"admin"===i?el`<span class="badge badge-info">${o}</span>`:""}
${"member"===i?el`<span class="badge badge-info">${a}</span>`:""}
${"moderator"===u?el`<span class="badge badge-info">${c}</span>`:""}
${"visitor"===u?el`<span class="badge badge-secondary">${d}</span>`:""}
2021-11-11 22:06:49 +01:00
</span>
</div>
</div>
</li>
2022-01-03 11:54:10 +01:00
`};var R_=n(9959),D_={};D_.styleTagTransform=vg(),D_.setAttributes=fg(),D_.insert=ug().bind(null,"head"),D_.domAPI=lg(),D_.insertStyleElement=gg(),ag()(R_.Z,D_),R_.Z&&R_.Z.locals&&R_.Z.locals;var L_=n(902),z_={};z_.styleTagTransform=vg(),z_.setAttributes=fg(),z_.insert=ug().bind(null,"head"),z_.domAPI=lg(),z_.insertStyleElement=gg(),ag()(L_.Z,z_),L_.Z&&L_.Z.locals&&L_.Z.locals;const{u:P_}=$l.env;jl.elements.define("converse-muc-sidebar",class extends ig{static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=wa.chatboxes.get(this.jid),this.listenTo(this.model.occupants,"add",this.requestUpdate),this.listenTo(this.model.occupants,"remove",this.requestUpdate),this.listenTo(this.model.occupants,"change",this.requestUpdate),this.listenTo(this.model.occupants,"vcard:change",this.requestUpdate),this.listenTo(this.model.occupants,"vcard:add",this.requestUpdate),this.model.initialized.then((()=>this.requestUpdate()))}render(){return(e=>{const t=Eh("Participants");return el`
2021-11-11 22:06:49 +01:00
<div class="occupants-header">
2022-01-03 11:54:10 +01:00
<i class="hide-occupants" @click=${e.closeSidebar}>
<converse-icon color="var(--text-color)" class="fa fa-times" size="1em"></converse-icon>
</i>
2021-11-11 22:06:49 +01:00
<div class="occupants-header--title">
2022-01-03 11:54:10 +01:00
<span class="occupants-heading">${t}</span>
2021-11-11 22:06:49 +01:00
</div>
</div>
<div class="dragresize dragresize-occupants-left"></div>
2022-01-03 11:54:10 +01:00
<ul class="occupant-list">${e.occupants.map((t=>M_(t,e)))}</ul>
`})(Object.assign(this.model.toJSON(),{occupants:[...this.model.occupants.models],closeSidebar:e=>this.closeSidebar(e),onOccupantClicked:e=>this.onOccupantClicked(e)}))}closeSidebar(e){var t,n;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),null==e||null===(n=e.stopPropagation)||void 0===n||n.call(e),P_.safeSave(this.model,{hidden_occupants:!0})}onOccupantClicked(e){var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e);const n=wa.chatboxviews.get(this.getAttribute("jid"));null==n||n.getMessageForm().insertIntoTextArea(`@${e.target.textContent}`)}});const{u:F_}=$l.env;jl.elements.define("converse-muc-chatarea",class extends ig{static get properties(){return{jid:{type:String},show_help_messages:{type:Boolean},type:{type:String}}}async initialize(){this.model=await jl.rooms.get(this.jid),this.listenTo(this.model,"change:show_help_messages",(()=>this.requestUpdate())),this.listenTo(this.model,"change:hidden_occupants",(()=>this.requestUpdate())),this.listenTo(this.model.session,"change:connection_status",(()=>this.requestUpdate())),this.onMouseMove=this._onMouseMove.bind(this),this.onMouseUp=this._onMouseUp.bind(this),this.requestUpdate()}render(){return(e=>{var t;return el`
2021-11-11 22:06:49 +01:00
<div class="chat-area">
<div class="chat-content ${e.show_send_button?"chat-content-sendbutton":""}" aria-live="polite">
<converse-chat-content
class="chat-content__messages"
jid="${e.jid}"></converse-chat-content>
2022-01-03 11:54:10 +01:00
${null!==(t=e.model)&&void 0!==t&&t.get("show_help_messages")?el`<div class="chat-content__help">
2021-11-11 22:06:49 +01:00
<converse-chat-help
.model=${e.model}
.messages=${e.getHelpMessages()}
type="info"
2022-01-03 11:54:10 +01:00
chat_type="${wa.CHATROOMS_TYPE}"
2021-11-11 22:06:49 +01:00
></converse-chat-help></div>`:""}
</div>
<converse-muc-bottom-panel jid="${e.jid}" class="bottom-panel"></converse-muc-bottom-panel>
</div>
<div class="disconnect-container hidden"></div>
2022-01-03 11:54:10 +01:00
${e.model?el`
2021-11-11 22:06:49 +01:00
<converse-muc-sidebar
class="occupants col-md-3 col-4 ${e.shouldShowSidebar()?"":"hidden"}"
style="flex: 0 0 ${e.model.get("occupants_width")}px"
jid=${e.jid}
@mousedown=${e.onMousedown}></converse-muc-sidebar>`:""}
2022-01-03 11:54:10 +01:00
`})({getHelpMessages:()=>this.getHelpMessages(),jid:this.jid,model:this.model,onMousedown:e=>this.onMousedown(e),show_send_button:jl.settings.get("show_send_button"),shouldShowSidebar:()=>this.shouldShowSidebar(),type:this.type})}shouldShowSidebar(){return!this.model.get("hidden_occupants")&&this.model.session.get("connection_status")===$l.ROOMSTATUS.ENTERED}getHelpMessages(){const e=jl.settings.get("muc_disable_slash_commands"),t=Array.isArray(e)?e:[];return[`<strong>/admin</strong>: ${Eh("Change user's affiliation to admin")}`,`<strong>/ban</strong>: ${Eh("Ban user by changing their affiliation to outcast")}`,`<strong>/clear</strong>: ${Eh("Clear the chat area")}`,`<strong>/close</strong>: ${Eh("Close this groupchat")}`,`<strong>/deop</strong>: ${Eh("Change user role to participant")}`,`<strong>/destroy</strong>: ${Eh("Remove this groupchat")}`,`<strong>/help</strong>: ${Eh("Show this menu")}`,`<strong>/kick</strong>: ${Eh("Kick user from groupchat")}`,`<strong>/me</strong>: ${Eh("Write in 3rd person")}`,`<strong>/member</strong>: ${Eh("Grant membership to a user")}`,`<strong>/modtools</strong>: ${Eh("Opens up the moderator tools GUI")}`,`<strong>/mute</strong>: ${Eh("Remove user's ability to post messages")}`,`<strong>/nick</strong>: ${Eh("Change your nickname")}`,`<strong>/op</strong>: ${Eh("Grant moderator role to user")}`,`<strong>/owner</strong>: ${Eh("Grant ownership of this groupchat")}`,`<strong>/register</strong>: ${Eh("Register your nickname")}`,`<strong>/revoke</strong>: ${Eh("Revoke the user's current affiliation")}`,`<strong>/subject</strong>: ${Eh("Set groupchat subject")}`,`<strong>/topic</strong>: ${Eh("Set groupchat subject (alias for /subject)")}`,`<strong>/voice</strong>: ${Eh("Allow muted user to post messages")}`].filter((e=>t.every((t=>!e.startsWith(t+"<",9))))).filter((e=>this.model.getAllowedCommands().some((t=>e.startsWith(t+"<",9)))))}onMousedown(e){F_.hasClass("dragresize-occupants-left",e.target)&&this.onStartResizeOccupants(e)}onStartResizeOccupants(e){this.resizing=!0,this.addEventListener("mousemove",this.onMouseMove),this.addEventListener("mouseup",this.onMouseUp);const t=this.querySelector("converse-muc-sidebar"),n=window.getComputedStyle(t);this.width=parseInt(n.width.replace(/px$/,""),10),this.prev_pageX=e.pageX}_onMouseMove(e){if(this.resizing){e.preventDefault();const t=this.prev_pageX-e.pageX;this.resizeSidebarView(t,e.pageX),this.prev_pageX=e.pageX}}_onMouseUp(e){if(this.resizing){e.preventDefault(),this.resizing=!1,this.removeEventListener("mousemove",this.onMouseMove),this.removeEventListener("mouseup",this.onMouseUp);const t=this.querySelector("converse-muc-sidebar").getBoundingClientRect(),n=this.calculateSidebarWidth(t,0);F_.safeSave(this.model,{occupants_width:n})}}calculateSidebarWidth(e,t){let n=e.width+t;const s=this.clientWidth;return n<.2*s?(n=.2*s,this.is_minimum=!0):n>.75*s?(n=.75*s,this.is_maximum=!0):s-n<250?(n=s-250,this.is_maximum=!0):(this.is_maximum=!1,this.is_minimum=!1),n}resizeSidebarView(e,t){const n=this.querySelector("converse-muc-sidebar"),s=n.getBoundingClientRect();if(this.is_minimum)this.is_minimum=s.left<t;else if(this.is_maximum)this.is_maximum=s.left>t;else{const t=this.calculateSidebarWidth(s,e);n.style.flex="0 0 "+t+"px"}}});const{sizzle:U_}=$l.env,B_=$l.env.utils,{sizzle:q_}=$l.env,H_=$l.env.utils;jl.elements.define("converse-muc-config-form",class extends ig{static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=wa.chatboxes.get(this.jid),this.listenTo(this.model.features,"change:passwordprotected",this.requestUpdate),this.listenTo(this.model.session,"change:config_stanza",this.requestUpdate),this.getConfig()}render(){return(e=>{const t=jl.settings.get("roomconfig_whitelist"),n=e.model.session.get("config_stanza");let s,i=[],r="";if(n){var o,a;const c=B_.toStanza(n);i=U_("field",c),t.length&&(i=i.filter((e=>t.includes(e.getAttribute("var")))));const l={new_password:!e.model.features.get("passwordprotected"),fixed_username:e.model.get("jid")};i=i.map((e=>B_.xForm2TemplateResult(e,c,l))),r=null=
2021-11-11 22:06:49 +01:00
<form class="converse-form chatroom-form ${i.length?"":"converse-form--spinner"}"
autocomplete="off"
@submit=${e.submitConfigForm}>
2021-03-19 19:26:15 +01:00
<fieldset class="form-group">
2021-11-11 22:06:49 +01:00
<legend class="centered">${s}</legend>
2022-01-03 11:54:10 +01:00
${s!==r?el`<p class="form-help">${r}</p>`:""}
${i.length?i:ny({classes:"hor_centered"})}
2021-03-19 19:26:15 +01:00
</fieldset>
2022-01-03 11:54:10 +01:00
${i.length?el`
2021-11-11 22:06:49 +01:00
<fieldset>
<input type="submit" class="btn btn-primary" value="${c}">
<input type="button" class="btn btn-secondary button-cancel" value="${l}" @click=${e.closeConfigForm}>
</fieldset>`:""}
</form>
2022-01-03 11:54:10 +01:00
`})({model:this.model,closeConfigForm:e=>this.closeForm(e),submitConfigForm:e=>this.submitConfigForm(e)})}async getConfig(){const e=await this.model.fetchRoomConfiguration();this.model.session.set("config_stanza",e.outerHTML)}async submitConfigForm(e){e.preventDefault();const t=q_(":input:not([type=button]):not([type=submit])",e.target).map(H_.webForm2xForm).filter((e=>e));try{await this.model.sendConfiguration(t)}catch(e){M.error(e);const t=Eh("Sorry, an error occurred while trying to submit the config form.")+" "+Eh("Check your browser's developer console for details.");jl.alert("error",Eh("Error"),t)}await this.model.refreshDiscoInfo(),this.closeForm()}closeForm(e){var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),this.model.session.set("view",null)}});jl.elements.define("converse-muc-destroyed",class extends ig{static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=wa.chatboxes.get(this.jid)}render(){const e=this.model.get("destroyed_reason");return(e=>{const t=Eh("This groupchat no longer exists"),n=Eh('The following reason was given: "%1$s"',e.reason||"");return el`
2021-11-11 22:06:49 +01:00
<div class="alert alert-danger">
<h3 class="alert-heading disconnect-msg">${t}</h3>
</div>
2022-01-03 11:54:10 +01:00
${e.reason?el`<p class="destroyed-reason">${n}</p>`:""}
${e.moved_jid?(e=>{const t=Eh("The conversation has moved to a new address. Click the link below to enter.");return el`
2021-11-11 22:06:49 +01:00
<p class="moved-label">${t}</p>
<p class="moved-link">
<a class="switch-chat" @click=${t=>e.onSwitch(t)}>${e.moved_jid}</a>
</p>`})(e):""}
2022-01-03 11:54:10 +01:00
`})({moved_jid:this.model.get("moved_jid"),reason:e,onSwitch:e=>this.onSwitch(e)})}async onSwitch(e){e.preventDefault();const t=this.model.get("moved_jid");(await jl.rooms.get(t,{},!0)).maybeShow(!0),this.model.destroy()}}),jl.elements.define("converse-muc-disconnected",class extends ig{static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=wa.chatboxes.get(this.jid)}render(){const e=this.model.session.get("disconnection_message");if(!e)return;const t=[e],n=this.model.session.get("disconnection_actor");n&&t.push(Eh("This action was done by %1$s.",n));const s=this.model.session.get("disconnection_reason");return s&&t.push(Eh('The reason given is: "%1$s".',s)),(e=>el`
2021-11-11 22:06:49 +01:00
<div class="alert alert-danger">
<h3 class="alert-heading disconnect-msg">${e[0]}</h3>
2022-01-03 11:54:10 +01:00
${e.slice(1).map((e=>el`<p class="disconnect-msg">${e}</p>`))}
</div>`)(t)}});const G_=$l.env.utils,W_=ap.extend({id:"muc-invite-modal",initialize(){ap.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change",this.render),this.initInviteWidget()},toHTML(){return(e=>{const t=Eh("Invite"),n=Eh("Invite someone to this groupchat"),s=Eh("user@example.org"),i=Eh("Please enter a valid XMPP address"),r=Eh("XMPP Address"),o=Eh("Optional reason for the invitation");return el`
2021-11-11 22:06:49 +01:00
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="add-chatroom-modal-label">${n}</h5>
2022-01-03 11:54:10 +01:00
${lp}
2021-11-11 22:06:49 +01:00
</div>
<div class="modal-body">
<span class="modal-alert"></span>
<div class="suggestion-box room-invite">
<form @submit=${e.submitInviteForm}>
<div class="form-group">
<label class="clearfix" for="invitee_jids">${r}:</label>
2022-01-03 11:54:10 +01:00
${e.invalid_invite_jid?el`<div class="error error-feedback">${i}</div>`:""}
2021-11-11 22:06:49 +01:00
<input class="form-control suggestion-box__input"
required="required"
name="invitee_jids"
id="invitee_jids"
placeholder="${s}"
type="text"/>
<span class="suggestion-box__additions visually-hidden" role="status" aria-live="assertive" aria-relevant="additions"></span>
<ul class="suggestion-box__results suggestion-box__results--below" hidden=""></ul>
</div>
<div class="form-group">
<label>${o}:</label>
<textarea class="form-control" name="reason"></textarea>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary">${t}</button>
</div>
</form>
</div>
</div>
</div>
</div>
2022-01-03 11:54:10 +01:00
`})(Object.assign(this.model.toJSON(),{submitInviteForm:e=>this.submitInviteForm(e)}))},initInviteWidget(){this.invite_auto_complete&&this.invite_auto_complete.destroy();const e=wa.roster.map((e=>({label:e.getDisplayName(),value:e.get("jid")}))),t=this.el.querySelector(".suggestion-box").parentElement;this.invite_auto_complete=new wa.AutoComplete(t,{min_chars:1,list:e})},submitInviteForm(e){e.preventDefault();const t=new FormData(e.target),n=t.get("invitee_jids"),s=t.get("reason");G_.isValidJID(n)?(this.chatroomview.model.directInvite(n,s),this.modal.hide()):this.model.set({invalid_invite_jid:!0})}}),V_=ap.extend({id:"muc-details-modal",initialize(){ap.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change",this.render),this.listenTo(this.model.features,"change",this.render),this.listenTo(this.model.occupants,"add",this.render),this.listenTo(this.model.occupants,"change",this.render)},toHTML(){return(e=>{const t=Eh("Groupchat XMPP address"),n=Eh("Message archiving"),s=Eh("Messages are archived on the server"),i=Eh("Description"),r=Eh("Features"),o=Eh("Hidden"),a=Eh("This groupchat is not publicly searchable"),c=Eh("This groupchat is restricted to members only"),l=Eh("Members only"),d=Eh("Moderated"),u=Eh("Participants entering this groupchat need to request permission to write"),h=Eh("Name"),f=Eh("This groupchat does not require a password upon entry"),m=Eh("No password required"),g=Eh("Not anonymous"),p=Eh("All other groupchat participants can see your XMPP address"),v=Eh("Not moderated"),y=Eh("Participants entering this groupchat can write right away"),b=Eh("Online users"),_=Eh("Open"),w=Eh("Anyone can join this groupchat"),S=Eh("This groupchat requires a password before entry"),x=Eh("Password protected"),E=Eh("Persistent"),A=Eh("This groupchat persists even if it's unoccupied"),C=Eh("Public"),T=Eh("Semi-anonymous"),k=Eh("Only moderators can see your XMPP address"),j=Eh("Temporary"),N=Eh("This groupchat will disappear once the last person leaves");return el`
2021-11-11 22:06:49 +01:00
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="muc-details-modal-label">${e.display_name}</h5>
2022-01-03 11:54:10 +01:00
${lp}
2021-11-11 22:06:49 +01:00
</div>
<div class="modal-body">
<span class="modal-alert"></span>
<div class="room-info">
<p class="room-info"><strong>${h}</strong>: ${e.name}</p>
<p class="room-info"><strong>${t}</strong>: ${e.jid}</p>
<p class="room-info"><strong>${i}</strong>: ${e.config.description}</p>
2022-01-03 11:54:10 +01:00
${e.subject?(e=>{const t=Eh("Topic"),n=Eh("Topic author");return el`
2021-11-11 22:06:49 +01:00
<p class="room-info"><strong>${t}</strong>: ${e.subject.text}</p>
<p class="room-info"><strong>${n}</strong>: ${e.subject&&e.subject.author}</p>
`})(e):""}
2022-01-03 11:54:10 +01:00
<p class="room-info"><strong>${b}</strong>: ${e.num_occupants}</p>
2021-11-11 22:06:49 +01:00
<p class="room-info"><strong>${r}</strong>:
<div class="chatroom-features">
<ul class="features-list">
2022-01-03 11:54:10 +01:00
${e.features.passwordprotected?el`<li class="feature" ><span class="fa fa-lock"></span>${x} - <em>${S}</em></li>`:""}
${e.features.unsecured?el`<li class="feature" ><span class="fa fa-unlock"></span>${m} - <em>${f}</em></li>`:""}
${e.features.hidden?el`<li class="feature" ><span class="fa fa-eye-slash"></span>${o} - <em>${a}</em></li>`:""}
${e.features.public_room?el`<li class="feature" ><span class="fa fa-eye"></span>${C} - <em>${e.__("This groupchat is publicly searchable")}</em></li>`:""}
${e.features.membersonly?el`<li class="feature" ><span class="fa fa-address-book"></span>${l} - <em>${c}</em></li>`:""}
${e.features.open?el`<li class="feature" ><span class="fa fa-globe"></span>${_} - <em>${w}</em></li>`:""}
${e.features.persistent?el`<li class="feature" ><span class="fa fa-save"></span>${E} - <em>${A}</em></li>`:""}
${e.features.temporary?el`<li class="feature" ><span class="fa fa-snowflake-o"></span>${j} - <em>${N}</em></li>`:""}
${e.features.nonanonymous?el`<li class="feature" ><span class="fa fa-id-card"></span>${g} - <em>${p}</em></li>`:""}
${e.features.semianonymous?el`<li class="feature" ><span class="fa fa-user-secret"></span>${T} - <em>${k}</em></li>`:""}
${e.features.moderated?el`<li class="feature" ><span class="fa fa-gavel"></span>${d} - <em>${u}</em></li>`:""}
${e.features.unmoderated?el`<li class="feature" ><span class="fa fa-info-circle"></span>${v} - <em>${y}</em></li>`:""}
${e.features.mam_enabled?el`<li class="feature" ><span class="fa fa-database"></span>${n} - <em>${s}</em></li>`:""}
2021-11-11 22:06:49 +01:00
</ul>
</div>
</p>
</div>
</div>
2022-01-03 11:54:10 +01:00
<div class="modal-footer">${cp}</div>
2021-11-11 22:06:49 +01:00
</div>
</div>
2022-01-03 11:54:10 +01:00
`})(Object.assign(this.model.toJSON(),{config:this.model.config.toJSON(),display_name:Eh("Groupchat info for %1$s",this.model.getDisplayName()),features:this.model.features.toJSON(),num_occupants:this.model.occupants.length}))}});var J_=n(307),Q_={};Q_.styleTagTransform=vg(),Q_.setAttributes=fg(),Q_.insert=ug().bind(null,"head"),Q_.domAPI=lg(),Q_.insertStyleElement=gg(),ag()(J_.Z,Q_),J_.Z&&J_.Z.locals&&J_.Z.locals,jl.elements.define("converse-rich-text",class extends ig{static get properties(){return{embed_audio:{type:Boolean},embed_videos:{type:Boolean},mentions:{type:Array},nick:{type:String},offset:{type:Number},onImgClick:{type:Function},onImgLoad:{type:Function},render_styling:{type:Boolean},show_images:{type:Boolean},hide_media_urls:{type:Boolean},show_me_message:{type:Boolean},text:{type:String}}}constructor(){super(),this.embed_audio=!1,this.embed_videos=!1,this.hide_media_urls=!1,this.mentions=[],this.offset=0,this.render_styling=!1,this.show_image_urls=!0,this.show_images=!1,this.show_me_message=!1}render(){const e={embed_audio:this.embed_audio,embed_videos:this.embed_videos,hide_media_urls:this.hide_media_urls,mentions:this.mentions,nick:this.nick,onImgClick:this.onImgClick,onImgLoad:this.onImgLoad,render_styling:this.render_styling,show_images:this.show_images,show_me_message:this.show_me_message};return _v(this.text,this.offset,e)}});var Z_=n(3288),K_={};K_.styleTagTransform=vg(),K_.setAttributes=fg(),K_.insert=ug().bind(null,"head"),K_.domAPI=lg(),K_.insertStyleElement=gg(),ag()(Z_.Z,K_),Z_.Z&&Z_.Z.locals&&Z_.Z.locals,jl.elements.define("converse-muc-heading",class extends Ng{async connectedCallback(){super.connectedCallback(),this.model=wa.chatboxes.get(this.getAttribute("jid")),this.debouncedRender=gc(this.render,100),this.listenTo(this.model,"change",this.debouncedRender);const e=await wa.api.user.settings.getModel();this.listenTo(e,"change:mucs_with_hidden_subject",this.debouncedRender),await this.model.initialized,this.listenTo(this.model.features,"change:open",this.debouncedRender),this.model.occupants.forEach((e=>this.onOccupantAdded(e))),this.listenTo(this.model.occupants,"add",this.onOccupantAdded),this.listenTo(this.model.occupants,"change:affiliation",this.onOccupantAffiliationChanged),this.render()}async render(){const e=await this.generateHeadingTemplate();il(e,this)}onOccupantAdded(e){e.get("jid")===wa.bare_jid&&this.debouncedRender()}onOccupantAffiliationChanged(e){e.get("jid")===wa.bare_jid&&this.debouncedRender()}showRoomDetailsModal(e){e.preventDefault(),jl.modal.show(V_,{model:this.model},e)}showInviteModal(e){e.preventDefault(),jl.modal.show(W_,{model:new Xo,chatroomview:this},e)}toggleTopic(e){var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),this.model.toggleSubjectHiddenState()}getAndRenderConfigurationForm(){this.model.session.set("view",$l.MUC.VIEWS.CONFIG)}close(e){e.preventDefault(),this.model.close()}destroy(e){e.preventDefault(),v_(this.model)}getHeadingButtons(e){const t=[];t.push({i18n_text:Eh("Details"),i18n_title:Eh("Show more information about this groupchat"),handler:e=>this.showRoomDetailsModal(e),a_class:"show-muc-details-modal",icon_class:"fa-info-circle",name:"details"}),"owner"===this.model.getOwnAffiliation()&&t.push({i18n_text:Eh("Configure"),i18n_title:Eh("Configure this groupchat"),handler:()=>this.getAndRenderConfigurationForm(),a_class:"configure-chatroom-button",icon_class:"fa-wrench",name:"configure"}),this.model.invitesAllowed()&&t.push({i18n_text:Eh("Invite"),i18n_title:Eh("Invite someone to join this groupchat"),handler:e=>this.showInviteModal(e),a_class:"open-invite-modal",icon_class:"fa-user-plus",name:"invite"});const n=this.model.get("subject");if(n&&n.text&&t.push({i18n_text:Eh(e?"Show topic":"Hide topic"),i18n_title:Eh(e?"Show the topic message in the heading":"Hide the topic in the heading"),handler:e=>this.toggleTopic(e),a_class:"hide-topic",icon_class:"fa-minus-square",name:"toggle-topic"}),this.model.session.get("connection_status")===$l.ROOMSTATUS.ENTERED){const e=this.model.getAllowedCommands();e.includes("modtools")&&t.push
2021-11-11 22:06:49 +01:00
<div class="chatbox-title ${i?"":"chatbox-title--no-desc"}">
2022-01-03 11:54:10 +01:00
${wa.api.settings.get("singleton")?"":el`<converse-controlbox-navback jid="${e.jid}"></converse-controlbox-navback>`}
<div class="chatbox-title__text" title="${"hidden"!==jl.settings.get("locked_muc_domain")?e.jid:""}">${e.title}
${e.bookmarked?el`<i class="fa fa-bookmark chatbox-title__text--bookmarked" title="${n}"></i>`:""}
2021-11-11 22:06:49 +01:00
</div>
<div class="chatbox-title__buttons row no-gutters">
2022-01-03 11:54:10 +01:00
${e.standalone_btns.length?(e=>e.standalone_btns.reverse().map((e=>xp(e,""))))(e):""}
${e.dropdown_btns.length?el`<converse-dropdown class="dropleft" color="var(--chatroom-head-color)" .items=${e.dropdown_btns}></converse-dropdown>`:""}
2021-11-11 22:06:49 +01:00
</div>
</div>
2022-01-03 11:54:10 +01:00
${i?el`<p class="chat-head__desc" title="${t}">
2021-11-11 22:06:49 +01:00
<converse-rich-text text=${s} render_styling></converse-rich-text>
</p>`:""}
2022-01-03 11:54:10 +01:00
`})(Object.assign(this.model.toJSON(),{_converse:wa,subject_hidden:e,dropdown_btns:s.map((e=>Cy(e))),standalone_btns:n.map((e=>Ty(e))),title:this.model.getDisplayName()}))}});var Y_=n(6233),X_={};X_.styleTagTransform=vg(),X_.setAttributes=fg(),X_.insert=ug().bind(null,"head"),X_.domAPI=lg(),X_.insertStyleElement=gg(),ag()(Y_.Z,X_),Y_.Z&&Y_.Z.locals&&Y_.Z.locals;jl.elements.define("converse-muc-nickname-form",class extends ig{static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=wa.chatboxes.get(this.jid)}render(){return N_(this.model)}});function ew(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}jl.elements.define("converse-muc-password-form",class extends ig{static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=wa.chatboxes.get(this.jid),this.listenTo(this.model,"change:password_validation_message",this.render),this.render()}render(){return(e=>{const t=Eh("This groupchat requires a password"),n=Eh("Password: "),s=Eh("Submit");return el`
2021-11-11 22:06:49 +01:00
<form class="converse-form chatroom-form converse-centered-form" @submit=${e.submitPassword}>
2021-03-19 19:26:15 +01:00
<fieldset class="form-group">
2021-11-11 22:06:49 +01:00
<label>${t}</label>
<p class="validation-message">${e.validation_message}</p>
<input class="hidden-username" type="text" autocomplete="username" value="${e.jid}"></input>
<input type="password"
name="password"
required="required"
class="form-control ${e.validation_message?"error":""}"
placeholder="${n}"/>
2021-03-19 19:26:15 +01:00
</fieldset>
<fieldset class="form-group">
2021-11-11 22:06:49 +01:00
<input class="btn btn-primary" type="submit" value="${s}"/>
</fieldset>
2021-03-19 19:26:15 +01:00
</form>
2022-01-03 11:54:10 +01:00
`})({jid:this.model.get("jid"),submitPassword:e=>this.submitPassword(e),validation_message:this.model.get("password_validation_message")})}submitPassword(e){e.preventDefault();const t=this.querySelector("input[type=password]").value;this.model.join(this.model.get("nick"),t),this.model.set("password_validation_message",null)}});class tw extends zy{constructor(...e){super(...e),ew(this,"length",300),ew(this,"is_chatroom",!0)}async initialize(){this.model=await jl.rooms.get(this.jid),wa.chatboxviews.add(this.jid,this),this.setAttribute("id",this.model.get("box_id")),this.listenTo(wa,"windowStateChanged",this.onWindowStateChanged),this.listenTo(this.model,"change:composing_spoiler",this.requestUpdateMessageForm),this.listenTo(this.model.session,"change:connection_status",this.onConnectionStatusChanged),this.listenTo(this.model.session,"change:view",this.requestUpdate),this.onConnectionStatusChanged(),this.model.maybeShow(),jl.trigger("chatRoomViewInitialized",this)}render(){return(e=>el`
2021-11-11 22:06:49 +01:00
<div class="flyout box-flyout">
<converse-dragresize></converse-dragresize>
2022-01-03 11:54:10 +01:00
${e.model?el`
2021-11-11 22:06:49 +01:00
<converse-muc-heading jid="${e.model.get("jid")}" class="chat-head chat-head-chatroom row no-gutters">
</converse-muc-heading>
2022-01-03 11:54:10 +01:00
<div class="chat-body chatroom-body row no-gutters">${function(e){const t=e.model.session.get("view"),n=e.model.get("jid"),s=$l.ROOMSTATUS,i=e.model.session.get("connection_status");return t===$l.MUC.VIEWS.CONFIG?el`<converse-muc-config-form class="muc-form-container" jid="${n}"></converse-muc-config-form>`:t===$l.MUC.VIEWS.BOOKMARK?el`<converse-muc-bookmark-form class="muc-form-container" jid="${n}"></converse-muc-bookmark-form>`:el`
${i==s.PASSWORD_REQUIRED?el`<converse-muc-password-form class="muc-form-container" jid="${n}"></converse-muc-password-form>`:""}
${i==s.ENTERED?el`<converse-muc-chatarea jid="${n}"></converse-muc-chatarea>`:""}
${i==s.CONNECTING?ny():""}
${i==s.NICKNAME_REQUIRED?function(e){const t=e.get("jid");return jl.settings.get("muc_show_logs_before_join")?el`<converse-muc-chatarea jid="${t}"></converse-muc-chatarea>`:el`<converse-muc-nickname-form jid="${t}"></converse-muc-nickname-form>`}(e.model):""}
${i==s.DISCONNECTED?el`<converse-muc-disconnected jid="${n}"></converse-muc-disconnected>`:""}
${i==s.BANNED?el`<converse-muc-disconnected jid="${n}"></converse-muc-disconnected>`:""}
${i==s.DESTROYED?el`<converse-muc-destroyed jid="${n}"></converse-muc-destroyed>`:""}
2021-11-11 22:06:49 +01:00
`}(e)}</div>
`:""}
2022-01-03 11:54:10 +01:00
</div>`)({model:this.model})}onConnectionStatusChanged(){this.model.session.get("connection_status")===$l.ROOMSTATUS.CONNECTING&&(this.model.session.save({disconnection_actor:void 0,disconnection_message:void 0,disconnection_reason:void 0}),this.model.save({moved_jid:void 0,password_validation_message:void 0,reason:void 0})),this.requestUpdate()}}jl.elements.define("converse-muc",tw);var nw=n(3076),sw={};sw.styleTagTransform=vg(),sw.setAttributes=fg(),sw.insert=ug().bind(null,"head"),sw.domAPI=lg(),sw.insertStyleElement=gg(),ag()(nw.Z,sw),nw.Z&&nw.Z.locals&&nw.Z.locals,$l.MUC.VIEWS={CONFIG:"config-form",BOOKMARK:"bookmark-form"},$l.plugins.add("converse-muc-views",{dependencies:["converse-modal","converse-controlbox","converse-chatview"],initialize(){const{_converse:e}=this;jl.settings.extend({auto_list_rooms:!1,cache_muc_messages:!0,locked_muc_nickname:!1,modtools_disable_query:[],muc_disable_slash_commands:!1,muc_mention_autocomplete_filter:"contains",muc_mention_autocomplete_min_chars:0,muc_mention_autocomplete_show_avatar:!0,muc_roomid_policy:null,muc_roomid_policy_hint:null,roomconfig_whitelist:[],show_retraction_warning:!0,visible_toolbar_buttons:{toggle_occupants:!0}}),e.ChatRoomView=tw,jl.listen.on("clearsession",(()=>{const t=e.chatboxviews.get("controlbox");t&&t.roomspanel&&(t.roomspanel.model.destroy(),t.roomspanel.remove(),delete t.roomspanel)})),jl.listen.on("controlBoxInitialized",(e=>{jl.settings.get("allow_muc")&&(b_(e),e.model.on("change:connected",(()=>b_(e))))})),jl.listen.on("chatBoxClosed",(t=>{var n;t.get("type")===e.CHATROOMS_TYPE&&(n=t.get("jid"),wa.router.history.getFragment()===`converse/room?jid=${n}`&&wa.router.navigate(""))}))}});var iw=n(5402),rw=n.n(iw);const{Strophe:ow}=$l.env,aw="Notification"in window;let cw;function lw(e){var t;return wa.isTestEnv()||((null===(t=wa.chatboxes.get(e.from))||void 0===t?void 0:t.isHidden())??!1)}function dw(){return wa.isTestEnv()||aw&&jl.settings.get("show_desktop_notifications")&&"granted"===Notification.permission}function uw(){var e,t;cw=null,null===(e=(t=navigator).clearAppBadge)||void 0===e||e.call(t).catch((e=>M.error("Could not clear unread count in app badge "+e)))}function hw(){if(jl.settings.get("show_tab_notifications")){var e,t;cw=cw??new $l.env.Favico({type:"circle",animation:"pop"});const n=wa.chatboxes.models.reduce(((e,t)=>e+(t.get("num_unread")||0)),0);cw.badge(n),null===(e=(t=navigator).setAppBadge)||void 0===e||e.call(t,n).catch((e=>M.error("Could set unread count in app badge - "+e)))}}function fw(e,t,n){return e.reduce(((e,s)=>e||(e=>[wa.bare_jid,`${t}/${n}`].includes(e.uri.replace(/^xmpp:/,"")))(s)),!1)}async function mw(e){if(!await function(e){const{attrs:t}=e;if(!t||t.is_forwarded)return!1;if("groupchat"===t.type)return async function(e){if(!(null!=e&&e.body||null!=e&&e.message))return!1;const t=e.from,n=e.from_muc,s=jl.settings.get("notify_all_room_messages"),i=wa.chatboxes.get(n),r=ow.getResourceFromJid(t),o=r&&ow.unescapeNode(r)||"";let a=!1;const c=i.get("nick");jl.settings.get("notify_nicknames_without_references")&&(a=new RegExp(`\\b${c}\\b`).test(e.body));const l=o!==c,d=!0===s||Array.isArray(s)&&s.includes(n)||fw(e.references,n,c)||a;return!(!l||!d)&&await jl.hook("shouldNotifyOfGroupMessage",e,!0)}(t);if("info"===t.type)return async function(e){if(!e.from_muc)return!1;const t=await jl.rooms.get(e.from_muc);if(!t)return!1;const n=t.get("nick"),s=e.from_muc,i=jl.settings.get("notify_all_room_messages");return!0===i||Array.isArray(i)&&i.includes(s)||fw(e.references,s,n)}(t);if(t.is_headline)return lw(t);const n=ow.getBareJidFromJid(t.from)===wa.bare_jid;return!na(t)&&!n&&("all"===jl.settings.get("show_desktop_notifications")||lw(t))}(e))return!1;jl.trigger("messageNotification",e),function(){if(jl.settings.get("play_sounds")&&void 0!==window.Audio){const e=new Audio(jl.settings.get("sounds_path")+"msg_received.ogg"),t=e.canPlayType("audio/ogg");if("probably"===t)return e.play();const n=new Audio(jl.settings.get("sounds_path")+"msg_received.mp3"),s=n.canPlayType("audio/mp3");"probably"===s?n.play():"maybe"===t?e.play(
<button class="toggle-omemo" title="${i}" data-disabled=${!n.get("omemo_supported")} @click=${Kw}>
<converse-icon
class="fa ${n.get("omemo_active")?"fa-lock":"fa-unlock"}"
path-prefix="${jl.settings.get("assets_path")}"
size="1em"
color="${r}"
></converse-icon>
</button>
`),t}const Xw={decryptMessage:async function(e){const t=await crypto.subtle.importKey("raw",e.key,_w,!0,["encrypt","decrypt"]),n=Sw(Tw(e.payload),e.tag),s={name:"AES-GCM",iv:Tw(e.iv),tagLength:128};return Ew(await crypto.subtle.decrypt(s,t,n))},encryptMessage:async function(e){const t=crypto.getRandomValues(new window.Uint8Array(12)),n=await crypto.subtle.generateKey(_w,!0,["encrypt","decrypt"]),s={name:"AES-GCM",iv:t,tagLength:128},i=await crypto.subtle.encrypt(s,n,Aw(e)),r=i.byteLength-16,o=i.slice(0,r),a=i.slice(r),c=await crypto.subtle.exportKey("raw",n);return{key:c,tag:a,key_and_tag:Sw(c,a),payload:Cw(o),iv:Cw(t)}},formatFingerprint:Mw};jl.elements.define("converse-omemo-fingerprints",class extends ig{static get properties(){return{jid:{type:String}}}async initialize(){this.devicelist=await wa.devicelists.getDeviceList(this.jid),this.listenTo(this.devicelist.devices,"change:bundle",this.requestUpdate),this.listenTo(this.devicelist.devices,"change:trusted",this.requestUpdate),this.listenTo(this.devicelist.devices,"remove",this.requestUpdate),this.listenTo(this.devicelist.devices,"add",this.requestUpdate),this.listenTo(this.devicelist.devices,"reset",this.requestUpdate),this.requestUpdate()}render(){return this.devicelist?(e=>{const t=Eh("OMEMO Fingerprints"),n=Eh("No OMEMO-enabled devices found"),s=e.devicelist.devices;return el`
<hr/>
<ul class="list-group fingerprints">
<li class="list-group-item active">${t}</li>
${s.length?s.map((t=>((e,t)=>{const n=Eh("Trusted"),s=Eh("Untrusted");return t.get("bundle")&&t.get("bundle").fingerprint?el`
<li class="list-group-item">
<form class="fingerprint-trust">
<div class="btn-group btn-group-toggle">
<label class="btn btn--small ${1===t.get("trusted")?"btn-primary active":"btn-secondary"}"
@click=${e.toggleDeviceTrust}>
<input type="radio" name="${t.get("id")}" value="1"
?checked=${-1!==t.get("trusted")}>${n}
</label>
<label class="btn btn--small ${-1===t.get("trusted")?"btn-primary active":"btn-secondary"}"
@click=${e.toggleDeviceTrust}>
<input type="radio" name="${t.get("id")}" value="-1"
?checked=${-1===t.get("trusted")}>${s}
</label>
</div>
<code class="fingerprint">${Mw(t.get("bundle").fingerprint)}</code>
</form>
</li>
`:""})(e,t))):el`<li class="list-group-item"> ${n} </li>`}
</ul>
`})(this):""}toggleDeviceTrust(e){const t=e.target;this.devicelist.devices.get(t.getAttribute("name")).save("trusted",parseInt(t.value,10))}});const eS=e=>{var t;const n=Eh("This device's OMEMO fingerprint"),s=Eh("Generate new keys and fingerprint");return el`
<form class="converse-form fingerprint-removal" @submit=${e.removeSelectedFingerprints}>
<ul class="list-group fingerprints">
<li class="list-group-item active">${n}</li>
<li class="list-group-item">
${e.current_device&&e.current_device.get("bundle")&&e.current_device.get("bundle").fingerprint?(e=>el`
<span class="fingerprint">${Mw(e.current_device.get("bundle").fingerprint)}</span>`)(e):ny()}
</li>
</ul>
<div class="form-group">
<button type="button" class="generate-bundle btn btn-danger" @click=${e.generateOMEMODeviceBundle}>${s}</button>
</div>
${null!==(t=e.other_devices)&&void 0!==t&&t.length?(e=>{var t;const n=Eh("Other OMEMO-enabled devices"),s=Eh("Checkbox to select fingerprints of all other OMEMO devices"),i=Eh("Remove checked devices and close"),r=Eh("Select all");return el`
<ul class="list-group fingerprints">
<li class="list-group-item nopadding active">
<label>
<input type="checkbox" class="select-all" @change=${e.selectAll} title="${r}" aria-label="${s}"/>
${n}
</label>
</li>
${null===(t=e.other_devices)||void 0===t?void 0:t.map((t=>(e=>el`
${e.device.get("bundle")&&e.device.get("bundle").fingerprint?(e=>{const t=Eh("Checkbox for selecting the following fingerprint");return el`
<li class="fingerprint-removal-item list-group-item nopadding">
<label>
<input type="checkbox" value="${e.device.get("id")}"
aria-label="${t}"/>
<span class="fingerprint">${Mw(e.device.get("bundle").fingerprint)}</span>
</label>
</li>
`})(e):(e=>{const t=Eh("Device without a fingerprint"),n=Eh("Checkbox for selecting the following device");return el`
<li class="fingerprint-removal-item list-group-item nopadding">
<label>
<input type="checkbox" value="${e.device.get("id")}"
aria-label="${n}"/>
<span>${t}</span>
</label>
</li>
`})(e)}
`)(Object.assign({device:t},e))))}
</ul>
<div class="form-group"><button type="submit" class="save-form btn btn-primary">${i}</button></div>
`})(e):""}
</form>`},{Strophe:tS,sizzle:nS,u:sS}=$l.env;jl.elements.define("converse-omemo-profile",class extends ig{async initialize(){this.devicelist=await wa.devicelists.getDeviceList(wa.bare_jid),await this.setAttributes(),this.listenTo(this.devicelist.devices,"change:bundle",(()=>this.requestUpdate())),this.listenTo(this.devicelist.devices,"reset",(()=>this.requestUpdate())),this.listenTo(this.devicelist.devices,"reset",(()=>this.requestUpdate())),this.listenTo(this.devicelist.devices,"remove",(()=>this.requestUpdate())),this.listenTo(this.devicelist.devices,"add",(()=>this.requestUpdate())),this.requestUpdate()}async setAttributes(){this.device_id=await jl.omemo.getDeviceID(),this.current_device=this.devicelist.devices.get(this.device_id),this.other_devices=this.devicelist.devices.filter((e=>e.get("id")!==this.device_id))}render(){return this.devicelist?eS(this):""}selectAll(e){let t=sS.ancestor(e.target,"li");for(;t;)t.querySelector('input[type="checkbox"]').checked=e.target.checked,t=t.nextElementSibling}async removeSelectedFingerprints(e){e.preventDefault(),e.stopPropagation(),e.target.querySelector(".select-all").checked=!1;const t=nS('.fingerprint-removal-item input[type="checkbox"]:checked',e.target).map((e=>e.value));try{await this.devicelist.removeOwnDevices(t)}catch(e){M.error(e),wa.api.alert(tS.LogLevel.ERROR,Eh("Error"),[Eh("Sorry, an error occurred while trying to remove the devices.")])}await this.setAttributes(),this.requestUpdate()}async generateOMEMODeviceBundle(e){e.preventDefault(),confirm(Eh("Are you sure you want to generate new OMEMO keys? This will remove your old keys and all previously encrypted messages will no longer be decryptable on this device."))&&(await jl.omemo.bundle.generate(),await this.setAttributes(),this.requestUpdate())}});let iS;const rS=ap.extend({id:"converse-client-info-modal",initialize(e){iS=e._converse,ap.prototype.initialize.apply(this,arguments)},toHTML(){return(e=>{const t=Eh("Settings"),n=Eh("%1$s Open Source %2$s XMPP chat client brought to you by %3$s Opkode %2$s",'<a target="_blank" rel="nofollow" href="https://conversejs.org">',"</a>",'<a target="_blank" rel="nofollow" href="https://opkode.com">'),s=Eh("%1$s Translate %2$s it into your own language",'<a target="_blank" rel="nofollow" href="https://hosted.weblate.org/projects/conversejs/#languages">',"</a>"),i=jl.settings.get("show_client_info"),r=jl.settings.get("allow_adhoc_commands");return el`
2021-03-19 19:26:15 +01:00
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="converse-modtools-modal-label">${t}</h5>
2022-01-03 11:54:10 +01:00
${lp}
2021-03-19 19:26:15 +01:00
</div>
<div class="modal-body">
2022-01-03 11:54:10 +01:00
${i&&r?(e=>{const t=Eh("About"),n=Eh("Commands");return el`
2021-03-19 19:26:15 +01:00
<ul class="nav nav-pills justify-content-center">
<li role="presentation" class="nav-item">
<a class="nav-link active" id="about-tab" href="#about-tabpanel" aria-controls="about-tabpanel" role="tab" data-toggle="tab" @click=${e.switchTab}>${t}</a>
</li>
<li role="presentation" class="nav-item">
<a class="nav-link" id="commands-tab" href="#commands-tabpanel" aria-controls="commands-tabpanel" role="tab" data-toggle="tab" @click=${e.switchTab}>${n}</a>
</li>
</ul>
`})(e):""}
<div class="tab-content">
<div class="tab-pane tab-pane--columns ${i?"active":""}"
id="about-tabpanel" role="tabpanel" aria-labelledby="about-tab">
<span class="modal-alert"></span>
<br/>
<div class="container">
<h6 class="brand-heading">Converse</h6>
<p class="brand-subtitle">${e.version_name}</p>
2022-01-03 11:54:10 +01:00
<p class="brand-subtitle">${my(Oo().sanitize(n))}</p>
<p class="brand-subtitle">${my(Oo().sanitize(s))}</p>
2021-03-19 19:26:15 +01:00
</div>
</div>
2021-11-11 22:06:49 +01:00
<div class="tab-pane tab-pane--columns ${!i&&r?"active":""}"
2021-03-19 19:26:15 +01:00
id="commands-tabpanel"
role="tabpanel"
aria-labelledby="commands-tab">
<converse-adhoc-commands/>
</div>
</div>
</div>
</div>
</div>
2022-01-03 11:54:10 +01:00
`})(Object.assign(this.model.toJSON(),this.model.vcard.toJSON(),{version_name:iS.VERSION_NAME}))}});jl.elements.define("converse-user-profile",class extends ig{initialize(){this.model=wa.xmppstatus,this.listenTo(this.model,"vcard:add",this.requestUpdate),this.listenTo(this.model,"change",this.requestUpdate),this.listenTo(this.model,"vcard:change",this.requestUpdate)}render(){return(e=>{var t,n,s;const i=e.model.get("status")||"offline",r=(null===(t=e.model.vcard)||void 0===t?void 0:t.get("fullname"))||wa.bare_jid,o=e.model.get("status_message")||Eh("I am %1$s","chat"===(a=i)?Eh("online"):"dnd"===a?Eh("busy"):"xa"===a?Eh("away for long"):"away"===a?Eh("away"):"offline"===a?Eh("offline"):Eh(a)||Eh("online"));var a;const c=Eh("Click to change your chat status"),l=jl.settings.get("show_client_info")||jl.settings.get("allow_adhoc_commands");let d,u;return[d,u]="online"===i?["fa fa-circle chat-status","chat-status-online"]:"dnd"===i?["fa fa-minus-circle chat-status","chat-status-busy"]:"away"===i?["fa fa-circle chat-status","chat-status-away"]:["fa fa-circle chat-status","subdued-color"],el`
<div class="userinfo controlbox-padded">
<div class="controlbox-section profile d-flex">
<a class="show-profile" href="#" @click=${e.showProfileModal}>
<converse-avatar class="avatar align-self-center"
.data=${null===(n=e.model.vcard)||void 0===n?void 0:n.attributes}
nonce=${null===(s=e.model.vcard)||void 0===s?void 0:s.get("vcard_updated")}
height="40" width="40"></converse-avatar>
</a>
<span class="username w-100 align-self-center">${r}</span>
${l?function(e){const t=Eh("Show details about this chat client");return el`<a class="controlbox-heading__btn show-client-info align-self-center" title="${t}" @click=${e.showUserSettingsModal}>
<converse-icon color="var(--subdued-color)" class="fa fa-cog" size="1em"></converse-icon>
</a>`}(e):""}
${jl.settings.get("allow_logout")?function(e){const t=Eh("Log out");return el`<a class="controlbox-heading__btn logout align-self-center" title="${t}" @click=${e.logout}>
<converse-icon color="var(--subdued-color)" class="fa fa-sign-out-alt" size="1em"></converse-icon>
</a>`}(e):""}
</div>
<div class="d-flex xmpp-status">
<a class="change-status" title="${c}" data-toggle="modal" data-target="#changeStatusModal" @click=${e.showStatusChangeModal}>
<span class="${i} w-100 align-self-center" data-value="${i}">
<converse-icon color="var(--${u})" style="margin-top: -0.1em" size="0.82em" class="${d}"></converse-icon> ${o}</span>
</a>
</div>
</div>`})(this)}showProfileModal(e){null==e||e.preventDefault(),jl.modal.show(wa.ProfileModal,{model:this.model},e)}showStatusChangeModal(e){null==e||e.preventDefault(),jl.modal.show(wa.ChatStatusModal,{model:this.model},e)}showUserSettingsModal(e){null==e||e.preventDefault(),jl.modal.show(rS,{model:this.model,_converse:wa},e)}logout(e){null==e||e.preventDefault(),!0===confirm(Eh("Are you sure you want to log out?"))&&jl.user.logout()}});const oS=$l.env.utils,aS=ap.extend({id:"modal-status-change",events:{"submit form#set-xmpp-status":"onFormSubmitted","click .clear-input":"clearStatusMessage"},toHTML(){return(e=>el`
2021-11-11 22:06:49 +01:00
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="changeStatusModalLabel">${e.modal_title}</h5>
2022-01-03 11:54:10 +01:00
${lp}
2021-11-11 22:06:49 +01:00
</div>
<div class="modal-body">
<span class="modal-alert"></span>
<form class="converse-form set-xmpp-status" id="set-xmpp-status">
<div class="form-group">
<div class="custom-control custom-radio">
<input ?checked=${"online"===e.status}
type="radio" id="radio-online" value="online" name="chat_status" class="custom-control-input"/>
<label class="custom-control-label" for="radio-online">
<span class="fa fa-circle chat-status chat-status--online"></span>${e.label_online}</label>
</div>
<div class="custom-control custom-radio">
<input ?checked=${"busy"===e.status}
type="radio" id="radio-busy" value="dnd" name="chat_status" class="custom-control-input"/>
<label class="custom-control-label" for="radio-busy">
<span class="fa fa-minus-circle chat-status chat-status--busy"></span>${e.label_busy}</label>
</div>
<div class="custom-control custom-radio">
<input ?checked=${"away"===e.status}
type="radio" id="radio-away" value="away" name="chat_status" class="custom-control-input"/>
<label class="custom-control-label" for="radio-away">
<span class="fa fa-circle chat-status chat-status--away"></span>${e.label_away}</label>
</div>
<div class="custom-control custom-radio">
<input ?checked=${"xa"===e.status}
type="radio" id="radio-xa" value="xa" name="chat_status" class="custom-control-input"/>
<label class="custom-control-label" for="radio-xa">
<span class="far fa-circle chat-status chat-status--xa"></span>${e.label_xa}</label>
</div>
</div>
<div class="form-group">
<div class="btn-group w-100">
<input name="status_message" type="text" class="form-control"
value="${e.status_message||""}" placeholder="${e.placeholder_status_message}"/>
<span class="clear-input fa fa-times ${e.status_message?"":"hidden"}"></span>
</div>
</div>
<button type="submit" class="btn btn-primary">${e.label_save}</button>
</form>
</div>
</div>
</div>
2022-01-03 11:54:10 +01:00
`)(Object.assign(this.model.toJSON(),this.model.vcard.toJSON(),{label_away:Eh("Away"),label_busy:Eh("Busy"),label_cancel:Eh("Cancel"),label_close:Eh("Close"),label_custom_status:Eh("Custom status"),label_offline:Eh("Offline"),label_online:Eh("Online"),label_save:Eh("Save"),label_xa:Eh("Away for long"),modal_title:Eh("Change chat status"),placeholder_status_message:Eh("Personal status message")}))},afterRender(){this.el.addEventListener("shown.bs.modal",(()=>{this.el.querySelector('input[name="status_message"]').focus()}),!1)},clearStatusMessage(e){e&&e.preventDefault&&(e.preventDefault(),oS.hideElement(this.el.querySelector(".clear-input"))),this.el.querySelector('input[name="status_message"]').value=""},onFormSubmitted(e){e.preventDefault();const t=new FormData(e.target);this.model.save({status_message:t.get("status_message"),status:t.get("chat_status")}),this.modal.hide()}});wa.ChatStatusModal=aS;const cS=Eh("Your profile picture");jl.elements.define("converse-image-picker",class extends ig{static get properties(){return{height:{type:Number},data:{type:Object},width:{type:Number}}}render(){return el`
<a class="change-avatar" @click=${this.openFileSelection} title="${cS}">
<converse-avatar class="avatar" .data=${this.data} height="${this.height}" width="${this.width}"></converse-avatar>
2021-03-19 19:26:15 +01:00
</a>
<input @change=${this.updateFilePreview} class="hidden" name="image" type="file"/>
2022-01-03 11:54:10 +01:00
`}openFileSelection(e){e.preventDefault(),this.querySelector('input[type="file"]').click()}updateFilePreview(e){const t=e.target.files[0],n=new FileReader;n.onloadend=()=>{this.data={data_uri:n.result,image_type:t.type}},n.readAsDataURL(t)}});var lS=n(2234),dS=n.n(lS);const{sizzle:uS}=$l.env,hS=new(dS())({targetSize:.1,quality:.75,maxWidth:256,maxHeight:256}),fS=ap.extend({id:"user-profile-modal",events:{"submit .profile-form":"onFormSubmitted"},initialize(){this.listenTo(this.model,"change",this.render),ap.prototype.initialize.apply(this,arguments),jl.trigger("profileModalInitialized",this.model)},toHTML(){return(e=>{var t,n;const s=Eh("Your Profile"),i=Eh("Email"),r=Eh("Full Name"),o=Eh("XMPP Address"),a=Eh("Nickname"),c=Eh("Role"),l=Eh("Save and close"),d=Eh("Use commas to separate multiple roles. Your roles are shown next to your name on your chat messages."),u=Eh("URL"),h=Eh("OMEMO"),f=Eh("Profile"),m=el`<ul class="nav nav-pills justify-content-center">
2021-03-19 19:26:15 +01:00
<li role="presentation" class="nav-item">
2022-01-03 11:54:10 +01:00
<a class="nav-link active" id="profile-tab" href="#profile-tabpanel" aria-controls="profile-tabpanel" role="tab" data-toggle="tab">${f}</a>
2021-03-19 19:26:15 +01:00
</li>
<li role="presentation" class="nav-item">
2022-01-03 11:54:10 +01:00
<a class="nav-link" id="omemo-tab" href="#omemo-tabpanel" aria-controls="omemo-tabpanel" role="tab" data-toggle="tab">${h}</a>
2021-03-19 19:26:15 +01:00
</li>
2022-01-03 11:54:10 +01:00
</ul>`;return el`
2021-03-19 19:26:15 +01:00
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
2022-01-03 11:54:10 +01:00
<h5 class="modal-title" id="user-profile-modal-label">${s}</h5>
${lp}
2021-03-19 19:26:15 +01:00
</div>
<div class="modal-body">
<span class="modal-alert"></span>
2022-01-03 11:54:10 +01:00
${null!==(t=wa.pluggable.plugins["converse-omemo"])&&void 0!==t&&t.enabled(wa)?m:""}
2021-03-19 19:26:15 +01:00
<div class="tab-content">
<div class="tab-pane active" id="profile-tabpanel" role="tabpanel" aria-labelledby="profile-tab">
<form class="converse-form converse-form--modal profile-form" action="#">
<div class="row">
<div class="col-auto">
2022-01-03 11:54:10 +01:00
<converse-image-picker .data="${{image:e.image,image_type:e.image_type}}" width="128" height="128"></converse-image-picker>
2021-03-19 19:26:15 +01:00
</div>
<div class="col">
<div class="form-group">
2022-01-03 11:54:10 +01:00
<label class="col-form-label">${o}:</label>
2021-03-19 19:26:15 +01:00
<div>${e.jid}</div>
</div>
</div>
</div>
<div class="form-group">
2022-01-03 11:54:10 +01:00
<label for="vcard-fullname" class="col-form-label">${r}:</label>
2021-03-19 19:26:15 +01:00
<input id="vcard-fullname" type="text" class="form-control" name="fn" value="${e.fullname||""}"/>
</div>
<div class="form-group">
2022-01-03 11:54:10 +01:00
<label for="vcard-nickname" class="col-form-label">${a}:</label>
2021-03-19 19:26:15 +01:00
<input id="vcard-nickname" type="text" class="form-control" name="nickname" value="${e.nickname||""}"/>
</div>
<div class="form-group">
2022-01-03 11:54:10 +01:00
<label for="vcard-url" class="col-form-label">${u}:</label>
2021-03-19 19:26:15 +01:00
<input id="vcard-url" type="url" class="form-control" name="url" value="${e.url||""}"/>
</div>
<div class="form-group">
2022-01-03 11:54:10 +01:00
<label for="vcard-email" class="col-form-label">${i}:</label>
2021-03-19 19:26:15 +01:00
<input id="vcard-email" type="email" class="form-control" name="email" value="${e.email||""}"/>
</div>
<div class="form-group">
2022-01-03 11:54:10 +01:00
<label for="vcard-role" class="col-form-label">${c}:</label>
2021-03-19 19:26:15 +01:00
<input id="vcard-role" type="text" class="form-control" name="role" value="${e.role||""}" aria-describedby="vcard-role-help"/>
2022-01-03 11:54:10 +01:00
<small id="vcard-role-help" class="form-text text-muted">${d}</small>
2021-03-19 19:26:15 +01:00
</div>
<hr/>
<div class="form-group">
2022-01-03 11:54:10 +01:00
<button type="submit" class="save-form btn btn-primary">${l}</button>
2021-03-19 19:26:15 +01:00
</div>
</form>
</div>
2022-01-03 11:54:10 +01:00
${null!==(n=wa.pluggable.plugins["converse-omemo"])&&void 0!==n&&n.enabled(wa)?el`
<div class="tab-pane" id="omemo-tabpanel" role="tabpanel" aria-labelledby="omemo-tab">
<converse-omemo-profile></converse-omemo-profile>
</div>`:""}
2021-03-19 19:26:15 +01:00
</div>
</div>
</div>
</div>
2022-01-03 11:54:10 +01:00
`})(Object.assign(this.model.toJSON(),this.model.vcard.toJSON(),{view:this}))},afterRender(){this.tabs=uS(".nav-item .nav-link",this.el).map((e=>new(Yg().Tab)(e)))},async setVCard(e){try{await jl.vcard.set(wa.bare_jid,e)}catch(e){return M.fatal(e),void this.alert([Eh("Sorry, an error happened while trying to save your profile data."),Eh("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),s=n.get("image"),i={fn:n.get("fn"),nickname:n.get("nickname"),role:n.get("role"),email:n.get("email"),url:n.get("url")};if(s.size){const e=[s];hS.compress(e).then((e=>{const{photo:n}=e[0];t.onloadend=()=>{Object.assign(i,{image:btoa(t.result),image_type:s.type}),this.setVCard(i)},t.readAsBinaryString(n.data)}))}else Object.assign(i,{image:this.model.vcard.get("image"),image_type:this.model.vcard.get("image_type")}),this.setVCard(i)}});wa.ProfileModal=fS,$l.plugins.add("converse-profile",{dependencies:["converse-status","converse-modal","converse-vcard","converse-chatboxviews"],initialize(){jl.settings.extend({allow_adhoc_commands:!0,show_client_info:!0})}});const mS={async sendMessage(e){var t;if(this.get("omemo_active")&&null!==(t=e)&&void 0!==t&&t.body){var n;const t=null===(n=e)||void 0===n?void 0:n.body;let s,i;(e=this.getOutgoingMessageAttributes(e)).is_encrypted=!0,e.plaintext=t;try{const t=await async function(e){const t=Eh("Sorry, no devices found to which we can send an OMEMO encrypted message.");let n;if(e.get("type")===wa.CHATROOMS_TYPE){const t=await Promise.all(e.occupants.map((e=>Ww(e.get("jid")))));n=t.reduce(((e,t)=>function(){var e=arguments.length;if(!e)return[];for(var t=Array(e-1),n=arguments[0],s=e;s--;)t[s-1]=arguments[s];return Yt(ot(n)?_i(n):[n],Co(t,1))}(e,t.models)),[])}else if(e.get("type")===wa.PRIVATE_CHAT_TYPE){const s=await Ww(e.get("jid"));if(0===s.length){const e=new Error(t);throw e.user_facing=!0,e}const i=wa.devicelists.get(wa.bare_jid).devices;n=[...i.models,...s.models]}const s=wa.omemo_store.get("device_id");n=n.filter((e=>e.get("id")!==s)),await Promise.all(n.map((e=>e.getBundle())));const i=n.filter((e=>e)).map((e=>async function(e){if(!e.get("bundle"))return M.error(`Could not build an OMEMO session for device ${e.get("id")} because we don't have its bundle`),null;const t=new libsignal.SignalProtocolAddress(e.get("jid"),e.get("id")),n=await wa.omemo_store.loadSession(t.toString());if(n)return n;try{return await async function(e){const t=new libsignal.SignalProtocolAddress(e.get("jid"),e.get("id")),n=new libsignal.SessionBuilder(wa.omemo_store,t),s=e.getRandomPreKey(),i=await e.getBundle();return n.processPreKey({registrationId:parseInt(e.get("id"),10),identityKey:Tw(i.identity_key),signedPreKey:{keyId:i.signed_prekey.id,publicKey:Tw(i.signed_prekey.public_key),signature:Tw(i.signed_prekey.signature)},preKey:{keyId:s.id,publicKey:Tw(s.key)}})}(e)}catch(t){return M.error(`Could not build an OMEMO session for device ${e.get("id")}`),M.error(t),null}}(e)));if(await Promise.all(i),i.includes(null)&&(n=n.filter((e=>i[n.indexOf(e)])),0===n.length)){const e=new Error(t);throw e.user_facing=!0,e}return n}(this);s=await this.createMessage(e),i=await function(e,t,n){const s=Eh("This is an OMEMO encrypted message which your client doesnt seem to support. Find more information on https://conversations.im/omemo");if(!t.get("message"))throw new Error("No message body to encrypt!");const i=jw({from:wa.connection.jid,to:e.get("jid"),type:e.get("message_type"),id:t.get("msgid")}).c("body").t(s).up();return"chat"===t.get("type")&&i.c("request",{xmlns:Nw.NS.RECEIPTS}).up(),i.c("encrypted",{xmlns:Nw.NS.OMEMO}).c("header",{sid:wa.omemo_store.get("device_id")}),Xw.encryptMessage(t.get("message")).then((t=>{const s=n.filter((e=>-1!=e.get("trusted")&&e.get("active"))).map((n=>e.encryptKey(t.key_and_tag,n)));return Promise.all(s).then((e=>function(e,t,n){for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){const i=t[s].payload,r=t[s].device,o=3==parseInt(i.type,10);e.c(
2021-11-11 22:06:49 +01:00
<converse-brand-logo></converse-brand-logo>
2022-01-03 11:54:10 +01:00
${0===e.model.get("registration_status")?(()=>{const e=jl.settings.get("registration_domain"),t=Eh("Create your account"),n=Eh("Please enter the XMPP provider to register with:");return el`
2021-11-11 22:06:49 +01:00
<form id="converse-register" class="converse-form">
<legend class="col-form-label">${t}</legend>
<div class="form-group">
<label>${n}</label>
<div class="form-errors hidden"></div>
2022-01-03 11:54:10 +01:00
${e||(()=>{const e=jl.settings.get("domain_placeholder"),t=Eh("Tip: A list of public XMPP providers is available"),n=Eh("here"),s=jl.settings.get("providers_link");return el`
2021-11-11 22:06:49 +01:00
<input class="form-control" required="required" type="text" name="domain" placeholder="${e}" />
<p class="form-text text-muted">
${t}
<a href="${s}" class="url" target="_blank" rel="noopener">${n}</a>.
</p>
`})()}
2021-03-19 19:26:15 +01:00
</div>
2022-01-03 11:54:10 +01:00
${e?"":(()=>{const e=Eh("Fetch registration form"),t=Eh("Already have a chat account?"),n=Eh("Log in here");return el`
2021-11-11 22:06:49 +01:00
<fieldset class="form-group buttons">
<input class="btn btn-primary" type="submit" value="${e}" />
</fieldset>
<div class="switch-form">
<p>${t}</p>
<p><a class="login-here toggle-register-login" href="#converse/login">${n}</a></p>
</div>
`})()}
</form>
`})():""}
2022-01-03 11:54:10 +01:00
${1===e.model.get("registration_status")?(()=>{const e=jl.settings.get("registration_domain"),t=Eh("Hold tight, we're fetching the registration form…"),n=Eh("Cancel");return el`
2021-11-11 22:06:49 +01:00
<form id="converse-register" class="converse-form no-scrolling">
2022-01-03 11:54:10 +01:00
${ny({classes:"hor_centered"})}
2021-11-11 22:06:49 +01:00
<p class="info">${t}</p>
2022-01-03 11:54:10 +01:00
${e?"":el`
2021-11-11 22:06:49 +01:00
<button class="btn btn-secondary button-cancel hor_centered">${n}</button>
`}
</form>
`})():""}
2022-01-03 11:54:10 +01:00
${2===e.model.get("registration_status")?(e=>{const t=Eh("Choose a different provider"),n=Eh("Already have a chat account?"),s=Eh("Account Registration:"),i=Eh("Log in here"),r=Eh("Register"),o=jl.settings.get("registration_domain");return el`
2021-11-11 22:06:49 +01:00
<form id="converse-register" class="converse-form">
<legend class="col-form-label">${s} ${e.domain}</legend>
<p class="title">${e.title}</p>
<p class="form-help instructions">${e.instructions}</p>
<div class="form-errors hidden"></div>
${e.form_fields}
<fieldset class="buttons form-group">
2022-01-03 11:54:10 +01:00
${e.fields?el`
2021-11-11 22:06:49 +01:00
<input type="submit" class="btn btn-primary" value="${r}" />
`:""}
2022-01-03 11:54:10 +01:00
${o?"":el`
2021-11-11 22:06:49 +01:00
<input
type="button"
class="btn btn-secondary button-cancel"
value="${t}"
/>
`}
<div class="switch-form">
<p>${n}</p>
<p><a class="login-here toggle-register-login" href="#converse/login">${i}</a></p>
</div>
</fieldset>
</form>
`})(e):""}
2022-01-03 11:54:10 +01:00
`;function VS(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const{Strophe:JS,sizzle:QS,$iq:ZS}=$l.env,KS=$l.env.utils,YS=1,XS=2;jl.elements.define("converse-register-panel",class extends Ng{constructor(...e){super(...e),VS(this,"id","converse-register-panel"),VS(this,"className","controlbox-pane fade-in"),VS(this,"events",{"submit form#converse-register":"onFormSubmission","click .button-cancel":"renderProviderChoiceForm"})}initialize(){this.reset();const e=wa.chatboxes.get("controlbox");this.model=e,this.listenTo(wa,"connectionInitialized",this.registerHooks),this.listenTo(this.model,"change:registration_status",this.render);const t=jl.settings.get("registration_domain");t?this.fetchRegistrationForm(t):this.model.set("registration_status",0)}render(){il(WS({domain:this.domain,fields:this.fields,form_fields:this.form_fields,instructions:this.instructions,model:this.model,title:this.title}),this)}registerHooks(){const e=wa.connection,t=e._connect_cb.bind(e);e._connect_cb=(e,n,s)=>{this._registering?this.getRegistrationFields(e,n)&&(this._registering=!1):t(e,n,s)}}connectedCallback(){super.connectedCallback(),this.render()}getRegistrationFields(e,t){const n=wa.connection;n.connected=!0;const s=n._proto._reqToData(e);if(!s)return;if(n._proto._connect_cb(s)===JS.Status.CONNFAIL)return this.showValidationError(Eh("Sorry, we're unable to connect to your chosen provider.")),!1;const i=s.getElementsByTagName("register"),r=s.getElementsByTagName("mechanism");if(0===i.length&&0===r.length)return n._proto._no_auth_received(t),!1;if(0===i.length)return n._changeConnectStatus(JS.Status.REGIFAIL),this.showValidationError(Eh("Sorry, the given provider does not support in band account registration. Please try with a different provider.")),!0;n._addSysHandler(this.onRegistrationFields.bind(this),null,"iq",null,null);const o=ZS({type:"get"}).c("query",{xmlns:JS.NS.REGISTER}).tree();return o.setAttribute("id",n.getUniqueId("sendIQ")),n.send(o),n.connected=!1,!0}onRegistrationFields(e){return"error"===e.getAttribute("type")?(wa.connection._changeConnectStatus(JS.Status.REGIFAIL,Eh('Something went wrong while establishing a connection with "%1$s". Are you sure it exists?',this.domain)),!1):1!==e.getElementsByTagName("query").length?(wa.connection._changeConnectStatus(JS.Status.REGIFAIL,"unknown"),!1):(this.setFields(e),this.model.get("registration_status")===YS&&this.renderRegistrationForm(e),!1)}reset(e){const t={fields:{},urls:[],title:"",instructions:"",registered:!1,_registering:!1,domain:null,form_type:null};Object.assign(this,t),e&&Object.assign(this,jo(e,Object.keys(t)))}onFormSubmission(e){e&&e.preventDefault&&e.preventDefault(),null===e.target.querySelector("input[name=domain]")?this.submitRegistrationForm(e.target):this.onProviderChosen(e.target)}onProviderChosen(e){const t=e.querySelector("input[name=domain]"),n=null==t?void 0:t.value;n?(e.querySelector("input[type=submit]").classList.add("hidden"),this.fetchRegistrationForm(n.trim())):t.classList.add("error")}async fetchRegistrationForm(e){var t;return this.model.set("registration_status",YS),this.reset({domain:JS.getDomainFromJid(e),_registering:!0}),await wa.initConnection(this.domain),null===(t=wa.connection)||void 0===t||t.connect(this.domain,"",(e=>this.onConnectStatusChanged(e))),!1}giveFeedback(e,t){let n=this.querySelector(".reg-feedback");null!==n&&n.parentNode.removeChild(n);const s=this.querySelector("form");s.insertAdjacentHTML("afterbegin",'<span class="reg-feedback"></span>'),n=s.querySelector(".reg-feedback"),n.textContent=e,t&&n.classList.add(t)}showSpinner(){const e=this.querySelector("form");return il(ny(),e),this}onConnectStatusChanged(e){M.debug("converse-register: onConnectStatusChanged"),[JS.Status.DISCONNECTED,JS.Status.CONNFAIL,JS.Status.REGIFAIL,JS.Status.NOTACCEPTABLE,JS.Status.CONFLICT].includes(e)?(M.error(`Problem during registration: Strophe.Status is ${wa.CONNECTION_STATUS[e]}`),this.abortRegistration()):e===JS.Status.REGISTERED&&(M.debug("Registered successfully."),wa.connection.re
2021-11-11 22:06:49 +01:00
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="add-chatroom-modal-label">${n}</h5>
2022-01-03 11:54:10 +01:00
${lp}
2021-11-11 22:06:49 +01:00
</div>
<div class="modal-body">
<span class="modal-alert"></span>
<form class="converse-form add-chatroom">
<div class="form-group">
<label for="chatroom">${e.label_room_address}:</label>
2022-01-03 11:54:10 +01:00
${e.muc_roomid_policy_error_msg?el`<label class="roomid-policy-error">${e.muc_roomid_policy_error_msg}</label>`:""}
2021-11-11 22:06:49 +01:00
<input type="text" required="required" name="chatroom" class="form-control roomjid-input" placeholder="${e.chatroom_placeholder}"/>
2021-03-19 19:26:15 +01:00
</div>
2022-01-03 11:54:10 +01:00
${e.muc_roomid_policy_hint?el`<div class="form-group">${my(Oo().sanitize(e.muc_roomid_policy_hint,{ALLOWED_TAGS:["b","br","em"]}))}</div>`:""}
${jl.settings.get("locked_muc_nickname")?"":(e=>{const t=Eh("Nickname"),n=Eh("This field is required");return el`
2021-11-11 22:06:49 +01:00
<div class="form-group" >
<label for="nickname">${t}:</label>
<input type="text" title="${n}" required="required" name="nickname" value="${e.nick||""}" class="form-control"/>
</div>
`})(e)}
<input type="submit" class="btn btn-primary" name="join" value="${t||""}" ?disabled=${e.muc_roomid_policy_error_msg}>
</form>
</div>
</div>
</div>
2022-01-03 11:54:10 +01:00
`})(Object.assign(this.model.toJSON(),{_converse:wa,label_room_address:jl.settings.get("muc_domain")?Eh("Groupchat name"):Eh("Groupchat address"),chatroom_placeholder:e,muc_roomid_policy_error_msg:this.muc_roomid_policy_error_msg,muc_roomid_policy_hint:jl.settings.get("muc_roomid_policy_hint")}))},afterRender(){this.el.addEventListener("shown.bs.modal",(()=>{this.el.querySelector('input[name="chatroom"]').focus()}),!1)},parseRoomDataFromEvent(e){const t=new FormData(e),n=t.get("chatroom");let s;if(jl.settings.get("locked_muc_nickname")){if(s=wa.getDefaultMUCNickname(),!s)throw new Error("Using locked_muc_nickname but no nickname found!")}else s=t.get("nickname").trim();return{jid:n,nick:s}},openChatRoom(e){e.preventDefault();const t=this.parseRoomDataFromEvent(e.target);let n;""===t.nick&&(t.nick=void 0),jl.settings.get("locked_muc_domain")||jl.settings.get("muc_domain")&&!ix.isValidJID(t.jid)?n=`${rx.escapeNode(t.jid)}@${jl.settings.get("muc_domain")}`:(n=t.jid,this.model.setDomain(n)),jl.rooms.open(n,Object.assign(t,{jid:n}),!0),this.modal.hide(),e.target.reset()},checkRoomidPolicy(){if(jl.settings.get("muc_roomid_policy")&&jl.settings.get("muc_domain")){let e=this.el.querySelector(".roomjid-input").value;!jl.settings.get("locked_muc_domain")&&ix.isValidJID(e)||(e=`${rx.escapeNode(e)}@${jl.settings.get("muc_domain")}`);const t=rx.getNodeFromJid(e),n=rx.getDomainFromJid(e);jl.settings.get("muc_domain")!==n||jl.settings.get("muc_roomid_policy").test(t)?this.muc_roomid_policy_error_msg=null:this.muc_roomid_policy_error_msg=Eh("Groupchat id is invalid."),this.render()}}}),ax=function(e){return e&&e.length?e[0]:void 0},{Strophe:cx,$iq:lx,sizzle:dx}=$l.env,ux=$l.env.utils;const hx=ap.extend({id:"muc-list-modal",persistent:!0,initialize(){this.items=[],this.loading_items=!1,ap.prototype.initialize.apply(this,arguments),jl.settings.get("muc_domain")&&!this.model.get("muc_domain")&&this.model.save("muc_domain",jl.settings.get("muc_domain")),this.listenTo(this.model,"change:muc_domain",this.onDomainChange),this.el.addEventListener("shown.bs.modal",(()=>jl.settings.get("locked_muc_domain")?this.updateRoomsList():this.el.querySelector('input[name="server"]').focus()))},toHTML(){const e=this.model.get("muc_domain")||jl.settings.get("muc_domain");return(e=>{const t=Eh("Query for Groupchats");return el`
2021-11-11 22:06:49 +01:00
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="muc-list-modal-label">${t}</h5>
2022-01-03 11:54:10 +01:00
${lp}
2021-11-11 22:06:49 +01:00
</div>
<div class="modal-body d-flex flex-column">
<span class="modal-alert"></span>
2022-01-03 11:54:10 +01:00
${e.show_form?(e=>{const t=Eh("Show groupchats"),n=Eh("Server address");return el`
2021-11-11 22:06:49 +01:00
<form class="converse-form list-chatrooms"
@submit=${e.submitForm}>
<div class="form-group">
<label for="chatroom">${n}:</label>
<input type="text"
@change=${e.setDomainFromEvent}
value="${e.muc_domain||""}"
required="required"
name="server"
class="form-control"
placeholder="${e.server_placeholder}"/>
</div>
<input type="submit" class="btn btn-primary" name="list" value="${t}"/>
</form>
`})(e):""}
<ul class="available-chatrooms list-group">
2022-01-03 11:54:10 +01:00
${e.loading_items?el`<li class="list-group-item"> ${ny()} </li>`:""}
${e.feedback_text?el`<li class="list-group-item active">${e.feedback_text}</li>`:""}
${Wg(e.items,(e=>e.jid),(t=>((e,t)=>{const n=Eh("Show more information on this groupchat"),s=Eh("Click to open this groupchat");return el`
2021-11-11 22:06:49 +01:00
<li class="room-item list-group-item">
<div class="available-chatroom d-flex flex-row">
<a class="open-room available-room w-100"
@click=${e.openRoom}
data-room-jid="${t.jid}"
data-room-name="${t.name}"
title="${s}"
href="#">${t.name||t.jid}</a>
<a class="right room-info icon-room-info"
@click=${e.toggleRoomInfo}
data-room-jid="${t.jid}"
title="${n}"
href="#"></a>
</div>
</li>
`})(e,t)))}
</ul>
</div>
2022-01-03 11:54:10 +01:00
<div class="modal-footer">${cp}</div>
2021-03-19 19:26:15 +01:00
</div>
</div>
2022-01-03 11:54:10 +01:00
`})(Object.assign(this.model.toJSON(),{show_form:!jl.settings.get("locked_muc_domain"),server_placeholder:e||Eh("conference.example.org"),items:this.items,loading_items:this.loading_items,openRoom:e=>this.openRoom(e),setDomainFromEvent:e=>this.setDomainFromEvent(e),submitForm:e=>this.showRooms(e),toggleRoomInfo:e=>this.toggleRoomInfo(e)}))},openRoom(e){e.preventDefault();const t=e.target.getAttribute("data-room-jid"),n=e.target.getAttribute("data-room-name");this.modal.hide(),jl.rooms.open(t,{name:n},!0)},toggleRoomInfo(e){e.preventDefault(),function(e){const t=ux.ancestor(e.target,".room-item"),n=t.querySelector("div.room-info");n?(ux.slideIn(n).then(ux.removeElement),t.querySelector("a.room-info").classList.remove("selected")):(t.insertAdjacentElement("beforeend",ux.getElementFromTemplateResult(ny())),jl.disco.info(e.target.getAttribute("data-room-jid"),null).then((e=>function(e,t){var n,s;e.querySelector("span.spinner").remove(),e.querySelector("a.room-info").classList.add("selected"),e.insertAdjacentHTML("beforeEnd",ux.getElementFromTemplateResult((e=>{const t=Eh("Description:"),n=Eh("Groupchat XMPP Address:"),s=Eh("Participants:"),i=Eh("Features:"),r=Eh("Requires authentication"),o=Eh("Hidden"),a=Eh("Requires an invitation"),c=Eh("Moderated"),l=Eh("Non-anonymous"),d=Eh("Open"),u=Eh("Permanent"),h=Eh("Public"),f=Eh("Semi-anonymous"),m=Eh("Temporary"),g=Eh("Unmoderated");return el`
2021-11-11 22:06:49 +01:00
<div class="room-info">
<p class="room-info"><strong>${n}</strong> ${e.jid}</p>
<p class="room-info"><strong>${t}</strong> ${e.desc}</p>
<p class="room-info"><strong>${s}</strong> ${e.occ}</p>
<p class="room-info"><strong>${i}</strong>
<ul>
2022-01-03 11:54:10 +01:00
${e.passwordprotected?el`<li class="room-info locked">${r}</li>`:""}
${e.hidden?el`<li class="room-info">${o}</li>`:""}
${e.membersonly?el`<li class="room-info">${a}</li>`:""}
${e.moderated?el`<li class="room-info">${c}</li>`:""}
${e.nonanonymous?el`<li class="room-info">${l}</li>`:""}
${e.open?el`<li class="room-info">${d}</li>`:""}
${e.persistent?el`<li class="room-info">${u}</li>`:""}
${e.publicroom?el`<li class="room-info">${h}</li>`:""}
${e.semianonymous?el`<li class="room-info">${f}</li>`:""}
${e.temporary?el`<li class="room-info">${m}</li>`:""}
${e.unmoderated?el`<li class="room-info">${g}</li>`:""}
2021-11-11 22:06:49 +01:00
</ul>
</p>
2021-03-19 19:26:15 +01:00
</div>
2022-01-03 11:54:10 +01:00
`})({jid:t.getAttribute("from"),desc:null===(n=ax(dx('field[var="muc#roominfo_description"] value',t)))||void 0===n?void 0:n.textContent,occ:null===(s=ax(dx('field[var="muc#roominfo_occupants"] value',t)))||void 0===s?void 0:s.textContent,hidden:dx('feature[var="muc_hidden"]',t).length,membersonly:dx('feature[var="muc_membersonly"]',t).length,moderated:dx('feature[var="muc_moderated"]',t).length,nonanonymous:dx('feature[var="muc_nonanonymous"]',t).length,open:dx('feature[var="muc_open"]',t).length,passwordprotected:dx('feature[var="muc_passwordprotected"]',t).length,persistent:dx('feature[var="muc_persistent"]',t).length,publicroom:dx('feature[var="muc_publicroom"]',t).length,semianonymous:dx('feature[var="muc_semianonymous"]',t).length,temporary:dx('feature[var="muc_temporary"]',t).length,unmoderated:dx('feature[var="muc_unmoderated"]',t).length})))}(t,e))).catch((e=>M.error(e))))}(e)},onDomainChange(){jl.settings.get("auto_list_rooms")&&this.updateRoomsList()},onRoomsFound(e){this.loading_items=!1;const t=e?dx("query item",e):[];return t.length?(this.model.set({feedback_text:Eh("Groupchats found")},{silent:!0}),this.items=t.map(md)):(this.items=[],this.model.set({feedback_text:Eh("No groupchats found")},{silent:!0})),this.render(),!0},updateRoomsList(){const e=lx({to:this.model.get("muc_domain"),from:wa.connection.jid,type:"get"}).c("query",{xmlns:cx.NS.DISCO_ITEMS});jl.sendIQ(e).then((e=>this.onRoomsFound(e))).catch((()=>this.onRoomsFound()))},showRooms(e){e.preventDefault(),this.loading_items=!0,this.render();const t=new FormData(e.target);this.model.setDomain(t.get("server")),this.updateRoomsList()},setDomainFromEvent(e){this.model.setDomain(e.target.value)},setNick(e){this.model.save({nick:e.target.value})}}),{Strophe:fx,u:mx}=$l.env;jl.elements.define("converse-rooms-list",class extends Ng{initialize(){const e=`converse.roomspanel${wa.bare_jid}`;this.model=new sx({id:e}),_o(this.model,e),this.model.fetch(),this.listenTo(wa.chatboxes,"add",this.renderIfChatRoom),this.listenTo(wa.chatboxes,"remove",this.renderIfChatRoom),this.listenTo(wa.chatboxes,"destroy",this.renderIfChatRoom),this.listenTo(wa.chatboxes,"change",this.renderIfRelevantChange),this.render()}renderIfChatRoom(e){mx.isChatRoom(e)&&this.render()}renderIfRelevantChange(e){const t=["bookmarked","hidden","name","num_unread","num_unread_general","has_activity"],n=e.changed||{};mx.isChatRoom(e)&&Object.keys(n).filter((e=>t.includes(e))).length&&this.render()}render(){il((e=>{const t=Eh("Click to toggle the list of open groupchats"),n=Eh("Groupchats"),s=Eh("Query for groupchats"),i=Eh("Add a new groupchat");return el`
2021-11-11 22:06:49 +01:00
<div class="d-flex controlbox-padded">
<span class="w-100 controlbox-heading controlbox-heading--groupchats">${n}</span>
<a class="controlbox-heading__btn show-list-muc-modal"
2022-01-03 11:54:10 +01:00
@click=${t=>jl.modal.show(hx,{model:e.model},t)}
2021-11-11 22:06:49 +01:00
title="${s}" data-toggle="modal" data-target="#muc-list-modal">
<converse-icon class="fa fa-list-ul right" color="var(--subdued-color)" path-prefix="/dist" size="1em"></converse-icon>
2021-03-19 19:26:15 +01:00
</a>
2021-11-11 22:06:49 +01:00
<a class="controlbox-heading__btn show-add-muc-modal"
2022-01-03 11:54:10 +01:00
@click=${t=>jl.modal.show(ox,{model:e.model},t)}
2021-11-11 22:06:49 +01:00
title="${i}" data-toggle="modal" data-target="#add-chatrooms-modal">
<converse-icon class="fa fa-plus right" color="var(--subdued-color)" path-prefix="/dist" size="1em"></converse-icon>
2021-03-19 19:26:15 +01:00
</a>
</div>
2021-11-11 22:06:49 +01:00
<div class="list-container list-container--openrooms ${e.rooms.length?"":"hidden"}">
<a class="list-toggle open-rooms-toggle controlbox-padded" title="${t}" @click=${e.toggleRoomsList}>
2022-01-03 11:54:10 +01:00
<span class="fa ${e.toggle_state===wa.OPENED?"fa-caret-down":"fa-caret-right"}"></span> ${Eh("Open Groupchats")}</a>
2021-11-11 22:06:49 +01:00
<div class="items-list rooms-list open-rooms-list ${e.collapsed&&"collapsed"}">
2022-01-03 11:54:10 +01:00
${e.rooms.map((t=>(e=>{const t=Eh("Leave this groupchat"),n=e.room.get("num_unread_general")||e.room.get("has_activity");return el`
2021-11-11 22:06:49 +01:00
<div class="list-item controlbox-padded available-chatroom d-flex flex-row ${e.currently_open(e.room)?"open":""} ${n?"unread-msgs":""}"
2021-03-19 19:26:15 +01:00
data-room-jid="${e.room.get("jid")}">
2022-01-03 11:54:10 +01:00
${e.room.get("num_unread")?(e=>el`<span class="list-item-badge badge badge--muc msgs-indicator">${e.room.get("num_unread")}</span>`)(e):e.room.get("has_activity")?el`<span class="list-item-badge badge badge--muc msgs-indicator"></span>`:""}
2021-11-11 22:06:49 +01:00
2021-03-19 19:26:15 +01:00
<a class="list-item-link open-room available-room w-100"
2021-11-11 22:06:49 +01:00
data-room-jid="${e.room.get("jid")}"
2022-01-03 11:54:10 +01:00
title="${Eh("Click to open this groupchat")}"
2021-11-11 22:06:49 +01:00
@click=${e.openRoom}>${e.room.getDisplayName()}</a>
2021-03-19 19:26:15 +01:00
2022-01-03 11:54:10 +01:00
${jl.settings.get("allow_bookmarks")?(e=>{const t=Eh("Bookmark this groupchat"),n=Eh("Unbookmark this groupchat");return e.bookmarked?el`
2021-03-19 19:26:15 +01:00
<a class="list-item-action fa fa-bookmark remove-bookmark button-on"
data-room-jid="${e.room.get("jid")}"
data-bookmark-name="${e.room.getDisplayName()}"
@click=${e.removeBookmark}
2022-01-03 11:54:10 +01:00
title="${e.bookmarked?n:t}"></a>`:el`
2021-03-19 19:26:15 +01:00
<a class="list-item-action fa fa-bookmark add-bookmark"
data-room-jid="${e.room.get("jid")}"
data-bookmark-name="${e.room.getDisplayName()}"
@click=${e.addBookmark}
title="${e.bookmarked?n:t}"></a>`})(e):""}
<a class="list-item-action room-info fa fa-info-circle"
2021-11-11 22:06:49 +01:00
data-room-jid="${e.room.get("jid")}"
2022-01-03 11:54:10 +01:00
title="${Eh("Show more information on this groupchat")}"
2021-11-11 22:06:49 +01:00
@click=${e.showRoomDetailsModal}></a>
2021-03-19 19:26:15 +01:00
<a class="list-item-action fa fa-sign-out-alt close-room"
2021-11-11 22:06:49 +01:00
data-room-jid="${e.room.get("jid")}"
data-room-name="${e.room.getDisplayName()}"
title="${t}"
@click=${e.closeRoom}></a>
</div>`})(Object.assign({room:t},e))))}
2021-03-19 19:26:15 +01:00
</div>
2022-01-03 11:54:10 +01:00
</div>`})({addBookmark:e=>this.addBookmark(e),allow_bookmarks:jl.settings.get("allow_bookmarks")&&wa.bookmarks,closeRoom:e=>this.closeRoom(e),collapsed:this.model.get("toggle-state")!==wa.OPENED,currently_open:e=>sa()&&!e.get("hidden"),model:this.model,openRoom:e=>this.openRoom(e),removeBookmark:e=>this.removeBookmark(e),rooms:wa.chatboxes.filter((e=>e.get("type")===wa.CHATROOMS_TYPE)),showRoomDetailsModal:e=>this.showRoomDetailsModal(e),toggleRoomsList:e=>this.toggleRoomsList(e),toggle_state:this.model.get("toggle-state")}),this)}showRoomDetailsModal(e){const t=e.target.getAttribute("data-room-jid"),n=wa.chatboxes.get(t);e.preventDefault(),jl.modal.show(V_,{model:n},e)}async openRoom(e){e.preventDefault();const t=e.target.textContent,n=e.target.getAttribute("data-room-jid"),s={name:t||fx.unescapeNode(fx.getNodeFromJid(n))||n};await jl.rooms.open(n,s,!0)}async closeRoom(e){e.preventDefault();const t=e.target.getAttribute("data-room-name");if(confirm(Eh("Are you sure you want to leave the groupchat %1$s?",t))){const t=e.target.getAttribute("data-room-jid");(await jl.rooms.get(t)).close()}}removeBookmark(e){wa.removeBookmarkViaEvent(e)}addBookmark(e){wa.addBookmarkViaEvent(e)}toggleRoomsList(e){var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e);const n=e.target.matches(".fa")?e.target:e.target.querySelector(".fa");n.classList.contains("fa-caret-down")?mx.slideIn(this.querySelector(".open-rooms-list")).then((()=>{this.model.save({"toggle-state":wa.CLOSED}),n.classList.remove("fa-caret-down"),n.classList.add("fa-caret-right")})):mx.slideOut(this.querySelector(".open-rooms-list")).then((()=>{this.model.save({"toggle-state":wa.OPENED}),n.classList.remove("fa-caret-right"),n.classList.add("fa-caret-down")}))}}),$l.plugins.add("converse-roomslist",{dependencies:["converse-singleton","converse-controlbox","converse-muc","converse-bookmarks"],initialize(){jl.listen.on("connected",(async()=>{jl.settings.get("allow_bookmarks")?await jl.waitUntil("bookmarksInitialized"):await Promise.all([jl.waitUntil("chatBoxesFetched")])}))}}),window.customElements.define("converse-fontawesome",class extends ig{render(){return el`
2021-11-11 22:06:49 +01:00
<?xml version="1.0" encoding="UTF-8"?>
<!--
Font Awesome Free 5.13.0 by @fontawesome - https://fontawesome.com
License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
-->
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol id="icon-address-book" viewBox="0 0 448 512">
<path d="M436 160c6.6 0 12-5.4 12-12v-40c0-6.6-5.4-12-12-12h-20V48c0-26.5-21.5-48-48-48H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h320c26.5 0 48-21.5 48-48v-48h20c6.6 0 12-5.4 12-12v-40c0-6.6-5.4-12-12-12h-20v-64h20c6.6 0 12-5.4 12-12v-40c0-6.6-5.4-12-12-12h-20v-64h20zm-228-32c35.3 0 64 28.7 64 64s-28.7 64-64 64-64-28.7-64-64 28.7-64 64-64zm112 236.8c0 10.6-10 19.2-22.4 19.2H118.4C106 384 96 375.4 96 364.8v-19.2c0-31.8 30.1-57.6 67.2-57.6h5c12.3 5.1 25.7 8 39.8 8s27.6-2.9 39.8-8h5c37.1 0 67.2 25.8 67.2 57.6v19.2z"></path>
</symbol>
<symbol id="icon-angle-double-down" viewBox="0 0 320 512">
<path d="M143 256.3L7 120.3c-9.4-9.4-9.4-24.6 0-33.9l22.6-22.6c9.4-9.4 24.6-9.4 33.9 0l96.4 96.4 96.4-96.4c9.4-9.4 24.6-9.4 33.9 0L313 86.3c9.4 9.4 9.4 24.6 0 33.9l-136 136c-9.4 9.5-24.6 9.5-34 .1zm34 192l136-136c9.4-9.4 9.4-24.6 0-33.9l-22.6-22.6c-9.4-9.4-24.6-9.4-33.9 0L160 352.1l-96.4-96.4c-9.4-9.4-24.6-9.4-33.9 0L7 278.3c-9.4 9.4-9.4 24.6 0 33.9l136 136c9.4 9.5 24.6 9.5 34 .1z"></path>
</symbol>
<symbol id="icon-angle-double-left" viewBox="0 0 448 512">
<path d="M223.7 239l136-136c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9L319.9 256l96.4 96.4c9.4 9.4 9.4 24.6 0 33.9L393.7 409c-9.4 9.4-24.6 9.4-33.9 0l-136-136c-9.5-9.4-9.5-24.6-.1-34zm-192 34l136 136c9.4 9.4 24.6 9.4 33.9 0l22.6-22.6c9.4-9.4 9.4-24.6 0-33.9L127.9 256l96.4-96.4c9.4-9.4 9.4-24.6 0-33.9L201.7 103c-9.4-9.4-24.6-9.4-33.9 0l-136 136c-9.5 9.4-9.5 24.6-.1 34z"></path>
</symbol>
<symbol id="icon-angle-double-right" viewBox="0 0 448 512">
<path d="M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34zm192-34l-136-136c-9.4-9.4-24.6-9.4-33.9 0l-22.6 22.6c-9.4 9.4-9.4 24.6 0 33.9l96.4 96.4-96.4 96.4c-9.4 9.4-9.4 24.6 0 33.9l22.6 22.6c9.4 9.4 24.6 9.4 33.9 0l136-136c9.4-9.2 9.4-24.4 0-33.8z"></path>
</symbol>
<symbol id="icon-angle-double-up" viewBox="0 0 320 512">
<path d="M177 255.7l136 136c9.4 9.4 9.4 24.6 0 33.9l-22.6 22.6c-9.4 9.4-24.6 9.4-33.9 0L160 351.9l-96.4 96.4c-9.4 9.4-24.6 9.4-33.9 0L7 425.7c-9.4-9.4-9.4-24.6 0-33.9l136-136c9.4-9.5 24.6-9.5 34-.1zm-34-192L7 199.7c-9.4 9.4-9.4 24.6 0 33.9l22.6 22.6c9.4 9.4 24.6 9.4 33.9 0l96.4-96.4 96.4 96.4c9.4 9.4 24.6 9.4 33.9 0l22.6-22.6c9.4-9.4 9.4-24.6 0-33.9l-136-136c-9.2-9.4-24.4-9.4-33.8 0z"></path>
</symbol>
<symbol id="icon-angle-down" viewBox="0 0 320 512">
<path d="M143 352.3L7 216.3c-9.4-9.4-9.4-24.6 0-33.9l22.6-22.6c9.4-9.4 24.6-9.4 33.9 0l96.4 96.4 96.4-96.4c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9l-136 136c-9.2 9.4-24.4 9.4-33.8 0z"></path>
</symbol>
<symbol id="icon-angle-left" viewBox="0 0 256 512">
<path d="M31.7 239l136-136c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9L127.9 256l96.4 96.4c9.4 9.4 9.4 24.6 0 33.9L201.7 409c-9.4 9.4-24.6 9.4-33.9 0l-136-136c-9.5-9.4-9.5-24.6-.1-34z"></path>
</symbol>
<symbol id="icon-angle-right" viewBox="0 0 256 512">
<path d="M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"></path>
</symbol>
<symbol id="icon-angle-up" viewBox="0 0 320 512">
<path d="M177 159.7l136 136c9.4 9.4 9.4 24.6 0 33.9l-22.6 22.6c-9.4 9.4-24.6 9.4-33.9 0L160 255.9l-96.4 96.4c-9.4 9.4-24.6 9.4-33.9 0L7 329.7c-9.4-9.4-9.4-24.6 0-33.9l136-136c9.4-9.5 24.6-9.5 34-.1z"></path>
</symbol>
<symbol id="icon-arrow-alt-circle-down" viewBox="0 0 512 512">
<path d="M504 256c0 137-111 248-248 248S8 393 8 256 119 8 256 8s248 111 248 248zM212 140v116h-70.9c-10.7 0-16.1 13-8.5 20.5l114.9 114.3c4.7 4.7 12.2 4.7 16.9 0l114.9-114.3c7.6-7.6 2.2-20.5-8.5-20.5H300V140c0-6.6-5.4-12-12-12h-64c-6.6 0-12 5.4-12 12z"></path>
</symbol>
<symbol id="icon-arrow-alt-circle-left" viewBox="0 0 512 512">
<path d="M256 504C119 504 8 393 8 256S119 8 256 8s248 111 248 248-111 248-248 248zm116-292H256v-70.9c0-10.7-13-16.1-20.5-8.5L121.2 247.5c-4.7 4.7-4.7 12.2 0 16.9l114.3 114.9c7.6 7.6 20.5 2.2 20.5-8.5V300h116c6.6 0 12-5.4 12-12v-64c0-6.6-5.4-12-12-12z"></path>
</symbol>
<symbol id="icon-arrow-alt-circle-right" viewBox="0 0 512 512">
<path d="M256 8c137 0 248 111 248 248S393 504 256 504 8 393 8 256 119 8 256 8zM140 300h116v70.9c0 10.7 13 16.1 20.5 8.5l114.3-114.9c4.7-4.7 4.7-12.2 0-16.9l-114.3-115c-7.6-7.6-20.5-2.2-20.5 8.5V212H140c-6.6 0-12 5.4-12 12v64c0 6.6 5.4 12 12 12z"></path>
</symbol>
<symbol id="icon-arrow-alt-circle-up" viewBox="0 0 512 512">
<path d="M8 256C8 119 119 8 256 8s248 111 248 248-111 248-248 248S8 393 8 256zm292 116V256h70.9c10.7 0 16.1-13 8.5-20.5L264.5 121.2c-4.7-4.7-12.2-4.7-16.9 0l-115 114.3c-7.6 7.6-2.2 20.5 8.5 20.5H212v116c0 6.6 5.4 12 12 12h64c6.6 0 12-5.4 12-12z"></path>
</symbol>
<symbol id="icon-arrow-circle-down" viewBox="0 0 512 512">
<path d="M504 256c0 137-111 248-248 248S8 393 8 256 119 8 256 8s248 111 248 248zm-143.6-28.9L288 302.6V120c0-13.3-10.7-24-24-24h-16c-13.3 0-24 10.7-24 24v182.6l-72.4-75.5c-9.3-9.7-24.8-9.9-34.3-.4l-10.9 11c-9.4 9.4-9.4 24.6 0 33.9L239 404.3c9.4 9.4 24.6 9.4 33.9 0l132.7-132.7c9.4-9.4 9.4-24.6 0-33.9l-10.9-11c-9.5-9.5-25-9.3-34.3.4z"></path>
</symbol>
<symbol id="icon-arrow-circle-left" viewBox="0 0 512 512">
<path d="M256 504C119 504 8 393 8 256S119 8 256 8s248 111 248 248-111 248-248 248zm28.9-143.6L209.4 288H392c13.3 0 24-10.7 24-24v-16c0-13.3-10.7-24-24-24H209.4l75.5-72.4c9.7-9.3 9.9-24.8.4-34.3l-11-10.9c-9.4-9.4-24.6-9.4-33.9 0L107.7 239c-9.4 9.4-9.4 24.6 0 33.9l132.7 132.7c9.4 9.4 24.6 9.4 33.9 0l11-10.9c9.5-9.5 9.3-25-.4-34.3z"></path>
</symbol>
<symbol id="icon-arrow-circle-right" viewBox="0 0 512 512">
<path d="M256 8c137 0 248 111 248 248S393 504 256 504 8 393 8 256 119 8 256 8zm-28.9 143.6l75.5 72.4H120c-13.3 0-24 10.7-24 24v16c0 13.3 10.7 24 24 24h182.6l-75.5 72.4c-9.7 9.3-9.9 24.8-.4 34.3l11 10.9c9.4 9.4 24.6 9.4 33.9 0L404.3 273c9.4-9.4 9.4-24.6 0-33.9L271.6 106.3c-9.4-9.4-24.6-9.4-33.9 0l-11 10.9c-9.5 9.6-9.3 25.1.4 34.4z"></path>
</symbol>
<symbol id="icon-arrow-circle-up" viewBox="0 0 512 512">
<path d="M8 256C8 119 119 8 256 8s248 111 248 248-111 248-248 248S8 393 8 256zm143.6 28.9l72.4-75.5V392c0 13.3 10.7 24 24 24h16c13.3 0 24-10.7 24-24V209.4l72.4 75.5c9.3 9.7 24.8 9.9 34.3.4l10.9-11c9.4-9.4 9.4-24.6 0-33.9L273 107.7c-9.4-9.4-24.6-9.4-33.9 0L106.3 240.4c-9.4 9.4-9.4 24.6 0 33.9l10.9 11c9.6 9.5 25.1 9.3 34.4-.4z"></path>
</symbol>
<symbol id="icon-arrow-down" viewBox="0 0 448 512">
<path d="M413.1 222.5l22.2 22.2c9.4 9.4 9.4 24.6 0 33.9L241 473c-9.4 9.4-24.6 9.4-33.9 0L12.7 278.6c-9.4-9.4-9.4-24.6 0-33.9l22.2-22.2c9.5-9.5 25-9.3 34.3.4L184 343.4V56c0-13.3 10.7-24 24-24h32c13.3 0 24 10.7 24 24v287.4l114.8-120.5c9.3-9.8 24.8-10 34.3-.4z"></path>
</symbol>
<symbol id="icon-arrow-left" viewBox="0 0 448 512">
<path d="M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z"></path>
</symbol>
<symbol id="icon-arrow-right" viewBox="0 0 448 512">
<path d="M190.5 66.9l22.2-22.2c9.4-9.4 24.6-9.4 33.9 0L441 239c9.4 9.4 9.4 24.6 0 33.9L246.6 467.3c-9.4 9.4-24.6 9.4-33.9 0l-22.2-22.2c-9.5-9.5-9.3-25 .4-34.3L311.4 296H24c-13.3 0-24-10.7-24-24v-32c0-13.3 10.7-24 24-24h287.4L190.9 101.2c-9.8-9.3-10-24.8-.4-34.3z"></path>
</symbol>
<symbol id="icon-arrow-up" viewBox="0 0 448 512">
<path d="M34.9 289.5l-22.2-22.2c-9.4-9.4-9.4-24.6 0-33.9L207 39c9.4-9.4 24.6-9.4 33.9 0l194.3 194.3c9.4 9.4 9.4 24.6 0 33.9L413 289.4c-9.5 9.5-25 9.3-34.3-.4L264 168.6V456c0 13.3-10.7 24-24 24h-32c-13.3 0-24-10.7-24-24V168.6L69.2 289.1c-9.3 9.8-24.8 10-34.3.4z"></path>
</symbol>
<symbol id="icon-arrows-alt" viewBox="0 0 512 512">
<path d="M352.201 425.775l-79.196 79.196c-9.373 9.373-24.568 9.373-33.941 0l-79.196-79.196c-15.119-15.119-4.411-40.971 16.971-40.97h51.162L228 284H127.196v51.162c0 21.382-25.851 32.09-40.971 16.971L7.029 272.937c-9.373-9.373-9.373-24.569 0-33.941L86.225 159.8c15.119-15.119 40.971-4.411 40.971 16.971V228H228V127.196h-51.23c-21.382 0-32.09-25.851-16.971-40.971l79.196-79.196c9.373-9.373 24.568-9.373 33.941 0l79.196 79.196c15.119 15.119 4.411 40.971-16.971 40.971h-51.162V228h100.804v-51.162c0-21.382 25.851-32.09 40.97-16.971l79.196 79.196c9.373 9.373 9.373 24.569 0 33.941L425.773 352.2c-15.119 15.119-40.971 4.411-40.97-16.971V284H284v100.804h51.23c21.382 0 32.09 25.851 16.971 40.971z"></path>
</symbol>
<symbol id="icon-arrows-alt-h" viewBox="0 0 512 512">
<path d="M377.941 169.941V216H134.059v-46.059c0-21.382-25.851-32.09-40.971-16.971L7.029 239.029c-9.373 9.373-9.373 24.568 0 33.941l86.059 86.059c15.119 15.119 40.971 4.411 40.971-16.971V296h243.882v46.059c0 21.382 25.851 32.09 40.971 16.971l86.059-86.059c9.373-9.373 9.373-24.568 0-33.941l-86.059-86.059c-15.119-15.12-40.971-4.412-40.971 16.97z"></path>
</symbol>
<symbol id="icon-arrows-alt-v" viewBox="0 0 256 512">
<path d="M214.059 377.941H168V134.059h46.059c21.382 0 32.09-25.851 16.971-40.971L144.971 7.029c-9.373-9.373-24.568-9.373-33.941 0L24.971 93.088c-15.119 15.119-4.411 40.971 16.971 40.971H88v243.882H41.941c-21.382 0-32.09 25.851-16.971 40.971l86.059 86.059c9.373 9.373 24.568 9.373 33.941 0l86.059-86.059c15.12-15.119 4.412-40.971-16.97-40.971z"></path>
</symbol>
<symbol id="icon-bars" viewBox="0 0 448 512">
<path d="M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"></path>
</symbol>
<symbol id="icon-bookmark" viewBox="0 0 384 512">
<path d="M0 512V48C0 21.49 21.49 0 48 0h288c26.51 0 48 21.49 48 48v464L192 400 0 512z"></path>
</symbol>
<symbol id="icon-caret-down" viewBox="0 0 320 512">
<path d="M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"></path>
</symbol>
<symbol id="icon-caret-right" viewBox="0 0 192 512">
<path d="M0 384.662V127.338c0-17.818 21.543-26.741 34.142-14.142l128.662 128.662c7.81 7.81 7.81 20.474 0 28.284L34.142 398.804C21.543 411.404 0 402.48 0 384.662z"></path>
</symbol>
<symbol id="icon-check" viewBox="0 0 512 512">
<path d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"></path>
</symbol>
<symbol id="icon-circle" viewBox="0 0 512 512">
<path d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z"></path>
</symbol>
<symbol id="icon-cog" viewBox="0 0 512 512">
<path d="M487.4 315.7l-42.6-24.6c4.3-23.2 4.3-47 0-70.2l42.6-24.6c4.9-2.8 7.1-8.6 5.5-14-11.1-35.6-30-67.8-54.7-94.6-3.8-4.1-10-5.1-14.8-2.3L380.8 110c-17.9-15.4-38.5-27.3-60.8-35.1V25.8c0-5.6-3.9-10.5-9.4-11.7-36.7-8.2-74.3-7.8-109.2 0-5.5 1.2-9.4 6.1-9.4 11.7V75c-22.2 7.9-42.8 19.8-60.8 35.1L88.7 85.5c-4.9-2.8-11-1.9-14.8 2.3-24.7 26.7-43.6 58.9-54.7 94.6-1.7 5.4.6 11.2 5.5 14L67.3 221c-4.3 23.2-4.3 47 0 70.2l-42.6 24.6c-4.9 2.8-7.1 8.6-5.5 14 11.1 35.6 30 67.8 54.7 94.6 3.8 4.1 10 5.1 14.8 2.3l42.6-24.6c17.9 15.4 38.5 27.3 60.8 35.1v49.2c0 5.6 3.9 10.5 9.4 11.7 36.7 8.2 74.3 7.8 109.2 0 5.5-1.2 9.4-6.1 9.4-11.7v-49.2c22.2-7.9 42.8-19.8 60.8-35.1l42.6 24.6c4.9 2.8 11 1.9 14.8-2.3 24.7-26.7 43.6-58.9 54.7-94.6 1.5-5.5-.7-11.3-5.6-14.1zM256 336c-44.1 0-80-35.9-80-80s35.9-80 80-80 80 35.9 80 80-35.9 80-80 80z"></path>
</symbol>
<symbol id="icon-database" viewBox="0 0 448 512">
<path d="M448 73.143v45.714C448 159.143 347.667 192 224 192S0 159.143 0 118.857V73.143C0 32.857 100.333 0 224 0s224 32.857 224 73.143zM448 176v102.857C448 319.143 347.667 352 224 352S0 319.143 0 278.857V176c48.125 33.143 136.208 48.572 224 48.572S399.874 209.143 448 176zm0 160v102.857C448 479.143 347.667 512 224 512S0 479.143 0 438.857V336c48.125 33.143 136.208 48.572 224 48.572S399.874 369.143 448 336z"></path>
</symbol>
<symbol id="icon-edit" viewBox="0 0 576 512">
<path d="M402.6 83.2l90.2 90.2c3.8 3.8 3.8 10 0 13.8L274.4 405.6l-92.8 10.3c-12.4 1.4-22.9-9.1-21.5-21.5l10.3-92.8L388.8 83.2c3.8-3.8 10-3.8 13.8 0zm162-22.9l-48.8-48.8c-15.2-15.2-39.9-15.2-55.2 0l-35.4 35.4c-3.8 3.8-3.8 10 0 13.8l90.2 90.2c3.8 3.8 10 3.8 13.8 0l35.4-35.4c15.2-15.3 15.2-40 0-55.2zM384 346.2V448H64V128h229.8c3.2 0 6.2-1.3 8.5-3.5l40-40c7.6-7.6 2.2-20.5-8.5-20.5H48C21.5 64 0 85.5 0 112v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V306.2c0-10.7-12.9-16-20.5-8.5l-40 40c-2.2 2.3-3.5 5.3-3.5 8.5z"></path>
</symbol>
<symbol id="icon-eye" viewBox="0 0 576 512">
<path d="M572.52 241.4C518.29 135.59 410.93 64 288 64S57.68 135.64 3.48 241.41a32.35 32.35 0 0 0 0 29.19C57.71 376.41 165.07 448 288 448s230.32-71.64 284.52-177.41a32.35 32.35 0 0 0 0-29.19zM288 400a144 144 0 1 1 144-144 143.93 143.93 0 0 1-144 144zm0-240a95.31 95.31 0 0 0-25.31 3.79 47.85 47.85 0 0 1-66.9 66.9A95.78 95.78 0 1 0 288 160z"></path>
</symbol>
<symbol id="icon-eye-slash" viewBox="0 0 640 512">
<path d="M320 400c-75.85 0-137.25-58.71-142.9-133.11L72.2 185.82c-13.79 17.3-26.48 35.59-36.72 55.59a32.35 32.35 0 0 0 0 29.19C89.71 376.41 197.07 448 320 448c26.91 0 52.87-4 77.89-10.46L346 397.39a144.13 144.13 0 0 1-26 2.61zm313.82 58.1l-110.55-85.44a331.25 331.25 0 0 0 81.25-102.07 32.35 32.35 0 0 0 0-29.19C550.29 135.59 442.93 64 320 64a308.15 308.15 0 0 0-147.32 37.7L45.46 3.37A16 16 0 0 0 23 6.18L3.37 31.45A16 16 0 0 0 6.18 53.9l588.36 454.73a16 16 0 0 0 22.46-2.81l19.64-25.27a16 16 0 0 0-2.82-22.45zm-183.72-142l-39.3-30.38A94.75 94.75 0 0 0 416 256a94.76 94.76 0 0 0-121.31-92.21A47.65 47.65 0 0 1 304 192a46.64 46.64 0 0 1-1.54 10l-73.61-56.89A142.31 142.31 0 0 1 320 112a143.92 143.92 0 0 1 144 144c0 21.63-5.29 41.79-13.9 60.11z"></path>
</symbol>
<symbol id="icon-gavel" viewBox="0 0 512 512">
<path d="M504.971 199.362l-22.627-22.627c-9.373-9.373-24.569-9.373-33.941 0l-5.657 5.657L329.608 69.255l5.657-5.657c9.373-9.373 9.373-24.569 0-33.941L312.638 7.029c-9.373-9.373-24.569-9.373-33.941 0L154.246 131.48c-9.373 9.373-9.373 24.569 0 33.941l22.627 22.627c9.373 9.373 24.569 9.373 33.941 0l5.657-5.657 39.598 39.598-81.04 81.04-5.657-5.657c-12.497-12.497-32.758-12.497-45.255 0L9.373 412.118c-12.497 12.497-12.497 32.758 0 45.255l45.255 45.255c12.497 12.497 32.758 12.497 45.255 0l114.745-114.745c12.497-12.497 12.497-32.758 0-45.255l-5.657-5.657 81.04-81.04 39.598 39.598-5.657 5.657c-9.373 9.373-9.373 24.569 0 33.941l22.627 22.627c9.373 9.373 24.569 9.373 33.941 0l124.451-124.451c9.372-9.372 9.372-24.568 0-33.941z"></path>
</symbol>
<symbol id="icon-globe" viewBox="0 0 496 512">
<path d="M336.5 160C322 70.7 287.8 8 248 8s-74 62.7-88.5 152h177zM152 256c0 22.2 1.2 43.5 3.3 64h185.3c2.1-20.5 3.3-41.8 3.3-64s-1.2-43.5-3.3-64H155.3c-2.1 20.5-3.3 41.8-3.3 64zm324.7-96c-28.6-67.9-86.5-120.4-158-141.6 24.4 33.8 41.2 84.7 50 141.6h108zM177.2 18.4C105.8 39.6 47.8 92.1 19.3 160h108c8.7-56.9 25.5-107.8 49.9-141.6zM487.4 192H372.7c2.1 21 3.3 42.5 3.3 64s-1.2 43-3.3 64h114.6c5.5-20.5 8.6-41.8 8.6-64s-3.1-43.5-8.5-64zM120 256c0-21.5 1.2-43 3.3-64H8.6C3.2 212.5 0 233.8 0 256s3.2 43.5 8.6 64h114.6c-2-21-3.2-42.5-3.2-64zm39.5 96c14.5 89.3 48.7 152 88.5 152s74-62.7 88.5-152h-177zm159.3 141.6c71.4-21.2 129.4-73.7 158-141.6h-108c-8.8 56.9-25.6 107.8-50 141.6zM19.3 352c28.6 67.9 86.5 120.4 158 141.6-24.4-33.8-41.2-84.7-50-141.6h-108z"></path>
</symbol>
<symbol id="icon-id-card" viewBox="0 0 576 512">
<path d="M528 32H48C21.5 32 0 53.5 0 80v16h576V80c0-26.5-21.5-48-48-48zM0 432c0 26.5 21.5 48 48 48h480c26.5 0 48-21.5 48-48V128H0v304zm352-232c0-4.4 3.6-8 8-8h144c4.4 0 8 3.6 8 8v16c0 4.4-3.6 8-8 8H360c-4.4 0-8-3.6-8-8v-16zm0 64c0-4.4 3.6-8 8-8h144c4.4 0 8 3.6 8 8v16c0 4.4-3.6 8-8 8H360c-4.4 0-8-3.6-8-8v-16zm0 64c0-4.4 3.6-8 8-8h144c4.4 0 8 3.6 8 8v16c0 4.4-3.6 8-8 8H360c-4.4 0-8-3.6-8-8v-16zM176 192c35.3 0 64 28.7 64 64s-28.7 64-64 64-64-28.7-64-64 28.7-64 64-64zM67.1 396.2C75.5 370.5 99.6 352 128 352h8.2c12.3 5.1 25.7 8 39.8 8s27.6-2.9 39.8-8h8.2c28.4 0 52.5 18.5 60.9 44.2 3.2 9.9-5.2 19.8-15.6 19.8H82.7c-10.4 0-18.8-10-15.6-19.8z"></path>
</symbol>
<symbol id="icon-id-card-alt" viewBox="0 0 576 512">
<path d="M528 64H384v96H192V64H48C21.5 64 0 85.5 0 112v352c0 26.5 21.5 48 48 48h480c26.5 0 48-21.5 48-48V112c0-26.5-21.5-48-48-48zM288 224c35.3 0 64 28.7 64 64s-28.7 64-64 64-64-28.7-64-64 28.7-64 64-64zm93.3 224H194.7c-10.4 0-18.8-10-15.6-19.8 8.3-25.6 32.4-44.2 60.9-44.2h8.2c12.3 5.1 25.7 8 39.8 8s27.6-2.9 39.8-8h8.2c28.4 0 52.5 18.5 60.9 44.2 3.2 9.8-5.2 19.8-15.6 19.8zM352 32c0-17.7-14.3-32-32-32h-64c-17.7 0-32 14.3-32 32v96h128V32z"></path>
</symbol>
<symbol id="icon-info" viewBox="0 0 192 512">
<path d="M20 424.229h20V279.771H20c-11.046 0-20-8.954-20-20V212c0-11.046 8.954-20 20-20h112c11.046 0 20 8.954 20 20v212.229h20c11.046 0 20 8.954 20 20V492c0 11.046-8.954 20-20 20H20c-11.046 0-20-8.954-20-20v-47.771c0-11.046 8.954-20 20-20zM96 0C56.235 0 24 32.235 24 72s32.235 72 72 72 72-32.235 72-72S135.764 0 96 0z"></path>
</symbol>
<symbol id="icon-info-circle" viewBox="0 0 512 512">
<path d="M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 110c23.196 0 42 18.804 42 42s-18.804 42-42 42-42-18.804-42-42 18.804-42 42-42zm56 254c0 6.627-5.373 12-12 12h-88c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h12v-64h-12c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h64c6.627 0 12 5.373 12 12v100h12c6.627 0 12 5.373 12 12v24z"></path>
</symbol>
<symbol id="icon-list-ul" viewBox="0 0 512 512">
<path d="M48 48a48 48 0 1 0 48 48 48 48 0 0 0-48-48zm0 160a48 48 0 1 0 48 48 48 48 0 0 0-48-48zm0 160a48 48 0 1 0 48 48 48 48 0 0 0-48-48zm448 16H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"></path>
</symbol>
<symbol id="icon-lock" viewBox="0 0 448 512">
<path d="M400 224h-24v-72C376 68.2 307.8 0 224 0S72 68.2 72 152v72H48c-26.5 0-48 21.5-48 48v192c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V272c0-26.5-21.5-48-48-48zm-104 0H152v-72c0-39.7 32.3-72 72-72s72 32.3 72 72v72z"></path>
</symbol>
<symbol id="icon-lock-open" viewBox="0 0 576 512">
<path d="M423.5 0C339.5.3 272 69.5 272 153.5V224H48c-26.5 0-48 21.5-48 48v192c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V272c0-26.5-21.5-48-48-48h-48v-71.1c0-39.6 31.7-72.5 71.3-72.9 40-.4 72.7 32.1 72.7 72v80c0 13.3 10.7 24 24 24h32c13.3 0 24-10.7 24-24v-80C576 68 507.5-.3 423.5 0z"></path>
</symbol>
<symbol id="icon-minus" viewBox="0 0 448 512">
<path d="M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"></path>
</symbol>
<symbol id="icon-minus-circle" viewBox="0 0 512 512">
<path d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zM124 296c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h264c6.6 0 12 5.4 12 12v56c0 6.6-5.4 12-12 12H124z"></path>
</symbol>
<symbol id="icon-minus-square" viewBox="0 0 448 512">
<path d="M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zM92 296c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h264c6.6 0 12 5.4 12 12v56c0 6.6-5.4 12-12 12H92z"></path>
</symbol>
<symbol id="icon-paper-plane" viewBox="0 0 512 512">
<path d="M476 3.2L12.5 270.6c-18.1 10.4-15.8 35.6 2.2 43.2L121 358.4l287.3-253.2c5.5-4.9 13.3 2.6 8.6 8.3L176 407v80.5c0 23.6 28.5 32.9 42.5 15.8L282 426l124.6 52.2c14.2 6 30.4-2.9 33-18.2l72-432C515 7.8 493.3-6.8 476 3.2z"></path>
</symbol>
<symbol id="icon-paperclip" viewBox="0 0 448 512">
<path d="M43.246 466.142c-58.43-60.289-57.341-157.511 1.386-217.581L254.392 34c44.316-45.332 116.351-45.336 160.671 0 43.89 44.894 43.943 117.329 0 162.276L232.214 383.128c-29.855 30.537-78.633 30.111-107.982-.998-28.275-29.97-27.368-77.473 1.452-106.953l143.743-146.835c6.182-6.314 16.312-6.422 22.626-.241l22.861 22.379c6.315 6.182 6.422 16.312.241 22.626L171.427 319.927c-4.932 5.045-5.236 13.428-.648 18.292 4.372 4.634 11.245 4.711 15.688.165l182.849-186.851c19.613-20.062 19.613-52.725-.011-72.798-19.189-19.627-49.957-19.637-69.154 0L90.39 293.295c-34.763 35.56-35.299 93.12-1.191 128.313 34.01 35.093 88.985 35.137 123.058.286l172.06-175.999c6.177-6.319 16.307-6.433 22.626-.256l22.877 22.364c6.319 6.177 6.434 16.307.256 22.626l-172.06 175.998c-59.576 60.938-155.943 60.216-214.77-.485z"></path>
</symbol>
<symbol id="icon-pencil-alt" viewBox="0 0 512 512">
<path d="M497.9 142.1l-46.1 46.1c-4.7 4.7-12.3 4.7-17 0l-111-111c-4.7-4.7-4.7-12.3 0-17l46.1-46.1c18.7-18.7 49.1-18.7 67.9 0l60.1 60.1c18.8 18.7 18.8 49.1 0 67.9zM284.2 99.8L21.6 362.4.4 483.9c-2.9 16.4 11.4 30.6 27.8 27.8l121.5-21.3 262.6-262.6c4.7-4.7 4.7-12.3 0-17l-111-111c-4.8-4.7-12.4-4.7-17.1 0zM124.1 339.9c-5.5-5.5-5.5-14.3 0-19.8l154-154c5.5-5.5 14.3-5.5 19.8 0s5.5 14.3 0 19.8l-154 154c-5.5 5.5-14.3 5.5-19.8 0zM88 424h48v36.3l-64.5 11.3-31.1-31.1L51.7 376H88v48z"></path>
</symbol>
<symbol id="icon-phone" viewBox="0 0 512 512">
<path d="M493.4 24.6l-104-24c-11.3-2.6-22.9 3.3-27.5 13.9l-48 112c-4.2 9.8-1.4 21.3 6.9 28l60.6 49.6c-36 76.7-98.9 140.5-177.2 177.2l-49.6-60.6c-6.8-8.3-18.2-11.1-28-6.9l-112 48C3.9 366.5-2 378.1.6 389.4l24 104C27.1 504.2 36.7 512 48 512c256.1 0 464-207.5 464-464 0-11.2-7.7-20.9-18.6-23.4z"></path>
</symbol>
<symbol id="icon-plus" viewBox="0 0 448 512">
<path d="M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"></path>
</symbol>
<symbol id="icon-plus-circle" viewBox="0 0 512 512">
<path d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm144 276c0 6.6-5.4 12-12 12h-92v92c0 6.6-5.4 12-12 12h-56c-6.6 0-12-5.4-12-12v-92h-92c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h92v-92c0-6.6 5.4-12 12-12h56c6.6 0 12 5.4 12 12v92h92c6.6 0 12 5.4 12 12v56z"></path>
</symbol>
<symbol id="icon-plus-square" viewBox="0 0 448 512">
<path d="M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm-32 252c0 6.6-5.4 12-12 12h-92v92c0 6.6-5.4 12-12 12h-56c-6.6 0-12-5.4-12-12v-92H92c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h92v-92c0-6.6 5.4-12 12-12h56c6.6 0 12 5.4 12 12v92h92c6.6 0 12 5.4 12 12v56z"></path>
</symbol>
<symbol id="icon-save" viewBox="0 0 448 512">
<path d="M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM224 416c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64s64 28.654 64 64c0 35.346-28.654 64-64 64zm96-304.52V212c0 6.627-5.373 12-12 12H76c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h228.52c3.183 0 6.235 1.264 8.485 3.515l3.48 3.48A11.996 11.996 0 0 1 320 111.48z"></path>
</symbol>
<symbol id="icon-sign-out-alt" viewBox="0 0 512 512">
<path d="M497 273L329 441c-15 15-41 4.5-41-17v-96H152c-13.3 0-24-10.7-24-24v-96c0-13.3 10.7-24 24-24h136V88c0-21.4 25.9-32 41-17l168 168c9.3 9.4 9.3 24.6 0 34zM192 436v-40c0-6.6-5.4-12-12-12H96c-17.7 0-32-14.3-32-32V160c0-17.7 14.3-32 32-32h84c6.6 0 12-5.4 12-12V76c0-6.6-5.4-12-12-12H96c-53 0-96 43-96 96v192c0 53 43 96 96 96h84c6.6 0 12-5.4 12-12z"></path>
</symbol>
<symbol id="icon-smile" viewBox="0 0 496 512">
<path d="M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm80 168c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm-160 0c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm194.8 170.2C334.3 380.4 292.5 400 248 400s-86.3-19.6-114.8-53.8c-13.6-16.3 11-36.7 24.6-20.5 22.4 26.9 55.2 42.2 90.2 42.2s67.8-15.4 90.2-42.2c13.4-16.2 38.1 4.2 24.6 20.5z"></path>
</symbol>
<symbol id="icon-snowflake" viewBox="0 0 448 512">
<path d="M440.3 345.2l-33.8-19.5 26-7c8.2-2.2 13.1-10.7 10.9-18.9l-4-14.9c-2.2-8.2-10.7-13.1-18.9-10.9l-70.8 19-63.9-37 63.8-36.9 70.8 19c8.2 2.2 16.7-2.7 18.9-10.9l4-14.9c2.2-8.2-2.7-16.7-10.9-18.9l-26-7 33.8-19.5c7.4-4.3 9.9-13.7 5.7-21.1L430.4 119c-4.3-7.4-13.7-9.9-21.1-5.7l-33.8 19.5 7-26c2.2-8.2-2.7-16.7-10.9-18.9l-14.9-4c-8.2-2.2-16.7 2.7-18.9 10.9l-19 70.8-62.8 36.2v-77.5l53.7-53.7c6.2-6.2 6.2-16.4 0-22.6l-11.3-11.3c-6.2-6.2-16.4-6.2-22.6 0L256 56.4V16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v40.4l-19.7-19.7c-6.2-6.2-16.4-6.2-22.6 0L138.3 48c-6.3 6.2-6.3 16.4 0 22.6l53.7 53.7v77.5l-62.8-36.2-19-70.8c-2.2-8.2-10.7-13.1-18.9-10.9l-14.9 4c-8.2 2.2-13.1 10.7-10.9 18.9l7 26-33.8-19.5c-7.4-4.3-16.8-1.7-21.1 5.7L2.1 145.7c-4.3 7.4-1.7 16.8 5.7 21.1l33.8 19.5-26 7c-8.3 2.2-13.2 10.7-11 19l4 14.9c2.2 8.2 10.7 13.1 18.9 10.9l70.8-19 63.8 36.9-63.8 36.9-70.8-19c-8.2-2.2-16.7 2.7-18.9 10.9l-4 14.9c-2.2 8.2 2.7 16.7 10.9 18.9l26 7-33.8 19.6c-7.4 4.3-9.9 13.7-5.7 21.1l15.5 26.8c4.3 7.4 13.7 9.9 21.1 5.7l33.8-19.5-7 26c-2.2 8.2 2.7 16.7 10.9 18.9l14.9 4c8.2 2.2 16.7-2.7 18.9-10.9l19-70.8 62.8-36.2v77.5l-53.7 53.7c-6.3 6.2-6.3 16.4 0 22.6l11.3 11.3c6.2 6.2 16.4 6.2 22.6 0l19.7-19.7V496c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-40.4l19.7 19.7c6.2 6.2 16.4 6.2 22.6 0l11.3-11.3c6.2-6.2 6.2-16.4 0-22.6L256 387.7v-77.5l62.8 36.2 19 70.8c2.2 8.2 10.7 13.1 18.9 10.9l14.9-4c8.2-2.2 13.1-10.7 10.9-18.9l-7-26 33.8 19.5c7.4 4.3 16.8 1.7 21.1-5.7l15.5-26.8c4.3-7.3 1.8-16.8-5.6-21z"></path>
</symbol>
<symbol id="icon-spinner" viewBox="0 0 512 512">
<path d="M304 48c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-48 368c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm208-208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zM96 256c0-26.51-21.49-48-48-48S0 229.49 0 256s21.49 48 48 48 48-21.49 48-48zm12.922 99.078c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.491-48-48-48zm294.156 0c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.49-48-48-48zM108.922 60.922c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.491-48-48-48z"></path>
</symbol>
<symbol id="icon-sync" viewBox="0 0 512 512">
<path d="M440.65 12.57l4 82.77A247.16 247.16 0 0 0 255.83 8C134.73 8 33.91 94.92 12.29 209.82A12 12 0 0 0 24.09 224h49.05a12 12 0 0 0 11.67-9.26 175.91 175.91 0 0 1 317-56.94l-101.46-4.86a12 12 0 0 0-12.57 12v47.41a12 12 0 0 0 12 12H500a12 12 0 0 0 12-12V12a12 12 0 0 0-12-12h-47.37a12 12 0 0 0-11.98 12.57zM255.83 432a175.61 175.61 0 0 1-146-77.8l101.8 4.87a12 12 0 0 0 12.57-12v-47.4a12 12 0 0 0-12-12H12a12 12 0 0 0-12 12V500a12 12 0 0 0 12 12h47.35a12 12 0 0 0 12-12.6l-4.15-82.57A247.17 247.17 0 0 0 255.83 504c121.11 0 221.93-86.92 243.55-201.82a12 12 0 0 0-11.8-14.18h-49.05a12 12 0 0 0-11.67 9.26A175.86 175.86 0 0 1 255.83 432z"></path>
</symbol>
<symbol id="icon-times" viewBox="0 0 352 512">
<path d="M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"></path>
</symbol>
<symbol id="icon-times-circle" viewBox="0 0 512 512">
<path d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm121.6 313.1c4.7 4.7 4.7 12.3 0 17L338 377.6c-4.7 4.7-12.3 4.7-17 0L256 312l-65.1 65.6c-4.7 4.7-12.3 4.7-17 0L134.4 338c-4.7-4.7-4.7-12.3 0-17l65.6-65-65.6-65.1c-4.7-4.7-4.7-12.3 0-17l39.6-39.6c4.7-4.7 12.3-4.7 17 0l65 65.7 65.1-65.6c4.7-4.7 12.3-4.7 17 0l39.6 39.6c4.7 4.7 4.7 12.3 0 17L312 256l65.6 65.1z"></path>
</symbol>
<symbol id="icon-trash" viewBox="0 0 448 512">
<path d="M432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16zM53.2 467a48 48 0 0 0 47.9 45h245.8a48 48 0 0 0 47.9-45L416 128H32z"></path>
</symbol>
<symbol id="icon-trash-alt" viewBox="0 0 448 512">
<path d="M32 464a48 48 0 0 0 48 48h288a48 48 0 0 0 48-48V128H32zm272-256a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zM432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16z"></path>
</symbol>
<symbol id="icon-unlock" viewBox="0 0 448 512">
<path d="M400 256H152V152.9c0-39.6 31.7-72.5 71.3-72.9 40-.4 72.7 32.1 72.7 72v16c0 13.3 10.7 24 24 24h32c13.3 0 24-10.7 24-24v-16C376 68 307.5-.3 223.5 0 139.5.3 72 69.5 72 153.5V256H48c-26.5 0-48 21.5-48 48v160c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V304c0-26.5-21.5-48-48-48z"></path>
</symbol>
<symbol id="icon-user" viewBox="0 0 448 512">
<path d="M224 256c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm89.6 32h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48v-41.6c0-74.2-60.2-134.4-134.4-134.4z"></path>
</symbol>
<symbol id="icon-user-cog" viewBox="0 0 640 512">
<path d="M610.5 373.3c2.6-14.1 2.6-28.5 0-42.6l25.8-14.9c3-1.7 4.3-5.2 3.3-8.5-6.7-21.6-18.2-41.2-33.2-57.4-2.3-2.5-6-3.1-9-1.4l-25.8 14.9c-10.9-9.3-23.4-16.5-36.9-21.3v-29.8c0-3.4-2.4-6.4-5.7-7.1-22.3-5-45-4.8-66.2 0-3.3.7-5.7 3.7-5.7 7.1v29.8c-13.5 4.8-26 12-36.9 21.3l-25.8-14.9c-2.9-1.7-6.7-1.1-9 1.4-15 16.2-26.5 35.8-33.2 57.4-1 3.3.4 6.8 3.3 8.5l25.8 14.9c-2.6 14.1-2.6 28.5 0 42.6l-25.8 14.9c-3 1.7-4.3 5.2-3.3 8.5 6.7 21.6 18.2 41.1 33.2 57.4 2.3 2.5 6 3.1 9 1.4l25.8-14.9c10.9 9.3 23.4 16.5 36.9 21.3v29.8c0 3.4 2.4 6.4 5.7 7.1 22.3 5 45 4.8 66.2 0 3.3-.7 5.7-3.7 5.7-7.1v-29.8c13.5-4.8 26-12 36.9-21.3l25.8 14.9c2.9 1.7 6.7 1.1 9-1.4 15-16.2 26.5-35.8 33.2-57.4 1-3.3-.4-6.8-3.3-8.5l-25.8-14.9zM496 400.5c-26.8 0-48.5-21.8-48.5-48.5s21.8-48.5 48.5-48.5 48.5 21.8 48.5 48.5-21.7 48.5-48.5 48.5zM224 256c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm201.2 226.5c-2.3-1.2-4.6-2.6-6.8-3.9l-7.9 4.6c-6 3.4-12.8 5.3-19.6 5.3-10.9 0-21.4-4.6-28.9-12.6-18.3-19.8-32.3-43.9-40.2-69.6-5.5-17.7 1.9-36.4 17.9-45.7l7.9-4.6c-.1-2.6-.1-5.2 0-7.8l-7.9-4.6c-16-9.2-23.4-28-17.9-45.7.9-2.9 2.2-5.8 3.2-8.7-3.8-.3-7.5-1.2-11.4-1.2h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c10.1 0 19.5-3.2 27.2-8.5-1.2-3.8-2-7.7-2-11.8v-9.2z"></path>
</symbol>
<symbol id="icon-user-plus" viewBox="0 0 640 512">
<path d="M624 208h-64v-64c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v64h-64c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h64v64c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-64h64c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm-400 48c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm89.6 32h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48v-41.6c0-74.2-60.2-134.4-134.4-134.4z"></path>
</symbol>
<symbol id="icon-user-secret" viewBox="0 0 448 512">
<path d="M383.9 308.3l23.9-62.6c4-10.5-3.7-21.7-15-21.7h-58.5c11-18.9 17.8-40.6 17.8-64v-.3c39.2-7.8 64-19.1 64-31.7 0-13.3-27.3-25.1-70.1-33-9.2-32.8-27-65.8-40.6-82.8-9.5-11.9-25.9-15.6-39.5-8.8l-27.6 13.8c-9 4.5-19.6 4.5-28.6 0L182.1 3.4c-13.6-6.8-30-3.1-39.5 8.8-13.5 17-31.4 50-40.6 82.8-42.7 7.9-70 19.7-70 33 0 12.6 24.8 23.9 64 31.7v.3c0 23.4 6.8 45.1 17.8 64H56.3c-11.5 0-19.2 11.7-14.7 22.3l25.8 60.2C27.3 329.8 0 372.7 0 422.4v44.8C0 491.9 20.1 512 44.8 512h358.4c24.7 0 44.8-20.1 44.8-44.8v-44.8c0-48.4-25.8-90.4-64.1-114.1zM176 480l-41.6-192 49.6 32 24 40-32 120zm96 0l-32-120 24-40 49.6-32L272 480zm41.7-298.5c-3.9 11.9-7 24.6-16.5 33.4-10.1 9.3-48 22.4-64-25-2.8-8.4-15.4-8.4-18.3 0-17 50.2-56 32.4-64 25-9.5-8.8-12.7-21.5-16.5-33.4-.8-2.5-6.3-5.7-6.3-5.8v-10.8c28.3 3.6 61 5.8 96 5.8s67.7-2.1 96-5.8v10.8c-.1.1-5.6 3.2-6.4 5.8z"></path>
</symbol>
<symbol id="icon-users" viewBox="0 0 640 512">
<path d="M96 224c35.3 0 64-28.7 64-64s-28.7-64-64-64-64 28.7-64 64 28.7 64 64 64zm448 0c35.3 0 64-28.7 64-64s-28.7-64-64-64-64 28.7-64 64 28.7 64 64 64zm32 32h-64c-17.6 0-33.5 7.1-45.1 18.6 40.3 22.1 68.9 62 75.1 109.4h66c17.7 0 32-14.3 32-32v-32c0-35.3-28.7-64-64-64zm-256 0c61.9 0 112-50.1 112-112S381.9 32 320 32 208 82.1 208 144s50.1 112 112 112zm76.8 32h-8.3c-20.8 10-43.9 16-68.5 16s-47.6-6-68.5-16h-8.3C179.6 288 128 339.6 128 403.2V432c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48v-28.8c0-63.6-51.6-115.2-115.2-115.2zm-223.7-13.4C161.5 263.1 145.6 256 128 256H64c-35.3 0-64 28.7-64 64v32c0 17.7 14.3 32 32 32h65.9c6.3-47.4 34.9-87.3 75.2-109.4z"></path>
</symbol>
<symbol id="icon-wrench" viewBox="0 0 512 512">
<path d="M507.73 109.1c-2.24-9.03-13.54-12.09-20.12-5.51l-74.36 74.36-67.88-11.31-11.31-67.88 74.36-74.36c6.62-6.62 3.43-17.9-5.66-20.16-47.38-11.74-99.55.91-136.58 37.93-39.64 39.64-50.55 97.1-34.05 147.2L18.74 402.76c-24.99 24.99-24.99 65.51 0 90.5 24.99 24.99 65.51 24.99 90.5 0l213.21-213.21c50.12 16.71 107.47 5.68 147.37-34.22 37.07-37.07 49.7-89.32 37.91-136.73zM64 472c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24z"></path>
</symbol>
</svg>
2022-01-03 11:54:10 +01:00
`}});var gx=n(1513),px={};px.styleTagTransform=vg(),px.setAttributes=fg(),px.insert=ug().bind(null,"head"),px.domAPI=lg(),px.insertStyleElement=gg(),ag()(gx.Z,px),gx.Z&&gx.Z.locals&&gx.Z.locals;class vx extends ig{render(){return(()=>{const e=jl.settings.get("singleton")?["converse-singleton"]:[];return e.push(`converse-${jl.settings.get("view_mode")}`),el`
<converse-chats class="converse-chatboxes row no-gutters ${e.join(" ")}"></converse-chats>
2021-11-11 22:06:49 +01:00
<div id="converse-modals" class="modals"></div>
<converse-fontawesome></converse-fontawesome>
2022-01-03 11:54:10 +01:00
`})()}initialize(){this.setAttribute("id","conversejs"),this.setClasses();const e=va();this.listenTo(e,"change:view_mode",(()=>this.setClasses())),this.listenTo(e,"change:singleton",(()=>this.setClasses()))}setClasses(){this.className="",this.classList.add("conversejs"),this.classList.add(`converse-${jl.settings.get("view_mode")}`),this.classList.add(`theme-${jl.settings.get("theme")}`),this.requestUpdate()}}function yx(){if(!jl.settings.get("auto_insert"))return;const e=jl.settings.get("root");if(!e.querySelector("converse-root")){const t=document.createElement("converse-root"),n=e.querySelector("body");n?n.appendChild(t):e.appendChild(t)}}$l.plugins.add("converse-rootview",{initialize(){jl.settings.extend({auto_insert:!0}),jl.listen.on("chatBoxesInitialized",yx),jl.elements.define("converse-root",vx)}});const{Strophe:bx}=$l.env,_x=$l.env.utils,wx=ap.extend({id:"add-contact-modal",events:{"submit form":"addContactFromForm"},initialize(){ap.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change",this.render)},toHTML(){const e=jl.settings.get("xhr_user_search_url")?Eh("Contact name"):Eh("Optional nickname");return(e=>{const t=Eh("name@example.org"),n=Eh("Add"),s=Eh("Please enter a valid XMPP address"),i=Eh("Add a Contact"),r=Eh("XMPP Address"),o=Eh("Nickname");return el`
2021-03-19 19:26:15 +01:00
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="addContactModalLabel">${i}</h5>
2022-01-03 11:54:10 +01:00
${lp}
2021-03-19 19:26:15 +01:00
</div>
<form class="converse-form add-xmpp-contact">
<div class="modal-body">
<span class="modal-alert"></span>
<div class="form-group add-xmpp-contact__jid">
2021-11-11 22:06:49 +01:00
<label class="clearfix" for="jid">${r}:</label>
2021-03-19 19:26:15 +01:00
<div class="suggestion-box suggestion-box__jid">
<ul class="suggestion-box__results suggestion-box__results--above" hidden=""></ul>
2022-01-03 11:54:10 +01:00
<input type="text" name="jid" ?required=${!jl.settings.get("xhr_user_search_url")}
2021-03-19 19:26:15 +01:00
value="${e.jid||""}"
class="form-control suggestion-box__input"
placeholder="${t}"/>
<span class="suggestion-box__additions visually-hidden" role="status" aria-live="assertive" aria-relevant="additions"></span>
</div>
</div>
<div class="form-group add-xmpp-contact__name">
<label class="clearfix" for="name">${o}:</label>
<div class="suggestion-box suggestion-box__name">
<ul class="suggestion-box__results suggestion-box__results--above" hidden=""></ul>
<input type="text" name="name" value="${e.nickname||""}"
class="form-control suggestion-box__input"
placeholder="${o}"/>
<span class="suggestion-box__additions visually-hidden" role="status" aria-live="assertive" aria-relevant="additions"></span>
</div>
</div>
<div class="form-group">
2021-11-11 22:06:49 +01:00
<div class="invalid-feedback">${s}</div>
2021-03-19 19:26:15 +01:00
</div>
<button type="submit" class="btn btn-primary">${n}</button>
</div>
</form>
</div>
</div>
2022-01-03 11:54:10 +01:00
`})(Object.assign(this.model.toJSON(),{_converse:wa,label_nickname:e}))},afterRender(){"string"==typeof jl.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(!jl.settings.get("autocomplete_add_contact"))return;const e=this.el.querySelector(".suggestion-box__jid").parentElement;this.jid_auto_complete=new wa.AutoComplete(e,{data:(e,t)=>`${t.slice(0,t.indexOf("@"))}@${e}`,filter:wa.FILTER_STARTSWITH,list:[...new Set(wa.roster.map((e=>bx.getDomainFromJid(e.get("jid")))))]})},initXHRAutoComplete(){if(!jl.settings.get("autocomplete_add_contact"))return this.initXHRFetch();const e=this.el.querySelector(".suggestion-box__name").parentElement;this.name_auto_complete=new wa.AutoComplete(e,{auto_evaluate:!1,filter:wa.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",gc((()=>{t.open("GET",`${jl.settings.get("xhr_user_search_url")}q=${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=Eh("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"),s=t[0].label;this.afterSubmission(e,n,s)}}}},validateSubmission(e){const t=this.el.querySelector(".invalid-feedback");return!e||$o(e.split("@")).length<2?(_x.addClass("is-invalid",this.el.querySelector('input[name="jid"]')),_x.addClass("d-block",t),!1):wa.roster.get(bx.getBareJidFromJid(e))?(t.textContent=Eh("This contact has already been added"),_x.addClass("d-block",t),!1):(_x.removeClass("d-block",t),!0)},afterSubmission(e,t,n){wa.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 jl.settings.get("xhr_user_search_url")){const e=this.el.querySelector('input[name="name"]');return this.xhr.open("GET",`${jl.settings.get("xhr_user_search_url")}q=${encodeURIComponent(e.value)}`,!0),void this.xhr.send()}this.validateSubmission(n)&&this.afterSubmission(e.target,n,t.get("name"))}});function Sx(e){var t,n;null===(t=wa.roster)||void 0===t||null===(n=t.findWhere({jid:e.get("jid")}))||void 0===n||n.trigger("highlight")}function xx(e,t){const n=wa.roster_filter,s=n.get("filter_type"),i="state"===s?n.get("chat_state").toLowerCase():n.get("filter_text").toLowerCase();return!!i&&("state"===s?![wa.HEADER_REQUESTING_CONTACTS,wa.HEADER_UNREAD].includes(t)&&("unread_messages"===i?0===e.get("num_unread"):"online"===i?["offline","unavailable"].includes(e.presence.get("show")):!e.presence.get("show").includes(i)):"contacts"===s?!e.getFilterCriteria().includes(i):void 0)}function Ex(e){const t=wa.roster_filter;if("groups"===t.get("filter_type")){var n;const s=null===(n=t.get("filter_text"))||void 0===n?void 0:n.toLowerCase();if(!s)return!0;if(!e.toLowerCase().includes(s))return!1}return!0}wa.AddContactModal=wx;const{u:Ax}=$l.env;function Cx(e){const t=e.get("jid"),n=[];if(sa()){const e=wa.chatboxes.get(t);e&&!e.get("hidden")&&n.push("open")}const s=e.get("ask"),i=e.get("requesting"),r=e.get("subscription");return"subscribe"===s||"from"===r?n.push("pending-xmpp-contact"):!0===i?n.push("requesting-xmpp-contact"):(
2021-11-11 22:06:49 +01:00
<li class="list-item d-flex controlbox-padded ${n.join(" ")}" data-status="${e.presence.get("show")}">
<converse-roster-contact .model=${e}></converse-roster-contact>
2022-01-03 11:54:10 +01:00
</li>`}const Tx=e=>{const t=Eh("Contacts"),n=Eh("Add a contact"),s=Eh("Re-sync your contacts"),i=(wa.roster||[]).reduce(((e,t)=>function(e,t){if("subscribe"===t.get("ask")){const n=wa.HEADER_PENDING_CONTACTS;e[n]?e[n].push(t):e[n]=[t]}else if(t.get("requesting")){const n=wa.HEADER_REQUESTING_CONTACTS;e[n]?e[n].push(t):e[n]=[t]}else{let n;jl.settings.get("roster_groups")?(n=t.get("groups"),n=0===n.length?[wa.HEADER_UNGROUPED]:n):n=[wa.HEADER_CURRENT_CONTACTS];for(const s of n)e[s]?e[s].push(t):e[s]=[t]}if(t.get("num_unread")){const n=wa.HEADER_UNREAD;e[n]?e[n].push(t):e[n]=[t]}return e}(e,t)),{}),r=Object.keys(i).filter(Ex);return r.sort(lm),el`
2021-11-11 22:06:49 +01:00
<div class="d-flex controlbox-padded">
<span class="w-100 controlbox-heading controlbox-heading--contacts">${t}</span>
<a class="controlbox-heading__btn sync-contacts" @click=${t=>e.syncContacts(t)} title="${s}">
<converse-icon class="fa fa-sync right ${e.syncing_contacts?"fa-spin":""}" color="var(--subdued-color)" path-prefix="/dist" size="1em"></converse-icon>
</a>
2022-01-03 11:54:10 +01:00
${jl.settings.get("allow_contact_requests")?el`
2021-11-11 22:06:49 +01:00
<a class="controlbox-heading__btn add-contact"
@click=${t=>e.showAddContactModal(t)}
title="${n}"
data-toggle="modal"
data-target="#add-contact-modal">
<converse-icon class="fa fa-user-plus right" color="var(--subdued-color)" path-prefix="/dist" size="1.25em"></converse-icon>
</a>`:""}
2021-03-19 19:26:15 +01:00
</div>
2021-11-11 22:06:49 +01:00
<converse-roster-filter></converse-roster-filter>
<div class="list-container roster-contacts">
2022-01-03 11:54:10 +01:00
${Wg(r,(e=>e),(e=>{const t=i[e].filter((t=>function(e,t){const n=e.presence.get("show");return jl.settings.get("hide_offline_users")&&"offline"===n?("subscribe"===e.get("ask")||"from"===e.get("subscription")||!0===e.get("requesting"))&&!xx(e,t):!xx(e,t)}(t,e)));return t.sort(cm),t.length?(e=>{const t=Eh("Click to hide these contacts"),n=wa.roster.state.get("collapsed_groups");return el`
2021-11-11 22:06:49 +01:00
<div class="roster-group" data-group="${e.name}">
2022-01-03 11:54:10 +01:00
<a href="#" class="list-toggle group-toggle controlbox-padded" title="${t}" @click=${t=>function(e,t){var n;null==e||null===(n=e.preventDefault)||void 0===n||n.call(e);const s=wa.roster.state.get("collapsed_groups");s.includes(t)?wa.roster.state.save("collapsed_groups",s.filter((e=>e!==t))):wa.roster.state.save("collapsed_groups",[...s,t])}(t,e.name)}>
2021-11-11 22:06:49 +01:00
<converse-icon color="var(--chat-head-color)" size="1em" class="fa ${n.includes(e.name)?"fa-caret-right":"fa-caret-down"}"></converse-icon> ${e.name}
</a>
<ul class="items-list roster-group-contacts ${n.includes(e.name)?"collapsed":""}" data-group="${e.name}">
2022-01-03 11:54:10 +01:00
${e.contacts.map(Cx)}
2021-11-11 22:06:49 +01:00
</ul>
</div>`})({contacts:t,name:e}):""}))}
</div>
2022-01-03 11:54:10 +01:00
`};jl.elements.define("converse-roster",class extends ig{async initialize(){await jl.waitUntil("rosterInitialized"),this.listenTo(wa,"rosterContactsFetched",this.requestUpdate),this.listenTo(wa.presences,"change:show",this.requestUpdate),this.listenTo(wa.roster,"add",this.requestUpdate),this.listenTo(wa.roster,"destroy",this.requestUpdate),this.listenTo(wa.roster,"remove",this.requestUpdate),this.listenTo(wa.roster,"change",this.requestUpdate),this.listenTo(wa.roster.state,"change",this.requestUpdate),jl.trigger("rosterViewInitialized")}firstUpdated(){this.listenToRosterFilter()}render(){return Tx(this)}listenToRosterFilter(){this.filter_view=this.querySelector("converse-roster-filter"),this.filter_view.addEventListener("update",(()=>this.requestUpdate()))}showAddContactModal(e){jl.modal.show(wa.AddContactModal,{model:new Xo},e)}async syncContacts(e){e.preventDefault(),this.syncing_contacts=!0,this.requestUpdate(),wa.roster.data.save("version",null),await wa.roster.fetchFromServer(),jl.user.presence.send(),this.syncing_contacts=!1,this.requestUpdate()}});const kx=e=>el`<span class="pending-contact-name" title="JID: ${e.jid}">${e.display_name}</span>`,jx=e=>el`<span class="req-contact-name w-100" title="JID: ${e.jid}">${e.display_name}</span>`,Nx={dnd:Eh("This contact is busy"),online:Eh("This contact is online"),offline:Eh("This contact is offline"),unavailable:Eh("This contact is unavailable"),xa:Eh("This contact is away for an extended period"),away:Eh("This contact is away")},Ox=$l.env.utils;class $x extends ig{static get properties(){return{model:{type:Object}}}connectedCallback(){super.connectedCallback(),this.listenTo(this.model,"change",this.requestUpdate),this.listenTo(this.model,"highlight",this.requestUpdate),this.listenTo(this.model,"vcard:change",this.requestUpdate)}render(){const e=this.model.get("ask"),t=this.model.get("requesting"),n=this.model.get("subscription"),s=this.model.get("jid");if("subscribe"===e||"from"===n){const e=this.model.getDisplayName();return(e=>{const t=Eh("Click to remove %1$s as a contact",e.display_name);return el`
${jl.settings.get("allow_chat_pending_contacts")?el`<a class="list-item-link open-chat w-100" href="#" @click=${e.openChat}>${kx(e)}</a>`:kx(e)}
<a class="list-item-action remove-xmpp-contact far fa-trash-alt" @click=${e.removeContact} title="${t}" href="#"></a>`})(Object.assign(this.model.toJSON(),{display_name:e,openChat:e=>this.openChat(e),removeContact:e=>this.removeContact(e)}))}if(!0===t){const e=this.model.getDisplayName();return(e=>el`
${jl.settings.get("allow_chat_pending_contacts")?el`<a class="open-chat w-100" href="#" @click=${e.openChat}>${jx(e)}</a>`:jx(e)}
2021-11-11 22:06:49 +01:00
<a class="accept-xmpp-request list-item-action list-item-action--visible fa fa-check"
@click=${e.acceptRequest}
aria-label="${e.desc_accept}" title="${e.desc_accept}" href="#"></a>
<a class="decline-xmpp-request list-item-action list-item-action--visible fa fa-times"
@click=${e.declineRequest}
2022-01-03 11:54:10 +01:00
aria-label="${e.desc_decline}" title="${e.desc_decline}" href="#"></a>`)(Object.assign(this.model.toJSON(),{display_name:e,openChat:e=>this.openChat(e),acceptRequest:e=>this.acceptRequest(e),declineRequest:e=>this.declineRequest(e),desc_accept:Eh("Click to accept the contact request from %1$s",e),desc_decline:Eh("Click to decline the contact request from %1$s",e),allow_chat_pending_contacts:jl.settings.get("allow_chat_pending_contacts")}))}if("both"===n||"to"===n||Ox.isSameBareJID(s,wa.connection.jid))return this.renderRosterItem(this.model)}renderRosterItem(e){return((e,t)=>{var n,s;const i=t.presence.get("show")||"offline";let r,o;[r,o]="online"===i?["fa fa-circle","chat-status-online"]:"dnd"===i?["fa fa-minus-circle","chat-status-busy"]:"away"===i?["fa fa-circle","chat-status-away"]:["fa fa-circle","subdued-color"];const a=t.getDisplayName(),c=Nx[i],l=t.get("num_unread")||0,d=Eh("Click to chat with %1$s (XMPP address: %2$s)",a,e.model.get("jid")),u=Eh("Click to remove %1$s as a contact",a);return el`
<a class="list-item-link cbox-list-item open-chat ${l?"unread-msgs":""}" title="${d}" href="#" @click=${e.openChat}>
<span>
<converse-avatar
class="avatar"
.data=${null===(n=e.model.vcard)||void 0===n?void 0:n.attributes}
nonce=${null===(s=e.model.vcard)||void 0===s?void 0:s.get("vcard_updated")}
height="30" width="30"></converse-avatar>
<converse-icon
title="${c}"
color="var(--${o})"
size="1em"
class="${r} chat-status chat-status--avatar"></converse-icon>
</span>
${l?el`<span class="msgs-indicator">${l}</span>`:""}
<span class="contact-name contact-name--${e.show} ${l?"unread-msgs":""}">${a}</span>
2021-11-11 22:06:49 +01:00
</a>
2022-01-03 11:54:10 +01:00
${jl.settings.get("allow_contact_removal")?el`<a class="list-item-action remove-xmpp-contact far fa-trash-alt" @click=${e.removeContact} title="${u}" href="#"></a>`:""}`})(this,e)}openChat(e){var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),this.model.openChat()}removeContact(e){var t;if(null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),jl.settings.get("allow_contact_removal")&&confirm(Eh("Are you sure you want to remove this contact?")))try{this.model.removeFromRoster(),this.model.collection&&this.model.destroy()}catch(e){M.error(e),jl.alert("error",Eh("Error"),[Eh("Sorry, there was an error while trying to remove %1$s as a contact.",this.model.getDisplayName())])}}async acceptRequest(e){var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),await wa.roster.sendContactAddIQ(this.model.get("jid"),this.model.getFullname(),[]),this.model.authorize().subscribe()}declineRequest(e){return e&&e.preventDefault&&e.preventDefault(),!0===confirm(Eh("Are you sure you want to decline this contact request?"))&&this.model.unauthorize().destroy(),this}}jl.elements.define("converse-roster-contact",$x);const Ix=Xo.extend({initialize(){this.set({filter_text:"",filter_type:"contacts",chat_state:"online"})}});class Mx extends ig{initialize(){const e=new wa.RosterFilter;e.id=`_converse.rosterfilter-${wa.bare_jid}`,_o(e,e.id),this.model=e,wa.roster_filter=e,this.liveFilter=gc((()=>{this.model.save({filter_text:this.querySelector(".roster-filter").value})}),250),this.listenTo(wa,"rosterContactsFetched",this.requestUpdate),this.listenTo(wa.presences,"change:show",this.requestUpdate),this.listenTo(wa.roster,"add",this.requestUpdate),this.listenTo(wa.roster,"destroy",this.requestUpdate),this.listenTo(wa.roster,"remove",this.requestUpdate),this.listenTo(this.model,"change",this.dispatchUpdateEvent),this.listenTo(this.model,"change",this.requestUpdate),this.model.fetch()}render(){return(e=>{const t=Eh("Filter"),n=Eh("Filter by contact name"),s=Eh("Filter by group name"),i=Eh("Filter by status"),r=Eh("Any"),o=Eh("Unread"),a=Eh("Online"),c=Eh("Chatty"),l=Eh("Busy"),d=Eh("Away"),u=Eh("Extended Away"),h=Eh("Offline");return el`
2021-11-11 22:06:49 +01:00
<form class="controlbox-padded roster-filter-form input-button-group ${e.visible?"fade-in":"hidden"}"
@submit=${e.submitFilter}>
<div class="form-inline flex-nowrap">
<div class="filter-by d-flex flex-nowrap">
<span @click=${e.changeTypeFilter} class="fa fa-user ${"contacts"===e.filter_type?"selected":""}" data-type="contacts" title="${n}"></span>
<span @click=${e.changeTypeFilter} class="fa fa-users ${"groups"===e.filter_type?"selected":""}" data-type="groups" title="${s}"></span>
<span @click=${e.changeTypeFilter} class="fa fa-circle ${"state"===e.filter_type?"selected":""}" data-type="state" title="${i}"></span>
</div>
<div class="btn-group">
<input .value="${e.filter_text||""}"
@keydown=${e.liveFilter}
class="roster-filter form-control ${"state"===e.filter_type?"hidden":""}"
placeholder="${t}"/>
<span class="clear-input fa fa-times ${e.filter_text&&"state"!==e.filter_type?"":"hidden"}"
@click=${e.clearFilter}>
</span>
</div>
<select class="form-control state-type ${"state"!==e.filter_type?"hidden":""}"
@change=${e.changeChatStateFilter}>
<option value="">${r}</option>
<option ?selected=${"unread_messages"===e.chat_state} value="unread_messages">${o}</option>
<option ?selected=${"online"===e.chat_state} value="online">${a}</option>
<option ?selected=${"chat"===e.chat_state} value="chat">${c}</option>
<option ?selected=${"dnd"===e.chat_state} value="dnd">${l}</option>
<option ?selected=${"away"===e.chat_state} value="away">${d}</option>
<option ?selected=${"xa"===e.chat_state} value="xa">${u}</option>
<option ?selected=${"offline"===e.chat_state} value="offline">${h}</option>
</select>
</div>
2022-01-03 11:54:10 +01:00
</form>`})(Object.assign(this.model.toJSON(),{visible:this.shouldBeVisible(),changeChatStateFilter:e=>this.changeChatStateFilter(e),changeTypeFilter:e=>this.changeTypeFilter(e),clearFilter:e=>this.clearFilter(e),liveFilter:e=>this.liveFilter(e),submitFilter:e=>this.submitFilter(e)}))}dispatchUpdateEvent(){this.dispatchEvent(new CustomEvent("update",{detail:this.model.changed}))}changeChatStateFilter(e){e&&e.preventDefault(),this.model.save({chat_state:this.querySelector(".state-type").value})}changeTypeFilter(e){e&&e.preventDefault();const t=e.target.dataset.type;"state"===t?this.model.save({filter_type:t,chat_state:this.querySelector(".state-type").value}):this.model.save({filter_type:t,filter_text:this.querySelector(".roster-filter").value})}submitFilter(e){e&&e.preventDefault(),this.liveFilter()}isActive(){return"state"===this.model.get("filter_type")||this.model.get("filter_text")}shouldBeVisible(){var e;return(null===(e=wa.roster)||void 0===e?void 0:e.length)>=5||this.isActive()}clearFilter(e){e&&e.preventDefault(),this.model.save({filter_text:""})}}jl.elements.define("converse-roster-filter",Mx);var Rx=n(1984),Dx={};Dx.styleTagTransform=vg(),Dx.setAttributes=fg(),Dx.insert=ug().bind(null,"head"),Dx.domAPI=lg(),Dx.insertStyleElement=gg(),ag()(Rx.Z,Dx),Rx.Z&&Rx.Z.locals&&Rx.Z.locals,$l.plugins.add("converse-rosterview",{dependencies:["converse-roster","converse-modal","converse-chatboxviews"],initialize(){jl.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}),jl.promises.add("rosterViewInitialized"),wa.RosterFilter=Ix,wa.RosterFilterView=Mx,wa.RosterContactView=$x,jl.listen.on("chatBoxesInitialized",(()=>{wa.chatboxes.on("destroy",(e=>Sx(e))),wa.chatboxes.on("change:hidden",(e=>Sx(e)))})),jl.listen.on("afterTearDown",(()=>{var e;return null===(e=wa.rotergroups)||void 0===e?void 0:e.off().reset()}))}}),wa.CustomElement=ig;const Lx=$l.initialize;$l.initialize=function(e,t){return Array.isArray(e.whitelisted_plugins)?e.whitelisted_plugins=e.whitelisted_plugins.concat(rg):e.whitelisted_plugins=rg,Lx(e,t)};const zx=$l},1551:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(8531),i=n.n(s),r=n(7180),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},5251:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(8531),i=n.n(s),r=n(7180),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},6931:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(8531),i=n.n(s),r=n(7180),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},352:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(8531),i=n.n(s),r=n(7180),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},7802:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(8531),i=n.n(s),r=n(7180),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},5599:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(8531),i=n.n(s),r=n(7180),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},1875:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(8531),i=n.n(s),r=n(7180),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},8041:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(8531),i=n.n(s),r=n(7180),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},5956:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(8531),i=n.n(s),r=n(7180),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},9679:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(8531),i=n.n(s),r=n(7180),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},4915:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(8531),i=n.n(s),r=n(7180),o
2021-01-29 23:34:36 +01:00
//# sourceMappingURL=converse.min.js.map