converse-tauri/dist/dist/converse.min.js

2401 lines
1014 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*! For license information please see converse.min.js.LICENSE.txt */
(()=>{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+2&&(i[2]|=e.charCodeAt(t+2)>>6,i[3]=63&e.charCodeAt(t+2));for(let e=0;e<i.length;e++)void 0===i[e]?s+="=":s+=n(i[e])}return s}},3170:function(e,t,n){var s,i,r;i=[],void 0===(r="function"==typeof(s=function(){"use strict";var e=void 0!==n.g?n.g:this||window,t=document,s=t.documentElement,i="body",r=e.BSN={},o=r.supports=[],a="data-toggle",c="data-dismiss",l="Alert",d="Button",u="Collapse",h="Dropdown",m="Modal",f="Popover",g="Tab",p="data-backdrop",v="data-keyboard",y="data-target",_="data-height",b="data-title",w="data-dismissible",S="data-trigger",x="data-animation",E="data-container",A="data-placement",C="data-delay",$="backdrop",k="keyboard",j="delay",T="content",I="target",N="currentTarget",O="animation",M="placement",R="container",D="offsetTop",z="offsetLeft",L="scrollTop",P="scrollLeft",F="clientWidth",U="clientHeight",B="offsetWidth",q="offsetHeight",H="innerWidth",G="scrollHeight",W="height",V="aria-expanded",J="aria-hidden",Z="aria-selected",Q="click",K="focus",Y="hover",X="keydown",ee="keyup",te="resize",ne="onmouseleave"in t?["mouseenter","mouseleave"]:["mouseover","mouseout"],se="show",ie="shown",re="hide",oe="hidden",ae="close",ce="closed",le="change",de="getAttribute",ue="setAttribute",he="hasAttribute",me="createElement",fe="appendChild",ge="innerHTML",pe="getElementsByTagName",ve="preventDefault",ye="getBoundingClientRect",_e="querySelectorAll",be="getElementsByClassName",we="getComputedStyle",Se="indexOf",xe="parentNode",Ee="length",Ae="toLowerCase",Ce="Transition",$e="Duration",ke="Webkit",je="style",Te="push",Ie="tabindex",Ne="contains",Oe="active",Me="show",Re="collapsing",De="left",ze="right",Le="top",Pe="bottom",Fe=/\b(top|bottom|left|right)+/,Ue=0,Be="fixed-top",qe="fixed-bottom",He=ke+Ce in s[je]||Ce[Ae]()in s[je],Ge=ke+Ce in s[je]?ke[Ae]()+Ce+"End":Ce[Ae]()+"end",We=ke+$e in s[je]?ke[Ae]()+Ce+$e:Ce[Ae]()+$e,Ve=function(e){e.focus?e.focus():e.setActive()},Je=function(e,t){e.classList.add(t)},Ze=function(e,t){e.classList.remove(t)},Qe=function(e,t){return e.classList[Ne](t)},Ke=function(e,t){return[].slice.call(e[be](t))},Ye=function(e,n){return"object"==typeof e?e:(n||t).querySelector(e)},Xe=function(e,n){var s=n.charAt(0),i=n.substr(1);if("."===s){for(;e&&e!==t;e=e[xe])if(null!==Ye(n,e[xe])&&Qe(e,i))return e}else if("#"===s)for(;e&&e!==t;e=e[xe])if(e.id===i)return e;return!1},et=function(e,t,n,s){s=s||!1,e.addEventListener(t,n,s)},tt=function(e,t,n,s){s=s||!1,e.removeEventListener(t,n,s)},nt=function(e,t,n,s){et(e,t,(function i(r){n(r),tt(e,t,i,s)}),s)},st=!!function(){var t=!1;try{var n=Object.defineProperty({},"passive",{get:function(){t=!0}});nt(e,"testPassive",null,n)}catch(e){}return t}()&&{passive:!0},it=function(t){var n=He?e[we](t)[We]:0;return n="number"!=typeof(n=parseFloat(n))||isNaN(n)?0:1e3*n},rt=function(e,t){var n=0;it(e)?nt(e,Ge,(function(e){!n&&t(e),n=1})):setTimeout((function(){!n&&t(),n=1}),17)},ot=function(e,t,n){var s=new CustomEvent(e+".bs."+t);s.relatedTarget=n,this.dispatchEvent(s)},at=function(){return{y:e.pageYOffset||s[L],x:e.pageXOffset||s[P]}},ct=function(e,n,r,o){var a,c,l,d,u,h,m={w:n[B],h:n[q]},f=s[F]||t[i][F],g=s[U]||t[i][U],p=e[ye](),v=o===t[i]?at():{x:o[z]+o[P],y:o[D]+o[L]},y={w:p[ze]-p[De],h:p[Pe]-p[Le]},_=Qe(n,"popover"),b=Ye(".arrow",n),w=p[Le]+y.h/2-m.h/2<0,S=p[De]+y.w/2-m.w/2<0,x=p[De]+m.w/2+y.w/2>=f,E=p[Le]+m.h/2+y.h/2>=g,A=p[Le]-m.h<0,C=p[De]-m.w<0,$=p[Le]+m.h+y.h>=g,k=p[De]+m.w+y.w>=f;r=(r=(r=(r=(r=(r===De||r===ze)&&C&&k?Le:r)===Le&&A?Pe:r)===Pe&&$?Le:r)===De&&C?ze:r)===ze&&k?De:r,-1===n.className[Se](r)&&(n.className=n.className.replace(Fe,r)),u=b[B],h=b[q],r===De||r===ze?(c=r===De?p[De]+v.x-m.w-(_?u:0):p[De]+v.x+y.w,w?(a=p[Le]+v.y,l=y.h/2-u):E?(a=p[Le]+v.y-m.h+y.h,l=m.h-y.h/2-u):(a=p[Le]+v.y-m.h/2+y.h/2,l=m.h/2-(_?.9*h:h/2))):r!==Le&&r!==Pe||(a=r===Le?p[Le]+v.y-m.h-(_?h:0):p[Le]+v.y+y.h,S?(c=0,d=p[De]+y.w/2-u):x?(c=f-1.01*m.w,d=m.w-(f-p[De])+y.w/2-u/2):(c=p[De]+v.x-m.w/2+y.w/2,d=m.w/2-(_?u:u/2))),n[je][Le]=a+"px",n[je][De]=c+"px",l&&(b[je][Le]=l+"px"),d&&(b[je][De]=d+"px")};r.version="2.0.27";var lt=function(e){e=Ye(e);var t=this,n="alert",s=Xe(e,"."+n),i=function(){Qe(s,"fade")?rt(s,o):o()},r=function(i){s=Xe(i[I],"."+n),(e=Ye("["+c+'="'+n+'"]',s))&&s&&(e===i[I]||e[Ne](i[I]))&&t.close()},o=function(){ot.call(s,ce,n),tt(e,Q,r),s[xe].removeChild(s)};this.close=function(){s&&e&&Qe(s,Me)&&(ot.call(s,ae,n),Ze(s,Me),s&&i())},l in e||et(e,Q,r),e[l]=t};o[Te]([l,lt,"["+c+'="alert"]']);var dt=function(e){e=Ye(e);var n=!1,s="button",i="checked",r="LABEL",o="INPUT",a=function(e){32===(e.which||e.keyCode)&&e[I]===t.activeElement&&l(e)},c=function(e){32===(e.which||e.keyCode)&&e[ve]()},l=function(t){var a=t[I].tagName===r?t[I]:t[I][xe].tagName===r?t[I][xe]:null;if(a){var c=Ke(a[xe],"btn"),l=a[pe](o)[0];if(l){if("checkbox"===l.type&&(l[i]?(Ze(a,Oe),l[de](i),l.removeAttribute(i),l[i]=!1):(Je(a,Oe),l[de](i),l[ue](i,i),l[i]=!0),n||(n=!0,ot.call(l,le,s),ot.call(e,le,s))),"radio"===l.type&&!n&&(!l[i]||0===t.screenX&&0==t.screenY)){Je(a,Oe),Je(a,K),l[ue](i,i),l[i]=!0,ot.call(l,le,s),ot.call(e,le,s),n=!0;for(var d=0,u=c[Ee];d<u;d++){var h=c[d],m=h[pe](o)[0];h!==a&&Qe(h,Oe)&&(Ze(h,Oe),m.removeAttribute(i),m[i]=!1,ot.call(m,le,s))}}setTimeout((function(){n=!1}),50)}}},u=function(e){Je(e[I][xe],K)},h=function(e){Ze(e[I][xe],K)};if(!(d in e)){et(e,Q,l),et(e,ee,a),et(e,X,c);for(var m=Ke(e,"btn"),f=0;f<m.length;f++){var g=m[f][pe](o)[0];et(g,K,u),et(g,"blur",h)}}var p=Ke(e,"btn"),v=p[Ee];for(f=0;f<v;f++)!Qe(p[f],Oe)&&Ye("input:checked",p[f])&&Je(p[f],Oe);e[d]=this};o[Te]([d,dt,"["+a+'="buttons"]']);var ut=function(e,t){e=Ye(e),t=t||{};var n,s,i=null,r=null,o=this,a=e[de]("data-parent"),c="collapse",l="collapsed",d="isAnimating",h=function(e,t){ot.call(e,se,c),e[d]=!0,Je(e,Re),Ze(e,c),e[je][W]=e[G]+"px",rt(e,(function(){e[d]=!1,e[ue](V,"true"),t[ue](V,"true"),Ze(e,Re),Je(e,c),Je(e,Me),e[je][W]="",ot.call(e,ie,c)}))},m=function(e,t){ot.call(e,re,c),e[d]=!0,e[je][W]=e[G]+"px",Ze(e,c),Ze(e,Me),Je(e,Re),e[B],e[je][W]="0px",rt(e,(function(){e[d]=!1,e[ue](V,"false"),t[ue](V,"false"),Ze(e,Re),Je(e,c),e[je][W]="",ot.call(e,oe,c)}))},f=function(){var t=e.href&&e[de]("href"),n=e[de](y),s=t||n&&"#"===n.charAt(0)&&n;return s&&Ye(s)};this.toggle=function(e){e[ve](),Qe(r,Me)?o.hide():o.show()},this.hide=function(){r[d]||(m(r,e),Je(e,l))},this.show=function(){i&&(n=Ye("."+c+"."+Me,i),s=n&&(Ye("["+y+'="#'+n.id+'"]',i)||Ye('[href="#'+n.id+'"]',i))),(!r[d]||n&&!n[d])&&(s&&n!==r&&(m(n,s),Je(s,l)),h(r,e),Ze(e,l))},u in e||et(e,Q,o.toggle),(r=f())[d]=!1,i=Ye(t.parent)||a&&Xe(e,a),e[u]=o};o[Te]([u,ut,"["+a+'="collapse"]']);var ht=function(e,n){e=Ye(e),this.persist=!0===n||"true"===e[de]("data-persist")||!1;var s=this,i="children",r=e[xe],o="dropdown",c="open",l=null,d=Ye(".dropdown-menu",r),u=function(){for(var e=d[i],t=[],n=0;n<e[Ee];n++)e[n][i][Ee]&&"A"===e[n][i][0].tagName&&t[Te](e[n][i][0]),"A"===e[n].tagName&&t[Te](e[n]);return t}(),m=function(e){(e.href&&"#"===e.href.slice(-1)||e[xe]&&e[xe].href&&"#"===e[xe].href.slice(-1))&&this[ve]()},f=function(){var n=e[c]?et:tt;n(t,Q,g),n(t,X,v),n(t,ee,y),n(t,K,g,!0)},g=function(t){var n=t[I],i=n&&(n[de](a)||n[xe]&&de in n[xe]&&n[xe][de](a));(t.type!==K||n!==e&&n!==d&&!d[Ne](n))&&(n!==d&&!d[Ne](n)||!s.persist&&!i)&&(l=n===e||e[Ne](n)?e:null,b(),m.call(t,n))},p=function(t){l=e,_(),m.call(t,t[I])},v=function(e){var t=e.which||e.keyCode;38!==t&&40!==t||e[ve]()},y=function(n){var i=n.which||n.keyCode,r=t.activeElement,o=u[Se](r),a=r===e,h=d[Ne](r),m=r[xe]===d||r[xe][xe]===d;m&&(o=a?0:38===i?o>1?o-1:0:40===i&&o<u[Ee]-1?o+1:o,u[o]&&Ve(u[o])),(u[Ee]&&m||!u[Ee]&&(h||a)||!h)&&e[c]&&27===i&&(s.toggle(),l=null)},_=function(){ot.call(r,se,o,l),Je(d,Me),Je(r,Me),e[ue](V,!0),ot.call(r,ie,o,l),e[c]=!0,tt(e,Q,p),setTimeout((function(){Ve(d[pe]("INPUT")[0]||e),f()}),1)},b=function(){ot.call(r,re,o,l),Ze(d,Me),Ze(r,Me),e[ue](V,!1),ot.call(r,oe,o,l),e[c]=!1,f(),Ve(e),setTimeout((function(){et(e,Q,p)}),1)};e[c]=!1,this.toggle=function(){Qe(r,Me)&&e[c]?b():_()},h in e||(!Ie in d&&d[ue](Ie,"0"),et(e,Q,p)),e[h]=s};o[Te]([h,ht,"["+a+'="dropdown"]']);var mt=function(n,r){n=Ye(n);var o="modal",a="static",l="modalTrigger",d="paddingRight",u="modal-backdrop",h="isAnimating",f=n[de](y)||n[de]("href"),g=Ye(f),_=Qe(n,o)?n:g;if(Qe(n,o)&&(n=null),_){r=r||{},this[k]=!1!==r[k]&&"false"!==_[de](v),this[$]=r[$]!==a&&_[de](p)!==a||a,this[$]=!1!==r[$]&&"false"!==_[de](p)&&this[$],this[O]=!!Qe(_,"fade"),this[T]=r[T],_[h]=!1;var b,w,S,x,E,A=this,C=null,j=Ke(s,Be).concat(Ke(s,qe)),N=function(){var t=s[ye]();return e[H]||t[ze]-Math.abs(t[De])},M=function(){var n,s=e[we](t[i]),r=parseInt(s[d],10);if(b&&(t[i][je][d]=r+w+"px",_[je][d]=w+"px",j[Ee]))for(var o=0;o<j[Ee];o++)n=e[we](j[o])[d],j[o][je][d]=parseInt(n)+w+"px"},R=function(){if(t[i][je][d]="",_[je][d]="",j[Ee])for(var e=0;e<j[Ee];e++)j[e][je][d]=""},D=function(){var e,n=t[me]("div");return n.className=o+"-scrollbar-measure",t[i][fe](n),e=n[B]-n[F],t[i].removeChild(n),e},z=function(){b=t[i][F]<N(),w=D()},L=function(){var e=t[me]("div");null===(S=Ye("."+u))&&(e[ue]("class",u+(A[O]?" fade":"")),S=e,t[i][fe](S)),Ue=1},P=function(){(S=Ye("."+u))&&null!==S&&"object"==typeof S&&(Ue=0,t[i].removeChild(S),S=null)},U=function(){Ve(_),_[h]=!1,ot.call(_,ie,o,C),et(e,te,A.update,st),et(_,Q,V),et(t,X,W)},q=function(){_[je].display="",n&&Ve(n),ot.call(_,oe,o),Ke(t,o+" "+Me)[0]||(R(),Ze(t[i],o+"-open"),S&&Qe(S,"fade")?(Ze(S,Me),rt(S,P)):P(),tt(e,te,A.update,st),tt(_,Q,V),tt(t,X,W)),_[h]=!1},G=function(e){if(!_[h]){var t=e[I];(t=t[he](y)||t[he]("href")?t:t[xe])!==n||Qe(_,Me)||(_[l]=n,C=n,A.show(),e[ve]())}},W=function(e){_[h]||A[k]&&27==e.which&&Qe(_,Me)&&A.hide()},V=function(e){if(!_[h]){var t=e[I];Qe(_,Me)&&(t[xe][de](c)===o||t[de](c)===o||t===_&&A[$]!==a)&&(A.hide(),C=null,e[ve]())}};this.toggle=function(){Qe(_,Me)?this.hide():this.show()},this.show=function(){Qe(_,Me)||_[h]||(clearTimeout(E),E=setTimeout((function(){_[h]=!0,ot.call(_,se,o,C);var e=Ke(t,o+" "+Me)[0];e&&e!==_&&(l in e&&e[l][m].hide(),m in e&&e[m].hide()),A[$]&&!Ue&&!S&&L(),S&&!Qe(S,Me)&&(S[B],x=it(S),Je(S,Me)),setTimeout((function(){_[je].display="block",z(),M(),Je(t[i],o+"-open"),Je(_,Me),_[ue](J,!1),Qe(_,"fade")?rt(_,U):U()}),He&&S&&x?x:1)}),1))},this.hide=function(){!_[h]&&Qe(_,Me)&&(clearTimeout(E),E=setTimeout((function(){_[h]=!0,ot.call(_,re,o),S=Ye("."+u),x=S&&it(S),Ze(_,Me),_[ue](J,!0),setTimeout((function(){Qe(_,"fade")?rt(_,q):q()}),He&&S&&x?x:2)}),2))},this.setContent=function(e){Ye("."+o+"-content",_)[ge]=e},this.update=function(){Qe(_,Me)&&(z(),M())},n&&!(m in n)&&et(n,Q,G),A[T]&&A.setContent(A[T]),n?(n[m]=A,_[l]=n):_[m]=A}};o[Te]([m,mt,"["+a+'="modal"]']);var ft=function(n,s){n=Ye(n),s=s||{};var r=n[de](S),o=n[de](x),a=n[de](A),c=n[de](w),l=n[de](C),d=n[de](E),u="popover",h="template",m="trigger",g="class",p="div",v="fade",y="data-content",_="dismissible",$='<button type="button" class="close">×</button>',k=Ye(s[R]),T=Ye(d),N=Xe(n,".modal"),D=Xe(n,"."+Be),z=Xe(n,"."+qe);this[h]=s[h]?s[h]:null,this[m]=s[m]?s[m]:r||Y,this[O]=s[O]&&s[O]!==v?s[O]:o||v,this[M]=s[M]?s[M]:a||Le,this[j]=parseInt(s[j]||l)||200,this[_]=!(!s[_]&&"true"!==c),this[R]=k||T||D||z||N||t[i];var L=this,P=s.title||n[de](b)||null,F=s.content||n[de](y)||null;if(F||this[h]){var U=null,B=0,q=this[M],H=function(e){null!==U&&e[I]===Ye(".close",U)&&L.hide()},G=function(){L[R].removeChild(U),B=null,U=null},W=function(){P=s.title||n[de](b),F=(F=s.content||n[de](y))?F.trim():null,U=t[me](p);var e=t[me](p);if(e[ue](g,"arrow"),U[fe](e),null!==F&&null===L[h]){if(U[ue]("role","tooltip"),null!==P){var i=t[me]("h3");i[ue](g,u+"-header"),i[ge]=L[_]?P+$:P,U[fe](i)}var r=t[me](p);r[ue](g,u+"-body"),r[ge]=L[_]&&null===P?F+$:F,U[fe](r)}else{var o=t[me](p);L[h]=L[h].trim(),o[ge]=L[h],U[ge]=o.firstChild[ge]}L[R][fe](U),U[je].display="block",U[ue](g,u+" bs-"+u+"-"+q+" "+L[O])},V=function(){!Qe(U,Me)&&Je(U,Me)},J=function(){ct(n,U,q,L[R])},Z=function(s){Q!=L[m]&&"focus"!=L[m]||!L[_]&&s(n,"blur",L.hide),L[_]&&s(t,Q,H),s(e,te,L.hide,st)},K=function(){Z(et),ot.call(n,ie,u)},X=function(){Z(tt),G(),ot.call(n,oe,u)};this.toggle=function(){null===U?L.show():L.hide()},this.show=function(){clearTimeout(B),B=setTimeout((function(){null===U&&(q=L[M],W(),J(),V(),ot.call(n,se,u),L[O]?rt(U,K):K())}),20)},this.hide=function(){clearTimeout(B),B=setTimeout((function(){U&&null!==U&&Qe(U,Me)&&(ot.call(n,re,u),Ze(U,Me),L[O]?rt(U,X):X())}),L[j])},f in n||(L[m]===Y?(et(n,ne[0],L.show),L[_]||et(n,ne[1],L.hide)):Q!=L[m]&&"focus"!=L[m]||et(n,L[m],L.toggle)),n[f]=L}};o[Te]([f,ft,"["+a+'="popover"]']);var gt=function(e,t){var n=(e=Ye(e))[de](_),s="tab",i="height",r="float",o="isAnimating";t=t||{},this[i]=!!He&&(t[i]||"true"===n);var a,c,l,d,u,h,m,f=this,p=Xe(e,".nav"),v=!1,y=p&&Ye(".dropdown-toggle",p),b=function(){v[je][i]="",Ze(v,Re),p[o]=!1},w=function(){v?h?b():setTimeout((function(){v[je][i]=m+"px",v[B],rt(v,b)}),50):p[o]=!1,ot.call(a,ie,s,c)},S=function(){v&&(l[je][r]=De,d[je][r]=De,u=l[G]),Je(d,Oe),ot.call(a,se,s,c),Ze(l,Oe),ot.call(c,oe,s,a),v&&(m=d[G],h=m===u,Je(v,Re),v[je][i]=u+"px",v[q],l[je][r]="",d[je][r]=""),Qe(d,"fade")?setTimeout((function(){Je(d,Me),rt(d,w)}),20):w()};if(p){p[o]=!1;var x=function(){var e,t=Ke(p,Oe);return 1!==t[Ee]||Qe(t[0][xe],"dropdown")?t[Ee]>1&&(e=t[t[Ee]-1]):e=t[0],e},E=function(){return Ye(x()[de]("href"))},A=function(e){e[ve](),a=e[N],!p[o]&&!Qe(a,Oe)&&f.show()};this.show=function(){d=Ye((a=a||e)[de]("href")),c=x(),l=E(),p[o]=!0,Ze(c,Oe),c[ue](Z,"false"),Je(a,Oe),a[ue](Z,"true"),y&&(Qe(e[xe],"dropdown-menu")?Qe(y,Oe)||Je(y,Oe):Qe(y,Oe)&&Ze(y,Oe)),ot.call(c,re,s,a),Qe(l,"fade")?(Ze(l,Me),rt(l,S)):S()},g in e||et(e,Q,A),f[i]&&(v=E()[xe]),e[g]=f}};o[Te]([g,gt,"["+a+'="tab"]']);var pt=function(e,t){for(var n=0,s=t[Ee];n<s;n++)new e(t[n])},vt=r.initCallback=function(e){e=e||t;for(var n=0,s=o[Ee];n<s;n++)pt(o[n][1],e[_e](o[n][2]))};return t[i]?vt():et(t,"DOMContentLoaded",(function(){vt()})),{Alert:lt,Button:dt,Collapse:ut,Dropdown:ht,Modal:mt,Popover:ft,Tab:gt}})?s.apply(t,i):s)||(e.exports=r)},4923:e=>{window,e.exports=function(e){var t={};function n(s){if(t[s])return t[s].exports;var i=t[s]={i:s,l:!1,exports:{}};return e[s].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,s){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:s})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=7)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.loadImageElement=function(e,t){return new Promise((function(n,s){e.addEventListener("load",(function(){n(e)}),!1),e.addEventListener("error",(function(e){s(e)}),!1),e.src=t}))},t.resize=function(e,t,n,s){if(!n&&!s)return{currentWidth:e,currentHeight:t};var i=e/t,r=void 0,o=void 0;return i>n/s?o=(r=Math.min(e,n))/i:r=(o=Math.min(t,s))*i,{width:r,height:o}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.base64ToFile=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"image/jpeg",n=window.atob(e),s=[],i=0;i<n.length;i++)s[i]=n.charCodeAt(i);return new window.Blob([new Uint8Array(s)],{type:t})},t.imageToCanvas=function(e,t,n,s){var i=document.createElement("canvas"),r=i.getContext("2d");if(i.width=t,i.height=n,!s||s>8)return r.drawImage(e,0,0,i.width,i.height),i;switch(s>4&&(i.width=n,i.height=t),s){case 2:r.translate(t,0),r.scale(-1,1);break;case 3:r.translate(t,n),r.rotate(Math.PI);break;case 4:r.translate(0,n),r.scale(1,-1);break;case 5:r.rotate(.5*Math.PI),r.scale(1,-1);break;case 6:r.rotate(.5*Math.PI),r.translate(0,-n);break;case 7:r.rotate(.5*Math.PI),r.translate(t,-n),r.scale(-1,1);break;case 8:r.rotate(-.5*Math.PI),r.translate(-t,0)}return s>4?r.drawImage(e,0,0,i.height,i.width):r.drawImage(e,0,0,i.width,i.height),i},t.canvasToBlob=function(e,t){return new Promise((function(n,s){e.toBlob((function(e){n(e)}),"image/jpeg",t)}))},t.size=function(e){return{kB:.001*e,MB:1e-6*e}},t.blobToBase64=function(e){return new Promise((function(t,n){var s=new window.FileReader;s.addEventListener("load",(function(e){t(e.target.result)}),!1),s.addEventListener("error",(function(e){n(e)}),!1),s.readAsDataURL(e)}))}},function(e,t,n){e.exports=n(6)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extractOrientation=function(e){return new Promise((function(t,n){var s=new window.FileReader;s.onload=function(e){var n=new DataView(e.target.result);65496!==n.getUint16(0,!1)&&t(-2);for(var s=n.byteLength,i=2;i<s;){var r=n.getUint16(i,!1);if(i+=2,65505===r){1165519206!==n.getUint32(i+=2,!1)&&t(-1);var o=18761===n.getUint16(i+=6,!1);i+=n.getUint32(i+4,o);var a=n.getUint16(i,o);i+=2;for(var c=0;c<a;c++)274===n.getUint16(i+12*c,o)&&t(n.getUint16(i+12*c+8,o))}else{if(65280!=(65280&r))break;i+=n.getUint16(i,!1)}}t(-1)},s.readAsArrayBuffer(e.slice(0,65536))}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s,i=(s=n(2))&&s.__esModule?s:{default:s},r=function(){function e(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}return function(t,n,s){return n&&e(t.prototype,n),s&&e(t,s),t}}(),o=n(3),a=n(0),c=n(1);function l(e){return function(){var t=e.apply(this,arguments);return new Promise((function(e,n){return function s(i,r){try{var o=t[i](r),a=o.value}catch(e){return void n(e)}if(!o.done)return Promise.resolve(a).then((function(e){s("next",e)}),(function(e){s("throw",e)}));e(a)}("next")}))}}var d=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.data=t,this.name=t.name,this.type=t.type,this.size=t.size}return r(e,[{key:"setData",value:function(e){this.data=e,this.size=e.size,this.type=e.type}},{key:"_calculateOrientation",value:function(){var e=l(i.default.mark((function e(){var t;return i.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,o.extractOrientation)(this.data);case 2:t=e.sent,this.orientation=t;case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"load",value:function(){var e=l(i.default.mark((function e(){var t,n;return i.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._calculateOrientation();case 2:return t=URL.createObjectURL(this.data),n=new window.Image,e.next=6,(0,a.loadImageElement)(n,t);case 6:URL.revokeObjectURL(t),this._img=n,this.width=n.naturalWidth,this.height=n.naturalHeight;case 10:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"getCanvas",value:function(e,t,n){return void 0!==n?(0,c.imageToCanvas)(this._img,e,t,n):(0,c.imageToCanvas)(this._img,e,t,this.orientation)}}]),e}();t.default=d,e.exports=t.default},function(e,t){!function(t){"use strict";var n,s=Object.prototype,i=s.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",c=r.toStringTag||"@@toStringTag",l="object"==typeof e,d=t.regeneratorRuntime;if(d)l&&(e.exports=d);else{(d=t.regeneratorRuntime=l?e.exports:{}).wrap=b;var u="suspendedStart",h="suspendedYield",m="executing",f="completed",g={},p={};p[o]=function(){return this};var v=Object.getPrototypeOf,y=v&&v(v(I([])));y&&y!==s&&i.call(y,o)&&(p=y);var _=E.prototype=S.prototype=Object.create(p);x.prototype=_.constructor=E,E.constructor=x,E[c]=x.displayName="GeneratorFunction",d.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===x||"GeneratorFunction"===(t.displayName||t.name))},d.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,c in e||(e[c]="GeneratorFunction")),e.prototype=Object.create(_),e},d.awrap=function(e){return{__await:e}},A(C.prototype),C.prototype[a]=function(){return this},d.AsyncIterator=C,d.async=function(e,t,n,s){var i=new C(b(e,t,n,s));return d.isGeneratorFunction(t)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},A(_),_[c]="Generator",_[o]=function(){return this},_.toString=function(){return"[object Generator]"},d.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var s=t.pop();if(s in e)return n.value=s,n.done=!1,n}return n.done=!0,n}},d.values=I,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(j),!e)for(var t in this)"t"===t.charAt(0)&&i.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=n)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function s(s,i){return a.type="throw",a.arg=e,t.next=s,i&&(t.method="next",t.arg=n),!!i}for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],a=o.completion;if("root"===o.tryLoc)return s("end");if(o.tryLoc<=this.prev){var c=i.call(o,"catchLoc"),l=i.call(o,"finallyLoc");if(c&&l){if(this.prev<o.catchLoc)return s(o.catchLoc,!0);if(this.prev<o.finallyLoc)return s(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return s(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return s(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var s=this.tryEntries[n];if(s.tryLoc<=this.prev&&i.call(s,"finallyLoc")&&this.prev<s.finallyLoc){var r=s;break}}r&&("break"===e||"continue"===e)&&r.tryLoc<=t&&t<=r.finallyLoc&&(r=null);var o=r?r.completion:{};return o.type=e,o.arg=t,r?(this.method="next",this.next=r.finallyLoc,g):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),j(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var s=n.completion;if("throw"===s.type){var i=s.arg;j(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,s){return this.delegate={iterator:I(e),resultName:t,nextLoc:s},"next"===this.method&&(this.arg=n),g}}}function b(e,t,n,s){var i=t&&t.prototype instanceof S?t:S,r=Object.create(i.prototype),o=new T(s||[]);return r._invoke=function(e,t,n){var s=u;return function(i,r){if(s===m)throw new Error("Generator is already running");if(s===f){if("throw"===i)throw r;return N()}for(n.method=i,n.arg=r;;){var o=n.delegate;if(o){var a=$(o,n);if(a){if(a===g)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(s===u)throw s=f,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);s=m;var c=w(e,t,n);if("normal"===c.type){if(s=n.done?f:h,c.arg===g)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(s=f,n.method="throw",n.arg=c.arg)}}}(e,n,o),r}function w(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function S(){}function x(){}function E(){}function A(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function C(e){var t;this._invoke=function(n,s){function r(){return new Promise((function(t,r){!function t(n,s,r,o){var a=w(e[n],e,s);if("throw"!==a.type){var c=a.arg,l=c.value;return l&&"object"==typeof l&&i.call(l,"__await")?Promise.resolve(l.__await).then((function(e){t("next",e,r,o)}),(function(e){t("throw",e,r,o)})):Promise.resolve(l).then((function(e){c.value=e,r(c)}),o)}o(a.arg)}(n,s,t,r)}))}return t=t?t.then(r,r):r()}}function $(e,t){var s=e.iterator[t.method];if(s===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=n,$(e,t),"throw"===t.method))return g;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return g}var i=w(s,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,g;var r=i.arg;return r?r.done?(t[e.resultName]=r.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=n),t.delegate=null,g):r:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,g)}function k(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function j(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(k,this),this.reset(!0)}function I(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var s=-1,r=function t(){for(;++s<e.length;)if(i.call(e,s))return t.value=e[s],t.done=!1,t;return t.value=n,t.done=!0,t};return r.next=r}}return{next:N}}function N(){return{value:n,done:!0}}}(function(){return this}()||Function("return this")())},function(e,t,n){var s=function(){return this}()||Function("return this")(),i=s.regeneratorRuntime&&Object.getOwnPropertyNames(s).indexOf("regeneratorRuntime")>=0,r=i&&s.regeneratorRuntime;if(s.regeneratorRuntime=void 0,e.exports=n(5),i)s.regeneratorRuntime=r;else try{delete s.regeneratorRuntime}catch(e){s.regeneratorRuntime=void 0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=c(n(2)),i=function(){function e(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}return function(t,n,s){return n&&e(t.prototype,n),s&&e(t,s),t}}(),r=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(1)),o=n(0),a=c(n(4));function c(e){return e&&e.__esModule?e:{default:e}}function l(e){return function(){var t=e.apply(this,arguments);return new Promise((function(e,n){return function s(i,r){try{var o=t[i](r),a=o.value}catch(e){return void n(e)}if(!o.done)return Promise.resolve(a).then((function(e){s("next",e)}),(function(e){s("throw",e)}));e(a)}("next")}))}}var d=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.setOptions(t)}return i(e,[{key:"setOptions",value:function(e){var t={targetSize:1/0,quality:.75,minQuality:.5,qualityStepSize:.1,maxWidth:1920,maxHeight:1920,resize:!0,throwIfSizeNotReached:!1,autoRotate:!0},n=new Proxy(e,{get:function(e,n){return n in e?e[n]:t[n]}});this.options=n}},{key:"_compressFile",value:function(){var e=l(s.default.mark((function e(t){var n,i;return s.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new a.default(t),(i={}).start=window.performance.now(),i.quality=this.options.quality,i.startType=n.type,e.next=7,n.load();case 7:return e.next=9,this._compressImage(n,i);case 9:return e.abrupt("return",e.sent);case 10:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"_compressImage",value:function(){var e=l(s.default.mark((function e(t,n){var i,a,c,l,d;return s.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.startWidth=t.width,n.startHeight=t.height,i=void 0,a=void 0,this.options.resize?(c=(0,o.resize)(t.width,t.height,this.options.maxWidth,this.options.maxHeight),i=c.width,a=c.height):(i=t.width,a=t.height),n.endWidth=i,n.endHeight=a,l=this.doAutoRotation?void 0:1,d=t.getCanvas(i,a,l),n.iterations=0,n.startSizeMB=r.size(t.size).MB,e.next=12,this._loopCompression(d,t,n);case 12:return n.endSizeMB=r.size(t.size).MB,n.sizeReducedInPercent=(n.startSizeMB-n.endSizeMB)/n.startSizeMB*100,n.end=window.performance.now(),n.elapsedTimeInSeconds=(n.end-n.start)/1e3,n.endType=t.type,e.abrupt("return",{photo:t,info:n});case 18:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"_loopCompression",value:function(){var e=l(s.default.mark((function e(t,n,i){var o;return s.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i.iterations++,e.t0=n,e.next=4,r.canvasToBlob(t,i.quality);case 4:if(e.t1=e.sent,e.t0.setData.call(e.t0,e.t1),1==i.iterations&&(n.width=i.endWidth,n.height=i.endHeight),!(r.size(n.size).MB>this.options.targetSize)){e.next=24;break}if(!(i.quality.toFixed(10)-.1<this.options.minQuality)){e.next=18;break}if(o="Couldn't compress image to target size while maintaining quality.\n Target size: "+this.options.targetSize+"\n Actual size: "+r.size(n.size).MB,this.options.throwIfSizeNotReached){e.next=14;break}console.error(o),e.next=15;break;case 14:throw new Error(o);case 15:case 24:return e.abrupt("return");case 18:return i.quality-=this.options.qualityStepSize,e.next=21,this._loopCompression(t,n,i);case 21:return e.abrupt("return",e.sent);case 22:e.next=25;break;case 25:case"end":return e.stop()}}),e,this)})));return function(t,n,s){return e.apply(this,arguments)}}()},{key:"setAutoRotate",value:function(){var t=l(s.default.mark((function t(){var n;return s.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.automaticRotationFeatureTest();case 2:n=t.sent,this.doAutoRotation=this.options.autoRotate&&!n;case 4:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}()},{key:"compress",value:function(){var e=l(s.default.mark((function e(t){var n=this;return s.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.setAutoRotate();case 2:return e.abrupt("return",Promise.all(t.map((function(e){return n._compressFile(e)}))));case 3:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()}],[{key:"blobToBase64",value:function(){var e=l(s.default.mark((function e(){var t=arguments;return s.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.blobToBase64.apply(r,t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"loadImageElement",value:function(){var e=l(s.default.mark((function e(){var t=arguments;return s.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.loadImageElement.apply(void 0,t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"automaticRotationFeatureTest",value:function(){return new Promise((function(e){var t=new Image;t.onload=function(){var n=1===t.width&&2===t.height;e(n)},t.src="data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q=="}))}}]),e}();t.default=d,e.exports=t.default}])},7705:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",s=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),s&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),s&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,s,i,r){"string"==typeof e&&(e=[[null,e,void 0]]);var o={};if(s)for(var a=0;a<this.length;a++){var c=this[a][0];null!=c&&(o[c]=!0)}for(var l=0;l<e.length;l++){var d=[].concat(e[l]);s&&o[d[0]]||(void 0!==r&&(void 0===d[5]||(d[1]="@layer".concat(d[5].length>0?" ".concat(d[5]):""," {").concat(d[1],"}")),d[5]=r),n&&(d[2]?(d[1]="@media ".concat(d[2]," {").concat(d[1],"}"),d[2]=n):d[2]=n),i&&(d[4]?(d[1]="@supports (".concat(d[4],") {").concat(d[1],"}"),d[4]=i):d[4]="".concat(i)),t.push(d))}},t}},4216:e=>{"use strict";e.exports=function(e){var t=e[1],n=e[3];if(!n)return t;if("function"==typeof btoa){var s=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),i="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(s),r="/*# ".concat(i," */");return[t].concat([r]).join("\n")}return[t].join("\n")}},7076:function(e){e.exports=function(){"use strict";var e=1e3,t=6e4,n=36e5,s="millisecond",i="second",r="minute",o="hour",a="day",c="week",l="month",d="quarter",u="year",h="date",m="Invalid Date",f=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,g=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,p={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],n=e%100;return"["+e+(t[(n-20)%10]||t[n]||t[0])+"]"}},v=function(e,t,n){var s=String(e);return!s||s.length>=t?e:""+Array(t+1-s.length).join(n)+e},y={s:v,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),s=Math.floor(n/60),i=n%60;return(t<=0?"+":"-")+v(s,2,"0")+":"+v(i,2,"0")},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var s=12*(n.year()-t.year())+(n.month()-t.month()),i=t.clone().add(s,l),r=n-i<0,o=t.clone().add(s+(r?-1:1),l);return+(-(s+(n-i)/(r?i-o:o-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:l,y:u,w:c,d:a,D:h,h:o,m:r,s:i,ms:s,Q:d}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},_="en",b={};b[_]=p;var w=function(e){return e instanceof A},S=function e(t,n,s){var i;if(!t)return _;if("string"==typeof t){var r=t.toLowerCase();b[r]&&(i=r),n&&(b[r]=n,i=r);var o=t.split("-");if(!i&&o.length>1)return e(o[0])}else{var a=t.name;b[a]=t,i=a}return!s&&i&&(_=i),i||!s&&_},x=function(e,t){if(w(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new A(n)},E=y;E.l=S,E.i=w,E.w=function(e,t){return x(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var A=function(){function p(e){this.$L=S(e.locale,null,!0),this.parse(e)}var v=p.prototype;return v.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(E.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var s=t.match(f);if(s){var i=s[2]-1||0,r=(s[7]||"0").substring(0,3);return n?new Date(Date.UTC(s[1],i,s[3]||1,s[4]||0,s[5]||0,s[6]||0,r)):new Date(s[1],i,s[3]||1,s[4]||0,s[5]||0,s[6]||0,r)}}return new Date(t)}(e),this.$x=e.x||{},this.init()},v.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},v.$utils=function(){return E},v.isValid=function(){return!(this.$d.toString()===m)},v.isSame=function(e,t){var n=x(e);return this.startOf(t)<=n&&n<=this.endOf(t)},v.isAfter=function(e,t){return x(e)<this.startOf(t)},v.isBefore=function(e,t){return this.endOf(t)<x(e)},v.$g=function(e,t,n){return E.u(e)?this[t]:this.set(n,e)},v.unix=function(){return Math.floor(this.valueOf()/1e3)},v.valueOf=function(){return this.$d.getTime()},v.startOf=function(e,t){var n=this,s=!!E.u(t)||t,d=E.p(e),m=function(e,t){var i=E.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return s?i:i.endOf(a)},f=function(e,t){return E.w(n.toDate()[e].apply(n.toDate("s"),(s?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},g=this.$W,p=this.$M,v=this.$D,y="set"+(this.$u?"UTC":"");switch(d){case u:return s?m(1,0):m(31,11);case l:return s?m(1,p):m(0,p+1);case c:var _=this.$locale().weekStart||0,b=(g<_?g+7:g)-_;return m(s?v-b:v+(6-b),p);case a:case h:return f(y+"Hours",0);case o:return f(y+"Minutes",1);case r:return f(y+"Seconds",2);case i:return f(y+"Milliseconds",3);default:return this.clone()}},v.endOf=function(e){return this.startOf(e,!1)},v.$set=function(e,t){var n,c=E.p(e),d="set"+(this.$u?"UTC":""),m=(n={},n[a]=d+"Date",n[h]=d+"Date",n[l]=d+"Month",n[u]=d+"FullYear",n[o]=d+"Hours",n[r]=d+"Minutes",n[i]=d+"Seconds",n[s]=d+"Milliseconds",n)[c],f=c===a?this.$D+(t-this.$W):t;if(c===l||c===u){var g=this.clone().set(h,1);g.$d[m](f),g.init(),this.$d=g.set(h,Math.min(this.$D,g.daysInMonth())).$d}else m&&this.$d[m](f);return this.init(),this},v.set=function(e,t){return this.clone().$set(e,t)},v.get=function(e){return this[E.p(e)]()},v.add=function(s,d){var h,m=this;s=Number(s);var f=E.p(d),g=function(e){var t=x(m);return E.w(t.date(t.date()+Math.round(e*s)),m)};if(f===l)return this.set(l,this.$M+s);if(f===u)return this.set(u,this.$y+s);if(f===a)return g(1);if(f===c)return g(7);var p=(h={},h[r]=t,h[o]=n,h[i]=e,h)[f]||1,v=this.$d.getTime()+s*p;return E.w(v,this)},v.subtract=function(e,t){return this.add(-1*e,t)},v.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||m;var s=e||"YYYY-MM-DDTHH:mm:ssZ",i=E.z(this),r=this.$H,o=this.$m,a=this.$M,c=n.weekdays,l=n.months,d=function(e,n,i,r){return e&&(e[n]||e(t,s))||i[n].slice(0,r)},u=function(e){return E.s(r%12||12,e,"0")},h=n.meridiem||function(e,t,n){var s=e<12?"AM":"PM";return n?s.toLowerCase():s},f={YY:String(this.$y).slice(-2),YYYY:E.s(this.$y,4,"0"),M:a+1,MM:E.s(a+1,2,"0"),MMM:d(n.monthsShort,a,l,3),MMMM:d(l,a),D:this.$D,DD:E.s(this.$D,2,"0"),d:String(this.$W),dd:d(n.weekdaysMin,this.$W,c,2),ddd:d(n.weekdaysShort,this.$W,c,3),dddd:c[this.$W],H:String(r),HH:E.s(r,2,"0"),h:u(1),hh:u(2),a:h(r,o,!0),A:h(r,o,!1),m:String(o),mm:E.s(o,2,"0"),s:String(this.$s),ss:E.s(this.$s,2,"0"),SSS:E.s(this.$ms,3,"0"),Z:i};return s.replace(g,(function(e,t){return t||f[e]||i.replace(":","")}))},v.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},v.diff=function(s,h,m){var f,g=E.p(h),p=x(s),v=(p.utcOffset()-this.utcOffset())*t,y=this-p,_=E.m(this,p);return _=(f={},f[u]=_/12,f[l]=_,f[d]=_/3,f[c]=(y-v)/6048e5,f[a]=(y-v)/864e5,f[o]=y/n,f[r]=y/t,f[i]=y/e,f)[g]||y,m?_:E.a(_)},v.daysInMonth=function(){return this.endOf(l).$D},v.$locale=function(){return b[this.$L]},v.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),s=S(e,t,!0);return s&&(n.$L=s),n},v.clone=function(){return E.w(this.$d,this)},v.toDate=function(){return new Date(this.valueOf())},v.toJSON=function(){return this.isValid()?this.toISOString():null},v.toISOString=function(){return this.$d.toISOString()},v.toString=function(){return this.$d.toUTCString()},p}(),C=A.prototype;return x.prototype=C,[["$ms",s],["$s",i],["$m",r],["$H",o],["$W",a],["$M",l],["$y",u],["$D",h]].forEach((function(e){C[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),x.extend=function(e,t){return e.$i||(e(t,A,x),e.$i=!0),x},x.locale=S,x.isDayjs=w,x.unix=function(e){return x(1e3*e)},x.en=b[_],x.Ls=b,x.p={},x}()},2455:function(e){e.exports=function(){"use strict";return function(e,t){var n=t.prototype,s=n.format;n.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return s.bind(this)(e);var i=this.$utils(),r=(e||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(e){switch(e){case"Q":return Math.ceil((t.$M+1)/3);case"Do":return n.ordinal(t.$D);case"gggg":return t.weekYear();case"GGGG":return t.isoWeekYear();case"wo":return n.ordinal(t.week(),"W");case"w":case"ww":return i.s(t.week(),"w"===e?1:2,"0");case"W":case"WW":return i.s(t.isoWeek(),"W"===e?1:2,"0");case"k":case"kk":return i.s(String(0===t.$H?24:t.$H),"k"===e?1:2,"0");case"X":return Math.floor(t.$d.getTime()/1e3);case"x":return t.$d.getTime();case"z":return"["+t.offsetName()+"]";case"zzz":return"["+t.offsetName("long")+"]";default:return e}}));return s.bind(this)(r)}}}()},1199:function(e){e.exports=function(){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,n){return t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},t(e,n)}function n(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function s(e,i,r){return s=n()?Reflect.construct:function(e,n,s){var i=[null];i.push.apply(i,n);var r=new(Function.bind.apply(e,i));return s&&t(r,s.prototype),r},s.apply(null,arguments)}function i(e){return r(e)||o(e)||a(e)||l()}function r(e){if(Array.isArray(e))return c(e)}function o(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function a(e,t){if(e){if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function l(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var d=Object.hasOwnProperty,u=Object.setPrototypeOf,h=Object.isFrozen,m=Object.getPrototypeOf,f=Object.getOwnPropertyDescriptor,g=Object.freeze,p=Object.seal,v=Object.create,y="undefined"!=typeof Reflect&&Reflect,_=y.apply,b=y.construct;_||(_=function(e,t,n){return e.apply(t,n)}),g||(g=function(e){return e}),p||(p=function(e){return e}),b||(b=function(e,t){return s(e,i(t))});var w=N(Array.prototype.forEach),S=N(Array.prototype.pop),x=N(Array.prototype.push),E=N(String.prototype.toLowerCase),A=N(String.prototype.toString),C=N(String.prototype.match),$=N(String.prototype.replace),k=N(String.prototype.indexOf),j=N(String.prototype.trim),T=N(RegExp.prototype.test),I=O(TypeError);function N(e){return function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return _(e,t,s)}}function O(e){return function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return b(e,n)}}function M(e,t,n){n=n||E,u&&u(e,null);for(var s=t.length;s--;){var i=t[s];if("string"==typeof i){var r=n(i);r!==i&&(h(t)||(t[s]=r),i=r)}e[i]=!0}return e}function R(e){var t,n=v(null);for(t in e)!0===_(d,e,[t])&&(n[t]=e[t]);return n}function D(e,t){for(;null!==e;){var n=f(e,t);if(n){if(n.get)return N(n.get);if("function"==typeof n.value)return N(n.value)}e=m(e)}function s(e){return console.warn("fallback value for",e),null}return s}var z=g(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),L=g(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),P=g(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),F=g(["animate","color-profile","cursor","discard","fedropshadow","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),U=g(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),B=g(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),q=g(["#text"]),H=g(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),G=g(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),W=g(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),V=g(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),J=p(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Z=p(/<%[\w\W]*|[\w\W]*%>/gm),Q=p(/\${[\w\W]*}/gm),K=p(/^data-[\-\w.\u00B7-\uFFFF]/),Y=p(/^aria-[\-\w]+$/),X=p(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ee=p(/^(?:\w+script|data):/i),te=p(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ne=p(/^html$/i),se=function(){return"undefined"==typeof window?null:window},ie=function(t,n){if("object"!==e(t)||"function"!=typeof t.createPolicy)return null;var s=null,i="data-tt-policy-suffix";n.currentScript&&n.currentScript.hasAttribute(i)&&(s=n.currentScript.getAttribute(i));var r="dompurify"+(s?"#"+s:"");try{return t.createPolicy(r,{createHTML:function(e){return e},createScriptURL:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+r+" could not be created."),null}};function re(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:se(),n=function(e){return re(e)};if(n.version="2.4.5",n.removed=[],!t||!t.document||9!==t.document.nodeType)return n.isSupported=!1,n;var s=t.document,r=t.document,o=t.DocumentFragment,a=t.HTMLTemplateElement,c=t.Node,l=t.Element,d=t.NodeFilter,u=t.NamedNodeMap,h=void 0===u?t.NamedNodeMap||t.MozNamedAttrMap:u,m=t.HTMLFormElement,f=t.DOMParser,p=t.trustedTypes,v=l.prototype,y=D(v,"cloneNode"),_=D(v,"nextSibling"),b=D(v,"childNodes"),N=D(v,"parentNode");if("function"==typeof a){var O=r.createElement("template");O.content&&O.content.ownerDocument&&(r=O.content.ownerDocument)}var oe=ie(p,s),ae=oe?oe.createHTML(""):"",ce=r,le=ce.implementation,de=ce.createNodeIterator,ue=ce.createDocumentFragment,he=ce.getElementsByTagName,me=s.importNode,fe={};try{fe=R(r).documentMode?r.documentMode:{}}catch(e){}var ge={};n.isSupported="function"==typeof N&&le&&void 0!==le.createHTMLDocument&&9!==fe;var pe,ve,ye=J,_e=Z,be=Q,we=K,Se=Y,xe=ee,Ee=te,Ae=X,Ce=null,$e=M({},[].concat(i(z),i(L),i(P),i(U),i(q))),ke=null,je=M({},[].concat(i(H),i(G),i(W),i(V))),Te=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ie=null,Ne=null,Oe=!0,Me=!0,Re=!1,De=!0,ze=!1,Le=!1,Pe=!1,Fe=!1,Ue=!1,Be=!1,qe=!1,He=!0,Ge=!1,We="user-content-",Ve=!0,Je=!1,Ze={},Qe=null,Ke=M({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Ye=null,Xe=M({},["audio","video","img","source","image","track"]),et=null,tt=M({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),nt="http://www.w3.org/1998/Math/MathML",st="http://www.w3.org/2000/svg",it="http://www.w3.org/1999/xhtml",rt=it,ot=!1,at=null,ct=M({},[nt,st,it],A),lt=["application/xhtml+xml","text/html"],dt="text/html",ut=null,ht=r.createElement("form"),mt=function(e){return e instanceof RegExp||e instanceof Function},ft=function(t){ut&&ut===t||(t&&"object"===e(t)||(t={}),t=R(t),pe=pe=-1===lt.indexOf(t.PARSER_MEDIA_TYPE)?dt:t.PARSER_MEDIA_TYPE,ve="application/xhtml+xml"===pe?A:E,Ce="ALLOWED_TAGS"in t?M({},t.ALLOWED_TAGS,ve):$e,ke="ALLOWED_ATTR"in t?M({},t.ALLOWED_ATTR,ve):je,at="ALLOWED_NAMESPACES"in t?M({},t.ALLOWED_NAMESPACES,A):ct,et="ADD_URI_SAFE_ATTR"in t?M(R(tt),t.ADD_URI_SAFE_ATTR,ve):tt,Ye="ADD_DATA_URI_TAGS"in t?M(R(Xe),t.ADD_DATA_URI_TAGS,ve):Xe,Qe="FORBID_CONTENTS"in t?M({},t.FORBID_CONTENTS,ve):Ke,Ie="FORBID_TAGS"in t?M({},t.FORBID_TAGS,ve):{},Ne="FORBID_ATTR"in t?M({},t.FORBID_ATTR,ve):{},Ze="USE_PROFILES"in t&&t.USE_PROFILES,Oe=!1!==t.ALLOW_ARIA_ATTR,Me=!1!==t.ALLOW_DATA_ATTR,Re=t.ALLOW_UNKNOWN_PROTOCOLS||!1,De=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,ze=t.SAFE_FOR_TEMPLATES||!1,Le=t.WHOLE_DOCUMENT||!1,Ue=t.RETURN_DOM||!1,Be=t.RETURN_DOM_FRAGMENT||!1,qe=t.RETURN_TRUSTED_TYPE||!1,Fe=t.FORCE_BODY||!1,He=!1!==t.SANITIZE_DOM,Ge=t.SANITIZE_NAMED_PROPS||!1,Ve=!1!==t.KEEP_CONTENT,Je=t.IN_PLACE||!1,Ae=t.ALLOWED_URI_REGEXP||Ae,rt=t.NAMESPACE||it,Te=t.CUSTOM_ELEMENT_HANDLING||{},t.CUSTOM_ELEMENT_HANDLING&&mt(t.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Te.tagNameCheck=t.CUSTOM_ELEMENT_HANDLING.tagNameCheck),t.CUSTOM_ELEMENT_HANDLING&&mt(t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Te.attributeNameCheck=t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),t.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Te.allowCustomizedBuiltInElements=t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ze&&(Me=!1),Be&&(Ue=!0),Ze&&(Ce=M({},i(q)),ke=[],!0===Ze.html&&(M(Ce,z),M(ke,H)),!0===Ze.svg&&(M(Ce,L),M(ke,G),M(ke,V)),!0===Ze.svgFilters&&(M(Ce,P),M(ke,G),M(ke,V)),!0===Ze.mathMl&&(M(Ce,U),M(ke,W),M(ke,V))),t.ADD_TAGS&&(Ce===$e&&(Ce=R(Ce)),M(Ce,t.ADD_TAGS,ve)),t.ADD_ATTR&&(ke===je&&(ke=R(ke)),M(ke,t.ADD_ATTR,ve)),t.ADD_URI_SAFE_ATTR&&M(et,t.ADD_URI_SAFE_ATTR,ve),t.FORBID_CONTENTS&&(Qe===Ke&&(Qe=R(Qe)),M(Qe,t.FORBID_CONTENTS,ve)),Ve&&(Ce["#text"]=!0),Le&&M(Ce,["html","head","body"]),Ce.table&&(M(Ce,["tbody"]),delete Ie.tbody),g&&g(t),ut=t)},gt=M({},["mi","mo","mn","ms","mtext"]),pt=M({},["foreignobject","desc","title","annotation-xml"]),vt=M({},["title","style","font","a","script"]),yt=M({},L);M(yt,P),M(yt,F);var _t=M({},U);M(_t,B);var bt=function(e){var t=N(e);t&&t.tagName||(t={namespaceURI:rt,tagName:"template"});var n=E(e.tagName),s=E(t.tagName);return!!at[e.namespaceURI]&&(e.namespaceURI===st?t.namespaceURI===it?"svg"===n:t.namespaceURI===nt?"svg"===n&&("annotation-xml"===s||gt[s]):Boolean(yt[n]):e.namespaceURI===nt?t.namespaceURI===it?"math"===n:t.namespaceURI===st?"math"===n&&pt[s]:Boolean(_t[n]):e.namespaceURI===it?!(t.namespaceURI===st&&!pt[s])&&!(t.namespaceURI===nt&&!gt[s])&&!_t[n]&&(vt[n]||!yt[n]):!("application/xhtml+xml"!==pe||!at[e.namespaceURI]))},wt=function(e){x(n.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){try{e.outerHTML=ae}catch(t){e.remove()}}},St=function(e,t){try{x(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){x(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!ke[e])if(Ue||Be)try{wt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},xt=function(e){var t,n;if(Fe)e="<remove></remove>"+e;else{var s=C(e,/^[\r\n\t ]+/);n=s&&s[0]}"application/xhtml+xml"===pe&&rt===it&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");var i=oe?oe.createHTML(e):e;if(rt===it)try{t=(new f).parseFromString(i,pe)}catch(e){}if(!t||!t.documentElement){t=le.createDocument(rt,"template",null);try{t.documentElement.innerHTML=ot?ae:i}catch(e){}}var o=t.body||t.documentElement;return e&&n&&o.insertBefore(r.createTextNode(n),o.childNodes[0]||null),rt===it?he.call(t,Le?"html":"body")[0]:Le?t.documentElement:o},Et=function(e){return de.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT,null,!1)},At=function(e){return e instanceof m&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof h)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Ct=function(t){return"object"===e(c)?t instanceof c:t&&"object"===e(t)&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName},$t=function(e,t,s){ge[e]&&w(ge[e],(function(e){e.call(n,t,s,ut)}))},kt=function(e){var t;if($t("beforeSanitizeElements",e,null),At(e))return wt(e),!0;if(T(/[\u0080-\uFFFF]/,e.nodeName))return wt(e),!0;var s=ve(e.nodeName);if($t("uponSanitizeElement",e,{tagName:s,allowedTags:Ce}),e.hasChildNodes()&&!Ct(e.firstElementChild)&&(!Ct(e.content)||!Ct(e.content.firstElementChild))&&T(/<[/\w]/g,e.innerHTML)&&T(/<[/\w]/g,e.textContent))return wt(e),!0;if("select"===s&&T(/<template/i,e.innerHTML))return wt(e),!0;if(!Ce[s]||Ie[s]){if(!Ie[s]&&Tt(s)){if(Te.tagNameCheck instanceof RegExp&&T(Te.tagNameCheck,s))return!1;if(Te.tagNameCheck instanceof Function&&Te.tagNameCheck(s))return!1}if(Ve&&!Qe[s]){var i=N(e)||e.parentNode,r=b(e)||e.childNodes;if(r&&i)for(var o=r.length-1;o>=0;--o)i.insertBefore(y(r[o],!0),_(e))}return wt(e),!0}return e instanceof l&&!bt(e)?(wt(e),!0):"noscript"!==s&&"noembed"!==s||!T(/<\/no(script|embed)/i,e.innerHTML)?(ze&&3===e.nodeType&&(t=e.textContent,t=$(t,ye," "),t=$(t,_e," "),t=$(t,be," "),e.textContent!==t&&(x(n.removed,{element:e.cloneNode()}),e.textContent=t)),$t("afterSanitizeElements",e,null),!1):(wt(e),!0)},jt=function(e,t,n){if(He&&("id"===t||"name"===t)&&(n in r||n in ht))return!1;if(Me&&!Ne[t]&&T(we,t));else if(Oe&&T(Se,t));else if(!ke[t]||Ne[t]){if(!(Tt(e)&&(Te.tagNameCheck instanceof RegExp&&T(Te.tagNameCheck,e)||Te.tagNameCheck instanceof Function&&Te.tagNameCheck(e))&&(Te.attributeNameCheck instanceof RegExp&&T(Te.attributeNameCheck,t)||Te.attributeNameCheck instanceof Function&&Te.attributeNameCheck(t))||"is"===t&&Te.allowCustomizedBuiltInElements&&(Te.tagNameCheck instanceof RegExp&&T(Te.tagNameCheck,n)||Te.tagNameCheck instanceof Function&&Te.tagNameCheck(n))))return!1}else if(et[t]);else if(T(Ae,$(n,Ee,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==k(n,"data:")||!Ye[e])if(Re&&!T(xe,$(n,Ee,"")));else if(n)return!1;return!0},Tt=function(e){return e.indexOf("-")>0},It=function(t){var s,i,r,o;$t("beforeSanitizeAttributes",t,null);var a=t.attributes;if(a){var c={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ke};for(o=a.length;o--;){var l=s=a[o],d=l.name,u=l.namespaceURI;if(i="value"===d?s.value:j(s.value),r=ve(d),c.attrName=r,c.attrValue=i,c.keepAttr=!0,c.forceKeepAttr=void 0,$t("uponSanitizeAttribute",t,c),i=c.attrValue,!c.forceKeepAttr&&(St(d,t),c.keepAttr))if(De||!T(/\/>/i,i)){ze&&(i=$(i,ye," "),i=$(i,_e," "),i=$(i,be," "));var h=ve(t.nodeName);if(jt(h,r,i)){if(!Ge||"id"!==r&&"name"!==r||(St(d,t),i=We+i),oe&&"object"===e(p)&&"function"==typeof p.getAttributeType)if(u);else switch(p.getAttributeType(h,r)){case"TrustedHTML":i=oe.createHTML(i);break;case"TrustedScriptURL":i=oe.createScriptURL(i)}try{u?t.setAttributeNS(u,d,i):t.setAttribute(d,i),S(n.removed)}catch(e){}}}else St(d,t)}$t("afterSanitizeAttributes",t,null)}},Nt=function e(t){var n,s=Et(t);for($t("beforeSanitizeShadowDOM",t,null);n=s.nextNode();)$t("uponSanitizeShadowNode",n,null),kt(n)||(n.content instanceof o&&e(n.content),It(n));$t("afterSanitizeShadowDOM",t,null)};return n.sanitize=function(i){var r,a,l,d,u,h=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if((ot=!i)&&(i="\x3c!--\x3e"),"string"!=typeof i&&!Ct(i)){if("function"!=typeof i.toString)throw I("toString is not a function");if("string"!=typeof(i=i.toString()))throw I("dirty is not a string, aborting")}if(!n.isSupported){if("object"===e(t.toStaticHTML)||"function"==typeof t.toStaticHTML){if("string"==typeof i)return t.toStaticHTML(i);if(Ct(i))return t.toStaticHTML(i.outerHTML)}return i}if(Pe||ft(h),n.removed=[],"string"==typeof i&&(Je=!1),Je){if(i.nodeName){var m=ve(i.nodeName);if(!Ce[m]||Ie[m])throw I("root node is forbidden and cannot be sanitized in-place")}}else if(i instanceof c)1===(a=(r=xt("\x3c!----\x3e")).ownerDocument.importNode(i,!0)).nodeType&&"BODY"===a.nodeName||"HTML"===a.nodeName?r=a:r.appendChild(a);else{if(!Ue&&!ze&&!Le&&-1===i.indexOf("<"))return oe&&qe?oe.createHTML(i):i;if(!(r=xt(i)))return Ue?null:qe?ae:""}r&&Fe&&wt(r.firstChild);for(var f=Et(Je?i:r);l=f.nextNode();)3===l.nodeType&&l===d||kt(l)||(l.content instanceof o&&Nt(l.content),It(l),d=l);if(d=null,Je)return i;if(Ue){if(Be)for(u=ue.call(r.ownerDocument);r.firstChild;)u.appendChild(r.firstChild);else u=r;return(ke.shadowroot||ke.shadowrootmod)&&(u=me.call(s,u,!0)),u}var g=Le?r.outerHTML:r.innerHTML;return Le&&Ce["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&T(ne,r.ownerDocument.doctype.name)&&(g="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+g),ze&&(g=$(g,ye," "),g=$(g,_e," "),g=$(g,be," ")),oe&&qe?oe.createHTML(g):g},n.setConfig=function(e){ft(e),Pe=!0},n.clearConfig=function(){ut=null,Pe=!1},n.isValidAttribute=function(e,t,n){ut||ft({});var s=ve(e),i=ve(t);return jt(s,i,n)},n.addHook=function(e,t){"function"==typeof t&&(ge[e]=ge[e]||[],x(ge[e],t))},n.removeHook=function(e){if(ge[e])return S(ge[e])},n.removeHooks=function(e){ge[e]&&(ge[e]=[])},n.removeAllHooks=function(){ge={}},n}return re()}()},3243:(e,t)=>{var n,s;s=function(e){"use strict";e=e||{};var t,n,s,i,r,o,a,c,l,d,u,h,m,f,g={bgColor:"#d00",textColor:"#fff",fontFamily:"sans-serif",fontStyle:"bold",type:"circle",position:"down",animation:"slide",elementId:!1,element:null,dataUrl:!1,win:window};(h={}).ff="undefined"!=typeof InstallTrigger,h.chrome=!!window.chrome,h.opera=!!window.opera||navigator.userAgent.indexOf("Opera")>=0,h.ie=!1,h.safari=Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0,h.supported=h.chrome||h.ff||h.opera;var p=[];u=function(){},c=!1;var v={ready:function(){c=!0,v.reset(),u()},reset:function(){c&&(p=[],l=!1,d=!1,o.clearRect(0,0,i,s),o.drawImage(a,0,0,i,s),b.setIcon(r),window.clearTimeout(m),window.clearTimeout(void 0))},start:function(){if(c&&!d&&p.length>0){d=!0;var e=function(){["type","animation","bgColor","textColor","fontFamily","fontStyle"].forEach((function(e){e in p[0].options&&(t[e]=p[0].options[e])})),x.run(p[0].options,(function(){l=p[0],d=!1,p.length>0&&(p.shift(),v.start())}),!1)};l?x.run(l.options,(function(){e()}),!0):e()}}},y={},_=function(e){return e.n="number"==typeof e.n?Math.abs(0|e.n):e.n,e.x=i*e.x,e.y=s*e.y,e.w=i*e.w,e.h=s*e.h,e.len=(""+e.n).length,e};y.circle=function(e){var n=!1;2===(e=_(e)).len?(e.x=e.x-.4*e.w,e.w=1.4*e.w,n=!0):e.len>=3&&(e.x=e.x-.65*e.w,e.w=1.65*e.w,n=!0),o.clearRect(0,0,i,s),o.drawImage(a,0,0,i,s),o.beginPath(),o.font=t.fontStyle+" "+Math.floor(e.h*(e.n>99?.85:1))+"px "+t.fontFamily,o.textAlign="center",n?(o.moveTo(e.x+e.w/2,e.y),o.lineTo(e.x+e.w-e.h/2,e.y),o.quadraticCurveTo(e.x+e.w,e.y,e.x+e.w,e.y+e.h/2),o.lineTo(e.x+e.w,e.y+e.h-e.h/2),o.quadraticCurveTo(e.x+e.w,e.y+e.h,e.x+e.w-e.h/2,e.y+e.h),o.lineTo(e.x+e.h/2,e.y+e.h),o.quadraticCurveTo(e.x,e.y+e.h,e.x,e.y+e.h-e.h/2),o.lineTo(e.x,e.y+e.h/2),o.quadraticCurveTo(e.x,e.y,e.x+e.h/2,e.y)):o.arc(e.x+e.w/2,e.y+e.h/2,e.h/2,0,2*Math.PI),o.fillStyle="rgba("+t.bgColor.r+","+t.bgColor.g+","+t.bgColor.b+","+e.o+")",o.fill(),o.closePath(),o.beginPath(),o.stroke(),o.fillStyle="rgba("+t.textColor.r+","+t.textColor.g+","+t.textColor.b+","+e.o+")","number"==typeof e.n&&e.n>999?o.fillText((e.n>9999?9:Math.floor(e.n/1e3))+"k+",Math.floor(e.x+e.w/2),Math.floor(e.y+e.h-.2*e.h)):o.fillText(e.n,Math.floor(e.x+e.w/2),Math.floor(e.y+e.h-.15*e.h)),o.closePath()},y.rectangle=function(e){2===(e=_(e)).len?(e.x=e.x-.4*e.w,e.w=1.4*e.w):e.len>=3&&(e.x=e.x-.65*e.w,e.w=1.65*e.w),o.clearRect(0,0,i,s),o.drawImage(a,0,0,i,s),o.beginPath(),o.font=t.fontStyle+" "+Math.floor(e.h*(e.n>99?.9:1))+"px "+t.fontFamily,o.textAlign="center",o.fillStyle="rgba("+t.bgColor.r+","+t.bgColor.g+","+t.bgColor.b+","+e.o+")",o.fillRect(e.x,e.y,e.w,e.h),o.fillStyle="rgba("+t.textColor.r+","+t.textColor.g+","+t.textColor.b+","+e.o+")","number"==typeof e.n&&e.n>999?o.fillText((e.n>9999?9:Math.floor(e.n/1e3))+"k+",Math.floor(e.x+e.w/2),Math.floor(e.y+e.h-.2*e.h)):o.fillText(e.n,Math.floor(e.x+e.w/2),Math.floor(e.y+e.h-.15*e.h)),o.closePath()};var b={};function w(e){e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(e,t,n,s){return t+t+n+n+s+s}));var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return!!t&&{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}}function S(e,t){var n,s={};for(n in e)s[n]=e[n];for(n in t)s[n]=t[n];return s}b.getIcons=function(){var e=[];return t.element?e=[t.element]:t.elementId?(e=[f.getElementById(t.elementId)])[0].setAttribute("href",e[0].getAttribute("src")):0===(e=function(){for(var e=[],t=f.getElementsByTagName("head")[0].getElementsByTagName("link"),n=0;n<t.length;n++)/(^|\s)icon(\s|$)/i.test(t[n].getAttribute("rel"))&&e.push(t[n]);return e}()).length&&((e=[f.createElement("link")])[0].setAttribute("rel","icon"),f.getElementsByTagName("head")[0].appendChild(e[0])),e.forEach((function(e){e.setAttribute("type","image/png")})),e},b.setIcon=function(e){var t=e.toDataURL("image/png");b.setIconSrc(t)},b.setIconSrc=function(e){if(t.dataUrl&&t.dataUrl(e),t.element)t.element.setAttribute("href",e),t.element.setAttribute("src",e);else if(t.elementId){var s=f.getElementById(t.elementId);s.setAttribute("href",e),s.setAttribute("src",e)}else if(h.ff||h.opera){var i=n[n.length-1],r=f.createElement("link");n=[r],h.opera&&r.setAttribute("rel","icon"),r.setAttribute("rel","icon"),r.setAttribute("type","image/png"),f.getElementsByTagName("head")[0].appendChild(r),r.setAttribute("href",e),i.parentNode&&i.parentNode.removeChild(i)}else n.forEach((function(t){t.setAttribute("href",e)}))};var x={duration:40,types:{}};return x.types.fade=[{x:.4,y:.4,w:.6,h:.6,o:0},{x:.4,y:.4,w:.6,h:.6,o:.1},{x:.4,y:.4,w:.6,h:.6,o:.2},{x:.4,y:.4,w:.6,h:.6,o:.3},{x:.4,y:.4,w:.6,h:.6,o:.4},{x:.4,y:.4,w:.6,h:.6,o:.5},{x:.4,y:.4,w:.6,h:.6,o:.6},{x:.4,y:.4,w:.6,h:.6,o:.7},{x:.4,y:.4,w:.6,h:.6,o:.8},{x:.4,y:.4,w:.6,h:.6,o:.9},{x:.4,y:.4,w:.6,h:.6,o:1}],x.types.none=[{x:.4,y:.4,w:.6,h:.6,o:1}],x.types.pop=[{x:1,y:1,w:0,h:0,o:1},{x:.9,y:.9,w:.1,h:.1,o:1},{x:.8,y:.8,w:.2,h:.2,o:1},{x:.7,y:.7,w:.3,h:.3,o:1},{x:.6,y:.6,w:.4,h:.4,o:1},{x:.5,y:.5,w:.5,h:.5,o:1},{x:.4,y:.4,w:.6,h:.6,o:1}],x.types.popFade=[{x:.75,y:.75,w:0,h:0,o:0},{x:.65,y:.65,w:.1,h:.1,o:.2},{x:.6,y:.6,w:.2,h:.2,o:.4},{x:.55,y:.55,w:.3,h:.3,o:.6},{x:.5,y:.5,w:.4,h:.4,o:.8},{x:.45,y:.45,w:.5,h:.5,o:.9},{x:.4,y:.4,w:.6,h:.6,o:1}],x.types.slide=[{x:.4,y:1,w:.6,h:.6,o:1},{x:.4,y:.9,w:.6,h:.6,o:1},{x:.4,y:.9,w:.6,h:.6,o:1},{x:.4,y:.8,w:.6,h:.6,o:1},{x:.4,y:.7,w:.6,h:.6,o:1},{x:.4,y:.6,w:.6,h:.6,o:1},{x:.4,y:.5,w:.6,h:.6,o:1},{x:.4,y:.4,w:.6,h:.6,o:1}],x.run=function(e,n,s,i){var o=x.types[f.hidden||f.msHidden||f.webkitHidden||f.mozHidden?"none":t.animation];i=!0===s?void 0!==i?i:o.length-1:void 0!==i?i:0,n=n||function(){},i<o.length&&i>=0?(y[t.type](S(e,o[i])),m=setTimeout((function(){s?i-=1:i+=1,x.run(e,n,s,i)}),x.duration),b.setIcon(r)):n()},function(){(t=S(g,e)).bgColor=w(t.bgColor),t.textColor=w(t.textColor),t.position=t.position.toLowerCase(),t.animation=x.types[""+t.animation]?t.animation:g.animation,f=t.win.document;var c=t.position.indexOf("up")>-1,l=t.position.indexOf("left")>-1;if(c||l)for(var d in x.types)for(var u=0;u<x.types[d].length;u++){var h=x.types[d][u];c&&(h.y<.6?h.y=h.y-.4:h.y=h.y-2*h.y+(1-h.w)),l&&(h.x<.6?h.x=h.x-.4:h.x=h.x-2*h.x+(1-h.h)),x.types[d][u]=h}t.type=y[""+t.type]?t.type:g.type,n=b.getIcons(),r=document.createElement("canvas"),a=document.createElement("img");var m=n[n.length-1];m.hasAttribute("href")?(a.setAttribute("crossOrigin","anonymous"),a.onload=function(){s=a.height>0?a.height:32,i=a.width>0?a.width:32,r.height=s,r.width=i,o=r.getContext("2d"),v.ready()},a.setAttribute("src",m.getAttribute("href"))):(s=32,i=32,a.height=s,a.width=i,r.height=s,r.width=i,o=r.getContext("2d"),v.ready())}(),{badge:function(e,t){t=("string"==typeof t?{animation:t}:t)||{},u=function(){try{if("number"==typeof e?e>0:""!==e){var n={type:"badge",options:{n:e}};if("animation"in t&&x.types[""+t.animation]&&(n.options.animation=""+t.animation),"type"in t&&y[""+t.type]&&(n.options.type=""+t.type),["bgColor","textColor"].forEach((function(e){e in t&&(n.options[e]=w(t[e]))})),["fontStyle","fontFamily"].forEach((function(e){e in t&&(n.options[e]=t[e])})),p.push(n),p.length>100)throw new Error("Too many badges requests in queue.");v.start()}else v.reset()}catch(e){throw new Error("Error setting badge. Message: "+e.message)}},c&&u()},setOpt:function(e,n){var s=e;null==n&&"[object Object]"==Object.prototype.toString.call(e)||((s={})[e]=n);for(var i=Object.keys(s),r=0;r<i.length;r++)"bgColor"==i[r]||"textColor"==i[r]?t[i[r]]=w(s[i[r]]):t[i[r]]=s[i[r]];p.push(l),v.start()},reset:v.reset,browser:{supported:h.supported}}},void 0===(n=function(){return s}.apply(t,[]))||(e.exports=n)},2598:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.deinterlace=void 0;t.deinterlace=function(e,t){for(var n=new Array(e.length),s=e.length/t,i=function(s,i){var r=e.slice(i*t,(i+1)*t);n.splice.apply(n,[s*t,t].concat(r))},r=[0,4,2,1],o=[8,8,4,2],a=0,c=0;c<4;c++)for(var l=r[c];l<s;l+=o[c])i(l,a),a++;return n}},5481:(e,t,n)=>{"use strict";t.zw=t.vq=void 0;var s,i=(s=n(4609))&&s.__esModule?s:{default:s},r=n(9588),o=n(7656),a=n(2598),c=n(9826);t.vq=function(e){var t=new Uint8Array(e);return(0,r.parse)((0,o.buildStream)(t),i.default)};var l=function(e,t,n){if(e.image){var s=e.image,i=s.descriptor.width*s.descriptor.height,r=(0,c.lzw)(s.data.minCodeSize,s.data.blocks,i);s.descriptor.lct.interlaced&&(r=(0,a.deinterlace)(r,s.descriptor.width));var o={pixels:r,dims:{top:e.image.descriptor.top,left:e.image.descriptor.left,width:e.image.descriptor.width,height:e.image.descriptor.height}};return s.descriptor.lct&&s.descriptor.lct.exists?o.colorTable=s.lct:o.colorTable=t,e.gce&&(o.delay=10*(e.gce.delay||10),o.disposalType=e.gce.extras.disposal,e.gce.extras.transparentColorGiven&&(o.transparentIndex=e.gce.transparentColorIndex)),n&&(o.patch=function(e){for(var t=e.pixels.length,n=new Uint8ClampedArray(4*t),s=0;s<t;s++){var i=4*s,r=e.pixels[s],o=e.colorTable[r]||[0,0,0];n[i]=o[0],n[i+1]=o[1],n[i+2]=o[2],n[i+3]=r!==e.transparentIndex?255:0}return n}(o)),o}console.warn("gif frame does not have associated image.")};t.zw=function(e,t){return e.frames.filter((function(e){return e.image})).map((function(n){return l(n,e.gct,t)}))}},9826:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.lzw=void 0;t.lzw=function(e,t,n){var s,i,r,o,a,c,l,d,u,h,m,f,g,p,v,y,_=4096,b=n,w=new Array(n),S=new Array(_),x=new Array(_),E=new Array(4097);for(a=(i=1<<(h=e))+1,s=i+2,l=-1,r=(1<<(o=h+1))-1,d=0;d<i;d++)S[d]=0,x[d]=d;for(m=f=g=p=v=y=0,u=0;u<b;){if(0===p){if(f<o){m+=t[y]<<f,f+=8,y++;continue}if(d=m&r,m>>=o,f-=o,d>s||d==a)break;if(d==i){r=(1<<(o=h+1))-1,s=i+2,l=-1;continue}if(-1==l){E[p++]=x[d],l=d,g=d;continue}for(c=d,d==s&&(E[p++]=g,d=l);d>i;)E[p++]=x[d],d=S[d];g=255&x[d],E[p++]=g,s<_&&(S[s]=l,x[s]=g,0==(++s&r)&&s<_&&(o++,r+=s)),l=c}p--,w[v++]=E[p],u++}for(u=v;u<b;u++)w[u]=0;return w}},2579:(e,t,n)=>{"use strict";var s,i,r=n.g.MutationObserver||n.g.WebKitMutationObserver;if(r){var o=0,a=new r(u),c=n.g.document.createTextNode("");a.observe(c,{characterData:!0}),s=function(){c.data=o=++o%2}}else if(n.g.setImmediate||void 0===n.g.MessageChannel)s="document"in n.g&&"onreadystatechange"in n.g.document.createElement("script")?function(){var e=n.g.document.createElement("script");e.onreadystatechange=function(){u(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},n.g.document.documentElement.appendChild(e)}:function(){setTimeout(u,0)};else{var l=new n.g.MessageChannel;l.port1.onmessage=u,s=function(){l.port2.postMessage(0)}}var d=[];function u(){var e,t;i=!0;for(var n=d.length;n;){for(t=d,d=[],e=-1;++e<n;)t[e]();n=d.length}i=!1}e.exports=function(e){1!==d.push(e)||i||s()}},2107:function(e,t){!function(n,s){var i=Array.prototype,r=Object.prototype,o=i.slice,a=r.hasOwnProperty,c=i.forEach,l={},d={forEach:function(e,t,n){var s,i,r;if(null!==e)if(c&&e.forEach===c)e.forEach(t,n);else if(e.length===+e.length){for(s=0,i=e.length;s<i;s++)if(s in e&&t.call(n,e[s],s,e)===l)return}else for(r in e)if(a.call(e,r)&&t.call(n,e[r],r,e)===l)return},extend:function(e){return this.forEach(o.call(arguments,1),(function(t){for(var n in t)e[n]=t[n]})),e}},u=function(e){if(this.defaults={locale_data:{messages:{"":{domain:"messages",lang:"en",plural_forms:"nplurals=2; plural=(n != 1);"}}},domain:"messages",debug:!1},this.options=d.extend({},this.defaults,e),this.textdomain(this.options.domain),e.domain&&!this.options.locale_data[this.options.domain])throw new Error("Text domain set to non-existent domain: `"+e.domain+"`")};function h(e){return u.PF.compile(e||"nplurals=2; plural=(n != 1);")}function m(e,t){this._key=e,this._i18n=t}u.context_delimiter=String.fromCharCode(4),d.extend(m.prototype,{onDomain:function(e){return this._domain=e,this},withContext:function(e){return this._context=e,this},ifPlural:function(e,t){return this._val=e,this._pkey=t,this},fetch:function(e){return"[object Array]"!={}.toString.call(e)&&(e=[].slice.call(arguments,0)),(e&&e.length?u.sprintf:function(e){return e})(this._i18n.dcnpgettext(this._domain,this._context,this._key,this._pkey,this._val),e)}}),d.extend(u.prototype,{translate:function(e){return new m(e,this)},textdomain:function(e){if(!e)return this._textdomain;this._textdomain=e},gettext:function(e){return this.dcnpgettext.call(this,s,s,e)},dgettext:function(e,t){return this.dcnpgettext.call(this,e,s,t)},dcgettext:function(e,t){return this.dcnpgettext.call(this,e,s,t)},ngettext:function(e,t,n){return this.dcnpgettext.call(this,s,s,e,t,n)},dngettext:function(e,t,n,i){return this.dcnpgettext.call(this,e,s,t,n,i)},dcngettext:function(e,t,n,i){return this.dcnpgettext.call(this,e,s,t,n,i)},pgettext:function(e,t){return this.dcnpgettext.call(this,s,e,t)},dpgettext:function(e,t,n){return this.dcnpgettext.call(this,e,t,n)},dcpgettext:function(e,t,n){return this.dcnpgettext.call(this,e,t,n)},npgettext:function(e,t,n,i){return this.dcnpgettext.call(this,s,e,t,n,i)},dnpgettext:function(e,t,n,s,i){return this.dcnpgettext.call(this,e,t,n,s,i)},dcnpgettext:function(e,t,n,s,i){var r;if(s=s||n,e=e||this._textdomain,!this.options)return(r=new u).dcnpgettext.call(r,void 0,void 0,n,s,i);if(!this.options.locale_data)throw new Error("No locale data provided.");if(!this.options.locale_data[e])throw new Error("Domain `"+e+"` was not found.");if(!this.options.locale_data[e][""])throw new Error("No locale meta information provided.");if(!n)throw new Error("No translation key found.");var o,a,c,l=t?t+u.context_delimiter+n:n,d=this.options.locale_data,m=d[e],f=(d.messages||this.defaults.locale_data.messages)[""],g=m[""].plural_forms||m[""]["Plural-Forms"]||m[""]["plural-forms"]||f.plural_forms||f["Plural-Forms"]||f["plural-forms"];if(void 0===i)c=0;else{if("number"!=typeof i&&(i=parseInt(i,10),isNaN(i)))throw new Error("The number that was passed in is not a number.");c=h(g)(i)}if(!m)throw new Error("No domain named `"+e+"` could be found.");return!(o=m[l])||c>o.length?(this.options.missing_key_callback&&this.options.missing_key_callback(l,e),a=[n,s],!0===this.options.debug&&console.log(a[h(g)(i)]),a[h()(i)]):(a=o[c])||(a=[n,s])[h()(i)]}});var f,g,p=function(){function e(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function t(e,t){for(var n=[];t>0;n[--t]=e);return n.join("")}var n=function(){return n.cache.hasOwnProperty(arguments[0])||(n.cache[arguments[0]]=n.parse(arguments[0])),n.format.call(null,n.cache[arguments[0]],arguments)};return n.format=function(n,s){var i,r,o,a,c,l,d,u=1,h=n.length,m="",f=[];for(r=0;r<h;r++)if("string"===(m=e(n[r])))f.push(n[r]);else if("array"===m){if((a=n[r])[2])for(i=s[u],o=0;o<a[2].length;o++){if(!i.hasOwnProperty(a[2][o]))throw p('[sprintf] property "%s" does not exist',a[2][o]);i=i[a[2][o]]}else i=a[1]?s[a[1]]:s[u++];if(/[^s]/.test(a[8])&&"number"!=e(i))throw p("[sprintf] expecting number but found %s",e(i));switch(null==i&&(i=""),a[8]){case"b":i=i.toString(2);break;case"c":i=String.fromCharCode(i);break;case"d":i=parseInt(i,10);break;case"e":i=a[7]?i.toExponential(a[7]):i.toExponential();break;case"f":i=a[7]?parseFloat(i).toFixed(a[7]):parseFloat(i);break;case"o":i=i.toString(8);break;case"s":i=(i=String(i))&&a[7]?i.substring(0,a[7]):i;break;case"u":i=Math.abs(i);break;case"x":i=i.toString(16);break;case"X":i=i.toString(16).toUpperCase()}i=/[def]/.test(a[8])&&a[3]&&i>=0?"+"+i:i,l=a[4]?"0"==a[4]?"0":a[4].charAt(1):" ",d=a[6]-String(i).length,c=a[6]?t(l,d):"",f.push(a[5]?i+c:c+i)}return f.join("")},n.cache={},n.parse=function(e){for(var t=e,n=[],s=[],i=0;t;){if(null!==(n=/^[^\x25]+/.exec(t)))s.push(n[0]);else if(null!==(n=/^\x25{2}/.exec(t)))s.push("%");else{if(null===(n=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(t)))throw"[sprintf] huh?";if(n[2]){i|=1;var r=[],o=n[2],a=[];if(null===(a=/^([a-z_][a-z_\d]*)/i.exec(o)))throw"[sprintf] huh?";for(r.push(a[1]);""!==(o=o.substring(a[0].length));)if(null!==(a=/^\.([a-z_][a-z_\d]*)/i.exec(o)))r.push(a[1]);else{if(null===(a=/^\[(\d+)\]/.exec(o)))throw"[sprintf] huh?";r.push(a[1])}n[2]=r}else i|=2;if(3===i)throw"[sprintf] mixing positional and named placeholders is not (yet) supported";s.push(n)}t=t.substring(n[0].length)}return s},n}();u.parse_plural=function(e,t){return e=e.replace(/n/g,t),u.parse_expression(e)},u.sprintf=function(e,t){return"[object Array]"=={}.toString.call(t)?function(e,t){return t.unshift(e),p.apply(null,t)}(e,[].slice.call(t)):p.apply(this,[].slice.call(arguments))},u.prototype.sprintf=function(){return u.sprintf.apply(this,arguments)},(u.PF={}).parse=function(e){var t=u.PF.extractPluralExpr(e);return u.PF.parser.parse.call(u.PF.parser,t)},u.PF.compile=function(e){var t=u.PF.parse(e);return function(e){return!0===(n=u.PF.interpreter(t)(e))?1:n||0;var n}},u.PF.interpreter=function(e){return function(t){switch(e.type){case"GROUP":return u.PF.interpreter(e.expr)(t);case"TERNARY":return u.PF.interpreter(e.expr)(t)?u.PF.interpreter(e.truthy)(t):u.PF.interpreter(e.falsey)(t);case"OR":return u.PF.interpreter(e.left)(t)||u.PF.interpreter(e.right)(t);case"AND":return u.PF.interpreter(e.left)(t)&&u.PF.interpreter(e.right)(t);case"LT":return u.PF.interpreter(e.left)(t)<u.PF.interpreter(e.right)(t);case"GT":return u.PF.interpreter(e.left)(t)>u.PF.interpreter(e.right)(t);case"LTE":return u.PF.interpreter(e.left)(t)<=u.PF.interpreter(e.right)(t);case"GTE":return u.PF.interpreter(e.left)(t)>=u.PF.interpreter(e.right)(t);case"EQ":return u.PF.interpreter(e.left)(t)==u.PF.interpreter(e.right)(t);case"NEQ":return u.PF.interpreter(e.left)(t)!=u.PF.interpreter(e.right)(t);case"MOD":return u.PF.interpreter(e.left)(t)%u.PF.interpreter(e.right)(t);case"VAR":return t;case"NUM":return e.val;default:throw new Error("Invalid Token found.")}}},u.PF.extractPluralExpr=function(e){e=e.replace(/^\s\s*/,"").replace(/\s\s*$/,""),/;\s*$/.test(e)||(e=e.concat(";"));var t,n=/nplurals\=(\d+);/,s=e.match(n);if(!(s.length>1))throw new Error("nplurals not found in plural_forms string: "+e);if(s[1],!((t=(e=e.replace(n,"")).match(/plural\=(.*);/))&&t.length>1))throw new Error("`plural` expression not found: "+e);return t[1]},u.PF.parser=(f={trace:function(){},yy:{},symbols_:{error:2,expressions:3,e:4,EOF:5,"?":6,":":7,"||":8,"&&":9,"<":10,"<=":11,">":12,">=":13,"!=":14,"==":15,"%":16,"(":17,")":18,n:19,NUMBER:20,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",6:"?",7:":",8:"||",9:"&&",10:"<",11:"<=",12:">",13:">=",14:"!=",15:"==",16:"%",17:"(",18:")",19:"n",20:"NUMBER"},productions_:[0,[3,2],[4,5],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,1],[4,1]],performAction:function(e,t,n,s,i,r,o){var a=r.length-1;switch(i){case 1:return{type:"GROUP",expr:r[a-1]};case 2:this.$={type:"TERNARY",expr:r[a-4],truthy:r[a-2],falsey:r[a]};break;case 3:this.$={type:"OR",left:r[a-2],right:r[a]};break;case 4:this.$={type:"AND",left:r[a-2],right:r[a]};break;case 5:this.$={type:"LT",left:r[a-2],right:r[a]};break;case 6:this.$={type:"LTE",left:r[a-2],right:r[a]};break;case 7:this.$={type:"GT",left:r[a-2],right:r[a]};break;case 8:this.$={type:"GTE",left:r[a-2],right:r[a]};break;case 9:this.$={type:"NEQ",left:r[a-2],right:r[a]};break;case 10:this.$={type:"EQ",left:r[a-2],right:r[a]};break;case 11:this.$={type:"MOD",left:r[a-2],right:r[a]};break;case 12:this.$={type:"GROUP",expr:r[a-1]};break;case 13:this.$={type:"VAR"};break;case 14:this.$={type:"NUM",val:Number(e)}}},table:[{3:1,4:2,17:[1,3],19:[1,4],20:[1,5]},{1:[3]},{5:[1,6],6:[1,7],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16]},{4:17,17:[1,3],19:[1,4],20:[1,5]},{5:[2,13],6:[2,13],7:[2,13],8:[2,13],9:[2,13],10:[2,13],11:[2,13],12:[2,13],13:[2,13],14:[2,13],15:[2,13],16:[2,13],18:[2,13]},{5:[2,14],6:[2,14],7:[2,14],8:[2,14],9:[2,14],10:[2,14],11:[2,14],12:[2,14],13:[2,14],14:[2,14],15:[2,14],16:[2,14],18:[2,14]},{1:[2,1]},{4:18,17:[1,3],19:[1,4],20:[1,5]},{4:19,17:[1,3],19:[1,4],20:[1,5]},{4:20,17:[1,3],19:[1,4],20:[1,5]},{4:21,17:[1,3],19:[1,4],20:[1,5]},{4:22,17:[1,3],19:[1,4],20:[1,5]},{4:23,17:[1,3],19:[1,4],20:[1,5]},{4:24,17:[1,3],19:[1,4],20:[1,5]},{4:25,17:[1,3],19:[1,4],20:[1,5]},{4:26,17:[1,3],19:[1,4],20:[1,5]},{4:27,17:[1,3],19:[1,4],20:[1,5]},{6:[1,7],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[1,28]},{6:[1,7],7:[1,29],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16]},{5:[2,3],6:[2,3],7:[2,3],8:[2,3],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,3]},{5:[2,4],6:[2,4],7:[2,4],8:[2,4],9:[2,4],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,4]},{5:[2,5],6:[2,5],7:[2,5],8:[2,5],9:[2,5],10:[2,5],11:[2,5],12:[2,5],13:[2,5],14:[2,5],15:[2,5],16:[1,16],18:[2,5]},{5:[2,6],6:[2,6],7:[2,6],8:[2,6],9:[2,6],10:[2,6],11:[2,6],12:[2,6],13:[2,6],14:[2,6],15:[2,6],16:[1,16],18:[2,6]},{5:[2,7],6:[2,7],7:[2,7],8:[2,7],9:[2,7],10:[2,7],11:[2,7],12:[2,7],13:[2,7],14:[2,7],15:[2,7],16:[1,16],18:[2,7]},{5:[2,8],6:[2,8],7:[2,8],8:[2,8],9:[2,8],10:[2,8],11:[2,8],12:[2,8],13:[2,8],14:[2,8],15:[2,8],16:[1,16],18:[2,8]},{5:[2,9],6:[2,9],7:[2,9],8:[2,9],9:[2,9],10:[2,9],11:[2,9],12:[2,9],13:[2,9],14:[2,9],15:[2,9],16:[1,16],18:[2,9]},{5:[2,10],6:[2,10],7:[2,10],8:[2,10],9:[2,10],10:[2,10],11:[2,10],12:[2,10],13:[2,10],14:[2,10],15:[2,10],16:[1,16],18:[2,10]},{5:[2,11],6:[2,11],7:[2,11],8:[2,11],9:[2,11],10:[2,11],11:[2,11],12:[2,11],13:[2,11],14:[2,11],15:[2,11],16:[2,11],18:[2,11]},{5:[2,12],6:[2,12],7:[2,12],8:[2,12],9:[2,12],10:[2,12],11:[2,12],12:[2,12],13:[2,12],14:[2,12],15:[2,12],16:[2,12],18:[2,12]},{4:30,17:[1,3],19:[1,4],20:[1,5]},{5:[2,2],6:[1,7],7:[2,2],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,2]}],defaultActions:{6:[2,1]},parseError:function(e,t){throw new Error(e)},parse:function(e){var t=this,n=[0],s=[null],i=[],r=this.table,o="",a=0,c=0,l=0;this.lexer.setInput(e),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,void 0===this.lexer.yylloc&&(this.lexer.yylloc={});var d=this.lexer.yylloc;function u(){var e;return"number"!=typeof(e=t.lexer.lex()||1)&&(e=t.symbols_[e]||e),e}i.push(d),"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var h,m,f,g,p,v,y,_,b,w,S={};;){if(f=n[n.length-1],this.defaultActions[f]?g=this.defaultActions[f]:(null==h&&(h=u()),g=r[f]&&r[f][h]),void 0===g||!g.length||!g[0]){if(!l){for(v in b=[],r[f])this.terminals_[v]&&v>2&&b.push("'"+this.terminals_[v]+"'");var x="";x=this.lexer.showPosition?"Parse error on line "+(a+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+b.join(", ")+", got '"+this.terminals_[h]+"'":"Parse error on line "+(a+1)+": Unexpected "+(1==h?"end of input":"'"+(this.terminals_[h]||h)+"'"),this.parseError(x,{text:this.lexer.match,token:this.terminals_[h]||h,line:this.lexer.yylineno,loc:d,expected:b})}if(3==l){if(1==h)throw new Error(x||"Parsing halted.");c=this.lexer.yyleng,o=this.lexer.yytext,a=this.lexer.yylineno,d=this.lexer.yylloc,h=u()}for(;!(2..toString()in r[f]);){if(0==f)throw new Error(x||"Parsing halted.");w=1,n.length=n.length-2*w,s.length=s.length-w,i.length=i.length-w,f=n[n.length-1]}m=h,h=2,g=r[f=n[n.length-1]]&&r[f][2],l=3}if(g[0]instanceof Array&&g.length>1)throw new Error("Parse Error: multiple actions possible at state: "+f+", token: "+h);switch(g[0]){case 1:n.push(h),s.push(this.lexer.yytext),i.push(this.lexer.yylloc),n.push(g[1]),h=null,m?(h=m,m=null):(c=this.lexer.yyleng,o=this.lexer.yytext,a=this.lexer.yylineno,d=this.lexer.yylloc,l>0&&l--);break;case 2:if(y=this.productions_[g[1]][1],S.$=s[s.length-y],S._$={first_line:i[i.length-(y||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(y||1)].first_column,last_column:i[i.length-1].last_column},void 0!==(p=this.performAction.call(S,o,c,a,this.yy,g[1],s,i)))return p;y&&(n=n.slice(0,-1*y*2),s=s.slice(0,-1*y),i=i.slice(0,-1*y)),n.push(this.productions_[g[1]][0]),s.push(S.$),i.push(S._$),_=r[n[n.length-2]][n[n.length-1]],n.push(_);break;case 3:return!0}}return!0}},g=function(){var e={EOF:1,parseError:function(e,t){if(!this.yy.parseError)throw new Error(e);this.yy.parseError(e,t)},setInput:function(e){return this._input=e,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this},input:function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.match+=e,this.matched+=e,e.match(/\n/)&&this.yylineno++,this._input=this._input.slice(1),e},unput:function(e){return this._input=e+this._input,this},more:function(){return this._more=!0,this},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=new Array(e.length+1).join("-");return e+this.upcomingInput()+"\n"+t+"^"},next:function(){if(this.done)return this.EOF;var e,t;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var n=this._currentRules(),s=0;s<n.length;s++)if(e=this._input.match(this.rules[n[s]]))return(t=e[0].match(/\n.*/g))&&(this.yylineno+=t.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:t?t[t.length-1].length-1:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this._more=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],this.performAction.call(this,this.yy,this,n[s],this.conditionStack[this.conditionStack.length-1])||void 0;if(""===this._input)return this.EOF;this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var e=this.next();return void 0!==e?e:this.lex()},begin:function(e){this.conditionStack.push(e)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(e){this.begin(e)},performAction:function(e,t,n,s){switch(n){case 0:break;case 1:return 20;case 2:return 19;case 3:return 8;case 4:return 9;case 5:return 6;case 6:return 7;case 7:return 11;case 8:return 13;case 9:return 10;case 10:return 12;case 11:return 14;case 12:return 15;case 13:return 16;case 14:return 17;case 15:return 18;case 16:return 5;case 17:return"INVALID"}},rules:[/^\s+/,/^[0-9]+(\.[0-9]+)?\b/,/^n\b/,/^\|\|/,/^&&/,/^\?/,/^:/,/^<=/,/^>=/,/^</,/^>/,/^!=/,/^==/,/^%/,/^\(/,/^\)/,/^$/,/^./],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],inclusive:!0}}};return e}(),f.lexer=g,f),e.exports&&(t=e.exports=u),t.Jed=u}()},9588:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.loop=t.conditional=t.parse=void 0;t.parse=function e(t,n){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s;if(Array.isArray(n))n.forEach((function(n){return e(t,n,s,i)}));else if("function"==typeof n)n(t,s,i,e);else{var r=Object.keys(n)[0];Array.isArray(n[r])?(i[r]={},e(t,n[r],s,i[r])):i[r]=n[r](t,s,i,e)}return s};t.conditional=function(e,t){return function(n,s,i,r){t(n,s,i)&&r(n,e,s,i)}};t.loop=function(e,t){return function(n,s,i,r){for(var o=[],a=n.pos;t(n,s,i);){var c={};if(r(n,e,s,c),n.pos===a)break;a=n.pos,o.push(c)}return o}}},7656:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.readBits=t.readArray=t.readUnsigned=t.readString=t.peekBytes=t.readBytes=t.peekByte=t.readByte=t.buildStream=void 0;t.buildStream=function(e){return{data:e,pos:0}};var n=function(){return function(e){return e.data[e.pos++]}};t.readByte=n;t.peekByte=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return function(t){return t.data[t.pos+e]}};var s=function(e){return function(t){return t.data.subarray(t.pos,t.pos+=e)}};t.readBytes=s;t.peekBytes=function(e){return function(t){return t.data.subarray(t.pos,t.pos+e)}};t.readString=function(e){return function(t){return Array.from(s(e)(t)).map((function(e){return String.fromCharCode(e)})).join("")}};t.readUnsigned=function(e){return function(t){var n=s(2)(t);return e?(n[1]<<8)+n[0]:(n[0]<<8)+n[1]}};t.readArray=function(e,t){return function(n,i,r){for(var o="function"==typeof t?t(n,i,r):t,a=s(e),c=new Array(o),l=0;l<o;l++)c[l]=a(n);return c}};t.readBits=function(e){return function(t){for(var n=function(e){return e.data[e.pos++]}(t),s=new Array(8),i=0;i<8;i++)s[7-i]=!!(n&1<<i);return Object.keys(e).reduce((function(t,n){var i=e[n];return i.length?t[n]=function(e,t,n){for(var s=0,i=0;i<n;i++)s+=e[t+i]&&Math.pow(2,n-i-1);return s}(s,i.index,i.length):t[n]=s[i.index],t}),{})}}},4609:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var s=n(9588),i=n(7656),r={blocks:function(e){for(var t=[],n=e.data.length,s=0,r=(0,i.readByte)()(e);0!==r&&r;r=(0,i.readByte)()(e)){if(e.pos+r>=n){var o=n-e.pos;t.push((0,i.readBytes)(o)(e)),s+=o;break}t.push((0,i.readBytes)(r)(e)),s+=r}for(var a=new Uint8Array(s),c=0,l=0;l<t.length;l++)a.set(t[l],c),c+=t[l].length;return a}},o=(0,s.conditional)({gce:[{codes:(0,i.readBytes)(2)},{byteSize:(0,i.readByte)()},{extras:(0,i.readBits)({future:{index:0,length:3},disposal:{index:3,length:3},userInput:{index:6},transparentColorGiven:{index:7}})},{delay:(0,i.readUnsigned)(!0)},{transparentColorIndex:(0,i.readByte)()},{terminator:(0,i.readByte)()}]},(function(e){var t=(0,i.peekBytes)(2)(e);return 33===t[0]&&249===t[1]})),a=(0,s.conditional)({image:[{code:(0,i.readByte)()},{descriptor:[{left:(0,i.readUnsigned)(!0)},{top:(0,i.readUnsigned)(!0)},{width:(0,i.readUnsigned)(!0)},{height:(0,i.readUnsigned)(!0)},{lct:(0,i.readBits)({exists:{index:0},interlaced:{index:1},sort:{index:2},future:{index:3,length:2},size:{index:5,length:3}})}]},(0,s.conditional)({lct:(0,i.readArray)(3,(function(e,t,n){return Math.pow(2,n.descriptor.lct.size+1)}))},(function(e,t,n){return n.descriptor.lct.exists})),{data:[{minCodeSize:(0,i.readByte)()},r]}]},(function(e){return 44===(0,i.peekByte)()(e)})),c=(0,s.conditional)({text:[{codes:(0,i.readBytes)(2)},{blockSize:(0,i.readByte)()},{preData:function(e,t,n){return(0,i.readBytes)(n.text.blockSize)(e)}},r]},(function(e){var t=(0,i.peekBytes)(2)(e);return 33===t[0]&&1===t[1]})),l=(0,s.conditional)({application:[{codes:(0,i.readBytes)(2)},{blockSize:(0,i.readByte)()},{id:function(e,t,n){return(0,i.readString)(n.blockSize)(e)}},r]},(function(e){var t=(0,i.peekBytes)(2)(e);return 33===t[0]&&255===t[1]})),d=(0,s.conditional)({comment:[{codes:(0,i.readBytes)(2)},r]},(function(e){var t=(0,i.peekBytes)(2)(e);return 33===t[0]&&254===t[1]})),u=[{header:[{signature:(0,i.readString)(3)},{version:(0,i.readString)(3)}]},{lsd:[{width:(0,i.readUnsigned)(!0)},{height:(0,i.readUnsigned)(!0)},{gct:(0,i.readBits)({exists:{index:0},resolution:{index:1,length:3},sort:{index:4},size:{index:5,length:3}})},{backgroundColorIndex:(0,i.readByte)()},{pixelAspectRatio:(0,i.readByte)()}]},(0,s.conditional)({gct:(0,i.readArray)(3,(function(e,t){return Math.pow(2,t.lsd.gct.size+1)}))},(function(e,t){return t.lsd.gct.exists})),{frames:(0,s.loop)([o,l,d,a,c],(function(e){var t=(0,i.peekByte)()(e);return 33===t||44===t}))}];t.default=u},3842:(e,t,n)=>{"use strict";var s=n(2579);function i(){}var r={},o=["REJECTED"],a=["FULFILLED"],c=["PENDING"];function l(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,e!==i&&m(this,e)}function d(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function u(e,t,n){s((function(){var s;try{s=t(n)}catch(t){return r.reject(e,t)}s===e?r.reject(e,new TypeError("Cannot resolve promise with itself")):r.resolve(e,s)}))}function h(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function m(e,t){var n=!1;function s(t){n||(n=!0,r.reject(e,t))}function i(t){n||(n=!0,r.resolve(e,t))}var o=f((function(){t(i,s)}));"error"===o.status&&s(o.value)}function f(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}e.exports=l,l.prototype.catch=function(e){return this.then(null,e)},l.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===o)return this;var n=new this.constructor(i);this.state!==c?u(n,this.state===a?e:t,this.outcome):this.queue.push(new d(n,e,t));return n},d.prototype.callFulfilled=function(e){r.resolve(this.promise,e)},d.prototype.otherCallFulfilled=function(e){u(this.promise,this.onFulfilled,e)},d.prototype.callRejected=function(e){r.reject(this.promise,e)},d.prototype.otherCallRejected=function(e){u(this.promise,this.onRejected,e)},r.resolve=function(e,t){var n=f(h,t);if("error"===n.status)return r.reject(e,n.value);var s=n.value;if(s)m(e,s);else{e.state=a,e.outcome=t;for(var i=-1,o=e.queue.length;++i<o;)e.queue[i].callFulfilled(t)}return e},r.reject=function(e,t){e.state=o,e.outcome=t;for(var n=-1,s=e.queue.length;++n<s;)e.queue[n].callRejected(t);return e},l.resolve=function(e){if(e instanceof this)return e;return r.resolve(new this(i),e)},l.reject=function(e){var t=new this(i);return r.reject(t,e)},l.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,s=!1;if(!n)return this.resolve([]);var o=new Array(n),a=0,c=-1,l=new this(i);for(;++c<n;)d(e[c],c);return l;function d(e,i){t.resolve(e).then((function(e){o[i]=e,++a!==n||s||(s=!0,r.resolve(l,o))}),(function(e){s||(s=!0,r.reject(l,e))}))}},l.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,s=!1;if(!n)return this.resolve([]);var o=-1,a=new this(i);for(;++o<n;)c=e[o],t.resolve(c).then((function(e){s||(s=!0,r.resolve(a,e))}),(function(e){s||(s=!0,r.reject(a,e))}));var c;return a}},3449:(e,t,n)=>{"use strict";"function"!=typeof n.g.Promise&&(n.g.Promise=n(3842))},8747:function(e,t){"undefined"!=typeof self&&self,function(e){"use strict";var t="localforage-driver-memory";function n(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}function s(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),s=0;s<e.length;s+=1)n.append(e[s]);return n.getBlob(t.type)}}var i=/^~~local_forage_type~([^~]+)~/,r=9,o=r+4,a=Object.prototype.toString;function c(e){var t=.75*e.length,n=e.length;"="===e[e.length-1]&&(t--,"="===e[e.length-2]&&t--);for(var s=new ArrayBuffer(t),i=new Uint8Array(s),r=0,o=0;r<n;r+=4){var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[r]),c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[r+1]),l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[r+2]),d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[r+3]);i[o++]=a<<2|c>>4,i[o++]=(15&c)<<4|l>>2,i[o++]=(3&l)<<6|63&d}return s}function l(e){for(var t=new Uint8Array(e),n="",s=0;s<t.length;s+=3)n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[t[s]>>2],n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(3&t[s])<<4|t[s+1]>>4],n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(15&t[s+1])<<2|t[s+2]>>6],n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[63&t[s+2]];return t.length%3==2?n=n.substring(0,n.length-1)+"=":t.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}function d(e,t){var n="";if(e&&(n=a.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===a.call(e.buffer))){var s=void 0,i="__lfsc__:";e instanceof ArrayBuffer?(s=e,i+="arbf"):(s=e.buffer,"[object Int8Array]"===n?i+="si08":"[object Uint8Array]"===n?i+="ui08":"[object Uint8ClampedArray]"===n?i+="uic8":"[object Int16Array]"===n?i+="si16":"[object Uint16Array]"===n?i+="ur16":"[object Int32Array]"===n?i+="si32":"[object Uint32Array]"===n?i+="ui32":"[object Float32Array]"===n?i+="fl32":"[object Float64Array]"===n?i+="fl64":t(new Error("Failed to get type for BinaryArray"))),t(i+l(s))}else if("[object Blob]"===n){var r=new FileReader;r.onload=function(){var n="~~local_forage_type~"+e.type+"~"+l(this.result);t("__lfsc__:blob"+n)},r.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}}function u(e){if("__lfsc__:"!==e.substring(0,r))return JSON.parse(e);var t,n=e.substring(o),a=e.substring(r,o);if("blob"===a&&i.test(n)){var l=n.match(i);t=l[1],n=n.substring(l[0].length)}var d=c(n);switch(a){case"arbf":return d;case"blob":return s([d],{type:t});case"si08":return new Int8Array(d);case"ui08":return new Uint8Array(d);case"uic8":return new Uint8ClampedArray(d);case"si16":return new Int16Array(d);case"ur16":return new Uint16Array(d);case"si32":return new Int32Array(d);case"ui32":return new Uint32Array(d);case"fl32":return new Float32Array(d);case"fl64":return new Float64Array(d);default:throw new Error("Unkown type: "+a)}}function h(e){var t,s;if(null===e||"object"!=typeof e||"isActiveClone"in e)return e;var i=e instanceof Date?new Date(e):e.constructor();try{for(var r=n(Object.keys(e)),o=r.next();!o.done;o=r.next()){var a=o.value;Object.prototype.hasOwnProperty.call(e,a)&&(e.isActiveClone=null,i[a]=h(e[a]),delete e.isActiveClone)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(s=r.return)&&s.call(r)}finally{if(t)throw t.error}}return i}function m(e,t){return(e.name||t.name)+"/"+(e.storeName||t.storeName)+"/"}function f(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function g(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}function p(e,t){var n=this;if(t=g.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var s=this.config();e.name=e.name||s.name,e.storeName=e.storeName||s.storeName}return{promise:e.name?new Promise((function(t){e.storeName?t(m(e,n._defaultConfig)):t(e.name+"/")})):Promise.reject("Invalid arguments"),callback:t}}function v(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}var y={bufferToString:l,deserialize:u,serialize:d,stringToBuffer:c},_={},b=function(){function e(e){this.kp=e,this.data={}}return e.resolve=function(t){return _[t]||(_[t]=new e(t)),_[t]},e.prototype.clear=function(){this.data={}},e.prototype.drop=function(){this.clear(),delete _[this.kp]},e.prototype.get=function(e){return this.data[e]},e.prototype.key=function(e){return this.keys()[e]},e.prototype.keys=function(){return Object.keys(this.data)},e.prototype.rm=function(e){delete this.data[e]},e.prototype.set=function(e,t){this.data[e]=t},e}();function w(e){var t=e?h(e):{},n=m(t,this._defaultConfig),s=b.resolve(n);return this._dbInfo=t,this._dbInfo.serializer=y,this._dbInfo.keyPrefix=n,this._dbInfo.mStore=s,Promise.resolve()}function S(e){var t=this,n=this.ready().then((function(){t._dbInfo.mStore.clear()}));return f(n,e),n}function x(e,t){var n=p.apply(this,arguments),s=n.promise,i=n.callback;return f(s.then((function(e){b.resolve(e).drop()})),i),s}function E(e,t){var n=this;e=v(e);var s=this.ready().then((function(){var t=n._dbInfo.mStore.get(e);return null==t?null:n._dbInfo.serializer.deserialize(t)}));return f(s,t),s}function A(e,t){var n=this,s=this.ready().then((function(){for(var t=n._dbInfo.mStore,s=t.keys(),i=0;i<s.length;i++){var r=t.get(s[i]);if(r&&(r=n._dbInfo.serializer.deserialize(r)),void 0!==(r=e(r,s[i],i+1)))return r}}));return f(s,t),s}function C(e,t){var n=this,s=this.ready().then((function(){var t;try{void 0===(t=n._dbInfo.mStore.key(e))&&(t=null)}catch(e){t=null}return t}));return f(s,t),s}function $(e){var t=this,n=this.ready().then((function(){return t._dbInfo.mStore.keys()}));return f(n,e),n}function k(e){var t=this.keys().then((function(e){return e.length}));return f(t,e),t}function j(e,t){var n=this;e=v(e);var s=this.ready().then((function(){n._dbInfo.mStore.rm(e)}));return f(s,t),s}function T(e,t,n){var s=this;e=v(e);var i=this.ready().then((function(){void 0===t&&(t=null);var n=t;return new Promise((function(i,r){s._dbInfo.serializer.serialize(t,(function(t,o){if(o)r(o);else try{s._dbInfo.mStore.set(e,t),i(n)}catch(e){r(e)}}))}))}));return f(i,n),i}var I=!0;e._support=I,e._driver=t,e._initStorage=w,e.clear=S,e.dropInstance=x,e.getItem=E,e.iterate=A,e.key=C,e.keys=$,e.length=k,e.removeItem=j,e.setItem=T,Object.defineProperty(e,"__esModule",{value:!0})}(t)},6883: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){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function i(e,t,n,s){function i(e,t){var n=e||t;return e&&"function"==typeof e||"string"!=typeof n||(e=function(e){return e[n]}),e}var r=[];if("[object Array]"===Object.prototype.toString.call(e)){t=i(t,"key"),n=i(n,"value");for(var o=0,a=e.length;o<a;o++){var c=e[o];r.push(s(t(c),n(c)))}}else for(var l in e)e.hasOwnProperty(l)&&r.push(s(l,e[l]));return r}function r(e,t,n,r){var o=this,a=o.ready().then((function(){return new Promise((function(s,r){var a,c=o._dbInfo,l=c.db.transaction(c.storeName,"readwrite"),d=l.objectStore(c.storeName);function u(e){var t=e.target||this;a=t.error||t.transaction.error,r(a)}l.oncomplete=function(){s(e)},l.onabort=l.onerror=function(e){r(a||e.target)},i(e,t,n,(function(e,t){null===t&&(t=void 0),d.put(t,e).onerror=u}))}))}));return s(a,r),a}function o(e,t,r,o){var a=this,c=new Promise((function(s,o){a.ready().then((function(){return n(a)})).then((function(n){var c=a._dbInfo;c.db.transaction((function(a){var l="INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",d=i(e,t,r,(function(e,t){return new Promise((function(s,i){n.serialize(t,(function(t,n){n?i(n):a.executeSql(l,[e,t],(function(){s()}),(function(e,t){i(t)}))}))}))}));Promise.all(d).then((function(){s(e)}),o)}),(function(e){o(e)}))})).catch(o)}));return s(c,o),c}function a(e,t,n,r){var o=this,a=i(e,t,n,(function(e,t){return o.setItem(e,t)})),c=Promise.all(a);return s(c,r),c}function c(e,t,n,s){var i=this,c=i.driver();return c===i.INDEXEDDB?r.call(i,e,t,n,s):c===i.WEBSQL?o.call(i,e,t,n,s):a.call(i,e,t,n,s)}function l(e){var t=Object.getPrototypeOf(e);t&&(t.setItems=c,t.setItems.indexedDB=function(){return r.apply(this,arguments)},t.setItems.websql=function(){return o.apply(this,arguments)},t.setItems.generic=function(){return a.apply(this,arguments)})}var d=l(t="default"in t?t.default:t);e.setItemsGeneric=a,e.localforageSetItems=c,e.extendPrototype=l,e.extendPrototypeResult=d,Object.defineProperty(e,"__esModule",{value:!0})}(t,n(5513))},2734:(e,t,n)=>{"use strict";var s=n(8135);Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var n=(0,a.getStorage)(),s=!(!n||!n[t]),c=s?n[t]:{clear:function(){},get:function(){},remove:function(){},set:function(){}},l=c.clear.bind(c),d=c.get.bind(c),u=c.remove.bind(c),h=c.set.bind(c);return{_driver:e,_support:s,_initStorage:function(){return Promise.resolve()},clear:function(e){return(0,o.default)(i.default.mark((function t(){return i.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:l(),e&&e();case 2:case"end":return t.stop()}}),t)})))()},iterate:function(e,t){return(0,o.default)(i.default.mark((function n(){var s;return i.default.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,(0,a.usePromise)(d,null);case 2:s=n.sent,Object.keys(s).forEach((function(t,n){return e(s[t],t,n)})),t&&t();case 6:case"end":return n.stop()}}),n)})))()},getItem:function(e,t){return(0,o.default)(i.default.mark((function n(){var s;return i.default.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,(0,a.usePromise)(d,e);case 3:return s=n.sent,s=void 0===(s="string"==typeof e?s[e]:s)?null:s,t&&t(null,s),n.abrupt("return",s);case 10:throw n.prev=10,n.t0=n.catch(0),t&&t(n.t0),n.t0;case 14:case"end":return n.stop()}}),n,null,[[0,10]])})))()},key:function(e,t){return(0,o.default)(i.default.mark((function n(){var s,r;return i.default.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,(0,a.usePromise)(d,null);case 2:return s=n.sent,r=Object.keys(s)[e],t&&t(r),n.abrupt("return",r);case 6:case"end":return n.stop()}}),n)})))()},keys:function(e){return(0,o.default)(i.default.mark((function t(){var n,s;return i.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,a.usePromise)(d,null);case 2:return n=t.sent,s=Object.keys(n),e&&e(s),t.abrupt("return",s);case 6:case"end":return t.stop()}}),t)})))()},length:function(e){return(0,o.default)(i.default.mark((function t(){var n,s,r;return i.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,a.usePromise)(d,null);case 2:return n=t.sent,s=Object.keys(n),r=s.length,e&&e(r),t.abrupt("return",r);case 6:case"end":return t.stop()}}),t)})))()},removeItem:function(e,t){return(0,o.default)(i.default.mark((function n(){return i.default.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,(0,a.usePromise)(u,e);case 2:t&&t();case 3:case"end":return n.stop()}}),n)})))()},setItem:function(e,t,n){return(0,o.default)(i.default.mark((function s(){return i.default.wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return s.next=2,(0,a.usePromise)(h,(0,r.default)({},e,t));case 2:n&&n();case 3:case"end":return s.stop()}}),s)})))()}}};var i=s(n(1117)),r=s(n(1514)),o=s(n(9563)),a=n(8413)},5914:(e,t,n)=>{"use strict";var s=n(8135);t.Z=void 0;var i=(0,s(n(2734)).default)("webExtensionLocalStorage","local");t.Z=i},5848:(e,t,n)=>{"use strict";var s=n(8135);t.Z=void 0;var i=(0,s(n(2734)).default)("webExtensionSyncStorage","sync");t.Z=i},8413:(e,t)=>{"use strict";function n(){return"undefined"!=typeof browser&&browser.storage||"undefined"!=typeof chrome&&chrome.storage}Object.defineProperty(t,"__esModule",{value:!0}),t.getStorage=n,t.usePromise=function(e,t){if(function(){var e=n();try{return e&&e.local.get&&e.local.get()&&"function"==typeof e.local.get().then}catch(e){return!1}}())return e(t);return new Promise((function(n){e(t,(function(){n.apply(void 0,arguments)}))}))}},5513:(e,t,n)=>{e.exports=function e(t,n,s){function i(o,a){if(!n[o]){if(!t[o]){if(r)return r(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[o]={exports:{}};t[o][0].call(l.exports,(function(e){var n=t[o][1][e];return i(n||e)}),l,l.exports,e,t,n,s)}return n[o].exports}for(var r=void 0,o=0;o<s.length;o++)i(s[o]);return i}({1:[function(e,t,s){(function(e){"use strict";var n,s,i=e.MutationObserver||e.WebKitMutationObserver;if(i){var r=0,o=new i(d),a=e.document.createTextNode("");o.observe(a,{characterData:!0}),n=function(){a.data=r=++r%2}}else if(e.setImmediate||void 0===e.MessageChannel)n="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){d(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(d,0)};else{var c=new e.MessageChannel;c.port1.onmessage=d,n=function(){c.port2.postMessage(0)}}var l=[];function d(){var e,t;s=!0;for(var n=l.length;n;){for(t=l,l=[],e=-1;++e<n;)t[e]();n=l.length}s=!1}function u(e){1!==l.push(e)||s||n()}t.exports=u}).call(this,void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){"use strict";var s=e(1);function i(){}var r={},o=["REJECTED"],a=["FULFILLED"],c=["PENDING"];function l(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,e!==i&&m(this,e)}function d(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function u(e,t,n){s((function(){var s;try{s=t(n)}catch(t){return r.reject(e,t)}s===e?r.reject(e,new TypeError("Cannot resolve promise with itself")):r.resolve(e,s)}))}function h(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function m(e,t){var n=!1;function s(t){n||(n=!0,r.reject(e,t))}function i(t){n||(n=!0,r.resolve(e,t))}function o(){t(i,s)}var a=f(o);"error"===a.status&&s(a.value)}function f(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}function g(e){return e instanceof this?e:r.resolve(new this(i),e)}function p(e){var t=new this(i);return r.reject(t,e)}function v(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,s=!1;if(!n)return this.resolve([]);for(var o=new Array(n),a=0,c=-1,l=new this(i);++c<n;)d(e[c],c);return l;function d(e,i){function c(e){o[i]=e,++a!==n||s||(s=!0,r.resolve(l,o))}t.resolve(e).then(c,(function(e){s||(s=!0,r.reject(l,e))}))}}function y(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,s=!1;if(!n)return this.resolve([]);for(var o=-1,a=new this(i);++o<n;)c(e[o]);return a;function c(e){t.resolve(e).then((function(e){s||(s=!0,r.resolve(a,e))}),(function(e){s||(s=!0,r.reject(a,e))}))}}t.exports=l,l.prototype.catch=function(e){return this.then(null,e)},l.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===o)return this;var n=new this.constructor(i);return this.state!==c?u(n,this.state===a?e:t,this.outcome):this.queue.push(new d(n,e,t)),n},d.prototype.callFulfilled=function(e){r.resolve(this.promise,e)},d.prototype.otherCallFulfilled=function(e){u(this.promise,this.onFulfilled,e)},d.prototype.callRejected=function(e){r.reject(this.promise,e)},d.prototype.otherCallRejected=function(e){u(this.promise,this.onRejected,e)},r.resolve=function(e,t){var n=f(h,t);if("error"===n.status)return r.reject(e,n.value);var s=n.value;if(s)m(e,s);else{e.state=a,e.outcome=t;for(var i=-1,o=e.queue.length;++i<o;)e.queue[i].callFulfilled(t)}return e},r.reject=function(e,t){e.state=o,e.outcome=t;for(var n=-1,s=e.queue.length;++n<s;)e.queue[n].callRejected(t);return e},l.resolve=g,l.reject=p,l.all=v,l.race=y},{1:1}],3:[function(e,t,s){(function(t){"use strict";"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,n){"use strict";var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}var o=r();function a(){try{if(!o||!o.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}function c(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),s=0;s<e.length;s+=1)n.append(e[s]);return n.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var l=Promise;function d(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function u(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)}function h(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function m(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var f="local-forage-detect-blob-support",g=void 0,p={},v=Object.prototype.toString,y="readonly",_="readwrite";function b(e){for(var t=e.length,n=new ArrayBuffer(t),s=new Uint8Array(n),i=0;i<t;i++)s[i]=e.charCodeAt(i);return n}function w(e){return new l((function(t){var n=e.transaction(f,_),s=c([""]);n.objectStore(f).put(s,"key"),n.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},n.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//);t(n||!e||parseInt(e[1],10)>=43)}})).catch((function(){return!1}))}function S(e){return"boolean"==typeof g?l.resolve(g):w(e).then((function(e){return g=e}))}function x(e){var t=p[e.name],n={};n.promise=new l((function(e,t){n.resolve=e,n.reject=t})),t.deferredOperations.push(n),t.dbReady?t.dbReady=t.dbReady.then((function(){return n.promise})):t.dbReady=n.promise}function E(e){var t=p[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function A(e,t){var n=p[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function C(e,t){return new l((function(n,s){if(p[e.name]=p[e.name]||D(),e.db){if(!t)return n(e.db);x(e),e.db.close()}var i=[e.name];t&&i.push(e.version);var r=o.open.apply(o,i);t&&(r.onupgradeneeded=function(t){var n=r.result;try{n.createObjectStore(e.storeName),t.oldVersion<=1&&n.createObjectStore(f)}catch(n){if("ConstraintError"!==n.name)throw n;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),r.onerror=function(e){e.preventDefault(),s(r.error)},r.onsuccess=function(){var t=r.result;t.onversionchange=function(e){e.target.close()},n(t),E(e)}}))}function $(e){return C(e,!1)}function k(e){return C(e,!0)}function j(e,t){if(!e.db)return!0;var n=!e.db.objectStoreNames.contains(e.storeName),s=e.version<e.db.version,i=e.version>e.db.version;if(s&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),i||n){if(n){var r=e.db.version+1;r>e.version&&(e.version=r)}return!0}return!1}function T(e){return new l((function(t,n){var s=new FileReader;s.onerror=n,s.onloadend=function(n){var s=btoa(n.target.result||"");t({__local_forage_encoded_blob:!0,data:s,type:e.type})},s.readAsBinaryString(e)}))}function I(e){return c([b(atob(e.data))],{type:e.type})}function N(e){return e&&e.__local_forage_encoded_blob}function O(e){var t=this,n=t._initReady().then((function(){var e=p[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return u(n,e,e),n}function M(e){x(e);for(var t=p[e.name],n=t.forages,s=0;s<n.length;s++){var i=n[s];i._dbInfo.db&&(i._dbInfo.db.close(),i._dbInfo.db=null)}return e.db=null,$(e).then((function(t){return e.db=t,j(e)?k(e):t})).then((function(s){e.db=t.db=s;for(var i=0;i<n.length;i++)n[i]._dbInfo.db=s})).catch((function(t){throw A(e,t),t}))}function R(e,t,n,s){void 0===s&&(s=1);try{var i=e.db.transaction(e.storeName,t);n(null,i)}catch(i){if(s>0&&(!e.db||"InvalidStateError"===i.name||"NotFoundError"===i.name))return l.resolve().then((function(){if(!e.db||"NotFoundError"===i.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),k(e)})).then((function(){return M(e).then((function(){R(e,t,n,s-1)}))})).catch(n);n(i)}}function D(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function z(e){var t=this,n={db:null};if(e)for(var s in e)n[s]=e[s];var i=p[n.name];i||(i=D(),p[n.name]=i),i.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=O);var r=[];function o(){return l.resolve()}for(var a=0;a<i.forages.length;a++){var c=i.forages[a];c!==t&&r.push(c._initReady().catch(o))}var d=i.forages.slice(0);return l.all(r).then((function(){return n.db=i.db,$(n)})).then((function(e){return n.db=e,j(n,t._defaultConfig.version)?k(n):e})).then((function(e){n.db=i.db=e,t._dbInfo=n;for(var s=0;s<d.length;s++){var r=d[s];r!==t&&(r._dbInfo.db=n.db,r._dbInfo.version=n.version)}}))}function L(e,t){var n=this;e=h(e);var s=new l((function(t,s){n.ready().then((function(){R(n._dbInfo,y,(function(i,r){if(i)return s(i);try{var o=r.objectStore(n._dbInfo.storeName).get(e);o.onsuccess=function(){var e=o.result;void 0===e&&(e=null),N(e)&&(e=I(e)),t(e)},o.onerror=function(){s(o.error)}}catch(e){s(e)}}))})).catch(s)}));return d(s,t),s}function P(e,t){var n=this,s=new l((function(t,s){n.ready().then((function(){R(n._dbInfo,y,(function(i,r){if(i)return s(i);try{var o=r.objectStore(n._dbInfo.storeName).openCursor(),a=1;o.onsuccess=function(){var n=o.result;if(n){var s=n.value;N(s)&&(s=I(s));var i=e(s,n.key,a++);void 0!==i?t(i):n.continue()}else t()},o.onerror=function(){s(o.error)}}catch(e){s(e)}}))})).catch(s)}));return d(s,t),s}function F(e,t,n){var s=this;e=h(e);var i=new l((function(n,i){var r;s.ready().then((function(){return r=s._dbInfo,"[object Blob]"===v.call(t)?S(r.db).then((function(e){return e?t:T(t)})):t})).then((function(t){R(s._dbInfo,_,(function(r,o){if(r)return i(r);try{var a=o.objectStore(s._dbInfo.storeName);null===t&&(t=void 0);var c=a.put(t,e);o.oncomplete=function(){void 0===t&&(t=null),n(t)},o.onabort=o.onerror=function(){var e=c.error?c.error:c.transaction.error;i(e)}}catch(e){i(e)}}))})).catch(i)}));return d(i,n),i}function U(e,t){var n=this;e=h(e);var s=new l((function(t,s){n.ready().then((function(){R(n._dbInfo,_,(function(i,r){if(i)return s(i);try{var o=r.objectStore(n._dbInfo.storeName).delete(e);r.oncomplete=function(){t()},r.onerror=function(){s(o.error)},r.onabort=function(){var e=o.error?o.error:o.transaction.error;s(e)}}catch(e){s(e)}}))})).catch(s)}));return d(s,t),s}function B(e){var t=this,n=new l((function(e,n){t.ready().then((function(){R(t._dbInfo,_,(function(s,i){if(s)return n(s);try{var r=i.objectStore(t._dbInfo.storeName).clear();i.oncomplete=function(){e()},i.onabort=i.onerror=function(){var e=r.error?r.error:r.transaction.error;n(e)}}catch(e){n(e)}}))})).catch(n)}));return d(n,e),n}function q(e){var t=this,n=new l((function(e,n){t.ready().then((function(){R(t._dbInfo,y,(function(s,i){if(s)return n(s);try{var r=i.objectStore(t._dbInfo.storeName).count();r.onsuccess=function(){e(r.result)},r.onerror=function(){n(r.error)}}catch(e){n(e)}}))})).catch(n)}));return d(n,e),n}function H(e,t){var n=this,s=new l((function(t,s){e<0?t(null):n.ready().then((function(){R(n._dbInfo,y,(function(i,r){if(i)return s(i);try{var o=r.objectStore(n._dbInfo.storeName),a=!1,c=o.openKeyCursor();c.onsuccess=function(){var n=c.result;n?0===e||a?t(n.key):(a=!0,n.advance(e)):t(null)},c.onerror=function(){s(c.error)}}catch(e){s(e)}}))})).catch(s)}));return d(s,t),s}function G(e){var t=this,n=new l((function(e,n){t.ready().then((function(){R(t._dbInfo,y,(function(s,i){if(s)return n(s);try{var r=i.objectStore(t._dbInfo.storeName).openKeyCursor(),o=[];r.onsuccess=function(){var t=r.result;t?(o.push(t.key),t.continue()):e(o)},r.onerror=function(){n(r.error)}}catch(e){n(e)}}))})).catch(n)}));return d(n,e),n}function W(e,t){t=m.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var s,i=this;if(e.name){var r=e.name===n.name&&i._dbInfo.db?l.resolve(i._dbInfo.db):$(e).then((function(t){var n=p[e.name],s=n.forages;n.db=t;for(var i=0;i<s.length;i++)s[i]._dbInfo.db=t;return t}));s=e.storeName?r.then((function(t){if(t.objectStoreNames.contains(e.storeName)){var n=t.version+1;x(e);var s=p[e.name],i=s.forages;t.close();for(var r=0;r<i.length;r++){var a=i[r];a._dbInfo.db=null,a._dbInfo.version=n}var c=new l((function(t,s){var i=o.open(e.name,n);i.onerror=function(e){i.result.close(),s(e)},i.onupgradeneeded=function(){i.result.deleteObjectStore(e.storeName)},i.onsuccess=function(){var e=i.result;e.close(),t(e)}}));return c.then((function(e){s.db=e;for(var t=0;t<i.length;t++){var n=i[t];n._dbInfo.db=e,E(n._dbInfo)}})).catch((function(t){throw(A(e,t)||l.resolve()).catch((function(){})),t}))}})):r.then((function(t){x(e);var n=p[e.name],s=n.forages;t.close();for(var i=0;i<s.length;i++)s[i]._dbInfo.db=null;var r=new l((function(t,n){var s=o.deleteDatabase(e.name);s.onerror=function(){var e=s.result;e&&e.close(),n(s.error)},s.onblocked=function(){console.warn('dropInstance blocked for database "'+e.name+'" until all open connections are closed')},s.onsuccess=function(){var e=s.result;e&&e.close(),t(e)}}));return r.then((function(e){n.db=e;for(var t=0;t<s.length;t++)E(s[t]._dbInfo)})).catch((function(t){throw(A(e,t)||l.resolve()).catch((function(){})),t}))}))}else s=l.reject("Invalid arguments");return d(s,t),s}var V={_driver:"asyncStorage",_initStorage:z,_support:a(),iterate:P,getItem:L,setItem:F,removeItem:U,clear:B,length:q,key:H,keys:G,dropInstance:W};function J(){return"function"==typeof openDatabase}var Z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Q="~~local_forage_type~",K=/^~~local_forage_type~([^~]+)~/,Y="__lfsc__:",X=Y.length,ee="arbf",te="blob",ne="si08",se="ui08",ie="uic8",re="si16",oe="si32",ae="ur16",ce="ui32",le="fl32",de="fl64",ue=X+ee.length,he=Object.prototype.toString;function me(e){var t,n,s,i,r,o=.75*e.length,a=e.length,c=0;"="===e[e.length-1]&&(o--,"="===e[e.length-2]&&o--);var l=new ArrayBuffer(o),d=new Uint8Array(l);for(t=0;t<a;t+=4)n=Z.indexOf(e[t]),s=Z.indexOf(e[t+1]),i=Z.indexOf(e[t+2]),r=Z.indexOf(e[t+3]),d[c++]=n<<2|s>>4,d[c++]=(15&s)<<4|i>>2,d[c++]=(3&i)<<6|63&r;return l}function fe(e){var t,n=new Uint8Array(e),s="";for(t=0;t<n.length;t+=3)s+=Z[n[t]>>2],s+=Z[(3&n[t])<<4|n[t+1]>>4],s+=Z[(15&n[t+1])<<2|n[t+2]>>6],s+=Z[63&n[t+2]];return n.length%3==2?s=s.substring(0,s.length-1)+"=":n.length%3==1&&(s=s.substring(0,s.length-2)+"=="),s}function ge(e,t){var n="";if(e&&(n=he.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===he.call(e.buffer))){var s,i=Y;e instanceof ArrayBuffer?(s=e,i+=ee):(s=e.buffer,"[object Int8Array]"===n?i+=ne:"[object Uint8Array]"===n?i+=se:"[object Uint8ClampedArray]"===n?i+=ie:"[object Int16Array]"===n?i+=re:"[object Uint16Array]"===n?i+=ae:"[object Int32Array]"===n?i+=oe:"[object Uint32Array]"===n?i+=ce:"[object Float32Array]"===n?i+=le:"[object Float64Array]"===n?i+=de:t(new Error("Failed to get type for BinaryArray"))),t(i+fe(s))}else if("[object Blob]"===n){var r=new FileReader;r.onload=function(){var n=Q+e.type+"~"+fe(this.result);t(Y+te+n)},r.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}}function pe(e){if(e.substring(0,X)!==Y)return JSON.parse(e);var t,n=e.substring(ue),s=e.substring(X,ue);if(s===te&&K.test(n)){var i=n.match(K);t=i[1],n=n.substring(i[0].length)}var r=me(n);switch(s){case ee:return r;case te:return c([r],{type:t});case ne:return new Int8Array(r);case se:return new Uint8Array(r);case ie:return new Uint8ClampedArray(r);case re:return new Int16Array(r);case ae:return new Uint16Array(r);case oe:return new Int32Array(r);case ce:return new Uint32Array(r);case le:return new Float32Array(r);case de:return new Float64Array(r);default:throw new Error("Unkown type: "+s)}}var ve={serialize:ge,deserialize:pe,stringToBuffer:me,bufferToString:fe};function ye(e,t,n,s){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,s)}function _e(e){var t=this,n={db:null};if(e)for(var s in e)n[s]="string"!=typeof e[s]?e[s].toString():e[s];var i=new l((function(e,s){try{n.db=openDatabase(n.name,String(n.version),n.description,n.size)}catch(e){return s(e)}n.db.transaction((function(i){ye(i,n,(function(){t._dbInfo=n,e()}),(function(e,t){s(t)}))}),s)}));return n.serializer=ve,i}function be(e,t,n,s,i,r){e.executeSql(n,s,i,(function(e,o){o.code===o.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,a){a.rows.length?r(e,o):ye(e,t,(function(){e.executeSql(n,s,i,r)}),r)}),r):r(e,o)}),r)}function we(e,t){var n=this;e=h(e);var s=new l((function(t,s){n.ready().then((function(){var i=n._dbInfo;i.db.transaction((function(n){be(n,i,"SELECT * FROM "+i.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,n){var s=n.rows.length?n.rows.item(0).value:null;s&&(s=i.serializer.deserialize(s)),t(s)}),(function(e,t){s(t)}))}))})).catch(s)}));return d(s,t),s}function Se(e,t){var n=this,s=new l((function(t,s){n.ready().then((function(){var i=n._dbInfo;i.db.transaction((function(n){be(n,i,"SELECT * FROM "+i.storeName,[],(function(n,s){for(var r=s.rows,o=r.length,a=0;a<o;a++){var c=r.item(a),l=c.value;if(l&&(l=i.serializer.deserialize(l)),void 0!==(l=e(l,c.key,a+1)))return void t(l)}t()}),(function(e,t){s(t)}))}))})).catch(s)}));return d(s,t),s}function xe(e,t,n,s){var i=this;e=h(e);var r=new l((function(r,o){i.ready().then((function(){void 0===t&&(t=null);var a=t,c=i._dbInfo;c.serializer.serialize(t,(function(t,l){l?o(l):c.db.transaction((function(n){be(n,c,"INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){r(a)}),(function(e,t){o(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(s>0)return void r(xe.apply(i,[e,a,n,s-1]));o(t)}}))}))})).catch(o)}));return d(r,n),r}function Ee(e,t,n){return xe.apply(this,[e,t,n,1])}function Ae(e,t){var n=this;e=h(e);var s=new l((function(t,s){n.ready().then((function(){var i=n._dbInfo;i.db.transaction((function(n){be(n,i,"DELETE FROM "+i.storeName+" WHERE key = ?",[e],(function(){t()}),(function(e,t){s(t)}))}))})).catch(s)}));return d(s,t),s}function Ce(e){var t=this,n=new l((function(e,n){t.ready().then((function(){var s=t._dbInfo;s.db.transaction((function(t){be(t,s,"DELETE FROM "+s.storeName,[],(function(){e()}),(function(e,t){n(t)}))}))})).catch(n)}));return d(n,e),n}function $e(e){var t=this,n=new l((function(e,n){t.ready().then((function(){var s=t._dbInfo;s.db.transaction((function(t){be(t,s,"SELECT COUNT(key) as c FROM "+s.storeName,[],(function(t,n){var s=n.rows.item(0).c;e(s)}),(function(e,t){n(t)}))}))})).catch(n)}));return d(n,e),n}function ke(e,t){var n=this,s=new l((function(t,s){n.ready().then((function(){var i=n._dbInfo;i.db.transaction((function(n){be(n,i,"SELECT key FROM "+i.storeName+" WHERE id = ? LIMIT 1",[e+1],(function(e,n){var s=n.rows.length?n.rows.item(0).key:null;t(s)}),(function(e,t){s(t)}))}))})).catch(s)}));return d(s,t),s}function je(e){var t=this,n=new l((function(e,n){t.ready().then((function(){var s=t._dbInfo;s.db.transaction((function(t){be(t,s,"SELECT key FROM "+s.storeName,[],(function(t,n){for(var s=[],i=0;i<n.rows.length;i++)s.push(n.rows.item(i).key);e(s)}),(function(e,t){n(t)}))}))})).catch(n)}));return d(n,e),n}function Te(e){return new l((function(t,n){e.transaction((function(s){s.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(n,s){for(var i=[],r=0;r<s.rows.length;r++)i.push(s.rows.item(r).name);t({db:e,storeNames:i})}),(function(e,t){n(t)}))}),(function(e){n(e)}))}))}function Ie(e,t){t=m.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var s,i=this;return d(s=e.name?new l((function(t){var s;s=e.name===n.name?i._dbInfo.db:openDatabase(e.name,"","",0),e.storeName?t({db:s,storeNames:[e.storeName]}):t(Te(s))})).then((function(e){return new l((function(t,n){e.db.transaction((function(s){function i(e){return new l((function(t,n){s.executeSql("DROP TABLE IF EXISTS "+e,[],(function(){t()}),(function(e,t){n(t)}))}))}for(var r=[],o=0,a=e.storeNames.length;o<a;o++)r.push(i(e.storeNames[o]));l.all(r).then((function(){t()})).catch((function(e){n(e)}))}),(function(e){n(e)}))}))})):l.reject("Invalid arguments"),t),s}var Ne={_driver:"webSQLStorage",_initStorage:_e,_support:J(),iterate:Se,getItem:we,setItem:Ee,removeItem:Ae,clear:Ce,length:$e,key:ke,keys:je,dropInstance:Ie};function Oe(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}function Me(e,t){var n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}function Re(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}function De(){return!Re()||localStorage.length>0}function ze(e){var t=this,n={};if(e)for(var s in e)n[s]=e[s];return n.keyPrefix=Me(e,t._defaultConfig),De()?(t._dbInfo=n,n.serializer=ve,l.resolve()):l.reject()}function Le(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,n=localStorage.length-1;n>=0;n--){var s=localStorage.key(n);0===s.indexOf(e)&&localStorage.removeItem(s)}}));return d(n,e),n}function Pe(e,t){var n=this;e=h(e);var s=n.ready().then((function(){var t=n._dbInfo,s=localStorage.getItem(t.keyPrefix+e);return s&&(s=t.serializer.deserialize(s)),s}));return d(s,t),s}function Fe(e,t){var n=this,s=n.ready().then((function(){for(var t=n._dbInfo,s=t.keyPrefix,i=s.length,r=localStorage.length,o=1,a=0;a<r;a++){var c=localStorage.key(a);if(0===c.indexOf(s)){var l=localStorage.getItem(c);if(l&&(l=t.serializer.deserialize(l)),void 0!==(l=e(l,c.substring(i),o++)))return l}}}));return d(s,t),s}function Ue(e,t){var n=this,s=n.ready().then((function(){var t,s=n._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(s.keyPrefix.length)),t}));return d(s,t),s}function Be(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo,n=localStorage.length,s=[],i=0;i<n;i++){var r=localStorage.key(i);0===r.indexOf(e.keyPrefix)&&s.push(r.substring(e.keyPrefix.length))}return s}));return d(n,e),n}function qe(e){var t=this.keys().then((function(e){return e.length}));return d(t,e),t}function He(e,t){var n=this;e=h(e);var s=n.ready().then((function(){var t=n._dbInfo;localStorage.removeItem(t.keyPrefix+e)}));return d(s,t),s}function Ge(e,t,n){var s=this;e=h(e);var i=s.ready().then((function(){void 0===t&&(t=null);var n=t;return new l((function(i,r){var o=s._dbInfo;o.serializer.serialize(t,(function(t,s){if(s)r(s);else try{localStorage.setItem(o.keyPrefix+e,t),i(n)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||r(e),r(e)}}))}))}));return d(i,n),i}function We(e,t){if(t=m.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config();e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}var s,i=this;return s=e.name?new l((function(t){e.storeName?t(Me(e,i._defaultConfig)):t(e.name+"/")})).then((function(e){for(var t=localStorage.length-1;t>=0;t--){var n=localStorage.key(t);0===n.indexOf(e)&&localStorage.removeItem(n)}})):l.reject("Invalid arguments"),d(s,t),s}var Ve={_driver:"localStorageWrapper",_initStorage:ze,_support:Oe(),iterate:Fe,getItem:Pe,setItem:Ge,removeItem:He,clear:Le,length:qe,key:Ue,keys:Be,dropInstance:We},Je=function(e,t){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)},Ze=function(e,t){for(var n=e.length,s=0;s<n;){if(Je(e[s],t))return!0;s++}return!1},Qe=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},Ke={},Ye={},Xe={INDEXEDDB:V,WEBSQL:Ne,LOCALSTORAGE:Ve},et=[Xe.INDEXEDDB._driver,Xe.WEBSQL._driver,Xe.LOCALSTORAGE._driver],tt=["dropInstance"],nt=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(tt),st={description:"",driver:et.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function it(e,t){e[t]=function(){var n=arguments;return e.ready().then((function(){return e[t].apply(e,n)}))}}function rt(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var n in t)t.hasOwnProperty(n)&&(Qe(t[n])?arguments[0][n]=t[n].slice():arguments[0][n]=t[n])}return arguments[0]}var ot=function(){function e(t){for(var n in i(this,e),Xe)if(Xe.hasOwnProperty(n)){var s=Xe[n],r=s._driver;this[n]=r,Ke[r]||this.defineDriver(s)}this._defaultConfig=rt({},st),this._config=rt({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((function(){}))}return e.prototype.config=function(e){if("object"===(void 0===e?"undefined":s(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,n){var s=new l((function(t,n){try{var s=e._driver,i=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void n(i);for(var r=nt.concat("_initStorage"),o=0,a=r.length;o<a;o++){var c=r[o];if((!Ze(tt,c)||e[c])&&"function"!=typeof e[c])return void n(i)}var u=function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),n=l.reject(t);return d(n,arguments[arguments.length-1]),n}},n=0,s=tt.length;n<s;n++){var i=tt[n];e[i]||(e[i]=t(i))}};u();var h=function(n){Ke[s]&&console.info("Redefining LocalForage driver: "+s),Ke[s]=e,Ye[s]=n,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(h,n):h(!!e._support):h(!0)}catch(e){n(e)}}));return u(s,t,n),s},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,n){var s=Ke[e]?l.resolve(Ke[e]):l.reject(new Error("Driver not found."));return u(s,t,n),s},e.prototype.getSerializer=function(e){var t=l.resolve(ve);return u(t,e),t},e.prototype.ready=function(e){var t=this,n=t._driverSet.then((function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}));return u(n,e,e),n},e.prototype.setDriver=function(e,t,n){var s=this;Qe(e)||(e=[e]);var i=this._getSupportedDrivers(e);function r(){s._config.driver=s.driver()}function o(e){return s._extend(e),r(),s._ready=s._initStorage(s._config),s._ready}function a(e){return function(){var t=0;function n(){for(;t<e.length;){var i=e[t];return t++,s._dbInfo=null,s._ready=null,s.getDriver(i).then(o).catch(n)}r();var a=new Error("No available storage method found.");return s._driverSet=l.reject(a),s._driverSet}return n()}}var c=null!==this._driverSet?this._driverSet.catch((function(){return l.resolve()})):l.resolve();return this._driverSet=c.then((function(){var e=i[0];return s._dbInfo=null,s._ready=null,s.getDriver(e).then((function(e){s._driver=e._driver,r(),s._wrapLibraryMethodsWithReady(),s._initDriver=a(i)}))})).catch((function(){r();var e=new Error("No available storage method found.");return s._driverSet=l.reject(e),s._driverSet})),u(this._driverSet,t,n),this._driverSet},e.prototype.supports=function(e){return!!Ye[e]},e.prototype._extend=function(e){rt(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],n=0,s=e.length;n<s;n++){var i=e[n];this.supports(i)&&t.push(i)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=nt.length;e<t;e++)it(this,nt[e])},e.prototype.createInstance=function(t){return new e(t)},e}(),at=new ot;t.exports=at},{3:3}]},{},[4])(4)},3568:(e,t,n)=>{var s;!function(i){var r,o,a,c,l,d,u,h,m,f,g,p,v,y,_,b,w,S,x,E="sizzle"+1*new Date,A=i.document,C=0,$=0,k=he(),j=he(),T=he(),I=he(),N=function(e,t){return e===t&&(g=!0),0},O={}.hasOwnProperty,M=[],R=M.pop,D=M.push,z=M.push,L=M.slice,P=function(e,t){for(var n=0,s=e.length;n<s;n++)if(e[n]===t)return n;return-1},F="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",U="[\\x20\\t\\r\\n\\f]",B="(?:\\\\[\\da-fA-F]{1,6}"+U+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",q="\\["+U+"*("+B+")(?:"+U+"*([*^$|!~]?=)"+U+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+B+"))|)"+U+"*\\]",H=":("+B+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+q+")*)|.*)\\)|)",G=new RegExp(U+"+","g"),W=new RegExp("^"+U+"+|((?:^|[^\\\\])(?:\\\\.)*)"+U+"+$","g"),V=new RegExp("^"+U+"*,"+U+"*"),J=new RegExp("^"+U+"*([>+~]|"+U+")"+U+"*"),Z=new RegExp(U+"|>"),Q=new RegExp(H),K=new RegExp("^"+B+"$"),Y={ID:new RegExp("^#("+B+")"),CLASS:new RegExp("^\\.("+B+")"),TAG:new RegExp("^("+B+"|[*])"),ATTR:new RegExp("^"+q),PSEUDO:new RegExp("^"+H),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+U+"*(even|odd|(([+-]|)(\\d*)n|)"+U+"*(?:([+-]|)"+U+"*(\\d+)|))"+U+"*\\)|)","i"),bool:new RegExp("^(?:"+F+")$","i"),needsContext:new RegExp("^"+U+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+U+"*((?:-\\d)?\\d*)"+U+"*\\)|)(?=[^-]|$)","i")},X=/HTML$/i,ee=/^(?:input|select|textarea|button)$/i,te=/^h\d$/i,ne=/^[^{]+\{\s*\[native \w/,se=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ie=/[+~]/,re=new RegExp("\\\\[\\da-fA-F]{1,6}"+U+"?|\\\\([^\\r\\n\\f])","g"),oe=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},ae=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ce=function(e,t){return t?"\0"===e?"<22>":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},le=function(){p()},de=Ee((function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()}),{dir:"parentNode",next:"legend"});try{z.apply(M=L.call(A.childNodes),A.childNodes),M[A.childNodes.length].nodeType}catch(e){z={apply:M.length?function(e,t){D.apply(e,L.call(t))}:function(e,t){for(var n=e.length,s=0;e[n++]=t[s++];);e.length=n-1}}}function ue(e,t,n,s){var i,r,a,c,l,u,m,f=t&&t.ownerDocument,g=t?t.nodeType:9;if(n=n||[],"string"!=typeof e||!e||1!==g&&9!==g&&11!==g)return n;if(!s&&(p(t),t=t||v,_)){if(11!==g&&(l=se.exec(e)))if(i=l[1]){if(9===g){if(!(a=t.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&x(t,a)&&a.id===i)return n.push(a),n}else{if(l[2])return z.apply(n,t.getElementsByTagName(e)),n;if((i=l[3])&&o.getElementsByClassName&&t.getElementsByClassName)return z.apply(n,t.getElementsByClassName(i)),n}if(o.qsa&&!I[e+" "]&&(!b||!b.test(e))&&(1!==g||"object"!==t.nodeName.toLowerCase())){if(m=e,f=t,1===g&&(Z.test(e)||J.test(e))){for((f=ie.test(e)&&we(t.parentNode)||t)===t&&o.scope||((c=t.getAttribute("id"))?c=c.replace(ae,ce):t.setAttribute("id",c=E)),r=(u=d(e)).length;r--;)u[r]=(c?"#"+c:":scope")+" "+xe(u[r]);m=u.join(",")}try{return z.apply(n,f.querySelectorAll(m)),n}catch(t){I(e,!0)}finally{c===E&&t.removeAttribute("id")}}}return h(e.replace(W,"$1"),t,n,s)}function he(){var e=[];return function t(n,s){return e.push(n+" ")>a.cacheLength&&delete t[e.shift()],t[n+" "]=s}}function me(e){return e[E]=!0,e}function fe(e){var t=v.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ge(e,t){for(var n=e.split("|"),s=n.length;s--;)a.attrHandle[n[s]]=t}function pe(e,t){var n=t&&e,s=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(s)return s;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function ve(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function ye(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function _e(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&de(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function be(e){return me((function(t){return t=+t,me((function(n,s){for(var i,r=e([],n.length,t),o=r.length;o--;)n[i=r[o]]&&(n[i]=!(s[i]=n[i]))}))}))}function we(e){return e&&void 0!==e.getElementsByTagName&&e}for(r in o=ue.support={},l=ue.isXML=function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!X.test(t||n&&n.nodeName||"HTML")},p=ue.setDocument=function(e){var t,n,s=e?e.ownerDocument||e:A;return s!=v&&9===s.nodeType&&s.documentElement?(y=(v=s).documentElement,_=!l(v),A!=v&&(n=v.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",le,!1):n.attachEvent&&n.attachEvent("onunload",le)),o.scope=fe((function(e){return y.appendChild(e).appendChild(v.createElement("div")),void 0!==e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length})),o.cssHas=fe((function(){try{return v.querySelector(":has(*,:jqfake)"),!1}catch(e){return!0}})),o.attributes=fe((function(e){return e.className="i",!e.getAttribute("className")})),o.getElementsByTagName=fe((function(e){return e.appendChild(v.createComment("")),!e.getElementsByTagName("*").length})),o.getElementsByClassName=ne.test(v.getElementsByClassName),o.getById=fe((function(e){return y.appendChild(e).id=E,!v.getElementsByName||!v.getElementsByName(E).length})),o.getById?(a.filter.ID=function(e){var t=e.replace(re,oe);return function(e){return e.getAttribute("id")===t}},a.find.ID=function(e,t){if(void 0!==t.getElementById&&_){var n=t.getElementById(e);return n?[n]:[]}}):(a.filter.ID=function(e){var t=e.replace(re,oe);return function(e){var n=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},a.find.ID=function(e,t){if(void 0!==t.getElementById&&_){var n,s,i,r=t.getElementById(e);if(r){if((n=r.getAttributeNode("id"))&&n.value===e)return[r];for(i=t.getElementsByName(e),s=0;r=i[s++];)if((n=r.getAttributeNode("id"))&&n.value===e)return[r]}return[]}}),a.find.TAG=o.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):o.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,s=[],i=0,r=t.getElementsByTagName(e);if("*"===e){for(;n=r[i++];)1===n.nodeType&&s.push(n);return s}return r},a.find.CLASS=o.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&_)return t.getElementsByClassName(e)},w=[],b=[],(o.qsa=ne.test(v.querySelectorAll))&&(fe((function(e){var t;y.appendChild(e).innerHTML="<a id='"+E+"'></a><select id='"+E+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&b.push("[*^$]="+U+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||b.push("\\["+U+"*(?:value|"+F+")"),e.querySelectorAll("[id~="+E+"-]").length||b.push("~="),(t=v.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||b.push("\\["+U+"*name"+U+"*="+U+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||b.push(":checked"),e.querySelectorAll("a#"+E+"+*").length||b.push(".#.+[+~]"),e.querySelectorAll("\\\f"),b.push("[\\r\\n\\f]")})),fe((function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=v.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&b.push("name"+U+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&b.push(":enabled",":disabled"),y.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&b.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),b.push(",.*:")}))),(o.matchesSelector=ne.test(S=y.matches||y.webkitMatchesSelector||y.mozMatchesSelector||y.oMatchesSelector||y.msMatchesSelector))&&fe((function(e){o.disconnectedMatch=S.call(e,"*"),S.call(e,"[s!='']:x"),w.push("!=",H)})),o.cssHas||b.push(":has"),b=b.length&&new RegExp(b.join("|")),w=w.length&&new RegExp(w.join("|")),t=ne.test(y.compareDocumentPosition),x=t||ne.test(y.contains)?function(e,t){var n=9===e.nodeType&&e.documentElement||e,s=t&&t.parentNode;return e===s||!(!s||1!==s.nodeType||!(n.contains?n.contains(s):e.compareDocumentPosition&&16&e.compareDocumentPosition(s)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},N=t?function(e,t){if(e===t)return g=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!o.sortDetached&&t.compareDocumentPosition(e)===n?e==v||e.ownerDocument==A&&x(A,e)?-1:t==v||t.ownerDocument==A&&x(A,t)?1:f?P(f,e)-P(f,t):0:4&n?-1:1)}:function(e,t){if(e===t)return g=!0,0;var n,s=0,i=e.parentNode,r=t.parentNode,o=[e],a=[t];if(!i||!r)return e==v?-1:t==v?1:i?-1:r?1:f?P(f,e)-P(f,t):0;if(i===r)return pe(e,t);for(n=e;n=n.parentNode;)o.unshift(n);for(n=t;n=n.parentNode;)a.unshift(n);for(;o[s]===a[s];)s++;return s?pe(o[s],a[s]):o[s]==A?-1:a[s]==A?1:0},v):v},ue.matches=function(e,t){return ue(e,null,null,t)},ue.matchesSelector=function(e,t){if(p(e),o.matchesSelector&&_&&!I[t+" "]&&(!w||!w.test(t))&&(!b||!b.test(t)))try{var n=S.call(e,t);if(n||o.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){I(t,!0)}return ue(t,v,null,[e]).length>0},ue.contains=function(e,t){return(e.ownerDocument||e)!=v&&p(e),x(e,t)},ue.attr=function(e,t){(e.ownerDocument||e)!=v&&p(e);var n=a.attrHandle[t.toLowerCase()],s=n&&O.call(a.attrHandle,t.toLowerCase())?n(e,t,!_):void 0;return void 0!==s?s:o.attributes||!_?e.getAttribute(t):(s=e.getAttributeNode(t))&&s.specified?s.value:null},ue.escape=function(e){return(e+"").replace(ae,ce)},ue.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},ue.uniqueSort=function(e){var t,n=[],s=0,i=0;if(g=!o.detectDuplicates,f=!o.sortStable&&e.slice(0),e.sort(N),g){for(;t=e[i++];)t===e[i]&&(s=n.push(i));for(;s--;)e.splice(n[s],1)}return f=null,e},c=ue.getText=function(e){var t,n="",s=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=c(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[s++];)n+=c(t);return n},a=ue.selectors={cacheLength:50,createPseudo:me,match:Y,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(re,oe),e[3]=(e[3]||e[4]||e[5]||"").replace(re,oe),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||ue.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&ue.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return Y.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&Q.test(n)&&(t=d(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(re,oe).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=k[e+" "];return t||(t=new RegExp("(^|"+U+")"+e+"("+U+"|$)"))&&k(e,(function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")}))},ATTR:function(e,t,n){return function(s){var i=ue.attr(s,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace(G," ")+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,s,i){var r="nth"!==e.slice(0,3),o="last"!==e.slice(-4),a="of-type"===t;return 1===s&&0===i?function(e){return!!e.parentNode}:function(t,n,c){var l,d,u,h,m,f,g=r!==o?"nextSibling":"previousSibling",p=t.parentNode,v=a&&t.nodeName.toLowerCase(),y=!c&&!a,_=!1;if(p){if(r){for(;g;){for(h=t;h=h[g];)if(a?h.nodeName.toLowerCase()===v:1===h.nodeType)return!1;f=g="only"===e&&!f&&"nextSibling"}return!0}if(f=[o?p.firstChild:p.lastChild],o&&y){for(_=(m=(l=(d=(u=(h=p)[E]||(h[E]={}))[h.uniqueID]||(u[h.uniqueID]={}))[e]||[])[0]===C&&l[1])&&l[2],h=m&&p.childNodes[m];h=++m&&h&&h[g]||(_=m=0)||f.pop();)if(1===h.nodeType&&++_&&h===t){d[e]=[C,m,_];break}}else if(y&&(_=m=(l=(d=(u=(h=t)[E]||(h[E]={}))[h.uniqueID]||(u[h.uniqueID]={}))[e]||[])[0]===C&&l[1]),!1===_)for(;(h=++m&&h&&h[g]||(_=m=0)||f.pop())&&((a?h.nodeName.toLowerCase()!==v:1!==h.nodeType)||!++_||(y&&((d=(u=h[E]||(h[E]={}))[h.uniqueID]||(u[h.uniqueID]={}))[e]=[C,_]),h!==t)););return(_-=i)===s||_%s==0&&_/s>=0}}},PSEUDO:function(e,t){var n,s=a.pseudos[e]||a.setFilters[e.toLowerCase()]||ue.error("unsupported pseudo: "+e);return s[E]?s(t):s.length>1?(n=[e,e,"",t],a.setFilters.hasOwnProperty(e.toLowerCase())?me((function(e,n){for(var i,r=s(e,t),o=r.length;o--;)e[i=P(e,r[o])]=!(n[i]=r[o])})):function(e){return s(e,0,n)}):s}},pseudos:{not:me((function(e){var t=[],n=[],s=u(e.replace(W,"$1"));return s[E]?me((function(e,t,n,i){for(var r,o=s(e,null,i,[]),a=e.length;a--;)(r=o[a])&&(e[a]=!(t[a]=r))})):function(e,i,r){return t[0]=e,s(t,null,r,n),t[0]=null,!n.pop()}})),has:me((function(e){return function(t){return ue(e,t).length>0}})),contains:me((function(e){return e=e.replace(re,oe),function(t){return(t.textContent||c(t)).indexOf(e)>-1}})),lang:me((function(e){return K.test(e||"")||ue.error("unsupported lang: "+e),e=e.replace(re,oe).toLowerCase(),function(t){var n;do{if(n=_?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}})),target:function(e){var t=i.location&&i.location.hash;return t&&t.slice(1)===e.id},root:function(e){return e===y},focus:function(e){return e===v.activeElement&&(!v.hasFocus||v.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:_e(!1),disabled:_e(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!a.pseudos.empty(e)},header:function(e){return te.test(e.nodeName)},input:function(e){return ee.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:be((function(){return[0]})),last:be((function(e,t){return[t-1]})),eq:be((function(e,t,n){return[n<0?n+t:n]})),even:be((function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e})),odd:be((function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e})),lt:be((function(e,t,n){for(var s=n<0?n+t:n>t?t:n;--s>=0;)e.push(s);return e})),gt:be((function(e,t,n){for(var s=n<0?n+t:n;++s<t;)e.push(s);return e}))}},a.pseudos.nth=a.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})a.pseudos[r]=ve(r);for(r in{submit:!0,reset:!0})a.pseudos[r]=ye(r);function Se(){}function xe(e){for(var t=0,n=e.length,s="";t<n;t++)s+=e[t].value;return s}function Ee(e,t,n){var s=t.dir,i=t.next,r=i||s,o=n&&"parentNode"===r,a=$++;return t.first?function(t,n,i){for(;t=t[s];)if(1===t.nodeType||o)return e(t,n,i);return!1}:function(t,n,c){var l,d,u,h=[C,a];if(c){for(;t=t[s];)if((1===t.nodeType||o)&&e(t,n,c))return!0}else for(;t=t[s];)if(1===t.nodeType||o)if(d=(u=t[E]||(t[E]={}))[t.uniqueID]||(u[t.uniqueID]={}),i&&i===t.nodeName.toLowerCase())t=t[s]||t;else{if((l=d[r])&&l[0]===C&&l[1]===a)return h[2]=l[2];if(d[r]=h,h[2]=e(t,n,c))return!0}return!1}}function Ae(e){return e.length>1?function(t,n,s){for(var i=e.length;i--;)if(!e[i](t,n,s))return!1;return!0}:e[0]}function Ce(e,t,n,s,i){for(var r,o=[],a=0,c=e.length,l=null!=t;a<c;a++)(r=e[a])&&(n&&!n(r,s,i)||(o.push(r),l&&t.push(a)));return o}function $e(e,t,n,s,i,r){return s&&!s[E]&&(s=$e(s)),i&&!i[E]&&(i=$e(i,r)),me((function(r,o,a,c){var l,d,u,h=[],m=[],f=o.length,g=r||function(e,t,n){for(var s=0,i=t.length;s<i;s++)ue(e,t[s],n);return n}(t||"*",a.nodeType?[a]:a,[]),p=!e||!r&&t?g:Ce(g,h,e,a,c),v=n?i||(r?e:f||s)?[]:o:p;if(n&&n(p,v,a,c),s)for(l=Ce(v,m),s(l,[],a,c),d=l.length;d--;)(u=l[d])&&(v[m[d]]=!(p[m[d]]=u));if(r){if(i||e){if(i){for(l=[],d=v.length;d--;)(u=v[d])&&l.push(p[d]=u);i(null,v=[],l,c)}for(d=v.length;d--;)(u=v[d])&&(l=i?P(r,u):h[d])>-1&&(r[l]=!(o[l]=u))}}else v=Ce(v===o?v.splice(f,v.length):v),i?i(null,o,v,c):z.apply(o,v)}))}function ke(e){for(var t,n,s,i=e.length,r=a.relative[e[0].type],o=r||a.relative[" "],c=r?1:0,l=Ee((function(e){return e===t}),o,!0),d=Ee((function(e){return P(t,e)>-1}),o,!0),u=[function(e,n,s){var i=!r&&(s||n!==m)||((t=n).nodeType?l(e,n,s):d(e,n,s));return t=null,i}];c<i;c++)if(n=a.relative[e[c].type])u=[Ee(Ae(u),n)];else{if((n=a.filter[e[c].type].apply(null,e[c].matches))[E]){for(s=++c;s<i&&!a.relative[e[s].type];s++);return $e(c>1&&Ae(u),c>1&&xe(e.slice(0,c-1).concat({value:" "===e[c-2].type?"*":""})).replace(W,"$1"),n,c<s&&ke(e.slice(c,s)),s<i&&ke(e=e.slice(s)),s<i&&xe(e))}u.push(n)}return Ae(u)}Se.prototype=a.filters=a.pseudos,a.setFilters=new Se,d=ue.tokenize=function(e,t){var n,s,i,r,o,c,l,d=j[e+" "];if(d)return t?0:d.slice(0);for(o=e,c=[],l=a.preFilter;o;){for(r in n&&!(s=V.exec(o))||(s&&(o=o.slice(s[0].length)||o),c.push(i=[])),n=!1,(s=J.exec(o))&&(n=s.shift(),i.push({value:n,type:s[0].replace(W," ")}),o=o.slice(n.length)),a.filter)!(s=Y[r].exec(o))||l[r]&&!(s=l[r](s))||(n=s.shift(),i.push({value:n,type:r,matches:s}),o=o.slice(n.length));if(!n)break}return t?o.length:o?ue.error(e):j(e,c).slice(0)},u=ue.compile=function(e,t){var n,s=[],i=[],r=T[e+" "];if(!r){for(t||(t=d(e)),n=t.length;n--;)(r=ke(t[n]))[E]?s.push(r):i.push(r);r=T(e,function(e,t){var n=t.length>0,s=e.length>0,i=function(i,r,o,c,l){var d,u,h,f=0,g="0",y=i&&[],b=[],w=m,S=i||s&&a.find.TAG("*",l),x=C+=null==w?1:Math.random()||.1,E=S.length;for(l&&(m=r==v||r||l);g!==E&&null!=(d=S[g]);g++){if(s&&d){for(u=0,r||d.ownerDocument==v||(p(d),o=!_);h=e[u++];)if(h(d,r||v,o)){c.push(d);break}l&&(C=x)}n&&((d=!h&&d)&&f--,i&&y.push(d))}if(f+=g,n&&g!==f){for(u=0;h=t[u++];)h(y,b,r,o);if(i){if(f>0)for(;g--;)y[g]||b[g]||(b[g]=R.call(c));b=Ce(b)}z.apply(c,b),l&&!i&&b.length>0&&f+t.length>1&&ue.uniqueSort(c)}return l&&(C=x,m=w),y};return n?me(i):i}(i,s)),r.selector=e}return r},h=ue.select=function(e,t,n,s){var i,r,o,c,l,h="function"==typeof e&&e,m=!s&&d(e=h.selector||e);if(n=n||[],1===m.length){if((r=m[0]=m[0].slice(0)).length>2&&"ID"===(o=r[0]).type&&9===t.nodeType&&_&&a.relative[r[1].type]){if(!(t=(a.find.ID(o.matches[0].replace(re,oe),t)||[])[0]))return n;h&&(t=t.parentNode),e=e.slice(r.shift().value.length)}for(i=Y.needsContext.test(e)?0:r.length;i--&&(o=r[i],!a.relative[c=o.type]);)if((l=a.find[c])&&(s=l(o.matches[0].replace(re,oe),ie.test(r[0].type)&&we(t.parentNode)||t))){if(r.splice(i,1),!(e=s.length&&xe(r)))return z.apply(n,s),n;break}}return(h||u(e,m))(s,t,!_,n,!t||ie.test(e)&&we(t.parentNode)||t),n},o.sortStable=E.split("").sort(N).join("")===E,o.detectDuplicates=!!g,p(),o.sortDetached=fe((function(e){return 1&e.compareDocumentPosition(v.createElement("fieldset"))})),fe((function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")}))||ge("type|href|height|width",(function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)})),o.attributes&&fe((function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")}))||ge("value",(function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue})),fe((function(e){return null==e.getAttribute("disabled")}))||ge(F,(function(e,t,n){var s;if(!n)return!0===e[t]?t.toLowerCase():(s=e.getAttributeNode(t))&&s.specified?s.value:null}));var je=i.Sizzle;ue.noConflict=function(){return i.Sizzle===ue&&(i.Sizzle=je),ue},void 0===(s=function(){return ue}.call(t,n,t,e))||(e.exports=s)}(window)},6293:(e,t,n)=>{var s;!function(){"use strict";var i={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function r(e){return function(e,t){var n,s,o,a,c,l,d,u,h,m=1,f=e.length,g="";for(s=0;s<f;s++)if("string"==typeof e[s])g+=e[s];else if("object"==typeof e[s]){if((a=e[s]).keys)for(n=t[m],o=0;o<a.keys.length;o++){if(null==n)throw new Error(r('[sprintf] Cannot access property "%s" of undefined value "%s"',a.keys[o],a.keys[o-1]));n=n[a.keys[o]]}else n=a.param_no?t[a.param_no]:t[m++];if(i.not_type.test(a.type)&&i.not_primitive.test(a.type)&&n instanceof Function&&(n=n()),i.numeric_arg.test(a.type)&&"number"!=typeof n&&isNaN(n))throw new TypeError(r("[sprintf] expecting number but found %T",n));switch(i.number.test(a.type)&&(u=n>=0),a.type){case"b":n=parseInt(n,10).toString(2);break;case"c":n=String.fromCharCode(parseInt(n,10));break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,a.width?parseInt(a.width):0);break;case"e":n=a.precision?parseFloat(n).toExponential(a.precision):parseFloat(n).toExponential();break;case"f":n=a.precision?parseFloat(n).toFixed(a.precision):parseFloat(n);break;case"g":n=a.precision?String(Number(n.toPrecision(a.precision))):parseFloat(n);break;case"o":n=(parseInt(n,10)>>>0).toString(8);break;case"s":n=String(n),n=a.precision?n.substring(0,a.precision):n;break;case"t":n=String(!!n),n=a.precision?n.substring(0,a.precision):n;break;case"T":n=Object.prototype.toString.call(n).slice(8,-1).toLowerCase(),n=a.precision?n.substring(0,a.precision):n;break;case"u":n=parseInt(n,10)>>>0;break;case"v":n=n.valueOf(),n=a.precision?n.substring(0,a.precision):n;break;case"x":n=(parseInt(n,10)>>>0).toString(16);break;case"X":n=(parseInt(n,10)>>>0).toString(16).toUpperCase()}i.json.test(a.type)?g+=n:(!i.number.test(a.type)||u&&!a.sign?h="":(h=u?"+":"-",n=n.toString().replace(i.sign,"")),l=a.pad_char?"0"===a.pad_char?"0":a.pad_char.charAt(1):" ",d=a.width-(h+n).length,c=a.width&&d>0?l.repeat(d):"",g+=a.align?h+n+c:"0"===l?h+c+n:c+h+n)}return g}(function(e){if(a[e])return a[e];var t,n=e,s=[],r=0;for(;n;){if(null!==(t=i.text.exec(n)))s.push(t[0]);else if(null!==(t=i.modulo.exec(n)))s.push("%");else{if(null===(t=i.placeholder.exec(n)))throw new SyntaxError("[sprintf] unexpected placeholder");if(t[2]){r|=1;var o=[],c=t[2],l=[];if(null===(l=i.key.exec(c)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(o.push(l[1]);""!==(c=c.substring(l[0].length));)if(null!==(l=i.key_access.exec(c)))o.push(l[1]);else{if(null===(l=i.index_access.exec(c)))throw new SyntaxError("[sprintf] failed to parse named argument key");o.push(l[1])}t[2]=o}else r|=2;if(3===r)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");s.push({placeholder:t[0],param_no:t[1],keys:t[2],sign:t[3],pad_char:t[4],align:t[5],width:t[6],precision:t[7],type:t[8]})}n=n.substring(t[0].length)}return a[e]=s}(e),arguments)}function o(e,t){return r.apply(null,[e].concat(t||[]))}var a=Object.create(null);t.sprintf=r,t.vsprintf=o,"undefined"!=typeof window&&(window.sprintf=r,window.vsprintf=o,void 0===(s=function(){return{sprintf:r,vsprintf:o}}.call(t,n,t,e))||(e.exports=s))}()},7939:function(e,t,n){var s,i;!function(r,o){"use strict";e.exports?e.exports=o():void 0===(i="function"==typeof(s=o)?s.call(t,n,t,e):s)||(e.exports=i)}(0,(function(e){"use strict";var t=e&&e.IPv6;return{best:function(e){var t,n,s=e.toLowerCase().split(":"),i=s.length,r=8;for(""===s[0]&&""===s[1]&&""===s[2]?(s.shift(),s.shift()):""===s[0]&&""===s[1]?s.shift():""===s[i-1]&&""===s[i-2]&&s.pop(),-1!==s[(i=s.length)-1].indexOf(".")&&(r=7),t=0;t<i&&""!==s[t];t++);if(t<r)for(s.splice(t,1,"0000");s.length<r;)s.splice(t,0,"0000");for(var o=0;o<r;o++){n=s[o].split("");for(var a=0;a<3&&("0"===n[0]&&n.length>1);a++)n.splice(0,1);s[o]=n.join("")}var c=-1,l=0,d=0,u=-1,h=!1;for(o=0;o<r;o++)h?"0"===s[o]?d+=1:(h=!1,d>l&&(c=u,l=d)):"0"===s[o]&&(h=!0,u=o,d=1);d>l&&(c=u,l=d),l>1&&s.splice(c,l,""),i=s.length;var m="";for(""===s[0]&&(m=":"),o=0;o<i&&(m+=s[o],o!==i-1);o++)m+=":";return""===s[i-1]&&(m+=":"),m},noConflict:function(){return e.IPv6===this&&(e.IPv6=t),this}}}))},3338:function(e,t,n){var s,i;!function(r,o){"use strict";e.exports?e.exports=o():void 0===(i="function"==typeof(s=o)?s.call(t,n,t,e):s)||(e.exports=i)}(0,(function(e){"use strict";var t=e&&e.SecondLevelDomains,n={list:{ac:" com gov mil net org ",ae:" ac co gov mil name net org pro sch ",af:" com edu gov net org ",al:" com edu gov mil net org ",ao:" co ed gv it og pb ",ar:" com edu gob gov int mil net org tur ",at:" ac co gv or ",au:" asn com csiro edu gov id net org ",ba:" co com edu gov mil net org rs unbi unmo unsa untz unze ",bb:" biz co com edu gov info net org store tv ",bh:" biz cc com edu gov info net org ",bn:" com edu gov net org ",bo:" com edu gob gov int mil net org tv ",br:" adm adv agr am arq art ato b bio blog bmd cim cng cnt com coop ecn edu eng esp etc eti far flog fm fnd fot fst g12 ggf gov imb ind inf jor jus lel mat med mil mus net nom not ntr odo org ppg pro psc psi qsl rec slg srv tmp trd tur tv vet vlog wiki zlg ",bs:" com edu gov net org ",bz:" du et om ov rg ",ca:" ab bc mb nb nf nl ns nt nu on pe qc sk yk ",ck:" biz co edu gen gov info net org ",cn:" ac ah bj com cq edu fj gd gov gs gx gz ha hb he hi hl hn jl js jx ln mil net nm nx org qh sc sd sh sn sx tj tw xj xz yn zj ",co:" com edu gov mil net nom org ",cr:" ac c co ed fi go or sa ",cy:" ac biz com ekloges gov ltd name net org parliament press pro tm ",do:" art com edu gob gov mil net org sld web ",dz:" art asso com edu gov net org pol ",ec:" com edu fin gov info med mil net org pro ",eg:" com edu eun gov mil name net org sci ",er:" com edu gov ind mil net org rochest w ",es:" com edu gob nom org ",et:" biz com edu gov info name net org ",fj:" ac biz com info mil name net org pro ",fk:" ac co gov net nom org ",fr:" asso com f gouv nom prd presse tm ",gg:" co net org ",gh:" com edu gov mil org ",gn:" ac com gov net org ",gr:" com edu gov mil net org ",gt:" com edu gob ind mil net org ",gu:" com edu gov net org ",hk:" com edu gov idv net org ",hu:" 2000 agrar bolt casino city co erotica erotika film forum games hotel info ingatlan jogasz konyvelo lakas media news org priv reklam sex shop sport suli szex tm tozsde utazas video ",id:" ac co go mil net or sch web ",il:" ac co gov idf k12 muni net org ",in:" ac co edu ernet firm gen gov i ind mil net nic org res ",iq:" com edu gov i mil net org ",ir:" ac co dnssec gov i id net org sch ",it:" edu gov ",je:" co net org ",jo:" com edu gov mil name net org sch ",jp:" ac ad co ed go gr lg ne or ",ke:" ac co go info me mobi ne or sc ",kh:" com edu gov mil net org per ",ki:" biz com de edu gov info mob net org tel ",km:" asso com coop edu gouv k medecin mil nom notaires pharmaciens presse tm veterinaire ",kn:" edu gov net org ",kr:" ac busan chungbuk chungnam co daegu daejeon es gangwon go gwangju gyeongbuk gyeonggi gyeongnam hs incheon jeju jeonbuk jeonnam k kg mil ms ne or pe re sc seoul ulsan ",kw:" com edu gov net org ",ky:" com edu gov net org ",kz:" com edu gov mil net org ",lb:" com edu gov net org ",lk:" assn com edu gov grp hotel int ltd net ngo org sch soc web ",lr:" com edu gov net org ",lv:" asn com conf edu gov id mil net org ",ly:" com edu gov id med net org plc sch ",ma:" ac co gov m net org press ",mc:" asso tm ",me:" ac co edu gov its net org priv ",mg:" com edu gov mil nom org prd tm ",mk:" com edu gov inf name net org pro ",ml:" com edu gov net org presse ",mn:" edu gov org ",mo:" com edu gov net org ",mt:" com edu gov net org ",mv:" aero biz com coop edu gov info int mil museum name net org pro ",mw:" ac co com coop edu gov int museum net org ",mx:" com edu gob net org ",my:" com edu gov mil name net org sch ",nf:" arts com firm info net other per rec store web ",ng:" biz com edu gov mil mobi name net org sch ",ni:" ac co com edu gob mil net nom org ",np:" com edu gov mil net org ",nr:" biz com edu gov info net org ",om:" ac biz co com edu gov med mil museum net org pro sch ",pe:" com edu gob mil net nom org sld ",ph:" com edu gov i mil net ngo org ",pk:" biz com edu fam gob gok gon gop gos gov net org web ",pl:" art bialystok biz com edu gda gdansk gorzow gov info katowice krakow lodz lublin mil net ngo olsztyn org poznan pwr radom slupsk szczecin torun warszawa waw wroc wroclaw zgora ",pr:" ac biz com edu est gov info isla name net org pro prof ",ps:" com edu gov net org plo sec ",pw:" belau co ed go ne or ",ro:" arts com firm info nom nt org rec store tm www ",rs:" ac co edu gov in org ",sb:" com edu gov net org ",sc:" com edu gov net org ",sh:" co com edu gov net nom org ",sl:" com edu gov net org ",st:" co com consulado edu embaixada gov mil net org principe saotome store ",sv:" com edu gob org red ",sz:" ac co org ",tr:" av bbs bel biz com dr edu gen gov info k12 name net org pol tel tsk tv web ",tt:" aero biz cat co com coop edu gov info int jobs mil mobi museum name net org pro tel travel ",tw:" club com ebiz edu game gov idv mil net org ",mu:" ac co com gov net or org ",mz:" ac co edu gov org ",na:" co com ",nz:" ac co cri geek gen govt health iwi maori mil net org parliament school ",pa:" abo ac com edu gob ing med net nom org sld ",pt:" com edu gov int net nome org publ ",py:" com edu gov mil net org ",qa:" com edu gov mil net org ",re:" asso com nom ",ru:" ac adygeya altai amur arkhangelsk astrakhan bashkiria belgorod bir bryansk buryatia cbg chel chelyabinsk chita chukotka chuvashia com dagestan e-burg edu gov grozny int irkutsk ivanovo izhevsk jar joshkar-ola kalmykia kaluga kamchatka karelia kazan kchr kemerovo khabarovsk khakassia khv kirov koenig komi kostroma kranoyarsk kuban kurgan kursk lipetsk magadan mari mari-el marine mil mordovia mosreg msk murmansk nalchik net nnov nov novosibirsk nsk omsk orenburg org oryol penza perm pp pskov ptz rnd ryazan sakhalin samara saratov simbirsk smolensk spb stavropol stv surgut tambov tatarstan tom tomsk tsaritsyn tsk tula tuva tver tyumen udm udmurtia ulan-ude vladikavkaz vladimir vladivostok volgograd vologda voronezh vrn vyatka yakutia yamal yekaterinburg yuzhno-sakhalinsk ",rw:" ac co com edu gouv gov int mil net ",sa:" com edu gov med net org pub sch ",sd:" com edu gov info med net org tv ",se:" a ac b bd c d e f g h i k l m n o org p parti pp press r s t tm u w x y z ",sg:" com edu gov idn net org per ",sn:" art com edu gouv org perso univ ",sy:" com edu gov mil net news org ",th:" ac co go in mi net or ",tj:" ac biz co com edu go gov info int mil name net nic org test web ",tn:" agrinet com defense edunet ens fin gov ind info intl mincom nat net org perso rnrt rns rnu tourism ",tz:" ac co go ne or ",ua:" biz cherkassy chernigov chernovtsy ck cn co com crimea cv dn dnepropetrovsk donetsk dp edu gov if in ivano-frankivsk kh kharkov kherson khmelnitskiy kiev kirovograd km kr ks kv lg lugansk lutsk lviv me mk net nikolaev od odessa org pl poltava pp rovno rv sebastopol sumy te ternopil uzhgorod vinnica vn zaporizhzhe zhitomir zp zt ",ug:" ac co go ne or org sc ",uk:" ac bl british-library co cym gov govt icnet jet lea ltd me mil mod national-library-scotland nel net nhs nic nls org orgn parliament plc police sch scot soc ",us:" dni fed isa kids nsn ",uy:" com edu gub mil net org ",ve:" co com edu gob info mil net org web ",vi:" co com k12 net org ",vn:" ac biz com edu gov health info int name net org pro ",ye:" co com gov ltd me net org plc ",yu:" ac co edu gov org ",za:" ac agric alt bourse city co cybernet db edu gov grondar iaccess imt inca landesign law mil net ngo nis nom olivetti org pix school tm web ",zm:" ac co com edu gov net org sch ",com:"ar br cn de eu gb gr hu jpn kr no qc ru sa se uk us uy za ",net:"gb jp se uk ",org:"ae",de:"com "},has:function(e){var t=e.lastIndexOf(".");if(t<=0||t>=e.length-1)return!1;var s=e.lastIndexOf(".",t-1);if(s<=0||s>=t-1)return!1;var i=n.list[e.slice(t+1)];return!!i&&i.indexOf(" "+e.slice(s+1,t)+" ")>=0},is:function(e){var t=e.lastIndexOf(".");if(t<=0||t>=e.length-1)return!1;if(e.lastIndexOf(".",t-1)>=0)return!1;var s=n.list[e.slice(t+1)];return!!s&&s.indexOf(" "+e.slice(0,t)+" ")>=0},get:function(e){var t=e.lastIndexOf(".");if(t<=0||t>=e.length-1)return null;var s=e.lastIndexOf(".",t-1);if(s<=0||s>=t-1)return null;var i=n.list[e.slice(t+1)];return i?i.indexOf(" "+e.slice(s+1,t)+" ")<0?null:e.slice(s+1):null},noConflict:function(){return e.SecondLevelDomains===this&&(e.SecondLevelDomains=t),this}};return n}))},9988:function(e,t,n){var s,i,r;!function(o,a){"use strict";e.exports?e.exports=a(n(7562),n(7939),n(3338)):(i=[n(7562),n(7939),n(3338)],void 0===(r="function"==typeof(s=a)?s.apply(t,i):s)||(e.exports=r))}(0,(function(e,t,n,s){"use strict";var i=s&&s.URI;function r(e,t){var n=arguments.length>=1;if(!(this instanceof r))return n?arguments.length>=2?new r(e,t):new r(e):new r;if(void 0===e){if(n)throw new TypeError("undefined is not a valid argument for URI");e="undefined"!=typeof location?location.href+"":""}if(null===e&&n)throw new TypeError("null is not a valid argument for URI");return this.href(e),void 0!==t?this.absoluteTo(t):this}r.version="1.19.11";var o=r.prototype,a=Object.prototype.hasOwnProperty;function c(e){return e.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function l(e){return void 0===e?"Undefined":String(Object.prototype.toString.call(e)).slice(8,-1)}function d(e){return"Array"===l(e)}function u(e,t){var n,s,i={};if("RegExp"===l(t))i=null;else if(d(t))for(n=0,s=t.length;n<s;n++)i[t[n]]=!0;else i[t]=!0;for(n=0,s=e.length;n<s;n++){(i&&void 0!==i[e[n]]||!i&&t.test(e[n]))&&(e.splice(n,1),s--,n--)}return e}function h(e,t){var n,s;if(d(t)){for(n=0,s=t.length;n<s;n++)if(!h(e,t[n]))return!1;return!0}var i=l(t);for(n=0,s=e.length;n<s;n++)if("RegExp"===i){if("string"==typeof e[n]&&e[n].match(t))return!0}else if(e[n]===t)return!0;return!1}function m(e,t){if(!d(e)||!d(t))return!1;if(e.length!==t.length)return!1;e.sort(),t.sort();for(var n=0,s=e.length;n<s;n++)if(e[n]!==t[n])return!1;return!0}function f(e){return e.replace(/^\/+|\/+$/g,"")}function g(e){return escape(e)}function p(e){return encodeURIComponent(e).replace(/[!'()*]/g,g).replace(/\*/g,"%2A")}r._parts=function(){return{protocol:null,username:null,password:null,hostname:null,urn:null,port:null,path:null,query:null,fragment:null,preventInvalidHostname:r.preventInvalidHostname,duplicateQueryParameters:r.duplicateQueryParameters,escapeQuerySpace:r.escapeQuerySpace}},r.preventInvalidHostname=!1,r.duplicateQueryParameters=!1,r.escapeQuerySpace=!0,r.protocol_expression=/^[a-z][a-z0-9.+-]*$/i,r.idn_expression=/[^a-z0-9\._-]/i,r.punycode_expression=/(xn--)/i,r.ip4_expression=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,r.ip6_expression=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,r.find_uri_expression=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/gi,r.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?«»“”„‘’]+$/,parens:/(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g},r.leading_whitespace_expression=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,r.ascii_tab_whitespace=/[\u0009\u000A\u000D]+/g,r.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"},r.hostProtocols=["http","https"],r.invalid_hostname_characters=/[^a-zA-Z0-9\.\-:_]/,r.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src",audio:"src",video:"src"},r.getDomAttribute=function(e){if(e&&e.nodeName){var t=e.nodeName.toLowerCase();if("input"!==t||"image"===e.type)return r.domAttributes[t]}},r.encode=p,r.decode=decodeURIComponent,r.iso8859=function(){r.encode=escape,r.decode=unescape},r.unicode=function(){r.encode=p,r.decode=decodeURIComponent},r.characters={pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/gi,map:{"%24":"$","%26":"&","%2B":"+","%2C":",","%3B":";","%3D":"=","%3A":":","%40":"@"}},decode:{expression:/[\/\?#]/g,map:{"/":"%2F","?":"%3F","#":"%23"}}},reserved:{encode:{expression:/%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/gi,map:{"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"="}}},urnpath:{encode:{expression:/%(21|24|27|28|29|2A|2B|2C|3B|3D|40)/gi,map:{"%21":"!","%24":"$","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"=","%40":"@"}},decode:{expression:/[\/\?#:]/g,map:{"/":"%2F","?":"%3F","#":"%23",":":"%3A"}}}},r.encodeQuery=function(e,t){var n=r.encode(e+"");return void 0===t&&(t=r.escapeQuerySpace),t?n.replace(/%20/g,"+"):n},r.decodeQuery=function(e,t){e+="",void 0===t&&(t=r.escapeQuerySpace);try{return r.decode(t?e.replace(/\+/g,"%20"):e)}catch(t){return e}};var v,y={encode:"encode",decode:"decode"},_=function(e,t){return function(n){try{return r[t](n+"").replace(r.characters[e][t].expression,(function(n){return r.characters[e][t].map[n]}))}catch(e){return n}}};for(v in y)r[v+"PathSegment"]=_("pathname",y[v]),r[v+"UrnPathSegment"]=_("urnpath",y[v]);var b=function(e,t,n){return function(s){var i;i=n?function(e){return r[t](r[n](e))}:r[t];for(var o=(s+"").split(e),a=0,c=o.length;a<c;a++)o[a]=i(o[a]);return o.join(e)}};function w(e){return function(t,n){return void 0===t?this._parts[e]||"":(this._parts[e]=t||null,this.build(!n),this)}}function S(e,t){return function(n,s){return void 0===n?this._parts[e]||"":(null!==n&&(n+="").charAt(0)===t&&(n=n.substring(1)),this._parts[e]=n,this.build(!s),this)}}r.decodePath=b("/","decodePathSegment"),r.decodeUrnPath=b(":","decodeUrnPathSegment"),r.recodePath=b("/","encodePathSegment","decode"),r.recodeUrnPath=b(":","encodeUrnPathSegment","decode"),r.encodeReserved=_("reserved","encode"),r.parse=function(e,t){var n;return t||(t={preventInvalidHostname:r.preventInvalidHostname}),(n=(e=(e=e.replace(r.leading_whitespace_expression,"")).replace(r.ascii_tab_whitespace,"")).indexOf("#"))>-1&&(t.fragment=e.substring(n+1)||null,e=e.substring(0,n)),(n=e.indexOf("?"))>-1&&(t.query=e.substring(n+1)||null,e=e.substring(0,n)),"//"===(e=(e=e.replace(/^(https?|ftp|wss?)?:+[/\\]*/i,"$1://")).replace(/^[/\\]{2,}/i,"//")).substring(0,2)?(t.protocol=null,e=e.substring(2),e=r.parseAuthority(e,t)):(n=e.indexOf(":"))>-1&&(t.protocol=e.substring(0,n)||null,t.protocol&&!t.protocol.match(r.protocol_expression)?t.protocol=void 0:"//"===e.substring(n+1,n+3).replace(/\\/g,"/")?(e=e.substring(n+3),e=r.parseAuthority(e,t)):(e=e.substring(n+1),t.urn=!0)),t.path=e,t},r.parseHost=function(e,t){e||(e="");var n,s,i=(e=e.replace(/\\/g,"/")).indexOf("/");if(-1===i&&(i=e.length),"["===e.charAt(0))n=e.indexOf("]"),t.hostname=e.substring(1,n)||null,t.port=e.substring(n+2,i)||null,"/"===t.port&&(t.port=null);else{var o=e.indexOf(":"),a=e.indexOf("/"),c=e.indexOf(":",o+1);-1!==c&&(-1===a||c<a)?(t.hostname=e.substring(0,i)||null,t.port=null):(s=e.substring(0,i).split(":"),t.hostname=s[0]||null,t.port=s[1]||null)}return t.hostname&&"/"!==e.substring(i).charAt(0)&&(i++,e="/"+e),t.preventInvalidHostname&&r.ensureValidHostname(t.hostname,t.protocol),t.port&&r.ensureValidPort(t.port),e.substring(i)||"/"},r.parseAuthority=function(e,t){return e=r.parseUserinfo(e,t),r.parseHost(e,t)},r.parseUserinfo=function(e,t){var n=e;-1!==e.indexOf("\\")&&(e=e.replace(/\\/g,"/"));var s,i=e.indexOf("/"),o=e.lastIndexOf("@",i>-1?i:e.length-1);return o>-1&&(-1===i||o<i)?(s=e.substring(0,o).split(":"),t.username=s[0]?r.decode(s[0]):null,s.shift(),t.password=s[0]?r.decode(s.join(":")):null,e=n.substring(o+1)):(t.username=null,t.password=null),e},r.parseQuery=function(e,t){if(!e)return{};if(!(e=e.replace(/&+/g,"&").replace(/^\?*&*|&+$/g,"")))return{};for(var n,s,i,o={},c=e.split("&"),l=c.length,d=0;d<l;d++)n=c[d].split("="),s=r.decodeQuery(n.shift(),t),i=n.length?r.decodeQuery(n.join("="),t):null,"__proto__"!==s&&(a.call(o,s)?("string"!=typeof o[s]&&null!==o[s]||(o[s]=[o[s]]),o[s].push(i)):o[s]=i);return o},r.build=function(e){var t="",n=!1;return e.protocol&&(t+=e.protocol+":"),e.urn||!t&&!e.hostname||(t+="//",n=!0),t+=r.buildAuthority(e)||"","string"==typeof e.path&&("/"!==e.path.charAt(0)&&n&&(t+="/"),t+=e.path),"string"==typeof e.query&&e.query&&(t+="?"+e.query),"string"==typeof e.fragment&&e.fragment&&(t+="#"+e.fragment),t},r.buildHost=function(e){var t="";return e.hostname?(r.ip6_expression.test(e.hostname)?t+="["+e.hostname+"]":t+=e.hostname,e.port&&(t+=":"+e.port),t):""},r.buildAuthority=function(e){return r.buildUserinfo(e)+r.buildHost(e)},r.buildUserinfo=function(e){var t="";return e.username&&(t+=r.encode(e.username)),e.password&&(t+=":"+r.encode(e.password)),t&&(t+="@"),t},r.buildQuery=function(e,t,n){var s,i,o,c,l="";for(i in e)if("__proto__"!==i&&a.call(e,i))if(d(e[i]))for(s={},o=0,c=e[i].length;o<c;o++)void 0!==e[i][o]&&void 0===s[e[i][o]+""]&&(l+="&"+r.buildQueryParameter(i,e[i][o],n),!0!==t&&(s[e[i][o]+""]=!0));else void 0!==e[i]&&(l+="&"+r.buildQueryParameter(i,e[i],n));return l.substring(1)},r.buildQueryParameter=function(e,t,n){return r.encodeQuery(e,n)+(null!==t?"="+r.encodeQuery(t,n):"")},r.addQuery=function(e,t,n){if("object"==typeof t)for(var s in t)a.call(t,s)&&r.addQuery(e,s,t[s]);else{if("string"!=typeof t)throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");if(void 0===e[t])return void(e[t]=n);"string"==typeof e[t]&&(e[t]=[e[t]]),d(n)||(n=[n]),e[t]=(e[t]||[]).concat(n)}},r.setQuery=function(e,t,n){if("object"==typeof t)for(var s in t)a.call(t,s)&&r.setQuery(e,s,t[s]);else{if("string"!=typeof t)throw new TypeError("URI.setQuery() accepts an object, string as the name parameter");e[t]=void 0===n?null:n}},r.removeQuery=function(e,t,n){var s,i,o;if(d(t))for(s=0,i=t.length;s<i;s++)e[t[s]]=void 0;else if("RegExp"===l(t))for(o in e)t.test(o)&&(e[o]=void 0);else if("object"==typeof t)for(o in t)a.call(t,o)&&r.removeQuery(e,o,t[o]);else{if("string"!=typeof t)throw new TypeError("URI.removeQuery() accepts an object, string, RegExp as the first parameter");void 0!==n?"RegExp"===l(n)?!d(e[t])&&n.test(e[t])?e[t]=void 0:e[t]=u(e[t],n):e[t]!==String(n)||d(n)&&1!==n.length?d(e[t])&&(e[t]=u(e[t],n)):e[t]=void 0:e[t]=void 0}},r.hasQuery=function(e,t,n,s){switch(l(t)){case"String":break;case"RegExp":for(var i in e)if(a.call(e,i)&&t.test(i)&&(void 0===n||r.hasQuery(e,i,n)))return!0;return!1;case"Object":for(var o in t)if(a.call(t,o)&&!r.hasQuery(e,o,t[o]))return!1;return!0;default:throw new TypeError("URI.hasQuery() accepts a string, regular expression or object as the name parameter")}switch(l(n)){case"Undefined":return t in e;case"Boolean":return n===Boolean(d(e[t])?e[t].length:e[t]);case"Function":return!!n(e[t],t,e);case"Array":return!!d(e[t])&&(s?h:m)(e[t],n);case"RegExp":return d(e[t])?!!s&&h(e[t],n):Boolean(e[t]&&e[t].match(n));case"Number":n=String(n);case"String":return d(e[t])?!!s&&h(e[t],n):e[t]===n;default:throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter")}},r.joinPaths=function(){for(var e=[],t=[],n=0,s=0;s<arguments.length;s++){var i=new r(arguments[s]);e.push(i);for(var o=i.segment(),a=0;a<o.length;a++)"string"==typeof o[a]&&t.push(o[a]),o[a]&&n++}if(!t.length||!n)return new r("");var c=new r("").segment(t);return""!==e[0].path()&&"/"!==e[0].path().slice(0,1)||c.path("/"+c.path()),c.normalize()},r.commonPath=function(e,t){var n,s=Math.min(e.length,t.length);for(n=0;n<s;n++)if(e.charAt(n)!==t.charAt(n)){n--;break}return n<1?e.charAt(0)===t.charAt(0)&&"/"===e.charAt(0)?"/":"":("/"===e.charAt(n)&&"/"===t.charAt(n)||(n=e.substring(0,n).lastIndexOf("/")),e.substring(0,n+1))},r.withinString=function(e,t,n){n||(n={});var s=n.start||r.findUri.start,i=n.end||r.findUri.end,o=n.trim||r.findUri.trim,a=n.parens||r.findUri.parens,c=/[a-z0-9-]=["']?$/i;for(s.lastIndex=0;;){var l=s.exec(e);if(!l)break;var d=l.index;if(n.ignoreHtml){var u=e.slice(Math.max(d-3,0),d);if(u&&c.test(u))continue}for(var h=d+e.slice(d).search(i),m=e.slice(d,h),f=-1;;){var g=a.exec(m);if(!g)break;var p=g.index+g[0].length;f=Math.max(f,p)}if(!((m=f>-1?m.slice(0,f)+m.slice(f).replace(o,""):m.replace(o,"")).length<=l[0].length||n.ignore&&n.ignore.test(m))){var v=t(m,d,h=d+m.length,e);void 0!==v?(v=String(v),e=e.slice(0,d)+v+e.slice(h),s.lastIndex=d+v.length):s.lastIndex=h}}return s.lastIndex=0,e},r.ensureValidHostname=function(t,n){var s=!!t,i=!1;if(!!n&&(i=h(r.hostProtocols,n)),i&&!s)throw new TypeError("Hostname cannot be empty, if protocol is "+n);if(t&&t.match(r.invalid_hostname_characters)){if(!e)throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-:_] and Punycode.js is not available');if(e.toASCII(t).match(r.invalid_hostname_characters))throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-:_]')}},r.ensureValidPort=function(e){if(e){var t=Number(e);if(!(/^[0-9]+$/.test(t)&&t>0&&t<65536))throw new TypeError('Port "'+e+'" is not a valid port')}},r.noConflict=function(e){if(e){var t={URI:this.noConflict()};return s.URITemplate&&"function"==typeof s.URITemplate.noConflict&&(t.URITemplate=s.URITemplate.noConflict()),s.IPv6&&"function"==typeof s.IPv6.noConflict&&(t.IPv6=s.IPv6.noConflict()),s.SecondLevelDomains&&"function"==typeof s.SecondLevelDomains.noConflict&&(t.SecondLevelDomains=s.SecondLevelDomains.noConflict()),t}return s.URI===this&&(s.URI=i),this},o.build=function(e){return!0===e?this._deferred_build=!0:(void 0===e||this._deferred_build)&&(this._string=r.build(this._parts),this._deferred_build=!1),this},o.clone=function(){return new r(this)},o.valueOf=o.toString=function(){return this.build(!1)._string},o.protocol=w("protocol"),o.username=w("username"),o.password=w("password"),o.hostname=w("hostname"),o.port=w("port"),o.query=S("query","?"),o.fragment=S("fragment","#"),o.search=function(e,t){var n=this.query(e,t);return"string"==typeof n&&n.length?"?"+n:n},o.hash=function(e,t){var n=this.fragment(e,t);return"string"==typeof n&&n.length?"#"+n:n},o.pathname=function(e,t){if(void 0===e||!0===e){var n=this._parts.path||(this._parts.hostname?"/":"");return e?(this._parts.urn?r.decodeUrnPath:r.decodePath)(n):n}return this._parts.urn?this._parts.path=e?r.recodeUrnPath(e):"":this._parts.path=e?r.recodePath(e):"/",this.build(!t),this},o.path=o.pathname,o.href=function(e,t){var n;if(void 0===e)return this.toString();this._string="",this._parts=r._parts();var s=e instanceof r,i="object"==typeof e&&(e.hostname||e.path||e.pathname);e.nodeName&&(e=e[r.getDomAttribute(e)]||"",i=!1);if(!s&&i&&void 0!==e.pathname&&(e=e.toString()),"string"==typeof e||e instanceof String)this._parts=r.parse(String(e),this._parts);else{if(!s&&!i)throw new TypeError("invalid input");var o=s?e._parts:e;for(n in o)"query"!==n&&a.call(this._parts,n)&&(this._parts[n]=o[n]);o.query&&this.query(o.query,!1)}return this.build(!t),this},o.is=function(e){var t=!1,s=!1,i=!1,o=!1,a=!1,c=!1,l=!1,d=!this._parts.urn;switch(this._parts.hostname&&(d=!1,s=r.ip4_expression.test(this._parts.hostname),i=r.ip6_expression.test(this._parts.hostname),a=(o=!(t=s||i))&&n&&n.has(this._parts.hostname),c=o&&r.idn_expression.test(this._parts.hostname),l=o&&r.punycode_expression.test(this._parts.hostname)),e.toLowerCase()){case"relative":return d;case"absolute":return!d;case"domain":case"name":return o;case"sld":return a;case"ip":return t;case"ip4":case"ipv4":case"inet4":return s;case"ip6":case"ipv6":case"inet6":return i;case"idn":return c;case"url":return!this._parts.urn;case"urn":return!!this._parts.urn;case"punycode":return l}return null};var x=o.protocol,E=o.port,A=o.hostname;o.protocol=function(e,t){if(e&&!(e=e.replace(/:(\/\/)?$/,"")).match(r.protocol_expression))throw new TypeError('Protocol "'+e+"\" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]");return x.call(this,e,t)},o.scheme=o.protocol,o.port=function(e,t){return this._parts.urn?void 0===e?"":this:(void 0!==e&&(0===e&&(e=null),e&&(":"===(e+="").charAt(0)&&(e=e.substring(1)),r.ensureValidPort(e))),E.call(this,e,t))},o.hostname=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0!==e){var n={preventInvalidHostname:this._parts.preventInvalidHostname};if("/"!==r.parseHost(e,n))throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-]');e=n.hostname,this._parts.preventInvalidHostname&&r.ensureValidHostname(e,this._parts.protocol)}return A.call(this,e,t)},o.origin=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e){var n=this.protocol();return this.authority()?(n?n+"://":"")+this.authority():""}var s=r(e);return this.protocol(s.protocol()).authority(s.authority()).build(!t),this},o.host=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e)return this._parts.hostname?r.buildHost(this._parts):"";if("/"!==r.parseHost(e,this._parts))throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-]');return this.build(!t),this},o.authority=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e)return this._parts.hostname?r.buildAuthority(this._parts):"";if("/"!==r.parseAuthority(e,this._parts))throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-]');return this.build(!t),this},o.userinfo=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e){var n=r.buildUserinfo(this._parts);return n?n.substring(0,n.length-1):n}return"@"!==e[e.length-1]&&(e+="@"),r.parseUserinfo(e,this._parts),this.build(!t),this},o.resource=function(e,t){var n;return void 0===e?this.path()+this.search()+this.hash():(n=r.parse(e),this._parts.path=n.path,this._parts.query=n.query,this._parts.fragment=n.fragment,this.build(!t),this)},o.subdomain=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var n=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,n)||""}var s=this._parts.hostname.length-this.domain().length,i=this._parts.hostname.substring(0,s),o=new RegExp("^"+c(i));if(e&&"."!==e.charAt(e.length-1)&&(e+="."),-1!==e.indexOf(":"))throw new TypeError("Domains cannot contain colons");return e&&r.ensureValidHostname(e,this._parts.protocol),this._parts.hostname=this._parts.hostname.replace(o,e),this.build(!t),this},o.domain=function(e,t){if(this._parts.urn)return void 0===e?"":this;if("boolean"==typeof e&&(t=e,e=void 0),void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var n=this._parts.hostname.match(/\./g);if(n&&n.length<2)return this._parts.hostname;var s=this._parts.hostname.length-this.tld(t).length-1;return s=this._parts.hostname.lastIndexOf(".",s-1)+1,this._parts.hostname.substring(s)||""}if(!e)throw new TypeError("cannot set domain empty");if(-1!==e.indexOf(":"))throw new TypeError("Domains cannot contain colons");if(r.ensureValidHostname(e,this._parts.protocol),!this._parts.hostname||this.is("IP"))this._parts.hostname=e;else{var i=new RegExp(c(this.domain())+"$");this._parts.hostname=this._parts.hostname.replace(i,e)}return this.build(!t),this},o.tld=function(e,t){if(this._parts.urn)return void 0===e?"":this;if("boolean"==typeof e&&(t=e,e=void 0),void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var s=this._parts.hostname.lastIndexOf("."),i=this._parts.hostname.substring(s+1);return!0!==t&&n&&n.list[i.toLowerCase()]&&n.get(this._parts.hostname)||i}var r;if(!e)throw new TypeError("cannot set TLD empty");if(e.match(/[^a-zA-Z0-9-]/)){if(!n||!n.is(e))throw new TypeError('TLD "'+e+'" contains characters other than [A-Z0-9]');r=new RegExp(c(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(r,e)}else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");r=new RegExp(c(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(r,e)}return this.build(!t),this},o.directory=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e||!0===e){if(!this._parts.path&&!this._parts.hostname)return"";if("/"===this._parts.path)return"/";var n=this._parts.path.length-this.filename().length-1,s=this._parts.path.substring(0,n)||(this._parts.hostname?"/":"");return e?r.decodePath(s):s}var i=this._parts.path.length-this.filename().length,o=this._parts.path.substring(0,i),a=new RegExp("^"+c(o));return this.is("relative")||(e||(e="/"),"/"!==e.charAt(0)&&(e="/"+e)),e&&"/"!==e.charAt(e.length-1)&&(e+="/"),e=r.recodePath(e),this._parts.path=this._parts.path.replace(a,e),this.build(!t),this},o.filename=function(e,t){if(this._parts.urn)return void 0===e?"":this;if("string"!=typeof e){if(!this._parts.path||"/"===this._parts.path)return"";var n=this._parts.path.lastIndexOf("/"),s=this._parts.path.substring(n+1);return e?r.decodePathSegment(s):s}var i=!1;"/"===e.charAt(0)&&(e=e.substring(1)),e.match(/\.?\//)&&(i=!0);var o=new RegExp(c(this.filename())+"$");return e=r.recodePath(e),this._parts.path=this._parts.path.replace(o,e),i?this.normalizePath(t):this.build(!t),this},o.suffix=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e||!0===e){if(!this._parts.path||"/"===this._parts.path)return"";var n,s,i=this.filename(),o=i.lastIndexOf(".");return-1===o?"":(n=i.substring(o+1),s=/^[a-z0-9%]+$/i.test(n)?n:"",e?r.decodePathSegment(s):s)}"."===e.charAt(0)&&(e=e.substring(1));var a,l=this.suffix();if(l)a=e?new RegExp(c(l)+"$"):new RegExp(c("."+l)+"$");else{if(!e)return this;this._parts.path+="."+r.recodePath(e)}return a&&(e=r.recodePath(e),this._parts.path=this._parts.path.replace(a,e)),this.build(!t),this},o.segment=function(e,t,n){var s=this._parts.urn?":":"/",i=this.path(),r="/"===i.substring(0,1),o=i.split(s);if(void 0!==e&&"number"!=typeof e&&(n=t,t=e,e=void 0),void 0!==e&&"number"!=typeof e)throw new Error('Bad segment "'+e+'", must be 0-based integer');if(r&&o.shift(),e<0&&(e=Math.max(o.length+e,0)),void 0===t)return void 0===e?o:o[e];if(null===e||void 0===o[e])if(d(t)){o=[];for(var a=0,c=t.length;a<c;a++)(t[a].length||o.length&&o[o.length-1].length)&&(o.length&&!o[o.length-1].length&&o.pop(),o.push(f(t[a])))}else(t||"string"==typeof t)&&(t=f(t),""===o[o.length-1]?o[o.length-1]=t:o.push(t));else t?o[e]=f(t):o.splice(e,1);return r&&o.unshift(""),this.path(o.join(s),n)},o.segmentCoded=function(e,t,n){var s,i,o;if("number"!=typeof e&&(n=t,t=e,e=void 0),void 0===t){if(d(s=this.segment(e,t,n)))for(i=0,o=s.length;i<o;i++)s[i]=r.decode(s[i]);else s=void 0!==s?r.decode(s):void 0;return s}if(d(t))for(i=0,o=t.length;i<o;i++)t[i]=r.encode(t[i]);else t="string"==typeof t||t instanceof String?r.encode(t):t;return this.segment(e,t,n)};var C=o.query;return o.query=function(e,t){if(!0===e)return r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("function"==typeof e){var n=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace),s=e.call(this,n);return this._parts.query=r.buildQuery(s||n,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!t),this}return void 0!==e&&"string"!=typeof e?(this._parts.query=r.buildQuery(e,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!t),this):C.call(this,e,t)},o.setQuery=function(e,t,n){var s=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("string"==typeof e||e instanceof String)s[e]=void 0!==t?t:null;else{if("object"!=typeof e)throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");for(var i in e)a.call(e,i)&&(s[i]=e[i])}return this._parts.query=r.buildQuery(s,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof e&&(n=t),this.build(!n),this},o.addQuery=function(e,t,n){var s=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return r.addQuery(s,e,void 0===t?null:t),this._parts.query=r.buildQuery(s,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof e&&(n=t),this.build(!n),this},o.removeQuery=function(e,t,n){var s=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return r.removeQuery(s,e,t),this._parts.query=r.buildQuery(s,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof e&&(n=t),this.build(!n),this},o.hasQuery=function(e,t,n){var s=r.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return r.hasQuery(s,e,t,n)},o.setSearch=o.setQuery,o.addSearch=o.addQuery,o.removeSearch=o.removeQuery,o.hasSearch=o.hasQuery,o.normalize=function(){return this._parts.urn?this.normalizeProtocol(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build():this.normalizeProtocol(!1).normalizeHostname(!1).normalizePort(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build()},o.normalizeProtocol=function(e){return"string"==typeof this._parts.protocol&&(this._parts.protocol=this._parts.protocol.toLowerCase(),this.build(!e)),this},o.normalizeHostname=function(n){return this._parts.hostname&&(this.is("IDN")&&e?this._parts.hostname=e.toASCII(this._parts.hostname):this.is("IPv6")&&t&&(this._parts.hostname=t.best(this._parts.hostname)),this._parts.hostname=this._parts.hostname.toLowerCase(),this.build(!n)),this},o.normalizePort=function(e){return"string"==typeof this._parts.protocol&&this._parts.port===r.defaultPorts[this._parts.protocol]&&(this._parts.port=null,this.build(!e)),this},o.normalizePath=function(e){var t,n=this._parts.path;if(!n)return this;if(this._parts.urn)return this._parts.path=r.recodeUrnPath(this._parts.path),this.build(!e),this;if("/"===this._parts.path)return this;var s,i,o="";for("/"!==(n=r.recodePath(n)).charAt(0)&&(t=!0,n="/"+n),"/.."!==n.slice(-3)&&"/."!==n.slice(-2)||(n+="/"),n=n.replace(/(\/(\.\/)+)|(\/\.$)/g,"/").replace(/\/{2,}/g,"/"),t&&(o=n.substring(1).match(/^(\.\.\/)+/)||"")&&(o=o[0]);-1!==(s=n.search(/\/\.\.(\/|$)/));)0!==s?(-1===(i=n.substring(0,s).lastIndexOf("/"))&&(i=s),n=n.substring(0,i)+n.substring(s+3)):n=n.substring(3);return t&&this.is("relative")&&(n=o+n.substring(1)),this._parts.path=n,this.build(!e),this},o.normalizePathname=o.normalizePath,o.normalizeQuery=function(e){return"string"==typeof this._parts.query&&(this._parts.query.length?this.query(r.parseQuery(this._parts.query,this._parts.escapeQuerySpace)):this._parts.query=null,this.build(!e)),this},o.normalizeFragment=function(e){return this._parts.fragment||(this._parts.fragment=null,this.build(!e)),this},o.normalizeSearch=o.normalizeQuery,o.normalizeHash=o.normalizeFragment,o.iso8859=function(){var e=r.encode,t=r.decode;r.encode=escape,r.decode=decodeURIComponent;try{this.normalize()}finally{r.encode=e,r.decode=t}return this},o.unicode=function(){var e=r.encode,t=r.decode;r.encode=p,r.decode=unescape;try{this.normalize()}finally{r.encode=e,r.decode=t}return this},o.readable=function(){var t=this.clone();t.username("").password("").normalize();var n="";if(t._parts.protocol&&(n+=t._parts.protocol+"://"),t._parts.hostname&&(t.is("punycode")&&e?(n+=e.toUnicode(t._parts.hostname),t._parts.port&&(n+=":"+t._parts.port)):n+=t.host()),t._parts.hostname&&t._parts.path&&"/"!==t._parts.path.charAt(0)&&(n+="/"),n+=t.path(!0),t._parts.query){for(var s="",i=0,o=t._parts.query.split("&"),a=o.length;i<a;i++){var c=(o[i]||"").split("=");s+="&"+r.decodeQuery(c[0],this._parts.escapeQuerySpace).replace(/&/g,"%26"),void 0!==c[1]&&(s+="="+r.decodeQuery(c[1],this._parts.escapeQuerySpace).replace(/&/g,"%26"))}n+="?"+s.substring(1)}return n+=r.decodeQuery(t.hash(),!0)},o.absoluteTo=function(e){var t,n,s,i=this.clone(),o=["protocol","username","password","hostname","port"];if(this._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(e instanceof r||(e=new r(e)),i._parts.protocol)return i;if(i._parts.protocol=e._parts.protocol,this._parts.hostname)return i;for(n=0;s=o[n];n++)i._parts[s]=e._parts[s];return i._parts.path?(".."===i._parts.path.substring(-2)&&(i._parts.path+="/"),"/"!==i.path().charAt(0)&&(t=(t=e.directory())||(0===e.path().indexOf("/")?"/":""),i._parts.path=(t?t+"/":"")+i._parts.path,i.normalizePath())):(i._parts.path=e._parts.path,i._parts.query||(i._parts.query=e._parts.query)),i.build(),i},o.relativeTo=function(e){var t,n,s,i,o,a=this.clone().normalize();if(a._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(e=new r(e).normalize(),t=a._parts,n=e._parts,i=a.path(),o=e.path(),"/"!==i.charAt(0))throw new Error("URI is already relative");if("/"!==o.charAt(0))throw new Error("Cannot calculate a URI relative to another relative URI");if(t.protocol===n.protocol&&(t.protocol=null),t.username!==n.username||t.password!==n.password)return a.build();if(null!==t.protocol||null!==t.username||null!==t.password)return a.build();if(t.hostname!==n.hostname||t.port!==n.port)return a.build();if(t.hostname=null,t.port=null,i===o)return t.path="",a.build();if(!(s=r.commonPath(i,o)))return a.build();var c=n.path.substring(s.length).replace(/[^\/]*$/,"").replace(/.*?\//g,"../");return t.path=c+t.path.substring(s.length)||"./",a.build()},o.equals=function(e){var t,n,s,i,o,c=this.clone(),l=new r(e),u={};if(c.normalize(),l.normalize(),c.toString()===l.toString())return!0;if(s=c.query(),i=l.query(),c.query(""),l.query(""),c.toString()!==l.toString())return!1;if(s.length!==i.length)return!1;for(o in t=r.parseQuery(s,this._parts.escapeQuerySpace),n=r.parseQuery(i,this._parts.escapeQuerySpace),t)if(a.call(t,o)){if(d(t[o])){if(!m(t[o],n[o]))return!1}else if(t[o]!==n[o])return!1;u[o]=!0}for(o in n)if(a.call(n,o)&&!u[o])return!1;return!0},o.preventInvalidHostname=function(e){return this._parts.preventInvalidHostname=!!e,this},o.duplicateQueryParameters=function(e){return this._parts.duplicateQueryParameters=!!e,this},o.escapeQuerySpace=function(e){return this._parts.escapeQuerySpace=!!e,this},r}))},7562:function(e,t,n){var s;e=n.nmd(e),function(i){t&&t.nodeType,e&&e.nodeType;var r="object"==typeof n.g&&n.g;r.global!==r&&r.window!==r&&r.self;var o,a=2147483647,c=36,l=1,d=26,u=38,h=700,m=72,f=128,g="-",p=/^xn--/,v=/[^\x20-\x7E]/,y=/[\x2E\u3002\uFF0E\uFF61]/g,_={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},b=c-l,w=Math.floor,S=String.fromCharCode;function x(e){throw new RangeError(_[e])}function E(e,t){for(var n=e.length,s=[];n--;)s[n]=t(e[n]);return s}function A(e,t){var n=e.split("@"),s="";return n.length>1&&(s=n[0]+"@",e=n[1]),s+E((e=e.replace(y,".")).split("."),t).join(".")}function C(e){for(var t,n,s=[],i=0,r=e.length;i<r;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<r?56320==(64512&(n=e.charCodeAt(i++)))?s.push(((1023&t)<<10)+(1023&n)+65536):(s.push(t),i--):s.push(t);return s}function $(e){return E(e,(function(e){var t="";return e>65535&&(t+=S((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=S(e)})).join("")}function k(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function j(e,t,n){var s=0;for(e=n?w(e/h):e>>1,e+=w(e/t);e>b*d>>1;s+=c)e=w(e/b);return w(s+(b+1)*e/(e+u))}function T(e){var t,n,s,i,r,o,u,h,p,v,y,_=[],b=e.length,S=0,E=f,A=m;for((n=e.lastIndexOf(g))<0&&(n=0),s=0;s<n;++s)e.charCodeAt(s)>=128&&x("not-basic"),_.push(e.charCodeAt(s));for(i=n>0?n+1:0;i<b;){for(r=S,o=1,u=c;i>=b&&x("invalid-input"),((h=(y=e.charCodeAt(i++))-48<10?y-22:y-65<26?y-65:y-97<26?y-97:c)>=c||h>w((a-S)/o))&&x("overflow"),S+=h*o,!(h<(p=u<=A?l:u>=A+d?d:u-A));u+=c)o>w(a/(v=c-p))&&x("overflow"),o*=v;A=j(S-r,t=_.length+1,0==r),w(S/t)>a-E&&x("overflow"),E+=w(S/t),S%=t,_.splice(S++,0,E)}return $(_)}function I(e){var t,n,s,i,r,o,u,h,p,v,y,_,b,E,A,$=[];for(_=(e=C(e)).length,t=f,n=0,r=m,o=0;o<_;++o)(y=e[o])<128&&$.push(S(y));for(s=i=$.length,i&&$.push(g);s<_;){for(u=a,o=0;o<_;++o)(y=e[o])>=t&&y<u&&(u=y);for(u-t>w((a-n)/(b=s+1))&&x("overflow"),n+=(u-t)*b,t=u,o=0;o<_;++o)if((y=e[o])<t&&++n>a&&x("overflow"),y==t){for(h=n,p=c;!(h<(v=p<=r?l:p>=r+d?d:p-r));p+=c)A=h-v,E=c-v,$.push(S(k(v+A%E,0))),h=w(A/E);$.push(S(k(h,0))),r=j(n,b,s==i),n=0,++s}++n,++t}return $.join("")}o={version:"1.3.2",ucs2:{decode:C,encode:$},decode:T,encode:I,toASCII:function(e){return A(e,(function(e){return v.test(e)?"xn--"+I(e):e}))},toUnicode:function(e){return A(e,(function(e){return p.test(e)?T(e.slice(4).toLowerCase()):e}))}},void 0===(s=function(){return o}.call(t,n,t,e))||(e.exports=s)}()},3263:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>Mk});var s={};n.r(s),n.d(s,{DOMParser:()=>hr,WebSocket:()=>ur,getDummyXMLDOMDocument:()=>mr});var i={};n.r(i),n.d(i,{addCookies:()=>xr,arrayBufToBase64:()=>br,base64ToArrayBuf:()=>wr,copyElement:()=>Or,createHtml:()=>Nr,default:()=>Wr,escapeNode:()=>Fr,forEachChild:()=>zr,getBareJidFromJid:()=>Gr,getDomainFromJid:()=>qr,getNodeFromJid:()=>Br,getResourceFromJid:()=>Hr,getText:()=>Pr,isTagEqual:()=>Lr,serialize:()=>Dr,stringToArrayBuf:()=>Sr,unescapeNode:()=>Ur,utf16to8:()=>yr,validAttribute:()=>Tr,validCSS:()=>Ir,validTag:()=>jr,xmlElement:()=>kr,xmlGenerator:()=>Ar,xmlHtmlNode:()=>$r,xmlTextNode:()=>Cr,xmlescape:()=>Mr,xmlunescape:()=>Rr,xorArrayBuffers:()=>_r});const r="object"==typeof global&&global&&global.Object===Object&&global;var o="object"==typeof self&&self&&self.Object===Object&&self;const a=r||o||Function("return this")();const c=a.Symbol;var l=Object.prototype,d=l.hasOwnProperty,u=l.toString,h=c?c.toStringTag:void 0;const m=function(e){var t=d.call(e,h),n=e[h];try{e[h]=void 0;var s=!0}catch(e){}var i=u.call(e);return s&&(t?e[h]=n:delete e[h]),i};var f=Object.prototype.toString;const g=function(e){return f.call(e)};var p=c?c.toStringTag:void 0;const v=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":p&&p in Object(e)?m(e):g(e)};const y=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};const _=function(e){if(!y(e))return!1;var t=v(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t};const b=a["__core-js_shared__"];var w,S=(w=/[^.]+$/.exec(b&&b.keys&&b.keys.IE_PROTO||""))?"Symbol(src)_1."+w:"";const x=function(e){return!!S&&S in e};var E=Function.prototype.toString;const A=function(e){if(null!=e){try{return E.call(e)}catch(e){}try{return e+""}catch(e){}}return""};var C=/^\[object .+?Constructor\]$/,$=Function.prototype,k=Object.prototype,j=$.toString,T=k.hasOwnProperty,I=RegExp("^"+j.call(T).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const N=function(e){return!(!y(e)||x(e))&&(_(e)?I:C).test(A(e))};const O=function(e,t){return null==e?void 0:e[t]};const M=function(e,t){var n=O(e,t);return N(n)?n:void 0};const R=function(){try{var e=M(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();const D=function(e,t,n){"__proto__"==t&&R?R(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n};const z=function(e,t){return e===t||e!=e&&t!=t};var L=Object.prototype.hasOwnProperty;const P=function(e,t,n){var s=e[t];L.call(e,t)&&z(s,n)&&(void 0!==n||t in e)||D(e,t,n)};const F=function(e,t,n,s){var i=!n;n||(n={});for(var r=-1,o=t.length;++r<o;){var a=t[r],c=s?s(n[a],e[a],a,n,e):void 0;void 0===c&&(c=e[a]),i?D(n,a,c):P(n,a,c)}return n};const U=function(e,t){for(var n=-1,s=Array(e);++n<e;)s[n]=t(n);return s};const B=function(e){return null!=e&&"object"==typeof e};const q=function(e){return B(e)&&"[object Arguments]"==v(e)};var H=Object.prototype,G=H.hasOwnProperty,W=H.propertyIsEnumerable;const V=q(function(){return arguments}())?q:function(e){return B(e)&&G.call(e,"callee")&&!W.call(e,"callee")};const J=Array.isArray;const Z=function(){return!1};var Q="object"==typeof exports&&exports&&!exports.nodeType&&exports,K=Q&&"object"==typeof module&&module&&!module.nodeType&&module,Y=K&&K.exports===Q?a.Buffer:void 0;const X=(Y?Y.isBuffer:void 0)||Z;var ee=/^(?:0|[1-9]\d*)$/;const te=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&ee.test(e))&&e>-1&&e%1==0&&e<t};const ne=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var se={};se["[object Float32Array]"]=se["[object Float64Array]"]=se["[object Int8Array]"]=se["[object Int16Array]"]=se["[object Int32Array]"]=se["[object Uint8Array]"]=se["[object Uint8ClampedArray]"]=se["[object Uint16Array]"]=se["[object Uint32Array]"]=!0,se["[object Arguments]"]=se["[object Array]"]=se["[object ArrayBuffer]"]=se["[object Boolean]"]=se["[object DataView]"]=se["[object Date]"]=se["[object Error]"]=se["[object Function]"]=se["[object Map]"]=se["[object Number]"]=se["[object Object]"]=se["[object RegExp]"]=se["[object Set]"]=se["[object String]"]=se["[object WeakMap]"]=!1;const ie=function(e){return B(e)&&ne(e.length)&&!!se[v(e)]};const re=function(e){return function(t){return e(t)}};var oe="object"==typeof exports&&exports&&!exports.nodeType&&exports,ae=oe&&"object"==typeof module&&module&&!module.nodeType&&module,ce=ae&&ae.exports===oe&&r.process;const le=function(){try{var e=ae&&ae.require&&ae.require("util").types;return e||ce&&ce.binding&&ce.binding("util")}catch(e){}}();var de=le&&le.isTypedArray;const ue=de?re(de):ie;var he=Object.prototype.hasOwnProperty;const me=function(e,t){var n=J(e),s=!n&&V(e),i=!n&&!s&&X(e),r=!n&&!s&&!i&&ue(e),o=n||s||i||r,a=o?U(e.length,String):[],c=a.length;for(var l in e)!t&&!he.call(e,l)||o&&("length"==l||i&&("offset"==l||"parent"==l)||r&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||te(l,c))||a.push(l);return a};var fe=Object.prototype;const ge=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||fe)};const pe=function(e,t){return function(n){return e(t(n))}};const ve=pe(Object.keys,Object);var ye=Object.prototype.hasOwnProperty;const _e=function(e){if(!ge(e))return ve(e);var t=[];for(var n in Object(e))ye.call(e,n)&&"constructor"!=n&&t.push(n);return t};const be=function(e){return null!=e&&ne(e.length)&&!_(e)};const we=function(e){return be(e)?me(e):_e(e)};const Se=function(e,t){return e&&F(t,we(t),e)};var xe=Object.create,Ee=function(){function e(){}return function(t){if(!y(t))return{};if(xe)return xe(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();const Ae=Ee;const Ce=function(e,t){var n=Ae(e);return null==t?n:Se(n,t)};const $e=function(e){return e};const ke=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)};var je=Math.max;const Te=function(e,t,n){return t=je(void 0===t?e.length-1:t,0),function(){for(var s=arguments,i=-1,r=je(s.length-t,0),o=Array(r);++i<r;)o[i]=s[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=s[i];return a[t]=n(o),ke(e,this,a)}};const Ie=function(e){return function(){return e}};const Ne=R?function(e,t){return R(e,"toString",{configurable:!0,enumerable:!1,value:Ie(t),writable:!0})}:$e;var Oe=Date.now;const Me=function(e){var t=0,n=0;return function(){var s=Oe(),i=16-(s-n);if(n=s,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(Ne);const Re=function(e,t){return Me(Te(e,t,$e),e+"")};const De=function(e,t,n){if(!y(n))return!1;var s=typeof t;return!!("number"==s?be(n)&&te(t,n.length):"string"==s&&t in n)&&z(n[t],e)};const ze=function(e){return Re((function(t,n){var s=-1,i=n.length,r=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(r=e.length>3&&"function"==typeof r?(i--,r):void 0,o&&De(n[0],n[1],o)&&(r=i<3?void 0:r,i=1),t=Object(t);++s<i;){var a=n[s];a&&e(t,a,s,r)}return t}))};const Le=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t};var Pe=Object.prototype.hasOwnProperty;const Fe=function(e){if(!y(e))return Le(e);var t=ge(e),n=[];for(var s in e)("constructor"!=s||!t&&Pe.call(e,s))&&n.push(s);return n};const Ue=function(e){return be(e)?me(e,!0):Fe(e)};const Be=ze((function(e,t){F(t,Ue(t),e)}));var qe=Object.prototype.hasOwnProperty;const He=function(e,t){return null!=e&&qe.call(e,t)};const Ge=function(e){return"symbol"==typeof e||B(e)&&"[object Symbol]"==v(e)};var We=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ve=/^\w*$/;const Je=function(e,t){if(J(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Ge(e))||(Ve.test(e)||!We.test(e)||null!=t&&e in Object(t))};const Ze=M(Object,"create");const Qe=function(){this.__data__=Ze?Ze(null):{},this.size=0};const Ke=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t};var Ye=Object.prototype.hasOwnProperty;const Xe=function(e){var t=this.__data__;if(Ze){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Ye.call(t,e)?t[e]:void 0};var et=Object.prototype.hasOwnProperty;const tt=function(e){var t=this.__data__;return Ze?void 0!==t[e]:et.call(t,e)};const nt=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Ze&&void 0===t?"__lodash_hash_undefined__":t,this};function st(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var s=e[t];this.set(s[0],s[1])}}st.prototype.clear=Qe,st.prototype.delete=Ke,st.prototype.get=Xe,st.prototype.has=tt,st.prototype.set=nt;const it=st;const rt=function(){this.__data__=[],this.size=0};const ot=function(e,t){for(var n=e.length;n--;)if(z(e[n][0],t))return n;return-1};var at=Array.prototype.splice;const ct=function(e){var t=this.__data__,n=ot(t,e);return!(n<0)&&(n==t.length-1?t.pop():at.call(t,n,1),--this.size,!0)};const lt=function(e){var t=this.__data__,n=ot(t,e);return n<0?void 0:t[n][1]};const dt=function(e){return ot(this.__data__,e)>-1};const ut=function(e,t){var n=this.__data__,s=ot(n,e);return s<0?(++this.size,n.push([e,t])):n[s][1]=t,this};function ht(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var s=e[t];this.set(s[0],s[1])}}ht.prototype.clear=rt,ht.prototype.delete=ct,ht.prototype.get=lt,ht.prototype.has=dt,ht.prototype.set=ut;const mt=ht;const ft=M(a,"Map");const gt=function(){this.size=0,this.__data__={hash:new it,map:new(ft||mt),string:new it}};const pt=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};const vt=function(e,t){var n=e.__data__;return pt(t)?n["string"==typeof t?"string":"hash"]:n.map};const yt=function(e){var t=vt(this,e).delete(e);return this.size-=t?1:0,t};const _t=function(e){return vt(this,e).get(e)};const bt=function(e){return vt(this,e).has(e)};const wt=function(e,t){var n=vt(this,e),s=n.size;return n.set(e,t),this.size+=n.size==s?0:1,this};function St(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var s=e[t];this.set(s[0],s[1])}}St.prototype.clear=gt,St.prototype.delete=yt,St.prototype.get=_t,St.prototype.has=bt,St.prototype.set=wt;const xt=St;function Et(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var s=arguments,i=t?t.apply(this,s):s[0],r=n.cache;if(r.has(i))return r.get(i);var o=e.apply(this,s);return n.cache=r.set(i,o)||r,o};return n.cache=new(Et.Cache||xt),n}Et.Cache=xt;const At=Et;const Ct=function(e){var t=At(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t};var $t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,kt=/\\(\\)?/g,jt=Ct((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace($t,(function(e,n,s,i){t.push(s?i.replace(kt,"$1"):n||e)})),t}));const Tt=jt;const It=function(e,t){for(var n=-1,s=null==e?0:e.length,i=Array(s);++n<s;)i[n]=t(e[n],n,e);return i};var Nt=c?c.prototype:void 0,Ot=Nt?Nt.toString:void 0;const Mt=function e(t){if("string"==typeof t)return t;if(J(t))return It(t,e)+"";if(Ge(t))return Ot?Ot.call(t):"";var n=t+"";return"0"==n&&1/t==-Infinity?"-0":n};const Rt=function(e){return null==e?"":Mt(e)};const Dt=function(e,t){return J(e)?e:Je(e,t)?[e]:Tt(Rt(e))};const zt=function(e){if("string"==typeof e||Ge(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};const Lt=function(e,t,n){for(var s=-1,i=(t=Dt(t,e)).length,r=!1;++s<i;){var o=zt(t[s]);if(!(r=null!=e&&n(e,o)))break;e=e[o]}return r||++s!=i?r:!!(i=null==e?0:e.length)&&ne(i)&&te(o,i)&&(J(e)||V(e))};const Pt=function(e,t){return null!=e&&Lt(e,t,He)};const Ft=function(e,t,n){var s=-1,i=(t=Dt(t,e)).length;for(i||(i=1,e=void 0);++s<i;){var r=null==e?void 0:e[zt(t[s])];void 0===r&&(s=i,r=n),e=_(r)?r.call(e):r}return e};function Ut(){return(65536*(1+Math.random())|0).toString(16).substring(1)}function Bt(e,t){const n=this;let s;return s=e&&Pt(e,"constructor")?e.constructor:function(){return n.apply(this,arguments)},Be(s,n,t),s.prototype=Ce(n.prototype,e),s.prototype.constructor=s,s.__super__=n.prototype,s}function qt(){const e={isResolved:!1,isPending:!0,isRejected:!1},t=new Promise(((t,n)=>{e.resolve=t,e.reject=n}));return Object.assign(t,e),t.then((function(e){return t.isResolved=!0,t.isPending=!1,t.isRejected=!1,e}),(function(e){throw t.isResolved=!1,t.isPending=!1,t.isRejected=!0,e})),t}function Ht(){throw new Error('A "url" property or function must be specified')}function Gt(e,t){const n=t.error;t.error=function(s){n&&n.call(t.context,e,s,t),e.trigger("error",e,s,t)}}const Wt={create:"POST",update:"PUT",patch:"PATCH",delete:"DELETE",read:"GET"};function Vt(e){const t=Ft(e,"browserStorage")||Ft(e.collection,"browserStorage");return t?t.sync():Jt}function Jt(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const s={type:Wt[e],dataType:"json"};n.url||(s.url=Ft(t,"url")||Ht()),null!=n.data||!t||"create"!==e&&"update"!==e&&"patch"!==e||(s.contentType="application/json",s.data=JSON.stringify(n.attrs||t.toJSON(n))),"GET"!==s.type&&(s.processData=!1);const i=n.error;n.error=function(e,t,s){n.textStatus=t,n.errorThrown=s,i&&i.call(n.context,e,t,s)};const r=n.xhr=function(){return fetch.apply(this,arguments)}(Be(s,n));return t.trigger("request",t,r,n),r}const Zt=M(a,"DataView");const Qt=M(a,"Promise");const Kt=M(a,"Set");const Yt=M(a,"WeakMap");var Xt="[object Map]",en="[object Promise]",tn="[object Set]",nn="[object WeakMap]",sn="[object DataView]",rn=A(Zt),on=A(ft),an=A(Qt),cn=A(Kt),ln=A(Yt),dn=v;(Zt&&dn(new Zt(new ArrayBuffer(1)))!=sn||ft&&dn(new ft)!=Xt||Qt&&dn(Qt.resolve())!=en||Kt&&dn(new Kt)!=tn||Yt&&dn(new Yt)!=nn)&&(dn=function(e){var t=v(e),n="[object Object]"==t?e.constructor:void 0,s=n?A(n):"";if(s)switch(s){case rn:return sn;case on:return Xt;case an:return en;case cn:return tn;case ln:return nn}return t});const un=dn;var hn=Object.prototype.hasOwnProperty;const mn=function(e){if(null==e)return!0;if(be(e)&&(J(e)||"string"==typeof e||"function"==typeof e.splice||X(e)||ue(e)||V(e)))return!e.length;var t=un(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(ge(e))return!_e(e).length;for(var n in e)if(hn.call(e,n))return!1;return!0};var fn=/\s/;const gn=function(e){for(var t=e.length;t--&&fn.test(e.charAt(t)););return t};var pn=/^\s+/;const vn=function(e){return e?e.slice(0,gn(e)+1).replace(pn,""):e};var yn=/^[-+]0x[0-9a-f]+$/i,_n=/^0b[01]+$/i,bn=/^0o[0-7]+$/i,wn=parseInt;const Sn=function(e){if("number"==typeof e)return e;if(Ge(e))return NaN;if(y(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=y(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=vn(e);var n=_n.test(e);return n||bn.test(e)?wn(e.slice(2),n?2:8):yn.test(e)?NaN:+e};var xn=1/0;const En=function(e){return e?(e=Sn(e))===xn||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0};const An=function(e){var t=En(e),n=t%1;return t==t?n?t-n:t:0};const Cn=function(e,t){var n;if("function"!=typeof t)throw new TypeError("Expected a function");return e=An(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}};const $n=function(e){return Cn(2,e)};var kn=0;const jn=function(e){var t=++kn;return Rt(e)+t},Tn={},In=/\s+/;let Nn;const On=function(e,t,n,s,i){let r,o=0;if(n&&"object"==typeof n){void 0!==s&&"context"in i&&void 0===i.context&&(i.context=s);for(r=we(n);o<r.length;o++)t=On(e,t,r[o],n[r[o]],i)}else if(n&&In.test(n))for(r=n.split(In);o<r.length;o++)t=e(t,r[o],s,i);else t=e(t,n,s,i);return t};Tn.on=function(e,t,n){if(this._events=On(Mn,this._events||{},e,t,{context:n,ctx:this,listening:Nn}),Nn){(this._listeners||(this._listeners={}))[Nn.id]=Nn,Nn.interop=!1}return this},Tn.listenTo=function(e,t,n){if(!e)return this;const s=e._listenId||(e._listenId=jn("l")),i=this._listeningTo||(this._listeningTo={});let r=Nn=i[s];r||(this._listenId||(this._listenId=jn("l")),r=Nn=i[s]=new Fn(this,e));const o=Rn(e,t,n,this);if(Nn=void 0,o)throw o;return r.interop&&r.on(t,n),this};const Mn=function(e,t,n,s){if(n){const i=e[t]||(e[t]=[]),r=s.context,o=s.ctx,a=s.listening;a&&a.count++,i.push({callback:n,context:r,ctx:r||o,listening:a})}return e},Rn=function(e,t,n,s){try{e.on(t,n,s)}catch(e){return e}};Tn.off=function(e,t,n){return this._events?(this._events=On(Dn,this._events,e,t,{context:n,listeners:this._listeners}),this):this},Tn.stopListening=function(e,t,n){const s=this._listeningTo;if(!s)return this;const i=e?[e._listenId]:we(s);for(let e=0;e<i.length;e++){const r=s[i[e]];if(!r)break;r.obj.off(t,n,this),r.interop&&r.off(t,n)}return mn(s)&&(this._listeningTo=void 0),this};const Dn=function(e,t,n,s){if(!e)return;const i=s.context,r=s.listeners;let o,a=0;if(t||i||n){for(o=t?[t]:we(e);a<o.length;a++){const s=e[t=o[a]];if(!s)break;const r=[];for(let e=0;e<s.length;e++){const o=s[e];if(n&&n!==o.callback&&n!==o.callback._callback||i&&i!==o.context)r.push(o);else{const e=o.listening;e&&e.off(t,n)}}r.length?e[t]=r:delete e[t]}return e}for(o=we(r);a<o.length;a++)r[o[a]].cleanup()};Tn.once=function(e,t,n){const s=On(zn,{},e,t,this.off.bind(this));return"string"==typeof e&&null==n&&(t=void 0),this.on(s,t,n)},Tn.listenToOnce=function(e,t,n){const s=On(zn,{},t,n,this.stopListening.bind(this,e));return this.listenTo(e,s)};const zn=function(e,t,n,s){if(n){const i=e[t]=$n((function(){s(t,i),n.apply(this,arguments)}));i._callback=n}return e};Tn.trigger=function(e){if(!this._events)return this;const t=Math.max(0,arguments.length-1),n=Array(t);for(let e=0;e<t;e++)n[e]=arguments[e+1];return On(Ln,this._events,e,void 0,n),this};const Ln=function(e,t,n,s){if(e){const n=e[t];let i=e.all;n&&i&&(i=i.slice()),n&&Pn(n,s),i&&Pn(i,[t].concat(s))}return e},Pn=function(e,t){let n,s=-1;const i=e.length,r=t[0],o=t[1],a=t[2];switch(t.length){case 0:for(;++s<i;)(n=e[s]).callback.call(n.ctx);return;case 1:for(;++s<i;)(n=e[s]).callback.call(n.ctx,r);return;case 2:for(;++s<i;)(n=e[s]).callback.call(n.ctx,r,o);return;case 3:for(;++s<i;)(n=e[s]).callback.call(n.ctx,r,o,a);return;default:for(;++s<i;)(n=e[s]).callback.apply(n.ctx,t);return}},Fn=function(e,t){this.id=e._listenId,this.listener=e,this.obj=t,this.interop=!0,this.count=0,this._events=void 0};Fn.prototype.on=Tn.on,Fn.prototype.off=function(e,t){let n;this.interop?(this._events=On(Dn,this._events,e,t,{context:void 0,listeners:void 0}),n=!this._events):(this.count--,n=0===this.count),n&&this.cleanup()},Fn.prototype.cleanup=function(){delete this.listener._listeningTo[this.obj._listenId],this.interop||delete this.obj._listeners[this.id]},Tn.bind=Tn.on,Tn.unbind=Tn.off;const Un=function(){this.__data__=new mt,this.size=0};const Bn=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n};const qn=function(e){return this.__data__.get(e)};const Hn=function(e){return this.__data__.has(e)};const Gn=function(e,t){var n=this.__data__;if(n instanceof mt){var s=n.__data__;if(!ft||s.length<199)return s.push([e,t]),this.size=++n.size,this;n=this.__data__=new xt(s)}return n.set(e,t),this.size=n.size,this};function Wn(e){var t=this.__data__=new mt(e);this.size=t.size}Wn.prototype.clear=Un,Wn.prototype.delete=Bn,Wn.prototype.get=qn,Wn.prototype.has=Hn,Wn.prototype.set=Gn;const Vn=Wn;const Jn=function(e,t){for(var n=-1,s=null==e?0:e.length;++n<s&&!1!==t(e[n],n,e););return e};const Zn=function(e,t){return e&&F(t,Ue(t),e)};var Qn="object"==typeof exports&&exports&&!exports.nodeType&&exports,Kn=Qn&&"object"==typeof module&&module&&!module.nodeType&&module,Yn=Kn&&Kn.exports===Qn?a.Buffer:void 0,Xn=Yn?Yn.allocUnsafe:void 0;const es=function(e,t){if(t)return e.slice();var n=e.length,s=Xn?Xn(n):new e.constructor(n);return e.copy(s),s};const ts=function(e,t){var n=-1,s=e.length;for(t||(t=Array(s));++n<s;)t[n]=e[n];return t};const ns=function(e,t){for(var n=-1,s=null==e?0:e.length,i=0,r=[];++n<s;){var o=e[n];t(o,n,e)&&(r[i++]=o)}return r};const ss=function(){return[]};var is=Object.prototype.propertyIsEnumerable,rs=Object.getOwnPropertySymbols;const os=rs?function(e){return null==e?[]:(e=Object(e),ns(rs(e),(function(t){return is.call(e,t)})))}:ss;const as=function(e,t){return F(e,os(e),t)};const cs=function(e,t){for(var n=-1,s=t.length,i=e.length;++n<s;)e[i+n]=t[n];return e};const ls=pe(Object.getPrototypeOf,Object);var ds=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)cs(t,os(e)),e=ls(e);return t}:ss;const us=ds;const hs=function(e,t){return F(e,us(e),t)};const ms=function(e,t,n){var s=t(e);return J(e)?s:cs(s,n(e))};const fs=function(e){return ms(e,we,os)};const gs=function(e){return ms(e,Ue,us)};var ps=Object.prototype.hasOwnProperty;const vs=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&ps.call(e,"index")&&(n.index=e.index,n.input=e.input),n};const ys=a.Uint8Array;const _s=function(e){var t=new e.constructor(e.byteLength);return new ys(t).set(new ys(e)),t};const bs=function(e,t){var n=t?_s(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)};var ws=/\w*$/;const Ss=function(e){var t=new e.constructor(e.source,ws.exec(e));return t.lastIndex=e.lastIndex,t};var xs=c?c.prototype:void 0,Es=xs?xs.valueOf:void 0;const As=function(e){return Es?Object(Es.call(e)):{}};const Cs=function(e,t){var n=t?_s(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)};const $s=function(e,t,n){var s=e.constructor;switch(t){case"[object ArrayBuffer]":return _s(e);case"[object Boolean]":case"[object Date]":return new s(+e);case"[object DataView]":return bs(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return Cs(e,n);case"[object Map]":case"[object Set]":return new s;case"[object Number]":case"[object String]":return new s(e);case"[object RegExp]":return Ss(e);case"[object Symbol]":return As(e)}};const ks=function(e){return"function"!=typeof e.constructor||ge(e)?{}:Ae(ls(e))};const js=function(e){return B(e)&&"[object Map]"==un(e)};var Ts=le&&le.isMap;const Is=Ts?re(Ts):js;const Ns=function(e){return B(e)&&"[object Set]"==un(e)};var Os=le&&le.isSet;const Ms=Os?re(Os):Ns;var Rs="[object Arguments]",Ds="[object Function]",zs="[object Object]",Ls={};Ls[Rs]=Ls["[object Array]"]=Ls["[object ArrayBuffer]"]=Ls["[object DataView]"]=Ls["[object Boolean]"]=Ls["[object Date]"]=Ls["[object Float32Array]"]=Ls["[object Float64Array]"]=Ls["[object Int8Array]"]=Ls["[object Int16Array]"]=Ls["[object Int32Array]"]=Ls["[object Map]"]=Ls["[object Number]"]=Ls[zs]=Ls["[object RegExp]"]=Ls["[object Set]"]=Ls["[object String]"]=Ls["[object Symbol]"]=Ls["[object Uint8Array]"]=Ls["[object Uint8ClampedArray]"]=Ls["[object Uint16Array]"]=Ls["[object Uint32Array]"]=!0,Ls["[object Error]"]=Ls[Ds]=Ls["[object WeakMap]"]=!1;const Ps=function e(t,n,s,i,r,o){var a,c=1&n,l=2&n,d=4&n;if(s&&(a=r?s(t,i,r,o):s(t)),void 0!==a)return a;if(!y(t))return t;var u=J(t);if(u){if(a=vs(t),!c)return ts(t,a)}else{var h=un(t),m=h==Ds||"[object GeneratorFunction]"==h;if(X(t))return es(t,c);if(h==zs||h==Rs||m&&!r){if(a=l||m?{}:ks(t),!c)return l?hs(t,Zn(a,t)):as(t,Se(a,t))}else{if(!Ls[h])return r?t:{};a=$s(t,h,c)}}o||(o=new Vn);var f=o.get(t);if(f)return f;o.set(t,a),Ms(t)?t.forEach((function(i){a.add(e(i,n,s,i,t,o))})):Is(t)&&t.forEach((function(i,r){a.set(r,e(i,n,s,r,t,o))}));var g=u?void 0:(d?l?gs:fs:l?Ue:we)(t);return Jn(g||t,(function(i,r){g&&(i=t[r=i]),P(a,r,e(i,n,s,r,t,o))})),a};const Fs=function(e){return Ps(e,4)};var Us=Object.prototype,Bs=Us.hasOwnProperty,qs=Re((function(e,t){e=Object(e);var n=-1,s=t.length,i=s>2?t[2]:void 0;for(i&&De(t[0],t[1],i)&&(s=1);++n<s;)for(var r=t[n],o=Ue(r),a=-1,c=o.length;++a<c;){var l=o[a],d=e[l];(void 0===d||z(d,Us[l])&&!Bs.call(e,l))&&(e[l]=r[l])}return e}));const Hs=qs;const Gs=function(e,t,n){if("function"!=typeof e)throw new TypeError("Expected a function");return setTimeout((function(){e.apply(void 0,n)}),t)};const Ws=Re((function(e,t){return Gs(e,1,t)}));const Vs=function(e){return function(t){return null==e?void 0:e[t]}};const Js=Vs({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});var Zs=/[&<>"']/g,Qs=RegExp(Zs.source);const Ks=function(e){return(e=Rt(e))&&Qs.test(e)?e.replace(Zs,Js):e};const Ys=function(e){return function(t,n,s){for(var i=-1,r=Object(t),o=s(t),a=o.length;a--;){var c=o[e?a:++i];if(!1===n(r[c],c,r))break}return t}};const Xs=Ys();const ei=function(e,t){return e&&Xs(e,t,we)};const ti=function(e,t,n,s){return ei(e,(function(e,i,r){t(s,n(e),i,r)})),s};const ni=function(e,t){return function(n,s){return ti(n,e,t(s),{})}};var si=Object.prototype.toString,ii=ni((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=si.call(t)),e[t]=n}),Ie($e));const ri=ii;const oi=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};const ai=function(e){return this.__data__.has(e)};function ci(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new xt;++t<n;)this.add(e[t])}ci.prototype.add=ci.prototype.push=oi,ci.prototype.has=ai;const li=ci;const di=function(e,t){for(var n=-1,s=null==e?0:e.length;++n<s;)if(t(e[n],n,e))return!0;return!1};const ui=function(e,t){return e.has(t)};const hi=function(e,t,n,s,i,r){var o=1&n,a=e.length,c=t.length;if(a!=c&&!(o&&c>a))return!1;var l=r.get(e),d=r.get(t);if(l&&d)return l==t&&d==e;var u=-1,h=!0,m=2&n?new li:void 0;for(r.set(e,t),r.set(t,e);++u<a;){var f=e[u],g=t[u];if(s)var p=o?s(g,f,u,t,e,r):s(f,g,u,e,t,r);if(void 0!==p){if(p)continue;h=!1;break}if(m){if(!di(t,(function(e,t){if(!ui(m,t)&&(f===e||i(f,e,n,s,r)))return m.push(t)}))){h=!1;break}}else if(f!==g&&!i(f,g,n,s,r)){h=!1;break}}return r.delete(e),r.delete(t),h};const mi=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,s){n[++t]=[s,e]})),n};const fi=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n};var gi=c?c.prototype:void 0,pi=gi?gi.valueOf:void 0;const vi=function(e,t,n,s,i,r,o){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!r(new ys(e),new ys(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return z(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var a=mi;case"[object Set]":var c=1&s;if(a||(a=fi),e.size!=t.size&&!c)return!1;var l=o.get(e);if(l)return l==t;s|=2,o.set(e,t);var d=hi(a(e),a(t),s,i,r,o);return o.delete(e),d;case"[object Symbol]":if(pi)return pi.call(e)==pi.call(t)}return!1};var yi=Object.prototype.hasOwnProperty;const _i=function(e,t,n,s,i,r){var o=1&n,a=fs(e),c=a.length;if(c!=fs(t).length&&!o)return!1;for(var l=c;l--;){var d=a[l];if(!(o?d in t:yi.call(t,d)))return!1}var u=r.get(e),h=r.get(t);if(u&&h)return u==t&&h==e;var m=!0;r.set(e,t),r.set(t,e);for(var f=o;++l<c;){var g=e[d=a[l]],p=t[d];if(s)var v=o?s(p,g,d,t,e,r):s(g,p,d,e,t,r);if(!(void 0===v?g===p||i(g,p,n,s,r):v)){m=!1;break}f||(f="constructor"==d)}if(m&&!f){var y=e.constructor,_=t.constructor;y==_||!("constructor"in e)||!("constructor"in t)||"function"==typeof y&&y instanceof y&&"function"==typeof _&&_ instanceof _||(m=!1)}return r.delete(e),r.delete(t),m};var bi="[object Arguments]",wi="[object Array]",Si="[object Object]",xi=Object.prototype.hasOwnProperty;const Ei=function(e,t,n,s,i,r){var o=J(e),a=J(t),c=o?wi:un(e),l=a?wi:un(t),d=(c=c==bi?Si:c)==Si,u=(l=l==bi?Si:l)==Si,h=c==l;if(h&&X(e)){if(!X(t))return!1;o=!0,d=!1}if(h&&!d)return r||(r=new Vn),o||ue(e)?hi(e,t,n,s,i,r):vi(e,t,c,n,s,i,r);if(!(1&n)){var m=d&&xi.call(e,"__wrapped__"),f=u&&xi.call(t,"__wrapped__");if(m||f){var g=m?e.value():e,p=f?t.value():t;return r||(r=new Vn),i(g,p,n,s,r)}}return!!h&&(r||(r=new Vn),_i(e,t,n,s,i,r))};const Ai=function e(t,n,s,i,r){return t===n||(null==t||null==n||!B(t)&&!B(n)?t!=t&&n!=n:Ei(t,n,s,i,e,r))};const Ci=function(e,t){return Ai(e,t)};const $i=function(e,t,n,s){var i=n.length,r=i,o=!s;if(null==e)return!r;for(e=Object(e);i--;){var a=n[i];if(o&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++i<r;){var c=(a=n[i])[0],l=e[c],d=a[1];if(o&&a[2]){if(void 0===l&&!(c in e))return!1}else{var u=new Vn;if(s)var h=s(l,d,c,e,t,u);if(!(void 0===h?Ai(d,l,3,s,u):h))return!1}}return!0};const ki=function(e){return e==e&&!y(e)};const ji=function(e){for(var t=we(e),n=t.length;n--;){var s=t[n],i=e[s];t[n]=[s,i,ki(i)]}return t};const Ti=function(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}};const Ii=function(e){var t=ji(e);return 1==t.length&&t[0][2]?Ti(t[0][0],t[0][1]):function(n){return n===e||$i(n,e,t)}};const Ni=function(e,t){for(var n=0,s=(t=Dt(t,e)).length;null!=e&&n<s;)e=e[zt(t[n++])];return n&&n==s?e:void 0};const Oi=function(e,t,n){var s=null==e?void 0:Ni(e,t);return void 0===s?n:s};const Mi=function(e,t){return null!=e&&t in Object(e)};const Ri=function(e,t){return null!=e&&Lt(e,t,Mi)};const Di=function(e,t){return Je(e)&&ki(t)?Ti(zt(e),t):function(n){var s=Oi(n,e);return void 0===s&&s===t?Ri(n,e):Ai(t,s,3)}};const zi=function(e){return function(t){return null==t?void 0:t[e]}};const Li=function(e){return function(t){return Ni(t,e)}};const Pi=function(e){return Je(e)?zi(zt(e)):Li(e)};const Fi=function(e){return"function"==typeof e?e:null==e?$e:"object"==typeof e?J(e)?Di(e[0],e[1]):Ii(e):Pi(e)};const Ui=function(e){return Fi("function"==typeof e?e:Ps(e,1))};const Bi=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0};const qi=function(e,t,n){var s=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var r=Array(i);++s<i;)r[s]=e[s+t];return r};const Hi=function(e,t){return t.length<2?e:Ni(e,qi(t,0,-1))};const Gi=function(e,t){return t=Dt(t,e),null==(e=Hi(e,t))||delete e[zt(Bi(t))]};var Wi=Function.prototype,Vi=Object.prototype,Ji=Wi.toString,Zi=Vi.hasOwnProperty,Qi=Ji.call(Object);const Ki=function(e){if(!B(e)||"[object Object]"!=v(e))return!1;var t=ls(e);if(null===t)return!0;var n=Zi.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Ji.call(n)==Qi};const Yi=function(e){return Ki(e)?void 0:e};var Xi=c?c.isConcatSpreadable:void 0;const er=function(e){return J(e)||V(e)||!!(Xi&&e&&e[Xi])};const tr=function e(t,n,s,i,r){var o=-1,a=t.length;for(s||(s=er),r||(r=[]);++o<a;){var c=t[o];n>0&&s(c)?n>1?e(c,n-1,s,i,r):cs(r,c):i||(r[r.length]=c)}return r};const nr=function(e){return(null==e?0:e.length)?tr(e,1):[]};const sr=function(e){return Me(Te(e,void 0,nr),e+"")};var ir=sr((function(e,t){var n={};if(null==e)return n;var s=!1;t=It(t,(function(t){return t=Dt(t,e),s||(s=t.length>1),t})),F(e,gs(e),n),s&&(n=Ps(n,7,Yi));for(var i=t.length;i--;)Gi(n,t[i]);return n}));const rr=ir;const or=function(e,t,n,s){if(!y(e))return e;for(var i=-1,r=(t=Dt(t,e)).length,o=r-1,a=e;null!=a&&++i<r;){var c=zt(t[i]),l=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(i!=o){var d=a[c];void 0===(l=s?s(d,c,a):void 0)&&(l=y(d)?d:te(t[i+1])?[]:{})}P(a,c,l),a=a[c]}return e};const ar=function(e,t,n){for(var s=-1,i=t.length,r={};++s<i;){var o=t[s],a=Ni(e,o);n(a,o)&&or(r,Dt(o,e),a)}return r};const cr=function(e,t){return ar(e,t,(function(t,n){return Ri(e,n)}))};const lr=sr((function(e,t){return null==e?{}:cr(e,t)})),dr=function(e,t){let n=e||{};t||(t={}),this.preinitialize.apply(this,arguments),this.cid=jn(this.cidPrefix),this.attributes={},t.collection&&(this.collection=t.collection),t.parse&&(n=this.parse(n,t)||{});const s=Ft(this,"defaults");n=Hs(Be({},s,n),s),this.set(n,t),this.changed={},this.initialize.apply(this,arguments)};dr.extend=Bt,Object.assign(dr.prototype,Tn,{changed:null,validationError:null,idAttribute:"id",cidPrefix:"c",preinitialize:function(){},initialize:function(){},toJSON:function(e){return Fs(this.attributes)},sync:function(e,t,n){return Vt(this)(e,t,n)},get:function(e){return this.attributes[e]},keys:function(){return Object.keys(this.attributes)},values:function(){return Object.values(this.attributes)},pairs:function(){return this.entries()},entries:function(){return Object.entries(this.attributes)},invert:function(){return ri(this.attributes)},pick:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 1===t.length&&Array.isArray(t[0])&&(t=t[0]),lr(this.attributes,t)},omit:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 1===t.length&&Array.isArray(t[0])&&(t=t[0]),rr(this.attributes,t)},isEmpty:function(){return mn(this.attributes)},escape:function(e){return Ks(this.get(e))},has:function(e){return null!=this.get(e)},matches:function(e){return!!Ui(e,this)(this.attributes)},set:function(e,t,n){if(null==e)return this;let s;if("object"==typeof e?(s=e,n=t):(s={})[e]=t,n||(n={}),!this._validate(s,n))return!1;const i=n.unset,r=n.silent,o=[],a=this._changing;this._changing=!0,a||(this._previousAttributes=Fs(this.attributes),this.changed={});const c=this.attributes,l=this.changed,d=this._previousAttributes;for(const e in s)t=s[e],Ci(c[e],t)||o.push(e),Ci(d[e],t)?delete l[e]:l[e]=t,i?delete c[e]:c[e]=t;if(this.idAttribute in s&&(this.id=this.get(this.idAttribute)),!r){o.length&&(this._pending=n);for(let e=0;e<o.length;e++)this.trigger("change:"+o[e],this,c[o[e]],n)}if(a)return this;if(!r)for(;this._pending;)n=this._pending,this._pending=!1,this.trigger("change",this,n);return this._pending=!1,this._changing=!1,this},unset:function(e,t){return this.set(e,void 0,Be({},t,{unset:!0}))},clear:function(e){const t={};for(const e in this.attributes)t[e]=void 0;return this.set(t,Be({},e,{unset:!0}))},hasChanged:function(e){return null==e?!mn(this.changed):Pt(this.changed,e)},changedAttributes:function(e){if(!e)return!!this.hasChanged()&&Fs(this.changed);const t=this._changing?this._previousAttributes:this.attributes,n={};let s;for(const i in e){const r=e[i];Ci(t[i],r)||(n[i]=r,s=!0)}return!!s&&n},previous:function(e){return null!=e&&this._previousAttributes?this._previousAttributes[e]:null},previousAttributes:function(){return Fs(this._previousAttributes)},fetch:function(e){e=Be({parse:!0},e);const t=this,n=e.success;return e.success=function(s){const i=e.parse?t.parse(s,e):s;if(!t.set(i,e))return!1;n&&n.call(e.context,t,s,e),t.trigger("sync",t,s,e)},Gt(this,e),this.sync("read",this,e)},save:function(e,t,n){let s;null==e||"object"==typeof e?(s=e,n=t):(s={})[e]=t;const i=(n=Be({validate:!0,parse:!0},n)).wait,r=n.promise,o=r&&qt();if(s&&!i){if(!this.set(s,n))return!1}else if(!this._validate(s,n))return!1;const a=this,c=n.success,l=n.error,d=this.attributes;n.success=function(e){a.attributes=d;let t=n.parse?a.parse(e,n):e;if(i&&(t=Be({},s,t)),t&&!a.set(t,n))return!1;c&&c.call(n.context,a,e,n),a.trigger("sync",a,e,n),r&&o.resolve()},n.error=function(e,t,n){l&&l.call(n.context,e,t,n),r&&o.reject(t)},Gt(this,n),s&&i&&(this.attributes=Be({},d,s));const u=this.isNew()?"create":n.patch?"patch":"update";"patch"!==u||n.attrs||(n.attrs=s);const h=this.sync(u,this,n);return this.attributes=d,r?o:h},destroy:function(e){e=e?Fs(e):{};const t=this,n=e.success,s=e.wait,i=function(){t.stopListening(),t.trigger("destroy",t,t.collection,e)};e.success=function(r){s&&i(),n&&n.call(e.context,t,r,e),t.isNew()||t.trigger("sync",t,r,e)};let r=!1;return this.isNew()?Ws(e.success):(Gt(this,e),r=this.sync("delete",this,e)),s||i(),r},url:function(){const e=Ft(this,"urlRoot")||Ft(this.collection,"url")||Ht();if(this.isNew())return e;const t=this.get(this.idAttribute);return e.replace(/[^\/]$/,"$&/")+encodeURIComponent(t)},parse:function(e,t){return e},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return!this.has(this.idAttribute)},isValid:function(e){return this._validate({},Be({},e,{validate:!0}))},_validate:function(e,t){if(!t.validate||!this.validate)return!0;e=Be({},this.attributes,e);const n=this.validationError=this.validate(e,t)||null;return!n||(this.trigger("invalid",this,n,Be(t,{validationError:n})),!1)}});const ur=window.WebSocket,hr=window.DOMParser;function mr(){return document.implementation.createDocument("jabber:client","strophe",null)}const fr={HTTPBIND:"http://jabber.org/protocol/httpbind",BOSH:"urn:xmpp:xbosh",CLIENT:"jabber:client",AUTH:"jabber:iq:auth",ROSTER:"jabber:iq:roster",PROFILE:"jabber:iq:profile",DISCO_INFO:"http://jabber.org/protocol/disco#info",DISCO_ITEMS:"http://jabber.org/protocol/disco#items",MUC:"http://jabber.org/protocol/muc",SASL:"urn:ietf:params:xml:ns:xmpp-sasl",STREAM:"http://etherx.jabber.org/streams",FRAMING:"urn:ietf:params:xml:ns:xmpp-framing",BIND:"urn:ietf:params:xml:ns:xmpp-bind",SESSION:"urn:ietf:params:xml:ns:xmpp-session",VERSION:"jabber:iq:version",STANZAS:"urn:ietf:params:xml:ns:xmpp-stanzas",XHTML_IM:"http://jabber.org/protocol/xhtml-im",XHTML:"http://www.w3.org/1999/xhtml"},gr={tags:["a","blockquote","br","cite","em","img","li","ol","p","span","strong","ul","body"],attributes:{a:["href"],blockquote:["style"],br:[],cite:["style"],em:[],img:["src","alt","style","height","width"],li:["style"],ol:["style"],p:["style"],span:["style"],strong:[],ul:["style"],body:[]},css:["background-color","color","font-family","font-size","font-style","font-weight","margin-left","margin-right","text-align","text-decoration"]},pr={ERROR:0,CONNECTING:1,CONNFAIL:2,AUTHENTICATING:3,AUTHFAIL:4,CONNECTED:5,DISCONNECTED:6,DISCONNECTING:7,ATTACHED:8,REDIRECT:9,CONNTIMEOUT:10,BINDREQUIRED:11,ATTACHFAIL:12},vr={NORMAL:1,TEXT:3,CDATA:4,FRAGMENT:11};function yr(e){let t="";const n=e.length;for(let s=0;s<n;s++){const n=e.charCodeAt(s);n>=0&&n<=127?t+=e.charAt(s):n>2047?(t+=String.fromCharCode(224|n>>12&15),t+=String.fromCharCode(128|n>>6&63),t+=String.fromCharCode(128|n>>0&63)):(t+=String.fromCharCode(192|n>>6&31),t+=String.fromCharCode(128|n>>0&63))}return t}function _r(e,t){const n=new Uint8Array(e),s=new Uint8Array(t),i=new Uint8Array(e.byteLength);for(let t=0;t<e.byteLength;t++)i[t]=n[t]^s[t];return i.buffer}function br(e){let t="";const n=new Uint8Array(e),s=n.byteLength;for(let e=0;e<s;e++)t+=String.fromCharCode(n[e]);return btoa(t)}function wr(e){return Uint8Array.from(atob(e),(e=>e.charCodeAt(0)))?.buffer}function Sr(e){return new TextEncoder("utf-8").encode(e).buffer}function xr(e){"undefined"==typeof document&&so.log(so.LogLevel.ERROR,"addCookies: not adding any cookies, since there's no document object"),e=e||{};for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n="",s="",i="";const r=e[t],o="object"==typeof r,a=escape(unescape(o?r.value:r));o&&(n=r.expires?";expires="+r.expires:"",s=r.domain?";domain="+r.domain:"",i=r.path?";path="+r.path:""),document.cookie=t+"="+a+n+s+i}}let Er=null;function Ar(){return Er||(Er=mr()),Er}function Cr(e){return Ar().createTextNode(e)}function $r(e){let t;if(hr){t=(new hr).parseFromString(e,"text/xml")}else t=new ActiveXObject("Microsoft.XMLDOM"),t.async="false",t.loadXML(e);return t}function kr(e){if(!e)return null;const t=Ar().createElement(e);for(let e=1;e<arguments.length;e++){const n=arguments[e];if(n)if("string"==typeof n||"number"==typeof n)t.appendChild(Cr(n));else if("object"==typeof n&&"function"==typeof n.sort)for(let e=0;e<n.length;e++){const s=n[e];"object"==typeof s&&"function"==typeof s.sort&&void 0!==s[1]&&null!==s[1]&&t.setAttribute(s[0],s[1])}else if("object"==typeof n)for(const e in n)Object.prototype.hasOwnProperty.call(n,e)&&void 0!==n[e]&&null!==n[e]&&t.setAttribute(e,n[e])}return t}function jr(e){for(let t=0;t<gr.tags.length;t++)if(e===gr.tags[t])return!0;return!1}function Tr(e,t){if(void 0!==gr.attributes[e]&&gr.attributes[e].length>0)for(let n=0;n<gr.attributes[e].length;n++)if(t===gr.attributes[e][n])return!0;return!1}function Ir(e){for(let t=0;t<gr.css.length;t++)if(e===gr.css[t])return!0;return!1}function Nr(e){let t;if(e.nodeType===vr.NORMAL){const n=e.nodeName.toLowerCase();if(jr(n))try{t=kr(n);for(let s=0;s<gr.attributes[n].length;s++){const i=gr.attributes[n][s];let r=e.getAttribute(i);if(null!=r&&""!==r&&!1!==r&&0!==r)if("style"===i&&"object"==typeof r&&void 0!==r.cssText&&(r=r.cssText),"style"===i){const e=[],n=r.split(";");for(let t=0;t<n.length;t++){const s=n[t].split(":"),i=s[0].replace(/^\s*/,"").replace(/\s*$/,"").toLowerCase();if(Ir(i)){const t=s[1].replace(/^\s*/,"").replace(/\s*$/,"");e.push(i+": "+t)}}e.length>0&&(r=e.join("; "),t.setAttribute(i,r))}else t.setAttribute(i,r)}for(let n=0;n<e.childNodes.length;n++)t.appendChild(Nr(e.childNodes[n]))}catch(e){t=Cr("")}else{t=Ar().createDocumentFragment();for(let n=0;n<e.childNodes.length;n++)t.appendChild(Nr(e.childNodes[n]))}}else if(e.nodeType===vr.FRAGMENT){t=Ar().createDocumentFragment();for(let n=0;n<e.childNodes.length;n++)t.appendChild(Nr(e.childNodes[n]))}else e.nodeType===vr.TEXT&&(t=Cr(e.nodeValue));return t}function Or(e){let t;if(e.nodeType===vr.NORMAL){t=kr(e.tagName);for(let n=0;n<e.attributes.length;n++)t.setAttribute(e.attributes[n].nodeName,e.attributes[n].value);for(let n=0;n<e.childNodes.length;n++)t.appendChild(Or(e.childNodes[n]))}else e.nodeType===vr.TEXT&&(t=Ar().createTextNode(e.nodeValue));return t}function Mr(e){return e=(e=(e=(e=(e=e.replace(/\&/g,"&amp;")).replace(/</g,"&lt;")).replace(/>/g,"&gt;")).replace(/'/g,"&apos;")).replace(/"/g,"&quot;")}function Rr(e){return e=(e=(e=(e=(e=e.replace(/\&amp;/g,"&")).replace(/&lt;/g,"<")).replace(/&gt;/g,">")).replace(/&apos;/g,"'")).replace(/&quot;/g,'"')}function Dr(e){if(!e)return null;"function"==typeof e.tree&&(e=e.tree());const t=[...Array(e.attributes.length).keys()].map((t=>e.attributes[t].nodeName));t.sort();let n=t.reduce(((t,n)=>`${t} ${n}="${Mr(e.attributes.getNamedItem(n).value)}"`),`<${e.nodeName}`);if(e.childNodes.length>0){n+=">";for(let t=0;t<e.childNodes.length;t++){const s=e.childNodes[t];switch(s.nodeType){case vr.NORMAL:n+=Dr(s);break;case vr.TEXT:n+=Mr(s.nodeValue);break;case vr.CDATA:n+="<![CDATA["+s.nodeValue+"]]>"}}n+="</"+e.nodeName+">"}else n+="/>";return n}function zr(e,t,n){for(let s=0;s<e.childNodes.length;s++){const i=e.childNodes[s];i.nodeType!==vr.NORMAL||t&&!this.isTagEqual(i,t)||n(i)}}function Lr(e,t){return e.tagName===t}function Pr(e){if(!e)return null;let t="";e.childNodes?.length||e.nodeType!==vr.TEXT||(t+=e.nodeValue);for(let n=0;n<e.childNodes?.length;n++)e.childNodes[n].nodeType===vr.TEXT&&(t+=e.childNodes[n].nodeValue);return Mr(t)}function Fr(e){return"string"!=typeof e?e:e.replace(/^\s+|\s+$/g,"").replace(/\\/g,"\\5c").replace(/ /g,"\\20").replace(/\"/g,"\\22").replace(/\&/g,"\\26").replace(/\'/g,"\\27").replace(/\//g,"\\2f").replace(/:/g,"\\3a").replace(/</g,"\\3c").replace(/>/g,"\\3e").replace(/@/g,"\\40")}function Ur(e){return"string"!=typeof e?e:e.replace(/\\20/g," ").replace(/\\22/g,'"').replace(/\\26/g,"&").replace(/\\27/g,"'").replace(/\\2f/g,"/").replace(/\\3a/g,":").replace(/\\3c/g,"<").replace(/\\3e/g,">").replace(/\\40/g,"@").replace(/\\5c/g,"\\")}function Br(e){return e.indexOf("@")<0?null:e.split("@")[0]}function qr(e){const t=Gr(e);if(t.indexOf("@")<0)return t;{const e=t.split("@");return e.splice(0,1),e.join("@")}}function Hr(e){if(!e)return null;const t=e.split("/");return t.length<2?null:(t.splice(0,1),t.join("/"))}function Gr(e){return e?e.split("/")[0]:null}const Wr={utf16to8:yr,xorArrayBuffers:_r,arrayBufToBase64:br,base64ToArrayBuf:wr,stringToArrayBuf:Sr,addCookies:xr};function Vr(e,t){return new Kr(e,t)}function Jr(e){return new Kr("message",e)}function Zr(e){return new Kr("iq",e)}function Qr(e){return new Kr("presence",e)}class Kr{constructor(e,t){"presence"!==e&&"message"!==e&&"iq"!==e||(t&&!t.xmlns?t.xmlns=fr.CLIENT:t||(t={xmlns:fr.CLIENT})),this.nodeTree=kr(e,t),this.node=this.nodeTree}tree(){return this.nodeTree}toString(){return Dr(this.nodeTree)}up(){return this.node=this.node.parentNode,this}root(){return this.node=this.nodeTree,this}attrs(e){for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(void 0===e[t]?this.node.removeAttribute(t):this.node.setAttribute(t,e[t]));return this}c(e,t,n){const s=kr(e,t,n);return this.node.appendChild(s),"string"!=typeof n&&"number"!=typeof n&&(this.node=s),this}cnode(e){let t;const n=Ar();try{t=void 0!==n.importNode}catch(e){t=!1}const s=t?n.importNode(e,!0):Or(e);return this.node.appendChild(s),this.node=s,this}t(e){const t=Cr(e);return this.node.appendChild(t),this}h(e){const t=Ar().createElement("body");t.innerHTML=e;const n=Nr(t);for(;n.childNodes.length>0;)this.node.appendChild(n.childNodes[0]);return this}}class Yr{constructor(e,t,n,s,i,r,o){this.handler=e,this.ns=t,this.name=n,this.type=s,this.id=i,this.options=o||{matchBareFromJid:!1,ignoreNamespaceFragment:!1},this.options.matchBare&&(so.warn('The "matchBare" option is deprecated, use "matchBareFromJid" instead.'),this.options.matchBareFromJid=this.options.matchBare,delete this.options.matchBare),this.options.matchBareFromJid?this.from=r?Gr(r):null:this.from=r,this.user=!0}getNamespace(e){let t=e.getAttribute("xmlns");return t&&this.options.ignoreNamespaceFragment&&(t=t.split("#")[0]),t}namespaceMatch(e){let t=!1;return!this.ns||(zr(e,null,(e=>{this.getNamespace(e)===this.ns&&(t=!0)})),t||this.getNamespace(e)===this.ns)}isMatch(e){let t=e.getAttribute("from");this.options.matchBareFromJid&&(t=Gr(t));const n=e.getAttribute("type");return!(!this.namespaceMatch(e)||this.name&&!so.isTagEqual(e,this.name)||this.type&&(Array.isArray(this.type)?-1===this.type.indexOf(n):n!==this.type)||this.id&&e.getAttribute("id")!==this.id||this.from&&t!==this.from)}run(e){let t=null;try{t=this.handler(e)}catch(e){throw so._handleError(e),e}return t}toString(){return"{Handler: "+this.handler+"("+this.name+","+this.id+","+this.ns+")}"}}class Xr{constructor(e,t){this.period=e,this.handler=t,this.lastCalled=(new Date).getTime(),this.user=!0}run(){return this.lastCalled=(new Date).getTime(),this.handler()}reset(){this.lastCalled=(new Date).getTime()}toString(){return"{TimedHandler: "+this.handler+"("+this.period+")}"}}var eo=n(7609);class to{constructor(e,t,n){this.mechname=e,this.isClientFirst=t,this.priority=n}test(){return!0}onStart(e){this._connection=e}onChallenge(e,t){throw new Error("You should implement challenge handling!")}clientChallenge(e){if(!this.isClientFirst)throw new Error("clientChallenge should not be called if isClientFirst is false!");return this.onChallenge(e)}onFailure(){this._connection=null}onSuccess(){this._connection=null}}const no={async scramResponse(e,t,n,s){const i=e._sasl_data.cnonce,r=function(e){let t,n,s;const i=/([a-z]+)=([^,]+)(,|$)/;for(;e.match(i);){const r=e.match(i);switch(e=e.replace(r[0],""),r[1]){case"r":t=r[2];break;case"s":n=Wr.base64ToArrayBuf(r[2]);break;case"i":s=parseInt(r[2],10);break;default:return}}if(isNaN(s)||s<4096)so.warn("Failing SCRAM authentication because server supplied iteration count < 4096.");else{if(n)return{nonce:t,salt:n,iter:s};so.warn("Failing SCRAM authentication because server supplied incorrect salt.")}}(t);if(!r&&r?.nonce.slice(0,i.length)!==i)return so.warn("Failing SCRAM authentication because server supplied incorrect nonce."),e._sasl_data={},e._sasl_failure_cb();let o,a;if(e.pass?.name===n&&e.pass?.salt===Wr.arrayBufToBase64(r.salt)&&e.pass?.iter===r.iter)o=Wr.base64ToArrayBuf(e.pass.ck),a=Wr.base64ToArrayBuf(e.pass.sk);else{if(!("string"==typeof e.pass||e.pass instanceof String))return e._sasl_failure_cb();{const t=await async function(e,t,n,s,i){const r=await crypto.subtle.deriveBits({name:"PBKDF2",salt:t,iterations:n,hash:{name:s}},await crypto.subtle.importKey("raw",Wr.stringToArrayBuf(e),"PBKDF2",!1,["deriveBits"]),i),o=await crypto.subtle.importKey("raw",r,{name:"HMAC",hash:s},!1,["sign"]);return{ck:await crypto.subtle.sign("HMAC",o,Wr.stringToArrayBuf("Client Key")),sk:await crypto.subtle.sign("HMAC",o,Wr.stringToArrayBuf("Server Key"))}}(e.pass,r.salt,r.iter,n,s);o=t.ck,a=t.sk}}const c=e._sasl_data["client-first-message-bare"],l=t,d=`c=biws,r=${r.nonce}`,u=`${c},${l},${d}`,h=await async function(e,t,n){const s=await crypto.subtle.importKey("raw",await crypto.subtle.digest(n,t),{name:"HMAC",hash:n},!1,["sign"]),i=await crypto.subtle.sign("HMAC",s,Wr.stringToArrayBuf(e));return Wr.xorArrayBuffers(t,i)}(u,o,n),m=await async function(e,t,n){const s=await crypto.subtle.importKey("raw",t,{name:"HMAC",hash:n},!1,["sign"]);return crypto.subtle.sign("HMAC",s,Wr.stringToArrayBuf(e))}(u,a,n);return e._sasl_data["server-signature"]=Wr.arrayBufToBase64(m),e._sasl_data.keys={name:n,iter:r.iter,salt:Wr.arrayBufToBase64(r.salt),ck:Wr.arrayBufToBase64(o),sk:Wr.arrayBufToBase64(a)},`${d},p=${Wr.arrayBufToBase64(h)}`},clientChallenge(e,t){const n=t||function(){const e=new Uint8Array(16);return Wr.arrayBufToBase64(crypto.getRandomValues(e).buffer)}(),s=`n=${e.authcid},r=${n}`;return e._sasl_data.cnonce=n,e._sasl_data["client-first-message-bare"]=s,`n,,${s}`}};const so={VERSION:"1.6.1",Builder:Kr,Connection:class{constructor(e,t){this.service=e,this.options=t||{},this.setProtocol(),this.jid="",this.domain=null,this.features=null,this._sasl_data={},this.do_bind=!1,this.do_session=!1,this.mechanisms={},this.timedHandlers=[],this.handlers=[],this.removeTimeds=[],this.removeHandlers=[],this.addTimeds=[],this.addHandlers=[],this.protocolErrorHandlers={HTTP:{},websocket:{}},this._idleTimeout=null,this._disconnectTimeout=null,this.authenticated=!1,this.connected=!1,this.disconnecting=!1,this.do_authentication=!0,this.paused=!1,this.restored=!1,this._data=[],this._uniqueId=0,this._sasl_success_handler=null,this._sasl_failure_handler=null,this._sasl_challenge_handler=null,this.maxRetries=5,this._idleTimeout=setTimeout((()=>this._onIdle()),100),xr(this.options.cookies),this.registerSASLMechanisms(this.options.mechanisms),this.iqFallbackHandler=new Yr((e=>this.send(Zr({type:"error",id:e.getAttribute("id")}).c("error",{type:"cancel"}).c("service-unavailable",{xmlns:so.NS.STANZAS}))),null,"iq",["get","set"]);for(const e in so._connectionPlugins)if(Object.prototype.hasOwnProperty.call(so._connectionPlugins,e)){const t=function(){};t.prototype=so._connectionPlugins[e],this[e]=new t,this[e].init(this)}}setProtocol(){const e=this.options.protocol||"";this.options.worker?this._proto=new so.WorkerWebsocket(this):0===this.service.indexOf("ws:")||0===this.service.indexOf("wss:")||0===e.indexOf("ws")?this._proto=new so.Websocket(this):this._proto=new so.Bosh(this)}reset(){this._proto._reset(),this.do_session=!1,this.do_bind=!1,this.timedHandlers=[],this.handlers=[],this.removeTimeds=[],this.removeHandlers=[],this.addTimeds=[],this.addHandlers=[],this.authenticated=!1,this.connected=!1,this.disconnecting=!1,this.restored=!1,this._data=[],this._requests=[],this._uniqueId=0}pause(){this.paused=!0}resume(){this.paused=!1}getUniqueId(e){const t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}));return"string"==typeof e||"number"==typeof e?t+":"+e:t+""}addProtocolErrorHandler(e,t,n){this.protocolErrorHandlers[e][t]=n}connect(e,t,n,s,i,r,o){let a=arguments.length>7&&void 0!==arguments[7]?arguments[7]:3e3;this.jid=e,this.authzid=so.getBareJidFromJid(this.jid),this.authcid=o||so.getNodeFromJid(this.jid),this.pass=t,this.scram_keys=null,this.connect_callback=n,this.disconnecting=!1,this.connected=!1,this.authenticated=!1,this.restored=!1,this.disconnection_timeout=a,this.domain=so.getDomainFromJid(this.jid),this._changeConnectStatus(pr.CONNECTING,null),this._proto._connect(s,i,r)}attach(e,t,n,s,i,r,o){if(this._proto._attach)return this._proto._attach(e,t,n,s,i,r,o);{const e=new Error('The "attach" method is not available for your connection protocol');throw e.name="StropheSessionError",e}}restore(e,t,n,s,i){if(!this._sessionCachingSupported()){const e=new Error('The "restore" method can only be used with a BOSH connection.');throw e.name="StropheSessionError",e}this._proto._restore(e,t,n,s,i)}_sessionCachingSupported(){if(this._proto instanceof so.Bosh){if(!JSON)return!1;try{sessionStorage.setItem("_strophe_","_strophe_"),sessionStorage.removeItem("_strophe_")}catch(e){return!1}return!0}return!1}xmlInput(e){}xmlOutput(e){}rawInput(e){}rawOutput(e){}nextValidRid(e){}send(e){if(null!==e){if("function"==typeof e.sort)for(let t=0;t<e.length;t++)this._queueData(e[t]);else"function"==typeof e.tree?this._queueData(e.tree()):this._queueData(e);this._proto._send()}}flush(){clearTimeout(this._idleTimeout),this._onIdle()}sendPresence(e,t,n,s){let i=null;"function"==typeof e.tree&&(e=e.tree());let r=e.getAttribute("id");if(r||(r=this.getUniqueId("sendPresence"),e.setAttribute("id",r)),"function"==typeof t||"function"==typeof n){const e=this.addHandler((e=>{i&&this.deleteTimedHandler(i),"error"===e.getAttribute("type")?n&&n(e):t&&t(e)}),null,"presence",null,r);s&&(i=this.addTimedHandler(s,(()=>(this.deleteHandler(e),n&&n(null),!1))))}return this.send(e),r}sendIQ(e,t,n,s){let i=null;"function"==typeof e.tree&&(e=e.tree());let r=e.getAttribute("id");if(r||(r=this.getUniqueId("sendIQ"),e.setAttribute("id",r)),"function"==typeof t||"function"==typeof n){const e=this.addHandler((e=>{i&&this.deleteTimedHandler(i);const s=e.getAttribute("type");if("result"===s)t&&t(e);else{if("error"!==s){const e=new Error(`Got bad IQ type of ${s}`);throw e.name="StropheError",e}n&&n(e)}}),null,"iq",["error","result"],r);s&&(i=this.addTimedHandler(s,(()=>(this.deleteHandler(e),n&&n(null),!1))))}return this.send(e),r}_queueData(e){if(null===e||!e.tagName||!e.childNodes){const e=new Error("Cannot queue non-DOMElement.");throw e.name="StropheError",e}this._data.push(e)}_sendRestart(){this._data.push("restart"),this._proto._sendRestart(),this._idleTimeout=setTimeout((()=>this._onIdle()),100)}addTimedHandler(e,t){const n=new so.TimedHandler(e,t);return this.addTimeds.push(n),n}deleteTimedHandler(e){this.removeTimeds.push(e)}addHandler(e,t,n,s,i,r,o){const a=new Yr(e,t,n,s,i,r,o);return this.addHandlers.push(a),a}deleteHandler(e){this.removeHandlers.push(e);const t=this.addHandlers.indexOf(e);t>=0&&this.addHandlers.splice(t,1)}registerSASLMechanisms(e){this.mechanisms={},(e=e||[so.SASLAnonymous,so.SASLExternal,so.SASLOAuthBearer,so.SASLXOAuth2,so.SASLPlain,so.SASLSHA1,so.SASLSHA256,so.SASLSHA384,so.SASLSHA512]).forEach((e=>this.registerSASLMechanism(e)))}registerSASLMechanism(e){const t=new e;this.mechanisms[t.mechname]=t}disconnect(e){if(this._changeConnectStatus(pr.DISCONNECTING,e),e?so.warn("Disconnect was called because: "+e):so.info("Disconnect was called"),this.connected){let e=!1;this.disconnecting=!0,this.authenticated&&(e=Qr({xmlns:so.NS.CLIENT,type:"unavailable"})),this._disconnectTimeout=this._addSysTimedHandler(this.disconnection_timeout,this._onDisconnectTimeout.bind(this)),this._proto._disconnect(e)}else so.warn("Disconnect was called before Strophe connected to the server"),this._proto._abortAllRequests(),this._doDisconnect()}_changeConnectStatus(e,t,n){for(const n in so._connectionPlugins)if(Object.prototype.hasOwnProperty.call(so._connectionPlugins,n)){const s=this[n];if(s.statusChanged)try{s.statusChanged(e,t)}catch(e){so.error(`${n} plugin caused an exception changing status: ${e}`)}}if(this.connect_callback)try{this.connect_callback(e,t,n)}catch(e){so._handleError(e),so.error(`User connection callback caused an exception: ${e}`)}}_doDisconnect(e){"number"==typeof this._idleTimeout&&clearTimeout(this._idleTimeout),null!==this._disconnectTimeout&&(this.deleteTimedHandler(this._disconnectTimeout),this._disconnectTimeout=null),so.debug("_doDisconnect was called"),this._proto._doDisconnect(),this.authenticated=!1,this.disconnecting=!1,this.restored=!1,this.handlers=[],this.timedHandlers=[],this.removeTimeds=[],this.removeHandlers=[],this.addTimeds=[],this.addHandlers=[],this._changeConnectStatus(pr.DISCONNECTED,e),this.connected=!1}_dataRecv(e,t){const n=this._proto._reqToData(e);if(null===n)return;for(this.xmlInput!==so.Connection.prototype.xmlInput&&(n.nodeName===this._proto.strip&&n.childNodes.length?this.xmlInput(n.childNodes[0]):this.xmlInput(n)),this.rawInput!==so.Connection.prototype.rawInput&&(t?this.rawInput(t):this.rawInput(so.serialize(n)));this.removeHandlers.length>0;){const e=this.removeHandlers.pop(),t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}for(;this.addHandlers.length>0;)this.handlers.push(this.addHandlers.pop());if(this.disconnecting&&this._proto._emptyQueue())return void this._doDisconnect();const s=n.getAttribute("type");if(null!==s&&"terminate"===s){if(this.disconnecting)return;let e=n.getAttribute("condition");const t=n.getElementsByTagName("conflict");return null!==e?("remote-stream-error"===e&&t.length>0&&(e="conflict"),this._changeConnectStatus(pr.CONNFAIL,e)):this._changeConnectStatus(pr.CONNFAIL,so.ErrorCondition.UNKOWN_REASON),void this._doDisconnect(e)}so.forEachChild(n,null,(e=>{const t=[];this.handlers=this.handlers.reduce(((n,s)=>{try{!s.isMatch(e)||!this.authenticated&&s.user?n.push(s):(s.run(e)&&n.push(s),t.push(s))}catch(e){so.warn("Removing Strophe handlers due to uncaught exception: "+e.message)}return n}),[]),!t.length&&this.iqFallbackHandler.isMatch(e)&&this.iqFallbackHandler.run(e)}))}_connect_cb(e,t,n){let s;so.debug("_connect_cb was called"),this.connected=!0;try{s=this._proto._reqToData(e)}catch(e){if(e.name!==so.ErrorCondition.BAD_FORMAT)throw e;this._changeConnectStatus(pr.CONNFAIL,so.ErrorCondition.BAD_FORMAT),this._doDisconnect(so.ErrorCondition.BAD_FORMAT)}if(!s)return;this.xmlInput!==so.Connection.prototype.xmlInput&&(s.nodeName===this._proto.strip&&s.childNodes.length?this.xmlInput(s.childNodes[0]):this.xmlInput(s)),this.rawInput!==so.Connection.prototype.rawInput&&(n?this.rawInput(n):this.rawInput(so.serialize(s)));if(this._proto._connect_cb(s)===pr.CONNFAIL)return;let i;if(i=s.getElementsByTagNameNS?s.getElementsByTagNameNS(so.NS.STREAM,"features").length>0:s.getElementsByTagName("stream:features").length>0||s.getElementsByTagName("features").length>0,!i)return void this._proto._no_auth_received(t);const r=Array.from(s.getElementsByTagName("mechanism")).map((e=>this.mechanisms[e.textContent])).filter((e=>e));0!==r.length||0!==s.getElementsByTagName("auth").length?!1!==this.do_authentication&&this.authenticate(r):this._proto._no_auth_received(t)}sortMechanismsByPriority(e){for(let t=0;t<e.length-1;++t){let n=t;for(let s=t+1;s<e.length;++s)e[s].priority>e[n].priority&&(n=s);if(n!==t){const s=e[t];e[t]=e[n],e[n]=s}}return e}authenticate(e){this._attemptSASLAuth(e)||this._attemptLegacyAuth()}_attemptSASLAuth(e){e=this.sortMechanismsByPriority(e||[]);let t=!1;for(let n=0;n<e.length;++n){if(!e[n].test(this))continue;this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null),this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null),this._sasl_challenge_handler=this._addSysHandler(this._sasl_challenge_cb.bind(this),null,"challenge",null,null),this._sasl_mechanism=e[n],this._sasl_mechanism.onStart(this);const s=Vr("auth",{xmlns:so.NS.SASL,mechanism:this._sasl_mechanism.mechname});if(this._sasl_mechanism.isClientFirst){const e=this._sasl_mechanism.clientChallenge(this);s.t((0,eo.btoa)(e))}this.send(s.tree()),t=!0;break}return t}async _sasl_challenge_cb(e){const t=(0,eo.atob)(Pr(e)),n=await this._sasl_mechanism.onChallenge(this,t),s=Vr("response",{xmlns:so.NS.SASL});return""!==n&&s.t((0,eo.btoa)(n)),this.send(s.tree()),!0}_attemptLegacyAuth(){null===so.getNodeFromJid(this.jid)?(this._changeConnectStatus(pr.CONNFAIL,so.ErrorCondition.MISSING_JID_NODE),this.disconnect(so.ErrorCondition.MISSING_JID_NODE)):(this._changeConnectStatus(pr.AUTHENTICATING,null),this._addSysHandler(this._onLegacyAuthIQResult.bind(this),null,null,null,"_auth_1"),this.send(Zr({type:"get",to:this.domain,id:"_auth_1"}).c("query",{xmlns:so.NS.AUTH}).c("username",{}).t(so.getNodeFromJid(this.jid)).tree()))}_onLegacyAuthIQResult(e){const t=Zr({type:"set",id:"_auth_2"}).c("query",{xmlns:so.NS.AUTH}).c("username",{}).t(so.getNodeFromJid(this.jid)).up().c("password").t(this.pass);return so.getResourceFromJid(this.jid)||(this.jid=so.getBareJidFromJid(this.jid)+"/strophe"),t.up().c("resource",{}).t(so.getResourceFromJid(this.jid)),this._addSysHandler(this._auth2_cb.bind(this),null,null,null,"_auth_2"),this.send(t.tree()),!1}_sasl_success_cb(e){if(this._sasl_data["server-signature"]){let t;const n=/([a-z]+)=([^,]+)(,|$)/,s=(0,eo.atob)(Pr(e)).match(n);if("v"===s[1]&&(t=s[2]),t!==this._sasl_data["server-signature"])return this.deleteHandler(this._sasl_failure_handler),this._sasl_failure_handler=null,this._sasl_challenge_handler&&(this.deleteHandler(this._sasl_challenge_handler),this._sasl_challenge_handler=null),this._sasl_data={},this._sasl_failure_cb(null)}so.info("SASL authentication succeeded."),this._sasl_data.keys&&(this.scram_keys=this._sasl_data.keys),this._sasl_mechanism&&this._sasl_mechanism.onSuccess(),this.deleteHandler(this._sasl_failure_handler),this._sasl_failure_handler=null,this._sasl_challenge_handler&&(this.deleteHandler(this._sasl_challenge_handler),this._sasl_challenge_handler=null);const t=[],n=(e,t)=>{for(;e.length;)this.deleteHandler(e.pop());return this._onStreamFeaturesAfterSASL(t),!1};return t.push(this._addSysHandler((e=>n(t,e)),null,"stream:features",null,null)),t.push(this._addSysHandler((e=>n(t,e)),so.NS.STREAM,"features",null,null)),this._sendRestart(),!1}_onStreamFeaturesAfterSASL(e){this.features=e;for(let t=0;t<e.childNodes.length;t++){const n=e.childNodes[t];"bind"===n.nodeName&&(this.do_bind=!0),"session"===n.nodeName&&(this.do_session=!0)}return this.do_bind?(this.options.explicitResourceBinding?this._changeConnectStatus(pr.BINDREQUIRED,null):this.bind(),!1):(this._changeConnectStatus(pr.AUTHFAIL,null),!1)}bind(){if(!this.do_bind)return void so.log(so.LogLevel.INFO,'Strophe.Connection.prototype.bind called but "do_bind" is false');this._addSysHandler(this._onResourceBindResultIQ.bind(this),null,null,null,"_bind_auth_2");const e=so.getResourceFromJid(this.jid);e?this.send(Zr({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:so.NS.BIND}).c("resource",{}).t(e).tree()):this.send(Zr({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:so.NS.BIND}).tree())}_onResourceBindResultIQ(e){if("error"===e.getAttribute("type")){so.warn("Resource binding failed.");let t;return e.getElementsByTagName("conflict").length>0&&(t=so.ErrorCondition.CONFLICT),this._changeConnectStatus(pr.AUTHFAIL,t,e),!1}const t=e.getElementsByTagName("bind");if(!(t.length>0))return so.warn("Resource binding failed."),this._changeConnectStatus(pr.AUTHFAIL,null,e),!1;{const e=t[0].getElementsByTagName("jid");e.length>0&&(this.authenticated=!0,this.jid=Pr(e[0]),this.do_session?this._establishSession():this._changeConnectStatus(pr.CONNECTED,null))}}_establishSession(){if(!this.do_session)throw new Error(`Strophe.Connection.prototype._establishSession called but apparently ${so.NS.SESSION} wasn't advertised by the server`);this._addSysHandler(this._onSessionResultIQ.bind(this),null,null,null,"_session_auth_2"),this.send(Zr({type:"set",id:"_session_auth_2"}).c("session",{xmlns:so.NS.SESSION}).tree())}_onSessionResultIQ(e){if("result"===e.getAttribute("type"))this.authenticated=!0,this._changeConnectStatus(pr.CONNECTED,null);else if("error"===e.getAttribute("type"))return this.authenticated=!1,so.warn("Session creation failed."),this._changeConnectStatus(pr.AUTHFAIL,null,e),!1;return!1}_sasl_failure_cb(e){return this._sasl_success_handler&&(this.deleteHandler(this._sasl_success_handler),this._sasl_success_handler=null),this._sasl_challenge_handler&&(this.deleteHandler(this._sasl_challenge_handler),this._sasl_challenge_handler=null),this._sasl_mechanism&&this._sasl_mechanism.onFailure(),this._changeConnectStatus(pr.AUTHFAIL,null,e),!1}_auth2_cb(e){return"result"===e.getAttribute("type")?(this.authenticated=!0,this._changeConnectStatus(pr.CONNECTED,null)):"error"===e.getAttribute("type")&&(this._changeConnectStatus(pr.AUTHFAIL,null,e),this.disconnect("authentication failed")),!1}_addSysTimedHandler(e,t){const n=new Xr(e,t);return n.user=!1,this.addTimeds.push(n),n}_addSysHandler(e,t,n,s,i){const r=new Yr(e,t,n,s,i);return r.user=!1,this.addHandlers.push(r),r}_onDisconnectTimeout(){return so.debug("_onDisconnectTimeout was called"),this._changeConnectStatus(pr.CONNTIMEOUT,null),this._proto._onDisconnectTimeout(),this._doDisconnect(),!1}_onIdle(){for(;this.addTimeds.length>0;)this.timedHandlers.push(this.addTimeds.pop());for(;this.removeTimeds.length>0;){const e=this.removeTimeds.pop(),t=this.timedHandlers.indexOf(e);t>=0&&this.timedHandlers.splice(t,1)}const e=(new Date).getTime(),t=[];for(let n=0;n<this.timedHandlers.length;n++){const s=this.timedHandlers[n];if(this.authenticated||!s.user){s.lastCalled+s.period-e<=0?s.run()&&t.push(s):t.push(s)}}this.timedHandlers=t,clearTimeout(this._idleTimeout),this._proto._onIdle(),this.connected&&(this._idleTimeout=setTimeout((()=>this._onIdle()),100))}},ElementType:vr,ErrorCondition:{BAD_FORMAT:"bad-format",CONFLICT:"conflict",MISSING_JID_NODE:"x-strophe-bad-non-anon-jid",NO_AUTH_MECH:"no-auth-mech",UNKNOWN_REASON:"unknown"},Handler:Yr,LogLevel:{DEBUG:0,INFO:1,WARN:2,ERROR:3,FATAL:4},NS:fr,SASLMechanism:to,Status:pr,TimedHandler:Xr,...i,XHTML:{...gr,validTag:jr,validCSS:Ir,validAttribute:Tr},addNamespace(e,t){so.NS[e]=t},_handleError(e){void 0!==e.stack&&so.fatal(e.stack),e.sourceURL?so.fatal("error: "+this.handler+" "+e.sourceURL+":"+e.line+" - "+e.name+": "+e.message):e.fileName?so.fatal("error: "+this.handler+" "+e.fileName+":"+e.lineNumber+" - "+e.name+": "+e.message):so.fatal("error: "+e.message)},log(e,t){e===this.LogLevel.FATAL&&console?.error(t)},debug(e){this.log(this.LogLevel.DEBUG,e)},info(e){this.log(this.LogLevel.INFO,e)},warn(e){this.log(this.LogLevel.WARN,e)},error(e){this.log(this.LogLevel.ERROR,e)},fatal(e){this.log(this.LogLevel.FATAL,e)},_requestId:0,_connectionPlugins:{},addConnectionPlugin(e,t){so._connectionPlugins[e]=t}};so.SASLAnonymous=class extends to{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"ANONYMOUS",arguments.length>1&&void 0!==arguments[1]&&arguments[1],arguments.length>2&&void 0!==arguments[2]?arguments[2]:20)}test(e){return null===e.authcid}},so.SASLPlain=class extends to{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"PLAIN",!(arguments.length>1&&void 0!==arguments[1])||arguments[1],arguments.length>2&&void 0!==arguments[2]?arguments[2]:50)}test(e){return null!==e.authcid}onChallenge(e){const{authcid:t,authzid:n,domain:s,pass:i}=e;if(!s)throw new Error("SASLPlain onChallenge: domain is not defined!");let r=n!==`${t}@${s}`?n:"";return r+="\0",r+=t,r+="\0",r+=i,Wr.utf16to8(r)}},so.SASLSHA1=class extends to{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"SCRAM-SHA-1",!(arguments.length>1&&void 0!==arguments[1])||arguments[1],arguments.length>2&&void 0!==arguments[2]?arguments[2]:60)}test(e){return null!==e.authcid}async onChallenge(e,t){return await no.scramResponse(e,t,"SHA-1",160)}clientChallenge(e,t){return no.clientChallenge(e,t)}},so.SASLSHA256=class extends to{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"SCRAM-SHA-256",!(arguments.length>1&&void 0!==arguments[1])||arguments[1],arguments.length>2&&void 0!==arguments[2]?arguments[2]:70)}test(e){return null!==e.authcid}async onChallenge(e,t){return await no.scramResponse(e,t,"SHA-256",256)}clientChallenge(e,t){return no.clientChallenge(e,t)}},so.SASLSHA384=class extends to{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"SCRAM-SHA-384",!(arguments.length>1&&void 0!==arguments[1])||arguments[1],arguments.length>2&&void 0!==arguments[2]?arguments[2]:71)}test(e){return null!==e.authcid}async onChallenge(e,t){return await no.scramResponse(e,t,"SHA-384",384)}clientChallenge(e,t){return no.clientChallenge(e,t)}},so.SASLSHA512=class extends to{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"SCRAM-SHA-512",!(arguments.length>1&&void 0!==arguments[1])||arguments[1],arguments.length>2&&void 0!==arguments[2]?arguments[2]:72)}test(e){return null!==e.authcid}async onChallenge(e,t){return await no.scramResponse(e,t,"SHA-512",512)}clientChallenge(e,t){return no.clientChallenge(e,t)}},so.SASLOAuthBearer=class extends to{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"OAUTHBEARER",!(arguments.length>1&&void 0!==arguments[1])||arguments[1],arguments.length>2&&void 0!==arguments[2]?arguments[2]:40)}test(e){return null!==e.pass}onChallenge(e){let t="n,";return null!==e.authcid&&(t=t+"a="+e.authzid),t+=",",t+="",t+="auth=Bearer ",t+=e.pass,t+="",t+="",Wr.utf16to8(t)}},so.SASLExternal=class extends to{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"EXTERNAL",!(arguments.length>1&&void 0!==arguments[1])||arguments[1],arguments.length>2&&void 0!==arguments[2]?arguments[2]:10)}onChallenge(e){return e.authcid===e.authzid?"":e.authzid}},so.SASLXOAuth2=class extends to{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"X-OAUTH2",!(arguments.length>1&&void 0!==arguments[1])||arguments[1],arguments.length>2&&void 0!==arguments[2]?arguments[2]:30)}test(e){return null!==e.pass}onChallenge(e){let t="\0";return null!==e.authcid&&(t+=e.authzid),t+="\0",t+=e.pass,Wr.utf16to8(t)}};const io={Strophe:so,$build:Vr,$iq:Zr,$msg:Jr,$pres:Qr};so.Request=class{constructor(e,t,n,s){this.id=++so._requestId,this.xmlData=e,this.data=so.serialize(e),this.origFunc=t,this.func=t,this.rid=n,this.date=NaN,this.sends=s||0,this.abort=!1,this.dead=null,this.age=function(){if(!this.date)return 0;return(new Date-this.date)/1e3},this.timeDead=function(){if(!this.dead)return 0;return(new Date-this.dead)/1e3},this.xhr=this._newXHR()}getResponse(){let e=null;if(this.xhr.responseXML&&this.xhr.responseXML.documentElement){if(e=this.xhr.responseXML.documentElement,"parsererror"===e.tagName)throw so.error("invalid response received"),so.error("responseText: "+this.xhr.responseText),so.error("responseXML: "+so.serialize(this.xhr.responseXML)),new Error("parsererror")}else if(this.xhr.responseText){so.debug("Got responseText but no responseXML; attempting to parse it with DOMParser..."),e=(new hr).parseFromString(this.xhr.responseText,"application/xml").documentElement;const t=e?.querySelector("parsererror");if(!e||t){t&&(so.error("invalid response received: "+t.textContent),so.error("responseText: "+this.xhr.responseText));const e=new Error;throw e.name=so.ErrorCondition.BAD_FORMAT,e}}return e}_newXHR(){let e=null;return globalThis.XMLHttpRequest?(e=new XMLHttpRequest,e.overrideMimeType&&e.overrideMimeType("text/xml; charset=utf-8")):globalThis.ActiveXObject&&(e=new ActiveXObject("Microsoft.XMLHTTP")),e.onreadystatechange=this.func.bind(null,this),e}},so.Bosh=class e{constructor(e){this._conn=e,this.rid=Math.floor(4294967295*Math.random()),this.sid=null,this.hold=1,this.wait=60,this.window=5,this.errors=0,this.inactivity=null,this.lastResponseHeaders=null,this._requests=[]}_buildBody(){const e=Vr("body",{rid:this.rid++,xmlns:so.NS.HTTPBIND});return null!==this.sid&&e.attrs({sid:this.sid}),this._conn.options.keepalive&&this._conn._sessionCachingSupported()&&this._cacheSession(),e}_reset(){this.rid=Math.floor(4294967295*Math.random()),this.sid=null,this.errors=0,this._conn._sessionCachingSupported()&&sessionStorage.removeItem("strophe-bosh-session"),this._conn.nextValidRid(this.rid)}_connect(e,t,n){this.wait=e||this.wait,this.hold=t||this.hold,this.errors=0;const s=this._buildBody().attrs({to:this._conn.domain,"xml:lang":"en",wait:this.wait,hold:this.hold,content:"text/xml; charset=utf-8",ver:"1.6","xmpp:version":"1.0","xmlns:xmpp":so.NS.BOSH});n&&s.attrs({route:n});const i=this._conn._connect_cb;this._requests.push(new so.Request(s.tree(),this._onRequestStateChange.bind(this,i.bind(this._conn)),s.tree().getAttribute("rid"))),this._throttledRequestHandler()}_attach(e,t,n,s,i,r,o){this._conn.jid=e,this.sid=t,this.rid=n,this._conn.connect_callback=s,this._conn.domain=so.getDomainFromJid(this._conn.jid),this._conn.authenticated=!0,this._conn.connected=!0,this.wait=i||this.wait,this.hold=r||this.hold,this.window=o||this.window,this._conn._changeConnectStatus(so.Status.ATTACHED,null)}_restore(e,t,n,s,i){const r=JSON.parse(sessionStorage.getItem("strophe-bosh-session"));if(!(null!=r&&r.rid&&r.sid&&r.jid&&(null==e||so.getBareJidFromJid(r.jid)===so.getBareJidFromJid(e)||null===so.getNodeFromJid(e)&&so.getDomainFromJid(r.jid)===e))){const e=new Error("_restore: no restoreable session.");throw e.name="StropheSessionError",e}this._conn.restored=!0,this._attach(r.jid,r.sid,r.rid,t,n,s,i)}_cacheSession(){this._conn.authenticated?this._conn.jid&&this.rid&&this.sid&&sessionStorage.setItem("strophe-bosh-session",JSON.stringify({jid:this._conn.jid,rid:this.rid,sid:this.sid})):sessionStorage.removeItem("strophe-bosh-session")}_connect_cb(e){const t=e.getAttribute("type");if(null!==t&&"terminate"===t){let t=e.getAttribute("condition");so.error("BOSH-Connection failed: "+t);const n=e.getElementsByTagName("conflict");return null!==t?("remote-stream-error"===t&&n.length>0&&(t="conflict"),this._conn._changeConnectStatus(so.Status.CONNFAIL,t)):this._conn._changeConnectStatus(so.Status.CONNFAIL,"unknown"),this._conn._doDisconnect(t),so.Status.CONNFAIL}this.sid||(this.sid=e.getAttribute("sid"));const n=e.getAttribute("requests");n&&(this.window=parseInt(n,10));const s=e.getAttribute("hold");s&&(this.hold=parseInt(s,10));const i=e.getAttribute("wait");i&&(this.wait=parseInt(i,10));const r=e.getAttribute("inactivity");r&&(this.inactivity=parseInt(r,10))}_disconnect(e){this._sendTerminate(e)}_doDisconnect(){this.sid=null,this.rid=Math.floor(4294967295*Math.random()),this._conn._sessionCachingSupported()&&sessionStorage.removeItem("strophe-bosh-session"),this._conn.nextValidRid(this.rid)}_emptyQueue(){return 0===this._requests.length}_callProtocolErrorHandlers(t){const n=e._getRequestStatus(t),s=this._conn.protocolErrorHandlers.HTTP[n];s&&s.call(this,n)}_hitError(e){this.errors++,so.warn("request errored, status: "+e+", number of errors: "+this.errors),this.errors>4&&this._conn._onDisconnectTimeout()}_no_auth_received(e){so.warn("Server did not yet offer a supported authentication mechanism. Sending a blank poll request."),e=e?e.bind(this._conn):this._conn._connect_cb.bind(this._conn);const t=this._buildBody();this._requests.push(new so.Request(t.tree(),this._onRequestStateChange.bind(this,e),t.tree().getAttribute("rid"))),this._throttledRequestHandler()}_onDisconnectTimeout(){this._abortAllRequests()}_abortAllRequests(){for(;this._requests.length>0;){const e=this._requests.pop();e.abort=!0,e.xhr.abort(),e.xhr.onreadystatechange=function(){}}}_onIdle(){const e=this._conn._data;if(this._conn.authenticated&&0===this._requests.length&&0===e.length&&!this._conn.disconnecting&&(so.debug("no requests during idle cycle, sending blank request"),e.push(null)),!this._conn.paused){if(this._requests.length<2&&e.length>0){const t=this._buildBody();for(let n=0;n<e.length;n++)null!==e[n]&&("restart"===e[n]?t.attrs({to:this._conn.domain,"xml:lang":"en","xmpp:restart":"true","xmlns:xmpp":so.NS.BOSH}):t.cnode(e[n]).up());delete this._conn._data,this._conn._data=[],this._requests.push(new so.Request(t.tree(),this._onRequestStateChange.bind(this,this._conn._dataRecv.bind(this._conn)),t.tree().getAttribute("rid"))),this._throttledRequestHandler()}if(this._requests.length>0){const e=this._requests[0].age();null!==this._requests[0].dead&&this._requests[0].timeDead()>Math.floor(so.SECONDARY_TIMEOUT*this.wait)&&this._throttledRequestHandler(),e>Math.floor(so.TIMEOUT*this.wait)&&(so.warn("Request "+this._requests[0].id+" timed out, over "+Math.floor(so.TIMEOUT*this.wait)+" seconds since last activity"),this._throttledRequestHandler())}}}static _getRequestStatus(e,t){let n;if(4===e.xhr.readyState)try{n=e.xhr.status}catch(e){so.error("Caught an error while retrieving a request's status, reqStatus: "+n)}return void 0===n&&(n="number"==typeof t?t:0),n}_onRequestStateChange(t,n){if(so.debug("request id "+n.id+"."+n.sends+" state changed to "+n.xhr.readyState),n.abort)return void(n.abort=!1);if(4!==n.xhr.readyState)return;const s=e._getRequestStatus(n);if(this.lastResponseHeaders=n.xhr.getAllResponseHeaders(),this._conn.disconnecting&&s>=400)return this._hitError(s),void this._callProtocolErrorHandlers(n);const i=this._requests[0]===n,r=this._requests[1]===n,o=s>0&&s<500,a=n.sends>this._conn.maxRetries;(o||a)&&(this._removeRequest(n),so.debug("request id "+n.id+" should now be removed")),200===s?((r||i&&this._requests.length>0&&this._requests[0].age()>Math.floor(so.SECONDARY_TIMEOUT*this.wait))&&this._restartRequest(0),this._conn.nextValidRid(Number(n.rid)+1),so.debug("request id "+n.id+"."+n.sends+" got 200"),t(n),this.errors=0):0===s||s>=400&&s<600||s>=12e3?(so.error("request id "+n.id+"."+n.sends+" error "+s+" happened"),this._hitError(s),this._callProtocolErrorHandlers(n),s>=400&&s<500&&(this._conn._changeConnectStatus(so.Status.DISCONNECTING,null),this._conn._doDisconnect())):so.error("request id "+n.id+"."+n.sends+" error "+s+" happened"),o||a?a&&!this._conn.connected&&this._conn._changeConnectStatus(so.Status.CONNFAIL,"giving-up"):this._throttledRequestHandler()}_processRequest(t){let n=this._requests[t];const s=e._getRequestStatus(n,-1);if(n.sends>this._conn.maxRetries)return void this._conn._onDisconnectTimeout();const i=n.age(),r=!isNaN(i)&&i>Math.floor(so.TIMEOUT*this.wait),o=null!==n.dead&&n.timeDead()>Math.floor(so.SECONDARY_TIMEOUT*this.wait),a=4===n.xhr.readyState&&(s<1||s>=500);if((r||o||a)&&(o&&so.error(`Request ${this._requests[t].id} timed out (secondary), restarting`),n.abort=!0,n.xhr.abort(),n.xhr.onreadystatechange=function(){},this._requests[t]=new so.Request(n.xmlData,n.origFunc,n.rid,n.sends),n=this._requests[t]),0===n.xhr.readyState){so.debug("request id "+n.id+"."+n.sends+" posting");try{const e=this._conn.options.contentType||"text/xml; charset=utf-8";n.xhr.open("POST",this._conn.service,!this._conn.options.sync),void 0!==n.xhr.setRequestHeader&&n.xhr.setRequestHeader("Content-Type",e),this._conn.options.withCredentials&&(n.xhr.withCredentials=!0)}catch(e){return so.error("XHR open failed: "+e.toString()),this._conn.connected||this._conn._changeConnectStatus(so.Status.CONNFAIL,"bad-service"),void this._conn.disconnect()}const e=()=>{if(n.date=new Date,this._conn.options.customHeaders){const e=this._conn.options.customHeaders;for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.xhr.setRequestHeader(t,e[t])}n.xhr.send(n.data)};if(n.sends>1){const t=1e3*Math.min(Math.floor(so.TIMEOUT*this.wait),Math.pow(n.sends,3));setTimeout((function(){e()}),t)}else e();n.sends++,this._conn.xmlOutput!==so.Connection.prototype.xmlOutput&&(n.xmlData.nodeName===this.strip&&n.xmlData.childNodes.length?this._conn.xmlOutput(n.xmlData.childNodes[0]):this._conn.xmlOutput(n.xmlData)),this._conn.rawOutput!==so.Connection.prototype.rawOutput&&this._conn.rawOutput(n.data)}else so.debug("_processRequest: "+(0===t?"first":"second")+" request has readyState of "+n.xhr.readyState)}_removeRequest(e){so.debug("removing request");for(let t=this._requests.length-1;t>=0;t--)e===this._requests[t]&&this._requests.splice(t,1);e.xhr.onreadystatechange=function(){},this._throttledRequestHandler()}_restartRequest(e){const t=this._requests[e];null===t.dead&&(t.dead=new Date),this._processRequest(e)}_reqToData(e){try{return e.getResponse()}catch(e){if("parsererror"!==e.message)throw e;this._conn.disconnect("strophe-parsererror")}}_sendTerminate(e){so.debug("_sendTerminate was called");const t=this._buildBody().attrs({type:"terminate"});e&&t.cnode(e.tree());const n=new so.Request(t.tree(),this._onRequestStateChange.bind(this,this._conn._dataRecv.bind(this._conn)),t.tree().getAttribute("rid"));this._requests.push(n),this._throttledRequestHandler()}_send(){clearTimeout(this._conn._idleTimeout),this._throttledRequestHandler(),this._conn._idleTimeout=setTimeout((()=>this._conn._onIdle()),100)}_sendRestart(){this._throttledRequestHandler(),clearTimeout(this._conn._idleTimeout)}_throttledRequestHandler(){this._requests?so.debug("_throttledRequestHandler called with "+this._requests.length+" requests"):so.debug("_throttledRequestHandler called with undefined requests"),this._requests&&0!==this._requests.length&&(this._requests.length>0&&this._processRequest(0),this._requests.length>1&&Math.abs(this._requests[0].rid-this._requests[1].rid)<this.window&&this._processRequest(1))}},so.Bosh.prototype.strip=null,so.Websocket=class{constructor(e){this._conn=e,this.strip="wrapper";const t=e.service;if(0!==t.indexOf("ws:")&&0!==t.indexOf("wss:")){let n="";"ws"===e.options.protocol&&"https:"!==location.protocol?n+="ws":n+="wss",n+="://"+location.host,0!==t.indexOf("/")?n+=location.pathname+t:n+=t,e.service=n}}_buildStream(){return Vr("open",{xmlns:so.NS.FRAMING,to:this._conn.domain,version:"1.0"})}_checkStreamError(e,t){let n;if(n=e.getElementsByTagNameNS?e.getElementsByTagNameNS(so.NS.STREAM,"error"):e.getElementsByTagName("stream:error"),0===n.length)return!1;const s=n[0];let i="",r="";for(let e=0;e<s.childNodes.length;e++){const t=s.childNodes[e];if("urn:ietf:params:xml:ns:xmpp-streams"!==t.getAttribute("xmlns"))break;"text"===t.nodeName?r=t.textContent:i=t.nodeName}let o="WebSocket stream error: ";return o+=i||"unknown",r&&(o+=" - "+r),so.error(o),this._conn._changeConnectStatus(t,i),this._conn._doDisconnect(),!0}_reset(){}_connect(){this._closeSocket(),this.socket=new ur(this._conn.service,"xmpp"),this.socket.onopen=()=>this._onOpen(),this.socket.onerror=e=>this._onError(e),this.socket.onclose=e=>this._onClose(e),this.socket.onmessage=e=>this._onInitialMessage(e)}_connect_cb(e){if(this._checkStreamError(e,so.Status.CONNFAIL))return so.Status.CONNFAIL}_handleStreamStart(e){let t=!1;const n=e.getAttribute("xmlns");"string"!=typeof n?t="Missing xmlns in <open />":n!==so.NS.FRAMING&&(t="Wrong xmlns in <open />: "+n);const s=e.getAttribute("version");return"string"!=typeof s?t="Missing version in <open />":"1.0"!==s&&(t="Wrong version in <open />: "+s),!t||(this._conn._changeConnectStatus(so.Status.CONNFAIL,t),this._conn._doDisconnect(),!1)}_onInitialMessage(e){if(0===e.data.indexOf("<open ")||0===e.data.indexOf("<?xml")){const t=e.data.replace(/^(<\?.*?\?>\s*)*/,"");if(""===t)return;const n=(new hr).parseFromString(t,"text/xml").documentElement;this._conn.xmlInput(n),this._conn.rawInput(e.data),this._handleStreamStart(n)&&this._connect_cb(n)}else if(0===e.data.indexOf("<close ")){const t=(new hr).parseFromString(e.data,"text/xml").documentElement;this._conn.xmlInput(t),this._conn.rawInput(e.data);const n=t.getAttribute("see-other-uri");if(n){const e=this._conn.service;(e.indexOf("wss:")>=0&&n.indexOf("wss:")>=0||e.indexOf("ws:")>=0)&&(this._conn._changeConnectStatus(so.Status.REDIRECT,"Received see-other-uri, resetting connection"),this._conn.reset(),this._conn.service=n,this._connect())}else this._conn._changeConnectStatus(so.Status.CONNFAIL,"Received closing stream"),this._conn._doDisconnect()}else{this._replaceMessageHandler();const t=this._streamWrap(e.data),n=(new hr).parseFromString(t,"text/xml").documentElement;this._conn._connect_cb(n,null,e.data)}}_replaceMessageHandler(){this.socket.onmessage=e=>this._onMessage(e)}_disconnect(e){if(this.socket&&this.socket.readyState!==ur.CLOSED){e&&this._conn.send(e);const t=Vr("close",{xmlns:so.NS.FRAMING});this._conn.xmlOutput(t.tree());const n=so.serialize(t);this._conn.rawOutput(n);try{this.socket.send(n)}catch(e){so.warn("Couldn't send <close /> tag.")}}setTimeout((()=>this._conn._doDisconnect()),0)}_doDisconnect(){so.debug("WebSockets _doDisconnect was called"),this._closeSocket()}_streamWrap(e){return"<wrapper>"+e+"</wrapper>"}_closeSocket(){if(this.socket)try{this.socket.onclose=null,this.socket.onerror=null,this.socket.onmessage=null,this.socket.close()}catch(e){so.debug(e.message)}this.socket=null}_emptyQueue(){return!0}_onClose(e){this._conn.connected&&!this._conn.disconnecting?(so.error("Websocket closed unexpectedly"),this._conn._doDisconnect()):e&&1006===e.code&&!this._conn.connected&&this.socket?(so.error("Websocket closed unexcectedly"),this._conn._changeConnectStatus(so.Status.CONNFAIL,"The WebSocket connection could not be established or was disconnected."),this._conn._doDisconnect()):so.debug("Websocket closed")}_no_auth_received(e){so.error("Server did not offer a supported authentication mechanism"),this._conn._changeConnectStatus(so.Status.CONNFAIL,so.ErrorCondition.NO_AUTH_MECH),e&&e.call(this._conn),this._conn._doDisconnect()}_onDisconnectTimeout(){}_abortAllRequests(){}_onError(e){so.error("Websocket error "+JSON.stringify(e)),this._conn._changeConnectStatus(so.Status.CONNFAIL,"The WebSocket connection could not be established or was disconnected."),this._disconnect()}_onIdle(){const e=this._conn._data;if(e.length>0&&!this._conn.paused){for(let t=0;t<e.length;t++)if(null!==e[t]){let n;n="restart"===e[t]?this._buildStream().tree():e[t];const s=so.serialize(n);this._conn.xmlOutput(n),this._conn.rawOutput(s),this.socket.send(s)}this._conn._data=[]}}_onMessage(e){let t;const n='<close xmlns="urn:ietf:params:xml:ns:xmpp-framing" />';if(e.data===n)return this._conn.rawInput(n),this._conn.xmlInput(e),void(this._conn.disconnecting||this._conn._doDisconnect());if(0===e.data.search("<open ")){if(t=(new hr).parseFromString(e.data,"text/xml").documentElement,!this._handleStreamStart(t))return}else{const n=this._streamWrap(e.data);t=(new hr).parseFromString(n,"text/xml").documentElement}return this._checkStreamError(t,so.Status.ERROR)?void 0:this._conn.disconnecting&&"presence"===t.firstChild.nodeName&&"unavailable"===t.firstChild.getAttribute("type")?(this._conn.xmlInput(t),void this._conn.rawInput(so.serialize(t))):void this._conn._dataRecv(t,e.data)}_onOpen(){so.debug("Websocket open");const e=this._buildStream();this._conn.xmlOutput(e.tree());const t=so.serialize(e);this._conn.rawOutput(t),this.socket.send(t)}_reqToData(e){return e}_send(){this._conn.flush()}_sendRestart(){clearTimeout(this._conn._idleTimeout),this._conn._onIdle.bind(this._conn)()}};const ro={};ro.debug=so.LogLevel.DEBUG,ro.info=so.LogLevel.INFO,ro.warn=so.LogLevel.WARN,ro.error=so.LogLevel.ERROR,ro.fatal=so.LogLevel.FATAL,so.WorkerWebsocket=class extends so.Websocket{constructor(e){super(e),this._conn=e,this.worker=new SharedWorker(this._conn.options.worker,"Strophe XMPP Connection"),this.worker.onerror=e=>{console?.error(e),so.log(so.LogLevel.ERROR,`Shared Worker Error: ${e}`)}}get socket(){return{send:e=>this.worker.port.postMessage(["send",e])}}_connect(){this._messageHandler=e=>this._onInitialMessage(e),this.worker.port.start(),this.worker.port.onmessage=e=>this._onWorkerMessage(e),this.worker.port.postMessage(["_connect",this._conn.service,this._conn.jid])}_attach(e){this._messageHandler=e=>this._onMessage(e),this._conn.connect_callback=e,this.worker.port.start(),this.worker.port.onmessage=e=>this._onWorkerMessage(e),this.worker.port.postMessage(["_attach",this._conn.service])}_attachCallback(e,t){e===so.Status.ATTACHED?(this._conn.jid=t,this._conn.authenticated=!0,this._conn.connected=!0,this._conn.restored=!0,this._conn._changeConnectStatus(so.Status.ATTACHED)):e===so.Status.ATTACHFAIL&&(this._conn.authenticated=!1,this._conn.connected=!1,this._conn.restored=!1,this._conn._changeConnectStatus(so.Status.ATTACHFAIL))}_disconnect(e,t){t&&this._conn.send(t);const n=Vr("close",{xmlns:so.NS.FRAMING});this._conn.xmlOutput(n.tree());const s=so.serialize(n);this._conn.rawOutput(s),this.worker.port.postMessage(["send",s]),this._conn._doDisconnect()}_onClose(e){this._conn.connected&&!this._conn.disconnecting?(so.error("Websocket closed unexpectedly"),this._conn._doDisconnect()):e&&1006===e.code&&!this._conn.connected?(so.error("Websocket closed unexcectedly"),this._conn._changeConnectStatus(so.Status.CONNFAIL,"The WebSocket connection could not be established or was disconnected."),this._conn._doDisconnect()):so.debug("Websocket closed")}_closeSocket(){this.worker.port.postMessage(["_closeSocket"])}_replaceMessageHandler(){this._messageHandler=e=>this._onMessage(e)}_onWorkerMessage(e){const{data:t}=e,n=t[0];if("_onMessage"===n)this._messageHandler(t[1]);else if(n in this)try{this[n].apply(this,e.data.slice(1))}catch(e){so.log(so.LogLevel.ERROR,e)}else if("log"===n){const e=t[1],n=t[2];so.log(ro[e],n)}else so.log(so.LogLevel.ERROR,`Found unhandled service worker message: ${t}`)}},n.g.$build=io.$build,n.g.$iq=io.$iq,n.g.$msg=io.$msg,n.g.$pres=io.$pres,n.g.Strophe=io.Strophe,n.g.Strophe.shims=s;const oo="v10.1.6",ao={offline:6,unavailable:5,xa:4,away:3,dnd:2,chat:1,online:1},co="anonymous",lo="external",uo="login",ho="logout",mo="prebind",fo={};fo[so.Status.ATTACHED]="ATTACHED",fo[so.Status.AUTHENTICATING]="AUTHENTICATING",fo[so.Status.AUTHFAIL]="AUTHFAIL",fo[so.Status.CONNECTED]="CONNECTED",fo[so.Status.CONNECTING]="CONNECTING",fo[so.Status.CONNFAIL]="CONNFAIL",fo[so.Status.DISCONNECTED]="DISCONNECTED",fo[so.Status.DISCONNECTING]="DISCONNECTING",fo[so.Status.ERROR]="ERROR",fo[so.Status.RECONNECTING]="RECONNECTING",fo[so.Status.REDIRECT]="REDIRECT",so.addNamespace("ACTIVITY","http://jabber.org/protocol/activity"),so.addNamespace("CARBONS","urn:xmpp:carbons:2"),so.addNamespace("CHATSTATES","http://jabber.org/protocol/chatstates"),so.addNamespace("CSI","urn:xmpp:csi:0"),so.addNamespace("DELAY","urn:xmpp:delay"),so.addNamespace("EME","urn:xmpp:eme:0"),so.addNamespace("FASTEN","urn:xmpp:fasten:0"),so.addNamespace("FORWARD","urn:xmpp:forward:0"),so.addNamespace("HINTS","urn:xmpp:hints"),so.addNamespace("HTTPUPLOAD","urn:xmpp:http:upload:0"),so.addNamespace("MAM","urn:xmpp:mam:2"),so.addNamespace("MARKERS","urn:xmpp:chat-markers:0"),so.addNamespace("MENTIONS","urn:xmpp:mmn:0"),so.addNamespace("MESSAGE_CORRECT","urn:xmpp:message-correct:0"),so.addNamespace("MODERATE","urn:xmpp:message-moderate:0"),so.addNamespace("NICK","http://jabber.org/protocol/nick"),so.addNamespace("OCCUPANTID","urn:xmpp:occupant-id:0"),so.addNamespace("OMEMO","eu.siacs.conversations.axolotl"),so.addNamespace("OUTOFBAND","jabber:x:oob"),so.addNamespace("PUBSUB","http://jabber.org/protocol/pubsub"),so.addNamespace("RAI","urn:xmpp:rai:0"),so.addNamespace("RECEIPTS","urn:xmpp:receipts"),so.addNamespace("REFERENCE","urn:xmpp:reference:0"),so.addNamespace("REGISTER","jabber:iq:register"),so.addNamespace("RETRACT","urn:xmpp:message-retract:0"),so.addNamespace("ROSTERX","http://jabber.org/protocol/rosterx"),so.addNamespace("RSM","http://jabber.org/protocol/rsm"),so.addNamespace("SID","urn:xmpp:sid:0"),so.addNamespace("SPOILER","urn:xmpp:spoiler:0"),so.addNamespace("STANZAS","urn:ietf:params:xml:ns:xmpp-stanzas"),so.addNamespace("STYLING","urn:xmpp:styling:0"),so.addNamespace("VCARD","vcard-temp"),so.addNamespace("VCARDUPDATE","vcard-temp:x:update"),so.addNamespace("XFORM","jabber:x:data"),so.addNamespace("XHTML","http://www.w3.org/1999/xhtml");const go=["converse-adhoc","converse-bookmarks","converse-bosh","converse-caps","converse-chat","converse-chatboxes","converse-disco","converse-emoji","converse-headlines","converse-mam","converse-muc","converse-ping","converse-pubsub","converse-roster","converse-smacks","converse-status","converse-vcard"],po={start:/(\b|_)(?:([a-z][a-z0-9.+-]*:\/\/)|xmpp:|mailto:|www\.)/gi},vo={TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESCAPE:27,LEFT_ARROW:37,UP_ARROW:38,RIGHT_ARROW:39,DOWN_ARROW:40,FORWARD_SLASH:47,AT:50,META:91,META_RIGHT:93};var yo=n(6293);const _o={initialize(){},__(){return(0,yo.sprintf)(...arguments)}};var bo=n(1199),wo=n.n(bo);const So=function(e){for(var t=-1,n=null==e?0:e.length,s=0,i=[];++t<n;){var r=e[t];r&&(i[s++]=r)}return i};var xo=n(3568),Eo=n.n(xo);function Ao(){const e={isResolved:!1,isPending:!0,isRejected:!1},t=new Promise(((t,n)=>{e.resolve=t,e.reject=n}));return Object.assign(t,e),t.then((function(e){return t.isResolved=!0,t.isPending=!1,t.isRejected=!1,e}),(function(e){throw t.isResolved=!1,t.isPending=!1,t.isRejected=!0,e})),t}const Co={allow_non_roster_messaging:!1,allow_url_history_change:!0,assets_path:"/dist",authentication:"login",auto_login:!1,reuse_scram_keys:!1,auto_reconnect:!0,blacklisted_plugins:[],clear_cache_on_logout:!1,connection_options:{},credentials_url:null,discover_connection_methods:!0,geouri_regex:/https\:\/\/www.openstreetmap.org\/.*#map=[0-9]+\/([\-0-9.]+)\/([\-0-9.]+)\S*/g,geouri_replacement:"https://www.openstreetmap.org/?mlat=$1&mlon=$2#map=18/$1/$2",i18n:void 0,jid:void 0,keepalive:!0,loglevel:"info",locales:["af","ar","bg","ca","cs","da","de","el","en","eo","es","eu","fa","fi","fr","gl","he","hi","hu","id","it","ja","lt","mr","nb","nl","oc","pl","pt","pt_BR","ro","ru","sv","th","tr","ug","uk","vi","zh_CN","zh_TW"],nickname:void 0,password:void 0,persistent_store:"IndexedDB",rid:void 0,root:window.document,sid:void 0,singleton:!1,strict_plugin_dependencies:!1,stanza_timeout:2e4,view_mode:"overlayed",websocket_url:void 0,whitelisted_plugins:[]};var $o=n(8747);const ko=function(e){return Ps(e,5)};const jo=function(e){return"string"==typeof e||!J(e)&&B(e)&&"[object String]"==v(e)};const To=function(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}();const Io=function(){try{if(!To||!To.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}};const No=function(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),s=0;s<e.length;s+=1)n.append(e[s]);return n.getBlob(t.type)}};"undefined"==typeof Promise&&n(3449);const Oo=Promise;const Mo=function(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))};const Ro=function(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)};function Do(e){return"string"!=typeof e&&(console.warn(`${e} used as a key, but it is not a string.`),e=String(e)),e}function zo(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}const Lo="local-forage-detect-blob-support";let Po;const Fo={},Uo=Object.prototype.toString,Bo="readonly",qo="readwrite";function Ho(e){return"boolean"==typeof Po?Oo.resolve(Po):function(e){return new Oo((function(t){var n=e.transaction(Lo,qo),s=No([""]);n.objectStore(Lo).put(s,"key"),n.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},n.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//);t(n||!e||parseInt(e[1],10)>=43)}})).catch((function(){return!1}))}(e).then((function(e){return Po=e,Po}))}function Go(e){var t=Fo[e.name],n={};n.promise=new Oo((function(e,t){n.resolve=e,n.reject=t})),t.deferredOperations.push(n),t.dbReady?t.dbReady=t.dbReady.then((function(){return n.promise})):t.dbReady=n.promise}function Wo(e){var t=Fo[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function Vo(e,t){var n=Fo[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function Jo(e,t){return new Oo((function(n,s){if(Fo[e.name]=Fo[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return n(e.db);Go(e),e.db.close()}var i=[e.name];t&&i.push(e.version);var r=To.open.apply(To,i);t&&(r.onupgradeneeded=function(t){var n=r.result;try{n.createObjectStore(e.storeName),t.oldVersion<=1&&n.createObjectStore(Lo)}catch(n){if("ConstraintError"!==n.name)throw n;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),r.onerror=function(e){e.preventDefault(),s(r.error)},r.onsuccess=function(){var t=r.result;t.onversionchange=function(e){e.target.close()},n(t),Wo(e)}}))}function Zo(e){return Jo(e,!1)}function Qo(e){return Jo(e,!0)}function Ko(e,t){if(!e.db)return!0;var n=!e.db.objectStoreNames.contains(e.storeName),s=e.version<e.db.version,i=e.version>e.db.version;if(s&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),i||n){if(n){var r=e.db.version+1;r>e.version&&(e.version=r)}return!0}return!1}function Yo(e){var t=function(e){for(var t=e.length,n=new ArrayBuffer(t),s=new Uint8Array(n),i=0;i<t;i++)s[i]=e.charCodeAt(i);return n}(atob(e.data));return No([t],{type:e.type})}function Xo(e){return e&&e.__local_forage_encoded_blob}function ea(e){var t=this,n=t._initReady().then((function(){var e=Fo[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return Ro(n,e,e),n}function ta(e,t,n,s){void 0===s&&(s=1);try{var i=e.db.transaction(e.storeName,t);n(null,i)}catch(i){if(s>0&&(!e.db||"InvalidStateError"===i.name||"NotFoundError"===i.name))return Oo.resolve().then((()=>{if(!e.db||"NotFoundError"===i.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),Qo(e)})).then((()=>function(e){Go(e);for(var t=Fo[e.name],n=t.forages,s=0;s<n.length;s++){const e=n[s];e._dbInfo.db&&(e._dbInfo.db.close(),e._dbInfo.db=null)}return e.db=null,Zo(e).then((t=>(e.db=t,Ko(e)?Qo(e):t))).then((s=>{e.db=t.db=s;for(var i=0;i<n.length;i++)n[i]._dbInfo.db=s})).catch((t=>{throw Vo(e,t),t}))}(e).then((function(){ta(e,t,n,s-1)})))).catch(n);n(i)}}var na={_driver:"asyncStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var s in e)n[s]=e[s];var i=Fo[n.name];i||(i={forages:[],db:null,dbReady:null,deferredOperations:[]},Fo[n.name]=i),i.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=ea);var r=[];function o(){return Oo.resolve()}for(var a=0;a<i.forages.length;a++){var c=i.forages[a];c!==t&&r.push(c._initReady().catch(o))}var l=i.forages.slice(0);return Oo.all(r).then((function(){return n.db=i.db,Zo(n)})).then((function(e){return n.db=e,Ko(n,t._defaultConfig.version)?Qo(n):e})).then((function(e){n.db=i.db=e,t._dbInfo=n;for(var s=0;s<l.length;s++){var r=l[s];r!==t&&(r._dbInfo.db=n.db,r._dbInfo.version=n.version)}}))},_support:Io(),iterate:function(e,t){var n=this,s=new Oo((function(t,s){n.ready().then((function(){ta(n._dbInfo,Bo,(function(i,r){if(i)return s(i);try{var o=r.objectStore(n._dbInfo.storeName).openCursor(),a=1;o.onsuccess=function(){var n=o.result;if(n){var s=n.value;Xo(s)&&(s=Yo(s));var i=e(s,n.key,a++);void 0!==i?t(i):n.continue()}else t()},o.onerror=function(){s(o.error)}}catch(e){s(e)}}))})).catch(s)}));return Mo(s,t),s},getItem:function(e,t){var n=this;e=Do(e);var s=new Oo((function(t,s){n.ready().then((function(){ta(n._dbInfo,Bo,(function(i,r){if(i)return s(i);try{var o=r.objectStore(n._dbInfo.storeName).get(e);o.onsuccess=function(){var e=o.result;void 0===e&&(e=null),Xo(e)&&(e=Yo(e)),t(e)},o.onerror=function(){s(o.error)}}catch(e){s(e)}}))})).catch(s)}));return Mo(s,t),s},setItem:function(e,t,n){var s=this;e=Do(e);var i=new Oo((function(n,i){var r;s.ready().then((function(){return r=s._dbInfo,"[object Blob]"===Uo.call(t)?Ho(r.db).then((function(e){return e?t:(n=t,new Oo((function(e,t){var s=new FileReader;s.onerror=t,s.onloadend=function(t){var s=btoa(t.target.result||"");e({__local_forage_encoded_blob:!0,data:s,type:n.type})},s.readAsBinaryString(n)})));var n})):t})).then((function(t){ta(s._dbInfo,qo,(function(r,o){if(r)return i(r);try{var a=o.objectStore(s._dbInfo.storeName);null===t&&(t=void 0);var c=a.put(t,e);o.oncomplete=function(){void 0===t&&(t=null),n(t)},o.onabort=o.onerror=function(){var e=c.error?c.error:c.transaction.error;i(e)}}catch(e){i(e)}}))})).catch(i)}));return Mo(i,n),i},removeItem:function(e,t){var n=this;e=Do(e);var s=new Oo((function(t,s){n.ready().then((function(){ta(n._dbInfo,qo,(function(i,r){if(i)return s(i);try{var o=r.objectStore(n._dbInfo.storeName).delete(e);r.oncomplete=function(){t()},r.onerror=function(){s(o.error)},r.onabort=function(){var e=o.error?o.error:o.transaction.error;s(e)}}catch(e){s(e)}}))})).catch(s)}));return Mo(s,t),s},clear:function(e){var t=this,n=new Oo((function(e,n){t.ready().then((function(){ta(t._dbInfo,qo,(function(s,i){if(s)return n(s);try{var r=i.objectStore(t._dbInfo.storeName).clear();i.oncomplete=function(){e()},i.onabort=i.onerror=function(){var e=r.error?r.error:r.transaction.error;n(e)}}catch(e){n(e)}}))})).catch(n)}));return Mo(n,e),n},length:function(e){var t=this,n=new Oo((function(e,n){t.ready().then((function(){ta(t._dbInfo,Bo,(function(s,i){if(s)return n(s);try{var r=i.objectStore(t._dbInfo.storeName).count();r.onsuccess=function(){e(r.result)},r.onerror=function(){n(r.error)}}catch(e){n(e)}}))})).catch(n)}));return Mo(n,e),n},key:function(e,t){var n=this,s=new Oo((function(t,s){e<0?t(null):n.ready().then((function(){ta(n._dbInfo,Bo,(function(i,r){if(i)return s(i);try{var o=r.objectStore(n._dbInfo.storeName),a=!1,c=o.openKeyCursor();c.onsuccess=function(){var n=c.result;n?0===e||a?t(n.key):(a=!0,n.advance(e)):t(null)},c.onerror=function(){s(c.error)}}catch(e){s(e)}}))})).catch(s)}));return Mo(s,t),s},keys:function(e){var t=this,n=new Oo((function(e,n){t.ready().then((function(){ta(t._dbInfo,Bo,(function(s,i){if(s)return n(s);try{var r=i.objectStore(t._dbInfo.storeName).openKeyCursor(),o=[];r.onsuccess=function(){var t=r.result;t?(o.push(t.key),t.continue()):e(o)},r.onerror=function(){n(r.error)}}catch(e){n(e)}}))})).catch(n)}));return Mo(n,e),n},dropInstance:function(e,t){t=zo.apply(this,arguments);var n,s=this.config();if((e="function"!=typeof e&&e||{}).name||(e.name=e.name||s.name,e.storeName=e.storeName||s.storeName),e.name){const t=e.name===s.name&&this._dbInfo.db?Oo.resolve(this._dbInfo.db):Zo(e).then((t=>{const n=Fo[e.name],s=n.forages;n.db=t;for(var i=0;i<s.length;i++)s[i]._dbInfo.db=t;return t}));n=e.storeName?t.then((t=>{if(!t.objectStoreNames.contains(e.storeName))return;const n=t.version+1;Go(e);const s=Fo[e.name],i=s.forages;t.close();for(let e=0;e<i.length;e++){const t=i[e];t._dbInfo.db=null,t._dbInfo.version=n}const r=new Oo(((t,s)=>{const i=To.open(e.name,n);i.onerror=e=>{i.result.close(),s(e)},i.onupgradeneeded=()=>{i.result.deleteObjectStore(e.storeName)},i.onsuccess=()=>{const e=i.result;e.close(),t(e)}}));return r.then((e=>{s.db=e;for(let t=0;t<i.length;t++){const n=i[t];n._dbInfo.db=e,Wo(n._dbInfo)}})).catch((t=>{throw(Vo(e,t)||Oo.resolve()).catch((()=>{})),t}))})):t.then((t=>{Go(e);const n=Fo[e.name],s=n.forages;t.close();for(var i=0;i<s.length;i++){s[i]._dbInfo.db=null}const r=new Oo(((t,n)=>{var s=To.deleteDatabase(e.name);s.onerror=()=>{const e=s.result;e&&e.close(),n(s.error)},s.onblocked=()=>{console.warn('dropInstance blocked for database "'+e.name+'" until all open connections are closed')},s.onsuccess=()=>{const e=s.result;e&&e.close(),t(e)}}));return r.then((e=>{n.db=e;for(var t=0;t<s.length;t++){Wo(s[t]._dbInfo)}})).catch((t=>{throw(Vo(e,t)||Oo.resolve()).catch((()=>{})),t}))}))}else n=Oo.reject("Invalid arguments");return Mo(n,t),n}};const sa=na;const ia=function(){return"function"==typeof openDatabase};var ra="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",oa=/^~~local_forage_type~([^~]+)~/,aa="__lfsc__:",ca="arbf",la="blob",da="si08",ua="ui08",ha="uic8",ma="si16",fa="si32",ga="ur16",pa="ui32",va="fl32",ya="fl64",_a=Object.prototype.toString;function ba(e){var t,n,s,i,r,o=.75*e.length,a=e.length,c=0;"="===e[e.length-1]&&(o--,"="===e[e.length-2]&&o--);var l=new ArrayBuffer(o),d=new Uint8Array(l);for(t=0;t<a;t+=4)n=ra.indexOf(e[t]),s=ra.indexOf(e[t+1]),i=ra.indexOf(e[t+2]),r=ra.indexOf(e[t+3]),d[c++]=n<<2|s>>4,d[c++]=(15&s)<<4|i>>2,d[c++]=(3&i)<<6|63&r;return l}function wa(e){var t,n=new Uint8Array(e),s="";for(t=0;t<n.length;t+=3)s+=ra[n[t]>>2],s+=ra[(3&n[t])<<4|n[t+1]>>4],s+=ra[(15&n[t+1])<<2|n[t+2]>>6],s+=ra[63&n[t+2]];return n.length%3==2?s=s.substring(0,s.length-1)+"=":n.length%3==1&&(s=s.substring(0,s.length-2)+"=="),s}var Sa={serialize:function(e,t){var n="";if(e&&(n=_a.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===_a.call(e.buffer))){var s,i=aa;e instanceof ArrayBuffer?(s=e,i+=ca):(s=e.buffer,"[object Int8Array]"===n?i+=da:"[object Uint8Array]"===n?i+=ua:"[object Uint8ClampedArray]"===n?i+=ha:"[object Int16Array]"===n?i+=ma:"[object Uint16Array]"===n?i+=ga:"[object Int32Array]"===n?i+=fa:"[object Uint32Array]"===n?i+=pa:"[object Float32Array]"===n?i+=va:"[object Float64Array]"===n?i+=ya:t(new Error("Failed to get type for BinaryArray"))),t(i+wa(s))}else if("[object Blob]"===n){var r=new FileReader;r.onload=function(){var n="~~local_forage_type~"+e.type+"~"+wa(this.result);t(aa+la+n)},r.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}},deserialize:function(e){if(e.substring(0,9)!==aa)return JSON.parse(e);var t,n=e.substring(13),s=e.substring(9,13);if(s===la&&oa.test(n)){var i=n.match(oa);t=i[1],n=n.substring(i[0].length)}var r=ba(n);switch(s){case ca:return r;case la:return No([r],{type:t});case da:return new Int8Array(r);case ua:return new Uint8Array(r);case ha:return new Uint8ClampedArray(r);case ma:return new Int16Array(r);case ga:return new Uint16Array(r);case fa:return new Int32Array(r);case pa:return new Uint32Array(r);case va:return new Float32Array(r);case ya:return new Float64Array(r);default:throw new Error("Unkown type: "+s)}},stringToBuffer:ba,bufferToString:wa};const xa=Sa;function Ea(e,t,n,s){e.executeSql(`CREATE TABLE IF NOT EXISTS ${t.storeName} (id INTEGER PRIMARY KEY, key unique, value)`,[],n,s)}function Aa(e,t,n,s,i,r){e.executeSql(n,s,i,(function(e,o){o.code===o.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,a){a.rows.length?r(e,o):Ea(e,t,(function(){e.executeSql(n,s,i,r)}),r)}),r):r(e,o)}),r)}function Ca(e,t,n,s){var i=this;e=Do(e);var r=new Oo((function(r,o){i.ready().then((function(){void 0===t&&(t=null);var a=t,c=i._dbInfo;c.serializer.serialize(t,(function(t,l){l?o(l):c.db.transaction((function(n){Aa(n,c,`INSERT OR REPLACE INTO ${c.storeName} (key, value) VALUES (?, ?)`,[e,t],(function(){r(a)}),(function(e,t){o(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(s>0)return void r(Ca.apply(i,[e,a,n,s-1]));o(t)}}))}))})).catch(o)}));return Mo(r,n),r}var $a={_driver:"webSQLStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var s in e)n[s]="string"!=typeof e[s]?e[s].toString():e[s];var i=new Oo((function(e,s){try{n.db=openDatabase(n.name,String(n.version),n.description,n.size)}catch(e){return s(e)}n.db.transaction((function(i){Ea(i,n,(function(){t._dbInfo=n,e()}),(function(e,t){s(t)}))}),s)}));return n.serializer=xa,i},_support:ia(),iterate:function(e,t){var n=this,s=new Oo((function(t,s){n.ready().then((function(){var i=n._dbInfo;i.db.transaction((function(n){Aa(n,i,`SELECT * FROM ${i.storeName}`,[],(function(n,s){for(var r=s.rows,o=r.length,a=0;a<o;a++){var c=r.item(a),l=c.value;if(l&&(l=i.serializer.deserialize(l)),void 0!==(l=e(l,c.key,a+1)))return void t(l)}t()}),(function(e,t){s(t)}))}))})).catch(s)}));return Mo(s,t),s},getItem:function(e,t){var n=this;e=Do(e);var s=new Oo((function(t,s){n.ready().then((function(){var i=n._dbInfo;i.db.transaction((function(n){Aa(n,i,`SELECT * FROM ${i.storeName} WHERE key = ? LIMIT 1`,[e],(function(e,n){var s=n.rows.length?n.rows.item(0).value:null;s&&(s=i.serializer.deserialize(s)),t(s)}),(function(e,t){s(t)}))}))})).catch(s)}));return Mo(s,t),s},setItem:function(e,t,n){return Ca.apply(this,[e,t,n,1])},removeItem:function(e,t){var n=this;e=Do(e);var s=new Oo((function(t,s){n.ready().then((function(){var i=n._dbInfo;i.db.transaction((function(n){Aa(n,i,`DELETE FROM ${i.storeName} WHERE key = ?`,[e],(function(){t()}),(function(e,t){s(t)}))}))})).catch(s)}));return Mo(s,t),s},clear:function(e){var t=this,n=new Oo((function(e,n){t.ready().then((function(){var s=t._dbInfo;s.db.transaction((function(t){Aa(t,s,`DELETE FROM ${s.storeName}`,[],(function(){e()}),(function(e,t){n(t)}))}))})).catch(n)}));return Mo(n,e),n},length:function(e){var t=this,n=new Oo((function(e,n){t.ready().then((function(){var s=t._dbInfo;s.db.transaction((function(t){Aa(t,s,`SELECT COUNT(key) as c FROM ${s.storeName}`,[],(function(t,n){var s=n.rows.item(0).c;e(s)}),(function(e,t){n(t)}))}))})).catch(n)}));return Mo(n,e),n},key:function(e,t){var n=this,s=new Oo((function(t,s){n.ready().then((function(){var i=n._dbInfo;i.db.transaction((function(n){Aa(n,i,`SELECT key FROM ${i.storeName} WHERE id = ? LIMIT 1`,[e+1],(function(e,n){var s=n.rows.length?n.rows.item(0).key:null;t(s)}),(function(e,t){s(t)}))}))})).catch(s)}));return Mo(s,t),s},keys:function(e){var t=this,n=new Oo((function(e,n){t.ready().then((function(){var s=t._dbInfo;s.db.transaction((function(t){Aa(t,s,`SELECT key FROM ${s.storeName}`,[],(function(t,n){for(var s=[],i=0;i<n.rows.length;i++)s.push(n.rows.item(i).key);e(s)}),(function(e,t){n(t)}))}))})).catch(n)}));return Mo(n,e),n},dropInstance:function(e,t){t=zo.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var s,i=this;return s=e.name?new Oo((function(t){var s;s=e.name===n.name?i._dbInfo.db:openDatabase(e.name,"","",0),e.storeName?t({db:s,storeNames:[e.storeName]}):t(function(e){return new Oo((function(t,n){e.transaction((function(s){s.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(n,s){for(var i=[],r=0;r<s.rows.length;r++)i.push(s.rows.item(r).name);t({db:e,storeNames:i})}),(function(e,t){n(t)}))}),(function(e){n(e)}))}))}(s))})).then((function(e){return new Oo((function(t,n){e.db.transaction((function(s){function i(e){return new Oo((function(t,n){s.executeSql(`DROP TABLE IF EXISTS ${e}`,[],(function(){t()}),(function(e,t){n(t)}))}))}for(var r=[],o=0,a=e.storeNames.length;o<a;o++)r.push(i(e.storeNames[o]));Oo.all(r).then((function(){t()})).catch((function(e){n(e)}))}),(function(e){n(e)}))}))})):Oo.reject("Invalid arguments"),Mo(s,t),s}};const ka=$a;function ja(e,t){var n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}function Ta(){return!function(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}()||localStorage.length>0}var Ia={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var n in e)t[n]=e[n];return t.keyPrefix=ja(e,this._defaultConfig),Ta()?(this._dbInfo=t,t.serializer=xa,Oo.resolve()):Oo.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(e,t){var n=this,s=n.ready().then((function(){for(var t=n._dbInfo,s=t.keyPrefix,i=s.length,r=localStorage.length,o=1,a=0;a<r;a++){var c=localStorage.key(a);if(0===c.indexOf(s)){var l=localStorage.getItem(c);if(l&&(l=t.serializer.deserialize(l)),void 0!==(l=e(l,c.substring(i),o++)))return l}}}));return Mo(s,t),s},getItem:function(e,t){var n=this;e=Do(e);var s=n.ready().then((function(){var t=n._dbInfo,s=localStorage.getItem(t.keyPrefix+e);return s&&(s=t.serializer.deserialize(s)),s}));return Mo(s,t),s},setItem:function(e,t,n){var s=this;e=Do(e);var i=s.ready().then((function(){void 0===t&&(t=null);var n=t;return new Oo((function(i,r){var o=s._dbInfo;o.serializer.serialize(t,(function(t,s){if(s)r(s);else try{localStorage.setItem(o.keyPrefix+e,t),i(n)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||r(e),r(e)}}))}))}));return Mo(i,n),i},removeItem:function(e,t){var n=this;e=Do(e);var s=n.ready().then((function(){var t=n._dbInfo;localStorage.removeItem(t.keyPrefix+e)}));return Mo(s,t),s},clear:function(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,n=localStorage.length-1;n>=0;n--){var s=localStorage.key(n);0===s.indexOf(e)&&localStorage.removeItem(s)}}));return Mo(n,e),n},length:function(e){var t=this.keys().then((function(e){return e.length}));return Mo(t,e),t},key:function(e,t){var n=this,s=n.ready().then((function(){var t,s=n._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(s.keyPrefix.length)),t}));return Mo(s,t),s},keys:function(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo,n=localStorage.length,s=[],i=0;i<n;i++){var r=localStorage.key(i);0===r.indexOf(e.keyPrefix)&&s.push(r.substring(e.keyPrefix.length))}return s}));return Mo(n,e),n},dropInstance:function(e,t){if(t=zo.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config();e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}var s,i=this;return s=e.name?new Oo((function(t){e.storeName?t(ja(e,i._defaultConfig)):t(`${e.name}/`)})).then((function(e){for(var t=localStorage.length-1;t>=0;t--){var n=localStorage.key(t);0===n.indexOf(e)&&localStorage.removeItem(n)}})):Oo.reject("Invalid arguments"),Mo(s,t),s}};const Na=Ia,Oa=(e,t)=>e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t),Ma=(e,t)=>{const n=e.length;let s=0;for(;s<n;){if(Oa(e[s],t))return!0;s++}return!1},Ra=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},Da={},za={},La={INDEXEDDB:sa,WEBSQL:ka,LOCALSTORAGE:Na},Pa=[La.INDEXEDDB._driver,La.WEBSQL._driver,La.LOCALSTORAGE._driver],Fa=["dropInstance"],Ua=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Fa),Ba={description:"",driver:Pa.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function qa(e,t){e[t]=function(){const n=arguments;return e.ready().then((function(){return e[t].apply(e,n)}))}}function Ha(){for(let e=1;e<arguments.length;e++){const t=arguments[e];if(t)for(let e in t)t.hasOwnProperty(e)&&(Ra(t[e])?arguments[0][e]=t[e].slice():arguments[0][e]=t[e])}return arguments[0]}class Ga{constructor(e){for(let e in La)if(La.hasOwnProperty(e)){const t=La[e],n=t._driver;this[e]=n,Da[n]||this.defineDriver(t)}this._defaultConfig=Ha({},Ba),this._config=Ha({},this._defaultConfig,e),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((()=>{}))}config(e){if("object"==typeof e){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(let t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config}defineDriver(e,t,n){const s=new Oo((function(t,n){try{const s=e._driver,i=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void n(i);const r=Ua.concat("_initStorage");for(let t=0,s=r.length;t<s;t++){const s=r[t];if((!Ma(Fa,s)||e[s])&&"function"!=typeof e[s])return void n(i)}const o=function(){const t=function(e){return function(){const t=new Error(`Method ${e} is not implemented by the current driver`),n=Oo.reject(t);return Mo(n,arguments[arguments.length-1]),n}};for(let n=0,s=Fa.length;n<s;n++){const s=Fa[n];e[s]||(e[s]=t(s))}};o();const a=function(n){Da[s]&&console.info(`Redefining LocalForage driver: ${s}`),Da[s]=e,za[s]=n,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(a,n):a(!!e._support):a(!0)}catch(e){n(e)}}));return Ro(s,t,n),s}driver(){return this._driver||null}getDriver(e,t,n){const s=Da[e]?Oo.resolve(Da[e]):Oo.reject(new Error("Driver not found."));return Ro(s,t,n),s}getSerializer(e){const t=Oo.resolve(xa);return Ro(t,e),t}ready(e){const t=this,n=t._driverSet.then((()=>(null===t._ready&&(t._ready=t._initDriver()),t._ready)));return Ro(n,e,e),n}setDriver(e,t,n){const s=this;Ra(e)||(e=[e]);const i=this._getSupportedDrivers(e);function r(){s._config.driver=s.driver()}function o(e){return s._extend(e),r(),s._ready=s._initStorage(s._config),s._ready}const a=null!==this._driverSet?this._driverSet.catch((()=>Oo.resolve())):Oo.resolve();return this._driverSet=a.then((()=>{const e=i[0];return s._dbInfo=null,s._ready=null,s.getDriver(e).then((e=>{s._driver=e._driver,r(),s._wrapLibraryMethodsWithReady(),s._initDriver=function(e){return function(){let t=0;return function n(){for(;t<e.length;){let i=e[t];return t++,s._dbInfo=null,s._ready=null,s.getDriver(i).then(o).catch(n)}r();const i=new Error("No available storage method found.");return s._driverSet=Oo.reject(i),s._driverSet}()}}(i)}))})).catch((()=>{r();const e=new Error("No available storage method found.");return s._driverSet=Oo.reject(e),s._driverSet})),Ro(this._driverSet,t,n),this._driverSet}supports(e){return!!za[e]}_extend(e){Ha(this,e)}_getSupportedDrivers(e){const t=[];for(let n=0,s=e.length;n<s;n++){const s=e[n];this.supports(s)&&t.push(s)}return t}_wrapLibraryMethodsWithReady(){for(let e=0,t=Ua.length;e<t;e++)qa(this,Ua[e])}createInstance(e){return new Ga(e)}}const Wa=new Ga;const Va=function(e,t,n){(void 0!==n&&!z(e[t],n)||void 0===n&&!(t in e))&&D(e,t,n)};const Ja=function(e){return B(e)&&be(e)};const Za=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]};const Qa=function(e){return F(e,Ue(e))};const Ka=function(e,t,n,s,i,r,o){var a=Za(e,n),c=Za(t,n),l=o.get(c);if(l)Va(e,n,l);else{var d=r?r(a,c,n+"",e,t,o):void 0,u=void 0===d;if(u){var h=J(c),m=!h&&X(c),f=!h&&!m&&ue(c);d=c,h||m||f?J(a)?d=a:Ja(a)?d=ts(a):m?(u=!1,d=es(c,!0)):f?(u=!1,d=Cs(c,!0)):d=[]:Ki(c)||V(c)?(d=a,V(a)?d=Qa(a):y(a)&&!_(a)||(d=ks(c))):u=!1}u&&(o.set(c,d),i(d,c,s,r,o),o.delete(c)),Va(e,n,d)}};const Ya=function e(t,n,s,i,r){t!==n&&Xs(n,(function(o,a){if(r||(r=new Vn),y(o))Ka(t,n,a,s,e,i,r);else{var c=i?i(Za(t,a),o,a+"",t,n,r):void 0;void 0===c&&(c=o),Va(t,a,c)}}),Ue)};const Xa=ze((function(e,t,n){Ya(e,t,n)}));const ec=ze((function(e,t,n,s){Ya(e,t,n,s)}));const tc=function(){return a.Date.now()},nc=Math.max,sc=Math.min;const ic=function(e,t){let n,s,i,r,o,a,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},l=0,d=!1,u=c.promise?Ao():null;if("function"!=typeof e)throw new TypeError("Expected a function");function h(t){const i=n,o=s,a=u;return n=s=void 0,l=t,r=e.apply(o,i),c.promise&&(a.resolve(r),u=Ao()),c.promise?a:r}function m(e){const n=e-a;return void 0===a||n>=t||n<0||d&&e-l>=i}function f(){const e=tc();if(m(e))return g(e);o=setTimeout(f,function(e){const n=t-(e-a);return d?sc(n,i-(e-l)):n}(e))}function g(e){return o=void 0,n?h(e):(n=s=void 0,c.promise?u:r)}function p(e,t){if(Array.isArray(e)&&Array.isArray(t))return c?.dedupeArrays?e.concat(t.filter((t=>-1===e.indexOf(t)))):e.concat(t)}function v(){const e=tc(),i=m(e);var g;if(g=Array.from(arguments),n=n?.length?g.length?c?.concatArrays||c?.dedupeArrays?ec(n,g,p):Xa(n,g):n:g||[],s=this,a=e,i){if(void 0===o)return function(e){return l=e,o=setTimeout(f,t),c.promise?u:r}(a);if(d)return clearTimeout(o),o=setTimeout(f,t),h(a)}return void 0===o&&(o=setTimeout(f,t)),c.promise?u:r}return t=Sn(t)||0,y(c)&&(d="maxWait"in c,i=d?nc(Sn(c.maxWait)||0,t):i),v.cancel=function(){void 0!==o&&clearTimeout(o),l=0,n=a=s=o=void 0},v.flush=function(){return void 0===o?r:g(tc())},v};function rc(e,t){let n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}const oc={serializer:{serialize:xa.serialize,deserialize:xa.deserialize}};const ac={_driver:"sessionStorageWrapper",_initStorage:function(e){if(oc.keyPrefix=rc(e,this._defaultConfig),e)for(const t in e)oc[t]=e[t]},_support:function(){try{if(sessionStorage&&"setItem"in sessionStorage)return!0}catch(e){console.log(e)}return!1}(),iterate:function(e,t){const n=this.ready().then((function(){const t=oc.keyPrefix,n=t.length,s=sessionStorage.length;let i=1;for(let r=0;r<s;r++){const s=sessionStorage.key(r);if(0!==s.indexOf(t))continue;let o=sessionStorage.getItem(s);if(o&&(o=oc.serializer.deserialize(o)),o=e(o,s.substring(n),i++),void 0!==o)return o}}));return Mo(n,t),n},getItem:function(e,t){e=Do(e);const n=this.ready().then((function(){let t=sessionStorage.getItem(oc.keyPrefix+e);return t&&(t=oc.serializer.deserialize(t)),t}));return Mo(n,t),n},setItem:async function(e,t,n){e=Do(e),await this.ready();const s=t=t??null;oc.serializer.serialize(t,((t,i)=>{if(i)throw i;try{sessionStorage.setItem(oc.keyPrefix+e,t),Mo(Promise.resolve(s),n)}catch(e){if("QuotaExceededError"===e.name||"NS_ERROR_DOM_QUOTA_REACHED"===e.name)throw console.error("Your sesionStorage capacity is used up."),e;throw e}}))},removeItem:function(e,t){e=Do(e);const n=this.ready().then((function(){sessionStorage.removeItem(oc.keyPrefix+e)}));return Mo(n,t),n},clear:function(e){const t=this.ready().then((function(){const e=oc.keyPrefix;for(let t=sessionStorage.length-1;t>=0;t--){const n=sessionStorage.key(t);0===n.indexOf(e)&&sessionStorage.removeItem(n)}}));return Mo(t,e),t},length:function(e){const t=this.keys().then((function(e){return e.length}));return Mo(t,e),t},key:function(e,t){const n=this.ready().then((function(){let t;try{t=sessionStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(oc.keyPrefix.length)),t}));return Mo(n,t),n},keys:function(e){const t=this.ready().then((function(){const e=sessionStorage.length,t=[];for(let n=0;n<e;n++){const e=sessionStorage.key(n);0===e.indexOf(oc.keyPrefix)&&t.push(e.substring(oc.keyPrefix.length))}return t}));return Mo(t,e),t},dropInstance:function(e,t){if(t=zo.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){const t=this.config();e.name=e.name||t.name,e.storeName=e.storeName||t.storeName}const n=this;let s;return s=e.name?new Promise((function(t){e.storeName?t(rc(e,n._defaultConfig)):t(`${e.name}/`)})).then((function(e){for(let t=sessionStorage.length-1;t>=0;t--){const n=sessionStorage.key(t);0===n.indexOf(e)&&sessionStorage.removeItem(n)}})):Promise.reject(new Error("Invalid arguments")),Mo(s,t),s}},cc=ac;var lc=n(6883),dc=n(8487);const uc=$o._driver;Wa.defineDriver($o),(0,lc.extendPrototype)(Wa),(0,dc.extendPrototype)(Wa);class hc{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("local"===t&&!window.localStorage)throw new Error("Skeletor.storage: Environment does not support localStorage.");if("session"===t&&!window.sessionStorage)throw new Error("Skeletor.storage: Environment does not support sessionStorage.");jo(t)?this.storeInitialized=this.initStore(t,n):(this.store=t,n&&(this.store.debouncedSetItems=ic((e=>this.store.setItems(e)),50,{promise:!0})),this.storeInitialized=Promise.resolve()),this.name=e}async initStore(e,t){if("session"===e)Wa.setDriver(cc._driver);else if("local"===e)await Wa.config({driver:Wa.LOCALSTORAGE});else if("in_memory"===e)Wa.config({driver:uc});else if("indexed"!==e)throw new Error("Skeletor.storage: No storage type was specified");this.store=Wa,t&&(this.store.debouncedSetItems=ic((e=>this.store.setItems(e)),50,{promise:!0}))}flush(){return this.store.debouncedSetItems?.flush()}async clear(){await this.store.removeItem(this.name).catch((e=>console.error(e)));const e=new RegExp(`^${this.name}-`),t=(await this.store.keys()).filter((t=>e.test(t)));await Promise.all(t.map((e=>this.store.removeItem(e).catch((e=>console.error(e))))))}sync(){const e=this;async function t(t,n,s){let i,r,o,a;const c=n.collection;["patch","update"].includes(t)&&(a=ko(n.attributes)),await e.storeInitialized;try{const r=n.attributes;switch(t){case"read":i=void 0!==n.id?await e.find(n):await e.findAll();break;case"create":i=await e.create(n,s);break;case"patch":case"update":s.wait&&(n.attributes=a),o=e.update(n,s),s.wait&&(n.attributes=r),i=await o;break;case"delete":i=await e.destroy(n,c)}}catch(t){r=22===t.code&&0===e.getStorageSize()?"Private browsing is unsupported":t.message}if(i){if(s&&s.success){const e="read"===t?i:null;s.success(e,s)}}else r=r||"Record Not Found",s&&s.error&&s.error(r)}return t.__name__="localSync",t}removeCollectionReference(e,t){if(!t)return;const n=t.filter((t=>t.id!==e.id)).map((e=>this.getItemName(e.id)));return this.store.setItem(this.name,n)}addCollectionReference(e,t){if(!t)return;const n=t.map((e=>this.getItemName(e.id))),s=this.getItemName(e.id);return n.includes(s)||n.push(s),this.store.setItem(this.name,n)}getCollectionReferenceData(e){if(!e.collection)return{};const t=e.collection.map((e=>this.getItemName(e.id))),n=this.getItemName(e.id);t.includes(n)||t.push(n);const s={};return s[this.name]=t,s}async save(e){if(this.store.setItems){const t={};return t[this.getItemName(e.id)]=e.toJSON(),Object.assign(t,this.getCollectionReferenceData(e)),this.store.debouncedSetItems?this.store.debouncedSetItems(t):this.store.setItems(t)}{const t=this.getItemName(e.id),n=await this.store.setItem(t,e.toJSON());return await this.addCollectionReference(e,e.collection),n}}create(e,t){return e.id||(e.id=Ut()+Ut()+"-"+Ut()+"-"+Ut()+"-"+Ut()+"-"+Ut()+Ut()+Ut(),e.set(e.idAttribute,e.id,t)),this.save(e)}update(e){return this.save(e)}find(e){return this.store.getItem(this.getItemName(e.id))}async findAll(){const e=await this.store.getItem(this.name);if(e?.length){const t=await this.store.getItems(e);return Object.values(t)}return[]}async destroy(e,t){return await this.flush(),await this.store.removeItem(this.getItemName(e.id)),await this.removeCollectionReference(e,t),e}getStorageSize(){return this.store.length}getItemName(e){return this.name+"-"+e}}hc.sessionStorageInitialized=Wa.defineDriver(cc),hc.localForage=Wa;const mc=hc;function fc(){if(bl.config.get("trusted")){return"sessionStorage"===Vl.settings.get("persistent_store")?"session":"persistent"}return"session"}function gc(e){return"persistent"===e&&"IndexedDB"===Vl.settings.get("persistent_store")}function pc(e,t){const n=t||fc(),s=bl.storage[n];if(void 0===s)throw new TypeError(`createStore: Could not find store for ${e}`);return new mc(e,s,gc(t))}function vc(e,t,n){const s=n||fc();if(e.browserStorage=pc(t,s),gc(s)){const t=()=>e.browserStorage.flush();window.addEventListener(bl.unloadevent,t),e.on("destroy",(()=>window.removeEventListener(bl.unloadevent,t))),e.listenTo(bl,"beforeLogout",t)}}let yc,_c,bc={};function wc(){return yc}function Sc(){if(!bl.bare_jid){const e="No JID to fetch user settings for";throw Yc.error(e),Error(e)}if(!_c?.fetched){const e=`converse.user-settings.${bl.bare_jid}`;_c=new dr({id:e}),vc(_c,e),_c.fetched=_c.fetch({promise:!0})}return _c.fetched}async function xc(){return await Sc(),_c}async function Ec(e,t){return await Sc(),_c.save(e,t)}const Ac={extend:e=>function(e){Zc.merge(Co,e);const t=Object.keys(lr(e,Object.keys(Co))),n=lr(bc,t),s=Be(lr(e,t),n);Zc.merge(yc,s)}(e),update(e){return Yc.warn("The api.settings.update method has been deprecated and will be removed. Please use api.settings.extend instead."),this.extend(e)},get:e=>function(e){if(Object.keys(Co).includes(e))return yc[e]}(e),set(e,t){!function(e,t){if(null==e)return this;let n;y(e)?n=e:"string"==typeof e&&(n={},n[e]=t);const s=Object.keys(lr(n,Object.keys(Co))),i={};s.forEach((e=>{const t=n[e];Ci(yc[e],t)||(i[e]=t,yc[e]=t)})),Object.keys(i).forEach((e=>yc.trigger("change:"+e,i[e]))),yc.trigger("change",i)}(e,t)},listen:{on(e,t,n){!function(e,t,n){yc.on(e,t,n)}(e,t,n)},not(e,t){!function(e,t){yc.off(e,t)}(e,t)}}},Cc={getModel:()=>xc(),async get(e,t){const n=await xc();return void 0===n.get(e)?t:n.get(e)},set(e,t){if(y(e))return Ec(e,{promise:!0});{const n={};return n[e]=t,Ec(n,{promise:!0})}},clear:()=>async function(){return await Sc(),_c.clear()}()};function $c(e,t){const n=so.xmlHtmlNode(e);if(n.getElementsByTagNameNS("http://www.w3.org/1999/xhtml","parsererror").length)throw new Error(`Parser Error: ${e}`);const s=n.firstElementChild;if(["message","iq","presence"].includes(s.nodeName.toLowerCase())&&"jabber:client"!==s.namespaceURI&&"jabber:server"!==s.namespaceURI){const e=`Invalid namespaceURI ${s.namespaceURI}`;if(Yc.error(e),t)throw new Error(e)}return s}class kc{constructor(e,t){this.strings=e,this.values=t}toString(){return this.string=this.string||this.strings.reduce(((e,t)=>{const n=this.strings.indexOf(t);return e+t+(this.values.length>n?this.values[n].toString():"")}),""),this.string}tree(){return this.node=this.node??$c(this.toString(),!0),this.node}}function jc(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];return new kc(e,n)}const Tc={};function Ic(e){return e instanceof Element||e instanceof HTMLDocument}function Nc(e){return e instanceof dr&&(e=e.attributes),!(e.oob_url||e.file||e.is_encrypted&&e.plaintext||e.message||e.body)}function Oc(){return["mobile","fullscreen","embedded"].includes(Ac.get("view_mode"))}function Mc(){const{api:e}=bl;return!bl.config.get("trusted")||e.settings.get("clear_cache_on_logout")||bl.isTestEnv()}async function Rc(){const{api:e}=bl;return await e.trigger("beforeTearDown",{synchronous:!0}),window.removeEventListener("click",bl.onUserActivity),window.removeEventListener("focus",bl.onUserActivity),window.removeEventListener("keypress",bl.onUserActivity),window.removeEventListener("mousemove",bl.onUserActivity),window.removeEventListener(bl.unloadevent,bl.onUserActivity),window.clearInterval(bl.everySecondTrigger),e.trigger("afterTearDown"),bl}function Dc(){return bl.session?.destroy(),delete bl.session,Mc()&&bl.api.user.settings.clear(),bl.api.trigger("clearSession",{synchronous:!0})}function zc(e){let t=e.getMessageText();return(e.get("references")||[]).sort(((e,t)=>t.begin-e.begin)).forEach((e=>{t=`${t.slice(0,e.begin)}@${t.slice(e.begin)}`})),t}function Lc(e){return"string"==typeof e&&(2===So(e.split("@")).length&&!e.startsWith("@")&&!e.endsWith("@"))}function Pc(e){return e instanceof Error}function Fc(e,t,n){Tc.isPersistableModel(e)?e.save(t,n):e.set(t,n)}function Uc(e){return Math.random()*e|0}function Bc(e){const t=crypto.randomUUID?.()??"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=Uc(16);return("x"===e?t:3&t|8).toString(16)}));return"string"==typeof e||"number"==typeof e?t+":"+e:t}function qc(e,t){clearTimeout(e),clearInterval(t)}function Hc(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:300,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3;try{const t=e();if(t)return Promise.resolve(t)}catch(e){return Promise.reject(e)}const s=Ao(),i=new Error;const r=setInterval((function(){try{const t=e();t&&(qc(o,r),s.resolve(t))}catch(e){qc(o,r),s.reject(e)}}),n);const o=setTimeout((function(){qc(o,r);const e=`Wait until promise timed out: \n\n${i.stack}`;console.trace(),Yc.error(e),s.reject(new Error(e))}),t);return s}function Gc(e){const t=bl.promises[e];if(!t)throw new Error(`Tried to replace non-existing promise: ${e}`);if(t.replace){const n=Ao();n.replace=t.replace,bl.promises[e]=n}else Yc.debug(`Not replacing promise "${e}"`)}Tc.isTagEqual=function(e,t){if(e.tree?.())return Tc.isTagEqual(e.tree(),t);if(e instanceof Element)return so.isTagEqual(e,t);throw Error("isTagEqual called with value which isn't an element or Strophe.Builder instance")},Tc.getJIDFromURI=function(e){return e.startsWith("xmpp:")&&e.endsWith("?join")?e.replace(/^xmpp:/,"").replace(/\?join$/,""):e},Tc.getLongestSubstring=function(e,t){return t.reduce((function(t,n){return e.startsWith(n)&&n.length>t.length?n:t}),"")},Tc.isValidMUCJID=function(e){return!e.startsWith("@")&&!e.endsWith("@")},Tc.isSameBareJID=function(e,t){return"string"==typeof e&&"string"==typeof t&&so.getBareJidFromJid(e).toLowerCase()===so.getBareJidFromJid(t).toLowerCase()},Tc.isSameDomain=function(e,t){return"string"==typeof e&&"string"==typeof t&&so.getDomainFromJid(e).toLowerCase()===so.getDomainFromJid(t).toLowerCase()},Tc.isNewMessage=function(e){return e instanceof Element?!(Eo()(`result[xmlns="${so.NS.MAM}"]`,e).length&&Eo()(`delay[xmlns="${so.NS.DELAY}"]`,e).length):(e instanceof dr&&(e=e.attributes),!(e.is_delayed&&e.is_archived))},Tc.shouldCreateMessage=function(e){return e.retracted||!Nc(e)},Tc.shouldCreateGroupchatMessage=function(e){return e.nick&&(Tc.shouldCreateMessage(e)||e.is_tombstone)},Tc.isChatRoom=function(e){return e&&"chatroom"===e.get("type")},Tc.isErrorStanza=function(e){return!!Ic(e)&&"error"===e.getAttribute("type")},Tc.isForbiddenError=function(e){return!!Ic(e)&&Eo()(`error[type="auth"] forbidden[xmlns="${so.NS.STANZAS}"]`,e).length>0},Tc.isServiceUnavailableError=function(e){return!!Ic(e)&&Eo()(`error[type="cancel"] service-unavailable[xmlns="${so.NS.STANZAS}"]`,e).length>0},Tc.getOuterWidth=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.offsetWidth;if(!t)return n;const s=window.getComputedStyle(e);return n+=parseInt(s.marginLeft?s.marginLeft:0,10)+parseInt(s.marginRight?s.marginRight:0,10),n},Tc.stringToElement=function(e){var t=document.createElement("div");return t.innerHTML=e,t.firstElementChild},Tc.matchesSelector=function(e,t){const n=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;return!!n&&n.call(e,t)},Tc.queryChildren=function(e,t){return Array.from(e.childNodes).filter((e=>Tc.matchesSelector(e,t)))},Tc.contains=function(e,t){const n=(e,n)=>e.get(n).toLowerCase().includes(t.toLowerCase());return function(t){if("object"==typeof e)return Object.keys(e).reduce(((e,s)=>e||n(t,s)),!1);if("string"==typeof e)return n(t,e);throw new TypeError("contains: wrong attribute type. Must be string or array.")}},Tc.isOfType=function(e,t){return t.get("type")==e},Tc.isInstance=function(e,t){return t instanceof e},Tc.getAttribute=function(e,t){return t.get(e)},Tc.contains.not=function(e,t){return function(n){return!Tc.contains(e,t)(n)}},Tc.rootContains=function(e,t){return e!==document||e.contains?e.contains?e.contains(t):window.HTMLElement.prototype.contains.call(e,t):document.head.contains(t)||document.body.contains(t)},Tc.createFragmentFromText=function(e){var t,n=document.createDocumentFragment(),s=document.createElement("body");for(s.innerHTML=e;t=s.firstChild;)n.appendChild(t);return n},Tc.isPersistableModel=function(e){return e.collection&&e.collection.browserStorage},Tc.getResolveablePromise=Ao,Tc.getOpenPromise=Ao,Tc.interpolate=function(e,t){return e.replace(/{{{([^{}]*)}}}/g,((e,n)=>{var s=t[n];return"string"==typeof s||"number"==typeof s?s:e}))},Tc.onMultipleEvents=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=[];function s(s){n.push(s),e.length===n.length&&(t(n),n=[])}e.forEach((e=>e.object.on(e.event,s)))},Tc.safeSave=Fc,Tc.siblingIndex=function(e){for(var t=0;e=e.previousElementSibling;t++);return t},Tc.getCurrentWord=function(e,t,n){t||(t=e.selectionEnd||void 0);let[s]=e.value.slice(0,t).split(/\s/).slice(-1);return n&&([s]=s.split(n).slice(-1)),s},Tc.isMentionBoundary=e=>"@"!==e&&RegExp("(\\p{Z}|\\p{P})","u").test(e),Tc.replaceCurrentWord=function(e,t){const n=e.selectionEnd||void 0,s=Bi(e.value.slice(0,n).split(/\s/)),i=e.value,r=Tc.isMentionBoundary(s[0])?s[0]:"";e.value=i.slice(0,n-s.length)+r+`${t} `+i.slice(n);const o=n-s.length+t.length+1;e.selectionEnd=r?o+1:o},Tc.triggerEvent=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Event",s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];const r=document.createEvent(n);r.initEvent(t,s,i),e.dispatchEvent(r)},Tc.getSelectValues=function(e){const t=[],n=e&&e.options;for(var s=0,i=n.length;s<i;s++){const e=n[s];e.selected&&t.push(e.value||e.text)}return t},Tc.placeCaretAtEnd=function(e){e!==document.activeElement&&e.focus();const t=2*e.value.length;setTimeout((()=>e.setSelectionRange(t,t)),1),this.scrollTop=999999};const Wc=document.createElement("div");function Vc(e){return e&&"string"==typeof e&&(Wc.innerHTML=wo().sanitize(e),e=Wc.textContent,Wc.textContent=""),e}function Jc(e){let t;const n={focus:"visible",focusin:"visible",pageshow:"visible",blur:"hidden",focusout:"hidden",pagehide:"hidden"};t=(e=e||document.createEvent("Events")).type in n?n[e.type]:document.hidden?"hidden":"visible",bl.windowState=t,bl.api.trigger("windowStateChanged",{state:t})}const Zc=Object.assign({shouldClearCache:Mc,waitUntil:Hc,isErrorObject:Pc,getRandomInt:Uc,getUniqueId:Bc,isElement:Ic,isEmptyMessage:Nc,isValidJID:Lc,merge:function e(t,n){for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&"__proto__"!==s&&"constructor"!==s&&(y(t[s])?e(t[s],n[s]):t[s]=n[s])},prefixMentions:zc,saveWindowState:Jc,stx:jc,toStanza:$c},Tc),Qc={debug:0,info:1,warn:2,error:3,fatal:4},Kc=Object.assign({debug:console?.log?console.log.bind(console):function(){},error:console?.log?console.log.bind(console):function(){},info:console?.log?console.log.bind(console):function(){},warn:console?.log?console.log.bind(console):function(){}},console),Yc={setLogLevel(e){if(!["debug","info","warn","error","fatal"].includes(e))throw new Error(`Invalid loglevel: ${e}`);this.loglevel=e},log(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(Qc[t]<Qc[this.loglevel])return;"error"===t||"fatal"===t?n=n||"color: maroon":"debug"===t&&(n=n||"color: green"),e instanceof Error?e=e.stack:Ic(e)&&(e=e.outerHTML);const s=n?"%c":"";"error"===t?Kc.error(`${s} ERROR: ${e}`,n):"warn"===t?Kc.warn(`${s} ${(new Date).toISOString()} WARNING: ${e}`,n):"fatal"===t?Kc.error(`${s} FATAL: ${e}`,n):"debug"===t?Kc.debug(`${s} ${(new Date).toISOString()} DEBUG: ${e}`,n):Kc.info(`${s} ${(new Date).toISOString()} INFO: ${e}`,n)},debug(e,t){this.log(e,"debug",t)},error(e,t){this.log(e,"error",t)},info(e,t){this.log(e,"info",t)},warn(e,t){this.log(e,"warn",t)},fatal(e,t){this.log(e,"fatal",t)}};function Xc(e,t,n,s){"function"==typeof n&&(void 0===this.__super__&&(this.__super__=s),this.__super__[e]=n.bind(this));for(var i=arguments.length,r=new Array(i>4?i-4:0),o=4;o<i;o++)r[o-4]=arguments[o];return t.apply(this,r)}class el{constructor(e,t){this.name=t,this.plugged=e,void 0===this.plugged.__super__?this.plugged.__super__={}:"string"==typeof this.plugged.__super__&&(this.plugged.__super__={__string__:this.plugged.__super__}),this.plugged.__super__[t]=this.plugged,this.plugins={},this.initialized_plugins=[]}_overrideAttribute(e,t){const n=t.overrides[e];if("function"==typeof n){const t={};t[this.name]=this.plugged;const s=this.plugged[e];this.plugged[e]=function(){for(var i=arguments.length,r=new Array(i),o=0;o<i;o++)r[o]=arguments[o];return Xc.apply(this,[e,n,s,t,...r])}}else this.plugged[e]=n}_extendObject(e,t){e.prototype.__super__||(e.prototype.__super__={},e.prototype.__super__[this.name]=this.plugged);for(const[n,s]of Object.entries(t))if("events"===n)e.prototype[n]=Object.assign(s,e.prototype[n]);else if("function"==typeof s){const t={};t[this.name]=this.plugged;const i=e.prototype[n];e.prototype[n]=function(){for(var e=arguments.length,r=new Array(e),o=0;o<e;o++)r[o]=arguments[o];return Xc.apply(this,[n,s,i,t,...r])}}else e.prototype[n]=s}loadPluginDependencies(e){e.dependencies?.forEach((t=>{const n=this.plugins[t];if(n){if(n.dependencies?.includes(e.__name__))throw'Found a circular dependency between the plugins "'+e.__name__+'" and "'+t+'"';this.initializePlugin(n)}else this.throwUndefinedDependencyError('Could not find dependency "'+t+'" for the plugin "'+e.__name__+"\". If it's needed, make sure it's loaded by require.js")}))}throwUndefinedDependencyError(e){if(this.plugged.strict_plugin_dependencies)throw e;console.warn?console.warn(e):console.log(e)}applyOverrides(e){Object.keys(e.overrides||{}).forEach((t=>{const n=e.overrides[t];"object"==typeof n?void 0===this.plugged[t]?this.throwUndefinedDependencyError(`Plugin "${e.__name__}" tried to override "${t}" but it's not found.`):this._extendObject(this.plugged[t],n):this._overrideAttribute(t,e)}))}initializePlugin(e){Object.keys(this.allowed_plugins).includes(e.__name__)&&(this.initialized_plugins.includes(e.__name__)||("boolean"==typeof e.enabled&&e.enabled||e.enabled?.(this.plugged)||null==e.enabled)&&(Object.assign(e,this.properties),e.dependencies&&this.loadPluginDependencies(e),this.applyOverrides(e),"function"==typeof e.initialize&&e.initialize.bind(e)(this),this.initialized_plugins.push(e.__name__)))}registerPlugin(e,t){if(e in this.plugins)throw new Error("Error: Plugin name "+e+" is already taken");t.__name__=e,this.plugins[e]=t}initializePlugins(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(Object.keys(this.plugins).length){this.properties=e,this.allowed_plugins={};for(const[e,s]of Object.entries(this.plugins))t.length&&!t.includes(e)||n.includes(e)||(this.allowed_plugins[e]=s);Object.values(this.allowed_plugins).forEach((e=>this.initializePlugin(e)))}}}const tl={enable:function(e,t,n){return void 0===n&&(n="pluginSocket"),void 0===t&&(t="plugged"),e[n]=new el(e,t),e}};const nl=function(e,t){return function(n,s){if(null==n)return n;if(!be(n))return e(n,s);for(var i=n.length,r=t?i:-1,o=Object(n);(t?r--:++r<i)&&!1!==s(o[r],r,o););return n}};const sl=nl(ei);const il=function(e,t){var n;return sl(e,(function(e,s,i){return!(n=t(e,s,i))})),!!n};const rl=function(e,t,n){var s=J(e)?di:il;return n&&De(e,t,n)&&(t=void 0),s(e,Fi(t,3))},ol=function(){this.handlers=[],this.checkUrl=this.checkUrl.bind(this),"undefined"!=typeof window&&(this.location=window.location,this.history=window.history)};ol.extend=Bt;const al=/^[#\/]|\s+$/g,cl=/^\/+|\/+$/g,ll=/#.*$/;ol.started=!1,Object.assign(ol.prototype,Tn,{interval:50,atRoot:function(){return this.location.pathname.replace(/[^\/]$/,"$&/")===this.root&&!this.getSearch()},matchRoot:function(){return this.decodeFragment(this.location.pathname).slice(0,this.root.length-1)+"/"===this.root},decodeFragment:function(e){return decodeURI(e.replace(/%25/g,"%2525"))},getSearch:function(){const e=this.location.href.replace(/#.*/,"").match(/\?.+/);return e?e[0]:""},getHash:function(e){const t=(e||this).location.href.match(/#(.*)$/);return t?t[1]:""},getPath:function(){const e=this.decodeFragment(this.location.pathname+this.getSearch()).slice(this.root.length-1);return"/"===e.charAt(0)?e.slice(1):e},getFragment:function(e){return null==e&&(e=this._usePushState||!this._wantsHashChange?this.getPath():this.getHash()),e.replace(al,"")},start:function(e){if(ol.started)throw new Error("history has already been started");if(ol.started=!0,this.options=Be({root:"/"},this.options,e),this.root=this.options.root,this._wantsHashChange=!1!==this.options.hashChange,this._hasHashChange="onhashchange"in window&&(void 0===document.documentMode||document.documentMode>7),this._useHashChange=this._wantsHashChange&&this._hasHashChange,this._wantsPushState=!!this.options.pushState,this._hasPushState=!(!this.history||!this.history.pushState),this._usePushState=this._wantsPushState&&this._hasPushState,this.fragment=this.getFragment(),this.root=("/"+this.root+"/").replace(cl,"/"),this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){const e=this.root.slice(0,-1)||"/";return this.location.replace(e+"#"+this.getPath()),!0}this._hasPushState&&this.atRoot()&&this.navigate(this.getHash(),{replace:!0})}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe"),this.iframe.src="javascript:0",this.iframe.style.display="none",this.iframe.tabIndex=-1;const e=document.body,t=e.insertBefore(this.iframe,e.firstChild).contentWindow;t.document.open(),t.document.close(),t.location.hash="#"+this.fragment}if(this._usePushState?addEventListener("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe?addEventListener("hashchange",this.checkUrl,!1):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),!this.options.silent)return this.loadUrl()},stop:function(){this._usePushState?removeEventListener("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe&&removeEventListener("hashchange",this.checkUrl,!1),this.iframe&&(document.body.removeChild(this.iframe),this.iframe=null),this._checkUrlInterval&&clearInterval(this._checkUrlInterval),ol.started=!1},route:function(e,t){this.handlers.unshift({route:e,callback:t})},checkUrl:function(e){let t=this.getFragment();if(t===this.fragment&&this.iframe&&(t=this.getHash(this.iframe.contentWindow)),t===this.fragment)return!1;this.iframe&&this.navigate(t),this.loadUrl()},loadUrl:function(e){return!!this.matchRoot()&&(e=this.fragment=this.getFragment(e),rl(this.handlers,(function(t){if(t.route.test(e))return t.callback(e),!0})))},navigate:function(e,t){if(!ol.started)return!1;t&&!0!==t||(t={trigger:!!t}),e=this.getFragment(e||"");let n=this.root;""!==e&&"?"!==e.charAt(0)||(n=n.slice(0,-1)||"/");const s=n+e;e=e.replace(ll,"");const i=this.decodeFragment(e);if(this.fragment!==i){if(this.fragment=i,this._usePushState)this.history[t.replace?"replaceState":"pushState"]({},document.title,s);else{if(!this._wantsHashChange)return this.location.assign(s);if(this._updateHash(this.location,e,t.replace),this.iframe&&e!==this.getHash(this.iframe.contentWindow)){const n=this.iframe.contentWindow;t.replace||(n.document.open(),n.document.close()),this._updateHash(n.location,e,t.replace)}}return t.trigger?this.loadUrl(e):void 0}},_updateHash:function(e,t,n){if(n){const n=e.href.replace(/(javascript:|#).*$/,"");e.replace(n+"#"+t)}else e.hash="#"+t}});const dl=ol;const ul=function(e){return B(e)&&"[object RegExp]"==v(e)};var hl=le&&le.isRegExp;const ml=hl?re(hl):ul,fl=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.history=e.history||new dl,this.preinitialize.apply(this,arguments),e.routes&&(this.routes=e.routes),this._bindRoutes(),this.initialize.apply(this,arguments)};fl.extend=Bt;const gl=/\((.*?)\)/g,pl=/(\(\?)?:\w+/g,vl=/\*\w+/g,yl=/[\-{}\[\]+?.,\\\^$|#\s]/g;Object.assign(fl.prototype,Tn,{preinitialize:function(){},initialize:function(){},route:function(e,t,n){return ml(e)||(e=this._routeToRegExp(e)),_(t)&&(n=t,t=""),n||(n=this[t]),this.history.route(e,(s=>{const i=this._extractParameters(e,s);!1!==this.execute(n,i,t)&&(this.trigger.apply(this,["route:"+t].concat(i)),this.trigger("route",t,i),this.history.trigger("route",this,t,i))})),this},execute:function(e,t,n){e&&e.apply(this,t)},navigate:function(e,t){return this.history.navigate(e,t),this},_bindRoutes:function(){if(!this.routes)return;let e;this.routes=Ft(this,"routes");const t=we(this.routes);for(;null!=(e=t.pop());)this.route(e,this.routes[e])},_routeToRegExp:function(e){return e=e.replace(yl,"\\$&").replace(gl,"(?:$1)?").replace(pl,(function(e,t){return t?e:"([^/?]+)"})).replace(vl,"([^?]*?)"),new RegExp("^"+e+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(e,t){const n=e.exec(t).slice(1);return n.map((function(e,t){return t===n.length-1?e||null:e?decodeURIComponent(e):null}))}});const _l={log:Yc,shouldClearCache:Mc,VERSION_NAME:oo,templates:{},promises:{initialized:Ao()},ANONYMOUS:co,CLOSED:"closed",EXTERNAL:lo,LOGIN:uo,LOGOUT:ho,OPENED:"opened",PREBIND:mo,SUCCESS:"success",FAILURE:"failure",DEFAULT_IMAGE_TYPE:"image/svg+xml",DEFAULT_IMAGE:"PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCI+CiA8cmVjdCB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCIgZmlsbD0iIzU1NSIvPgogPGNpcmNsZSBjeD0iNjQiIGN5PSI0MSIgcj0iMjQiIGZpbGw9IiNmZmYiLz4KIDxwYXRoIGQ9Im0yOC41IDExMiB2LTEyIGMwLTEyIDEwLTI0IDI0LTI0IGgyMyBjMTQgMCAyNCAxMiAyNCAyNCB2MTIiIGZpbGw9IiNmZmYiLz4KPC9zdmc+Cg==",INACTIVE:"inactive",ACTIVE:"active",COMPOSING:"composing",PAUSED:"paused",GONE:"gone",PRIVATE_CHAT_TYPE:"chatbox",CHATROOMS_TYPE:"chatroom",HEADLINES_TYPE:"headline",CONTROLBOX_TYPE:"controlbox",TIMEOUTS:{PAUSED:1e4,INACTIVE:9e4},default_connection_options:{explicitResourceBinding:!0},router:new fl,isTestEnv:()=>"montague.lit/http-bind"===bc.bosh_service_url,getDefaultStore:fc,createStore:pc,__:function(){return _o.__(...arguments)},___:e=>e};Object.assign(_l,Tn),tl.enable(_l,"_converse","pluggable");const bl=_l;var wl=n(2455),Sl=n.n(wl);const xl={authenticated:()=>bl?.connection?.authenticated&&!0,connected:()=>bl?.connection?.connected&&!0,disconnect(){bl.connection&&bl.connection.disconnect()},reconnect(){const{__:e,connection:t}=bl;return t.setConnectionStatus(so.Status.RECONNECTING,e("The connection has dropped, attempting to reconnect.")),t?.reconnecting?t.debouncedReconnect():t.reconnect()},isType:e=>bl.connection.isType(e)},El={async trigger(e){if(!bl._events)return;const t=Array.from(arguments),n=t.pop();if(n&&n.synchronous){const n=bl._events[e]||[],s=t.splice(1);await Promise.all(n.map((e=>e.callback.apply(e.ctx,s))))}else bl.trigger.apply(bl,arguments);const s=bl.promises[e];void 0!==s&&s.resolve()},hook(e,t,n){const s=bl._events[e]||[];return s.length?s.reduce(((e,n)=>e.then((e=>n.callback(t,e)))),Promise.resolve(n)):n},listen:{once:bl.once.bind(bl),on:bl.on.bind(bl),not:bl.off.bind(bl),stanza(e,t,n){Zc(t)?(n=t,t={}):t=t||{},bl.connection.addHandler(n,t.ns,e,t.type,t.id,t.from,t)}}},Al={promises:{add(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];(e=Array.isArray(e)?e:[e]).forEach((e=>{const n=Ao();n.replace=t,bl.promises[e]=n}))}},waitUntil(e){if("function"==typeof e)return Hc(e);{const t=bl.promises[e];return void 0===t?null:t}}};class Cl extends Error{}const $l={send(e){const{api:t}=bl;return t.connection.connected()?("string"==typeof e?e=$c(e):e?.tree&&(e=e.tree()),"iq"===e.tagName?t.sendIQ(e):(bl.connection.send(e),void t.trigger("send",e))):(Yc.warn("Not sending stanza because we're not connected!"),void Yc.warn(so.serialize(e)))},sendIQ(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const{api:s,connection:i}=bl;let r;return e=e.tree?.()??e,["get","set"].includes(e.getAttribute("type"))?(t=t||s.settings.get("stanza_timeout"),n?(r=new Promise(((n,s)=>i.sendIQ(e,n,s,t))),r.catch((n=>{if(null===n)throw new Cl(`Timeout error after ${t}ms for the following IQ stanza: ${so.serialize(e)}`)}))):r=new Promise((n=>i.sendIQ(e,n,n,t)))):(bl.connection.sendIQ(e),r=Promise.resolve()),s.trigger("send",e),r}},kl={presence:{async send(e,t,n,s){await Vl.waitUntil("statusInitialized"),s&&!Array.isArray(s)&&(s=[s]);const i=bl.xmppstatus,r=await i.constructPresence(e,t,n);if(s?.map((e=>e?.tree()??e)).forEach((e=>r.cnode(e).up())),Vl.send(r),["away","chat","dnd","online","xa",void 0].includes(e)){(await Vl.rooms.get()).forEach((t=>t.sendStatusPresence(e,n,s)))}}}};var jl=Math.max,Tl=Math.min;const Il=function(e,t,n){var s,i,r,o,a,c,l=0,d=!1,u=!1,h=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function m(t){var n=s,r=i;return s=i=void 0,l=t,o=e.apply(r,n)}function f(e){var n=e-c;return void 0===c||n>=t||n<0||u&&e-l>=r}function g(){var e=tc();if(f(e))return p(e);a=setTimeout(g,function(e){var n=t-(e-c);return u?Tl(n,r-(e-l)):n}(e))}function p(e){return a=void 0,h&&s?m(e):(s=i=void 0,o)}function v(){var e=tc(),n=f(e);if(s=arguments,i=this,c=e,n){if(void 0===a)return function(e){return l=e,a=setTimeout(g,t),d?m(e):o}(c);if(u)return clearTimeout(a),a=setTimeout(g,t),m(c)}return void 0===a&&(a=setTimeout(g,t)),o}return t=Sn(t)||0,y(n)&&(d=!!n.leading,r=(u="maxWait"in n)?jl(Sn(n.maxWait)||0,t):r,h="trailing"in n?!!n.trailing:h),v.cancel=function(){void 0!==a&&clearTimeout(a),l=0,s=c=i=a=void 0},v.flush=function(){return void 0===a?o:p(tc())},v};var Nl=n(5914),Ol=n(5848);const Ml=Object.keys(so.Status).reduce(((e,t)=>Math.max(e,so.Status[t])),0);so.Status.RECONNECTING=Ml+1;class Rl extends so.Connection{constructor(e,t){super(e,t),this.debouncedReconnect=Il(this.reconnect,3e3)}static generateResource(){return`/converse.js-${Math.floor(139749528*Math.random()).toString()}`}async bind(){await Vl.trigger("beforeResourceBinding",{synchronous:!0}),super.bind()}async onDomainDiscovered(e){const t=await e.text(),n=(new window.DOMParser).parseFromString(t,"text/xml").firstElementChild;if("XRD"!=n.nodeName||"http://docs.oasis-open.org/ns/xri/xrd-1.0"!=n.namespaceURI)return Yc.warn("Could not discover XEP-0156 connection methods");const s=Eo()('Link[rel="urn:xmpp:alt-connections:xbosh"]',n),i=Eo()('Link[rel="urn:xmpp:alt-connections:websocket"]',n),r=s.map((e=>e.getAttribute("href"))),o=i.map((e=>e.getAttribute("href")));0===r.length&&0===o.length?Yc.warn("Neither BOSH nor WebSocket connection methods have been specified with XEP-0156."):(Vl.settings.set("websocket_url",o.pop()),Vl.settings.set("bosh_service_url",r.pop()),this.service=Vl.settings.get("websocket_url")||Vl.settings.get("bosh_service_url"),this.setProtocol())}async discoverConnectionMethods(e){const t={mode:"cors",headers:{Accept:"application/xrd+xml, text/xml"}},n=`https://${e}/.well-known/host-meta`;let s;try{s=await fetch(n,t)}catch(e){return Yc.error(`Failed to discover alternative connection methods at ${n}`),void Yc.error(e)}s.status>=200&&s.status<400?await this.onDomainDiscovered(s):Yc.warn("Could not discover XEP-0156 connection methods")}async connect(e,t,n){if(Vl.settings.get("discover_connection_methods")){const t=so.getDomainFromJid(e);await this.discoverConnectionMethods(t)}if(!Vl.settings.get("bosh_service_url")&&!Vl.settings.get("websocket_url"))throw new Error("You must supply a value for either the bosh_service_url or websocket_url or both.");super.connect(e,t,n||this.onConnectStatusChanged,59)}async switchTransport(){Vl.connection.isType("websocket")&&Vl.settings.get("bosh_service_url")?(await Fl(bl.bare_jid),this._proto._doDisconnect(),this._proto=new so.Bosh(this),this.service=Vl.settings.get("bosh_service_url")):Vl.connection.isType("bosh")&&Vl.settings.get("websocket_url")&&(Vl.settings.get("authentication")===co?await Fl(Vl.settings.get("jid")):await Fl(bl.bare_jid),this._proto._doDisconnect(),this._proto=new so.Websocket(this),this.service=Vl.settings.get("websocket_url"))}async reconnect(){Yc.debug("RECONNECTING: the connection has dropped, attempting to reconnect."),this.reconnecting=!0,await Rc();const e=bl.connfeedback.get("connection_status");return e===so.Status.CONNFAIL?this.switchTransport():e===so.Status.AUTHFAIL&&Vl.settings.get("authentication")===co&&await Fl(Vl.settings.get("jid")),Vl.trigger("will-reconnect"),Vl.settings.get("authentication")===co&&await Dc(),Vl.user.login()}async onConnected(e){delete this.reconnecting,this.flush(),await Fl(this.jid),bl.config.get("trusted")&&localStorage.setItem("conversejs-session-jid",bl.bare_jid),await Vl.trigger("afterResourceBinding",e,{synchronous:!0}),e?Vl.trigger("reconnected"):Vl.trigger("connected")}setDisconnectionCause(e,t,n){void 0===e?(delete this.disconnection_cause,delete this.disconnection_reason):(void 0===this.disconnection_cause||n)&&(this.disconnection_cause=e,this.disconnection_reason=t)}setConnectionStatus(e,t){this.status=e,bl.connfeedback.set({connection_status:e,message:t})}async finishDisconnection(){Yc.debug("DISCONNECTED"),delete this.reconnecting,this.reset(),Rc(),await Dc(),delete bl.connection,Vl.trigger("disconnected")}onDisconnected(){if(!Vl.settings.get("auto_reconnect"))return this.finishDisconnection();{const e=this.disconnection_reason;if(this.disconnection_cause===so.Status.AUTHFAIL)return Vl.settings.get("credentials_url")||Vl.settings.get("authentication")===co?Vl.connection.reconnect():this.finishDisconnection();if(this.status===so.Status.CONNECTING){const{__:e}=bl;return this.setConnectionStatus(so.Status.CONNFAIL,e("An error occurred while connecting to the chat server.")),this.finishDisconnection()}if(this.disconnection_cause===ho||e===so.ErrorCondition.NO_AUTH_MECH||"host-unknown"===e||"remote-connection-failed"===e)return this.finishDisconnection();Vl.connection.reconnect()}}onConnectStatusChanged(e,t){const{__:n}=bl;if(Yc.debug(`Status changed to: ${fo[e]}`),e===so.Status.ATTACHFAIL)this.setConnectionStatus(e),this.worker_attach_promise?.resolve(!1);else if(e===so.Status.CONNECTED||e===so.Status.ATTACHED){if(this.worker_attach_promise?.isResolved&&this.status===so.Status.ATTACHED)return;this.setConnectionStatus(e),this.worker_attach_promise?.resolve(!0),bl.send_initial_presence=!0,this.setDisconnectionCause(),this.reconnecting?(Yc.debug(e===so.Status.CONNECTED?"Reconnected":"Reattached"),this.onConnected(!0)):(Yc.debug(e===so.Status.CONNECTED?"Connected":"Attached"),this.restored&&(bl.send_initial_presence=!1),this.onConnected())}else if(e===so.Status.DISCONNECTED)this.setDisconnectionCause(e,t),this.onDisconnected();else if(e===so.Status.BINDREQUIRED)this.bind();else if(e===so.Status.ERROR)this.setConnectionStatus(e,n("An error occurred while connecting to the chat server."));else if(e===so.Status.CONNECTING)this.setConnectionStatus(e);else if(e===so.Status.AUTHENTICATING)this.setConnectionStatus(e);else if(e===so.Status.AUTHFAIL)t||(t=n("Your XMPP address and/or password is incorrect. Please try again.")),this.setConnectionStatus(e,t),this.setDisconnectionCause(e,t,!0),this.onDisconnected();else if(e===so.Status.CONNFAIL){let s=t;"host-unknown"===t||"remote-connection-failed"==t?s=n("Sorry, we could not connect to the XMPP host with domain: %1$s",`"${so.getDomainFromJid(this.jid)}"`):void 0!==t&&t===so?.ErrorCondition?.NO_AUTH_MECH&&(s=n("The XMPP server did not offer a supported authentication mechanism")),this.setConnectionStatus(e,s),this.setDisconnectionCause(e,t)}else e===so.Status.DISCONNECTING&&this.setDisconnectionCause(e,t)}isType(e){return"websocket"===e.toLowerCase()?this._proto instanceof so.Websocket:"bosh"===e.toLowerCase()?so.Bosh&&this._proto instanceof so.Bosh:void 0}hasResumed(){return Vl.settings.get("connection_options")?.worker||this.isType("bosh")?bl.connfeedback.get("connection_status")===so.Status.ATTACHED:!this.do_bind}restoreWorkerSession(){return this.attach(this.onConnectStatusChanged),this.worker_attach_promise=Ao(),this.worker_attach_promise}}class Dl extends Rl{constructor(e,t){super(e,t),this.sent_stanzas=[],this.IQ_stanzas=[],this.IQ_ids=[],this.features=so.xmlHtmlNode('<stream:features xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client"><ver xmlns="urn:xmpp:features:rosterver"/><csi xmlns="urn:xmpp:csi:0"/><this xmlns="http://jabber.org/protocol/caps" ver="UwBpfJpEt3IoLYfWma/o/p3FFRo=" hash="sha-1" node="http://prosody.im"/><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><required/></bind><sm xmlns=\'urn:xmpp:sm:3\'/><session xmlns="urn:ietf:params:xml:ns:xmpp-session"><optional/></session></stream:features>').firstChild,this._proto._processRequest=()=>{},this._proto._disconnect=()=>this._onDisconnectTimeout(),this._proto._onDisconnectTimeout=()=>{},this._proto._connect=()=>{this.connected=!0,this.mock=!0,this.jid="romeo@montague.lit/orchard",this._changeConnectStatus(so.Status.BINDREQUIRED)}}_processRequest(){}sendIQ(e,t,n){e=e.tree?.()??e,this.IQ_stanzas.push(e);const s=super.sendIQ(e,t,n);return this.IQ_ids.push(s),s}send(e){return e=e.tree?.()??e,this.sent_stanzas.push(e),super.send(e)}async bind(){await Vl.trigger("beforeResourceBinding",{synchronous:!0}),this.authenticated=!0,bl.no_connection_on_bind||this._changeConnectStatus(so.Status.CONNECTED)}}function zl(){const{api:e}=bl;return("WebSocket"in window||"MozWebSocket"in window)&&e.settings.get("websocket_url")?e.settings.get("websocket_url"):e.settings.get("bosh_service_url")?e.settings.get("bosh_service_url"):""}function Ll(){const e=bl.api;if(!e.settings.get("bosh_service_url")&&e.settings.get("authentication")===mo)throw new Error("authentication is set to 'prebind' but we don't have a BOSH connection");const t=bl.isTestEnv()?Dl:Rl;bl.connection=new t(zl(),Object.assign(bl.default_connection_options,e.settings.get("connection_options"),{keepalive:e.settings.get("keepalive")})),function(){const e={};e[so.LogLevel.DEBUG]="debug",e[so.LogLevel.INFO]="info",e[so.LogLevel.WARN]="warn",e[so.LogLevel.ERROR]="error",e[so.LogLevel.FATAL]="fatal",so.log=(t,n)=>Yc.log(n,e[t]),so.error=e=>Yc.error(e),bl.connection.xmlInput=e=>Yc.debug(e.outerHTML,"color: darkgoldenrod"),bl.connection.xmlOutput=e=>Yc.debug(e.outerHTML,"color: darkcyan")}(),e.trigger("connectionInitialized")}function Pl(e,t){t=e.session.get("jid")||t,e.api.settings.get("authentication")===co||so.getResourceFromJid(t)||(t=t.toLowerCase()+Rl.generateResource()),e.jid=t,e.bare_jid=so.getBareJidFromJid(t),e.resource=so.getResourceFromJid(t),e.domain=so.getDomainFromJid(t),e.session.save({jid:t,bare_jid:e.bare_jid,resource:e.resource,domain:e.domain,active:!0}),e.connection.jid=t}async function Fl(e){return await async function(e,t){const n=e.api.settings.get("connection_options").worker,s=so.getBareJidFromJid(t).toLowerCase(),i=`converse.session-${s}`;e.session?.get("id")!==i?(!function(e,t){if("sessionStorage"===e.api.settings.get("persistent_store"))return;if("BrowserExtLocal"===e.api.settings.get("persistent_store"))return mc.localForage.defineDriver(Nl.Z).then((()=>mc.localForage.setDriver("webExtensionLocalStorage"))),void(e.storage.persistent=mc.localForage);if("BrowserExtSync"===e.api.settings.get("persistent_store"))return mc.localForage.defineDriver(Ol.Z).then((()=>mc.localForage.setDriver("webExtensionSyncStorage"))),void(e.storage.persistent=mc.localForage);const n={name:e.isTestEnv()?"converse-test-persistent":"converse-persistent",storeName:t};"localStorage"===e.api.settings.get("persistent_store")?(n.description="localStorage instance",n.driver=[mc.localForage.LOCALSTORAGE]):"IndexedDB"===e.api.settings.get("persistent_store")&&(n.description="indexedDB instance",n.driver=[mc.localForage.INDEXEDDB]),e.storage.persistent=mc.localForage.createInstance(n)}(e,s),e.session=new dr({id:i}),vc(e.session,i,n?"persistent":"session"),await new Promise((t=>e.session.fetch({success:t,error:t}))),!n&&e.session.get("active")&&(e.session.clear(),e.session.save({id:i})),Pl(e,t),window.addEventListener(e.unloadevent,(()=>e.session?.save("active",!1))),e.api.trigger("userSessionInitialized")):Pl(e,t)}(bl,e),bl.api.trigger("setUserJID"),e}async function Ul(e){const{api:t}=e;await t.trigger("cleanup",{synchronous:!0}),e.router.history.stop(),function(e){const{api:t}=e;document.removeEventListener("visibilitychange",Jc),t.trigger("unregisteredGlobalEventHandlers")}(e),e.connection?.reset(),e.stopListening(),e.off(),e.promises.initialized.isResolved&&t.promises.add("initialized")}function Bl(){return new Promise(Il((async(e,t)=>{let n=new XMLHttpRequest;n.open("GET",bl.api.settings.get("credentials_url"),!0),n.setRequestHeader("Accept","application/json, text/javascript"),n.onload=()=>{if(n.status>=200&&n.status<400){const t=JSON.parse(n.responseText);Fl(t.jid).then((()=>{e({jid:t.jid,password:t.password})}))}else t(new Error(`${n.status}: ${n.responseText}`))},n.onerror=t,n=await bl.api.hook("beforeFetchLoginCredentials",this,n),n.send()}),arguments.length>0&&void 0!==arguments[0]?arguments[0]:0))}async function ql(e,t){const{api:n}=bl;if(n.settings.get("authentication")===uo){if(e)return Gl(e);if(n.settings.get("credentials_url"))return Gl(await async function(){let e,t=0;for(;!e;){try{e=await Bl(t)}catch(e){Yc.error("Could not fetch login credentials"),Yc.error(e)}t=2e3}return e}());if(bl.jid&&(n.settings.get("password")||bl.connection.pass))return Gl();if(n.settings.get("reuse_scram_keys")){const e=await async function(){const e=localStorage.getItem("conversejs-session-jid");if(!e)return null;await Fl(e);const t=(await Hl(e)).get("scram_keys");return t?{jid:e,password:t}:null}();if(e)return Gl(e)}if(!bl.isTestEnv()&&"credentials"in navigator){const e=await async function(){if(!localStorage.getItem("conversejs-session-jid"))return null;try{const e=await navigator.credentials.get({password:!0});if(e&&"password"==e.type&&Lc(e.id))return await Fl(e.id),{jid:e.id,password:e.password}}catch(e){return Yc.error(e),null}}();if(e)return Gl(e)}bl.isTestEnv()||Yc.warn("attemptNonPreboundSession: Couldn't find credentials to log in with")}else![co,lo].includes(n.settings.get("authentication"))||t&&!n.settings.get("auto_login")||Gl()}async function Hl(e){const t=`converse.scram-keys-${so.getBareJidFromJid(e)}`,n=new dr({id:t});return vc(n,t,"persistent"),await new Promise((e=>n.fetch({success:e,error:e}))),n}async function Gl(e){const{api:t}=bl;if([co,lo].includes(t.settings.get("authentication"))){if(!bl.jid)throw new Error("Config Error: when using anonymous login you need to provide the server's domain via the 'jid' option. Either when calling converse.initialize, or when calling _converse.api.user.login.");bl.connection.reconnecting||bl.connection.reset(),bl.connection.connect(bl.jid.toLowerCase())}else if(t.settings.get("authentication")===uo){const n=e?.password??(bl.connection?.pass||t.settings.get("password"));if(!n){if(t.settings.get("auto_login"))throw new Error("autoLogin: If you use auto_login and authentication='login' then you also need to provide a password.");return bl.connection.setDisconnectionCause(so.Status.AUTHFAIL,void 0,!0),void t.connection.disconnect()}let s;if(bl.connection.reconnecting||(bl.connection.reset(),bl.connection.service=zl()),bl.config.get("trusted")&&bl.jid&&t.settings.get("reuse_scram_keys")&&!n?.ck){const e=await Hl(bl.jid);s=t=>{const{scram_keys:n}=bl.connection;n&&e.save({scram_keys:n}),bl.connection.onConnectStatusChanged(t)}}bl.connection.connect(bl.jid,n,s)}}const Wl={user:{settings:Cc,...kl,jid:()=>bl.connection.jid,async login(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const{api:s}=bl;if(e=e||s.settings.get("jid"),(!bl.connection?.jid||e&&!Zc.isSameDomain(bl.connection.jid,e))&&Ll(),s.settings.get("connection_options")?.worker&&await bl.connection.restoreWorkerSession())return;e&&(e=await Fl(e));const i=bl.pluggable.plugins["converse-bosh"];if(i?.enabled()){if(await bl.restoreBOSHSession())return;if(s.settings.get("authentication")===mo&&(!n||s.settings.get("auto_login")))return bl.startNewPreboundBOSHSession()}t=t||s.settings.get("password");ql(e&&t?{jid:e,password:t}:null,n)},async logout(){const{api:e}=bl;await e.trigger("beforeLogout",{synchronous:!0});const t=Ao(),n=()=>{Object.keys(bl.promises).forEach(Gc),delete bl.jid,localStorage.removeItem("conversejs-session-jid"),e.trigger("logout"),t.resolve()};return bl.connection.setDisconnectionCause(ho,void 0,!0),void 0!==bl.connection?(e.listen.once("disconnected",(()=>n())),bl.connection.disconnect()):n(),t}}},Vl=bl.api={connection:xl,settings:Ac,...$l,...Wl,...El,...Al};var Jl=n(7076),Zl=n.n(Jl);const Ql=dr.extend({defaults:{connection_status:so.Status.DISCONNECTED,message:""},initialize(){const{api:e}=bl;this.on("change",(()=>e.trigger("connfeedback",bl.connfeedback)))}});var Kl=n(9988),Yl=n.n(Kl);const Xl=function(e,t,n,s){for(var i=-1,r=null==e?0:e.length;++i<r;){var o=e[i];t(s,o,n(o),e)}return s};const ed=function(e,t,n,s){return sl(e,(function(e,i,r){t(s,e,n(e),r)})),s};const td=function(e,t){return function(n,s){var i=J(n)?Xl:ed,r=t?t():{};return i(n,e,Fi(s,2),r)}};var nd=Object.prototype.hasOwnProperty,sd=td((function(e,t,n){nd.call(e,n)?++e[n]:D(e,n,1)}));const id=sd;const rd=function(e,t,n,s){for(var i=e.length,r=n+(s?1:-1);s?r--:++r<i;)if(t(e[r],r,e))return r;return-1};const od=function(e){return e!=e};const ad=function(e,t,n){for(var s=n-1,i=e.length;++s<i;)if(e[s]===t)return s;return-1};const cd=function(e,t,n){return t==t?ad(e,t,n):rd(e,od,n)};const ld=function(e,t){return!!(null==e?0:e.length)&&cd(e,t,0)>-1};const dd=function(e,t,n){for(var s=-1,i=null==e?0:e.length;++s<i;)if(n(t,e[s]))return!0;return!1};const ud=function(e,t,n,s){var i=-1,r=ld,o=!0,a=e.length,c=[],l=t.length;if(!a)return c;n&&(t=It(t,re(n))),s?(r=dd,o=!1):t.length>=200&&(r=ui,o=!1,t=new li(t));e:for(;++i<a;){var d=e[i],u=null==n?d:n(d);if(d=s||0!==d?d:0,o&&u==u){for(var h=l;h--;)if(t[h]===u)continue e;c.push(d)}else r(t,u,s)||c.push(d)}return c};const hd=Re((function(e,t){return Ja(e)?ud(e,tr(t,1,Ja,!0)):[]}));const md=function(e,t){for(var n=-1,s=null==e?0:e.length;++n<s;)if(!t(e[n],n,e))return!1;return!0};const fd=function(e,t){var n=!0;return sl(e,(function(e,s,i){return n=!!t(e,s,i)})),n};const gd=function(e,t,n){var s=J(e)?md:fd;return n&&De(e,t,n)&&(t=void 0),s(e,Fi(t,3))};var pd=Math.max;const vd=function(e,t,n){var s=null==e?0:e.length;if(!s)return-1;var i=null==n?0:An(n);return i<0&&(i=pd(s+i,0)),rd(e,Fi(t,3),i)};var yd=Math.max,_d=Math.min;const bd=function(e,t,n){var s=null==e?0:e.length;if(!s)return-1;var i=s-1;return void 0!==n&&(i=An(n),i=n<0?yd(s+i,0):_d(i,s-1)),rd(e,Fi(t,3),i,!0)};var wd=Object.prototype.hasOwnProperty,Sd=td((function(e,t,n){wd.call(e,n)?e[n].push(t):D(e,n,[t])}));const xd=Sd;var Ed=Math.max;const Ad=function(e,t,n){var s=null==e?0:e.length;if(!s)return-1;var i=null==n?0:An(n);return i<0&&(i=Ed(s+i,0)),cd(e,t,i)};var Cd=td((function(e,t,n){D(e,n,t)}));const $d=Cd;const kd=function(e,t,n){for(var s=n+1;s--;)if(e[s]===t)return s;return s};var jd=Math.max,Td=Math.min;const Id=function(e,t,n){var s=null==e?0:e.length;if(!s)return-1;var i=s;return void 0!==n&&(i=(i=An(n))<0?jd(s+i,0):Td(i,s-1)),t==t?kd(e,t,i):rd(e,od,i,!0)};const Nd=function(e,t){var n=-1,s=be(e)?Array(e.length):[];return sl(e,(function(e,i,r){s[++n]=t(e,i,r)})),s};const Od=function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e};const Md=function(e,t){if(e!==t){var n=void 0!==e,s=null===e,i=e==e,r=Ge(e),o=void 0!==t,a=null===t,c=t==t,l=Ge(t);if(!a&&!l&&!r&&e>t||r&&o&&c&&!a&&!l||s&&o&&c||!n&&c||!i)return 1;if(!s&&!r&&!l&&e<t||l&&n&&i&&!s&&!r||a&&n&&i||!o&&i||!c)return-1}return 0};const Rd=function(e,t,n){for(var s=-1,i=e.criteria,r=t.criteria,o=i.length,a=n.length;++s<o;){var c=Md(i[s],r[s]);if(c)return s>=a?c:c*("desc"==n[s]?-1:1)}return e.index-t.index};const Dd=function(e,t,n){t=t.length?It(t,(function(e){return J(e)?function(t){return Ni(t,1===e.length?e[0]:e)}:e})):[$e];var s=-1;t=It(t,re(Fi));var i=Nd(e,(function(e,n,i){var r=It(t,(function(t){return t(e)}));return{criteria:r,index:++s,value:e}}));return Od(i,(function(e,t){return Rd(e,t,n)}))};var zd=Re((function(e,t){if(null==e)return[];var n=t.length;return n>1&&De(e,t[0],t[1])?t=[]:n>2&&De(t[0],t[1],t[2])&&(t=[t[0]]),Dd(e,tr(t,1),[])}));const Ld=zd,Pd=Array.prototype.slice,Fd=function(e,t){t||(t={}),this.preinitialize.apply(this,arguments),t.model&&(this.model=t.model),void 0!==t.comparator&&(this.comparator=t.comparator),this._reset(),this.initialize.apply(this,arguments),e&&this.reset(e,Be({silent:!0},t))};Fd.extend=Bt;const Ud={add:!0,remove:!0,merge:!0},Bd={add:!0,remove:!1},qd=function(e,t,n){n=Math.min(Math.max(n,0),e.length);const s=Array(e.length-n),i=t.length;let r;for(r=0;r<s.length;r++)s[r]=e[r+n];for(r=0;r<i;r++)e[r+n]=t[r];for(r=0;r<s.length;r++)e[r+i+n]=s[r]};Object.assign(Fd.prototype,Tn,{model:dr,preinitialize:function(){},initialize:function(){},toJSON:function(e){return this.map((function(t){return t.toJSON(e)}))},sync:function(e,t,n){return Vt(this)(e,t,n)},add:function(e,t){return this.set(e,Be({merge:!1},t,Bd))},remove:function(e,t){t=Be({},t);const n=!Array.isArray(e);e=n?[e]:e.slice();const s=this._removeModels(e,t);return!t.silent&&s.length&&(t.changes={added:[],merged:[],removed:s},this.trigger("update",this,t)),n?s[0]:s},set:function(e,t){if(null==e)return;(t=Be({},Ud,t)).parse&&!this._isModel(e)&&(e=this.parse(e,t)||[]);const n=!Array.isArray(e);e=n?[e]:e.slice();let s=t.at;null!=s&&(s=+s),s>this.length&&(s=this.length),s<0&&(s+=this.length+1);const i=[],r=[],o=[],a=[],c={},l=t.add,d=t.merge,u=t.remove;let h=!1;const m=this.comparator&&null==s&&!1!==t.sort,f=jo(this.comparator)?this.comparator:null;let g,p;for(p=0;p<e.length;p++){g=e[p];const n=this.get(g);if(n){if(d&&g!==n){let e=this._isModel(g)?g.attributes:g;t.parse&&(e=n.parse(e,t)),n.set(e,t),o.push(n),m&&!h&&(h=n.hasChanged(f))}c[n.cid]||(c[n.cid]=!0,i.push(n)),e[p]=n}else l&&(g=e[p]=this._prepareModel(g,t),g&&(r.push(g),this._addReference(g,t),c[g.cid]=!0,i.push(g)))}if(u){for(p=0;p<this.length;p++)g=this.models[p],c[g.cid]||a.push(g);a.length&&this._removeModels(a,t)}let v=!1;const y=!m&&l&&u;if(i.length&&y?(v=this.length!==i.length||rl(this.models,((e,t)=>e!==i[t])),this.models.length=0,qd(this.models,i,0),this.length=this.models.length):r.length&&(m&&(h=!0),qd(this.models,r,null==s?this.length:s),this.length=this.models.length),h&&this.sort({silent:!0}),!t.silent){for(p=0;p<r.length;p++)null!=s&&(t.index=s+p),g=r[p],g.trigger("add",g,this,t);(h||v)&&this.trigger("sort",this,t),(r.length||a.length||o.length)&&(t.changes={added:r,removed:a,merged:o},this.trigger("update",this,t))}return n?e[0]:e},clearStore:async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;await Promise.all(this.models.filter(t).map((t=>new Promise((n=>{t.destroy(Object.assign(e,{success:n,error:(e,t)=>{console.error(t),n()}}))}))))),await this.browserStorage.clear(),this.reset()},reset:function(e,t){t=t?Fs(t):{};for(let e=0;e<this.models.length;e++)this._removeReference(this.models[e],t);return t.previousModels=this.models,this._reset(),e=this.add(e,Be({silent:!0},t)),t.silent||this.trigger("reset",this,t),e},push:function(e,t){return this.add(e,Be({at:this.length},t))},pop:function(e){const t=this.at(this.length-1);return this.remove(t,e)},unshift:function(e,t){return this.add(e,Be({at:0},t))},shift:function(e){const t=this.at(0);return this.remove(t,e)},slice:function(){return Pd.apply(this.models,arguments)},filter:function(e,t){return this.models.filter(_(e)?e:t=>t.matches(e),t)},every:function(e){return gd(this.models.map((e=>e.attributes)),e)},difference:function(e){return hd(this.models,e)},max:function(){return Math.max.apply(Math,this.models)},min:function(){return Math.min.apply(Math,this.models)},drop:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.models.slice(e)},some:function(e){return rl(this.models.map((e=>e.attributes)),e)},sortBy:function(e){return Ld(this.models,_(e)?e:t=>jo(e)?t.get(e):t.matches(e))},isEmpty:function(){return mn(this.models)},keyBy:function(e){return $d(this.models,e)},each:function(e,t){return this.forEach(e,t)},forEach:function(e,t){return this.models.forEach(e,t)},includes:function(e){return this.models.includes(e)},size:function(){return this.models.length},countBy:function(e){return id(this.models,_(e)?e:t=>jo(e)?t.get(e):t.matches(e))},groupBy:function(e){return xd(this.models,_(e)?e:t=>jo(e)?t.get(e):t.matches(e))},indexOf:function(e){return Ad(this.models,e)},findLastIndex:function(e,t){return bd(this.models,_(e)?e:t=>jo(e)?t.get(e):t.matches(e),t)},lastIndexOf:function(e){return Id(this.models,e)},findIndex:function(e){return vd(this.models,_(e)?e:t=>jo(e)?t.get(e):t.matches(e))},last:function(){const e=null==this.models?0:this.models.length;return e?this.models[e-1]:void 0},head:function(){return this.models[0]},first:function(){return this.head()},map:function(e,t){return this.models.map(_(e)?e:t=>jo(e)?t.get(e):t.matches(e),t)},reduce:function(e,t){return this.models.reduce(e,t||this.models[0])},reduceRight:function(e,t){return this.models.reduceRight(e,t||this.models[0])},toArray:function(){return Array.from(this.models)},get:function(e){if(null!=e)return this._byId[e]||this._byId[this.modelId(this._isModel(e)?e.attributes:e)]||e.cid&&this._byId[e.cid]},has:function(e){return null!=this.get(e)},at:function(e){return e<0&&(e+=this.length),this.models[e]},where:function(e,t){return this[t?"find":"filter"](e)},findWhere:function(e){return this.where(e,!0)},find:function(e,t){const n=_(e)?e:t=>t.matches(e);return this.models.find(n,t)},sort:function(e){let t=this.comparator;if(!t)throw new Error("Cannot sort a set without a comparator");e||(e={});const n=t.length;return _(t)&&(t=t.bind(this)),1===n||jo(t)?this.models=this.sortBy(t):this.models.sort(t),e.silent||this.trigger("sort",this,e),this},pluck:function(e){return this.map(e+"")},fetch:function(e){const t=(e=Be({parse:!0},e)).success,n=this,s=e.promise&&qt();return e.success=function(i){const r=e.reset?"reset":"set";n[r](i,e),t&&t.call(e.context,n,i,e),s&&s.resolve(),n.trigger("sync",n,i,e)},Gt(this,e),s||this.sync("read",this,e)},create:function(e,t){const n=(t=t?Fs(t):{}).wait,s=t.promise,i=s&&qt();if(!(e=this._prepareModel(e,t)))return!1;n||this.add(e,t);const r=this,o=t.success,a=t.error;return t.success=function(e,t,a){n&&r.add(e,a),o&&o.call(a.context,e,t,a),s&&i.resolve(e)},t.error=function(e,t,n){a&&a.call(n.context,e,t,n),s&&i.reject(t)},e.save(null,Object.assign(t,{promise:!1})),s?i:e},parse:function(e,t){return e},clone:function(){return new this.constructor(this.models,{model:this.model,comparator:this.comparator})},modelId:function(e){return e[this.model.prototype?.idAttribute||"id"]},values:function(){return new Gd(this,Wd)},keys:function(){return new Gd(this,Vd)},entries:function(){return new Gd(this,Jd)},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(e,t){if(this._isModel(e))return e.collection||(e.collection=this),e;(t=t?Fs(t):{}).collection=this;const n=new this.model(e,t);return n.validationError?(this.trigger("invalid",this,n.validationError,t),!1):n},_removeModels:function(e,t){const n=[];for(let s=0;s<e.length;s++){const i=this.get(e[s]);if(!i)continue;const r=this.indexOf(i);this.models.splice(r,1),this.length--,delete this._byId[i.cid];const o=this.modelId(i.attributes);null!=o&&delete this._byId[o],t.silent||(t.index=r,i.trigger("remove",i,this,t)),n.push(i),this._removeReference(i,t)}return n},_isModel:function(e){return e instanceof dr},_addReference:function(e,t){this._byId[e.cid]=e;const n=this.modelId(e.attributes);null!=n&&(this._byId[n]=e),e.on("all",this._onModelEvent,this)},_removeReference:function(e,t){delete this._byId[e.cid];const n=this.modelId(e.attributes);null!=n&&delete this._byId[n],this===e.collection&&delete e.collection,e.off("all",this._onModelEvent,this)},_onModelEvent:function(e,t,n,s){if(t){if(("add"===e||"remove"===e)&&n!==this)return;if("destroy"===e&&this.remove(t,s),"change"===e){const e=this.modelId(t.previousAttributes()),n=this.modelId(t.attributes);e!==n&&(null!=e&&delete this._byId[e],null!=n&&(this._byId[n]=t))}}this.trigger.apply(this,arguments)}});const Hd="function"==typeof Symbol&&Symbol.iterator;Hd&&(Fd.prototype[Hd]=Fd.prototype.values);const Gd=function(e,t){this._collection=e,this._kind=t,this._index=0},Wd=1,Vd=2,Jd=3;Hd&&(Gd.prototype[Hd]=function(){return this}),Gd.prototype.next=function(){if(this._collection){if(this._index<this._collection.length){const e=this._collection.at(this._index);let t;if(this._index++,this._kind===Wd)t=e;else{const n=this._collection.modelId(e.attributes);t=this._kind===Vd?n:[n,e]}return{value:t,done:!1}}this._collection=void 0}return{value:void 0,done:!0}};const Zd="array",Qd="bit",Kd="bits",Yd="byte",Xd="bytes",eu="",tu="exponent",nu="function",su="iec",iu="Invalid number",ru="Invalid rounding method",ou="jedec",au="object",cu=".",lu="round",du="s",uu="kbit",hu="kB",mu=" ",fu="string",gu="0",pu={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function vu(e){let{bits:t=!1,pad:n=!1,base:s=-1,round:i=2,locale:r=eu,localeOptions:o={},separator:a=eu,spacer:c=mu,symbols:l={},standard:d=eu,output:u=fu,fullform:h=!1,fullforms:m=[],exponent:f=-1,roundingMethod:g=lu,precision:p=0}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},v=f,y=Number(e),_=[],b=0,w=eu;-1===s&&0===d.length?(s=10,d=ou):-1===s&&d.length>0?(d=d===su?su:ou,s=d===su?2:10):(s=2===s?2:10,d=10===s||d===ou?ou:su);const S=10===s?1e3:1024,x=!0===h,E=y<0,A=Math[g];if("bigint"!=typeof e&&isNaN(e))throw new TypeError(iu);if(typeof A!==nu)throw new TypeError(ru);if(E&&(y=-y),(-1===v||isNaN(v))&&(v=Math.floor(Math.log(y)/Math.log(S)),v<0&&(v=0)),v>8&&(p>0&&(p+=8-v),v=8),u===tu)return v;if(0===y)_[0]=0,w=_[1]=pu.symbol[d][t?Kd:Xd][v];else{b=y/(2===s?Math.pow(2,10*v):Math.pow(1e3,v)),t&&(b*=8,b>=S&&v<8&&(b/=S,v++));const e=Math.pow(10,v>0?i:0);_[0]=A(b*e)/e,_[0]===S&&v<8&&-1===f&&(_[0]=1,v++),w=_[1]=10===s&&1===v?t?uu:hu:pu.symbol[d][t?Kd:Xd][v]}if(E&&(_[0]=-_[0]),p>0&&(_[0]=_[0].toPrecision(p)),_[1]=l[_[1]]||_[1],!0===r?_[0]=_[0].toLocaleString():r.length>0?_[0]=_[0].toLocaleString(r,o):a.length>0&&(_[0]=_[0].toString().replace(cu,a)),n&&!1===Number.isInteger(_[0])&&i>0){const e=a||cu,t=_[0].toString().split(e),n=t[1]||eu,s=n.length,r=i-s;_[0]=`${t[0]}${e}${n.padEnd(s+r,gu)}`}return x&&(_[1]=m[v]?m[v]:pu.fullform[d][v]+(t?Qd:Yd)+(1===_[0]?eu:du)),u===Zd?_:u===au?{value:_[0],symbol:_[1],exponent:v,unit:w}:_.join(c)}const yu=window,_u=yu.ShadowRoot&&(void 0===yu.ShadyCSS||yu.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,bu=Symbol(),wu=new WeakMap;class Su{constructor(e,t,n){if(this._$cssResult$=!0,n!==bu)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(_u&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=wu.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&wu.set(t,e))}return e}toString(){return this.cssText}}const xu=_u?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return(e=>new Su("string"==typeof e?e:e+"",void 0,bu))(t)})(e):e;var Eu;const Au=window,Cu=Au.trustedTypes,$u=Cu?Cu.emptyScript:"",ku=Au.reactiveElementPolyfillSupport,ju={toAttribute(e,t){switch(t){case Boolean:e=e?$u:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},Tu=(e,t)=>t!==e&&(t==t||e==e),Iu={attribute:!0,type:String,converter:ju,reflect:!1,hasChanged:Tu},Nu="finalized";class Ou extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(e){var t;this.finalize(),(null!==(t=this.h)&&void 0!==t?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,n)=>{const s=this._$Ep(n,t);void 0!==s&&(this._$Ev.set(s,n),e.push(s))})),e}static createProperty(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Iu;if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const n="symbol"==typeof e?Symbol():"__"+e,s=this.getPropertyDescriptor(e,n,t);void 0!==s&&Object.defineProperty(this.prototype,e,s)}}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(s){const i=this[e];this[t]=s,this.requestUpdate(e,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||Iu}static finalize(){if(this.hasOwnProperty(Nu))return!1;this[Nu]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),void 0!==e.h&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const n of t)this.createProperty(n,e[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(xu(e))}else void 0!==e&&t.push(xu(e));return t}static _$Ep(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}u(){var e;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,n;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(n=e.hostConnected)||void 0===n||n.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{_u?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const n=document.createElement("style"),s=yu.litNonce;void 0!==s&&n.setAttribute("nonce",s),n.textContent=t.cssText,e.appendChild(n)}))})(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EO(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Iu;var s;const i=this.constructor._$Ep(e,n);if(void 0!==i&&!0===n.reflect){const r=(void 0!==(null===(s=n.converter)||void 0===s?void 0:s.toAttribute)?n.converter:ju).toAttribute(t,n.type);this._$El=e,null==r?this.removeAttribute(i):this.setAttribute(i,r),this._$El=null}}_$AK(e,t){var n;const s=this.constructor,i=s._$Ev.get(e);if(void 0!==i&&this._$El!==i){const e=s.getPropertyOptions(i),r="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null===(n=e.converter)||void 0===n?void 0:n.fromAttribute)?e.converter:ju;this._$El=i,this[i]=r.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,n){let s=!0;void 0!==e&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||Tu)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$El!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,n))):s=!1),!this.isUpdatePending&&s&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((e,t)=>this[t]=e)),this._$Ei=void 0);let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(n)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;null===(t=this._$ES)||void 0===t||t.forEach((e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach(((e,t)=>this._$EO(t,this[t],e))),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}var Mu;Ou[Nu]=!0,Ou.elementProperties=new Map,Ou.elementStyles=[],Ou.shadowRootOptions={mode:"open"},null==ku||ku({ReactiveElement:Ou}),(null!==(Eu=Au.reactiveElementVersions)&&void 0!==Eu?Eu:Au.reactiveElementVersions=[]).push("1.6.2");const Ru=window,Du=Ru.trustedTypes,zu=Du?Du.createPolicy("lit-html",{createHTML:e=>e}):void 0,Lu="$lit$",Pu=`lit$${(Math.random()+"").slice(9)}$`,Fu="?"+Pu,Uu=`<${Fu}>`,Bu=document,qu=()=>Bu.createComment(""),Hu=e=>null===e||"object"!=typeof e&&"function"!=typeof e,Gu=Array.isArray,Wu=e=>Gu(e)||"function"==typeof(null==e?void 0:e[Symbol.iterator]),Vu="[ \t\n\f\r]",Ju=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Zu=/-->/g,Qu=/>/g,Ku=RegExp(`>|${Vu}(?:([^\\s"'>=/]+)(${Vu}*=${Vu}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Yu=/'/g,Xu=/"/g,eh=/^(?:script|style|textarea|title)$/i,th=e=>function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return{_$litType$:e,strings:t,values:s}},nh=th(1),sh=(th(2),Symbol.for("lit-noChange")),ih=Symbol.for("lit-nothing"),rh=new WeakMap,oh=Bu.createTreeWalker(Bu,129,null,!1),ah=(e,t)=>{const n=e.length-1,s=[];let i,r=2===t?"<svg>":"",o=Ju;for(let t=0;t<n;t++){const n=e[t];let a,c,l=-1,d=0;for(;d<n.length&&(o.lastIndex=d,c=o.exec(n),null!==c);)d=o.lastIndex,o===Ju?"!--"===c[1]?o=Zu:void 0!==c[1]?o=Qu:void 0!==c[2]?(eh.test(c[2])&&(i=RegExp("</"+c[2],"g")),o=Ku):void 0!==c[3]&&(o=Ku):o===Ku?">"===c[0]?(o=null!=i?i:Ju,l=-1):void 0===c[1]?l=-2:(l=o.lastIndex-c[2].length,a=c[1],o=void 0===c[3]?Ku:'"'===c[3]?Xu:Yu):o===Xu||o===Yu?o=Ku:o===Zu||o===Qu?o=Ju:(o=Ku,i=void 0);const u=o===Ku&&e[t+1].startsWith("/>")?" ":"";r+=o===Ju?n+Uu:l>=0?(s.push(a),n.slice(0,l)+Lu+n.slice(l)+Pu+u):n+Pu+(-2===l?(s.push(void 0),t):u)}const a=r+(e[n]||"<?>")+(2===t?"</svg>":"");if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==zu?zu.createHTML(a):a,s]};class ch{constructor(e,t){let n,{strings:s,_$litType$:i}=e;this.parts=[];let r=0,o=0;const a=s.length-1,c=this.parts,[l,d]=ah(s,i);if(this.el=ch.createElement(l,t),oh.currentNode=this.el.content,2===i){const e=this.el.content,t=e.firstChild;t.remove(),e.append(...t.childNodes)}for(;null!==(n=oh.nextNode())&&c.length<a;){if(1===n.nodeType){if(n.hasAttributes()){const e=[];for(const t of n.getAttributeNames())if(t.endsWith(Lu)||t.startsWith(Pu)){const s=d[o++];if(e.push(t),void 0!==s){const e=n.getAttribute(s.toLowerCase()+Lu).split(Pu),t=/([.?@])?(.*)/.exec(s);c.push({type:1,index:r,name:t[2],strings:e,ctor:"."===t[1]?mh:"?"===t[1]?gh:"@"===t[1]?ph:hh})}else c.push({type:6,index:r})}for(const t of e)n.removeAttribute(t)}if(eh.test(n.tagName)){const e=n.textContent.split(Pu),t=e.length-1;if(t>0){n.textContent=Du?Du.emptyScript:"";for(let s=0;s<t;s++)n.append(e[s],qu()),oh.nextNode(),c.push({type:2,index:++r});n.append(e[t],qu())}}}else if(8===n.nodeType)if(n.data===Fu)c.push({type:2,index:r});else{let e=-1;for(;-1!==(e=n.data.indexOf(Pu,e+1));)c.push({type:7,index:r}),e+=Pu.length-1}r++}}static createElement(e,t){const n=Bu.createElement("template");return n.innerHTML=e,n}}function lh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,s=arguments.length>3?arguments[3]:void 0;var i,r,o,a;if(t===sh)return t;let c=void 0!==s?null===(i=n._$Co)||void 0===i?void 0:i[s]:n._$Cl;const l=Hu(t)?void 0:t._$litDirective$;return(null==c?void 0:c.constructor)!==l&&(null===(r=null==c?void 0:c._$AO)||void 0===r||r.call(c,!1),void 0===l?c=void 0:(c=new l(e),c._$AT(e,n,s)),void 0!==s?(null!==(o=(a=n)._$Co)&&void 0!==o?o:a._$Co=[])[s]=c:n._$Cl=c),void 0!==c&&(t=lh(e,c._$AS(e,t.values),c,s)),t}class dh{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var t;const{el:{content:n},parts:s}=this._$AD,i=(null!==(t=null==e?void 0:e.creationScope)&&void 0!==t?t:Bu).importNode(n,!0);oh.currentNode=i;let r=oh.nextNode(),o=0,a=0,c=s[0];for(;void 0!==c;){if(o===c.index){let t;2===c.type?t=new uh(r,r.nextSibling,this,e):1===c.type?t=new c.ctor(r,c.name,c.strings,this,e):6===c.type&&(t=new vh(r,this,e)),this._$AV.push(t),c=s[++a]}o!==(null==c?void 0:c.index)&&(r=oh.nextNode(),o++)}return oh.currentNode=Bu,i}v(e){let t=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}class uh{constructor(e,t,n,s){var i;this.type=2,this._$AH=ih,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=s,this._$Cp=null===(i=null==s?void 0:s.isConnected)||void 0===i||i}get _$AU(){var e,t;return null!==(t=null===(e=this._$AM)||void 0===e?void 0:e._$AU)&&void 0!==t?t:this._$Cp}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===(null==e?void 0:e.nodeType)&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e){e=lh(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this),Hu(e)?e===ih||null==e||""===e?(this._$AH!==ih&&this._$AR(),this._$AH=ih):e!==this._$AH&&e!==sh&&this._(e):void 0!==e._$litType$?this.g(e):void 0!==e.nodeType?this.$(e):Wu(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==ih&&Hu(this._$AH)?this._$AA.nextSibling.data=e:this.$(Bu.createTextNode(e)),this._$AH=e}g(e){var t;const{values:n,_$litType$:s}=e,i="number"==typeof s?this._$AC(e):(void 0===s.el&&(s.el=ch.createElement(s.h,this.options)),s);if((null===(t=this._$AH)||void 0===t?void 0:t._$AD)===i)this._$AH.v(n);else{const e=new dh(i,this),t=e.u(this.options);e.v(n),this.$(t),this._$AH=e}}_$AC(e){let t=rh.get(e.strings);return void 0===t&&rh.set(e.strings,t=new ch(e)),t}T(e){Gu(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,s=0;for(const i of e)s===t.length?t.push(n=new uh(this.k(qu()),this.k(qu()),this,this.options)):n=t[s],n._$AI(i),s++;s<t.length&&(this._$AR(n&&n._$AB.nextSibling,s),t.length=s)}_$AR(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._$AA.nextSibling,t=arguments.length>1?arguments[1]:void 0;var n;for(null===(n=this._$AP)||void 0===n||n.call(this,!1,!0,t);e&&e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){var t;void 0===this._$AM&&(this._$Cp=e,null===(t=this._$AP)||void 0===t||t.call(this,e))}}class hh{constructor(e,t,n,s,i){this.type=1,this._$AH=ih,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=i,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=ih}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this,n=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0;const i=this.strings;let r=!1;if(void 0===i)e=lh(this,e,t,0),r=!Hu(e)||e!==this._$AH&&e!==sh,r&&(this._$AH=e);else{const s=e;let o,a;for(e=i[0],o=0;o<i.length-1;o++)a=lh(this,s[n+o],t,o),a===sh&&(a=this._$AH[o]),r||(r=!Hu(a)||a!==this._$AH[o]),a===ih?e=ih:e!==ih&&(e+=(null!=a?a:"")+i[o+1]),this._$AH[o]=a}r&&!s&&this.j(e)}j(e){e===ih?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=e?e:"")}}class mh extends hh{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===ih?void 0:e}}const fh=Du?Du.emptyScript:"";class gh extends hh{constructor(){super(...arguments),this.type=4}j(e){e&&e!==ih?this.element.setAttribute(this.name,fh):this.element.removeAttribute(this.name)}}class ph extends hh{constructor(e,t,n,s,i){super(e,t,n,s,i),this.type=5}_$AI(e){var t;if((e=null!==(t=lh(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this,0))&&void 0!==t?t:ih)===sh)return;const n=this._$AH,s=e===ih&&n!==ih||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,i=e!==ih&&(n===ih||s);s&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,n;"function"==typeof this._$AH?this._$AH.call(null!==(n=null===(t=this.options)||void 0===t?void 0:t.host)&&void 0!==n?n:this.element,e):this._$AH.handleEvent(e)}}class vh{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){lh(this,e)}}const yh={O:Lu,P:Pu,A:Fu,C:1,M:ah,L:dh,D:Wu,R:lh,I:uh,V:hh,H:gh,N:ph,U:mh,F:vh},_h=Ru.litHtmlPolyfillSupport;null==_h||_h(ch,uh),(null!==(Mu=Ru.litHtmlVersions)&&void 0!==Mu?Mu:Ru.litHtmlVersions=[]).push("2.7.4");const bh=(e,t,n)=>{var s,i;const r=null!==(s=null==n?void 0:n.renderBefore)&&void 0!==s?s:t;let o=r._$litPart$;if(void 0===o){const e=null!==(i=null==n?void 0:n.renderBefore)&&void 0!==i?i:null;r._$litPart$=o=new uh(t.insertBefore(qu(),e),e,void 0,null!=n?n:{})}return o._$AI(e),o};var wh,Sh;class xh extends Ou{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;const n=super.createRenderRoot();return null!==(e=(t=this.renderOptions).renderBefore)&&void 0!==e||(t.renderBefore=n.firstChild),n}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=bh(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),null===(e=this._$Do)||void 0===e||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),null===(e=this._$Do)||void 0===e||e.setConnected(!1)}render(){return sh}}xh.finalized=!0,xh._$litElement$=!0,null===(wh=globalThis.litElementHydrateSupport)||void 0===wh||wh.call(globalThis,{LitElement:xh});const Eh=globalThis.litElementPolyfillSupport;null==Eh||Eh({LitElement:xh});(null!==(Sh=globalThis.litElementVersions)&&void 0!==Sh?Sh:globalThis.litElementVersions=[]).push("3.3.2");const Ah=Object.assign(window.converse||{},{CHAT_STATES:["active","composing","gone","inactive","paused"],keycodes:vo,async initialize(e){const{api:t}=bl;if(await Ul(bl),"onpagehide"in window?bl.unloadevent="pagehide":"onbeforeunload"in window?bl.unloadevent="beforeunload":"onunload"in window&&(bl.unloadevent="unload"),function(e){bc=e,yc={},Object.assign(yc,Tn);const t=lr(e,Object.keys(Co));Be(yc,Co,t)}(e),bl.strict_plugin_dependencies=e.strict_plugin_dependencies,Yc.setLogLevel(t.settings.get("loglevel")),t.settings.get("authentication")===co&&t.settings.get("auto_login")&&!t.settings.get("jid"))throw new Error("Config Error: you need to provide the server's domain via the 'jid' option when using anonymous authentication with auto_login.");bl.router.route(/^converse\?loglevel=(debug|info|warn|error|fatal)$/,"loglevel",(e=>Yc.setLogLevel(e))),bl.connfeedback=new Ql,bl.send_initial_presence=!0,await async function(e){await mc.sessionStorageInitialized,e.storage={session:mc.localForage.createInstance({name:e.isTestEnv()?"converse-test-session":"converse-session",description:"sessionStorage instance",driver:["sessionStorageWrapper"]})}}(bl),await async function(e){const t="converse.client-config";e.config=new dr({id:t,trusted:!0}),e.config.browserStorage=pc(t,"session"),await new Promise((t=>e.config.fetch({success:t,error:t}))),e.api.trigger("clientConfigInitialized")}(bl),await _o.initialize(),function(e){e.pluggable.initialized_plugins=[];const t=go.concat(e.api.settings.get("whitelisted_plugins"));e.api.settings.get("singleton")&&["converse-bookmarks","converse-controlbox","converse-headline","converse-register"].forEach((t=>e.api.settings.get("blacklisted_plugins").push(t))),e.pluggable.initializePlugins({_converse:e},t,e.api.settings.get("blacklisted_plugins")),e.api.trigger("pluginsInitialized")}(bl),t.elements?.register(),function(e){document.addEventListener("visibilitychange",Jc),Jc({type:document.hidden?"blur":"focus"}),e.api.trigger("registeredGlobalEventHandlers")}(bl);try{!History.started&&bl.router.history.start()}catch(e){Yc.error(e)}const n=bl.pluggable.plugins;if((t.settings.get("auto_login")||t.settings.get("keepalive")&&n["converse-bosh"]?.enabled())&&await t.user.login(null,null,!0),t.trigger("initialized"),bl.isTestEnv())return bl},plugins:{add(e,t){if(t.__name__=e,void 0!==bl.pluggable.plugins[e])throw new TypeError(`Error: plugin with name "${e}" has already been registered!`);bl.pluggable.plugins[e]=t}},env:{$build:Vr,$iq:Zr,$msg:Jr,$pres:Qr,utils:Zc,Collection:Fd,Model:dr,Promise,Strophe:so,TimeoutError:Cl,URI:Yl(),VERSION_NAME:oo,dayjs:Zl(),filesize:vu,html:nh,log:Yc,sizzle:Eo(),sprintf:yo.sprintf,stx:jc,u:Zc}});Zl().extend(Sl());const Ch=dr.extend({initialize(){this.rosterContactAdded=Ao()},async setRosterContact(e){const t=await Vl.contacts.get(e);t&&(this.contact=t,this.set("nickname",t.get("nickname")),this.rosterContactAdded.resolve())}}),$h=Ch;const kh=function(e,t){return e===t||$i(e,t,ji(t))},{u:jh}=Ah.env;function Th(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return e.map((e=>{const s=e.start-n,i=e.end-n;return s<0||s>=t.length?null:Object.assign({},e,{start:s,end:i,url:t.substring(e.start-n,e.end-n)})})).filter((e=>e))}async function Ih(e,t){if(!t.replace_id||!t.from)return;const n="groupchat"===t.type&&t.occupant_id?e=>{let{attributes:n}=e;return n.msgid===t.replace_id&&n.occupant_id==t.occupant_id}:e=>{let{attributes:n}=e;return n.msgid===t.replace_id&&n.from===t.from&&null==n.occupant_id},s=e.messages.models.find(n);if(!s)return t.older_versions={},await e.createMessage(t);const i=s.get("older_versions")||{};return t.time<s.get("time")&&s.get("edited")?(i[t.time]=t.message,s.save({older_versions:i})):(Object.keys(i).length?i[s.get("edited")]=s.getMessageText():i[s.get("time")]=s.getMessageText(),delete(t=Object.assign(t,{older_versions:i})).msgid,delete t.id,t.time=s.get("time"),s.save(t)),s}const Nh=Il((function(e){const t=Vl.settings.get("prune_messages_above");if(t&&"number"==typeof t&&e.messages.length>t){const n=e.messages.filter((e=>!jh.isEmptyMessage(e)));if(n.length>t){for(;n.length>t;)n.shift().destroy();Vl.trigger("historyPruned",e)}}}),500),Oh=Ah.env.utils;function Mh(e,t){Vl.send(Jr({to:e.getAttribute("from"),type:"error",id:e.getAttribute("id")}).c("error",{type:"cancel"}).c("not-allowed",{xmlns:"urn:ietf:params:xml:ns:xmpp-stanzas"}).up().c("text",{xmlns:"urn:ietf:params:xml:ns:xmpp-stanzas"}).t(t)),Yc.warn(`Rejecting message stanza with the following reason: ${t}`),Yc.warn(e)}function Rh(e,t,n,s){const i=Jr({from:bl.connection.jid,id:Oh.getUniqueId(),to:e,type:s||"chat"}).c(n,{xmlns:so.NS.MARKERS,id:t});Vl.send(i)}const{u:Dh}=Ah.env;function zh(e){const t=Lh(e),{protocol:n}=window.location;return!!["chrome-extension:","file:"].includes(n)||("http:"===n||"https:"===n&&["https","aesgcm"].includes(t.protocol().toLowerCase()))}function Lh(e){try{return e instanceof Yl()?e:new(Yl())(e)}catch(e){return Yc.debug(e),null}}function Ph(e,t){const n=Lh(t);if(null===n)throw new Error(`checkFileTypes: could not parse url ${t}`);const s=n.filename().toLowerCase();return!!e.filter((e=>s.endsWith(e))).length}function Fh(e,t){const n=Lh(t),s=n.subdomain(),i=n.domain(),r=`${s?`${s}.`:""}${i}`;return e.includes(i)||e.includes(r)}function Uh(e,t){if(!zh(e))return!1;const n=Vl.settings.get("render_media"),s=qh(e,`allowed_${t}_domains`);return Array.isArray(n)?s&&Fh(n,e):s&&n}function Bh(e){const t=Vl.settings.get("filter_url_query_params");if(!t)return e;return Lh(e).removeQuery(t).toString()}function qh(e,t){const n=Vl.settings.get(t);if(!Array.isArray(n))return!0;try{return Fh(n,e)}catch(e){return Yc.debug(e),!1}}function Hh(e){return e.is_audio&&qh(e.url,"allowed_audio_domains")||e.is_video&&qh(e.url,"allowed_video_domains")||e.is_image&&qh(e.url,"allowed_image_domains")}function Gh(e){return Ph([".jpg",".jpeg",".png",".gif",".bmp",".tiff",".svg"],e)}function Wh(e){return Ph([".gif"],e)}function Vh(e){return Ph([".ogg",".mp3",".m4a"],e)}function Jh(e){return Ph([".mp4",".webm"],e)}function Zh(e){const t=Vl.settings.get("image_urls_regex");return t?.test(e)||Gh(e)}Object.assign(Dh,{isAudioURL:Vh,isGIFURL:Wh,isVideoURL:Jh,isImageURL:Zh,isURLWithImageExtension:Gh,checkFileTypes:Ph,getURI:Lh,shouldRenderMediaFromURL:Uh,isAllowedProtocolForMedia:zh});const{NS:Qh}=so;class Kh extends Error{constructor(e,t){super(e,t),this.name="StanzaParseError",this.stanza=t}}function Yh(e,t){const n={},s=Eo()(`stanza-id[xmlns="${so.NS.SID}"]`,e).reduce(((e,t)=>(e[`stanza_id ${t.getAttribute("by")}`]=t.getAttribute("id"),e)),{});Object.assign(n,s);const i=Eo()(`message > result[xmlns="${so.NS.MAM}"]`,t).pop();if(i){n[`stanza_id ${t.getAttribute("from")||bl.bare_jid}`]=i.getAttribute("id")}const r=Eo()(`origin-id[xmlns="${so.NS.SID}"]`,e).pop();return r&&(n.origin_id=r.getAttribute("id")),n}function Xh(e){const t=Eo()(`encryption[xmlns="${so.NS.EME}"]`,e).pop(),n=t?.getAttribute("namespace"),s={};return n?(s.is_encrypted=!0,s.encryption_namespace=n):Eo()(`encrypted[xmlns="${so.NS.OMEMO}"]`,e).pop()&&(s.is_encrypted=!0,s.encryption_namespace=so.NS.OMEMO),s}function em(e,t){const n=Eo()(`> apply-to[xmlns="${so.NS.FASTEN}"]`,e).pop();if(n){const e=n.getAttribute("id");if(Eo()(`> retract[xmlns="${so.NS.RETRACT}"]`,n).pop()){const n=Eo()(`delay[xmlns="${so.NS.DELAY}"]`,t).pop();return{editable:!1,retracted:n?Zl()(n.getAttribute("stamp")).toISOString():(new Date).toISOString(),retracted_id:e}}}else{const t=Eo()(`> retracted[xmlns="${so.NS.RETRACT}"]`,e).pop();if(t)return{editable:!1,is_tombstone:!0,retracted:t.getAttribute("stamp")}}return{}}function tm(e,t){const n=Eo()(`replace[xmlns="${so.NS.MESSAGE_CORRECT}"]`,e).pop();if(n){const e=n.getAttribute("id");if(e){const n=Eo()(`delay[xmlns="${so.NS.DELAY}"]`,t).pop();return{replace_id:e,edited:n?Zl()(n.getAttribute("stamp")).toISOString():(new Date).toISOString()}}}return{}}function nm(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=[];if(!e)return{};try{Yl().withinString(e,((e,s,i)=>(e.startsWith("_")&&(e=e.slice(1),s+=1),e.endsWith("_")&&(e=e.slice(0,e.length-1),i-=1),n.push({url:e,start:s+t,end:i+t}),e)),po)}catch(e){Yc.debug(e)}const s=n.map((e=>{return{end:e.end,is_audio:Vh(e.url),is_image:Zh(e.url),is_video:Jh(e.url),is_encrypted:(t=e.url,t.startsWith("aesgcm://")),start:e.start};var t}));return s.length?{media_urls:s}:{}}function sm(e){const t=Eo()(`spoiler[xmlns="${so.NS.SPOILER}"]`,e).pop();return{is_spoiler:!!t,spoiler_hint:t?.textContent}}function im(e){const t=Eo()(`x[xmlns="${so.NS.OUTOFBAND}"]`,e).pop();return t?{oob_url:t.querySelector("url")?.textContent,oob_desc:t.querySelector("desc")?.textContent}:{}}function rm(e){if("error"===e.getAttribute("type")){const t=e.querySelector("error"),n=Eo()(`text[xmlns="${so.NS.STANZAS}"]`,t).pop();return{is_error:!0,error_text:n?.textContent,error_type:t.getAttribute("type"),error_condition:t.firstElementChild.nodeName}}return{}}function om(e){return Eo()(`reference[xmlns="${so.NS.REFERENCE}"]`,e).map((t=>{const n=t.getAttribute("anchor"),s=e.querySelector(n?`#${n}`:"body")?.textContent;if(!s)return Yc.warn(`Could not find referenced text for ${t}`),null;const i=t.getAttribute("begin"),r=t.getAttribute("end");return{begin:i,end:r,type:t.getAttribute("type"),value:s.slice(i,r),uri:t.getAttribute("uri")}})).filter((e=>e))}function am(e){const t=Eo()(`received[xmlns="${so.NS.RECEIPTS}"]`,e).pop();return t?.getAttribute("id")}function cm(e){const t=so.NS.CARBONS;return Eo()(`message > received[xmlns="${t}"]`,e).length>0||Eo()(`message > sent[xmlns="${t}"]`,e).length>0}function lm(e){return Eo()(`\n composing[xmlns="${Qh.CHATSTATES}"],\n paused[xmlns="${Qh.CHATSTATES}"],\n inactive[xmlns="${Qh.CHATSTATES}"],\n active[xmlns="${Qh.CHATSTATES}"],\n gone[xmlns="${Qh.CHATSTATES}"]`,e).pop()?.nodeName}function dm(e,t){return"me"!==t.sender&&!t.is_carbon&&!t.is_archived&&Eo()(`request[xmlns="${so.NS.RECEIPTS}"]`,e).length}function um(e){if(Eo()(`message > forwarded[xmlns="${so.NS.FORWARD}"]`,e).length){Mh(e,"Forwarded messages not part of an encapsulating protocol are not supported");const t=e.getAttribute("from");throw new Kh(`Ignoring unencapsulated forwarded message from ${t}`,e)}}function hm(e){return Eo()(`\n acknowledged[xmlns="${so.NS.MARKERS}"],\n displayed[xmlns="${so.NS.MARKERS}"],\n received[xmlns="${so.NS.MARKERS}"]`,e).pop()}function mm(e){return"headline"===e.getAttribute("type")}function fm(e){if(Eo()(`mentions[xmlns="${so.NS.MENTIONS}"]`,e).pop())return!1;const t=e.getAttribute("from");return!("error"===e.getAttribute("type")||!t||t.includes("@"))}function gm(e){return!!Eo()(`message > result[xmlns="${so.NS.MAM}"]`,e).pop()}function pm(e){return e.getAttributeNames().reduce(((t,n)=>(t[n]=so.xmlunescape(e.getAttribute(n)),t)),{})}const{Strophe:vm,sizzle:ym}=Ah.env;async function _m(e){um(e);let t=e.getAttribute("to");const n=vm.getResourceFromJid(t);if(Vl.settings.get("filter_by_resource")&&n&&n!==bl.resource)return new Kh(`Ignoring incoming message intended for a different resource: ${t}`,e);const s=e;let i=e.getAttribute("from")||bl.bare_jid;if(cm(e)){if(i!==bl.bare_jid)return Mh(e,"Rejecting carbon from invalid JID"),new Kh(`Rejecting carbon from invalid JID ${t}`,e);{const n=`[xmlns="${vm.NS.CARBONS}"] > forwarded[xmlns="${vm.NS.FORWARD}"] > message`;t=(e=ym(n,e).pop()).getAttribute("to"),i=e.getAttribute("from")}}const r=gm(e);if(r){if(i!==bl.bare_jid)return new Kh(`Invalid Stanza: alleged MAM message from ${e.getAttribute("from")}`,e);{const n=`[xmlns="${vm.NS.MAM}"] > forwarded[xmlns="${vm.NS.FORWARD}"] > message`;t=(e=ym(n,e).pop()).getAttribute("to"),i=e.getAttribute("from")}}const o=vm.getBareJidFromJid(i),a=o===bl.bare_jid;if(a&&null===t)return new Kh(`Don't know how to handle message stanza without 'to' attribute. ${e.outerHTML}`,e);const c=mm(e),l=fm(e);let d,u;if(!c&&!l&&(u=a?vm.getBareJidFromJid(t):o,d=await Vl.contacts.get(u),void 0===d&&!Vl.settings.get("allow_non_roster_messaging")))return Yc.error(e),new Kh("Blocking messaging with a JID not in our roster because allow_non_roster_messaging is false.",e);const h=ym(`delay[xmlns="${vm.NS.DELAY}"]`,s).pop(),m=hm(e),f=(new Date).toISOString();let g=Object.assign({contact_jid:u,is_archived:r,is_headline:c,is_server_message:l,body:e.querySelector("body")?.textContent?.trim(),chat_state:lm(e),from:vm.getBareJidFromJid(e.getAttribute("from")),is_carbon:cm(s),is_delayed:!!h,is_markable:!!ym(`markable[xmlns="${vm.NS.MARKERS}"]`,e).length,is_marker:!!m,is_unstyled:!!ym(`unstyled[xmlns="${vm.NS.STYLING}"]`,e).length,marker_id:m&&m.getAttribute("id"),msgid:e.getAttribute("id")||s.getAttribute("id"),nick:d?.attributes?.nickname,receipt_id:am(e),received:(new Date).toISOString(),references:om(e),sender:a?"me":"them",subject:e.querySelector("subject")?.textContent,thread:e.querySelector("thread")?.textContent,time:h?Zl()(h.getAttribute("stamp")).toISOString():f,to:e.getAttribute("to"),type:e.getAttribute("type")||"normal"},rm(e),im(e),sm(e),tm(e,s),Yh(e,s),em(e,s),Xh(e));if(g.is_archived){const t=s.getAttribute("from");if(t&&t!==bl.bare_jid)return new Kh(`Invalid Stanza: Forged MAM message from ${t}`,e)}return await Vl.emojis.initialize(),g=Object.assign({message:g.body||g.error,is_only_emojis:!!g.body&&Zc.isOnlyEmojis(g.body),is_valid_receipt_request:dm(e,g)},g),g.id=g.origin_id||g[`stanza_id ${g.from}`]||Zc.getUniqueId(),g=await Vl.hook("parseMessage",e,g),Object.assign(g,nm(g.is_encrypted?g.plaintext:g.body))}const{Strophe:bm,$msg:wm}=Ah.env,Sm=Ah.env.utils,xm=$h.extend({defaults(){return{bookmarked:!1,chat_state:void 0,hidden:Oc()&&!Vl.settings.get("singleton"),message_type:"chat",nickname:void 0,num_unread:0,time_opened:this.get("time_opened")||(new Date).getTime(),time_sent:new Date(0).toISOString(),type:bl.PRIVATE_CHAT_TYPE,url:""}},async initialize(){this.initialized=Ao(),$h.prototype.initialize.apply(this,arguments);const e=this.get("jid");e&&(this.set({box_id:`box-${e}`}),this.initNotifications(),this.initUI(),this.initMessages(),this.get("type")===bl.PRIVATE_CHAT_TYPE&&(this.presence=bl.presences.get(e)||bl.presences.create({jid:e}),await this.setRosterContact(e),this.presence.on("change:show",(e=>this.onPresenceChanged(e)))),this.on("change:chat_state",this.sendChatState,this),this.ui.on("change:scrolled",this.onScrolledChanged,this),await this.fetchMessages(),await Vl.trigger("chatBoxInitialized",this,{Synchronous:!0}),this.initialized.resolve())},getMessagesCollection:()=>new bl.Messages,getMessagesCacheKey(){return`converse.messages-${this.get("jid")}-${bl.bare_jid}`},initMessages(){this.messages=this.getMessagesCollection(),this.messages.fetched=Ao(),this.messages.chatbox=this,vc(this.messages,this.getMessagesCacheKey()),this.listenTo(this.messages,"change:upload",this.onMessageUploadChanged,this),this.listenTo(this.messages,"add",this.onMessageAdded,this)},initUI(){this.ui=new dr},initNotifications(){this.notifications=new dr},getNotificationsText(){const{__:e}=bl;return this.notifications?.get("chat_state")===bl.COMPOSING?e("%1$s is typing",this.getDisplayName()):this.notifications?.get("chat_state")===bl.PAUSED?e("%1$s has stopped typing",this.getDisplayName()):this.notifications?.get("chat_state")===bl.GONE?e("%1$s has gone away",this.getDisplayName()):""},afterMessagesFetched(){this.pruneHistoryWhenScrolledDown(),Vl.trigger("afterMessagesFetched",this)},fetchMessages(){if(this.messages.fetched_flag)return void Yc.info(`Not re-fetching messages for ${this.get("jid")}`);this.messages.fetched_flag=!0;const e=this.messages.fetched.resolve;return this.messages.fetch({add:!0,success:t=>{this.afterMessagesFetched(t),e()},error:()=>{this.afterMessagesFetched(),e()}}),this.messages.fetched},async handleErrorMessageStanza(e){const{__:t}=bl,n=await _m(e);if(!await this.shouldShowErrorMessage(n))return;const s=this.getMessageReferencedByError(n);if(s){const e={error:n.error,error_condition:n.error_condition,error_text:n.error_text,error_type:n.error_type,editable:!1};n.msgid===s.get("retraction_id")?(e.retraction_id=void 0,n.error||("forbidden"===n.error_condition?e.error=t("You're not allowed to retract your message."):e.error=t("Sorry, an error occurred while trying to retract your message."))):n.error||("forbidden"===n.error_condition?e.error=t("You're not allowed to send a message."):e.error=t("Sorry, an error occurred while trying to send your message.")),s.save(e)}else this.createMessage(n)},queueMessage(e){return this.msg_chain=(this.msg_chain||this.messages.fetched).then((()=>this.onMessage(e))).catch((e=>Yc.error(e))),this.msg_chain},async onMessage(e){if(e=await e,Sm.isErrorObject(e))return e.stanza&&Yc.error(e.stanza),Yc.error(e.message);const t=this.getDuplicateMessage(e);if(t)this.updateMessage(t,e);else if(!this.handleReceipt(e)&&!this.handleChatMarker(e)&&!await this.handleRetraction(e)&&(this.setEditable(e,e.time),e.chat_state&&"them"===e.sender&&this.notifications.set("chat_state",e.chat_state),Sm.shouldCreateMessage(e))){const t=await Ih(this,e)||await this.createMessage(e);this.notifications.set({chat_state:null}),this.handleUnreadMessage(t)}},async onMessageUploadChanged(e){if(e.get("upload")===bl.SUCCESS){const t={body:e.get("body"),spoiler_hint:e.get("spoiler_hint"),oob_url:e.get("oob_url")};await this.sendMessage(t),e.destroy()}},onMessageAdded(e){!Vl.settings.get("prune_messages_above")||"scrolled"!==Vl.settings.get("pruning_behavior")&&this.ui.get("scrolled")||Nc(e)||Nh(this)},async clearMessages(){try{await this.messages.clearStore()}catch(e){this.messages.trigger("reset"),Yc.error(e)}finally{this.messages.fetched.resolve()}},async close(){Vl.connection.connected()&&(this.setChatState(bl.INACTIVE),this.sendChatState());try{await new Promise(((e,t)=>this.destroy({success:e,error:(e,n)=>t(n)})))}catch(e){Yc.error(e)}finally{Vl.settings.get("clear_messages_on_reconnection")&&await this.clearMessages()}Vl.trigger("chatBoxClosed",this)},announceReconnection(){Vl.trigger("chatReconnected",this)},async onReconnection(){Vl.settings.get("clear_messages_on_reconnection")&&await this.clearMessages(),this.announceReconnection()},onPresenceChanged(e){const{__:t}=bl,n=e.get("show"),s=this.getDisplayName();let i;"offline"===n?i=t("%1$s has gone offline",s):"away"===n?i=t("%1$s has gone away",s):"dnd"===n?i=t("%1$s is busy",s):"online"===n&&(i=t("%1$s is online",s)),i&&this.createMessage({message:i,type:"info"})},onScrolledChanged(){this.ui.get("scrolled")||(this.clearUnreadMsgCounter(),this.pruneHistoryWhenScrolledDown())},pruneHistoryWhenScrolledDown(){Vl.settings.get("prune_messages_above")&&"unscrolled"===Vl.settings.get("pruning_behavior")&&!this.ui.get("scrolled")&&Nh(this)},validate(e){if(!e.jid)return"Ignored ChatBox without JID";const t=Vl.settings.get("auto_join_rooms").map((e=>y(e)?e.jid:e)),n=Vl.settings.get("auto_join_private_chats").concat(t);if(Vl.settings.get("singleton")&&!n.includes(e.jid)&&!Vl.settings.get("auto_join_on_invite")){const t=`${e.jid} is not allowed because singleton is true and it's not being auto_joined`;return Yc.warn(t),t}},getDisplayName(){return this.contact?this.contact.getDisplayName():this.vcard?this.vcard.getDisplayName():this.get("jid")},async createMessageFromError(e){if(e instanceof Cl){(await this.createMessage({type:"error",message:e.message,retry_event_id:e.retry_event_id,is_ephemeral:3e4})).error=e}},editEarlierMessage(){let e,t=this.messages.findLastIndex("correcting");if(t>=0)for(this.messages.at(t).save("correcting",!1);t>0;){t-=1;const n=this.messages.at(t);if(n.get("editable")){e=n;break}}e=e||this.messages.filter({sender:"me"}).reverse().find((e=>e.get("editable"))),e&&e.save("correcting",!0)},editLaterMessage(){let e,t=this.messages.findLastIndex("correcting");if(t>=0)for(this.messages.at(t).save("correcting",!1);t<this.messages.length-1;){t+=1;const n=this.messages.at(t);if(n.get("editable")){e=n,e.save("correcting",!0);break}}return e},getOldestMessage(){for(let e=0;e<this.messages.length;e++){const t=this.messages.at(e);if(t.get("type")===this.get("message_type"))return t}},getMostRecentMessage(){for(let e=this.messages.length-1;e>=0;e--){const t=this.messages.at(e);if(t.get("type")===this.get("message_type"))return t}},getUpdatedMessageAttributes:(e,t)=>t.error_type||"Decryption"!==e.get("error_type")?{is_archived:t.is_archived}:Object.assign({},t,{error_condition:void 0,error_message:void 0,error_text:void 0,error_type:void 0,is_archived:t.is_archived,is_ephemeral:!1,is_error:!1}),updateMessage(e,t){const n=this.getUpdatedMessageAttributes(e,t);n&&e.save(n)},setChatState(e,t){return void 0!==this.chat_state_timeout&&(window.clearTimeout(this.chat_state_timeout),delete this.chat_state_timeout),e===bl.COMPOSING?this.chat_state_timeout=window.setTimeout(this.setChatState.bind(this),bl.TIMEOUTS.PAUSED,bl.PAUSED):e===bl.PAUSED&&(this.chat_state_timeout=window.setTimeout(this.setChatState.bind(this),bl.TIMEOUTS.INACTIVE,bl.INACTIVE)),this.set("chat_state",e,t),this},getMessageReferencedByError(e){const t=e.msgid;return t&&this.messages.models.find((e=>[e.get("msgid"),e.get("retraction_id")].includes(t)))},shouldShowErrorMessage(e){if(this.getMessageReferencedByError(e)||!e.chat_state)return!0},isSameUser:(e,t)=>Sm.isSameBareJID(e,t),findDanglingRetraction(e){if(!e.origin_id||!this.messages.length)return null;if(this.messages.last().get("time")>e.time){const t=Array.from(this.messages.models);return t.reverse(),t.find((t=>{let{attributes:n}=t;return n.retracted_id===e.origin_id&&n.from===e.from&&!n.moderated_by}))}},async handleRetraction(e){const t=["retracted","retracted_id","editable"];if(e.retracted){if(e.is_tombstone)return!1;const n=this.messages.findWhere({origin_id:e.retracted_id,from:e.from});return n?(n.save(lr(e,t)),!0):(e.dangling_retraction=!0,await this.createMessage(e),!0)}{const n=this.findDanglingRetraction(e);if(n){const s=lr(n.attributes,t),i=Object.assign({dangling_retraction:!1},e,s);return delete i.id,n.save(i),!0}}return!1},getDuplicateMessage(e){const t=[...this.getStanzaIdQueryAttrs(e),this.getOriginIdQueryAttrs(e),this.getMessageBodyQueryAttrs(e)].filter((e=>e));return this.messages.models.find((e=>t.reduce(((t,n)=>t||kh(e.attributes,n)),!1)))},getOriginIdQueryAttrs:e=>e.origin_id&&{origin_id:e.origin_id,from:e.from},getStanzaIdQueryAttrs(e){const t=Object.keys(e).filter((e=>e.startsWith("stanza_id ")));return t.map((t=>{const n={};return n[`stanza_id ${t.replace(/^stanza_id /,"")}`]=e[t],n}))},getMessageBodyQueryAttrs(e){if(e.msgid){const t={from:e.from,msgid:e.msgid};return!e.is_encrypted&&e.body&&(t.body=e.body),t}},retractOwnMessage(e){this.sendRetractionMessage(e),e.save({retracted:(new Date).toISOString(),retracted_id:e.get("origin_id"),retraction_id:e.get("id"),is_ephemeral:!0,editable:!1})},sendRetractionMessage(e){const t=e.get("origin_id");if(!t)throw new Error("Can't retract message without a XEP-0359 Origin ID");const n=wm({id:Sm.getUniqueId(),to:this.get("jid"),type:"chat"}).c("store",{xmlns:bm.NS.HINTS}).up().c("apply-to",{id:t,xmlns:bm.NS.FASTEN}).c("retract",{xmlns:bm.NS.RETRACT});return bl.connection.send(n)},sendMarkerForLastMessage(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"displayed",t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=Array.from(this.messages.models);n.reverse();const s=n.find((e=>"them"===e.get("sender")&&(t||e.get("is_markable"))));s&&this.sendMarkerForMessage(s,e,t)},sendMarkerForMessage(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"displayed",n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e&&Vl.settings.get("send_chat_markers").includes(t)&&(e?.get("is_markable")||n)){Rh(bm.getBareJidFromJid(e.get("from")),e.get("msgid"),t,e.get("type"))}},handleChatMarker(e){if(bm.getBareJidFromJid(e.to)!==bl.bare_jid)return!1;if(e.is_markable)return!this.contact||e.is_archived||e.is_carbon||Rh(e.from,e.msgid,"received"),!1;if(e.marker_id){const t=this.messages.findWhere({msgid:e.marker_id}),n=`marker_${e.marker}`;return t&&!t.get(n)&&t.save({field_name:(new Date).toISOString()}),!0}},sendReceiptStanza(e,t){const n=wm({from:bl.connection.jid,id:Sm.getUniqueId(),to:e,type:"chat"}).c("received",{xmlns:bm.NS.RECEIPTS,id:t}).up().c("store",{xmlns:bm.NS.HINTS}).up();Vl.send(n)},handleReceipt(e){if("them"===e.sender)if(e.is_valid_receipt_request)this.sendReceiptStanza(e.from,e.msgid);else if(e.receipt_id){const t=this.messages.findWhere({msgid:e.receipt_id});return t&&!t.get("received")&&t.save({received:(new Date).toISOString()}),!0}return!1},async createMessageStanza(e){const t=wm({from:bl.connection.jid,to:this.get("jid"),type:this.get("message_type"),id:e.get("edited")&&Sm.getUniqueId()||e.get("msgid")}).c("body").t(e.get("body")).up().c(bl.ACTIVE,{xmlns:bm.NS.CHATSTATES}).root();"chat"===e.get("type")&&t.c("request",{xmlns:bm.NS.RECEIPTS}).root(),e.get("is_encrypted")||(e.get("is_spoiler")&&(e.get("spoiler_hint")?t.c("spoiler",{xmlns:bm.NS.SPOILER},e.get("spoiler_hint")).root():t.c("spoiler",{xmlns:bm.NS.SPOILER}).root()),(e.get("references")||[]).forEach((e=>{const n={xmlns:bm.NS.REFERENCE,begin:e.begin,end:e.end,type:e.type};e.uri&&(n.uri=e.uri),t.c("reference",n).root()})),e.get("oob_url")&&t.c("x",{xmlns:bm.NS.OUTOFBAND}).c("url").t(e.get("oob_url")).root()),e.get("edited")&&t.c("replace",{xmlns:bm.NS.MESSAGE_CORRECT,id:e.get("msgid")}).root(),e.get("origin_id")&&t.c("origin-id",{xmlns:bm.NS.SID,id:e.get("origin_id")}).root(),t.root();return(await Vl.hook("createMessageStanza",this,{message:e,stanza:t})).stanza},async getOutgoingMessageAttributes(e){await Vl.emojis.initialize();const t=!!this.get("composing_spoiler"),n=Sm.getUniqueId(),s=e?.body,i=s?Sm.shortnamesToUnicode(s):void 0;return e=Object.assign({},e,{from:bl.bare_jid,fullname:bl.xmppstatus.get("fullname"),id:n,is_only_emojis:!!s&&Sm.isOnlyEmojis(s),jid:this.get("jid"),message:i,msgid:n,nickname:this.get("nickname"),sender:"me",time:(new Date).toISOString(),type:this.get("message_type"),body:i,is_spoiler:t,origin_id:n},nm(s)),e=await Vl.hook("getOutgoingMessageAttributes",this,e)},setEditable(e,t){e.is_headline||Nc(e)||"me"!==e.sender||("all"===Vl.settings.get("allow_message_corrections")?e.editable=!(e.file||e.retracted||"oob_url"in e):"last"===Vl.settings.get("allow_message_corrections")&&t>this.get("time_sent")&&(this.set({time_sent:t}),this.messages.findWhere({editable:!0})?.save({editable:!1}),e.editable=!(e.file||e.retracted||"oob_url"in e)))},async createMessage(e,t){return e.time=e.time||(new Date).toISOString(),await this.messages.fetched,this.messages.create(e,t)},async sendMessage(e){e=await this.getOutgoingMessageAttributes(e);let t=this.messages.findWhere("correcting");if(t){const n=t.get("older_versions")||{};n[t.get("edited")||t.get("time")]=t.getMessageText(),t.save({...lr(e,["body","is_only_emojis","media_urls","references","is_encrypted"]),correcting:!1,edited:(new Date).toISOString(),message:e.body,ogp_metadata:[],origin_id:Sm.getUniqueId(),received:void 0,older_versions:n,plaintext:e.is_encrypted?e.message:void 0})}else this.setEditable(e,(new Date).toISOString()),t=await this.createMessage(e);try{const e=await this.createMessageStanza(t);Vl.send(e)}catch(e){return t.destroy(),void Yc.error(e)}return Vl.trigger("sendMessage",{chatbox:this,message:t}),t},sendChatState(){if(Vl.settings.get("send_chat_state_notifications")&&this.get("chat_state")){const e=Vl.settings.get("send_chat_state_notifications");if(Array.isArray(e)&&!e.includes(this.get("chat_state")))return;Vl.send(wm({id:Sm.getUniqueId(),to:this.get("jid"),type:"chat"}).c(this.get("chat_state"),{xmlns:bm.NS.CHATSTATES}).up().c("no-store",{xmlns:bm.NS.HINTS}).up().c("no-permanent-store",{xmlns:bm.NS.HINTS}))}},async sendFiles(e){const{__:t}=bl,n=(await Vl.disco.features.get(bm.NS.HTTPUPLOAD,bl.domain)).pop();if(!n)return void this.createMessage({message:t("Sorry, looks like file upload is not supported by your server."),type:"error",is_ephemeral:!0});const s=n.dataforms.where({FORM_TYPE:{value:bm.NS.HTTPUPLOAD,type:"hidden"}}).pop(),i=window.parseInt((s?.attributes||{})["max-file-size"]?.value),r=n?.id;r?Array.from(e).forEach((async e=>{if(e=await Vl.hook("beforeFileUpload",this,e),!window.isNaN(i)&&window.parseInt(e.size)>i)return this.createMessage({message:t("The size of your file, %1$s, exceeds the maximum allowed by your server, which is %2$s.",e.name,vu(i)),type:"error",is_ephemeral:!0});{const t=await this.getOutgoingMessageAttributes(),n=Object.assign(t,{file:!0,progress:0,slot_request_url:r});this.setEditable(n,(new Date).toISOString());const s=await this.createMessage(n,{silent:!0});s.file=e,this.messages.trigger("add",s),s.getRequestSlotURL()}})):this.createMessage({message:t("Sorry, looks like file upload is not supported by your server."),type:"error",is_ephemeral:!0})},maybeShow(e){if(!Oc())return Sm.safeSave(this,{hidden:!1}),this.trigger("show"),this;{const t=e=>!e.get("hidden")&&e.get("jid")!==this.get("jid")&&"controlbox"!==e.get("id"),n=bl.chatboxes.filter(t);(e||0===n.length)&&(n.forEach((e=>Sm.safeSave(e,{hidden:!0}))),Sm.safeSave(this,{hidden:!1}))}},isHidden(){return this.get("hidden")||this.isScrolledUp()||"hidden"===bl.windowState},handleUnreadMessage(e){e?.get("body")&&Sm.isNewMessage(e)&&("me"===e.get("sender")?this.ui.set("scrolled",!1):this.isHidden()?this.incrementUnreadMsgsCounter(e):this.sendMarkerForMessage(e))},incrementUnreadMsgsCounter(e){const t={num_unread:this.get("num_unread")+1};0===this.get("num_unread")&&(t.first_unread_id=e.get("id")),this.save(t)},clearUnreadMsgCounter(){this.get("num_unread")>0&&this.sendMarkerForMessage(this.messages.last()),Sm.safeSave(this,{num_unread:0})},isScrolledUp(){return this.ui.get("scrolled")}}),Em=xm,{Strophe:Am,sizzle:Cm,u:$m}=Ah.env,km={defaults:()=>({msgid:$m.getUniqueId(),time:(new Date).toISOString(),is_ephemeral:!1}),async initialize(){this.checkValidity()&&(this.initialized=Ao(),this.get("file")&&this.on("change:put",(()=>this.uploadFile())),this.on("change:type",(()=>this.setContact())),this.on("change:is_ephemeral",(()=>this.setTimerForEphemeralMessage())),await this.setContact(),this.setTimerForEphemeralMessage(),await Vl.trigger("messageInitialized",this,{Synchronous:!0}),this.initialized.resolve())},setContact(){["chat","normal"].includes(this.get("type"))&&($h.prototype.initialize.apply(this,arguments),this.setRosterContact(Am.getBareJidFromJid(this.get("from"))))},setTimerForEphemeralMessage(){this.ephemeral_timer&&clearTimeout(this.ephemeral_timer);const e=this.isEphemeral();if(e){const t="number"==typeof e?e:1e4;this.ephemeral_timer=window.setTimeout((()=>this.safeDestroy()),t)}},checkValidity(){return 3!==Object.keys(this.attributes).length||(this.validationError="Empty message",this.safeDestroy(),!1)},mayBeRetracted(){const e="me"===this.get("sender"),t="cancel"!==this.get("error_type");return e&&t&&["all","own"].includes(Vl.settings.get("allow_message_retraction"))},safeDestroy(){try{this.destroy()}catch(e){Yc.warn(`safeDestroy: ${e}`)}},isEphemeral(){return this.get("is_ephemeral")},isMeCommand(){const e=this.getMessageText();return!!e&&e.startsWith("/me ")},isFollowup(){const e=this.collection.models,t=e.indexOf(this),n=t?e[t-1]:null;if(null===n)return!1;const s=Zl()(this.get("time"));return this.get("from")===n.get("from")&&!this.isMeCommand()&&!n.isMeCommand()&&!!this.get("is_encrypted")==!!n.get("is_encrypted")&&this.get("type")===n.get("type")&&"info"!==this.get("type")&&s.isBefore(Zl()(n.get("time")).add(10,"minutes"))&&("groupchat"!==this.get("type")||this.get("occupant_id")===n.get("occupant_id"))},getDisplayName(){return this.contact?this.contact.getDisplayName():this.vcard?this.vcard.getDisplayName():this.get("from")},getMessageText(){if(this.get("is_encrypted")){const{__:e}=bl;return this.get("plaintext")||this.get("body")||e("Undecryptable OMEMO message")}return["groupchat","chat","normal"].includes(this.get("type"))?this.get("body"):this.get("message")},sendSlotRequestStanza(){if(!this.file)return Promise.reject(new Error("file is undefined"));const e=Ah.env.$iq({from:bl.jid,to:this.get("slot_request_url"),type:"get"}).c("request",{xmlns:Am.NS.HTTPUPLOAD,filename:this.file.name,size:this.file.size,"content-type":this.file.type});return Vl.sendIQ(e)},getUploadRequestMetadata:e=>({headers:Cm(`slot[xmlns="${Am.NS.HTTPUPLOAD}"] put header`,e).map((e=>({name:e.getAttribute("name"),value:e.textContent}))).filter((e=>["Authorization","Expires"].includes(e.name)))}),async getRequestSlotURL(){const{__:e}=bl;let t;try{t=await this.sendSlotRequestStanza()}catch(t){return Yc.error(t),this.save({type:"error",message:e("Sorry, could not determine upload URL."),is_ephemeral:!0})}const n=Cm(`slot[xmlns="${Am.NS.HTTPUPLOAD}"]`,t).pop();if(!n)return this.save({type:"error",message:e("Sorry, could not determine file upload URL."),is_ephemeral:!0});this.upload_metadata=this.getUploadRequestMetadata(t),this.save({get:n.querySelector("get").getAttribute("url"),put:n.querySelector("put").getAttribute("url")})},uploadFile(){const e=new XMLHttpRequest;e.onreadystatechange=async()=>{if(e.readyState===XMLHttpRequest.DONE)if(Yc.info("Status: "+e.status),200===e.status||201===e.status){let e={upload:bl.SUCCESS,oob_url:this.get("get"),message:this.get("get"),body:this.get("get")};e=await Vl.hook("afterFileUploaded",this,e),this.save(e)}else e.onerror()},e.upload.addEventListener("progress",(e=>{e.lengthComputable&&this.set("progress",e.loaded/e.total)}),!1),e.onerror=()=>{const{__:t}=bl;let n;n=e.responseText?t('Sorry, could not succesfully upload your file. Your servers response: "%1$s"',e.responseText):t("Sorry, could not succesfully upload your file."),this.save({type:"error",upload:bl.FAILURE,message:n,is_ephemeral:!0})},e.open("PUT",this.get("put"),!0),e.setRequestHeader("Content-type",this.file.type),this.upload_metadata.headers?.forEach((t=>e.setRequestHeader(t.name,t.value))),e.send(this.file)}},jm=km,Tm={chats:{async create(e,t){if("string"==typeof e){if(t&&!t?.fullname){const n=await Vl.contacts.get(e);t.fullname=n?.attributes?.fullname}const n=Vl.chats.get(e,t,!0);return n||void Yc.error("Could not open chatbox for JID: "+e)}return Array.isArray(e)?Promise.all(e.forEach((async n=>{const s=await Vl.contacts.get(e);return t.fullname=s?.attributes?.fullname,Vl.chats.get(n,t,!0).maybeShow()}))):(Yc.error("chats.create: You need to provide at least one JID"),null)},async open(e,t,n){if("string"==typeof e){const s=await Vl.chats.get(e,t,!0);return s?s.maybeShow(n):s}if(Array.isArray(e))return Promise.all(e.map((e=>Vl.chats.get(e,t,!0).then((e=>e&&e.maybeShow(n))))).filter((e=>e)));const s="chats.open: You need to provide at least one JID";throw Yc.error(s),new Error(s)},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.ChatBox):(s=s&&s.get("type")===bl.PRIVATE_CHAT_TYPE?s:null,s&&Object.keys(t).length&&s.save(t)),s}if(await Vl.waitUntil("chatBoxesFetched"),void 0===e){return(await Vl.chatboxes.get()).filter((e=>e.get("type")===bl.PRIVATE_CHAT_TYPE))}return"string"==typeof e?s(e):Promise.all(e.map((e=>s(e))))}}},{Strophe:Im,u:Nm}=Ah.env;function Om(e){if(!Nm.isValidJID(e))return Yc.warn(`Invalid JID "${e}" provided in URL fragment`);Vl.chats.open(e)}async function Mm(){if(Mc()){await Promise.all(bl.chatboxes.map((e=>e.messages&&e.messages.clearStore({silent:!0}))));const e=e=>e.get("type")!==bl.CONTROLBOX_TYPE;bl.chatboxes.clearStore({silent:!0},e)}}function Rm(){Vl.settings.get("auto_join_private_chats").forEach((e=>{bl.chatboxes.where({jid:e}).length||("string"==typeof e?Vl.chats.open(e):Yc.error('Invalid jid criteria specified for "auto_join_private_chats"'))})),Vl.trigger("privateChatsAutoJoined")}function Dm(){bl.connection.addHandler((e=>!!(["groupchat","error"].includes(e.getAttribute("type"))||mm(e)||fm(e)||gm(e))||(bl.handleMessageStanza(e)||!0)),null,"message"),bl.connection.addHandler((e=>async function(e){const t=Im.getBareJidFromJid(e.getAttribute("from"));if(Nm.isSameBareJID(t,bl.bare_jid))return;const n=await Vl.chatboxes.get(t);n?.get("type")===bl.PRIVATE_CHAT_TYPE&&n?.handleErrorMessageStanza(e)}(e)||!0),null,"message","error")}async function zm(e){if(fm(e=e.tree?.()??e)){const t=e.getAttribute("from");return Yc.info(`handleMessageStanza: Ignoring incoming server message from JID: ${t}`)}let t;try{t=await _m(e)}catch(e){return Yc.error(e)}if(Nm.isErrorObject(t))return t.stanza&&Yc.error(t.stanza),Yc.error(t.message);const n=!(!t.body&&!t.plaintext),s=await Vl.chats.get(t.contact_jid,{nickname:t.nick},n);await(s?.queueMessage(t));const i={stanza:e,attrs:t,chatbox:s};Vl.trigger("message",i)}async function Lm(){const e=Im.getDomainFromJid(bl.bare_jid);if(!await Vl.disco.supports(Im.NS.CARBONS,e))return void Yc.warn("Not enabling carbons because it's not supported!");const t=new Im.Builder("iq",{from:bl.connection.jid,type:"set"}).c("enable",{xmlns:Im.NS.CARBONS}),n=await Vl.sendIQ(t,null,!1);null===n?Yc.warn("A timeout occurred while trying to enable carbons"):Nm.isErrorStanza(n)?(Yc.warn("An error occurred while trying to enable message carbons."),Yc.error(n)):Yc.debug("Message carbons have been enabled.")}Ah.plugins.add("converse-chat",{dependencies:["converse-chatboxes","converse-disco"],initialize(){Vl.settings.extend({allow_message_corrections:"all",allow_message_retraction:"all",allow_message_styling:!0,auto_join_private_chats:[],clear_messages_on_reconnection:!1,filter_by_resource:!1,prune_messages_above:void 0,pruning_behavior:"unscrolled",send_chat_markers:["received","displayed","acknowledged"],send_chat_state_notifications:!0}),bl.Message=$h.extend(jm),bl.Messages=Fd.extend({model:bl.Message,comparator:"time"}),Object.assign(bl,{ChatBox:Em,handleMessageStanza:zm}),Object.assign(Vl,Tm),bl.router.route("converse/chat?jid=:jid",Om),Vl.listen.on("chatBoxesFetched",Rm),Vl.listen.on("presencesInitialized",Dm),Vl.listen.on("clearSession",Mm),Vl.listen.on("connected",(()=>Lm())),Vl.listen.on("reconnected",(()=>Lm()))}});const{Strophe:Pm}=Ah.env,Fm=dr.extend({idAttribute:"jid",initialize(e,t){this.waitUntilFeaturesDiscovered=Ao(),this.dataforms=new Fd;let n=`converse.dataforms-${this.get("jid")}`;this.dataforms.browserStorage=bl.createStore(n,"session"),this.features=new Fd,n=`converse.features-${this.get("jid")}`,this.features.browserStorage=bl.createStore(n,"session"),this.listenTo(this.features,"add",this.onFeatureAdded),this.fields=new Fd,n=`converse.fields-${this.get("jid")}`,this.fields.browserStorage=bl.createStore(n,"session"),this.listenTo(this.fields,"add",this.onFieldAdded),this.identities=new Fd,n=`converse.identities-${this.get("jid")}`,this.identities.browserStorage=bl.createStore(n,"session"),this.fetchFeatures(t)},async getIdentity(e,t){return await this.waitUntilFeaturesDiscovered,this.identities.findWhere({category:e,type:t})},async getFeature(e){if(await this.waitUntilFeaturesDiscovered,this.features.findWhere({var:e}))return this},onFeatureAdded(e){e.entity=this,Vl.trigger("serviceDiscovered",e)},onFieldAdded(e){e.entity=this,Vl.trigger("discoExtensionFieldDiscovered",e)},async fetchFeatures(e){if(e.ignore_cache)this.queryInfo();else{const e=this.features.browserStorage.name,t=await this.features.browserStorage.store.getItem(e);t&&0===t.length||null===t?this.queryInfo():(this.features.fetch({add:!0,success:()=>{this.waitUntilFeaturesDiscovered.resolve(this),this.trigger("featuresDiscovered")}}),this.identities.fetch({add:!0}))}},async queryInfo(){let e;try{e=await Vl.disco.info(this.get("jid"),null)}catch(e){return null===e?Yc.error(`Timeout for disco#info query for ${this.get("jid")}`):Yc.error(e),void this.waitUntilFeaturesDiscovered.resolve(this)}this.onInfo(e)},onDiscoItems(e){Eo()(`query[xmlns="${Pm.NS.DISCO_ITEMS}"] item`,e).forEach((e=>{if(e.getAttribute("node"))return;const t=e.getAttribute("jid"),n=bl.disco_entities.get(t);n?n.set({parent_jids:[this.get("jid")]}):Vl.disco.entities.create({jid:t,parent_jids:[this.get("jid")],name:e.getAttribute("name")})}))},async queryForItems(){if(0===this.identities.where({category:"server"}).length)return;const e=await Vl.disco.items(this.get("jid"));this.onDiscoItems(e)},async onInfo(e){Array.from(e.querySelectorAll("identity")).forEach((e=>{this.identities.create({category:e.getAttribute("category"),type:e.getAttribute("type"),name:e.getAttribute("name")})})),Eo()(`x[type="result"][xmlns="${Pm.NS.XFORM}"]`,e).forEach((e=>{const t={};Eo()("field",e).forEach((e=>{t[e.getAttribute("var")]={value:e.querySelector("value")?.textContent,type:e.getAttribute("type")}})),this.dataforms.create(t)})),e.querySelector(`feature[var="${Pm.NS.DISCO_ITEMS}"]`)&&await this.queryForItems(),Array.from(e.querySelectorAll("feature")).forEach((t=>{this.features.create({var:t.getAttribute("var"),from:e.getAttribute("from")})})),Eo()('x[type="result"][xmlns="jabber:x:data"] field',e).forEach((t=>{this.fields.create({var:t.getAttribute("var"),value:t.querySelector("value")?.textContent,from:e.getAttribute("from")})})),this.waitUntilFeaturesDiscovered.resolve(this),this.trigger("featuresDiscovered")}}),Um=Fm,Bm=Fd.extend({model:Um,fetchEntities(){return new Promise(((e,t)=>{this.fetch({add:!0,success:e,error(e,n){Yc.error(n),t(new Error("Could not fetch disco entities"))}})}))}}),qm=Bm,{Strophe:Hm,$iq:Gm}=Ah.env;async function Wm(){Vl.disco.own.identities.add("client","web","Converse"),Vl.disco.own.features.add(Hm.NS.CHATSTATES),Vl.disco.own.features.add(Hm.NS.DISCO_INFO),Vl.disco.own.features.add(Hm.NS.ROSTERX),Vl.disco.own.features.add(Hm.NS.CARBONS),Vl.trigger("addClientFeatures"),bl.connection.addHandler((e=>function(e){const t=e.getElementsByTagName("query")[0].getAttribute("node"),n={xmlns:Hm.NS.DISCO_INFO};t&&(n.node=t);const s=Gm({type:"result",id:e.getAttribute("id")}),i=e.getAttribute("from");return null!==i&&s.attrs({to:i}),s.c("query",n),bl.disco._identities.forEach((e=>{const t={category:e.category,type:e.type};e.name&&(t.name=e.name),e.lang&&(t["xml:lang"]=e.lang),s.c("identity",t).up()})),bl.disco._features.forEach((e=>s.c("feature",{var:e}).up())),Vl.send(s.tree()),!0}(e)),Hm.NS.DISCO_INFO,"iq","get",null,null),bl.disco_entities=new bl.DiscoEntities;const e=`converse.disco-entities-${bl.bare_jid}`;bl.disco_entities.browserStorage=bl.createStore(e,"session");const t=await bl.disco_entities.fetchEntities();0!==t.length&&t.get(bl.domain)||Vl.disco.entities.create({jid:bl.domain},{ignore_cache:!0}),Vl.trigger("discoInitialized")}function Vm(){if(!bl.stream_features){const e=`converse.stream-features-${Hm.getBareJidFromJid(bl.jid)}`;Vl.promises.add("streamFeaturesAdded"),bl.stream_features=new Fd,bl.stream_features.browserStorage=bl.createStore(e,"session")}}function Jm(){Vl.trigger("streamFeaturesAdded")}function Zm(){Vm(),Array.from(bl.connection.features.childNodes).forEach((e=>{bl.stream_features.create({name:e.nodeName,xmlns:e.getAttribute("xmlns")})})),Jm()}function Qm(){bl.disco_entities?.forEach((e=>e.features.clearStore())),bl.disco_entities?.forEach((e=>e.identities.clearStore())),bl.disco_entities?.forEach((e=>e.dataforms.clearStore())),bl.disco_entities?.forEach((e=>e.fields.clearStore())),bl.disco_entities?.clearStore(),delete bl.disco_entities}const{Strophe:Km,$iq:Ym}=Ah.env,Xm={disco:{stream:{async getFeature(e,t){if(await Vl.waitUntil("streamFeaturesAdded"),!e||!t)throw new Error("name and xmlns need to be provided when calling disco.stream.getFeature");if(void 0!==bl.stream_features||Vl.connection.connected())return bl.stream_features.findWhere({name:e,xmlns:t});{const n=`Tried to get feature ${e} ${t} but _converse.stream_features has been torn down`;Yc.warn(n)}}},own:{identities:{add(e,t,n,s){for(var i=0;i<bl.disco._identities.length;i++)if(bl.disco._identities[i].category==e&&bl.disco._identities[i].type==t&&bl.disco._identities[i].name==n&&bl.disco._identities[i].lang==s)return!1;bl.disco._identities.push({category:e,type:t,name:n,lang:s})},clear(){bl.disco._identities=[]},get:()=>bl.disco._identities},features:{add(e){for(var t=0;t<bl.disco._features.length;t++)if(bl.disco._features[t]==e)return!1;bl.disco._features.push(e)},clear(){bl.disco._features=[]},get:()=>bl.disco._features}},info(e,t){const n={xmlns:Km.NS.DISCO_INFO};t&&(n.node=t);const s=Ym({from:bl.connection.jid,to:e,type:"get"}).c("query",n);return Vl.sendIQ(s)},items(e,t){const n={xmlns:Km.NS.DISCO_ITEMS};return t&&(n.node=t),Vl.sendIQ(Ym({from:bl.connection.jid,to:e,type:"get"}).c("query",n))},entities:{async get(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(await Vl.waitUntil("discoInitialized"),!e)return bl.disco_entities;if(void 0===bl.disco_entities)return void Yc.warn(`Tried to look up entity ${e} but _converse.disco_entities has been torn down`);const n=bl.disco_entities.get(e);return n||!t?n:Vl.disco.entities.create({jid:e})},items:e=>bl.disco_entities.filter((t=>t.get("parent_jids")?.includes(e))),create:(e,t)=>bl.disco_entities.create(e,t)},features:{async get(e,t){if(!t)throw new TypeError("You need to provide an entity JID");const n=await Vl.disco.entities.get(t,!0);if(void 0===bl.disco_entities&&!Vl.connection.connected())return Yc.warn(`Tried to get feature ${e} for ${t} but _converse.disco_entities has been torn down`),[];const s=[n.getFeature(e),...Vl.disco.entities.items(t).map((t=>t.getFeature(e)))];return(await Promise.all(s)).filter(y)},async has(e,t){if(!t)throw new TypeError("You need to provide an entity JID");const n=await Vl.disco.entities.get(t,!0);if(void 0===bl.disco_entities&&!Vl.connection.connected())return Yc.warn(`Tried to check if ${t} supports feature ${e}`),!1;if(await n.getFeature(e))return!0;const s=await Promise.all(Vl.disco.entities.items(t).map((t=>t.getFeature(e))));return s.map(y).includes(!0)}},supports:(e,t)=>Vl.disco.features.has(e,t),async refresh(e){if(!e)throw new TypeError("api.disco.refresh: You need to provide an entity JID");await Vl.waitUntil("discoInitialized");let t=await Vl.disco.entities.get(e);return t?(t.features.reset(),t.fields.reset(),t.identities.reset(),t.waitUntilFeaturesDiscovered.isPending||(t.waitUntilFeaturesDiscovered=Ao()),t.queryInfo()):t=await Vl.disco.entities.create({jid:e},{ignore_cache:!0}),t.waitUntilFeaturesDiscovered},refreshFeatures:e=>Vl.refresh(e),async getFeatures(e){if(!e)throw new TypeError("api.disco.getFeatures: You need to provide an entity JID");await Vl.waitUntil("discoInitialized");let t=await Vl.disco.entities.get(e,!0);return t=await t.waitUntilFeaturesDiscovered,t.features},async getFields(e){if(!e)throw new TypeError("api.disco.getFields: You need to provide an entity JID");await Vl.waitUntil("discoInitialized");let t=await Vl.disco.entities.get(e,!0);return t=await t.waitUntilFeaturesDiscovered,t.fields},async getIdentity(e,t,n){const s=await Vl.disco.entities.get(n,!0);if(void 0!==s||Vl.connection.connected())return s.getIdentity(e,t);{const t=`Tried to look up category ${e} for ${n} but _converse.disco_entities has been torn down`;Yc.warn(t)}}}},{Strophe:ef}=Ah.env;Ah.plugins.add("converse-disco",{initialize(){Object.assign(Vl,Xm),Vl.promises.add("discoInitialized"),Vl.promises.add("streamFeaturesAdded"),bl.DiscoEntity=Um,bl.DiscoEntities=qm,bl.disco={_identities:[],_features:[]},Vl.listen.on("userSessionInitialized",(async()=>{Vm(),bl.connfeedback.get("connection_status")===ef.Status.ATTACHED&&(await new Promise(((e,t)=>bl.stream_features.fetch({success:e,error:t}))),Jm())})),Vl.listen.on("beforeResourceBinding",Zm),Vl.listen.on("reconnected",Wm),Vl.listen.on("connected",Wm),Vl.listen.on("beforeTearDown",(async()=>{Vl.promises.add("streamFeaturesAdded"),bl.stream_features&&(await bl.stream_features.clearStore(),delete bl.stream_features)})),Vl.listen.on("will-reconnect",Qm),Vl.listen.on("clearSession",Qm)}});const tf=new RegExp("<object[^>]*>.*?</object>|<span[^>]*>.*?</span>|<(?:object|embed|svg|img|div|span|p|a)[^>]*>|((\\s|^)(\\*\\\\0\\/\\*|\\*\\\\O\\/\\*|\\-___\\-|\\:'\\-\\)|'\\:\\-\\)|'\\:\\-D|\\>\\:\\-\\)|>\\:\\-\\)|'\\:\\-\\(|\\>\\:\\-\\(|>\\:\\-\\(|\\:'\\-\\(|O\\:\\-\\)|0\\:\\-3|0\\:\\-\\)|0;\\^\\)|O;\\-\\)|0;\\-\\)|O\\:\\-3|\\-__\\-|\\:\\-Þ|\\:\\-Þ|\\<\\/3|<\\/3|\\:'\\)|\\:\\-D|'\\:\\)|'\\=\\)|'\\:D|'\\=D|\\>\\:\\)|>\\:\\)|\\>;\\)|>;\\)|\\>\\=\\)|>\\=\\)|;\\-\\)|\\*\\-\\)|;\\-\\]|;\\^\\)|'\\:\\(|'\\=\\(|\\:\\-\\*|\\:\\^\\*|\\>\\:P|>\\:P|X\\-P|\\>\\:\\[|>\\:\\[|\\:\\-\\(|\\:\\-\\[|\\>\\:\\(|>\\:\\(|\\:'\\(|;\\-\\(|\\>\\.\\<|>\\.<|#\\-\\)|%\\-\\)|X\\-\\)|\\\\0\\/|\\\\O\\/|0\\:3|0\\:\\)|O\\:\\)|O\\=\\)|O\\:3|B\\-\\)|8\\-\\)|B\\-D|8\\-D|\\-_\\-|\\>\\:\\\\|>\\:\\\\|\\>\\:\\/|>\\:\\/|\\:\\-\\/|\\:\\-\\.|\\:\\-P|\\:Þ|\\:Þ|\\:\\-b|\\:\\-O|O_O|\\>\\:O|>\\:O|\\:\\-X|\\:\\-#|\\:\\-\\)|\\(y\\)|\\<3|<3|\\:D|\\=D|;\\)|\\*\\)|;\\]|;D|\\:\\*|\\=\\*|\\:\\(|\\:\\[|\\=\\(|\\:@|;\\(|D\\:|\\:\\$|\\=\\$|#\\)|%\\)|X\\)|B\\)|8\\)|\\:\\/|\\:\\\\|\\=\\/|\\=\\\\|\\:L|\\=L|\\:P|\\=P|\\:b|\\:O|\\:X|\\:#|\\=X|\\=#|\\:\\)|\\=\\]|\\=\\)|\\:\\])(?=\\s|$|[!,.?]))","gi"),nf=/(?:\ud83d\udc68\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffc-\udfff]|\ud83d\udc68\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffd-\udfff]|\ud83d\udc68\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc68\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffd\udfff]|\ud83d\udc68\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffe]|\ud83d\udc69\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffc-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffc-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffd-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb\udffd-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc69\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc69\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffd\udfff]|\ud83d\udc69\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb-\udffd\udfff]|\ud83d\udc69\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffe]|\ud83d\udc69\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb-\udffe]|\ud83e\uddd1\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\u200d\ud83e\udd1d\u200d\ud83e\uddd1|\ud83d\udc6b\ud83c[\udffb-\udfff]|\ud83d\udc6c\ud83c[\udffb-\udfff]|\ud83d\udc6d\ud83c[\udffb-\udfff]|\ud83d[\udc6b-\udc6d])|(?:\ud83d[\udc68\udc69]|\ud83e\uddd1)(?:\ud83c[\udffb-\udfff])?\u200d(?:\u2695\ufe0f|\u2696\ufe0f|\u2708\ufe0f|\ud83c[\udf3e\udf73\udf93\udfa4\udfa8\udfeb\udfed]|\ud83d[\udcbb\udcbc\udd27\udd2c\ude80\ude92]|\ud83e[\uddaf-\uddb3\uddbc\uddbd])|(?:\ud83c[\udfcb\udfcc]|\ud83d[\udd74\udd75]|\u26f9)((?:\ud83c[\udffb-\udfff]|\ufe0f)\u200d[\u2640\u2642]\ufe0f)|(?:\ud83c[\udfc3\udfc4\udfca]|\ud83d[\udc6e\udc71\udc73\udc77\udc81\udc82\udc86\udc87\ude45-\ude47\ude4b\ude4d\ude4e\udea3\udeb4-\udeb6]|\ud83e[\udd26\udd35\udd37-\udd39\udd3d\udd3e\uddb8\uddb9\uddcd-\uddcf\uddd6-\udddd])(?:\ud83c[\udffb-\udfff])?\u200d[\u2640\u2642]\ufe0f|(?:\ud83d\udc68\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68|\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d[\udc68\udc69]|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\u2764\ufe0f\u200d\ud83d\udc68|\ud83d\udc68\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\u2764\ufe0f\u200d\ud83d[\udc68\udc69]|\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83c\udff3\ufe0f\u200d\u26a7\ufe0f|\ud83c\udff3\ufe0f\u200d\ud83c\udf08|\ud83c\udff4\u200d\u2620\ufe0f|\ud83d\udc15\u200d\ud83e\uddba|\ud83d\udc41\u200d\ud83d\udde8|\ud83d\udc68\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83d\udc6f\u200d\u2640\ufe0f|\ud83d\udc6f\u200d\u2642\ufe0f|\ud83e\udd3c\u200d\u2640\ufe0f|\ud83e\udd3c\u200d\u2642\ufe0f|\ud83e\uddde\u200d\u2640\ufe0f|\ud83e\uddde\u200d\u2642\ufe0f|\ud83e\udddf\u200d\u2640\ufe0f|\ud83e\udddf\u200d\u2642\ufe0f)|[#*0-9]\ufe0f?\u20e3|(?:[©®\u2122\u265f]\ufe0f)|(?:\ud83c[\udc04\udd70\udd71\udd7e\udd7f\ude02\ude1a\ude2f\ude37\udf21\udf24-\udf2c\udf36\udf7d\udf96\udf97\udf99-\udf9b\udf9e\udf9f\udfcd\udfce\udfd4-\udfdf\udff3\udff5\udff7]|\ud83d[\udc3f\udc41\udcfd\udd49\udd4a\udd6f\udd70\udd73\udd76-\udd79\udd87\udd8a-\udd8d\udda5\udda8\uddb1\uddb2\uddbc\uddc2-\uddc4\uddd1-\uddd3\udddc-\uddde\udde1\udde3\udde8\uddef\uddf3\uddfa\udecb\udecd-\udecf\udee0-\udee5\udee9\udef0\udef3]|[\u203c\u2049\u2139\u2194-\u2199\u21a9\u21aa\u231a\u231b\u2328\u23cf\u23ed-\u23ef\u23f1\u23f2\u23f8-\u23fa\u24c2\u25aa\u25ab\u25b6\u25c0\u25fb-\u25fe\u2600-\u2604\u260e\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262a\u262e\u262f\u2638-\u263a\u2640\u2642\u2648-\u2653\u2660\u2663\u2665\u2666\u2668\u267b\u267f\u2692-\u2697\u2699\u269b\u269c\u26a0\u26a1\u26a7\u26aa\u26ab\u26b0\u26b1\u26bd\u26be\u26c4\u26c5\u26c8\u26cf\u26d1\u26d3\u26d4\u26e9\u26ea\u26f0-\u26f5\u26f8\u26fa\u26fd\u2702\u2708\u2709\u270f\u2712\u2714\u2716\u271d\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u2764\u27a1\u2934\u2935\u2b05-\u2b07\u2b1b\u2b1c\u2b50\u2b55\u3030\u303d\u3297\u3299])(?:\ufe0f|(?!\ufe0e))|(?:(?:\ud83c[\udfcb\udfcc]|\ud83d[\udd74\udd75\udd90]|[\u261d\u26f7\u26f9\u270c\u270d])(?:\ufe0f|(?!\ufe0e))|(?:\ud83c[\udf85\udfc2-\udfc4\udfc7\udfca]|\ud83d[\udc42\udc43\udc46-\udc50\udc66-\udc69\udc6e\udc70-\udc78\udc7c\udc81-\udc83\udc85-\udc87\udcaa\udd7a\udd95\udd96\ude45-\ude47\ude4b-\ude4f\udea3\udeb4-\udeb6\udec0\udecc]|\ud83e[\udd0f\udd18-\udd1c\udd1e\udd1f\udd26\udd30-\udd39\udd3d\udd3e\uddb5\uddb6\uddb8\uddb9\uddbb\uddcd-\uddcf\uddd1-\udddd]|[\u270a\u270b]))(?:\ud83c[\udffb-\udfff])?|(?:\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc65\udb40\udc6e\udb40\udc67\udb40\udc7f|\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc73\udb40\udc63\udb40\udc74\udb40\udc7f|\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc77\udb40\udc6c\udb40\udc73\udb40\udc7f|\ud83c\udde6\ud83c[\udde8-\uddec\uddee\uddf1\uddf2\uddf4\uddf6-\uddfa\uddfc\uddfd\uddff]|\ud83c\udde7\ud83c[\udde6\udde7\udde9-\uddef\uddf1-\uddf4\uddf6-\uddf9\uddfb\uddfc\uddfe\uddff]|\ud83c\udde8\ud83c[\udde6\udde8\udde9\uddeb-\uddee\uddf0-\uddf5\uddf7\uddfa-\uddff]|\ud83c\udde9\ud83c[\uddea\uddec\uddef\uddf0\uddf2\uddf4\uddff]|\ud83c\uddea\ud83c[\udde6\udde8\uddea\uddec\udded\uddf7-\uddfa]|\ud83c\uddeb\ud83c[\uddee-\uddf0\uddf2\uddf4\uddf7]|\ud83c\uddec\ud83c[\udde6\udde7\udde9-\uddee\uddf1-\uddf3\uddf5-\uddfa\uddfc\uddfe]|\ud83c\udded\ud83c[\uddf0\uddf2\uddf3\uddf7\uddf9\uddfa]|\ud83c\uddee\ud83c[\udde8-\uddea\uddf1-\uddf4\uddf6-\uddf9]|\ud83c\uddef\ud83c[\uddea\uddf2\uddf4\uddf5]|\ud83c\uddf0\ud83c[\uddea\uddec-\uddee\uddf2\uddf3\uddf5\uddf7\uddfc\uddfe\uddff]|\ud83c\uddf1\ud83c[\udde6-\udde8\uddee\uddf0\uddf7-\uddfb\uddfe]|\ud83c\uddf2\ud83c[\udde6\udde8-\udded\uddf0-\uddff]|\ud83c\uddf3\ud83c[\udde6\udde8\uddea-\uddec\uddee\uddf1\uddf4\uddf5\uddf7\uddfa\uddff]|\ud83c\uddf4\ud83c\uddf2|\ud83c\uddf5\ud83c[\udde6\uddea-\udded\uddf0-\uddf3\uddf7-\uddf9\uddfc\uddfe]|\ud83c\uddf6\ud83c\udde6|\ud83c\uddf7\ud83c[\uddea\uddf4\uddf8\uddfa\uddfc]|\ud83c\uddf8\ud83c[\udde6-\uddea\uddec-\uddf4\uddf7-\uddf9\uddfb\uddfd-\uddff]|\ud83c\uddf9\ud83c[\udde6\udde8\udde9\uddeb-\udded\uddef-\uddf4\uddf7\uddf9\uddfb\uddfc\uddff]|\ud83c\uddfa\ud83c[\udde6\uddec\uddf2\uddf3\uddf8\uddfe\uddff]|\ud83c\uddfb\ud83c[\udde6\udde8\uddea\uddec\uddee\uddf3\uddfa]|\ud83c\uddfc\ud83c[\uddeb\uddf8]|\ud83c\uddfd\ud83c\uddf0|\ud83c\uddfe\ud83c[\uddea\uddf9]|\ud83c\uddff\ud83c[\udde6\uddf2\uddfc]|\ud83c[\udccf\udd8e\udd91-\udd9a\udde6-\uddff\ude01\ude32-\ude36\ude38-\ude3a\ude50\ude51\udf00-\udf20\udf2d-\udf35\udf37-\udf7c\udf7e-\udf84\udf86-\udf93\udfa0-\udfc1\udfc5\udfc6\udfc8\udfc9\udfcf-\udfd3\udfe0-\udff0\udff4\udff8-\udfff]|\ud83d[\udc00-\udc3e\udc40\udc44\udc45\udc51-\udc65\udc6a\udc6f\udc79-\udc7b\udc7d-\udc80\udc84\udc88-\udca9\udcab-\udcfc\udcff-\udd3d\udd4b-\udd4e\udd50-\udd67\udda4\uddfb-\ude44\ude48-\ude4a\ude80-\udea2\udea4-\udeb3\udeb7-\udebf\udec1-\udec5\uded0-\uded2\uded5\udeeb\udeec\udef4-\udefa\udfe0-\udfeb]|\ud83e[\udd0d\udd0e\udd10-\udd17\udd1d\udd20-\udd25\udd27-\udd2f\udd3a\udd3c\udd3f-\udd45\udd47-\udd71\udd73-\udd76\udd7a-\udda2\udda5-\uddaa\uddae-\uddb4\uddb7\uddba\uddbc-\uddca\uddd0\uddde-\uddff\ude70-\ude73\ude78-\ude7a\ude80-\ude82\ude90-\ude95]|[\u23e9-\u23ec\u23f0\u23f3\u267e\u26ce\u2705\u2728\u274c\u274e\u2753-\u2755\u2795-\u2797\u27b0\u27bf\ue50a])|\ufe0f/g,{u:sf}=Ah.env,rf={},of={"*\\0/*":"1f646","*\\O/*":"1f646","-___-":"1f611",":'-)":"1f602","':-)":"1f605","':-D":"1f605",">:-)":"1f606","':-(":"1f613",">:-(":"1f620",":'-(":"1f622","O:-)":"1f607","0:-3":"1f607","0:-)":"1f607","0;^)":"1f607","O;-)":"1f607","0;-)":"1f607","O:-3":"1f607","-__-":"1f611",":-Þ":"1f61b","</3":"1f494",":')":"1f602",":-D":"1f603","':)":"1f605","'=)":"1f605","':D":"1f605","'=D":"1f605",">:)":"1f606",">;)":"1f606",">=)":"1f606",";-)":"1f609","*-)":"1f609",";-]":"1f609",";^)":"1f609","':(":"1f613","'=(":"1f613",":-*":"1f618",":^*":"1f618",">:P":"1f61c","X-P":"1f61c",">:[":"1f61e",":-(":"1f61e",":-[":"1f61e",">:(":"1f620",":'(":"1f622",";-(":"1f622",">.<":"1f623","#-)":"1f635","%-)":"1f635","X-)":"1f635","\\0/":"1f646","\\O/":"1f646","0:3":"1f607","0:)":"1f607","O:)":"1f607","O=)":"1f607","O:3":"1f607","B-)":"1f60e","8-)":"1f60e","B-D":"1f60e","8-D":"1f60e","-_-":"1f611",">:\\":"1f615",">:/":"1f615",":-/":"1f615",":-.":"1f615",":-P":"1f61b",":Þ":"1f61b",":-b":"1f61b",":-O":"1f62e",O_O:"1f62e",">:O":"1f62e",":-X":"1f636",":-#":"1f636",":-)":"1f642","(y)":"1f44d","<3":"2764",":D":"1f603","=D":"1f603",";)":"1f609","*)":"1f609",";]":"1f609",";D":"1f609",":*":"1f618","=*":"1f618",":(":"1f61e",":[":"1f61e","=(":"1f61e",":@":"1f620",";(":"1f622","D:":"1f628",":$":"1f633","=$":"1f633","#)":"1f635","%)":"1f635","X)":"1f635","B)":"1f60e","8)":"1f60e",":/":"1f615",":\\":"1f615","=/":"1f615","=\\":"1f615",":L":"1f615","=L":"1f615",":P":"1f61b","=P":"1f61b",":b":"1f61b",":O":"1f62e",":X":"1f636",":#":"1f636","=X":"1f636","=#":"1f636",":)":"1f642","=]":"1f642","=)":"1f642",":]":"1f642"};function af(e){if(e.indexOf("-")>-1){const t=[],n=e.split("-");for(let e=0;e<n.length;e++){let s=parseInt(n[e],16);if(s>=65536&&s<=1114111){const e=Math.floor((s-65536)/1024)+55296,t=(s-65536)%1024+56320;s=String.fromCharCode(e)+String.fromCharCode(t)}else s=String.fromCharCode(s);t.push(s)}return t.join("")}return function(e){let t="string"==typeof e?parseInt(e,16):e;return t<65536?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}(e)}function cf(e){return e.replace(tf,((e,t,n,s)=>{if(void 0===s||""===s||!(sf.unescapeHTML(s)in of))return e;s=sf.unescapeHTML(s);return n+af(of[s].toUpperCase())}))}function lf(e){if(!Ah.emojis.initialized)throw new Error("getShortnameReferences called before emojis are initialized. To avoid this problem, first await the converse.emojis.initialized_promise");return[...e.matchAll(Ah.emojis.shortnames_regex)].filter((e=>e[0].length>0)).map((e=>{const t=Ah.emojis.by_sn[e[0]].cp;return{cp:t,begin:e.index,end:e.index+e[0].length,shortname:e[0],emoji:t?af(t):null}}))}function df(e){const t=[];return function(e,t){const n=/\uFE0F/g,s=String.fromCharCode(8205);String(e).replace(nf,((e,i,r)=>{const o=function(e){const t=[];let n=0,s=0;for(;s<e.length;){const i=e.charCodeAt(s++);n?(t.push((65536+(n-55296<<10)+(i-56320)).toString(16)),n=0):55296<=i&&i<=56319?n=i:t.push(i.toString(16))}return t.join("-")}(e.indexOf(s)<0?e.replace(n,""):e);o&&t(o,e,r)}))}(e,((e,n,s)=>{t.push({begin:s,cp:e,emoji:n,end:s+n.length,shortname:uf("cp")[e]?.sn||""})})),t}function uf(e){if(rf[e])return rf[e];if("category"===e)return Ah.emojis.json;const t=Ah.emojis.list.map((t=>t[e])).filter(((e,t,n)=>n.indexOf(e)==t));return rf[e]={},t.forEach((t=>rf[e][t]=Ah.emojis.list.find((n=>n[e]===t)))),rf[e]}Object.assign(sf,{getEmojisByAtrribute:uf,isOnlyEmojis:function(e){const t=e.trim().split(/\s+/);if(0===t.length||t.length>3)return!1;return t.filter((e=>{const t=df(sf.shortnamesToUnicode(e));return 1===t.length&&(e===t[0].shortname||e===t[0].emoji)})).length===t.length},shortnamesToUnicode:function(e){return function(e){let t=[e];return[...lf(e),...df(e)].sort(((e,t)=>t.begin-e.begin)).forEach((e=>{const n=t.shift(),s=e.emoji||e.shortname;t=[n.slice(0,e.begin)+s+n.slice(e.end),...t]})),t}(cf(e)).pop()}}),Ah.emojis={initialized:!1,initialized_promise:Ao()},Ah.plugins.add("converse-emoji",{initialize(){const{___:e}=bl;Vl.settings.extend({emoji_image_path:"https://twemoji.maxcdn.com/v/12.1.6/",emoji_categories:{smileys:":grinning:",people:":thumbsup:",activity:":soccer:",travel:":motorcycle:",objects:":bomb:",nature:":rainbow:",food:":hotdog:",symbols:":musical_note:",flags:":flag_ac:",custom:null},emoji_category_labels:{smileys:e("Smileys and emotions"),people:e("People"),activity:e("Activities"),travel:e("Travel"),objects:e("Objects"),nature:e("Animals and nature"),food:e("Food and drink"),symbols:e("Symbols"),flags:e("Flags"),custom:e("Stickers")}}),bl.EmojiPicker=dr.extend({defaults:{current_category:"smileys",current_skintone:"",scroll_position:0}}),Object.assign(Vl,{emojis:{async initialize(){if(!Ah.emojis.initialized){Ah.emojis.initialized=!0;const e=await n.e(4610).then(n.t.bind(n,5175,19)),t=Ah.emojis.json=e.default;Ah.emojis.by_sn=Object.keys(t).reduce(((e,n)=>Object.assign(e,t[n])),{}),Ah.emojis.list=Object.values(Ah.emojis.by_sn),Ah.emojis.list.sort(((e,t)=>e.sn<t.sn?-1:e.sn>t.sn?1:0)),Ah.emojis.shortnames=Ah.emojis.list.map((e=>e.sn));const s=()=>Ah.emojis.shortnames.map((e=>e.replace(/[+]/g,"\\$&"))).join("|");Ah.emojis.shortnames_regex=new RegExp(s(),"gi"),Ah.emojis.initialized_promise.resolve()}return Ah.emojis.initialized_promise}}})}});const hf={initialize(){this.checkValidity()&&(this.get("file")&&this.on("change:put",(()=>this.uploadFile())),this.on("change:type",(()=>this.setOccupant())),this.on("change:is_ephemeral",(()=>this.setTimerForEphemeralMessage())),this.chatbox=this.collection?.chatbox,this.setTimerForEphemeralMessage(),this.setOccupant(),Vl.trigger("chatRoomMessageInitialized",this))},getDisplayName(){return this.occupant?.getDisplayName()||this.get("nick")},mayBeModerated(){if(void 0!==this.get("from_muc"))return["all","moderator"].includes(Vl.settings.get("allow_message_retraction"))&&this.get(`stanza_id ${this.get("from_muc")}`)&&this.chatbox.canModerateMessages()},checkValidity(){const e=bl.Message.prototype.checkValidity.call(this);return!e&&this.chatbox.debouncedRejoin(),e},onOccupantRemoved(){this.stopListening(this.occupant),delete this.occupant,this.listenTo(this.chatbox.occupants,"add",this.onOccupantAdded)},onOccupantAdded(e){if(this.get("occupant_id")){if(e.get("occupant_id")!==this.get("occupant_id"))return}else if(e.get("nick")!==so.getResourceFromJid(this.get("from")))return;this.occupant=e,e.get("jid")&&this.save("from_real_jid",e.get("jid")),this.trigger("occupantAdded"),this.listenTo(this.occupant,"destroy",this.onOccupantRemoved),this.stopListening(this.chatbox.occupants,"add",this.onOccupantAdded)},getOccupant(){return this.occupant||this.setOccupant(),this.occupant},setOccupant(){if("groupchat"!==this.get("type")||this.isEphemeral()||this.occupant)return;const e=so.getResourceFromJid(this.get("from")),t=this.get("occupant_id");if(this.occupant=this.chatbox.occupants.findOccupant({nick:e,occupant_id:t}),!this.occupant&&(this.occupant=this.chatbox.occupants.create({nick:e,occupant_id:t,jid:this.get("from_real_jid")}),Vl.settings.get("muc_send_probes"))){const t=`${this.chatbox.get("jid")}/${e}`;Vl.user.presence.send("probe",t)}this.listenTo(this.occupant,"destroy",this.onOccupantRemoved)}},mf=hf;const ff=function(e){return B(e)&&1===e.nodeType&&!Ki(e)},gf={},pf=(e,t)=>e.replace(RegExp("\\"+t,"ig"),"\\"+t);gf.escapeCharacters=e=>t=>e.split("").reduce(pf,t),gf.escapeRegexString=gf.escapeCharacters("[\\^$.?*+(){}|"),gf.findFirstMatchInArray=e=>t=>{for(let n=0;n<e.length;n++)if(0===t.localeCompare(e[n],void 0,{sensitivity:"base"}))return e[n];return null};const vf=(e,t,n)=>{let[s,i]=e,r=s,{begin:o,end:a}=t;const{value:c}=t;return o-=n,a=a-n-1,r=`${r.slice(0,o)}${c}${r.slice(a+1)}`,[r,[...i,{...t,begin:o,end:a}]]};gf.reduceTextFromReferences=(e,t)=>t.reduce(vf,[e,[]]);const yf=gf,_f=["moderator","participant","visitor"],bf=["owner","admin","member","outcast","none"],wf={moderator:1,participant:2,visitor:3,none:2},Sf={OWNER:"owner",ADMIN:"admin",MEMBER:"member",EXADMIN:"exadmin",EXOWNER:"exowner",EXOUTCAST:"exoutcast",EXMEMBER:"exmember"},xf=Object.values(Sf),Ef={ENTERED:"entered",EXITED:"exited"},Af=Object.values(Ef),Cf={OP:"op",DEOP:"deop",VOICE:"voice",MUTE:"mute"},$f=Object.values(Cf),kf={visibility_changes:["100","102","103","172","173","174"],self:["110"],non_privacy_changes:["104","201"],muc_logging_changes:["170","171"],nickname_changes:["210","303"],disconnected:["301","307","321","322","332","333"],affiliation_changes:[...xf],join_leave_events:[...Af],role_changes:[...$f]},jf={CONNECTED:0,CONNECTING:1,NICKNAME_REQUIRED:2,PASSWORD_REQUIRED:3,DISCONNECTED:4,ENTERED:5,DESTROYED:6,BANNED:7,CLOSING:8},{Strophe:Tf,sizzle:If,u:Nf}=Ah.env,{NS:Of}=Tf;function Mf(e){const t=If(`items[node="${Tf.NS.CONFINFO}"]`,e).pop();if(!t)return null;const n=e.getAttribute("from"),s=e.getAttribute("id"),i=`item conference-info[xmlns="${Tf.NS.CONFINFO}"] activity[xmlns="${Tf.NS.ACTIVITY}"]`;return If(i,t).map((t=>{const i=t.querySelector("text")?.textContent;if(i){const r=om(e),o=t.querySelector("reason")?.textContent;return{from:n,msgid:s,message:i,reason:o,references:r,type:"mep"}}return{}}))}function Rf(e,t){if(t.features.get(Tf.NS.OCCUPANTID))return If(`occupant-id[xmlns="${Tf.NS.OCCUPANTID}"]`,e).pop()?.getAttribute("id")}function Df(e,t){let n;const s=t.get("occupant_id");return n=s?e.occupant_id===s:e.from_real_jid?Tf.getBareJidFromJid(e.from_real_jid)===bl.bare_jid:e.nick===t.get("nick"),n?"me":"them"}async function zf(e,t){um(e);const n=`[xmlns="${Of.MAM}"] > forwarded[xmlns="${Of.FORWARD}"] > message`,s=e;if(e=If(n,e).pop()||e,If(`message > forwarded[xmlns="${Tf.NS.FORWARD}"]`,e).length)return new Kh(`Invalid Stanza: Forged MAM groupchat message from ${e.getAttribute("from")}`,e);const i=If(`delay[xmlns="${Tf.NS.DELAY}"]`,s).pop(),r=e.getAttribute("from"),o=hm(e);let a=Object.assign({from:r,activities:Mf(e),body:e.querySelector(":scope > body")?.textContent?.trim(),chat_state:lm(e),from_muc:Tf.getBareJidFromJid(r),is_archived:gm(s),is_carbon:cm(s),is_delayed:!!i,is_forwarded:!!e.querySelector("forwarded"),is_headline:mm(e),is_markable:!!If(`markable[xmlns="${Tf.NS.MARKERS}"]`,e).length,is_marker:!!o,is_unstyled:!!If(`unstyled[xmlns="${Tf.NS.STYLING}"]`,e).length,marker_id:o&&o.getAttribute("id"),msgid:e.getAttribute("id")||s.getAttribute("id"),nick:Tf.unescapeNode(Tf.getResourceFromJid(r)),occupant_id:Rf(e,t),receipt_id:am(e),received:(new Date).toISOString(),references:om(e),subject:e.querySelector("subject")?.textContent,thread:e.querySelector("thread")?.textContent,time:i?Zl()(i.getAttribute("stamp")).toISOString():(new Date).toISOString(),to:e.getAttribute("to"),type:e.getAttribute("type")},rm(e),im(e),sm(e),tm(e,s),Yh(e,s),function(e){const t=Eo()(`> apply-to[xmlns="${so.NS.FASTEN}"]`,e).pop();if(t){const e=t.getAttribute("id"),n=Eo()(`> meta[xmlns="${so.NS.XHTML}"]`,t);if(n.length){const t=Vl.settings.get("message_limit"),s=n.reduce(((e,n)=>{const s=n.getAttribute("property");if(s){let i=Vc(n.getAttribute("content")||"");t&&"og:description"===s&&i.length>=t&&(i=`${i.slice(0,t)}${Vc("&#8230;")}`),e[s]=i}return e}),{ogp_for_id:e});if("og:description"in s||"og:title"in s||"og:image"in s)return s}}return{}}(e),em(e,s),function(e){const t=If(`apply-to[xmlns="${Tf.NS.FASTEN}"]`,e).pop();if(t){const e=t.getAttribute("id"),n=If(`moderated[xmlns="${Tf.NS.MODERATE}"]`,t).pop();if(n&&If(`retract[xmlns="${Tf.NS.RETRACT}"]`,n).pop())return{editable:!1,moderated:"retracted",moderated_by:n.getAttribute("by"),moderated_id:e,moderation_reason:n.querySelector("reason")?.textContent}}else{const t=If(`> moderated[xmlns="${Tf.NS.MODERATE}"]`,e).pop();if(t&&If(`retracted[xmlns="${Tf.NS.RETRACT}"]`,t).pop())return{editable:!1,is_tombstone:!0,moderated_by:t.getAttribute("by"),retracted:t.getAttribute("stamp"),moderation_reason:t.querySelector("reason")?.textContent}}return{}}(e),Xh(e));return await Vl.emojis.initialize(),a.from_real_jid=a.is_archived&&function(e){const t=If(`x[xmlns="${Tf.NS.MUC_USER}"] item`,e).pop();return t?.getAttribute("jid")}(e)||t.occupants.findOccupant(a)?.get("jid"),a=Object.assign({is_only_emojis:!!a.body&&Nf.isOnlyEmojis(a.body),is_valid_receipt_request:dm(e,a),message:a.body||a.error,sender:Df(a,t)},a),a.is_archived&&s.getAttribute("from")!==a.from_muc?new Kh(`Invalid Stanza: Forged MAM message from ${s.getAttribute("from")}`,e):a.is_archived&&s.getAttribute("from")!==t.get("jid")?new Kh(`Invalid Stanza: Forged MAM groupchat message from ${e.getAttribute("from")}`,e):a.is_carbon?new Kh("Invalid Stanza: MUC messages SHOULD NOT be XEP-0280 carbon copied",e):(a.id=a.origin_id||a[`stanza_id ${a.from_muc||a.from}`]||Nf.getUniqueId(),a=await Vl.hook("parseMUCMessage",e,a),Object.assign(a,nm(a.is_encrypted?a.plaintext:a.body)))}const{Strophe:Lf,$iq:Pf,u:Ff}=Ah.env;async function Uf(e,t){const{__:n}=bl,s=Pf({to:t,type:"get"}).c("query",{xmlns:Lf.NS.MUC_ADMIN}).c("item",{affiliation:e}),i=await Vl.sendIQ(s,null,!1);if(null===i){const s=n("Error: timeout while fetching %1s list for MUC %2s",e,t),i=new Error(s);return Yc.warn(s),i}if(Ff.isErrorStanza(i)){const s=n("Error: not allowed to fetch %1s list for MUC %2s",e,t),r=new Error(s);return Yc.warn(s),Yc.warn(i),r}return function(e){return If(`query[xmlns="${Tf.NS.MUC_ADMIN}"] item`,e).map((e=>{const t={affiliation:e.getAttribute("affiliation")},n=e.getAttribute("jid");Nf.isValidJID(n)?t.jid=n:t.nick=n;const s=e.getAttribute("nick");return s&&(t.nick=s),e.getAttribute("role")&&(t.role=s),t}))}(i).filter((e=>e)).sort(((e,t)=>e.nick<t.nick?-1:e.nick>t.nick?1:0))}function Bf(e){let t=Vl.settings.get("modtools_disable_assign");return Array.isArray(t)||(t=t?Ag:[]),"owner"===e?.get("affiliation")?Ag.filter((e=>!t.includes(e))):"admin"===e?.get("affiliation")?Ag.filter((e=>!["owner","admin",...t].includes(e))):[]}function qf(e,t){const n=[...new Set(t.map((e=>e.affiliation)))];return Promise.all(n.map((n=>Hf(n,e,t))))}function Hf(e,t,n){return Array.isArray(t)||(t=[t]),n=n.filter((t=>[void 0,e].includes(t.affiliation))),Promise.all(t.reduce(((t,s)=>[...t,...n.map((t=>function(e,t,n){const s=Pf({to:t,type:"set"}).c("query",{xmlns:Lf.NS.MUC_ADMIN}).c("item",{affiliation:n.affiliation||e,nick:n.nick,jid:n.jid});void 0!==n.reason&&s.c("reason",n.reason);return Vl.sendIQ(s)}(e,s,t)))]),[]))}function Gf(e,t,n,s){const i=n.map((e=>e.jid)),r=s.map((e=>e.jid));let o=hd(i,r).map((e=>n[Ad(i,e)]));return e||(o=o.concat(n.filter((e=>{const t=Ad(r,e.jid);return t>=0&&e.affiliation!==s[t].affiliation})))),t&&(o=o.concat(hd(r,i).map((e=>({jid:e,affiliation:"none"}))))),o}bl.getAssignableAffiliations=Bf;const{u:Wf}=Ah.env,Vf=["owner"],Jf=["admin","ban","deop","destroy","member","op","revoke"],Zf=["kick","mute","voice","modtools"],Qf=["nick"],Kf=["og:article:author","og:article:published_time","og:description","og:image","og:image:height","og:image:width","og:site_name","og:title","og:type","og:url","og:video:height","og:video:secure_url","og:video:tag","og:video:type","og:video:url","og:video:width"],Yf=["301","303","333","307","321","322"],Xf=dr.extend({defaults:()=>({connection_status:jf.DISCONNECTED})}),eg={defaults(){return{bookmarked:!1,chat_state:void 0,has_activity:!1,hidden:Oc()&&!Vl.settings.get("singleton"),hidden_occupants:!!Vl.settings.get("hide_muc_participants"),message_type:"groupchat",name:"",num_unread_general:0,num_unread:0,roomconfig:{},time_opened:this.get("time_opened")||(new Date).getTime(),time_sent:new Date(0).toISOString(),type:bl.CHATROOMS_TYPE}},async initialize(){this.initialized=Ao(),this.debouncedRejoin=Il(this.rejoin,250),this.set("box_id",`box-${this.get("jid")}`),this.initNotifications(),this.initMessages(),this.initUI(),this.initOccupants(),this.initDiscoModels(),this.registerHandlers(),this.on("change:chat_state",this.sendChatState,this),this.on("change:hidden",this.onHiddenChange,this),this.on("destroy",this.removeHandlers,this),this.ui.on("change:scrolled",this.onScrolledChanged,this),await this.restoreSession(),this.session.on("change:connection_status",this.onConnectionStatusChanged,this),this.listenTo(this.occupants,"add",this.onOccupantAdded),this.listenTo(this.occupants,"remove",this.onOccupantRemoved),this.listenTo(this.occupants,"change:show",this.onOccupantShowChanged),this.listenTo(this.occupants,"change:affiliation",this.createAffiliationChangeMessage),this.listenTo(this.occupants,"change:role",this.createRoleChangeMessage);await this.restoreFromCache()||this.join(),await Vl.trigger("chatRoomInitialized",this,{Synchronous:!0}),this.initialized.resolve()},isEntered(){return this.session.get("connection_status")===jf.ENTERED},isRAICandidate(){return this.get("hidden")&&Vl.settings.get("muc_subscribe_to_rai")&&"none"!==this.getOwnAffiliation()},async restoreFromCache(){if(this.isEntered()){if(await this.fetchOccupants().catch((e=>Yc.error(e))),this.isRAICandidate())return this.session.save("connection_status",jf.DISCONNECTED),this.enableRAI(),!0;if(await this.isJoined())return await new Promise((e=>this.config.fetch({success:e,error:e}))),await new Promise((e=>this.features.fetch({success:e,error:e}))),await this.fetchMessages().catch((e=>Yc.error(e))),!0}return this.session.save("connection_status",jf.DISCONNECTED),this.clearOccupantsCache(),!1},async join(e,t){return this.isEntered()?this:(this.session.save("connection_status",jf.CONNECTING),await this.refreshDiscoInfo(),(e=await this.getAndPersistNickname(e))?(Vl.send(await this.constructJoinPresence(t)),this):(Fc(this.session,{connection_status:jf.NICKNAME_REQUIRED}),Vl.settings.get("muc_show_logs_before_join")&&await this.fetchMessages(),this))},rejoin(){return this.session.save("connection_status",jf.DISCONNECTED),this.registerHandlers(),this.clearOccupantsCache(),this.join()},async constructJoinPresence(e){let t=Qr({id:Bc(),from:bl.connection.jid,to:this.getRoomJIDAndNick()}).c("x",{xmlns:so.NS.MUC}).c("history",{maxstanzas:this.features.get("mam_enabled")?0:Vl.settings.get("muc_history_max_stanzas")}).up();return(e=e||this.get("password"))&&t.cnode(so.xmlElement("password",[],e)),t.up(),t=await Vl.hook("constructedMUCPresence",this,t),t},clearOccupantsCache(){this.occupants.length?this.occupants.filter((e=>!e.isMember())).forEach((e=>e.destroy())):this.occupants.clearStore()},sendMarkerForMessage(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"displayed",n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e&&Vl.settings.get("send_chat_markers").includes(t)&&"groupchat"===e?.get("type")&&(e?.get("is_markable")||n)){const n=`stanza_id ${this.get("jid")}`,s=e.get(n);if(!s)return void Yc.error(`Can't send marker for message without stanza ID: ${n}`);Rh(so.getBareJidFromJid(e.get("from")),s,t,e.get("type"))}},enableRAI(){if(Vl.settings.get("muc_subscribe_to_rai")){const e=so.getDomainFromJid(this.get("jid"));Vl.user.presence.send(null,e,null,Vr("rai",{xmlns:so.NS.RAI}))}},async onHiddenChange(){const e=jf,t=this.session.get("connection_status");this.get("hidden")?t===e.ENTERED&&this.isRAICandidate()&&(this.sendMarkerForLastMessage("received",!0),await this.leave(),this.enableRAI()):(t===e.DISCONNECTED&&this.rejoin(),this.clearUnreadMsgCounter())},onOccupantAdded(e){bl.isInfoVisible(Ah.MUC_TRAFFIC_STATES.ENTERED)&&this.session.get("connection_status")===jf.ENTERED&&"online"===e.get("show")&&this.updateNotifications(e.get("nick"),Ah.MUC_TRAFFIC_STATES.ENTERED)},onOccupantRemoved(e){bl.isInfoVisible(Ah.MUC_TRAFFIC_STATES.EXITED)&&this.isEntered()&&"online"===e.get("show")&&this.updateNotifications(e.get("nick"),Ah.MUC_TRAFFIC_STATES.EXITED)},onOccupantShowChanged(e){e.get("states").includes("303")||("offline"===e.get("show")&&bl.isInfoVisible(Ah.MUC_TRAFFIC_STATES.EXITED)?this.updateNotifications(e.get("nick"),Ah.MUC_TRAFFIC_STATES.EXITED):"online"===e.get("show")&&bl.isInfoVisible(Ah.MUC_TRAFFIC_STATES.ENTERED)&&this.updateNotifications(e.get("nick"),Ah.MUC_TRAFFIC_STATES.ENTERED))},async onRoomEntered(){await this.occupants.fetchMembers(),Vl.settings.get("clear_messages_on_reconnection")?await this.clearMessages():await this.fetchMessages(),Vl.trigger("enteredNewRoom",this),Vl.settings.get("auto_register_muc_nickname")&&await Vl.disco.supports(so.NS.MUC_REGISTER,this.get("jid"))&&this.registerNickname()},async onConnectionStatusChanged(){if(this.isEntered())if(this.isRAICandidate()){try{await this.leave()}catch(e){Yc.error(e)}this.enableRAI()}else await this.onRoomEntered()},async onReconnection(){await this.rejoin(),this.announceReconnection()},getMessagesCollection:()=>new bl.ChatRoomMessages,restoreSession(){const e=`muc.session-${bl.bare_jid}-${this.get("jid")}`;return this.session=new Xf({id:e}),vc(this.session,e,"session"),new Promise((e=>this.session.fetch({success:e,error:e})))},initDiscoModels(){let e=`converse.muc-features-${bl.bare_jid}-${this.get("jid")}`;this.features=new dr(Object.assign({id:e},Ah.ROOM_FEATURES.reduce(((e,t)=>(e[t]=!1,e)),{}))),this.features.browserStorage=bl.createStore(e,"session"),this.features.listenTo(bl,"beforeLogout",(()=>this.features.browserStorage.flush())),e=`converse.muc-config-${bl.bare_jid}-${this.get("jid")}`,this.config=new dr({id:e}),this.config.browserStorage=bl.createStore(e,"session"),this.config.listenTo(bl,"beforeLogout",(()=>this.config.browserStorage.flush()))},initOccupants(){this.occupants=new bl.ChatRoomOccupants;const e=`converse.occupants-${bl.bare_jid}${this.get("jid")}`;this.occupants.browserStorage=bl.createStore(e,"session"),this.occupants.chatroom=this,this.occupants.listenTo(bl,"beforeLogout",(()=>this.occupants.browserStorage.flush()))},fetchOccupants(){return this.occupants.fetched=new Promise((e=>{this.occupants.fetch({add:!0,silent:!0,success:e,error:e})})),this.occupants.fetched},handleAffiliationChangedMessage(e){const t=Eo()(`x[xmlns="${so.NS.MUC_USER}"] item`,e).pop();if(t){const n=e.getAttribute("from"),s=e.getAttribute("type"),i=t.getAttribute("affiliation"),r=t.getAttribute("jid"),o={from:n,type:s,affiliation:i,states:[],show:"unavailable"==s?"offline":"online",role:t.getAttribute("role"),jid:so.getBareJidFromJid(r),resource:so.getResourceFromJid(r)},a=this.occupants.findOccupant({jid:o.jid});a?a.save(o):this.occupants.create(o)}},async handleErrorMessageStanza(e){const{__:t}=bl,n=await zf(e,this);if(!await this.shouldShowErrorMessage(n))return;const s=this.getMessageReferencedByError(n);if(s){const e={error:n.error,error_condition:n.error_condition,error_text:n.error_text,error_type:n.error_type,editable:!1};n.msgid===s.get("retraction_id")?(e.retracted=void 0,e.retraction_id=void 0,e.retracted_id=void 0,n.error||("forbidden"===n.error_condition?e.error=t("You're not allowed to retract your message."):"not-acceptable"===n.error_condition?e.error=t("Your retraction was not delivered because you're not present in the groupchat."):e.error=t("Sorry, an error occurred while trying to retract your message."))):n.error||("forbidden"===n.error_condition?e.error=t("Your message was not delivered because you weren't allowed to send it."):"not-acceptable"===n.error_condition?e.error=t("Your message was not delivered because you're not present in the groupchat."):e.error=t("Sorry, an error occurred while trying to send your message.")),s.save(e)}else this.createMessage(n)},handleMessageFromMUCHost(e){if(this.isEntered())return;const t=Eo()(`rai[xmlns="${so.NS.RAI}"]`,e).pop(),n=Array.from(t?.querySelectorAll("activity")||[]).map((e=>e.textContent));n.includes(this.get("jid"))&&this.save({has_activity:!0,num_unread_general:0})},handleForwardedMentions(e){if(this.isEntered())return;const t=Eo()(`mentions[xmlns="${so.NS.MENTIONS}"] forwarded[xmlns="${so.NS.FORWARD}"] message[type="groupchat"]`,e),n=this.get("jid"),s=t.filter((e=>so.getBareJidFromJid(e.getAttribute("from"))===n));s.length&&(this.save({has_activity:!0,num_unread:this.get("num_unread")+s.length}),s.forEach((async e=>{const t={stanza:e,attrs:await zf(e,this),chatbox:this};Vl.trigger("message",t)})))},async handleMessageStanza(e){const t=(e=e.tree?.()??e).getAttribute("type");if("error"===t)return this.handleErrorMessageStanza(e);if("groupchat"===t){if(gm(e))return Yc.warn('Received a MAM message with type "groupchat"');this.createInfoMessages(e),this.fetchFeaturesIfConfigurationChanged(e)}else if(!t)return this.handleForwardedMentions(e);let n;try{n=await zf(e,this)}catch(e){return Yc.error(e)}const s={stanza:e,attrs:n,chatbox:this};return Vl.trigger("message",s),n&&this.queueMessage(n)},registerHandlers(){const e=this.get("jid"),t=so.getDomainFromJid(e);this.removeHandlers(),this.presence_handler=bl.connection.addHandler((e=>this.onPresence(e)||!0),null,"presence",null,null,e,{ignoreNamespaceFragment:!0,matchBareFromJid:!0}),this.domain_presence_handler=bl.connection.addHandler((e=>this.onPresenceFromMUCHost(e)||!0),null,"presence",null,null,t),this.message_handler=bl.connection.addHandler((e=>!!this.handleMessageStanza(e)||!0),null,"message",null,null,e,{matchBareFromJid:!0}),this.domain_message_handler=bl.connection.addHandler((e=>this.handleMessageFromMUCHost(e)||!0),null,"message",null,null,t),this.affiliation_message_handler=bl.connection.addHandler((e=>this.handleAffiliationChangedMessage(e)||!0),so.NS.MUC_USER,"message",null,null,e)},removeHandlers(){return this.message_handler&&(bl.connection&&bl.connection.deleteHandler(this.message_handler),delete this.message_handler),this.domain_message_handler&&(bl.connection&&bl.connection.deleteHandler(this.domain_message_handler),delete this.domain_message_handler),this.presence_handler&&(bl.connection&&bl.connection.deleteHandler(this.presence_handler),delete this.presence_handler),this.domain_presence_handler&&(bl.connection&&bl.connection.deleteHandler(this.domain_presence_handler),delete this.domain_presence_handler),this.affiliation_message_handler&&(bl.connection&&bl.connection.deleteHandler(this.affiliation_message_handler),delete this.affiliation_message_handler),this},invitesAllowed(){return Vl.settings.get("allow_muc_invitations")&&(this.features.get("open")||"owner"===this.getOwnAffiliation())},getDisplayName(){const e=this.get("name");return e||("hidden"===Vl.settings.get("locked_muc_domain")?so.getNodeFromJid(this.get("jid")):this.get("jid"))},sendTimedMessage(e){"function"==typeof e.tree&&(e=e.tree());let t=e.getAttribute("id");t||(t=this.getUniqueId("sendIQ"),e.setAttribute("id",t));const n=Ao(),s=Vl.settings.get("stanza_timeout"),i=bl.connection.addTimedHandler(s,(()=>{bl.connection.deleteHandler(r);const e=new Cl("Timeout Error: No response from server");return n.resolve(e),!1})),r=bl.connection.addHandler((e=>{i&&bl.connection.deleteTimedHandler(i),n.resolve(e)}),null,"message",["error","groupchat"],t);return Vl.send(e),n},async retractOwnMessage(e){const t=bl.__,n=e.get("origin_id");if(!n)throw new Error("Can't retract message without a XEP-0359 Origin ID");const s=e.get("editable"),i=Jr({id:Bc(),to:this.get("jid"),type:"groupchat"}).c("store",{xmlns:so.NS.HINTS}).up().c("apply-to",{id:n,xmlns:so.NS.FASTEN}).c("retract",{xmlns:so.NS.RETRACT});e.set({retracted:(new Date).toISOString(),retracted_id:n,retraction_id:i.tree().getAttribute("id"),editable:!1});const r=await this.sendTimedMessage(i);Wf.isErrorStanza(r)?Yc.error(r):r instanceof Cl&&(Yc.error(r),e.save({editable:s,error_type:"timeout",error:t("A timeout happened while while trying to retract your message."),retracted:void 0,retracted_id:void 0,retraction_id:void 0}))},async retractOtherMessage(e,t){const n=e.get("editable");e.save({moderated:"retracted",moderated_by:bl.bare_jid,moderated_id:e.get("msgid"),moderation_reason:t,editable:!1});const s=await this.sendRetractionIQ(e,t);return(null===s||Wf.isErrorStanza(s))&&e.save({editable:n,moderated:void 0,moderated_by:void 0,moderated_id:void 0,moderation_reason:void 0}),s},sendRetractionIQ(e,t){const n=Zr({to:this.get("jid"),type:"set"}).c("apply-to",{id:e.get(`stanza_id ${this.get("jid")}`),xmlns:so.NS.FASTEN}).c("moderate",{xmlns:so.NS.MODERATE}).c("retract",{xmlns:so.NS.RETRACT}).up().c("reason").t(t||"");return Vl.sendIQ(n,null,!1)},sendDestroyIQ(e,t){const n=Vr("destroy");t&&n.attrs({jid:t});const s=Zr({to:this.get("jid"),type:"set"}).c("query",{xmlns:so.NS.MUC_OWNER}).cnode(n.node);return e&&e.length>0&&s.c("reason",e),Vl.sendIQ(s)},async leave(e){Vl.connection.connected()&&Vl.user.presence.send("unavailable",this.getRoomJIDAndNick(),e),this.features&&await new Promise((e=>this.features.destroy({success:e,error:(t,n)=>{Yc.error(n),e()}})));const t=bl.disco_entities?.get(this.get("jid"));t&&await new Promise((e=>t.destroy({success:e,error:(t,n)=>{Yc.error(n),e()}}))),Fc(this.session,{connection_status:jf.DISCONNECTED})},async close(e){const{ENTERED:t,CLOSING:n}=jf,s=this.session.get("connection_status")===t;return Fc(this.session,{connection_status:n}),s&&this.sendMarkerForLastMessage("received",!0),await this.unregisterNickname(),await this.leave(),this.occupants.clearStore(),"closeAllChatBoxes"!==e?.name&&Vl.settings.get("muc_clear_messages_on_leave")&&this.clearMessages(),await new Promise((e=>this.session.destroy({success:e,error:(t,n)=>{Yc.error(n),e()}}))),bl.ChatBox.prototype.close.call(this)},canModerateMessages(){const e=this.getOwnOccupant();return e&&e.isModerator()&&Vl.disco.supports(so.NS.MODERATE,this.get("jid"))},getAllKnownNicknames(){return[...new Set([...this.occupants.map((e=>e.get("nick"))),...this.messages.map((e=>e.get("nick")))])].filter((e=>e))},getAllKnownNicknamesRegex(){const e=this.getAllKnownNicknames().map((e=>yf.escapeRegexString(e))).join("|");return RegExp(`(?:\\p{P}|\\p{Z}|^)@(${e})(?![\\w@-])`,"uig")},getOccupantByJID(e){return this.occupants.findOccupant({jid:e})},getOccupantByNickname(e){return this.occupants.findOccupant({nick:e})},getReferenceURIFromNickname(e){const t=this.get("jid"),n=this.getOccupant(e),s=this.features.get("nonanonymous")&&n?.get("jid")||`${t}/${e}`;return encodeURI(`xmpp:${s}`)},parseTextForReferences(e){if(!e||!/(\p{P}|\p{Z}|^)([@][\w_-]+(?:\.\w+)*)/giu.test(e))return[e,[]];const t=yf.findFirstMatchInArray(this.getAllKnownNicknames()),n=this.getAllKnownNicknamesRegex(),s=[...e.matchAll(n)].filter((e=>!e[0].startsWith("/"))),i=s.map((e=>{let n=e[0].indexOf("@");"@"===e[0][n+1]&&(n+=1);const s=e.index+n,i=s+e[0].length-n,r=t(e[1]);return{begin:s,end:i,value:r,type:"mention",uri:this.getReferenceURIFromNickname(r)}})),[r,o]=yf.reduceTextFromReferences(e,i);return[r,o]},async getOutgoingMessageAttributes(e){await Vl.emojis.initialize();const t=this.get("composing_spoiler");let n,s="";e?.body&&([s,n]=this.parseTextForReferences(e.body));const i=Bc(),r=s?Wf.shortnamesToUnicode(s):void 0;return e=Object.assign({},e,{body:r,is_spoiler:t,origin_id:i,references:n,id:i,msgid:i,from:`${this.get("jid")}/${this.get("nick")}`,fullname:this.get("nick"),is_only_emojis:!!s&&Wf.isOnlyEmojis(s),message:r,nick:this.get("nick"),sender:"me",type:"groupchat"},nm(s)),e=await Vl.hook("getOutgoingMessageAttributes",this,e)},getRoomJIDAndNick(){const e=this.get("nick");return so.getBareJidFromJid(this.get("jid"))+(null!==e?`/${e}`:"")},sendChatState(){if(!Vl.settings.get("send_chat_state_notifications")||!this.get("chat_state")||!this.isEntered()||this.features.get("moderated")&&"visitor"===this.getOwnRole())return;const e=Vl.settings.get("send_chat_state_notifications");if(Array.isArray(e)&&!e.includes(this.get("chat_state")))return;const t=this.get("chat_state");t!==bl.GONE&&Vl.send(Jr({to:this.get("jid"),type:"groupchat"}).c(t,{xmlns:so.NS.CHATSTATES}).up().c("no-store",{xmlns:so.NS.HINTS}).up().c("no-permanent-store",{xmlns:so.NS.HINTS}))},directInvite(e,t){this.features.get("membersonly")&&this.updateMemberLists([{jid:e,affiliation:"member",reason:t}]);const n={xmlns:"jabber:x:conference",jid:this.get("jid")};null!==t&&(n.reason=t),this.get("password")&&(n.password=this.get("password"));const s=Jr({from:bl.connection.jid,to:e,id:Bc()}).c("x",n);Vl.send(s),Vl.trigger("roomInviteSent",{room:this,recipient:e,reason:t})},refreshDiscoInfo(){return Vl.disco.refresh(this.get("jid")).then((()=>this.getDiscoInfo())).catch((e=>Yc.error(e)))},getDiscoInfo(){return Vl.disco.getIdentity("conference","text",this.get("jid")).then((e=>this.save({name:e?.get("name")}))).then((()=>this.getDiscoInfoFields())).then((()=>this.getDiscoInfoFeatures())).catch((e=>Yc.error(e)))},async getDiscoInfoFields(){const e=(await Vl.disco.getFields(this.get("jid"))).reduce(((e,t)=>{const n=t.get("var");return n?.startsWith("muc#roominfo_")&&(e[n.replace("muc#roominfo_","")]=t.get("value")),e}),{});this.config.save(e)},async getDiscoInfoFeatures(){const e=await Vl.disco.getFeatures(this.get("jid")),t=Ah.ROOM_FEATURES.reduce(((e,t)=>(e[t]=!1,e)),{fetched:(new Date).toISOString()});e.each((e=>{const n=e.get("var");n.startsWith("muc_")?t[n.replace("muc_","")]=!0:n===so.NS.MAM?t.mam_enabled=!0:t[n]=!0})),this.features.save(t)},addFieldValue(e){const t=e.getAttribute("type");if("fixed"===t)return e;const n=e.getAttribute("var").replace("muc#roomconfig_",""),s=this.get("roomconfig");if(n in s){let i;switch(t){case"boolean":i=[s[n]?1:0];break;case"list-multi":i=s[n];break;default:i=[s[n]]}e.innerHTML=i.map((e=>Vr("value").t(e))).join("")}return e},async autoConfigureChatRoom(){const e=await this.fetchRoomConfiguration(),t=Eo()("field",e).map((e=>this.addFieldValue(e)));if(t.length)return this.sendConfiguration(t)},fetchRoomConfiguration(){return Vl.sendIQ(Zr({to:this.get("jid"),type:"get"}).c("query",{xmlns:so.NS.MUC_OWNER}))},sendConfiguration(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const t=Zr({to:this.get("jid"),type:"set"}).c("query",{xmlns:so.NS.MUC_OWNER}).c("x",{xmlns:so.NS.XFORM,type:"submit"});return e.forEach((e=>t.cnode(e).up())),Vl.sendIQ(t)},onCommandError(e){const{__:t}=bl;Yc.fatal(e);const n=t("Sorry, an error happened while running the command.")+" "+t("Check your browser's developer console for details.");this.createMessage({message:n,type:"error"})},getNickOrJIDFromCommandArgs(e){const{__:t}=bl;if(Wf.isValidJID(e.trim()))return e.trim();e.startsWith("@")||(e="@"+e);const[n,s]=this.parseTextForReferences(e);if(!s.length){const e=t("Error: couldn't find a groupchat participant based on your arguments");return void this.createMessage({message:e,type:"error"})}if(s.length>1){const e=t("Error: found multiple groupchat participant based on your arguments");return void this.createMessage({message:e,type:"error"})}const i=s.pop().value,r=e.split(i,2)[1];if(!r||r.startsWith(" "))return i;{const e=t("Error: couldn't find a groupchat participant based on your arguments");this.createMessage({message:e,type:"error"})}},validateRoleOrAffiliationChangeArgs(e,t){const{__:n}=bl;if(!t){const t=n('Error: the "%1$s" command takes two arguments, the user\'s nickname and optionally a reason.',e);return this.createMessage({message:t,type:"error"}),!1}return!0},getAllowedCommands(){let e=["clear","help","me","nick","register"];(this.config.get("changesubject")||["owner","admin"].includes(this.getOwnAffiliation()))&&(e=[...e,"subject","topic"]);const t=this.occupants.findWhere({jid:bl.bare_jid});return this.verifyAffiliations(["owner"],t,!1)?e=e.concat(Vf).concat(Jf):this.verifyAffiliations(["admin"],t,!1)&&(e=e.concat(Jf)),this.verifyRoles(["moderator"],t,!1)?e=e.concat(Zf).concat(Qf):this.verifyRoles(["visitor","participant","moderator"],t,!1)||(e=e.concat(Qf)),e.sort(),Array.isArray(Vl.settings.get("muc_disable_slash_commands"))?e.filter((e=>!Vl.settings.get("muc_disable_slash_commands").includes(e))):e},verifyAffiliations(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const{__:s}=bl;if(!Array.isArray(e))throw new TypeError("affiliations must be an Array");if(!e.length)return!0;if(t=t||this.occupants.findWhere({jid:bl.bare_jid})){const n=t.get("affiliation");if(e.includes(n))return!0}if(n){const e=s("Forbidden: you do not have the necessary affiliation in order to do that.");this.createMessage({message:e,type:"error"})}return!1},verifyRoles(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const{__:s}=bl;if(!Array.isArray(e))throw new TypeError("roles must be an Array");if(!e.length)return!0;if(t=t||this.occupants.findWhere({jid:bl.bare_jid})){const n=t.get("role");if(e.includes(n))return!0}if(n){const e=s("Forbidden: you do not have the necessary role in order to do that.");this.createMessage({message:e,type:"error",is_ephemeral:2e4})}return!1},getOwnRole(){return this.getOwnOccupant()?.attributes?.role},getOwnAffiliation(){return this.getOwnOccupant()?.attributes?.affiliation||"none"},getOwnOccupant(){return this.occupants.getOwnOccupant()},async setNickname(e){if(Vl.settings.get("auto_register_muc_nickname")&&await Vl.disco.supports(so.NS.MUC_REGISTER,this.get("jid"))){const t=this.get("nick");this.set({nick:e});try{await this.registerNickname()}catch(e){const{__:n}=bl;Yc.error(e);const s=n("Error: couldn't register new nickname in members only room");return this.createMessage({message:s,type:"error",is_ephemeral:!0}),void this.set({nick:t})}}const t=so.getBareJidFromJid(this.get("jid"));Vl.send(Qr({from:bl.connection.jid,to:`${t}/${e}`,id:Bc()}).tree())},setRole(e,t,n,s,i){const r=Vr("item",{nick:e.get("nick"),role:t}),o=Zr({to:this.get("jid"),type:"set"}).c("query",{xmlns:so.NS.MUC_ADMIN}).cnode(r.node);return null!==n&&o.c("reason",n),Vl.sendIQ(o).then(s).catch(i)},getOccupant(e){return Wf.isValidJID(e)?this.getOccupantByJID(e):this.getOccupantByNickname(e)},getOccupantsWithRole(e){return this.getOccupantsSortedBy("nick").filter((t=>t.get("role")===e)).map((e=>({jid:e.get("jid"),nick:e.get("nick"),role:e.get("role")})))},getOccupantsWithAffiliation(e){return this.getOccupantsSortedBy("nick").filter((t=>t.get("affiliation")===e)).map((e=>({jid:e.get("jid"),nick:e.get("nick"),affiliation:e.get("affiliation")})))},getOccupantsSortedBy(e){return Array.from(this.occupants.models).sort(((t,n)=>t.get(e)<n.get(e)?-1:t.get(e)>n.get(e)?1:0))},async updateMemberLists(e){const t=this.get("jid"),n=await Promise.all(["member","admin","owner"].map((e=>Uf(e,t)))),s=n.reduce(((e,t)=>Wf.isErrorObject(t)?e:[...t,...e]),[]);await qf(t,Gf(!0,!1,e,s)),await this.occupants.fetchMembers()},async getAndPersistNickname(e){return(e=e||this.get("nick")||await this.getReservedNick()||bl.getDefaultMUCNickname())&&Fc(this,{nick:e},{silent:!0}),e},async getReservedNick(){const e=Zr({to:this.get("jid"),from:bl.connection.jid,type:"get"}).c("query",{xmlns:so.NS.DISCO_INFO,node:"x-roomuser-item"}),t=await Vl.sendIQ(e,null,!1);if(Wf.isErrorObject(t))throw t;const n=t?.querySelector('query[node="x-roomuser-item"] identity');return n?n.getAttribute("name"):null},async registerNickname(){const{__:e}=bl,t=this.get("nick"),n=this.get("jid");let s,i;try{s=await Vl.sendIQ(Zr({to:n,type:"get"}).c("query",{xmlns:so.NS.MUC_REGISTER}))}catch(t){return Eo()(`not-allowed[xmlns="${so.NS.STANZAS}"]`,t).length?i=e("You're not allowed to register yourself in this groupchat."):Eo()(`registration-required[xmlns="${so.NS.STANZAS}"]`,t).length&&(i=e("You're not allowed to register in this groupchat because it's members-only.")),Yc.error(t),i}const r=Eo()("field required",s).map((e=>e.parentElement));if(r.length>1&&"muc#register_roomnick"!==r[0].getAttribute("var"))return Yc.error(`Can't register the user register in the groupchat ${n} due to the required fields`);try{await Vl.sendIQ(Zr({to:n,type:"set"}).c("query",{xmlns:so.NS.MUC_REGISTER}).c("x",{xmlns:so.NS.XFORM,type:"submit"}).c("field",{var:"FORM_TYPE"}).c("value").t("http://jabber.org/protocol/muc#register").up().up().c("field",{var:"muc#register_roomnick"}).c("value").t(t))}catch(t){return Eo()(`service-unavailable[xmlns="${so.NS.STANZAS}"]`,t).length?i=e("Can't register your nickname in this groupchat, it doesn't support registration."):Eo()(`bad-request[xmlns="${so.NS.STANZAS}"]`,t).length&&(i=e("Can't register your nickname in this groupchat, invalid data form supplied.")),Yc.error(i),Yc.error(t),i}},async unregisterNickname(){if("unregister"===Vl.settings.get("auto_register_muc_nickname"))try{await Vl.disco.supports(so.NS.MUC_REGISTER,this.get("jid"))&&await this.sendUnregistrationIQ()}catch(e){Yc.error(e)}},sendUnregistrationIQ(){const e=Zr({to:this.get("jid"),type:"set"}).c("query",{xmlns:so.NS.MUC_REGISTER}).c("remove");return Vl.sendIQ(e).catch((e=>Yc.error(e)))},updateOccupantsOnPresence(e){const t=function(e,t){const n=e.getAttribute("from"),s=e.getAttribute("type"),i={is_me:!!e.querySelector("status[code='110']"),from:n,occupant_id:Rf(e,t),nick:Tf.getResourceFromJid(n),type:s,states:[],hats:[],show:"unavailable"!==s?"online":"offline"};return Array.from(e.children).forEach((e=>{e.matches("status")?i.status=e.textContent||null:e.matches("show")?i.show=e.textContent||"online":e.matches("x")&&e.getAttribute("xmlns")===Tf.NS.MUC_USER?Array.from(e.children).forEach((e=>{"item"===e.nodeName?(i.affiliation=e.getAttribute("affiliation"),i.role=e.getAttribute("role"),i.jid=e.getAttribute("jid"),i.nick=e.getAttribute("nick")||i.nick):"status"==e.nodeName&&e.getAttribute("code")&&i.states.push(e.getAttribute("code"))})):e.matches("x")&&e.getAttribute("xmlns")===Tf.NS.VCARDUPDATE?i.image_hash=e.querySelector("photo")?.textContent:e.matches("hats")&&e.getAttribute("xmlns")===Tf.NS.MUC_HATS&&(i.hats=Array.from(e.children).map((e=>e.matches("hat")&&{title:e.getAttribute("title"),uri:e.getAttribute("uri")})))})),i}(e,this);if("error"===t.type||!t.jid&&!t.nick&&!t.occupant_id)return!0;const n=this.occupants.findOccupant(t);if("unavailable"===t.type&&n&&!t.states.includes(Ah.MUC_NICK_CHANGED_CODE)&&!["admin","owner","member"].includes(t.affiliation))return n.set(t),void n.destroy();const s=t.jid||"",i={...t,jid:so.getBareJidFromJid(s)||n?.attributes?.jid,resource:so.getResourceFromJid(s)||n?.attributes?.resource};if(t.is_me){let e=!1;t.states.includes(Ah.MUC_NICK_CHANGED_CODE)&&(e=!0,this.set("nick",t.nick)),this.features.get(so.NS.OCCUPANTID)&&this.get("occupant-id")!==t.occupant_id&&(e=!0,this.set("occupant_id",t.occupant_id)),e&&this.save()}n?n.save(i):this.occupants.create(i)},fetchFeaturesIfConfigurationChanged(e){const t=["104","170","171","172","173","174"];Eo()("status",e).filter((e=>t.includes(e.getAttribute("status")))).length&&this.refreshDiscoInfo()},isSameUser(e,t){const n=so.getBareJidFromJid(e),s=so.getBareJidFromJid(t),i=so.getResourceFromJid(e),r=so.getResourceFromJid(t);if(Wf.isSameBareJID(e,t))return n!==this.get("jid")||i===r;return(n===this.get("jid")?this.occupants.findOccupant({nick:i}):this.occupants.findOccupant({jid:n}))===(s===this.get("jid")?this.occupants.findOccupant({nick:r}):this.occupants.findOccupant({jid:s}))},async isSubjectHidden(){return(await Vl.user.settings.get("mucs_with_hidden_subject",[])).includes(this.get("jid"))},async toggleSubjectHiddenState(){const e=this.get("jid"),t=await Vl.user.settings.get("mucs_with_hidden_subject",[]);t.includes(this.get("jid"))?Vl.user.settings.set("mucs_with_hidden_subject",t.filter((t=>t!==e))):Vl.user.settings.set("mucs_with_hidden_subject",[...t,e])},async handleSubjectChange(e){const t=bl.__;if("string"==typeof e.subject&&!e.thread&&!e.message){const n=e.subject,s=e.nick;if(Fc(this,{subject:{author:s,text:e.subject||""}}),!e.is_delayed&&s){const i=t(n?"Topic set by %1$s":"Topic cleared by %1$s",s),r=this.messages.last();r?.get("nick")===e.nick&&"info"===r?.get("type")&&r?.get("message")===i||this.createMessage({message:i,nick:e.nick,type:"info",is_ephemeral:!0}),await this.isSubjectHidden()&&this.toggleSubjectHiddenState()}return!0}return!1},setSubject(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";Vl.send(Jr({to:this.get("jid"),from:bl.connection.jid,type:"groupchat"}).c("subject",{xmlns:"jabber:client"}).t(e).tree())},ignorableCSN(e){return e.chat_state&&!e.body&&(e.is_delayed||this.isOwnMessage(e))},isOwnMessage(e){let t;return t=ff(e)?e.getAttribute("from"):e instanceof bl.Message?e.get("from"):e.from,so.getResourceFromJid(t)==this.get("nick")},getUpdatedMessageAttributes(e,t){const n={...bl.ChatBox.prototype.getUpdatedMessageAttributes.call(this,e,t),...lr(t,["from_muc","occupant_id"])};if(this.isOwnMessage(t)){const s=Object.keys(t).filter((e=>e.startsWith("stanza_id")));Object.assign(n,lr(t,s)),e.get("received")||(n.received=(new Date).toISOString())}return n},async isJoined(){return this.isEntered()?(Vl.connection.connected()||await new Promise((e=>Vl.listen.once("reconnected",e))),Vl.ping(`${this.get("jid")}/${this.get("nick")}`)):(Yc.info(`isJoined: not pinging MUC ${this.get("jid")} since we're not entered`),!1)},async sendStatusPresence(e,t,n){if(this.session.get("connection_status")===jf.ENTERED){const s=await bl.xmppstatus.constructPresence(e,this.getRoomJIDAndNick(),t);n?.map((e=>e?.tree()??e)).forEach((e=>s.cnode(e).up())),Vl.send(s)}},async rejoinIfNecessary(){return this.isRAICandidate()?(Yc.debug(`rejoinIfNecessary: not rejoining hidden MUC "${this.get("jid")}" since we're using RAI`),!0):await this.isJoined()?void 0:(this.rejoin(),!0)},async shouldShowErrorMessage(e){if("Decryption"===e.error_type){if("Message key not found. The counter was repeated or the key was not filled."===e.error_message)return!1;if("not-encrypted-for-this-device"===e.error_condition)return!1}else if("not-acceptable"===e.error_condition&&await this.rejoinIfNecessary())return!1;return bl.ChatBox.prototype.shouldShowErrorMessage.call(this,e)},findDanglingModeration(e){if(!this.messages.length)return null;if(this.messages.last().get("time")>e.time){const t=Array.from(this.messages.models),n=e[`stanza_id ${this.get("jid")}`];return n?(t.reverse(),t.find((e=>{let{attributes:t}=e;return"retracted"===t.moderated&&t.moderated_id===n&&t.moderated_by}))):null}},async handleModeration(e){const t=["editable","moderated","moderated_by","moderated_id","moderation_reason"];if("retracted"===e.moderated){const n={};n[`stanza_id ${this.get("jid")}`]=e.moderated_id;const s=this.messages.findWhere(n);return s?(s.save(lr(e,t)),!0):(e.dangling_moderation=!0,await this.createMessage(e),!0)}{const n=this.findDanglingModeration(e);if(n){const s=lr(n.attributes,t),i=Object.assign({dangling_moderation:!1},e,s);return delete i.id,n.save(i),!0}}return!1},getNotificationsText(){const{__:e}=bl,t=this.notifications.toJSON(),n=Vl.settings.get("muc_show_info_messages").filter((e=>Ah.MUC_ROLE_CHANGES_LIST.includes(e))),s=Vl.settings.get("muc_show_info_messages").filter((e=>Ah.MUC_TRAFFIC_STATES_LIST.includes(e)));return[...Ah.CHAT_STATES,...s,...n].reduce(((n,s)=>{const i=t[s];if(!i?.length)return n;const r=i.map((e=>this.getOccupant(e)?.getDisplayName()||e));if(1===r.length){if("composing"===s)return`${n}${e("%1$s is typing",r[0])}\n`;if("paused"===s)return`${n}${e("%1$s has stopped typing",r[0])}\n`;if(s===bl.GONE)return`${n}${e("%1$s has gone away",r[0])}\n`;if("entered"===s)return`${n}${e("%1$s has entered the groupchat",r[0])}\n`;if("exited"===s)return`${n}${e("%1$s has left the groupchat",r[0])}\n`;if("op"===s)return`${n}${e("%1$s is now a moderator",r[0])}\n`;if("deop"===s)return`${n}${e("%1$s is no longer a moderator",r[0])}\n`;if("voice"===s)return`${n}${e("%1$s has been given a voice",r[0])}\n`;if("mute"===s)return`${n}${e("%1$s has been muted",r[0])}\n`}else if(r.length>1){let t;if(r.length>3)t=`${Array.from(r).slice(0,2).join(", ")} and others`;else{const n=r.pop();t=e("%1$s and %2$s",r.join(", "),n)}if("composing"===s)return`${n}${e("%1$s are typing",t)}\n`;if("paused"===s)return`${n}${e("%1$s have stopped typing",t)}\n`;if(s===bl.GONE)return`${n}${e("%1$s have gone away",t)}\n`;if("entered"===s)return`${n}${e("%1$s have entered the groupchat",t)}\n`;if("exited"===s)return`${n}${e("%1$s have left the groupchat",t)}\n`;if("op"===s)return`${n}${e("%1$s are now moderators",r[0])}\n`;if("deop"===s)return`${n}${e("%1$s are no longer moderators",r[0])}\n`;if("voice"===s)return`${n}${e("%1$s have been given voices",r[0])}\n`;if("mute"===s)return`${n}${e("%1$s have been muted",r[0])}\n`}return n}),"")},removeNotification(e,t){const n=this.notifications.toJSON();(t=Array.isArray(t)?t:[t]).forEach((t=>{const s=Array.from(n[t]||[]);if(s.includes(e)){const n=s.indexOf(e);s.splice(n,1),this.notifications.set(t,Array.from(s))}}))},updateNotifications(e,t){const n=this.notifications.toJSON(),s=n[t]||[];if(s.includes(e))return;const i=(i,r)=>(i[r]=r===t?[...s,e]:(n[r]||[]).filter((t=>t!==e)),i),r=Ah.CHAT_STATES.reduce(i,{}),o=Ah.MUC_TRAFFIC_STATES_LIST.reduce(i,{}),a=Ah.MUC_ROLE_CHANGES_LIST.reduce(i,{});this.notifications.set(Object.assign(r,o,a)),window.setTimeout((()=>this.removeNotification(e,t)),1e4)},handleMetadataFastening(e){if(e.ogp_for_id){if(e.from!==this.get("jid"))return!1;const t=this.messages.findWhere({origin_id:e.ogp_for_id});if(t){const n=t.get("ogp_metadata")||[];if(n.filter((t=>t["og:url"]===e["og:url"])).length)return!1;const s=[...n,lr(e,Kf)];return t.save("ogp_metadata",s),!0}}return!1},handleMEPNotification(e){return!(e.from!==this.get("jid")||!e.activities)&&(e.activities?.forEach((t=>{const n=Object.assign(e,t);this.createMessage(n),Vl.trigger("message",{attrs:n,chatbox:this})})),!!e.activities.length)},getDuplicateMessage(e){return e.activities?.length?this.messages.findWhere({type:"mep",msgid:e.msgid}):bl.ChatBox.prototype.getDuplicateMessage.call(this,e)},async onMessage(e){if(e=await e,Wf.isErrorObject(e))return e.stanza&&Yc.error(e.stanza),Yc.error(e.message);if("error"===e.type&&!await this.shouldShowErrorMessage(e))return;const t=this.getDuplicateMessage(e);if(t)"groupchat"===t.get("type")&&this.updateMessage(t,e);else if(!(e.receipt_id||e.is_marker||this.ignorableCSN(e)))if(this.handleMetadataFastening(e)||this.handleMEPNotification(e)||await this.handleRetraction(e)||await this.handleModeration(e)||await this.handleSubjectChange(e))e.nick&&this.removeNotification(e.nick,["composing","paused"]);else if(this.setEditable(e,e.time),e.chat_state&&this.updateNotifications(e.nick,e.chat_state),Wf.shouldCreateGroupchatMessage(e)){const t=await Ih(this,e)||await this.createMessage(e);this.removeNotification(e.nick,["composing","paused"]),this.handleUnreadMessage(t)}},handleModifyError(e){const t=e.querySelector("error text")?.textContent;if(t)if(this.session.get("connection_status")===jf.CONNECTING)this.setDisconnectionState(t);else{const e={type:"error",message:t,is_ephemeral:!0};this.createMessage(e)}},handleDisconnection(e){const t=null!==e.querySelector("status[code='110']"),n=Eo()(`x[xmlns="${so.NS.MUC_USER}"]`,e).pop();if(!n)return;const s=Object.keys(bl.muc.disconnect_messages),i=Eo()("status",n).map((e=>e.getAttribute("code"))).filter((e=>s.includes(e)));if(!(t&&i.length>0))return;const r=n.querySelector("item"),o=r?r.querySelector("reason")?.textContent:void 0,a=r?r.querySelector("actor")?.getAttribute("nick"):void 0,c=bl.muc.disconnect_messages[i[0]],l=i.includes("301")?jf.BANNED:jf.DISCONNECTED;this.setDisconnectionState(c,o,a,l)},getActionInfoMessage(e,t,n){const s=bl.__;return"301"===e?n?s("%1$s has been banned by %2$s",t,n):s("%1$s has been banned",t):"303"===e?s("%1$s's nickname has changed",t):"307"===e?n?s("%1$s has been kicked out by %2$s",t,n):s("%1$s has been kicked out",t):"321"===e?s("%1$s has been removed because of an affiliation change",t):"322"===e?s("%1$s has been removed for not being a member",t):void 0},createAffiliationChangeMessage(e){const t=bl.__,n=e._previousAttributes.affiliation;if(!n)return;const s=e.get("affiliation");"admin"===n&&bl.isInfoVisible(Ah.AFFILIATION_CHANGES.EXADMIN)?this.createMessage({type:"info",message:t("%1$s is no longer an admin of this groupchat",e.get("nick"))}):"owner"===n&&bl.isInfoVisible(Ah.AFFILIATION_CHANGES.EXOWNER)?this.createMessage({type:"info",message:t("%1$s is no longer an owner of this groupchat",e.get("nick"))}):"outcast"===n&&bl.isInfoVisible(Ah.AFFILIATION_CHANGES.EXOUTCAST)&&this.createMessage({type:"info",message:t("%1$s is no longer banned from this groupchat",e.get("nick"))}),"none"===s&&"member"===n&&bl.isInfoVisible(Ah.AFFILIATION_CHANGES.EXMEMBER)&&this.createMessage({type:"info",message:t("%1$s is no longer a member of this groupchat",e.get("nick"))}),"member"===s&&bl.isInfoVisible(Ah.AFFILIATION_CHANGES.MEMBER)?this.createMessage({type:"info",message:t("%1$s is now a member of this groupchat",e.get("nick"))}):("admin"===s&&bl.isInfoVisible(Ah.AFFILIATION_CHANGES.ADMIN)||"owner"==s&&bl.isInfoVisible(Ah.AFFILIATION_CHANGES.OWNER))&&this.createMessage({type:"info",message:t("%1$s is now an %2$s of this groupchat",e.get("nick"),s)})},createRoleChangeMessage(e,t){if("none"===t||e.changed.affiliation)return;const n=e._previousAttributes.role;"moderator"===n&&bl.isInfoVisible(Ah.MUC_ROLE_CHANGES.DEOP)?this.updateNotifications(e.get("nick"),Ah.MUC_ROLE_CHANGES.DEOP):"visitor"===n&&bl.isInfoVisible(Ah.MUC_ROLE_CHANGES.VOICE)&&this.updateNotifications(e.get("nick"),Ah.MUC_ROLE_CHANGES.VOICE),"visitor"===e.get("role")&&bl.isInfoVisible(Ah.MUC_ROLE_CHANGES.MUTE)?this.updateNotifications(e.get("nick"),Ah.MUC_ROLE_CHANGES.MUTE):"moderator"===e.get("role")&&!["owner","admin"].includes(e.get("affiliation"))&&bl.isInfoVisible(Ah.MUC_ROLE_CHANGES.OP)&&this.updateNotifications(e.get("nick"),Ah.MUC_ROLE_CHANGES.OP)},createInfoMessage(e,t,n){const s=bl.__,i={type:"info",is_ephemeral:!0};if(bl.isInfoVisible(e)&&"110"!==e&&("100"!==e||n)){if(e in bl.muc.info_messages)i.message=bl.muc.info_messages[e];else if(!n&&Yf.includes(e)){const n=so.getResourceFromJid(t.getAttribute("from")),s=Eo()(`x[xmlns="${so.NS.MUC_USER}"] item`,t).pop();i.actor=s?s.querySelector("actor")?.getAttribute("nick"):void 0,i.reason=s?s.querySelector("reason")?.textContent:void 0,i.message=this.getActionInfoMessage(e,n,i.actor)}else if(n&&e in bl.muc.new_nickname_messages){let n;"210"===e?n=so.getResourceFromJid(t.getAttribute("from")):"303"===e&&(n=Eo()(`x[xmlns="${so.NS.MUC_USER}"] item`,t).pop().getAttribute("nick")),this.save("nick",n),i.message=s(bl.muc.new_nickname_messages[e],n)}if(i.message){if("201"===e&&this.messages.findWhere(i))return;this.createMessage(i)}}},createInfoMessages(e){const t=Eo()(`x[xmlns="${so.NS.MUC_USER}"] status`,e).map((e=>e.getAttribute("code")));t.includes("333")&&t.includes("307")&&t.splice(t.indexOf("307"),1);const n=t.includes("110");t.forEach((t=>this.createInfoMessage(t,e,n)))},setDisconnectionState(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:jf.DISCONNECTED;this.session.save({connection_status:s,disconnection_actor:n,disconnection_message:e,disconnection_reason:t})},onNicknameClash(e){const t=bl.__;if(Vl.settings.get("muc_nickname_from_jid")){const t=e.getAttribute("from").split("/")[1];if(t===bl.getDefaultMUCNickname())this.join(t+"-2");else{const e=t.lastIndexOf("-"),n=t.substring(e+1,t.length);this.join(t.substring(0,e+1)+String(Number(n)+1))}}else this.save({nickname_validation_message:t("The nickname you chose is reserved or currently in use, please choose a different one.")}),this.session.save({connection_status:jf.NICKNAME_REQUIRED})},onErrorPresence(e){const t=bl.__,n=e.querySelector("error"),s=n.getAttribute("type"),i=Eo()(`text[xmlns="${so.NS.STANZAS}"]`,n).pop()?.textContent;if("modify"===s)this.handleModifyError(e);else if("auth"===s)if(Eo()(`not-authorized[xmlns="${so.NS.STANZAS}"]`,n).length&&(this.save({password_validation_message:i||t("Password incorrect")}),this.session.save({connection_status:jf.PASSWORD_REQUIRED})),n.querySelector("registration-required")){const e=t("You are not on the member list of this groupchat.");this.setDisconnectionState(e,i)}else n.querySelector("forbidden")&&this.setDisconnectionState(bl.muc.disconnect_messages[301],i,null,jf.BANNED);else if("cancel"===s)if(n.querySelector("not-allowed")){const e=t("You are not allowed to create new groupchats.");this.setDisconnectionState(e,i)}else if(n.querySelector("not-acceptable")){const e=t("Your nickname doesn't conform to this groupchat's policies.");this.setDisconnectionState(e,i)}else if(Eo()(`gone[xmlns="${so.NS.STANZAS}"]`,n).length){const e=Eo()(`gone[xmlns="${so.NS.STANZAS}"]`,n).pop()?.textContent.replace(/^xmpp:/,"").replace(/\?join$/,"");this.save({moved_jid:e,destroyed_reason:i}),this.session.save({connection_status:jf.DESTROYED})}else if(n.querySelector("conflict"))this.onNicknameClash(e);else if(n.querySelector("item-not-found")){const e=t("This groupchat does not (yet) exist.");this.setDisconnectionState(e,i)}else if(n.querySelector("service-unavailable")){const e=t("This groupchat has reached its maximum number of participants.");this.setDisconnectionState(e,i)}else if(n.querySelector("remote-server-not-found")){const e=t("Remote server not found");this.setDisconnectionState(e,i)}else if(n.querySelector("forbidden")){const e=t("You're not allowed to enter this groupchat");this.setDisconnectionState(e,i)}else{const e=t("An error happened while trying to enter this groupchat");this.setDisconnectionState(e,i)}},onPresenceFromMUCHost(e){if("error"===e.getAttribute("type")){const t=e.querySelector("error");"wait"===t?.getAttribute("type")&&t?.querySelector("resource-constraint")&&this.session.get("connection_status")===jf.DISCONNECTED&&this.rejoin()}},onPresence(e){if("error"===e.getAttribute("type"))return this.onErrorPresence(e);this.createInfoMessages(e),e.querySelector("status[code='110']")?(this.onOwnPresence(e),"none"!==this.getOwnRole()&&this.session.get("connection_status")===jf.CONNECTING&&this.session.save("connection_status",jf.CONNECTED)):this.updateOccupantsOnPresence(e)},async onOwnPresence(e){if(await this.occupants.fetched,"unavailable"===e.getAttribute("type"))return void this.handleDisconnection(e);const t=this.session.get("connection_status");t!==jf.ENTERED&&t!==jf.CLOSING?(this.session.save("connection_status",jf.ENTERED,{silent:!0}),this.updateOccupantsOnPresence(e),this.session.trigger("change:connection_status",this.session,t)):this.updateOccupantsOnPresence(e);e.querySelector("status[code='201']")&&(this.get("auto_configure")?await this.autoConfigureChatRoom().then((()=>this.refreshDiscoInfo())):Vl.settings.get("muc_instant_rooms")?await this.sendConfiguration().then((()=>this.refreshDiscoInfo())):this.session.save({view:Ah.MUC.VIEWS.CONFIG}))},isUserMentioned(e){const t=this.get("nick");if(e.get("references").length){return e.get("references").filter((e=>"mention"===e.type)).map((e=>e.value)).includes(t)}return new RegExp(`\\b${t}\\b`).test(e.get("body"))},incrementUnreadMsgsCounter(e){const t={num_unread_general:this.get("num_unread_general")+1};0===this.get("num_unread_general")&&(t.first_unread_id=e.get("id")),this.isUserMentioned(e)&&(t.num_unread=this.get("num_unread")+1),this.save(t)},clearUnreadMsgCounter(){(this.get("num_unread_general")>0||this.get("num_unread")>0||this.get("has_activity"))&&this.sendMarkerForMessage(this.messages.last()),Fc(this,{has_activity:!1,num_unread:0,num_unread_general:0})}},tg=eg;const ng=class extends dr{defaults(){return{hats:[],show:"offline",states:[]}}save(e,t,n){let s;return null==e?super.save(e,t,n):("object"==typeof e?(s=e,n=t):(s={})[e]=t,s.occupant_id&&(s.id=s.occupant_id),super.save(s,n))}getDisplayName(){return this.get("nick")||this.get("jid")}isMember(){return["admin","owner","member"].includes(this.get("affiliation"))}isModerator(){return["admin","owner"].includes(this.get("affiliation"))||"moderator"===this.get("role")}isSelf(){return this.get("states").includes("110")}},{Strophe:sg,sizzle:ig,u:rg}=Ah.env;function og(){const e=Vl.settings.get("muc_fetch_members");return Array.isArray(e)?e:e?["member","admin","owner"]:[]}function ag(e){let t=Vl.settings.get("modtools_disable_assign");return Array.isArray(t)||(t=t?_f:[]),"moderator"===e.get("role")?_f.filter((e=>!t.includes(e))):[]}function cg(){bl.connection.addHandler((e=>(bl.onDirectMUCInvitation(e),!0)),"jabber:x:conference","message")}function lg(){return bl.chatboxes.filter((e=>e.get("type")===bl.CHATROOMS_TYPE)).forEach((e=>e.session.save({connection_status:Ah.ROOMSTATUS.DISCONNECTED})))}async function dg(e){if("visible"===e.state&&Vl.connection.connected()){(await Vl.rooms.get()).forEach((e=>e.rejoinIfNecessary()))}}async function ug(e){if(!rg.isValidMUCJID(e))return Yc.warn(`invalid jid "${e}" provided in url fragment`);await Vl.waitUntil("roomsAutoJoined"),Vl.settings.get("allow_bookmarks")&&await Vl.waitUntil("bookmarksInitialized"),Vl.rooms.open(e)}async function hg(e){const t=ig('x[xmlns="jabber:x:conference"]',e).pop(),n=sg.getBareJidFromJid(e.getAttribute("from")),s=t.getAttribute("jid"),i=t.getAttribute("reason");let r;if(Vl.settings.get("auto_join_on_invite"))r=!0;else{const e=bl.roster.get(n)?.getDisplayName()??n;r=await Vl.hook("confirmDirectMUCInvitation",{contact:e,reason:i,jid:s},!1)}if(r){(await async function(e,t){t.type=bl.CHATROOMS_TYPE,t.id=e;const n=await Vl.rooms.get(e,t,!0);return n.maybeShow(!0),n}(s,{password:t.getAttribute("password")})).session.get("connection_status")===Ah.ROOMSTATUS.DISCONNECTED&&bl.chatboxes.get(s).rejoin()}}function mg(){if(!bl.xmppstatus)throw new Error("Can't call _converse.getDefaultMUCNickname before the statusInitialized has been fired.");const e=bl.xmppstatus.getNickname();return e||(Vl.settings.get("muc_nickname_from_jid")?sg.unescapeNode(sg.getNodeFromJid(bl.bare_jid)):void 0)}function fg(e){return!!Vl.settings.get("muc_show_info_messages").includes(e)}async function gg(){await Promise.all(Vl.settings.get("auto_join_rooms").map((e=>"string"==typeof e?bl.chatboxes.where({jid:e}).length?Promise.resolve():Vl.rooms.open(e):y(e)?Vl.rooms.open(e.jid,{...e}):(Yc.error('Invalid muc criteria specified for "auto_join_rooms"'),Promise.resolve())))),Vl.trigger("roomsAutoJoined")}function pg(){Vl.disco.own.features.add(sg.NS.MUC),Vl.settings.get("allow_muc_invitations")&&Vl.disco.own.features.add("jabber:x:conference")}function vg(){bl.chatboxes.where({type:bl.CHATROOMS_TYPE}).forEach((e=>Fc(e.session,{connection_status:Ah.ROOMSTATUS.DISCONNECTED})))}function yg(){window.addEventListener(bl.unloadevent,(()=>{!Vl.connection.isType("websocket")||Vl.settings.get("enable_smacks")&&bl.session.get("smacks_stream_id")||lg()}))}function _g(){bl.connection.addHandler((e=>{const t=sg.getBareJidFromJid(e.getAttribute("from"));return bl.chatboxes.get(t)||Vl.waitUntil("chatBoxesFetched").then((async()=>{const n=bl.chatboxes.get(t);n&&(await n.initialized,n.message_handler.run(e))})),!0}),null,"message","groupchat")}Object.assign(bl,{getAssignableRoles:ag});const{u:bg}=Ah.env;const wg=class extends Fd{model=ng;comparator(e,t){const n=e.get("role")||"none",s=t.get("role")||"none";if(wf[n]===wf[s]){const n=e.getDisplayName().toLowerCase(),s=t.getDisplayName().toLowerCase();return n<s?-1:n>s?1:0}return wf[n]<wf[s]?-1:1}create(e,t){return e.id||e instanceof dr||(e.id=e.occupant_id||Bc()),super.create(e,t)}async fetchMembers(){if(!["member","admin","owner"].includes(this.getOwnOccupant()?.get("affiliation")))return;const e=og();if(0===e.length)return;const t=this.chatroom.get("jid"),n=await Promise.all(e.map((e=>Uf(e,t)))),s=n.reduce(((e,t)=>bg.isErrorObject(t)?e:[...t,...e]),[]),i=e.filter((t=>!bg.isErrorObject(n[e.indexOf(t)]))),r=s.map((e=>e.jid)).filter((e=>void 0!==e)),o=s.map((e=>!e.jid&&e.nick||void 0)).filter((e=>void 0!==e)),a=this.filter((e=>i.includes(e.get("affiliation"))&&!o.includes(e.get("nick"))&&!r.includes(e.get("jid"))));a.forEach((e=>{e.get("jid")!==bl.bare_jid&&("offline"===e.get("show")?e.destroy():e.save("affiliation",null))})),s.forEach((e=>{const t=this.findOccupant(e);t?t.save(e):this.create(e)})),Vl.trigger("membersFetched")}findOccupant(e){if(e.occupant_id)return this.get(e.occupant_id);const t=e.jid&&so.getBareJidFromJid(e.jid);return t&&this.findWhere({jid:t})||e.nick&&this.findWhere({nick:e.nick})}getOwnOccupant(){return this.findOccupant({jid:bl.bare_jid,occupant_id:this.chatroom.get("occupant_id")})}},Sg={affiliations:{set:(e,t)=>(t=Array.isArray(t)?t:[t],qf(e=Array.isArray(e)?e:[e],t))}},{u:xg}=Ah.env,Eg={rooms:{create(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t="string"==typeof t?{nick:t}:t||{},!t.nick&&Vl.settings.get("muc_nickname_from_jid")&&(t.nick=so.getNodeFromJid(bl.bare_jid)),void 0===e)throw new TypeError("rooms.create: You need to provide at least one JID");return"string"==typeof e?Vl.rooms.get(xg.getJIDFromURI(e),t,!0):e.map((e=>Vl.rooms.get(xg.getJIDFromURI(e),t,!0)))},async open(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(await Vl.waitUntil("chatBoxesFetched"),void 0===e){const e="rooms.open: You need to provide at least one JID";throw Yc.error(e),new TypeError(e)}if("string"==typeof e){const s=await Vl.rooms.get(e,t,!0);return!t.hidden&&s?.maybeShow(n),s}{const s=await Promise.all(e.map((e=>Vl.rooms.get(e,t,!0))));return s.forEach((e=>!t.hidden&&e.maybeShow(n))),s}},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){e=xg.getJIDFromURI(e);let s=await Vl.chatboxes.get(e);return!s&&n?s=await Vl.chatboxes.create(e,t,bl.ChatRoom):(s=s&&s.get("type")===bl.CHATROOMS_TYPE?s:null,s&&Object.keys(t).length&&s.save(t)),s}if(await Vl.waitUntil("chatBoxesFetched"),void 0===e){return(await Vl.chatboxes.get()).filter((e=>e.get("type")===bl.CHATROOMS_TYPE))}return"string"==typeof e?s(e):Promise.all(e.map((e=>s(e))))}}},Ag=["owner","admin","member","outcast","none"];Ah.AFFILIATION_CHANGES=Sf,Ah.AFFILIATION_CHANGES_LIST=xf,Ah.MUC_TRAFFIC_STATES=Ef,Ah.MUC_TRAFFIC_STATES_LIST=Af,Ah.MUC_ROLE_CHANGES=Cf,Ah.MUC_ROLE_CHANGES_LIST=$f,Ah.MUC={INFO_CODES:kf},Ah.MUC_NICK_CHANGED_CODE="303",Ah.ROOM_FEATURES=["passwordprotected","unsecured","hidden","publicroom","membersonly","open","persistent","temporary","nonanonymous","semianonymous","moderated","unmoderated","mam_enabled"],Ah.ROOMSTATUS=jf;const{Strophe:Cg}=Ah.env;Cg.addNamespace("MUC_ADMIN",Cg.NS.MUC+"#admin"),Cg.addNamespace("MUC_OWNER",Cg.NS.MUC+"#owner"),Cg.addNamespace("MUC_REGISTER","jabber:iq:register"),Cg.addNamespace("MUC_ROOMCONF",Cg.NS.MUC+"#roomconfig"),Cg.addNamespace("MUC_USER",Cg.NS.MUC+"#user"),Cg.addNamespace("MUC_HATS","xmpp:prosody.im/protocol/hats:1"),Cg.addNamespace("CONFINFO","urn:ietf:params:xml:ns:conference-info"),Ah.plugins.add("converse-muc",{dependencies:["converse-chatboxes","converse-chat","converse-disco"],overrides:{ChatBoxes:{model(e,t){const{_converse:n}=this.__super__;return e&&e.type==n.CHATROOMS_TYPE?new n.ChatRoom(e,t):this.__super__.model.apply(this,arguments)}}},initialize(){const{__:e,___:t}=bl;if(Vl.settings.extend({allow_muc_invitations:!0,auto_join_on_invite:!1,auto_join_rooms:[],auto_register_muc_nickname:!1,hide_muc_participants:!1,locked_muc_domain:!1,modtools_disable_assign:!1,muc_clear_messages_on_leave:!0,muc_domain:void 0,muc_fetch_members:!0,muc_history_max_stanzas:void 0,muc_instant_rooms:!0,muc_nickname_from_jid:!1,muc_send_probes:!1,muc_show_info_messages:[...Ah.MUC.INFO_CODES.visibility_changes,...Ah.MUC.INFO_CODES.self,...Ah.MUC.INFO_CODES.non_privacy_changes,...Ah.MUC.INFO_CODES.muc_logging_changes,...Ah.MUC.INFO_CODES.nickname_changes,...Ah.MUC.INFO_CODES.disconnected,...Ah.MUC.INFO_CODES.affiliation_changes,...Ah.MUC.INFO_CODES.join_leave_events,...Ah.MUC.INFO_CODES.role_changes],muc_show_logs_before_join:!1,muc_subscribe_to_rai:!1}),Vl.promises.add(["roomsAutoJoined"]),Vl.settings.get("locked_muc_domain")&&"string"!=typeof Vl.settings.get("muc_domain"))throw new Error("Config Error: it makes no sense to set locked_muc_domain to true when muc_domain is not set");Ah.env.muc_utils={computeAffiliationsDelta:Gf},Object.assign(Vl,Eg),Object.assign(Vl.rooms,Sg),bl.muc={info_messages:{100:e("This groupchat is not anonymous"),102:e("This groupchat now shows unavailable members"),103:e("This groupchat does not show unavailable members"),104:e("The groupchat configuration has changed"),170:e("Groupchat logging is now enabled"),171:e("Groupchat logging is now disabled"),172:e("This groupchat is now no longer anonymous"),173:e("This groupchat is now semi-anonymous"),174:e("This groupchat is now fully-anonymous"),201:e("A new groupchat has been created")},new_nickname_messages:{210:t("Your nickname has been automatically set to %1$s"),303:t("Your nickname has been changed to %1$s")},disconnect_messages:{301:e("You have been banned from this groupchat"),333:e("You have exited this groupchat due to a technical problem"),307:e("You have been kicked from this groupchat"),321:e("You have been removed from this groupchat because of an affiliation change"),322:e("You have been removed from this groupchat because the groupchat has changed to members-only and you're not a member"),332:e("You have been removed from this groupchat because the service hosting it is being shut down")}},bl.router.route("converse/room?jid=:jid",ug),bl.ChatRoom=bl.ChatBox.extend(tg),bl.ChatRoomMessage=bl.Message.extend(mf),bl.ChatRoomOccupants=wg,bl.ChatRoomOccupant=ng,bl.ChatRoomMessages=Fd.extend({model:bl.ChatRoomMessage,comparator:"time"}),Object.assign(bl,{getDefaultMUCNickname:mg,isInfoVisible:fg,onDirectMUCInvitation:hg}),Vl.settings.get("allow_muc_invitations")&&(Vl.listen.on("connected",cg),Vl.listen.on("reconnected",cg)),Vl.listen.on("addClientFeatures",(()=>Vl.disco.own.features.add(`${Cg.NS.CONFINFO}+notify`))),Vl.listen.on("addClientFeatures",pg),Vl.listen.on("beforeResourceBinding",_g),Vl.listen.on("beforeTearDown",vg),Vl.listen.on("chatBoxesFetched",gg),Vl.listen.on("disconnected",lg),Vl.listen.on("statusInitialized",yg),Vl.listen.on("windowStateChanged",dg)}});const{Strophe:$g}=Ah.env,kg=dr.extend({idAttribute:"jid",getDisplayName(){return $g.xmlunescape(this.get("name"))}}),{Strophe:jg,$iq:Tg,sizzle:Ig}=Ah.env,Ng={model:kg,comparator:e=>e.get("name").toLowerCase(),async initialize(){this.on("add",(e=>this.openBookmarkedRoom(e).then((e=>this.markRoomAsBookmarked(e))).catch((e=>Yc.fatal(e))))),this.on("remove",this.markRoomAsUnbookmarked,this),this.on("remove",this.sendBookmarkStanza,this);const e=`converse.room-bookmarks${bl.bare_jid}`;this.fetched_flag=e+"fetched",vc(this,e),await this.fetchBookmarks(),Vl.trigger("bookmarksInitialized",this)},async openBookmarkedRoom(e){if(Vl.settings.get("muc_respect_autojoin")&&e.get("autojoin")){(await Vl.rooms.create(e.get("jid"),{nick:e.get("nick")})).maybeShow()}return e},fetchBookmarks(){const e=Ao();return window.sessionStorage.getItem(this.fetched_flag)?this.fetch({success:()=>e.resolve(),error:()=>e.resolve()}):this.fetchBookmarksFromServer(e),e},createBookmark(e){this.create(e),this.sendBookmarkStanza().catch((t=>this.onBookmarkError(t,e)))},sendBookmarkStanza(){const e=Tg({type:"set",from:bl.connection.jid}).c("pubsub",{xmlns:jg.NS.PUBSUB}).c("publish",{node:jg.NS.BOOKMARKS}).c("item",{id:"current"}).c("storage",{xmlns:jg.NS.BOOKMARKS});return this.forEach((t=>{e.c("conference",{name:t.get("name"),autojoin:t.get("autojoin"),jid:t.get("jid")}).c("nick").t(t.get("nick")).up().up()})),e.up().up().up(),e.c("publish-options").c("x",{xmlns:jg.NS.XFORM,type:"submit"}).c("field",{var:"FORM_TYPE",type:"hidden"}).c("value").t("http://jabber.org/protocol/pubsub#publish-options").up().up().c("field",{var:"pubsub#persist_items"}).c("value").t("true").up().up().c("field",{var:"pubsub#access_model"}).c("value").t("whitelist"),Vl.sendIQ(e)},onBookmarkError(e,t){const{__:n}=bl;Yc.error("Error while trying to add bookmark"),Yc.error(e),Vl.alert("error",n("Error"),[n("Sorry, something went wrong while trying to save your bookmark.")]),this.get(t.jid)?.destroy()},fetchBookmarksFromServer(e){const t=Tg({from:bl.connection.jid,type:"get"}).c("pubsub",{xmlns:jg.NS.PUBSUB}).c("items",{node:jg.NS.BOOKMARKS});Vl.sendIQ(t).then((t=>this.onBookmarksReceived(e,t))).catch((t=>this.onBookmarksReceivedError(e,t)))},markRoomAsBookmarked(e){const t=bl.chatboxes.get(e.get("jid"));t?.save("bookmarked",!0)},markRoomAsUnbookmarked(e){const t=bl.chatboxes.get(e.get("jid"));t?.save("bookmarked",!1)},createBookmarksFromStanza(e){const t=jg.NS.BOOKMARKS;Ig(`items[node="${t}"] item storage[xmlns="${t}"] conference`,e).forEach((e=>{const t=e.getAttribute("jid"),n=this.get(t),s={jid:t,name:e.getAttribute("name")||t,autojoin:"true"===e.getAttribute("autojoin"),nick:e.querySelector("nick")?.textContent||""};n?n.save(s):this.create(s)}))},onBookmarksReceived(e,t){if(this.createBookmarksFromStanza(t),window.sessionStorage.setItem(this.fetched_flag,!0),void 0!==e)return e.resolve()},onBookmarksReceivedError(e,t){const{__:n}=bl;if(null===t)Yc.error("Error: timeout while fetching bookmarks"),Vl.alert("error",n("Timeout Error"),[n("The server did not return your bookmarks within the allowed time. You can reload the page to request them again.")]);else{if(e)return t.querySelector('error[type="cancel"] item-not-found')?(window.sessionStorage.setItem(this.fetched_flag,!0),e.resolve()):(Yc.error("Error while fetching bookmarks"),Yc.error(t),e.reject(new Error("Could not fetch bookmarks")));Yc.error("Error while fetching bookmarks"),Yc.error(t)}},async getUnopenedBookmarks(){return await Vl.waitUntil("bookmarksInitialized"),await Vl.waitUntil("chatBoxesFetched"),this.filter((e=>!bl.chatboxes.get(e.get("jid"))))}},Og=Ng,{Strophe:Mg,sizzle:Rg}=Ah.env;async function Dg(){const e=await Vl.disco.getIdentity("pubsub","pep",bl.bare_jid);return Vl.settings.get("allow_public_bookmarks")?!!e:Vl.disco.supports(Mg.NS.PUBSUB+"#publish-options",bl.bare_jid)}function zg(e){return Rg(`event[xmlns="${Mg.NS.PUBSUB}#event"] items[node="${Mg.NS.BOOKMARKS}"]`,e).length&&Vl.waitUntil("bookmarksInitialized").then((()=>bl.bookmarks.createBookmarksFromStanza(e))).catch((e=>Yc.fatal(e))),!0}const{Strophe:Lg}=Ah.env;Lg.addNamespace("BOOKMARKS","storage:bookmarks"),Ah.plugins.add("converse-bookmarks",{dependencies:["converse-chatboxes","converse-muc"],overrides:{ChatRoom:{getDisplayName(){const{_converse:e,getDisplayName:t}=this.__super__,n=this.get("bookmarked")?e.bookmarks?.get(this.get("jid")):null;return n?.get("name")||t.apply(this,arguments)},getAndPersistNickname(e){var t;return e=e||(t=this.get("jid"),Vl.settings.get("allow_bookmarks")?bl.bookmarks?.get(t)?.get("nick"):null),this.__super__.getAndPersistNickname.call(this,e)}}},initialize(){Vl.settings.extend({allow_bookmarks:!0,allow_public_bookmarks:!1,muc_respect_autojoin:!0}),Vl.promises.add("bookmarksInitialized"),bl.Bookmark=kg,bl.Bookmarks=Fd.extend(Og),Vl.listen.on("addClientFeatures",(()=>{Vl.settings.get("allow_bookmarks")&&Vl.disco.own.features.add(Lg.NS.BOOKMARKS+"+notify")})),Vl.listen.on("clearSession",(()=>{bl.bookmarks&&(bl.bookmarks.clearStore({silent:!0}),window.sessionStorage.removeItem(bl.bookmarks.fetched_flag),delete bl.bookmarks)})),Vl.listen.on("connected",(async()=>{const{connection:e}=bl;e.addHandler(zg,null,"message","headline",null,bl.bare_jid),await Promise.all([Vl.waitUntil("chatBoxesFetched")]),async function(){Vl.settings.get("allow_bookmarks")&&await Dg()&&(bl.bookmarks=new bl.Bookmarks)}()}))}});const{Strophe:Pg}=Ah.env,Fg="converse.bosh-session";Ah.plugins.add("converse-bosh",{enabled:()=>!bl.api.settings.get("blacklisted_plugins").includes("converse-bosh"),initialize(){Vl.settings.extend({bosh_service_url:void 0,prebind_url:null}),bl.startNewPreboundBOSHSession=function(){if(!Vl.settings.get("prebind_url"))throw new Error("startNewPreboundBOSHSession: If you use prebind then you MUST supply a prebind_url");const e=new XMLHttpRequest;e.open("GET",Vl.settings.get("prebind_url"),!0),e.setRequestHeader("Accept","application/json, text/javascript"),e.onload=async function(){if(e.status>=200&&e.status<400){const t=JSON.parse(e.responseText),n=await Fl(t.jid);bl.connection.attach(n,t.sid,t.rid,bl.connection.onConnectStatusChanged,59)}else e.onerror()},e.onerror=function(){delete bl.connection,Vl.trigger("noResumeableBOSHSession",bl)},e.send()},bl.restoreBOSHSession=async function(){const e=(await async function(){const e=Fg;if(bl.bosh_session||(bl.bosh_session=new dr({id:e}),bl.bosh_session.browserStorage=bl.createStore(e,"session"),await new Promise((e=>bl.bosh_session.fetch({success:e,error:e})))),bl.jid){if(bl.bosh_session.get("jid")!==bl.jid){const e=await Fl(bl.jid);bl.bosh_session.clear({silent:!0}),bl.bosh_session.save({jid:e})}}else{const e=bl.bosh_session.get("jid");e&&await Fl(e)}return bl.bosh_session}()).get("jid");if(e&&bl.connection._proto instanceof Pg.Bosh)try{return bl.connection.restore(e,bl.connection.onConnectStatusChanged),!0}catch(t){return!bl.isTestEnv()&&Yc.warn("Could not restore session for jid: "+e+" Error message: "+t.message),!1}return!1},Vl.listen.on("clearSession",(()=>{if(void 0===bl.bosh_session){const e=Fg;sessionStorage.removeItem(e),sessionStorage.removeItem(`${e}-${e}`)}else bl.bosh_session.destroy(),delete bl.bosh_session})),Vl.listen.on("setUserJID",(()=>{void 0!==bl.bosh_session&&bl.bosh_session.save({jid:bl.jid})})),Vl.listen.on("addClientFeatures",(()=>Vl.disco.own.features.add(Pg.NS.BOSH))),Object.assign(Vl,{tokens:{get:e=>void 0===bl.connection?null:"rid"===e.toLowerCase()?bl.connection.rid||bl.connection._proto.rid:"sid"===e.toLowerCase()?bl.connection.sid||bl.connection._proto.sid:void 0}})}});const{u:Ug}=Ah.env;function Bg(e,t){const n=new Uint8Array(e.byteLength+t.byteLength);return n.set(new Uint8Array(e),0),n.set(new Uint8Array(t),e.byteLength),n.buffer}function qg(e){return Array.prototype.map.call(new Uint8Array(e),(e=>("00"+e.toString(16)).slice(-2))).join("")}function Hg(e){return new TextDecoder("utf-8").decode(e)}function Gg(e){return new TextEncoder("utf-8").encode(e).buffer}function Wg(e){return btoa(new Uint8Array(e).reduce(((e,t)=>e+String.fromCharCode(t)),""))}function Vg(e){const t=window.atob(e),n=t.length,s=new Uint8Array(n);for(let e=0;e<n;e++)s[e]=t.charCodeAt(e);return s.buffer}function Jg(e){const t=new Uint8Array(e.match(/[\da-f]{2}/gi).map((e=>parseInt(e,16))));return t.buffer}Object.assign(Ug,{arrayBufferToHex:qg,arrayBufferToString:Hg,stringToArrayBuffer:Gg,arrayBufferToBase64:Wg,base64ToArrayBuffer:Vg});const{Strophe:Zg,$build:Qg}=Ah.env;function Kg(e,t){return e.sort(((e,n)=>e[t]>n[t]?-1:1))}async function Yg(){const e=bl.api.disco.own.identities.get(),t=bl.api.disco.own.features.get();e.length>1&&(Kg(e,"category"),Kg(e,"type"),Kg(e,"lang"));let n=e.reduce(((e,t)=>`${e}${t.category}/${t.type}/${t?.lang??""}/${t.name}<`),"");t.sort(),n=t.reduce(((e,t)=>`${e}${t}<`),n);return Wg(await crypto.subtle.digest("SHA-1",Gg(n)))}async function Xg(e){const t=await async function(){return Qg("c",{xmlns:Zg.NS.CAPS,hash:"sha-1",node:"https://conversejs.org",ver:await Yg()}).tree()}();return e.root().cnode(t).up(),e}const{Strophe:ep}=Ah.env;ep.addNamespace("CAPS","http://jabber.org/protocol/caps"),Ah.plugins.add("converse-caps",{dependencies:["converse-status"],initialize(){Vl.listen.on("constructedPresence",((e,t)=>Xg(t))),Vl.listen.on("constructedMUCPresence",((e,t)=>Xg(t)))}});const tp=Fd.extend({comparator:"time_opened",model:(e,t)=>new bl.ChatBox(e,t),onChatBoxesFetched(e){e.filter((e=>!e.isValid())).forEach((e=>e.destroy())),Vl.trigger("chatBoxesFetched")},onConnected(e){e||(vc(this,`converse.chatboxes-${bl.bare_jid}`),this.fetch({add:!0,success:e=>this.onChatBoxesFetched(e)}))}}),np=tp,{Strophe:sp}=Ah.env;async function ip(e,t,n){let s;e=sp.getBareJidFromJid(e.toLowerCase()),Object.assign(t,{jid:e,id:e});try{s=new n(t,{collection:bl.chatboxes})}catch(e){return Yc.error(e),null}return await s.initialized,s.isValid()?(bl.chatboxes.add(s),s):(s.destroy(),null)}const rp={async create(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return await Vl.waitUntil("chatBoxesFetched"),"string"==typeof e?ip(e,t,n):Promise.all(e.map((e=>ip(e,t,n))))},get:async e=>(await Vl.waitUntil("chatBoxesFetched"),void 0===e?bl.chatboxes.models:"string"==typeof e?bl.chatboxes.get(e.toLowerCase()):(e=e.map((e=>e.toLowerCase())),bl.chatboxes.models.filter((t=>e.includes(t.get("jid"))))))},{Strophe:op}=Ah.env;Ah.plugins.add("converse-chatboxes",{dependencies:["converse-emoji","converse-roster","converse-vcard"],initialize(){Vl.promises.add(["chatBoxesFetched","chatBoxesInitialized","privateChatsAutoJoined"]),Object.assign(Vl,{chatboxes:rp}),bl.ChatBoxes=np,Vl.listen.on("addClientFeatures",(()=>{Vl.disco.own.features.add(op.NS.MESSAGE_CORRECT),Vl.disco.own.features.add(op.NS.HTTPUPLOAD),Vl.disco.own.features.add(op.NS.OUTOFBAND)})),Vl.listen.on("pluginsInitialized",(()=>{bl.chatboxes=new bl.ChatBoxes,Vl.trigger("chatBoxesInitialized")})),Vl.listen.on("presencesInitialized",(e=>bl.chatboxes.onConnected(e))),Vl.listen.on("reconnected",(()=>bl.chatboxes.forEach((e=>e.onReconnection()))))}});const{Strophe:ap,u:cp}=Ah.env;function lp(e,t){const n=Eo()(`command[xmlns="${ap.NS.ADHOC}"]`,e).pop(),s={sessionid:n.getAttribute("sessionid"),instructions:Eo()('x[type="form"][xmlns="jabber:x:data"] instructions',n).pop()?.textContent,fields:Eo()('x[type="form"][xmlns="jabber:x:data"] field',n).map((e=>cp.xForm2TemplateResult(e,n,{domain:t}))),actions:Array.from(n.querySelector("actions")?.children).map((e=>e.nodeName.toLowerCase()))??[]};return s}const{Strophe:dp,$iq:up,u:hp,stx:mp}=Ah.env,fp={adhoc:{async getCommands(e){try{return t=await Vl.disco.items(e,dp.NS.ADHOC),Eo()(`query[xmlns="${ap.NS.DISCO_ITEMS}"][node="${ap.NS.ADHOC}"] item`,t).map(pm)}catch(t){return null===t?Yc.error(`Error: timeout while fetching ad-hoc commands for ${e}`):(Yc.error(`Error while fetching ad-hoc commands for ${e}`),Yc.error(t)),[]}var t},async fetchCommandForm(e){const t=e.node,n=e.jid,s=up({type:"set",to:n}).c("command",{xmlns:dp.NS.ADHOC,node:t,action:"execute"});try{return lp(await Vl.sendIQ(s),n)}catch(e){null===e?Yc.error(`Error: timeout while trying to execute command for ${n}`):(Yc.error(`Error while trying to execute command for ${n}`),Yc.error(e));const{__:t}=bl;return{instructions:t("An error occurred while trying to fetch the command form"),fields:[]}}},async runCommand(e,t,n,s,i){const r=mp`<iq type="set" to="${e}" xmlns="jabber:client">
<command sessionid="${t}" node="${n}" action="${s}" xmlns="${dp.NS.ADHOC}">
${["cancel","prev"].includes(s)?"":mp`
<x xmlns="${dp.NS.XFORM}" type="submit">
${i.reduce(((e,t)=>{let{name:n,value:s}=t;return e+`<field var="${n}"><value>${s}</value></field>`}),"")}
</x>`}
</command>
</iq>`,o=await 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.supports(Np.MAM,n))return Yc.warn(`Did not fetch MAM archive for ${n} because it doesn't support ${Np.MAM}`),{messages:[]};const s=Op.getUniqueId(),i=Tp(t).c("query",{xmlns:Np.MAM,queryid:s});if(e){i.c("x",{xmlns:Np.XFORM,type:"submit"}).c("field",{var:"FORM_TYPE",type:"hidden"}).c("value").t(Np.MAM).up().up(),e.with&&!e.groupchat&&i.c("field",{var:"with"}).c("value").t(e.with).up().up(),["start","end"].forEach((t=>{if(e[t]){const n=Ip(e[t]);if(!n.isValid())throw new TypeError(`archive.query: invalid date provided for: ${t}`);i.c("field",{var:t}).c("value").t(n.toISOString()).up().up()}})),i.up();const t=new kp(e);Object.keys(t.query).length&&i.cnode(t.toXML())}const r=[],o=bl.connection.addHandler((t=>{const n=Eo()(`message > result[xmlns="${Np.MAM}"]`,t).pop();if(void 0===n||n.getAttribute("queryid")!==s)return!0;const i=t.getAttribute("from")||bl.bare_jid;if(e.groupchat){if(i!==e.with)return Yc.warn(`Ignoring alleged groupchat MAM message from ${t.getAttribute("from")}`),!0}else if(i!==bl.bare_jid)return Yc.warn(`Ignoring alleged MAM message from ${t.getAttribute("from")}`),!0;return r.push(t),!0}),Np.MAM);let a;const c=Vl.settings.get("message_archiving_timeout"),l=await Vl.sendIQ(i,c,!1);if(null===l){const{__:e}=bl,t=e("Timeout while trying to fetch archived messages.");return Yc.error(t),a=new Cl(t),{messages:r,error:a}}if(Op.isErrorStanza(l)){const{__:e}=bl,t=e("An error occurred while querying for archived messages.");return Yc.error(t),Yc.error(l),a=new Error(t),{messages:r,error:a}}let d;bl.connection.deleteHandler(o);const u=l&&Eo()(`fin[xmlns="${Np.MAM}"]`,l).pop(),h="true"===u?.getAttribute("complete"),m=Eo()(`set[xmlns="${Np.RSM}"]`,u).pop();return m&&(d=new kp({...e,xml:m})),{messages:r,rsm:d,complete:h}}}},{Strophe:Rp,$iq:Dp}=Ah.env,{NS:zp}=Rp,Lp=Ah.env.utils;function Pp(e){e?.querySelectorAll("feature-not-implemented").length?Yc.warn(`Message Archive Management (XEP-0313) not supported by ${e.getAttribute("from")}`):(Yc.error(`Error while trying to set archiving preferences for ${e.getAttribute("from")}.`),Yc.error(e))}function Fp(e,t){const n=Eo()(`prefs[xmlns="${zp.MAM}"]`,e).pop();if(n.getAttribute("default")!==Vl.settings.get("message_archiving")){const e=Dp({type:"set"}).c("prefs",{xmlns:zp.MAM,default:Vl.settings.get("message_archiving")});Array.from(n.children).forEach((t=>e.cnode(t).up())),Vl.sendIQ(e).then((()=>t.save({preferences:{default:Vl.settings.get("message_archiving")}}))).catch(bl.onMAMError)}else t.save({preferences:{default:Vl.settings.get("message_archiving")}})}function Up(e){const t=e.get("preferences")||{};e.get("var")===zp.MAM&&void 0!==Vl.settings.get("message_archiving")&&t.default!==Vl.settings.get("message_archiving")&&Vl.sendIQ(Dp({type:"get"}).c("prefs",{xmlns:zp.MAM})).then((t=>bl.onMAMPreferences(t,e))).catch(bl.onMAMError)}function Bp(e){Vl.settings.get("muc_show_logs_before_join")&&e.features.get("mam_enabled")&&!e.get("prejoin_mam_fetched")&&(Gp(e),e.save({prejoin_mam_fetched:!0}))}async function qp(e,t,n,s,i){await Vl.emojis.initialize();const r=e.get("type")===bl.CHATROOMS_TYPE,o=await Promise.all(t.messages.map((t=>r?zf(t,e):_m(t))));t.messages=o;const a={query:n,chatbox:e,messages:o};if(await Vl.trigger("MAMResult",a,{synchronous:!0}),o.forEach((t=>e.queueMessage(t))),t.error){const n=t.error.retry_event_id=Lp.getUniqueId();Vl.listen.once(n,(()=>Hp(e,s,i))),e.createMessageFromError(t.error)}}async function Hp(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(e.disable_mam)return;const s=e.get("type")===bl.CHATROOMS_TYPE,i=s?e.get("jid"):bl.bare_jid;if(!await Vl.disco.supports(zp.MAM,i))return;const r=Vl.settings.get("archived_messages_page_size"),o=Object.assign({groupchat:s,max:r,with:e.get("jid")},t),a=await Vl.archive.query(o);if(await qp(e,a,o,t,n),a.rsm&&!a.complete){if(n)return"forwards"===n?t=a.rsm.next(r,t.before).query:"backwards"===n&&(t=a.rsm.previous(r,t.after).query),Hp(e,t,n);!async function(e,t,n){if(""==t.before&&(0===e.messages.length||!t.start))return;if(t.before&&!t.start)return;if(null==t.before)return;const s=await Promise.all(n.messages),{rsm:i}=n,r=`stanza_id ${e.get("jid")}`,o=s.find((e=>e[r]===i.result.first)),a={template_hook:"getMessageTemplate",time:new Date(new Date(o.time)-1).toISOString(),before:i.result.first,start:t.start};e.messages.add(new _p(a))}(e,t,a)}}function Gp(e){if(e.disable_mam)return;const t=e.getMostRecentMessage();if(t&&!Vl.settings.get("clear_messages_on_reconnection")){if(Vl.settings.get("mam_request_all_pages")){const n=t.get(`stanza_id ${e.get("jid")}`);Hp(e,n?{after:n}:{start:t.get("time")},"forwards")}else Hp(e,{before:"",start:t.get("time")})}else Hp(e,{before:""})}const{Strophe:Wp}=Ah.env,{NS:Vp}=Wp;Ah.plugins.add("converse-mam",{dependencies:["converse-disco","converse-muc"],initialize(){Vl.settings.extend({archived_messages_page_size:"50",mam_request_all_pages:!0,message_archiving:void 0,message_archiving_timeout:2e4}),Object.assign(Vl,Mp),Object.assign(bl,{onMAMError:Pp,onMAMPreferences:Fp,handleMAMResult:qp,MAMPlaceholderMessage:_p}),Vl.listen.on("addClientFeatures",(()=>Vl.disco.own.features.add(Vp.MAM))),Vl.listen.on("serviceDiscovered",Up),Vl.listen.on("chatRoomViewInitialized",(e=>{Vl.settings.get("muc_show_logs_before_join")&&(Bp(e.model),e.model.features.on("change:mam_enabled",(()=>Bp(e.model))))})),Vl.listen.on("enteredNewRoom",(e=>e.features.get("mam_enabled")&&Gp(e))),Vl.listen.on("chatReconnected",(e=>{e.get("type")===bl.PRIVATE_CHAT_TYPE&&Gp(e)})),Vl.listen.on("afterMessagesFetched",(e=>{e.get("type")===bl.PRIVATE_CHAT_TYPE&&Gp(e)}))}});const{Strophe:Jp,$iq:Zp}=Ah.env;let Qp,Kp;function Yp(e){"visible"===e.state&&Vl.ping(null,5e3)}function Xp(e){Qp=new Date;const t=e.getAttribute("from"),n=e.getAttribute("id"),s=Zp({type:"result",to:t,id:n});return bl.connection.sendIQ(s),!0}function ev(){!function(){const{connection:e}=bl;e.disco&&Vl.disco.own.features.add(Jp.NS.PING),e.addHandler(Xp,Jp.NS.PING,"iq","get")}(),bl.connection.addHandler((()=>{if(Vl.settings.get("ping_interval")>0)return Qp=new Date,!0})),clearInterval(Kp),Kp=setInterval(nv,1e3)}function tv(){clearInterval(Kp)}function nv(){if(bl.isTestEnv()||!Vl.connection.authenticated())return;const e=Vl.settings.get("ping_interval");if(e>0){const t=new Date;Qp=Qp??t,(t-Qp)/1e3>e&&Vl.ping()}}const{Strophe:sv,$iq:iv,u:rv}=Ah.env,ov={async ping(e,t){if(!Vl.connection.authenticated())return Yc.warn("Not pinging when we know we're not authenticated"),null;var n;n=new Date,Qp=n,e=e||sv.getDomainFromJid(bl.bare_jid);const s=iv({type:"get",to:e,id:rv.getUniqueId("ping")}).c("ping",{xmlns:sv.NS.PING}),i=await Vl.sendIQ(s,t||1e4,!1);return null===i?(Yc.warn(`Timeout while pinging ${e}`),e===sv.getDomainFromJid(bl.bare_jid)&&Vl.connection.reconnect(),!1):!rv.isErrorStanza(i)||(Yc.error(`Error while pinging ${e}`),Yc.error(i),!1)}},{Strophe:av}=Ah.env;av.addNamespace("PING","urn:xmpp:ping"),Ah.plugins.add("converse-ping",{initialize(){Vl.settings.extend({ping_interval:60}),Object.assign(Vl,ov),Vl.listen.on("connected",ev),Vl.listen.on("reconnected",ev),Vl.listen.on("disconnected",tv),Vl.listen.on("windowStateChanged",Yp)}});const{Strophe:cv,$iq:lv}=Ah.env;cv.addNamespace("PUBSUB_ERROR",cv.NS.PUBSUB+"#errors"),Ah.plugins.add("converse-pubsub",{dependencies:["converse-disco"],initialize(){Object.assign(bl.api,{pubsub:{async publish(e,t,n,s){let i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];const r=lv({from:bl.bare_jid,type:"set",to:e}).c("pubsub",{xmlns:cv.NS.PUBSUB}).c("publish",{node:t}).cnode(n.tree()).up().up();s&&(e=e||bl.bare_jid,await Vl.disco.supports(cv.NS.PUBSUB+"#publish-options",e)?(r.c("publish-options").c("x",{xmlns:cv.NS.XFORM,type:"submit"}).c("field",{var:"FORM_TYPE",type:"hidden"}).c("value").t(`${cv.NS.PUBSUB}#publish-options`).up().up(),Object.keys(s).forEach((e=>r.c("field",{var:e}).c("value").t(s[e]).up().up()))):Yc.warn(`_converse.api.publish: ${e} does not support #publish-options, so we didn't set them even though they were provided.`));try{await Vl.sendIQ(r)}catch(e){if(!(e instanceof Element&&i&&e.querySelector(`precondition-not-met[xmlns="${cv.NS.PUBSUB_ERROR}"]`)))throw e;{const e=r.tree();e.querySelector("publish-options").outerHTML="",Yc.warn(`PubSub: Republishing without publish options. ${e.outerHTML}`),await Vl.sendIQ(e)}}}}})}});const dv=function(e){return"number"==typeof e||B(e)&&"[object Number]"==v(e)};const uv=function(e){return dv(e)&&e!=+e},{Strophe:hv,$pres:mv}=Ah.env;class fv extends dr{defaults(){return{status:Vl.settings.get("default_state")}}initialize(){this.on("change",(e=>{y(e.changed)&&("status"in e.changed||"status_message"in e.changed)&&Vl.user.presence.send(this.get("status"),null,this.get("status_message"))}))}getDisplayName(){return this.getFullname()||this.getNickname()||bl.bare_jid}getNickname(){return Vl.settings.get("nickname")}getFullname(){return""}async constructPresence(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2?arguments[2]:void 0;if(e="string"==typeof e?e:this.get("status")||Vl.settings.get("default_state"),s="string"==typeof s?s:this.get("status_message"),"subscribe"===e){t=mv({to:n,type:e});const{xmppstatus:s}=bl,i=s.getNickname();i&&t.c("nick",{xmlns:hv.NS.NICK}).t(i).up()}else t="unavailable"===e||"probe"===e||"error"===e||"unsubscribe"===e||"unsubscribed"===e||"subscribed"===e?mv({to:n,type:e}):"offline"===e?mv({to:n,type:"unavailable"}):"online"===e?mv({to:n}):mv({to:n}).c("show").t(e).up();s&&t.c("status").t(s).up();const i=Vl.settings.get("priority");t.c("priority").t(uv(Number(i))?0:i).up();const{idle:r,idle_seconds:o}=bl;if(r){const e=new Date;e.setSeconds(e.getSeconds()-o),t.c("idle",{xmlns:hv.NS.IDLE,since:e.toISOString()})}return t=await Vl.hook("constructedPresence",null,t),t}}const gv={status:{get:async()=>(await Vl.waitUntil("statusInitialized"),bl.xmppstatus.get("status")),async set(e,t){const n={status:e};if(!Object.keys(ao).includes(e))throw new Error("Invalid availability value. See https://xmpp.org/rfcs/rfc3921.html#rfc.section.2.2.2.1");"string"==typeof t&&(n.status_message=t),await Vl.waitUntil("statusInitialized"),bl.xmppstatus.save(n)},message:{get:async()=>(await Vl.waitUntil("statusInitialized"),bl.xmppstatus.get("status_message")),async set(e){await Vl.waitUntil("statusInitialized"),bl.xmppstatus.save({status_message:e})}}}},{Strophe:pv,$build:vv}=Ah.env;function yv(e){Vl.trigger("statusInitialized",e)}function _v(e){if(e=void 0!==bl.xmppstatus&&e)yv(e);else{const t=`converse.xmppstatus-${bl.bare_jid}`;bl.xmppstatus=new bl.XMPPStatus({id:t}),vc(bl.xmppstatus,t,"session"),bl.xmppstatus.fetch({success:()=>yv(e),error:()=>yv(e),silent:!0})}}function bv(){bl.idle_seconds>0&&(bl.idle_seconds=0),bl.connection?.authenticated&&(bl.inactive&&bl.sendCSI(bl.ACTIVE),bl.idle&&(bl.idle=!1,Vl.user.presence.send()),!0===bl.auto_changed_status&&(bl.auto_changed_status=!1,bl.xmppstatus.set("status",Vl.settings.get("default_state"))))}function wv(){if(!bl.connection?.authenticated)return;const e=bl.xmppstatus.get("status");bl.idle_seconds++,Vl.settings.get("csi_waiting_time")>0&&bl.idle_seconds>Vl.settings.get("csi_waiting_time")&&!bl.inactive&&bl.sendCSI(bl.INACTIVE),Vl.settings.get("idle_presence_timeout")>0&&bl.idle_seconds>Vl.settings.get("idle_presence_timeout")&&!bl.idle&&(bl.idle=!0,Vl.user.presence.send()),Vl.settings.get("auto_away")>0&&bl.idle_seconds>Vl.settings.get("auto_away")&&"away"!==e&&"xa"!==e&&"dnd"!==e?(bl.auto_changed_status=!0,bl.xmppstatus.set("status","away")):Vl.settings.get("auto_xa")>0&&bl.idle_seconds>Vl.settings.get("auto_xa")&&"xa"!==e&&"dnd"!==e&&(bl.auto_changed_status=!0,bl.xmppstatus.set("status","xa"))}function Sv(e){Vl.send(vv(e,{xmlns:pv.NS.CSI})),bl.inactive=e===bl.INACTIVE}function xv(){if(Vl.settings.get("auto_away")<1&&Vl.settings.get("auto_xa")<1&&Vl.settings.get("csi_waiting_time")<1&&Vl.settings.get("idle_presence_timeout")<1)return;bl.idle_seconds=0,bl.auto_changed_status=!1;const{unloadevent:e}=bl;window.addEventListener("click",bl.onUserActivity),window.addEventListener("focus",bl.onUserActivity),window.addEventListener("keypress",bl.onUserActivity),window.addEventListener("mousemove",bl.onUserActivity),window.addEventListener(e,bl.onUserActivity,{once:!0,passive:!0}),bl.everySecondTrigger=window.setInterval(bl.onEverySecond,1e3)}function Ev(e,t){const{xmppstatus:n}=bl,s=n.get("status");["away","chat","dnd","xa"].includes(s)&&t.c("show").t(s).up();const i=n.get("status_message");return i&&t.c("status").t(i).up(),t}const{Strophe:Av}=Ah.env;Av.addNamespace("IDLE","urn:xmpp:idle:1"),Ah.plugins.add("converse-status",{initialize(){Vl.settings.extend({auto_away:0,auto_xa:0,csi_waiting_time:0,default_state:"online",idle_presence_timeout:300,priority:0}),Vl.promises.add(["statusInitialized"]),bl.XMPPStatus=fv,bl.onUserActivity=bv,bl.onEverySecond=wv,bl.sendCSI=Sv,bl.registerIntervalHandler=xv,Object.assign(bl.api.user,gv),Vl.settings.get("idle_presence_timeout")>0&&Vl.listen.on("addClientFeatures",(()=>Vl.disco.own.features.add(Av.NS.IDLE))),Vl.listen.on("presencesInitialized",(e=>{e||bl.registerIntervalHandler()})),Vl.listen.on("clearSession",(()=>{Mc()&&bl.xmppstatus&&(bl.xmppstatus.destroy(),delete bl.xmppstatus,Vl.promises.add(["statusInitialized"]))})),Vl.listen.on("connected",(()=>_v(!1))),Vl.listen.on("reconnected",(()=>_v(!0))),Vl.listen.on("constructedMUCPresence",Ev)}});const Cv=dr.extend({initialize(){this.set({filter_text:"",filter_type:"contacts",chat_state:"online"})}}),{$pres:$v}=Ah.env;function kv(e){const t=bl.roster?.get(e.get("jid"));t?.save({num_unread:e.get("num_unread")})}function jv(){void 0!==bl.presence_ref&&(bl.connection.deleteHandler(bl.presence_ref),delete bl.presence_ref)}async function Tv(){await(bl.presences?.clearStore())}async function Iv(){await Tv(),Mc()&&(bl.rostergroups&&(await bl.rostergroups.clearStore(),delete bl.rostergroups),bl.roster&&(bl.roster.data?.destroy(),await bl.roster.clearStore(),delete bl.roster))}function Nv(e){e?Vl.trigger("rosterReadyAfterReconnection"):function(){const e=bl.roster=new bl.RosterContacts;let t=`converse.contacts-${bl.bare_jid}`;vc(e,t);const n=bl.roster_filter=new Cv;n.id=`_converse.rosterfilter-${bl.bare_jid}`,vc(n,n.id),n.fetch(),t=`converse-roster-model-${bl.bare_jid}`,e.data=new dr,e.data.id=t,vc(e.data,t),e.data.fetch(),Vl.trigger("rosterInitialized")}(),bl.roster.onConnected(),jv(),bl.presence_ref=bl.connection.addHandler((e=>(bl.roster.presenceHandler(e),!0)),null,"presence",null),async function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(bl.send_initial_presence=!0);try{await bl.roster.fetchRosterContacts(),Vl.trigger("rosterContactsFetched")}catch(e){Yc.error(e)}finally{bl.send_initial_presence&&Vl.user.presence.send()}}(!bl.connection.restored)}async function Ov(e){if(e)!bl.connection.hasResumed()&&await Tv();else{bl.presences=new bl.Presences;const e=`converse.presences-${bl.bare_jid}`;vc(bl.presences,e,"session"),bl.presences.fetch()}Vl.trigger("presencesInitialized",e)}function Mv(){bl.chatboxes.on("change:num_unread",kv),bl.chatboxes.on("add",(e=>{e.get("type")===bl.PRIVATE_CHAT_TYPE&&e.setRosterContact(e.get("jid"))}))}function Rv(){bl.roster.on("add",(e=>{const t=bl.chatboxes.findWhere({jid:e.get("jid")});t?.setRosterContact(e.get("jid"))}))}function Dv(e,t){const n=$v({to:e,type:"unsubscribed"});t&&""!==t&&n.c("status").t(t),Vl.send(n)}function zv(e,t){const n=e.presence.get("show")||"offline",s=t.presence.get("show")||"offline";if(ao[n]===ao[s]){const n=e.getDisplayName().toLowerCase(),s=t.getDisplayName().toLowerCase();return n<s?-1:n>s?1:0}return ao[n]<ao[s]?-1:1}function Lv(e,t){const n={};n[bl.HEADER_UNREAD]=0,n[bl.HEADER_REQUESTING_CONTACTS]=1,n[bl.HEADER_CURRENT_CONTACTS]=2,n[bl.HEADER_UNGROUPED]=3,n[bl.HEADER_PENDING_CONTACTS]=4;const s=n,i=Object.keys(n),r=i.includes(e),o=i.includes(t);if(!r&&!o)return e.toLowerCase()<t.toLowerCase()?-1:e.toLowerCase()>t.toLowerCase()?1:0;if(r&&o)return s[e]<s[t]?-1:s[e]>s[t]?1:0;if(!r&&o){const e=bl.HEADER_CURRENT_CONTACTS;return s[e]<s[t]?-1:s[e]>s[t]?1:0}if(r&&!o){const t=bl.HEADER_CURRENT_CONTACTS;return s[e]<s[t]?-1:s[e]>s[t]?1:0}}const{Strophe:Pv,$iq:Fv,$pres:Uv}=Ah.env,Bv=dr.extend({idAttribute:"jid",defaults:{chat_state:void 0,groups:[],image:bl.DEFAULT_IMAGE,image_type:bl.DEFAULT_IMAGE_TYPE,num_unread:0,status:void 0},async initialize(e){this.initialized=Ao(),this.setPresence();const{jid:t}=e;this.set({...e,jid:Pv.getBareJidFromJid(t).toLowerCase(),user_id:Pv.getNodeFromJid(t)}),this.listenTo(this.presence,"change:show",(()=>Vl.trigger("contactPresenceChanged",this))),this.listenTo(this.presence,"change:show",(()=>this.trigger("presenceChanged"))),await Vl.trigger("rosterContactInitialized",this,{Synchronous:!0}),this.initialized.resolve()},setPresence(){const e=this.get("jid");this.presence=bl.presences.findWhere(e)||bl.presences.create({jid:e})},openChat(){const e=this.attributes;Vl.chats.open(e.jid,e,!0)},getFilterCriteria(){const e=this.get("nickname"),t=this.get("jid");let n=this.getDisplayName();return n=n.includes(t)?n:n.concat(` ${t}`),n=n.includes(e)?n:n.concat(` ${e}`),n.toLowerCase()},getDisplayName(){return this.get("nickname")?this.get("nickname"):this.get("jid")},getFullname(){return this.get("jid")},subscribe(e){return Vl.user.presence.send("subscribe",this.get("jid"),e),this.save("ask","subscribe"),this},ackSubscribe(){Vl.send(Uv({type:"subscribe",to:this.get("jid")}))},ackUnsubscribe(){Vl.send(Uv({type:"unsubscribe",to:this.get("jid")})),this.removeFromRoster(),this.destroy()},unauthorize(e){return Dv(this.get("jid"),e),this},authorize(e){const t=Uv({to:this.get("jid"),type:"subscribed"});return e&&""!==e&&t.c("status").t(e),Vl.send(t),this},removeFromRoster(){const e=Fv({type:"set"}).c("query",{xmlns:Pv.NS.ROSTER}).c("item",{jid:this.get("jid"),subscription:"remove"});return Vl.sendIQ(e)}}),qv=Bv,{Strophe:Hv,$iq:Gv,sizzle:Wv,u:Vv}=Ah.env,Jv=Fd.extend({model:qv,initialize(){const e=`roster.state-${bl.bare_jid}-${this.get("jid")}`;this.state=new dr({id:e,collapsed_groups:[]}),vc(this.state,e),this.state.fetch()},onConnected(){this.registerRosterHandler(),this.registerRosterXHandler()},registerRosterHandler(){bl.connection.addHandler((e=>(bl.roster.onRosterPush(e),!0)),Hv.NS.ROSTER,"iq","set")},registerRosterXHandler(){let e=0;bl.connection.addHandler((function(t){return window.setTimeout((function(){bl.connection.flush(),bl.roster.subscribeToSuggestedItems.bind(bl.roster)(t)}),e),e+=250*t.querySelectorAll("item").length,!0}),Hv.NS.ROSTERX,"message",null)},async fetchRosterContacts(){const e=await new Promise(((e,t)=>{this.fetch({add:!0,silent:!0,success:e,error:(e,n)=>t(n)})}));if(Vv.isErrorObject(e)&&(Yc.error(e),bl.session.save("roster_cached",!1),this.data.save("version",void 0)),!bl.session.get("roster_cached"))return bl.send_initial_presence=!0,bl.roster.fetchFromServer();Vl.trigger("cachedRoster",e)},subscribeToSuggestedItems:e=>(Array.from(e.querySelectorAll("item")).forEach((e=>{"add"===e.getAttribute("action")&&bl.roster.addAndSubscribe(e.getAttribute("jid"),bl.xmppstatus.getNickname()||bl.xmppstatus.getFullname())})),!0),isSelf:e=>Vv.isSameBareJID(e,bl.connection.jid),async addAndSubscribe(e,t,n,s,i){const r=await this.addContactToRoster(e,t,n,i);r instanceof bl.RosterContact&&r.subscribe(s)},sendContactAddIQ(e,t,n){t=t||null;const s=Gv({type:"set"}).c("query",{xmlns:Hv.NS.ROSTER}).c("item",{jid:e,name:t});return n.forEach((e=>s.c("group").t(e).up())),Vl.sendIQ(s)},async addContactToRoster(e,t,n,s){await Vl.waitUntil("rosterContactsFetched"),n=n||[];try{await this.sendContactAddIQ(e,t,n)}catch(n){const{__:s}=bl;return Yc.error(n),alert(s("Sorry, there was an error while trying to add %1$s as a contact.",t||e)),n}return this.create(Object.assign({ask:void 0,nickname:t,groups:n,jid:e,requesting:!1,subscription:"none"},s),{sort:!1})},async subscribeBack(e,t){const n=this.get(e);if(n instanceof bl.RosterContact)n.authorize().subscribe();else{const n=Wv(`nick[xmlns="${Hv.NS.NICK}"]`,t).pop()?.textContent||null,s=await this.addContactToRoster(e,n,[],{subscription:"from"});s instanceof bl.RosterContact&&s.authorize().subscribe()}},onRosterPush(e){const t=e.getAttribute("id"),n=e.getAttribute("from");if(n&&n!==bl.bare_jid)return void Yc.warn(`Ignoring roster illegitimate roster push message from ${e.getAttribute("from")}`);Vl.send(Gv({type:"result",id:t,from:bl.connection.jid}));const s=Wv(`query[xmlns="${Hv.NS.ROSTER}"]`,e).pop();this.data.save("version",s.getAttribute("ver"));const i=Wv("item",s);if(i.length>1)throw Yc.error(e),new Error('Roster push query may not contain more than one "item" element.');if(0===i.length)return Yc.warn(e),void Yc.warn('Received a roster push stanza without an "item" element.');this.updateContact(i.pop()),Vl.trigger("rosterPush",e)},rosterVersioningSupported(){return Vl.disco.stream.getFeature("ver","urn:xmpp:features:rosterver")&&this.data.get("version")},async fetchFromServer(){const e=Gv({type:"get",id:Vv.getUniqueId("roster")}).c("query",{xmlns:Hv.NS.ROSTER});this.rosterVersioningSupported()&&e.attrs({ver:this.data.get("version")});const t=await Vl.sendIQ(e,null,!1);if("result"===t.getAttribute("type")){const e=Wv(`query[xmlns="${Hv.NS.ROSTER}"]`,t).pop();if(e){const t=Wv("item",e);if(!this.data.get("version")&&this.models.length){const e=t.map((e=>e.getAttribute("jid")));this.forEach((t=>!t.get("requesting")&&!e.includes(t.get("jid"))&&t.destroy()))}t.forEach((e=>this.updateContact(e))),this.data.save("version",e.getAttribute("ver"))}}else if(!Vv.isServiceUnavailableError(t))return Yc.error(t),void Yc.error("Error while trying to fetch roster from the server");bl.session.save("roster_cached",!0),Vl.trigger("roster",t)},updateContact(e){const t=e.getAttribute("jid"),n=this.get(t),s=e.getAttribute("subscription");if("remove"===s)return n?.destroy();const i=e.getAttribute("ask"),r=e.getAttribute("name"),o=[...new Set(Wv("group",e).map((e=>e.textContent)))];n?n.save({subscription:s,ask:i,nickname:r,groups:o,requesting:null}):this.create({nickname:r,ask:i,groups:o,jid:t,subscription:s},{sort:!1})},createRequestingContact(e){const t={jid:Hv.getBareJidFromJid(e.getAttribute("from")),subscription:"none",ask:null,requesting:!0,nickname:Wv(`nick[xmlns="${Hv.NS.NICK}"]`,e).pop()?.textContent||null};Vl.trigger("contactRequest",this.create(t))},handleIncomingSubscription(e){const t=e.getAttribute("from"),n=Hv.getBareJidFromJid(t),s=this.get(n);if(!Vl.settings.get("allow_contact_requests")){const{__:e}=bl;Dv(t,e("This client does not allow presence subscriptions"))}Vl.settings.get("auto_subscribe")?s&&"to"===s.get("subscription")?s.authorize():this.subscribeBack(n,e):s?("none"!==s.get("subscription")||"subscribe"===s.get("ask"))&&s.authorize():this.createRequestingContact(e)},handleOwnPresence(e){const t=e.getAttribute("from"),n=Hv.getResourceFromJid(t),s=e.getAttribute("type");if(bl.connection.jid!==t&&"unavailable"!==s&&(!0===Vl.settings.get("synchronize_availability")||Vl.settings.get("synchronize_availability")===n)){const t=e.querySelector("show")?.textContent||"online";bl.xmppstatus.save({status:t},{silent:!0});const n=e.querySelector("status")?.textContent;n&&bl.xmppstatus.save({status_message:n})}bl.jid===t&&"unavailable"===s&&Vl.user.presence.send()},presenceHandler(e){const t=e.getAttribute("type");if("error"===t)return!0;const n=e.getAttribute("from"),s=Hv.getBareJidFromJid(n);if(this.isSelf(s))return this.handleOwnPresence(e);if(Wv(`query[xmlns="${Hv.NS.MUC}"]`,e).length)return;const i=this.get(s);if(i){const t=e.querySelector("status")?.textContent;i.get("status")!==t&&i.save({status:t})}if("subscribed"===t&&i)i.ackSubscribe();else if("unsubscribed"===t&&i)i.ackUnsubscribe();else{if("unsubscribe"===t)return;if("subscribe"===t)this.handleIncomingSubscription(e);else if("unavailable"===t&&i){const e=Hv.getResourceFromJid(n);i.presence.removeResource(e)}else i&&i.presence.addResource(e)}}}),Zv=Jv,{Strophe:Qv}=Ah.env,Kv={contacts:{async get(e){await Vl.waitUntil("rosterContactsFetched");const t=e=>bl.roster.get(Qv.getBareJidFromJid(e));if(void 0===e)e=bl.roster.pluck("jid");else if("string"==typeof e)return t(e);return e.map(t)},async add(e,t){if(await Vl.waitUntil("rosterContactsFetched"),"string"!=typeof e||!e.includes("@"))throw new TypeError("contacts.add: invalid jid");return bl.roster.addAndSubscribe(e,t)}}},{Strophe:Yv,dayjs:Xv,sizzle:ey}=Ah.env,ty=dr.extend({idAttribute:"name"}),ny=Fd.extend({model:ty}),sy=dr.extend({idAttribute:"jid",defaults:{show:"offline"},initialize(){this.resources=new ny;const e=`converse.identities-${this.get("jid")}`;vc(this.resources,e,"session"),this.listenTo(this.resources,"update",this.onResourcesChanged),this.listenTo(this.resources,"change",this.onResourcesChanged)},onResourcesChanged(){const e=this.getHighestPriorityResource(),t=e?.attributes?.show||"offline";this.get("show")!==t&&this.save({show:t})},getHighestPriorityResource(){return this.resources.sortBy((e=>`${e.get("priority")}-${e.get("timestamp")}`)).reverse()[0]},addResource(e){const t=e.getAttribute("from"),n=Yv.getResourceFromJid(t),s=ey(`delay[xmlns="${Yv.NS.DELAY}"]`,e).pop(),i=e.querySelector("priority")?.textContent,r=this.resources.get(n),o={name:n,priority:uv(parseInt(i,10))?0:parseInt(i,10),show:e.querySelector("show")?.textContent??"online",timestamp:s?Xv(s.getAttribute("stamp")).toISOString():(new Date).toISOString()};r?r.save(o):this.resources.create(o)},removeResource(e){const t=this.resources.get(e);t?.destroy()}}),iy=Fd.extend({model:sy});Ah.plugins.add("converse-roster",{dependencies:["converse-status"],initialize(){Vl.settings.extend({allow_contact_requests:!0,auto_subscribe:!1,synchronize_availability:!0}),Vl.promises.add(["cachedRoster","roster","rosterContactsFetched","rosterInitialized"]),Object.assign(bl.api,Kv);const{__:e}=bl;bl.HEADER_CURRENT_CONTACTS=e("My contacts"),bl.HEADER_PENDING_CONTACTS=e("Pending contacts"),bl.HEADER_REQUESTING_CONTACTS=e("Contact requests"),bl.HEADER_UNGROUPED=e("Ungrouped"),bl.HEADER_UNREAD=e("New messages"),bl.Presence=sy,bl.Presences=iy,bl.RosterContact=qv,bl.RosterContacts=Zv,Vl.listen.on("beforeTearDown",(()=>jv())),Vl.listen.on("chatBoxesInitialized",Mv),Vl.listen.on("clearSession",Iv),Vl.listen.on("presencesInitialized",Nv),Vl.listen.on("statusInitialized",Ov),Vl.listen.on("streamResumptionFailed",(()=>bl.session.set("roster_cached",!1))),Vl.waitUntil("rosterContactsFetched").then(Rv)}});const{Strophe:ry}=Ah.env,oy=Ah.env.utils;function ay(){return!(Vl.connection.isType("bosh")&&!bl.isTestEnv())&&Vl.disco.stream.getFeature("sm",ry.NS.SM)}function cy(e){if(!bl.session.get("smacks_enabled"))return!0;const t=parseInt(e.getAttribute("h"),10),n=bl.session.get("num_stanzas_handled_by_server"),s=t-n;if(s<0){const e=`New reported stanza count lower than previous. New: ${t} - Previous: ${n}`;Yc.error(e)}const i=bl.session.get("unacked_stanzas");if(s>i.length){const e=`Higher reported acknowledge count than unacknowledged stanzas. Reported Acknowledged Count: ${s} -Unacknowledged Stanza Count: ${i.length} -New: ${t} - Previous: ${n}`;Yc.error(e)}return bl.session.save({num_stanzas_handled_by_server:t,num_stanzas_since_last_ack:0,unacked_stanzas:i.slice(s)}),!0}function ly(){if(bl.session.get("smacks_enabled")){const e=bl.session.get("num_stanzas_handled"),t=oy.toStanza(`<a xmlns="${ry.NS.SM}" h="${e}"/>`);Vl.send(t)}return!0}function dy(e){if(bl.session.get("smacks_enabled")&&(oy.isTagEqual(e,"iq")||oy.isTagEqual(e,"presence")||oy.isTagEqual(e,"message"))){const e=bl.session.get("num_stanzas_handled");bl.session.save("num_stanzas_handled",e+1)}return!0}function uy(){bl.session.save({smacks_enabled:bl.session.get("smacks_enabled")||!1,num_stanzas_handled:bl.session.get("num_stanzas_handled")||0,num_stanzas_handled_by_server:bl.session.get("num_stanzas_handled_by_server")||0,num_stanzas_since_last_ack:bl.session.get("num_stanzas_since_last_ack")||0,unacked_stanzas:bl.session.get("unacked_stanzas")||[]})}function hy(){bl.session?.save({smacks_enabled:!1,num_stanzas_handled:0,num_stanzas_handled_by_server:0,num_stanzas_since_last_ack:0,unacked_stanzas:[]})}function my(e){const t={smacks_enabled:!0};return["1","true"].includes(e.getAttribute("resume"))&&(t.smacks_stream_id=e.getAttribute("id")),bl.session.save(t),!0}function fy(e){return e.querySelector("item-not-found")?Yc.warn("Could not resume previous SMACKS session, session id not found. A new session will be established."):(Yc.error("Failed to enable stream management"),Yc.error(e.outerHTML)),hy(),Vl.trigger("streamResumptionFailed"),!0}function gy(e){my(e),cy(e),function(){const e=bl.session.get("unacked_stanzas");bl.session.save("unacked_stanzas",[]),e.forEach((e=>Vl.send(e)))}(),bl.connection.do_bind=!1,bl.connection.authenticated=!0,bl.connection.restored=!0,bl.connection._changeConnectStatus(ry.Status.CONNECTED,null)}async function py(){if(Vl.settings.get("enable_smacks")&&!bl.session.get("smacks_enabled")&&await ay()){const e=Ao();bl.connection._addSysHandler((t=>e.resolve(my(t))),ry.NS.SM,"enabled"),bl.connection._addSysHandler((t=>e.resolve(fy(t))),ry.NS.SM,"failed");const t=Vl.connection.isType("websocket")||bl.isTestEnv(),n=oy.toStanza(`<enable xmlns="${ry.NS.SM}" resume="${t}"/>`);Vl.send(n),bl.connection.flush(),await e}}const vy=[];async function yy(){if(!Vl.settings.get("enable_smacks"))return;if(!await ay())return;const e=bl.connection;for(;vy.length;)e.deleteHandler(vy.pop());vy.push(e.addHandler(dy)),vy.push(e.addHandler(ly,ry.NS.SM,"r")),vy.push(e.addHandler(cy,ry.NS.SM,"a")),bl.session?.get("smacks_stream_id")?await async function(){const e=Ao();bl.connection._addSysHandler((t=>e.resolve(gy(t))),ry.NS.SM,"resumed"),bl.connection._addSysHandler((t=>e.resolve(fy(t))),ry.NS.SM,"failed");const t=bl.session.get("smacks_stream_id"),n=bl.session.get("num_stanzas_handled"),s=oy.toStanza(`<resume xmlns="${ry.NS.SM}" h="${n}" previd="${t}"/>`);Vl.send(s),bl.connection.flush(),await e}():hy()}function _y(e){if(bl.session){if(bl.session.get("smacks_enabled")&&(oy.isTagEqual(e,"iq")||oy.isTagEqual(e,"presence")||oy.isTagEqual(e,"message"))){const t=ry.serialize(e);bl.session.save("unacked_stanzas",(bl.session.get("unacked_stanzas")||[]).concat([t]));const n=Vl.settings.get("smacks_max_unacked_stanzas");if(n>0){const e=bl.session.get("num_stanzas_since_last_ack")+1;e%n==0&&Vl.send(oy.toStanza(`<r xmlns="${ry.NS.SM}"/>`)),bl.session.save({num_stanzas_since_last_ack:e})}}}else Yc.warn("No _converse.session!")}const{Strophe:by}=Ah.env;by.addNamespace("SM","urn:xmpp:sm:3"),Ah.plugins.add("converse-smacks",{initialize(){Vl.settings.extend({enable_smacks:!0,smacks_max_unacked_stanzas:5}),Vl.listen.on("afterResourceBinding",py),Vl.listen.on("beforeResourceBinding",yy),Vl.listen.on("send",_y),Vl.listen.on("userSessionInitialized",uy)}});const wy=dr.extend({idAttribute:"jid",defaults:{image:bl.DEFAULT_IMAGE,image_type:bl.DEFAULT_IMAGE_TYPE},set(e,t,n){let s;return"object"==typeof e?(s=e,n=t):(s={})[e]=t,"image"in s&&!s.image?(s.image=bl.DEFAULT_IMAGE,s.image_type=bl.DEFAULT_IMAGE_TYPE,dr.prototype.set.call(this,s,n)):dr.prototype.set.apply(this,arguments)},getDisplayName(){return this.get("nickname")||this.get("fullname")||this.get("jid")}}),Sy=wy,{Strophe:xy,$iq:Ey,u:Ay}=Ah.env;function Cy(e,t,n){const s=Ey(t?{type:e,to:t}:{type:e});return n?s.cnode(n):s.c("vCard",{xmlns:xy.NS.VCARD}),s}async function $y(e){let t;if(e instanceof bl.Message){if(["error","info"].includes(e.get("type")))return;t=e.get("from")}else t=e.get("jid");t?(await Vl.waitUntil("VCardsInitialized"),e.vcard=bl.vcards.get(t)||bl.vcards.create({jid:t}),e.vcard.on("change",(()=>e.trigger("vcard:change"))),e.trigger("vcard:add")):Yc.warn("Could not set VCard on model because no JID found!")}async function ky(e){await Vl.waitUntil("VCardsInitialized"),e.vcard=function(e){const t=e?.collection?.chatroom,n=e.get("nick");if(n&&t?.get("nick")===n)return bl.xmppstatus.vcard;{const t=e.get("jid")||e.get("from");return t?bl.vcards.get(t)||bl.vcards.create({jid:t}):void Yc.warn("Could not get VCard for occupant because no JID found!")}}(e),e.vcard&&(e.vcard.on("change",(()=>e.trigger("vcard:change"))),e.trigger("vcard:add"))}async function jy(e){["error","info"].includes(e.get("type"))||(await Vl.waitUntil("VCardsInitialized"),e.vcard=function(e){const t=e?.collection?.chatbox,n=xy.getResourceFromJid(e.get("from"));if(n&&t?.get("nick")===n)return bl.xmppstatus.vcard;{const t=e.occupant?.get("jid")||e.get("from");return t?bl.vcards.get(t)||bl.vcards.create({jid:t}):void Yc.warn(`Could not get VCard for message because no JID found! msgid: ${e.get("msgid")}`)}}(e),e.vcard&&(e.vcard.on("change",(()=>e.trigger("vcard:change"))),e.trigger("vcard:add")))}async function Ty(){bl.vcards=new bl.VCards;const e=`${bl.bare_jid}-converse.vcards`;vc(bl.vcards,e),await new Promise((e=>{bl.vcards.fetch({success:e,error:e},{silent:!0})}));const t=bl.vcards;if(bl.session){const e=bl.session.get("bare_jid"),n=bl.xmppstatus;n.vcard=t.get(e)||t.create({jid:e}),n.vcard&&(n.vcard.on("change",(()=>n.trigger("vcard:change"))),n.trigger("vcard:add"))}Vl.trigger("VCardsInitialized")}async function Iy(e){const t=xy.getBareJidFromJid(e)===bl.bare_jid?null:e;let n;try{n=await Vl.sendIQ(Cy("get",t))}catch(n){return{jid:e,stanza:n,vcard_error:(new Date).toISOString()}}return async function(e,t){const n=t.querySelector("vCard");let s={};if(null!==n&&(s={stanza:t,fullname:n.querySelector("FN")?.textContent,nickname:n.querySelector("NICKNAME")?.textContent,image:n.querySelector("PHOTO BINVAL")?.textContent,image_type:n.querySelector("PHOTO TYPE")?.textContent,url:n.querySelector("URL")?.textContent,role:n.querySelector("ROLE")?.textContent,email:n.querySelector("EMAIL USERID")?.textContent,vcard_updated:(new Date).toISOString(),vcard_error:void 0}),s.image){const e=Ay.base64ToArrayBuffer(s.image),t=await crypto.subtle.digest("SHA-1",e);s.image_hash=Ay.arrayBufferToHex(t)}return s}(0,n)}const{dayjs:Ny,u:Oy}=Ah.env,My={vcard:{async set(e,t){if(!e)throw Error("No jid provided for the VCard data");const n=document.createElement("div"),s=Oy.toStanza(`\n <vCard xmlns="vcard-temp">\n <FN>${t.fn}</FN>\n <NICKNAME>${t.nickname}</NICKNAME>\n <URL>${t.url}</URL>\n <ROLE>${t.role}</ROLE>\n <EMAIL><INTERNET/><PREF/><USERID>${t.email}</USERID></EMAIL>\n <PHOTO>\n <TYPE>${t.image_type}</TYPE>\n <BINVAL>${t.image}</BINVAL>\n </PHOTO>\n </vCard>`,n);let i;try{i=await Vl.sendIQ(Cy("set",e,s))}catch(e){throw e}return await Vl.vcard.update(e,!0),i},get(e,t){if("string"==typeof e)return Iy(e);const n=e.get("vcard_error"),s=n&&Ny(n).isSame(new Date,"day");if(t||!e.get("vcard_updated")&&!s){const t=e.get("jid");return t||Yc.error("No JID to get vcard for"),Iy(t)}return Promise.resolve({})},async update(e,t){const n=await this.get(e,t);(e="string"==typeof e?bl.vcards.get(e):e)?Object.keys(n).length&&(delete n.stanza,e.save(n)):Yc.error(`Could not find a VCard model for ${e}`)}}},{Strophe:Ry}=Ah.env;Ah.plugins.add("converse-vcard",{dependencies:["converse-status","converse-roster"],overrides:{XMPPStatus:{getNickname(){const{_converse:e}=this.__super__,t=this.__super__.getNickname.apply(this);return!t&&e.xmppstatus.vcard?e.xmppstatus.vcard.get("nickname"):t},getFullname(){const{_converse:e}=this.__super__,t=this.__super__.getFullname.apply(this);return!t&&e.xmppstatus.vcard?e.xmppstatus.vcard.get("fullname"):t}},RosterContact:{getDisplayName(){return!this.get("nickname")&&this.vcard?this.vcard.getDisplayName():this.__super__.getDisplayName.apply(this)},getFullname(){return this.vcard?this.vcard.get("fullname"):this.__super__.getFullname.apply(this)}}},initialize(){Vl.promises.add("VCardsInitialized"),bl.VCard=Sy,bl.VCards=Fd.extend({model:bl.VCard,initialize(){this.on("add",(e=>e.get("jid")&&Vl.vcard.update(e)))}}),Vl.listen.on("chatRoomInitialized",(e=>{$y(e),e.occupants.forEach(ky),e.listenTo(e.occupants,"add",ky),e.listenTo(e.occupants,"change:image_hash",(e=>function(e){const t=e.get("image_hash"),n=[];e.get("jid")&&n.push(bl.vcards.get(e.get("jid"))),n.push(bl.vcards.get(e.get("from"))),n.forEach((e=>t&&e?.get("image_hash")!==t&&Vl.vcard.update(e,!0)))}(e)))})),Vl.listen.on("chatBoxInitialized",(e=>$y(e))),Vl.listen.on("chatRoomMessageInitialized",(e=>jy(e))),Vl.listen.on("addClientFeatures",(()=>Vl.disco.own.features.add(Ry.NS.VCARD))),Vl.listen.on("clearSession",(()=>{Mc()&&(Vl.promises.add("VCardsInitialized"),bl.vcards&&(bl.vcards.clearStore(),delete bl.vcards))})),Vl.listen.on("messageInitialized",(e=>$y(e))),Vl.listen.on("rosterContactInitialized",(e=>$y(e))),Vl.listen.on("statusInitialized",Ty),Object.assign(bl.api,My)}});var Dy=n(2107),zy=n.n(Dy);const{dayjs:Ly}=Ah.env;let Py;function Fy(e,t){return"string"==typeof e&&t.includes(e)}function Uy(e,t){if("en"===e||t(e))return e;const{languages:n}=window.navigator;let s;for(let e=0;e<n.length&&!s;e++)s=By(n[e],t);return s||"en"}function By(e,t){if(t(e))return e;var n=e.split("-")[0];return n!==e&&t(n)?n:void 0}Object.assign(_o,{getLocale:(e,t)=>Uy(e,(e=>Fy(e,t))),translate(e){if(!Py)return zy().sprintf.apply(zy(),arguments);const t=Py.translate(e);return arguments.length>1?t.fetch.apply(t,[].slice.call(arguments,1)):t.fetch()},async initialize(){if(bl.isTestEnv())bl.locale="en";else try{const e=Vl.settings.get("i18n");bl.locale=_o.getLocale(e,Vl.settings.get("locales")),Py=await async function(){const{api:e,locale:t}=bl,s=function(e){const t=e.toLowerCase().replace("_","-");return"ug"===t?"ug-cn":t}(t);if(!Fy(t,e.settings.get("locales"))||"en"===t)return;const{default:i}=await n(6404)(`./${t}/LC_MESSAGES/converse.po`);return await n(3683)(`./${s}.js`),Ly.locale(Uy(s,(e=>Ly.locale(e)))),new(zy())(i)}()}catch(e){Yc.fatal(e.message),bl.locale="en"}},__(){return _o.translate(...arguments)}});const qy=_o.__,Hy={};Vl.elements={registry:Hy,define(e,t){this.registry[e]=t},register(){Object.keys(Hy).forEach((e=>{customElements.get(e)||customElements.define(e,Hy[e])}))}};class Gy extends xh{createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.initialize?.()}disconnectedCallback(){super.disconnectedCallback(),this.stopListening()}}Object.assign(Gy.prototype,Tn);const Wy=["converse-adhoc-views","converse-bookmark-views","converse-chatboxviews","converse-chatview","converse-controlbox","converse-dragresize","converse-fullscreen","converse-headlines-view","converse-mam-views","converse-minimize","converse-modal","converse-muc-views","converse-notification","converse-omemo","converse-profile","converse-push","converse-register","converse-roomslist","converse-rootview","converse-rosterview","converse-singleton"];var Vy=n(3379),Jy=n.n(Vy),Zy=n(7795),Qy=n.n(Zy),Ky=n(569),Yy=n.n(Ky),Xy=n(3565),e_=n.n(Xy),t_=n(9216),n_=n.n(t_),s_=n(4589),i_=n.n(s_),r_=n(1815),o_={};o_.styleTagTransform=i_(),o_.setAttributes=e_(),o_.insert=Yy().bind(null,"head"),o_.domAPI=Qy(),o_.insertStyleElement=n_();Jy()(r_.Z,o_);r_.Z&&r_.Z.locals&&r_.Z.locals;var a_=n(3170),c_=n.n(a_);const l_=e=>nh`<div class="alert ${e.type}" role="alert"><p>${e.message}</p></div>`,d_=/^\s*</,u_=("undefined"!=typeof Element&&Element.prototype,function(e){this.cid=jn("view"),this._domEvents=[],this.preinitialize.apply(this,arguments),Be(this,lr(e,m_)),this._ensureElement(),this.initialize.apply(this,arguments)});u_.extend=Bt;const h_=/^(\S+)\s*(.*)$/,m_=["model","collection","el","id","attributes","className","tagName","events"];Object.assign(u_.prototype,Tn,{tagName:"div",$:function(e){return this.el.querySelectorAll(e)},preinitialize:function(){},initialize:function(){},render:function(){return _(this.beforeRender)&&this.beforeRender(),_(this.toHTML)&&bh(this.toHTML(),this.el),_(this.afterRender)&&this.afterRender(),this},remove:function(){return this._removeElement(),this.stopListening(),this},_removeElement:function(){this.undelegateEvents(),this.el.parentNode&&this.el.parentNode.removeChild(this.el)},setElement:function(e){return this.undelegateEvents(),this._setElement(e),this.delegateEvents(),this},_setElement:function(e){if("string"==typeof e)if(d_.test(e)){const t=document.createElement("div");t.innerHTML=e,this.el=t.firstChild}else this.el=document.querySelector(e);else e&&!ff(e)&&e.length?this.el=e[0]:this.el=e},delegateEvents:function(e){if(e||(e=Ft(this,"events")),!e)return this;this.undelegateEvents();for(const t in e){let n=e[t];if(_(n)||(n=this[n]),!n)continue;const s=t.match(h_);this.delegate(s[1],s[2],n.bind(this))}return this},delegate:function(e,t,n){const s=this.el;if(!s)return this;if("function"==typeof t&&(n=t,t=null),-1!==["focus","blur"].indexOf(e)){const s=this.el.querySelectorAll(t);for(let t=0,i=s.length;t<i;t++){const i=s[t];i.addEventListener(e,n,!1),this._domEvents.push({el:i,eventName:e,handler:n})}return n}const i=t?function(e){let i=e.target||e.srcElement;for(;i&&i!=s;i=i.parentNode)i.matches(t)&&(e.delegateTarget=i,n(e))}:n;return this.el.addEventListener(e,i,!1),this._domEvents.push({el:this.el,eventName:e,handler:i,listener:n,selector:t}),this},undelegateEvents:function(){if(this.el){for(let e=0,t=this._domEvents.length;e<t;e++){const t=this._domEvents[e];t.el.removeEventListener(t.eventName,t.handler,!1)}this._domEvents.length=0}return this},undelegate:function(e,t,n){if("function"==typeof t&&(n=t,t=null),this.el){const s=this._domEvents.slice();let i=s.length;for(;i--;){const r=s[i];!(r.eventName!==e||n&&r.listener!==n||t&&r.selector!==t)&&(r.el.removeEventListener(r.eventName,r.handler,!1),this._domEvents.splice(i,1))}}return this},_createElement:function(e){return document.createElement(e)},_ensureElement:function(){if(this.el)this.setElement(Ft(this,"el"));else{const e=Be({},Ft(this,"attributes"));this.id&&(e.id=Ft(this,"id")),this.className&&(e.class=Ft(this,"className")),this.setElement(this._createElement(Ft(this,"tagName"))),this._setAttributes(e)}},_setAttributes:function(e){for(const t in e)t in this.el?this.el[t]=e[t]:this.el.setAttribute(t,e[t])}});const f_=(e,t)=>nh`<audio controls src="${e}"></audio>${t?"":nh`<a target="_blank" rel="noopener" href="${e}">${e}</a>`}`,g_=(e,t)=>{const n=qy('Download file "%1$s"',t);return nh`<a target="_blank" rel="noopener" href="${e}">${n}</a>`},p_=e=>nh`
<div class="form-group">
${"hidden"!==e.type?nh`<label for="${e.id}">${e.label}</label>`:""}
<!-- This is a hack to prevent Chrome from auto-filling the username in
any of the other input fields in the MUC configuration form. -->
${"password"===e.type&&e.fixed_username?nh`
<input class="hidden-username" type="text" autocomplete="username" value="${e.fixed_username}"></input>
`:""}
<input
autocomplete="${e.autocomplete||""}"
class="form-control"
id="${e.id}"
name="${e.name}"
placeholder="${e.placeholder||""}"
type="${e.type}"
value="${e.value||""}"
?required=${e.required} />
</div>`,v_=e=>nh`
<div class="form-group">
<label for="${e.id}">${e.label}</label>
<select class="form-control" id="${e.id}" name="${e.name}" ?multiple="${e.multiple}">
${e.options?.map((e=>(e=>nh`<option value="${e.value}" ?selected="${e.selected}">${e.label}</option>`)(e)))}
</select>
</div>`,y_=e=>nh`
<label>${e.label}
<a class="form-url" target="_blank" rel="noopener" href="${e.value}">${e.value}</a>
</label>`,__=e=>nh`
<div class="form-group">
${e.label?nh`<label>${e.label}</label>`:""}
<div class="input-group">
<input name="${e.name}"
class="form-control"
type="${e.type}"
value="${e.value||""}"
?required="${e.required}" />
<div class="input-group-append">
<div class="input-group-text" title="${e.domain}">${e.domain}</div>
</div>
</div>
</div>`;function 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`
<a target="_blank"
rel="noopener"
@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="hidden",e.setAttribute("data-slider-marker",requestAnimationFrame((function t(){a-=r/o,a>0?(e.style.height=a+"px",e.setAttribute("data-slider-marker",requestAnimationFrame(t).toString())):(e.removeAttribute("data-slider-marker"),e.classList.add("collapsed"),e.style.height="",n(e))})).toString())}))}function H_(e,t){e.classList.remove("visible"),t?.()}Zc.calculateElementHeight=function(e){return Array.from(e.children).reduce(((e,t)=>e+t.offsetHeight),0)},Zc.getNextElement=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"*",n=e.nextElementSibling;for(;null!==n&&!x_.matchesSelector(n,t);)n=n.nextElementSibling;return n},Zc.getPreviousElement=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"*",n=e.previousElementSibling;for(;null!==n&&!x_.matchesSelector(n,t);)n=n.previousElementSibling;return n},Zc.getFirstChildElement=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"*",n=e.firstElementChild;for(;null!==n&&!x_.matchesSelector(n,t);)n=n.nextElementSibling;return n},Zc.getLastChildElement=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"*",n=e.lastElementChild;for(;null!==n&&!x_.matchesSelector(n,t);)n=n.previousElementSibling;return n},Zc.toggleClass=function(e,t){Zc.hasClass(e,t)?L_(e,t):z_(e,t)},Zc.getElementFromTemplateResult=function(e){const t=document.createElement("div");return bh(e,t),t.firstElementChild},Zc.showElement=e=>{L_("collapsed",e),L_("hidden",e)},Zc.hideElement=function(e){return e instanceof Element&&e.classList.add("hidden"),e},Zc.nextUntil=function(e,t){const n=[];let s=e.nextElementSibling;for(;null!==s&&!s.matches(t);)n.push(s),s=s.nextElementSibling;return n},Zc.unescapeHTML=function(e){var t=document.createElement("div");return t.innerHTML=e,t.innerText},Zc.escapeHTML=function(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")},Zc.slideInAllElements=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:300;return Promise.all(Array.from(e).map((e=>Zc.slideIn(e,t))))},Zc.slideToggleElement=function(e,t){return Zc.hasClass("collapsed",e)||Zc.hasClass("hidden",e)?Zc.slideOut(e,t):Zc.slideIn(e,t)},Zc.isInDOM=function(e){return document.querySelector("body").contains(e)},Zc.isVisible=function(e){return null!==e&&(!Zc.hasClass("hidden",e)&&(e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0))},Zc.fadeIn=function(e,t){if(e||Yc.warn("An element needs to be passed in to fadeIn"),window.converse_disable_effects)return e.classList.remove("hidden"),H_(e,t);Zc.hasClass("hidden",e)?(e.classList.add("visible"),e.classList.remove("hidden"),e.addEventListener("webkitAnimationEnd",(()=>H_(e,t))),e.addEventListener("animationend",(()=>H_(e,t))),e.addEventListener("oanimationend",(()=>H_(e,t)))):H_(e,t)},Zc.xForm2TemplateResult=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("list-single"===e.getAttribute("type")||"list-multi"===e.getAttribute("type")){const t=Zc.queryChildren(e,"value").map((e=>e?.textContent)),n=Zc.queryChildren(e,"option").map((n=>{const s=n.querySelector("value")?.textContent;return{value:s,label:n.getAttribute("label"),selected:t.includes(s),required:!!e.querySelector("required")}}));return v_({options:n,id:Zc.getUniqueId(),label:e.getAttribute("label"),multiple:"list-multi"===e.getAttribute("type"),name:e.getAttribute("var"),required:!!e.querySelector("required")})}if("fixed"===e.getAttribute("type")){const t=e.querySelector("value")?.textContent;return(e=>nh`<p class="form-help">${e.text}</p>`)({text:t})}if("jid-multi"===e.getAttribute("type"))return(e=>{const t=Zc.getUniqueId();return nh`
<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>
`})({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`
<fieldset class="form-group">
<input id="${e.id}" name="${e.name}" type="checkbox" ?checked=${e.checked} ?required=${e.required} />
<label class="form-check-label" for="${e.id}">${e.label}</label>
</fieldset>`)({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`
<fieldset class="form-group">
${e.label?nh`<label>${e.label}</label>`:""}
<img src="data:${e.type};base64,${e.data}">
<input name="${e.name}" type="text" ?required="${e.required}" />
</fieldset>
`)({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.parentNode)i.matches(t)&&(e.delegateTarget=i,n(e))}:n;return this.addEventListener(e,i,!1),this._domEvents.push({el:this,eventName:e,handler:i,listener:n,selector:t}),this}undelegateEvents(){if(this){for(let e=0,t=this._domEvents.length;e<t;e++){const t=this._domEvents[e];t.el.removeEventListener(t.eventName,t.handler,!1)}this._domEvents.length=0}return this}undelegate(e,t,n){if("function"==typeof t&&(n=t,t=null),this){const s=this._domEvents.slice();let i=s.length;for(;i--;){const r=s[i];!(r.eventName!==e||n&&r.listener!==n||t&&r.selector!==t)&&(r.el.removeEventListener(r.eventName,r.handler,!1),this._domEvents.splice(i,1))}}return this}}Object.assign(eb.prototype,Tn);const tb=class extends eb{constructor(e){super(),this.className="modal",this.initialized=Ao(),Object.assign(this,e),setTimeout((()=>this.insertIntoDOM())),this.addEventListener("hide.bs.modal",(()=>this.onHide()),!1)}initialize(){this.modal=new(c_().Modal)(this,{backdrop:!0,keyboard:!0}),this.initialized.resolve(),this.render()}toHTML(){return(e=>{const t=e.model?.get("alert"),n=e.model?.get("level")??"";return nh`
<div class="modal-dialog" role="document" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-content">
<div class="modal-header ${n}">
<h5 class="modal-title">${e.getModalTitle()}</h5>
${K_}
</div>
<div class="modal-body">
<span class="modal-alert">
${t?l_({type:`alert-${t.type}`,message:t.message}):""}
</span>
${e.renderModal?.()??""}
</div>
${e.renderModalFooter?.()??nh`<div class="modal-footer">${Q_}</div>`}
</div>
</div>
`})(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`
<div class="modal-body">
<span class="modal-alert"></span>
${e.messages.map((e=>nh`<p>${e}</p>`))}
</div>`)(this.model.toJSON())}getModalTitle(){return this.model.get("title")}});const nb=e=>nh`
<form class="converse-form converse-form--modal confirm" action="#" @submit=${t=>e.onConfimation(t)}>
<div class="form-group">
${e.model.get("messages")?.map((e=>nh`<p>${e}</p>`))}
</div>
${e.model.get("fields")?.map((e=>(e=>nh`
<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">
<button type="submit" class="btn btn-primary">${qy("OK")}</button>
<input type="button" class="btn btn-secondary" data-dismiss="modal" value="${qy("Cancel")}"/>
</div>
</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(){return this.toString()}},gb=Ah.env.utils;class pb{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.suggestions=[],this.is_opened=!1,gb.hasClass("suggestion-box",e)?this.container=e:this.container=e.querySelector(".suggestion-box"),this.input=this.container.querySelector(".suggestion-box__input"),this.input.setAttribute("aria-autocomplete","list"),this.ul=this.container.querySelector(".suggestion-box__results"),this.status=this.container.querySelector(".suggestion-box__additions"),Object.assign(this,{match_current_word:!1,ac_triggers:[],include_triggers:[],min_chars:2,max_items:10,auto_evaluate:!0,auto_first:!1,data:e=>e,filter:db,sort:!1!==t.sort&&hb,item:mb},t),this.index=-1,this.bindEvents(),this.input.hasAttribute("list")?(this.list="#"+this.input.getAttribute("list"),this.input.removeAttribute("list")):this.list=this.input.getAttribute("data-list")||t.list||[]}bindEvents(){const e={blur:()=>this.close({reason:"blur"})};this.auto_evaluate&&(e.input=e=>this.evaluate(e)),this._events={input:e,form:{submit:()=>this.close({reason:"submit"})},ul:{mousedown:e=>this.onMouseDown(e),mouseover:e=>this.onMouseOver(e)}},lb.bind(this.input,this._events.input),lb.bind(this.input.form,this._events.form),lb.bind(this.ul,this._events.ul)}set list(e){if(Array.isArray(e)||"function"==typeof e)this._list=e;else if("string"==typeof e&&e.includes(","))this._list=e.split(/\s*,\s*/);else{const t=lb.getElement(e)?.children||[];this._list=Array.from(t).filter((e=>!e.disabled)).map((e=>{const t=e.textContent.trim(),n=e.value||t,s=e.label||t;return""!==n?{label:s,value:n}:null})).filter((e=>e))}document.activeElement===this.input&&this.evaluate()}get list(){return this._list}get selected(){return this.index>-1}get opened(){return this.is_opened}close(e){this.opened&&(this.ul.setAttribute("hidden",""),this.is_opened=!1,this.index=-1,this.trigger("suggestion-box-close",e||{}))}insertValue(e){this.match_current_word?gb.replaceCurrentWord(this.input,e.value):this.input.value=e.value}open(){this.ul.removeAttribute("hidden"),this.is_opened=!0,this.auto_first&&-1===this.index&&this.goto(0),this.trigger("suggestion-box-open")}destroy(){lb.unbind(this.input,this._events.input),lb.unbind(this.input.form,this._events.form),this.input.removeAttribute("aria-autocomplete")}next(){const e=this.ul.children.length;this.goto(this.index<e-1?this.index+1:e?0:-1)}previous(){const e=this.ul.children.length,t=this.index-1;this.goto(this.selected&&-1!==t?t:e-1)}goto(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const n=this.ul.children;this.selected&&n[this.index].setAttribute("aria-selected","false"),this.index=e,e>-1&&n.length>0&&(n[e].setAttribute("aria-selected","true"),n[e].focus(),this.status.textContent=n[e].textContent,t&&(this.ul.scrollTop=n[e].offsetTop-this.ul.clientHeight+n[e].clientHeight),this.trigger("suggestion-box-highlight",{text:this.suggestions[this.index]}))}select(e){if(e?this.index=gb.siblingIndex(e):e=this.ul.children[this.index],e){const e=this.suggestions[this.index];this.insertValue(e),this.close({reason:"select"}),this.auto_completing=!1,this.trigger("suggestion-box-selectcomplete",{text:e})}}onMouseOver(e){const t=gb.ancestor(e.target,"li");if(t){const e=Array.prototype.slice.call(this.ul.children).indexOf(t);this.goto(e,!1)}}onMouseDown(e){if(0!==e.button)return;const t=gb.ancestor(e.target,"li");t&&(e.preventDefault(),this.select(t,e.target))}onKeyDown(e){if(this.opened){if([Ah.keycodes.ENTER,Ah.keycodes.TAB].includes(e.keyCode)&&this.selected)return e.preventDefault(),e.stopPropagation(),this.select(),!0;if(e.keyCode===Ah.keycodes.ESCAPE)return this.close({reason:"esc"}),!0;if([Ah.keycodes.UP_ARROW,Ah.keycodes.DOWN_ARROW].includes(e.keyCode))return e.preventDefault(),e.stopPropagation(),this[e.keyCode===Ah.keycodes.UP_ARROW?"previous":"next"](),!0}if(![Ah.keycodes.SHIFT,Ah.keycodes.META,Ah.keycodes.META_RIGHT,Ah.keycodes.ESCAPE,Ah.keycodes.ALT].includes(e.keyCode))if(this.ac_triggers.includes(e.key))"Tab"===e.key&&e.preventDefault(),this.auto_completing=!0;else if("Backspace"===e.key){const t=gb.getCurrentWord(e.target,e.target.selectionEnd-1);lb.isMention(t,this.ac_triggers)&&(this.auto_completing=!0)}}async evaluate(e){const t=this.selected&&e&&(e.keyCode===Ah.keycodes.UP_ARROW||e.keyCode===Ah.keycodes.DOWN_ARROW);if(!this.auto_evaluate&&!this.auto_completing||t)return;let n=this.match_current_word?gb.getCurrentWord(this.input):this.input.value;const s=lb.isMention(n,this.ac_triggers);s&&!this.include_triggers.includes(e.key)&&(n=gb.isMentionBoundary(n[0])?n.slice("2"):n.slice("1"));const i=n.length&&n.length>=this.min_chars;if(s||i){this.auto_completing=!0;const e="function"==typeof this._list?await this._list(n):this._list;if(0===e.length||!this.auto_completing)return void this.close({reason:"nomatches"});this.index=-1,this.ul.innerHTML="",this.suggestions=e.map((e=>new fb(this.data(e,n),n))).filter((e=>this.filter(e,n))),!1!==this.sort&&(this.suggestions=this.suggestions.sort(this.sort)),this.suggestions=this.suggestions.slice(0,this.max_items),this.suggestions.forEach((e=>this.ul.appendChild(this.item(e,n)))),0===this.ul.children.length?this.close({reason:"nomatches"}):this.open()}else this.close({reason:"nomatches"}),s||(this.auto_completing=!1)}}Object.assign(pb.prototype,Tn);const vb=pb;Vl.elements.define("converse-autocomplete",class extends Gy{static get properties(){return{position:{type:String},autofocus:{type:Boolean},getAutoCompleteList:{type:Function},list:{type:Array},auto_evaluate:{type:Boolean},auto_first:{type:Boolean},filter:{type:String},include_triggers:{type:String},min_chars:{type:Number},name:{type:String},placeholder:{type:String},triggers:{type:String},required:{type:Boolean}}}constructor(){super(),this.position="above",this.auto_evaluate=!0,this.auto_first=!1,this.filter="contains",this.include_triggers="",this.match_current_word=!1,this.max_items=10,this.min_chars=1,this.triggers=""}render(){const e=`suggestion-box__results--${this.position}`;return nh`
<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>
`}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`
<li class="room-item list-group-item">
<div class="available-chatroom d-flex flex-row">
<a class="open-room available-room w-100"
@click=${t=>e.toggleCommandForm(t)}
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>
${t.node===e.showform?((e,t)=>{const n=qy("Cancel");return nh`
<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" -->
<form>
${t.alert?nh`<div class="alert alert-${t.alert_type}" role="alert">${t.alert}</div>`:""}
<fieldset class="form-group">
<input type="hidden" name="command_node" value="${t.node}"/>
<input type="hidden" name="command_jid" value="${t.jid}"/>
<p class="form-instructions">${t.instructions}</p>
${t.fields}
</fieldset>
<fieldset>
${t.actions.map((t=>nh`<input data-action="${t}"
@click=${t=>e.executeAction(t)}
type="button"
class="btn btn-primary"
value="${bb[t]}">`))}<input type="button"
class="btn btn-secondary button-cancel"
value="${n}"
@click=${t=>e.cancel(t)}>
</fieldset>
</form>
</span>
`})(e,t):""}
</li>
`,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`
<svg xmlns="http://www.w3.org/2000/svg" class="avatar ${e.classes}" width="${e.width}" height="${e.height}">
<image width="${e.width}" height="${e.height}" preserveAspectRatio="xMidYMid meet" href="${t=e.image,n=e.image_type,t.startsWith("data:")?t:`data:${n};base64,${t}`}"/>
</svg>`:"";var t,n};var 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<t.length&&!(e>this._$C_t);e++){const o=t[e];if(!Hb(o))return this._$C_t=e,o;e<s&&o===n[e]||(this._$C_t=Gb,s=0,Promise.resolve(o).then((async e=>{for(;r.get();)await r.get();const t=i.deref();if(void 0!==t){const n=t._$Cwt.indexOf(o);n>-1&&n<t._$C_t&&(t._$C_t=n,t.setValue(e))}})))}return sh}disconnected(){this._$Cq.disconnect(),this._$CK.pause()}reconnected(){this._$Cq.reconnect(this),this._$CK.resume()}}),{u:Vb}=Ah.env;function Jb(e){return"moderator"===e?qy("Moderators are privileged users who can change the roles of other users (except those with admin or owner affiliations."):"participant"===e?qy("The default role, implies that you can read and write messages."):"visitor"==e?qy("Visitors aren't allowed to write messages in a moderated multi-user chat."):void 0}function Zb(e){return"owner"===e?qy("Owner is the highest affiliation. Owners can modify roles and affiliations of all other users."):"admin"===e?qy("Admin is the 2nd highest affiliation. Admins can modify roles and affiliations of all other users except owners."):"outcast"===e?qy('To ban a user, you give them the affiliation of "outcast".'):void 0}Vl.elements.define("converse-muc-occupant-modal",class extends tb{constructor(){super(),this.addEventListener("affiliationChanged",(()=>this.alert(qy("Affiliation changed")))),this.addEventListener("roleChanged",(()=>this.alert(qy("role changed"))))}initialize(){super.initialize();const e=this.model??this.message;this.listenTo(e,"change",(()=>this.render())),Vl.trigger("occupantModalInitialized",{model:this.model,message:this.message})}getVcard(){const e=this.model??this.message;if(e.vcard)return e.vcard;const t=e?.get("jid")||e?.get("from");return t?bl.vcards.get(t):null}renderModal(){return(e=>{const t=e.model??e.message,n=t?.get("jid"),s=e.getVcard(),i=t.get("nick"),r=t.get("occupant_id"),o=e.model?.get("role"),a=e.model?.get("affiliation"),c=e.model?.get("hats")?.length?e.model.get("hats"):null,l=e.model.collection.chatroom,d=l.getAllowedCommands().includes("modtools"),u=qy("Add to Contacts"),h=l.features.get("nonanonymous")||"moderator"===l.getOwnRole(),m=n!=bl.bare_jid,f=Vl.contacts.get(n).then((e=>!e&&m&&h)).then((t=>t?nh`<li><button class="btn btn-primary" type="button" @click=${()=>e.addToContacts()}>${u}</button></li>`:""));return nh`
<div class="row">
<div class="col-auto">
<converse-avatar
class="avatar modal-avatar"
.data=${s?.attributes}
nonce=${s?.get("vcard_updated")}
height="120" width="120"></converse-avatar>
</div>
<div class="col">
<ul class="occupant-details">
<li>
${i?nh`<div class="row"><strong>${qy("Nickname")}:</strong></div><div class="row">${i}</div>`:""}
</li>
<li>
${n?nh`<div class="row"><strong>${qy("XMPP Address")}:</strong></div><div class="row">${n}</div>`:""}
</li>
<li>
<div class="row"><strong>${qy("Affiliation")}:</strong></div>
<div class="row">${a}&nbsp;
${d?nh`
<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>
${e.show_affiliation_form?nh`<converse-muc-affiliation-form jid=${n} .muc=${l} affiliation=${a}></converse-muc-affiliation-form>`:""}`:""}
</div>
</li>
<li>
<div class="row"><strong>${qy("Role")}:</strong></div>
<div class="row">${o}&nbsp;
${d&&o?nh`
<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>
${e.show_role_form?nh`<converse-muc-role-form jid=${n} .muc=${l} role=${o}></converse-muc-role-form>`:""}`:""}
</div>
</li>
<li>
${c?nh`<div class="row"><strong>${qy("Hats")}:</strong></div><div class="row">${c}</div>`:""}
</li>
<li>
${r?nh`<div class="row"><strong>${qy("Occupant Id")}:</strong></div><div class="row">${r}</div>`:""}
</li>
${Wb(f,"")}
</ul>
</div>
</div>
`})(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`
<li class="list-group-item" data-nick="${t.item.nick}">
<ul class="list-group">
<li class="list-group-item active">
<div><strong>JID:</strong> ${t.item.jid}</div>
</li>
<li class="list-group-item">
<div><strong>Nickname:</strong> ${t.item.nick}</div>
</li>
<li class="list-group-item">
<div><strong>Role:</strong> ${t.item.role} ${t.assignable_roles.length?(e=>nh`
<a href="#" data-form="converse-muc-role-form" class="toggle-form right" color="var(--subdued-color)" @click=${e.toggleForm}>
<converse-icon class="fa fa-wrench" size="1em"></converse-icon>
</a>`)(t):""}</div>
${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>`:""}
</li>
</ul>
</li>
`,Kb=(e,t)=>nh`
<li class="list-group-item" data-nick="${t.item.nick}">
<ul class="list-group">
<li class="list-group-item active">
<div><strong>JID:</strong> ${t.item.jid}</div>
</li>
<li class="list-group-item">
<div><strong>Nickname:</strong> ${t.item.nick}</div>
</li>
<li class="list-group-item">
<div><strong>Affiliation:</strong> ${t.item.affiliation} ${t.assignable_affiliations.length?(e=>nh`
<a href="#" data-form="converse-muc-affiliation-form" class="toggle-form right" color="var(--subdued-color)" @click=${e.toggleForm}>
<converse-icon class="fa fa-wrench" size="1em"></converse-icon>
</a>`)(t):""}</div>
${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>`:""}
</li>
</ul>
</li>
`,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`
<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>
`)(t):""}
<div class="tab-content">
${t.queryable_affiliations.length?nh`
<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>
<div class="form-group">
<label for="affiliation">
<strong>${n}:</strong>
</label>
<div class="row">
<div class="col">
<select class="custom-select select-affiliation" name="affiliation">
${t.queryable_affiliations.map((e=>(e=>nh`
<option value="${e.item||""}"
?selected=${e.item===e.affiliation}
title="${Zb(e.item)}">${e.item}</option>
`)(Object.assign({item:e},t))))}
</select>
</div>
<div class="col">
<input type="submit" class="btn btn-primary" name="users_with_affiliation" value="${a}"/>
</div>
</div>
<div class="row">
<div class="col mt-3">
${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}"/>`:""}
</div>
</div>
${Zb(t.affiliation)?nh`<div class="row"><div class="col pt-2"><p class="helptext pb-3">${Zb(t.affiliation)}</p></div></div>`:""}
</div>
</form>
<div class="scrollable-container">
<ul class="list-group list-group--users">
${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>`:""}
${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)):""))}
</ul>
</div>
</div>`:""}
${t.queryable_roles.length?nh`
<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>
<div class="form-group">
<label for="role"><strong>${o}:</strong></label>
<div class="row">
<div class="col">
<select class="custom-select select-role" name="role">
${t.queryable_roles.map((e=>(e=>nh`
<option value="${e.item||""}"
?selected=${e.item===e.role}
title="${Jb(e.item)}">${e.item}</option>
`)(Object.assign({item:e},t))))}
</select>
</div>
<div class="col">
<input type="submit" class="btn btn-primary" name="users_with_role" value="${a}"/>
</div>
</div>
<div class="row">
<div class="col mt-3">
${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}"/>`:""}
</div>
</div>
${Jb(t.role)?nh`<div class="row"><div class="col pt-2"><p class="helptext pb-3">${Jb(t.role)}</p></div></div>`:""}
</div>
</form>
<div class="scrollable-container">
<ul class="list-group list-group--users">
${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>`:""}
${(t.users_with_role||[]).map((n=>n.nick.match(t.roles_filter)?Qb(e,Object.assign({item:n},t)):""))}
</ul>
</div>
</div>`:""}
</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} affiliation=${this.affiliation}></converse-modtools>`}getModalTitle(){return qy("Moderator Tools")}});const{Strophe:nw,u:sw}=Ah.env,iw={admin:"admin",ban:"outcast",member:"member",owner:"owner",revoke:"none"},rw={deop:"participant",kick:"none",mute:"visitor",op:"moderator",voice:"participant"};function ow(e){let{contact:t,jid:n,reason:s}=e;return s?Vl.confirm(qy('%1$s has invited you to join a groupchat: %2$s, and left the following reason: "%3$s"',t,n,s)):Vl.confirm(qy("%1$s has invited you to join a groupchat: %2$s",t,n))}async function aw(e){const t=[qy("Are you sure you want to destroy this groupchat?")];let n=[{name:"challenge",label:qy("Please enter the XMPP address of this groupchat to confirm"),challenge:e.get("jid"),placeholder:qy("name@example.org"),required:!0},{name:"reason",label:qy("Optional reason for destroying this groupchat"),placeholder:qy("Reason")},{name:"newjid",label:qy("Optional XMPP address for a new groupchat that replaces this one"),placeholder:qy("replacement@example.org")}];try{n=await Vl.confirm(qy("Confirm"),t,n);const s=n.filter((e=>"reason"===e.name)).pop()?.value,i=n.filter((e=>"newjid"===e.name)).pop()?.value;return e.sendDestroyIQ(s,i).then((()=>e.close()))}catch(e){Yc.error(e)}}function cw(e){const t=e.model.session.get("view"),n=e.model.get("jid"),s=Ah.ROOMSTATUS,i=e.model.session.get("connection_status");return t===Ah.MUC.VIEWS.CONFIG?nh`<converse-muc-config-form class="muc-form-container" jid="${n}"></converse-muc-config-form>`:nh`
${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>`:""}
${i==s.CONNECTING?Sb():""}
${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.includes(i))&&(uw(n,i,r,[],["moderator"]),!0)}const gw=e=>{const t=qy("On which entity do you want to run commands?"),n=qy("Certain XMPP services and entities allow privileged users to execute ad-hoc commands on them."),s=qy("Commands found"),i=qy("List available commands"),r=qy("XMPP Address"),o=qy("No commands found");return nh`
${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>`:""}
<form class="converse-form" @submit=${e.fetchCommands}>
<fieldset class="form-group">
<label>
${t}
<p class="form-help">${n}</p>
<converse-autocomplete
.getAutoCompleteList="${dw}"
required
placeholder="${r}"
name="jid">
</converse-autocomplete>
</label>
</fieldset>
<fieldset class="form-group">
${e.fetching?Sb():nh`<input type="submit" class="btn btn-primary" value="${i}">`}
</fieldset>
${"list-commands"===e.view?nh`
<fieldset class="form-group">
<ul class="list-group">
<li class="list-group-item active">${e.commands.length?s:o}:</li>
${e.commands.map((t=>wb(e,t)))}
</ul>
</fieldset>`:""}
</form>
`},{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));return s>-1?[...t.slice(0,s),i,...t.slice(s)]:[i,...t]}return t}async function Sw(e){e.preventDefault();const t=e.currentTarget.getAttribute("data-bookmark-name"),n=e.currentTarget.getAttribute("data-room-jid");await Vl.confirm(qy('Are you sure you want to remove the bookmark "%1$s"?',t))&&bw(bl.bookmarks.where({jid:n}),dr.prototype.destroy)}function xw(e){e.preventDefault();const t=e.currentTarget.getAttribute("data-room-jid");Vl.modal.show("converse-bookmark-form-modal",{jid:t},e)}function Ew(e){e.preventDefault();const{Strophe:t}=Ah.env,n=e.target.textContent,s=e.target.getAttribute("data-room-jid"),i={name:n||t.unescapeNode(t.getNodeFromJid(s))||s};Vl.rooms.open(s,i,!0)}const Aw=e=>{const t=e.get("jid"),n=qy("Unbookmark this groupchat"),s=qy("Click to open this groupchat");return nh`
<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}"
@click=${Ew}>${e.getDisplayName()}</a>
<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}"
@click=${Sw}>
<converse-icon class="fa fa-bookmark" size="1em"></converse-icon>
</a>
</div>
`};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`
<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">
${i.map((e=>Aw(e)))}
</div>
</div>
`})(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`
<form class="converse-form chatroom-form" @submit=${t=>e.onBookmarkFormSubmitted(t)}>
<legend>${s}</legend>
<fieldset class="form-group">
<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"/>
</fieldset>
<fieldset class="form-group">
<label for="converse_muc_bookmark_nick">${a}</label>
<input class="form-control" type="text" name="nick" value="${n||""}" id="converse_muc_bookmark_nick"/>
</fieldset>
<fieldset class="form-group form-check">
<input class="form-check-input" id="converse_muc_bookmark_autojoin" type="checkbox" ?checked=${e.bookmark?.get("autojoin")} name="autojoin"/>
<label class="form-check-label" for="converse_muc_bookmark_autojoin">${i}</label>
</fieldset>
<fieldset class="form-group">
<input class="btn btn-primary" type="submit" value="${c}">
${e.bookmark?nh`<input class="btn btn-secondary button-remove" type="button" value="${r}" @click=${t=>e.removeBookmark(t)}>`:""}
</fieldset>
</form>
`})(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`
<converse-muc-bookmark-form class="muc-form-container" jid="${this.jid}">
</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`
<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>
${"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>`:""}
<converse-controlbox
id="controlbox"
class="chatbox ${"overlayed"===i&&e.get("closed")?"hidden":""} ${o?"logged-out":""}"
style="${e.get("width")?`width: ${e.get("width")}`:""}"></converse-controlbox>
`:e.get("type")===n?nh`
<converse-muc jid="${e.get("jid")}" class="chatbox chatroom"></converse-muc>
`:e.get("type")===s?nh`
<converse-headlines jid="${e.get("jid")}" class="chatbox headlines"></converse-headlines>
`:nh`
<converse-chat jid="${e.get("jid")}" class="chatbox"></converse-chat>
`))}
`})()}});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
class="chat-msg__actions ${e?"dropup dropup--left":"dropleft"}"
.items=${t}
></converse-dropdown>`:""}static getActionsDropdownItem(e){return nh`
<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>
`}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:"edit"});const t=["groupchat","mep"].includes(this.model.get("type"))&&await this.model.mayBeModerated();return!this.is_retracted&&(this.model.mayBeRetracted()||t)&&e.push({i18n_text:qy("Retract"),handler:e=>this.onMessageRetractButtonClicked(e),button_class:"chat-msg__action-retract",icon_class:"fas fa-trash-alt",name:"retract"}),this.model.collection?(this.addMediaRenderingToggle(e),Vl.hook("getMessageActionButtons",this,e)):[]}}Vl.elements.define("converse-message-actions",Hw);var Gw=n(8334),Ww={};Ww.styleTagTransform=i_(),Ww.setAttributes=e_(),Ww.insert=Yy().bind(null,"head"),Ww.domAPI=Qy(),Ww.insertStyleElement=n_();Jy()(Gw.Z,Ww);Gw.Z&&Gw.Z.locals&&Gw.Z.locals;Vl.elements.define("converse-image-modal",class extends tb{renderModal(){return(e=>nh`<img class="chat-image chat-image--modal" src="${e.src}">`)({src:this.src})}getModalTitle(){return nh`${qy("Image: ")}<a target="_blank" rel="noopener" href="${this.src}">${M_(this.src)}</a>`}});var Vw=n(5481);class Jw{constructor(e,t){this.options=Object.assign({width:null,height:null,autoplay:!0,loop:!0,show_progress_bar:!0,progress_bg_color:"rgba(0,0,0,0.4)",progress_color:"rgba(255,0,22,.8)",progress_bar_height:5},t),this.el=e,this.gif_el=e.querySelector("img"),this.canvas=e.querySelector("canvas"),this.ctx=this.canvas.getContext("2d"),this.offscreenCanvas=document.createElement("canvas"),this.patchCanvas=document.createElement("canvas"),this.ctx_scaled=!1,this.frames=[],this.load_error=null,this.playing=this.options.autoplay,this.frame_idx=0,this.iteration_count=0,this.start=null,this.hovering=null,this.frameImageData=null,this.disposal_restore_from_idx=null,this.initialize()}async initialize(){this.options.width&&this.options.height&&this.setSizes(this.options.width,this.options.height);const e=await this.fetchGIF(this.gif_el.src);requestAnimationFrame((()=>this.handleGIFResponse(e)))}initPlayer(){if(!this.load_error&&(this.options.width&&this.options.height||this.ctx.scale(this.getCanvasScale(),this.getCanvasScale()),this.frame_idx=0,this.renderImage(),this.options.autoplay)){const e=this.frames[this.frame_idx]?.delay??0;setTimeout((()=>this.play()),e)}}getNextFrameNo(){return 0===this.frames.length?0:(this.frame_idx+1+this.frames.length)%this.frames.length}onIterationEnd(){return this.iteration_count++,this.options.onIterationEnd?.(this),!this.options.loop&&(this.pause(),!0)}onAnimationFrame(e,t,n){if(!this.playing)return;if(e-t<n)return this.hovering?this.drawPauseIcon():this.renderImage(),void requestAnimationFrame((e=>this.onAnimationFrame(e,t,n)));const s=this.getNextFrameNo();if(0===s&&this.onIterationEnd())return;this.frame_idx=s,this.renderImage();const i=this.frames[this.frame_idx]?.delay||8;requestAnimationFrame((t=>this.onAnimationFrame(t,e,i)))}setSizes(e,t){this.canvas.width=e*this.getCanvasScale(),this.canvas.height=t*this.getCanvasScale(),this.offscreenCanvas.width=e,this.offscreenCanvas.height=t,this.offscreenCanvas.style.width=e+"px",this.offscreenCanvas.style.height=t+"px",this.offscreenCanvas.getContext("2d").setTransform(1,0,0,1,0,0)}doShowProgress(e,t,n){if(n&&this.options.show_progress_bar){let n=this.options.progress_bar_height;const s=(this.canvas.height-n)/(this.ctx_scaled?this.getCanvasScale():1),i=e/t*this.canvas.width/(this.ctx_scaled?this.getCanvasScale():1),r=this.canvas.width/(this.ctx_scaled?this.getCanvasScale():1);n/=this.ctx_scaled?this.getCanvasScale():1,this.ctx.fillStyle=this.options.progress_bg_color,this.ctx.fillRect(i,s,r-i,n),this.ctx.fillStyle=this.options.progress_color,this.ctx.fillRect(0,s,i,n)}}handleGIFResponse(e){try{const t=(0,Vw.vq)(e);this.hdr=t.header,this.lsd=t.lsd,this.setSizes(this.options.width??this.lsd.width,this.options.height??this.lsd.height),this.frames=(0,Vw.zw)(t,!0)}catch(e){this.showError()}this.initPlayer(),!this.options.autoplay&&this.drawPlayIcon()}drawError(){this.ctx.fillStyle="black",this.ctx.fillRect(0,0,this.options.width,this.options.height),this.ctx.strokeStyle="red",this.ctx.lineWidth=3,this.ctx.moveTo(0,0),this.ctx.lineTo(this.options.width,this.options.height),this.ctx.moveTo(0,this.options.height),this.ctx.lineTo(this.options.width,0),this.ctx.stroke()}showError(){this.load_error=!0,this.hdr={width:this.gif_el.width,height:this.gif_el.height},this.frames=[],this.drawError(),this.el.requestUpdate()}manageDisposal(e){if(e<=0)return;const t=this.offscreenCanvas.getContext("2d"),n=this.frames[e-1].disposalType;e>1&&(3===n?null!=this.disposal_restore_from_idx&&t.putImageData(this.frames[this.disposal_restore_from_idx].data,0,0):this.disposal_restore_from_idx=e-1),2===n&&t.clearRect(this.last_frame.dims.left,this.last_frame.dims.top,this.last_frame.dims.width,this.last_frame.dims.height)}renderImage(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(!this.frames.length)return;let t=this.frame_idx;t=parseInt(t.toString(),10),(t>this.frames.length-1||t<0)&&(t=0),this.manageDisposal(t);const n=this.frames[t],s=this.patchCanvas.getContext("2d"),i=this.offscreenCanvas.getContext("2d"),r=n.dims;this.frameImageData&&r.width==this.frameImageData.width&&r.height==this.frameImageData.height||(this.patchCanvas.width=r.width,this.patchCanvas.height=r.height,this.frameImageData=s.createImageData(r.width,r.height)),this.frameImageData.data.set(n.patch),s.putImageData(this.frameImageData,0,0),i.drawImage(this.patchCanvas,r.left,r.top);const o=i.getImageData(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height);this.ctx.putImageData(o,0,0),this.ctx.drawImage(this.canvas,0,0,this.canvas.width,this.canvas.height),e&&this.hovering&&this.drawPauseIcon(),this.last_frame=n}play(){this.playing=!0,requestAnimationFrame((e=>this.onAnimationFrame(e,0,0)))}pause(){this.playing=!1,requestAnimationFrame((()=>this.drawPlayIcon()))}drawPauseIcon(){if(!this.playing)return;this.renderImage(!1),this.ctx.fillStyle="rgb(0, 0, 0, 0.25)",this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height);const e=.1*this.canvas.height;this.ctx.lineWidth=.04*this.canvas.height,this.ctx.beginPath(),this.ctx.moveTo(this.canvas.width/2-e/2,this.canvas.height/2-e),this.ctx.lineTo(this.canvas.width/2-e/2,this.canvas.height/2+e),this.ctx.fillStyle="rgb(200, 200, 200, 0.75)",this.ctx.stroke(),this.ctx.beginPath(),this.ctx.moveTo(this.canvas.width/2+e/2,this.canvas.height/2-e),this.ctx.lineTo(this.canvas.width/2+e/2,this.canvas.height/2+e),this.ctx.fillStyle="rgb(200, 200, 200, 0.75)",this.ctx.stroke(),this.ctx.lineWidth=.02*this.canvas.height,this.ctx.strokeStyle="rgb(200, 200, 200, 0.75)",this.ctx.beginPath(),this.ctx.arc(this.canvas.width/2,this.canvas.height/2,1.5*e,0,2*Math.PI),this.ctx.stroke()}drawPlayIcon(){if(this.playing)return;this.renderImage(!1),this.ctx.fillStyle="rgb(0, 0, 0, 0.25)",this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height);const e=.1*this.canvas.height,t=new Path2D;t.moveTo(this.canvas.width/2+e,this.canvas.height/2),t.lineTo(this.canvas.width/2-e/2,this.canvas.height/2+e),t.lineTo(this.canvas.width/2-e/2,this.canvas.height/2-e),t.closePath(),this.ctx.fillStyle="rgb(200, 200, 200, 0.75)",this.ctx.fill(t);const n=1.5*e;this.ctx.lineWidth=.02*this.canvas.height,this.ctx.strokeStyle="rgb(200, 200, 200, 0.75)",this.ctx.beginPath(),this.ctx.arc(this.canvas.width/2,this.canvas.height/2,n,0,2*Math.PI),this.ctx.stroke()}getCanvasScale(){let e;return e=this.options.max_width&&this.hdr&&this.lsd.width>this.options.max_width?this.options.max_width/this.lsd.width:1,e}fetchGIF(e){const t=Ao(),n=new XMLHttpRequest;return n.open("GET",e,!0),n.responseType="arraybuffer",n?.overrideMimeType("text/plain; charset=x-user-defined"),n.onload=()=>{if(200!=n.status)return this.showError(),t.reject();t.resolve(n.response)},n.onprogress=e=>e.lengthComputable&&this.doShowProgress(e.loaded,e.total,!0),n.onerror=e=>{Yc.error(e),this.showError()},n.send(),t}}var Zw=n(8069),Qw={};Qw.styleTagTransform=i_(),Qw.setAttributes=e_(),Qw.insert=Yy().bind(null,"head"),Qw.domAPI=Qy(),Qw.insertStyleElement=n_();Jy()(Zw.Z,Qw);Zw.Z&&Zw.Z.locals&&Zw.Z.locals;Vl.elements.define("converse-gif",class extends Gy{static get properties(){return{autoplay:{type:Boolean},noloop:{type:Boolean},progress_color:{type:String},fallback:{type:String},src:{type:String}}}constructor(){super(),this.src=null,this.autoplay=!1,this.noloop=!1,this.fallback="url"}initGIF(){const e={autoplay:this.autoplay,loop:!this.noloop};this.progress_color&&(e.progress_color=this.progress_color),this.supergif=new Jw(this,e)}updated(e){this.supergif&&!e.has("src")?(e.has("autoplay")&&(this.supergif.options.autoplay=this.autoplay),e.has("noloop")&&(this.supergif.options.loop=!this.noloop),e.has("progress_color")&&(this.supergif.options.progress_color=this.progress_color)):this.initGIF()}render(){return this.supergif?.load_error&&["url","empty"].includes(this.fallback)?this.renderErrorFallback():nh`<canvas class="gif-canvas"
@mouseover=${()=>this.setHover()}
@mouseleave=${()=>this.unsetHover()}
@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"
loading="lazy"
src="${e}"
@click=${s}
@error=${()=>this.onError(e,t,n,s)}
@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`
<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>
`}(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`
<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>
`:""}(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`
<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>
`)({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"
loading="lazy"
draggable="false"
title="${s}"
alt="${n}"
src="${t}/72x72/${e.cp}.png"/>`}}return t.unicode_only?s:nh`<img class="emoji"
loading="lazy"
draggable="false"
title="${s}"
alt="${s}"
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)=>t.begin-e.begin)).forEach((t=>{const n=e.shift();e=[n.slice(0,t.begin),t,n.slice(t.end),...e]})),e.reduce(((e,t)=>{return wS(t)?[...e,cf((n=t,n.replace(/\n\n+/g,(e=>`\n${"".repeat(e.length-2)}\n`))))]:[...e,t];var n}),[])}}class xS{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.offset=t,this.options=n,this.text=e}async transform(){const e=new SS(this.text,this.offset,this.options);try{await e.addTemplates()}catch(e){Yc.error(e)}return e.payload}render(){return nh`${Wb(this.transform(),nh`${this.text}`)}`}}const ES=Ob(class extends Mb{render(e,t,n,s){const i=new xS(e,t,n).render();return s?.(),i}}),AS=ES;var CS=n(6380),$S={};$S.styleTagTransform=i_(),$S.setAttributes=e_(),$S.insert=Yy().bind(null,"head"),$S.domAPI=Qy(),$S.insertStyleElement=n_();Jy()(CS.Z,$S);CS.Z&&CS.Z.locals&&CS.Z.locals;Vl.elements.define("converse-chat-message-body",class extends Gy{static get properties(){return{hide_url_previews:{type:String},is_me_message:{type:Boolean},model:{type:Object},text:{type:String}}}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()))}onImgClick(e){e.preventDefault(),Vl.modal.show("converse-image-modal",{src:e.target.src},e)}onImgLoad(){this.dispatchEvent(new CustomEvent("imageLoaded",{detail:this,bubbles:!0}))}render(){const e={media_urls:this.model.get("media_urls"),mentions:this.model.get("references"),nick:this.model.collection.chatbox.get("nick"),onImgClick:e=>this.onImgClick(e),onImgLoad:()=>this.onImgLoad(),render_styling:!this.model.get("is_unstyled")&&Vl.settings.get("allow_message_styling"),show_me_message:!0};return"false"===this.hide_url_previews?(e.embed_audio=!0,e.embed_videos=!0,e.show_images=!0):"true"===this.hide_url_previews&&(e.embed_audio=!1,e.embed_videos=!1,e.show_images=!1),AS(this.text,0,e,(()=>this.model.collection?.trigger("rendered",this.model)))}});var kS=n(2484),jS={};jS.styleTagTransform=i_(),jS.setAttributes=e_(),jS.insert=Yy().bind(null,"head"),jS.domAPI=Qy(),jS.insertStyleElement=n_();Jy()(kS.Z,jS);kS.Z&&kS.Z.locals&&kS.Z.locals;Vl.elements.define("converse-icon",class extends Gy{static get properties(){return{color:String,class_name:{attribute:"class"},style:String,size:String}}constructor(){super(),this.class_name="",this.style="",this.size="",this.color=""}getSource(){return`#icon-${this.class_name.trim().split(" ")[1].replace("fa-","")}`}getStyles(){const e=this.color.match(/var\((--.*)\)/)?.[1],t=e?getComputedStyle(this).getPropertyValue(e):this.color;return`\n ${this.size?`width: ${this.size};`:""}\n ${this.size?`height: ${this.size};`:""}\n ${t?`fill: ${t};`:""}\n ${this.style}\n `}render(){return nh`<svg .style="${this.getStyles()}"> <use href="${this.getSource()}"> </use> </svg>`}});const{keycodes:TS}=Ah;function IS(e){let t=0;do{isNaN(e.offsetTop)||(t+=e.offsetTop)}while(e=e.offsetParent);return t}function NS(e){let t=0;do{isNaN(e.offsetLeft)||(t+=e.offsetLeft)}while(e=e.offsetParent);return t}class OS{static get DIRECTION(){return{down:"down",end:"end",home:"home",left:"left",right:"right",up:"up"}}static get DEFAULTS(){return{home:[`${TS.SHIFT}+${TS.UP_ARROW}`],end:[`${TS.SHIFT}+${TS.DOWN_ARROW}`],up:[TS.UP_ARROW],down:[TS.DOWN_ARROW],left:[TS.LEFT_ARROW,`${TS.SHIFT}+${TS.TAB}`],right:[TS.RIGHT_ARROW,TS.TAB],getSelector:null,jump_to_picked:null,jump_to_picked_direction:null,jump_to_picked_selector:"picked",onSelected:null,selected:"selected",selector:"li"}}static getClosestElement(e,t){return e.reduce(((e,n)=>{const s=t(n);return s<e.distance?{distance:s,element:n}:e}),{distance:1/0}).element}constructor(e,t){this.doc=window.document,this.container=e,this.scroll_container=t.scroll_container||e,this.options=Object.assign({},OS.DEFAULTS,t),this.init()}init(){this.selected=null,this.keydownHandler=null,this.elements={},this.keys={},this.options.down.forEach((e=>this.keys[e]=OS.DIRECTION.down)),this.options.end.forEach((e=>this.keys[e]=OS.DIRECTION.end)),this.options.home.forEach((e=>this.keys[e]=OS.DIRECTION.home)),this.options.left.forEach((e=>this.keys[e]=OS.DIRECTION.left)),this.options.right.forEach((e=>this.keys[e]=OS.DIRECTION.right)),this.options.up.forEach((e=>this.keys[e]=OS.DIRECTION.up))}enable(){this.getElements(),this.keydownHandler=e=>this.handleKeydown(e),this.doc.addEventListener("keydown",this.keydownHandler),this.enabled=!0}disable(){this.keydownHandler&&this.doc.removeEventListener("keydown",this.keydownHandler),this.unselect(),this.elements={},this.enabled=!1}destroy(){this.disable(),this.container.domNavigator&&delete this.container.domNavigator}getNextElement(e){let t;if(e===OS.DIRECTION.home)t=this.getElements(e)[0];else if(e===OS.DIRECTION.end)t=Array.from(this.getElements(e)).pop();else if(this.selected)if(e===OS.DIRECTION.right){const n=this.getElements(e);t=n.slice(n.indexOf(this.selected))[1]}else if(e==OS.DIRECTION.left){const n=this.getElements(e);t=n.slice(0,n.indexOf(this.selected)).pop()||this.selected}else if(e==OS.DIRECTION.down){const e=this.selected.offsetLeft,n=this.selected.offsetTop+this.selected.offsetHeight,s=this.elementsAfter(0,n),i=t=>Math.abs(t.offsetLeft-e)+Math.abs(t.offsetTop-n);t=OS.getClosestElement(s,i)}else{if(e!=OS.DIRECTION.up)throw new Error("getNextElement: invalid direction value");{const e=this.selected.offsetLeft,n=this.selected.offsetTop-1,s=this.elementsBefore(1/0,n),i=t=>Math.abs(e-t.offsetLeft)+Math.abs(n-t.offsetTop);t=OS.getClosestElement(s,i)}}else t=e===OS.DIRECTION.right||e===OS.DIRECTION.down?this.getElements(e)[1]:this.getElements(e)[0];return this.options.jump_to_picked&&t&&t.matches(this.options.jump_to_picked)&&e===this.options.jump_to_picked_direction&&(t=this.container.querySelector(this.options.jump_to_picked_selector)||t),t}select(e,t){e&&e!==this.selected&&(this.unselect(),t&&this.scrollTo(e,t),e.matches("input")?e.focus():G_.addClass(this.options.selected,e),this.selected=e,this.options.onSelected&&this.options.onSelected(e))}unselect(){this.selected&&(G_.removeClass(this.options.selected,this.selected),delete this.selected)}scrollTo(e,t){if(this.inScrollContainerViewport(e)){if(!function(e){const t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=window.innerHeight&&t.right<=window.innerWidth}(e))switch(t){case OS.DIRECTION.left:document.body.scrollLeft=NS(e)-document.body.offsetLeft;break;case OS.DIRECTION.up:document.body.scrollTop=IS(e)-document.body.offsetTop;break;case OS.DIRECTION.right:document.body.scrollLeft=NS(e)-document.body.offsetLeft-(document.documentElement.clientWidth-e.offsetWidth);break;case OS.DIRECTION.down:document.body.scrollTop=IS(e)-document.body.offsetTop-(document.documentElement.clientHeight-e.offsetHeight)}}else{const n=this.scroll_container;if(!n.contains(e))return;switch(t){case OS.DIRECTION.left:n.scrollLeft=e.offsetLeft-n.offsetLeft,n.scrollTop=e.offsetTop-n.offsetTop;break;case OS.DIRECTION.up:n.scrollTop=e.offsetTop-n.offsetTop;break;case OS.DIRECTION.right:n.scrollLeft=e.offsetLeft-n.offsetLeft-(n.offsetWidth-e.offsetWidth),n.scrollTop=e.offsetTop-n.offsetTop-(n.offsetHeight-e.offsetHeight);break;case OS.DIRECTION.down:n.scrollTop=e.offsetTop-n.offsetTop-(n.offsetHeight-e.offsetHeight)}}}inScrollContainerViewport(e){const t=this.scroll_container;return!(e.offsetLeft-t.scrollLeft<t.offsetLeft)&&(!(e.offsetTop-t.scrollTop<t.offsetTop)&&(!(e.offsetLeft+e.offsetWidth-t.scrollLeft>t.offsetLeft+t.offsetWidth)&&!(e.offsetTop+e.offsetHeight-t.scrollTop>t.offsetTop+t.offsetHeight)))}getElements(e){const t=this.options.getSelector?this.options.getSelector(e):this.options.selector;return this.elements[t]||(this.elements[t]=Array.from(this.container.querySelectorAll(t))),this.elements[t]}elementsAfter(e,t){return this.getElements(OS.DIRECTION.down).filter((n=>n.offsetLeft>=e&&n.offsetTop>=t))}elementsBefore(e,t){return this.getElements(OS.DIRECTION.up).filter((n=>n.offsetLeft<=e&&n.offsetTop<=t))}handleKeydown(e){const t=TS,n=e.shiftKey?this.keys[`${t.SHIFT}+${e.which}`]:this.keys[e.which];if(n){e.preventDefault(),e.stopPropagation();const t=this.getNextElement(n,e);this.select(t,n)}}}const MS=OS,RS=Ah.env.utils;class DS extends Gy{connectedCallback(){super.connectedCallback(),this.registerEvents()}registerEvents(){this.clickOutside=e=>this._clickOutside(e),document.addEventListener("click",this.clickOutside)}firstUpdated(){super.firstUpdated(),this.menu=this.querySelector(".dropdown-menu"),this.button=this.querySelector("button"),this.addEventListener("click",(e=>this.toggleMenu(e))),this.addEventListener("keyup",(e=>this.handleKeyUp(e)))}_clickOutside(e){this.contains(e.composedPath()[0])||this.hideMenu(e)}hideMenu(){RS.removeClass("show",this.menu),this.button?.setAttribute("aria-expanded",!1),this.button?.blur()}showMenu(){RS.addClass("show",this.menu),this.button.setAttribute("aria-expanded",!0)}toggleMenu(e){e.preventDefault(),RS.hasClass("show",this.menu)?this.hideMenu():this.showMenu()}handleKeyUp(e){e.keyCode===Ah.keycodes.ESCAPE&&this.hideMenu()}disconnectedCallback(){document.removeEventListener("click",this.clickOutside),super.disconnectedCallback()}}var zS=n(1484),LS={};LS.styleTagTransform=i_(),LS.setAttributes=e_(),LS.insert=Yy().bind(null,"head"),LS.domAPI=Qy(),LS.insertStyleElement=n_();Jy()(zS.Z,LS);zS.Z&&zS.Z.locals&&zS.Z.locals;class PS extends DS{static get properties(){return{icon_classes:{type:String},items:{type:Array}}}constructor(){super(),this.icon_classes="fa fa-bars"}render(){return nh`
<button type="button" class="btn btn--transparent btn--standalone" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<converse-icon size="1em" class="${this.icon_classes}">
</button>
<div class="dropdown-menu">
${this.items.map((e=>Wb(e,"")))}
</div>
`}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>`}
<hr/>
<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`
<div class="modal-footer">
${Q_}
<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>
${s&&t?(e=>{const t=qy("Remove as contact");return nh`
<button type="button" @click="${t=>e.removeContact(t)}" class="btn btn-danger remove-contact">
<converse-icon
class="fas fa-trash-alt"
color="var(--text-color-lighten-15-percent)"
size="1em"
></converse-icon>
${t}
</button>
`})(e):""}
</div>
`};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`
<div class="modal-body">
${s.image?nh`<div class="mb-4">${xb(Object.assign(s,u))}</div>`:""}
${s.fullname?nh`<p><label>${o}:</label> ${s.fullname}</p>`:""}
<p><label>${i}:</label> <a href="xmpp:${s.jid}">${s.jid}</a></p>
${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>`:""}
<converse-omemo-fingerprints jid=${s.jid}></converse-omemo-fingerprints>
</div>
`})(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">
<converse-rich-text text=${e.description}></converse-rich-text>
</p>`:""}
${e.url?nh`<p class="card-text">
<a href="${e.url}" target="_blank" rel="noopener">${Lh(e.url).domain()}</a>
</p>`:""}
</div>`:""}
</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`
<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}>
<converse-icon size="1em" color="var(--background)" class="fa ${e.model.get("is_spoiler_visible")?"fa-eye-slash":"fa-eye"}"></converse-icon>
${e.model.get("is_spoiler_visible")?s:t}
</a>
</div>
`,r=e.model.get("is_spoiler")?"spoiler "+(e.model.get("is_spoiler_visible")?"":"hidden"):"",o=e.model.getMessageText(),a=e.model.get("oob_url")&&o!==e.model.get("oob_url");return nh`
${e.model.get("is_spoiler")?i:""}
${e.model.get("subject")?nh`<div class="chat-msg__subject">${e.model.get("subject")}</div>`:""}
<span class="chat-msg__body--wrapper">
<converse-chat-message-body
class="chat-msg__text ${e.model.get("is_only_emojis")?"chat-msg__text--larger":""} ${r}"
.model="${e.model}"
hide_url_previews=${e.model.get("hide_url_previews")}
?is_me_message=${e.model.isMeCommand()}
text="${o}"></converse-chat-message-body>
${!e.model.get("received")||e.model.isMeCommand()||n?"":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):""}
</span>
${a?nh`<div class="chat-msg__media">${R_(e.model.get("oob_url"))}</div>`:""}
<div class="chat-msg__error">${e.model.get("error_text")||e.model.get("error")}</div>
`};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`
<div class="retraction">${t}</div>
${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`
<div class="message chat-info message--mep ${e.getExtraMessageClasses()}"
data-isodate="${t}"
data-type="${e.data_name}"
data-value="${e.data_value}">
<div class="chat-msg__content">
<div class="chat-msg__body chat-msg__body--${e.model.get("type")} ${e.model.get("is_delayed")?"chat-msg__body--delayed":""}">
<div class="chat-info__message">
${e.isRetracted()?e.renderRetraction():nh`
<converse-rich-text
.mentions=${e.model.get("references")}
render_styling
text=${e.model.getMessageText()}>
</converse-rich-text>
${e.model.get("reason")?nh`<q class="reason"><converse-rich-text text=${e.model.get("reason")}></converse-rich-text></q>`:""}
`}
</div>
<converse-message-actions
?is_retracted=${e.isRetracted()}
.model=${e.model}></converse-message-actions>
</div>
</div>
</div>`})(this)}renderInfoMessage(){return(e=>{const t=ZS(e.model.get("time")).toISOString(),n=qy("Retry");return nh`
<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>
${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`
<div class="message chat-msg">
${e.shouldShowAvatar()?nh`<a class="show-msg-author-modal" @click=${e.showUserModal}>
<converse-avatar class="avatar align-self-center"
.data=${e.model.vcard?.attributes}
nonce=${e.model.vcard?.get("vcard_updated")}
height="40" width="40"></converse-avatar>
</a>`:""}
<div class="chat-msg__content">
<span class="chat-msg__text">${t} <strong>${n}</strong>, ${s}</span>
<progress value="${e.model.get("progress")}"/>
</div>
</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>`:""}
<div class="message chat-msg ${e.getExtraMessageClasses()}"
data-isodate="${t.time}"
data-msgid="${t.msgid}"
data-from="${t.from}"
data-encrypted="${t.is_encrypted}">
<!-- Anchor to allow us to scroll the message into view -->
<a id="${t.msgid}"></a>
${t.should_show_avatar&&!s?nh`<a class="show-msg-author-modal" @click=${e.showUserModal}>
<converse-avatar
class="avatar align-self-center"
.data=${e.model.vcard?.attributes}
nonce=${e.model.vcard?.get("vcard_updated")}
height="40" width="40"></converse-avatar>
</a>`:""}
<div class="chat-msg__content chat-msg__content--${t.sender} ${t.is_me_message?"chat-msg__content--action":""}">
${t.is_me_message||s?"":nh`
<span class="chat-msg__heading">
<span class="chat-msg__author"><a class="show-msg-author-modal" @click=${e.showUserModal}>${t.username}</a></span>
${t.hats.map((e=>nh`<span class="badge badge-secondary">${e.title}</span>`))}
<time timestamp="${e.model.get("edited")||e.model.get("time")}" class="chat-msg__time">${t.pretty_time}</time>
${t.is_encrypted?nh`<converse-icon class="fa fa-lock" size="1.1em"></converse-icon>`:""}
</span>`}
<div class="chat-msg__body chat-msg__body--${t.message_type} ${t.received?"chat-msg__body--received":""} ${t.is_delayed?"chat-msg__body--delayed":""}">
<div class="chat-msg__message">
${t.is_me_message?nh`
<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()}
</div>
<converse-message-actions
.model=${e.model}
?is_retracted=${t.is_retracted}></converse-message-actions>
</div>
${e.model.get("ogp_metadata")?.map((t=>!0===e.model.get("hide_url_previews")?"":Uh(t["og:image"],"image")?nh`<converse-message-unfurl
@animationend="${e.onUnfurlAnimationEnd}"
class="${e.model.get("url_preview_transition")}"
jid="${e.chatbox?.get("jid")}"
description="${t["og:description"]||""}"
title="${t["og:title"]||""}"
image="${t["og:image"]||""}"
url="${t["og:url"]||""}"></converse-message-unfurl>`:""))}
</div>
</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
jid="${this.model.get("jid")}"
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`
<div class="chat-content__notifications">${this.model.getNotificationsText()}</div>
<converse-message-history
.model=${this.model}
.messages=${[...this.model.messages.models]}>
</converse-message-history>
${this.model.ui?.get("chat-content-spinner-top")?Sb():""}
`:""}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"
@click=${this.close}
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`
<li data-category="${e.category}"
class="emoji-category ${e.category} ${e.current_category===e.category?"picked":""}"
title="${qy(Vl.settings.get("emoji_category_labels")[e.category])}">
<a class="pick-category"
@click=${e.onCategoryPicked}
href="#emoji-picker-${e.category}"
data-category="${e.category}">${e.emoji} </a>
</li>
`)(Object.assign({category:n,emoji:e.sn2Emoji(t[n])},e)):""))}</ul>`},hx=e=>nh`
<li class="emoji insert-emoji ${e.shouldBeHidden(e.emoji.sn)?"hidden":""}" data-emoji="${e.emoji.sn}" title="${e.emoji.sn}">
<a href="#" @click=${e.insertEmoji} data-emoji="${e.emoji.sn}">${dx.shortnamesToEmojis(e.emoji.sn)}</a>
</li>
`,mx=e=>{const t=Vl.settings.get("emoji_categories");return nh`
<span ?hidden=${e.query} class="emoji-lists__container emoji-lists__container--browse">
${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>
<ul class="emoji-picker" data-category="${e.category}">
${Object.values(Ah.emojis.json[e.category]).map((t=>hx(Object.assign({emoji:t},e))))}
</ul>`)(Object.assign({category:n},e)):""))}
</span>`},fx=e=>{const t=qy("Search");return nh`
<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}>
${e.query?"":ux(e)}
</div>
${e.render_emojis?nh`<converse-emoji-picker-content
.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">
<ul>${["tone1","tone2","tone3","tone4","tone5"].map((t=>(e=>nh`
<li data-skintone="${e.skintone}" class="emoji-skintone ${e.current_skintone===e.skintone?"picked":""}">
<a class="pick-skintone" href="#" data-skintone="${e.skintone}" @click=${e.onSkintonePicked}>${dx.shortnamesToEmojis(":"+e.skintone+":")}</a>
</li>`)(Object.assign({skintone:t},e))))}</ul>
</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`
<div class="emoji-picker__lists">
${(e=>{const t=qy("Search results");return nh`
<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">
${e.search_results.map((t=>hx(Object.assign({emoji:t},e))))}
</ul>
</span>
`})(e)}
${mx(e)}
</div>
`}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`
<div class="dropup">
<button class="toggle-emojis"
title="${qy("Insert emojis")}"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false">
<converse-icon
color="var(${e})"
class="fa fa-smile "
path-prefix="${Vl.settings.get("assets_path")}"
size="1em"></converse-icon>
</button>
<div class="dropdown-menu">
${Wb(this.initModel().then((()=>nh`
<converse-emoji-picker
.chatview=${this.chatview}
.model=${this.model}
@emojiSelected=${()=>this.hideMenu()}
?render_emojis=${this.render_emojis}
current_category="${this.model.get("current_category")||""}"
current_skintone="${this.model.get("current_skintone")||""}"
query="${this.model.get("query")||""}"
></converse-emoji-picker>`)),"")}
</div>
</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-skintone").trim();this.current_skintone===t?this.model.save({current_skintone:""}):this.model.save({current_skintone:t})}chooseCategory(e){e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation();const t=e.target.matches("li")?e.target:_x.ancestor(e.target,"li");this.setCategoryForElement(t),this.navigator.select(t),!this.navigator.enabled&&this.navigator.enable()}onSearchInputKeyDown(e){if(e.keyCode===vo.TAB)if(e.target.value){e.preventDefault();const t=Ah.emojis.shortnames.find((t=>bl.FILTER_CONTAINS(t,e.target.value)));t&&this.model.set({query:t})}else this.navigator.enabled||this.enableArrowNavigation(e);else e.keyCode!==vo.DOWN_ARROW||this.navigator.enabled?e.keyCode!==vo.ENTER&&e.keyCode!==vo.DOWN_ARROW&&this.debouncedFilter(e.target):this.enableArrowNavigation(e)}onEnterPressed(e){e.preventDefault(),e.stopPropagation(),Ah.emojis.shortnames.includes(e.target.value)?this.insertIntoTextArea(e.target.value):1===this.search_results.length?this.insertIntoTextArea(this.search_results[0].sn):this.navigator.selected&&this.navigator.selected.matches(".insert-emoji")?this.insertIntoTextArea(this.navigator.selected.getAttribute("data-emoji")):this.navigator.selected&&this.navigator.selected.matches(".emoji-category")&&this.chooseCategory({target:this.navigator.selected})}onSearchInputFocus(e){this.chatview.emitBlurred(e),this.disableArrowNavigation()}getTonedShortname(e){return _S().includes(e)&&this.current_skintone?`${e.slice(0,e.length-1)}_${this.current_skintone}:`:e}initArrowNavigation(){if(!this.navigator){const e="li:not(.hidden):not(.emoji-skintone), .emoji-search",t={jump_to_picked:".emoji-category",jump_to_picked_selector:".emoji-category.picked",jump_to_picked_direction:MS.DIRECTION.down,picked_selector:".picked",scroll_container:this.querySelector(".emoji-picker__lists"),getSelector:t=>{if(t===MS.DIRECTION.down){const t=this.navigator.selected&&this.navigator.selected.getAttribute("data-category");return t?`ul[data-category="${t}"] li:not(.hidden):not(.emoji-skintone), .emoji-search`:e}return e},onSelected:e=>{e.matches(".insert-emoji")&&this.setCategoryForElement(e.parentElement),e.matches(".insert-emoji, .emoji-category")&&e.firstElementChild.focus(),e.matches(".emoji-search")&&e.focus()}};this.navigator=new MS(this,t)}}disableArrowNavigation(){this.navigator?.disable()}enableArrowNavigation(e){e?.preventDefault?.(),e?.stopPropagation?.(),this.disableArrowNavigation(),this.navigator.enable(),this.navigator.handleKeydown(e)}});Vl.elements.define("converse-message-limit-indicator",class extends Gy{static get properties(){return{model:{type:Object}}}connectedCallback(){super.connectedCallback(),this.listenTo(this.model,"change:draft",(()=>this.requestUpdate()))}render(){const e=Vl.settings.get("message_limit");if(!e)return"";return(e=>{const t=qy("Message characters remaining");return nh`<span class="message-limit ${e<1?"error":""}" title="${t}">${e}</span>`})(e-(this.model.get("draft")||"").length)}});const bx=e=>nh`
<span class="toolbar-buttons">${Wb(e.getButtons(),"")}</span>
${e.show_send_button?function(){const e=qy("Send the message");return nh`<button type="submit" class="btn send-button" title="${e}">
<converse-icon color="var(--toolbar-btn-text-color)" class="fa fa-paper-plane" size="1em"></converse-icon>
</button>`}():""}
`;var 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`
<button class="toggle-call" @click=${this.toggleCall} title="${n}">
<converse-icon color="var(${t})" class="fa fa-phone" size="1em"></converse-icon>
</button>`)}Vl.settings.get("message_limit")&&e.push(nh`
<converse-message-limit-indicator .model=${this.model} class="right">
</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`
<button class="toggle_occupants right"
title="${this.hidden_occupants?n:t}"
@click=${this.toggleOccupants}>
<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>
</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`
<button title="${e}" @click=${this.toggleFileUpload}>
<converse-icon
color="var(${t})"
class="fa fa-paperclip"
size="1em"></converse-icon>
</button>
<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`
<button class="toggle-compose-spoiler"
title="${t}"
@click=${this.toggleComposeSpoilerMessage}>
<converse-icon
color="var(${n})"
class="fa ${e.get("composing_spoiler")?"fa-eye-slash":"fa-eye"}"
size="1em"></converse-icon>
</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}">
<converse-avatar
class="avatar chat-msg__avatar"
.data=${e.model.vcard?.attributes}
nonce=${e.model.vcard?.get("vcard_updated")}
height="40" width="40"></converse-avatar></span>`,s=e.model.getDisplayName();return nh`
<div class="chatbox-title ${e.status?"":"chatbox-title--no-desc"}">
<div class="chatbox-title--row">
${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>`:""}
<div class="chatbox-title__text" title="${e.jid}">
${e.type!==bl.HEADLINES_TYPE?nh`<a class="user show-msg-author-modal" @click=${e.showUserDetailsModal}>${s}</a>`:s}
</div>
</div>
<div class="chatbox-title__buttons row no-gutters">
${Wb(fS(e.heading_buttons_promise),"")}
${Wb(mS(e.heading_buttons_promise),"")}
</div>
</div>
${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`
<form class="sendXMPPMessage">
<input type="text"
enterkeyhint="send"
placeholder="${n||""}"i
value="${e.hint_value||""}"
class="${e.composing_spoiler?"":"hidden"} spoiler-hint"/>
<textarea
autofocus
type="text"
enterkeyhint="send"
@drop=${e.onDrop}
@input=${$x}
@keydown=${e.onKeyDown}
@keyup=${e.onKeyUp}
@paste=${e.onPaste}
@change=${e.onChange}
class="chat-textarea
${s?"chat-textarea-send-button":""}
${e.composing_spoiler?"spoiler":""}"
placeholder="${t}">${e.message_value||""}</textarea>
</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("disabled"),kx.removeClass("disabled",t),"overlayed"===Vl.settings.get("view_mode")){bl.chatboxviews.get(this.getAttribute("jid")).querySelector(".chat-content__messages").parentElement.style.display=""}this.model.setChatState(bl.ACTIVE,{silent:!0}),t.focus()}}Vl.elements.define("converse-message-form",jx);var Tx=n(7092),Ix={};Ix.styleTagTransform=i_(),Ix.setAttributes=e_(),Ix.insert=Yy().bind(null,"head"),Ix.domAPI=Qy(),Ix.insertStyleElement=n_();Jy()(Tx.Z,Ix);Tx.Z&&Tx.Z.locals&&Tx.Z.locals;class Nx extends eb{events={"click .send-button":"sendButtonClicked","click .toggle-clear":"clearMessages"};constructor(){super(),this.debouncedRender=Il(this.render,100)}async connectedCallback(){super.connectedCallback(),await this.initialize(),this.render()}async initialize(){this.model=await Vl.chatboxes.get(this.getAttribute("jid")),await this.model.initialized,this.listenTo(this.model,"change:num_unread",this.debouncedRender),this.listenTo(this.model,"emoji-picker-autocomplete",this.autocompleteInPicker),this.addEventListener("focusin",(e=>this.emitFocused(e))),this.addEventListener("focusout",(e=>this.emitBlurred(e)))}render(){bh((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>`:""}
${Vl.settings.get("show_toolbar")?nh`
<converse-chat-toolbar
class="chat-toolbar no-text-select"
.model=${e.model}
?composing_spoiler="${e.model.get("composing_spoiler")}"
?show_call_button="${s}"
?show_emoji_button="${i}"
?show_send_button="${r}"
?show_spoiler_button="${o}"
?show_toolbar="${a}"
message_limit="${n}"></converse-chat-toolbar>`:""}
<converse-message-form jid="${e.model.get("jid")}"></converse-message-form>
`})({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`
<div class="flyout box-flyout">
<converse-dragresize></converse-dragresize>
${e.model?nh`
<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>
${e.show_help_messages?nh`<div class="chat-content__help">
<converse-chat-help
.model=${e.model}
.messages=${e.help_messages}
?hidden=${!e.show_help_messages}
type="info"
chat_type="${bl.CHATROOMS_TYPE}"
></converse-chat-help></div>`:""}
</div>
<converse-chat-bottom-panel jid="${e.jid}" class="bottom-panel"> </converse-chat-bottom-panel>
</div>
`:""}
</div>
`)(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>
<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>
`:""}
`}});Vl.elements.define("converse-brand-logo",class extends Gy{render(){const e="fullscreen"===Vl.settings.get("view_mode");return nh`
<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">
<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>
</g>
</g>
</svg>
<span class="brand-name">
<span class="brand-name__text">converse<span class="subdued">.js</span></span>
${e?nh`
<p class="byline">messaging freedom</p>
`:""}
</span>
</span>
</a>
`}});Vl.elements.define("converse-brand-heading",class extends Gy{render(){return nh`
<converse-brand-logo></converse-brand-logo>
<converse-brand-byline></converse-brand-byline>
`}});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`
<div class="form-group">
<label for="converse-login-jid">${s}:</label>
<input
id="converse-login-jid"
?autofocus=${!!Vl.settings.get("auto_focus")}
@changed=${e.validate}
value="${Vl.settings.get("jid")??""}"
required
class="form-control"
type="text"
name="jid"
placeholder="${o}"
/>
</div>
${t!==lo?(()=>{const e=qy("Password");return nh`
<div class="form-group">
<label for="converse-login-password">${e}</label>
<input
id="converse-login-password"
class="form-control"
required="required"
value="${Vl.settings.get("password")??""}"
type="password"
name="password"
placeholder="${e}"
/>
</div>
`})():""}
${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`
<div class="form-group fade-in">
<label for="converse-conn-url">${e}</label>
<p class="form-help instructions">${t}</p>
<input
id="converse-conn-url"
class="form-control"
type="url"
name="connection-url"
placeholder="${n}"
/>
</div>
`})():""}
${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`
<div class="form-group form-check login-trusted">
<input
id="converse-login-trusted"
type="checkbox"
class="form-check-input"
name="trusted"
?checked=${e}
/>
<label for="converse-login-trusted" class="form-check-label login-trusted__desc">${n}</label>
<converse-icon
class="fa fa-info-circle"
data-toggle="popover"
data-title="Trusted device?"
data-content="${t}"
size="1.2em"
title="${t}"
></converse-icon>
</div>
`})("off"!==a):""}
<fieldset class="form-group buttons">
<input class="btn btn-primary" type="submit" value="${n}" />
</fieldset>
${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`
<fieldset class="switch-form">
<p>${t}</p>
<p>
<a class="register-account toggle-register-login" href="#converse/register">${e}</a>
</p>
</fieldset>
`})():""}
`},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>
<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>
${"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>`:""}
`})(e)}
</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.chatboxes.get("controlbox"),this.listenTo(this.model,"change:closed",(()=>this.requestUpdate())),this.requestUpdate()}render(){return(e=>{const t=Vl.connection.connected()?qy("Chat Contacts"):qy("Toggle chat");return nh`<a id="toggle-controlbox" class="toggle-controlbox ${e.hide?"hidden":""}" @click=${e.onClick}><span class="toggle-feedback">${t}</span></a>`})({onClick:Vx,hide:!this.model?.get("closed")})}}Vl.elements.define("converse-controlbox-toggle",sE);const iE=sE,{Strophe:rE}=Ah.env;const oE=e=>{const t=e.model.toJSON(),n=Vl.settings.get("sticky_controlbox");return nh`
<div class="flyout box-flyout">
<converse-dragresize></converse-dragresize>
<div class="chat-head controlbox-head">
${n?"":nh`
<a class="chatbox-btn close-chatbox-button" @click=${t=>e.close(t)}>
<converse-icon class="fa fa-times" size="1em"></converse-icon>
</a>
`}
</div>
<div class="controlbox-panes">
<div class="controlbox-pane">
${t.connected?nh`
<converse-user-profile></converse-user-profile>
<converse-headlines-feeds-list class="controlbox-section"></converse-headlines-feeds-list>
<div id="chatrooms" class="controlbox-section"><converse-rooms-list></converse-rooms-list></div>
${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)}
</div>
</div>
</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`
<div class="chatbox-title ${e.status?"":"chatbox-title--no-desc"}">
<div class="chatbox-title--row">
${bl.api.settings.get("singleton")?"":nh`<converse-controlbox-navback jid="${e.jid}"></converse-controlbox-navback>`}
<div class="chatbox-title__text" title="${e.jid}">${e.display_name}</div>
</div>
<div class="chatbox-title__buttons row no-gutters">
${Wb(fS(e.heading_buttons_promise),"")}
${Wb(mS(e.heading_buttons_promise),"")}
</div>
</div>
${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`
<div class="flyout box-flyout">
<converse-dragresize></converse-dragresize>
${e?nh`
<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>
`)(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`
<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>
</div>
</div>
<div class="list-container list-container--headline ${t.length?"":"hidden"}">
<div class="items-list rooms-list headline-list">
${t.map((t=>function(e,t){const n=qy("Click to open this server message");return nh`
<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>
`}(e,t)))}
</div>
</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")}">
<div class="message mam-placeholder"></div>
</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`
<form class="affiliation-form" @submit=${t=>e.assignAffiliation(t)}>
${e.alert_message?nh`<div class="alert alert-${e.alert_type}" role="alert">${e.alert_message}</div>`:""}
<div class="form-group">
<div class="row">
<div class="col">
<label><strong>${n}:</strong></label>
<select class="custom-select select-affiliation" name="affiliation">
${i.map((t=>nh`<option value="${t}" ?selected=${t===e.affiliation}>${t}</option>`))}
</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>
`})(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`
<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">
${i.map((t=>nh`<option value="${t}" ?selected=${t===e.role}>${t}</option>`))}
</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>
`})(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`
<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}
@input=${$x}
@keydown=${e.onKeyDown}
@keyup=${e.onKeyUp}
@paste=${e.onPaste}
@change=${e.onChange}
class="chat-textarea suggestion-box__input
${s?"chat-textarea-send-button":""}
${e.composing_spoiler?"spoiler":""}"
placeholder="${t}">${e.message_value||""}</textarea>
<span class="suggestion-box__additions visually-hidden" role="status" aria-live="assertive" aria-relevant="additions"></span>
</div>
</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`
<div class="chatroom-form-container muc-nickname-form">
<form class="converse-form chatroom-form converse-centered-form"
@submit=${t=>e.submitNickname(t)}>
<fieldset class="form-group">
<label>${s}</label>
<p class="validation-message">${i}</p>
<input type="text"
required="required"
name="nick"
value="${e.model?.get("nick")||""}"
class="form-control ${i?"error":""}"
placeholder="${t}"/>
</fieldset>
<fieldset class="form-group">
<input type="submit"
class="btn btn-primary"
name="join"
value="${n}"/>
</fieldset>
</form>
</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`
<converse-chat-toolbar
class="chat-toolbar no-text-select"
.model=${e.model}
?hidden_occupants="${e.model.get("hidden_occupants")}"
?is_groupchat="${e.is_groupchat}"
?show_call_button="${s}"
?show_emoji_button="${i}"
?show_send_button="${r}"
?show_spoiler_button="${o}"
?show_toolbar="${a}"
message_limit="${n}"></converse-chat-toolbar>`:""}
<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">
<converse-muc-nickname-form jid="${e.model.get("jid")}"></converse-muc-nickname-form>
</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)}">
<div class="row no-gutters">
<div class="col-auto">
<a class="show-msg-author-modal" @click=${t=>function(e,t){Vl.modal.show("converse-muc-occupant-modal",{model:t},e)}(t,e)}>
<converse-avatar
class="avatar chat-msg__avatar"
.data=${e.vcard?.attributes}
nonce=${e.vcard?.get("vcard_updated")}
height="30" width="30"></converse-avatar>
<converse-icon
title="${s}"
color="var(--${h})"
style="margin-top: -0.1em"
size="0.82em"
class="${u} chat-status chat-status--avatar"></converse-icon>
</a>
</div>
<div class="col occupant-nick-badge">
<span class="occupant-nick" @click=${t.onOccupantClicked}>${e.getDisplayName()}</span>
<span class="occupant-badges">
${"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>`:""}
</span>
</div>
</div>
</li>
`};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`
<div class="occupants-header">
<div class="occupants-header--title">
<span class="occupants-heading">${e.occupants.length} ${t}</span>
<i class="hide-occupants" @click=${e.closeSidebar}>
<converse-icon class="fa fa-times" size="1em"></converse-icon>
</i>
</div>
</div>
<div class="dragresize dragresize-occupants-left"></div>
<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`
<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>
${e.model?.get("show_help_messages")?nh`<div class="chat-content__help">
<converse-chat-help
.model=${e.model}
.messages=${e.getHelpMessages()}
type="info"
chat_type="${bl.CHATROOMS_TYPE}"
></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>
${e.model?nh`
<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>`:""}
`)({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")?.textContent,s=o.querySelector("title")?.textContent}else s=qy("Loading configuration form");const o=qy("Save"),a=qy("Cancel");return nh`
<form class="converse-form chatroom-form ${i.length?"":"converse-form--spinner"}"
autocomplete="off"
@submit=${e.submitConfigForm}>
<fieldset class="form-group">
<legend class="centered">${s}</legend>
${s!==r?nh`<p class="form-help">${r}</p>`:""}
${i.length?i:Sb({classes:"hor_centered"})}
</fieldset>
${i.length?nh`
<fieldset>
<input type="submit" class="btn btn-primary" value="${o}">
<input type="button" class="btn btn-secondary button-cancel" value="${a}" @click=${e.closeConfigForm}>
</fieldset>`:""}
</form>
`})({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`
<div class="alert alert-danger">
<h3 class="alert-heading disconnect-msg">${t}</h3>
</div>
${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`
<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):""}
`};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`
<div class="alert alert-danger">
<h3 class="alert-heading disconnect-msg">${e[0]}</h3>
${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`
<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>
${t.subject?(e=>{const t=qy("Topic"),n=qy("Topic author");return nh`
<p class="room-info"><strong>${t}</strong>: <converse-rich-text text=${e.subject.text} render_styling></converse-rich-text></p>
<p class="room-info"><strong>${n}</strong>: ${e.subject&&e.subject.author}</p>
`})(t):""}
<p class="room-info"><strong>${x}</strong>: ${i}</p>
<p class="room-info"><strong>${l}</strong>:
<div class="chatroom-features">
<ul class="features-list">
${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>`:""}
</ul>
</div>
</p>
`};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`
<form class="converse-form" @submit=${t=>e.submitInviteForm(t)}>
<div class="form-group">
<label class="clearfix" for="invitee_jids">${i}:</label>
${e.model.get("invalid_invite_jid")?nh`<div class="error error-feedback">${s}</div>`:""}
<converse-autocomplete
.getAutoCompleteList=${()=>e.getAutoCompleteList()}
?autofocus=${!0}
min_chars="1"
position="below"
required="required"
name="invitee_jids"
id="invitee_jids"
placeholder="${n}">
</converse-autocomplete>
</div>
<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>
`})(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`
<div class="chatbox-title ${a?"":"chatbox-title--no-desc"}">
${c&&c!==bl.DEFAULT_IMAGE?nh`
<converse-avatar class="avatar align-self-center"
.data=${e.model.vcard?.attributes}
nonce=${e.model.vcard?.get("vcard_updated")}
height="40" width="40"></converse-avatar>`:""}
<div class="chatbox-title--row">
${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
class="fa fa-bookmark chatbox-title__text--bookmarked"
size="1em"
color="var(--chatroom-head-color)"
title="${r}">
</converse-icon>`:""}
</div>
</div>
<div class="chatbox-title__buttons row no-gutters">
${Wb(mS(s),"")}
${Wb(fS(s),"")}
</div>
</div>
${a?nh`<p class="chat-head__desc" title="${i}">
<converse-rich-text text=${o} render_styling></converse-rich-text>
</p>`:""}
`})(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`
<form class="converse-form chatroom-form converse-centered-form" @submit=${e.submitPassword}>
<fieldset class="form-group">
<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}"/>
</fieldset>
<fieldset class="form-group">
<input class="btn btn-primary" type="submit" value="${s}"/>
</fieldset>
</form>
`})({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`
<div class="flyout box-flyout">
<converse-dragresize></converse-dragresize>
${e.model?nh`
<converse-muc-heading jid="${e.model.get("jid")}" class="chat-head chat-head-chatroom row no-gutters">
</converse-muc-heading>
<div class="chat-body chatroom-body row no-gutters">${cw(e)}</div>
`:""}
</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"}">
<a id="toggle-minimized-chats" class="row no-gutters" @click=${e.toggle}>
${e.num_minimized} ${qy("Minimized")}
<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":""}">
${e.chats.map((e=>nh`<converse-minimized-chat
.model=${e}
title=${e.getDisplayName()}
type=${e.get("type")}
num_unread=${e.get("num_unread")}></converse-minimized-chat>`))}
</div>
</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`
<div class="chat-head-${e.type} chat-head row no-gutters">
<a class="restore-chat w-100 align-self-center" title="${t}" @click=${e.restore}>
${e.num_unread?nh`<span class="message-count badge badge-light">${e.num_unread}</span>`:""}
${e.title}
</a>
<a class="chatbox-btn close-chatbox-button" @click=${e.close}>
<converse-icon color=${n} class="fas fa-times" @click=${e.close} size="1em"></converse-icon>
</a>
</div>`})({close:e=>this.close(e),num_unread:this.num_unread,restore:e=>this.restore(e),title:this.title,type:this.type})}close(e){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.body));const l=o!==c,d=!0===s||Array.isArray(s)&&s.includes(n)||NA(e.references,n,c)||a;if(l&&d)return await Vl.hook("shouldNotifyOfGroupMessage",e,!0);return!1}(t);if("info"===t.type)return async function(e){if(!e.from_muc)return!1;const t=await Vl.rooms.get(e.from_muc);if(!t)return!1;const n=t.get("nick"),s=e.from_muc,i=Vl.settings.get("notify_all_room_messages");return!0===i||Array.isArray(i)&&i.includes(s)||NA(e.references,s,n)}(t);if(t.is_headline)return kA(t);const n=AA.getBareJidFromJid(t.from)===bl.bare_jid;return!Nc(t)&&!n&&("all"===Vl.settings.get("show_desktop_notifications")||kA(t))}async function MA(e){if(!await OA(e))return!1;Vl.trigger("messageNotification",e),function(){if(Vl.settings.get("play_sounds")&&void 0!==window.Audio){const e=new Audio(Vl.settings.get("sounds_path")+"msg_received.ogg"),t=e.canPlayType("audio/ogg");if("probably"===t)return e.play();const n=new Audio(Vl.settings.get("sounds_path")+"msg_received.mp3"),s=n.canPlayType("audio/mp3");"probably"===s?n.play():"maybe"===t?e.play():"maybe"===s&&n.play()}}(),function(e){const{attrs:t}=e;if(t.is_error)return;if(!jA())return;let n,s;const i=t.from,r=AA.getBareJidFromJid(i);if("info"==t.type)n=t.message;else if("headline"===t.type){if(r.includes("@")&&!Vl.settings.get("allow_non_roster_messaging"))return;n=qy("Notification from %1$s",r)}else if(r.includes("@"))if("groupchat"===t.type)n=qy("%1$s says",AA.getResourceFromJid(i));else{if(void 0===bl.roster)return void Yc.error("Could not send notification, because roster is undefined");if(s=bl.roster.get(r),void 0!==s)n=qy("%1$s says",s.getDisplayName());else{if(!Vl.settings.get("allow_non_roster_messaging"))return;n=qy("%1$s says",r)}}else n=qy("Notification from %1$s",r);let o;if("info"==t.type)o=t.reason;else if(o=t.is_encrypted?t.plaintext:t.body,!o)return;const a=new Notification(n,{body:o,lang:bl.locale,icon:Vl.settings.get("notification_icon"),requireInteraction:!Vl.settings.get("notification_delay")});Vl.settings.get("notification_delay")&&setTimeout((()=>a.close()),Vl.settings.get("notification_delay")),a.onclick=function(e){e.preventDefault(),window.focus(),bl.chatboxes.get(r).maybeShow(!0)}}(e)}function RA(e){jA()&&function(e){if("error"===e.klass||"warn"===e.klass){const t=new Notification(e.subject,{body:e.message,lang:bl.locale,icon:Vl.settings.get("notification_icon")});setTimeout(t.close.bind(t),5e3)}}(e)}function DA(e){jA()&&Vl.settings.get("show_chat_state_notifications")&&function(e){if(Vl.settings.get("chatstate_notification_blacklist")?.includes(e.jid))return;const t=e.presence.get("show");let n=null;if("offline"===t?n=qy("has gone offline"):"away"===t?n=qy("has gone away"):"dnd"===t?n=qy("is busy"):"online"===t&&(n=qy("has come online")),null===n)return;const s=new Notification(e.getDisplayName(),{body:n,lang:bl.locale,icon:Vl.settings.get("notification_icon")});setTimeout((()=>s.close()),5e3)}(e)}function zA(e){jA()&&function(e){const t=new Notification(e.getDisplayName(),{body:qy("wants to be your contact"),lang:bl.locale,icon:Vl.settings.get("notification_icon")});setTimeout((()=>t.close()),5e3)}(e)}function LA(){CA&&!["denied","granted"].includes(Notification.permission)&&Notification.requestPermission()}Ah.env.Favico=EA(),Ah.plugins.add("converse-notification",{dependencies:["converse-chatboxes"],initialize(){Vl.settings.extend({chatstate_notification_blacklist:[],notification_delay:5e3,notification_icon:"/images/logo/conversejs-filled.svg",notify_all_room_messages:!1,notify_nicknames_without_references:!1,play_sounds:!0,show_chat_state_notifications:!1,show_desktop_notifications:!0,show_tab_notifications:!0,sounds_path:Vl.settings.get("assets_path")+"/sounds/"}),Vl.listen.on("clearSession",TA),Vl.waitUntil("chatBoxesInitialized").then((()=>bl.chatboxes.on("change:num_unread",IA))),Vl.listen.on("pluginsInitialized",(function(){Vl.listen.on("contactRequest",zA),Vl.listen.on("contactPresenceChanged",DA),Vl.listen.on("message",MA),Vl.listen.on("feedback",RA),Vl.listen.on("connected",LA)}))}});const PA=Ah.env.utils;class FA extends tb{initialize(){super.initialize(),this.render(),this.addEventListener("shown.bs.modal",(()=>{this.querySelector('input[name="status_message"]').focus()}),!1)}renderModal(){return(e=>{const t=qy("Away"),n=qy("Busy"),s=qy("Online"),i=qy("Save"),r=qy("Away for long"),o=qy("Personal status message"),a=e.model.get("status"),c=e.model.get("status_message");return nh`
<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>
</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}">
<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"/>
`}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">
<a class="nav-link ${"profile"===e.tab?"active":""}"
id="profile-tab"
href="#profile-tabpanel"
aria-controls="profile-tabpanel"
role="tab"
@click=${t=>e.switchTab(t)}
data-name="profile"
data-toggle="tab">${u}</a>
</li>`];return m.push(nh`<li role="presentation" class="nav-item">
<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>
</li>`),bl.pluggable.plugins["converse-omemo"]?.enabled(bl)&&m.push(nh`<li role="presentation" class="nav-item">
<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>
</li>`),nh`
<ul class="nav nav-pills justify-content-center">${m}</ul>
<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">
<converse-image-picker .data="${{image:t.image,image_type:t.image_type}}" width="128" height="128"></converse-image-picker>
</div>
<div class="col">
<div class="form-group">
<label class="col-form-label">${i}:</label>
<div>${t.jid}</div>
</div>
</div>
</div>
<div class="form-group">
<label for="vcard-fullname" class="col-form-label">${s}:</label>
<input id="vcard-fullname" type="text" class="form-control" name="fn" value="${t.fullname||""}"/>
</div>
<div class="form-group">
<label for="vcard-nickname" class="col-form-label">${r}:</label>
<input id="vcard-nickname" type="text" class="form-control" name="nickname" value="${t.nickname||""}"/>
</div>
<div class="form-group">
<label for="vcard-url" class="col-form-label">${l}:</label>
<input id="vcard-url" type="url" class="form-control" name="url" value="${t.url||""}"/>
</div>
<div class="form-group">
<label for="vcard-email" class="col-form-label">${n}:</label>
<input id="vcard-email" type="email" class="form-control" name="email" value="${t.email||""}"/>
</div>
<div class="form-group">
<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>
</div>
<hr/>
<div class="form-group">
<button type="submit" class="save-form btn btn-primary">${a}</button>
</div>
</form>
</div>
<div class="tab-pane ${"passwordreset"===e.tab?"active":""}" id="passwordreset-tabpanel" role="tabpanel" aria-labelledby="passwordreset-tab">
${"passwordreset"===e.tab?nh`<converse-change-password-form></converse-change-password-form>`:""}
</div>
${bl.pluggable.plugins["converse-omemo"]?.enabled(bl)?(e=>nh`
<div class="tab-pane ${"omemo"===e.tab?"active":""}" id="omemo-tabpanel" role="tabpanel" aria-labelledby="omemo-tab">
${"omemo"===e.tab?nh`<converse-omemo-profile></converse-omemo-profile>`:""}
</div>`)(e):""}
</div>
</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>`:""}
<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)}
/>
${e.passwords_mismatched?nh`<span class="error">${n}</span>`:""}
</div>
<input class="save-form btn btn-primary"
type="submit"
value=${t}
?disabled="${e.alert_message}" />
</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`
<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">
${s?nh`
<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>
<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>
</div>
</div>`:""}
${i?nh`
<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>
`};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}>
<converse-icon class="fa fa-sign-out-alt" size="1em"></converse-icon>
</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`
<div class="userinfo controlbox-padded">
<div class="controlbox-section profile d-flex">
<a class="show-profile" href="#" @click=${e.showProfileModal}>
<converse-avatar class="avatar align-self-center"
.data=${e.model.vcard?.attributes}
nonce=${e.model.vcard?.get("vcard_updated")}
height="40" width="40"></converse-avatar>
</a>
<span class="username w-100 align-self-center">${e.model.getDisplayName()}</span>
${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}>
<converse-icon class="fa fa-cog" size="1em"></converse-icon>
</a>`}(e):""}
${Vl.settings.get("allow_logout")?nC():""}
</div>
<div class="d-flex xmpp-status">
<a class="change-status" title="${i}" data-toggle="modal" data-target="#changeStatusModal" @click=${e.showStatusChangeModal}>
<span class="${t} w-100 align-self-center" data-value="${t}">
<converse-icon color="var(--${a})" style="margin-top: -0.1em" size="0.82em" class="${o}"></converse-icon> ${n}</span>
</a>
</div>
</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.replace(r,"");let a;try{a=await async function(e,t,n){const s=await crypto.subtle.importKey("raw",Jg(t),"AES-GCM",!1,["decrypt"]),i={name:"AES-GCM",iv:Jg(e)};return crypto.subtle.decrypt(i,s,n)}(o,r,s)}catch(t){return Yc.error(`Could not decrypt file ${e.toString()}`),Yc.error(t),null}const[c,l]=e.filename().split("."),d=oC[l];try{const e=new File([a],c,{type:d});return URL.createObjectURL(e)}catch(t){return Yc.error(`Could not decrypt file ${e.toString()}`),Yc.error(t),null}}function fC(e,t,n){if(s=t,"[object Error]"===Object.prototype.toString.call(s))return nh`<p class="error">${t.message}</p>`;var s;const i=e.toString();return Zh(i)?eS({src:t,onClick:n.onImgClick,onLoad:n.onImgLoad}):Vh(i)?f_(t):Jh(i)?S_(t):g_(t,e.filename())}function gC(e){bl.config.get("trusted")&&e.addAnnotations(((t,n)=>function(e,t,n){const s=[];try{const t={start:/\b(aesgcm:\/\/)/gi};cC.withinString(e,((e,t,n)=>(s.push({url:e,start:t,end:n}),e)),t)}catch(e){return void Yc.debug(e)}s.forEach((s=>{const i=Lh(e.slice(s.start,s.end)),r=mC(i).then((e=>fC(i,e,n))),o=nh`${Wb(r,"")}`;n.addTemplateResult(s.start+t,s.end+t,o)}))}(t,n,e)))}async function pC(e,t){if(Vl.settings.get("clear_cache_on_logout")||!t.is_encrypted||t.encryption_namespace!==aC.NS.OMEMO)return t;const n=lC(`encrypted[xmlns="${aC.NS.OMEMO}"]`,e).pop(),s=n.querySelector("header");t.encrypted={device_id:s.getAttribute("sid")};const i=await(Vl.omemo?.getDeviceID()),r=i&&lC(`key[rid="${i}"]`,n).pop();return r?(Object.assign(t.encrypted,{iv:s.querySelector("iv").textContent,key:r.textContent,payload:n.querySelector("payload")?.textContent||null,prekey:["true","1"].includes(r.getAttribute("prekey"))}),!0===t.encrypted.prekey?async function(e){const t=bC(e),n=_C(t,parseInt(e.encrypted.device_id,10)),s=Vg(e.encrypted.key);let i;try{i=await n.decryptPreKeyWhisperMessage(s,"binary")}catch(t){return Yc.error(`${t.name} ${t.message}`),Object.assign(e,SC(t))}try{const t=await wC(e,i);return await bl.omemo_store.generateMissingPreKeys(),await bl.omemo_store.publishBundle(),t?Object.assign(e,{plaintext:t}):Object.assign(e,{is_only_key:!0})}catch(t){return Yc.error(`${t.name} ${t.message}`),Object.assign(e,SC(t))}}(t):async function(e){const t=bC(e),n=_C(t,parseInt(e.encrypted.device_id,10)),s=Vg(e.encrypted.key);try{const t=await n.decryptWhisperMessage(s,"binary"),i=await wC(e,t);return Object.assign(e,{plaintext:i})}catch(t){return Yc.error(`${t.name} ${t.message}`),Object.assign(e,SC(t))}}(t)):Object.assign(t,{error_condition:"not-encrypted-for-this-device",error_type:"Decryption",is_ephemeral:!0,is_error:!0,type:"error"})}function vC(){bl.chatboxes.on("add",(e=>{TC(e),e.get("type")===bl.CHATROOMS_TYPE&&(e.occupants.on("add",(t=>async function(e,t){if(t.isSelf()||!e.features.get("nonanonymous")||!e.features.get("membersonly"))return;if(e.get("omemo_active")){await bl.contactHasOMEMOSupport(t.get("jid"))||(e.createMessage({message:qy("%1$s doesn't appear to have a client that supports OMEMO. Encrypted chat will no longer be possible in this grouchat.",t.get("nick")),type:"error"}),e.save({omemo_active:!1,omemo_supported:!1}))}}(e,t))),e.features.on("change",(()=>TC(e))))}))}function yC(e){e.listenTo(e.model.messages,"add",(t=>{t.get("is_encrypted")&&!t.get("is_error")&&e.model.save("omemo_supported",!0)})),e.listenTo(e.model,"change:omemo_supported",(()=>{!e.model.get("omemo_supported")&&e.model.get("omemo_active")?e.model.set("omemo_active",!1):e.querySelector("converse-chat-toolbar")?.requestUpdate()})),e.listenTo(e.model,"change:omemo_active",(()=>{e.querySelector("converse-chat-toolbar").requestUpdate()}))}function _C(e,t){const n=new libsignal.SignalProtocolAddress(e,t);return new window.libsignal.SessionCipher(bl.omemo_store,n)}function bC(e){const t=e.from_muc?e.from_real_jid:e.from;if(!t)throw Object.assign(e,{error_text:qy("Sorry, could not decrypt a received OMEMO message because we don't have the XMPP address for that user."),error_type:"Decryption",is_ephemeral:!0,is_error:!0,type:"error"}),new Error("Could not find JID to decrypt OMEMO message for");return t}async function wC(e,t){const n=bC(e),s=await Vl.omemo.devicelists.get(n,!0),i=e.encrypted;let r=s.devices.get(i.device_id);if(r||(r=await s.devices.create({id:i.device_id,jid:n},{promise:!0})),i.payload){const e=t.slice(0,16),n=t.slice(16),s=await MC.decryptMessage(Object.assign(i,{key:e,tag:n}));return r.save("active",!0),s}}function SC(e){return{error_text:qy("Sorry, could not decrypt a received OMEMO message due to an error.")+` ${e.name} ${e.message}`,error_condition:e.name,error_message:e.message,error_type:"Decryption",is_ephemeral:!0,is_error:!0,type:"error"}}function xC(e){const t=e.querySelector("signedPreKeyPublic"),n=e.querySelector("signedPreKeySignature"),s=lC("prekeys > preKeyPublic",e).map((e=>({id:parseInt(e.getAttribute("preKeyId"),10),key:e.textContent})));return{identity_key:e.querySelector("identityKey").textContent.trim(),signed_prekey:{id:parseInt(t.getAttribute("signedPreKeyId"),10),public_key:t.textContent,signature:n.textContent},prekeys:s}}async function EC(e){if(e.get("bundle")?.fingerprint)return;const t=await e.getBundle();t.fingerprint=qg(Vg(t.identity_key)),e.save("bundle",t),e.trigger("change:bundle")}async function AC(e){await Vl.waitUntil("OMEMOInitialized");const t=await Vl.omemo.devicelists.get(e,!0);return await t.fetchDevices(),t.devices}async function CC(e){if(!e.get("bundle"))return Yc.error(`Could not build an OMEMO session for device ${e.get("id")} because we don't have its bundle`),null;const t=new libsignal.SignalProtocolAddress(e.get("jid"),e.get("id")),n=await bl.omemo_store.loadSession(t.toString());if(n)return n;try{const t=await async function(e){const t=new libsignal.SignalProtocolAddress(e.get("jid"),e.get("id")),n=new libsignal.SessionBuilder(bl.omemo_store,t),s=e.getRandomPreKey(),i=await e.getBundle();return n.processPreKey({registrationId:parseInt(e.get("id"),10),identityKey:Vg(i.identity_key),signedPreKey:{keyId:i.signed_prekey.id,publicKey:Vg(i.signed_prekey.public_key),signature:Vg(i.signed_prekey.signature)},preKey:{keyId:s.id,publicKey:Vg(s.key)}})}(e);return t}catch(t){return Yc.error(`Could not build an OMEMO session for device ${e.get("id")}`),Yc.error(t),null}}function $C(){bl.connection.addHandler((async e=>{try{lC(`event[xmlns="${aC.NS.PUBSUB}#event"]`,e).length&&(await Vl.waitUntil("OMEMOInitialized"),await async function(e){const t=lC(`items[node="${aC.NS.OMEMO_DEVICELIST}"]`,e).pop();if(!t)return;const n=`item list[xmlns="${aC.NS.OMEMO}"] device`,s=lC(n,t).map((e=>e.getAttribute("id"))),i=e.getAttribute("from"),r=await Vl.omemo.devicelists.get(i,!0),o=r.devices;hd(o.pluck("id"),s).forEach((e=>{i===bl.bare_jid&&e===bl.omemo_store.get("device_id")||o.get(e).save("active",!1)})),s.forEach((e=>{const t=o.get(e);t?t.save("active",!0):o.create({id:e,jid:i})})),dC.isSameBareJID(i,bl.bare_jid)&&r.publishCurrentDevice(s)}(e),await async function(e){const t=lC("items",e).pop();if(!t||!t.getAttribute("node").startsWith(aC.NS.OMEMO_BUNDLES))return;const n=t.getAttribute("node").split(":")[1],s=e.getAttribute("from"),i=lC("item > bundle",t).pop(),r=await Vl.omemo.devicelists.get(s,!0);(r.devices.get(n)||r.devices.create({id:n,jid:s})).save({bundle:xC(i)})}(e))}catch(e){Yc.error(e.message)}return!0}),null,"message","headline")}async function kC(){if(void 0===bl.omemo_store){const e=`converse.omemosession-${bl.bare_jid}`;bl.omemo_store=new bl.OMEMOStore({id:e}),vc(bl.omemo_store,e)}await bl.omemo_store.fetchSession()}async function jC(e){if(!e)if(bl.config.get("trusted")&&!Vl.settings.get("clear_cache_on_logout")){try{await async function(){bl.devicelists=new bl.DeviceLists;const e=`converse.devicelists-${bl.bare_jid}`;vc(bl.devicelists,e),await new Promise((e=>{bl.devicelists.fetch({success:e,error:(t,n)=>{Yc.error(n),e()}})})),await Vl.omemo.devicelists.get(bl.bare_jid,!0)}(),await kC(),await bl.omemo_store.publishBundle()}catch(e){return Yc.error("Could not initialize OMEMO support"),void Yc.error(e)}Vl.trigger("OMEMOInitialized")}else Yc.warn("Not initializing OMEMO, since this browser is not trusted or clear_cache_on_logout is set to true")}async function TC(e){let t;e.get("type")===bl.CHATROOMS_TYPE?(await Vl.waitUntil("OMEMOInitialized"),t=e.features.get("nonanonymous")&&e.features.get("membersonly")):e.get("type")===bl.PRIVATE_CHAT_TYPE&&(t=await bl.contactHasOMEMOSupport(e.get("jid"))),e.set("omemo_supported",t),t&&Vl.settings.get("omemo_default")&&e.set("omemo_active",!0)}function IC(e){e.stopPropagation(),e.preventDefault();const t=dC.ancestor(e.target,"converse-chat-toolbar");if(!t.model.get("omemo_supported")){let e;return e=t.model.get("type")===bl.CHATROOMS_TYPE?[qy("Cannot use end-to-end encryption in this groupchat, either the groupchat has some anonymity or not all participants support OMEMO.")]:[qy("Cannot use end-to-end encryption because %1$s uses a client that doesn't support OMEMO.",t.model.contact.getDisplayName())],Vl.alert("error",qy("Error"),e)}t.model.save({omemo_active:!t.model.get("omemo_active")})}function NC(e,t){const n=e.model,s=n.get("type")===bl.CHATROOMS_TYPE;let i,r;if(n.get("omemo_supported")){const e=qy("Messages are being sent in plaintext"),t=qy("Messages are sent encrypted");i=n.get("omemo_active")?t:e}else i=qy(s?"This groupchat needs to be members-only and non-anonymous in order to support OMEMO encrypted messages":"OMEMO encryption is not supported");return r=n.get("omemo_supported")?n.get("omemo_active")?s?"var(--muc-color)":"var(--chat-toolbar-btn-color)":"var(--error-color)":"var(--muc-toolbar-btn-disabled-color)",t.push(nh`
<button class="toggle-omemo" title="${i}" data-disabled=${!n.get("omemo_supported")} @click=${IC}>
<converse-icon
class="fa ${n.get("omemo_active")?"fa-lock":"fa-unlock"}"
path-prefix="${Vl.settings.get("assets_path")}"
size="1em"
color="${r}"
></converse-icon>
</button>
`),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`
<hr/>
<ul class="list-group fingerprints">
<li class="list-group-item active">${t}</li>
${s.length?s.map((t=>((e,t)=>{const n=qy("Trusted"),s=qy("Untrusted");return t.get("bundle")&&t.get("bundle").fingerprint?nh`
<li class="list-group-item">
<form class="fingerprint-trust">
<div class="btn-group btn-group-toggle">
<label class="btn btn--small ${1===t.get("trusted")?"btn-primary active":"btn-secondary"}"
@click=${e.toggleDeviceTrust}>
<input type="radio" name="${t.get("id")}" value="1"
?checked=${-1!==t.get("trusted")}>${n}
</label>
<label class="btn btn--small ${-1===t.get("trusted")?"btn-primary active":"btn-secondary"}"
@click=${e.toggleDeviceTrust}>
<input type="radio" name="${t.get("id")}" value="-1"
?checked=${-1===t.get("trusted")}>${s}
</label>
</div>
<code class="fingerprint">${uC(t.get("bundle").fingerprint)}</code>
</form>
</li>
`:""})(e,t))):nh`<li class="list-group-item"> ${n} </li>`}
</ul>
`};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`
<li class="fingerprint-removal-item list-group-item">
<label>
<input type="checkbox" value="${e.device.get("id")}"
aria-label="${t}"/>
<span class="fingerprint">${uC(e.device.get("bundle").fingerprint)}</span>
</label>
</li>
`})(e):(e=>{const t=qy("Device without a fingerprint"),n=qy("Checkbox for selecting the following device");return nh`
<li class="fingerprint-removal-item list-group-item">
<label>
<input type="checkbox" value="${e.device.get("id")}"
aria-label="${n}"/>
<span>${t}</span>
</label>
</li>
`})(e)}
`,zC=e=>{const t=qy("This device's OMEMO fingerprint"),n=qy("Generate new keys and fingerprint");return nh`
<form class="converse-form fingerprint-removal" @submit=${e.removeSelectedFingerprints}>
<ul class="list-group fingerprints">
<li class="list-group-item active">${t}</li>
<li class="list-group-item">
${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()}
</li>
</ul>
<div class="form-group">
<button type="button" class="generate-bundle btn btn-danger" @click=${e.generateOMEMODeviceBundle}>${n}</button>
</div>
${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`
<ul class="list-group fingerprints">
<li class="list-group-item active">
<label>
<input type="checkbox" class="select-all" @change=${e.selectAll} title="${i}" aria-label="${n}"/>
${t}
</label>
</li>
${e.other_devices?.map((t=>DC(Object.assign({device:t},e))))}
</ul>
<div class="form-group"><button type="submit" class="save-form btn btn-primary">${s}</button></div>
`})(e):""}
</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.includes(await this.getOwnDeviceId())?void 0:this.publishDevices();Yc.warn("publishCurrentDevice: omemo_store is not defined, likely a timing issue")}},async fetchDevicesFromServer(){const e=QC({type:"get",from:bl.bare_jid,to:this.get("jid")}).c("pubsub",{xmlns:JC.NS.PUBSUB}).c("items",{node:JC.NS.OMEMO_DEVICELIST}),t=await Vl.sendIQ(e),n=`list[xmlns="${JC.NS.OMEMO}"] device`,s=KC(n,t).map((e=>e.getAttribute("id"))),i=this.get("jid");return Promise.all(s.map((e=>this.devices.create({id:e,jid:i},{promise:!0}))))},publishDevices(){const e=ZC("item",{id:"current"}).c("list",{xmlns:JC.NS.OMEMO});this.devices.filter((e=>e.get("active"))).forEach((t=>e.c("device",{id:t.get("id")}).up()));return Vl.pubsub.publish(null,JC.NS.OMEMO_DEVICELIST,e,{"pubsub#access_model":"open"},!1)},async removeOwnDevices(e){if(this.get("jid")!==bl.bare_jid)throw new Error("Cannot remove devices from someone else's device list");return await Promise.all(e.map((e=>this.devices.get(e))).map((e=>new Promise((t=>e.destroy({success:t,error:(e,n)=>{Yc.error(n),t()}})))))),this.publishDevices()}}),XC=YC,e$=Fd.extend({model:XC}),t$=Fd.extend({model:VC});var n$=Math.ceil,s$=Math.max;const i$=function(e,t,n,s){for(var i=-1,r=s$(n$((t-e)/(n||1)),0),o=Array(r);r--;)o[s?r:++i]=e,e+=n;return o};const r$=function(e){return function(t,n,s){return s&&"number"!=typeof s&&De(t,n,s)&&(n=s=void 0),t=En(t),void 0===n?(n=t,t=0):n=En(n),s=void 0===s?t<n?1:-1:En(s),i$(t,n,s,e)}}(),{Strophe:o$,$build:a$,u:c$}=Ah.env,l$=dr.extend({Direction:{SENDING:1,RECEIVING:2},getIdentityKeyPair(){const e=this.get("identity_keypair");return Promise.resolve({privKey:c$.base64ToArrayBuffer(e.privKey),pubKey:c$.base64ToArrayBuffer(e.pubKey)})},getLocalRegistrationId(){return Promise.resolve(parseInt(this.get("device_id"),10))},isTrustedIdentity(e,t,n){if(null==e)throw new Error("Can't check identity key for invalid key");if(!(t instanceof ArrayBuffer))throw new Error("Expected identity_key to be an ArrayBuffer");const s=this.get("identity_key"+e);return void 0===s?Promise.resolve(!0):Promise.resolve(c$.arrayBufferToBase64(t)===s)},loadIdentityKey(e){if(null==e)throw new Error("Can't load identity_key for invalid identifier");return Promise.resolve(c$.base64ToArrayBuffer(this.get("identity_key"+e)))},saveIdentity(e,t){if(null==e)throw new Error("Can't save identity_key for invalid identifier");const n=new libsignal.SignalProtocolAddress.fromString(e),s=this.get("identity_key"+n.getName()),i=c$.arrayBufferToBase64(t);return this.save("identity_key"+n.getName(),i),s&&i!==s?Promise.resolve(!0):Promise.resolve(!1)},getPreKeys(){return this.get("prekeys")||{}},loadPreKey(e){const t=this.getPreKeys()[e];return t?Promise.resolve({privKey:c$.base64ToArrayBuffer(t.privKey),pubKey:c$.base64ToArrayBuffer(t.pubKey)}):Promise.resolve()},storePreKey(e,t){const n={};return n[e]={pubKey:c$.arrayBufferToBase64(t.pubKey),privKey:c$.arrayBufferToBase64(t.privKey)},this.save("prekeys",Object.assign(this.getPreKeys(),n)),Promise.resolve()},removePreKey(e){return this.save("prekeys",rr(this.getPreKeys(),e)),Promise.resolve()},loadSignedPreKey(e){const t=this.get("signed_prekey");return t?Promise.resolve({privKey:c$.base64ToArrayBuffer(t.privKey),pubKey:c$.base64ToArrayBuffer(t.pubKey)}):Promise.resolve()},storeSignedPreKey(e){if("object"!=typeof e)throw new Error("storeSignedPreKey: expected an object");return this.save("signed_prekey",{id:e.keyId,privKey:c$.arrayBufferToBase64(e.keyPair.privKey),pubKey:c$.arrayBufferToBase64(e.keyPair.pubKey),signature:c$.arrayBufferToBase64(e.signature)}),Promise.resolve()},removeSignedPreKey(e){return this.get("signed_prekey").id===e&&(this.unset("signed_prekey"),this.save()),Promise.resolve()},loadSession(e){return Promise.resolve(this.get("session"+e))},storeSession(e,t){return Promise.resolve(this.save("session"+e,t))},removeSession(e){return Promise.resolve(this.unset("session"+e))},removeAllSessions(e){const t=Object.keys(this.attributes).filter((t=>!!t.startsWith("session"+e)&&t)),n={};return t.forEach((e=>{n[e]=void 0})),this.save(n),Promise.resolve()},publishBundle(){const e=this.get("signed_prekey"),t=`${o$.NS.OMEMO_BUNDLES}:${this.get("device_id")}`,n=a$("item").c("bundle",{xmlns:o$.NS.OMEMO}).c("signedPreKeyPublic",{signedPreKeyId:e.id}).t(e.pubKey).up().c("signedPreKeySignature").t(e.signature).up().c("identityKey").t(this.get("identity_keypair").pubKey).up().c("prekeys");Object.values(this.get("prekeys")).forEach(((e,t)=>n.c("preKeyPublic",{preKeyId:t}).t(e.pubKey).up()));return Vl.pubsub.publish(null,t,n,{"pubsub#access_model":"open"},!1)},async generateMissingPreKeys(){const e=hd(bw(r$(0,bl.NUM_PREKEYS),Number.prototype.toString),Object.keys(this.getPreKeys()));if(e.length<1)return Yc.warn("No missing prekeys to generate for our own device"),Promise.resolve();(await Promise.all(e.map((e=>libsignal.KeyHelper.generatePreKey(parseInt(e,10)))))).forEach((e=>this.storePreKey(e.keyId,e.keyPair)));const t=Object.keys(this.getPreKeys()).map((e=>({id:e.keyId,key:c$.arrayBufferToBase64(e.pubKey)}))),n=(await Vl.omemo.devicelists.get(bl.bare_jid)).devices.get(this.get("device_id")),s=await n.getBundle();n.save("bundle",Object.assign(s,{prekeys:t}))},async generatePreKeys(){const e=bl.NUM_PREKEYS,{KeyHelper:t}=libsignal,n=await Promise.all(r$(0,e).map((e=>t.generatePreKey(e))));return n.forEach((e=>this.storePreKey(e.keyId,e.keyPair))),n.map((e=>({id:e.keyId,key:c$.arrayBufferToBase64(e.keyPair.pubKey)})))},async generateBundle(){const e=await libsignal.KeyHelper.generateIdentityKeyPair(),t=c$.arrayBufferToBase64(e.pubKey),n=await async function(){const e=(await Vl.omemo.devicelists.get(bl.bare_jid,!0)).devices.pluck("id");let t=libsignal.KeyHelper.generateRegistrationId(),n=0;for(;e.includes(t);)if(t=libsignal.KeyHelper.generateRegistrationId(),n++,10===n)throw new Error("Unable to generate a unique device ID");return t.toString()}();this.save({device_id:n,identity_keypair:{privKey:c$.arrayBufferToBase64(e.privKey),pubKey:t},identity_key:t});const s=await libsignal.KeyHelper.generateSignedPreKey(e,0);this.storeSignedPreKey(s);const i={identity_key:t,device_id:n,prekeys:await this.generatePreKeys()};i.signed_prekey={id:s.keyId,public_key:c$.arrayBufferToBase64(s.keyPair.pubKey),signature:c$.arrayBufferToBase64(s.signature)};const r=await Vl.omemo.devicelists.get(bl.bare_jid);(await r.devices.create({id:i.device_id,jid:bl.bare_jid},{promise:!0})).save("bundle",i)},fetchSession(){return void 0===this._setup_promise&&(this._setup_promise=new Promise(((e,t)=>{this.fetch({success:()=>{this.get("device_id")?e():this.generateBundle().then(e).catch(t)},error:(n,s)=>{Yc.warn("Could not fetch OMEMO session from cache, we'll generate a new one."),Yc.warn(s),this.generateBundle().then(e).catch(t)}})}))),this._setup_promise}}),d$=l$,u$={omemo:{getDeviceID:async()=>(await Vl.waitUntil("OMEMOInitialized"),bl.omemo_store.get("device_id")),devicelists:{async get(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=bl.devicelists.get(e)||(t?bl.devicelists.create({jid:e}):null);return await(n?.initialized),n}},bundle:{generate:async()=>{await Vl.waitUntil("OMEMOInitialized");const e=await Vl.omemo.devicelists.get(bl.bare_jid),t=bl.omemo_store.get("device_id");if(t){const n=e.devices.get(t);bl.omemo_store.unset(t),n&&await new Promise((e=>n.destroy({success:e,error:e}))),e.devices.trigger("remove")}await bl.omemo_store.generateBundle(),await e.publishDevices();const n=EC(e.devices.get(bl.omemo_store.get("device_id")));return await bl.omemo_store.publishBundle(),n}}}},{Strophe:h$}=Ah.env;Ah.env.omemo=MC,h$.addNamespace("OMEMO_DEVICELIST",h$.NS.OMEMO+".devicelist"),h$.addNamespace("OMEMO_VERIFICATION",h$.NS.OMEMO+".verification"),h$.addNamespace("OMEMO_WHITELISTED",h$.NS.OMEMO+".whitelisted"),h$.addNamespace("OMEMO_BUNDLES",h$.NS.OMEMO+".bundles"),Ah.plugins.add("converse-omemo",{enabled:e=>window.libsignal&&e.config.get("trusted")&&!Vl.settings.get("clear_cache_on_logout")&&!e.api.settings.get("blacklisted_plugins").includes("converse-omemo"),dependencies:["converse-chatview","converse-pubsub","converse-profile"],initialize(){Vl.settings.extend({omemo_default:!1}),Vl.promises.add(["OMEMOInitialized"]),bl.NUM_PREKEYS=100,Object.assign(bl,BC),Object.assign(bl.api,u$),bl.OMEMOStore=d$,bl.Device=VC,bl.Devices=t$,bl.DeviceList=XC,bl.DeviceLists=e$,Vl.waitUntil("chatBoxesInitialized").then(vC),Vl.listen.on("getOutgoingMessageAttributes",hC),Vl.listen.on("createMessageStanza",(async(e,t)=>{try{t=await OC(e,t)}catch(t){!function(e,t){if("IQError"===e.name){t.save("omemo_supported",!1);const n=[];lC(`presence-subscription-required[xmlns="${aC.NS.PUBSUB_ERROR}"]`,e.iq).length?n.push(qy("Sorry, we're unable to send an encrypted message because %1$s requires you to be subscribed to their presence in order to see their OMEMO information",e.iq.getAttribute("from"))):lC('remote-server-not-found[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]',e.iq).length?n.push(qy("Sorry, we're unable to send an encrypted message because the remote server for %1$s could not be found",e.iq.getAttribute("from"))):(n.push(qy("Unable to send an encrypted message due to an unexpected error.")),n.push(e.iq.outerHTML)),Vl.alert("error",qy("Error"),n)}else e.user_facing&&Vl.alert("error",qy("Error"),[e.message]);throw e}(t,e)}return t})),Vl.listen.on("afterFileUploaded",((e,t)=>e.file.xep454_ivkey?function(e,t){const n=t.oob_url.replace(/^https?:/,"aesgcm:")+"#"+e.file.xep454_ivkey;return Object.assign(t,{oob_url:null,message:n,body:n})}(e,t):t)),Vl.listen.on("beforeFileUpload",((e,t)=>e.get("omemo_active")?async function(e){const t=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.generateKey({name:"AES-GCM",length:256},!0,["encrypt","decrypt"]),s=await crypto.subtle.encrypt({name:"AES-GCM",iv:t},n,await e.arrayBuffer()),i=await window.crypto.subtle.exportKey("raw",n),r=new File([s],e.name,{type:e.type,lastModified:e.lastModified});return r.xep454_ivkey=qg(t)+qg(i),r}(t):t)),Vl.listen.on("parseMessage",pC),Vl.listen.on("parseMUCMessage",pC),Vl.listen.on("chatBoxViewInitialized",yC),Vl.listen.on("chatRoomViewInitialized",yC),Vl.listen.on("connected",$C),Vl.listen.on("getToolbarButtons",NC),Vl.listen.on("statusInitialized",jC),Vl.listen.on("addClientFeatures",(()=>Vl.disco.own.features.add(`${h$.NS.OMEMO_DEVICELIST}+notify`))),Vl.listen.on("afterMessageBodyTransformed",gC),Vl.listen.on("userDetailsModalInitialized",(e=>{const t=e.get("jid");bl.generateFingerprints(t).catch((e=>Yc.error(e)))})),Vl.listen.on("profileModalInitialized",(()=>{bl.generateFingerprints(bl.bare_jid).catch((e=>Yc.error(e)))})),Vl.listen.on("clearSession",(()=>{delete bl.omemo_store,Mc()&&bl.devicelists&&(bl.devicelists.clearStore(),delete bl.devicelists)}))}});const{Strophe:m$,$iq:f$}=Ah.env;async function g$(e){e=e||bl.bare_jid;const t=bl.session.get("push_enabled")||[];if(t.includes(e))return;const n=Vl.settings.get("push_app_servers").filter((e=>!e.disable)),s=Vl.settings.get("push_app_servers").filter((e=>e.disable)),i=n.map((t=>async function(e,t){if(!t.jid||!t.node)return;if(!await Vl.disco.getIdentity("pubsub","push",t.jid))return Yc.warn(`Not enabling push the service "${t.jid}", it doesn't have the right disco identtiy.`);const n=await Promise.all([Vl.disco.supports(m$.NS.PUSH,t.jid),Vl.disco.supports(m$.NS.PUSH,e)]);if(!n[0]&&!n[1])return void Yc.warn(`Not enabling push app server "${t.jid}", no disco support from your server.`);const s=f$({type:"set"});return e!==bl.bare_jid&&s.attrs({to:e}),s.c("enable",{xmlns:m$.NS.PUSH,jid:t.jid,node:t.node}),t.secret&&s.c("x",{xmlns:m$.NS.XFORM,type:"submit"}).c("field",{var:"FORM_TYPE"}).c("value").t(`${m$.NS.PUBSUB}#publish-options`).up().up().c("field",{var:"secret"}).c("value").t(t.secret),Vl.sendIQ(s)}(e,t))),r=s.map((t=>async function(e,t){if(!t.jid)return;if(!await Vl.disco.supports(m$.NS.PUSH,e||bl.bare_jid))return void Yc.warn(`Not disabling push app server "${t.jid}", no disco support from your server.`);const n=f$({type:"set"});e!==bl.bare_jid&&n.attrs({to:e}),n.c("disable",{xmlns:m$.NS.PUSH,jid:t.jid}),t.node&&n.attrs({node:t.node}),Vl.sendIQ(n).catch((e=>{Yc.error(`Could not disable push app server for ${t.jid}`),Yc.error(e)}))}(e,t)));try{await Promise.all(i.concat(r))}catch(e){Yc.error("Could not enable or disable push App Server"),e&&Yc.error(e)}finally{t.push(e)}bl.session.save("push_enabled",t)}function p$(e){e.get("type")==bl.CHATROOMS_TYPE&&g$(m$.getDomainFromJid(e.get("jid")))}const{Strophe:v$}=Ah.env;v$.addNamespace("PUSH","urn:xmpp:push:0"),Ah.plugins.add("converse-push",{initialize(){Vl.settings.extend({push_app_servers:[],enable_muc_push:!1}),Vl.listen.on("statusInitialized",(()=>g$())),Vl.settings.get("enable_muc_push")&&Vl.listen.on("chatBoxesInitialized",(()=>bl.chatboxes.on("add",p$)))}});const y$=()=>{const e=qy("Already have a chat account?"),t=qy("Log in here");return nh`
<div class="switch-form">
<p>${e}</p>
<p><a class="login-here toggle-register-login" href="#converse/login">${t}</a></p>
</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`
<form id="converse-register" class="converse-form" @submit=${t=>e.onFormSubmission(t)}>
<legend class="col-form-label">${n}</legend>
<div class="form-group">
<label>${s}</label>
${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`
<input class="form-control" required="required" type="text" name="domain" placeholder="${e}" />
<p class="form-text text-muted">
${t}
<a href="${s}" class="url" target="_blank" rel="noopener">${n}</a>.
</p>
`})()}
</div>
${i?(()=>{const e=qy("Fetch registration form"),t=qy("Already have a chat account?"),n=qy("Log in here");return nh`
<fieldset class="form-group buttons">
<input class="btn btn-primary" type="submit" value="${e}" />
</fieldset>
<div class="switch-form">
<p>${t}</p>
<p><a class="login-here toggle-register-login" href="#converse/login">${n}</a></p>
</div>
`})():""}
</form>
`},b$=0,w$=e=>nh`
<converse-brand-logo></converse-brand-logo>
${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`
<form id="converse-register" class="converse-form no-scrolling" @submit=${t=>e.onFormSubmission(t)}>
${Sb({classes:"hor_centered"})}
${t?"":nh`
<button class="btn btn-secondary button-cancel hor_centered"
@click=${t=>e.renderProviderChoiceForm(t)}>${n}</button>
`}
</form>
`})(e):""}
${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`
<form id="converse-register" class="converse-form" @submit=${t=>e.onFormSubmission(t)}>
<legend class="col-form-label">${n} ${e.domain}</legend>
<p class="title">${e.title}</p>
<p class="form-help instructions">${e.instructions}</p>
<div class="form-errors hidden"></div>
${e.form_fields}
<fieldset class="buttons form-group">
${e.fields?nh`
<input type="submit" class="btn btn-primary" value="${s}" />
`:""}
${i?"":nh`
<input
type="button"
class="btn btn-secondary button-cancel"
value="${t}"
@click=${t=>e.renderProviderChoiceForm(t)}
/>
`}
${y$()}
</fieldset>
</form>
`})(e):""}
${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=Object.keys(this.fields).map((e=>"username"===e?__({domain:` @${this.domain}`,name:e,type:"text",label:e,value:"",required:!0}):p_({label:e,name:e,placeholder:e,required:!0,type:"password"===e||"email"===e?e:"text",value:""}))),t=this.urls.map((e=>y_({label:"",value:e})));return[...e,...t]}getFormFields(e){return"xform"===this.form_type?Array.from(e.querySelectorAll("field")).map((t=>T$.xForm2TemplateResult(t,e,{domain:this.domain}))):this.getLegacyFormFields()}renderRegistrationForm(e){this.form_fields=this.getFormFields(e),this.status=N$}reportErrors(e){const t=Array.from(e.querySelectorAll("error"));t.length?this.setErrorMessage(t.reduce(((e,t)=>`${e}\n${t.textContent}`),"")):this.setErrorMessage(qy("The provider rejected your registration attempt. Please check the values you entered for correctness."))}renderProviderChoiceForm(e){e?.preventDefault?.(),bl.connection._proto._abortAllRequests(),bl.connection.reset(),this.status=0}abortRegistration(){bl.connection._proto._abortAllRequests(),bl.connection.reset(),[I$,N$].includes(this.status)?Vl.settings.get("registration_domain")&&this.fetchRegistrationForm(Vl.settings.get("registration_domain")):this.requestUpdate()}submitRegistrationForm(e){const t=k$(":input:not([type=button]):not([type=submit])",e),n=j$({type:"set",id:T$.getUniqueId()}).c("query",{xmlns:$$.NS.REGISTER});if("xform"===this.form_type){n.c("x",{xmlns:$$.NS.XFORM,type:"submit"});const e=t.map((e=>E$(e))).filter((e=>e));e.forEach((e=>n.cnode(e).up()))}else t.forEach((e=>n.c(e.getAttribute("name"),{},e.value)));bl.connection._addSysHandler((e=>this._onRegisterIQ(e)),null,"iq",null,null),bl.connection.send(n),this.setFields(n.tree())}setFields(e){const t=e.querySelector("query"),n=k$(`x[xmlns="${$$.NS.XFORM}"]`,t);n.length>0?this._setFieldsFromXForm(n.pop()):this._setFieldsFromLegacy(t)}_setFieldsFromLegacy(e){[].forEach.call(e.children,(e=>{"instructions"!==e.tagName.toLowerCase()?"x"!==e.tagName.toLowerCase()?this.fields[e.tagName.toLowerCase()]=$$.getText(e):"jabber:x:oob"===e.getAttribute("xmlns")&&this.urls.concat(k$("url",e).map((e=>e.textContent))):this.instructions=$$.getText(e)})),this.form_type="legacy"}_setFieldsFromXForm(e){this.title=e.querySelector("title")?.textContent??"",this.instructions=e.querySelector("instructions")?.textContent??"",e.querySelectorAll("field").forEach((e=>{const t=e.getAttribute("var");t?this.fields[t.toLowerCase()]=e.querySelector("value")?.textContent??"":Yc.warn("Found field we couldn't parse")})),this.form_type="xform"}_onRegisterIQ(e){if("error"===e.getAttribute("type")){Yc.error("Registration failed."),this.reportErrors(e);let t=e.getElementsByTagName("error");if(1!==t.length)return bl.connection._changeConnectStatus($$.Status.REGIFAIL,"unknown"),!1;t=t[0].firstElementChild.tagName.toLowerCase(),"conflict"===t?bl.connection._changeConnectStatus($$.Status.CONFLICT,t):"not-acceptable"===t?bl.connection._changeConnectStatus($$.Status.NOTACCEPTABLE,t):bl.connection._changeConnectStatus($$.Status.REGIFAIL,t)}else bl.connection._changeConnectStatus($$.Status.REGISTERED,null);return!1}});const{Strophe:O$}=Ah.env;O$.addNamespace("REGISTER","jabber:iq:register");const M$=Object.keys(O$.Status).reduce(((e,t)=>Math.max(e,O$.Status[t])),0);O$.Status.REGIFAIL=M$+1,O$.Status.REGISTERED=M$+2,O$.Status.CONFLICT=M$+3,O$.Status.NOTACCEPTABLE=M$+5,Ah.plugins.add("converse-register",{dependencies:["converse-controlbox"],enabled:()=>!0,initialize(){const{router:e}=bl;fo[O$.Status.REGIFAIL]="REGIFAIL",fo[O$.Status.REGISTERED]="REGISTERED",fo[O$.Status.CONFLICT]="CONFLICT",fo[O$.Status.NOTACCEPTABLE]="NOTACCEPTABLE",Vl.settings.extend({allow_registration:!0,domain_placeholder:qy(" e.g. conversejs.org"),providers_link:"https://compliance.conversations.im/",registration_domain:""}),e.route("converse/login",(()=>S$("login"))),e.route("converse/register",(()=>S$("register")))}});const{Strophe:R$}=Ah.env,D$=dr.extend({defaults:function(){return{muc_domain:Vl.settings.get("muc_domain"),nick:bl.getDefaultMUCNickname(),toggle_state:bl.OPENED}},initialize(){Vl.settings.listen.on("change:muc_domain",(e=>this.setDomain(e)))},setDomain(e){Vl.settings.get("locked_muc_domain")||this.save("muc_domain",R$.getDomainFromJid(e))}}),{Strophe:z$,$iq:L$,sizzle:P$}=Ah.env;z$.addNamespace("MUCSEARCH","https://xmlns.zombofant.net/muclumbus/search/1.0");const F$={};function U$(e){return F$[e]||(F$[e]=async function(e){const t=L$({type:"get",from:bl.bare_jid,to:"api@search.jabber.network"}).c("search",{xmlns:z$.NS.MUCSEARCH}).c("set",{xmlns:z$.NS.RSM}).c("max").t(10).up().up().c("x",{xmlns:z$.NS.XFORM,type:"submit"}).c("field",{var:"FORM_TYPE",type:"hidden"}).c("value").t("https://xmlns.zombofant.net/muclumbus/search/1.0#params").up().up().c("field",{var:"q",type:"text-single"}).c("value").t(e).up().up().c("field",{var:"sinname",type:"boolean"}).c("value").t("true").up().up().c("field",{var:"sindescription",type:"boolean"}).c("value").t("false").up().up().c("field",{var:"sinaddr",type:"boolean"}).c("value").t("true").up().up().c("field",{var:"min_users",type:"text-single"}).c("value").t("1").up().up().c("field",{var:"key",type:"list-single"}).c("value").t("address").up().c("option").c("value").t("nusers").up().up().c("option").c("value").t("address");let n;try{n=await Vl.sendIQ(t)}catch(e){return Yc.error(e),[]}const s=`result[xmlns="${z$.NS.MUCSEARCH}"] item`;return P$(s,n).map((e=>{const t=e.getAttribute("address");return{label:`${e.querySelector("name")?.textContent} (${t})`,value:t}}))}(e)),F$[e]}const B$=e=>{const t=qy("Join"),n=e.model.get("muc_domain")||Vl.settings.get("muc_domain");let s="";Vl.settings.get("locked_muc_domain")||(s=n?`name@${n}`:qy("name@conference.example.org"));const i=qy(n?"Groupchat name":"Groupchat address"),r=e.muc_roomid_policy_error_msg,o=Vl.settings.get("muc_roomid_policy_hint");return nh`
<form class="converse-form add-chatroom" @submit=${t=>e.openChatRoom(t)}>
<div class="form-group">
<label for="chatroom">${i}:</label>
${r?nh`<label class="roomid-policy-error">${r}</label>`:""}
<converse-autocomplete
.getAutoCompleteList=${U$}
?autofocus=${!0}
min_chars="3"
position="below"
placeholder="${s}"
class="add-muc-autocomplete"
name="chatroom">
</converse-autocomplete>
</div>
${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`
<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>
`};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`
<div class="room-info">
<p class="room-info"><strong>${n}</strong> ${e.jid}</p>
<p class="room-info"><strong>${t}</strong> ${e.desc}</p>
<p class="room-info"><strong>${s}</strong> ${e.occ}</p>
<p class="room-info"><strong>${i}</strong>
<ul>
${e.passwordprotected?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>`:""}
</ul>
</p>
</div>
`},Z$=e=>nh`
${e.show_form?(e=>{const t=qy("Show groupchats"),n=qy("Server address");return nh`
<form class="converse-form list-chatrooms"
@submit=${e.submitForm}>
<div class="form-group">
<label for="chatroom">${n}:</label>
<input type="text"
autofocus
@change=${e.setDomainFromEvent}
value="${e.muc_domain||""}"
required="required"
name="server"
class="form-control"
placeholder="${e.server_placeholder}"/>
</div>
<input type="submit" class="btn btn-primary" name="list" value="${t}"/>
</form>
`})(e):""}
<ul class="available-chatrooms list-group">
${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`
<li class="room-item list-group-item">
<div class="available-chatroom d-flex flex-row">
<a class="open-room available-room w-100"
@click=${e.openRoom}
data-room-jid="${t.jid}"
data-room-name="${t.name}"
title="${s}"
href="#">${t.name||t.jid}</a>
<a class="right room-info icon-room-info"
@click=${e.toggleRoomInfo}
data-room-jid="${t.jid}"
title="${n}"
href="#"></a>
</div>
</li>
`})(e,t)))}
</ul>
`,{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":""}"
data-room-jid="${t.get("jid")}">
${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>`:""}
<a class="list-item-link open-room available-room w-100"
data-room-jid="${t.get("jid")}"
title="${qy("Click to open this groupchat")}"
@click=${t=>e.openRoom(t)}>${t.getDisplayName()}</a>
${Vl.settings.get("allow_bookmarks")?function(e){const t=e.get("bookmarked")??!1,n=qy("Bookmark");return nh`
<a class="list-item-action add-bookmark"
data-room-jid="${e.get("jid")}"
data-bookmark-name="${e.getDisplayName()}"
@click=${e=>xw(e)}
title="${n}">
<converse-icon class="fa ${t?"fa-bookmark":"fa-bookmark-empty"}"
size="1.2em"
color="${tk(e)?"var(--inverse-link-color)":""}"></converse-icon>
</a>`}(t):""}
<a class="list-item-action room-info"
data-room-jid="${t.get("jid")}"
title="${qy("Show more information on this groupchat")}"
@click=${t=>e.showRoomDetailsModal(t)}>
<converse-icon class="fa fa-info-circle" size="1.2em" color="${tk(t)?"var(--inverse-link-color)":""}"></converse-icon>
</a>
<a class="list-item-action close-room"
data-room-jid="${t.get("jid")}"
data-room-name="${t.getDisplayName()}"
title="${n}"
@click=${t=>e.closeRoom(t)}>
<converse-icon class="fa fa-sign-out-alt" size="1.2em" color="${tk(t)?"var(--inverse-link-color)":""}"></converse-icon>
</a>
</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`
<div class="d-flex controlbox-padded">
<span class="w-100 controlbox-heading controlbox-heading--groupchats">
<a class="list-toggle open-rooms-toggle" title="${r}" @click=${t=>e.toggleRoomsList(t)}>
<converse-icon
class="fa ${d?"fa-caret-right":"fa-caret-down"}"
size="1em"
color="var(--muc-color)"></converse-icon>
${o}
</a>
</span>
<a class="controlbox-heading__btn show-bookmark-list-modal"
@click=${t=>Vl.modal.show("converse-bookmark-list-modal",{model:e.model},t)}
title="${l}"
data-toggle="modal">
<converse-icon class="fa fa-bookmark right" size="1em"></converse-icon>
</a>
<a class="controlbox-heading__btn show-list-muc-modal"
@click=${t=>Vl.modal.show("converse-muc-list-modal",{model:e.model},t)}
title="${a}" data-toggle="modal" data-target="#muc-list-modal">
<converse-icon class="fa fa-list-ul right" size="1em"></converse-icon>
</a>
<a class="controlbox-heading__btn show-add-muc-modal"
@click=${t=>Vl.modal.show("converse-add-muc-modal",{model:e.model},t)}
title="${c}" data-toggle="modal" data-target="#add-chatrooms-modal">
<converse-icon class="fa fa-plus right" size="1em"></converse-icon>
</a>
</div>
<div class="list-container list-container--openrooms ${i.length?"":"hidden"}">
<div class="items-list rooms-list open-rooms-list ${d?"collapsed":""}">
${i.map((t=>nk(e,t)))}
</div>
</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`
<?xml version="1.0" encoding="UTF-8"?>
<!--
Font Awesome Free 5.13.0 by @fontawesome - https://fontawesome.com
License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
-->
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol id="icon-address-book" viewBox="0 0 448 512">
<path d="M436 160c6.6 0 12-5.4 12-12v-40c0-6.6-5.4-12-12-12h-20V48c0-26.5-21.5-48-48-48H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h320c26.5 0 48-21.5 48-48v-48h20c6.6 0 12-5.4 12-12v-40c0-6.6-5.4-12-12-12h-20v-64h20c6.6 0 12-5.4 12-12v-40c0-6.6-5.4-12-12-12h-20v-64h20zm-228-32c35.3 0 64 28.7 64 64s-28.7 64-64 64-64-28.7-64-64 28.7-64 64-64zm112 236.8c0 10.6-10 19.2-22.4 19.2H118.4C106 384 96 375.4 96 364.8v-19.2c0-31.8 30.1-57.6 67.2-57.6h5c12.3 5.1 25.7 8 39.8 8s27.6-2.9 39.8-8h5c37.1 0 67.2 25.8 67.2 57.6v19.2z"></path>
</symbol>
<symbol id="icon-angle-double-down" viewBox="0 0 320 512">
<path d="M143 256.3L7 120.3c-9.4-9.4-9.4-24.6 0-33.9l22.6-22.6c9.4-9.4 24.6-9.4 33.9 0l96.4 96.4 96.4-96.4c9.4-9.4 24.6-9.4 33.9 0L313 86.3c9.4 9.4 9.4 24.6 0 33.9l-136 136c-9.4 9.5-24.6 9.5-34 .1zm34 192l136-136c9.4-9.4 9.4-24.6 0-33.9l-22.6-22.6c-9.4-9.4-24.6-9.4-33.9 0L160 352.1l-96.4-96.4c-9.4-9.4-24.6-9.4-33.9 0L7 278.3c-9.4 9.4-9.4 24.6 0 33.9l136 136c9.4 9.5 24.6 9.5 34 .1z"></path>
</symbol>
<symbol id="icon-angle-double-left" viewBox="0 0 448 512">
<path d="M223.7 239l136-136c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9L319.9 256l96.4 96.4c9.4 9.4 9.4 24.6 0 33.9L393.7 409c-9.4 9.4-24.6 9.4-33.9 0l-136-136c-9.5-9.4-9.5-24.6-.1-34zm-192 34l136 136c9.4 9.4 24.6 9.4 33.9 0l22.6-22.6c9.4-9.4 9.4-24.6 0-33.9L127.9 256l96.4-96.4c9.4-9.4 9.4-24.6 0-33.9L201.7 103c-9.4-9.4-24.6-9.4-33.9 0l-136 136c-9.5 9.4-9.5 24.6-.1 34z"></path>
</symbol>
<symbol id="icon-angle-double-right" viewBox="0 0 448 512">
<path d="M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34zm192-34l-136-136c-9.4-9.4-24.6-9.4-33.9 0l-22.6 22.6c-9.4 9.4-9.4 24.6 0 33.9l96.4 96.4-96.4 96.4c-9.4 9.4-9.4 24.6 0 33.9l22.6 22.6c9.4 9.4 24.6 9.4 33.9 0l136-136c9.4-9.2 9.4-24.4 0-33.8z"></path>
</symbol>
<symbol id="icon-angle-double-up" viewBox="0 0 320 512">
<path d="M177 255.7l136 136c9.4 9.4 9.4 24.6 0 33.9l-22.6 22.6c-9.4 9.4-24.6 9.4-33.9 0L160 351.9l-96.4 96.4c-9.4 9.4-24.6 9.4-33.9 0L7 425.7c-9.4-9.4-9.4-24.6 0-33.9l136-136c9.4-9.5 24.6-9.5 34-.1zm-34-192L7 199.7c-9.4 9.4-9.4 24.6 0 33.9l22.6 22.6c9.4 9.4 24.6 9.4 33.9 0l96.4-96.4 96.4 96.4c9.4 9.4 24.6 9.4 33.9 0l22.6-22.6c9.4-9.4 9.4-24.6 0-33.9l-136-136c-9.2-9.4-24.4-9.4-33.8 0z"></path>
</symbol>
<symbol id="icon-angle-down" viewBox="0 0 320 512">
<path d="M143 352.3L7 216.3c-9.4-9.4-9.4-24.6 0-33.9l22.6-22.6c9.4-9.4 24.6-9.4 33.9 0l96.4 96.4 96.4-96.4c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9l-136 136c-9.2 9.4-24.4 9.4-33.8 0z"></path>
</symbol>
<symbol id="icon-angle-left" viewBox="0 0 256 512">
<path d="M31.7 239l136-136c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9L127.9 256l96.4 96.4c9.4 9.4 9.4 24.6 0 33.9L201.7 409c-9.4 9.4-24.6 9.4-33.9 0l-136-136c-9.5-9.4-9.5-24.6-.1-34z"></path>
</symbol>
<symbol id="icon-angle-right" viewBox="0 0 256 512">
<path d="M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"></path>
</symbol>
<symbol id="icon-angle-up" viewBox="0 0 320 512">
<path d="M177 159.7l136 136c9.4 9.4 9.4 24.6 0 33.9l-22.6 22.6c-9.4 9.4-24.6 9.4-33.9 0L160 255.9l-96.4 96.4c-9.4 9.4-24.6 9.4-33.9 0L7 329.7c-9.4-9.4-9.4-24.6 0-33.9l136-136c9.4-9.5 24.6-9.5 34-.1z"></path>
</symbol>
<symbol id="icon-arrow-alt-circle-down" viewBox="0 0 512 512">
<path d="M504 256c0 137-111 248-248 248S8 393 8 256 119 8 256 8s248 111 248 248zM212 140v116h-70.9c-10.7 0-16.1 13-8.5 20.5l114.9 114.3c4.7 4.7 12.2 4.7 16.9 0l114.9-114.3c7.6-7.6 2.2-20.5-8.5-20.5H300V140c0-6.6-5.4-12-12-12h-64c-6.6 0-12 5.4-12 12z"></path>
</symbol>
<symbol id="icon-arrow-alt-circle-left" viewBox="0 0 512 512">
<path d="M256 504C119 504 8 393 8 256S119 8 256 8s248 111 248 248-111 248-248 248zm116-292H256v-70.9c0-10.7-13-16.1-20.5-8.5L121.2 247.5c-4.7 4.7-4.7 12.2 0 16.9l114.3 114.9c7.6 7.6 20.5 2.2 20.5-8.5V300h116c6.6 0 12-5.4 12-12v-64c0-6.6-5.4-12-12-12z"></path>
</symbol>
<symbol id="icon-arrow-alt-circle-right" viewBox="0 0 512 512">
<path d="M256 8c137 0 248 111 248 248S393 504 256 504 8 393 8 256 119 8 256 8zM140 300h116v70.9c0 10.7 13 16.1 20.5 8.5l114.3-114.9c4.7-4.7 4.7-12.2 0-16.9l-114.3-115c-7.6-7.6-20.5-2.2-20.5 8.5V212H140c-6.6 0-12 5.4-12 12v64c0 6.6 5.4 12 12 12z"></path>
</symbol>
<symbol id="icon-arrow-alt-circle-up" viewBox="0 0 512 512">
<path d="M8 256C8 119 119 8 256 8s248 111 248 248-111 248-248 248S8 393 8 256zm292 116V256h70.9c10.7 0 16.1-13 8.5-20.5L264.5 121.2c-4.7-4.7-12.2-4.7-16.9 0l-115 114.3c-7.6 7.6-2.2 20.5 8.5 20.5H212v116c0 6.6 5.4 12 12 12h64c6.6 0 12-5.4 12-12z"></path>
</symbol>
<symbol id="icon-arrow-circle-down" viewBox="0 0 512 512">
<path d="M504 256c0 137-111 248-248 248S8 393 8 256 119 8 256 8s248 111 248 248zm-143.6-28.9L288 302.6V120c0-13.3-10.7-24-24-24h-16c-13.3 0-24 10.7-24 24v182.6l-72.4-75.5c-9.3-9.7-24.8-9.9-34.3-.4l-10.9 11c-9.4 9.4-9.4 24.6 0 33.9L239 404.3c9.4 9.4 24.6 9.4 33.9 0l132.7-132.7c9.4-9.4 9.4-24.6 0-33.9l-10.9-11c-9.5-9.5-25-9.3-34.3.4z"></path>
</symbol>
<symbol id="icon-arrow-circle-left" viewBox="0 0 512 512">
<path d="M256 504C119 504 8 393 8 256S119 8 256 8s248 111 248 248-111 248-248 248zm28.9-143.6L209.4 288H392c13.3 0 24-10.7 24-24v-16c0-13.3-10.7-24-24-24H209.4l75.5-72.4c9.7-9.3 9.9-24.8.4-34.3l-11-10.9c-9.4-9.4-24.6-9.4-33.9 0L107.7 239c-9.4 9.4-9.4 24.6 0 33.9l132.7 132.7c9.4 9.4 24.6 9.4 33.9 0l11-10.9c9.5-9.5 9.3-25-.4-34.3z"></path>
</symbol>
<symbol id="icon-arrow-circle-right" viewBox="0 0 512 512">
<path d="M256 8c137 0 248 111 248 248S393 504 256 504 8 393 8 256 119 8 256 8zm-28.9 143.6l75.5 72.4H120c-13.3 0-24 10.7-24 24v16c0 13.3 10.7 24 24 24h182.6l-75.5 72.4c-9.7 9.3-9.9 24.8-.4 34.3l11 10.9c9.4 9.4 24.6 9.4 33.9 0L404.3 273c9.4-9.4 9.4-24.6 0-33.9L271.6 106.3c-9.4-9.4-24.6-9.4-33.9 0l-11 10.9c-9.5 9.6-9.3 25.1.4 34.4z"></path>
</symbol>
<symbol id="icon-arrow-circle-up" viewBox="0 0 512 512">
<path d="M8 256C8 119 119 8 256 8s248 111 248 248-111 248-248 248S8 393 8 256zm143.6 28.9l72.4-75.5V392c0 13.3 10.7 24 24 24h16c13.3 0 24-10.7 24-24V209.4l72.4 75.5c9.3 9.7 24.8 9.9 34.3.4l10.9-11c9.4-9.4 9.4-24.6 0-33.9L273 107.7c-9.4-9.4-24.6-9.4-33.9 0L106.3 240.4c-9.4 9.4-9.4 24.6 0 33.9l10.9 11c9.6 9.5 25.1 9.3 34.4-.4z"></path>
</symbol>
<symbol id="icon-arrow-down" viewBox="0 0 448 512">
<path d="M413.1 222.5l22.2 22.2c9.4 9.4 9.4 24.6 0 33.9L241 473c-9.4 9.4-24.6 9.4-33.9 0L12.7 278.6c-9.4-9.4-9.4-24.6 0-33.9l22.2-22.2c9.5-9.5 25-9.3 34.3.4L184 343.4V56c0-13.3 10.7-24 24-24h32c13.3 0 24 10.7 24 24v287.4l114.8-120.5c9.3-9.8 24.8-10 34.3-.4z"></path>
</symbol>
<symbol id="icon-arrow-left" viewBox="0 0 448 512">
<path d="M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z"></path>
</symbol>
<symbol id="icon-arrow-right" viewBox="0 0 448 512">
<path d="M190.5 66.9l22.2-22.2c9.4-9.4 24.6-9.4 33.9 0L441 239c9.4 9.4 9.4 24.6 0 33.9L246.6 467.3c-9.4 9.4-24.6 9.4-33.9 0l-22.2-22.2c-9.5-9.5-9.3-25 .4-34.3L311.4 296H24c-13.3 0-24-10.7-24-24v-32c0-13.3 10.7-24 24-24h287.4L190.9 101.2c-9.8-9.3-10-24.8-.4-34.3z"></path>
</symbol>
<symbol id="icon-arrow-up" viewBox="0 0 448 512">
<path d="M34.9 289.5l-22.2-22.2c-9.4-9.4-9.4-24.6 0-33.9L207 39c9.4-9.4 24.6-9.4 33.9 0l194.3 194.3c9.4 9.4 9.4 24.6 0 33.9L413 289.4c-9.5 9.5-25 9.3-34.3-.4L264 168.6V456c0 13.3-10.7 24-24 24h-32c-13.3 0-24-10.7-24-24V168.6L69.2 289.1c-9.3 9.8-24.8 10-34.3.4z"></path>
</symbol>
<symbol id="icon-arrows-alt" viewBox="0 0 512 512">
<path d="M352.201 425.775l-79.196 79.196c-9.373 9.373-24.568 9.373-33.941 0l-79.196-79.196c-15.119-15.119-4.411-40.971 16.971-40.97h51.162L228 284H127.196v51.162c0 21.382-25.851 32.09-40.971 16.971L7.029 272.937c-9.373-9.373-9.373-24.569 0-33.941L86.225 159.8c15.119-15.119 40.971-4.411 40.971 16.971V228H228V127.196h-51.23c-21.382 0-32.09-25.851-16.971-40.971l79.196-79.196c9.373-9.373 24.568-9.373 33.941 0l79.196 79.196c15.119 15.119 4.411 40.971-16.971 40.971h-51.162V228h100.804v-51.162c0-21.382 25.851-32.09 40.97-16.971l79.196 79.196c9.373 9.373 9.373 24.569 0 33.941L425.773 352.2c-15.119 15.119-40.971 4.411-40.97-16.971V284H284v100.804h51.23c21.382 0 32.09 25.851 16.971 40.971z"></path>
</symbol>
<symbol id="icon-arrows-alt-h" viewBox="0 0 512 512">
<path d="M377.941 169.941V216H134.059v-46.059c0-21.382-25.851-32.09-40.971-16.971L7.029 239.029c-9.373 9.373-9.373 24.568 0 33.941l86.059 86.059c15.119 15.119 40.971 4.411 40.971-16.971V296h243.882v46.059c0 21.382 25.851 32.09 40.971 16.971l86.059-86.059c9.373-9.373 9.373-24.568 0-33.941l-86.059-86.059c-15.119-15.12-40.971-4.412-40.971 16.97z"></path>
</symbol>
<symbol id="icon-arrows-alt-v" viewBox="0 0 256 512">
<path d="M214.059 377.941H168V134.059h46.059c21.382 0 32.09-25.851 16.971-40.971L144.971 7.029c-9.373-9.373-24.568-9.373-33.941 0L24.971 93.088c-15.119 15.119-4.411 40.971 16.971 40.971H88v243.882H41.941c-21.382 0-32.09 25.851-16.971 40.971l86.059 86.059c9.373 9.373 24.568 9.373 33.941 0l86.059-86.059c15.12-15.119 4.412-40.971-16.97-40.971z"></path>
</symbol>
<symbol id="icon-bars" viewBox="0 0 448 512">
<path d="M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"></path>
</symbol>
<symbol id="icon-bookmark" viewBox="0 0 384 512">
<path d="M0 512V48C0 21.49 21.49 0 48 0h288c26.51 0 48 21.49 48 48v464L192 400 0 512z"></path>
</symbol>
<symbol id="icon-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>
<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>
<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>
</svg>
`}});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`
<converse-chats class="converse-chatboxes row no-gutters ${e.join(" ")}"></converse-chats>
<div id="converse-modals" class="modals"></div>
<converse-fontawesome></converse-fontawesome>
`})()}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`
<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>
<input type="text" name="jid" ?required=${!Vl.settings.get("xhr_user_search_url")}
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>
</div>
<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>
</div>
</div>
<div class="form-group add-xmpp-contact__group">
<label class="clearfix" for="name">${i}:</label>
<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>
</div>
<div class="form-group"><div class="invalid-feedback">${s}</div></div>
<button type="submit" class="btn btn-primary">${t}</button>
</div>
</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`
<li class="list-item d-flex controlbox-padded ${n.join(" ")}" data-status="${e.presence.get("show")}">
<converse-roster-contact .model=${e}></converse-roster-contact>
</li>`}const hk=e=>{const t=qy("Click to hide these contacts"),n=bl.roster.state.get("collapsed_groups");return nh`
<div class="roster-group" data-group="${e.name}">
<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)}>
<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}">
${Mw(e.contacts,(e=>e.get("jid")),uk)}
</ul>
</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`
<div class="d-flex controlbox-padded">
<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}">
<converse-icon class="fa fa-sync right ${e.syncing_contacts?"fa-spin":""}" size="1em"></converse-icon>
</a>
${Vl.settings.get("allow_contact_requests")?nh`
<a class="controlbox-heading__btn add-contact"
@click=${t=>e.showAddContactModal(t)}
title="${s}"
data-toggle="modal"
data-target="#add-contact-modal">
<converse-icon class="fa fa-user-plus right" size="1.25em"></converse-icon>
</a>`:""}
</div>
<div class="list-container roster-contacts ${a?"hidden":""}">
<converse-roster-filter @update=${()=>e.requestUpdate()}></converse-roster-filter>
${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}):""}))}
</div>
`};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`
<a class="list-item-link cbox-list-item open-chat ${o?"unread-msgs":""}" title="${c}" href="#" @click=${e.openChat}>
<span>
<converse-avatar
class="avatar"
.data=${e.model.vcard?.attributes}
nonce=${e.model.vcard?.get("vcard_updated")}
height="30" width="30"></converse-avatar>
<converse-icon
title="${r}"
color="var(--${i})"
size="1em"
class="${s} chat-status chat-status--avatar"></converse-icon>
</span>
${o?nh`<span class="msgs-indicator">${o}</span>`:""}
<span class="contact-name contact-name--${e.show} ${o?"unread-msgs":""}">${a}</span>
</a>
${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`
<a class="list-item-action remove-xmpp-contact" @click=${e.removeContact} title="${s}" href="#">
<converse-icon class="fa fa-trash-alt" size="1.5em"></converse-icon>
</a>
`})(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`
<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"
@click=${e.acceptRequest}
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"
@click=${e.declineRequest}
aria-label="${e.desc_decline}" title="${e.desc_decline}" href="#">
<converse-icon class="fa fa-times" size="1em"></converse-icon>
</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`
<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">
<converse-icon size="1em" @click=${e.changeTypeFilter} class="fa fa-user clickable ${"contacts"===e.filter_type?"selected":""}" data-type="contacts" title="${n}"></converse-icon>
<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>
</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}"/>
<converse-icon size="1em" class="fa fa-times clear-input ${e.filter_text&&"state"!==e.filter_type?"":"hidden"}"
@click=${e.clearFilter}>
</converse-icon>
</div>
<select class="form-control state-type ${"state"!==e.filter_type?"hidden":""}"
@change=${e.changeChatStateFilter}>
<option value="">${r}</option>
<option ?selected=${"unread_messages"===e.chat_state} value="unread_messages">${o}</option>
<option ?selected=${"online"===e.chat_state} value="online">${a}</option>
<option ?selected=${"chat"===e.chat_state} value="chat">${c}</option>
<option ?selected=${"dnd"===e.chat_state} value="dnd">${l}</option>
<option ?selected=${"away"===e.chat_state} value="away">${d}</option>
<option ?selected=${"xa"===e.chat_state} value="xa">${u}</option>
<option ?selected=${"offline"===e.chat_state} value="offline">${h}</option>
</select>
</div>
</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.model.get("default_height")),n=Ck(bl.resizing.chatbox.width,bl.resizing.chatbox.model.get("default_width"));Vl.connection.connected()?(bl.resizing.chatbox.model.save({height:t}),bl.resizing.chatbox.model.save({width:n})):(bl.resizing.chatbox.model.set({height:t}),bl.resizing.chatbox.model.set({width:n})),bl.resizing=null}const jk=()=>nh`
<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.initialize=function(e,t){return Array.isArray(e.whitelisted_plugins)?e.whitelisted_plugins=e.whitelisted_plugins.concat(Wy):e.whitelisted_plugins=Wy,Ok(e,t)};const Mk=Ah},5422:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},9989:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},7092:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},3584:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},2:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},9870:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},4937:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},567:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},3806:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},2846:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},7038:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},5784:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},975:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},1602:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},1693:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},6205:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},3774:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},2430:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},2339:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},3284:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},9592:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},354:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},4412:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},9107:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},2886:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},6022:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},180:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},4659:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},4311:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},4912:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},6380:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},563:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},8899:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},1165:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},1484:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},8069:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},2484:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},8211:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},9575:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},8334:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},1815:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},6305:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(4216),i=n.n(s),r=n(7705),o=n.n(r)()(i());o.push([e.id,"","",{version:3,sources:[],names:[],mappings:"",sourceRoot:""}]);const a=o},3683:(e,t,n)=>{var s={"./af.js":[3014,9210],"./am.js":[6185,5073],"./ar-dz.js":[3308,9406],"./ar-iq.js":[3659,2990],"./ar-kw.js":[9029,9897],"./ar-ly.js":[6318,3521],"./ar-ma.js":[1057,5313],"./ar-sa.js":[5061,485],"./ar-tn.js":[7558,8040],"./ar.js":[4439,6755],"./az.js":[4890,4963],"./be.js":[9499,9478],"./bg.js":[9735,578],"./bi.js":[6381,2984],"./bm.js":[93,2263],"./bn-bd.js":[2098,1351],"./bn.js":[7392,280],"./bo.js":[2027,9950],"./br.js":[9802,760],"./bs.js":[6698,9833],"./ca.js":[5230,102],"./cs.js":[8272,7400],"./cv.js":[2960,4481],"./cy.js":[6961,6740],"./da.js":[4771,2548],"./de-at.js":[1078,7175],"./de-ch.js":[8630,1679],"./de.js":[6377,52],"./dv.js":[5326,5569],"./el.js":[4005,1606],"./en-au.js":[4567,5485],"./en-ca.js":[3666,4035],"./en-gb.js":[5500,6031],"./en-ie.js":[4791,8129],"./en-il.js":[4962,3463],"./en-in.js":[5294,6898],"./en-nz.js":[9101,8547],"./en-sg.js":[1228,1735],"./en-tt.js":[224,6105],"./en.js":[164,535],"./eo.js":[6504,5121],"./es-do.js":[6824,8758],"./es-mx.js":[2262,7416],"./es-pr.js":[7634,911],"./es-us.js":[4976,3208],"./es.js":[2791,3411],"./et.js":[4419,4153],"./eu.js":[3371,1396],"./fa.js":[2523,5544],"./fi.js":[3072,2130],"./fo.js":[8348,8745],"./fr-ca.js":[3056,7363],"./fr-ch.js":[4623,7952],"./fr.js":[8876,1910],"./fy.js":[2559,6376],"./ga.js":[523,688],"./gd.js":[1365,5050],"./gl.js":[1575,5818],"./gom-latn.js":[488,825],"./gu.js":[8417,3623],"./he.js":[4092,9372],"./hi.js":[8184,8010],"./hr.js":[4323,7419],"./ht.js":[2458,5822],"./hu.js":[5639,8214],"./hy-am.js":[9300,5407],"./id.js":[5100,9513],"./is.js":[2552,1194],"./it-ch.js":[4677,6010],"./it.js":[4434,1880],"./ja.js":[451,1107],"./jv.js":[5852,4305],"./ka.js":[4253,5186],"./kk.js":[6864,5206],"./km.js":[8445,2475],"./kn.js":[860,7523],"./ko.js":[3206,3446],"./ku.js":[7514,7024],"./ky.js":[160,5055],"./lb.js":[5364,5215],"./lo.js":[3531,1204],"./lt.js":[9452,7899],"./lv.js":[4158,631],"./me.js":[705,145],"./mi.js":[9346,7454],"./mk.js":[2487,4951],"./ml.js":[1357,7679],"./mn.js":[5060,8618],"./mr.js":[6481,5600],"./ms-my.js":[1387,882],"./ms.js":[939,9095],"./mt.js":[9454,9665],"./my.js":[7878,5166],"./nb.js":[8011,646],"./ne.js":[8472,9030],"./nl-be.js":[4390,3155],"./nl.js":[7409,1520],"./nn.js":[2117,7050],"./oc-lnc.js":[3190,7203],"./pa-in.js":[3341,5850],"./pl.js":[6262,1211],"./pt-br.js":[7375,5274],"./pt.js":[4374,265],"./rn.js":[9507,4678],"./ro.js":[3809,8022],"./ru.js":[6581,559],"./rw.js":[2285,3221],"./sd.js":[7256,1298],"./se.js":[5114,1942],"./si.js":[2237,9333],"./sk.js":[8777,6783],"./sl.js":[8173,9625],"./sq.js":[9195,8603],"./sr-cyrl.js":[3238,3435],"./sr.js":[8117,7390],"./ss.js":[3471,9238],"./sv-fi.js":[7487,9997],"./sv.js":[516,9652],"./sw.js":[4925,9733],"./ta.js":[8639,7645],"./te.js":[4178,7714],"./tet.js":[9665,555],"./tg.js":[4256,2446],"./th.js":[6547,1729],"./tk.js":[8112,5256],"./tl-ph.js":[5310,9443],"./tlh.js":[3002,2814],"./tr.js":[1945,8665],"./tzl.js":[376,2843],"./tzm-latn.js":[5004,3933],"./tzm.js":[362,4342],"./ug-cn.js":[3095,6890],"./uk.js":[4019,1619],"./ur.js":[7159,9568],"./uz-latn.js":[5866,1110],"./uz.js":[1835,3153],"./vi.js":[6758,8073],"./x-pseudo.js":[9154,4423],"./yo.js":[4595,8692],"./zh-cn.js":[7095,9630],"./zh-hk.js":[8586,3755],"./zh-tw.js":[7973,6776],"./zh.js":[4249,8458]};function i(e){if(!n.o(s,e))return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=s[e],i=t[0];return n.e(t[1]).then((()=>n.t(i,23)))}i.keys=()=>Object.keys(s),i.id=3683,e.exports=i},3379:e=>{"use strict";var t=[];function n(e){for(var n=-1,s=0;s<t.length;s++)if(t[s].identifier===e){n=s;break}return n}function s(e,s){for(var r={},o=[],a=0;a<e.length;a++){var c=e[a],l=s.base?c[0]+s.base:c[0],d=r[l]||0,u="".concat(l," ").concat(d);r[l]=d+1;var h=n(u),m={css:c[1],media:c[2],sourceMap:c[3],supports:c[4],layer:c[5]};if(-1!==h)t[h].references++,t[h].updater(m);else{var f=i(m,s);s.byIndex=a,t.splice(a,0,{identifier:u,updater:f,references:1})}o.push(u)}return o}function i(e,t){var n=t.domAPI(t);n.update(e);return function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,i){var r=s(e=e||[],i=i||{});return function(e){e=e||[];for(var o=0;o<r.length;o++){var a=n(r[o]);t[a].references--}for(var c=s(e,i),l=0;l<r.length;l++){var d=n(r[l]);0===t[d].references&&(t[d].updater(),t.splice(d,1))}r=c}}},569:e=>{"use strict";var t={};e.exports=function(e,n){var s=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");s.appendChild(n)}},9216:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},3565:(e,t,n)=>{"use strict";e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},7795:e=>{"use strict";e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var s="";n.supports&&(s+="@supports (".concat(n.supports,") {")),n.media&&(s+="@media ".concat(n.media," {"));var i=void 0!==n.layer;i&&(s+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),s+=n.css,i&&(s+="}"),n.media&&(s+="}"),n.supports&&(s+="}");var r=n.sourceMap;r&&"undefined"!=typeof btoa&&(s+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),t.styleTagTransform(s,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},4589:e=>{"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},6404:(e,t,n)=>{var s={"./af/LC_MESSAGES/converse.po":[4534,5830],"./ar/LC_MESSAGES/converse.po":[4201,4469],"./bg/LC_MESSAGES/converse.po":[5384,2551],"./ca/LC_MESSAGES/converse.po":[122,1553],"./cs/LC_MESSAGES/converse.po":[3893,5301],"./da/LC_MESSAGES/converse.po":[7889,1163],"./de/LC_MESSAGES/converse.po":[1658,2895],"./el/LC_MESSAGES/converse.po":[7530,5524],"./eo/LC_MESSAGES/converse.po":[1758,2433],"./es/LC_MESSAGES/converse.po":[7790,8269],"./eu/LC_MESSAGES/converse.po":[9398,3103],"./fa/LC_MESSAGES/converse.po":[2897,321],"./fi/LC_MESSAGES/converse.po":[9583,7618],"./fr/LC_MESSAGES/converse.po":[5011,5129],"./gl/LC_MESSAGES/converse.po":[8816,777],"./he/LC_MESSAGES/converse.po":[6725,4363],"./hi/LC_MESSAGES/converse.po":[411,4468],"./hu/LC_MESSAGES/converse.po":[2825,6239],"./id/LC_MESSAGES/converse.po":[6042,6678],"./it/LC_MESSAGES/converse.po":[3741,3719],"./ja/LC_MESSAGES/converse.po":[6893,6249],"./lt/LC_MESSAGES/converse.po":[5176,513],"./mr/LC_MESSAGES/converse.po":[6292,1784],"./nb/LC_MESSAGES/converse.po":[8467,473],"./nl/LC_MESSAGES/converse.po":[8544,2473],"./nl_BE/LC_MESSAGES/converse.po":[8133,8131],"./oc/LC_MESSAGES/converse.po":[8857,5500],"./pl/LC_MESSAGES/converse.po":[2503,3606],"./pt/LC_MESSAGES/converse.po":[1132,6227],"./pt_BR/LC_MESSAGES/converse.po":[2774,1455],"./ro/LC_MESSAGES/converse.po":[9740,3539],"./ru/LC_MESSAGES/converse.po":[2276,7917],"./sv/LC_MESSAGES/converse.po":[1025,8859],"./th/LC_MESSAGES/converse.po":[4297,457],"./tr/LC_MESSAGES/converse.po":[2266,4195],"./ug/LC_MESSAGES/converse.po":[3915,8676],"./uk/LC_MESSAGES/converse.po":[9642,7979],"./vi/LC_MESSAGES/converse.po":[1298,2110],"./zh_CN/LC_MESSAGES/converse.po":[9771,3325],"./zh_TW/LC_MESSAGES/converse.po":[4133,1458]};function i(e){if(!n.o(s,e))return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=s[e],i=t[0];return n.e(t[1]).then((()=>n.t(i,19)))}i.keys=()=>Object.keys(s),i.id=6404,e.exports=i},9563:e=>{function t(e,t,n,s,i,r,o){try{var a=e[r](o),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(s,i)}e.exports=function(e){return function(){var n=this,s=arguments;return new Promise((function(i,r){var o=e.apply(n,s);function a(e){t(o,i,r,a,c,"next",e)}function c(e){t(o,i,r,a,c,"throw",e)}a(void 0)}))}},e.exports.__esModule=!0,e.exports.default=e.exports},1514:(e,t,n)=>{var s=n(7616);e.exports=function(e,t,n){return(t=s(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.__esModule=!0,e.exports.default=e.exports},8135:e=>{e.exports=function(e){return e&&e.__esModule?e:{default:e}},e.exports.__esModule=!0,e.exports.default=e.exports},2518:(e,t,n)=>{var s=n(435).default;function i(){"use strict";e.exports=i=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",d=a.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function h(e,t,n,s){var i=t&&t.prototype instanceof g?t:g,r=Object.create(i.prototype),a=new k(s||[]);return o(r,"_invoke",{value:E(e,n,a)}),r}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=h;var f={};function g(){}function p(){}function v(){}var y={};u(y,c,(function(){return this}));var _=Object.getPrototypeOf,b=_&&_(_(j([])));b&&b!==n&&r.call(b,c)&&(y=b);var w=v.prototype=g.prototype=Object.create(y);function S(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(i,o,a,c){var l=m(e[i],e,o);if("throw"!==l.type){var d=l.arg,u=d.value;return u&&"object"==s(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(u).then((function(e){d.value=e,a(d)}),(function(e){return n("throw",e,a,c)}))}c(l.arg)}var i;o(this,"_invoke",{value:function(e,s){function r(){return new t((function(t,i){n(e,s,t,i)}))}return i=i?i.then(r,r):r()}})}function E(e,t,n){var s="suspendedStart";return function(i,r){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===i)throw r;return T()}for(n.method=i,n.arg=r;;){var o=n.delegate;if(o){var a=A(o,n);if(a){if(a===f)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===s)throw s="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);s="executing";var c=m(e,t,n);if("normal"===c.type){if(s=n.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(s="completed",n.method="throw",n.arg=c.arg)}}}function A(e,t){var n=t.method,s=e.iterator[n];if(void 0===s)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,A(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var i=m(s,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,f;var r=i.arg;return r?r.done?(t[e.resultName]=r.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):r:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function $(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function j(e){if(e){var t=e[c];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,s=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return s.next=s}}return{next:T}}function T(){return{value:void 0,done:!0}}return p.prototype=v,o(w,"constructor",{value:v,configurable:!0}),o(v,"constructor",{value:p,configurable:!0}),p.displayName=u(v,d,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,u(e,d,"GeneratorFunction")),e.prototype=Object.create(w),e},t.awrap=function(e){return{__await:e}},S(x.prototype),u(x.prototype,l,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,s,i,r){void 0===r&&(r=Promise);var o=new x(h(e,n,s,i),r);return t.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},S(w),u(w,d,"Generator"),u(w,c,(function(){return this})),u(w,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var s in t)n.push(s);return n.reverse(),function e(){for(;n.length;){var s=n.pop();if(s in t)return e.value=s,e.done=!1,e}return e.done=!0,e}},t.values=j,k.prototype={constructor:k,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach($),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,s){return o.type="throw",o.arg=e,t.next=n,s&&(t.method="next",t.arg=void 0),!!s}for(var s=this.tryEntries.length-1;s>=0;--s){var i=this.tryEntries[s],o=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var a=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(a&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var s=this.tryEntries[n];if(s.tryLoc<=this.prev&&r.call(s,"finallyLoc")&&this.prev<s.finallyLoc){var i=s;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),$(n),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var s=n.completion;if("throw"===s.type){var i=s.arg;$(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:j(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports},9772:(e,t,n)=>{var s=n(435).default;e.exports=function(e,t){if("object"!==s(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!==s(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},7616:(e,t,n)=>{var s=n(435).default,i=n(9772);e.exports=function(e){var t=i(e,"string");return"symbol"===s(t)?t:String(t)},e.exports.__esModule=!0,e.exports.default=e.exports},435:e=>{function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},1117:(e,t,n)=>{var s=n(2518)();e.exports=s;try{regeneratorRuntime=s}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=s:Function("r","regeneratorRuntime = r")(s)}}},r={};function o(e){var t=r[e];if(void 0!==t)return t.exports;var n=r[e]={id:e,loaded:!1,exports:{}};return i[e].call(n.exports,n,n.exports,o),n.loaded=!0,n.exports}o.m=i,o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(n,s){if(1&s&&(n=this(n)),8&s)return n;if("object"==typeof n&&n){if(4&s&&n.__esModule)return n;if(16&s&&"function"==typeof n.then)return n}var i=Object.create(null);o.r(i);var r={};e=e||[null,t({}),t([]),t(t)];for(var a=2&s&&n;"object"==typeof a&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach((e=>r[e]=()=>n[e]));return r.default=()=>n,o.d(i,r),i},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((t,n)=>(o.f[n](e,t),t)),[])),o.u=e=>({52:"locales/dayjs/de-js",102:"locales/dayjs/ca-js",145:"locales/dayjs/me-js",265:"locales/dayjs/pt-js",280:"locales/dayjs/bn-js",321:"locales/fa-LC_MESSAGES-converse-po",457:"locales/th-LC_MESSAGES-converse-po",473:"locales/nb-LC_MESSAGES-converse-po",485:"locales/dayjs/ar-sa-js",513:"locales/lt-LC_MESSAGES-converse-po",535:"locales/dayjs/en-js",555:"locales/dayjs/tet-js",559:"locales/dayjs/ru-js",578:"locales/dayjs/bg-js",631:"locales/dayjs/lv-js",646:"locales/dayjs/nb-js",688:"locales/dayjs/ga-js",760:"locales/dayjs/br-js",777:"locales/gl-LC_MESSAGES-converse-po",825:"locales/dayjs/gom-latn-js",882:"locales/dayjs/ms-my-js",911:"locales/dayjs/es-pr-js",1107:"locales/dayjs/ja-js",1110:"locales/dayjs/uz-latn-js",1163:"locales/da-LC_MESSAGES-converse-po",1194:"locales/dayjs/is-js",1204:"locales/dayjs/lo-js",1211:"locales/dayjs/pl-js",1298:"locales/dayjs/sd-js",1351:"locales/dayjs/bn-bd-js",1396:"locales/dayjs/eu-js",1455:"locales/pt_BR-LC_MESSAGES-converse-po",1458:"locales/zh_TW-LC_MESSAGES-converse-po",1520:"locales/dayjs/nl-js",1553:"locales/ca-LC_MESSAGES-converse-po",1606:"locales/dayjs/el-js",1619:"locales/dayjs/uk-js",1679:"locales/dayjs/de-ch-js",1729:"locales/dayjs/th-js",1735:"locales/dayjs/en-sg-js",1784:"locales/mr-LC_MESSAGES-converse-po",1880:"locales/dayjs/it-js",1910:"locales/dayjs/fr-js",1942:"locales/dayjs/se-js",2110:"locales/vi-LC_MESSAGES-converse-po",2130:"locales/dayjs/fi-js",2263:"locales/dayjs/bm-js",2433:"locales/eo-LC_MESSAGES-converse-po",2446:"locales/dayjs/tg-js",2473:"locales/nl-LC_MESSAGES-converse-po",2475:"locales/dayjs/km-js",2548:"locales/dayjs/da-js",2551:"locales/bg-LC_MESSAGES-converse-po",2814:"locales/dayjs/tlh-js",2843:"locales/dayjs/tzl-js",2895:"locales/de-LC_MESSAGES-converse-po",2984:"locales/dayjs/bi-js",2990:"locales/dayjs/ar-iq-js",3103:"locales/eu-LC_MESSAGES-converse-po",3153:"locales/dayjs/uz-js",3155:"locales/dayjs/nl-be-js",3208:"locales/dayjs/es-us-js",3221:"locales/dayjs/rw-js",3325:"locales/zh_CN-LC_MESSAGES-converse-po",3411:"locales/dayjs/es-js",3435:"locales/dayjs/sr-cyrl-js",3446:"locales/dayjs/ko-js",3463:"locales/dayjs/en-il-js",3521:"locales/dayjs/ar-ly-js",3539:"locales/ro-LC_MESSAGES-converse-po",3606:"locales/pl-LC_MESSAGES-converse-po",3623:"locales/dayjs/gu-js",3719:"locales/it-LC_MESSAGES-converse-po",3755:"locales/dayjs/zh-hk-js",3933:"locales/dayjs/tzm-latn-js",4035:"locales/dayjs/en-ca-js",4153:"locales/dayjs/et-js",4195:"locales/tr-LC_MESSAGES-converse-po",4305:"locales/dayjs/jv-js",4342:"locales/dayjs/tzm-js",4363:"locales/he-LC_MESSAGES-converse-po",4423:"locales/dayjs/x-pseudo-js",4468:"locales/hi-LC_MESSAGES-converse-po",4469:"locales/ar-LC_MESSAGES-converse-po",4481:"locales/dayjs/cv-js",4610:"emojis",4678:"locales/dayjs/rn-js",4951:"locales/dayjs/mk-js",4963:"locales/dayjs/az-js",5050:"locales/dayjs/gd-js",5055:"locales/dayjs/ky-js",5073:"locales/dayjs/am-js",5121:"locales/dayjs/eo-js",5129:"locales/fr-LC_MESSAGES-converse-po",5166:"locales/dayjs/my-js",5186:"locales/dayjs/ka-js",5206:"locales/dayjs/kk-js",5215:"locales/dayjs/lb-js",5256:"locales/dayjs/tk-js",5274:"locales/dayjs/pt-br-js",5301:"locales/cs-LC_MESSAGES-converse-po",5313:"locales/dayjs/ar-ma-js",5407:"locales/dayjs/hy-am-js",5485:"locales/dayjs/en-au-js",5500:"locales/oc-LC_MESSAGES-converse-po",5524:"locales/el-LC_MESSAGES-converse-po",5544:"locales/dayjs/fa-js",5569:"locales/dayjs/dv-js",5600:"locales/dayjs/mr-js",5818:"locales/dayjs/gl-js",5822:"locales/dayjs/ht-js",5830:"locales/af-LC_MESSAGES-converse-po",5850:"locales/dayjs/pa-in-js",6010:"locales/dayjs/it-ch-js",6031:"locales/dayjs/en-gb-js",6105:"locales/dayjs/en-tt-js",6227:"locales/pt-LC_MESSAGES-converse-po",6239:"locales/hu-LC_MESSAGES-converse-po",6249:"locales/ja-LC_MESSAGES-converse-po",6376:"locales/dayjs/fy-js",6678:"locales/id-LC_MESSAGES-converse-po",6740:"locales/dayjs/cy-js",6755:"locales/dayjs/ar-js",6776:"locales/dayjs/zh-tw-js",6783:"locales/dayjs/sk-js",6890:"locales/dayjs/ug-cn-js",6898:"locales/dayjs/en-in-js",7024:"locales/dayjs/ku-js",7050:"locales/dayjs/nn-js",7175:"locales/dayjs/de-at-js",7203:"locales/dayjs/oc-lnc-js",7363:"locales/dayjs/fr-ca-js",7390:"locales/dayjs/sr-js",7400:"locales/dayjs/cs-js",7416:"locales/dayjs/es-mx-js",7419:"locales/dayjs/hr-js",7454:"locales/dayjs/mi-js",7523:"locales/dayjs/kn-js",7618:"locales/fi-LC_MESSAGES-converse-po",7645:"locales/dayjs/ta-js",7679:"locales/dayjs/ml-js",7714:"locales/dayjs/te-js",7899:"locales/dayjs/lt-js",7917:"locales/ru-LC_MESSAGES-converse-po",7952:"locales/dayjs/fr-ch-js",7979:"locales/uk-LC_MESSAGES-converse-po",8010:"locales/dayjs/hi-js",8022:"locales/dayjs/ro-js",8040:"locales/dayjs/ar-tn-js",8073:"locales/dayjs/vi-js",8129:"locales/dayjs/en-ie-js",8131:"locales/nl_BE-LC_MESSAGES-converse-po",8214:"locales/dayjs/hu-js",8269:"locales/es-LC_MESSAGES-converse-po",8458:"locales/dayjs/zh-js",8547:"locales/dayjs/en-nz-js",8603:"locales/dayjs/sq-js",8618:"locales/dayjs/mn-js",8665:"locales/dayjs/tr-js",8676:"locales/ug-LC_MESSAGES-converse-po",8692:"locales/dayjs/yo-js",8745:"locales/dayjs/fo-js",8758:"locales/dayjs/es-do-js",8859:"locales/sv-LC_MESSAGES-converse-po",9030:"locales/dayjs/ne-js",9095:"locales/dayjs/ms-js",9210:"locales/dayjs/af-js",9238:"locales/dayjs/ss-js",9333:"locales/dayjs/si-js",9372:"locales/dayjs/he-js",9406:"locales/dayjs/ar-dz-js",9443:"locales/dayjs/tl-ph-js",9478:"locales/dayjs/be-js",9513:"locales/dayjs/id-js",9568:"locales/dayjs/ur-js",9625:"locales/dayjs/sl-js",9630:"locales/dayjs/zh-cn-js",9652:"locales/dayjs/sv-js",9665:"locales/dayjs/mt-js",9733:"locales/dayjs/sw-js",9833:"locales/dayjs/bs-js",9897:"locales/dayjs/ar-kw-js",9950:"locales/dayjs/bo-js",9997:"locales/dayjs/sv-fi-js"}[e]+".js"),o.miniCssF=e=>{},o.miniCssF=e=>{},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n={},s="converse.js:",o.l=(e,t,i,r)=>{if(n[e])n[e].push(t);else{var a,c;if(void 0!==i)for(var l=document.getElementsByTagName("script"),d=0;d<l.length;d++){var u=l[d];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==s+i){a=u;break}}a||(c=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,o.nc&&a.setAttribute("nonce",o.nc),a.setAttribute("data-webpack",s+i),a.src=e),n[e]=[t];var h=(t,s)=>{a.onerror=a.onload=null,clearTimeout(m);var i=n[e];if(delete n[e],a.parentNode&&a.parentNode.removeChild(a),i&&i.forEach((e=>e(s))),t)return t(s)},m=setTimeout(h.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=h.bind(null,a.onerror),a.onload=h.bind(null,a.onload),c&&document.head.appendChild(a)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),o.p="/dist/",(()=>{var e={1189:0,5040:0};o.f.j=(t,n)=>{var s=o.o(e,t)?e[t]:void 0;if(0!==s)if(s)n.push(s[2]);else{var i=new Promise(((n,i)=>s=e[t]=[n,i]));n.push(s[2]=i);var r=o.p+o.u(t),a=new Error;o.l(r,(n=>{if(o.o(e,t)&&(0!==(s=e[t])&&(e[t]=void 0),s)){var i=n&&("load"===n.type?"missing":n.type),r=n&&n.target&&n.target.src;a.message="Loading chunk "+t+" failed.\n("+i+": "+r+")",a.name="ChunkLoadError",a.type=i,a.request=r,s[1](a)}}),"chunk-"+t,t)}};var t=(t,n)=>{var s,i,[r,a,c]=n,l=0;if(r.some((t=>0!==e[t]))){for(s in a)o.o(a,s)&&(o.m[s]=a[s]);if(c)c(o)}for(t&&t(n);l<r.length;l++)i=r[l],o.o(e,i)&&e[i]&&e[i][0](),e[i]=0},n=self.webpackChunkconverse_js=self.webpackChunkconverse_js||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})(),o.nc=void 0,(()=>{"use strict";const e={},t={plugins:{add(t,n){if(void 0!==e[t])throw new TypeError(`Error: plugin with name "${t}" has already been registered!`);e[t]=n}},initialize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.load(e).initialize(e)},load(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return n.assets_path&&(o.p=n.assets_path),o(3263),Object.keys(e).forEach((n=>t.plugins.add(n,e[n]))),t}};window.converse=t;const n=new CustomEvent("converse-loaded",{detail:{converse:t}});window.dispatchEvent(n)})()})();
//# sourceMappingURL=converse.min.js.map