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

2362 lines
1,014 KiB
JavaScript
Raw Normal View History

2021-11-11 22:06:49 +01:00
/*! For license information please see converse.min.js.LICENSE.txt */
2023-02-17 12:24:37 +01:00
(()=>{var e,t,n,s,i={8487:function(e,t,n){!function(e,t){"use strict";function n(e){return n.result?n.result:e&&"function"==typeof e.getSerializer?(n.result=e.getSerializer(),n.result):Promise.reject(new Error("localforage.getSerializer() was not available! localforage v1.4+ is required!"))}function s(e,t){return t&&e.then((function(e){t(null,e)}),(function(e){t(e)})),e}function i(e,t){var n=this.getItem(e).then((function(t){return{key:e,value:t}}));return s(n,t),n}function r(e){var t=this;return new Promise((function(n,s){for(var r=[],o=0,a=e.length;o<a;o++)r.push(i.call(t,e[o]));Promise.all(r).then((function(e){for(var t={},s=0,i=e.length;s<i;s++){var r=e[s];t[r.key]=r.value}n(t)})).catch(s)}))}function o(){var e={};return this.iterate((function(t,n){e[n]=t})).then((function(){return e}))}function a(){return"undefined"!=typeof IDBKeyRange?IDBKeyRange:"undefined"!=typeof webkitIDBKeyRange?webkitIDBKeyRange:"undefined"!=typeof mozIDBKeyRange?mozIDBKeyRange:void 0}t="default"in t?t.default:t;var c=a();function l(e){e=e.slice();var t=this;function n(e,t){return e<t?-1:e>t?1:0}return new Promise((function(s,i){t.ready().then((function(){var r,o=t._dbInfo,a=o.db.transaction(o.storeName,"readonly").objectStore(o.storeName),l=e.sort(n),d=c.bound(e[0],e[e.length-1],!1,!1);if("getAll"in a)(r=a.getAll(d)).onsuccess=function(){var e=r.result;void 0===e&&(e=null),s(e)};else{r=a.openCursor(d);var u={},h=0;r.onsuccess=function(){var e=r.result;if(e){for(var t=e.key;t>l[h];)if(++h===l.length)return void s(u);if(t===l[h]){var n=e.value;void 0===n&&(n=null),u[t]=n,e.continue()}else e.continue(l[h])}else s(u)}}r.onerror=function(){i(r.error)}})).catch(i)}))}function d(e){var t=this;return new Promise((function(s,i){t.ready().then((function(){return n(t)})).then((function(n){var r=t._dbInfo;r.db.transaction((function(t){for(var o=new Array(e.length),a=0,c=e.length;a<c;a++)o[a]="?";t.executeSql("SELECT * FROM "+r.storeName+" WHERE (key IN ("+o.join(",")+"))",e,(function(e,t){for(var i={},r=t.rows,o=0,a=r.length;o<a;o++){var c=r.item(o),l=c.value;l&&(l=n.deserialize(l)),i[c.key]=l}s(i)}),(function(e,t){i(t)}))}))})).catch(i)}))}function u(e,t){var n,i=this;if(arguments.length&&null!==e){var a=i.driver();n=a===i.INDEXEDDB?l.apply(i,arguments):a===i.WEBSQL?d.apply(i,arguments):r.apply(i,arguments)}else n=o.apply(i);return s(n,t),n}function h(e){var t=Object.getPrototypeOf(e);t&&(t.getItems=u,t.getItems.indexedDB=function(){return l.apply(this,arguments)},t.getItems.websql=function(){return d.apply(this,arguments)},t.getItems.generic=function(){return r.apply(this,arguments)})}var m=h(t);e.localforageGetItems=u,e.extendPrototype=h,e.extendPrototypeResult=m,e.getItemsGeneric=r,Object.defineProperty(e,"__esModule",{value:!0})}(t,n(5513))},7609:(e,t,n)=>{"use strict";const s=n(7776),i=n(2350);e.exports={atob:s,btoa:i}},7776:e=>{"use strict";const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function n(e){const n=t.indexOf(e);return n<0?void 0:n}e.exports=function(e){if(0===arguments.length)throw new TypeError("1 argument required, but only 0 present.");if((e=(e=`${e}`).replace(/[ \t\n\f\r]/g,"")).length%4==0&&(e=e.replace(/==?$/,"")),e.length%4==1||/[^+/0-9A-Za-z]/.test(e))return null;let t="",s=0,i=0;for(let r=0;r<e.length;r++)s<<=6,s|=n(e[r]),i+=6,24===i&&(t+=String.fromCharCode((16711680&s)>>16),t+=String.fromCharCode((65280&s)>>8),t+=String.fromCharCode(255&s),s=i=0);return 12===i?(s>>=4,t+=String.fromCharCode(s)):18===i&&(s>>=2,t+=String.fromCharCode((65280&s)>>8),t+=String.fromCharCode(255&s)),t}},2350:e=>{"use strict";const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function n(e){if(e>=0&&e<64)return t[e]}e.exports=function(e){if(0===arguments.length)throw new TypeError("1 argument required, but only 0 present.");let t;for(e=`${e}`,t=0;t<e.length;t++)if(e.charCodeAt(t)>255)return null;let s="";for(t=0;t<e.length;t+=3){const i=[void 0,void 0,void 0,void 0];i[0]=e.charCodeAt(t)>>2,i[1]=(3&e.charCodeAt(t))<<4,e.length>t+1&&(i[1]|=e.charCodeAt(t+1)>>4,i[2]=(15&e.charCodeAt(t+1))<<2),e.length>t
<command sessionid="${t}" node="${n}" action="${s}" xmlns="${dp.NS.ADHOC}">
${["cancel","prev"].includes(s)?"":mp`
<x xmlns="${dp.NS.XFORM}" type="submit">
${i.reduce(((e,t)=>{let{name:n,value:s}=t;return e+`<field var="${n}"><value>${s}</value></field>`}),"")}
</x>`}
</command>
</iq>`,o=await Ih.sendIQ(r,null,!1);if(null===o){Il.warn("A timeout occurred while trying to run an ad-hoc command");const{__:e}=nd;return{status:"error",note:e("A timeout occurred")}}hp.isErrorStanza(o)&&(Il.error("Error while trying to execute an ad-hoc command"),Il.error(o));const a=o.querySelector("command")?.getAttribute("status");return{status:a,..."executing"===a?lp(o):{},note:o.querySelector("note")?.textContent}}}},{Strophe:fp}=Oh.env;fp.addNamespace("ADHOC","http://jabber.org/protocol/commands"),Oh.plugins.add("converse-adhoc",{dependencies:["converse-disco"],initialize(){Object.assign(this._converse.api,gp)}});class pp extends Mm{defaults(){return{bookmarked:!1,hidden:["mobile","fullscreen"].includes(Ih.settings.get("view_mode")),message_type:"headline",num_unread:0,time_opened:this.get("time_opened")||(new Date).getTime(),type:nd.HEADLINES_TYPE}}async initialize(){this.set({box_id:`box-${this.get("jid")}`}),this.initUI(),this.initMessages(),await this.fetchMessages(),Ih.trigger("headlinesFeedInitialized",this)}}const vp={headlines:{async get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];async function s(e){let s=await Ih.chatboxes.get(e);return!s&&n?s=await Ih.chatboxes.create(e,t,nd.HeadlinesFeed):(s=s&&s.get("type")===nd.HEADLINES_TYPE?s:null,s&&Object.keys(t).length&&s.save(t)),s}if(void 0===e){return(await Ih.chatboxes.get()).filter((e=>e.get("type")===nd.HEADLINES_TYPE))}return"string"==typeof e?s(e):Promise.all(e.map((e=>s(e))))}}};Oh.plugins.add("converse-headlines",{dependencies:["converse-chat"],overrides:{ChatBoxes:{model(e,t){const{_converse:n}=this.__super__;return e.type==n.HEADLINES_TYPE?new n.HeadlinesFeed(e,t):this.__super__.model.apply(this,arguments)}}},initialize(){function e(){nd.connection.addHandler((e=>async function(e){if(xm(e)||Em(e)){const t=e.getAttribute("from");if(await Ih.waitUntil("rosterInitialized"),t.includes("@")&&!nd.roster.get(t)&&!Ih.settings.get("allow_non_roster_messaging"))return;if(null===e.querySelector("body"))return;const n=nd.chatboxes.create({id:t,jid:t,type:nd.HEADLINES_TYPE,from:t}),s=await jm(e);await n.createMessage(s),Ih.trigger("message",{chatbox:n,stanza:e,attrs:s})}}(e)||!0),null,"message")}nd.HeadlinesFeed=pp,Ih.listen.on("connected",e),Ih.listen.on("reconnected",e),Object.assign(Ih,vp)}});const yp=Oh.env.utils;class _p extends No{defaults(){return{msgid:yp.getUniqueId(),is_ephemeral:!1}}}const{Strophe:bp,$build:wp}=Oh.env;bp.addNamespace("RSM","http://jabber.org/protocol/rsm");const Sp=["after","before","index","max"],xp=e=>Number(e),Ep=e=>e.toString(),Ap={after:Ep,before:Ep,count:xp,first:Ep,index:xp,last:Ep,max:xp},Cp=e=>void 0===e,$p=Object.keys(Ap);class kp{static getQueryParameters(){return To(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},Sp)}static parseXMLResult(e){const t={};for(var n=0;n<$p.length;n++){const s=$p[n],i=e.getElementsByTagName(s)[0];Cp(i)||null===i||(t[s]=Ap[s](bp.getText(i)),"first"==s&&(t.index=Ap.index(i.getAttribute("index"))))}return t}constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.query=kp.getQueryParameters(e),this.result=e.xml?kp.parseXMLResult(e.xml):{}}toXML(){const e=wp("set",{xmlns:bp.NS.RSM});return Sp.reduce(((e,t)=>Cp(this.query[t])?e:e.c(t).t((this.query[t]||"").toString()).up()),e).tree()}next(e,t){const n=Object.assign({},this.query,{after:this.result.last,before:t,max:e});return new kp(n)}previous(e,t){const n=Object.assign({},this.query,{after:t,before:this.result.first,max:e});return new kp(n)}}nd.RSM_ATTRIBUTES=$p,nd.RSM=kp;const{Strophe:jp,$iq:Tp,dayjs:Np}=Oh.env,{NS:Ip}=jp,Op=Oh.env.utils,Mp={archive:{async query(e){if(!Ih.connection.connected())throw new Error("Can't call `api.archive.query` before having established an XMPP session");const t={type:"set"};if(e&&e.groupchat){if(!e.with)throw new Error('You need to specify a "with" value containing the chat room JID, when querying groupchat messages.');t.to=e.with}const n=t.to||nd.bare_jid;if(!await Ih.disco.supports
2022-12-17 22:08:36 +01:00
<div class="modal-dialog" role="document" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-content">
2023-01-07 22:34:35 +01:00
<div class="modal-header ${n}">
2022-12-17 22:08:36 +01:00
<h5 class="modal-title">${e.getModalTitle()}</h5>
2023-02-17 12:24:37 +01:00
${x_}
2022-12-17 22:08:36 +01:00
</div>
<div class="modal-body">
<span class="modal-alert">
2023-02-17 12:24:37 +01:00
${t?u_({type:`alert-${t.type}`,message:t.message}):""}
2022-12-17 22:08:36 +01:00
</span>
2023-01-07 22:34:35 +01:00
${e.renderModal?.()??""}
2022-12-17 22:08:36 +01:00
</div>
2023-02-17 12:24:37 +01:00
${e.renderModalFooter?.()??Gu`<div class="modal-footer">${S_}</div>`}
2022-12-17 22:08:36 +01:00
</div>
</div>
2023-02-17 12:24:37 +01:00
`})(this)}getModalTitle(){return""}switchTab(e){e?.stopPropagation(),e?.preventDefault(),this.tab=e.target.getAttribute("data-name"),this.render()}onHide(){this.modal.hide()}insertIntoDOM(){document.querySelector("#converse-modals").insertAdjacentElement("beforeEnd",this)}alert(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"primary";this.model.set("alert",{message:e,type:t}),setTimeout((()=>{this.model.set("alert",void 0)}),5e3)}async show(){await this.initialized,this.modal.show(),this.render()}};Ih.elements.define("converse-alert-modal",class extends $_{initialize(){super.initialize(),this.listenTo(this.model,"change",(()=>this.render())),this.addEventListener("hide.bs.modal",(()=>this.remove()),!1)}renderModal(){return(e=>Gu`
2022-12-17 22:08:36 +01:00
<div class="modal-body">
<span class="modal-alert"></span>
2023-02-17 12:24:37 +01:00
${e.messages.map((e=>Gu`<p>${e}</p>`))}
</div>`)(this.model.toJSON())}getModalTitle(){return this.model.get("title")}});const k_=e=>Gu`
2022-12-17 22:08:36 +01:00
<form class="converse-form converse-form--modal confirm" action="#" @submit=${t=>e.onConfimation(t)}>
<div class="form-group">
2023-02-17 12:24:37 +01:00
${e.model.get("messages")?.map((e=>Gu`<p>${e}</p>`))}
2022-12-17 22:08:36 +01:00
</div>
2023-02-17 12:24:37 +01:00
${e.model.get("fields")?.map((e=>(e=>Gu`
2022-12-17 22:08:36 +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>
`)(e)))}
<div class="form-group">
2023-02-17 12:24:37 +01:00
<button type="submit" class="btn btn-primary">${Gy("OK")}</button>
<input type="button" class="btn btn-secondary" data-dismiss="modal" value="${Gy("Cancel")}"/>
2022-12-17 22:08:36 +01:00
</div>
2023-02-17 12:24:37 +01:00
</form>`;class j_ extends $_{constructor(e){super(e),this.confirmation=ea()}initialize(){super.initialize(),this.listenTo(this.model,"change",(()=>this.render())),this.addEventListener("hide.bs.modal",(()=>{this.confirmation.isResolved||this.confirmation.reject()}),!1)}renderModal(){return k_(this)}getModalTitle(){return this.model.get("title")}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()}renderModalFooter(){return""}}Ih.elements.define("converse-confirm-modal",j_);let T_=[],N_={};const I_={modal:{show(e,t,n){let s;if("string"==typeof e)s=this.get(e)??this.create(e,t),Object.assign(s,t);else{const n=e,i=n.id??t.id;s=this.get(i)??this.create(n,t)}return s.show(n),s},get:e=>N_[e]??T_.filter((t=>t.id==e)).pop(),create(e,t){let n;if("string"==typeof e){const s=customElements.get(e);n=N_[e]=new s(t)}else{n=new e(t),T_.push(n)}return n},remove(e){let t;"string"==typeof e?(t=N_[e],delete N_[e]):(t=e,T_=T_.filter((e=>e!==t))),t?.remove()},removeAll(){T_.forEach((e=>e.remove())),T_=[],N_={}}},async confirm(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];"string"==typeof t&&(t=[t]);const n=new No({title:e,messages:t,fields:arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],type:"confirm"}),s=new j_({model:n});let i;s.show();try{i=await s.confirmation}catch(e){i=!1}return s.remove(),i},async prompt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];"string"==typeof t&&(t=[t]);const n=new No({title:e,messages:t,fields:[{name:"reason",placeholder:arguments.length>2&&void 0!==arguments[2]?arguments[2]:""}],type:"prompt"}),s=new j_({model:n});let i;s.show();try{i=(await s.confirmation).pop()?.value}catch(e){i=!1}return s.remove(),i},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 No({title:t,messages:n,level:s,type:"alert"});I_.modal.show("converse-alert-modal",{model:i})}},O_=I_;Oh.env.BootstrapModal=w_,Oh.plugins.add("converse-modal",{initialize(){Ih.listen.on("disconnect",(()=>{const e=document.querySelector("#converse-modals");e&&(e.innerHTML="")})),Ih.listen.on("clearSession",(()=>Ih.modal.removeAll())),Object.assign(nd.api,O_)}});const M_=Oh.env.utils,R_={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])||M_.isMentionBoundary(e[0])&&t.includes(e[1])},D_=function(e,t){return RegExp(R_.regExpEscape(t.trim()),"i").test(e)},z_=function(e,t){return RegExp("^"+R_.regExpEscape(t.trim()),"i").test(e)},L_=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},P_=(e,t)=>{t=t.trim();const n=document.createElement("li");n.setAttribute("aria-selected","false");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};const F_=class extends String{constructor(e,t){super();const n=Array.isArray(e)?{label:e[0],value:e[1]}:"object"==typeof e&&"label"in e&&"value"in e?e:{label:e,value:e};this.label=n.label||n.value,this.value=n.value,this.query=t}get lenth(){return this.label.length}toString(){return""+this.label}valueOf(){retur
2022-12-17 22:08:36 +01:00
<div class="suggestion-box suggestion-box__name">
<ul class="suggestion-box__results ${e}" hidden=""></ul>
<input
?autofocus=${this.autofocus}
?required=${this.required}
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>
</div>
2023-02-17 12:24:37 +01:00
`}firstUpdated(){this.auto_complete=new q_(this.firstElementChild,{ac_triggers:this.triggers.split(" "),auto_evaluate:this.auto_evaluate,auto_first:this.auto_first,filter:"contains"==this.filter?D_:z_,include_triggers:[],list:this.list??(e=>this.getAutoCompleteList(e)),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 H_=n(4921),G_={};G_.styleTagTransform=o_(),G_.setAttributes=n_(),G_.insert=e_().bind(null,"head"),G_.domAPI=Ky(),G_.insertStyleElement=i_();Qy()(H_.Z,G_);H_.Z&&H_.Z.locals&&H_.Z.locals;nd.FILTER_CONTAINS=D_,nd.FILTER_STARTSWITH=z_,nd.AutoComplete=q_;const W_={execute:Gy("Execute"),prev:Gy("Previous"),next:Gy("Next"),complete:Gy("Complete")},V_=(e,t)=>Gu`
2022-12-17 22:08:36 +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"
2023-02-17 12:24:37 +01:00
@click=${t=>e.toggleCommandForm(t)}
2022-12-17 22:08:36 +01:00
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>
2023-02-17 12:24:37 +01:00
${t.node===e.showform?((e,t)=>{const n=Gy("Cancel");return Gu`
2022-12-17 22:08:36 +01:00
<span> <!-- Don't remove this <span>,
this is a workaround for a lit bug where a <form> cannot be removed
if it contains an <input> with name "remove" -->
2023-02-17 12:24:37 +01:00
<form>
${t.alert?Gu`<div class="alert alert-${t.alert_type}" role="alert">${t.alert}</div>`:""}
2022-12-17 22:08:36 +01:00
<fieldset class="form-group">
<input type="hidden" name="command_node" value="${t.node}"/>
<input type="hidden" name="command_jid" value="${t.jid}"/>
2023-02-17 12:24:37 +01:00
<p class="form-instructions">${t.instructions}</p>
2022-12-17 22:08:36 +01:00
${t.fields}
</fieldset>
<fieldset>
2023-02-17 12:24:37 +01:00
${t.actions.map((t=>Gu`<input data-action="${t}"
@click=${t=>e.executeAction(t)}
type="button"
class="btn btn-primary"
value="${W_[t]}">`))}<input type="button"
class="btn btn-secondary button-cancel"
value="${n}"
@click=${t=>e.cancel(t)}>
2022-12-17 22:08:36 +01:00
</fieldset>
</form>
</span>
`})(e,t):""}
</li>
2023-02-17 12:24:37 +01:00
`,J_=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.classes?.includes("hor_centered")?Gu`<div class="spinner__container"><converse-icon size="1em" class="fa fa-spinner spinner centered ${e.classes||""}"></converse-icon></div>`:Gu`<converse-icon size="1em" class="fa fa-spinner spinner centered ${e.classes||""}"></converse-icon>`},Z_=e=>{return e.image?Gu`
2022-12-17 22:08:36 +01:00
<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}`}"/>
2023-02-17 12:24:37 +01:00
</svg>`:"";var t,n};var Q_=n(5222),Y_={};Y_.styleTagTransform=o_(),Y_.setAttributes=n_(),Y_.insert=e_().bind(null,"head"),Y_.domAPI=Ky(),Y_.insertStyleElement=i_();Qy()(Q_.Z,Y_);Q_.Z&&Q_.Z.locals&&Q_.Z.locals;Ih.elements.define("converse-avatar",class extends Vy{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(){const e=this.data?.image_type||nd.DEFAULT_IMAGE_TYPE;let t;if(this.data?.data_uri)t=this.data?.data_uri;else{t="data:"+e+";base64,"+(this.data?.image||nd.DEFAULT_IMAGE)}return Z_({classes:this.getAttribute("class"),height:this.height,width:this.width,image:t,image_type:e})}});const{I:K_}=ah,X_=()=>document.createComment(""),eb=(e,t,n)=>{var s;const i=e._$AA.parentNode,r=void 0===t?e._$AB:t._$AA;if(void 0===n){const t=i.insertBefore(X_(),r),s=i.insertBefore(X_(),r);n=new K_(t,s,e,e.options)}else{const t=n._$AB.nextSibling,o=n._$AM,a=o!==e;if(a){let t;null===(s=n._$AQ)||void 0===s||s.call(n,e),n._$AM=e,void 0!==n._$AP&&(t=e._$AU)!==o._$AU&&n._$AP(t)}if(t!==r||a){let e=n._$AA;for(;e!==t;){const t=e.nextSibling;i.insertBefore(e,r),e=t}}}return n},tb=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e;return e._$AI(t,n),e},nb={},sb=e=>{var t;null===(t=e._$AP)||void 0===t||t.call(e,!1,!0);let n=e._$AA;const s=e._$AB.nextSibling;for(;n!==s;){const e=n.nextSibling;n.remove(),n=e}},ib=2,rb=e=>function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return{_$litDirective$:e,values:n}};class ob{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}const ab=(e,t)=>{var n,s;const i=e._$AN;if(void 0===i)return!1;for(const e of i)null===(s=(n=e)._$AO)||void 0===s||s.call(n,t,!1),ab(e,t);return!0},cb=e=>{let t,n;do{if(void 0===(t=e._$AM))break;n=t._$AN,n.delete(e),e=t}while(0===(null==n?void 0:n.size))},lb=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(void 0===n)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),hb(t)}};function db(e){void 0!==this._$AN?(cb(this),this._$AM=e,lb(this)):this._$AM=e}function ub(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=this._$AH,i=this._$AN;if(void 0!==i&&0!==i.size)if(t)if(Array.isArray(s))for(let e=n;e<s.length;e++)ab(s[e],!1),cb(s[e]);else null!=s&&(ab(s,!1),cb(s));else ab(this,e)}const hb=e=>{var t,n,s,i;e.type==ib&&(null!==(t=(s=e)._$AP)&&void 0!==t||(s._$AP=ub),null!==(n=(i=e)._$AQ)&&void 0!==n||(i._$AQ=db))};class mb extends ob{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),lb(this),this.isConnected=e._$AU}_$AO(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];var n,s;e!==this.isConnected&&(this.isConnected=e,e?null===(n=this.reconnected)||void 0===n||n.call(this):null===(s=this.disconnected)||void 0===s||s.call(this)),t&&(ab(this,e),cb(this))}setValue(e){if((e=>void 0===e.strings)(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}class gb{constructor(e){this.Y=e}disconnect(){this.Y=void 0}reconnect(e){this.Y=e}deref(){return this.Y}}class fb{constructor(){this.Z=void 0,this.q=void 0}get(){return this.Z}pause(){var e;null!==(e=this.Z)&&void 0!==e||(this.Z=new Promise((e=>this.q=e)))}resume(){var e;null===(e=this.q)||void 0===e||e.call(this),this.Z=this.q=void 0}}const pb=e=>!(e=>null===e||"object"!=typeof e&&"function"!=typeof e)(e)&&"function"==typeof e.then;const vb=rb(class extends mb{constructor(){super(...arguments),this._$Cwt=1073741823,this._$Cyt=[],this._$CK=new gb(this),this._$CX=new fb}render(){for(var e,t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return null!==(e=n.find((e=>!pb(e))))&&void 0!==e?e:Wu}update(e,t){const n=this._$Cyt;let s=n.length;this._$Cyt=t;const i=this._$CK,r=this._$CX;this.isConnected||this.disconnected();for(let e=0;e<t.le
2022-12-17 22:08:36 +01:00
<div class="row">
<div class="col-auto">
<converse-avatar
class="avatar modal-avatar"
2023-01-07 22:34:35 +01:00
.data=${s?.attributes}
nonce=${s?.get("vcard_updated")}
2022-12-17 22:08:36 +01:00
height="120" width="120"></converse-avatar>
</div>
<div class="col">
<ul class="occupant-details">
<li>
2023-02-17 12:24:37 +01:00
${i?Gu`<div class="row"><strong>${Gy("Nickname")}:</strong></div><div class="row">${i}</div>`:""}
2022-12-17 22:08:36 +01:00
</li>
<li>
2023-02-17 12:24:37 +01:00
${n?Gu`<div class="row"><strong>${Gy("XMPP Address")}:</strong></div><div class="row">${n}</div>`:""}
2022-12-17 22:08:36 +01:00
</li>
<li>
2023-02-17 12:24:37 +01:00
${a?Gu`<div class="row"><strong>${Gy("Affiliation")}:</strong></div><div class="row">${a}</div>`:""}
2022-12-17 22:08:36 +01:00
</li>
<li>
2023-02-17 12:24:37 +01:00
${o?Gu`<div class="row"><strong>${Gy("Roles")}:</strong></div><div class="row">${o}</div>`:""}
2022-12-17 22:08:36 +01:00
</li>
<li>
2023-02-17 12:24:37 +01:00
${c?Gu`<div class="row"><strong>${Gy("Hats")}:</strong></div><div class="row">${c}</div>`:""}
2022-12-17 22:08:36 +01:00
</li>
<li>
2023-02-17 12:24:37 +01:00
${r?Gu`<div class="row"><strong>${Gy("Occupant Id")}:</strong></div><div class="row">${r}</div>`:""}
2022-12-17 22:08:36 +01:00
</li>
2023-02-17 12:24:37 +01:00
${vb(m,"")}
2022-12-17 22:08:36 +01:00
</ul>
</div>
</div>
2023-02-17 12:24:37 +01:00
`})(this)}getModalTitle(){return(this.model??this.message)?.getDisplayName()}addToContacts(){const e=(this.model??this.message).get("jid");e&&Ih.modal.show("converse-add-contact-modal",{model:new No({jid:e})})}});const bb=e=>Gu`
2022-12-17 22:08:36 +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">
2023-02-17 12:24:37 +01:00
<div><strong>Role:</strong> ${e.item.role} ${e.assignable_roles.length?(e=>Gu`
2022-12-17 22:08:36 +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>
2023-02-17 12:24:37 +01:00
${e.assignable_roles.length?(e=>{const t=Gy("Change role"),n=Gy("New Role"),s=Gy("Reason");return Gu`
2022-12-17 22:08:36 +01:00
<form class="role-form hidden" @submit=${e.assignRole}>
<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>
<select class="custom-select select-role" name="role">
2023-02-17 12:24:37 +01:00
${e.assignable_roles.map((t=>Gu`<option value="${t}" ?selected=${t===e.item.role}>${t}</option>`))}
2022-12-17 22:08:36 +01:00
</select>
</div>
<div class="col">
<label><strong>${s}:</strong></label>
<input class="form-control" type="text" name="reason"/>
</div>
</div>
</div>
<div class="form-group">
<input type="submit" class="btn btn-primary" value="${t}"/>
</div>
</form>
`})(e):""}
</li>
</ul>
</li>
2023-02-17 12:24:37 +01:00
`,wb=e=>Gu`
2022-12-17 22:08:36 +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">
2023-02-17 12:24:37 +01:00
<div><strong>Affiliation:</strong> ${e.item.affiliation} ${e.assignable_affiliations.length?(e=>Gu`
2022-12-17 22:08:36 +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>
2023-02-17 12:24:37 +01:00
${e.assignable_affiliations.length?(e=>{const t=Gy("Change affiliation"),n=Gy("New affiliation"),s=Gy("Reason");return Gu`
2022-12-17 22:08:36 +01:00
<form class="affiliation-form hidden" @submit=${e.assignAffiliation}>
<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>
<select class="custom-select select-affiliation" name="affiliation">
2023-02-17 12:24:37 +01:00
${e.assignable_affiliations.map((t=>Gu`<option value="${t}" ?selected=${t===e.item.affiliation}>${t}</option>`))}
2022-12-17 22:08:36 +01:00
</select>
</div>
<div class="col">
<label><strong>${s}:</strong></label>
<input class="form-control" type="text" name="reason"/>
</div>
</div>
</div>
<div class="form-group">
<input type="submit" class="btn btn-primary" name="change" value="${t}"/>
</div>
</form>
`})(e):""}
</li>
</ul>
</li>
2023-02-17 12:24:37 +01:00
`,Sb=e=>{const t=Gy("Affiliation"),n=Gy("No users with that affiliation found."),s=Gy("No users with that role found."),i=Gy("Type here to filter the search results"),r=Gy("Role"),o=Gy("Show users"),a=Gy("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=Gy("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 Gu`
${e.alert_message?Gu`<div class="alert alert-${e.alert_type}" role="alert">${e.alert_message}</div>`:""}
${l?(e=>Gu`
2022-12-17 22:08:36 +01:00
<ul class="nav nav-pills justify-content-center">
<li role="presentation" class="nav-item">
<a class="nav-link ${"affiliations"===e.tab?"active":""}"
id="affiliations-tab"
href="#affiliations-tabpanel"
aria-controls="affiliations-tabpanel"
role="tab"
data-name="affiliations"
@click=${e.switchTab}>Affiliations</a>
</li>
<li role="presentation" class="nav-item">
<a class="nav-link ${"roles"===e.tab?"active":""}"
id="roles-tab"
href="#roles-tabpanel"
aria-controls="roles-tabpanel"
role="tab"
data-name="roles"
@click=${e.switchTab}>Roles</a>
</li>
</ul>
`)(e):""}
<div class="tab-content">
2023-02-17 12:24:37 +01:00
${e.queryable_affiliations.length?Gu`
2022-12-17 22:08:36 +01:00
<div class="tab-pane tab-pane--columns ${"affiliations"===e.tab?"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">
2023-02-17 12:24:37 +01:00
${e.queryable_affiliations.map((t=>(e=>Gu`
2022-12-17 22:08:36 +01:00
<option value="${e.item||""}"
?selected=${e.item===e.affiliation}
2023-02-17 12:24:37 +01:00
title="${_b(e.item)}">${e.item}</option>
2022-12-17 22:08:36 +01:00
`)(Object.assign({item:t},e))))}
</select>
</div>
<div class="col">
<input type="submit" class="btn btn-primary" name="users_with_affiliation" value="${o}"/>
</div>
</div>
<div class="row">
<div class="col mt-3">
2023-02-17 12:24:37 +01:00
${Array.isArray(e.users_with_affiliation)&&e.users_with_affiliation.length>5?Gu`<input class="form-control" .value="${e.affiliations_filter}" @keyup=${e.filterAffiliationResults} type="text" name="filter" placeholder="${i}"/>`:""}
2022-12-17 22:08:36 +01:00
</div>
</div>
2023-02-17 12:24:37 +01:00
${_b(e.affiliation)?Gu`<div class="row"><div class="col pt-2"><p class="helptext pb-3">${_b(e.affiliation)}</p></div></div>`:""}
2022-12-17 22:08:36 +01:00
</div>
</form>
<div class="scrollable-container">
<ul class="list-group list-group--users">
2023-02-17 12:24:37 +01:00
${e.loading_users_with_affiliation?Gu`<li class="list-group-item"> ${J_()} </li>`:""}
${Array.isArray(e.users_with_affiliation)&&0===e.users_with_affiliation.length?Gu`<li class="list-group-item">${n}</li>`:""}
2022-12-17 22:08:36 +01:00
2023-02-17 12:24:37 +01:00
${e.users_with_affiliation instanceof Error?Gu`<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"))?wb(Object.assign({item:t},e)):""))}
2022-12-17 22:08:36 +01:00
</ul>
</div>
</div>`:""}
2023-02-17 12:24:37 +01:00
${e.queryable_roles.length?Gu`
2022-12-17 22:08:36 +01:00
<div class="tab-pane tab-pane--columns ${"roles"===e.tab?"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">
2023-02-17 12:24:37 +01:00
${e.queryable_roles.map((t=>(e=>Gu`
2022-12-17 22:08:36 +01:00
<option value="${e.item||""}"
?selected=${e.item===e.role}
2023-02-17 12:24:37 +01:00
title="${yb(e.item)}">${e.item}</option>
2022-12-17 22:08:36 +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">
2023-02-17 12:24:37 +01:00
${Array.isArray(e.users_with_role)&&e.users_with_role.length>5?Gu`<input class="form-control" .value="${e.roles_filter}" @keyup=${e.filterRoleResults} type="text" name="filter" placeholder="${i}"/>`:""}
2022-12-17 22:08:36 +01:00
</div>
</div>
2023-02-17 12:24:37 +01:00
${yb(e.role)?Gu`<div class="row"><div class="col pt-2"><p class="helptext pb-3">${yb(e.role)}</p></div></div>`:""}
2022-12-17 22:08:36 +01:00
</div>
</form>
<div class="scrollable-container">
<ul class="list-group list-group--users">
2023-02-17 12:24:37 +01:00
${e.loading_users_with_role?Gu`<li class="list-group-item"> ${J_()} </li>`:""}
${e.users_with_role&&0===e.users_with_role.length?Gu`<li class="list-group-item">${s}</li>`:""}
${(e.users_with_role||[]).map((t=>t.nick.match(e.roles_filter)?bb(Object.assign({item:t},e)):""))}
2022-12-17 22:08:36 +01:00
</ul>
</div>
</div>`:""}
2023-02-17 12:24:37 +01:00
</div>`},{Strophe:xb,sizzle:Eb,u:Ab}=Oh.env;Ih.elements.define("converse-modtools",class extends Vy{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},tab:{type:String},users_with_affiliation:{type:Array,attribute:!1},users_with_role:{type:Array,attribute:!1}}}constructor(){super(),this.tab="affiliations",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=ea();const e=await Ih.rooms.get(this.jid);await e.initialized,this.muc=e,this.initialized.resolve()}render(){if(this.muc?.occupants){const e=this.muc.occupants.findWhere({jid:nd.bare_jid});return Sb({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:Tg(e),assignable_roles:af(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:Rg.filter((e=>!Ih.settings.get("modtools_disable_query").includes(e))),queryable_roles:Mg.filter((e=>!Ih.settings.get("modtools_disable_query").includes(e))),roles_filter:this.roles_filter,switchTab:e=>this.switchTab(e),tab:this.tab,toggleForm:e=>this.toggleForm(e),users_with_affiliation:this.users_with_affiliation,users_with_role:this.users_with_role})}return""}switchTab(e){e.stopPropagation(),e.preventDefault(),this.tab=e.target.getAttribute("data-name"),this.requestUpdate()}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 jg(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;if("none"===e)return!1;return!of().includes(e)}toggleForm(e){e.stopPropagation(),e.preventDefault();const t=Ab.ancestor(e.target,".toggle-form"),n=t.getAttribute("data-form"),s=Ab.ancestor(t,".list-group-item").querySelector(`.${n}`);Ab.hasClass("hidden",s)?Ab.removeClass("hidden",s):Ab.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 Ig(n,r,[s])}catch(e){return null===e?this.alert(Gy("Timeout error while trying to set the affiliation"),"danger"):Eb(`not-allowed[xmlns="${xb.NS.STANZAS}"]`,e).length?this.alert(Gy("Sorry, you're not allowed to make that change"),"danger"):this.alert(Gy("Sorry, something went wrong while trying to set the affiliation"),"d
${i==s.PASSWORD_REQUIRED?Gu`<converse-muc-password-form class="muc-form-container" jid="${n}"></converse-muc-password-form>`:""}
${i==s.ENTERED?Gu`<converse-muc-chatarea jid="${n}"></converse-muc-chatarea>`:""}
${i==s.CONNECTING?J_():""}
${i==s.NICKNAME_REQUIRED?function(e){const t=e.get("jid");return Ih.settings.get("muc_show_logs_before_join")?Gu`<converse-muc-chatarea jid="${t}"></converse-muc-chatarea>`:Gu`<converse-muc-nickname-form jid="${t}"></converse-muc-nickname-form>`}(e.model):""}
${i==s.DISCONNECTED?Gu`<converse-muc-disconnected jid="${n}"></converse-muc-disconnected>`:""}
${i==s.BANNED?Gu`<converse-muc-disconnected jid="${n}"></converse-muc-disconnected>`:""}
${i==s.DESTROYED?Gu`<converse-muc-destroyed jid="${n}"></converse-muc-destroyed>`:""}
`}function Ib(e,t){t=t.trim();const n=document.createElement("li");if(n.setAttribute("aria-selected","false"),Ih.settings.get("muc_mention_autocomplete_show_avatar")){const t=document.createElement("img");let s="data:"+nd.DEFAULT_IMAGE_TYPE+";base64,"+nd.DEFAULT_IMAGE;if(nd.vcards){const t=nd.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 Ob(){const e=[...await Ih.rooms.get(),...await Ih.contacts.get()],t=[...new Set(e.map((e=>Cb.getDomainFromJid(e.get("jid")))))];return t}function Mb(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];const r=jb[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 Rb(e,t,n,s){const i=kb[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(!$b.isValidJID(r)){const t=Gy("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&&Ih.settings.get("auto_register_muc_nickname")&&(l.nick=c.get("nick")),Ig(i,e.get("jid"),[l]).then((()=>e.occupants.fetchMembers())).catch((t=>e.onCommandError(t)))}function Db(e,t){if(!e.verifyRoles(["moderator"]))return;let n=Ih.modal.get("converse-modtools-modal");n?(n.affiliation=t,n.render()):n=Ih.modal.create("converse-modtools-modal",{affiliation:t,jid:e.get("jid")}),n.show()}function zb(e,t){const n=e.model;if(t||n.get("type")!==nd.CHATROOMS_TYPE||Ih.settings.get("muc_disable_slash_commands")&&!Array.isArray(Ih.settings.get("muc_disable_slash_commands")))return t;let s=e.text;s=s.replace(/^\s*/,"");const i=(s.match(/^\/([a-zA-Z]*) ?/)||[""]).pop().toLowerCase();if(!i)return!1;const r=s.slice(("/"+i).length+1).trim(),o=n.getAllowedCommands()??[];if("admin"===i&&o.includes(i))return Rb(n,i,r,["owner"]),!0;if("ban"===i&&o.includes(i))return Rb(n,i,r,["admin","owner"]),!0;if("modtools"===i&&o.includes(i))return Db(n,r),!0;if("deop"===i&&o.includes(i))return Mb(n,i,r,["admin","owner"]),!0;if("destroy"===i&&o.includes(i))return!n.verifyAffiliations(["owner"])||(Tb(n).catch((e=>n.onCommandError(e))),!0);if("help"===i&&o.includes(i))return n.set({show_help_messages:!1},{silent:!0}),n.set({show_help_messages:!0}),!0;if("kick"===i&&o.includes(i))return Mb(n,i,r,[],["moderator"]),!0;if("mute"===i&&o.includes(i))return Mb(n,i,r,[],["moderator"]),!0;if("member"===i&&o.includes(i))return Rb(n,i,r,["admin","owner"]),!0;if("nick"===i&&o.includes(i)){if(!n.verifyRoles(["visitor","participant","moderator"]))return!0;if(0===r.length){const e=Gy('Your nickname is "%1$s"',n.get("nick"));n.createMessage({message:e,type:"error"})}else n.setNickname(r);return!0}return"owner"===i&&o.includes(i)?(Rb(n,i,r,["owner"]),!0):"op"===i&&o.includes(i)?(Mb(n,i,r,["admin","owner"]),!0):"register"===i&&o.includes(i)?(r.length>1?n.createMessage({message:Gy("Error: invalid number of arguments"),type:"error"}):n.registerNickname().then((e=>{e&&n.createMessage({message:e,type:"error"})})),!0):"revoke"===i&&o.includes(i)?(Rb(n,i,r,["admin","owner"]),!0):"topic"===i&&o.includes(i)||"subject"===i&&o.includes(i)?(n.setSubject(r),!0):!("voice"!==i||!o.inclu
${e.alert?Gu`<div class="alert alert-${e.alert_type}" role="alert">${e.alert}</div>`:""}
${e.note?Gu`<p class="form-help">${e.note}</p>`:""}
2022-12-17 22:08:36 +01:00
<form class="converse-form" @submit=${e.fetchCommands}>
<fieldset class="form-group">
<label>
2023-02-17 12:24:37 +01:00
${t}
<p class="form-help">${n}</p>
2022-12-17 22:08:36 +01:00
<converse-autocomplete
2023-02-17 12:24:37 +01:00
.getAutoCompleteList="${Ob}"
required
placeholder="${r}"
2022-12-17 22:08:36 +01:00
name="jid">
</converse-autocomplete>
</label>
</fieldset>
<fieldset class="form-group">
2023-02-17 12:24:37 +01:00
${e.fetching?J_():Gu`<input type="submit" class="btn btn-primary" value="${i}">`}
2022-12-17 22:08:36 +01:00
</fieldset>
2023-02-17 12:24:37 +01:00
${"list-commands"===e.view?Gu`
2022-12-17 22:08:36 +01:00
<fieldset class="form-group">
<ul class="list-group">
2023-02-17 12:24:37 +01:00
<li class="list-group-item active">${e.commands.length?s:o}:</li>
${e.commands.map((t=>V_(e,t)))}
2022-12-17 22:08:36 +01:00
</ul>
</fieldset>`:""}
</form>
2023-02-17 12:24:37 +01:00
`},Pb=(e,t)=>Gu`<audio controls src="${e}"></audio>${t?"":Gu`<a target="_blank" rel="noopener" href="${e}">${e}</a>`}`,Fb=(e,t)=>{const n=Gy('Download file "%1$s"',t);return Gu`<a target="_blank" rel="noopener" href="${e}">${n}</a>`},Ub=e=>Gu`
<fieldset class="form-group">
${e.label?Gu`<label>${e.label}</label>`:""}
<img src="data:${e.type};base64,${e.data}">
<input name="${e.name}" type="text" ?required="${e.required}" />
</fieldset>
`,Bb=e=>Gu`
<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>
</fieldset>`,qb=e=>Gu`<p class="form-help">${e.text}</p>`,Hb=e=>Gu`
<div class="form-group">
${"hidden"!==e.type?Gu`<label for="${e.id}">${e.label}</label>`:""}
<!-- This is a hack to prevent Chrome from auto-filling the username in
any of the other input fields in the MUC configuration form. -->
${"password"===e.type&&e.fixed_username?Gu`
<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} />
</div>`,Gb=e=>Gu`
<div class="form-group">
<label for="${e.id}">${e.label}</label>
<select class="form-control" id="${e.id}" name="${e.name}" ?multiple="${e.multiple}">
${e.options?.map((e=>(e=>Gu`<option value="${e.value}" ?selected="${e.selected}">${e.label}</option>`)(e)))}
</select>
</div>`,Wb=e=>{const t=kl.getUniqueId();return Gu`
<div class="form-group">
<label class="label-ta" for="${t}">${e.label}</label>
<textarea name="${e.name}" id="${t}" class="form-control">${e.value}</textarea>
</div>
`},Vb=e=>Gu`
<label>${e.label}
<a class="form-url" target="_blank" rel="noopener" href="${e.value}">${e.value}</a>
</label>`,Jb=e=>Gu`
<div class="form-group">
${e.label?Gu`<label>${e.label}</label>`:""}
<div class="input-group">
<input name="${e.name}"
class="form-control"
type="${e.type}"
value="${e.value||""}"
?required="${e.required}" />
<div class="input-group-append">
<div class="input-group-text" title="${e.domain}">${e.domain}</div>
</div>
</div>
</div>`;function Zb(e){e.preventDefault(),Ih.rooms.open(e.target.href)}const Qb=(e,t)=>{let n=e.normalizePath().toString();return e._parts.protocol||t.startsWith("http://")||t.startsWith("https://")||(n="http://"+n),"xmpp"===e._parts.protocol&&"join"===e._parts.query?Gu`
<a target="_blank"
rel="noopener"
@click=${Zb}
href="${n}">${t}</a>`:Gu`<a target="_blank" rel="noopener" href="${n}">${t}</a>`},Yb=(e,t)=>Gu`<video controls preload="metadata" src="${e}"></video>${t?"":Gu`<a target="_blank" rel="noopener" href="${e}">${e}</a>`}`,{sizzle:Kb,Strophe:Xb}=Oh.env,ew=["http","https","xmpp","mailto"];function tw(e,t){return{"muc#roomconfig_lang":"language","muc#roomconfig_roomsecret":t?.new_password?"new-password":"current-password"}[e]}const nw={"text-private":"password","text-single":"text",fixed:"label",boolean:"checkbox",hidden:"hidden","jid-multi":"textarea","list-single":"dropdown","list-multi":"dropdown"},sw={"xs:anyURI":"url","xs:byte":"number","xs:date":"date","xs:dateTime":"datetime","xs:int":"number","xs:integer":"number","xs:time":"time"},iw=/\s*\n\s*/;function rw(e){let t;e=e.tree?.()??e;const n=[],s=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,(e=>"body"===e.parentElement.nodeName.toLowerCase()?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT));for(;t=s.nextNode();)n.push(t);return n.forEach((e=>iw.test(e.data)&&e.parentElement.removeChild(e))),e}const ow=new XMLSerializer;function aw(e){const t=e.getAttribute("name");if(!t)return null;let n;return n="checkbox"===e.getAttribute("type")?e.checked?1:0:"TEXTAREA"==e.tagName?e.value.split("\n").filter((e=>e.trim())):"SELECT"==e.tagName?kl.getSelectValues(e):e.value,{name:t,value:n}}function cw(e){const t=nw[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 sw[e]||t}}return t}function lw(e){const t=Jh(e);try{return decodeURI(t.filename())}catch(e){return Il.debug(e),t.filename()}}function dw(e){const t=Jh(e);return null===t?e:im(t)?Yb(e):sm(t)?Pb(e):(rm(t),Fb(t.toString(),lw(t)))}function uw(e,t){let n=e;for(;null!==n&&!Kb.matchesSelector(n,t);)n=n.parentElement;return n}function hw(e){const t=RegExp("^w{3}.","ig").test(e)?`http://${e}`:e,n=Jh(e);return null===n||!function(e){try{return!!new URL(e)}catch(e){return!1}}(t)||!function(e){return!!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:ew).includes(e)}(n._parts.protocol)&&n._parts.protocol?e:Qb(n,e)}function mw(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200;return new Promise(((n,s)=>{if(!e){const e="An element needs to be passed in to slideOut";return Il.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=kl.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(!kl.hasClass("collapsed",e)&&!kl.hasClass("hidden",e))return void n();const o=t/17;let a=0;e.style.height="0",e.style.overflow="hidden",e.classList.remove("hidden"),e.classList.remove("collapsed"),e.setAttribute("data-slider-marker",window.requestAnimationFrame((function t(){a+=r/o,a<r?(e.style.height=a+"px",e.setAttribute("data-slider-marker",window.requestAnimationFrame(t))):(e.removeAttribute("data-slider-marker"),e.style.height=kl.calculateElementHeight(e)+"px",e.style.overflow="",e.style.height="",n())})))}))}function gw(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200;return new Promise(((n,s)=>{if(!e){const e="An element needs to be passed in to slideIn";return Il.warn(e),s(new Error(e))}if(kl.hasClass("collapsed",e))return n(e);if(window.converse_disable_effects)return e.classList.add("collapsed"),e.style.height="",n(e);const i=e.getAttribute("data-slider-marker");i&&(e.removeAttribute("data-slider-marker"),window.cancelAnimationFrame(i));const r=e.offsetHeight,o=t/17;let a=r;e.style.overflow="hidden",e.setAttribute("data-slider-marker",window.requestAnimationFrame((function t(){a-=r/o,a>0?(e.style.height=a+"px",e.setAttribute("data-slider-marker",window.requestAnimationFrame(t))):(e.removeAttribute("data-slider-marker"),e.classList.add("collapsed"),e.style.height="",n(e))})))}))}fu
2022-12-17 22:08:36 +01:00
<div class="list-item room-item available-chatroom d-flex flex-row" data-room-jid="${t}">
<a class="list-item-link open-room w-100" data-room-jid="${t}"
title="${s}"
2023-02-17 12:24:37 +01:00
@click=${Ew}>${e.getDisplayName()}</a>
2022-12-17 22:08:36 +01:00
<a class="list-item-action remove-bookmark align-self-center ${e.get("bookmarked")?"button-on":""}"
data-room-jid="${t}"
data-bookmark-name="${e.getDisplayName()}"
title="${n}"
2023-02-17 12:24:37 +01:00
@click=${Sw}>
2022-12-17 22:08:36 +01:00
<converse-icon class="fa fa-bookmark" size="1em"></converse-icon>
</a>
</div>
2023-02-17 12:24:37 +01:00
`};var Cw=n(5251),$w={};$w.styleTagTransform=o_(),$w.setAttributes=n_(),$w.insert=e_().bind(null,"head"),$w.domAPI=Ky(),$w.insertStyleElement=i_();Qy()(Cw.Z,$w);Cw.Z&&Cw.Z.locals&&Cw.Z.locals;class kw extends Vy{async initialize(){await Ih.waitUntil("bookmarksInitialized");const{bookmarks:e,chatboxes:t}=nd;this.liveFilter=vh((e=>this.model.set({filter_text:e.target.value})),100),this.listenTo(e,"add",(()=>this.requestUpdate())),this.listenTo(e,"remove",(()=>this.requestUpdate())),this.listenTo(t,"add",(()=>this.requestUpdate())),this.listenTo(t,"remove",(()=>this.requestUpdate()));const n=`converse.bookmarks-list-model-${nd.bare_jid}`;this.model=new No({id:n}),Xc(this.model,n),this.listenTo(this.model,"change",(()=>this.requestUpdate())),this.model.fetch({success:()=>this.requestUpdate(),error:()=>this.requestUpdate()})}render(){return nd.bookmarks&&this.model?(e=>{const t=Gy("Filter"),n=e.model.get("filter_text"),{bookmarks:s}=nd,i=n?s.filter((e=>((e,t)=>e.get("name")?.includes(t)||e.get("jid")?.includes(t))(e,n))):s;return Gu`
2022-12-17 22:08:36 +01:00
<form class="converse-form bookmarks-filter">
<div class="btn-group w-100">
<input
.value=${n??""}
@keydown="${t=>e.liveFilter(t)}"
class="form-control"
placeholder="${t}"/>
<converse-icon size="1em" class="fa fa-times clear-input ${n?"":"hidden"}"
@click=${e.clearFilter}>
</converse-icon>
</div>
</form>
<div class="list-container list-container--bookmarks">
<div class="items-list bookmarks rooms-list">
2023-02-17 12:24:37 +01:00
${i.map((e=>Aw(e)))}
2022-12-17 22:08:36 +01:00
</div>
</div>
2023-02-17 12:24:37 +01:00
`})(this):J_()}clearFilter(e){e?.stopPropagation?.(),this.model.set("filter_text","")}}Ih.elements.define("converse-bookmarks",kw);Ih.elements.define("converse-bookmark-list-modal",class extends $_{renderModal(){return Gu`<converse-bookmarks></converse-bookmarks>`}getModalTitle(){return Gy("Bookmarks")}});class jw extends Vy{static get properties(){return{jid:{type:String}}}willUpdate(e){e.has("jid")&&(this.model=nd.chatboxes.get(this.jid),this.bookmark=nd.bookmarks.get(this.jid))}render(){return(e=>{const t=e.model.getDisplayName(),n=e.bookmark?.get("nick")??e.model.get("nick"),s=Gy('Bookmark for "%1$s"',t),i=Gy("Would you like this groupchat to be automatically joined upon startup?"),r=Gy("Remove"),o=Gy("The name for this bookmark:"),a=Gy("What should your nickname for this groupchat be?"),c=e.bookmark?Gy("Update"):Gy("Save");return Gu`
<form class="converse-form chatroom-form" @submit=${t=>e.onBookmarkFormSubmitted(t)}>
2023-01-07 22:34:35 +01:00
<legend>${s}</legend>
2021-03-19 19:26:15 +01:00
<fieldset class="form-group">
2023-01-07 22:34:35 +01:00
<label for="converse_muc_bookmark_name">${o}</label>
<input class="form-control" type="text" value="${t}" name="name" required="required" id="converse_muc_bookmark_name"/>
2021-03-19 19:26:15 +01:00
</fieldset>
<fieldset class="form-group">
2023-01-07 22:34:35 +01:00
<label for="converse_muc_bookmark_nick">${a}</label>
<input class="form-control" type="text" name="nick" value="${n||""}" id="converse_muc_bookmark_nick"/>
2021-03-19 19:26:15 +01:00
</fieldset>
<fieldset class="form-group form-check">
<input class="form-check-input" id="converse_muc_bookmark_autojoin" type="checkbox" name="autojoin"/>
2023-01-07 22:34:35 +01:00
<label class="form-check-label" for="converse_muc_bookmark_autojoin">${i}</label>
2021-03-19 19:26:15 +01:00
</fieldset>
<fieldset class="form-group">
2023-01-07 22:34:35 +01:00
<input class="btn btn-primary" type="submit" value="${c}">
2023-02-17 12:24:37 +01:00
${e.bookmark?Gu`<input class="btn btn-secondary button-remove" type="button" value="${r}" @click=${t=>e.removeBookmark(t)}>`:""}
2021-03-19 19:26:15 +01:00
</fieldset>
</form>
2023-02-17 12:24:37 +01:00
`})(this)}onBookmarkFormSubmitted(e){e.preventDefault(),nd.bookmarks.createBookmark({jid:this.model.get("jid"),autojoin:e.target.querySelector('input[name="autojoin"]')?.checked||!1,name:e.target.querySelector("input[name=name]")?.value,nick:e.target.querySelector("input[name=nick]")?.value}),this.closeBookmarkForm(e)}removeBookmark(e){this.bookmark?.destroy(),this.closeBookmarkForm(e)}closeBookmarkForm(e){e.preventDefault();const t=document.createEvent("Event");t.initEvent("hide.bs.modal",!0,!0),this.dispatchEvent(t)}}Ih.elements.define("converse-muc-bookmark-form",jw);const Tw=jw;Ih.elements.define("converse-bookmark-form-modal",class extends $_{renderModal(){return Gu`
2022-12-17 22:08:36 +01:00
<converse-muc-bookmark-form class="muc-form-container" jid="${this.jid}">
2023-02-17 12:24:37 +01:00
</converse-muc-bookmark-form>`}getModalTitle(){return Gy("Bookmark")}});const{u:Nw}=Oh.env,Iw={setBookmarkState(){if(void 0!==nd.bookmarks){nd.bookmarks.where({jid:this.model.get("jid")}).length?this.model.save("bookmarked",!0):this.model.save("bookmarked",!1)}},renderBookmarkForm(){if(!this.bookmark_form){this.bookmark_form=new nd.MUCBookmarkForm({model:this.model,chatroomview:this});this.querySelector(".chatroom-body").insertAdjacentElement("beforeend",this.bookmark_form.el)}Nw.showElement(this.bookmark_form.el)},showBookmarkModal(e){e?.preventDefault();const t=this.model.get("jid");Ih.modal.show("converse-bookmark-form-modal",{jid:t},e)}};Oh.plugins.add("converse-bookmark-views",{dependencies:["converse-chatboxes","converse-muc","converse-muc-views"],initialize(){Ih.settings.extend({hide_open_bookmarks:!0}),nd.removeBookmarkViaEvent=Sw,nd.addBookmarkViaEvent=xw,Object.assign(nd.ChatRoomView.prototype,Iw),nd.MUCBookmarkForm=Tw,nd.BookmarksView=kw,Ih.listen.on("getHeadingButtons",ww),Ih.listen.on("chatRoomViewInitialized",(e=>e.setBookmarkState()))}});const Ow=(e,t,n)=>{const s=new Map;for(let i=t;i<=n;i++)s.set(e[i],i);return s},Mw=rb(class extends ob{constructor(e){if(super(e),e.type!==ib)throw Error("repeat() can only be used in text expressions")}ht(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.ht(e,t,n).values}update(e,t){let[n,s,i]=t;var r;const o=(e=>e._$AH)(e),{values:a,keys:c}=this.ht(n,s,i);if(!Array.isArray(o))return this.ut=c,a;const l=null!==(r=this.ut)&&void 0!==r?r:this.ut=[],d=[];let u,h,m=0,g=o.length-1,f=0,p=a.length-1;for(;m<=g&&f<=p;)if(null===o[m])m++;else if(null===o[g])g--;else if(l[m]===c[f])d[f]=tb(o[m],a[f]),m++,f++;else if(l[g]===c[p])d[p]=tb(o[g],a[p]),g--,p--;else if(l[m]===c[p])d[p]=tb(o[m],a[p]),eb(e,d[p+1],o[m]),m++,p--;else if(l[g]===c[f])d[f]=tb(o[g],a[f]),eb(e,o[m],o[g]),g--,f++;else if(void 0===u&&(u=Ow(c,f,p),h=Ow(l,m,g)),u.has(l[m]))if(u.has(l[g])){const t=h.get(c[f]),n=void 0!==t?o[t]:null;if(null===n){const t=eb(e,o[m]);tb(t,a[f]),d[f]=t}else d[f]=tb(n,a[f]),eb(e,o[m],n),o[t]=null;f++}else sb(o[g]),g--;else sb(o[m]),m++;for(;f<=p;){const t=eb(e,d[p+1]);tb(t,a[f]),d[f++]=t}for(;m<=g;){const e=o[m++];null!==e&&sb(e)}return this.ut=c,function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:nb;e._$AH=t}(e,d),Wu}});function Rw(e){const{CONTROLBOX_TYPE:t}=nd,n="overlayed"===Ih.settings.get("view_mode")&&e.get("minimized");return e.get("type")===t||!(e.get("hidden")||n)}Ih.elements.define("converse-chats",class extends Vy{initialize(){this.model=nd.chatboxes,this.listenTo(this.model,"add",(()=>this.requestUpdate())),this.listenTo(this.model,"change:closed",(()=>this.requestUpdate())),this.listenTo(this.model,"change:hidden",(()=>this.requestUpdate())),this.listenTo(this.model,"change:jid",(()=>this.requestUpdate())),this.listenTo(this.model,"change:minimized",(()=>this.requestUpdate())),this.listenTo(this.model,"destroy",(()=>this.requestUpdate())),this.listenTo(nd,"connected",(()=>this.requestUpdate())),this.listenTo(nd,"reconnected",(()=>this.requestUpdate())),this.listenTo(nd,"disconnected",(()=>this.requestUpdate()));const e=sl();this.listenTo(e,"change:view_mode",(()=>this.requestUpdate())),this.listenTo(e,"change:singleton",(()=>this.requestUpdate()));const t=document.getElementById("conversejs-bg");t&&!t.innerHTML.trim()&&lh(Gu`
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>
2023-02-17 12:24:37 +01:00
${"overlayed"===Ih.settings.get("view_mode")?Gu`<div class="converse-brand__padding"></div>`:""}
</div>`,t);document.querySelector("body").classList.add(`converse-${Ih.settings.get("view_mode")}`),Ih.trigger("chatBoxViewsInitialized")}render(){return(()=>{const{chatboxes:e,CONTROLBOX_TYPE:t,CHATROOMS_TYPE:n,HEADLINES_TYPE:s}=nd,i=Ih.settings.get("view_mode"),r=nd?.connection,o=!r?.connected||!r?.authenticated||r?.disconnecting;return Gu`
${o||"overlayed"!==i?"":Gu`<converse-minimized-chats></converse-minimized-chats>`}
${Mw(e.filter(Rw),(e=>e.get("jid")),(e=>e.get("type")===t?Gu`
${"overlayed"===i?Gu`<converse-controlbox-toggle class="${e.get("closed")?"":"hidden"}"></converse-controlbox-toggle>`:""}
2021-11-11 22:06:49 +01:00
<converse-controlbox
id="controlbox"
2022-12-17 22:08:36 +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>
2023-02-17 12:24:37 +01:00
`:e.get("type")===n?Gu`
2021-11-11 22:06:49 +01:00
<converse-muc jid="${e.get("jid")}" class="chatbox chatroom"></converse-muc>
2023-02-17 12:24:37 +01:00
`:e.get("type")===s?Gu`
2021-11-11 22:06:49 +01:00
<converse-headlines jid="${e.get("jid")}" class="chatbox headlines"></converse-headlines>
2023-02-17 12:24:37 +01:00
`:Gu`
2021-11-11 22:06:49 +01:00
<converse-chat jid="${e.get("jid")}" class="chatbox"></converse-chat>
`))}
2023-02-17 12:24:37 +01:00
`})()}});const Dw=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"}))))}};function zw(){const e=.01*window.innerHeight;document.documentElement.style.setProperty("--vh",`${e}px`)}var Lw=n(6931),Pw={};Pw.styleTagTransform=o_(),Pw.setAttributes=n_(),Pw.insert=e_().bind(null,"head"),Pw.domAPI=Ky(),Pw.insertStyleElement=i_();Qy()(Lw.Z,Pw);Lw.Z&&Lw.Z.locals&&Lw.Z.locals;Oh.plugins.add("converse-chatboxviews",{dependencies:["converse-chatboxes","converse-vcard"],initialize(){Ih.promises.add(["chatBoxViewsInitialized"]),Ih.settings.extend({animate:!0}),nd.chatboxviews=new Dw,Ih.listen.on("chatBoxesInitialized",(()=>{nd.chatboxes.on("destroy",(e=>nd.chatboxviews.remove(e.get("jid"))))})),Ih.listen.on("cleanup",(()=>delete nd.chatboxviews)),Ih.listen.on("clearSession",(()=>nd.chatboxviews.closeAllChatBoxes())),Ih.listen.on("chatBoxViewsInitialized",zw),window.addEventListener("resize",zw),Object.assign(Oh,{insertInto(e){const t=nd.chatboxviews?.el;if(t&&!e.contains(t))e.insertAdjacentElement("afterBegin",t);else if(!t)throw new Error("Cannot insert non-existing #conversejs element into the DOM")}})}});var Fw=n(4166),Uw={};Uw.styleTagTransform=o_(),Uw.setAttributes=n_(),Uw.insert=e_().bind(null,"head"),Uw.domAPI=Ky(),Uw.insertStyleElement=i_();Qy()(Fw.Z,Uw);Fw.Z&&Fw.Z.locals&&Fw.Z.locals;const{Strophe:Bw,u:qw}=Oh.env;class Hw extends Vy{static get properties(){return{is_retracted:{type:Boolean},model:{type:Object}}}initialize(){const e=sl();this.listenTo(e,"change:allowed_audio_domains",(()=>this.requestUpdate())),this.listenTo(e,"change:allowed_image_domains",(()=>this.requestUpdate())),this.listenTo(e,"change:allowed_video_domains",(()=>this.requestUpdate())),this.listenTo(e,"change:render_media",(()=>this.requestUpdate())),this.listenTo(this.model,"change",(()=>this.requestUpdate()))}render(){return Gu`${vb(this.renderActions(),"")}`}async renderActions(){const e=this.model.collection.length>2&&this.model===this.model.collection.last(),t=(await this.getActionButtons()).map((e=>Hw.getActionsDropdownItem(e)));return t.length?Gu`<converse-dropdown
2021-11-11 22:06:49 +01:00
class="chat-msg__actions ${e?"dropup dropup--left":"dropleft"}"
.items=${t}
2023-02-17 12:24:37 +01:00
></converse-dropdown>`:""}static getActionsDropdownItem(e){return Gu`
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}"
color="var(--text-color-lighten-15-percent)"
size="1em"
></converse-icon>
${e.i18n_text}
</button>
2023-02-17 12:24:37 +01:00
`}async onMessageEditButtonClicked(e){e.preventDefault();const t=this.model.collection.findWhere("correcting"),n=qw.ancestor(this,".chatbox")?.querySelector(".chat-textarea")?.value;if(n&&(!t||t.getMessageText()!==n)){if(!await Ih.confirm(Gy("You have an unsent message which will be lost if you continue. Are you sure?")))return}t!==this.model?(t?.save("correcting",!1),this.model.save("correcting",!0)):this.model.save("correcting",!1)}async onDirectMessageRetractButtonClicked(){if("me"!==this.model.get("sender"))return Il.error("onMessageRetractButtonClicked called for someone else's message!");const e=Gy("Be aware that other XMPP/Jabber clients (and servers) may not yet support retractions and that this message may not be removed everywhere."),t=[Gy("Are you sure you want to retract this message?")];Ih.settings.get("show_retraction_warning")&&(t[1]=e);if(await Ih.confirm(Gy("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=Gy("A timeout occurred while trying to retract the message");Ih.alert("error",Gy("Error"),e),Il(e,Bw.LogLevel.WARN)}else if(qw.isErrorStanza(n)){const e=Gy("Sorry, you're not allowed to retract this message.");Ih.alert("error",Gy("Error"),e),Il(e,Bw.LogLevel.WARN),Il(n,Bw.LogLevel.WARN)}}async onMUCMessageRetractButtonClicked(){const e=Gy("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=[Gy("Are you sure you want to retract this message?")];if(Ih.settings.get("show_retraction_warning")&&(t[1]=e),await Ih.confirm(Gy("Confirm"),t)){this.model.collection.chatbox.retractOwnMessage(this.model)}}else if(await this.model.mayBeModerated())if("me"===this.model.get("sender")){let t=[Gy("Are you sure you want to retract this message?")];Ih.settings.get("show_retraction_warning")&&(t=[t[0],e,t[1]]),await Ih.confirm(Gy("Confirm"),t)&&this.retractOtherMessage()}else{let t=[Gy("You are about to retract this message."),Gy("You may optionally include a message, explaining the reason for the retraction.")];Ih.settings.get("show_retraction_warning")&&(t=[t[0],e,t[1]]);const n=await Ih.prompt(Gy("Message Retraction"),t,Gy("Optional reason"));!1!==n&&this.retractOtherMessage(n)}else{const e=Gy("Sorry, you're not allowed to retract this message");Ih.alert("error",Gy("Error"),e)}}onMessageRetractButtonClicked(e){e?.preventDefault?.();this.model.collection.chatbox.get("type")===nd.CHATROOMS_TYPE?this.onMUCMessageRetractButtonClicked():this.onDirectMessageRetractButtonClicked()}onMediaToggleClicked(e){if(e?.preventDefault?.(),this.hasHiddenMedia(this.getMediaURLs()))this.model.save({hide_url_previews:!1,url_preview_transition:"fade-in"});else{(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=Ih.settings.get("render_media");return Array.isArray(t)?e.reduce(((e,n)=>e||!Qh(t,n)),!1):!t}getMediaURLs(){const e=(this.model.get("ogp_metadata")||[]).map((e=>({url:e["og:image"],is_image:!0}))).filter((e=>em(e))),t=Fh(this.model.get("media_urls")||[],this.model.get("body")).filter((e=>em(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:Gy(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")?Gy("Cancel Editing"):Gy("Edit"),handler:e=>this.onMessageEditButtonClicked(e),button_class:"chat-msg__action-edit",icon_class:"fa fa-pencil-alt",name:
2021-11-11 22:06:49 +01:00
@mouseover=${()=>this.setHover()}
@mouseleave=${()=>this.unsetHover()}
2023-02-17 12:24:37 +01:00
@click=${e=>this.onControlsClicked(e)}><img class="gif" src="${this.src}"></a></canvas>`}renderErrorFallback(){return"url"===this.fallback?hw(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.frames.length>0&&(this.supergif.options.loop=!0,this.supergif.play())}});const iS=(e,t)=>Gu`<converse-gif autoplay noloop fallback='empty' src=${e}></converse-gif>${t?"":Gu`<a target="_blank" rel="noopener" href="${e}">${e}</a>`}`,{URI:rS}=Oh.env;const oS=rb(class extends mb{render(e,t,n,s){return t?Gu`<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 Gu`<img class="chat-image img-thumbnail"
2022-05-05 23:06:17 +02:00
loading="lazy"
2021-11-11 22:06:49 +01:00
src="${e}"
2022-05-05 23:06:17 +02:00
@click=${s}
@error=${()=>this.onError(e,t,n,s)}
2023-02-17 12:24:37 +01:00
@load=${n}/></a>`}onError(e,t,n,s){if(tm(e))t&&this.setValue(hw(t));else{const i=new rS(e),r=i.filename();i.filename(`${r}.png`),this.setValue(oS(i.toString(),t,n,s))}}}),aS=e=>Gu`${oS(e.src||e.url,e.href,e.onLoad,e.onClick)}`;const cS=rb(class extends ob{render(e,t,n){const s=new US(e,t,Object.assign(n,{show_images:!1,embed_videos:!1,embed_audio:!1}));return Gu`${vb(async function(e){try{await e.addTemplates()}catch(e){Il.error(e)}return e.payload}(s),Gu`${s}`)}`}}),lS=["*","_","~","`"],dS=[...lS,"```",">"],uS={"*":{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"}},hS=["_",">","`","~"],mS={emphasis:(e,t,n)=>Gu`<span class="styling-directive">_</span><i>${cS(e,t,n)}</i><span class="styling-directive">_</span>`,preformatted:e=>Gu`<span class="styling-directive">\`</span><code>${e}</code><span class="styling-directive">\`</span>`,preformatted_block:e=>Gu`<div class="styling-directive">\`\`\`</div><code class="block">${e}</code><div class="styling-directive">\`\`\`</div>`,quote:(e,t,n)=>Gu`<blockquote>${cS(e,t,n)}</blockquote>`,strike:(e,t,n)=>Gu`<span class="styling-directive">~</span><del>${cS(e,t,n)}</del><span class="styling-directive">~</span>`,strong:(e,t,n)=>Gu`<span class="styling-directive">*</span><b>${cS(e,t,n)}</b><span class="styling-directive">*</span>`};function gS(e,t){let n,s=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(/(^```[\s,\u200B]*\n)|(^```[\s,\u200B]*$)/.test(e.slice(t))&&(0===t||">"===e[t-1]||/\n\u200B{0,2}$/.test(e.slice(0,t))))n=e.slice(t,t+3);else{if(!dS.includes(e.slice(t,t+1)))return null;if(n=e.slice(t,t+1),!function(e,t,n,s){if(s){const s=RegExp(hS.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(pS(e)&&n>0&&"\n"!==t[n-1])return!1;if(lS.includes(e)&&t[n+1]===e)return!1}else{const s=RegExp(hS.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(lS.includes(e)&&t[n-1]===e)return!1}return!0}(n,e,t,s))return null}return n}function fS(e,t){const n=gS(e,t),s=n?function(e,t,n){if(!e)return 0;const s=n;if(n+=e.length,pS(e))return(n+=t.slice(n).split(/\n[^>]/).shift().length)-s;if("span"===uS[e].type){const s=t.slice(n).split("\n").shift();let i=0,r=s.indexOf(e);for(;-1!==r;){if(gS(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(gS(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 pS=e=>[">","&gt;"].includes(e);function vS(e,t,n,s){const i=mS[uS[e].name];if(pS(e)){return i(t.replace(/\n>\s/g,"\n").replace(/\n>/g,"\n").replace(/\n$/,""),n,s)}return i(t,n,s)}var yS=n(9046),_S=n.n(yS);const bS=e=>Gu`
<div class="message date-separator" data-isodate="${e.time}">
<hr class="separator"/>
<time class="separator-text" datetime="${e.time}"><span>${e.datestring}</span></time>
</div>
`,wS=new RegExp("<object[^>]*>.*?</object>|<span[^>]*>.*?</span>|<(?:object|embed|svg|img|div|span|p|a)[^>]*>|((\\s|^)(\\*\\\\0\\/\\*|\\*\\\\O\\/\\*|\\-___\\-|\\:'\\-\\)|'\\:\\-\\)|'\\:\\-D|\\>\\:\\-\\)|>\\:\\-\\)|'\\:\\-\\(|\\>\\:\\-\\(|>\\:\\-\\(|\\:'\\-\\(|O\\:\\-\\)|0\\:\\-3|0\\:\\-\\)|0;\\^\\)|O;\\-\\)|0;\\-\\)|O\\:\\-3|\\-__\\-|\\:\\-Þ|\\:\\-Þ|\\<\\/3|<\\/3|\\:'\\)|\\:\\-D|'\\:\\)|'\\=\\)|'\\:D|'\\=D|\\>\\:\\)|>\\:\\)|\\>;\\)|>;\\)|\\>\\=\\)|>\\=\\)|;\\-\\)|\\*\\-\\)|;\\-\\]|;\\^\\)|'\\:\\(|'\\=\\(|\\:\\-\\*|\\:\\^\\*|\\>\\:P|>\\:P|X\\-P|\\>\\:\\[|>\\:\\[|\\:\\-\\(|\\:\\-\\[|\\>\\:\\(|>\\:\\(|\\:'\\(|;\\-\\(|\\>\\.\\<|>\\.<|#\\-\\)|%\\-\\)|X\\-\\)|\\\\0\\/|\\\\O\\/|0\\:3|0\\:\\)|O\\:\\)|O\\=\\)|O\\:3|B\\-\\)|8\\-\\)|B\\-D|8\\-D|\\-_\\-|\\>\\:\\\\|>\\:\\\\|\\>\\:\\/|>\\:\\/|\\:\\-\\/|\\:\\-\\.|\\:\\-P|\\:Þ|\\:Þ|\\:\\-b|\\:\\-O|O_O|\\>\\:O|>\\:O|\\:\\-X|\\:\\-#|\\:\\-\\)|\\(y\\)|\\<3|<3|\\:D|\\=D|;\\)|\\*\\)|;\\]|;D|\\:\\*|\\=\\*|\\:\\(|\\:\\[|\\=\\(|\\:@|;\\(|D\\:|\\:\\$|\\=\\$|#\\)|%\\)|X\\)|B\\)|8\\)|\\:\\/|\\:\\\\|\\=\\/|\\=\\\\|\\:L|\\=L|\\:P|\\=P|\\:b|\\:O|\\:X|\\:#|\\=X|\\=#|\\:\\)|\\=\\]|\\=\\)|\\:\\])(?=\\s|$|[!,.?]))","gi"),SS=/(?:\ud83d\udc68\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffc-\udfff]|\ud83d\udc68\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffd-\udfff]|\ud83d\udc68\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc68\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffd\udfff]|\ud83d\udc68\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffe]|\ud83d\udc69\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffc-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffc-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffd-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb\udffd-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc69\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc69\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffd\udfff]|\ud83d\udc69\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb-\udffd\udfff]|\ud83d\udc69\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffe]|\ud83d\udc69\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb-\udffe]|\ud83e\uddd1\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\u200d\ud83e\udd1d\u200d\ud83e\uddd1|\ud83d\udc6b\ud83c[\udffb-\udfff]|\ud83d\udc6c\ud83c[\udffb-\udfff]|\ud83d\udc6d\ud83c[\udffb-\udfff]|\ud83d[\udc6b-\udc6d])|(?:\ud83d[\udc68\udc69]|\ud83e\uddd1)(?:\ud83c[\udffb-\udfff])?\u200d(?:\u2695\ufe0f|\u2696\ufe0f|\u2708\ufe0f|\ud83c[\udf3e\udf73\udf93\udfa4\udfa8\udfeb\udfed]|\ud83d[\udcbb\udcbc\udd27\udd2c\ude80\ude92]|\ud83e[\uddaf-\uddb3\uddbc\uddbd])|(?:\ud83c[\udfcb\udfcc]|\ud83d[\udd74\udd75]|\u26f9)((?:\ud83c[\udffb-\udfff]|\ufe0f)\u200d[\u2640\u2642]\ufe0f)|(?:\ud83c[\udfc3\udfc4\udfca]|\ud83d[\udc6e\udc71\udc73\udc77\udc81\udc82\udc86\udc87\ude45-\ude47\ude4b\ude4d\ude4e\udea3\udeb4-\udeb6]|\ud83e[\udd26\udd35\udd37-\udd39\udd3d\udd3e\uddb8\uddb9\uddcd-\uddcf\uddd6-\udddd])(?:\ud83c[\udffb-\udfff])?\u200d[\u2640\u2642]\ufe0f|(?:\ud83d\udc68\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68|\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d[\
2022-12-17 22:08:36 +01:00
<a
href="#"
class="chatbox-btn ${t.a_class}"
@click=${t.handler}
title="${t.i18n_title}"
>
<converse-icon
size="1em"
class="fa ${t.icon_class}"
></converse-icon>
</a>
2023-02-17 12:24:37 +01:00
`}(e))).reverse().map((e=>vb(e,"")))))}function MS(e){return e.then((e=>{const t=e.filter((e=>!e.standalone)).map((e=>async function(e){const t=await e;return t?Gu`
2022-12-17 22:08:36 +01:00
<a href="#" class="dropdown-item ${t.a_class}" @click=${t.handler} title="${t.i18n_title}">
<converse-icon
size="1em"
class="fa ${t.icon_class}"
></converse-icon>
${t.i18n_text}
</a>
2023-02-17 12:24:37 +01:00
`:""}(e)));return t.length?Gu`<converse-dropdown class="chatbox-btn dropleft" .items=${t}></converse-dropdown>`:""}))}function RS(e){if(!e.isHidden()&&Ih.settings.get("allow_url_history_change")){const t=window.location.hash;t&&e.messages.get(t.slice(1))&&nd.router.history.navigate()}}const DS=_S()((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,RS(t.model)):i&&Ih.trigger("chatBoxScrolledUp",t),t.model.get("scolled")!==n&&t.model.ui.set({scrolled:n})}(e)),50);function zS(e){if("groupchat"===e.get("type")){const t=Ih.settings.get("muc_hats").filter((e=>e)).map((e=>e.toLowerCase()));let n=[];t.includes("vcard_roles")&&(n=e.vcard?e.vcard.get("role"):null,n=n?n.split(",").filter((e=>e)).map((e=>({title:e}))):[]);const s=[...e.occupant?[e.occupant.get("role")]:[],...e.occupant?[e.occupant.get("affiliation")]:[]].filter((e=>e)).filter((e=>t.includes(e.toLowerCase()))).map((e=>({title:e})));return[...t.includes("xep317")&&e.occupant?.get("hats")||[],...n,...s]}return[]}function LS(){var e;return Oh.emojis.toned||(Oh.emojis.toned=(e=Object.values(Oh.emojis.json.people).filter((e=>e.sn.includes("_tone"))).map((e=>e.sn.replace(/_tone[1-5]/,""))),[...new Set(e)])),Oh.emojis.toned}function PS(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{unicode_only:!1,add_title_wrapper:!1};const n=e.emoji,s=e.shortname;if(n){if(t.unicode_only)return n;if(Ih.settings.get("use_system_emojis"))return t.add_title_wrapper&&s?Gu`<span title="${s}">${n}</span>`:n;{const t=Ih.settings.get("emoji_image_path");return Gu`<img class="emoji"
2022-05-05 23:06:17 +02:00
loading="lazy"
draggable="false"
title="${s}"
alt="${n}"
2023-02-17 12:24:37 +01:00
src="${t}/72x72/${e.cp}.png"/>`}}return t.unicode_only?s:Gu`<img class="emoji"
2022-05-05 23:06:17 +02:00
loading="lazy"
draggable="false"
title="${s}"
alt="${s}"
2023-02-17 12:24:37 +01:00
src="${Oh.emojis.by_sn[s].url}">`}Object.assign(IS,{shortnamesToEmojis:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{unicode_only:!1,add_title_wrapper:!1};return function(e,t){let n=[e];return[...kS(e),...jS(e)].sort(((e,t)=>t.begin-e.begin)).forEach((e=>{const s=n.shift(),i=PS(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=$S(e),t)}});const FS=e=>"string"==typeof e;class US extends String{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};super(e),this.embed_audio=n?.embed_audio,this.embed_videos=n?.embed_videos,this.mentions=n?.mentions||[],this.media_urls=n?.media_urls,this.nick=n?.nick,this.offset=t,this.onImgClick=n?.onImgClick,this.onImgLoad=n?.onImgLoad,this.options=n,this.payload=[],this.references=[],this.render_styling=n?.render_styling,this.show_images=n?.show_images,this.hide_media_urls=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:Yh(e,t)}addHyperlinks(e,t){const n=t+this.offset;Fh(this.media_urls||hm(e,t).media_urls||[],e,n).filter((e=>!e.is_encrypted)).forEach((e=>{const n=e.url,s=Kh(n);let i;i=nm(n)&&this.shouldRenderMedia(n,"image")?iS(s,this.hide_media_urls):rm(n)&&this.shouldRenderMedia(n,"image")?aS({src:s,href:this.hide_media_urls?null:s,onClick:this.onImgClick,onLoad:this.onImgLoad}):im(n)&&this.shouldRenderMedia(n,"video")?Yb(s,this.hide_media_urls):sm(n)&&this.shouldRenderMedia(n,"audio")?Pb(s,this.hide_media_urls):hw(s),this.addTemplateResult(e.start+t,e.end+t,i)}))}addMapURLs(e,t){const n=/geo:([\-0-9.]+),([\-0-9.]+)(?:,([\-0-9.]+))?(?:\?(.*))?/g,s=e.matchAll(n);for(const e of s)this.addTemplateResult(e.index+t,e.index+e[0].length+t,hw(e[0].replace(n,Ih.settings.get("geouri_replacement"))))}addEmojis(e,t){[...kS(e.toString()),...jS(e.toString())].forEach((e=>{this.addTemplateResult(e.begin+t,e.end+t,PS(e,{add_title_wrapper:!0}))}))}addMentions(e,t){const n=t+this.offset;this.mentions?.forEach((s=>{const i=Number(s.begin)-n;if(i<0||i>=n+e.length)return;const r=Number(s.end)-n,o=e.slice(i,r);o===this.nick?this.addTemplateResult(i+t,r+t,(e=>Gu`<span class="mention mention--self badge badge-info" data-uri="${e.uri}">${e.mention}</span>`)({...s,mention:o})):this.addTemplateResult(i+t,r+t,(e=>Gu`<span class="mention" data-uri="${e.uri}">${e.mention}</span>`)({...s,mention:o}))}))}addStyling(){if(!function(e){for(let t=0;t<dS.length;t++)if(e.includes(dS[t]))return!0}(this))return;const e=[],t=this.mentions.map((e=>Array.from({length:Number(e.end)},((t,n)=>Number(e.begin)+n))));let n=0;for(;n<this.length;){if(t.filter((e=>e.includes(n))).length){n++;continue}const{d:s,length:i}=fS(this,n);if(s&&i){const t=pS(s),r=n+i,o=t?r:r-s.length;let a="```"===s?n+s.length+1:n+s.length;t&&" "===this[a]&&(a+=1);const c=a,l=this.slice(a,o);e.push({begin:n,template:vS(s,l,c,this.options),end:r}),n=r}n++}e.forEach((e=>this.addTemplateResult(e.begin,e.end,e.template)))}trimMeMessage(){0===this.offset&&this.isMeCommand()&&(this.payload[0]=this.payload[0].substring(4))}addAnnotations(e){const t=this.marshall();let n=0;for(const s of t)s&&(FS(s)?(e.call(this,s,n),n+=s.length):n=s.end)}async addTemplates(){await Ih.trigger("beforeMessageBodyTransformed",this,{Synchronous:!0}),this.render_styling&&this.addStyling(),this.addAnnotations(this.addMentions),this.addAnnotations(this.addHyperlinks),this.addAnnotations(this.addMapURLs),await Ih.emojis.initialize(),this.addAnnotations(this.addEmojis),await Ih.trigger("afterMessageBodyTransformed",this,{Synchronous:!0}),this.payload=this.marshall(),this.options.show_me_message&&this.trimMeMessage(),this.payload=this.payload.map((e=>FS(e)?e:e.template))}addTemplateResult(e,t,n){this.references.push({begin:e,end:t,template:n})}isMeCommand(){const e=this.toString();return!!e&&e.startsWith("/me ")}marshall(){let e=[this.toString()];return this.references.sort(((e,t)=>
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">
2022-12-17 22:08:36 +01:00
<converse-icon 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">
2023-02-17 12:24:37 +01:00
${this.items.map((e=>vb(e,"")))}
2021-11-11 22:06:49 +01:00
</div>
2023-02-17 12:24:37 +01:00
`}firstUpdated(){super.firstUpdated(),this.initArrowNavigation()}connectedCallback(){super.connectedCallback(),this.hideOnEscape=e=>e.keyCode===Dl.ESCAPE&&this.hideMenu(),document.addEventListener("keydown",this.hideOnEscape)}disconnectedCallback(){document.removeEventListener("keydown",this.hideOnEscape),super.disconnectedCallback()}hideMenu(){super.hideMenu(),this.navigator?.disable()}initArrowNavigation(){if(!this.navigator){const e={selector:".dropdown-item",onSelected:e=>e.focus()};this.navigator=new XS(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!==Dl.DOWN_ARROW||this.navigator.enabled||this.enableArrowNavigation(e)}}Ih.elements.define("converse-dropdown",ix);var rx=n(2751),ox={};ox.styleTagTransform=o_(),ox.setAttributes=n_(),ox.insert=e_().bind(null,"head"),ox.domAPI=Ky(),ox.insertStyleElement=i_();Qy()(rx.Z,ox);rx.Z&&rx.Z.locals&&rx.Z.locals;const{dayjs:ax}=Oh.env;Ih.elements.define("converse-message-versions",class extends Vy{static get properties(){return{model:{type:Object}}}render(){const e=this.model.get("older_versions"),t=Object.keys(e);return Gu`
${t.length?Gu`<h4>${Gy("Older versions")}</h4> ${t.map((t=>((e,t)=>Gu`<p class="older-msg"><time>${ax(e).format("MMM D, YYYY, HH:mm:ss")}</time>: ${t[e]}</p>`)(t,e)))}`:Gu`<h4>${Gy("No older versions found")}</h4>`}
2021-11-11 22:06:49 +01:00
<hr/>
2023-02-17 12:24:37 +01:00
<h4>${Gy("Current version")}</h4>
<p><time>${ax(this.model.get("time")).format("MMM D, YYYY, HH:mm:ss")}</time>: ${this.model.getMessageText()}</p>`}});Ih.elements.define("converse-message-versions-modal",class extends $_{renderModal(){return Gu`<converse-message-versions .model=${this.model}></converse-message-versions>`}getModalTitle(){return Gy("Message versions")}});const cx=e=>{const t=void 0!==e.model.contact,n=Gy("Refresh"),s=Ih.settings.get("allow_contact_removal");return Gu`
2022-12-17 22:08:36 +01:00
<div class="modal-footer">
2023-02-17 12:24:37 +01:00
${S_}
2022-12-17 22:08:36 +01:00
<button type="button" class="btn btn-info refresh-contact" @click=${t=>e.refreshContact(t)}>
<converse-icon
class="fa fa-refresh"
color="var(--text-color-lighten-15-percent)"
size="1em"
></converse-icon>
${n}</button>
2023-02-17 12:24:37 +01:00
${s&&t?(e=>{const t=Gy("Remove as contact");return Gu`
2022-12-17 22:08:36 +01:00
<button type="button" @click="${t=>e.removeContact(t)}" class="btn btn-danger remove-contact">
2022-04-02 21:20:14 +02:00
<converse-icon
class="fas fa-trash-alt"
color="var(--text-color-lighten-15-percent)"
size="1em"
></converse-icon>
${t}
2021-11-11 22:06:49 +01:00
</button>
`})(e):""}
2022-12-17 22:08:36 +01:00
</div>
2023-02-17 12:24:37 +01:00
`};function lx(e){nd.roster?.get(e.get("jid"))?.trigger("highlight")}function dx(e,t){const n=nd.roster_filter,s=n.get("filter_type"),i="state"===s?n.get("chat_state").toLowerCase():n.get("filter_text").toLowerCase();if(!i)return!1;if("state"===s){return![nd.HEADER_REQUESTING_CONTACTS,nd.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))}return"contacts"===s?!e.getFilterCriteria().includes(i):void 0}function ux(e){const t=nd.roster_filter;if("groups"===t.get("filter_type")){const n=t.get("filter_text")?.toLowerCase();if(!n)return!0;if(!e.toLowerCase().includes(n))return!1}return!0}const hx=Oh.env.utils;Ih.elements.define("converse-user-details-modal",class extends $_{initialize(){super.initialize(),this.model.rosterContactAdded.then((()=>this.registerContactEventHandlers())),this.listenTo(this.model,"change",this.render),this.registerContactEventHandlers(),Ih.trigger("userDetailsModalInitialized",this.model)}renderModal(){return(e=>{const t=e.model?.vcard,n=t?t.toJSON():{},s={...e.model.toJSON(),...n},i=Gy("XMPP Address"),r=Gy("Email"),o=Gy("Full Name"),a=Gy("Nickname"),c=Gy("The User's Profile Image"),l=Gy("Role"),d=Gy("URL"),u={alt_text:c,extra_classes:"mb-3",height:"120",width:"120"};return Gu`
2022-12-17 22:08:36 +01:00
<div class="modal-body">
2023-02-17 12:24:37 +01:00
${s.image?Gu`<div class="mb-4">${Z_(Object.assign(s,u))}</div>`:""}
${s.fullname?Gu`<p><label>${o}:</label> ${s.fullname}</p>`:""}
2023-01-07 22:34:35 +01:00
<p><label>${i}:</label> <a href="xmpp:${s.jid}">${s.jid}</a></p>
2023-02-17 12:24:37 +01:00
${s.nickname?Gu`<p><label>${a}:</label> ${s.nickname}</p>`:""}
${s.url?Gu`<p><label>${d}:</label> <a target="_blank" rel="noopener" href="${s.url}">${s.url}</a></p>`:""}
${s.email?Gu`<p><label>${r}:</label> <a href="mailto:${s.email}">${s.email}</a></p>`:""}
${s.role?Gu`<p><label>${l}:</label> ${s.role}</p>`:""}
2021-03-19 19:26:15 +01:00
2023-01-07 22:34:35 +01:00
<converse-omemo-fingerprints jid=${s.jid}></converse-omemo-fingerprints>
2021-11-11 22:06:49 +01:00
</div>
2023-02-17 12:24:37 +01:00
`})(this)}renderModalFooter(){return cx(this)}getModalTitle(){return this.model.getDisplayName()}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");hx.addClass("fa-spin",t);try{await Ih.vcard.update(this.model.contact.vcard,!0)}catch(e){Il.fatal(e),this.alert(Gy("Sorry, something went wrong while trying to refresh"),"danger")}hx.removeClass("fa-spin",t)}async removeContact(e){if(e?.preventDefault?.(),!Ih.settings.get("allow_contact_removal"))return;await Ih.confirm(Gy("Are you sure you want to remove this contact?"))&&(setTimeout((()=>function(e){e.removeFromRoster((()=>e.destroy()),(t=>{t&&Il.error(t),Ih.alert("error",Gy("Error"),[Gy("Sorry, there was an error while trying to remove %1$s as a contact.",e.getDisplayName())])}))}(this.model.contact)),1),this.modal.hide())}});const{dayjs:mx}=Oh.env,{dayjs:gx}=Oh.env;function fx(e){return!!Jh(e).host()}Ih.elements.define("converse-image",class extends Vy{static get properties(){return{src:{type:String},onImgLoad:{type:Function},href:{type:String}}}render(){return nm(this.src)&&Yh(this.src,"image")?iS(Kh(this.src),!0):aS({src:Kh(this.src),href:this.href,onClick:this.onImgClick,onLoad:this.onImgLoad})}});const px=e=>{const t=(n=e.image)&&Xh(n,"allowed_image_domains")&&fx(n);var n;const s=e.title||e.description||e.url;return t||s?Gu`<div class="card card--unfurl">
${t?(e=>Gu`<converse-image class="card-img-top hor_centered" href="${e.url}" src="${e.image}" .onImgLoad=${e.onload}></converse-image>`)(e):""}
${s?Gu` <div class="card-body">
${e.title?((e,t)=>e.url&&fx(e.url)&&!nm(e.image)?Gu`<a href="${e.url}" target="_blank" rel="noopener">${t(e)}</a>`:t(e))(e,(e=>Gu`<h5 class="card-title">${e.title}</h5>`)):""}
${e.description?Gu`<p class="card-text">
2022-01-03 11:54:10 +01:00
<converse-rich-text text=${e.description}></converse-rich-text>
</p>`:""}
2023-02-17 12:24:37 +01:00
${e.url?Gu`<p class="card-text">
<a href="${e.url}" target="_blank" rel="noopener">${Jh(e.url).domain()}</a>
2022-01-03 11:54:10 +01:00
</p>`:""}
</div>`:""}
2023-02-17 12:24:37 +01:00
</div>`:""};var vx=n(5046),yx={};yx.styleTagTransform=o_(),yx.setAttributes=n_(),yx.insert=e_().bind(null,"head"),yx.domAPI=Ky(),yx.insertStyleElement=i_();Qy()(vx.Z,yx);vx.Z&&vx.Z.locals&&vx.Z.locals;Ih.elements.define("converse-message-unfurl",class extends Vy{static get properties(){return{description:{type:String},image:{type:String},jid:{type:String},title:{type:String},url:{type:String}}}initialize(){const e=sl();this.listenTo(e,"change:allowed_image_domains",(()=>this.requestUpdate())),this.listenTo(e,"change:render_media",(()=>this.requestUpdate()))}render(){return px(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}))}});const _x=e=>{const t=Gy("Show more"),n="groupchat"===e.model.get("type"),s=Gy("Show less"),i=Gu`
2022-01-03 11:54:10 +01:00
<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}>
2022-04-02 21:20:14 +02:00
<converse-icon size="1em" color="var(--background)" class="fa ${e.model.get("is_spoiler_visible")?"fa-eye-slash":"fa-eye"}"></converse-icon>
2022-05-05 23:06:17 +02:00
${e.model.get("is_spoiler_visible")?s:t}
2022-01-03 11:54:10 +01:00
</a>
</div>
2023-02-17 12:24:37 +01:00
`,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 Gu`
2022-05-05 23:06:17 +02:00
${e.model.get("is_spoiler")?i:""}
2023-02-17 12:24:37 +01:00
${e.model.get("subject")?Gu`<div class="chat-msg__subject">${e.model.get("subject")}</div>`:""}
2022-12-17 22:08:36 +01:00
<span class="chat-msg__body--wrapper">
2022-01-03 11:54:10 +01:00
<converse-chat-message-body
2022-12-17 22:08:36 +01:00
class="chat-msg__text ${e.model.get("is_only_emojis")?"chat-msg__text--larger":""} ${r}"
2022-01-03 11:54:10 +01:00
.model="${e.model}"
hide_url_previews=${e.model.get("hide_url_previews")}
?is_me_message=${e.model.isMeCommand()}
2022-12-17 22:08:36 +01:00
text="${o}"></converse-chat-message-body>
2023-02-17 12:24:37 +01:00
${!e.model.get("received")||e.model.isMeCommand()||n?"":Gu`<converse-icon size="1em" color="var(--chat-color)" class="fa fa-check chat-msg__receipt"></converse-icon>`}
${e.model.get("edited")?(e=>{const t=Gy("This message has been edited");return Gu`<converse-icon title="${t}" class="fa fa-edit chat-msg__edit-modal" @click=${e.showMessageVersionsModal} size="1em"></converse-icon>`})(e):""}
2022-01-03 11:54:10 +01:00
</span>
2023-02-17 12:24:37 +01:00
${a?Gu`<div class="chat-msg__media">${dw(e.model.get("oob_url"))}</div>`:""}
2022-01-03 11:54:10 +01:00
<div class="chat-msg__error">${e.model.get("error_text")||e.model.get("error")}</div>
2023-02-17 12:24:37 +01:00
`};var bx=n(9523),wx={};wx.styleTagTransform=o_(),wx.setAttributes=n_(),wx.insert=e_().bind(null,"head"),wx.domAPI=Ky(),wx.insertStyleElement=i_();Qy()(bx.Z,wx);bx.Z&&bx.Z.locals&&bx.Z.locals;const{Strophe:Sx,dayjs:xx}=Oh.env;Ih.elements.define("converse-chat-message",class extends Vy{static get properties(){return{jid:{type:String},mid:{type:String}}}async initialize(){if(await this.setModels(),!this.model)return void Il.error("Could not find module for converse-chat-message");const e=sl();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 Ih.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?J_():this.model.get("file")&&this.model.get("upload")!==nd.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 Gu`
2022-05-05 23:06:17 +02:00
<div class="retraction">${t}</div>
2023-02-17 12:24:37 +01:00
${e.model.get("moderation_reason")?Gu`<q class="chat-msg--retracted__reason">${e.model.get("moderation_reason")}</q>`:""}`})(this)}renderMessageText(){return _x(this)}renderMEPMessage(){return(e=>{const t=gx(e.model.get("time")).toISOString();return Gu`
2022-01-03 11:54:10 +01:00
<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">
2023-02-17 12:24:37 +01:00
${e.isRetracted()?e.renderRetraction():Gu`
2022-01-03 11:54:10 +01:00
<converse-rich-text
.mentions=${e.model.get("references")}
render_styling
text=${e.model.getMessageText()}>
</converse-rich-text>
2023-02-17 12:24:37 +01:00
${e.model.get("reason")?Gu`<q class="reason"><converse-rich-text text=${e.model.get("reason")}></converse-rich-text></q>`:""}
2022-01-03 11:54:10 +01:00
`}
</div>
<converse-message-actions
?is_retracted=${e.isRetracted()}
.model=${e.model}></converse-message-actions>
</div>
</div>
2023-02-17 12:24:37 +01:00
</div>`})(this)}renderInfoMessage(){return(e=>{const t=mx(e.model.get("time")).toISOString(),n=Gy("Retry");return Gu`
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>
2023-02-17 12:24:37 +01:00
${e.model.get("reason")?Gu`<q class="reason">${e.model.get("reason")}</q>`:""}
${e.model.get("error_text")?Gu`<q class="reason">${e.model.get("error_text")}</q>`:""}
${e.model.get("retry_event_id")?Gu`<a class="retry" @click=${e.onRetryClicked}>${n}</a>`:""}
</div>`})(this)}renderFileProgress(){return this.model.file?(e=>{const t=Gy("Uploading file:"),n=e.model.file.name,s=zh()(e.model.file.size);return Gu`
2022-01-03 11:54:10 +01:00
<div class="message chat-msg">
2023-02-17 12:24:37 +01:00
${e.shouldShowAvatar()?Gu`<a class="show-msg-author-modal" @click=${e.showUserModal}>
2022-01-03 11:54:10 +01:00
<converse-avatar class="avatar align-self-center"
2023-01-07 22:34:35 +01:00
.data=${e.model.vcard?.attributes}
nonce=${e.model.vcard?.get("vcard_updated")}
2022-01-03 11:54:10 +01:00
height="40" width="40"></converse-avatar>
</a>`:""}
<div class="chat-msg__content">
2023-01-07 22:34:35 +01:00
<span class="chat-msg__text">${t} <strong>${n}</strong>, ${s}</span>
2022-01-03 11:54:10 +01:00
<progress value="${e.model.get("progress")}"/>
</div>
2023-02-17 12:24:37 +01:00
</div>`})(this):""}renderChatMessage(){return((e,t)=>{const n=Gy("New messages"),s=e.model.isFollowup();return Gu`
${t.is_first_unread?Gu`<div class="message separator"><hr class="separator"><span class="separator-text">${n}</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
2023-02-17 12:24:37 +01:00
${t.should_show_avatar&&!s?Gu`<a class="show-msg-author-modal" @click=${e.showUserModal}>
2022-01-03 11:54:10 +01:00
<converse-avatar
class="avatar align-self-center"
2023-01-07 22:34:35 +01:00
.data=${e.model.vcard?.attributes}
nonce=${e.model.vcard?.get("vcard_updated")}
2022-01-03 11:54:10 +01:00
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":""}">
2023-02-17 12:24:37 +01:00
${t.is_me_message||s?"":Gu`
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>
2023-02-17 12:24:37 +01:00
${t.hats.map((e=>Gu`<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>
2023-02-17 12:24:37 +01:00
${t.is_encrypted?Gu`<converse-icon class="fa fa-lock" size="1.1em"></converse-icon>`:""}
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">
2023-02-17 12:24:37 +01:00
${t.is_me_message?Gu`
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
2023-02-17 12:24:37 +01:00
${e.model.get("ogp_metadata")?.map((t=>!0===e.model.get("hide_url_previews")?"":Yh(t["og:image"],"image")?Gu`<converse-message-unfurl
2021-11-11 22:06:49 +01:00
@animationend="${e.onUnfurlAnimationEnd}"
class="${e.model.get("url_preview_transition")}"
2023-01-07 22:34:35 +01:00
jid="${e.chatbox?.get("jid")}"
2021-11-11 22:06:49 +01:00
description="${t["og:description"]||""}"
title="${t["og:title"]||""}"
image="${t["og:image"]||""}"
2023-01-07 22:34:35 +01:00
url="${t["og:url"]||""}"></converse-message-unfurl>`:""))}
2021-03-19 19:26:15 +01:00
</div>
2023-02-17 12:24:37 +01:00
</div>`})(this,this.getProps())}shouldShowAvatar(){return Ih.settings.get("show_message_avatar")&&!this.model.isMeCommand()&&["chat","groupchat","normal"].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 Ih.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(){return this.model.occupant?.get("affiliation")}getOccupantRole(){return this.model.occupant?.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=Ih.settings.get("time_format");return{pretty_time:xx(this.model.get("edited")||this.model.get("time")).format(e),has_mentions:this.hasMentions(),hats:zS(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:Sx.getResourceFromJid(e)}));const n=this.model.mod?this.model.mod.getDisplayName():"A moderator";return Gy("%1$s has removed this message",n)}return Gy("%1$s has removed this message",this.model.getDisplayName())}showUserModal(e){if("me"===this.model.get("sender"))Ih.modal.show("converse-profile-modal",{model:this.model},e);else if("groupchat"===this.model.get("type"))e.preventDefault(),Ih.modal.show("converse-muc-occupant-modal",{model:this.model.occupant,message:this.model},e);else{e.preventDefault();const t=this.model.collection.chatbox;Ih.modal.show("converse-user-details-modal",{model:t},e)}}showMessageVersionsModal(e){e.preventDefault(),Ih.modal.show("converse-message-versions-modal",{model:this.model},e)}toggleSpoilerMessage(e){e?.preventDefault(),this.model.save({is_spoiler_visible:!this.model.get("is_spoiler_visible")})}});Ih.elements.define("converse-message-history",class extends Vy{static get properties(){return{model:{type:Object},messages:{type:Array}}}render(){const e=this.messages;return e.length?Mw(e,(e=>e.get("id")),(e=>Gu`${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=Ih.hook(t,e,"");return vb(n,"")}{const t=Gu`<converse-chat-message
2021-11-11 22:06:49 +01:00
jid="${this.model.get("jid")}"
2023-02-17 12:24:37 +01:00
mid="${e.get("id")}"></converse-chat-message>`,n=function(e){const t=e.collection?.models;if(!t)return;const n=t.indexOf(e),s=t[n-1];if(!s||NS(e.get("time")).isAfter(NS(s.get("time")),"day")){const t=NS(e.get("time")).startOf("day");return bS({type:"date",time:t.toISOString(),datestring:t.format("dddd MMM Do YYYY")})}}(e);return n?[n,t]:t}}});var Ex=n(8054),Ax={};Ax.styleTagTransform=o_(),Ax.setAttributes=n_(),Ax.insert=e_().bind(null,"head"),Ax.domAPI=Ky(),Ax.insertStyleElement=i_();Qy()(Ex.Z,Ax);Ex.Z&&Ex.Z.locals&&Ex.Z.locals;Ih.elements.define("converse-chat-content",class extends Vy{static get properties(){return{jid:{type:String}}}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("scroll",DS)}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",DS)}async setModels(){this.model=await Ih.chatboxes.get(this.jid),await this.model.initialized,this.requestUpdate()}render(){return this.model?Gu`
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>
2023-02-17 12:24:37 +01:00
${this.model.ui?.get("chat-content-spinner-top")?J_():""}
`:""}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;Ih.trigger("chatBoxScrolledDown",{chatbox:this.model})}}});class Cx extends ob{constructor(e){if(super(e),this.it=Vu,e.type!==ib)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===Vu||null==e)return this._t=void 0,this.it=e;if(e===Wu)return e;if("string"!=typeof e)throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}Cx.directiveName="unsafeHTML",Cx.resultType=1;const $x=rb(Cx);Ih.elements.define("converse-chat-help",class extends Vy{static get properties(){return{chat_type:{type:String},messages:{type:Array},model:{type:Object},type:{type:String}}}render(){const e=(new Date).toISOString();return[Gu`<converse-icon class="fas fa-times close-chat-help"
2021-03-19 19:26:15 +01:00
@click=${this.close}
2023-02-17 12:24:37 +01:00
path-prefix="${Ih.settings.get("assets_path")}"
size="1em"></converse-icon>`,...this.messages.map((t=>this.renderHelpMessage({isodate:e,markup:zo().sanitize(t,{ALLOWED_TAGS:["strong"]})})))]}close(){this.model.set({show_help_messages:!1})}renderHelpMessage(e){return Gu`<div class="message chat-${this.type}" data-isodate="${e.isodate}">${$x(e.markup)}</div>`}});const kx=Oh.env.utils,jx=e=>{const t=Ih.settings.get("emoji_categories");return Gu`<ul>${Object.keys(t).map((n=>t[n]?(e=>Gu`
2021-11-11 22:06:49 +01:00
<li data-category="${e.category}"
class="emoji-category ${e.category} ${e.current_category===e.category?"picked":""}"
2023-02-17 12:24:37 +01:00
title="${Gy(Ih.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>
2023-02-17 12:24:37 +01:00
`)(Object.assign({category:n,emoji:e.sn2Emoji(t[n])},e)):""))}</ul>`},Tx=e=>Gu`
2022-05-05 23:06:17 +02:00
<li class="emoji insert-emoji ${e.shouldBeHidden(e.emoji.sn)?"hidden":""}" data-emoji="${e.emoji.sn}" title="${e.emoji.sn}">
2023-02-17 12:24:37 +01:00
<a href="#" @click=${e.insertEmoji} data-emoji="${e.emoji.sn}">${kx.shortnamesToEmojis(e.emoji.sn)}</a>
2022-05-05 23:06:17 +02:00
</li>
2023-02-17 12:24:37 +01:00
`,Nx=e=>{const t=Ih.settings.get("emoji_categories");return Gu`
2022-05-05 23:06:17 +02:00
<span ?hidden=${e.query} class="emoji-lists__container emoji-lists__container--browse">
2023-02-17 12:24:37 +01:00
${Object.keys(t).map((n=>t[n]?(e=>Gu`
<a id="emoji-picker-${e.category}" class="emoji-category__heading" data-category="${e.category}">${Gy(Ih.settings.get("emoji_category_labels")[e.category])}</a>
2022-05-05 23:06:17 +02:00
<ul class="emoji-picker" data-category="${e.category}">
2023-02-17 12:24:37 +01:00
${Object.values(Oh.emojis.json[e.category]).map((t=>Tx(Object.assign({emoji:t},e))))}
2022-05-05 23:06:17 +02:00
</ul>`)(Object.assign({category:n},e)):""))}
2023-02-17 12:24:37 +01:00
</span>`},Ix=e=>{const t=Gy("Search");return Gu`
2022-05-05 23:06:17 +02: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}>
2023-02-17 12:24:37 +01:00
${e.query?"":jx(e)}
2021-03-19 19:26:15 +01:00
</div>
2023-02-17 12:24:37 +01:00
${e.render_emojis?Gu`<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">
2023-02-17 12:24:37 +01:00
<ul>${["tone1","tone2","tone3","tone4","tone5"].map((t=>(e=>Gu`
2021-03-19 19:26:15 +01:00
<li data-skintone="${e.skintone}" class="emoji-skintone ${e.current_skintone===e.skintone?"picked":""}">
2023-02-17 12:24:37 +01:00
<a class="pick-skintone" href="#" data-skintone="${e.skintone}" @click=${e.onSkintonePicked}>${kx.shortnamesToEmojis(":"+e.skintone+":")}</a>
2021-11-11 22:06:49 +01:00
</li>`)(Object.assign({skintone:t},e))))}</ul>
2023-02-17 12:24:37 +01:00
</div>`},{sizzle:Ox}=Oh.env;Ih.elements.define("converse-emoji-picker-content",class extends Vy{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 Gu`
2021-03-19 19:26:15 +01:00
<div class="emoji-picker__lists">
2023-02-17 12:24:37 +01:00
${(e=>{const t=Gy("Search results");return Gu`
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">
2023-02-17 12:24:37 +01:00
${e.search_results.map((t=>Tx(Object.assign({emoji:t},e))))}
2021-03-19 19:26:15 +01:00
</ul>
</span>
`})(e)}
2023-02-17 12:24:37 +01:00
${Nx(e)}
2021-03-19 19:26:15 +01:00
</div>
2023-02-17 12:24:37 +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)}Ox(".emoji-picker",this).forEach((e=>this.observer.observe(e)))}}setCategoryOnVisibilityChange(e){const t=this.parentElement.navigator.selected,n=e.filter((e=>e.target.contains(t))).pop();let s;if(s=n||e.reduce(((e,t)=>t.intersectionRatio>=(e?.intersectionRatio||0)?t:e),null),s&&s.isIntersecting){const e=s.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&&LS().includes(e))return!0;return!(!this.query||nd.FILTER_CONTAINS(e,this.query))}});const Mx=Oh.env.utils;Ih.elements.define("converse-emoji-dropdown",class extends ix{static get properties(){return{chatview:{type:Object}}}constructor(){super(),this.render_emojis=!1}initModel(){return this.init_promise||(this.init_promise=(async()=>{await Ih.emojis.initialize();const e=`converse.emoji-${nd.bare_jid}-${this.chatview.model.get("jid")}`;this.model=new nd.EmojiPicker({id:e}),Xc(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(){const e=this.chatview.model.get("type")===nd.CHATROOMS_TYPE?"--muc-toolbar-btn-color":"--chat-toolbar-btn-color";return Gu`
2021-03-19 19:26:15 +01:00
<div class="dropup">
<button class="toggle-emojis"
2023-02-17 12:24:37 +01:00
title="${Gy("Insert emojis")}"
2021-03-19 19:26:15 +01:00
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false">
<converse-icon
2022-04-02 21:20:14 +02:00
color="var(${e})"
2021-03-19 19:26:15 +01:00
class="fa fa-smile "
2023-02-17 12:24:37 +01:00
path-prefix="${Ih.settings.get("assets_path")}"
2021-03-19 19:26:15 +01:00
size="1em"></converse-icon>
</button>
<div class="dropdown-menu">
2023-02-17 12:24:37 +01:00
${vb(this.initModel().then((()=>Gu`
2021-03-19 19:26:15 +01:00
<converse-emoji-picker
.chatview=${this.chatview}
.model=${this.model}
2022-04-02 21:20:14 +02:00
@emojiSelected=${()=>this.hideMenu()}
2021-03-19 19:26:15 +01:00
?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>
2023-02-17 12:24:37 +01:00
</div>`}connectedCallback(){super.connectedCallback(),this.render_emojis=!1}toggleMenu(e){e.stopPropagation(),e.preventDefault(),Mx.hasClass("show",this.menu)?Mx.ancestor(e.target,".toggle-emojis")&&this.hideMenu():this.showMenu()}async showMenu(){await this.initModel(),this.render_emojis||(this.render_emojis=!0,this.requestUpdate(),await this.updateComplete),super.showMenu(),setTimeout((()=>this.querySelector(".emoji-search")?.focus()))}});var Rx=n(8125),Dx={};Dx.styleTagTransform=o_(),Dx.setAttributes=n_(),Dx.insert=e_().bind(null,"head"),Dx.domAPI=Ky(),Dx.insertStyleElement=i_();Qy()(Rx.Z,Dx);Rx.Z&&Rx.Z.locals&&Rx.Z.locals;const zx=Oh.env.utils;Ih.elements.define("converse-emoji-picker",class extends Vy{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,reflect:!0},render_emojis:{type:Boolean}}}firstUpdated(){super.firstUpdated(),this.listenTo(this.model,"change",(e=>this.onModelChanged(e.changed))),this.initArrowNavigation()}constructor(){super(),this.query="",this._search_results=[],this.debouncedFilter=vh((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 Ix({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.onSearchInputKeyDown(e),onSkintonePicked:e=>this.chooseSkinTone(e),query:this.query,search_results:this.search_results,render_emojis:this.render_emojis,sn2Emoji:e=>zx.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=nd.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=Oh.emojis.list.filter((e=>n(e.sn,this.query)))}else this.search_results.length&&(this.search_results=[])}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),this.disableArrowNavigation(),super.disconnectedCallback()}_onGlobalKeyDown(e){this.navigator&&(e.keyCode===Dl.ENTER&&zx.isVisible(this)?this.onEnterPressed(e):e.keyCode===Dl.DOWN_ARROW&&!this.navigator.enabled&&zx.isVisible(this)?this.enableArrowNavigation(e):e.keyCode===Dl.ESCAPE&&(this.disableArrowNavigation(),setTimeout((()=>this.chatview.querySelector(".chat-textarea").focus()),50)))}setCategoryForElement(e){const t=this.current_category,n=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.model.set({autocompleting:null,query:"",ac_position:null}),this.disableArrowNavigation();const s={bubbles:!0,detail:{value:e,autocompleting:t,ac_position:n,jid:this.chatview.model.get("jid")}};this.dispatchEvent(new CustomEvent("emojiSelected",s))}chooseSkinTone(e){e.preventDefault(),e.stopPropagation();const t=("IMG"===e.target.nodeName?e.target.parentElement:e.target).getAttribute("data-skinton
<span class="toolbar-buttons">${vb(e.getButtons(),"")}</span>
${e.show_send_button?function(){const e=Gy("Send the message");return Gu`<button type="submit" class="btn send-button" title="${e}">
2022-05-05 23:06:17 +02:00
<converse-icon color="var(--toolbar-btn-text-color)" class="fa fa-paper-plane" size="1em"></converse-icon>
</button>`}():""}
2023-02-17 12:24:37 +01:00
`;var Px=n(6176),Fx={};Fx.styleTagTransform=o_(),Fx.setAttributes=n_(),Fx.insert=e_().bind(null,"head"),Fx.domAPI=Ky(),Fx.insertStyleElement=i_();Qy()(Px.Z,Fx);Px.Z&&Px.Z.locals&&Px.Z.locals;const Ux=Oh.env.Strophe;Ih.elements.define("converse-chat-toolbar",class extends Vy{static get properties(){return{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 Lx(this)}firstUpdated(){Ih.trigger("renderToolbar",this)}getButtons(){const e=[];if(this.show_emoji_button){const t=nd.chatboxviews.get(this.model.get("jid"));e.push(Gu`<converse-emoji-dropdown .chatview=${t}></converse-emoji-dropdown>`)}if(this.show_call_button){const t=this.is_groupchat?"--muc-toolbar-btn-color":"--chat-toolbar-btn-color",n=Gy("Start a call");e.push(Gu`
2022-04-02 21:20:14 +02:00
<button class="toggle-call" @click=${this.toggleCall} title="${n}">
2023-01-07 22:34:35 +01:00
<converse-icon color="var(${t})" class="fa fa-phone" size="1em"></converse-icon>
2023-02-17 12:24:37 +01:00
</button>`)}Ih.settings.get("message_limit")&&e.push(Gu`
2021-11-11 22:06:49 +01:00
<converse-message-limit-indicator .model=${this.model} class="right">
2023-02-17 12:24:37 +01:00
</converse-message-limit-indicator>`),this.show_spoiler_button&&e.push(this.getSpoilerButton());const t=Ih.disco.supports(Ux.NS.HTTPUPLOAD,nd.domain);if(e.push(Gu`${vb(t.then((e=>this.getHTTPUploadButton(e))),"")}`),this.is_groupchat&&Ih.settings.get("visible_toolbar_buttons")?.toggle_occupants){const t=Gy("Hide participants"),n=Gy("Show participants");e.push(Gu`
2021-03-19 19:26:15 +01:00
<button class="toggle_occupants right"
2023-01-07 22:34:35 +01:00
title="${this.hidden_occupants?n:t}"
2021-03-19 19:26:15 +01:00
@click=${this.toggleOccupants}>
2022-04-02 21:20:14 +02:00
<converse-icon
color="var(--muc-toolbar-btn-color)"
class="fa ${this.hidden_occupants?"fa-angle-double-left":"fa-angle-double-right"}"
size="1em"></converse-icon>
2023-02-17 12:24:37 +01:00
</button>`)}return nd.api.hook("getToolbarButtons",this,e)}getHTTPUploadButton(e){if(e){const e=Gy("Choose a file to send"),t=this.is_groupchat?"--muc-toolbar-btn-color":"--chat-toolbar-btn-color";return Gu`
2021-03-19 19:26:15 +01:00
<button title="${e}" @click=${this.toggleFileUpload}>
2022-04-02 21:20:14 +02:00
<converse-icon
color="var(${t})"
class="fa fa-paperclip"
2021-03-19 19:26:15 +01:00
size="1em"></converse-icon>
</button>
2023-02-17 12:24:37 +01:00
<input type="file" @change=${this.onFileSelection} class="fileupload" multiple="" style="display:none"/>`}return""}getSpoilerButton(){const e=this.model;if(!this.is_groupchat&&!e.presence?.resources.length)return;let t;t=e.get("composing_spoiler")?Gy("Click to write as a normal (non-spoiler) message"):Gy("Click to write your message as a spoiler");const n=this.is_groupchat?"--muc-toolbar-btn-color":"--chat-toolbar-btn-color",s=Gu`
2021-03-19 19:26:15 +01:00
<button class="toggle-compose-spoiler"
2023-01-07 22:34:35 +01:00
title="${t}"
2021-03-19 19:26:15 +01:00
@click=${this.toggleComposeSpoilerMessage}>
2022-04-02 21:20:14 +02:00
<converse-icon
2023-01-07 22:34:35 +01:00
color="var(${n})"
class="fa ${e.get("composing_spoiler")?"fa-eye-slash":"fa-eye"}"
2022-04-02 21:20:14 +02:00
size="1em"></converse-icon>
2023-02-17 12:24:37 +01:00
</button>`;if(this.is_groupchat)return s;{const t=e.get("jid"),n=Promise.all(e.presence.resources.map((e=>Ih.disco.supports(Ux.NS.SPOILER,`${t}/${e.get("name")}`)))).then((e=>e.reduce(((e,t)=>e&&t),!0)));return Gu`${vb(n.then((()=>s)),"")}`}}toggleFileUpload(e){e?.preventDefault?.(),e?.stopPropagation?.(),this.querySelector(".fileupload").click()}onFileSelection(e){this.model.sendFiles(e.target.files)}toggleComposeSpoilerMessage(e){e?.preventDefault?.(),e?.stopPropagation?.(),this.model.set("composing_spoiler",!this.model.get("composing_spoiler"))}toggleOccupants(e){e?.preventDefault?.(),e?.stopPropagation?.(),this.model.save({hidden_occupants:!this.model.get("hidden_occupants")})}toggleCall(e){e?.preventDefault?.(),e?.stopPropagation?.(),Ih.trigger("callButtonClicked",{connection:nd.connection,model:this.model})}});var Bx=n(7802),qx={};qx.styleTagTransform=o_(),qx.setAttributes=n_(),qx.insert=e_().bind(null,"head"),qx.domAPI=Ky(),qx.insertStyleElement=i_();Qy()(Bx.Z,qx);Bx.Z&&Bx.Z.locals&&Bx.Z.locals;async function Hx(e){await Ih.confirm(Gy("Are you sure you want to clear the messages from this conversation?"))&&await e.clearMessages()}function Gx(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=""}Ih.elements.define("converse-chat-heading",class extends Vy{static get properties(){return{jid:{type:String}}}initialize(){this.model=nd.chatboxes.get(this.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())),this.model.rosterContactAdded?.then((()=>{this.listenTo(this.model.contact,"change:nickname",(()=>this.requestUpdate())),this.requestUpdate()}))}render(){return(e=>{const t=Gy("The User's Profile Image"),n=Gu`<span title="${t}">
2022-01-03 11:54:10 +01:00
<converse-avatar
class="avatar chat-msg__avatar"
2023-01-07 22:34:35 +01:00
.data=${e.model.vcard?.attributes}
nonce=${e.model.vcard?.get("vcard_updated")}
2023-02-17 12:24:37 +01:00
height="40" width="40"></converse-avatar></span>`,s=e.model.getDisplayName();return Gu`
2021-11-11 22:06:49 +01:00
<div class="chatbox-title ${e.status?"":"chatbox-title--no-desc"}">
<div class="chatbox-title--row">
2023-02-17 12:24:37 +01:00
${nd.api.settings.get("singleton")?"":Gu`<converse-controlbox-navback jid="${e.jid}"></converse-controlbox-navback>`}
${e.type!==nd.HEADLINES_TYPE?Gu`<a class="show-msg-author-modal" @click=${e.showUserDetailsModal}>${n}</a>`:""}
2021-11-11 22:06:49 +01:00
<div class="chatbox-title__text" title="${e.jid}">
2023-02-17 12:24:37 +01:00
${e.type!==nd.HEADLINES_TYPE?Gu`<a class="user show-msg-author-modal" @click=${e.showUserDetailsModal}>${s}</a>`:s}
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">
2023-02-17 12:24:37 +01:00
${vb(MS(e.heading_buttons_promise),"")}
${vb(OS(e.heading_buttons_promise),"")}
2021-03-19 19:26:15 +01:00
</div>
</div>
2023-02-17 12:24:37 +01:00
${e.status?Gu`<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(),Ih.modal.show("converse-user-details-modal",{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:Gy("Details"),i18n_title:Gy("See more information about this person"),icon_class:"fa-id-card",name:"details",standalone:"overlayed"===Ih.settings.get("view_mode")}];Ih.settings.get("singleton")||e.push({a_class:"close-chatbox-button",handler:e=>this.close(e),i18n_text:Gy("Close"),i18n_title:Gy("Close and end this conversation"),icon_class:"fa-times",name:"close",standalone:"overlayed"===Ih.settings.get("view_mode")});const t=nd.chatboxviews.get(this.getAttribute("jid"));return t?nd.api.hook("getHeadingButtons",t,e):e}});const{u:Wx}=Oh.env;class Vx extends C_{async connectedCallback(){super.connectedCallback(),this.model=nd.chatboxes.get(this.getAttribute("jid")),await this.model.initialized,this.listenTo(this.model.messages,"change:correcting",this.onMessageCorrecting),this.listenTo(this.model,"change:composing_spoiler",(()=>this.render())),this.handleEmojiSelection=e=>{let{detail:t}=e;this.model.get("jid")===t.jid&&this.insertIntoTextArea(t.value,t.autocompleting,!1,t.ac_position)},document.addEventListener("emojiSelected",this.handleEmojiSelection),this.render()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("emojiSelected",this.handleEmojiSelection)}toHTML(){return(e=>{const t=e.composing_spoiler?Gy("Hidden message"):Gy("Message"),n=Gy("Optional hint"),s=Ih.settings.get("show_send_button");return Gu`
2021-11-11 22:06:49 +01:00
<form class="sendXMPPMessage">
2022-05-05 23:06:17 +02:00
<input type="text"
enterkeyhint="send"
placeholder="${n||""}"i
value="${e.hint_value||""}"
class="${e.composing_spoiler?"":"hidden"} spoiler-hint"/>
2021-11-11 22:06:49 +01:00
<textarea
autofocus
type="text"
2022-05-05 23:06:17 +02:00
enterkeyhint="send"
2021-11-11 22:06:49 +01:00
@drop=${e.onDrop}
2023-02-17 12:24:37 +01:00
@input=${Gx}
2021-11-11 22:06:49 +01:00
@keydown=${e.onKeyDown}
@keyup=${e.onKeyUp}
@paste=${e.onPaste}
@change=${e.onChange}
class="chat-textarea
2022-05-05 23:06:17 +02:00
${s?"chat-textarea-send-button":""}
2021-11-11 22:06:49 +01:00
${e.composing_spoiler?"spoiler":""}"
placeholder="${t}">${e.message_value||""}</textarea>
2023-02-17 12:24:37 +01:00
</form>`})(Object.assign(this.model.toJSON(),{onDrop:e=>this.onDrop(e),hint_value:this.querySelector(".spoiler-hint")?.value,message_value:this.querySelector(".chat-textarea")?.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){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const i=this.querySelector(".chat-textarea");if(n?Wx.addClass("correcting",i):Wx.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),Wx.placeCaretAtEnd(i)}onMessageCorrecting(e){if(e.get("correcting"))this.insertIntoTextArea(vl(e),!0,!0);else{const t=this.model.messages.findWhere("correcting");t&&t!==e?this.insertIntoTextArea(vl(e),!0,!0):this.insertIntoTextArea("",!0,!1)}}onEscapePressed(e){const t=this.model.messages.findLastIndex("correcting"),n=t>=0?this.model.messages.at(t):null;n&&(e.preventDefault(),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===Oh.keycodes.TAB){const t=Wx.getCurrentWord(e.target,null,/(:.*?:)/g);t.startsWith(":")&&(e.preventDefault(),e.stopPropagation(),this.model.trigger("emoji-picker-autocomplete",e.target,t))}else{if(e.keyCode===Oh.keycodes.FORWARD_SLASH)return;if(e.keyCode===Oh.keycodes.ESCAPE)return this.onEscapePressed(e,this);if(e.keyCode===Oh.keycodes.ENTER)return this.onFormSubmitted(e);if(e.keyCode!==Oh.keycodes.UP_ARROW||e.target.selectionEnd){if(e.keyCode===Oh.keycodes.DOWN_ARROW&&e.target.selectionEnd===e.target.value.length&&Wx.hasClass("correcting",this.querySelector(".chat-textarea")))return this.model.editLaterMessage()}else{const e=this.querySelector(".chat-textarea");if(!e.value||Wx.hasClass("correcting",e))return this.model.editEarlierMessage()}}[Oh.keycodes.SHIFT,Oh.keycodes.META,Oh.keycodes.META_RIGHT,Oh.keycodes.ESCAPE,Oh.keycodes.ALT].includes(e.keyCode)||this.model.get("chat_state")!==nd.COMPOSING&&this.model.setChatState(nd.COMPOSING)}}async onFormSubmitted(e){e?.preventDefault?.();const t=this.querySelector(".chat-textarea"),n=t.value.trim();if(Ih.settings.get("message_limit")&&n.length>Ih.settings.get("message_limit")||!n.replace(/\s/g,"").length)return;if(!nd.connection.authenticated){const e=Gy("Sorry, the connection has been lost, and your message could not be sent");return Ih.alert("error",Gy("Error"),e),void Ih.connection.reconnect()}let s,i={};this.model.get("composing_spoiler")&&(i=this.querySelector("form.sendXMPPMessage input.spoiler-hint"),s=i.value),Wx.addClass("disabled",t),t.setAttribute("disabled","disabled"),this.querySelector("converse-emoji-dropdown")?.hideMenu();const r=await async function(e,t){const n=t.replace(/^\s*/,"").match(/^\/(.*)\s*$/);if(n){let s=!1;if(s=await Ih.hook("parseMessageForCommands",{model:e,text:t},s),s)return!0;if("clear"===n[1])return Hx(e),!0;if("close"===n[1])return nd.chatboxviews.get(e.get("jid"))?.close(),!0;if("help"===n[1])return e.set({show_help_messages:!1},{silent:!0}),e.set({show_help_messages:!0}),!0}return!1}(this.model,n),o=r?null:await this.model.sendMessage({body:n,spoiler_hint:s});if((r||o)&&(i.value="",t.value="",Wx.removeClass("correcting",t),t.style.height="auto",this.model.set({draft:""})),"overlayed"===Ih.settings.get("view_mode")){nd.chatboxviews.get(this.getAttribute("jid")).querySelector(".chat-content__messages").parentElement.style.display="none"}if(t.removeAttribute(
${e.model.ui.get("scrolled")&&e.model.get("num_unread")?Gu`<div class="new-msgs-indicator" @click=${t=>e.viewUnreadMessages(t)}>▼ ${t} ▼</div>`:""}
${Ih.settings.get("show_toolbar")?Gu`
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")}"
2022-05-05 23:06:17 +02:00
?show_call_button="${s}"
?show_emoji_button="${i}"
2022-12-17 22:08:36 +01:00
?show_send_button="${r}"
?show_spoiler_button="${o}"
2021-11-11 22:06:49 +01:00
?show_toolbar="${a}"
message_limit="${n}"></converse-chat-toolbar>`:""}
<converse-message-form jid="${e.model.get("jid")}"></converse-message-form>
2023-02-17 12:24:37 +01:00
`})({model:this.model,viewUnreadMessages:e=>this.viewUnreadMessages(e)}),this)}sendButtonClicked(e){this.querySelector("converse-message-form")?.onFormSubmitted(e)}viewUnreadMessages(e){e?.preventDefault?.(),this.model.ui.set({scrolled:!1})}emitFocused(e){nd.chatboxviews.get(this.getAttribute("jid"))?.emitFocused(e)}emitBlurred(e){nd.chatboxviews.get(this.getAttribute("jid"))?.emitBlurred(e)}onDrop(e){0!=e.dataTransfer.files.length&&(e.preventDefault(),this.model.sendFiles(e.dataTransfer.files))}onDragOver(e){e.preventDefault()}clearMessages(e){e?.preventDefault?.(),Hx(this.model)}async autocompleteInPicker(e,t){await Ih.emojis.initialize();const n=this.querySelector("converse-emoji-picker");if(n){n.model.set({ac_position:e.selectionStart,autocompleting:t,query:t});this.querySelector("converse-emoji-dropdown")?.showMenu()}}}Ih.elements.define("converse-chat-bottom-panel",Qx);class Yx extends Vy{static get properties(){return{jid:{type:String}}}disconnectedCallback(){super.disconnectedCallback(),nd.chatboxviews.remove(this.jid,this)}updated(){this.model&&this.jid!==this.model.get("jid")&&(this.stopListening(),nd.chatboxviews.remove(this.model.get("jid"),this),delete this.model,this.requestUpdate(),this.initialize())}close(e){return e?.preventDefault?.(),this.model.close(e)}maybeFocus(){Ih.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)||Ih.trigger("chatBoxBlurred",this,e)}emitFocused(e){this.contains(e.relatedTarget)||Ih.trigger("chatBoxFocused",this,e)}getBottomPanel(){return this.model.get("type")===nd.CHATROOMS_TYPE?this.querySelector("converse-muc-bottom-panel"):this.querySelector("converse-chat-bottom-panel")}getMessageForm(){return this.model.get("type")===nd.CHATROOMS_TYPE?this.querySelector("converse-muc-message-form"):this.querySelector("converse-message-form")}scrollDown(e){e?.preventDefault?.(),e?.stopPropagation?.(),this.model.ui.get("scrolled")&&this.model.ui.set({scrolled:!1}),RS(this.model)}onWindowStateChanged(e){"visible"===e.state?this.model.isHidden()||this.model.clearUnreadMsgCounter():"hidden"===e.state&&(this.model.setChatState(nd.INACTIVE,{silent:!0}),this.model.sendChatState())}}class Kx extends Yx{length=200;async initialize(){nd.chatboxviews.add(this.jid,this),this.model=nd.chatboxes.get(this.jid),this.listenTo(nd,"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(),Ih.trigger("chatBoxViewInitialized",this)}render(){return(e=>Gu`
2021-11-11 22:06:49 +01:00
<div class="flyout box-flyout">
<converse-dragresize></converse-dragresize>
2023-02-17 12:24:37 +01:00
${e.model?Gu`
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
2023-02-17 12:24:37 +01:00
${e.show_help_messages?Gu`<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"
2023-02-17 12:24:37 +01:00
chat_type="${nd.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>
2023-02-17 12:24:37 +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>: ${Gy("Remove messages")}`,`<strong>/close</strong>: ${Gy("Close this chat")}`,`<strong>/me</strong>: ${Gy("Write in the third person")}`,`<strong>/help</strong>: ${Gy("Show this menu")}`]}afterShown(){this.model.setChatState(nd.ACTIVE),this.model.clearUnreadMsgCounter(),this.maybeFocus()}}Ih.elements.define("converse-chat",Kx);var Xx=n(5599),eE={};eE.styleTagTransform=o_(),eE.setAttributes=n_(),eE.insert=e_().bind(null,"head"),eE.domAPI=Ky(),eE.insertStyleElement=i_();Qy()(Xx.Z,eE);Xx.Z&&Xx.Z.locals&&Xx.Z.locals;const{Strophe:tE}=Oh.env;Oh.plugins.add("converse-chatview",{dependencies:["converse-chatboxviews","converse-chat","converse-disco","converse-modal"],initialize(){Ih.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}}),nd.ChatBoxView=Kx,Ih.listen.on("connected",(()=>Ih.disco.own.features.add(tE.NS.SPOILER))),Ih.listen.on("chatBoxClosed",(e=>{return t=e.get("jid"),void(nd.router.history.getFragment()===`converse/chat?jid=${t}`&&nd.router.navigate(""));var t}))}});Ih.elements.define("converse-brand-byline",class extends Vy{render(){const e="fullscreen"===Ih.settings.get("view_mode");return Gu`
${e?Gu`
<p class="brand-subtitle">${nd.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>
`:""}
2023-02-17 12:24:37 +01:00
`}});Ih.elements.define("converse-brand-logo",class extends Vy{render(){const e="fullscreen"===Ih.settings.get("view_mode");return Gu`
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>
2023-02-17 12:24:37 +01:00
${e?Gu`
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>
2023-02-17 12:24:37 +01:00
`}});Ih.elements.define("converse-brand-heading",class extends Vy{render(){return Gu`
2021-11-11 22:06:49 +01:00
<converse-brand-logo></converse-brand-logo>
<converse-brand-byline></converse-brand-byline>
2023-02-17 12:24:37 +01:00
`}});const{Strophe:nE}=Oh.env,sE=[nE.Status.ERROR,nE.Status.CONNECTING,nE.Status.CONNFAIL,nE.Status.AUTHENTICATING,nE.Status.AUTHFAIL,nE.Status.DISCONNECTING,nE.Status.RECONNECTING],iE=Object.fromEntries([[nE.Status.ERROR,"Error"],[nE.Status.CONNECTING,"Connecting"],[nE.Status.CONNFAIL,"Connection failure"],[nE.Status.AUTHENTICATING,"Authenticating"],[nE.Status.AUTHFAIL,"Authentication failure"],[nE.Status.CONNECTED,"Connected"],[nE.Status.DISCONNECTED,"Disconnected"],[nE.Status.DISCONNECTING,"Disconnecting"],[nE.Status.ATTACHED,"Attached"],[nE.Status.REDIRECT,"Redirect"],[nE.Status.CONNTIMEOUT,"Connection timeout"],[nE.Status.RECONNECTING,"Reconnecting"]]),rE=Object.fromEntries([[nE.Status.ERROR,"error"],[nE.Status.CONNECTING,"info"],[nE.Status.CONNFAIL,"error"],[nE.Status.AUTHENTICATING,"info"],[nE.Status.AUTHFAIL,"error"],[nE.Status.CONNECTED,"info"],[nE.Status.DISCONNECTED,"error"],[nE.Status.DISCONNECTING,"warn"],[nE.Status.ATTACHED,"info"],[nE.Status.REDIRECT,"info"],[nE.Status.RECONNECTING,"warn"]]),oE=e=>{const t=Ih.settings.get("authentication"),n=Gy("Log in"),s=Gy("XMPP Address"),i=Ih.settings.get("locked_domain"),r=Ih.settings.get("default_domain"),o=(i||r)&&Gy("Username")||Gy("user@domain"),a=Ih.settings.get("allow_user_trust_override");return Gu`
2021-03-19 19:26:15 +01:00
<div class="form-group">
2022-05-05 23:06:17 +02:00
<label for="converse-login-jid">${s}:</label>
2021-03-19 19:26:15 +01:00
<input id="converse-login-jid"
2023-02-17 12:24:37 +01:00
?autofocus=${!!Ih.settings.get("auto_focus")}
2022-04-02 21:20:14 +02:00
@changed=${e.validate}
2023-02-17 12:24:37 +01:00
value="${Ih.settings.get("jid")??""}"
2021-03-19 19:26:15 +01:00
required
class="form-control"
type="text"
name="jid"
2022-12-17 22:08:36 +01:00
placeholder="${o}"/>
2021-03-19 19:26:15 +01:00
</div>
2023-02-17 12:24:37 +01:00
${t!==nd.EXTERNAL?(()=>{const e=Gy("Password");return Gu`
2021-03-19 19:26:15 +01:00
<div class="form-group">
<label for="converse-login-password">${e}</label>
2022-04-02 21:20:14 +02:00
<input id="converse-login-password"
class="form-control"
required="required"
2023-02-17 12:24:37 +01:00
value="${Ih.settings.get("password")??""}"
2022-04-02 21:20:14 +02:00
type="password"
name="password"
placeholder="${e}"/>
2021-03-19 19:26:15 +01:00
</div>
`})():""}
2023-02-17 12:24:37 +01:00
${Ih.settings.get("show_connection_url_input")?(()=>{const e=Gy("Connection URL"),t=Gy("HTTP or websocket URL that is used to connect to your XMPP server"),n=Gy("e.g. wss://example.org/xmpp-websocket");return Gu`
2022-04-02 21:20:14 +02:00
<div class="form-group fade-in">
<label for="converse-conn-url">${e}</label>
<p class="form-help instructions">${t}</p>
<input id="converse-conn-url"
class="form-control"
type="url"
name="connection-url"
placeholder="${n}"/>
</div>
`})():""}
2023-02-17 12:24:37 +01:00
${a?(e=>{const t=Gy("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=Gy("This is a trusted device");return Gu`
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>
2022-12-17 22:08:36 +01:00
<converse-icon class="fa fa-info-circle" data-toggle="popover"
2021-03-19 19:26:15 +01:00
data-title="Trusted device?"
2022-12-17 22:08:36 +01:00
data-content="${t}"
size="1.2em"
title="${t}"></converse-icon>
2021-03-19 19:26:15 +01:00
</div>
2022-04-02 21:20:14 +02:00
`})("off"!==a):""}
2021-11-11 22:06:49 +01:00
<fieldset class="form-group buttons">
2022-04-02 21:20:14 +02:00
<input class="btn btn-primary" type="submit" value="${n}"/>
2021-03-19 19:26:15 +01:00
</fieldset>
2023-02-17 12:24:37 +01:00
${Ih.settings.get("allow_registration")&&!Ih.settings.get("auto_login")&&nd.pluggable.plugins["converse-register"].enabled(nd)?(()=>{const e=Gy("Create an account"),t=Gy("Don't have a chat account?");return Gu`
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>
`})():""}
2023-02-17 12:24:37 +01:00
`},aE=e=>{const t=nd.connfeedback.get("connection_status");let n,s;sE.includes(t)&&(s=iE[t],n=rE[t]);const i=nd.connfeedback.get("message");return Gu`
2022-05-05 23:06:17 +02:00
<converse-brand-heading></converse-brand-heading>
<form id="converse-login" class="converse-form" method="post" @submit=${e.onLoginFormSubmitted}>
<div class="conn-feedback fade-in ${s?n:"hidden"}">
<p class="feedback-subject">${s}</p>
<p class="feedback-message ${i?"":"hidden"}">${i}</p>
</div>
2023-02-17 12:24:37 +01:00
${"CONNECTING"===nd.CONNECTION_STATUS[t]?J_({classes:"hor_centered"}):(e=>{const t=Ih.settings.get("authentication"),{ANONYMOUS:n,EXTERNAL:s,LOGIN:i,PREBIND:r}=nd,o=Gy("Disconnected"),a=Gy("Click here to log in anonymously");return Gu`
${t==i||t==s?oE(e):""}
${t==n?Gu`<input class="btn btn-primary login-anon" type="submit" value="${a}">`:""}
${t==r?Gu`<p>${o}</p>`:""}
2021-03-19 19:26:15 +01:00
`})(e)}
2023-02-17 12:24:37 +01:00
</form>`},{Strophe:cE,u:lE}=Oh.env;function dE(){const e=nd.chatboxes.add(new nd.ControlBox({id:"controlbox"}));return nd.chatboxviews.get("controlbox")?.setModel(),e}function uE(e){e?.preventDefault?.();const t=nd.chatboxes.get("controlbox")||dE();lE.safeSave(t,{closed:!1})}function hE(){const e=nd.chatboxviews.get("controlbox");return e.model.set({connected:!1}),e}function mE(){const e=nd?.chatboxviews,t=e&&e.get("controlbox");t&&(lE.safeSave(t.model,{connected:!1}),t?.controlbox_pane&&(t.controlbox_pane.remove(),delete t.controlbox_pane))}function gE(){(nd.chatboxes.get("controlbox")||dE()).save({connected:!0})}const{Strophe:fE,u:pE}=Oh.env;Ih.elements.define("converse-login-form",class extends Vy{initialize(){this.listenTo(nd.connfeedback,"change",(()=>this.requestUpdate())),this.handler=()=>this.requestUpdate()}connectedCallback(){super.connectedCallback(),Ih.settings.listen.on("change",this.handler)}disconnectedCallback(){super.disconnectedCallback(),Ih.settings.listen.not("change",this.handler)}render(){return aE(this)}firstUpdated(){this.initPopovers()}async onLoginFormSubmitted(e){if(e?.preventDefault(),Ih.settings.get("authentication")===nd.ANONYMOUS)return this.connect(nd.jid);(function(e){const t=e.querySelector("input[name=jid]");return!t.value||Ih.settings.get("locked_domain")||Ih.settings.get("default_domain")||lE.isValidJID(t.value)?(t.setCustomValidity(""),!0):(t.setCustomValidity(Gy("Please enter a valid XMPP address")),!1)})(e.target)&&(!function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=new FormData(e),s=n.get("connection-url");s?.startsWith("ws")?t.websocket_url=s:s?.startsWith("http")&&(t.bosh_service_url=s);let i=n.get("jid");if(Ih.settings.get("locked_domain")){const e="@"+Ih.settings.get("locked_domain");i.endsWith(e)&&(i=i.substr(0,i.length-e.length)),i=cE.escapeNode(i)+e}else Ih.settings.get("default_domain")&&!i.includes("@")&&(i=i+"@"+Ih.settings.get("default_domain"));t.jid=i,t.password=n.get("password"),Ih.settings.set(t),nd.config.save({trusted:!!n.get("trusted")})}(e.target),Ih.settings.get("bosh_service_url")||Ih.settings.get("websocket_url")||await this.discoverConnectionMethods(e),Ih.settings.get("bosh_service_url")||Ih.settings.get("websocket_url")?this.connect():Ih.settings.set("show_connection_url_input",!0))}discoverConnectionMethods(e){if(!Ih.settings.get("discover_connection_methods"))return;const t=new FormData(e.target).get("jid"),n=fE.getDomainFromJid(t);return(!nd.connection?.jid||t&&!pE.isSameDomain(nd.connection.jid,t))&&Eh(),nd.connection.discoverConnectionMethods(n)}initPopovers(){Array.from(this.querySelectorAll("[data-title]")).forEach((e=>{new(d_().Popover)(e,{trigger:"mobile"===Ih.settings.get("view_mode")?"click":"hover",dismissible:"mobile"===Ih.settings.get("view_mode"),container:this.parentElement.parentElement.parentElement})}))}connect(e){["converse/login","converse/register"].includes(nd.router.history.getFragment())&&nd.router.navigate("",{replace:!0}),nd.connection?.reset(),Ih.user.login(e)}});const vE=e=>Gu`<converse-icon size="1em" class="fa fa-arrow-left" @click=${()=>function(e){uE();const t=nd.chatboxes.get(e);lE.safeSave(t,{hidden:!0})}(e)}></converse-icon>`;class yE extends Vy{static get properties(){return{jid:{type:String}}}render(){return vE(this.jid)}}Ih.elements.define("converse-controlbox-navback",yE);const{dayjs:_E}=Oh.env,bE=No.extend({defaults:()=>({bookmarked:!1,box_id:"controlbox",chat_state:void 0,closed:!Ih.settings.get("show_controlbox_by_default"),num_unread:0,time_opened:_E(0).valueOf(),type:nd.CONTROLBOX_TYPE,url:""}),validate(e){return e.type===nd.CONTROLBOX_TYPE?"embedded"===Ih.settings.get("view_mode")&&Ih.settings.get("singleton")?"Controlbox not relevant in embedded view mode":void 0:nd.ChatBox.prototype.validate.call(this,e)},maybeShow(e){return e||"controlbox"!==this.get("id")?nd.ChatBox.prototype.maybeShow.call(this,e):this},onReconnection(){this.save("connected",!0)}});class wE extends Vy{async connectedCallback(){super.connectedCallback(),await Ih.waitUntil("initialized"),this.model=n
2022-05-05 23:06:17 +02:00
<div class="flyout box-flyout">
<converse-dragresize></converse-dragresize>
<div class="chat-head controlbox-head">
2023-02-17 12:24:37 +01:00
${n?"":Gu`
2022-12-17 22:08:36 +01:00
<a class="chatbox-btn close-chatbox-button" @click=${t=>e.close(t)}>
<converse-icon class="fa fa-times" size="1em"></converse-icon>
</a>
2022-05-05 23:06:17 +02:00
`}
2021-11-11 22:06:49 +01:00
</div>
2022-05-05 23:06:17 +02:00
<div class="controlbox-panes">
<div class="controlbox-pane">
2023-02-17 12:24:37 +01:00
${t.connected?Gu`
2022-05-05 23:06:17 +02:00
<converse-user-profile></converse-user-profile>
2022-12-17 22:08:36 +01:00
<converse-headlines-feeds-list class="controlbox-section"></converse-headlines-feeds-list>
<div id="chatrooms" class="controlbox-section"><converse-rooms-list></converse-rooms-list></div>
2023-02-17 12:24:37 +01:00
${Ih.settings.get("authentication")===nd.ANONYMOUS?"":Gu`<div id="converse-roster" class="controlbox-section"><converse-roster></converse-roster></div>`}`:function(e){const t=nd.connfeedback.get("connection_status");return[xE.Status.RECONNECTING,xE.Status.CONNECTING].includes(t)?J_():"register"===e["active-form"]?Gu`<converse-register-panel></converse-register-panel>`:Gu`<converse-login-form id="converse-login-panel" class="controlbox-pane fade-in row no-gutters"></converse-login-form>`}(t)}
2022-05-05 23:06:17 +02:00
</div>
</div>
2023-02-17 12:24:37 +01:00
</div>`},AE=Oh.env.utils;class CE extends Vy{initialize(){this.setModel(),nd.chatboxviews.add("controlbox",this),this.model.get("connected")&&void 0===this.model.get("closed")&&this.model.set("closed",!Ih.settings.get("show_controlbox_by_default")),this.requestUpdate(),Ih.trigger("controlBoxInitialized",this)}setModel(){this.model=nd.chatboxes.get("controlbox"),this.listenTo(nd.connfeedback,"change:connection_status",(()=>this.requestUpdate())),this.listenTo(this.model,"change:active-form",(()=>this.requestUpdate())),this.listenTo(this.model,"change:connected",(()=>this.requestUpdate())),this.listenTo(this.model,"change:closed",(()=>!this.model.get("closed")&&this.afterShown())),this.requestUpdate()}render(){return this.model?EE(this):""}close(e){if(e?.preventDefault?.(),("closeAllChatBoxes"!==e?.name||nd.disconnection_cause===nd.LOGOUT&&!Ih.settings.get("show_controlbox_by_default"))&&!Ih.settings.get("sticky_controlbox"))return AE.safeSave(this.model,{closed:!0}),Ih.trigger("controlBoxClosed",this),this}afterShown(){return Ih.trigger("controlBoxOpened",this),this}}Ih.elements.define("converse-controlbox",CE);const $E=CE,{u:kE}=Oh.env,jE={controlbox:{async open(){await Ih.waitUntil("chatBoxesFetched");const e=await Ih.chatboxes.get("controlbox")||Ih.chatboxes.create("controlbox",{},nd.Controlbox);return kE.safeSave(e,{closed:!1}),e},get:()=>nd.chatboxviews.get("controlbox")}};var TE=n(1875),NE={};NE.styleTagTransform=o_(),NE.setAttributes=n_(),NE.insert=e_().bind(null,"head"),NE.domAPI=Ky(),NE.insertStyleElement=i_();Qy()(TE.Z,NE);TE.Z&&TE.Z.locals&&TE.Z.locals;var IE=n(6755),OE={};OE.styleTagTransform=o_(),OE.setAttributes=n_(),OE.insert=e_().bind(null,"head"),OE.domAPI=Ky(),OE.insertStyleElement=i_();Qy()(IE.Z,OE);IE.Z&&IE.Z.locals&&IE.Z.locals;Oh.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 bE(e,t):this.__super__.model.apply(this,arguments)}}},initialize(){Ih.settings.extend({allow_logout:!0,allow_user_trust_override:!0,default_domain:void 0,locked_domain:void 0,show_connection_url_input:!1,show_controlbox_by_default:!1,sticky_controlbox:!1}),Ih.promises.add("controlBoxInitialized",!1),Object.assign(Ih,jE),nd.ControlBoxView=$E,nd.ControlBox=bE,nd.ControlBoxToggle=SE,Ih.listen.on("chatBoxesFetched",gE),Ih.listen.on("clearSession",mE),Ih.listen.on("will-reconnect",hE),Ih.waitUntil("chatBoxViewsInitialized").then(dE).catch((e=>Il.fatal(e)))}});Ih.elements.define("converse-headlines-heading",class extends Vy{static get properties(){return{jid:{type:String}}}async initialize(){this.model=nd.chatboxes.get(this.jid),await this.model.initialized,this.requestUpdate()}render(){return(e=>Gu`
2021-11-11 22:06:49 +01:00
<div class="chatbox-title ${e.status?"":"chatbox-title--no-desc"}">
<div class="chatbox-title--row">
2023-02-17 12:24:37 +01:00
${nd.api.settings.get("singleton")?"":Gu`<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">
2023-02-17 12:24:37 +01:00
${vb(MS(e.heading_buttons_promise),"")}
${vb(OS(e.heading_buttons_promise),"")}
2021-11-11 22:06:49 +01:00
</div>
</div>
2023-02-17 12:24:37 +01:00
${e.status?Gu`<p class="chat-head__desc">${e.status}</p>`:""}
`)({...this.model.toJSON(),display_name:this.model.getDisplayName(),heading_buttons_promise:this.getHeadingButtons()})}getHeadingButtons(){const e=[];return Ih.settings.get("singleton")||e.push({a_class:"close-chatbox-button",handler:e=>this.close(e),i18n_text:Gy("Close"),i18n_title:Gy("Close these announcements"),icon_class:"fa-times",name:"close",standalone:"overlayed"===Ih.settings.get("view_mode")}),nd.api.hook("getHeadingButtons",this,e)}close(e){e.preventDefault(),this.model.close()}});Ih.elements.define("converse-headlines",class extends Yx{async initialize(){nd.chatboxviews.add(this.jid,this),this.model=nd.chatboxes.get(this.jid),this.model.disable_mam=!0,this.listenTo(nd,"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(),Ih.trigger("headlinesBoxViewInitialized",this)}render(){return(e=>Gu`
2021-11-11 22:06:49 +01:00
<div class="flyout box-flyout">
<converse-dragresize></converse-dragresize>
2023-02-17 12:24:37 +01:00
${e?Gu`
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>
2023-02-17 12:24:37 +01:00
`)(this.model)}async close(e){return e?.preventDefault?.(),nd.router.history.getFragment()==="converse/chat?jid="+this.model.get("jid")&&nd.router.navigate(""),await this.model.close(e),this}getNotifications(){return[]}afterShown(){this.model.clearUnreadMsgCounter()}});const ME=e=>{const t=e.model.filter((e=>e.get("type")===nd.HEADLINES_TYPE)),n=Gy("Announcements");return Gu`
2022-12-17 22:08:36 +01:00
<div class="controlbox-section" id="headline">
<div class="d-flex controlbox-padded ${t.length?"":"hidden"}">
<span class="w-100 controlbox-heading controlbox-heading--headline">${n}</span>
2021-03-19 19:26:15 +01:00
</div>
2022-05-05 23:06:17 +02:00
</div>
2022-12-17 22:08:36 +01:00
<div class="list-container list-container--headline ${t.length?"":"hidden"}">
<div class="items-list rooms-list headline-list">
2023-02-17 12:24:37 +01:00
${t.map((t=>function(e,t){const n=Gy("Click to open this server message");return Gu`
2022-12-17 22:08:36 +01:00
<div class="list-item controlbox-padded d-flex flex-row"
data-headline-jid="${t.get("jid")}">
<a class="list-item-link open-headline available-room w-100"
data-headline-jid="${t.get("jid")}"
title="${n}"
@click=${t=>e.openHeadline(t)}
href="#">${t.get("jid")}</a>
</div>
2023-02-17 12:24:37 +01:00
`}(e,t)))}
2021-03-19 19:26:15 +01:00
</div>
2023-02-17 12:24:37 +01:00
</div>`};class RE extends Vy{initialize(){this.model=nd.chatboxes,this.listenTo(this.model,"add",(e=>this.renderIfHeadline(e))),this.listenTo(this.model,"remove",(e=>this.renderIfHeadline(e))),this.listenTo(this.model,"destroy",(e=>this.renderIfHeadline(e))),this.requestUpdate()}render(){return ME(this)}renderIfHeadline(e){return e?.get("type")===nd.HEADLINES_TYPE&&this.requestUpdate()}async openHeadline(e){e.preventDefault();const t=e.target.getAttribute("data-headline-jid");(await Ih.headlines.get(t)).maybeShow(!0)}}Ih.elements.define("converse-headlines-feeds-list",RE);var DE=n(5956),zE={};zE.styleTagTransform=o_(),zE.setAttributes=n_(),zE.insert=e_().bind(null,"head"),zE.domAPI=Ky(),zE.insertStyleElement=i_();Qy()(DE.Z,zE);DE.Z&&DE.Z.locals&&DE.Z.locals;var LE=n(2759),PE={};PE.styleTagTransform=o_(),PE.setAttributes=n_(),PE.insert=e_().bind(null,"head"),PE.domAPI=Ky(),PE.insertStyleElement=i_();Qy()(LE.Z,PE);LE.Z&&LE.Z.locals&&LE.Z.locals;Oh.plugins.add("converse-headlines-view",{dependencies:["converse-headlines","converse-chatview"],initialize(){nd.HeadlinesFeedsList=RE,nd.HeadlinesPanel=RE}});var FE=n(9679),UE={};UE.styleTagTransform=o_(),UE.setAttributes=n_(),UE.insert=e_().bind(null,"head"),UE.domAPI=Ky(),UE.insertStyleElement=i_();Qy()(FE.Z,UE);FE.Z&&FE.Z.locals&&FE.Z.locals;function BE(e,t){return e instanceof _p?Gu`<converse-mam-placeholder .model=${e}></converse-mam-placeholder>`:t}async function qE(e){if(!e.model.ui.get("chat-content-spinner-top")&&e.model.messages.length){const t=e.model.get("type")===nd.CHATROOMS_TYPE,n=e.model.getOldestMessage();if(n){const s=t?e.model.get("jid"):nd.bare_jid,i=n&&n.get(`stanza_id ${s}`);e.model.ui.set("chat-content-spinner-top",!0);try{i?await Hp(e.model,{before:i}):await Hp(e.model,{end:n.get("time")})}catch(t){return Il.error(t),void e.model.ui.set("chat-content-spinner-top",!1)}Ih.settings.get("allow_url_history_change")&&nd.router.history.navigate(`#${n.get("msgid")}`),setTimeout((()=>e.model.ui.set("chat-content-spinner-top",!1)),250)}}}Ih.elements.define("converse-mam-placeholder",class extends Vy{static get properties(){return{model:{type:Object}}}render(){return(e=this).model.get("fetching")?J_({classes:"hor_centered"}):Gu`<a @click="${t=>e.fetchMissingMessages(t)}" title="${Gy("Click to load missing messages")}">
2022-12-17 22:08:36 +01:00
<div class="message mam-placeholder"></div>
2023-02-17 12:24:37 +01:00
</a>`;var e}async fetchMissingMessages(e){e?.preventDefault?.(),this.model.set("fetching",!0);const t={before:this.model.get("before"),start:this.model.get("start")};await Hp(this.model.collection.chatbox,t),this.model.destroy()}}),Oh.plugins.add("converse-mam-views",{dependencies:["converse-mam","converse-chatview","converse-muc-views"],initialize(){Ih.listen.on("chatBoxScrolledUp",qE),Ih.listen.on("getMessageTemplate",BE)}});Ih.elements.define("converse-muc-message-form",class extends Vx{async connectedCallback(){super.connectedCallback(),await this.model.initialized}toHTML(){return(e=>{const t=e.composing_spoiler?Gy("Hidden message"):Gy("Message"),n=Gy("Optional hint"),s=Ih.settings.get("show_send_button");return Gu`
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}
2023-02-17 12:24:37 +01:00
@input=${Gx}
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
2022-05-05 23:06:17 +02:00
${s?"chat-textarea-send-button":""}
2021-11-11 22:06:49 +01:00
${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>
2023-02-17 12:24:37 +01:00
</form>`})(Object.assign(this.model.toJSON(),{hint_value:this.querySelector(".spoiler-hint")?.value,message_value:this.querySelector(".chat-textarea")?.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")===Oh.ROOMSTATUS.ENTERED,t=e&&!(this.model.features.get("moderated")&&"visitor"===this.model.getOwnRole());e&&t&&this.initMentionAutoComplete()}initMentionAutoComplete(){this.mention_auto_complete=new nd.AutoComplete(this,{auto_first:!0,auto_evaluate:!1,min_chars:Ih.settings.get("muc_mention_autocomplete_min_chars"),match_current_word:!0,list:()=>this.getAutoCompleteList(),filter:"contains"==Ih.settings.get("muc_mention_autocomplete_filter")?nd.FILTER_CONTAINS:nd.FILTER_STARTSWITH,ac_triggers:["Tab","@"],include_triggers:[],item:Ib}),this.mention_auto_complete.on("suggestion-box-selectcomplete",(()=>this.auto_completing=!1))}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)}});var HE=n(6233),GE={};GE.styleTagTransform=o_(),GE.setAttributes=n_(),GE.insert=e_().bind(null,"head"),GE.domAPI=Ky(),GE.insertStyleElement=i_();Qy()(HE.Z,GE);HE.Z&&HE.Z.locals&&HE.Z.locals;class WE extends Vy{static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=nd.chatboxes.get(this.jid)}render(){return(e=>{const t=Gy("Nickname"),n=e.model?.isEntered()?Gy("Change nickname"):Gy("Enter groupchat"),s=Ih.settings.get("muc_show_logs_before_join")?Gy("Choose a nickname to enter"):Gy("Please choose your nickname"),i=e.model?.get("nickname_validation_message");return Gu`
2022-12-17 22:08:36 +01:00
<div class="chatroom-form-container muc-nickname-form">
<form class="converse-form chatroom-form converse-centered-form"
@submit=${t=>e.submitNickname(t)}>
2021-11-11 22:06:49 +01:00
<fieldset class="form-group">
2023-01-07 22:34:35 +01:00
<label>${s}</label>
<p class="validation-message">${i}</p>
2021-11-11 22:06:49 +01:00
<input type="text"
required="required"
name="nick"
2023-01-07 22:34:35 +01:00
value="${e.model?.get("nick")||""}"
class="form-control ${i?"error":""}"
placeholder="${t}"/>
2021-11-11 22:06:49 +01:00
</fieldset>
<fieldset class="form-group">
2022-12-17 22:08:36 +01:00
<input type="submit"
class="btn btn-primary"
name="join"
2023-01-07 22:34:35 +01:00
value="${n}"/>
2021-11-11 22:06:49 +01:00
</fieldset>
</form>
2023-02-17 12:24:37 +01:00
</div>`})(this)}submitNickname(e){e.preventDefault();const t=e.target.nick.value.trim();t&&(this.model.isEntered()?(this.model.setNickname(t),this.closeModal()):this.model.join(t))}closeModal(){const e=document.createEvent("Event");e.initEvent("hide.bs.modal",!0,!0),this.dispatchEvent(e)}}Ih.elements.define("converse-muc-nickname-form",WE);const VE=e=>{const t=Gy("You have unread messages"),n=e.model.session.get("connection_status"),s=Gy("You're not allowed to send messages in this room");return n===Oh.ROOMSTATUS.ENTERED?Gu`
${e.model.ui.get("scrolled")&&e.model.get("num_unread_general")?Gu`<div class="new-msgs-indicator" @click=${t=>e.viewUnreadMessages(t)}>▼ ${t} ▼</div>`:""}
${e.can_edit?(e=>{const t=Gy("You have unread messages"),n=Ih.settings.get("message_limit"),s=Ih.settings.get("visible_toolbar_buttons").call,i=Ih.settings.get("visible_toolbar_buttons").emoji,r=Ih.settings.get("show_send_button"),o=Ih.settings.get("visible_toolbar_buttons").spoiler,a=Ih.settings.get("show_toolbar");return Gu`
${e.model.ui.get("scrolled")&&e.model.get("num_unread")?Gu`<div class="new-msgs-indicator" @click=${t=>e.viewUnreadMessages(t)}>▼ ${t} ▼</div>`:""}
${a?Gu`
2021-11-11 22:06:49 +01:00
<converse-chat-toolbar
class="chat-toolbar no-text-select"
.model=${e.model}
?hidden_occupants="${e.model.get("hidden_occupants")}"
?is_groupchat="${e.is_groupchat}"
2022-05-05 23:06:17 +02:00
?show_call_button="${s}"
?show_emoji_button="${i}"
2022-12-17 22:08:36 +01:00
?show_send_button="${r}"
?show_spoiler_button="${o}"
2021-11-11 22:06:49 +01:00
?show_toolbar="${a}"
message_limit="${n}"></converse-chat-toolbar>`:""}
2023-02-17 12:24:37 +01:00
<converse-muc-message-form jid=${e.model.get("jid")}></converse-muc-message-form>`})(e):Gu`<span class="muc-bottom-panel muc-bottom-panel--muted">${s}</span>`}`:n!=Oh.ROOMSTATUS.NICKNAME_REQUIRED?"":Ih.settings.get("muc_show_logs_before_join")?Gu`<span class="muc-bottom-panel muc-bottom-panel--nickname">
2022-04-02 21:20:14 +02:00
<converse-muc-nickname-form jid="${e.model.get("jid")}"></converse-muc-nickname-form>
2023-02-17 12:24:37 +01:00
</span>`:void 0};var JE=n(6916),ZE={};ZE.styleTagTransform=o_(),ZE.setAttributes=n_(),ZE.insert=e_().bind(null,"head"),ZE.domAPI=Ky(),ZE.insertStyleElement=i_();Qy()(JE.Z,ZE);JE.Z&&JE.Z.locals&&JE.Z.locals;Ih.elements.define("converse-muc-bottom-panel",class extends Qx{events={"click .hide-occupants":"hideOccupants","click .send-button":"sendButtonClicked"};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")===Oh.ROOMSTATUS.ENTERED,t=e&&!(this.model.features.get("moderated")&&"visitor"===this.model.getOwnRole());lh(VE({can_edit:t,entered:e,model:this.model,is_groupchat:!0,viewUnreadMessages:e=>this.viewUnreadMessages(e)}),this)}renderIfOwnOccupant(e){e.get("jid")===nd.bare_jid&&this.debouncedRender()}sendButtonClicked(e){this.querySelector("converse-muc-message-form")?.onFormSubmitted(e)}hideOccupants(e){e?.preventDefault?.(),e?.stopPropagation?.(),this.model.save({hidden_occupants:!0})}});const QE={offline:"Offline",unavailable:"Unavailable",xa:"Extended Away",away:"Away",dnd:"Do not disturb",chat:"Chattty",online:"Online"},YE=e=>{const t=e.get("role"),n=(e=>Gy("Click to mention %1$s in your message.",e.get("nick")))(e),s=Gy("This user is a moderator."),i=Gy("This user can send messages in this groupchat."),r=Gy("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}`},KE=(e,t)=>{const n=e.get("affiliation"),s=QE[e.get("show")],i=Gy("Admin"),r=Gy("Member"),o=Gy("Moderator"),a=Gy("Owner"),c=Gy("Visitor"),l=e.get("role"),d=e.get("show");let u,h;return[u,h]="online"===d?["fa fa-circle","chat-status-online"]:"dnd"===d?["fa fa-minus-circle","chat-status-busy"]:"away"===d?["fa fa-circle","chat-status-away"]:["fa fa-circle","subdued-color"],Gu`
<li class="occupant" id="${e.id}" title="${YE(e)}">
2021-11-11 22:06:49 +01:00
<div class="row no-gutters">
<div class="col-auto">
2023-02-17 12:24:37 +01:00
<a class="show-msg-author-modal" @click=${t=>function(e,t){Ih.modal.show("converse-muc-occupant-modal",{model:t},e)}(t,e)}>
2022-01-03 11:54:10 +01:00
<converse-avatar
class="avatar chat-msg__avatar"
2023-01-07 22:34:35 +01:00
.data=${e.vcard?.attributes}
nonce=${e.vcard?.get("vcard_updated")}
2022-01-03 11:54:10 +01:00
height="30" width="30"></converse-avatar>
<converse-icon
2023-01-07 22:34:35 +01:00
title="${s}"
color="var(--${h})"
2022-01-03 11:54:10 +01:00
style="margin-top: -0.1em"
size="0.82em"
2023-01-07 22:34:35 +01:00
class="${u} chat-status chat-status--avatar"></converse-icon>
2022-01-03 11:54:10 +01:00
</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">
2023-02-17 12:24:37 +01:00
${"owner"===n?Gu`<span class="badge badge-groupchat">${a}</span>`:""}
${"admin"===n?Gu`<span class="badge badge-info">${i}</span>`:""}
${"member"===n?Gu`<span class="badge badge-info">${r}</span>`:""}
${"moderator"===l?Gu`<span class="badge badge-info">${o}</span>`:""}
${"visitor"===l?Gu`<span class="badge badge-secondary">${c}</span>`:""}
2021-11-11 22:06:49 +01:00
</span>
</div>
</div>
</li>
2023-02-17 12:24:37 +01:00
`};var XE=n(9959),eA={};eA.styleTagTransform=o_(),eA.setAttributes=n_(),eA.insert=e_().bind(null,"head"),eA.domAPI=Ky(),eA.insertStyleElement=i_();Qy()(XE.Z,eA);XE.Z&&XE.Z.locals&&XE.Z.locals;var tA=n(902),nA={};nA.styleTagTransform=o_(),nA.setAttributes=n_(),nA.insert=e_().bind(null,"head"),nA.domAPI=Ky(),nA.insertStyleElement=i_();Qy()(tA.Z,nA);tA.Z&&tA.Z.locals&&tA.Z.locals;const{u:sA}=Oh.env;Ih.elements.define("converse-muc-sidebar",class extends Vy{static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=nd.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(){const e=(e=>{const t=1===e.occupants.length?Gy("Participant"):Gy("Participants");return Gu`
2021-11-11 22:06:49 +01:00
<div class="occupants-header">
<div class="occupants-header--title">
2022-05-05 23:06:17 +02:00
<span class="occupants-heading">${e.occupants.length} ${t}</span>
2022-04-02 21:20:14 +02:00
<i class="hide-occupants" @click=${e.closeSidebar}>
<converse-icon class="fa fa-times" size="1em"></converse-icon>
</i>
2021-11-11 22:06:49 +01:00
</div>
</div>
<div class="dragresize dragresize-occupants-left"></div>
2023-02-17 12:24:37 +01:00
<ul class="occupant-list">${Mw(e.occupants,(e=>e.get("jid")),(t=>KE(t,e)))}</ul>
`})(Object.assign(this.model.toJSON(),{occupants:[...this.model.occupants.models],closeSidebar:e=>this.closeSidebar(e),onOccupantClicked:e=>this.onOccupantClicked(e)}));return e}closeSidebar(e){e?.preventDefault?.(),e?.stopPropagation?.(),sA.safeSave(this.model,{hidden_occupants:!0})}onOccupantClicked(e){e?.preventDefault?.();nd.chatboxviews.get(this.getAttribute("jid"))?.getMessageForm().insertIntoTextArea(`@${e.target.textContent}`)}});const{u:iA}=Oh.env;Ih.elements.define("converse-muc-chatarea",class extends Vy{static get properties(){return{jid:{type:String},show_help_messages:{type:Boolean},type:{type:String}}}async initialize(){this.model=await Ih.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=>Gu`
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>
2023-02-17 12:24:37 +01:00
${e.model?.get("show_help_messages")?Gu`<div class="chat-content__help">
2021-11-11 22:06:49 +01:00
<converse-chat-help
.model=${e.model}
.messages=${e.getHelpMessages()}
type="info"
2023-02-17 12:24:37 +01:00
chat_type="${nd.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>
2023-02-17 12:24:37 +01:00
${e.model?Gu`
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>`:""}
2023-02-17 12:24:37 +01:00
`)({getHelpMessages:()=>this.getHelpMessages(),jid:this.jid,model:this.model,onMousedown:e=>this.onMousedown(e),show_send_button:Ih.settings.get("show_send_button"),shouldShowSidebar:()=>this.shouldShowSidebar(),type:this.type})}shouldShowSidebar(){return!this.model.get("hidden_occupants")&&this.model.session.get("connection_status")===Oh.ROOMSTATUS.ENTERED}getHelpMessages(){const e=Ih.settings.get("muc_disable_slash_commands"),t=Array.isArray(e)?e:[];return[`<strong>/admin</strong>: ${Gy("Change user's affiliation to admin")}`,`<strong>/ban</strong>: ${Gy("Ban user by changing their affiliation to outcast")}`,`<strong>/clear</strong>: ${Gy("Clear the chat area")}`,`<strong>/close</strong>: ${Gy("Close this groupchat")}`,`<strong>/deop</strong>: ${Gy("Change user role to participant")}`,`<strong>/destroy</strong>: ${Gy("Remove this groupchat")}`,`<strong>/help</strong>: ${Gy("Show this menu")}`,`<strong>/kick</strong>: ${Gy("Kick user from groupchat")}`,`<strong>/me</strong>: ${Gy("Write in 3rd person")}`,`<strong>/member</strong>: ${Gy("Grant membership to a user")}`,`<strong>/modtools</strong>: ${Gy("Opens up the moderator tools GUI")}`,`<strong>/mute</strong>: ${Gy("Remove user's ability to post messages")}`,`<strong>/nick</strong>: ${Gy("Change your nickname")}`,`<strong>/op</strong>: ${Gy("Grant moderator role to user")}`,`<strong>/owner</strong>: ${Gy("Grant ownership of this groupchat")}`,`<strong>/register</strong>: ${Gy("Register your nickname")}`,`<strong>/revoke</strong>: ${Gy("Revoke the user's current affiliation")}`,`<strong>/subject</strong>: ${Gy("Set groupchat subject")}`,`<strong>/topic</strong>: ${Gy("Set groupchat subject (alias for /subject)")}`,`<strong>/voice</strong>: ${Gy("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){iA.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);iA.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:rA}=Oh.env,oA=Oh.env.utils,{sizzle:aA}=Oh.env,cA=Oh.env.utils;class lA extends Vy{static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=nd.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=Ih.settings.get("roomconfig_whitelist"),n=e.model.session.get("config_stanza");let s,i=[],r="";if(n){const o=oA.toStanza(n);i=rA("field",o),t.length&&(i=i.filter((e=>t.includes(e.getAttribute("var")))));const a={new_password:!e.model.features.get("passwordprotected"),fixed_username:e.model.get("jid")};i=i.map((e=>oA.xForm2TemplateResult(e,o,a))),r=o.querySelector("instructions")?.textCont
2022-05-05 23:06:17 +02:00
<form class="converse-form chatroom-form ${i.length?"":"converse-form--spinner"}"
2021-11-11 22:06:49 +01:00
autocomplete="off"
@submit=${e.submitConfigForm}>
2021-03-19 19:26:15 +01:00
<fieldset class="form-group">
2022-05-05 23:06:17 +02:00
<legend class="centered">${s}</legend>
2023-02-17 12:24:37 +01:00
${s!==r?Gu`<p class="form-help">${r}</p>`:""}
${i.length?i:J_({classes:"hor_centered"})}
2021-03-19 19:26:15 +01:00
</fieldset>
2023-02-17 12:24:37 +01:00
${i.length?Gu`
2021-11-11 22:06:49 +01:00
<fieldset>
2023-01-07 22:34:35 +01:00
<input type="submit" class="btn btn-primary" value="${o}">
<input type="button" class="btn btn-secondary button-cancel" value="${a}" @click=${e.closeConfigForm}>
2022-12-17 22:08:36 +01:00
</fieldset>`:""}
</form>
2023-02-17 12:24:37 +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=aA(":input:not([type=button]):not([type=submit])",e.target).map(cA.webForm2xForm).filter((e=>e));try{await this.model.sendConfiguration(t)}catch(e){Il.error(e);const t=Gy("Sorry, an error occurred while trying to submit the config form.")+" "+Gy("Check your browser's developer console for details.");Ih.alert("error",Gy("Error"),t)}await this.model.refreshDiscoInfo(),this.closeForm()}closeForm(e){e?.preventDefault?.(),this.model.session.set("view",null)}}Ih.elements.define("converse-muc-config-form",lA);const dA=e=>{const t=Gy("This groupchat no longer exists"),n=Gy('The following reason was given: "%1$s"',e.reason||"");return Gu`
2022-12-17 22:08:36 +01:00
<div class="alert alert-danger">
<h3 class="alert-heading disconnect-msg">${t}</h3>
2021-11-11 22:06:49 +01:00
</div>
2023-02-17 12:24:37 +01:00
${e.reason?Gu`<p class="destroyed-reason">${n}</p>`:""}
${e.moved_jid?(e=>{const t=Gy("The conversation has moved to a new address. Click the link below to enter.");return Gu`
2022-12-17 22:08:36 +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):""}
2023-02-17 12:24:37 +01:00
`};Ih.elements.define("converse-muc-destroyed",class extends Vy{static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=nd.chatboxes.get(this.jid)}render(){const e=this.model.get("destroyed_reason"),t=this.model.get("moved_jid");return dA({moved_jid:t,reason:e,onSwitch:e=>this.onSwitch(e)})}async onSwitch(e){e.preventDefault();const t=this.model.get("moved_jid");(await Ih.rooms.get(t,{},!0)).maybeShow(!0),this.model.destroy()}});Ih.elements.define("converse-muc-disconnected",class extends Vy{static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=nd.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(Gy("This action was done by %1$s.",n));const s=this.model.session.get("disconnection_reason");return s&&t.push(Gy('The reason given is: "%1$s".',s)),(e=>Gu`
2022-12-17 22:08:36 +01:00
<div class="alert alert-danger">
<h3 class="alert-heading disconnect-msg">${e[0]}</h3>
2023-02-17 12:24:37 +01:00
${e.slice(1).map((e=>Gu`<p class="disconnect-msg">${e}</p>`))}
</div>`)(t)}});const uA=e=>{const t=e.toJSON(),n=e.config.toJSON(),s=e.features.toJSON(),i=e.occupants.filter((e=>"offline"!==e.get("show"))).length,r=Gy("XMPP address"),o=Gy("Message archiving"),a=Gy("Messages are archived on the server"),c=Gy("Description"),l=Gy("Features"),d=Gy("Hidden"),u=Gy("This groupchat is not publicly searchable"),h=Gy("This groupchat is restricted to members only"),m=Gy("Members only"),g=Gy("Moderated"),f=Gy("Participants entering this groupchat need to request permission to write"),p=Gy("Name"),v=Gy("This groupchat does not require a password upon entry"),y=Gy("No password required"),_=Gy("Not anonymous"),b=Gy("All other groupchat participants can see your XMPP address"),w=Gy("Not moderated"),S=Gy("Participants entering this groupchat can write right away"),x=Gy("Online users"),E=Gy("Open"),A=Gy("Anyone can join this groupchat"),C=Gy("This groupchat requires a password before entry"),$=Gy("Password protected"),k=Gy("Persistent"),j=Gy("This groupchat persists even if it's unoccupied"),T=Gy("Public"),N=Gy("Semi-anonymous"),I=Gy("Only moderators can see your XMPP address"),O=Gy("Temporary"),M=Gy("This groupchat will disappear once the last person leaves");return Gu`
2022-12-17 22:08:36 +01:00
<div class="room-info">
<p class="room-info"><strong>${p}</strong>: ${t.name}</p>
<p class="room-info"><strong>${r}</strong>: <converse-rich-text text="xmpp:${t.jid}?join"></converse-rich-text></p>
<p class="room-info"><strong>${c}</strong>: <converse-rich-text text="${n.description}" render_styling></converse-rich-text></p>
2023-02-17 12:24:37 +01:00
${t.subject?(e=>{const t=Gy("Topic"),n=Gy("Topic author");return Gu`
2022-04-02 21:20:14 +02:00
<p class="room-info"><strong>${t}</strong>: <converse-rich-text text=${e.subject.text} render_styling></converse-rich-text></p>
2021-11-11 22:06:49 +01:00
<p class="room-info"><strong>${n}</strong>: ${e.subject&&e.subject.author}</p>
2022-04-02 21:20:14 +02:00
`})(t):""}
2022-12-17 22:08:36 +01:00
<p class="room-info"><strong>${x}</strong>: ${i}</p>
<p class="room-info"><strong>${l}</strong>:
<div class="chatroom-features">
<ul class="features-list">
2023-02-17 12:24:37 +01:00
${s.passwordprotected?Gu`<li class="feature" ><converse-icon size="1em" class="fa fa-lock"></converse-icon>${$} - <em>${C}</em></li>`:""}
${s.unsecured?Gu`<li class="feature" ><converse-icon size="1em" class="fa fa-unlock"></converse-icon>${y} - <em>${v}</em></li>`:""}
${s.hidden?Gu`<li class="feature" ><converse-icon size="1em" class="fa fa-eye-slash"></converse-icon>${d} - <em>${u}</em></li>`:""}
${s.public_room?Gu`<li class="feature" ><converse-icon size="1em" class="fa fa-eye"></converse-icon>${T} - <em>${t.__("This groupchat is publicly searchable")}</em></li>`:""}
${s.membersonly?Gu`<li class="feature" ><converse-icon size="1em" class="fa fa-address-book"></converse-icon>${m} - <em>${h}</em></li>`:""}
${s.open?Gu`<li class="feature" ><converse-icon size="1em" class="fa fa-globe"></converse-icon>${E} - <em>${A}</em></li>`:""}
${s.persistent?Gu`<li class="feature" ><converse-icon size="1em" class="fa fa-save"></converse-icon>${k} - <em>${j}</em></li>`:""}
${s.temporary?Gu`<li class="feature" ><converse-icon size="1em" class="fa fa-snowflake"></converse-icon>${O} - <em>${M}</em></li>`:""}
${s.nonanonymous?Gu`<li class="feature" ><converse-icon size="1em" class="fa fa-id-card"></converse-icon>${_} - <em>${b}</em></li>`:""}
${s.semianonymous?Gu`<li class="feature" ><converse-icon size="1em" class="fa fa-user-secret"></converse-icon>${N} - <em>${I}</em></li>`:""}
${s.moderated?Gu`<li class="feature" ><converse-icon size="1em" class="fa fa-gavel"></converse-icon>${g} - <em>${f}</em></li>`:""}
${s.unmoderated?Gu`<li class="feature" ><converse-icon size="1em" class="fa fa-info-circle"></converse-icon>${w} - <em>${S}</em></li>`:""}
${s.mam_enabled?Gu`<li class="feature" ><converse-icon size="1em" class="fa fa-database"></converse-icon>${o} - <em>${a}</em></li>`:""}
2022-12-17 22:08:36 +01:00
</ul>
2021-11-11 22:06:49 +01:00
</div>
2022-12-17 22:08:36 +01:00
</p>
2023-02-17 12:24:37 +01:00
`};var hA=n(814),mA={};mA.styleTagTransform=o_(),mA.setAttributes=n_(),mA.insert=e_().bind(null,"head"),mA.domAPI=Ky(),mA.insertStyleElement=i_();Qy()(hA.Z,mA);hA.Z&&hA.Z.locals&&hA.Z.locals;Ih.elements.define("converse-muc-details-modal",class extends $_{initialize(){super.initialize(),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()))}renderModal(){return uA(this.model)}getModalTitle(){return Gy("Groupchat info for %1$s",this.model.getDisplayName())}});const gA=Oh.env.utils;Ih.elements.define("converse-muc-invite-modal",class extends $_{initialize(){super.initialize(),this.listenTo(this.model,"change",(()=>this.render()))}renderModal(){return(e=>{const t=Gy("Invite"),n=Gy("user@example.org"),s=Gy("Please enter a valid XMPP address"),i=Gy("XMPP Address"),r=Gy("Optional reason for the invitation");return Gu`
2022-12-17 22:08:36 +01:00
<form class="converse-form" @submit=${t=>e.submitInviteForm(t)}>
<div class="form-group">
<label class="clearfix" for="invitee_jids">${i}:</label>
2023-02-17 12:24:37 +01:00
${e.model.get("invalid_invite_jid")?Gu`<div class="error error-feedback">${s}</div>`:""}
2022-12-17 22:08:36 +01:00
<converse-autocomplete
.getAutoCompleteList=${()=>e.getAutoCompleteList()}
?autofocus=${!0}
min_chars="1"
position="below"
required="required"
name="invitee_jids"
id="invitee_jids"
placeholder="${n}">
</converse-autocomplete>
2021-11-11 22:06:49 +01:00
</div>
2022-12-17 22:08:36 +01:00
<div class="form-group">
<label>${r}:</label>
<textarea class="form-control" name="reason"></textarea>
</div>
<div class="form-group">
<input type="submit" class="btn btn-primary" value="${t}"/>
</div>
</form>
2023-02-17 12:24:37 +01:00
`})(this)}getModalTitle(){return Gy("Invite someone to this groupchat")}getAutoCompleteList(){return nd.roster.map((e=>({label:e.getDisplayName(),value:e.get("jid")})))}submitInviteForm(e){e.preventDefault();const t=new FormData(e.target),n=t.get("invitee_jids")?.trim(),s=t.get("reason");gA.isValidJID(n)?(this.chatroomview.model.directInvite(n,s),this.modal.hide()):this.model.set({invalid_invite_jid:!0})}});Ih.elements.define("converse-muc-nickname-modal",class extends $_{renderModal(){return Gu`<converse-muc-nickname-form jid="${this.model.get("jid")}"></converse-muc-nickname-form>`}getModalTitle(){return Gy("Change your nickname")}});var fA=n(307),pA={};pA.styleTagTransform=o_(),pA.setAttributes=n_(),pA.insert=e_().bind(null,"head"),pA.domAPI=Ky(),pA.insertStyleElement=i_();Qy()(fA.Z,pA);fA.Z&&fA.Z.locals&&fA.Z.locals;Ih.elements.define("converse-rich-text",class extends Vy{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 HS(this.text,this.offset,e)}});var vA=n(3288),yA={};yA.styleTagTransform=o_(),yA.setAttributes=n_(),yA.insert=e_().bind(null,"head"),yA.domAPI=Ky(),yA.insertStyleElement=i_();Qy()(vA.Z,yA);vA.Z&&vA.Z.locals&&vA.Z.locals;Ih.elements.define("converse-muc-heading",class extends Vy{async initialize(){this.model=nd.chatboxes.get(this.getAttribute("jid")),this.listenTo(this.model,"change",(()=>this.requestUpdate())),this.listenTo(this.model,"vcard:add",(()=>this.requestUpdate())),this.listenTo(this.model,"vcard:change",(()=>this.requestUpdate())),this.user_settings=await nd.api.user.settings.getModel(),this.listenTo(this.user_settings,"change:mucs_with_hidden_subject",(()=>this.requestUpdate())),await this.model.initialized,this.listenTo(this.model.features,"change:open",(()=>this.requestUpdate())),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.requestUpdate()}render(){return this.model&&this.user_settings?(e=>{const t=e.model.toJSON(),n=e.user_settings?.get("mucs_with_hidden_subject",[])?.includes(e.model.get("jid")),s=e.getHeadingButtons(n),i=Gy("Hide the groupchat topic"),r=Gy("This groupchat is bookmarked"),o=t.subject?t.subject.text:"",a=o&&!n,c=e.model.vcard?.get("image");return Gu`
2023-01-07 22:34:35 +01:00
<div class="chatbox-title ${a?"":"chatbox-title--no-desc"}">
2022-05-05 23:06:17 +02:00
2023-02-17 12:24:37 +01:00
${c&&c!==nd.DEFAULT_IMAGE?Gu`
2022-05-05 23:06:17 +02:00
<converse-avatar class="avatar align-self-center"
2023-01-07 22:34:35 +01:00
.data=${e.model.vcard?.attributes}
nonce=${e.model.vcard?.get("vcard_updated")}
2022-05-05 23:06:17 +02:00
height="40" width="40"></converse-avatar>`:""}
2022-04-02 21:20:14 +02:00
<div class="chatbox-title--row">
2023-02-17 12:24:37 +01:00
${nd.api.settings.get("singleton")?"":Gu`<converse-controlbox-navback jid="${t.jid}"></converse-controlbox-navback>`}
<div class="chatbox-title__text" title="${"hidden"!==Ih.settings.get("locked_muc_domain")?t.jid:""}">${e.model.getDisplayName()}
${t.bookmarked?Gu`<converse-icon
2022-12-17 22:08:36 +01:00
class="fa fa-bookmark chatbox-title__text--bookmarked"
size="1em"
color="var(--chatroom-head-color)"
2023-01-07 22:34:35 +01:00
title="${r}">
2022-12-17 22:08:36 +01:00
</converse-icon>`:""}
2022-04-02 21:20:14 +02:00
</div>
2021-11-11 22:06:49 +01:00
</div>
<div class="chatbox-title__buttons row no-gutters">
2023-02-17 12:24:37 +01:00
${vb(OS(s),"")}
${vb(MS(s),"")}
2021-11-11 22:06:49 +01:00
</div>
</div>
2023-02-17 12:24:37 +01:00
${a?Gu`<p class="chat-head__desc" title="${i}">
2023-01-07 22:34:35 +01:00
<converse-rich-text text=${o} render_styling></converse-rich-text>
2021-11-11 22:06:49 +01:00
</p>`:""}
2023-02-17 12:24:37 +01:00
`})(this):""}onOccupantAdded(e){e.get("jid")===nd.bare_jid&&this.requestUpdate()}onOccupantAffiliationChanged(e){e.get("jid")===nd.bare_jid&&this.requestUpdate()}showRoomDetailsModal(e){e.preventDefault(),Ih.modal.show("converse-muc-details-modal",{model:this.model},e)}showInviteModal(e){e.preventDefault(),Ih.modal.show("converse-muc-invite-modal",{model:new No,chatroomview:this},e)}toggleTopic(e){e?.preventDefault?.(),this.model.toggleSubjectHiddenState()}getAndRenderConfigurationForm(){this.model.session.set("view",Oh.MUC.VIEWS.CONFIG)}close(e){e.preventDefault(),this.model.close()}destroy(e){e.preventDefault(),Tb(this.model)}getHeadingButtons(e){const t=[];t.push({i18n_text:Gy("Details"),i18n_title:Gy("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:Gy("Configure"),i18n_title:Gy("Configure this groupchat"),handler:()=>this.getAndRenderConfigurationForm(),a_class:"configure-chatroom-button",icon_class:"fa-wrench",name:"configure"}),t.push({i18n_text:Gy("Nickname"),i18n_title:Gy("Change the nickname you're using in this groupchat"),handler:e=>Ih.modal.show("converse-muc-nickname-modal",{model:this.model},e),a_class:"open-nickname-modal",icon_class:"fa-smile",name:"nickname"}),this.model.invitesAllowed()&&t.push({i18n_text:Gy("Invite"),i18n_title:Gy("Invite someone to join this groupchat"),handler:e=>this.showInviteModal(e),a_class:"open-invite-modal",icon_class:"fa-user-plus",name:"invite"});const n=this.model.get("subject");n&&n.text&&t.push({i18n_text:Gy(e?"Show topic":"Hide topic"),i18n_title:Gy(e?"Show the topic message in the heading":"Hide the topic in the heading"),handler:e=>this.toggleTopic(e),a_class:"hide-topic",icon_class:"fa-minus-square",name:"toggle-topic"});if(this.model.session.get("connection_status")===Oh.ROOMSTATUS.ENTERED){const e=this.model.getAllowedCommands();e.includes("modtools")&&t.push({i18n_text:Gy("Moderate"),i18n_title:Gy("Moderate this groupchat"),handler:()=>Db(this.model),a_class:"moderate-chatroom-button",icon_class:"fa-user-cog",name:"moderate"}),e.includes("destroy")&&t.push({i18n_text:Gy("Destroy"),i18n_title:Gy("Remove this groupchat"),handler:e=>this.destroy(e),a_class:"destroy-chatroom-button",icon_class:"fa-trash",name:"destroy"})}Ih.settings.get("singleton")||t.push({i18n_text:Gy("Leave"),i18n_title:Gy("Leave and close this groupchat"),handler:async e=>{e.stopPropagation();const t=[Gy("Are you sure you want to leave this groupchat?")];await Ih.confirm(Gy("Confirm"),t)&&this.close(e)},a_class:"close-chatbox-button",standalone:"overlayed"===Ih.settings.get("view_mode"),icon_class:"fa-sign-out-alt",name:"signout"});const s=nd.chatboxviews.get(this.getAttribute("jid"));return s?nd.api.hook("getHeadingButtons",s,t):Promise.resolve(t)}});class _A extends Vy{static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=nd.chatboxes.get(this.jid),this.listenTo(this.model,"change:password_validation_message",this.render),this.render()}render(){return(e=>{const t=Gy("This groupchat requires a password"),n=Gy("Password: "),s=Gy("Submit");return Gu`
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">
2022-05-05 23:06:17 +02:00
<input class="btn btn-primary" type="submit" value="${s}"/>
2021-11-11 22:06:49 +01:00
</fieldset>
2021-03-19 19:26:15 +01:00
</form>
2023-02-17 12:24:37 +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)}}Ih.elements.define("converse-muc-password-form",_A);class bA extends Yx{length=300;is_chatroom=!0;async initialize(){this.model=await Ih.rooms.get(this.jid),nd.chatboxviews.add(this.jid,this),this.setAttribute("id",this.model.get("box_id")),this.listenTo(nd,"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(),Ih.trigger("chatRoomViewInitialized",this)}render(){return(e=>Gu`
2021-11-11 22:06:49 +01:00
<div class="flyout box-flyout">
<converse-dragresize></converse-dragresize>
2023-02-17 12:24:37 +01:00
${e.model?Gu`
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>
2023-02-17 12:24:37 +01:00
<div class="chat-body chatroom-body row no-gutters">${Nb(e)}</div>
2021-11-11 22:06:49 +01:00
`:""}
2023-02-17 12:24:37 +01:00
</div>`)({model:this.model})}onConnectionStatusChanged(){this.model.session.get("connection_status")===Oh.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()}}Ih.elements.define("converse-muc",bA);var wA=n(3076),SA={};SA.styleTagTransform=o_(),SA.setAttributes=n_(),SA.insert=e_().bind(null,"head"),SA.domAPI=Ky(),SA.insertStyleElement=i_();Qy()(wA.Z,SA);wA.Z&&wA.Z.locals&&wA.Z.locals;const{Strophe:xA}=Oh.env;Oh.MUC.VIEWS={CONFIG:"config-form"},Oh.plugins.add("converse-muc-views",{dependencies:["converse-modal","converse-controlbox","converse-chatview"],initialize(){const{_converse:e}=this;Ih.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=bA,Ih.settings.get("muc_domain")||Ih.listen.on("serviceDiscovered",(async e=>{if(e?.get("var")===xA.NS.MUC){if(e.entity.get("jid").includes("@"))return;await e.entity.getIdentity("conference","text")&&Ih.settings.set("muc_domain",xA.getDomainFromJid(e.get("from")))}})),Ih.listen.on("clearsession",(()=>{const t=e.chatboxviews.get("controlbox");t&&t.roomspanel&&(t.roomspanel.model.destroy(),t.roomspanel.remove(),delete t.roomspanel)})),Ih.listen.on("chatBoxClosed",(t=>{var n;t.get("type")===e.CHATROOMS_TYPE&&(n=t.get("jid"),nd.router.history.getFragment()===`converse/room?jid=${n}`&&nd.router.navigate(""))})),Ih.listen.on("parseMessageForCommands",zb)}});const EA=No.extend({defaults:{collapsed:!1}});Ih.elements.define("converse-minimized-chats",class extends Vy{async initialize(){this.model=nd.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(nd,"connected",(()=>this.requestUpdate())),this.listenTo(nd,"reconnected",(()=>this.requestUpdate())),this.listenTo(nd,"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=>Gu`<div id="minimized-chats" class="${e.chats.length?"":"hidden"}">
2022-12-17 22:08:36 +01:00
<a id="toggle-minimized-chats" class="row no-gutters" @click=${e.toggle}>
2023-02-17 12:24:37 +01:00
${e.num_minimized} ${Gy("Minimized")}
2022-12-17 22:08:36 +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":""}">
2023-02-17 12:24:37 +01:00
${e.chats.map((e=>Gu`<converse-minimized-chat
2022-12-17 22:08:36 +01:00
.model=${e}
title=${e.getDisplayName()}
type=${e.get("type")}
num_unread=${e.get("num_unread")}></converse-minimized-chat>`))}
</div>
2023-02-17 12:24:37 +01:00
</div>`)(s)}async initToggle(){const e=`converse.minchatstoggle-${nd.bare_jid}`;this.minchats=new EA({id:e}),Xc(this.minchats,e,"session"),await new Promise((e=>this.minchats.fetch({success:e,error:e})))}toggle(e){e?.preventDefault(),this.minchats.save({collapsed:!this.minchats.get("collapsed")})}});const{dayjs:AA,u:CA}=Oh.env;function $A(e){if("controlbox"===e.model.get("id")){if(CA.isVisible(e))return CA.getOuterWidth(e,!0);{const e=document.querySelector("converse-controlbox-toggle");return e?CA.getOuterWidth(e,!0):0}}return!e.model.get("minimized")&&CA.isVisible(e)?CA.getOuterWidth(e,!0):0}function kA(){const e=document.querySelector("converse-minimized-chats");return nd.chatboxes.pluck("minimized").includes(!0)?CA.getOuterWidth(e,!0):0}function jA(e){const t=e?e.model.get("id"):null,n=e?CA.getOuterWidth(e,!0):0;return Object.values(nd.chatboxviews.xget(t)).reduce(((e,t)=>e+$A(t)),n)}function TA(e){if(nd.isTestEnv()||Ih.settings.get("no_trimming")||"overlayed"!==Ih.settings.get("view_mode"))return;const t=nd.chatboxviews.filter((e=>!e.model.get("minimized")&&!e.model.get("closed")&&CA.isVisible(e)));if(t.length<=1)return;const n=CA.getOuterWidth(document.querySelector("body"),!0);if($A(t[0])===n)return;if(document.querySelector("converse-minimized-chats"))for(;kA()+jA(e)>n;){const t=NA([e?e.model.get("id"):null]);if(!t)break;nd.chatboxes.get(t.get("id"))?.save("hidden",!0),OA(t)}}function NA(e){e.push("controlbox");let t=0,n=nd.chatboxes.sort().at(t);for(;e.includes(n.get("id"))||!0===n.get("minimized");)if(t++,n=nd.chatboxes.at(t),!n)return null;return n}function IA(e,t){e?.preventDefault?e.preventDefault():t=e,CA.safeSave(t,{hidden:!1,minimized:!1,time_opened:(new Date).getTime()})}function OA(e,t){e?.preventDefault?e.preventDefault():t=e,t.setChatState(nd.INACTIVE),CA.safeSave(t,{hidden:!0,minimized:!0,time_minimized:(new Date).toISOString()})}function MA(e){e.get("minimized")?function(e){Ih.trigger("chatBoxMinimized",e)}(e):function(e){e.isScrolledUp()||e.clearUnreadMsgCounter(),e.setChatState(nd.ACTIVE),Ih.trigger("chatBoxMaximized",e)}(e)}Ih.elements.define("converse-minimized-chat",class extends Vy{static get properties(){return{model:{type:Object},title:{type:String},type:{type:String},num_unread:{type:Number}}}render(){return(e=>{const t=Gy("Click to restore this chat");let n;return n="chatroom"===e.type?"var(--chatroom-head-color)":"headline"===e.type?"var(--headlines-head-text-color)":"var(--chat-head-text-color)",Gu`
2022-12-17 22:08:36 +01:00
<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}>
2023-02-17 12:24:37 +01:00
${e.num_unread?Gu`<span class="message-count badge badge-light">${e.num_unread}</span>`:""}
2022-12-17 22:08:36 +01:00
${e.title}
</a>
<a class="chatbox-btn close-chatbox-button" @click=${e.close}>
<converse-icon color=${n} class="fas fa-times" @click=${e.close} size="1em"></converse-icon>
</a>
2023-02-17 12:24:37 +01:00
</div>`})({close:e=>this.close(e),num_unread:this.num_unread,restore:e=>this.restore(e),title:this.title,type:this.type})}close(e){e?.preventDefault(),this.model.close()}restore(e){e?.preventDefault(),IA(this.model)}});var RA=n(4915),DA={};DA.styleTagTransform=o_(),DA.setAttributes=n_(),DA.insert=e_().bind(null,"head"),DA.domAPI=Ky(),DA.insertStyleElement=i_();Qy()(RA.Z,DA);RA.Z&&RA.Z.locals&&RA.Z.locals;Oh.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:{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){!function(e){e.on("change:hidden",(t=>!t.get("hidden")&&IA(e)),e),"controlbox"!==e.get("id")&&e.save({minimized:e.get("minimized")||!1,time_minimized:e.get("time_minimized")||AA()})}(e),e.on("change:minimized",(()=>MA(e)))}Ih.settings.extend({no_trimming:!1}),Ih.promises.add("minimizedChatsInitialized"),nd.MinimizedChatsToggle=EA,nd.minimize={trimChats:TA,minimize:OA,maximize:IA},Ih.listen.on("chatBoxViewInitialized",(e=>nd.minimize.trimChats(e))),Ih.listen.on("chatRoomViewInitialized",(e=>nd.minimize.trimChats(e))),Ih.listen.on("controlBoxOpened",(e=>nd.minimize.trimChats(e))),Ih.listen.on("chatBoxInitialized",e),Ih.listen.on("chatRoomInitialized",e),Ih.listen.on("getHeadingButtons",((e,t)=>e.model.get("type")===nd.CHATROOMS_TYPE?function(e,t){const n={a_class:"toggle-chatbox-button",handler:t=>OA(t,e.model),i18n_text:Gy("Minimize"),i18n_title:Gy("Minimize this groupchat"),icon_class:"fa-minus",name:"minimize",standalone:"overlayed"===nd.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=>OA(t,e.model),i18n_text:Gy("Minimize"),i18n_title:Gy("Minimize this chat"),icon_class:"fa-minus",name:"minimize",standalone:"overlayed"===nd.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=vh((()=>nd.minimize.trimChats()),250);Ih.listen.on("registeredGlobalEventHandlers",(()=>window.addEventListener("resize",t))),Ih.listen.on("unregisteredGlobalEventHandlers",(()=>window.removeEventListener("resize",t)))}});var zA=n(3243),LA=n.n(zA);const{Strophe:PA}=Oh.env,FA="Notification"in window;let UA;function BA(e){return nd.isTestEnv()||(nd.chatboxes.get(e.from)?.isHidden()??!1)}function qA(){return nd.isTestEnv()||FA&&Ih.settings.get("show_desktop_notifications")&&"granted"===Notification.permission}function HA(){UA=null,navigator.clearAppBadge?.().catch((e=>Il.error("Could not clear unread count in app badge "+e)))}function GA(){if(Ih.settings.get("show_tab_notifications")){UA=UA??new Oh.env.Favico({type:"circle",animation:"pop"});const e=nd.chatboxes.models.reduce(((e,t)=>e+(t.get("num_unread")||0)),0);UA.badge(e),navigator.setAppBadge?.(e).catch((e=>Il.error("Could set unread count in app badge - "+e)))}}function WA(e,t,n){return e.reduce(((e,s)=>e||(e=>[nd.bare_jid,`${t}/${n}`].includes(e.uri.replace(/^xmpp:/,"")))(s)),!1)}function VA(e){const{attrs:t}=e;if(!t||t.is_forwarded)return!1;if("groupchat"===t.type)return async function(e){if(!e?.body&&!e?.message)return!1;const t=e.from,n=e.from_muc,s=Ih.settings.get("notify_all_room_messages"),i=nd.chatboxes.get(n),r=PA.getResourceFromJid(t),o=r&&PA.unescapeNode(r)||"";let a=!1;const c=i.get("nick");Ih.settings.get("notify_nicknames_without_references")&&(a=new RegExp(`\\b${c}\\b`).test(e.bod
2022-12-17 22:08:36 +01:00
<form class="converse-form set-xmpp-status" id="set-xmpp-status" @submit=${t=>e.onFormSubmitted(t)}>
<div class="form-group">
<div class="custom-control custom-radio">
<input ?checked=${"online"===a}
type="radio" id="radio-online" value="online" name="chat_status" class="custom-control-input"/>
<label class="custom-control-label" for="radio-online">
<converse-icon size="1em" class="fa fa-circle chat-status chat-status--online"></converse-icon>${s}</label>
</div>
<div class="custom-control custom-radio">
<input ?checked=${"busy"===a}
type="radio" id="radio-busy" value="dnd" name="chat_status" class="custom-control-input"/>
<label class="custom-control-label" for="radio-busy">
<converse-icon size="1em" class="fa fa-minus-circle chat-status chat-status--busy"></converse-icon>${n}</label>
</div>
<div class="custom-control custom-radio">
<input ?checked=${"away"===a}
type="radio" id="radio-away" value="away" name="chat_status" class="custom-control-input"/>
<label class="custom-control-label" for="radio-away">
<converse-icon size="1em" class="fa fa-circle chat-status chat-status--away"></converse-icon>${t}</label>
</div>
<div class="custom-control custom-radio">
<input ?checked=${"xa"===a}
type="radio" id="radio-xa" value="xa" name="chat_status" class="custom-control-input"/>
<label class="custom-control-label" for="radio-xa">
<converse-icon size="1em" class="far fa-circle chat-status chat-status--xa"></converse-icon>${r}</label>
</div>
</div>
<div class="form-group">
<div class="btn-group w-100">
<input name="status_message" type="text" class="form-control" autofocus
value="${c||""}" placeholder="${o}"/>
<converse-icon size="1em" class="fa fa-times clear-input ${c?"":"hidden"}" @click=${t=>e.clearStatusMessage(t)}></converse-icon>
</div>
</div>
<button type="submit" class="btn btn-primary">${i}</button>
2023-02-17 12:24:37 +01:00
</form>`})(this)}getModalTitle(){return Gy("Change chat status")}clearStatusMessage(e){e&&e.preventDefault&&(e.preventDefault(),XA.hideElement(this.querySelector(".clear-input")));this.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()}}nd.ChatStatusModal=eC,Ih.elements.define("converse-chat-status-modal",eC);const tC=Gy("Your profile picture");Ih.elements.define("converse-image-picker",class extends Vy{static get properties(){return{height:{type:Number},data:{type:Object},width:{type:Number}}}render(){return Gu`
<a class="change-avatar" @click=${this.openFileSelection} title="${tC}">
2022-12-17 22:08:36 +01:00
<converse-avatar class="avatar" .data=${this.data} height="${this.height}" width="${this.width}"></converse-avatar>
</a>
<input @change=${this.updateFilePreview} class="hidden" name="image" type="file"/>
2023-02-17 12:24:37 +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)}});const nC=e=>{const t={...e.model.toJSON(),...e.model.vcard.toJSON()},n=Gy("Email"),s=Gy("Full Name"),i=Gy("XMPP Address"),r=Gy("Nickname"),o=Gy("Role"),a=Gy("Save and close"),c=Gy("Use commas to separate multiple roles. Your roles are shown next to your name on your chat messages."),l=Gy("URL"),d=Gy("OMEMO"),u=Gy("Profile"),h=Gy("Reset Password"),m=[Gu`<li role="presentation" class="nav-item">
2022-12-17 22:08:36 +01:00
<a class="nav-link ${"profile"===e.tab?"active":""}"
id="profile-tab"
href="#profile-tabpanel"
2023-01-07 22:34:35 +01:00
aria-controls="profile-tabpanel"
role="tab"
2022-12-17 22:08:36 +01:00
@click=${t=>e.switchTab(t)}
data-name="profile"
2023-01-07 22:34:35 +01:00
data-toggle="tab">${u}</a>
2023-02-17 12:24:37 +01:00
</li>`];return m.push(Gu`<li role="presentation" class="nav-item">
2023-01-07 22:34:35 +01:00
<a class="nav-link ${"passwordreset"===e.tab?"active":""}"
id="passwordreset-tab"
href="#passwordreset-tabpanel"
aria-controls="passwordreset-tabpanel"
role="tab"
@click=${t=>e.switchTab(t)}
data-name="passwordreset"
data-toggle="tab">${h}</a>
2023-02-17 12:24:37 +01:00
</li>`),nd.pluggable.plugins["converse-omemo"]?.enabled(nd)&&m.push(Gu`<li role="presentation" class="nav-item">
2023-01-07 22:34:35 +01:00
<a class="nav-link ${"omemo"===e.tab?"active":""}"
id="omemo-tab"
href="#omemo-tabpanel"
aria-controls="omemo-tabpanel"
role="tab"
@click=${t=>e.switchTab(t)}
data-name="omemo"
data-toggle="tab">${d}</a>
2023-02-17 12:24:37 +01:00
</li>`),Gu`
2023-01-07 22:34:35 +01:00
<ul class="nav nav-pills justify-content-center">${m}</ul>
2022-12-17 22:08:36 +01:00
<div class="tab-content">
<div class="tab-pane ${"profile"===e.tab?"active":""}" id="profile-tabpanel" role="tabpanel" aria-labelledby="profile-tab">
<form class="converse-form converse-form--modal profile-form" action="#" @submit=${t=>e.onFormSubmitted(t)}>
<div class="row">
<div class="col-auto">
2023-01-07 22:34:35 +01:00
<converse-image-picker .data="${{image:t.image,image_type:t.image_type}}" width="128" height="128"></converse-image-picker>
2022-12-17 22:08:36 +01:00
</div>
<div class="col">
<div class="form-group">
2023-01-07 22:34:35 +01:00
<label class="col-form-label">${i}:</label>
<div>${t.jid}</div>
2022-12-17 22:08:36 +01:00
</div>
</div>
</div>
<div class="form-group">
2023-01-07 22:34:35 +01:00
<label for="vcard-fullname" class="col-form-label">${s}:</label>
<input id="vcard-fullname" type="text" class="form-control" name="fn" value="${t.fullname||""}"/>
2022-12-17 22:08:36 +01:00
</div>
<div class="form-group">
2023-01-07 22:34:35 +01:00
<label for="vcard-nickname" class="col-form-label">${r}:</label>
<input id="vcard-nickname" type="text" class="form-control" name="nickname" value="${t.nickname||""}"/>
2022-12-17 22:08:36 +01:00
</div>
<div class="form-group">
2023-01-07 22:34:35 +01:00
<label for="vcard-url" class="col-form-label">${l}:</label>
<input id="vcard-url" type="url" class="form-control" name="url" value="${t.url||""}"/>
2022-12-17 22:08:36 +01:00
</div>
<div class="form-group">
2023-01-07 22:34:35 +01:00
<label for="vcard-email" class="col-form-label">${n}:</label>
<input id="vcard-email" type="email" class="form-control" name="email" value="${t.email||""}"/>
2022-12-17 22:08:36 +01:00
</div>
<div class="form-group">
2023-01-07 22:34:35 +01:00
<label for="vcard-role" class="col-form-label">${o}:</label>
<input id="vcard-role" type="text" class="form-control" name="role" value="${t.role||""}" aria-describedby="vcard-role-help"/>
<small id="vcard-role-help" class="form-text text-muted">${c}</small>
2022-12-17 22:08:36 +01:00
</div>
<hr/>
<div class="form-group">
2023-01-07 22:34:35 +01:00
<button type="submit" class="save-form btn btn-primary">${a}</button>
2022-12-17 22:08:36 +01:00
</div>
</form>
</div>
2023-01-07 22:34:35 +01:00
<div class="tab-pane ${"passwordreset"===e.tab?"active":""}" id="passwordreset-tabpanel" role="tabpanel" aria-labelledby="passwordreset-tab">
2023-02-17 12:24:37 +01:00
${"passwordreset"===e.tab?Gu`<converse-change-password-form></converse-change-password-form>`:""}
2023-01-07 22:34:35 +01:00
</div>
2023-02-17 12:24:37 +01:00
${nd.pluggable.plugins["converse-omemo"]?.enabled(nd)?(e=>Gu`
2022-12-17 22:08:36 +01:00
<div class="tab-pane ${"omemo"===e.tab?"active":""}" id="omemo-tabpanel" role="tabpanel" aria-labelledby="omemo-tab">
2023-02-17 12:24:37 +01:00
${"omemo"===e.tab?Gu`<converse-omemo-profile></converse-omemo-profile>`:""}
2022-12-17 22:08:36 +01:00
</div>`)(e):""}
</div>
2023-02-17 12:24:37 +01:00
</div>`};var sC=n(4923),iC=n.n(sC);const{Strophe:rC,$iq:oC,sizzle:aC,u:cC}=Oh.env;Ih.elements.define("converse-change-password-form",class extends Vy{static get properties(){return{passwords_mismatched:{type:Boolean},alert_message:{type:String}}}initialize(){this.passwords_mismatched=!1,this.alert_message=""}render(){return(e=>{const t=Gy("Submit"),n=Gy("The new passwords must match"),s=Gy("New password"),i=Gy("Confirm new password");return Gu`<form class="converse-form passwordreset-form" method="POST" @submit=${t=>e.onSubmit(t)}>
${e.alert_message?Gu`<div class="alert alert-danger" role="alert">${e.alert_message}</div>`:""}
2023-01-07 22:34:35 +01:00
<div class="form-group">
<label for="converse_password_reset_new">${s}</label>
<input
class="form-control ${e.passwords_mismatched?"error":""}"
type="password"
value=""
name="password"
required="required"
id="converse_password_reset_new"
autocomplete="new-password"
minlength="8"
?disabled="${e.alert_message}"
/>
</div>
<div class="form-group">
<label for="converse_password_reset_check">${i}</label>
<input
class="form-control ${e.passwords_mismatched?"error":""}"
type="password"
value=""
name="password_check"
required="required"
id="converse_password_reset_check"
autocomplete="new-password"
minlength="8"
?disabled="${e.alert_message}"
@input=${t=>e.checkPasswordsMatch(t)}
/>
2023-02-17 12:24:37 +01:00
${e.passwords_mismatched?Gu`<span class="error">${n}</span>`:""}
2023-01-07 22:34:35 +01:00
</div>
<input class="save-form btn btn-primary"
type="submit"
value=${t}
?disabled="${e.alert_message}" />
2023-02-17 12:24:37 +01:00
</form>`})(this)}checkPasswordsMatch(e){const t=new FormData(e.target.form??e.target),n=t.get("password"),s=t.get("password_check");return this.passwords_mismatched=n&&n!==s,this.passwords_mismatched}async onSubmit(e){if(e.preventDefault(),this.checkPasswordsMatch(e))return;const t=oC({type:"get",to:nd.domain}).c("query",{xmlns:rC.NS.REGISTER}),n=await Ih.sendIQ(t);if(null===n)return void(this.alert_message=Gy("Timeout error"));if(aC(`error service-unavailable[xmlns="${rC.NS.STANZAS}"]`,n).length)return void(this.alert_message=Gy("Your server does not support in-band password reset"));if(cC.isErrorStanza(n))return this.alert_message=Gy("Your server responded with an unknown error, check the console for details"),Il.error("Could not set password"),void Il.error(n);const s=n.querySelector("username").textContent,i=new FormData(e.target).get("password"),r=oC({type:"set",to:nd.domain}).c("query",{xmlns:rC.NS.REGISTER}).c("username",{},s).c("password",{},i),o=await Ih.sendIQ(r);null===o?this.alert_message=Gy("Timeout error while trying to set your password"):aC(`error not-allowed[xmlns="${rC.NS.STANZAS}"]`,o).length?this.alert_message=Gy("Your server does not allow in-band password reset"):aC(`error forbidden[xmlns="${rC.NS.STANZAS}"]`,o).length||cC.isErrorStanza(o)?this.alert_message=Gy("You are not allowed to change your password"):Ih.alert("info",Gy("Success"),[Gy("Your new password has been set")])}});const lC=new(iC())({targetSize:.1,quality:.75,maxWidth:256,maxHeight:256});Ih.elements.define("converse-profile-modal",class extends $_{constructor(e){super(e),this.tab="profile"}initialize(){super.initialize(),this.listenTo(this.model,"change",this.render),Ih.trigger("profileModalInitialized",this.model)}renderModal(){return nC(this)}getModalTitle(){return Gy("Your Profile")}async setVCard(e){try{await Ih.vcard.set(nd.bare_jid,e)}catch(e){return Il.fatal(e),void this.alert([Gy("Sorry, an error happened while trying to save your profile data."),Gy("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];lC.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)}});const dC=e=>{const t=Gy("%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">'),n=Gy("%1$s Translate %2$s it into your own language",'<a target="_blank" rel="nofollow" href="https://hosted.weblate.org/projects/conversejs/#languages">',"</a>"),s=Ih.settings.get("show_client_info"),i=Ih.settings.get("allow_adhoc_commands");return Gu`
${s&&i?(e=>{const t=Gy("About"),n=Gy("Commands");return Gu`
2022-12-17 22:08:36 +01:00
<ul class="nav nav-pills justify-content-center">
<li role="presentation" class="nav-item">
<a class="nav-link ${"about"===e.tab?"active":""}"
id="about-tab"
href="#about-tabpanel"
aria-controls="about-tabpanel"
role="tab"
data-toggle="tab"
data-name="about"
@click=${t=>e.switchTab(t)}>${t}</a>
</li>
<li role="presentation" class="nav-item">
<a class="nav-link ${"commands"===e.tab?"active":""}"
id="commands-tab"
href="#commands-tabpanel"
aria-controls="commands-tabpanel"
role="tab"
data-toggle="tab"
data-name="commands"
@click=${t=>e.switchTab(t)}>${n}</a>
</li>
</ul>
`})(e):""}
<div class="tab-content">
2023-02-17 12:24:37 +01:00
${s?Gu`
2022-12-17 22:08:36 +01:00
<div class="tab-pane tab-pane--columns ${"about"===e.tab?"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>
2023-02-17 12:24:37 +01:00
<p class="brand-subtitle">${nd.VERSION_NAME}</p>
<p class="brand-subtitle">${$x(zo().sanitize(t))}</p>
<p class="brand-subtitle">${$x(zo().sanitize(n))}</p>
2022-12-17 22:08:36 +01:00
</div>
</div>`:""}
2023-02-17 12:24:37 +01:00
${i?Gu`
2022-12-17 22:08:36 +01:00
<div class="tab-pane tab-pane--columns ${"commands"===e.tab?"active":""}"
id="commands-tabpanel"
role="tabpanel"
aria-labelledby="commands-tab">
<converse-adhoc-commands/>
</div> `:""}
</div>
2023-02-17 12:24:37 +01:00
`};Ih.elements.define("converse-user-settings-modal",class extends $_{constructor(e){super(e);const t=Ih.settings.get("show_client_info"),n=Ih.settings.get("allow_adhoc_commands");t&&n||t?this.tab="about":n&&(this.tab="commands")}renderModal(){return dC(this)}getModalTitle(){return Gy("Settings")}});const{Strophe:uC,$iq:hC,sizzle:mC,u:gC}=Oh.env;async function fC(e){e?.preventDefault();await Ih.confirm(Gy("Are you sure you want to log out?"))&&Ih.user.logout()}function pC(){const e=Gy("Log out");return Gu`<a class="controlbox-heading__btn logout align-self-center" title="${e}" @click=${fC}>
2022-12-17 22:08:36 +01:00
<converse-icon class="fa fa-sign-out-alt" size="1em"></converse-icon>
2023-02-17 12:24:37 +01:00
</a>`}const vC=e=>{const t=e.model.get("status")||"offline",n=e.model.vcard?.get("fullname")||e.model.vcard?.get("nickname")||nd.bare_jid,s=e.model.get("status_message")||Gy("I am %1$s","chat"===(i=t)?Gy("online"):"dnd"===i?Gy("busy"):"xa"===i?Gy("away for long"):"away"===i?Gy("away"):"offline"===i?Gy("offline"):Gy(i)||Gy("online"));var i;const r=Gy("Click to change your chat status"),o=Ih.settings.get("show_client_info")||Ih.settings.get("allow_adhoc_commands");let a,c;return[a,c]="online"===t?["fa fa-circle chat-status","chat-status-online"]:"dnd"===t?["fa fa-minus-circle chat-status","chat-status-busy"]:"away"===t?["fa fa-circle chat-status","chat-status-away"]:["fa fa-circle chat-status","subdued-color"],Gu`
2022-12-17 22:08:36 +01:00
<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"
2023-01-07 22:34:35 +01:00
.data=${e.model.vcard?.attributes}
nonce=${e.model.vcard?.get("vcard_updated")}
2022-12-17 22:08:36 +01:00
height="40" width="40"></converse-avatar>
</a>
2023-01-07 22:34:35 +01:00
<span class="username w-100 align-self-center">${n}</span>
2023-02-17 12:24:37 +01:00
${o?function(e){const t=Gy("Show details about this chat client");return Gu`<a class="controlbox-heading__btn show-client-info align-self-center" title="${t}" @click=${e.showUserSettingsModal}>
2022-12-17 22:08:36 +01:00
<converse-icon class="fa fa-cog" size="1em"></converse-icon>
</a>`}(e):""}
2023-02-17 12:24:37 +01:00
${Ih.settings.get("allow_logout")?pC():""}
2022-12-17 22:08:36 +01:00
</div>
<div class="d-flex xmpp-status">
2023-01-07 22:34:35 +01:00
<a class="change-status" title="${r}" data-toggle="modal" data-target="#changeStatusModal" @click=${e.showStatusChangeModal}>
<span class="${t} w-100 align-self-center" data-value="${t}">
<converse-icon color="var(--${c})" style="margin-top: -0.1em" size="0.82em" class="${a}"></converse-icon> ${s}</span>
2022-12-17 22:08:36 +01:00
</a>
</div>
2023-02-17 12:24:37 +01:00
</div>`};Ih.elements.define("converse-user-profile",class extends Vy{initialize(){this.model=nd.xmppstatus,this.listenTo(this.model,"change",(()=>this.requestUpdate())),this.listenTo(this.model,"vcard:add",(()=>this.requestUpdate())),this.listenTo(this.model,"vcard:change",(()=>this.requestUpdate()))}render(){return vC(this)}showProfileModal(e){e?.preventDefault(),Ih.modal.show("converse-profile-modal",{model:this.model},e)}showStatusChangeModal(e){e?.preventDefault(),Ih.modal.show("converse-chat-status-modal",{model:this.model},e)}showUserSettingsModal(e){e?.preventDefault(),Ih.modal.show("converse-user-settings-modal",{model:this.model,_converse:nd},e)}}),Oh.plugins.add("converse-profile",{dependencies:["converse-status","converse-modal","converse-vcard","converse-chatboxviews","converse-adhoc-views"],initialize(){Ih.settings.extend({show_client_info:!0})}});const yC=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 Ns(X(n)?Es(n):[n],So(t,1))},_C=-1,bC=128,wC={name:"AES-GCM",length:128},SC={aac:"audio/aac",abw:"application/x-abiword",arc:"application/x-freearc",avi:"video/x-msvideo",azw:"application/vnd.amazon.ebook",bin:"application/octet-stream",bmp:"image/bmp",bz:"application/x-bzip",bz2:"application/x-bzip2",cda:"application/x-cdf",csh:"application/x-csh",css:"text/css",csv:"text/csv",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",eot:"application/vnd.ms-fontobject",epub:"application/epub+zip",gif:"image/gif",gz:"application/gzip",htm:"text/html",html:"text/html",ico:"image/vnd.microsoft.icon",ics:"text/calendar",jar:"application/java-archive",jpeg:"image/jpeg",jpg:"image/jpeg",js:"text/javascript",json:"application/json",jsonld:"application/ld+json",m4a:"audio/mp4",mid:"audio/midi",midi:"audio/midi",mjs:"text/javascript",mp3:"audio/mpeg",mp4:"video/mp4",mpeg:"video/mpeg",mpkg:"application/vnd.apple.installer+xml",odp:"application/vnd.oasis.opendocument.presentation",ods:"application/vnd.oasis.opendocument.spreadsheet",odt:"application/vnd.oasis.opendocument.text",oga:"audio/ogg",ogv:"video/ogg",ogx:"application/ogg",opus:"audio/opus",otf:"font/otf",png:"image/png",pdf:"application/pdf",php:"application/x-httpd-php",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",rar:"application/vnd.rar",rtf:"application/rtf",sh:"application/x-sh",svg:"image/svg+xml",swf:"application/x-shockwave-flash",tar:"application/x-tar",tif:"image/tiff",tiff:"image/tiff",ts:"video/mp2t",ttf:"font/ttf",txt:"text/plain",vsd:"application/vnd.visio",wav:"audio/wav",weba:"audio/webm",webm:"video/webm",webp:"image/webp",woff:"font/woff",woff2:"font/woff2",xhtml:"application/xhtml+xml",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xml:"text/xml",xul:"application/vnd.mozilla.xul+xml",zip:"application/zip","3gp":"video/3gpp","3g2":"video/3gpp2","7z":"application/x-7z-compressed"},{Strophe:xC,URI:EC,sizzle:AC,u:CC}=Oh.env;function $C(e){e=e.replace(/^05/,"");for(let t=1;t<8;t++){const n=8*t+t-1;e=e.slice(0,n)+" "+e.slice(n)}return e}function kC(e,t){return e.get("omemo_active")&&t.body&&(t.is_encrypted=!0,t.plaintext=t.body,t.body=Gy("This is an OMEMO encrypted message which your client doesnt seem to support. Find more information on https://conversations.im/omemo")),t}async function jC(e){const t="localhost"===window.location.hostname&&"localhost"===e.domain()?"http":"https",n=e.toString().replace(/^aesgcm/,t),s=await async function(e){let t;try{t=await fetch(e)}catch(t){return Il.error(`${t.name}: Failed to download encrypted media: ${e}`),Il.error(t),null}if(t.status>=200&&t.status<400)return t.arrayBuffer()}(n);if(null===s)return Il.error(`Could not decrypt a received encrypted file ${e.toString()} since it could not be downloaded`),new Error(Gy("Error: could not decrypt a received encrypted file, because it could not be downloaded"));const i=e.hash().slice(1),r=i.substring(i.length-6
<button class="toggle-omemo" title="${i}" data-disabled=${!n.get("omemo_supported")} @click=${VC}>
2022-01-03 11:54:10 +01:00
<converse-icon
class="fa ${n.get("omemo_active")?"fa-lock":"fa-unlock"}"
2023-02-17 12:24:37 +01:00
path-prefix="${Ih.settings.get("assets_path")}"
2022-01-03 11:54:10 +01:00
size="1em"
2022-12-17 22:08:36 +01:00
color="${r}"
2022-01-03 11:54:10 +01:00
></converse-icon>
</button>
2023-02-17 12:24:37 +01:00
`),t}async function ZC(e,t){let{stanza:n}=t;const{message:s}=t;if(!s.get("is_encrypted"))return t;if(!s.get("body"))throw new Error("No message body to encrypt!");const i=await async function(e){const t=Gy("Sorry, no devices found to which we can send an OMEMO encrypted message.");let n;if(e.get("type")===nd.CHATROOMS_TYPE){const t=await Promise.all(e.occupants.map((e=>UC(e.get("jid")))));n=t.reduce(((e,t)=>yC(e,t.models)),[])}else if(e.get("type")===nd.PRIVATE_CHAT_TYPE){const s=await UC(e.get("jid"));if(0===s.length){const e=new Error(t);throw e.user_facing=!0,e}const i=(await Ih.omemo.devicelists.get(nd.bare_jid)).devices;n=[...i.models,...s.models]}const s=nd.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=>BC(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}(e);n.c("encrypted",{xmlns:xC.NS.OMEMO}).c("header",{sid:nd.omemo_store.get("device_id")});const{key_and_tag:r,iv:o,payload:a}=await QC.encryptMessage(s.get("plaintext")),c=await Promise.all(i.filter((e=>e.get("trusted")!=_C&&e.get("active"))).map((e=>function(e,t){return RC(t.get("jid"),t.get("id")).encrypt(e).then((e=>({payload:e,device:t})))}(r,e))));return n=await 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("key",{rid:r.get("id")}).t(btoa(i.body)),o&&e.attrs({prekey:o}),e.up(),s==t.length-1&&e.c("iv").t(n).up().up()}return Promise.resolve(e)}(n,c,o),n.c("payload").t(a).up().up(),n.c("store",{xmlns:xC.NS.HINTS}).up(),n.c("encryption",{xmlns:xC.NS.EME,namespace:xC.NS.OMEMO}),{message:s,stanza:n}}const QC={decryptMessage:async function(e){const t=await crypto.subtle.importKey("raw",e.key,wC,!0,["encrypt","decrypt"]),n=Bf(Vf(e.payload),e.tag),s={name:"AES-GCM",iv:Vf(e.iv),tagLength:bC};return Hf(await crypto.subtle.decrypt(s,t,n))},encryptMessage:async function(e){const t=crypto.getRandomValues(new window.Uint8Array(12)),n=await crypto.subtle.generateKey(wC,!0,["encrypt","decrypt"]),s={name:"AES-GCM",iv:t,tagLength:bC},i=await crypto.subtle.encrypt(s,n,Gf(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:Bf(c,a),payload:Wf(o),iv:Wf(t)}},formatFingerprint:$C},YC=e=>{const t=Gy("OMEMO Fingerprints"),n=Gy("No OMEMO-enabled devices found"),s=e.devicelist.devices;return Gu`
2022-01-03 11:54:10 +01:00
<hr/>
<ul class="list-group fingerprints">
<li class="list-group-item active">${t}</li>
2023-02-17 12:24:37 +01:00
${s.length?s.map((t=>((e,t)=>{const n=Gy("Trusted"),s=Gy("Untrusted");return t.get("bundle")&&t.get("bundle").fingerprint?Gu`
2022-01-03 11:54:10 +01:00
<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"
2022-05-05 23:06:17 +02:00
?checked=${-1===t.get("trusted")}>${s}
2022-01-03 11:54:10 +01:00
</label>
</div>
2023-02-17 12:24:37 +01:00
<code class="fingerprint">${$C(t.get("bundle").fingerprint)}</code>
2022-01-03 11:54:10 +01:00
</form>
</li>
2023-02-17 12:24:37 +01:00
`:""})(e,t))):Gu`<li class="list-group-item"> ${n} </li>`}
2022-01-03 11:54:10 +01:00
</ul>
2023-02-17 12:24:37 +01:00
`};Ih.elements.define("converse-omemo-fingerprints",class extends Vy{static get properties(){return{jid:{type:String}}}async initialize(){this.devicelist=await Ih.omemo.devicelists.get(this.jid,!0),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?YC(this):""}toggleDeviceTrust(e){const t=e.target;this.devicelist.devices.get(t.getAttribute("name")).save("trusted",parseInt(t.value,10))}});const KC=e=>Gu`
${e.device.get("bundle")&&e.device.get("bundle").fingerprint?(e=>{const t=Gy("Checkbox for selecting the following fingerprint");return Gu`
2022-12-17 22:08:36 +01:00
<li class="fingerprint-removal-item list-group-item">
2022-01-03 11:54:10 +01:00
<label>
<input type="checkbox" value="${e.device.get("id")}"
aria-label="${t}"/>
2023-02-17 12:24:37 +01:00
<span class="fingerprint">${$C(e.device.get("bundle").fingerprint)}</span>
2022-01-03 11:54:10 +01:00
</label>
</li>
2023-02-17 12:24:37 +01:00
`})(e):(e=>{const t=Gy("Device without a fingerprint"),n=Gy("Checkbox for selecting the following device");return Gu`
2022-12-17 22:08:36 +01:00
<li class="fingerprint-removal-item list-group-item">
2022-01-03 11:54:10 +01:00
<label>
<input type="checkbox" value="${e.device.get("id")}"
aria-label="${n}"/>
<span>${t}</span>
</label>
</li>
`})(e)}
2023-02-17 12:24:37 +01:00
`,XC=e=>{const t=Gy("This device's OMEMO fingerprint"),n=Gy("Generate new keys and fingerprint");return Gu`
2022-05-05 23:06:17 +02:00
<form class="converse-form fingerprint-removal" @submit=${e.removeSelectedFingerprints}>
<ul class="list-group fingerprints">
2023-01-07 22:34:35 +01:00
<li class="list-group-item active">${t}</li>
2022-05-05 23:06:17 +02:00
<li class="list-group-item">
2023-02-17 12:24:37 +01:00
${e.current_device&&e.current_device.get("bundle")&&e.current_device.get("bundle").fingerprint?(e=>Gu`
<span class="fingerprint">${$C(e.current_device.get("bundle").fingerprint)}</span>`)(e):J_()}
2022-05-05 23:06:17 +02:00
</li>
</ul>
<div class="form-group">
2023-01-07 22:34:35 +01:00
<button type="button" class="generate-bundle btn btn-danger" @click=${e.generateOMEMODeviceBundle}>${n}</button>
2022-05-05 23:06:17 +02:00
</div>
2023-02-17 12:24:37 +01:00
${e.other_devices?.length?(e=>{const t=Gy("Other OMEMO-enabled devices"),n=Gy("Checkbox to select fingerprints of all other OMEMO devices"),s=Gy("Remove checked devices and close"),i=Gy("Select all");return Gu`
2022-05-05 23:06:17 +02:00
<ul class="list-group fingerprints">
2022-12-17 22:08:36 +01:00
<li class="list-group-item active">
2022-05-05 23:06:17 +02:00
<label>
2023-01-07 22:34:35 +01:00
<input type="checkbox" class="select-all" @change=${e.selectAll} title="${i}" aria-label="${n}"/>
${t}
2022-05-05 23:06:17 +02:00
</label>
</li>
2023-02-17 12:24:37 +01:00
${e.other_devices?.map((t=>KC(Object.assign({device:t},e))))}
2022-01-03 11:54:10 +01:00
</ul>
2023-01-07 22:34:35 +01:00
<div class="form-group"><button type="submit" class="save-form btn btn-primary">${s}</button></div>
2022-01-03 11:54:10 +01:00
`})(e):""}
2023-02-17 12:24:37 +01:00
</form>`},{Strophe:e$,sizzle:t$,u:n$}=Oh.env;Ih.elements.define("converse-omemo-profile",class extends Vy{async initialize(){this.devicelist=await Ih.omemo.devicelists.get(nd.bare_jid,!0),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 Ih.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?XC(this):J_()}selectAll(e){let t=n$.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=t$('.fingerprint-removal-item input[type="checkbox"]:checked',e.target).map((e=>e.value));try{await this.devicelist.removeOwnDevices(t)}catch(e){Il.error(e),nd.api.alert(e$.LogLevel.ERROR,Gy("Error"),[Gy("Sorry, an error occurred while trying to remove the devices.")])}await this.setAttributes(),this.requestUpdate()}async generateOMEMODeviceBundle(e){e.preventDefault();await Ih.confirm(Gy("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 Ih.omemo.bundle.generate(),await this.setAttributes(),this.requestUpdate())}});const s$={async generateFingerprints(e){const t=await UC(e);return Promise.all(t.map((e=>FC(e))))},getDeviceForContact:(e,t)=>UC(e).then((e=>e.get(t))),contactHasOMEMOSupport:async e=>(await UC(e)).length>0},i$=s$;class r$ extends Error{constructor(e,t){super(e,t),this.name="IQError",this.iq=t}}const{Strophe:o$,sizzle:a$,$iq:c$}=Oh.env,l$=No.extend({defaults:{trusted:0,active:!0},getRandomPreKey(){const e=this.get("bundle");return e.prekeys[wl(e.prekeys.length)]},async fetchBundleFromServer(){const e=c$({type:"get",from:nd.bare_jid,to:this.get("jid")}).c("pubsub",{xmlns:o$.NS.PUBSUB}).c("items",{node:`${o$.NS.OMEMO_BUNDLES}:${this.get("id")}`});let t;try{t=await Ih.sendIQ(e)}catch(t){return Il.error(`Could not fetch bundle for device ${this.get("id")} from ${this.get("jid")}`),Il.error(t),null}if(t.querySelector("error"))throw new r$("Could not fetch bundle",t);const n=a$(`items[node="${o$.NS.OMEMO_BUNDLES}:${this.get("id")}"]`,t).pop(),s=PC(a$(`bundle[xmlns="${o$.NS.OMEMO}"]`,n).pop());return this.save("bundle",s),s},getBundle(){return this.get("bundle")?Promise.resolve(this.get("bundle"),this):this.fetchBundleFromServer()}}),{Strophe:d$,$build:u$,$iq:h$,sizzle:m$}=Oh.env,g$=No.extend({idAttribute:"jid",async initialize(){this.initialized=ea(),await this.initDevices(),this.initialized.resolve()},initDevices(){this.devices=new nd.Devices;const e=`converse.devicelist-${nd.bare_jid}-${this.get("jid")}`;return Xc(this.devices,e),this.fetchDevices()},async onDevicesFound(e){if(0===e.length){let e=[];try{e=await this.fetchDevicesFromServer()}catch(e){null===e?Il.error(`Timeout error while fetching devices for ${this.get("jid")}`):(Il.error(`Could not fetch devices for ${this.get("jid")}`),Il.error(e)),this.destroy()}this.get("jid")===nd.bare_jid&&this.publishCurrentDevice(e)}},fetchDevices(){return void 0===this._devices_promise&&(this._devices_promise=new Promise((e=>{this.devices.fetch({success:t=>e(this.onDevicesFound(t)),error:(t,n)=>{Il.error(n),e()}})}))),this._devices_promise},async getOwnDeviceId(){let e=nd.omemo_store.get("device_id");return this.devices.get(e)||(await nd.omemo_store.generateBundle(),e=nd.omemo_store.get("device_id")),e},async publishCurrentDevice(e){if(this.get("jid")===nd.bare_jid){if(await HC(),nd.omemo_store)return e.include
<div class="switch-form">
<p>${e}</p>
<p><a class="login-here toggle-register-login" href="#converse/login">${t}</a></p>
</div>`},R$=e=>{const t=Ih.settings.get("registration_domain"),n=Gy("Create your account"),s=Gy("Please enter the XMPP provider to register with:"),i=!t&&e.status===D$;return Gu`
<form id="converse-register" class="converse-form" @submit=${t=>e.onFormSubmission(t)}>
<legend class="col-form-label">${n}</legend>
2021-11-11 22:06:49 +01:00
<div class="form-group">
2023-02-17 12:24:37 +01:00
<label>${s}</label>
${t||(()=>{const e=Ih.settings.get("domain_placeholder"),t=Gy("Tip: A list of public XMPP providers is available"),n=Gy("here"),s=Ih.settings.get("providers_link");return Gu`
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}
2022-05-05 23:06:17 +02:00
<a href="${s}" class="url" target="_blank" rel="noopener">${n}</a>.
2021-11-11 22:06:49 +01:00
</p>
`})()}
2021-03-19 19:26:15 +01:00
</div>
2023-02-17 12:24:37 +01:00
${i?(()=>{const e=Gy("Fetch registration form"),t=Gy("Already have a chat account?"),n=Gy("Log in here");return Gu`
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>
2023-02-17 12:24:37 +01:00
`})():""}
2021-11-11 22:06:49 +01:00
</form>
2023-02-17 12:24:37 +01:00
`},D$=0,z$=e=>Gu`
2022-05-05 23:06:17 +02:00
<converse-brand-logo></converse-brand-logo>
2023-02-17 12:24:37 +01:00
${e.alert_message?Gu`<div class="alert alert-${e.alert_type}" role="alert">${e.alert_message}</div>`:""}
${e.status===D$?R$(e):""}
${1===e.status?(e=>{const t=Ih.settings.get("registration_domain"),n=Gy("Cancel");return Gu`
<form id="converse-register" class="converse-form no-scrolling" @submit=${t=>e.onFormSubmission(t)}>
${J_({classes:"hor_centered"})}
${t?"":Gu`
<button class="btn btn-secondary button-cancel hor_centered"
@click=${t=>e.renderProviderChoiceForm(t)}>${n}</button>
2021-11-11 22:06:49 +01:00
`}
</form>
2023-02-17 12:24:37 +01:00
`})(e):""}
${2===e.status?(e=>{const t=Gy("Choose a different provider"),n=Gy("Account Registration:"),s=Gy("Register"),i=Ih.settings.get("registration_domain");return Gu`
<form id="converse-register" class="converse-form" @submit=${t=>e.onFormSubmission(t)}>
<legend class="col-form-label">${n} ${e.domain}</legend>
2021-11-11 22:06:49 +01:00
<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">
2023-02-17 12:24:37 +01:00
${e.fields?Gu`
<input type="submit" class="btn btn-primary" value="${s}" />
2021-11-11 22:06:49 +01:00
`:""}
2023-02-17 12:24:37 +01:00
${i?"":Gu`
2021-11-11 22:06:49 +01:00
<input
type="button"
class="btn btn-secondary button-cancel"
value="${t}"
2023-02-17 12:24:37 +01:00
@click=${t=>e.renderProviderChoiceForm(t)}
2021-11-11 22:06:49 +01:00
/>
`}
2023-02-17 12:24:37 +01:00
${M$()}
2021-11-11 22:06:49 +01:00
</fieldset>
</form>
`})(e):""}
2023-02-17 12:24:37 +01:00
${3===e.status?M$():""}
`;async function L$(e){await Ih.waitUntil("controlBoxInitialized");nd.chatboxes.get("controlbox").set({"active-form":e})}const P$=(e,t)=>`<field var="${e}">${t}</field>`,F$=e=>`<value>${e}</value>`;function U$(e){const t=e.getAttribute("name");if(!t)return null;let n;return n="checkbox"===e.getAttribute("type")?e.checked?1:0:"TEXTAREA"==e.tagName?e.value.split("\n").filter((e=>e.trim())):"SELECT"==e.tagName?kl.getSelectValues(e):e.value,kl.toStanza(P$(t,Array.isArray(n)?n.map(F$):F$(n)))}kl.webForm2xForm=U$;var B$=n(7099),q$={};q$.styleTagTransform=o_(),q$.setAttributes=n_(),q$.insert=e_().bind(null,"head"),q$.domAPI=Ky(),q$.insertStyleElement=i_();Qy()(B$.Z,q$);B$.Z&&B$.Z.locals&&B$.Z.locals;const{Strophe:H$,sizzle:G$,$iq:W$}=Oh.env,V$=Oh.env.utils,J$=1,Z$=2;Ih.elements.define("converse-register-panel",class extends Vy{static get properties(){return{status:{type:String},alert_message:{type:String},alert_type:{type:String}}}constructor(){super(),this.alert_type="info",this.setErrorMessage=e=>this.setMessage(e,"danger"),this.setFeedbackMessage=e=>this.setMessage(e,"info")}initialize(){this.reset(),this.listenTo(nd,"connectionInitialized",(()=>this.registerHooks()));const e=Ih.settings.get("registration_domain");e?this.fetchRegistrationForm(e):this.status=0}render(){return z$(this)}setMessage(e,t){this.alert_type=t,this.alert_message=e}registerHooks(){const e=nd.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)}}getRegistrationFields(e,t){const n=nd.connection;n.connected=!0;const s=n._proto._reqToData(e);if(!s)return;if(n._proto._connect_cb(s)===H$.Status.CONNFAIL)return this.status=0,this.setErrorMessage(Gy("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(H$.Status.REGIFAIL),this.alert_type="danger",this.setErrorMessage(Gy("Sorry, the given provider does not support in band account registration. Please try with a different provider.")),!0;n._addSysHandler((e=>this.onRegistrationFields(e)),null,"iq",null,null);const o=W$({type:"get"}).c("query",{xmlns:H$.NS.REGISTER}).tree();return o.setAttribute("id",n.getUniqueId("sendIQ")),n.send(o),n.connected=!1,!0}onRegistrationFields(e){return"error"===e.getAttribute("type")?(this.reportErrors(e),Ih.settings.get("registration_domain")?this.status=3:this.status=0,!1):(this.setFields(e),this.status===J$&&this.renderRegistrationForm(e),!1)}reset(e){Object.assign(this,{fields:{},urls:[],title:"",instructions:"",registered:!1,_registering:!1,domain:null,form_type:null}),e&&Object.assign(this,e)}onFormSubmission(e){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]")?.value;t&&this.fetchRegistrationForm(t.trim())}fetchRegistrationForm(e){return this.status=J$,this.reset({domain:H$.getDomainFromJid(e),_registering:!0}),Eh(this.domain),nd.connection?.connect(this.domain,"",(e=>this.onConnectStatusChanged(e))),!1}onConnectStatusChanged(e){Il.debug("converse-register: onConnectStatusChanged"),[H$.Status.DISCONNECTED,H$.Status.CONNFAIL,H$.Status.REGIFAIL,H$.Status.NOTACCEPTABLE,H$.Status.CONFLICT].includes(e)?(Il.error(`Problem during registration: Strophe.Status is ${nd.CONNECTION_STATUS[e]}`),this.abortRegistration()):e===H$.Status.REGISTERED&&(Il.debug("Registered successfully."),nd.connection.reset(),["converse/login","converse/register"].includes(nd.router.history.getFragment())&&nd.router.navigate("",{replace:!0}),L$("login"),this.fields.password&&this.fields.username?(nd.connection.connect(this.fields.username.toLowerCase()+"@"+this.domain.toLowerCase(),this.fields.password,nd.onConnectStatusChanged),this.setFeedbackMessage(Gy("Now logging you in"))):this.setFeedbackMessage(Gy("Registered successfully")),this.reset())}getLegacyFo
2022-12-17 22:08:36 +01:00
<form class="converse-form add-chatroom" @submit=${t=>e.openChatRoom(t)}>
<div class="form-group">
<label for="chatroom">${i}:</label>
2023-02-17 12:24:37 +01:00
${r?Gu`<label class="roomid-policy-error">${r}</label>`:""}
2022-12-17 22:08:36 +01:00
<converse-autocomplete
2023-02-17 12:24:37 +01:00
.getAutoCompleteList=${ik}
2022-12-17 22:08:36 +01:00
?autofocus=${!0}
min_chars="3"
position="below"
placeholder="${s}"
class="add-muc-autocomplete"
name="chatroom">
</converse-autocomplete>
2021-11-11 22:06:49 +01:00
</div>
2023-02-17 12:24:37 +01:00
${o?Gu`<div class="form-group">${$x(zo().sanitize(o,{ALLOWED_TAGS:["b","br","em"]}))}</div>`:""}
${Ih.settings.get("locked_muc_nickname")?"":(e=>{const t=Gy("Nickname"),n=Gy("This field is required");return Gu`
2022-12-17 22:08:36 +01:00
<div class="form-group" >
<label for="nickname">${t}:</label>
<input type="text"
title="${n}"
required="required"
name="nickname"
value="${e.model.get("nick")||""}"
class="form-control"/>
</div>
`})(e)}
<input type="submit" class="btn btn-primary" name="join" value="${t||""}" ?disabled=${r}/>
</form>
2023-02-17 12:24:37 +01:00
`};var ok=n(3247),ak={};ak.styleTagTransform=o_(),ak.setAttributes=n_(),ak.insert=e_().bind(null,"head"),ak.domAPI=Ky(),ak.insertStyleElement=i_();Qy()(ok.Z,ak);ok.Z&&ok.Z.locals&&ok.Z.locals;const ck=Oh.env.utils,{Strophe:lk}=Oh.env;Ih.elements.define("converse-add-muc-modal",class extends $_{initialize(){super.initialize(),this.listenTo(this.model,"change:muc_domain",(()=>this.render())),this.muc_roomid_policy_error_msg=null,this.render(),this.addEventListener("shown.bs.modal",(()=>{this.querySelector('input[name="chatroom"]').focus()}),!1)}renderModal(){return rk(this)}getModalTitle(){return Gy("Enter a new Groupchat")}parseRoomDataFromEvent(e){const t=new FormData(e),n=t.get("chatroom")?.trim();let s;if(Ih.settings.get("locked_muc_nickname")){if(s=nd.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){if(e.preventDefault(),this.checkRoomidPolicy())return;const t=this.parseRoomDataFromEvent(e.target);let n;""===t.nick&&(t.nick=void 0),Ih.settings.get("locked_muc_domain")||Ih.settings.get("muc_domain")&&!ck.isValidJID(t.jid)?n=`${lk.escapeNode(t.jid)}@${Ih.settings.get("muc_domain")}`:(n=t.jid,this.model.setDomain(n)),Ih.rooms.open(n,Object.assign(t,{jid:n}),!0),e.target.reset(),this.modal.hide()}checkRoomidPolicy(){if(Ih.settings.get("muc_roomid_policy")&&Ih.settings.get("muc_domain")){let e=this.querySelector("converse-autocomplete input").value;!Ih.settings.get("locked_muc_domain")&&ck.isValidJID(e)||(e=`${lk.escapeNode(e)}@${Ih.settings.get("muc_domain")}`);const t=lk.getNodeFromJid(e),n=lk.getDomainFromJid(e);if(Ih.settings.get("muc_domain")===n&&!Ih.settings.get("muc_roomid_policy").test(t))return this.muc_roomid_policy_error_msg=Gy("Groupchat id is invalid."),!0;this.muc_roomid_policy_error_msg=null,this.render()}}});const dk=function(e){return e&&e.length?e[0]:void 0},uk=e=>{const t=Gy("Description:"),n=Gy("Groupchat XMPP Address:"),s=Gy("Participants:"),i=Gy("Features:"),r=Gy("Requires authentication"),o=Gy("Hidden"),a=Gy("Requires an invitation"),c=Gy("Moderated"),l=Gy("Non-anonymous"),d=Gy("Open"),u=Gy("Permanent"),h=Gy("Public"),m=Gy("Semi-anonymous"),g=Gy("Temporary"),f=Gy("Unmoderated");return Gu`
<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>
${e.passwordprotected?Gu`<li class="room-info locked">${r}</li>`:""}
${e.hidden?Gu`<li class="room-info">${o}</li>`:""}
${e.membersonly?Gu`<li class="room-info">${a}</li>`:""}
${e.moderated?Gu`<li class="room-info">${c}</li>`:""}
${e.nonanonymous?Gu`<li class="room-info">${l}</li>`:""}
${e.open?Gu`<li class="room-info">${d}</li>`:""}
${e.persistent?Gu`<li class="room-info">${u}</li>`:""}
${e.publicroom?Gu`<li class="room-info">${h}</li>`:""}
${e.semianonymous?Gu`<li class="room-info">${m}</li>`:""}
${e.temporary?Gu`<li class="room-info">${g}</li>`:""}
${e.unmoderated?Gu`<li class="room-info">${f}</li>`:""}
</ul>
</p>
</div>
`},hk=e=>Gu`
${e.show_form?(e=>{const t=Gy("Show groupchats"),n=Gy("Server address");return Gu`
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"
2022-12-17 22:08:36 +01:00
autofocus
2021-11-11 22:06:49 +01:00
@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):""}
2022-12-17 22:08:36 +01:00
<ul class="available-chatrooms list-group">
2023-02-17 12:24:37 +01:00
${e.loading_items?Gu`<li class="list-group-item"> ${J_()} </li>`:""}
${e.feedback_text?Gu`<li class="list-group-item active">${e.feedback_text}</li>`:""}
${Mw(e.items,(e=>e.jid),(t=>((e,t)=>{const n=Gy("Show more information on this groupchat"),s=Gy("Click to open this groupchat");return Gu`
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"
2022-12-17 22:08:36 +01:00
@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>
2021-11-11 22:06:49 +01:00
</div>
</li>
`})(e,t)))}
2022-12-17 22:08:36 +01:00
</ul>
2023-02-17 12:24:37 +01:00
`,{Strophe:mk,$iq:gk,sizzle:fk}=Oh.env,pk=Oh.env.utils;function vk(e){const t=pk.ancestor(e.target,".room-item"),n=t.querySelector("div.room-info");n?(pk.slideIn(n).then(pk.removeElement),t.querySelector("a.room-info").classList.remove("selected")):(t.insertAdjacentElement("beforeend",pk.getElementFromTemplateResult(J_())),Ih.disco.info(e.target.getAttribute("data-room-jid"),null).then((e=>function(e,t){e.querySelector("span.spinner").remove(),e.querySelector("a.room-info").classList.add("selected"),e.insertAdjacentHTML("beforeEnd",pk.getElementFromTemplateResult(uk({jid:t.getAttribute("from"),desc:dk(fk('field[var="muc#roominfo_description"] value',t))?.textContent,occ:dk(fk('field[var="muc#roominfo_occupants"] value',t))?.textContent,hidden:fk('feature[var="muc_hidden"]',t).length,membersonly:fk('feature[var="muc_membersonly"]',t).length,moderated:fk('feature[var="muc_moderated"]',t).length,nonanonymous:fk('feature[var="muc_nonanonymous"]',t).length,open:fk('feature[var="muc_open"]',t).length,passwordprotected:fk('feature[var="muc_passwordprotected"]',t).length,persistent:fk('feature[var="muc_persistent"]',t).length,publicroom:fk('feature[var="muc_publicroom"]',t).length,semianonymous:fk('feature[var="muc_semianonymous"]',t).length,temporary:fk('feature[var="muc_temporary"]',t).length,unmoderated:fk('feature[var="muc_unmoderated"]',t).length})))}(t,e))).catch((e=>Il.error(e))))}function yk(e){return gl()&&!e.get("hidden")}Ih.elements.define("converse-muc-list-modal",class extends $_{constructor(e){super(e),this.items=[],this.loading_items=!1}initialize(){super.initialize(),this.listenTo(this.model,"change:muc_domain",this.onDomainChange),this.listenTo(this.model,"change:feedback_text",(()=>this.render())),this.addEventListener("shown.bs.modal",(()=>Ih.settings.get("locked_muc_domain")&&this.updateRoomsList())),this.model.save("feedback_text","")}renderModal(){return hk(Object.assign(this.model.toJSON(),{show_form:!Ih.settings.get("locked_muc_domain"),server_placeholder:this.model.get("muc_domain")||Gy("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)}))}getModalTitle(){return Gy("Query for Groupchats")}openRoom(e){e.preventDefault();const t=e.target.getAttribute("data-room-jid"),n=e.target.getAttribute("data-room-name");this.modal.hide(),Ih.rooms.open(t,{name:n},!0)}toggleRoomInfo(e){e.preventDefault(),vk(e)}onDomainChange(){Ih.settings.get("auto_list_rooms")&&this.updateRoomsList()}onRoomsFound(e){this.loading_items=!1;const t=e?fk("query item",e):[];return t.length?(this.model.set({feedback_text:Gy("Groupchats found")},{silent:!0}),this.items=t.map(Cm)):(this.items=[],this.model.set({feedback_text:Gy("No groupchats found")},{silent:!0})),this.render(),!0}updateRoomsList(){const e=gk({to:this.model.get("muc_domain"),from:nd.connection.jid,type:"get"}).c("query",{xmlns:mk.NS.DISCO_ITEMS});Ih.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})}});const _k=e=>Gu`<span class="list-item-badge badge badge--muc msgs-indicator">${e.get("num_unread")}</span>`,bk=()=>Gu`<span class="list-item-badge badge badge--muc msgs-indicator"></span>`;function wk(e,t){const n=Gy("Leave this groupchat"),s=t.get("num_unread_general")||t.get("has_activity");return Gu`
<div class="list-item controlbox-padded available-chatroom d-flex flex-row ${yk(t)?"open":""} ${s?"unread-msgs":""}"
data-room-jid="${t.get("jid")}">
2021-03-19 19:26:15 +01:00
2023-02-17 12:24:37 +01:00
${t.get("num_unread")?_k(t):t.get("has_activity")?bk():""}
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"
2023-02-17 12:24:37 +01:00
data-room-jid="${t.get("jid")}"
title="${Gy("Click to open this groupchat")}"
@click=${t=>e.openRoom(t)}>${t.getDisplayName()}</a>
2022-12-17 22:08:36 +01:00
2023-02-17 12:24:37 +01:00
${Ih.settings.get("allow_bookmarks")?function(e){const t=e.get("bookmarked")??!1,n=Gy("Bookmark");return Gu`
<a class="list-item-action add-bookmark"
data-room-jid="${e.get("jid")}"
data-bookmark-name="${e.getDisplayName()}"
@click=${e=>xw(e)}
title="${n}">
2022-12-17 22:08:36 +01:00
2023-02-17 12:24:37 +01:00
<converse-icon class="fa ${t?"fa-bookmark":"fa-bookmark-empty"}"
size="1.2em"
color="${yk(e)?"var(--inverse-link-color)":""}"></converse-icon>
</a>`}(t):""}
2021-03-19 19:26:15 +01:00
2022-12-17 22:08:36 +01:00
<a class="list-item-action room-info"
2023-02-17 12:24:37 +01:00
data-room-jid="${t.get("jid")}"
title="${Gy("Show more information on this groupchat")}"
@click=${t=>e.showRoomDetailsModal(t)}>
2021-03-19 19:26:15 +01:00
2023-02-17 12:24:37 +01:00
<converse-icon class="fa fa-info-circle" size="1.2em" color="${yk(t)?"var(--inverse-link-color)":""}"></converse-icon>
2022-12-17 22:08:36 +01:00
</a>
<a class="list-item-action close-room"
2023-02-17 12:24:37 +01:00
data-room-jid="${t.get("jid")}"
data-room-name="${t.getDisplayName()}"
title="${n}"
@click=${t=>e.closeRoom(t)}>
<converse-icon class="fa fa-sign-out-alt" size="1.2em" color="${yk(t)?"var(--inverse-link-color)":""}"></converse-icon>
2022-12-17 22:08:36 +01:00
</a>
2023-02-17 12:24:37 +01:00
</div>`}const{Strophe:Sk,u:xk}=Oh.env;Ih.elements.define("converse-rooms-list",class extends Vy{initialize(){const e=`converse.roomspanel${nd.bare_jid}`;this.model=new X$({id:e}),Xc(this.model,e),this.model.fetch(),this.listenTo(nd.chatboxes,"add",this.renderIfChatRoom),this.listenTo(nd.chatboxes,"remove",this.renderIfChatRoom),this.listenTo(nd.chatboxes,"destroy",this.renderIfChatRoom),this.listenTo(nd.chatboxes,"change",this.renderIfRelevantChange),this.listenTo(this.model,"change",(()=>this.requestUpdate())),this.requestUpdate()}render(){return(e=>{const{chatboxes:t,CHATROOMS_TYPE:n,CLOSED:s}=nd,i=t.filter((e=>e.get("type")===n));i.sort(((e,t)=>e.getDisplayName().toLowerCase()<=t.getDisplayName().toLowerCase()?-1:1));const r=Gy("Click to toggle the list of open groupchats"),o=Gy("Groupchats"),a=Gy("Query for groupchats"),c=Gy("Add a new groupchat"),l=Gy("Show bookmarked groupchats"),d=e.model.get("toggle_state")===s;return Gu`
2022-05-05 23:06:17 +02:00
<div class="d-flex controlbox-padded">
2022-12-17 22:08:36 +01:00
<span class="w-100 controlbox-heading controlbox-heading--groupchats">
2023-02-17 12:24:37 +01:00
<a class="list-toggle open-rooms-toggle" title="${r}" @click=${t=>e.toggleRoomsList(t)}>
2022-12-17 22:08:36 +01:00
<converse-icon
2023-02-17 12:24:37 +01:00
class="fa ${d?"fa-caret-right":"fa-caret-down"}"
2022-12-17 22:08:36 +01:00
size="1em"
color="var(--muc-color)"></converse-icon>
2023-02-17 12:24:37 +01:00
${o}
2022-12-17 22:08:36 +01:00
</a>
</span>
<a class="controlbox-heading__btn show-bookmark-list-modal"
2023-02-17 12:24:37 +01:00
@click=${t=>Ih.modal.show("converse-bookmark-list-modal",{model:e.model},t)}
title="${l}"
2022-12-17 22:08:36 +01:00
data-toggle="modal">
<converse-icon class="fa fa-bookmark right" size="1em"></converse-icon>
</a>
2022-05-05 23:06:17 +02:00
<a class="controlbox-heading__btn show-list-muc-modal"
2023-02-17 12:24:37 +01:00
@click=${t=>Ih.modal.show("converse-muc-list-modal",{model:e.model},t)}
title="${a}" data-toggle="modal" data-target="#muc-list-modal">
2022-12-17 22:08:36 +01:00
<converse-icon class="fa fa-list-ul right" size="1em"></converse-icon>
2022-05-05 23:06:17 +02:00
</a>
<a class="controlbox-heading__btn show-add-muc-modal"
2023-02-17 12:24:37 +01:00
@click=${t=>Ih.modal.show("converse-add-muc-modal",{model:e.model},t)}
title="${c}" data-toggle="modal" data-target="#add-chatrooms-modal">
2022-12-17 22:08:36 +01:00
<converse-icon class="fa fa-plus right" size="1em"></converse-icon>
2022-05-05 23:06:17 +02:00
</a>
</div>
2023-02-17 12:24:37 +01:00
<div class="list-container list-container--openrooms ${i.length?"":"hidden"}">
<div class="items-list rooms-list open-rooms-list ${d?"collapsed":""}">
${i.map((t=>wk(e,t)))}
2021-03-19 19:26:15 +01:00
</div>
2023-02-17 12:24:37 +01:00
</div>`})(this)}renderIfChatRoom(e){xk.isChatRoom(e)&&this.requestUpdate()}renderIfRelevantChange(e){const t=["bookmarked","hidden","name","num_unread","num_unread_general","has_activity"],n=e.changed||{};xk.isChatRoom(e)&&Object.keys(n).filter((e=>t.includes(e))).length&&this.requestUpdate()}showRoomDetailsModal(e){const t=e.currentTarget.getAttribute("data-room-jid"),n=nd.chatboxes.get(t);e.preventDefault(),Ih.modal.show("converse-muc-details-modal",{model:n},e)}async openRoom(e){e.preventDefault();const t=e.target.textContent,n=e.target.getAttribute("data-room-jid"),s={name:t||Sk.unescapeNode(Sk.getNodeFromJid(n))||n};await Ih.rooms.open(n,s,!0)}async closeRoom(e){e.preventDefault();const t=e.currentTarget.getAttribute("data-room-name"),n=e.currentTarget.getAttribute("data-room-jid");if(await Ih.confirm(Gy("Are you sure you want to leave the groupchat %1$s?",t))){(await Ih.rooms.get(n)).close()}}toggleRoomsList(e){e?.preventDefault?.();const t=this.querySelector(".open-rooms-list");this.model.get("toggle_state")===nd.CLOSED?xk.slideOut(t).then((()=>this.model.save({toggle_state:nd.OPENED}))):xk.slideIn(t).then((()=>this.model.save({toggle_state:nd.CLOSED})))}}),Oh.plugins.add("converse-roomslist",{dependencies:["converse-singleton","converse-controlbox","converse-muc","converse-bookmarks"],initialize(){}});Ih.elements.define("converse-fontawesome",class extends Vy{render(){return Gu`
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>
2023-02-17 12:24:37 +01:00
<symbol id="icon-bookmark-empty" viewBox="0 0 384 512">
<path d="M0 48C0 21.5 21.5 0 48 0l0 48V441.4l130.1-92.9c8.3-6 19.6-6 27.9 0L336 441.4V48H48V0H336c26.5 0 48 21.5 48 48V488c0 9-5 17.2-13 21.3s-17.6 3.4-24.9-1.8L192 397.5 37.9 507.5c-7.3 5.2-16.9 5.9-24.9 1.8S0 497 0 488V48z"/>
</symbol>
2021-11-11 22:06:49 +01:00
<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>
2022-04-02 21:20:14 +02:00
<symbol id="icon-refresh" viewBox="0 0 512 512">
<path d="M464 16c-17.67 0-32 14.31-32 32v74.09C392.1 66.52 327.4 32 256 32C161.5 32 78.59 92.34 49.58 182.2c-5.438 16.81 3.797 34.88 20.61 40.28c16.89 5.5 34.88-3.812 40.3-20.59C130.9 138.5 189.4 96 256 96c50.5 0 96.26 24.55 124.4 64H336c-17.67 0-32 14.31-32 32s14.33 32 32 32h128c17.67 0 32-14.31 32-32V48C496 30.31 481.7 16 464 16zM441.8 289.6c-16.92-5.438-34.88 3.812-40.3 20.59C381.1 373.5 322.6 416 256 416c-50.5 0-96.25-24.55-124.4-64H176c17.67 0 32-14.31 32-32s-14.33-32-32-32h-128c-17.67 0-32 14.31-32 32v144c0 17.69 14.33 32 32 32s32-14.31 32-32v-74.09C119.9 445.5 184.6 480 255.1 480c94.45 0 177.4-60.34 206.4-150.2C467.9 313 458.6 294.1 441.8 289.6z"></path>
</symbol>
2021-11-11 22:06:49 +01:00
</svg>
2023-02-17 12:24:37 +01:00
`}});function Ek(){if(!Ih.settings.get("auto_insert"))return;const e=Ih.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)}}var Ak=n(1513),Ck={};Ck.styleTagTransform=o_(),Ck.setAttributes=n_(),Ck.insert=e_().bind(null,"head"),Ck.domAPI=Ky(),Ck.insertStyleElement=i_();Qy()(Ak.Z,Ck);Ak.Z&&Ak.Z.locals&&Ak.Z.locals;class $k extends Vy{render(){return(()=>{const e=Ih.settings.get("singleton")?["converse-singleton"]:[];return e.push(`converse-${Ih.settings.get("view_mode")}`),Gu`
2022-01-03 11:54:10 +01:00
<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>
2023-02-17 12:24:37 +01:00
`})()}initialize(){this.setAttribute("id","conversejs"),this.setClasses();const e=sl();this.listenTo(e,"change:view_mode",(()=>this.setClasses())),this.listenTo(e,"change:singleton",(()=>this.setClasses())),window.matchMedia("(prefers-color-scheme: dark)").addListener((()=>this.setClasses())),window.matchMedia("(prefers-color-scheme: light)").addListener((()=>this.setClasses()))}setClasses(){this.className="",this.classList.add("conversejs"),this.classList.add(`converse-${Ih.settings.get("view_mode")}`),this.classList.add(`theme-${window.matchMedia("(prefers-color-scheme: dark)").matches?Ih.settings.get("dark_theme"):Ih.settings.get("theme")}`),this.requestUpdate()}}Oh.plugins.add("converse-rootview",{initialize(){Ih.settings.extend({auto_insert:!0,theme:"classic",dark_theme:"dracula"}),Ih.listen.on("chatBoxesInitialized",Ek),Ih.elements.define("converse-root",$k)}});const kk=e=>{const t=Gy("Add"),n=Gy("name@example.org"),s=Gy("Please enter a valid XMPP address"),i=Gy("Group"),r=Gy("Name"),o=Gy("XMPP Address");return Gu`
2022-12-17 22:08:36 +01:00
<form class="converse-form add-xmpp-contact" @submit=${t=>e.addContactFromForm(t)}>
<div class="modal-body">
<span class="modal-alert"></span>
<div class="form-group add-xmpp-contact__jid">
<label class="clearfix" for="jid">${o}:</label>
<div class="suggestion-box suggestion-box__jid">
<ul class="suggestion-box__results suggestion-box__results--below" hidden=""></ul>
2023-02-17 12:24:37 +01:00
<input type="text" name="jid" ?required=${!Ih.settings.get("xhr_user_search_url")}
2022-12-17 22:08:36 +01:00
value="${e.model.get("jid")||""}"
class="form-control suggestion-box__input"
placeholder="${n}"/>
<span class="suggestion-box__additions visually-hidden" role="status" aria-live="assertive" aria-relevant="additions"></span>
</div>
2021-03-19 19:26:15 +01:00
</div>
2022-12-17 22:08:36 +01:00
<div class="form-group add-xmpp-contact__name">
<label class="clearfix" for="name">${r}:</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.model.get("nickname")||""}"
class="form-control suggestion-box__input"/>
<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-12-17 22:08:36 +01:00
</div>
<div class="form-group add-xmpp-contact__group">
<label class="clearfix" for="name">${i}:</label>
2023-02-17 12:24:37 +01:00
<converse-autocomplete .list=${function(){const{roster:e}=nd,t=e.reduce(((e,t)=>e.concat(t.get("groups"))),[]);return[...new Set(t.filter((e=>e)))]}()} name="group"></converse-autocomplete>
2022-12-17 22:08:36 +01:00
</div>
<div class="form-group"><div class="invalid-feedback">${s}</div></div>
<button type="submit" class="btn btn-primary">${t}</button>
2021-03-19 19:26:15 +01:00
</div>
2023-02-17 12:24:37 +01:00
</form>`},{Strophe:jk}=Oh.env,Tk=Oh.env.utils;Ih.elements.define("converse-add-contact-modal",class extends $_{initialize(){super.initialize(),this.listenTo(this.model,"change",(()=>this.render())),this.render(),this.addEventListener("shown.bs.modal",(()=>this.querySelector('input[name="jid"]')?.focus()),!1)}renderModal(){return kk(this)}getModalTitle(){return Gy("Add a Contact")}afterRender(){"string"==typeof Ih.settings.get("xhr_user_search_url")?this.initXHRAutoComplete():this.initJIDAutoComplete()}initJIDAutoComplete(){if(!Ih.settings.get("autocomplete_add_contact"))return;const e=this.querySelector(".suggestion-box__jid").parentElement;this.jid_auto_complete=new nd.AutoComplete(e,{data:(e,t)=>`${t.slice(0,t.indexOf("@"))}@${e}`,filter:nd.FILTER_STARTSWITH,list:[...new Set(nd.roster.map((e=>jk.getDomainFromJid(e.get("jid")))))]})}initGroupAutoComplete(){if(!Ih.settings.get("autocomplete_add_contact"))return;const e=this.querySelector(".suggestion-box__jid").parentElement;this.jid_auto_complete=new nd.AutoComplete(e,{data:(e,t)=>`${t.slice(0,t.indexOf("@"))}@${e}`,filter:nd.FILTER_STARTSWITH,list:[...new Set(nd.roster.map((e=>jk.getDomainFromJid(e.get("jid")))))]})}initXHRAutoComplete(){if(!Ih.settings.get("autocomplete_add_contact"))return this.initXHRFetch();const e=this.querySelector(".suggestion-box__name").parentElement;this.name_auto_complete=new nd.AutoComplete(e,{auto_evaluate:!1,filter:nd.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.querySelector('input[name="name"]');n.addEventListener("input",vh((()=>{t.open("GET",`${Ih.settings.get("xhr_user_search_url")}q=${encodeURIComponent(n.value)}`,!0),t.send()}),300)),this.name_auto_complete.on("suggestion-box-selectcomplete",(e=>{this.querySelector('input[name="name"]').value=e.text.label,this.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.querySelector(".invalid-feedback");return e.textContent=Gy("Sorry, could not find a contact with that name"),void Tk.addClass("d-block",e)}const n=t[0].value;if(this.validateSubmission(n)){const e=this.querySelector("form"),s=t[0].label;this.afterSubmission(e,n,s)}}}}validateSubmission(e){const t=this.querySelector(".invalid-feedback");return!e||Lo(e.split("@")).length<2?(Tk.addClass("is-invalid",this.querySelector('input[name="jid"]')),Tk.addClass("d-block",t),!1):nd.roster.get(jk.getBareJidFromJid(e))?(t.textContent=Gy("This contact has already been added"),Tk.addClass("d-block",t),!1):(Tk.removeClass("d-block",t),!0)}afterSubmission(e,t,n,s){s&&!Array.isArray(s)&&(s=[s]),nd.roster.addAndSubscribe(t,n,s),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 Ih.settings.get("xhr_user_search_url")){const e=this.querySelector('input[name="name"]');return this.xhr.open("GET",`${Ih.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"),t.get("group"))}});const{u:Nk}=Oh.env;function Ik(e){const t=e.get("jid"),n=[];if(gl()){const e=nd.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"):("both"===r||"to"===r||Nk.isSameBareJID(t,nd.connection.jid))&&(n.push("current-xmpp-contact"),n.push(r),n.push(e.presence.get("show"))),Gu`
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>
2023-02-17 12:24:37 +01:00
</li>`}const Ok=e=>{const t=Gy("Click to hide these contacts"),n=nd.roster.state.get("collapsed_groups");return Gu`
2022-05-05 23:06:17 +02:00
<div class="roster-group" data-group="${e.name}">
2023-02-17 12:24:37 +01:00
<a href="#" class="list-toggle group-toggle controlbox-padded" title="${t}" @click=${t=>function(e,t){e?.preventDefault?.();const n=nd.roster.state.get("collapsed_groups");n.includes(t)?nd.roster.state.save("collapsed_groups",n.filter((e=>e!==t))):nd.roster.state.save("collapsed_groups",[...n,t])}(t,e.name)}>
2022-05-05 23:06:17 +02:00
<converse-icon color="var(--chat-head-color-dark)" 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}">
2023-02-17 12:24:37 +01:00
${Mw(e.contacts,(e=>e.get("jid")),Ik)}
2022-05-05 23:06:17 +02:00
</ul>
2023-02-17 12:24:37 +01:00
</div>`},Mk=e=>{const t=Gy("Contacts"),n=Gy("Click to toggle contacts"),s=Gy("Add a contact"),i=Gy("Re-sync your contacts"),r=(nd.roster||[]).reduce(((e,t)=>function(e,t){if(t.get("requesting")){const n=nd.HEADER_REQUESTING_CONTACTS;e[n]?e[n].push(t):e[n]=[t]}else{let n;Ih.settings.get("roster_groups")?(n=t.get("groups"),n=0===n.length?[nd.HEADER_UNGROUPED]:n):n="subscribe"===t.get("ask")?[nd.HEADER_PENDING_CONTACTS]:[nd.HEADER_CURRENT_CONTACTS];for(const s of n)e[s]?e[s].push(t):e[s]=[t]}if(t.get("num_unread")){const n=nd.HEADER_UNREAD;e[n]?e[n].push(t):e[n]=[t]}return e}(e,t)),{}),o=Object.keys(r).filter(ux),a=e.model.get("toggle_state")===nd.CLOSED;return o.sort(Fv),Gu`
2021-11-11 22:06:49 +01:00
<div class="d-flex controlbox-padded">
2022-12-17 22:08:36 +01:00
<span class="w-100 controlbox-heading controlbox-heading--contacts">
<a class="list-toggle open-contacts-toggle" title="${n}" @click=${e.toggleRoster}>
<converse-icon
class="fa ${a?"fa-caret-right":"fa-caret-down"}"
size="1em"
color="var(--chat-color)"></converse-icon>
${t}
</a>
</span>
<a class="controlbox-heading__btn sync-contacts"
@click=${t=>e.syncContacts(t)}
title="${i}">
2022-04-02 21:20:14 +02:00
<converse-icon class="fa fa-sync right ${e.syncing_contacts?"fa-spin":""}" size="1em"></converse-icon>
2021-11-11 22:06:49 +01:00
</a>
2023-02-17 12:24:37 +01:00
${Ih.settings.get("allow_contact_requests")?Gu`
2021-11-11 22:06:49 +01:00
<a class="controlbox-heading__btn add-contact"
@click=${t=>e.showAddContactModal(t)}
2022-12-17 22:08:36 +01:00
title="${s}"
2021-11-11 22:06:49 +01:00
data-toggle="modal"
data-target="#add-contact-modal">
2022-04-02 21:20:14 +02:00
<converse-icon class="fa fa-user-plus right" size="1.25em"></converse-icon>
2021-11-11 22:06:49 +01:00
</a>`:""}
2021-03-19 19:26:15 +01:00
</div>
2023-01-07 22:34:35 +01:00
2022-12-17 22:08:36 +01:00
<div class="list-container roster-contacts ${a?"hidden":""}">
<converse-roster-filter @update=${()=>e.requestUpdate()}></converse-roster-filter>
2023-02-17 12:24:37 +01:00
${Mw(o,(e=>e),(e=>{const t=r[e].filter((t=>function(e,t){const n=e.presence.get("show");return Ih.settings.get("hide_offline_users")&&"offline"===n?("subscribe"===e.get("ask")||"from"===e.get("subscription")||!0===e.get("requesting"))&&!dx(e,t):!dx(e,t)}(t,e)));return t.sort(Pv),t.length?Ok({contacts:t,name:e}):""}))}
2021-11-11 22:06:49 +01:00
</div>
2023-02-17 12:24:37 +01:00
`};Ih.elements.define("converse-roster",class extends Vy{async initialize(){const e=`converse.contacts-panel${nd.bare_jid}`;this.model=new No({id:e}),Xc(this.model,e),this.model.fetch(),await Ih.waitUntil("rosterInitialized");const{chatboxes:t,presences:n,roster:s}=nd;this.listenTo(nd,"rosterContactsFetched",(()=>this.requestUpdate())),this.listenTo(n,"change:show",(()=>this.requestUpdate())),this.listenTo(t,"change:hidden",(()=>this.requestUpdate())),this.listenTo(s,"add",(()=>this.requestUpdate())),this.listenTo(s,"destroy",(()=>this.requestUpdate())),this.listenTo(s,"remove",(()=>this.requestUpdate())),this.listenTo(s,"change",(()=>this.requestUpdate())),this.listenTo(s.state,"change",(()=>this.requestUpdate())),this.listenTo(this.model,"change",(()=>this.requestUpdate())),Ih.trigger("rosterViewInitialized")}render(){return Mk(this)}showAddContactModal(e){Ih.modal.show("converse-add-contact-modal",{model:new No},e)}async syncContacts(e){e.preventDefault();const{roster:t}=nd;this.syncing_contacts=!0,this.requestUpdate(),t.data.save("version",null),await t.fetchFromServer(),Ih.user.presence.send(),this.syncing_contacts=!1,this.requestUpdate()}toggleRoster(e){e?.preventDefault?.();const t=this.querySelector(".list-container.roster-contacts");this.model.get("toggle_state")===nd.CLOSED?mw(t).then((()=>this.model.save({toggle_state:nd.OPENED}))):gw(t).then((()=>this.model.save({toggle_state:nd.CLOSED})))}});const Rk={dnd:Gy("This contact is busy"),online:Gy("This contact is online"),offline:Gy("This contact is offline"),unavailable:Gy("This contact is unavailable"),xa:Gy("This contact is away for an extended period"),away:Gy("This contact is away")},Dk=(e,t)=>{const n=t.presence.get("show")||"offline";let s,i;[s,i]="online"===n?["fa fa-circle","chat-status-online"]:"dnd"===n?["fa fa-minus-circle","chat-status-busy"]:"away"===n?["fa fa-circle","chat-status-away"]:["fa fa-circle","subdued-color"];const r=Rk[n],o=t.get("num_unread")||0,a=t.getDisplayName(),c=Gy("Click to chat with %1$s (XMPP address: %2$s)",a,e.model.get("jid"));return Gu`
2023-01-07 22:34:35 +01:00
<a class="list-item-link cbox-list-item open-chat ${o?"unread-msgs":""}" title="${c}" href="#" @click=${e.openChat}>
2022-01-03 11:54:10 +01:00
<span>
<converse-avatar
class="avatar"
2023-01-07 22:34:35 +01:00
.data=${e.model.vcard?.attributes}
nonce=${e.model.vcard?.get("vcard_updated")}
2022-01-03 11:54:10 +01:00
height="30" width="30"></converse-avatar>
<converse-icon
2023-01-07 22:34:35 +01:00
title="${r}"
color="var(--${i})"
2022-01-03 11:54:10 +01:00
size="1em"
2023-01-07 22:34:35 +01:00
class="${s} chat-status chat-status--avatar"></converse-icon>
2022-01-03 11:54:10 +01:00
</span>
2023-02-17 12:24:37 +01:00
${o?Gu`<span class="msgs-indicator">${o}</span>`:""}
2023-01-07 22:34:35 +01:00
<span class="contact-name contact-name--${e.show} ${o?"unread-msgs":""}">${a}</span>
2021-11-11 22:06:49 +01:00
</a>
2023-02-17 12:24:37 +01:00
${Ih.settings.get("allow_contact_removal")?((e,t)=>{const n=t.getDisplayName(),s=Gy("Click to remove %1$s as a contact",n);return Gu`
2022-05-05 23:06:17 +02:00
<a class="list-item-action remove-xmpp-contact" @click=${e.removeContact} title="${s}" href="#">
2022-04-02 21:20:14 +02:00
<converse-icon class="fa fa-trash-alt" size="1.5em"></converse-icon>
</a>
2023-02-17 12:24:37 +01:00
`})(e,t):""}`};class zk extends Vy{static get properties(){return{model:{type:Object}}}initialize(){this.listenTo(this.model,"change",(()=>this.requestUpdate())),this.listenTo(this.model,"highlight",(()=>this.requestUpdate())),this.listenTo(this.model,"vcard:add",(()=>this.requestUpdate())),this.listenTo(this.model,"vcard:change",(()=>this.requestUpdate()))}render(){if(!0===this.model.get("requesting")){const e=this.model.getDisplayName();return(e=>Gu`
2022-12-17 22:08:36 +01:00
<a class="open-chat w-100" href="#" @click=${e.openChat}>
<span class="req-contact-name w-100" title="JID: ${e.jid}">${e.display_name}</span>
</a>
<a class="accept-xmpp-request list-item-action list-item-action--visible"
2022-05-05 23:06:17 +02:00
@click=${e.acceptRequest}
2022-12-17 22:08:36 +01:00
aria-label="${e.desc_accept}" title="${e.desc_accept}" href="#">
<converse-icon class="fa fa-check" size="1em"></converse-icon>
</a>
<a class="decline-xmpp-request list-item-action list-item-action--visible"
2022-05-05 23:06:17 +02:00
@click=${e.declineRequest}
2022-12-17 22:08:36 +01:00
aria-label="${e.desc_decline}" title="${e.desc_decline}" href="#">
<converse-icon class="fa fa-times" size="1em"></converse-icon>
2023-02-17 12:24:37 +01:00
</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:Gy("Click to accept the contact request from %1$s",e),desc_decline:Gy("Click to decline the contact request from %1$s",e)}))}return Dk(this,this.model)}openChat(e){e?.preventDefault?.(),this.model.openChat()}async removeContact(e){if(e?.preventDefault?.(),!Ih.settings.get("allow_contact_removal"))return;if(await Ih.confirm(Gy("Are you sure you want to remove this contact?")))try{this.model.removeFromRoster(),this.model.collection&&this.model.destroy()}catch(e){Il.error(e),Ih.alert("error",Gy("Error"),[Gy("Sorry, there was an error while trying to remove %1$s as a contact.",this.model.getDisplayName())])}}async acceptRequest(e){e?.preventDefault?.(),await nd.roster.sendContactAddIQ(this.model.get("jid"),this.model.getFullname(),[]),this.model.authorize().subscribe()}async declineRequest(e){e&&e.preventDefault&&e.preventDefault();return await Ih.confirm(Gy("Are you sure you want to decline this contact request?"))&&this.model.unauthorize().destroy(),this}}Ih.elements.define("converse-roster-contact",zk);class Lk extends Vy{async initialize(){await Ih.waitUntil("rosterInitialized"),this.model=nd.roster_filter,this.liveFilter=vh((()=>{this.model.save({filter_text:this.querySelector(".roster-filter").value})}),250),this.listenTo(nd,"rosterContactsFetched",(()=>this.requestUpdate())),this.listenTo(nd.presences,"change:show",(()=>this.requestUpdate())),this.listenTo(nd.roster,"add",(()=>this.requestUpdate())),this.listenTo(nd.roster,"destroy",(()=>this.requestUpdate())),this.listenTo(nd.roster,"remove",(()=>this.requestUpdate())),this.listenTo(this.model,"change",this.dispatchUpdateEvent),this.listenTo(this.model,"change",(()=>this.requestUpdate())),this.requestUpdate()}render(){return this.model?(e=>{const t=Gy("Filter"),n=Gy("Filter by contact name"),s=Gy("Filter by group name"),i=Gy("Filter by status"),r=Gy("Any"),o=Gy("Unread"),a=Gy("Online"),c=Gy("Chatty"),l=Gy("Busy"),d=Gy("Away"),u=Gy("Extended Away"),h=Gy("Offline");return Gu`
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">
2022-04-02 21:20:14 +02:00
<converse-icon size="1em" @click=${e.changeTypeFilter} class="fa fa-user clickable ${"contacts"===e.filter_type?"selected":""}" data-type="contacts" title="${n}"></converse-icon>
2022-05-05 23:06:17 +02:00
<converse-icon size="1em" @click=${e.changeTypeFilter} class="fa fa-users clickable ${"groups"===e.filter_type?"selected":""}" data-type="groups" title="${s}"></converse-icon>
<converse-icon size="1em" @click=${e.changeTypeFilter} class="fa fa-circle clickable ${"state"===e.filter_type?"selected":""}" data-type="state" title="${i}"></converse-icon>
2021-11-11 22:06:49 +01:00
</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}"/>
2022-04-02 21:20:14 +02:00
<converse-icon size="1em" class="fa fa-times clear-input ${e.filter_text&&"state"!==e.filter_type?"":"hidden"}"
2021-11-11 22:06:49 +01:00
@click=${e.clearFilter}>
2022-04-02 21:20:14 +02:00
</converse-icon>
2021-11-11 22:06:49 +01:00
</div>
<select class="form-control state-type ${"state"!==e.filter_type?"hidden":""}"
@change=${e.changeChatStateFilter}>
2022-12-17 22:08:36 +01:00
<option value="">${r}</option>
<option ?selected=${"unread_messages"===e.chat_state} value="unread_messages">${o}</option>
2021-11-11 22:06:49 +01:00
<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>
2023-02-17 12:24:37 +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=uw(e.target,"converse-icon")?.dataset.type||"contacts";"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(){return nd.roster?.length>=5||this.isActive()}clearFilter(e){e&&e.preventDefault(),this.model.save({filter_text:""})}}Ih.elements.define("converse-roster-filter",Lk);var Pk=n(1984),Fk={};Fk.styleTagTransform=o_(),Fk.setAttributes=n_(),Fk.insert=e_().bind(null,"head"),Fk.domAPI=Ky(),Fk.insertStyleElement=i_();Qy()(Pk.Z,Fk);Pk.Z&&Pk.Z.locals&&Pk.Z.locals;Oh.plugins.add("converse-rosterview",{dependencies:["converse-roster","converse-modal","converse-chatboxviews"],initialize(){Ih.settings.extend({autocomplete_add_contact:!0,allow_contact_removal:!0,hide_offline_users:!1,roster_groups:!0,xhr_user_search_url:null}),Ih.promises.add("rosterViewInitialized"),nd.RosterFilter=kv,nd.RosterFilterView=Lk,nd.RosterContactView=zk,Ih.listen.on("chatBoxesInitialized",(()=>{nd.chatboxes.on("destroy",(e=>lx(e))),nd.chatboxes.on("change:hidden",(e=>lx(e)))})),Ih.listen.on("afterTearDown",(()=>nd.rotergroups?.off().reset()))}});var Uk=n(1833),Bk={};Bk.styleTagTransform=o_(),Bk.setAttributes=n_(),Bk.insert=e_().bind(null,"head"),Bk.domAPI=Ky(),Bk.insertStyleElement=i_();Qy()(Uk.Z,Bk);Uk.Z&&Uk.Z.locals&&Uk.Z.locals;Oh.plugins.add("converse-singleton",{enabled:e=>e.api.settings.get("singleton"),initialize(){Ih.settings.extend({allow_logout:!1,allow_muc_invitations:!1,hide_muc_server:!0});const e=Ih.settings.get("auto_join_rooms"),t=Ih.settings.get("auto_join_private_chats");if(!Array.isArray(e)&&!Array.isArray(t))throw new Error("converse-singleton: auto_join_rooms must be an Array");if(0===e.length&&0===t.length)throw new Error("If you set singleton set to true, you need to specify auto_join_rooms or auto_join_private_chats");if(e.length>0&&t.length>0)throw new Error("It doesn't make sense to have singleton set to true and auto_join_rooms or auto_join_private_chats set to more then one, since only one chat room may be open at any time.")}});const{u:qk}=Oh.env;function Hk(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!Ih.settings.get("allow_dragresize"))return!0;e.preventDefault();const n=qk.ancestor(e.target,".box-flyout"),s=window.getComputedStyle(n),i=n.parentElement;i.height=parseInt(s.height.replace(/px$/,""),10),nd.resizing={chatbox:i,direction:"top"},i.prev_pageY=e.pageY,t&&Ih.trigger("startVerticalResize",i)}function Gk(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!Ih.settings.get("allow_dragresize"))return!0;e.preventDefault();const n=qk.ancestor(e.target,".box-flyout"),s=window.getComputedStyle(n),i=n.parentElement;i.width=parseInt(s.width.replace(/px$/,""),10),nd.resizing={chatbox:i,direction:"left"},i.prev_pageX=e.pageX,t&&Ih.trigger("startHorizontalResize",i)}function Wk(e){Gk(e,!1),Hk(e,!1),nd.resizing.direction="topleft",Ih.trigger("startDiagonalResize",this)}function Vk(e,t){if(void 0===e)return;if(void 0===t)return e;return e!==t&&Math.abs(e-t)<10?t:e}function Jk(e){if(!nd.resizing||!Ih.settings.get("allow_dragresize"))return!0;e.preventDefault(),nd.resizing.chatbox.resizeChatBox(e)}function Zk(e){if(!nd.resizing||!Ih.settings.get("allow_dragresize"))return!0;e.preventDefault();const t=Vk(nd.resizing.chatbox.height,nd.resizing.chatbox.
<div class="dragresize dragresize-top" @mousedown="${Hk}"></div>
<div class="dragresize dragresize-topleft" @mousedown="${Wk}"></div>
<div class="dragresize dragresize-left" @mousedown="${Gk}"></div>
`;Ih.elements.define("converse-dragresize",class extends Vy{render(){return Qk()}});const Yk={initDragResize(){const e=this,t=vh((()=>e.setDimensions()));window.addEventListener("resize",e.debouncedSetDimensions),this.listenTo(this.model,"destroy",(()=>window.removeEventListener("resize",t)));const n=this.querySelector(".box-flyout"),s=window.getComputedStyle(n);if(void 0===this.model.get("height")){const e=parseInt(s.height.replace(/px$/,""),10),t=parseInt(s.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 i=s["min-width"],r=s["min-height"];return this.model.set("min_width",i.endsWith("px")?Number(i.replace(/px$/,"")):0),this.model.set("min_height",r.endsWith("px")?Number(r.replace(/px$/,"")):0),this.prev_pageY=0,this.prev_pageX=0,nd.connection?.connected&&(this.height=this.model.get("height"),this.width=this.model.get("width")),this},resizeChatBox(e){let t;0===nd.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))),nd.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?Vk(e,this.model.get("default_height"))+"px":"";const t=this.querySelector(".box-flyout");null!==t&&(t.style.height=e)},setChatBoxWidth(e){e=e?Vk(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)}};Oh.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"),s="controlbox"===this.get("id")?e=>this.set(e):e=>this.save(e);return s({height:Vk(t,this.get("default_height")),width:Vk(n,this.get("default_width"))}),e}}},initialize(){Ih.settings.extend({allow_dragresize:!0}),Object.assign(nd.ChatBoxView.prototype,Yk),Object.assign(nd.ChatRoomView.prototype,Yk),nd.ControlBoxView&&Object.assign(nd.ControlBoxView.prototype,Yk),Ih.listen.on("registeredGlobalEventHandlers",(function(){document.addEventListener("mousemove",Jk),document.addEventListener("mouseup",Zk)})),Ih.listen.on("unregisteredGlobalEventHandlers",(function(){document.removeEventListener("mousemove",Jk),document.removeEventListener("mouseup",Zk)})),Ih.listen.on("beforeShowingChatView",(e=>e.initDragResize().setDimensions()))}});var Kk=n(2791),Xk={};Xk.styleTagTransform=o_(),Xk.setAttributes=n_(),Xk.insert=e_().bind(null,"head"),Xk.domAPI=Ky(),Xk.insertStyleElement=i_();Qy()(Kk.Z,Xk);Kk.Z&&Kk.Z.locals&&Kk.Z.locals;Oh.plugins.add("converse-fullscreen",{enabled:()=>gl(),initialize(){Ih.settings.extend({chatview_avatar_height:50,chatview_avatar_width:50,hide_open_bookmarks:!0,show_controlbox_by_default:!0,sticky_controlbox:!0})}}),nd.CustomElement=Vy;const ej=Oh.initialize;Oh.initialize=function(e,t){return Array.isArray(e.whitelisted_plugins)?e.whitelisted_plugins=e.whitelisted_plugins.concat(Jy):e.whitelisted_plugins=Jy,ej(e,t)};const tj=Oh},5251:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},69
2021-01-29 23:34:36 +01:00
//# sourceMappingURL=converse.min.js.map