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

2401 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-12-29 14:11:55 +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">
2023-02-17 12:24:37 +01:00
${i.reduce(((e,t)=>{let{name:n,value:s}=t;return e+`<field var="${n}"><value>${s}</value></field>`}),"")}
</x>`}
</command>
2023-12-29 14:11:55 +01:00
</iq>`,o=await Vl.sendIQ(r,null,!1);if(null===o){Yc.warn("A timeout occurred while trying to run an ad-hoc command");const{__:e}=bl;return{status:"error",note:e("A timeout occurred")}}hp.isErrorStanza(o)&&(Yc.error("Error while trying to execute an ad-hoc command"),Yc.error(o));const a=o.querySelector("command"),c=a?.getAttribute("status");return{status:c,..."executing"===c?lp(o):{},note:o.querySelector("note")?.textContent}}}},{Strophe:gp}=Ah.env;gp.addNamespace("ADHOC","http://jabber.org/protocol/commands"),Ah.plugins.add("converse-adhoc",{dependencies:["converse-disco"],initialize(){Object.assign(this._converse.api,fp)}});class pp extends Em{defaults(){return{bookmarked:!1,hidden:["mobile","fullscreen"].includes(Vl.settings.get("view_mode")),message_type:"headline",num_unread:0,time_opened:this.get("time_opened")||(new Date).getTime(),type:bl.HEADLINES_TYPE}}async initialize(){this.set({box_id:`box-${this.get("jid")}`}),this.initUI(),this.initMessages(),await this.fetchMessages(),Vl.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 Vl.chatboxes.get(e);return!s&&n?s=await Vl.chatboxes.create(e,t,bl.HeadlinesFeed):(s=s&&s.get("type")===bl.HEADLINES_TYPE?s:null,s&&Object.keys(t).length&&s.save(t)),s}if(void 0===e){return(await Vl.chatboxes.get()).filter((e=>e.get("type")===bl.HEADLINES_TYPE))}return"string"==typeof e?s(e):Promise.all(e.map((e=>s(e))))}}};Ah.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(){bl.connection.addHandler((e=>async function(e){if(mm(e)||fm(e)){const t=e.getAttribute("from");if(await Vl.waitUntil("rosterInitialized"),t.includes("@")&&!bl.roster.get(t)&&!Vl.settings.get("allow_non_roster_messaging"))return;if(null===e.querySelector("body"))return;const n=bl.chatboxes.create({id:t,jid:t,type:bl.HEADLINES_TYPE,from:t}),s=await _m(e);await n.createMessage(s),Vl.trigger("message",{chatbox:n,stanza:e,attrs:s})}}(e)||!0),null,"message")}bl.HeadlinesFeed=pp,Vl.listen.on("connected",e),Vl.listen.on("reconnected",e),Object.assign(Vl,vp)}});const yp=Ah.env.utils;class _p extends dr{defaults(){return{msgid:yp.getUniqueId(),is_ephemeral:!1}}}const{Strophe:bp,$build:wp}=Ah.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 lr(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)}}bl.RSM_ATTRIBUTES=$p,bl.RSM=kp;const{Strophe:jp,$iq:Tp,dayjs:Ip}=Ah.env,{NS:Np}=jp,Op=Ah.env.utils,Mp={archive:{async query(e){if(!Vl.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||bl.bare_jid;if(!await Vl.disco.supp
2023-06-25 15:59:31 +02:00
<div class="form-group">
2023-12-29 14:11:55 +01:00
${"hidden"!==e.type?nh`<label for="${e.id}">${e.label}</label>`:""}
2023-06-25 15:59:31 +02:00
<!-- This is a hack to prevent Chrome from auto-filling the username in
any of the other input fields in the MUC configuration form. -->
2023-12-29 14:11:55 +01:00
${"password"===e.type&&e.fixed_username?nh`
2023-06-25 15:59:31 +02:00
<input class="hidden-username" type="text" autocomplete="username" value="${e.fixed_username}"></input>
`:""}
<input
autocomplete="${e.autocomplete||""}"
class="form-control"
id="${e.id}"
name="${e.name}"
placeholder="${e.placeholder||""}"
type="${e.type}"
value="${e.value||""}"
?required=${e.required} />
2023-12-29 14:11:55 +01:00
</div>`,v_=e=>nh`
2023-06-25 15:59:31 +02:00
<div class="form-group">
<label for="${e.id}">${e.label}</label>
<select class="form-control" id="${e.id}" name="${e.name}" ?multiple="${e.multiple}">
2023-12-29 14:11:55 +01:00
${e.options?.map((e=>(e=>nh`<option value="${e.value}" ?selected="${e.selected}">${e.label}</option>`)(e)))}
2023-06-25 15:59:31 +02:00
</select>
2023-12-29 14:11:55 +01:00
</div>`,y_=e=>nh`
2023-06-25 15:59:31 +02:00
<label>${e.label}
<a class="form-url" target="_blank" rel="noopener" href="${e.value}">${e.value}</a>
2023-12-29 14:11:55 +01:00
</label>`,__=e=>nh`
2023-06-25 15:59:31 +02:00
<div class="form-group">
2023-12-29 14:11:55 +01:00
${e.label?nh`<label>${e.label}</label>`:""}
2023-06-25 15:59:31 +02:00
<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>
2023-12-29 14:11:55 +01:00
</div>`;function b_(e){e.preventDefault(),Vl.rooms.open(e.target.href)}const w_=(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?nh`
2023-06-25 15:59:31 +02:00
<a target="_blank"
rel="noopener"
2023-12-29 14:11:55 +01:00
@click=${b_}
href="${n}">${t}</a>`:nh`<a target="_blank" rel="noopener" href="${n}">${t}</a>`},S_=(e,t)=>nh`<video controls preload="metadata" src="${e}"></video>${t?"":nh`<a target="_blank" rel="noopener" href="${e}">${e}</a>`}`,{sizzle:x_,Strophe:E_}=Ah.env,A_=["http","https","xmpp","mailto"];function C_(e,t){return{"muc#roomconfig_lang":"language","muc#roomconfig_roomsecret":t?.new_password?"new-password":"current-password"}[e]}const $_={"text-private":"password","text-single":"text",fixed:"label",boolean:"checkbox",hidden:"hidden","jid-multi":"textarea","list-single":"dropdown","list-multi":"dropdown"},k_={"xs:anyURI":"url","xs:byte":"number","xs:date":"date","xs:dateTime":"datetime","xs:int":"number","xs:integer":"number","xs:time":"time"},j_=/\s*\n\s*/;function T_(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=>j_.test(e.data)&&e.parentElement.removeChild(e))),e}const I_=new XMLSerializer;function N_(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?Zc.getSelectValues(e):e.value,{name:t,value:n}}function O_(e){const t=$_[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 k_[e]||t}}return t}function M_(e){const t=Lh(e);try{return decodeURI(t.filename())}catch(e){return Yc.debug(e),t.filename()}}function R_(e){const t=Lh(e);return null===t?e:Jh(t)?S_(e):Vh(t)?f_(e):(Zh(t),g_(t.toString(),M_(t)))}function D_(e,t){return t instanceof Element&&t.classList.contains(e)}function z_(e,t){return t instanceof Element&&t.classList.add(e),t}function L_(e,t){return t instanceof Element&&t.classList.remove(e),t}function P_(e){return e instanceof Element&&e.parentNode&&e.parentNode.removeChild(e),e}function F_(e,t){let n=e;for(;null!==n&&!x_.matchesSelector(n,t);)n=n.parentElement;return n}function U_(e){const t=RegExp("^w{3}.","ig").test(e)?`http://${e}`:e,n=Lh(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]:A_).includes(e)}(n._parts.protocol)&&n._parts.protocol?e:w_(n,e)}function B_(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 Yc.warn(e),void s(new Error(e))}const i=e.getAttribute("data-slider-marker");i&&(e.removeAttribute("data-slider-marker"),cancelAnimationFrame(i));const r=Zc.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(!Zc.hasClass("collapsed",e)&&!Zc.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",requestAnimationFrame((function t(){a+=r/o,a<r?(e.style.height=a+"px",e.setAttribute("data-slider-marker",requestAnimationFrame(t).toString())):(e.removeAttribute("data-slider-marker"),e.style.height=Zc.calculateElementHeight(e)+"px",e.style.overflow="",e.style.height="",n())})).toString())}))}function q_(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 Yc.warn(e),s(new Error(e))}if(Zc.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"),cancelAnimationFrame(i));const r=e.offsetHeight,o=t/17;let a=r;e.style.overflow="hidde
2023-06-25 15:59:31 +02:00
<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>
2023-12-29 14:11:55 +01:00
`})({name:e.getAttribute("var"),label:e.getAttribute("label")||"",value:e.querySelector("value")?.textContent,required:!!e.querySelector("required")});if("boolean"===e.getAttribute("type")){const t=e.querySelector("value")?.textContent;return(e=>nh`
2023-06-25 15:59:31 +02:00
<fieldset class="form-group">
<input id="${e.id}" name="${e.name}" type="checkbox" ?checked=${e.checked} ?required=${e.required} />
<label class="form-check-label" for="${e.id}">${e.label}</label>
2023-12-29 14:11:55 +01:00
</fieldset>`)({id:Zc.getUniqueId(),name:e.getAttribute("var"),label:e.getAttribute("label")||"",checked:"1"===t||"true"===t?'checked="1"':""})}if("url"===e.getAttribute("var"))return y_({label:e.getAttribute("label")||"",value:e.querySelector("value")?.textContent});if("username"===e.getAttribute("var"))return __({domain:" @"+n.domain,name:e.getAttribute("var"),type:O_(e),label:e.getAttribute("label")||"",value:e.querySelector("value")?.textContent,required:!!e.querySelector("required")});if("password"===e.getAttribute("var"))return p_({name:e.getAttribute("var"),type:"password",label:e.getAttribute("label")||"",value:e.querySelector("value")?.textContent,required:!!e.querySelector("required")});if("ocr"===e.getAttribute("var")){const n=e.querySelector("uri"),s=x_('data[cid="'+n.textContent.replace(/^cid:/,"")+'"]',t)[0];return(e=>nh`
2023-06-25 15:59:31 +02:00
<fieldset class="form-group">
2023-12-29 14:11:55 +01:00
${e.label?nh`<label>${e.label}</label>`:""}
2023-06-25 15:59:31 +02:00
<img src="data:${e.type};base64,${e.data}">
<input name="${e.name}" type="text" ?required="${e.required}" />
</fieldset>
2023-12-29 14:11:55 +01:00
`)({label:e.getAttribute("label"),name:e.getAttribute("var"),data:s?.textContent,type:n.getAttribute("type"),required:!!e.querySelector("required")})}{const t=e.getAttribute("var");return p_({id:Zc.getUniqueId(),label:e.getAttribute("label")||"",name:t,fixed_username:n?.fixed_username,autocomplete:C_(t,n),placeholder:null,required:!!e.querySelector("required"),type:O_(e),value:e.querySelector("value")?.textContent})}},Object.assign(Zc,{hasClass:D_,addClass:z_,ancestor:F_,getOOBURLMarkup:R_,isEqualNode:function(e,t){if(!Zc.isElement(e))throw new Error("Element being compared must be an Element!");e=T_(e),t=T_(t);let n=e.isEqualNode(t);if(!n){const{xmlHtmlNode:s}=E_,i=I_.serializeToString(e),r=I_.serializeToString(t);n=i===r||s(i).isEqualNode(s(r))}return n},removeClass:L_,removeElement:P_,slideIn:q_,slideOut:B_});const G_=Zc;var W_=n(975),V_={};V_.styleTagTransform=i_(),V_.setAttributes=e_(),V_.insert=Yy().bind(null,"head"),V_.domAPI=Qy(),V_.insertStyleElement=n_();Jy()(W_.Z,V_);W_.Z&&W_.Z.locals&&W_.Z.locals;const J_=u_.extend({className:"modal",persistent:!1,events:{"click .nav-item .nav-link":"switchTab"},initialize(e){if(!this.id)throw new Error("Each modal class must have a unique id attribute");Object.assign(this,e),this.render(),this.el.setAttribute("tabindex","-1"),this.el.setAttribute("role","dialog"),this.el.setAttribute("aria-hidden","true");const t=this.el.querySelector(".modal-title").getAttribute("id");t&&this.el.setAttribute("aria-labelledby",t),this.insertIntoDOM();const n=c_().Modal;this.modal=new n(this.el,{backdrop:!0,keyboard:!0}),this.el.addEventListener("hide.bs.modal",(()=>this.onHide()),!1)},onHide(){L_("selected",this.trigger_el),!this.persistent&&Vl.modal.remove(this)},insertIntoDOM(){document.querySelector("#converse-modals").insertAdjacentElement("beforeEnd",this.el)},switchTab(e){e.stopPropagation(),e.preventDefault(),Eo()(".nav-link.active",this.el).forEach((e=>{L_("active",this.el.querySelector(e.getAttribute("href"))),L_("active",e)})),z_("active",e.target),z_("active",this.el.querySelector(e.target.getAttribute("href")))},alert(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"primary";const n=this.el.querySelector(".modal-alert");if(null===n)return void Yc.error("Could not find a .modal-alert element in the modal to show an alert message in!");bh(l_({type:`alert-${t}`,message:e}),n);const s=n.firstElementChild;setTimeout((()=>{z_("fade-out",s),setTimeout((()=>P_(s)),600)}),5e3)},show(e){e&&(e.preventDefault(),this.trigger_el=e.target,!D_("chat-image",this.trigger_el)&&z_("selected",this.trigger_el)),this.modal.show()}}),Z_=J_,Q_=nh`<button type="button" class="btn btn-secondary" data-dismiss="modal">${qy("Close")}</button>`,K_=nh`<button type="button" class="close" data-dismiss="modal" aria-label="${qy("Close")}"><span aria-hidden="true">×</span></button>`,Y_=("undefined"!=typeof Element&&Element.prototype,/^(\S+)\s*(.*)$/),X_=["model","collection","events"];class eb extends HTMLElement{events={};constructor(e){super(),this.cid=jn("view"),this._domEvents=[],Be(this,lr(e,X_))}createRenderRoot(){return this}connectedCallback(){this._initialized||(this.preinitialize.apply(this,arguments),this.initialize.apply(this,arguments),this._initialized=!0),this.delegateEvents()}disconnectedCallback(){this.undelegateEvents(),this.stopListening()}preinitialize(){}initialize(){}render(){return _(this.beforeRender)&&this.beforeRender(),_(this.toHTML)&&bh(this.toHTML(),this),_(this.afterRender)&&this.afterRender(),this}delegateEvents(){if(!this.events)return this;this.undelegateEvents();for(const e in this.events){let t=this.events[e];if(_(t)||(t=this[t]),!t)continue;const n=e.match(Y_);this.delegate(n[1],n[2],t.bind(this))}return this}delegate(e,t,n){const s=this;if(!s)return this;if("function"==typeof t&&(n=t,t=null),-1!==["focus","blur"].indexOf(e)){const s=this.querySelectorAll(t);for(let t=0,i=s.length;t<i;t++){const i=s[t];i.addEventListener(e,n,!1),this._domEvents.push({el:i,eventName:e,handler:n})}return n}const i=t?function(e){let i=e.target||e.srcElement;for(;i&&i!=s;i=i.parentN
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-06-25 15:59:31 +02:00
${K_}
2022-12-17 22:08:36 +01:00
</div>
<div class="modal-body">
<span class="modal-alert">
2023-12-29 14:11:55 +01:00
${t?l_({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-12-29 14:11:55 +01:00
${e.renderModalFooter?.()??nh`<div class="modal-footer">${Q_}</div>`}
2022-12-17 22:08:36 +01:00
</div>
</div>
2023-12-29 14:11:55 +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()}};Vl.elements.define("converse-alert-modal",class extends tb{initialize(){super.initialize(),this.listenTo(this.model,"change",(()=>this.render())),this.addEventListener("hide.bs.modal",(()=>this.remove()),!1)}renderModal(){return(e=>nh`
2022-12-17 22:08:36 +01:00
<div class="modal-body">
<span class="modal-alert"></span>
2023-12-29 14:11:55 +01:00
${e.messages.map((e=>nh`<p>${e}</p>`))}
</div>`)(this.model.toJSON())}getModalTitle(){return this.model.get("title")}});const nb=e=>nh`
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-12-29 14:11:55 +01:00
${e.model.get("messages")?.map((e=>nh`<p>${e}</p>`))}
2022-12-17 22:08:36 +01:00
</div>
2023-12-29 14:11:55 +01:00
${e.model.get("fields")?.map((e=>(e=>nh`
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-12-29 14:11:55 +01:00
<button type="submit" class="btn btn-primary">${qy("OK")}</button>
<input type="button" class="btn btn-secondary" data-dismiss="modal" value="${qy("Cancel")}"/>
2022-12-17 22:08:36 +01:00
</div>
2023-12-29 14:11:55 +01:00
</form>`;class sb extends tb{constructor(e){super(e),this.confirmation=Ao()}initialize(){super.initialize(),this.listenTo(this.model,"change",(()=>this.render())),this.addEventListener("hide.bs.modal",(()=>{this.confirmation.isResolved||this.confirmation.reject()}),!1)}renderModal(){return nb(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""}}Vl.elements.define("converse-confirm-modal",sb);let ib=[],rb={};const ob={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=>rb[e]??ib.filter((t=>t.id==e)).pop(),create(e,t){let n;if("string"==typeof e){const s=customElements.get(e);n=rb[e]=new s(t)}else{n=new e(t),ib.push(n)}return n},remove(e){let t;"string"==typeof e?(t=rb[e],delete rb[e]):(t=e,ib=ib.filter((e=>e!==t))),t?.remove()},removeAll(){ib.forEach((e=>e.remove())),ib=[],rb={}}},async confirm(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];"string"==typeof t&&(t=[t]);const n=new dr({title:e,messages:t,fields:arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],type:"confirm"}),s=new sb({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 dr({title:e,messages:t,fields:[{name:"reason",placeholder:arguments.length>2&&void 0!==arguments[2]?arguments[2]:""}],type:"prompt"}),s=new sb({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 dr({title:t,messages:n,level:s,type:"alert"});ob.modal.show("converse-alert-modal",{model:i})}},ab=ob;Ah.env.BootstrapModal=Z_,Ah.plugins.add("converse-modal",{initialize(){Vl.listen.on("disconnect",(()=>{const e=document.querySelector("#converse-modals");e&&(e.innerHTML="")})),Vl.listen.on("clearSession",(()=>Vl.modal.removeAll())),Object.assign(bl.api,ab)}});const cb=Ah.env.utils,lb={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])||cb.isMentionBoundary(e[0])&&t.includes(e[1])},db=function(e,t){return RegExp(lb.regExpEscape(t.trim()),"i").test(e)},ub=function(e,t){return RegExp("^"+lb.regExpEscape(t.trim()),"i").test(e)},hb=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},mb=(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 fb=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-12-29 14:11:55 +01:00
`}firstUpdated(){this.auto_complete=new vb(this.firstElementChild,{ac_triggers:this.triggers.split(" "),auto_evaluate:this.auto_evaluate,auto_first:this.auto_first,filter:"contains"==this.filter?db:ub,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 yb=n(6022),_b={};_b.styleTagTransform=i_(),_b.setAttributes=e_(),_b.insert=Yy().bind(null,"head"),_b.domAPI=Qy(),_b.insertStyleElement=n_();Jy()(yb.Z,_b);yb.Z&&yb.Z.locals&&yb.Z.locals;bl.FILTER_CONTAINS=db,bl.FILTER_STARTSWITH=ub,bl.AutoComplete=vb;const bb={execute:qy("Execute"),prev:qy("Previous"),next:qy("Next"),complete:qy("Complete")},wb=(e,t)=>nh`
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-12-29 14:11:55 +01:00
${t.node===e.showform?((e,t)=>{const n=qy("Cancel");return nh`
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>
2023-12-29 14:11:55 +01:00
${t.alert?nh`<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-12-29 14:11:55 +01:00
${t.actions.map((t=>nh`<input data-action="${t}"
2023-02-17 12:24:37 +01:00
@click=${t=>e.executeAction(t)}
type="button"
class="btn btn-primary"
2023-06-25 15:59:31 +02:00
value="${bb[t]}">`))}<input type="button"
2023-02-17 12:24:37 +01:00
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-12-29 14:11:55 +01:00
`,Sb=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.classes?.includes("hor_centered")?nh`<div class="spinner__container"><converse-icon size="1em" class="fa fa-spinner spinner centered ${e.classes||""}"></converse-icon></div>`:nh`<converse-icon size="1em" class="fa fa-spinner spinner centered ${e.classes||""}"></converse-icon>`},xb=e=>{return e.image?nh`
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-12-29 14:11:55 +01:00
</svg>`:"";var t,n};var Eb=n(180),Ab={};Ab.styleTagTransform=i_(),Ab.setAttributes=e_(),Ab.insert=Yy().bind(null,"head"),Ab.domAPI=Qy(),Ab.insertStyleElement=n_();Jy()(Eb.Z,Ab);Eb.Z&&Eb.Z.locals&&Eb.Z.locals;Vl.elements.define("converse-avatar",class extends Gy{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||bl.DEFAULT_IMAGE_TYPE;let t;if(this.data?.data_uri)t=this.data?.data_uri;else{t="data:"+e+";base64,"+(this.data?.image||bl.DEFAULT_IMAGE)}return xb({classes:this.getAttribute("class"),height:this.height,width:this.width,image:t,image_type:e})}});const{I:Cb}=yh,$b=()=>document.createComment(""),kb=(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($b(),r),s=i.insertBefore($b(),r);n=new Cb(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},jb=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e;return e._$AI(t,n),e},Tb={},Ib=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}},Nb=2,Ob=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 Mb{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 Rb=(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),Rb(e,t);return!0},Db=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))},zb=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),Fb(t)}};function Lb(e){void 0!==this._$AN?(Db(this),this._$AM=e,zb(this)):this._$AM=e}function Pb(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++)Rb(s[e],!1),Db(s[e]);else null!=s&&(Rb(s,!1),Db(s));else Rb(this,e)}const Fb=e=>{var t,n,s,i;e.type==Nb&&(null!==(t=(s=e)._$AP)&&void 0!==t||(s._$AP=Pb),null!==(n=(i=e)._$AQ)&&void 0!==n||(i._$AQ=Lb))};class Ub extends Mb{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),zb(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&&(Rb(this,e),Db(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 Bb{constructor(e){this.G=e}disconnect(){this.G=void 0}reconnect(e){this.G=e}deref(){return this.G}}class qb{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){var e;null!==(e=this.Y)&&void 0!==e||(this.Y=new Promise((e=>this.Z=e)))}resume(){var e;null===(e=this.Z)||void 0===e||e.call(this),this.Y=this.Z=void 0}}const Hb=e=>!(e=>null===e||"object"!=typeof e&&"function"!=typeof e)(e)&&"function"==typeof e.then,Gb=1073741823;const Wb=Ob(class extends Ub{constructor(){super(...arguments),this._$C_t=Gb,this._$Cwt=[],this._$Cq=new Bb(this),this._$CK=new qb}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=>!Hb(e))))&&void 0!==e?e:sh}update(e,t){const n=this._$Cwt;let s=n.length;this._$Cwt=t;const i=this._$Cq,r=this._$CK;this.isConnected||this.disconnected();for(let e=0;e
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-12-29 14:11:55 +01:00
${i?nh`<div class="row"><strong>${qy("Nickname")}:</strong></div><div class="row">${i}</div>`:""}
2022-12-17 22:08:36 +01:00
</li>
<li>
2023-12-29 14:11:55 +01:00
${n?nh`<div class="row"><strong>${qy("XMPP Address")}:</strong></div><div class="row">${n}</div>`:""}
2022-12-17 22:08:36 +01:00
</li>
<li>
2023-12-29 14:11:55 +01:00
<div class="row"><strong>${qy("Affiliation")}:</strong></div>
2023-06-25 15:59:31 +02:00
<div class="row">${a}&nbsp;
2023-12-29 14:11:55 +01:00
${d?nh`
2023-06-25 15:59:31 +02:00
<a href="#"
data-form="affiliation-form"
class="toggle-form right"
color="var(--subdued-color)"
@click=${t=>e.toggleForm(t)}><converse-icon class="fa fa-wrench" size="1em"></converse-icon>
</a>
2023-12-29 14:11:55 +01:00
${e.show_affiliation_form?nh`<converse-muc-affiliation-form jid=${n} .muc=${l} affiliation=${a}></converse-muc-affiliation-form>`:""}`:""}
2023-06-25 15:59:31 +02:00
</div>
2022-12-17 22:08:36 +01:00
</li>
<li>
2023-12-29 14:11:55 +01:00
<div class="row"><strong>${qy("Role")}:</strong></div>
2023-06-25 15:59:31 +02:00
<div class="row">${o}&nbsp;
2023-12-29 14:11:55 +01:00
${d&&o?nh`
2023-06-25 15:59:31 +02:00
<a href="#"
data-form="row-form"
class="toggle-form right"
color="var(--subdued-color)"
@click=${t=>e.toggleForm(t)}><converse-icon class="fa fa-wrench" size="1em"></converse-icon>
</a>
2023-12-29 14:11:55 +01:00
${e.show_role_form?nh`<converse-muc-role-form jid=${n} .muc=${l} role=${o}></converse-muc-role-form>`:""}`:""}
2023-06-25 15:59:31 +02:00
</div>
2022-12-17 22:08:36 +01:00
</li>
<li>
2023-12-29 14:11:55 +01:00
${c?nh`<div class="row"><strong>${qy("Hats")}:</strong></div><div class="row">${c}</div>`:""}
2022-12-17 22:08:36 +01:00
</li>
<li>
2023-12-29 14:11:55 +01:00
${r?nh`<div class="row"><strong>${qy("Occupant Id")}:</strong></div><div class="row">${r}</div>`:""}
2022-12-17 22:08:36 +01:00
</li>
2023-12-29 14:11:55 +01:00
${Wb(f,"")}
2022-12-17 22:08:36 +01:00
</ul>
</div>
</div>
2023-12-29 14:11:55 +01:00
`})(this)}getModalTitle(){const e=this.model??this.message;return e?.getDisplayName()}addToContacts(){const e=(this.model??this.message).get("jid");e&&Vl.modal.show("converse-add-contact-modal",{model:new dr({jid:e})})}toggleForm(e){"row-form"===Vb.ancestor(e.target,".toggle-form").getAttribute("data-form")?this.show_role_form=!this.show_role_form:this.show_affiliation_form=!this.show_affiliation_form,this.render()}});const Qb=(e,t)=>nh`
2023-06-25 15:59:31 +02:00
<li class="list-group-item" data-nick="${t.item.nick}">
2022-12-17 22:08:36 +01:00
<ul class="list-group">
<li class="list-group-item active">
2023-06-25 15:59:31 +02:00
<div><strong>JID:</strong> ${t.item.jid}</div>
2022-12-17 22:08:36 +01:00
</li>
<li class="list-group-item">
2023-06-25 15:59:31 +02:00
<div><strong>Nickname:</strong> ${t.item.nick}</div>
2022-12-17 22:08:36 +01:00
</li>
<li class="list-group-item">
2023-12-29 14:11:55 +01:00
<div><strong>Role:</strong> ${t.item.role} ${t.assignable_roles.length?(e=>nh`
2023-06-25 15:59:31 +02:00
<a href="#" data-form="converse-muc-role-form" class="toggle-form right" color="var(--subdued-color)" @click=${e.toggleForm}>
2022-12-17 22:08:36 +01:00
<converse-icon class="fa fa-wrench" size="1em"></converse-icon>
2023-06-25 15:59:31 +02:00
</a>`)(t):""}</div>
2023-12-29 14:11:55 +01:00
${t.assignable_roles.length?nh`<converse-muc-role-form class="hidden" .muc=${e.muc} jid=${t.item.jid} role=${t.item.role}></converse-muc-role-form>`:""}
2022-12-17 22:08:36 +01:00
</li>
</ul>
</li>
2023-12-29 14:11:55 +01:00
`,Kb=(e,t)=>nh`
2023-06-25 15:59:31 +02:00
<li class="list-group-item" data-nick="${t.item.nick}">
2022-12-17 22:08:36 +01:00
<ul class="list-group">
<li class="list-group-item active">
2023-06-25 15:59:31 +02:00
<div><strong>JID:</strong> ${t.item.jid}</div>
2022-12-17 22:08:36 +01:00
</li>
<li class="list-group-item">
2023-06-25 15:59:31 +02:00
<div><strong>Nickname:</strong> ${t.item.nick}</div>
2022-12-17 22:08:36 +01:00
</li>
<li class="list-group-item">
2023-12-29 14:11:55 +01:00
<div><strong>Affiliation:</strong> ${t.item.affiliation} ${t.assignable_affiliations.length?(e=>nh`
2023-06-25 15:59:31 +02:00
<a href="#" data-form="converse-muc-affiliation-form" class="toggle-form right" color="var(--subdued-color)" @click=${e.toggleForm}>
2022-12-17 22:08:36 +01:00
<converse-icon class="fa fa-wrench" size="1em"></converse-icon>
2023-06-25 15:59:31 +02:00
</a>`)(t):""}</div>
2023-12-29 14:11:55 +01:00
${t.assignable_affiliations.length?nh`<converse-muc-affiliation-form class="hidden" .muc=${e.muc} jid=${t.item.jid} affiliation=${t.item.affiliation}></converse-muc-affiliation-form>`:""}
2022-12-17 22:08:36 +01:00
</li>
</ul>
</li>
2023-12-29 14:11:55 +01:00
`,Yb=(e,t)=>{const n=qy("Affiliation"),s=qy("No users with that affiliation found."),i=qy("No users with that role found."),r=qy("Type here to filter the search results"),o=qy("Role"),a=qy("Show users"),c=qy("Roles are assigned to users to grant or deny them certain abilities in a multi-user chat. They're assigned either explicitly or implicitly as part of an affiliation. A role that's not due to an affiliation, is only valid for the duration of the user's session."),l=qy("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."),d=t.queryable_roles.length&&t.queryable_affiliations.length;return nh`
${t.alert_message?nh`<div class="alert alert-${t.alert_type}" role="alert">${t.alert_message}</div>`:""}
${d?(e=>nh`
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>
2023-06-25 15:59:31 +02:00
`)(t):""}
2022-12-17 22:08:36 +01:00
<div class="tab-content">
2023-12-29 14:11:55 +01:00
${t.queryable_affiliations.length?nh`
2023-06-25 15:59:31 +02:00
<div class="tab-pane tab-pane--columns ${"affiliations"===t.tab?"active":""}" id="affiliations-tabpanel" role="tabpanel" aria-labelledby="affiliations-tab">
<form class="converse-form query-affiliation" @submit=${t.queryAffiliation}>
<p class="helptext pb-3">${l}</p>
2022-12-17 22:08:36 +01:00
<div class="form-group">
<label for="affiliation">
2023-06-25 15:59:31 +02:00
<strong>${n}:</strong>
2022-12-17 22:08:36 +01:00
</label>
<div class="row">
<div class="col">
<select class="custom-select select-affiliation" name="affiliation">
2023-12-29 14:11:55 +01:00
${t.queryable_affiliations.map((e=>(e=>nh`
2022-12-17 22:08:36 +01:00
<option value="${e.item||""}"
?selected=${e.item===e.affiliation}
2023-06-25 15:59:31 +02:00
title="${Zb(e.item)}">${e.item}</option>
`)(Object.assign({item:e},t))))}
2022-12-17 22:08:36 +01:00
</select>
</div>
<div class="col">
2023-06-25 15:59:31 +02:00
<input type="submit" class="btn btn-primary" name="users_with_affiliation" value="${a}"/>
2022-12-17 22:08:36 +01:00
</div>
</div>
<div class="row">
<div class="col mt-3">
2023-12-29 14:11:55 +01:00
${Array.isArray(t.users_with_affiliation)&&t.users_with_affiliation.length>5?nh`<input class="form-control" .value="${t.affiliations_filter}" @keyup=${t.filterAffiliationResults} type="text" name="filter" placeholder="${r}"/>`:""}
2022-12-17 22:08:36 +01:00
</div>
</div>
2023-12-29 14:11:55 +01:00
${Zb(t.affiliation)?nh`<div class="row"><div class="col pt-2"><p class="helptext pb-3">${Zb(t.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-12-29 14:11:55 +01:00
${t.loading_users_with_affiliation?nh`<li class="list-group-item"> ${Sb()} </li>`:""}
${Array.isArray(t.users_with_affiliation)&&0===t.users_with_affiliation.length?nh`<li class="list-group-item">${s}</li>`:""}
2022-12-17 22:08:36 +01:00
2023-12-29 14:11:55 +01:00
${t.users_with_affiliation instanceof Error?nh`<li class="list-group-item">${t.users_with_affiliation.message}</li>`:(t.users_with_affiliation||[]).map((n=>(n.nick||n.jid).match(new RegExp(t.affiliations_filter,"i"))?Kb(e,Object.assign({item:n},t)):""))}
2022-12-17 22:08:36 +01:00
</ul>
</div>
</div>`:""}
2023-12-29 14:11:55 +01:00
${t.queryable_roles.length?nh`
2023-06-25 15:59:31 +02:00
<div class="tab-pane tab-pane--columns ${"roles"===t.tab?"active":""}" id="roles-tabpanel" role="tabpanel" aria-labelledby="roles-tab">
<form class="converse-form query-role" @submit=${t.queryRole}>
<p class="helptext pb-3">${c}</p>
2022-12-17 22:08:36 +01:00
<div class="form-group">
2023-06-25 15:59:31 +02:00
<label for="role"><strong>${o}:</strong></label>
2022-12-17 22:08:36 +01:00
<div class="row">
<div class="col">
<select class="custom-select select-role" name="role">
2023-12-29 14:11:55 +01:00
${t.queryable_roles.map((e=>(e=>nh`
2022-12-17 22:08:36 +01:00
<option value="${e.item||""}"
?selected=${e.item===e.role}
2023-06-25 15:59:31 +02:00
title="${Jb(e.item)}">${e.item}</option>
`)(Object.assign({item:e},t))))}
2022-12-17 22:08:36 +01:00
</select>
</div>
<div class="col">
2023-06-25 15:59:31 +02:00
<input type="submit" class="btn btn-primary" name="users_with_role" value="${a}"/>
2022-12-17 22:08:36 +01:00
</div>
</div>
<div class="row">
<div class="col mt-3">
2023-12-29 14:11:55 +01:00
${Array.isArray(t.users_with_role)&&t.users_with_role.length>5?nh`<input class="form-control" .value="${t.roles_filter}" @keyup=${t.filterRoleResults} type="text" name="filter" placeholder="${r}"/>`:""}
2022-12-17 22:08:36 +01:00
</div>
</div>
2023-12-29 14:11:55 +01:00
${Jb(t.role)?nh`<div class="row"><div class="col pt-2"><p class="helptext pb-3">${Jb(t.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-12-29 14:11:55 +01:00
${t.loading_users_with_role?nh`<li class="list-group-item"> ${Sb()} </li>`:""}
${t.users_with_role&&0===t.users_with_role.length?nh`<li class="list-group-item">${i}</li>`:""}
2023-06-25 15:59:31 +02:00
${(t.users_with_role||[]).map((n=>n.nick.match(t.roles_filter)?Qb(e,Object.assign({item:n},t)):""))}
2022-12-17 22:08:36 +01:00
</ul>
</div>
</div>`:""}
2023-12-29 14:11:55 +01:00
</div>`};var Xb=n(6205),ew={};ew.styleTagTransform=i_(),ew.setAttributes=e_(),ew.insert=Yy().bind(null,"head"),ew.domAPI=Qy(),ew.insertStyleElement=n_();Jy()(Xb.Z,ew);Xb.Z&&Xb.Z.locals&&Xb.Z.locals;const{u:tw}=Ah.env;Vl.elements.define("converse-modtools",class extends Gy{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="",this.addEventListener("affiliationChanged",(()=>{this.alert(qy("Affiliation changed"),"primary"),this.onSearchAffiliationChange(),this.requestUpdate()})),this.addEventListener("roleChanged",(()=>{this.alert(qy("Role changed"),"primary"),this.requestUpdate()}))}updated(e){e.has("role")&&this.onSearchRoleChange(),e.has("affiliation")&&this.onSearchAffiliationChange(),e.has("jid")&&e.get("jid")&&this.initialize()}async initialize(){this.initialized=Ao();const e=await Vl.rooms.get(this.jid);await e.initialized,this.muc=e,this.initialized.resolve()}render(){if(this.muc?.occupants){const e=this.muc.occupants.getOwnOccupant();return Yb(this,{affiliations_filter:this.affiliations_filter,alert_message:this.alert_message,alert_type:this.alert_type,assignRole:e=>this.assignRole(e),assignable_affiliations:Bf(e),assignable_roles:ag(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:bf.filter((e=>!Vl.settings.get("modtools_disable_query").includes(e))),queryable_roles:_f.filter((e=>!Vl.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 Uf(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!og().includes(e)}toggleForm(e){e.stopPropagation(),e.preventDefault();const t=tw.ancestor(e.target,".toggle-form"),n=t.getAttribute("data-form"),s=tw.ancestor(t,".list-group-item").querySelector(n);tw.hasClass("hidden",s)?tw.removeClass("hidden",s):tw.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}});Vl.elements.define("converse-modtools-modal",class extends tb{constructor(e){super(e),this.id="converse-modtools-modal"}renderModal(){return nh`<converse-modtools jid=${this.jid}
${i==s.PASSWORD_REQUIRED?nh`<converse-muc-password-form class="muc-form-container" jid="${n}"></converse-muc-password-form>`:""}
${i==s.ENTERED?nh`<converse-muc-chatarea jid="${n}"></converse-muc-chatarea>`:""}
2023-06-25 15:59:31 +02:00
${i==s.CONNECTING?Sb():""}
2023-12-29 14:11:55 +01:00
${i==s.NICKNAME_REQUIRED?function(e){const t=e.get("jid");return Vl.settings.get("muc_show_logs_before_join")?nh`<converse-muc-chatarea jid="${t}"></converse-muc-chatarea>`:nh`<converse-muc-nickname-form jid="${t}"></converse-muc-nickname-form>`}(e.model):""}
${i==s.DISCONNECTED?nh`<converse-muc-disconnected jid="${n}"></converse-muc-disconnected>`:""}
${i==s.BANNED?nh`<converse-muc-disconnected jid="${n}"></converse-muc-disconnected>`:""}
${i==s.DESTROYED?nh`<converse-muc-destroyed jid="${n}"></converse-muc-destroyed>`:""}
`}function lw(e,t){t=t.trim();const n=document.createElement("li");if(n.setAttribute("aria-selected","false"),Vl.settings.get("muc_mention_autocomplete_show_avatar")){const t=document.createElement("img");let s="data:"+bl.DEFAULT_IMAGE_TYPE+";base64,"+bl.DEFAULT_IMAGE;if(bl.vcards){const t=bl.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 dw(){const e=[...await Vl.rooms.get(),...await Vl.contacts.get()],t=[...new Set(e.map((e=>nw.getDomainFromJid(e.get("jid")))))];return t}function uw(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=rw[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 hw(e,t,n,s){const i=iw[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(!sw.isValidJID(r)){const t=qy("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&&Vl.settings.get("auto_register_muc_nickname")&&(l.nick=c.get("nick")),Hf(i,e.get("jid"),[l]).then((()=>e.occupants.fetchMembers())).catch((t=>e.onCommandError(t)))}function mw(e,t){if(!e.verifyRoles(["moderator"]))return;let n=Vl.modal.get("converse-modtools-modal");n?(n.affiliation=t,n.render()):n=Vl.modal.create("converse-modtools-modal",{affiliation:t,jid:e.get("jid")}),n.show()}function fw(e,t){const n=e.model;if(t||n.get("type")!==bl.CHATROOMS_TYPE||Vl.settings.get("muc_disable_slash_commands")&&!Array.isArray(Vl.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 hw(n,i,r,["owner"]),!0;if("ban"===i&&o.includes(i))return hw(n,i,r,["admin","owner"]),!0;if("modtools"===i&&o.includes(i))return mw(n,r),!0;if("deop"===i&&o.includes(i))return uw(n,i,r,["admin","owner"]),!0;if("destroy"===i&&o.includes(i))return!n.verifyAffiliations(["owner"])||(aw(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 uw(n,i,r,[],["moderator"]),!0;if("mute"===i&&o.includes(i))return uw(n,i,r,[],["moderator"]),!0;if("member"===i&&o.includes(i))return hw(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=qy('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)?(hw(n,i,r,["owner"]),!0):"op"===i&&o.includes(i)?(uw(n,i,r,["admin","owner"]),!0):"register"===i&&o.includes(i)?(r.length>1?n.createMessage({message:qy("Error: invalid number of arguments"),type:"error"}):n.registerNickname().then((e=>{e&&n.createMessage({message:e,type:"error"})})),!0):"revoke"===i&&o.includes(i)?(hw(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?nh`<div class="alert alert-${e.alert_type}" role="alert">${e.alert}</div>`:""}
${e.note?nh`<p class="form-help">${e.note}</p>`:""}
2023-02-17 12:24:37 +01:00
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-06-25 15:59:31 +02:00
.getAutoCompleteList="${dw}"
2023-02-17 12:24:37 +01:00
required
placeholder="${r}"
2022-12-17 22:08:36 +01:00
name="jid">
</converse-autocomplete>
</label>
</fieldset>
<fieldset class="form-group">
2023-12-29 14:11:55 +01:00
${e.fetching?Sb():nh`<input type="submit" class="btn btn-primary" value="${i}">`}
2022-12-17 22:08:36 +01:00
</fieldset>
2023-12-29 14:11:55 +01:00
${"list-commands"===e.view?nh`
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>
2023-06-25 15:59:31 +02:00
${e.commands.map((t=>wb(e,t)))}
2022-12-17 22:08:36 +01:00
</ul>
</fieldset>`:""}
</form>
2023-12-29 14:11:55 +01:00
`},{Strophe:pw,sizzle:vw}=Ah.env;Vl.elements.define("converse-adhoc-commands",class extends Gy{static get properties(){return{alert:{type:String},alert_type:{type:String},commands:{type:Array},fetching:{type:Boolean},showform:{type:String},view:{type:String}}}constructor(){super(),this.view="choose-service",this.fetching=!1,this.showform="",this.commands=[]}render(){return gw(this)}async fetchCommands(e){e.preventDefault(),delete this.alert_type,delete this.alert,this.fetching=!0;const t=new FormData(e.target).get("jid").trim();let n;try{n=await Vl.disco.supports(pw.NS.ADHOC,t)}catch(e){Yc.error(e)}finally{this.fetching=!1}if(n)try{this.commands=await Vl.adhoc.getCommands(t),this.view="list-commands"}catch(e){return Yc.error(e),this.alert_type="danger",this.alert=qy("Sorry, an error occurred while looking for commands on that entity."),this.commands=[],void Yc.error(e)}else this.alert_type="danger",this.alert=qy("The specified entity doesn't support ad-hoc commands")}async toggleCommandForm(e){e.preventDefault();const t=e.target.getAttribute("data-command-node"),n=this.commands.filter((e=>e.node===t))[0];if(this.showform===t)this.showform="",this.requestUpdate();else{const e=await Vl.adhoc.fetchCommandForm(n);n.sessionid=e.sessionid,n.instructions=e.instructions,n.fields=e.fields,n.actions=e.actions,this.showform=t}}executeAction(e){e.preventDefault();const t=e.target.getAttribute("data-action");["execute","next","prev","complete"].includes(t)?this.runCommand(e.target.form,t):Yc.error(`Unknown action: ${t}`)}clearCommand(e){delete e.alert,delete e.instructions,delete e.sessionid,delete e.alert_type,e.fields=[],e.acions=[],this.showform=""}async runCommand(e,t){const n=new FormData(e),s=n.get("command_jid").trim(),i=n.get("command_node").trim(),r=this.commands.filter((e=>e.node===i))[0];delete r.alert,this.requestUpdate();const o="prev"===t?[]:vw(":input:not([type=button]):not([type=submit])",e).filter((e=>!["command_jid","command_node"].includes(e.getAttribute("name")))).map(N_).filter((e=>e)),a=await Vl.adhoc.runCommand(s,r.sessionid,r.node,t,o),{fields:c,status:l,note:d,instructions:u,actions:h}=a;if("error"===l)return r.alert_type="danger",r.alert=qy("Sorry, an error occurred while trying to execute the command. See the developer console for details"),this.requestUpdate();"executing"===l?(r.alert=qy("Executing"),r.fields=c,r.instructions=u,r.alert_type="primary",r.actions=h):"completed"===l?(this.alert_type="primary",this.alert=qy("Completed"),this.note=d,this.clearCommand(r)):(Yc.error(`Unexpected status for ad-hoc command: ${l}`),r.alert=qy("Completed"),r.alert_type="primary"),this.requestUpdate()}async cancel(e){e.preventDefault(),this.showform="",this.requestUpdate();const t=new FormData(e.target.form),n=t.get("command_jid").trim(),s=t.get("command_node").trim(),i=this.commands.filter((e=>e.node===s))[0];delete i.alert,this.requestUpdate();const{status:r}=await Vl.adhoc.runCommand(n,i.sessionid,i.node,"cancel",[]);"error"===r?(i.alert_type="danger",i.alert=qy("An error occurred while trying to cancel the command. See the developer console for details")):"canceled"===r?(this.alert_type="",this.alert="",this.clearCommand(i)):(Yc.error(`Unexpected status for ad-hoc command: ${r}`),i.alert=qy("Error: unexpected result"),i.alert_type="danger"),this.requestUpdate()}}),Ah.plugins.add("converse-adhoc-views",{dependencies:["converse-controlbox","converse-muc"],initialize(){Vl.settings.extend({allow_adhoc_commands:!0})}});const yw=function(e,t,n){t=Dt(t,e);var s=null==(e=Hi(e,t))?e:e[zt(Bi(t))];return null==s?void 0:ke(s,e,n)};var _w=Re((function(e,t,n){var s=-1,i="function"==typeof t,r=be(e)?Array(e.length):[];return sl(e,(function(e){r[++s]=i?ke(t,e,n):yw(e,t,n)})),r}));const bw=_w;function ww(e,t){if(Vl.settings.get("allow_bookmarks")&&e.model.get("type")===bl.CHATROOMS_TYPE){const n={i18n_title:qy("Bookmark this groupchat"),i18n_text:qy("Bookmark"),handler:t=>e.showBookmarkModal(t),a_class:"toggle-bookmark",icon_class:"fa-bookmark",name:"bookmark"},s=t.map((e=>e.name)).indexOf("details"),i=Dg().then((e=>e?n:null));
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-12-29 14:11:55 +01:00
`};var Cw=n(5422),$w={};$w.styleTagTransform=i_(),$w.setAttributes=e_(),$w.insert=Yy().bind(null,"head"),$w.domAPI=Qy(),$w.insertStyleElement=n_();Jy()(Cw.Z,$w);Cw.Z&&Cw.Z.locals&&Cw.Z.locals;class kw extends Gy{async initialize(){await Vl.waitUntil("bookmarksInitialized");const{bookmarks:e,chatboxes:t}=bl;this.liveFilter=Il((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-${bl.bare_jid}`;this.model=new dr({id:n}),vc(this.model,n),this.listenTo(this.model,"change",(()=>this.requestUpdate())),this.model.fetch({success:()=>this.requestUpdate(),error:()=>this.requestUpdate()})}render(){return bl.bookmarks&&this.model?(e=>{const t=qy("Filter"),n=e.model.get("filter_text"),{bookmarks:s}=bl,i=n?s.filter((e=>((e,t)=>e.get("name")?.includes(t)||e.get("jid")?.includes(t))(e,n))):s;return nh`
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-12-29 14:11:55 +01:00
`})(this):Sb()}clearFilter(e){e?.stopPropagation?.(),this.model.set("filter_text","")}}Vl.elements.define("converse-bookmarks",kw);Vl.elements.define("converse-bookmark-list-modal",class extends tb{renderModal(){return nh`<converse-bookmarks></converse-bookmarks>`}getModalTitle(){return qy("Bookmarks")}});class jw extends Gy{static get properties(){return{jid:{type:String}}}willUpdate(e){e.has("jid")&&(this.model=bl.chatboxes.get(this.jid),this.bookmark=bl.bookmarks.get(this.jid))}render(){return(e=>{const t=e.model.getDisplayName(),n=e.bookmark?.get("nick")??e.model.get("nick"),s=qy('Bookmark for "%1$s"',t),i=qy("Would you like this groupchat to be automatically joined upon startup?"),r=qy("Remove"),o=qy("The name for this bookmark:"),a=qy("What should your nickname for this groupchat be?"),c=e.bookmark?qy("Update"):qy("Save");return nh`
2023-02-17 12:24:37 +01:00
<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">
2023-06-25 15:59:31 +02:00
<input class="form-check-input" id="converse_muc_bookmark_autojoin" type="checkbox" ?checked=${e.bookmark?.get("autojoin")} 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-12-29 14:11:55 +01:00
${e.bookmark?nh`<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-12-29 14:11:55 +01:00
`})(this)}onBookmarkFormSubmitted(e){e.preventDefault(),bl.bookmarks.createBookmark({jid:this.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)}}Vl.elements.define("converse-muc-bookmark-form",jw);const Tw=jw;Vl.elements.define("converse-bookmark-form-modal",class extends tb{renderModal(){return nh`
2022-12-17 22:08:36 +01:00
<converse-muc-bookmark-form class="muc-form-container" jid="${this.jid}">
2023-12-29 14:11:55 +01:00
</converse-muc-bookmark-form>`}getModalTitle(){return qy("Bookmark")}});const{u:Iw}=Ah.env,Nw={setBookmarkState(){if(void 0!==bl.bookmarks){bl.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 bl.MUCBookmarkForm({model:this.model,chatroomview:this});this.querySelector(".chatroom-body").insertAdjacentElement("beforeend",this.bookmark_form.el)}Iw.showElement(this.bookmark_form.el)},showBookmarkModal(e){e?.preventDefault();const t=this.model.get("jid");Vl.modal.show("converse-bookmark-form-modal",{jid:t},e)}};Ah.plugins.add("converse-bookmark-views",{dependencies:["converse-chatboxes","converse-muc","converse-muc-views"],initialize(){Vl.settings.extend({hide_open_bookmarks:!0}),bl.removeBookmarkViaEvent=Sw,bl.addBookmarkViaEvent=xw,Object.assign(bl.ChatRoomView.prototype,Nw),bl.MUCBookmarkForm=Tw,bl.BookmarksView=kw,Vl.listen.on("getHeadingButtons",ww),Vl.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=Ob(class extends Mb{constructor(e){if(super(e),e.type!==Nb)throw Error("repeat() can only be used in text expressions")}dt(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.dt(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.dt(n,s,i);if(!Array.isArray(o))return this.ht=c,a;const l=null!==(r=this.ht)&&void 0!==r?r:this.ht=[],d=[];let u,h,m=0,f=o.length-1,g=0,p=a.length-1;for(;m<=f&&g<=p;)if(null===o[m])m++;else if(null===o[f])f--;else if(l[m]===c[g])d[g]=jb(o[m],a[g]),m++,g++;else if(l[f]===c[p])d[p]=jb(o[f],a[p]),f--,p--;else if(l[m]===c[p])d[p]=jb(o[m],a[p]),kb(e,d[p+1],o[m]),m++,p--;else if(l[f]===c[g])d[g]=jb(o[f],a[g]),kb(e,o[m],o[f]),f--,g++;else if(void 0===u&&(u=Ow(c,g,p),h=Ow(l,m,f)),u.has(l[m]))if(u.has(l[f])){const t=h.get(c[g]),n=void 0!==t?o[t]:null;if(null===n){const t=kb(e,o[m]);jb(t,a[g]),d[g]=t}else d[g]=jb(n,a[g]),kb(e,o[m],n),o[t]=null;g++}else Ib(o[f]),f--;else Ib(o[m]),m++;for(;g<=p;){const t=kb(e,d[p+1]);jb(t,a[g]),d[g++]=t}for(;m<=f;){const e=o[m++];null!==e&&Ib(e)}return this.ht=c,function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Tb;e._$AH=t}(e,d),sh}});function Rw(e){const{CONTROLBOX_TYPE:t}=bl,n="overlayed"===Vl.settings.get("view_mode")&&e.get("minimized");return e.get("type")===t||!(e.get("hidden")||n)}Vl.elements.define("converse-chats",class extends Gy{initialize(){this.model=bl.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(bl,"connected",(()=>this.requestUpdate())),this.listenTo(bl,"reconnected",(()=>this.requestUpdate())),this.listenTo(bl,"disconnected",(()=>this.requestUpdate()));const e=wc();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()&&bh(nh`
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-12-29 14:11:55 +01:00
${"overlayed"===Vl.settings.get("view_mode")?nh`<div class="converse-brand__padding"></div>`:""}
</div>`,t);document.querySelector("body").classList.add(`converse-${Vl.settings.get("view_mode")}`),Vl.trigger("chatBoxViewsInitialized")}render(){return(()=>{const{chatboxes:e,CONTROLBOX_TYPE:t,CHATROOMS_TYPE:n,HEADLINES_TYPE:s}=bl,i=Vl.settings.get("view_mode"),r=bl?.connection,o=!r?.connected||!r?.authenticated||r?.disconnecting;return nh`
${o||"overlayed"!==i?"":nh`<converse-minimized-chats></converse-minimized-chats>`}
${Mw(e.filter(Rw),(e=>e.get("jid")),(e=>e.get("type")===t?nh`
${"overlayed"===i?nh`<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-12-29 14:11:55 +01:00
`:e.get("type")===n?nh`
2021-11-11 22:06:49 +01:00
<converse-muc jid="${e.get("jid")}" class="chatbox chatroom"></converse-muc>
2023-12-29 14:11:55 +01:00
`:e.get("type")===s?nh`
2021-11-11 22:06:49 +01:00
<converse-headlines jid="${e.get("jid")}" class="chatbox headlines"></converse-headlines>
2023-12-29 14:11:55 +01:00
`:nh`
2021-11-11 22:06:49 +01:00
<converse-chat jid="${e.get("jid")}" class="chatbox"></converse-chat>
`))}
2023-12-29 14:11:55 +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(9989),Pw={};Pw.styleTagTransform=i_(),Pw.setAttributes=e_(),Pw.insert=Yy().bind(null,"head"),Pw.domAPI=Qy(),Pw.insertStyleElement=n_();Jy()(Lw.Z,Pw);Lw.Z&&Lw.Z.locals&&Lw.Z.locals;Ah.plugins.add("converse-chatboxviews",{dependencies:["converse-chatboxes","converse-vcard"],initialize(){Vl.promises.add(["chatBoxViewsInitialized"]),Vl.settings.extend({animate:!0}),bl.chatboxviews=new Dw,Vl.listen.on("chatBoxesInitialized",(()=>{bl.chatboxes.on("destroy",(e=>bl.chatboxviews.remove(e.get("jid"))))})),Vl.listen.on("cleanup",(()=>delete bl.chatboxviews)),Vl.listen.on("clearSession",(()=>bl.chatboxviews.closeAllChatBoxes())),Vl.listen.on("chatBoxViewsInitialized",zw),window.addEventListener("resize",zw),Object.assign(Ah,{insertInto(e){const t=bl.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(4912),Uw={};Uw.styleTagTransform=i_(),Uw.setAttributes=e_(),Uw.insert=Yy().bind(null,"head"),Uw.domAPI=Qy(),Uw.insertStyleElement=n_();Jy()(Fw.Z,Uw);Fw.Z&&Fw.Z.locals&&Fw.Z.locals;const{Strophe:Bw,u:qw}=Ah.env;class Hw extends Gy{static get properties(){return{is_retracted:{type:Boolean},model:{type:Object}}}initialize(){const e=wc();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 nh`${Wb(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?nh`<converse-dropdown
2021-11-11 22:06:49 +01:00
class="chat-msg__actions ${e?"dropup dropup--left":"dropleft"}"
.items=${t}
2023-12-29 14:11:55 +01:00
></converse-dropdown>`:""}static getActionsDropdownItem(e){return nh`
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-12-29 14:11:55 +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 Vl.confirm(qy("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 Yc.error("onMessageRetractButtonClicked called for someone else's message!");const e=qy("Be aware that other XMPP/Jabber clients (and servers) may not yet support retractions and that this message may not be removed everywhere."),t=[qy("Are you sure you want to retract this message?")];Vl.settings.get("show_retraction_warning")&&(t[1]=e);if(await Vl.confirm(qy("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=qy("A timeout occurred while trying to retract the message");Vl.alert("error",qy("Error"),e),Yc(e,Bw.LogLevel.WARN)}else if(qw.isErrorStanza(n)){const e=qy("Sorry, you're not allowed to retract this message.");Vl.alert("error",qy("Error"),e),Yc(e,Bw.LogLevel.WARN),Yc(n,Bw.LogLevel.WARN)}}async onMUCMessageRetractButtonClicked(){const e=qy("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=[qy("Are you sure you want to retract this message?")];if(Vl.settings.get("show_retraction_warning")&&(t[1]=e),await Vl.confirm(qy("Confirm"),t)){this.model.collection.chatbox.retractOwnMessage(this.model)}}else if(await this.model.mayBeModerated())if("me"===this.model.get("sender")){let t=[qy("Are you sure you want to retract this message?")];Vl.settings.get("show_retraction_warning")&&(t=[t[0],e,t[1]]),await Vl.confirm(qy("Confirm"),t)&&this.retractOtherMessage()}else{let t=[qy("You are about to retract this message."),qy("You may optionally include a message, explaining the reason for the retraction.")];Vl.settings.get("show_retraction_warning")&&(t=[t[0],e,t[1]]);const n=await Vl.prompt(qy("Message Retraction"),t,qy("Optional reason"));!1!==n&&this.retractOtherMessage(n)}else{const e=qy("Sorry, you're not allowed to retract this message");Vl.alert("error",qy("Error"),e)}}onMessageRetractButtonClicked(e){e?.preventDefault?.();this.model.collection.chatbox.get("type")===bl.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=Vl.settings.get("render_media");return Array.isArray(t)?e.reduce(((e,n)=>e||!Fh(t,n)),!1):!t}getMediaURLs(){const e=(this.model.get("ogp_metadata")||[]).map((e=>({url:e["og:image"],is_image:!0}))).filter((e=>Hh(e))),t=Th(this.model.get("media_urls")||[],this.model.get("body")).filter((e=>Hh(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:qy(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")?qy("Cancel Editing"):qy("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-12-29 14:11:55 +01:00
@click=${e=>this.onControlsClicked(e)}><img class="gif" src="${this.src}"></a></canvas>`}renderErrorFallback(){return"url"===this.fallback?U_(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 Kw=(e,t)=>nh`<converse-gif autoplay noloop fallback='empty' src=${e}></converse-gif>${t?"":nh`<a target="_blank" rel="noopener" href="${e}">${e}</a>`}`,{URI:Yw}=Ah.env;const Xw=Ob(class extends Ub{render(e,t,n,s){return t?nh`<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 nh`<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-12-29 14:11:55 +01:00
@load=${n}/></a>`}onError(e,t,n,s){if(Gh(e))t&&this.setValue(U_(t));else{const i=new Yw(e),r=i.filename();i.filename(`${r}.png`),this.setValue(Xw(i.toString(),t,n,s))}}}),eS=e=>nh`${Xw(e.src||e.url,e.href,e.onLoad,e.onClick)}`;const tS=Ob(class extends Mb{render(e,t,n){const s=new SS(e,t,Object.assign(n,{show_images:!1,embed_videos:!1,embed_audio:!1}));return nh`${Wb(async function(e){try{await e.addTemplates()}catch(e){Yc.error(e)}return e.payload}(s),nh`${s}`)}`}}),nS=["*","_","~","`"],sS=[...nS,"```",">"],iS={"*":{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"}},rS=["_",">","`","~"],oS={emphasis:(e,t,n)=>nh`<span class="styling-directive">_</span><i>${tS(e,t,n)}</i><span class="styling-directive">_</span>`,preformatted:e=>nh`<span class="styling-directive">\`</span><code>${e}</code><span class="styling-directive">\`</span>`,preformatted_block:e=>nh`<div class="styling-directive">\`\`\`</div><code class="block">${e}</code><div class="styling-directive">\`\`\`</div>`,quote:(e,t,n)=>nh`<blockquote>${tS(e,t,n)}</blockquote>`,strike:(e,t,n)=>nh`<span class="styling-directive">~</span><del>${tS(e,t,n)}</del><span class="styling-directive">~</span>`,strong:(e,t,n)=>nh`<span class="styling-directive">*</span><b>${tS(e,t,n)}</b><span class="styling-directive">*</span>`};function aS(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(!sS.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(rS.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(lS(e)&&n>0&&"\n"!==t[n-1])return!1;if(nS.includes(e)&&t[n+1]===e)return!1}else{const s=RegExp(rS.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(nS.includes(e)&&t[n-1]===e)return!1}return!0}(n,e,t,s))return null}return n}function cS(e,t){const n=aS(e,t),s=n?function(e,t,n){if(!e)return 0;const s=n;if(n+=e.length,lS(e))return(n+=t.slice(n).split(/\n[^>]/).shift().length)-s;if("span"===iS[e].type){const s=t.slice(n).split("\n").shift();let i=0,r=s.indexOf(e);for(;-1!==r;){if(aS(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(aS(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 lS=e=>[">","&gt;"].includes(e);function dS(e,t,n,s){const i=oS[iS[e].name];if(lS(e)){return i(t.replace(/\n>\s/g,"\n").replace(/\n>/g,"\n").replace(/\n$/,""),n,s)}return i(t,n,s)}const{dayjs:uS,u:hS}=Ah.env;function mS(e){return e.then((e=>e.filter((e=>e.standalone)).map((e=>async function(e){const t=await e;return nh`
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-12-29 14:11:55 +01:00
`}(e))).reverse().map((e=>Wb(e,"")))))}function fS(e){return e.then((e=>{const t=e.filter((e=>!e.standalone)).map((e=>async function(e){const t=await e;return t?nh`
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-12-29 14:11:55 +01:00
`:""}(e)));return t.length?nh`<converse-dropdown class="chatbox-btn dropleft" .items=${t}></converse-dropdown>`:""}))}function gS(e){if(!e.isHidden()&&Vl.settings.get("allow_url_history_change")){const t=window.location.hash;t&&e.messages.get(t.slice(1))&&bl.router.history.navigate()}}const pS=Il((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,gS(t.model)):i&&Vl.trigger("chatBoxScrolledUp",t),t.model.get("scolled")!==n&&t.model.ui.set({scrolled:n})}(e)),50);function vS(e){const t=e.collection?.models;if(!t)return;const n=t.indexOf(e),s=t[n-1];if(!s||uS(e.get("time")).isAfter(uS(s.get("time")),"day")){const t=uS(e.get("time")).startOf("day");return(e=>nh`
2023-06-25 15:59:31 +02:00
<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>
2023-12-29 14:11:55 +01:00
`)({type:"date",time:t.toISOString(),datestring:t.format("dddd MMM Do YYYY")})}}function yS(e){if("groupchat"===e.get("type")){const t=Vl.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 _S(){var e;return Ah.emojis.toned||(Ah.emojis.toned=(e=Object.values(Ah.emojis.json.people).filter((e=>e.sn.includes("_tone"))).map((e=>e.sn.replace(/_tone[1-5]/,""))),[...new Set(e)])),Ah.emojis.toned}function bS(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(Vl.settings.get("use_system_emojis"))return t.add_title_wrapper&&s?nh`<span title="${s}">${n}</span>`:n;{const t=Vl.settings.get("emoji_image_path");return nh`<img class="emoji"
2022-05-05 23:06:17 +02:00
loading="lazy"
draggable="false"
title="${s}"
alt="${n}"
2023-12-29 14:11:55 +01:00
src="${t}/72x72/${e.cp}.png"/>`}}return t.unicode_only?s:nh`<img class="emoji"
2022-05-05 23:06:17 +02:00
loading="lazy"
draggable="false"
title="${s}"
alt="${s}"
2023-12-29 14:11:55 +01:00
src="${Ah.emojis.by_sn[s].url}">`}Object.assign(hS,{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[...lf(e),...df(e)].sort(((e,t)=>t.begin-e.begin)).forEach((e=>{const s=n.shift(),i=bS(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=cf(e),t)}});const wS=e=>"string"==typeof e;class SS 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:Uh(e,t)}addHyperlinks(e,t){const n=t+this.offset;Th(this.media_urls||nm(e,t).media_urls||[],e,n).filter((e=>!e.is_encrypted)).forEach((e=>{const n=e.url,s=Bh(n);let i;i=Wh(n)&&this.shouldRenderMedia(n,"image")?Kw(s,this.hide_media_urls):Zh(n)&&this.shouldRenderMedia(n,"image")?eS({src:s,href:this.hide_media_urls?null:s,onClick:this.onImgClick,onLoad:this.onImgLoad}):Jh(n)&&this.shouldRenderMedia(n,"video")?S_(s,this.hide_media_urls):Vh(n)&&this.shouldRenderMedia(n,"audio")?f_(s,this.hide_media_urls):U_(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,U_(e[0].replace(n,Vl.settings.get("geouri_replacement"))))}addEmojis(e,t){[...lf(e.toString()),...df(e.toString())].forEach((e=>{this.addTemplateResult(e.begin+t,e.end+t,bS(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=>nh`<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=>nh`<span class="mention" data-uri="${e.uri}">${e.mention}</span>`)({...s,mention:o}))}))}addStyling(){if(!function(e){for(let t=0;t<sS.length;t++)if(e.includes(sS[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}=cS(this,n);if(s&&i){const t=lS(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:dS(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&&(wS(s)?(e.call(this,s,n),n+=s.length):n=s.end)}async addTemplates(){await Vl.trigger("beforeMessageBodyTransformed",this,{Synchronous:!0}),this.render_styling&&this.addStyling(),this.addAnnotations(this.addMentions),this.addAnnotations(this.addHyperlinks),this.addAnnotations(this.addMapURLs),await Vl.emojis.initialize(),this.addAnnotations(this.addEmojis),await Vl.trigger("afterMessageBodyTransformed",this,{Synchronous:!0}),this.payload=this.marshall(),this.options.show_me_message&&this.trimMeMessage(),this.payload=this.payload.map((e=>wS(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-06-25 15:59:31 +02:00
${this.items.map((e=>Wb(e,"")))}
2021-11-11 22:06:49 +01:00
</div>
2023-12-29 14:11:55 +01:00
`}firstUpdated(){super.firstUpdated(),this.initArrowNavigation()}connectedCallback(){super.connectedCallback(),this.hideOnEscape=e=>e.keyCode===vo.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 MS(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!==vo.DOWN_ARROW||this.navigator.enabled||this.enableArrowNavigation(e)}}Vl.elements.define("converse-dropdown",PS);var FS=n(8211),US={};US.styleTagTransform=i_(),US.setAttributes=e_(),US.insert=Yy().bind(null,"head"),US.domAPI=Qy(),US.insertStyleElement=n_();Jy()(FS.Z,US);FS.Z&&FS.Z.locals&&FS.Z.locals;const{dayjs:BS}=Ah.env;Vl.elements.define("converse-message-versions",class extends Gy{static get properties(){return{model:{type:Object}}}constructor(){super(),this.model=null}render(){const e=this.model.get("older_versions"),t=Object.keys(e);return nh`
${t.length?nh`<h4>${qy("Older versions")}</h4> ${t.map((t=>((e,t)=>nh`<p class="older-msg"><time>${BS(e).format("MMM D, YYYY, HH:mm:ss")}</time>: ${t[e]}</p>`)(t,e)))}`:nh`<h4>${qy("No older versions found")}</h4>`}
2021-11-11 22:06:49 +01:00
<hr/>
2023-12-29 14:11:55 +01:00
<h4>${qy("Current version")}</h4>
<p><time>${BS(this.model.get("time")).format("MMM D, YYYY, HH:mm:ss")}</time>: ${this.model.getMessageText()}</p>`}});Vl.elements.define("converse-message-versions-modal",class extends tb{renderModal(){return nh`<converse-message-versions .model=${this.model}></converse-message-versions>`}getModalTitle(){return qy("Message versions")}});const qS=e=>{const t=void 0!==e.model.contact,n=qy("Refresh"),s=Vl.settings.get("allow_contact_removal");return nh`
2022-12-17 22:08:36 +01:00
<div class="modal-footer">
2023-06-25 15:59:31 +02:00
${Q_}
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-12-29 14:11:55 +01:00
${s&&t?(e=>{const t=qy("Remove as contact");return nh`
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-12-29 14:11:55 +01:00
`};function HS(e){bl.roster?.get(e.get("jid"))?.trigger("highlight")}function GS(e,t){const n=bl.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![bl.HEADER_REQUESTING_CONTACTS,bl.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 WS(e){const t=bl.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 VS=Ah.env.utils;Vl.elements.define("converse-user-details-modal",class extends tb{initialize(){super.initialize(),this.model.rosterContactAdded.then((()=>this.registerContactEventHandlers())),this.listenTo(this.model,"change",this.render),this.registerContactEventHandlers(),Vl.trigger("userDetailsModalInitialized",this.model)}renderModal(){return(e=>{const t=e.model?.vcard,n=t?t.toJSON():{},s={...e.model.toJSON(),...n},i=qy("XMPP Address"),r=qy("Email"),o=qy("Full Name"),a=qy("Nickname"),c=qy("The User's Profile Image"),l=qy("Role"),d=qy("URL"),u={alt_text:c,extra_classes:"mb-3",height:"120",width:"120"};return nh`
2022-12-17 22:08:36 +01:00
<div class="modal-body">
2023-12-29 14:11:55 +01:00
${s.image?nh`<div class="mb-4">${xb(Object.assign(s,u))}</div>`:""}
${s.fullname?nh`<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-12-29 14:11:55 +01:00
${s.nickname?nh`<p><label>${a}:</label> ${s.nickname}</p>`:""}
${s.url?nh`<p><label>${d}:</label> <a target="_blank" rel="noopener" href="${s.url}">${s.url}</a></p>`:""}
${s.email?nh`<p><label>${r}:</label> <a href="mailto:${s.email}">${s.email}</a></p>`:""}
${s.role?nh`<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-12-29 14:11:55 +01:00
`})(this)}renderModalFooter(){return qS(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");VS.addClass("fa-spin",t);try{await Vl.vcard.update(this.model.contact.vcard,!0)}catch(e){Yc.fatal(e),this.alert(qy("Sorry, something went wrong while trying to refresh"),"danger")}VS.removeClass("fa-spin",t)}async removeContact(e){if(e?.preventDefault?.(),!Vl.settings.get("allow_contact_removal"))return;await Vl.confirm(qy("Are you sure you want to remove this contact?"))&&(setTimeout((()=>function(e){e.removeFromRoster((()=>e.destroy()),(t=>{t&&Yc.error(t),Vl.alert("error",qy("Error"),[qy("Sorry, there was an error while trying to remove %1$s as a contact.",e.getDisplayName())])}))}(this.model.contact)),1),this.modal.hide())}});const{filesize:JS}=Ah.env,{dayjs:ZS}=Ah.env,{dayjs:QS}=Ah.env;function KS(e){return!!Lh(e).host()}Vl.elements.define("converse-image",class extends Gy{static get properties(){return{src:{type:String},onImgLoad:{type:Function},href:{type:String}}}constructor(){super(),this.src=null,this.href=null,this.onImgClick=null,this.onImgLoad=null}render(){return Wh(this.src)&&Uh(this.src,"image")?Kw(Bh(this.src),!0):eS({src:Bh(this.src),href:this.href,onClick:this.onImgClick,onLoad:this.onImgLoad})}});const YS=e=>{const t=(n=e.image)&&qh(n,"allowed_image_domains")&&KS(n);var n;const s=e.title||e.description||e.url;return t||s?nh`<div class="card card--unfurl">
${t?(e=>nh`<converse-image class="card-img-top hor_centered" href="${e.url}" src="${e.image}" .onImgLoad=${e.onload}></converse-image>`)(e):""}
${s?nh` <div class="card-body">
${e.title?((e,t)=>e.url&&KS(e.url)&&!Wh(e.image)?nh`<a href="${e.url}" target="_blank" rel="noopener">${t(e)}</a>`:t(e))(e,(e=>nh`<h5 class="card-title">${e.title}</h5>`)):""}
${e.description?nh`<p class="card-text">
2022-01-03 11:54:10 +01:00
<converse-rich-text text=${e.description}></converse-rich-text>
</p>`:""}
2023-12-29 14:11:55 +01:00
${e.url?nh`<p class="card-text">
<a href="${e.url}" target="_blank" rel="noopener">${Lh(e.url).domain()}</a>
2022-01-03 11:54:10 +01:00
</p>`:""}
</div>`:""}
2023-12-29 14:11:55 +01:00
</div>`:""};var XS=n(1165),ex={};ex.styleTagTransform=i_(),ex.setAttributes=e_(),ex.insert=Yy().bind(null,"head"),ex.domAPI=Qy(),ex.insertStyleElement=n_();Jy()(XS.Z,ex);XS.Z&&XS.Z.locals&&XS.Z.locals;Vl.elements.define("converse-message-unfurl",class extends Gy{static get properties(){return{description:{type:String},image:{type:String},jid:{type:String},title:{type:String},url:{type:String}}}initialize(){const e=wc();this.listenTo(e,"change:allowed_image_domains",(()=>this.requestUpdate())),this.listenTo(e,"change:render_media",(()=>this.requestUpdate()))}render(){return YS(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 tx=e=>{const t=qy("Show more"),n="groupchat"===e.model.get("type"),s=qy("Show less"),i=nh`
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-12-29 14:11:55 +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 nh`
2022-05-05 23:06:17 +02:00
${e.model.get("is_spoiler")?i:""}
2023-12-29 14:11:55 +01:00
${e.model.get("subject")?nh`<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-12-29 14:11:55 +01:00
${!e.model.get("received")||e.model.isMeCommand()||n?"":nh`<converse-icon size="1em" color="var(--chat-color)" class="fa fa-check chat-msg__receipt"></converse-icon>`}
${e.model.get("edited")?(e=>{const t=qy("This message has been edited");return nh`<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-12-29 14:11:55 +01:00
${a?nh`<div class="chat-msg__media">${R_(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-12-29 14:11:55 +01:00
`};var nx=n(563),sx={};sx.styleTagTransform=i_(),sx.setAttributes=e_(),sx.insert=Yy().bind(null,"head"),sx.domAPI=Qy(),sx.insertStyleElement=n_();Jy()(nx.Z,sx);nx.Z&&nx.Z.locals&&nx.Z.locals;const{Strophe:ix,dayjs:rx}=Ah.env;Vl.elements.define("converse-chat-message",class extends Gy{static get properties(){return{jid:{type:String},mid:{type:String}}}async initialize(){if(await this.setModels(),!this.model)return void Yc.error("Could not find module for converse-chat-message");const e=wc();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 Vl.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?Sb():this.model.get("file")&&this.model.get("upload")!==bl.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 nh`
2022-05-05 23:06:17 +02:00
<div class="retraction">${t}</div>
2023-12-29 14:11:55 +01:00
${e.model.get("moderation_reason")?nh`<q class="chat-msg--retracted__reason">${e.model.get("moderation_reason")}</q>`:""}`})(this)}renderMessageText(){return tx(this)}renderMEPMessage(){return(e=>{const t=QS(e.model.get("time")).toISOString();return nh`
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-12-29 14:11:55 +01:00
${e.isRetracted()?e.renderRetraction():nh`
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-12-29 14:11:55 +01:00
${e.model.get("reason")?nh`<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-12-29 14:11:55 +01:00
</div>`})(this)}renderInfoMessage(){return(e=>{const t=ZS(e.model.get("time")).toISOString(),n=qy("Retry");return nh`
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-12-29 14:11:55 +01:00
${e.model.get("reason")?nh`<q class="reason">${e.model.get("reason")}</q>`:""}
${e.model.get("error_text")?nh`<q class="reason">${e.model.get("error_text")}</q>`:""}
${e.model.get("retry_event_id")?nh`<a class="retry" @click=${e.onRetryClicked}>${n}</a>`:""}
</div>`})(this)}renderFileProgress(){return this.model.file?(e=>{const t=qy("Uploading file:"),n=e.model.file.name,s=JS(e.model.file.size);return nh`
2022-01-03 11:54:10 +01:00
<div class="message chat-msg">
2023-12-29 14:11:55 +01:00
${e.shouldShowAvatar()?nh`<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-12-29 14:11:55 +01:00
</div>`})(this):""}renderChatMessage(){return((e,t)=>{const n=qy("New messages"),s=e.model.isFollowup();return nh`
${t.is_first_unread?nh`<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-12-29 14:11:55 +01:00
${t.should_show_avatar&&!s?nh`<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-12-29 14:11:55 +01:00
${t.is_me_message||s?"":nh`
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-12-29 14:11:55 +01:00
${t.hats.map((e=>nh`<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-12-29 14:11:55 +01:00
${t.is_encrypted?nh`<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-12-29 14:11:55 +01:00
${t.is_me_message?nh`
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-12-29 14:11:55 +01:00
${e.model.get("ogp_metadata")?.map((t=>!0===e.model.get("hide_url_previews")?"":Uh(t["og:image"],"image")?nh`<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-12-29 14:11:55 +01:00
</div>`})(this,this.getProps())}shouldShowAvatar(){return Vl.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 Vl.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=Vl.settings.get("time_format");return{pretty_time:rx(this.model.get("edited")||this.model.get("time")).format(e),has_mentions:this.hasMentions(),hats:yS(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:ix.getResourceFromJid(e)}));const n=this.model.mod?this.model.mod.getDisplayName():"A moderator";return qy("%1$s has removed this message",n)}return qy("%1$s has removed this message",this.model.getDisplayName())}showUserModal(e){if("me"===this.model.get("sender"))Vl.modal.show("converse-profile-modal",{model:this.model},e);else if("groupchat"===this.model.get("type"))e.preventDefault(),Vl.modal.show("converse-muc-occupant-modal",{model:this.model.getOccupant(),message:this.model},e);else{e.preventDefault();const t=this.model.collection.chatbox;Vl.modal.show("converse-user-details-modal",{model:t},e)}}showMessageVersionsModal(e){e.preventDefault(),Vl.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")})}});Vl.elements.define("converse-message-history",class extends Gy{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=>nh`${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=Vl.hook(t,e,"");return Wb(n,"")}{const t=nh`<converse-chat-message
2021-11-11 22:06:49 +01:00
jid="${this.model.get("jid")}"
2023-12-29 14:11:55 +01:00
mid="${e.get("id")}"></converse-chat-message>`,n=vS(e);return n?[n,t]:t}}});var ox=n(4659),ax={};ax.styleTagTransform=i_(),ax.setAttributes=e_(),ax.insert=Yy().bind(null,"head"),ax.domAPI=Qy(),ax.insertStyleElement=n_();Jy()(ox.Z,ax);ox.Z&&ox.Z.locals&&ox.Z.locals;Vl.elements.define("converse-chat-content",class extends Gy{static get properties(){return{jid:{type:String}}}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("scroll",pS)}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",pS)}async setModels(){this.model=await Vl.chatboxes.get(this.jid),await this.model.initialized,this.requestUpdate()}render(){return this.model?nh`
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-06-25 15:59:31 +02:00
${this.model.ui?.get("chat-content-spinner-top")?Sb():""}
2023-12-29 14:11:55 +01:00
`:""}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;Vl.trigger("chatBoxScrolledDown",{chatbox:this.model})}}});class cx extends Mb{constructor(e){if(super(e),this.et=ih,e.type!==Nb)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===ih||null==e)return this.ft=void 0,this.et=e;if(e===sh)return e;if("string"!=typeof e)throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.et)return this.ft;this.et=e;const t=[e];return t.raw=t,this.ft={_$litType$:this.constructor.resultType,strings:t,values:[]}}}cx.directiveName="unsafeHTML",cx.resultType=1;const lx=Ob(cx);Vl.elements.define("converse-chat-help",class extends Gy{static get properties(){return{chat_type:{type:String},messages:{type:Array},model:{type:Object},type:{type:String}}}render(){const e=(new Date).toISOString();return[nh`<converse-icon class="fas fa-times close-chat-help"
2021-03-19 19:26:15 +01:00
@click=${this.close}
2023-12-29 14:11:55 +01:00
path-prefix="${Vl.settings.get("assets_path")}"
size="1em"></converse-icon>`,...this.messages.map((t=>this.renderHelpMessage({isodate:e,markup:wo().sanitize(t,{ALLOWED_TAGS:["strong"]})})))]}close(){this.model.set({show_help_messages:!1})}renderHelpMessage(e){return nh`<div class="message chat-${this.type}" data-isodate="${e.isodate}">${lx(e.markup)}</div>`}});const dx=Ah.env.utils,ux=e=>{const t=Vl.settings.get("emoji_categories");return nh`<ul>${Object.keys(t).map((n=>t[n]?(e=>nh`
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-12-29 14:11:55 +01:00
title="${qy(Vl.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-12-29 14:11:55 +01:00
`)(Object.assign({category:n,emoji:e.sn2Emoji(t[n])},e)):""))}</ul>`},hx=e=>nh`
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-12-29 14:11:55 +01:00
<a href="#" @click=${e.insertEmoji} data-emoji="${e.emoji.sn}">${dx.shortnamesToEmojis(e.emoji.sn)}</a>
2022-05-05 23:06:17 +02:00
</li>
2023-12-29 14:11:55 +01:00
`,mx=e=>{const t=Vl.settings.get("emoji_categories");return nh`
2022-05-05 23:06:17 +02:00
<span ?hidden=${e.query} class="emoji-lists__container emoji-lists__container--browse">
2023-12-29 14:11:55 +01:00
${Object.keys(t).map((n=>t[n]?(e=>nh`
<a id="emoji-picker-${e.category}" class="emoji-category__heading" data-category="${e.category}">${qy(Vl.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-12-29 14:11:55 +01:00
${Object.values(Ah.emojis.json[e.category]).map((t=>hx(Object.assign({emoji:t},e))))}
2022-05-05 23:06:17 +02:00
</ul>`)(Object.assign({category:n},e)):""))}
2023-12-29 14:11:55 +01:00
</span>`},fx=e=>{const t=qy("Search");return nh`
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-12-29 14:11:55 +01:00
${e.query?"":ux(e)}
2021-03-19 19:26:15 +01:00
</div>
2023-12-29 14:11:55 +01:00
${e.render_emojis?nh`<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-12-29 14:11:55 +01:00
<ul>${["tone1","tone2","tone3","tone4","tone5"].map((t=>(e=>nh`
2021-03-19 19:26:15 +01:00
<li data-skintone="${e.skintone}" class="emoji-skintone ${e.current_skintone===e.skintone?"picked":""}">
2023-12-29 14:11:55 +01:00
<a class="pick-skintone" href="#" data-skintone="${e.skintone}" @click=${e.onSkintonePicked}>${dx.shortnamesToEmojis(":"+e.skintone+":")}</a>
2021-11-11 22:06:49 +01:00
</li>`)(Object.assign({skintone:t},e))))}</ul>
2023-12-29 14:11:55 +01:00
</div>`},{sizzle:gx}=Ah.env;Vl.elements.define("converse-emoji-picker-content",class extends Gy{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 nh`
2021-03-19 19:26:15 +01:00
<div class="emoji-picker__lists">
2023-12-29 14:11:55 +01:00
${(e=>{const t=qy("Search results");return nh`
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-12-29 14:11:55 +01:00
${e.search_results.map((t=>hx(Object.assign({emoji:t},e))))}
2021-03-19 19:26:15 +01:00
</ul>
</span>
`})(e)}
2023-12-29 14:11:55 +01:00
${mx(e)}
2021-03-19 19:26:15 +01:00
</div>
2023-12-29 14:11:55 +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)}gx(".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&&_S().includes(e))return!0;return!(!this.query||bl.FILTER_CONTAINS(e,this.query))}});const px=Ah.env.utils;Vl.elements.define("converse-emoji-dropdown",class extends PS{static get properties(){return{chatview:{type:Object}}}constructor(){super(),this.render_emojis=!1}initModel(){return this.init_promise||(this.init_promise=(async()=>{await Vl.emojis.initialize();const e=`converse.emoji-${bl.bare_jid}-${this.chatview.model.get("jid")}`;this.model=new bl.EmojiPicker({id:e}),vc(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")===bl.CHATROOMS_TYPE?"--muc-toolbar-btn-color":"--chat-toolbar-btn-color";return nh`
2021-03-19 19:26:15 +01:00
<div class="dropup">
<button class="toggle-emojis"
2023-12-29 14:11:55 +01:00
title="${qy("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-12-29 14:11:55 +01:00
path-prefix="${Vl.settings.get("assets_path")}"
2021-03-19 19:26:15 +01:00
size="1em"></converse-icon>
</button>
<div class="dropdown-menu">
2023-12-29 14:11:55 +01:00
${Wb(this.initModel().then((()=>nh`
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-12-29 14:11:55 +01:00
</div>`}connectedCallback(){super.connectedCallback(),this.render_emojis=!1}toggleMenu(e){e.stopPropagation(),e.preventDefault(),px.hasClass("show",this.menu)?px.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 vx=n(4311),yx={};yx.styleTagTransform=i_(),yx.setAttributes=e_(),yx.insert=Yy().bind(null,"head"),yx.domAPI=Qy(),yx.insertStyleElement=n_();Jy()(vx.Z,yx);vx.Z&&vx.Z.locals&&vx.Z.locals;const _x=Ah.env.utils;Vl.elements.define("converse-emoji-picker",class extends Gy{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=Il((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 fx({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=>_x.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=bl.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=Ah.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===vo.ENTER&&_x.isVisible(this)?this.onEnterPressed(e):e.keyCode===vo.DOWN_ARROW&&!this.navigator.enabled&&_x.isVisible(this)?this.enableArrowNavigation(e):e.keyCode===vo.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
2023-06-25 15:59:31 +02:00
<span class="toolbar-buttons">${Wb(e.getButtons(),"")}</span>
2023-12-29 14:11:55 +01:00
${e.show_send_button?function(){const e=qy("Send the message");return nh`<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-12-29 14:11:55 +01:00
`;var wx=n(8899),Sx={};Sx.styleTagTransform=i_(),Sx.setAttributes=e_(),Sx.insert=Yy().bind(null,"head"),Sx.domAPI=Qy(),Sx.insertStyleElement=n_();Jy()(wx.Z,Sx);wx.Z&&wx.Z.locals&&wx.Z.locals;const xx=Ah.env.Strophe;Vl.elements.define("converse-chat-toolbar",class extends Gy{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 bx(this)}firstUpdated(){Vl.trigger("renderToolbar",this)}getButtons(){const e=[];if(this.show_emoji_button){const t=bl.chatboxviews.get(this.model.get("jid"));e.push(nh`<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=qy("Start a call");e.push(nh`
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-12-29 14:11:55 +01:00
</button>`)}Vl.settings.get("message_limit")&&e.push(nh`
2021-11-11 22:06:49 +01:00
<converse-message-limit-indicator .model=${this.model} class="right">
2023-12-29 14:11:55 +01:00
</converse-message-limit-indicator>`),this.show_spoiler_button&&e.push(this.getSpoilerButton());const t=Vl.disco.supports(xx.NS.HTTPUPLOAD,bl.domain);if(e.push(nh`${Wb(t.then((e=>this.getHTTPUploadButton(e))),"")}`),this.is_groupchat&&Vl.settings.get("visible_toolbar_buttons")?.toggle_occupants){const t=qy("Hide participants"),n=qy("Show participants");e.push(nh`
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-12-29 14:11:55 +01:00
</button>`)}return bl.api.hook("getToolbarButtons",this,e)}getHTTPUploadButton(e){if(e){const e=qy("Choose a file to send"),t=this.is_groupchat?"--muc-toolbar-btn-color":"--chat-toolbar-btn-color";return nh`
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-12-29 14:11:55 +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")?qy("Click to write as a normal (non-spoiler) message"):qy("Click to write your message as a spoiler");const n=this.is_groupchat?"--muc-toolbar-btn-color":"--chat-toolbar-btn-color",s=nh`
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-12-29 14:11:55 +01:00
</button>`;if(this.is_groupchat)return s;{const t=e.get("jid"),n=Promise.all(e.presence.resources.map((e=>Vl.disco.supports(xx.NS.SPOILER,`${t}/${e.get("name")}`)))).then((e=>e.reduce(((e,t)=>e&&t),!0)));return nh`${Wb(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?.(),Vl.trigger("callButtonClicked",{connection:bl.connection,model:this.model})}});var Ex=n(3584),Ax={};Ax.styleTagTransform=i_(),Ax.setAttributes=e_(),Ax.insert=Yy().bind(null,"head"),Ax.domAPI=Qy(),Ax.insertStyleElement=n_();Jy()(Ex.Z,Ax);Ex.Z&&Ex.Z.locals&&Ex.Z.locals;async function Cx(e){await Vl.confirm(qy("Are you sure you want to clear the messages from this conversation?"))&&await e.clearMessages()}function $x(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=""}Vl.elements.define("converse-chat-heading",class extends Gy{static get properties(){return{jid:{type:String}}}initialize(){this.model=bl.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=qy("The User's Profile Image"),n=nh`<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-12-29 14:11:55 +01:00
height="40" width="40"></converse-avatar></span>`,s=e.model.getDisplayName();return nh`
2021-11-11 22:06:49 +01:00
<div class="chatbox-title ${e.status?"":"chatbox-title--no-desc"}">
<div class="chatbox-title--row">
2023-12-29 14:11:55 +01:00
${bl.api.settings.get("singleton")?"":nh`<converse-controlbox-navback jid="${e.jid}"></converse-controlbox-navback>`}
${e.type!==bl.HEADLINES_TYPE?nh`<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-12-29 14:11:55 +01:00
${e.type!==bl.HEADLINES_TYPE?nh`<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-12-29 14:11:55 +01:00
${Wb(fS(e.heading_buttons_promise),"")}
${Wb(mS(e.heading_buttons_promise),"")}
2021-03-19 19:26:15 +01:00
</div>
</div>
2023-12-29 14:11:55 +01:00
${e.status?nh`<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(),Vl.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:qy("Details"),i18n_title:qy("See more information about this person"),icon_class:"fa-id-card",name:"details",standalone:"overlayed"===Vl.settings.get("view_mode")}];Vl.settings.get("singleton")||e.push({a_class:"close-chatbox-button",handler:e=>this.close(e),i18n_text:qy("Close"),i18n_title:qy("Close and end this conversation"),icon_class:"fa-times",name:"close",standalone:"overlayed"===Vl.settings.get("view_mode")});const t=bl.chatboxviews.get(this.getAttribute("jid"));return t?bl.api.hook("getHeadingButtons",t,e):e}});const{u:kx}=Ah.env;class jx extends eb{async connectedCallback(){super.connectedCallback(),this.model=bl.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?qy("Hidden message"):qy("Message"),n=qy("Optional hint"),s=Vl.settings.get("show_send_button");return nh`
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-12-29 14:11:55 +01:00
@input=${$x}
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-12-29 14:11:55 +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?kx.addClass("correcting",i):kx.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),kx.placeCaretAtEnd(i)}onMessageCorrecting(e){if(e.get("correcting"))this.insertIntoTextArea(zc(e),!0,!0);else{const t=this.model.messages.findWhere("correcting");t&&t!==e?this.insertIntoTextArea(zc(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===Ah.keycodes.TAB){const t=kx.getCurrentWord(e.target,null,/(:.*?:)/g);t.startsWith(":")&&(e.preventDefault(),e.stopPropagation(),this.model.trigger("emoji-picker-autocomplete",e.target,t))}else{if(e.keyCode===Ah.keycodes.FORWARD_SLASH)return;if(e.keyCode===Ah.keycodes.ESCAPE)return this.onEscapePressed(e,this);if(e.keyCode===Ah.keycodes.ENTER)return this.onFormSubmitted(e);if(e.keyCode!==Ah.keycodes.UP_ARROW||e.target.selectionEnd){if(e.keyCode===Ah.keycodes.DOWN_ARROW&&e.target.selectionEnd===e.target.value.length&&kx.hasClass("correcting",this.querySelector(".chat-textarea")))return this.model.editLaterMessage()}else{const e=this.querySelector(".chat-textarea");if(!e.value||kx.hasClass("correcting",e))return this.model.editEarlierMessage()}}[Ah.keycodes.SHIFT,Ah.keycodes.META,Ah.keycodes.META_RIGHT,Ah.keycodes.ESCAPE,Ah.keycodes.ALT].includes(e.keyCode)||this.model.get("chat_state")!==bl.COMPOSING&&this.model.setChatState(bl.COMPOSING)}}async onFormSubmitted(e){e?.preventDefault?.();const t=this.querySelector(".chat-textarea"),n=t.value.trim();if(Vl.settings.get("message_limit")&&n.length>Vl.settings.get("message_limit")||!n.replace(/\s/g,"").length)return;if(!bl.connection.authenticated){const e=qy("Sorry, the connection has been lost, and your message could not be sent");return Vl.alert("error",qy("Error"),e),void Vl.connection.reconnect()}let s,i={};this.model.get("composing_spoiler")&&(i=this.querySelector("form.sendXMPPMessage input.spoiler-hint"),s=i.value),kx.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 Vl.hook("parseMessageForCommands",{model:e,text:t},s),s)return!0;if("clear"===n[1])return Cx(e),!0;if("close"===n[1])return bl.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="",kx.removeClass("correcting",t),t.style.height="auto",this.model.set({draft:""})),"overlayed"===Vl.settings.get("view_mode")){bl.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")?nh`<div class="new-msgs-indicator" @click=${t=>e.viewUnreadMessages(t)}>▼ ${t} ▼</div>`:""}
${Vl.settings.get("show_toolbar")?nh`
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-12-29 14:11:55 +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){bl.chatboxviews.get(this.getAttribute("jid"))?.emitFocused(e)}emitBlurred(e){bl.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?.(),Cx(this.model)}async autocompleteInPicker(e,t){await Vl.emojis.initialize();const n=this.querySelector("converse-emoji-picker");if(n){n.model.set({ac_position:e.selectionStart,autocompleting:t,query:t});const s=this.querySelector("converse-emoji-dropdown");s?.showMenu()}}}Vl.elements.define("converse-chat-bottom-panel",Nx);class Ox extends Gy{static get properties(){return{jid:{type:String}}}disconnectedCallback(){super.disconnectedCallback(),bl.chatboxviews.remove(this.jid,this)}updated(){this.model&&this.jid!==this.model.get("jid")&&(this.stopListening(),bl.chatboxviews.remove(this.model.get("jid"),this),delete this.model,this.requestUpdate(),this.initialize())}close(e){return e?.preventDefault?.(),this.model.close(e)}maybeFocus(){Vl.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)||Vl.trigger("chatBoxBlurred",this,e)}emitFocused(e){this.contains(e.relatedTarget)||Vl.trigger("chatBoxFocused",this,e)}getBottomPanel(){return this.model.get("type")===bl.CHATROOMS_TYPE?this.querySelector("converse-muc-bottom-panel"):this.querySelector("converse-chat-bottom-panel")}getMessageForm(){return this.model.get("type")===bl.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}),gS(this.model)}onWindowStateChanged(e){"visible"===e.state?this.model.isHidden()||this.model.clearUnreadMsgCounter():"hidden"===e.state&&(this.model.setChatState(bl.INACTIVE,{silent:!0}),this.model.sendChatState())}}class Mx extends Ox{length=200;async initialize(){bl.chatboxviews.add(this.jid,this),this.model=bl.chatboxes.get(this.jid),this.listenTo(bl,"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(),Vl.trigger("chatBoxViewInitialized",this)}render(){return(e=>nh`
2021-11-11 22:06:49 +01:00
<div class="flyout box-flyout">
<converse-dragresize></converse-dragresize>
2023-12-29 14:11:55 +01:00
${e.model?nh`
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-12-29 14:11:55 +01:00
${e.show_help_messages?nh`<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-12-29 14:11:55 +01:00
chat_type="${bl.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-12-29 14:11:55 +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>: ${qy("Remove messages")}`,`<strong>/close</strong>: ${qy("Close this chat")}`,`<strong>/me</strong>: ${qy("Write in the third person")}`,`<strong>/help</strong>: ${qy("Show this menu")}`]}afterShown(){this.model.setChatState(bl.ACTIVE),this.model.clearUnreadMsgCounter(),this.maybeFocus()}}Vl.elements.define("converse-chat",Mx);var Rx=n(2),Dx={};Dx.styleTagTransform=i_(),Dx.setAttributes=e_(),Dx.insert=Yy().bind(null,"head"),Dx.domAPI=Qy(),Dx.insertStyleElement=n_();Jy()(Rx.Z,Dx);Rx.Z&&Rx.Z.locals&&Rx.Z.locals;const{Strophe:zx}=Ah.env;Ah.plugins.add("converse-chatview",{dependencies:["converse-chatboxviews","converse-chat","converse-disco","converse-modal"],initialize(){Vl.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}}),bl.ChatBoxView=Mx,Vl.listen.on("connected",(()=>Vl.disco.own.features.add(zx.NS.SPOILER))),Vl.listen.on("chatBoxClosed",(e=>{return t=e.get("jid"),void(bl.router.history.getFragment()===`converse/chat?jid=${t}`&&bl.router.navigate(""));var t}))}});Vl.elements.define("converse-brand-byline",class extends Gy{render(){const e="fullscreen"===Vl.settings.get("view_mode");return nh`
${e?nh`
<p class="brand-subtitle">${bl.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-12-29 14:11:55 +01:00
`}});Vl.elements.define("converse-brand-logo",class extends Gy{render(){const e="fullscreen"===Vl.settings.get("view_mode");return nh`
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-12-29 14:11:55 +01:00
${e?nh`
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-12-29 14:11:55 +01:00
`}});Vl.elements.define("converse-brand-heading",class extends Gy{render(){return nh`
2021-11-11 22:06:49 +01:00
<converse-brand-logo></converse-brand-logo>
<converse-brand-byline></converse-brand-byline>
2023-12-29 14:11:55 +01:00
`}});const{Strophe:Lx}=Ah.env,Px=[Lx.Status.ERROR,Lx.Status.CONNECTING,Lx.Status.CONNFAIL,Lx.Status.AUTHENTICATING,Lx.Status.AUTHFAIL,Lx.Status.DISCONNECTING,Lx.Status.RECONNECTING],Fx=Object.fromEntries([[Lx.Status.ERROR,"Error"],[Lx.Status.CONNECTING,"Connecting"],[Lx.Status.CONNFAIL,"Connection failure"],[Lx.Status.AUTHENTICATING,"Authenticating"],[Lx.Status.AUTHFAIL,"Authentication failure"],[Lx.Status.CONNECTED,"Connected"],[Lx.Status.DISCONNECTED,"Disconnected"],[Lx.Status.DISCONNECTING,"Disconnecting"],[Lx.Status.ATTACHED,"Attached"],[Lx.Status.REDIRECT,"Redirect"],[Lx.Status.CONNTIMEOUT,"Connection timeout"],[Lx.Status.RECONNECTING,"Reconnecting"]]),Ux=Object.fromEntries([[Lx.Status.ERROR,"error"],[Lx.Status.CONNECTING,"info"],[Lx.Status.CONNFAIL,"error"],[Lx.Status.AUTHENTICATING,"info"],[Lx.Status.AUTHFAIL,"error"],[Lx.Status.CONNECTED,"info"],[Lx.Status.DISCONNECTED,"error"],[Lx.Status.DISCONNECTING,"warn"],[Lx.Status.ATTACHED,"info"],[Lx.Status.REDIRECT,"info"],[Lx.Status.RECONNECTING,"warn"]]),Bx=e=>{const t=Vl.settings.get("authentication"),n=qy("Log in"),s=qy("XMPP Address"),i=Vl.settings.get("locked_domain"),r=Vl.settings.get("default_domain"),o=(i||r)&&qy("Username")||qy("user@domain"),a=Vl.settings.get("allow_user_trust_override");return nh`
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>
2023-06-25 15:59:31 +02:00
<input
id="converse-login-jid"
2023-12-29 14:11:55 +01:00
?autofocus=${!!Vl.settings.get("auto_focus")}
2022-04-02 21:20:14 +02:00
@changed=${e.validate}
2023-12-29 14:11:55 +01:00
value="${Vl.settings.get("jid")??""}"
2021-03-19 19:26:15 +01:00
required
class="form-control"
type="text"
name="jid"
2023-06-25 15:59:31 +02:00
placeholder="${o}"
/>
2021-03-19 19:26:15 +01:00
</div>
2023-12-29 14:11:55 +01:00
${t!==lo?(()=>{const e=qy("Password");return nh`
2021-03-19 19:26:15 +01:00
<div class="form-group">
<label for="converse-login-password">${e}</label>
2023-06-25 15:59:31 +02:00
<input
id="converse-login-password"
2022-04-02 21:20:14 +02:00
class="form-control"
required="required"
2023-12-29 14:11:55 +01:00
value="${Vl.settings.get("password")??""}"
2022-04-02 21:20:14 +02:00
type="password"
name="password"
2023-06-25 15:59:31 +02:00
placeholder="${e}"
/>
2021-03-19 19:26:15 +01:00
</div>
`})():""}
2023-12-29 14:11:55 +01:00
${Vl.settings.get("show_connection_url_input")?(()=>{const e=qy("Connection URL"),t=qy("HTTP or websocket URL that is used to connect to your XMPP server"),n=qy("e.g. wss://example.org/xmpp-websocket");return nh`
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>
2023-06-25 15:59:31 +02:00
<input
id="converse-conn-url"
class="form-control"
type="url"
name="connection-url"
placeholder="${n}"
/>
2022-04-02 21:20:14 +02:00
</div>
`})():""}
2023-12-29 14:11:55 +01:00
${a?(e=>{const t=qy("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=qy("This is a trusted device");return nh`
2021-03-19 19:26:15 +01:00
<div class="form-group form-check login-trusted">
2023-06-25 15:59:31 +02:00
<input
id="converse-login-trusted"
type="checkbox"
class="form-check-input"
name="trusted"
?checked=${e}
/>
2021-03-19 19:26:15 +01:00
<label for="converse-login-trusted" class="form-check-label login-trusted__desc">${n}</label>
2022-12-17 22:08:36 +01:00
2023-06-25 15:59:31 +02: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"
2023-06-25 15:59:31 +02:00
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">
2023-06-25 15:59:31 +02:00
<input class="btn btn-primary" type="submit" value="${n}" />
2021-03-19 19:26:15 +01:00
</fieldset>
2023-12-29 14:11:55 +01:00
${Vl.settings.get("allow_registration")&&!Vl.settings.get("auto_login")&&bl.pluggable.plugins["converse-register"].enabled(bl)?(()=>{const e=qy("Create an account"),t=qy("Don't have a chat account?");return nh`
2021-03-19 19:26:15 +01:00
<fieldset class="switch-form">
<p>${t}</p>
2023-06-25 15:59:31 +02:00
<p>
<a class="register-account toggle-register-login" href="#converse/register">${e}</a>
</p>
2021-03-19 19:26:15 +01:00
</fieldset>
`})():""}
2023-12-29 14:11:55 +01:00
`},qx=e=>{const t=bl.connfeedback.get("connection_status");let n,s;Px.includes(t)&&(s=Fx[t],n=Ux[t]);const i=bl.connfeedback.get("message");return nh` <converse-brand-heading></converse-brand-heading>
2022-05-05 23:06:17 +02:00
<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-12-29 14:11:55 +01:00
${"CONNECTING"===fo[t]?Sb({classes:"hor_centered"}):(e=>{const t=Vl.settings.get("authentication"),n=qy("Disconnected"),s=qy("Click here to log in anonymously");return nh`
${t==uo||t==lo?Bx(e):""}
${t==co?nh`<input class="btn btn-primary login-anon" type="submit" value="${s}" />`:""}
${t==mo?nh`<p>${n}</p>`:""}
2021-03-19 19:26:15 +01:00
`})(e)}
2023-12-29 14:11:55 +01:00
</form>`},{Strophe:Hx,u:Gx}=Ah.env;function Wx(){const e=bl.chatboxes.add(new bl.ControlBox({id:"controlbox"}));return bl.chatboxviews.get("controlbox")?.setModel(),e}function Vx(e){e?.preventDefault?.();const t=bl.chatboxes.get("controlbox")||Wx();Gx.safeSave(t,{closed:!1})}function Jx(){const e=bl.chatboxviews.get("controlbox");return e.model.set({connected:!1}),e}function Zx(){const e=bl?.chatboxviews,t=e&&e.get("controlbox");t&&(Gx.safeSave(t.model,{connected:!1}),t?.controlbox_pane&&(t.controlbox_pane.remove(),delete t.controlbox_pane))}function Qx(){(bl.chatboxes.get("controlbox")||Wx()).save({connected:!0})}const{Strophe:Kx,u:Yx}=Ah.env;Vl.elements.define("converse-login-form",class extends Gy{initialize(){this.listenTo(bl.connfeedback,"change",(()=>this.requestUpdate())),this.handler=()=>this.requestUpdate()}connectedCallback(){super.connectedCallback(),Vl.settings.listen.on("change",this.handler)}disconnectedCallback(){super.disconnectedCallback(),Vl.settings.listen.not("change",this.handler)}render(){return qx(this)}firstUpdated(){this.initPopovers()}async onLoginFormSubmitted(e){if(e?.preventDefault(),Vl.settings.get("authentication")===co)return this.connect(bl.jid);(function(e){const t=e.querySelector("input[name=jid]");return!t.value||Vl.settings.get("locked_domain")||Vl.settings.get("default_domain")||Gx.isValidJID(t.value)?(t.setCustomValidity(""),!0):(t.setCustomValidity(qy("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(Vl.settings.get("locked_domain")){const e="@"+Vl.settings.get("locked_domain");i.endsWith(e)&&(i=i.substr(0,i.length-e.length)),i=Hx.escapeNode(i)+e}else Vl.settings.get("default_domain")&&!i.includes("@")&&(i=i+"@"+Vl.settings.get("default_domain"));t.jid=i,t.password=n.get("password"),Vl.settings.set(t),bl.config.save({trusted:!!n.get("trusted")})}(e.target),Vl.settings.get("bosh_service_url")||Vl.settings.get("websocket_url")||await this.discoverConnectionMethods(e),Vl.settings.get("bosh_service_url")||Vl.settings.get("websocket_url")?this.connect():Vl.settings.set("show_connection_url_input",!0))}discoverConnectionMethods(e){if(!Vl.settings.get("discover_connection_methods"))return;const t=new FormData(e.target).get("jid"),n=Kx.getDomainFromJid(t);return(!bl.connection?.jid||t&&!Yx.isSameDomain(bl.connection.jid,t))&&Ll(),bl.connection.discoverConnectionMethods(n)}initPopovers(){Array.from(this.querySelectorAll("[data-title]")).forEach((e=>{new(c_().Popover)(e,{trigger:"mobile"===Vl.settings.get("view_mode")?"click":"hover",dismissible:"mobile"===Vl.settings.get("view_mode"),container:this.parentElement.parentElement.parentElement})}))}connect(e){["converse/login","converse/register"].includes(bl.router.history.getFragment())&&bl.router.navigate("",{replace:!0}),bl.connection?.reset(),Vl.user.login(e)}});const Xx=e=>nh`<converse-icon size="1em" class="fa fa-arrow-left" @click=${()=>function(e){Vx();const t=bl.chatboxes.get(e);Gx.safeSave(t,{hidden:!0})}(e)}></converse-icon>`;class eE extends Gy{static get properties(){return{jid:{type:String}}}render(){return Xx(this.jid)}}Vl.elements.define("converse-controlbox-navback",eE);const{dayjs:tE}=Ah.env,nE=dr.extend({defaults:()=>({bookmarked:!1,box_id:"controlbox",chat_state:void 0,closed:!Vl.settings.get("show_controlbox_by_default"),num_unread:0,time_opened:tE(0).valueOf(),type:bl.CONTROLBOX_TYPE,url:""}),validate(e){return e.type===bl.CONTROLBOX_TYPE?"embedded"===Vl.settings.get("view_mode")&&Vl.settings.get("singleton")?"Controlbox not relevant in embedded view mode":void 0:bl.ChatBox.prototype.validate.call(this,e)},maybeShow(e){return e||"controlbox"!==this.get("id")?bl.ChatBox.prototype.maybeShow.call(this,e):this},onReconnection(){this.save("connected",!0)}});class sE extends Gy{async connectedCallback(){super.connectedCallback(),await Vl.waitUntil("initialized"),this.model=bl.chatboxe
2022-05-05 23:06:17 +02:00
<div class="flyout box-flyout">
<converse-dragresize></converse-dragresize>
<div class="chat-head controlbox-head">
2023-12-29 14:11:55 +01:00
${n?"":nh`
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-12-29 14:11:55 +01:00
${t.connected?nh`
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-12-29 14:11:55 +01:00
${Vl.settings.get("authentication")===bl.ANONYMOUS?"":nh`<div id="converse-roster" class="controlbox-section"><converse-roster></converse-roster></div>`}`:function(e){const t=bl.connfeedback.get("connection_status");return[rE.Status.RECONNECTING,rE.Status.CONNECTING].includes(t)?Sb():"register"===e["active-form"]?nh`<converse-register-panel></converse-register-panel>`:nh`<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-12-29 14:11:55 +01:00
</div>`},aE=Ah.env.utils;class cE extends Gy{initialize(){this.setModel(),bl.chatboxviews.add("controlbox",this),this.model.get("connected")&&void 0===this.model.get("closed")&&this.model.set("closed",!Vl.settings.get("show_controlbox_by_default")),this.requestUpdate(),Vl.trigger("controlBoxInitialized",this)}setModel(){this.model=bl.chatboxes.get("controlbox"),this.listenTo(bl.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?oE(this):""}close(e){if(e?.preventDefault?.(),("closeAllChatBoxes"!==e?.name||bl.disconnection_cause===ho&&!Vl.settings.get("show_controlbox_by_default"))&&!Vl.settings.get("sticky_controlbox"))return aE.safeSave(this.model,{closed:!0}),Vl.trigger("controlBoxClosed",this),this}afterShown(){return Vl.trigger("controlBoxOpened",this),this}}Vl.elements.define("converse-controlbox",cE);const lE=cE,{u:dE}=Ah.env,uE={controlbox:{async open(){await Vl.waitUntil("chatBoxesFetched");const e=await Vl.chatboxes.get("controlbox")||Vl.chatboxes.create("controlbox",{},bl.Controlbox);return dE.safeSave(e,{closed:!1}),e},get:()=>bl.chatboxviews.get("controlbox")}};var hE=n(9870),mE={};mE.styleTagTransform=i_(),mE.setAttributes=e_(),mE.insert=Yy().bind(null,"head"),mE.domAPI=Qy(),mE.insertStyleElement=n_();Jy()(hE.Z,mE);hE.Z&&hE.Z.locals&&hE.Z.locals;var fE=n(4937),gE={};gE.styleTagTransform=i_(),gE.setAttributes=e_(),gE.insert=Yy().bind(null,"head"),gE.domAPI=Qy(),gE.insertStyleElement=n_();Jy()(fE.Z,gE);fE.Z&&fE.Z.locals&&fE.Z.locals;Ah.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 nE(e,t):this.__super__.model.apply(this,arguments)}}},initialize(){Vl.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}),Vl.promises.add("controlBoxInitialized",!1),Object.assign(Vl,uE),bl.ControlBoxView=lE,bl.ControlBox=nE,bl.ControlBoxToggle=iE,Vl.listen.on("chatBoxesFetched",Qx),Vl.listen.on("clearSession",Zx),Vl.listen.on("will-reconnect",Jx),Vl.waitUntil("chatBoxViewsInitialized").then(Wx).catch((e=>Yc.fatal(e)))}});Vl.elements.define("converse-headlines-heading",class extends Gy{static get properties(){return{jid:{type:String}}}async initialize(){this.model=bl.chatboxes.get(this.jid),await this.model.initialized,this.requestUpdate()}render(){return(e=>nh`
2021-11-11 22:06:49 +01:00
<div class="chatbox-title ${e.status?"":"chatbox-title--no-desc"}">
<div class="chatbox-title--row">
2023-12-29 14:11:55 +01:00
${bl.api.settings.get("singleton")?"":nh`<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-12-29 14:11:55 +01:00
${Wb(fS(e.heading_buttons_promise),"")}
${Wb(mS(e.heading_buttons_promise),"")}
2021-11-11 22:06:49 +01:00
</div>
</div>
2023-12-29 14:11:55 +01:00
${e.status?nh`<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 Vl.settings.get("singleton")||e.push({a_class:"close-chatbox-button",handler:e=>this.close(e),i18n_text:qy("Close"),i18n_title:qy("Close these announcements"),icon_class:"fa-times",name:"close",standalone:"overlayed"===Vl.settings.get("view_mode")}),bl.api.hook("getHeadingButtons",this,e)}close(e){e.preventDefault(),this.model.close()}});Vl.elements.define("converse-headlines",class extends Ox{async initialize(){bl.chatboxviews.add(this.jid,this),this.model=bl.chatboxes.get(this.jid),this.model.disable_mam=!0,this.listenTo(bl,"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(),Vl.trigger("headlinesBoxViewInitialized",this)}render(){return(e=>nh`
2021-11-11 22:06:49 +01:00
<div class="flyout box-flyout">
<converse-dragresize></converse-dragresize>
2023-12-29 14:11:55 +01:00
${e?nh`
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-12-29 14:11:55 +01:00
`)(this.model)}async close(e){return e?.preventDefault?.(),bl.router.history.getFragment()==="converse/chat?jid="+this.model.get("jid")&&bl.router.navigate(""),await this.model.close(e),this}getNotifications(){return[]}afterShown(){this.model.clearUnreadMsgCounter()}});const pE=e=>{const t=e.model.filter((e=>e.get("type")===bl.HEADLINES_TYPE)),n=qy("Announcements");return nh`
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-12-29 14:11:55 +01:00
${t.map((t=>function(e,t){const n=qy("Click to open this server message");return nh`
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-12-29 14:11:55 +01:00
</div>`};class vE extends Gy{initialize(){this.model=bl.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 pE(this)}renderIfHeadline(e){return e?.get("type")===bl.HEADLINES_TYPE&&this.requestUpdate()}async openHeadline(e){e.preventDefault();const t=e.target.getAttribute("data-headline-jid");(await Vl.headlines.get(t)).maybeShow(!0)}}Vl.elements.define("converse-headlines-feeds-list",vE);var yE=n(2846),_E={};_E.styleTagTransform=i_(),_E.setAttributes=e_(),_E.insert=Yy().bind(null,"head"),_E.domAPI=Qy(),_E.insertStyleElement=n_();Jy()(yE.Z,_E);yE.Z&&yE.Z.locals&&yE.Z.locals;var bE=n(3806),wE={};wE.styleTagTransform=i_(),wE.setAttributes=e_(),wE.insert=Yy().bind(null,"head"),wE.domAPI=Qy(),wE.insertStyleElement=n_();Jy()(bE.Z,wE);bE.Z&&bE.Z.locals&&bE.Z.locals;Ah.plugins.add("converse-headlines-view",{dependencies:["converse-headlines","converse-chatview"],initialize(){bl.HeadlinesFeedsList=vE,bl.HeadlinesPanel=vE}});var SE=n(7038),xE={};xE.styleTagTransform=i_(),xE.setAttributes=e_(),xE.insert=Yy().bind(null,"head"),xE.domAPI=Qy(),xE.insertStyleElement=n_();Jy()(SE.Z,xE);SE.Z&&SE.Z.locals&&SE.Z.locals;function EE(e,t){return e instanceof _p?nh`<converse-mam-placeholder .model=${e}></converse-mam-placeholder>`:t}async function AE(e){if(!e.model.ui.get("chat-content-spinner-top")&&e.model.messages.length){const t=e.model.get("type")===bl.CHATROOMS_TYPE,n=e.model.getOldestMessage();if(n){const s=t?e.model.get("jid"):bl.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 Yc.error(t),void e.model.ui.set("chat-content-spinner-top",!1)}Vl.settings.get("allow_url_history_change")&&bl.router.history.navigate(`#${n.get("msgid")}`),setTimeout((()=>e.model.ui.set("chat-content-spinner-top",!1)),250)}}}Vl.elements.define("converse-mam-placeholder",class extends Gy{static get properties(){return{model:{type:Object}}}render(){return(e=this).model.get("fetching")?Sb({classes:"hor_centered"}):nh`<a @click="${t=>e.fetchMissingMessages(t)}" title="${qy("Click to load missing messages")}">
2022-12-17 22:08:36 +01:00
<div class="message mam-placeholder"></div>
2023-12-29 14:11:55 +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()}}),Ah.plugins.add("converse-mam-views",{dependencies:["converse-mam","converse-chatview","converse-muc-views"],initialize(){Vl.listen.on("chatBoxScrolledUp",AE),Vl.listen.on("getMessageTemplate",EE)}});const{Strophe:CE,sizzle:$E}=Ah.env;Vl.elements.define("converse-muc-affiliation-form",class extends Gy{static get properties(){return{muc:{type:Object},jid:{type:String},affiliation:{type:String},alert_message:{type:String,attribute:!1},alert_type:{type:String,attribute:!1}}}render(){return(e=>{const t=qy("Change affiliation"),n=qy("New affiliation"),s=qy("Reason"),i=Bf(e.muc.getOwnOccupant());return nh`
2023-06-25 15:59:31 +02:00
<form class="affiliation-form" @submit=${t=>e.assignAffiliation(t)}>
2023-12-29 14:11:55 +01:00
${e.alert_message?nh`<div class="alert alert-${e.alert_type}" role="alert">${e.alert_message}</div>`:""}
2023-06-25 15:59:31 +02:00
<div class="form-group">
<div class="row">
<div class="col">
<label><strong>${n}:</strong></label>
<select class="custom-select select-affiliation" name="affiliation">
2023-12-29 14:11:55 +01:00
${i.map((t=>nh`<option value="${t}" ?selected=${t===e.affiliation}>${t}</option>`))}
2023-06-25 15:59:31 +02: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">
<div class="col">
<input type="submit" class="btn btn-primary" name="change" value="${t}"/>
</div>
</div>
</form>
2023-12-29 14:11:55 +01:00
`})(this)}alert(e,t){this.alert_message=e,this.alert_type=t}async assignAffiliation(e){e.stopPropagation(),e.preventDefault(),this.alert();const t=new FormData(e.target),n=t.get("affiliation"),s={jid:this.jid,reason:t.get("reason")},i=this.muc.get("jid");try{await Hf(n,i,[s])}catch(e){return null===e?this.alert(qy("Timeout error while trying to set the affiliation"),"danger"):$E(`not-allowed[xmlns="${CE.NS.STANZAS}"]`,e).length?this.alert(qy("Sorry, you're not allowed to make that change"),"danger"):this.alert(qy("Sorry, something went wrong while trying to set the affiliation"),"danger"),void Yc.error(e)}await this.muc.occupants.fetchMembers();const r=new CustomEvent("affiliationChanged",{bubbles:!0});this.dispatchEvent(r)}});const{Strophe:kE,sizzle:jE}=Ah.env;Vl.elements.define("converse-muc-role-form",class extends Gy{static get properties(){return{muc:{type:Object},jid:{type:String},role:{type:String},alert_message:{type:String,attribute:!1},alert_type:{type:String,attribute:!1}}}render(){return(e=>{const t=qy("Change role"),n=qy("New Role"),s=qy("Reason"),i=ag(e.muc.getOwnOccupant());return nh`
2023-06-25 15:59:31 +02:00
<form class="role-form" @submit=${e.assignRole}>
<div class="form-group">
<input type="hidden" name="jid" value="${e.jid}"/>
<input type="hidden" name="nick" value="${e.nick}"/>
<div class="row">
<div class="col">
<label><strong>${n}:</strong></label>
<select class="custom-select select-role" name="role">
2023-12-29 14:11:55 +01:00
${i.map((t=>nh`<option value="${t}" ?selected=${t===e.role}>${t}</option>`))}
2023-06-25 15:59:31 +02: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">
<div class="col">
<input type="submit" class="btn btn-primary" value="${t}"/>
</div>
</div>
</form>
2023-12-29 14:11:55 +01:00
`})(this)}alert(e,t){this.alert_message=e,this.alert_type=t}assignRole(e){e.stopPropagation(),e.preventDefault(),this.alert();const t=new FormData(e.target),n=this.muc.getOccupant(t.get("jid")||t.get("nick")),s=t.get("role"),i=t.get("reason");this.muc.setRole(n,s,i,(()=>{const e=new CustomEvent("roleChanged",{bubbles:!0});this.dispatchEvent(e)}),(e=>{jE(`not-allowed[xmlns="${kE.NS.STANZAS}"]`,e).length?this.alert(qy("You're not allowed to make that change"),"danger"):(this.alert(qy("Sorry, something went wrong while trying to set the role"),"danger"),Pc(e)&&Yc.error(e))}))}});Vl.elements.define("converse-muc-message-form",class extends jx{async connectedCallback(){super.connectedCallback(),await this.model.initialized}toHTML(){return(e=>{const t=e.composing_spoiler?qy("Hidden message"):qy("Message"),n=qy("Optional hint"),s=Vl.settings.get("show_send_button");return nh`
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-12-29 14:11:55 +01:00
@input=${$x}
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-12-29 14:11:55 +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")===Ah.ROOMSTATUS.ENTERED,t=e&&!(this.model.features.get("moderated")&&"visitor"===this.model.getOwnRole());e&&t&&this.initMentionAutoComplete()}initMentionAutoComplete(){this.mention_auto_complete=new bl.AutoComplete(this,{auto_first:!0,auto_evaluate:!1,min_chars:Vl.settings.get("muc_mention_autocomplete_min_chars"),match_current_word:!0,list:()=>this.getAutoCompleteList(),filter:"contains"==Vl.settings.get("muc_mention_autocomplete_filter")?bl.FILTER_CONTAINS:bl.FILTER_STARTSWITH,ac_triggers:["Tab","@"],include_triggers:[],item:lw}),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 TE=n(9592),IE={};IE.styleTagTransform=i_(),IE.setAttributes=e_(),IE.insert=Yy().bind(null,"head"),IE.domAPI=Qy(),IE.insertStyleElement=n_();Jy()(TE.Z,IE);TE.Z&&TE.Z.locals&&TE.Z.locals;class NE extends Gy{static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=bl.chatboxes.get(this.jid)}render(){return(e=>{const t=qy("Nickname"),n=e.model?.isEntered()?qy("Change nickname"):qy("Enter groupchat"),s=Vl.settings.get("muc_show_logs_before_join")?qy("Choose a nickname to enter"):qy("Please choose your nickname"),i=e.model?.get("nickname_validation_message");return nh`
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-12-29 14:11:55 +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)}}Vl.elements.define("converse-muc-nickname-form",NE);const OE=e=>{const t=qy("You have unread messages"),n=e.model.session.get("connection_status"),s=qy("You're not allowed to send messages in this room");return n===Ah.ROOMSTATUS.ENTERED?nh`
${e.model.ui.get("scrolled")&&e.model.get("num_unread_general")?nh`<div class="new-msgs-indicator" @click=${t=>e.viewUnreadMessages(t)}>▼ ${t} ▼</div>`:""}
${e.can_edit?(e=>{const t=qy("You have unread messages"),n=Vl.settings.get("message_limit"),s=Vl.settings.get("visible_toolbar_buttons").call,i=Vl.settings.get("visible_toolbar_buttons").emoji,r=Vl.settings.get("show_send_button"),o=Vl.settings.get("visible_toolbar_buttons").spoiler,a=Vl.settings.get("show_toolbar");return nh`
${e.model.ui.get("scrolled")&&e.model.get("num_unread")?nh`<div class="new-msgs-indicator" @click=${t=>e.viewUnreadMessages(t)}>▼ ${t} ▼</div>`:""}
${a?nh`
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-12-29 14:11:55 +01:00
<converse-muc-message-form jid=${e.model.get("jid")}></converse-muc-message-form>`})(e):nh`<span class="muc-bottom-panel muc-bottom-panel--muted">${s}</span>`}`:n!=Ah.ROOMSTATUS.NICKNAME_REQUIRED?"":Vl.settings.get("muc_show_logs_before_join")?nh`<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-12-29 14:11:55 +01:00
</span>`:void 0};var ME=n(3774),RE={};RE.styleTagTransform=i_(),RE.setAttributes=e_(),RE.insert=Yy().bind(null,"head"),RE.domAPI=Qy(),RE.insertStyleElement=n_();Jy()(ME.Z,RE);ME.Z&&ME.Z.locals&&ME.Z.locals;Vl.elements.define("converse-muc-bottom-panel",class extends Nx{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")===Ah.ROOMSTATUS.ENTERED,t=e&&!(this.model.features.get("moderated")&&"visitor"===this.model.getOwnRole());bh(OE({can_edit:t,entered:e,model:this.model,is_groupchat:!0,viewUnreadMessages:e=>this.viewUnreadMessages(e)}),this)}renderIfOwnOccupant(e){e.get("jid")===bl.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 DE={offline:"Offline",unavailable:"Unavailable",xa:"Extended Away",away:"Away",dnd:"Do not disturb",chat:"Chattty",online:"Online"},zE=e=>{const t=e.get("role"),n=(e=>qy("Click to mention %1$s in your message.",e.get("nick")))(e),s=qy("This user is a moderator."),i=qy("This user can send messages in this groupchat."),r=qy("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}`},LE=(e,t)=>{const n=e.get("affiliation"),s=DE[e.get("show")],i=qy("Admin"),r=qy("Member"),o=qy("Moderator"),a=qy("Owner"),c=qy("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"],nh`
<li class="occupant" id="${e.id}" title="${zE(e)}">
2021-11-11 22:06:49 +01:00
<div class="row no-gutters">
<div class="col-auto">
2023-12-29 14:11:55 +01:00
<a class="show-msg-author-modal" @click=${t=>function(e,t){Vl.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-12-29 14:11:55 +01:00
${"owner"===n?nh`<span class="badge badge-groupchat">${a}</span>`:""}
${"admin"===n?nh`<span class="badge badge-info">${i}</span>`:""}
${"member"===n?nh`<span class="badge badge-info">${r}</span>`:""}
${"moderator"===l?nh`<span class="badge badge-info">${o}</span>`:""}
${"visitor"===l?nh`<span class="badge badge-secondary">${c}</span>`:""}
2021-11-11 22:06:49 +01:00
</span>
</div>
</div>
</li>
2023-12-29 14:11:55 +01:00
`};var PE=n(6305),FE={};FE.styleTagTransform=i_(),FE.setAttributes=e_(),FE.insert=Yy().bind(null,"head"),FE.domAPI=Qy(),FE.insertStyleElement=n_();Jy()(PE.Z,FE);PE.Z&&PE.Z.locals&&PE.Z.locals;var UE=n(3284),BE={};BE.styleTagTransform=i_(),BE.setAttributes=e_(),BE.insert=Yy().bind(null,"head"),BE.domAPI=Qy(),BE.insertStyleElement=n_();Jy()(UE.Z,BE);UE.Z&&UE.Z.locals&&UE.Z.locals;const{u:qE}=Ah.env;Vl.elements.define("converse-muc-sidebar",class extends Gy{static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=bl.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?qy("Participant"):qy("Participants");return nh`
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-12-29 14:11:55 +01:00
<ul class="occupant-list">${Mw(e.occupants,(e=>e.get("jid")),(t=>LE(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?.(),qE.safeSave(this.model,{hidden_occupants:!0})}onOccupantClicked(e){e?.preventDefault?.();const t=bl.chatboxviews.get(this.getAttribute("jid"));t?.getMessageForm().insertIntoTextArea(`@${e.target.textContent}`)}});const{u:HE}=Ah.env;Vl.elements.define("converse-muc-chatarea",class extends Gy{static get properties(){return{jid:{type:String},show_help_messages:{type:Boolean},type:{type:String}}}async initialize(){this.model=await Vl.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=>nh`
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-12-29 14:11:55 +01:00
${e.model?.get("show_help_messages")?nh`<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-12-29 14:11:55 +01:00
chat_type="${bl.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-12-29 14:11:55 +01:00
${e.model?nh`
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-12-29 14:11:55 +01:00
`)({getHelpMessages:()=>this.getHelpMessages(),jid:this.jid,model:this.model,onMousedown:e=>this.onMousedown(e),show_send_button:Vl.settings.get("show_send_button"),shouldShowSidebar:()=>this.shouldShowSidebar(),type:this.type})}shouldShowSidebar(){return!this.model.get("hidden_occupants")&&this.model.session.get("connection_status")===Ah.ROOMSTATUS.ENTERED}getHelpMessages(){const e=Vl.settings.get("muc_disable_slash_commands"),t=Array.isArray(e)?e:[];return[`<strong>/admin</strong>: ${qy("Change user's affiliation to admin")}`,`<strong>/ban</strong>: ${qy("Ban user by changing their affiliation to outcast")}`,`<strong>/clear</strong>: ${qy("Clear the chat area")}`,`<strong>/close</strong>: ${qy("Close this groupchat")}`,`<strong>/deop</strong>: ${qy("Change user role to participant")}`,`<strong>/destroy</strong>: ${qy("Remove this groupchat")}`,`<strong>/help</strong>: ${qy("Show this menu")}`,`<strong>/kick</strong>: ${qy("Kick user from groupchat")}`,`<strong>/me</strong>: ${qy("Write in 3rd person")}`,`<strong>/member</strong>: ${qy("Grant membership to a user")}`,`<strong>/modtools</strong>: ${qy("Opens up the moderator tools GUI")}`,`<strong>/mute</strong>: ${qy("Remove user's ability to post messages")}`,`<strong>/nick</strong>: ${qy("Change your nickname")}`,`<strong>/op</strong>: ${qy("Grant moderator role to user")}`,`<strong>/owner</strong>: ${qy("Grant ownership of this groupchat")}`,`<strong>/register</strong>: ${qy("Register your nickname")}`,`<strong>/revoke</strong>: ${qy("Revoke the user's current affiliation")}`,`<strong>/subject</strong>: ${qy("Set groupchat subject")}`,`<strong>/topic</strong>: ${qy("Set groupchat subject (alias for /subject)")}`,`<strong>/voice</strong>: ${qy("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){HE.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);HE.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:GE}=Ah.env,WE=Ah.env.utils,{sizzle:VE}=Ah.env,JE=Ah.env.utils;class ZE extends Gy{static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=bl.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=Vl.settings.get("roomconfig_whitelist"),n=e.model.session.get("config_stanza");let s,i=[],r="";if(n){const o=WE.toStanza(n);i=GE("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=>WE.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-12-29 14:11:55 +01:00
${s!==r?nh`<p class="form-help">${r}</p>`:""}
2023-06-25 15:59:31 +02:00
${i.length?i:Sb({classes:"hor_centered"})}
2021-03-19 19:26:15 +01:00
</fieldset>
2023-12-29 14:11:55 +01:00
${i.length?nh`
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-12-29 14:11:55 +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=VE(":input:not([type=button]):not([type=submit])",e.target).map(JE.webForm2xForm).filter((e=>e));try{await this.model.sendConfiguration(t)}catch(e){Yc.error(e);const t=qy("Sorry, an error occurred while trying to submit the config form.")+" "+qy("Check your browser's developer console for details.");Vl.alert("error",qy("Error"),t)}await this.model.refreshDiscoInfo(),this.closeForm()}closeForm(e){e?.preventDefault?.(),this.model.session.set("view",null)}}Vl.elements.define("converse-muc-config-form",ZE);const QE=e=>{const t=qy("This groupchat no longer exists"),n=qy('The following reason was given: "%1$s"',e.reason||"");return nh`
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-12-29 14:11:55 +01:00
${e.reason?nh`<p class="destroyed-reason">${n}</p>`:""}
${e.moved_jid?(e=>{const t=qy("The conversation has moved to a new address. Click the link below to enter.");return nh`
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-12-29 14:11:55 +01:00
`};Vl.elements.define("converse-muc-destroyed",class extends Gy{static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=bl.chatboxes.get(this.jid)}render(){const e=this.model.get("destroyed_reason"),t=this.model.get("moved_jid");return QE({moved_jid:t,reason:e,onSwitch:e=>this.onSwitch(e)})}async onSwitch(e){e.preventDefault();const t=this.model.get("moved_jid");(await Vl.rooms.get(t,{},!0)).maybeShow(!0),this.model.destroy()}});Vl.elements.define("converse-muc-disconnected",class extends Gy{static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=bl.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(qy("This action was done by %1$s.",n));const s=this.model.session.get("disconnection_reason");return s&&t.push(qy('The reason given is: "%1$s".',s)),(e=>nh`
2022-12-17 22:08:36 +01:00
<div class="alert alert-danger">
<h3 class="alert-heading disconnect-msg">${e[0]}</h3>
2023-12-29 14:11:55 +01:00
${e.slice(1).map((e=>nh`<p class="disconnect-msg">${e}</p>`))}
</div>`)(t)}});const KE=e=>{const t=e.toJSON(),n=e.config.toJSON(),s=e.features.toJSON(),i=e.occupants.filter((e=>"offline"!==e.get("show"))).length,r=qy("XMPP address"),o=qy("Message archiving"),a=qy("Messages are archived on the server"),c=qy("Description"),l=qy("Features"),d=qy("Hidden"),u=qy("This groupchat is not publicly searchable"),h=qy("This groupchat is restricted to members only"),m=qy("Members only"),f=qy("Moderated"),g=qy("Participants entering this groupchat need to request permission to write"),p=qy("Name"),v=qy("This groupchat does not require a password upon entry"),y=qy("No password required"),_=qy("Not anonymous"),b=qy("All other groupchat participants can see your XMPP address"),w=qy("Not moderated"),S=qy("Participants entering this groupchat can write right away"),x=qy("Online users"),E=qy("Open"),A=qy("Anyone can join this groupchat"),C=qy("This groupchat requires a password before entry"),$=qy("Password protected"),k=qy("Persistent"),j=qy("This groupchat persists even if it's unoccupied"),T=qy("Public"),I=qy("Semi-anonymous"),N=qy("Only moderators can see your XMPP address"),O=qy("Temporary"),M=qy("This groupchat will disappear once the last person leaves");return nh`
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-12-29 14:11:55 +01:00
${t.subject?(e=>{const t=qy("Topic"),n=qy("Topic author");return nh`
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-12-29 14:11:55 +01:00
${s.passwordprotected?nh`<li class="feature" ><converse-icon size="1em" class="fa fa-lock"></converse-icon>${$} - <em>${C}</em></li>`:""}
${s.unsecured?nh`<li class="feature" ><converse-icon size="1em" class="fa fa-unlock"></converse-icon>${y} - <em>${v}</em></li>`:""}
${s.hidden?nh`<li class="feature" ><converse-icon size="1em" class="fa fa-eye-slash"></converse-icon>${d} - <em>${u}</em></li>`:""}
${s.public_room?nh`<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?nh`<li class="feature" ><converse-icon size="1em" class="fa fa-address-book"></converse-icon>${m} - <em>${h}</em></li>`:""}
${s.open?nh`<li class="feature" ><converse-icon size="1em" class="fa fa-globe"></converse-icon>${E} - <em>${A}</em></li>`:""}
${s.persistent?nh`<li class="feature" ><converse-icon size="1em" class="fa fa-save"></converse-icon>${k} - <em>${j}</em></li>`:""}
${s.temporary?nh`<li class="feature" ><converse-icon size="1em" class="fa fa-snowflake"></converse-icon>${O} - <em>${M}</em></li>`:""}
${s.nonanonymous?nh`<li class="feature" ><converse-icon size="1em" class="fa fa-id-card"></converse-icon>${_} - <em>${b}</em></li>`:""}
${s.semianonymous?nh`<li class="feature" ><converse-icon size="1em" class="fa fa-user-secret"></converse-icon>${I} - <em>${N}</em></li>`:""}
${s.moderated?nh`<li class="feature" ><converse-icon size="1em" class="fa fa-gavel"></converse-icon>${f} - <em>${g}</em></li>`:""}
${s.unmoderated?nh`<li class="feature" ><converse-icon size="1em" class="fa fa-info-circle"></converse-icon>${w} - <em>${S}</em></li>`:""}
${s.mam_enabled?nh`<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-12-29 14:11:55 +01:00
`};var YE=n(2430),XE={};XE.styleTagTransform=i_(),XE.setAttributes=e_(),XE.insert=Yy().bind(null,"head"),XE.domAPI=Qy(),XE.insertStyleElement=n_();Jy()(YE.Z,XE);YE.Z&&YE.Z.locals&&YE.Z.locals;Vl.elements.define("converse-muc-details-modal",class extends tb{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 KE(this.model)}getModalTitle(){return qy("Groupchat info for %1$s",this.model.getDisplayName())}});const eA=Ah.env.utils;Vl.elements.define("converse-muc-invite-modal",class extends tb{initialize(){super.initialize(),this.listenTo(this.model,"change",(()=>this.render()))}renderModal(){return(e=>{const t=qy("Invite"),n=qy("user@example.org"),s=qy("Please enter a valid XMPP address"),i=qy("XMPP Address"),r=qy("Optional reason for the invitation");return nh`
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-12-29 14:11:55 +01:00
${e.model.get("invalid_invite_jid")?nh`<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-12-29 14:11:55 +01:00
`})(this)}getModalTitle(){return qy("Invite someone to this groupchat")}getAutoCompleteList(){return bl.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");eA.isValidJID(n)?(this.chatroomview.model.directInvite(n,s),this.modal.hide()):this.model.set({invalid_invite_jid:!0})}});Vl.elements.define("converse-muc-nickname-modal",class extends tb{renderModal(){return nh`<converse-muc-nickname-form jid="${this.model.get("jid")}"></converse-muc-nickname-form>`}getModalTitle(){return qy("Change your nickname")}});var tA=n(9575),nA={};nA.styleTagTransform=i_(),nA.setAttributes=e_(),nA.insert=Yy().bind(null,"head"),nA.domAPI=Qy(),nA.insertStyleElement=n_();Jy()(tA.Z,nA);tA.Z&&tA.Z.locals&&tA.Z.locals;Vl.elements.define("converse-rich-text",class extends Gy{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 AS(this.text,this.offset,e)}});var sA=n(2339),iA={};iA.styleTagTransform=i_(),iA.setAttributes=e_(),iA.insert=Yy().bind(null,"head"),iA.domAPI=Qy(),iA.insertStyleElement=n_();Jy()(sA.Z,iA);sA.Z&&sA.Z.locals&&sA.Z.locals;Vl.elements.define("converse-muc-heading",class extends Gy{async initialize(){this.model=bl.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 bl.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=qy("Hide the groupchat topic"),r=qy("This groupchat is bookmarked"),o=t.subject?t.subject.text:"",a=o&&!n,c=e.model.vcard?.get("image");return nh`
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-12-29 14:11:55 +01:00
${c&&c!==bl.DEFAULT_IMAGE?nh`
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-12-29 14:11:55 +01:00
${bl.api.settings.get("singleton")?"":nh`<converse-controlbox-navback jid="${t.jid}"></converse-controlbox-navback>`}
<div class="chatbox-title__text" title="${"hidden"!==Vl.settings.get("locked_muc_domain")?t.jid:""}">${e.model.getDisplayName()}
${t.bookmarked?nh`<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-12-29 14:11:55 +01:00
${Wb(mS(s),"")}
${Wb(fS(s),"")}
2021-11-11 22:06:49 +01:00
</div>
</div>
2023-12-29 14:11:55 +01:00
${a?nh`<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-12-29 14:11:55 +01:00
`})(this):""}onOccupantAdded(e){e.get("jid")===bl.bare_jid&&this.requestUpdate()}onOccupantAffiliationChanged(e){e.get("jid")===bl.bare_jid&&this.requestUpdate()}showRoomDetailsModal(e){e.preventDefault(),Vl.modal.show("converse-muc-details-modal",{model:this.model},e)}showInviteModal(e){e.preventDefault(),Vl.modal.show("converse-muc-invite-modal",{model:new dr,chatroomview:this},e)}toggleTopic(e){e?.preventDefault?.(),this.model.toggleSubjectHiddenState()}getAndRenderConfigurationForm(){this.model.session.set("view",Ah.MUC.VIEWS.CONFIG)}close(e){e.preventDefault(),this.model.close()}destroy(e){e.preventDefault(),aw(this.model)}getHeadingButtons(e){const t=[];t.push({i18n_text:qy("Details"),i18n_title:qy("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:qy("Configure"),i18n_title:qy("Configure this groupchat"),handler:()=>this.getAndRenderConfigurationForm(),a_class:"configure-chatroom-button",icon_class:"fa-wrench",name:"configure"}),t.push({i18n_text:qy("Nickname"),i18n_title:qy("Change the nickname you're using in this groupchat"),handler:e=>Vl.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:qy("Invite"),i18n_title:qy("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:qy(e?"Show topic":"Hide topic"),i18n_title:qy(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")===Ah.ROOMSTATUS.ENTERED){const e=this.model.getAllowedCommands();e.includes("modtools")&&t.push({i18n_text:qy("Moderate"),i18n_title:qy("Moderate this groupchat"),handler:()=>mw(this.model),a_class:"moderate-chatroom-button",icon_class:"fa-user-cog",name:"moderate"}),e.includes("destroy")&&t.push({i18n_text:qy("Destroy"),i18n_title:qy("Remove this groupchat"),handler:e=>this.destroy(e),a_class:"destroy-chatroom-button",icon_class:"fa-trash",name:"destroy"})}Vl.settings.get("singleton")||t.push({i18n_text:qy("Leave"),i18n_title:qy("Leave and close this groupchat"),handler:async e=>{e.stopPropagation();const t=[qy("Are you sure you want to leave this groupchat?")];await Vl.confirm(qy("Confirm"),t)&&this.close(e)},a_class:"close-chatbox-button",standalone:"overlayed"===Vl.settings.get("view_mode"),icon_class:"fa-sign-out-alt",name:"signout"});const s=bl.chatboxviews.get(this.getAttribute("jid"));return s?bl.api.hook("getHeadingButtons",s,t):Promise.resolve(t)}});class rA extends Gy{static get properties(){return{jid:{type:String}}}connectedCallback(){super.connectedCallback(),this.model=bl.chatboxes.get(this.jid),this.listenTo(this.model,"change:password_validation_message",this.render),this.render()}render(){return(e=>{const t=qy("This groupchat requires a password"),n=qy("Password: "),s=qy("Submit");return nh`
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-12-29 14:11:55 +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)}}Vl.elements.define("converse-muc-password-form",rA);class oA extends Ox{length=300;is_chatroom=!0;async initialize(){this.model=await Vl.rooms.get(this.jid),bl.chatboxviews.add(this.jid,this),this.setAttribute("id",this.model.get("box_id")),this.listenTo(bl,"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(),Vl.trigger("chatRoomViewInitialized",this)}render(){return(e=>nh`
2021-11-11 22:06:49 +01:00
<div class="flyout box-flyout">
<converse-dragresize></converse-dragresize>
2023-12-29 14:11:55 +01:00
${e.model?nh`
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-06-25 15:59:31 +02:00
<div class="chat-body chatroom-body row no-gutters">${cw(e)}</div>
2021-11-11 22:06:49 +01:00
`:""}
2023-12-29 14:11:55 +01:00
</div>`)({model:this.model})}onConnectionStatusChanged(){this.model.session.get("connection_status")===Ah.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()}}Vl.elements.define("converse-muc",oA);var aA=n(1693),cA={};cA.styleTagTransform=i_(),cA.setAttributes=e_(),cA.insert=Yy().bind(null,"head"),cA.domAPI=Qy(),cA.insertStyleElement=n_();Jy()(aA.Z,cA);aA.Z&&aA.Z.locals&&aA.Z.locals;const{Strophe:lA}=Ah.env;Ah.MUC.VIEWS={CONFIG:"config-form"},Ah.plugins.add("converse-muc-views",{dependencies:["converse-modal","converse-controlbox","converse-chatview"],initialize(){const{_converse:e}=this;Vl.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=oA,Vl.settings.get("muc_domain")||Vl.listen.on("serviceDiscovered",(async e=>{if(e?.get("var")===lA.NS.MUC){if(e.entity.get("jid").includes("@"))return;await e.entity.getIdentity("conference","text")&&Vl.settings.set("muc_domain",lA.getDomainFromJid(e.get("from")))}})),Vl.listen.on("clearsession",(()=>{const t=e.chatboxviews.get("controlbox");t&&t.roomspanel&&(t.roomspanel.model.destroy(),t.roomspanel.remove(),delete t.roomspanel)})),Vl.listen.on("chatBoxClosed",(t=>{var n;t.get("type")===e.CHATROOMS_TYPE&&(n=t.get("jid"),bl.router.history.getFragment()===`converse/room?jid=${n}`&&bl.router.navigate(""))})),Vl.listen.on("parseMessageForCommands",fw),Vl.listen.on("confirmDirectMUCInvitation",ow)}});const dA=dr.extend({defaults:{collapsed:!1}});Vl.elements.define("converse-minimized-chats",class extends Gy{async initialize(){this.model=bl.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(bl,"connected",(()=>this.requestUpdate())),this.listenTo(bl,"reconnected",(()=>this.requestUpdate())),this.listenTo(bl,"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=>nh`<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-12-29 14:11:55 +01:00
${e.num_minimized} ${qy("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-12-29 14:11:55 +01:00
${e.chats.map((e=>nh`<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-12-29 14:11:55 +01:00
</div>`)(s)}async initToggle(){const e=`converse.minchatstoggle-${bl.bare_jid}`;this.minchats=new dA({id:e}),vc(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:uA,u:hA}=Ah.env;function mA(e){if("controlbox"===e.model.get("id")){if(hA.isVisible(e))return hA.getOuterWidth(e,!0);{const e=document.querySelector("converse-controlbox-toggle");return e?hA.getOuterWidth(e,!0):0}}return!e.model.get("minimized")&&hA.isVisible(e)?hA.getOuterWidth(e,!0):0}function fA(){const e=document.querySelector("converse-minimized-chats");return bl.chatboxes.pluck("minimized").includes(!0)?hA.getOuterWidth(e,!0):0}function gA(e){const t=e?e.model.get("id"):null,n=e?hA.getOuterWidth(e,!0):0;return Object.values(bl.chatboxviews.xget(t)).reduce(((e,t)=>e+mA(t)),n)}function pA(e){if(bl.isTestEnv()||Vl.settings.get("no_trimming")||"overlayed"!==Vl.settings.get("view_mode"))return;const t=bl.chatboxviews.filter((e=>!e.model.get("minimized")&&!e.model.get("closed")&&hA.isVisible(e)));if(t.length<=1)return;const n=hA.getOuterWidth(document.querySelector("body"),!0);if(mA(t[0])===n)return;if(document.querySelector("converse-minimized-chats"))for(;fA()+gA(e)>n;){const t=vA([e?e.model.get("id"):null]);if(!t)break;{const e=bl.chatboxes.get(t.get("id"));e?.save("hidden",!0),_A(t)}}}function vA(e){e.push("controlbox");let t=0,n=bl.chatboxes.sort().at(t);for(;e.includes(n.get("id"))||!0===n.get("minimized");)if(t++,n=bl.chatboxes.at(t),!n)return null;return n}function yA(e,t){e?.preventDefault?e.preventDefault():t=e,hA.safeSave(t,{hidden:!1,minimized:!1,time_opened:(new Date).getTime()})}function _A(e,t){e?.preventDefault?e.preventDefault():t=e,t.setChatState(bl.INACTIVE),hA.safeSave(t,{hidden:!0,minimized:!0,time_minimized:(new Date).toISOString()})}function bA(e){e.get("minimized")?function(e){Vl.trigger("chatBoxMinimized",e)}(e):function(e){e.isScrolledUp()||e.clearUnreadMsgCounter(),e.setChatState(bl.ACTIVE),Vl.trigger("chatBoxMaximized",e)}(e)}Vl.elements.define("converse-minimized-chat",class extends Gy{static get properties(){return{model:{type:Object},title:{type:String},type:{type:String},num_unread:{type:Number}}}render(){return(e=>{const t=qy("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)",nh`
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-12-29 14:11:55 +01:00
${e.num_unread?nh`<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-12-29 14:11:55 +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(),yA(this.model)}});var wA=n(5784),SA={};SA.styleTagTransform=i_(),SA.setAttributes=e_(),SA.insert=Yy().bind(null,"head"),SA.domAPI=Qy(),SA.insertStyleElement=n_();Jy()(wA.Z,SA);wA.Z&&wA.Z.locals&&wA.Z.locals;Ah.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")&&yA(e)),e),"controlbox"!==e.get("id")&&e.save({minimized:e.get("minimized")||!1,time_minimized:e.get("time_minimized")||uA()})}(e),e.on("change:minimized",(()=>bA(e)))}Vl.settings.extend({no_trimming:!1}),Vl.promises.add("minimizedChatsInitialized"),bl.MinimizedChatsToggle=dA,bl.minimize={trimChats:pA,minimize:_A,maximize:yA},Vl.listen.on("chatBoxViewInitialized",(e=>bl.minimize.trimChats(e))),Vl.listen.on("chatRoomViewInitialized",(e=>bl.minimize.trimChats(e))),Vl.listen.on("controlBoxOpened",(e=>bl.minimize.trimChats(e))),Vl.listen.on("chatBoxInitialized",e),Vl.listen.on("chatRoomInitialized",e),Vl.listen.on("getHeadingButtons",((e,t)=>e.model.get("type")===bl.CHATROOMS_TYPE?function(e,t){const n={a_class:"toggle-chatbox-button",handler:t=>_A(t,e.model),i18n_text:qy("Minimize"),i18n_title:qy("Minimize this groupchat"),icon_class:"fa-minus",name:"minimize",standalone:"overlayed"===bl.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=>_A(t,e.model),i18n_text:qy("Minimize"),i18n_title:qy("Minimize this chat"),icon_class:"fa-minus",name:"minimize",standalone:"overlayed"===bl.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=Il((()=>bl.minimize.trimChats()),250);Vl.listen.on("registeredGlobalEventHandlers",(()=>window.addEventListener("resize",t))),Vl.listen.on("unregisteredGlobalEventHandlers",(()=>window.removeEventListener("resize",t)))}});var xA=n(3243),EA=n.n(xA);const{Strophe:AA}=Ah.env,CA="Notification"in window;let $A;function kA(e){return bl.isTestEnv()||(bl.chatboxes.get(e.from)?.isHidden()??!1)}function jA(){return bl.isTestEnv()||CA&&Vl.settings.get("show_desktop_notifications")&&"granted"===Notification.permission}function TA(){$A=null,navigator.clearAppBadge?.().catch((e=>Yc.error("Could not clear unread count in app badge "+e)))}function IA(){if(Vl.settings.get("show_tab_notifications")){$A=$A??new Ah.env.Favico({type:"circle",animation:"pop"});const e=bl.chatboxes.models.reduce(((e,t)=>e+(t.get("num_unread")||0)),0);$A.badge(e),navigator.setAppBadge?.(e).catch((e=>Yc.error("Could set unread count in app badge - "+e)))}}function NA(e,t,n){return e.reduce(((e,s)=>e||(e=>[bl.bare_jid,`${t}/${n}`].includes(e.uri.replace(/^xmpp:/,"")))(s)),!1)}function OA(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=Vl.settings.get("notify_all_room_messages"),i=bl.chatboxes.get(n),r=AA.getResourceFromJid(t),o=r&&AA.unescapeNode(r)||"";let a=!1;const c=i.get("nick");Vl.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-12-29 14:11:55 +01:00
</form>`})(this)}getModalTitle(){return qy("Change chat status")}clearStatusMessage(e){e&&e.preventDefault&&(e.preventDefault(),PA.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()}}bl.ChatStatusModal=FA,Vl.elements.define("converse-chat-status-modal",FA);const UA=qy("Your profile picture");Vl.elements.define("converse-image-picker",class extends Gy{static get properties(){return{height:{type:Number},data:{type:Object},width:{type:Number}}}render(){return nh`
<a class="change-avatar" @click=${this.openFileSelection} title="${UA}">
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-12-29 14:11:55 +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 BA=e=>{const t={...e.model.toJSON(),...e.model.vcard.toJSON()},n=qy("Email"),s=qy("Full Name"),i=qy("XMPP Address"),r=qy("Nickname"),o=qy("Role"),a=qy("Save and close"),c=qy("Use commas to separate multiple roles. Your roles are shown next to your name on your chat messages."),l=qy("URL"),d=qy("OMEMO"),u=qy("Profile"),h=qy("Reset Password"),m=[nh`<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-12-29 14:11:55 +01:00
</li>`];return m.push(nh`<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-12-29 14:11:55 +01:00
</li>`),bl.pluggable.plugins["converse-omemo"]?.enabled(bl)&&m.push(nh`<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-12-29 14:11:55 +01:00
</li>`),nh`
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-12-29 14:11:55 +01:00
${"passwordreset"===e.tab?nh`<converse-change-password-form></converse-change-password-form>`:""}
2023-01-07 22:34:35 +01:00
</div>
2023-12-29 14:11:55 +01:00
${bl.pluggable.plugins["converse-omemo"]?.enabled(bl)?(e=>nh`
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-12-29 14:11:55 +01:00
${"omemo"===e.tab?nh`<converse-omemo-profile></converse-omemo-profile>`:""}
2022-12-17 22:08:36 +01:00
</div>`)(e):""}
</div>
2023-12-29 14:11:55 +01:00
</div>`};var qA=n(4923),HA=n.n(qA);const{Strophe:GA,$iq:WA,sizzle:VA,u:JA}=Ah.env;Vl.elements.define("converse-change-password-form",class extends Gy{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=qy("Submit"),n=qy("The new passwords must match"),s=qy("New password"),i=qy("Confirm new password");return nh`<form class="converse-form passwordreset-form" method="POST" @submit=${t=>e.onSubmit(t)}>
${e.alert_message?nh`<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-12-29 14:11:55 +01:00
${e.passwords_mismatched?nh`<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-12-29 14:11:55 +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=WA({type:"get",to:bl.domain}).c("query",{xmlns:GA.NS.REGISTER}),n=await Vl.sendIQ(t);if(null===n)return void(this.alert_message=qy("Timeout error"));if(VA(`error service-unavailable[xmlns="${GA.NS.STANZAS}"]`,n).length)return void(this.alert_message=qy("Your server does not support in-band password reset"));if(JA.isErrorStanza(n))return this.alert_message=qy("Your server responded with an unknown error, check the console for details"),Yc.error("Could not set password"),void Yc.error(n);const s=n.querySelector("username").textContent,i=new FormData(e.target).get("password"),r=WA({type:"set",to:bl.domain}).c("query",{xmlns:GA.NS.REGISTER}).c("username",{},s).c("password",{},i),o=await Vl.sendIQ(r);null===o?this.alert_message=qy("Timeout error while trying to set your password"):VA(`error not-allowed[xmlns="${GA.NS.STANZAS}"]`,o).length?this.alert_message=qy("Your server does not allow in-band password reset"):VA(`error forbidden[xmlns="${GA.NS.STANZAS}"]`,o).length||JA.isErrorStanza(o)?this.alert_message=qy("You are not allowed to change your password"):Vl.alert("info",qy("Success"),[qy("Your new password has been set")])}});const ZA=new(HA())({targetSize:.1,quality:.75,maxWidth:256,maxHeight:256});Vl.elements.define("converse-profile-modal",class extends tb{constructor(e){super(e),this.tab="profile"}initialize(){super.initialize(),this.listenTo(this.model,"change",this.render),Vl.trigger("profileModalInitialized",this.model)}renderModal(){return BA(this)}getModalTitle(){return qy("Your Profile")}async setVCard(e){try{await Vl.vcard.set(bl.bare_jid,e)}catch(e){return Yc.fatal(e),void this.alert([qy("Sorry, an error happened while trying to save your profile data."),qy("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];ZA.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 QA=e=>{const t=qy("%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=qy("%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=Vl.settings.get("show_client_info"),i=Vl.settings.get("allow_adhoc_commands");return nh`
${s&&i?(e=>{const t=qy("About"),n=qy("Commands");return nh`
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-12-29 14:11:55 +01:00
${s?nh`
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-12-29 14:11:55 +01:00
<p class="brand-subtitle">${bl.VERSION_NAME}</p>
<p class="brand-subtitle">${lx(wo().sanitize(t))}</p>
<p class="brand-subtitle">${lx(wo().sanitize(n))}</p>
2022-12-17 22:08:36 +01:00
</div>
</div>`:""}
2023-12-29 14:11:55 +01:00
${i?nh`
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-12-29 14:11:55 +01:00
`};Vl.elements.define("converse-user-settings-modal",class extends tb{constructor(e){super(e);const t=Vl.settings.get("show_client_info"),n=Vl.settings.get("allow_adhoc_commands");t&&n||t?this.tab="about":n&&(this.tab="commands")}renderModal(){return QA(this)}getModalTitle(){return qy("Settings")}});const{Strophe:KA,$iq:YA,sizzle:XA,u:eC}=Ah.env;async function tC(e){e?.preventDefault();await Vl.confirm(qy("Are you sure you want to log out?"))&&Vl.user.logout()}function nC(){const e=qy("Log out");return nh`<a class="controlbox-heading__btn logout align-self-center" title="${e}" @click=${tC}>
2022-12-17 22:08:36 +01:00
<converse-icon class="fa fa-sign-out-alt" size="1em"></converse-icon>
2023-12-29 14:11:55 +01:00
</a>`}const sC=e=>{const t=e.model.get("status")||"offline",n=e.model.get("status_message")||qy("I am %1$s","chat"===(s=t)?qy("online"):"dnd"===s?qy("busy"):"xa"===s?qy("away for long"):"away"===s?qy("away"):"offline"===s?qy("offline"):qy(s)||qy("online"));var s;const i=qy("Click to change your chat status"),r=Vl.settings.get("show_client_info")||Vl.settings.get("allow_adhoc_commands");let o,a;return[o,a]="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"],nh`
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-06-25 15:59:31 +02:00
<span class="username w-100 align-self-center">${e.model.getDisplayName()}</span>
2023-12-29 14:11:55 +01:00
${r?function(e){const t=qy("Show details about this chat client");return nh`<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-12-29 14:11:55 +01:00
${Vl.settings.get("allow_logout")?nC():""}
2022-12-17 22:08:36 +01:00
</div>
<div class="d-flex xmpp-status">
2023-06-25 15:59:31 +02:00
<a class="change-status" title="${i}" data-toggle="modal" data-target="#changeStatusModal" @click=${e.showStatusChangeModal}>
2023-01-07 22:34:35 +01:00
<span class="${t} w-100 align-self-center" data-value="${t}">
2023-06-25 15:59:31 +02:00
<converse-icon color="var(--${a})" style="margin-top: -0.1em" size="0.82em" class="${o}"></converse-icon> ${n}</span>
2022-12-17 22:08:36 +01:00
</a>
</div>
2023-12-29 14:11:55 +01:00
</div>`};Vl.elements.define("converse-user-profile",class extends Gy{initialize(){this.model=bl.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 sC(this)}showProfileModal(e){e?.preventDefault(),Vl.modal.show("converse-profile-modal",{model:this.model},e)}showStatusChangeModal(e){e?.preventDefault(),Vl.modal.show("converse-chat-status-modal",{model:this.model},e)}showUserSettingsModal(e){e?.preventDefault(),Vl.modal.show("converse-user-settings-modal",{model:this.model,_converse:bl},e)}}),Ah.plugins.add("converse-profile",{dependencies:["converse-status","converse-modal","converse-vcard","converse-chatboxviews","converse-adhoc-views"],initialize(){Vl.settings.extend({show_client_info:!0})}});const iC=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 cs(J(n)?ts(n):[n],tr(t,1))},rC={name:"AES-GCM",length:128},oC={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:aC,URI:cC,sizzle:lC,u:dC}=Ah.env;function uC(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 hC(e,t){return e.get("omemo_active")&&t.body&&(t.is_encrypted=!0,t.plaintext=t.body,t.body=qy("This is an OMEMO encrypted message which your client doesnt seem to support. Find more information on https://conversations.im/omemo")),t}async function mC(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 Yc.error(`${t.name}: Failed to download encrypted media: ${e}`),Yc.error(t),null}if(t.status>=200&&t.status<400)return t.arrayBuffer()}(n);if(null===s)return Yc.error(`Could not decrypt a received encrypted file ${e.toString()} since it could not be downloaded`),new Error(qy("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-64),o=i.replac
<button class="toggle-omemo" title="${i}" data-disabled=${!n.get("omemo_supported")} @click=${IC}>
2022-01-03 11:54:10 +01:00
<converse-icon
class="fa ${n.get("omemo_active")?"fa-lock":"fa-unlock"}"
2023-12-29 14:11:55 +01:00
path-prefix="${Vl.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-12-29 14:11:55 +01:00
`),t}async function OC(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=qy("Sorry, no devices found to which we can send an OMEMO encrypted message.");let n;if(e.get("type")===bl.CHATROOMS_TYPE){const t=await Promise.all(e.occupants.map((e=>AC(e.get("jid")))));n=t.reduce(((e,t)=>iC(e,t.models)),[])}else if(e.get("type")===bl.PRIVATE_CHAT_TYPE){const s=await AC(e.get("jid"));if(0===s.length){const e=new Error(t);throw e.user_facing=!0,e}const i=(await Vl.omemo.devicelists.get(bl.bare_jid)).devices;n=[...i.models,...s.models]}const s=bl.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=>CC(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:aC.NS.OMEMO}).c("header",{sid:bl.omemo_store.get("device_id")});const{key_and_tag:r,iv:o,payload:a}=await MC.encryptMessage(s.get("plaintext")),c=await Promise.all(i.filter((e=>-1!=e.get("trusted")&&e.get("active"))).map((e=>function(e,t){return _C(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:aC.NS.HINTS}).up(),n.c("encryption",{xmlns:aC.NS.EME,namespace:aC.NS.OMEMO}),{message:s,stanza:n}}const MC={decryptMessage:async function(e){const t=await crypto.subtle.importKey("raw",e.key,rC,!0,["encrypt","decrypt"]),n=Bg(Vg(e.payload),e.tag),s={name:"AES-GCM",iv:Vg(e.iv),tagLength:128};return Hg(await crypto.subtle.decrypt(s,t,n))},encryptMessage:async function(e){const t=crypto.getRandomValues(new window.Uint8Array(12)),n=await crypto.subtle.generateKey(rC,!0,["encrypt","decrypt"]),s={name:"AES-GCM",iv:t,tagLength:128},i=await crypto.subtle.encrypt(s,n,Gg(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:Bg(c,a),payload:Wg(o),iv:Wg(t)}},formatFingerprint:uC},RC=e=>{const t=qy("OMEMO Fingerprints"),n=qy("No OMEMO-enabled devices found"),s=e.devicelist.devices;return nh`
2022-01-03 11:54:10 +01:00
<hr/>
<ul class="list-group fingerprints">
<li class="list-group-item active">${t}</li>
2023-12-29 14:11:55 +01:00
${s.length?s.map((t=>((e,t)=>{const n=qy("Trusted"),s=qy("Untrusted");return t.get("bundle")&&t.get("bundle").fingerprint?nh`
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-12-29 14:11:55 +01:00
<code class="fingerprint">${uC(t.get("bundle").fingerprint)}</code>
2022-01-03 11:54:10 +01:00
</form>
</li>
2023-12-29 14:11:55 +01:00
`:""})(e,t))):nh`<li class="list-group-item"> ${n} </li>`}
2022-01-03 11:54:10 +01:00
</ul>
2023-12-29 14:11:55 +01:00
`};Vl.elements.define("converse-omemo-fingerprints",class extends Gy{static get properties(){return{jid:{type:String}}}async initialize(){this.devicelist=await Vl.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?RC(this):""}toggleDeviceTrust(e){const t=e.target;this.devicelist.devices.get(t.getAttribute("name")).save("trusted",parseInt(t.value,10))}});const DC=e=>nh`
${e.device.get("bundle")&&e.device.get("bundle").fingerprint?(e=>{const t=qy("Checkbox for selecting the following fingerprint");return nh`
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-12-29 14:11:55 +01:00
<span class="fingerprint">${uC(e.device.get("bundle").fingerprint)}</span>
2022-01-03 11:54:10 +01:00
</label>
</li>
2023-12-29 14:11:55 +01:00
`})(e):(e=>{const t=qy("Device without a fingerprint"),n=qy("Checkbox for selecting the following device");return nh`
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-12-29 14:11:55 +01:00
`,zC=e=>{const t=qy("This device's OMEMO fingerprint"),n=qy("Generate new keys and fingerprint");return nh`
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-12-29 14:11:55 +01:00
${e.current_device&&e.current_device.get("bundle")&&e.current_device.get("bundle").fingerprint?(e=>nh`
<span class="fingerprint">${uC(e.current_device.get("bundle").fingerprint)}</span>`)(e):Sb()}
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-12-29 14:11:55 +01:00
${e.other_devices?.length?(e=>{const t=qy("Other OMEMO-enabled devices"),n=qy("Checkbox to select fingerprints of all other OMEMO devices"),s=qy("Remove checked devices and close"),i=qy("Select all");return nh`
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-12-29 14:11:55 +01:00
${e.other_devices?.map((t=>DC(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-12-29 14:11:55 +01:00
</form>`},{Strophe:LC,sizzle:PC,u:FC}=Ah.env;Vl.elements.define("converse-omemo-profile",class extends Gy{async initialize(){this.devicelist=await Vl.omemo.devicelists.get(bl.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 Vl.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?zC(this):Sb()}selectAll(e){let t=FC.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=PC('.fingerprint-removal-item input[type="checkbox"]:checked',e.target).map((e=>e.value));try{await this.devicelist.removeOwnDevices(t)}catch(e){Yc.error(e),bl.api.alert(LC.LogLevel.ERROR,qy("Error"),[qy("Sorry, an error occurred while trying to remove the devices.")])}await this.setAttributes(),this.requestUpdate()}async generateOMEMODeviceBundle(e){e.preventDefault();await Vl.confirm(qy("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 Vl.omemo.bundle.generate(),await this.setAttributes(),this.requestUpdate())}});const UC={async generateFingerprints(e){const t=await AC(e);return Promise.all(t.map((e=>EC(e))))},getDeviceForContact:(e,t)=>AC(e).then((e=>e.get(t))),contactHasOMEMOSupport:async e=>(await AC(e)).length>0},BC=UC;class qC extends Error{constructor(e,t){super(e,t),this.name="IQError",this.iq=t}}const{Strophe:HC,sizzle:GC,$iq:WC}=Ah.env,VC=dr.extend({defaults:{trusted:0,active:!0},getRandomPreKey(){const e=this.get("bundle");return e.prekeys[Uc(e.prekeys.length)]},async fetchBundleFromServer(){const e=WC({type:"get",from:bl.bare_jid,to:this.get("jid")}).c("pubsub",{xmlns:HC.NS.PUBSUB}).c("items",{node:`${HC.NS.OMEMO_BUNDLES}:${this.get("id")}`});let t;try{t=await Vl.sendIQ(e)}catch(t){return Yc.error(`Could not fetch bundle for device ${this.get("id")} from ${this.get("jid")}`),Yc.error(t),null}if(t.querySelector("error"))throw new qC("Could not fetch bundle",t);const n=GC(`items[node="${HC.NS.OMEMO_BUNDLES}:${this.get("id")}"]`,t).pop(),s=xC(GC(`bundle[xmlns="${HC.NS.OMEMO}"]`,n).pop());return this.save("bundle",s),s},getBundle(){return this.get("bundle")?Promise.resolve(this.get("bundle"),this):this.fetchBundleFromServer()}}),{Strophe:JC,$build:ZC,$iq:QC,sizzle:KC}=Ah.env,YC=dr.extend({idAttribute:"jid",async initialize(){this.initialized=Ao(),await this.initDevices(),this.initialized.resolve()},initDevices(){this.devices=new bl.Devices;const e=`converse.devicelist-${bl.bare_jid}-${this.get("jid")}`;return vc(this.devices,e),this.fetchDevices()},async onDevicesFound(e){if(0===e.length){let e=[];try{e=await this.fetchDevicesFromServer()}catch(e){null===e?Yc.error(`Timeout error while fetching devices for ${this.get("jid")}`):(Yc.error(`Could not fetch devices for ${this.get("jid")}`),Yc.error(e)),this.destroy()}this.get("jid")===bl.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)=>{Yc.error(n),e()}})}))),this._devices_promise},async getOwnDeviceId(){let e=bl.omemo_store.get("device_id");return this.devices.get(e)||(await bl.omemo_store.generateBundle(),e=bl.omemo_store.get("device_id")),e},async publishCurrentDevice(e){if(this.get("jid")===bl.bare_jid){if(await kC(),bl.omemo_store)return e.include
2023-02-17 12:24:37 +01:00
<div class="switch-form">
<p>${e}</p>
<p><a class="login-here toggle-register-login" href="#converse/login">${t}</a></p>
2023-12-29 14:11:55 +01:00
</div>`},_$=e=>{const t=Vl.settings.get("registration_domain"),n=qy("Create your account"),s=qy("Please enter the XMPP provider to register with:"),i=!t&&e.status===b$;return nh`
2023-02-17 12:24:37 +01:00
<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>
2023-12-29 14:11:55 +01:00
${t||(()=>{const e=Vl.settings.get("domain_placeholder"),t=qy("Tip: A list of public XMPP providers is available"),n=qy("here"),s=Vl.settings.get("providers_link");return nh`
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-12-29 14:11:55 +01:00
${i?(()=>{const e=qy("Fetch registration form"),t=qy("Already have a chat account?"),n=qy("Log in here");return nh`
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-12-29 14:11:55 +01:00
`},b$=0,w$=e=>nh`
2022-05-05 23:06:17 +02:00
<converse-brand-logo></converse-brand-logo>
2023-12-29 14:11:55 +01:00
${e.alert_message?nh`<div class="alert alert-${e.alert_type}" role="alert">${e.alert_message}</div>`:""}
${e.status===b$?_$(e):""}
${1===e.status?(e=>{const t=Vl.settings.get("registration_domain"),n=qy("Cancel");return nh`
2023-02-17 12:24:37 +01:00
<form id="converse-register" class="converse-form no-scrolling" @submit=${t=>e.onFormSubmission(t)}>
2023-06-25 15:59:31 +02:00
${Sb({classes:"hor_centered"})}
2023-12-29 14:11:55 +01:00
${t?"":nh`
2023-02-17 12:24:37 +01:00
<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):""}
2023-12-29 14:11:55 +01:00
${2===e.status?(e=>{const t=qy("Choose a different provider"),n=qy("Account Registration:"),s=qy("Register"),i=Vl.settings.get("registration_domain");return nh`
2023-02-17 12:24:37 +01:00
<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-12-29 14:11:55 +01:00
${e.fields?nh`
2023-02-17 12:24:37 +01:00
<input type="submit" class="btn btn-primary" value="${s}" />
2021-11-11 22:06:49 +01:00
`:""}
2023-12-29 14:11:55 +01:00
${i?"":nh`
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-12-29 14:11:55 +01:00
${y$()}
2021-11-11 22:06:49 +01:00
</fieldset>
</form>
`})(e):""}
2023-12-29 14:11:55 +01:00
${3===e.status?y$():""}
`;async function S$(e){await Vl.waitUntil("controlBoxInitialized");bl.chatboxes.get("controlbox").set({"active-form":e})}const x$=e=>`<value>${e}</value>`;function E$(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?Zc.getSelectValues(e):e.value,Zc.toStanza(((e,t)=>`<field var="${e}">${t}</field>`)(t,Array.isArray(n)?n.map(x$):x$(n)))}Zc.webForm2xForm=E$;var A$=n(354),C$={};C$.styleTagTransform=i_(),C$.setAttributes=e_(),C$.insert=Yy().bind(null,"head"),C$.domAPI=Qy(),C$.insertStyleElement=n_();Jy()(A$.Z,C$);A$.Z&&A$.Z.locals&&A$.Z.locals;const{Strophe:$$,sizzle:k$,$iq:j$}=Ah.env,T$=Ah.env.utils,I$=1,N$=2;Vl.elements.define("converse-register-panel",class extends Gy{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(bl,"connectionInitialized",(()=>this.registerHooks()));const e=Vl.settings.get("registration_domain");e?this.fetchRegistrationForm(e):this.status=0}render(){return w$(this)}setMessage(e,t){this.alert_type=t,this.alert_message=e}registerHooks(){const e=bl.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=bl.connection;n.connected=!0;const s=n._proto._reqToData(e);if(!s)return;if(n._proto._connect_cb(s)===$$.Status.CONNFAIL)return this.status=0,this.setErrorMessage(qy("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($$.Status.REGIFAIL),this.alert_type="danger",this.setErrorMessage(qy("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=j$({type:"get"}).c("query",{xmlns:$$.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),Vl.settings.get("registration_domain")?this.status=3:this.status=0,!1):(this.setFields(e),this.status===I$&&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=I$,this.reset({domain:$$.getDomainFromJid(e),_registering:!0}),Ll(this.domain),bl.connection?.connect(this.domain,"",(e=>this.onConnectStatusChanged(e))),!1}onConnectStatusChanged(e){Yc.debug("converse-register: onConnectStatusChanged"),[$$.Status.DISCONNECTED,$$.Status.CONNFAIL,$$.Status.REGIFAIL,$$.Status.NOTACCEPTABLE,$$.Status.CONFLICT].includes(e)?(Yc.error(`Problem during registration: Strophe.Status is ${fo[e]}`),this.abortRegistration()):e===$$.Status.REGISTERED&&(Yc.debug("Registered successfully."),bl.connection.reset(),["converse/login","converse/register"].includes(bl.router.history.getFragment())&&bl.router.navigate("",{replace:!0}),S$("login"),this.fields.password&&this.fields.username?(bl.connection.connect(this.fields.username.toLowerCase()+"@"+this.domain.toLowerCase(),this.fields.password,bl.onConnectStatusChanged),this.setFeedbackMessage(qy("Now logging you in"))):this.setFeedbackMessage(qy("Registered successfully")),this.reset())}getLegacyFormFields(){const e=Obje
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-12-29 14:11:55 +01:00
${r?nh`<label class="roomid-policy-error">${r}</label>`:""}
2022-12-17 22:08:36 +01:00
<converse-autocomplete
2023-12-29 14:11:55 +01:00
.getAutoCompleteList=${U$}
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-12-29 14:11:55 +01:00
${o?nh`<div class="form-group">${lx(wo().sanitize(o,{ALLOWED_TAGS:["b","br","em"]}))}</div>`:""}
${Vl.settings.get("locked_muc_nickname")?"":(e=>{const t=qy("Nickname"),n=qy("This field is required");return nh`
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-12-29 14:11:55 +01:00
`};var q$=n(1602),H$={};H$.styleTagTransform=i_(),H$.setAttributes=e_(),H$.insert=Yy().bind(null,"head"),H$.domAPI=Qy(),H$.insertStyleElement=n_();Jy()(q$.Z,H$);q$.Z&&q$.Z.locals&&q$.Z.locals;const G$=Ah.env.utils,{Strophe:W$}=Ah.env;Vl.elements.define("converse-add-muc-modal",class extends tb{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 B$(this)}getModalTitle(){return qy("Enter a new Groupchat")}parseRoomDataFromEvent(e){const t=new FormData(e),n=t.get("chatroom")?.trim();let s;if(Vl.settings.get("locked_muc_nickname")){if(s=bl.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),Vl.settings.get("locked_muc_domain")||Vl.settings.get("muc_domain")&&!G$.isValidJID(t.jid)?n=`${W$.escapeNode(t.jid)}@${Vl.settings.get("muc_domain")}`:(n=t.jid,this.model.setDomain(n)),Vl.rooms.open(n,Object.assign(t,{jid:n}),!0),e.target.reset(),this.modal.hide()}checkRoomidPolicy(){if(Vl.settings.get("muc_roomid_policy")&&Vl.settings.get("muc_domain")){let e=this.querySelector("converse-autocomplete input").value;!Vl.settings.get("locked_muc_domain")&&G$.isValidJID(e)||(e=`${W$.escapeNode(e)}@${Vl.settings.get("muc_domain")}`);const t=W$.getNodeFromJid(e),n=W$.getDomainFromJid(e);if(Vl.settings.get("muc_domain")===n&&!Vl.settings.get("muc_roomid_policy").test(t))return this.muc_roomid_policy_error_msg=qy("Groupchat id is invalid."),!0;this.muc_roomid_policy_error_msg=null,this.render()}}});const V$=function(e){return e&&e.length?e[0]:void 0},J$=e=>{const t=qy("Description:"),n=qy("Groupchat XMPP Address:"),s=qy("Participants:"),i=qy("Features:"),r=qy("Requires authentication"),o=qy("Hidden"),a=qy("Requires an invitation"),c=qy("Moderated"),l=qy("Non-anonymous"),d=qy("Open"),u=qy("Permanent"),h=qy("Public"),m=qy("Semi-anonymous"),f=qy("Temporary"),g=qy("Unmoderated");return nh`
2023-02-17 12:24:37 +01:00
<div class="room-info">
<p class="room-info"><strong>${n}</strong> ${e.jid}</p>
<p class="room-info"><strong>${t}</strong> ${e.desc}</p>
<p class="room-info"><strong>${s}</strong> ${e.occ}</p>
<p class="room-info"><strong>${i}</strong>
<ul>
2023-12-29 14:11:55 +01:00
${e.passwordprotected?nh`<li class="room-info locked">${r}</li>`:""}
${e.hidden?nh`<li class="room-info">${o}</li>`:""}
${e.membersonly?nh`<li class="room-info">${a}</li>`:""}
${e.moderated?nh`<li class="room-info">${c}</li>`:""}
${e.nonanonymous?nh`<li class="room-info">${l}</li>`:""}
${e.open?nh`<li class="room-info">${d}</li>`:""}
${e.persistent?nh`<li class="room-info">${u}</li>`:""}
${e.publicroom?nh`<li class="room-info">${h}</li>`:""}
${e.semianonymous?nh`<li class="room-info">${m}</li>`:""}
${e.temporary?nh`<li class="room-info">${f}</li>`:""}
${e.unmoderated?nh`<li class="room-info">${g}</li>`:""}
2023-02-17 12:24:37 +01:00
</ul>
</p>
</div>
2023-12-29 14:11:55 +01:00
`},Z$=e=>nh`
${e.show_form?(e=>{const t=qy("Show groupchats"),n=qy("Server address");return nh`
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-12-29 14:11:55 +01:00
${e.loading_items?nh`<li class="list-group-item"> ${Sb()} </li>`:""}
${e.feedback_text?nh`<li class="list-group-item active">${e.feedback_text}</li>`:""}
${Mw(e.items,(e=>e.jid),(t=>((e,t)=>{const n=qy("Show more information on this groupchat"),s=qy("Click to open this groupchat");return nh`
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-12-29 14:11:55 +01:00
`,{Strophe:Q$,$iq:K$,sizzle:Y$}=Ah.env,X$=Ah.env.utils;function ek(e){const t=X$.ancestor(e.target,".room-item"),n=t.querySelector("div.room-info");n?(X$.slideIn(n).then(X$.removeElement),t.querySelector("a.room-info").classList.remove("selected")):(t.insertAdjacentElement("beforeend",X$.getElementFromTemplateResult(Sb())),Vl.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",X$.getElementFromTemplateResult(J$({jid:t.getAttribute("from"),desc:V$(Y$('field[var="muc#roominfo_description"] value',t))?.textContent,occ:V$(Y$('field[var="muc#roominfo_occupants"] value',t))?.textContent,hidden:Y$('feature[var="muc_hidden"]',t).length,membersonly:Y$('feature[var="muc_membersonly"]',t).length,moderated:Y$('feature[var="muc_moderated"]',t).length,nonanonymous:Y$('feature[var="muc_nonanonymous"]',t).length,open:Y$('feature[var="muc_open"]',t).length,passwordprotected:Y$('feature[var="muc_passwordprotected"]',t).length,persistent:Y$('feature[var="muc_persistent"]',t).length,publicroom:Y$('feature[var="muc_publicroom"]',t).length,semianonymous:Y$('feature[var="muc_semianonymous"]',t).length,temporary:Y$('feature[var="muc_temporary"]',t).length,unmoderated:Y$('feature[var="muc_unmoderated"]',t).length})))}(t,e))).catch((e=>Yc.error(e))))}function tk(e){return Oc()&&!e.get("hidden")}Vl.elements.define("converse-muc-list-modal",class extends tb{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",(()=>Vl.settings.get("locked_muc_domain")&&this.updateRoomsList())),this.model.save("feedback_text","")}renderModal(){return Z$(Object.assign(this.model.toJSON(),{show_form:!Vl.settings.get("locked_muc_domain"),server_placeholder:this.model.get("muc_domain")||qy("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 qy("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(),Vl.rooms.open(t,{name:n},!0)}toggleRoomInfo(e){e.preventDefault(),ek(e)}onDomainChange(){Vl.settings.get("auto_list_rooms")&&this.updateRoomsList()}onRoomsFound(e){this.loading_items=!1;const t=e?Y$("query item",e):[];return t.length?(this.model.set({feedback_text:qy("Groupchats found")},{silent:!0}),this.items=t.map(pm)):(this.items=[],this.model.set({feedback_text:qy("No groupchats found")},{silent:!0})),this.render(),!0}updateRoomsList(){const e=K$({to:this.model.get("muc_domain"),from:bl.connection.jid,type:"get"}).c("query",{xmlns:Q$.NS.DISCO_ITEMS});Vl.sendIQ(e).then((e=>this.onRoomsFound(e))).catch((()=>this.onRoomsFound()))}showRooms(e){e.preventDefault(),this.loading_items=!0,this.render();const t=new FormData(e.target);this.model.setDomain(t.get("server")),this.updateRoomsList()}setDomainFromEvent(e){this.model.setDomain(e.target.value)}setNick(e){this.model.save({nick:e.target.value})}});function nk(e,t){const n=qy("Leave this groupchat"),s=t.get("num_unread_general")||t.get("has_activity");return nh`
<div class="list-item controlbox-padded available-chatroom d-flex flex-row ${tk(t)?"open":""} ${s?"unread-msgs":""}"
2023-02-17 12:24:37 +01:00
data-room-jid="${t.get("jid")}">
2021-03-19 19:26:15 +01:00
2023-12-29 14:11:55 +01:00
${t.get("num_unread")?(e=>nh`<span class="list-item-badge badge badge--muc msgs-indicator">${e.get("num_unread")}</span>`)(t):t.get("has_activity")?nh`<span class="list-item-badge badge badge--muc msgs-indicator"></span>`:""}
2021-11-11 22:06:49 +01:00
2021-03-19 19:26:15 +01:00
<a class="list-item-link open-room available-room w-100"
2023-02-17 12:24:37 +01:00
data-room-jid="${t.get("jid")}"
2023-12-29 14:11:55 +01:00
title="${qy("Click to open this groupchat")}"
2023-02-17 12:24:37 +01:00
@click=${t=>e.openRoom(t)}>${t.getDisplayName()}</a>
2022-12-17 22:08:36 +01:00
2023-12-29 14:11:55 +01:00
${Vl.settings.get("allow_bookmarks")?function(e){const t=e.get("bookmarked")??!1,n=qy("Bookmark");return nh`
2023-02-17 12:24:37 +01:00
<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"
2023-12-29 14:11:55 +01:00
color="${tk(e)?"var(--inverse-link-color)":""}"></converse-icon>
2023-02-17 12:24:37 +01:00
</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")}"
2023-12-29 14:11:55 +01:00
title="${qy("Show more information on this groupchat")}"
2023-02-17 12:24:37 +01:00
@click=${t=>e.showRoomDetailsModal(t)}>
2021-03-19 19:26:15 +01:00
2023-12-29 14:11:55 +01:00
<converse-icon class="fa fa-info-circle" size="1.2em" color="${tk(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)}>
2023-12-29 14:11:55 +01:00
<converse-icon class="fa fa-sign-out-alt" size="1.2em" color="${tk(t)?"var(--inverse-link-color)":""}"></converse-icon>
2022-12-17 22:08:36 +01:00
</a>
2023-12-29 14:11:55 +01:00
</div>`}const{Strophe:sk,u:ik}=Ah.env;Vl.elements.define("converse-rooms-list",class extends Gy{initialize(){const e=`converse.roomspanel${bl.bare_jid}`;this.model=new D$({id:e}),vc(this.model,e),this.model.fetch(),this.listenTo(bl.chatboxes,"add",this.renderIfChatRoom),this.listenTo(bl.chatboxes,"remove",this.renderIfChatRoom),this.listenTo(bl.chatboxes,"destroy",this.renderIfChatRoom),this.listenTo(bl.chatboxes,"change",this.renderIfRelevantChange),this.listenTo(this.model,"change",(()=>this.requestUpdate())),this.requestUpdate()}render(){return(e=>{const{chatboxes:t,CHATROOMS_TYPE:n,CLOSED:s}=bl,i=t.filter((e=>e.get("type")===n));i.sort(((e,t)=>e.getDisplayName().toLowerCase()<=t.getDisplayName().toLowerCase()?-1:1));const r=qy("Click to toggle the list of open groupchats"),o=qy("Groupchats"),a=qy("Query for groupchats"),c=qy("Add a new groupchat"),l=qy("Show bookmarked groupchats"),d=e.model.get("toggle_state")===s;return nh`
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-12-29 14:11:55 +01:00
@click=${t=>Vl.modal.show("converse-bookmark-list-modal",{model:e.model},t)}
2023-02-17 12:24:37 +01:00
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-12-29 14:11:55 +01:00
@click=${t=>Vl.modal.show("converse-muc-list-modal",{model:e.model},t)}
2023-02-17 12:24:37 +01:00
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-12-29 14:11:55 +01:00
@click=${t=>Vl.modal.show("converse-add-muc-modal",{model:e.model},t)}
2023-02-17 12:24:37 +01:00
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":""}">
2023-12-29 14:11:55 +01:00
${i.map((t=>nk(e,t)))}
2021-03-19 19:26:15 +01:00
</div>
2023-12-29 14:11:55 +01:00
</div>`})(this)}renderIfChatRoom(e){ik.isChatRoom(e)&&this.requestUpdate()}renderIfRelevantChange(e){const t=["bookmarked","hidden","name","num_unread","num_unread_general","has_activity"],n=e.changed||{};ik.isChatRoom(e)&&Object.keys(n).filter((e=>t.includes(e))).length&&this.requestUpdate()}showRoomDetailsModal(e){const t=e.currentTarget.getAttribute("data-room-jid"),n=bl.chatboxes.get(t);e.preventDefault(),Vl.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 Vl.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 Vl.confirm(qy("Are you sure you want to leave the groupchat %1$s?",t))){(await Vl.rooms.get(n)).close()}}toggleRoomsList(e){e?.preventDefault?.();const t=this.querySelector(".open-rooms-list");this.model.get("toggle_state")===bl.CLOSED?ik.slideOut(t).then((()=>this.model.save({toggle_state:bl.OPENED}))):ik.slideIn(t).then((()=>this.model.save({toggle_state:bl.CLOSED})))}}),Ah.plugins.add("converse-roomslist",{dependencies:["converse-singleton","converse-controlbox","converse-muc","converse-bookmarks"],initialize(){}});Vl.elements.define("converse-fontawesome",class extends Gy{render(){return nh`
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-12-29 14:11:55 +01:00
`}});function rk(){if(!Vl.settings.get("auto_insert"))return;const e=Vl.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 ok=n(4412),ak={};ak.styleTagTransform=i_(),ak.setAttributes=e_(),ak.insert=Yy().bind(null,"head"),ak.domAPI=Qy(),ak.insertStyleElement=n_();Jy()(ok.Z,ak);ok.Z&&ok.Z.locals&&ok.Z.locals;class ck extends Gy{render(){return(()=>{const e=Vl.settings.get("singleton")?["converse-singleton"]:[];return e.push(`converse-${Vl.settings.get("view_mode")}`),nh`
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-12-29 14:11:55 +01:00
`})()}initialize(){this.setAttribute("id","conversejs"),this.setClasses();const e=wc();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-${Vl.settings.get("view_mode")}`),this.classList.add(`theme-${window.matchMedia("(prefers-color-scheme: dark)").matches?Vl.settings.get("dark_theme"):Vl.settings.get("theme")}`),this.requestUpdate()}}Ah.plugins.add("converse-rootview",{initialize(){Vl.settings.extend({auto_insert:!0,theme:"classic",dark_theme:"dracula"}),Vl.listen.on("chatBoxesInitialized",rk),Vl.elements.define("converse-root",ck)}});const lk=e=>{const t=qy("Add"),n=qy("name@example.org"),s=qy("Please enter a valid XMPP address"),i=qy("Group"),r=qy("Name"),o=qy("XMPP Address");return nh`
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-12-29 14:11:55 +01:00
<input type="text" name="jid" ?required=${!Vl.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-12-29 14:11:55 +01:00
<converse-autocomplete .list=${function(){const{roster:e}=bl,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-12-29 14:11:55 +01:00
</form>`};Vl.elements.define("converse-add-contact-modal",class extends tb{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 lk(this)}getModalTitle(){return qy("Add a Contact")}afterRender(){"string"==typeof Vl.settings.get("xhr_user_search_url")?this.initXHRAutoComplete():this.initJIDAutoComplete()}initJIDAutoComplete(){if(!Vl.settings.get("autocomplete_add_contact"))return;const e=this.querySelector(".suggestion-box__jid").parentElement;this.jid_auto_complete=new bl.AutoComplete(e,{data:(e,t)=>`${t.slice(0,t.indexOf("@"))}@${e}`,filter:bl.FILTER_STARTSWITH,list:[...new Set(bl.roster.map((e=>so.getDomainFromJid(e.get("jid")))))]})}initGroupAutoComplete(){if(!Vl.settings.get("autocomplete_add_contact"))return;const e=this.querySelector(".suggestion-box__jid").parentElement;this.jid_auto_complete=new bl.AutoComplete(e,{data:(e,t)=>`${t.slice(0,t.indexOf("@"))}@${e}`,filter:bl.FILTER_STARTSWITH,list:[...new Set(bl.roster.map((e=>so.getDomainFromJid(e.get("jid")))))]})}initXHRAutoComplete(){if(!Vl.settings.get("autocomplete_add_contact"))return this.initXHRFetch();const e=this.querySelector(".suggestion-box__name").parentElement;this.name_auto_complete=new bl.AutoComplete(e,{auto_evaluate:!1,filter:bl.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",Il((()=>{t.open("GET",`${Vl.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=qy("Sorry, could not find a contact with that name"),void z_("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||So(e.split("@")).length<2?(z_("is-invalid",this.querySelector('input[name="jid"]')),z_("d-block",t),!1):bl.roster.get(so.getBareJidFromJid(e))?(t.textContent=qy("This contact has already been added"),z_("d-block",t),!1):(L_("d-block",t),!0)}afterSubmission(e,t,n,s){s&&!Array.isArray(s)&&(s=[s]),bl.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 Vl.settings.get("xhr_user_search_url")){const e=this.querySelector('input[name="name"]');return this.xhr.open("GET",`${Vl.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:dk}=Ah.env;function uk(e){const t=e.get("jid"),n=[];if(Oc()){const e=bl.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||dk.isSameBareJID(t,bl.connection.jid))&&(n.push("current-xmpp-contact"),n.push(r),n.push(e.presence.get("show"))),nh`
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-12-29 14:11:55 +01:00
</li>`}const hk=e=>{const t=qy("Click to hide these contacts"),n=bl.roster.state.get("collapsed_groups");return nh`
2022-05-05 23:06:17 +02:00
<div class="roster-group" data-group="${e.name}">
2023-12-29 14:11:55 +01:00
<a href="#" class="list-toggle group-toggle controlbox-padded" title="${t}" @click=${t=>function(e,t){e?.preventDefault?.();const n=bl.roster.state.get("collapsed_groups");n.includes(t)?bl.roster.state.save("collapsed_groups",n.filter((e=>e!==t))):bl.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-12-29 14:11:55 +01:00
${Mw(e.contacts,(e=>e.get("jid")),uk)}
2022-05-05 23:06:17 +02:00
</ul>
2023-12-29 14:11:55 +01:00
</div>`},mk=e=>{const t=qy("Contacts"),n=qy("Click to toggle contacts"),s=qy("Add a contact"),i=qy("Re-sync your contacts"),r=(bl.roster||[]).reduce(((e,t)=>function(e,t){if(t.get("requesting")){const n=bl.HEADER_REQUESTING_CONTACTS;e[n]?e[n].push(t):e[n]=[t]}else{let n;Vl.settings.get("roster_groups")?(n=t.get("groups"),n=0===n.length?[bl.HEADER_UNGROUPED]:n):n="subscribe"===t.get("ask")?[bl.HEADER_PENDING_CONTACTS]:[bl.HEADER_CURRENT_CONTACTS];for(const s of n)e[s]?e[s].push(t):e[s]=[t]}if(t.get("num_unread")){const n=bl.HEADER_UNREAD;e[n]?e[n].push(t):e[n]=[t]}return e}(e,t)),{}),o=Object.keys(r).filter(WS),a=e.model.get("toggle_state")===bl.CLOSED;return o.sort(Lv),nh`
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-12-29 14:11:55 +01:00
${Vl.settings.get("allow_contact_requests")?nh`
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-12-29 14:11:55 +01:00
${Mw(o,(e=>e),(e=>{const t=r[e].filter((t=>function(e,t){const n=e.presence.get("show");return Vl.settings.get("hide_offline_users")&&"offline"===n?("subscribe"===e.get("ask")||"from"===e.get("subscription")||!0===e.get("requesting"))&&!GS(e,t):!GS(e,t)}(t,e)));return t.sort(zv),t.length?hk({contacts:t,name:e}):""}))}
2021-11-11 22:06:49 +01:00
</div>
2023-12-29 14:11:55 +01:00
`};Vl.elements.define("converse-roster",class extends Gy{async initialize(){const e=`converse.contacts-panel${bl.bare_jid}`;this.model=new dr({id:e}),vc(this.model,e),this.model.fetch(),await Vl.waitUntil("rosterInitialized");const{chatboxes:t,presences:n,roster:s}=bl;this.listenTo(bl,"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())),Vl.trigger("rosterViewInitialized")}render(){return mk(this)}showAddContactModal(e){Vl.modal.show("converse-add-contact-modal",{model:new dr},e)}async syncContacts(e){e.preventDefault();const{roster:t}=bl;this.syncing_contacts=!0,this.requestUpdate(),t.data.save("version",null),await t.fetchFromServer(),Vl.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")===bl.CLOSED?B_(t).then((()=>this.model.save({toggle_state:bl.OPENED}))):q_(t).then((()=>this.model.save({toggle_state:bl.CLOSED})))}});const fk={dnd:qy("This contact is busy"),online:qy("This contact is online"),offline:qy("This contact is offline"),unavailable:qy("This contact is unavailable"),xa:qy("This contact is away for an extended period"),away:qy("This contact is away")},gk=(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=fk[n],o=t.get("num_unread")||0,a=t.getDisplayName(),c=qy("Click to chat with %1$s (XMPP address: %2$s)",a,e.model.get("jid"));return nh`
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-12-29 14:11:55 +01:00
${o?nh`<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-12-29 14:11:55 +01:00
${Vl.settings.get("allow_contact_removal")?((e,t)=>{const n=t.getDisplayName(),s=qy("Click to remove %1$s as a contact",n);return nh`
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-12-29 14:11:55 +01:00
`})(e,t):""}`};class pk extends Gy{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())),this.listenTo(this.model,"presenceChanged",(()=>this.requestUpdate()))}render(){if(!0===this.model.get("requesting")){const e=this.model.getDisplayName();return(e=>nh`
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-12-29 14:11:55 +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:qy("Click to accept the contact request from %1$s",e),desc_decline:qy("Click to decline the contact request from %1$s",e)}))}return gk(this,this.model)}openChat(e){e?.preventDefault?.(),this.model.openChat()}async removeContact(e){if(e?.preventDefault?.(),!Vl.settings.get("allow_contact_removal"))return;if(await Vl.confirm(qy("Are you sure you want to remove this contact?")))try{this.model.removeFromRoster(),this.model.collection&&this.model.destroy()}catch(e){Yc.error(e),Vl.alert("error",qy("Error"),[qy("Sorry, there was an error while trying to remove %1$s as a contact.",this.model.getDisplayName())])}}async acceptRequest(e){e?.preventDefault?.(),await bl.roster.sendContactAddIQ(this.model.get("jid"),this.model.getFullname(),[]),this.model.authorize().subscribe()}async declineRequest(e){e&&e.preventDefault&&e.preventDefault();return await Vl.confirm(qy("Are you sure you want to decline this contact request?"))&&this.model.unauthorize().destroy(),this}}Vl.elements.define("converse-roster-contact",pk);class vk extends Gy{async initialize(){await Vl.waitUntil("rosterInitialized"),this.model=bl.roster_filter,this.liveFilter=Il((()=>{this.model.save({filter_text:this.querySelector(".roster-filter").value})}),250),this.listenTo(bl,"rosterContactsFetched",(()=>this.requestUpdate())),this.listenTo(bl.presences,"change:show",(()=>this.requestUpdate())),this.listenTo(bl.roster,"add",(()=>this.requestUpdate())),this.listenTo(bl.roster,"destroy",(()=>this.requestUpdate())),this.listenTo(bl.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=qy("Filter"),n=qy("Filter by contact name"),s=qy("Filter by group name"),i=qy("Filter by status"),r=qy("Any"),o=qy("Unread"),a=qy("Online"),c=qy("Chatty"),l=qy("Busy"),d=qy("Away"),u=qy("Extended Away"),h=qy("Offline");return nh`
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-12-29 14:11:55 +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=F_(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 bl.roster?.length>=5||this.isActive()}clearFilter(e){e&&e.preventDefault(),this.model.save({filter_text:""})}}Vl.elements.define("converse-roster-filter",vk);var yk=n(9107),_k={};_k.styleTagTransform=i_(),_k.setAttributes=e_(),_k.insert=Yy().bind(null,"head"),_k.domAPI=Qy(),_k.insertStyleElement=n_();Jy()(yk.Z,_k);yk.Z&&yk.Z.locals&&yk.Z.locals;Ah.plugins.add("converse-rosterview",{dependencies:["converse-roster","converse-modal","converse-chatboxviews"],initialize(){Vl.settings.extend({autocomplete_add_contact:!0,allow_contact_removal:!0,hide_offline_users:!1,roster_groups:!0,xhr_user_search_url:null}),Vl.promises.add("rosterViewInitialized"),bl.RosterFilter=Cv,bl.RosterFilterView=vk,bl.RosterContactView=pk,Vl.listen.on("chatBoxesInitialized",(()=>{bl.chatboxes.on("destroy",(e=>HS(e))),bl.chatboxes.on("change:hidden",(e=>HS(e)))})),Vl.listen.on("afterTearDown",(()=>bl.rotergroups?.off().reset()))}});var bk=n(2886),wk={};wk.styleTagTransform=i_(),wk.setAttributes=e_(),wk.insert=Yy().bind(null,"head"),wk.domAPI=Qy(),wk.insertStyleElement=n_();Jy()(bk.Z,wk);bk.Z&&bk.Z.locals&&bk.Z.locals;Ah.plugins.add("converse-singleton",{enabled:e=>e.api.settings.get("singleton"),initialize(){Vl.settings.extend({allow_logout:!1,allow_muc_invitations:!1,hide_muc_server:!0});const e=Vl.settings.get("auto_join_rooms"),t=Vl.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:Sk}=Ah.env;function xk(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!Vl.settings.get("allow_dragresize"))return!0;e.preventDefault();const n=Sk.ancestor(e.target,".box-flyout"),s=window.getComputedStyle(n),i=n.parentElement;i.height=parseInt(s.height.replace(/px$/,""),10),bl.resizing={chatbox:i,direction:"top"},i.prev_pageY=e.pageY,t&&Vl.trigger("startVerticalResize",i)}function Ek(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!Vl.settings.get("allow_dragresize"))return!0;e.preventDefault();const n=Sk.ancestor(e.target,".box-flyout"),s=window.getComputedStyle(n),i=n.parentElement;i.width=parseInt(s.width.replace(/px$/,""),10),bl.resizing={chatbox:i,direction:"left"},i.prev_pageX=e.pageX,t&&Vl.trigger("startHorizontalResize",i)}function Ak(e){Ek(e,!1),xk(e,!1),bl.resizing.direction="topleft",Vl.trigger("startDiagonalResize",this)}function Ck(e,t){if(void 0===e)return;if(void 0===t)return e;return e!==t&&Math.abs(e-t)<10?t:e}function $k(e){if(!bl.resizing||!Vl.settings.get("allow_dragresize"))return!0;e.preventDefault(),bl.resizing.chatbox.resizeChatBox(e)}function kk(e){if(!bl.resizing||!Vl.settings.get("allow_dragresize"))return!0;e.preventDefault();const t=Ck(bl.resizing.chatbox.height,bl.resizing.chatbox.
<div class="dragresize dragresize-top" @mousedown="${xk}"></div>
<div class="dragresize dragresize-topleft" @mousedown="${Ak}"></div>
<div class="dragresize dragresize-left" @mousedown="${Ek}"></div>
`;Vl.elements.define("converse-dragresize",class extends Gy{render(){return jk()}});const Tk={initDragResize(){const e=this,t=Il((()=>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,bl.connection?.connected&&(this.height=this.model.get("height"),this.width=this.model.get("width")),this},resizeChatBox(e){let t;0===bl.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))),bl.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?Ck(e,this.model.get("default_height"))+"px":"";const t=this.querySelector(".box-flyout");null!==t&&(t.style.height=e)},setChatBoxWidth(e){e=e?Ck(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)}};Ah.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:Ck(t,this.get("default_height")),width:Ck(n,this.get("default_width"))}),e}}},initialize(){function e(e){const t=document.getElementsByTagName("iframe");for(let n of t)e.addEventListener("mousedown",(()=>{n.style.pointerEvents="none"}),{once:!0}),e.addEventListener("mouseup",(()=>{n.style.pointerEvents="initial"}),{once:!0})}Vl.settings.extend({allow_dragresize:!0}),Object.assign(bl.ChatBoxView.prototype,Tk),Object.assign(bl.ChatRoomView.prototype,Tk),bl.ControlBoxView&&Object.assign(bl.ControlBoxView.prototype,Tk),Vl.listen.on("registeredGlobalEventHandlers",(function(){document.addEventListener("mousemove",$k),document.addEventListener("mouseup",kk)})),Vl.listen.on("unregisteredGlobalEventHandlers",(function(){document.removeEventListener("mousemove",$k),document.removeEventListener("mouseup",kk)})),Vl.listen.on("beforeShowingChatView",(e=>e.initDragResize().setDimensions())),Vl.listen.on("startDiagonalResize",e),Vl.listen.on("startHorizontalResize",e),Vl.listen.on("startVerticalResize",e)}});var Ik=n(567),Nk={};Nk.styleTagTransform=i_(),Nk.setAttributes=e_(),Nk.insert=Yy().bind(null,"head"),Nk.domAPI=Qy(),Nk.insertStyleElement=n_();Jy()(Ik.Z,Nk);Ik.Z&&Ik.Z.locals&&Ik.Z.locals;Ah.plugins.add("converse-fullscreen",{enabled:()=>Oc(),initialize(){Vl.settings.extend({chatview_avatar_height:50,chatview_avatar_width:50,hide_open_bookmarks:!0,show_controlbox_by_default:!0,sticky_controlbox:!0})}}),bl.CustomElement=Gy;const Ok=Ah.initialize;Ah.initia
2021-01-29 23:34:36 +01:00
//# sourceMappingURL=converse.min.js.map