PageSourceSearch

https://exode.me/plugins/livechat/14.0.1/client-scripts/dist/client/common-client-plugin.js

js exode.me collected 2026-10-04 16:17:50 UTC 171,912 bytes, 70 lines download raw bytes

vendor: 10,731 bytes, line 1
1var Yi=Object.freeze,Qt=Object.defineProperty,js=Object.defineProperties,qs=Object.getOwnPropertyDescriptor,Gs=Object.getOwnPropertyDescriptors;var Ki=Object.getOwnPropertySymbols;var Ws=Object.prototype.hasOwnProperty,zs=Object.prototype.propertyIsEnumerable;var Ji=(i,t,e)=>t in i?Qt(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,D=(i,t)=>{for(var e in t||(t={}))Ws.call(t,e)&&Ji(i,e,t[e]);if(Ki)for(var e of Ki(t))zs.call(t,e)&&Ji(i,e,t[e]);return i},Ee=(i,t)=>js(i,Gs(t));var P=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var g=(i,t,e,r)=>{for(var n=r>1?void 0:r?qs(t,e):t,o=i.length-1,s;o>=0;o--)(s=i[o])&&(n=(r?s(t,e,n):s(n))||n);return r&&n&&Qt(t,e,n),n};var p=(i,t)=>Yi(Qt(i,"raw",{value:Yi(t||i.slice())}));var vi=P(bi=>{"use strict";Object.defineProperty(bi,"__esModule",{value:!0});bi.default=ha;var vt,da=new Uint8Array(16);function ha(){if(!vt&&(vt=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!vt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return vt(da)}});var cn=P(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.default=void 0;var pa=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;_t.default=pa});var Qe=P(Ct=>{"use strict";Object.defineProperty(Ct,"__esModule",{value:!0});Ct.default=void 0;var fa=ma(cn());function ma(i){return i&&i.__esModule?i:{default:i}}function ga(i){return typeof i=="string"&&fa.default.test(i)}var ba=ga;Ct.default=ba});var tt=P(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.default=void 0;et.unsafeStringify=un;var va=_a(Qe());function _a(i){return i&&i.__esModule?i:{default:i}}var B=[];for(let i=0;i<256;++i)B.push((i+256).toString(16).slice(1));function un(i,t=0){return B[i[t+0]]+B[i[t+1]]+B[i[t+2]]+B[i[t+3]]+"-"+B[i[t+4]]+B[i[t+5]]+"-"+B[i[t+6]]+B[i[t+7]]+"-"+B[i[t+8]]+B[i[t+9]]+"-"+B[i[t+10]]+B[i[t+11]]+B[i[t+12]]+B[i[t+13]]+B[i[t+14]]+B[i[t+15]]}function Ca(i,t=0){let e=un(i,t);if(!(0,va.default)(e))throw TypeError("Stringified UUID is invalid");return e}var ya=Ca;et.default=ya});var hn=P(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.default=void 0;var Ea=Aa(vi()),Oa=tt();function Aa(i){return i&&i.__esModule?i:{default:i}}var dn,_i,Ci=0,yi=0;function $a(i,t,e){let r=t&&e||0,n=t||new Array(16);i=i||{};let o=i.node||dn,s=i.clockseq!==void 0?i.clockseq:_i;if(o==null||s==null){let m=i.random||(i.rng||Ea.default)();o==null&&(o=dn=[m[0]|1,m[1],m[2],m[3],m[4],m[5]]),s==null&&(s=_i=(m[6]<<8|m[7])&16383)}let a=i.msecs!==void 0?i.msecs:Date.now(),l=i.nsecs!==void 0?i.nsecs:yi+1,c=a-Ci+(l-yi)/1e4;if(c<0&&i.clockseq===void 0&&(s=s+1&16383),(c<0||a>Ci)&&i.nsecs===void 0&&(l=0),l>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Ci=a,yi=l,_i=s,a+=122192928e5;let u=((a&268435455)*1e4+l)%4294967296;n[r++]=u>>>24&255,n[r++]=u>>>16&255,n[r++]=u>>>8&255,n[r++]=u&255;let h=a/4294967296*1e4&268435455;n[r++]=h>>>8&255,n[r++]=h&255,n[r++]=h>>>24&15|16,n[r++]=h>>>16&255,n[r++]=s>>>8|128,n[r++]=s&255;for(let m=0;m<6;++m)n[r+m]=o[m];return t||(0,Oa.unsafeStringify)(n)}var Ta=$a;yt.default=Ta});var Ei=P(Et=>{"use strict";Object.defineProperty(Et,"__esModule",{value:!0});Et.default=void 0;var La=wa(Qe());function wa(i){return i&&i.__esModule?i:{default:i}}function Ra(i){if(!(0,La.default)(i))throw TypeError("Invalid UUID");let t,e=new Uint8Array(16);return e[0]=(t=parseInt(i.slice(0,8),16))>>>24,e[1]=t>>>16&255,e[2]=t>>>8&255,e[3]=t&255,e[4]=(t=parseInt(i.slice(9,13),16))>>>8,e[5]=t&255,e[6]=(t=parseInt(i.slice(14,18),16))>>>8,e[7]=t&255,e[8]=(t=parseInt(i.slice(19,23),16))>>>8,e[9]=t&255,e[10]=(t=parseInt(i.slice(24,36),16))/1099511627776&255,e[11]=t/4294967296&255,e[12]=t>>>24&255,e[13]=t>>>16&255,e[14]=t>>>8&255,e[15]=t&255,e}var Sa=Ra;Et.default=Sa});var Oi=P(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.URL=Se.DNS=void 0;Se.default=Da;var ka=tt(),xa=Ia(Ei());function Ia(i){return i&&i.__esModule?i:{default:i}}function Na(i){i=unescape(encodeURIComponent(i));let t=[];for(let e=0;e<i.length;++e)t.push(i.charCodeAt(e));return t}var pn="6ba7b810-9dad-11d1-80b4-00c04fd430c8";Se.DNS=pn;var fn="6ba7b811-9dad-11d1-80b4-00c04fd430c8";Se.URL=fn;function Da(i,t,e){function r(n,o,s,a){var l;if(typeof n=="string"&&(n=Na(n)),typeof o=="string"&&(o=(0,xa.default)(o)),((l=o)===null||l===void 0?void 0:l.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+n.length);if(c.set(o),c.set(n,o.length),c=e(c),c[6]=c[6]&15|t,c[8]=c[8]&63|128,s){a=a||0;for(let u=0;u<16;++u)s[a+u]=c[u];return s}return(0,ka.unsafeStringify)(c)}try{r.name=i}catch(n){}return r.DNS=pn,r.URL=fn,r}});var gn=P(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.default=void 0;function Pa(i){if(typeof i=="string"){let t=unescape(encodeURIComponent(i));i=new Uint8Array(t.length);for(let e=0;e<t.length;++e)i[e]=t.charCodeAt(e)}return Ua(Ma(Ha(i),i.length*8))}function Ua(i){let t=[],e=i.length*32,r="0123456789abcdef";for(let n=0;n<e;n+=8){let o=i[n>>5]>>>n%32&255,s=parseInt(r.charAt(o>>>4&15)+r.charAt(o&15),16);t.push(s)}return t}function mn(i){return(i+64>>>9<<4)+14+1}function Ma(i,t){i[t>>5]|=128<<t%32,i[mn(t)-1]=t;let e=1732584193,r=-271733879,n=-1732584194,o=271733878;for(let s=0;s<i.length;s+=16){let a=e,l=r,c=n,u=o;e=j(e,r,n,o,i[s],7,-680876936),o=j(o,e,r,n,i[s+1],12,-389564586),n=j(n,o,e,r,i[s+2],17,606105819),r=j(r,n,o,e,i[s+3],22,-1044525330),e=j(e,r,n,o,i[s+4],7,-176418897),o=j(o,e,r,n,i[s+5],12,1200080426),n=j(n,o,e,r,i[s+6],17,-1473231341),r=j(r,n,o,e,i[s+7],22,-45705983),e=j(e,r,n,o,i[s+8],7,1770035416),o=j(o,e,r,n,i[s+9],12,-1958414417),n=j(n,o,e,r,i[s+10],17,-42063),r=j(r,n,o,e,i[s+11],22,-1990404162),e=j(e,r,n,o,i[s+12],7,1804603682),o=j(o,e,r,n,i[s+13],12,-40341101),n=j(n,o,e,r,i[s+14],17,-1502002290),r=j(r,n,o,e,i[s+15],22,1236535329),e=q(e,r,n,o,i[s+1],5,-165796510),o=q(o,e,r,n,i[s+6],9,-1069501632),n=q(n,o,e,r,i[s+11],14,643717713),r=q(r,n,o,e,i[s],20,-373897302),e=q(e,r,n,o,i[s+5],5,-701558691),o=q(o,e,r,n,i[s+10],9,38016083),n=q(n,o,e,r,i[s+15],14,-660478335),r=q(r,n,o,e,i[s+4],20,-405537848),e=q(e,r,n,o,i[s+9],5,568446438),o=q(o,e,r,n,i[s+14],9,-1019803690),n=q(n,o,e,r,i[s+3],14,-187363961),r=q(r,n,o,e,i[s+8],20,1163531501),e=q(e,r,n,o,i[s+13],5,-1444681467),o=q(o,e,r,n,i[s+2],9,-51403784),n=q(n,o,e,r,i[s+7],14,1735328473),r=q(r,n,o,e,i[s+12],20,-1926607734),e=G(e,r,n,o,i[s+5],4,-378558),o=G(o,e,r,n,i[s+8],11,-2022574463),n=G(n,o,e,r,i[s+11],16,1839030562),r=G(r,n,o,e,i[s+14],23,-35309556),e=G(e,r,n,o,i[s+1],4,-1530992060),o=G(o,e,r,n,i[s+4],11,1272893353),n=G(n,o,e,r,i[s+7],16,-155497632),r=G(r,n,o,e,i[s+10],23,-1094730640),e=G(e,r,n,o,i[s+13],4,681279174),o=G(o,e,r,n,i[s],11,-358537222),n=G(n,o,e,r,i[s+3],16,-722521979),r=G(r,n,o,e,i[s+6],23,76029189),e=G(e,r,n,o,i[s+9],4,-640364487),o=G(o,e,r,n,i[s+12],11,-421815835),n=G(n,o,e,r,i[s+15],16,530742520),r=G(r,n,o,e,i[s+2],23,-995338651),e=W(e,r,n,o,i[s],6,-198630844),o=W(o,e,r,n,i[s+7],10,1126891415),n=W(n,o,e,r,i[s+14],15,-1416354905),r=W(r,n,o,e,i[s+5],21,-57434055),e=W(e,r,n,o,i[s+12],6,1700485571),o=W(o,e,r,n,i[s+3],10,-1894986606),n=W(n,o,e,r,i[s+10],15,-1051523),r=W(r,n,o,e,i[s+1],21,-2054922799),e=W(e,r,n,o,i[s+8],6,1873313359),o=W(o,e,r,n,i[s+15],10,-30611744),n=W(n,o,e,r,i[s+6],15,-1560198380),r=W(r,n,o,e,i[s+13],21,1309151649),e=W(e,r,n,o,i[s+4],6,-145523070),o=W(o,e,r,n,i[s+11],10,-1120210379),n=W(n,o,e,r,i[s+2],15,718787259),r=W(r,n,o,e,i[s+9],21,-343485551),e=_e(e,a),r=_e(r,l),n=_e(n,c),o=_e(o,u)}return[e,r,n,o]}function Ha(i){if(i.length===0)return[];let t=i.length*8,e=new Uint32Array(mn(t));for(let r=0;r<t;r+=8)e[r>>5]|=(i[r/8]&255)<<r%32;return e}function _e(i,t){let e=(i&65535)+(t&65535);return(i>>16)+(t>>16)+(e>>16)<<16|e&65535}function Va(i,t){return i<<t|i>>>32-t}function Ot(i,t,e,r,n,o){return _e(Va(_e(_e(t,i),_e(r,o)),n),e)}function j(i,t,e,r,n,o,s){return Ot(t&e|~t&r,i,t,n,o,s)}function q(i,t,e,r,n,o,s){return Ot(t&r|e&~r,i,t,n,o,s)}function G(i,t,e,r,n,o,s){return Ot(t^e^r,i,t,n,o,s)}function W(i,t,e,r,n,o,s){return Ot(e^(t|~r),i,t,n,o,s)}var Ba=Pa;At.default=Ba});var vn=P($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.default=void 0;var Fa=bn(Oi()),ja=bn(gn());function bn(i){return i&&i.__esModule?i:{default:i}}var qa=(0,Fa.default)("v3",48,ja.default),Ga=qa;$t.default=Ga});var _n=P(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.default=void 0;var Wa=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),za={randomUUID:Wa};Tt.default=za});var En=P(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Lt.default=void 0;var Cn=yn(_n()),Ya=yn(vi()),Ka=tt();function yn(i){return i&&i.__esModule?i:{default:i}}function Ja(i,t,e){if(Cn.default.randomUUID&&!t&&!i)return Cn.default.randomUUID();i=i||{};let r=i.random||(i.rng||Ya.default)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){e=e||0;for(let n=0;n<16;++n)t[e+n]=r[n];return t}return(0,Ka.unsafeStringify)(r)}var Xa=Ja;Lt.default=Xa});var On=P(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.default=void 0;function Za(i,t,e,r){switch(i){case 0:return t&e^~t&r;case 1:return t^e^r;case 2:return t&e^t&r^e&r;case 3:return t^e^r}}function Ai(i,t){return i<<t|i>>>32-t}function Qa(i){let t=[1518500249,1859775393,2400959708,3395469782],e=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof i=="string"){let s=unescape(encodeURIComponent(i));i=[];for(let a=0;a<s.length;++a)i.push(s.charCodeAt(a))}else Array.isArray(i)||(i=Array.prototype.slice.call(i));i.push(128);let r=i.length/4+2,n=Math.ceil(r/16),o=new Array(n);for(let s=0;s<n;++s){let a=new Uint32Array(16);for(let l=0;l<16;++l)a[l]=i[s*64+l*4]<<24|i[s*64+l*4+1]<<16|i[s*64+l*4+2]<<8|i[s*64+l*4+3];o[s]=a}o[n-1][14]=(i.length-1)*8/Math.pow(2,32),o[n-1][14]=Math.floor(o[n-1][14]),o[n-1][15]=(i.length-1)*8&4294967295;for(let s=0;s<n;++s){let a=new Uint32Array(80);for(let b=0;b<16;++b)a[b]=o[s][b];for(let b=16;b<80;++b)a[b]=Ai(a[b-3]^a[b-8]^a[b-14]^a[b-16],1);let l=e[0],c=e[1],u=e[2],h=e[3],m=e[4];for(let b=0;b<80;++b){let y=Math.floor(b/20),A=Ai(l,5)+Za(y,c,u,h)+m+t[y]+a[b]>>>0;m=h,h=u,u=Ai(c,30)>>>0,c=l,l=A}e[0]=e[0]+l>>>0,e[1]=e[1]+c>>>0,e[2]=e[2]+u>>>0,e[3]=e[3]+h>>>0,e[4]=e[4]+m>>>0}return[e[0]>>24&255,e[0]>>16&255,e[0]>>8&255,e[0]&255,e[1]>>24&255,e[1]>>16&255,e[1]>>8&255,e[1]&255,e[2]>>24&255,e[2]>>16&255,e[2]>>8&255,e[2]&255,e[3]>>24&255,e[3]>>16&255,e[3]>>8&255,e[3]&255,e[4]>>24&255,e[4]>>16&255,e[4]>>8&255,e[4]&255]}var el=Qa;wt.default=el});var $n=P(Rt=>{"use strict";
1Object.defineProperty(Rt,"__esModule",{value:!0});Rt.default=void 0;var tl=An(Oi()),il=An(On());function An(i){return i&&i.__esModule?i:{default:i}}var rl=(0,tl.default)("v5",80,il.default),nl=rl;Rt.default=nl});var Tn=P(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.default=void 0;var ol="00000000-0000-0000-0000-000000000000";St.default=ol});var Ln=P(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.default=void 0;var sl=al(Qe());function al(i){return i&&i.__esModule?i:{default:i}}function ll(i){if(!(0,sl.default)(i))throw TypeError("Invalid UUID");return parseInt(i.slice(14,15),16)}var cl=ll;kt.default=cl});var wn=P(ie=>{"use strict";Object.defineProperty(ie,"__esModule",{value:!0});Object.defineProperty(ie,"NIL",{enumerable:!0,get:function(){return fl.default}});Object.defineProperty(ie,"parse",{enumerable:!0,get:function(){return vl.default}});Object.defineProperty(ie,"stringify",{enumerable:!0,get:function(){return bl.default}});Object.defineProperty(ie,"v1",{enumerable:!0,get:function(){return ul.default}});Object.defineProperty(ie,"v3",{enumerable:!0,get:function(){return dl.default}});Object.defineProperty(ie,"v4",{enumerable:!0,get:function(){return hl.default}});Object.defineProperty(ie,"v5",{enumerable:!0,get:function(){return pl.default}});Object.defineProperty(ie,"validate",{enumerable:!0,get:function(){return gl.default}});Object.defineProperty(ie,"version",{enumerable:!0,get:function(){return ml.default}});var ul=ce(hn()),dl=ce(vn()),hl=ce(En()),pl=ce($n()),fl=ce(Tn()),ml=ce(Ln()),gl=ce(Qe()),bl=ce(tt()),vl=ce(Ei());function ce(i){return i&&i.__esModule?i:{default:i}}});var Sn=P((kh,Rn)=>{"use strict";function $i(i,t){if(!i||!t||!i.length||!t.length)throw new Error("Bad alphabet");this.srcAlphabet=i,this.dstAlphabet=t}$i.prototype.convert=function(i){var t,e,r,n={},o=this.srcAlphabet.length,s=this.dstAlphabet.length,a=i.length,l=typeof i=="string"?"":[];if(!this.isValid(i))throw new Error('Number "'+i+'" contains of non-alphabetic digits ('+this.srcAlphabet+")");if(this.srcAlphabet===this.dstAlphabet)return i;for(t=0;t<a;t++)n[t]=this.srcAlphabet.indexOf(i[t]);do{for(e=0,r=0,t=0;t<a;t++)e=e*o+n[t],e>=s?(n[r++]=parseInt(e/s,10),e=e%s):r>0&&(n[r++]=0);a=r,l=this.dstAlphabet.slice(e,e+1).concat(l)}while(r!==0);return l};$i.prototype.isValid=function(i){for(var t=0;t<i.length;++t)if(this.srcAlphabet.indexOf(i[t])===-1)return!1;return!0};Rn.exports=$i});var xn=P((xh,kn)=>{var _l=Sn();function it(i,t){var e=new _l(i,t);return function(r){return e.convert(r)}}it.BIN="01";it.OCT="01234567";it.DEC="0123456789";it.HEX="0123456789abcdef";kn.exports=it});var Pn=P((Ih,Dn)=>{var{v4:Ti,validate:Cl}=wn(),xt=xn(),Li={cookieBase90:"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!#$%&'()*+-./:<=>?@[]^_`{|}~",flickrBase58:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ",uuid25Base36:"0123456789abcdefghijklmnopqrstuvwxyz"},yl={consistentLength:!0},wi,In=(i,t,e)=>{let r=t(i.toLowerCase().replace(/-/g,""));return!e||!e.consistentLength?r:r.padStart(e.shortIdLength,e.paddingChar)},Nn=(i,t)=>{let r=t(i).padStart(32,"0").match(/(\w{8})(\w{4})(\w{4})(\w{4})(\w{12})/);return[r[1],r[2],r[3],r[4],r[5]].join("-")},El=i=>Math.ceil(Math.log(2**128)/Math.log(i));Dn.exports=(()=>{let i=(t,e)=>{let r=t||Li.flickrBase58,n=D(D({},yl),e);if([...new Set(Array.from(r))].length!==r.length)throw new Error("The provided Alphabet has duplicate characters resulting in unreliable results");let o=El(r.length),s={shortIdLength:o,consistentLength:n.consistentLength,paddingChar:r[0]},a=xt(xt.HEX,r),l=xt(r,xt.HEX),c=()=>In(Ti(),a,s),h={alphabet:r,fromUUID:m=>In(m,a,s),maxLength:o,generate:c,new:c,toUUID:m=>Nn(m,l),uuid:Ti,validate:(m,b=!1)=>{if(!m||typeof m!="string")return!1;let y=n.consistentLength?m.length===o:m.length<=o,A=m.split("").every(w=>r.includes(w));return b===!1?y&&A:y&&A&&Cl(Nn(m,l))}};return Object.freeze(h),h};return i.constants=Li,i.uuid=Ti,i.generate=()=>(wi||(wi=i(Li.flickrBase58).generate),wi()),i})()});var Kn=P((Jh,Yn)=>{Yn.exports=function(i){var t={};function e(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return i[r].call(n.exports,n,n.exports,e),n.l=!0,n.exports}return e.m=i,e.c=t,e.d=function(r,n,o){e.o(r,n)||Object.defineProperty(r,n,{enumerable:!0,get:o})},e.r=function(r){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}
1),Object.defineProperty(r,"__esModule",{value:!0})},e.t=function(r,n){if(1&n&&(r=e(r)),8&n||4&n&&typeof r=="object"&&r&&r.__esModule)return r;var o=Object.create(null);if(e.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:r}),2&n&&typeof r!="string")for(var s in r)e.d(o,s,(function(a){return r[a]}).bind(null,s));return o},e.n=function(r){var n=r&&r.__esModule?function(){return r.default}:function(){return r};return e.d(n,"a",n),n},e.o=function(r,n){return Object.prototype.hasOwnProperty.call(r,n)},e.p="",e(e.s=0)}([function(i,t,e){"use strict";e.r(t),e.d(t,"validateHTMLColorName",function(){return s}),e.d(t,"validateHTMLColorSpecialName",function(){return a}),e.d(t,"validateHTMLColorHex",function(){return l}),e.d(t,"validateHTMLColorRgb",function(){return A}),e.d(t,"validateHTMLColorHsl",function(){return w}),e.d(t,"validateHTMLColorHwb",function(){return x}),e.d(t,"validateHTMLColorLab",function(){return M}),e.d(t,"validateHTMLColorLch",function(){return H}),e.d(t,"validateHTMLColor",function(){return I});let r=C=>C&&typeof C=="string",n=["AliceBlue","AntiqueWhite","Aqua","Aquamarine","Azure","Beige","Bisque","Black","BlanchedAlmond","Blue","BlueViolet","Brown","BurlyWood","CadetBlue","Chartreuse","Chocolate","Coral","CornflowerBlue","Cornsilk","Crimson","Cyan","DarkBlue","DarkCyan","DarkGoldenrod","DarkGray","DarkGrey","DarkGreen","DarkKhaki","DarkMagenta","DarkOliveGreen","DarkOrange","DarkOrchid","DarkRed","DarkSalmon","DarkSeaGreen","DarkSlateBlue","DarkSlateGray","DarkSlateGrey","DarkTurquoise","DarkViolet","DeepPink","DeepSkyBlue","DimGray","DimGrey","DodgerBlue","FireBrick","FloralWhite","ForestGreen","Fuchsia","Gainsboro","GhostWhite","Gold","Goldenrod","Gray","Grey","Green","GreenYellow","HoneyDew","HotPink","IndianRed","Indigo","Ivory","Khaki","Lavender","LavenderBlush","LawnGreen","LemonChiffon","LightBlue","LightCoral","LightCyan","LightGoldenrodYellow","LightGray","LightGrey","LightGreen","LightPink","LightSalmon","LightSalmon","LightSeaGreen","LightSkyBlue","LightSlateGray","LightSlateGrey","LightSteelBlue","LightYellow","Lime","LimeGreen","Linen","Magenta","Maroon","MediumAquamarine","MediumBlue","MediumOrchid","MediumPurple","MediumSeaGreen","MediumSlateBlue","MediumSlateBlue","MediumSpringGreen","MediumTurquoise","MediumVioletRed","MidnightBlue","MintCream","MistyRose","Moccasin","NavajoWhite","Navy","OldLace","Olive","OliveDrab","Orange","OrangeRed","Orchid","PaleGoldenrod","PaleGreen","PaleTurquoise","PaleVioletRed","PapayaWhip","PeachPuff","Peru","Pink","Plum","PowderBlue","Purple","RebeccaPurple","Red","RosyBrown","RoyalBlue","SaddleBrown","Salmon","SandyBrown","SeaGreen","SeaShell","Sienna","Silver","SkyBlue","SlateBlue","SlateGray","SlateGrey","Snow","SpringGreen","SteelBlue","Tan","Teal","Thistle","Tomato","Turquoise","Violet","Wheat","White","WhiteSmoke","Yellow","YellowGreen"],o=["currentColor","inherit","transparent"],s=C=>{let $=!1;return r(C)&&n.map(N=>(C.toLowerCase()===N.toLowerCase()&&($=!0),null)),$},a=C=>{let $=!1;return r(C)&&o.map(N=>(C.toLowerCase()===N.toLowerCase()&&($=!0),null)),$},l=C=>r(C)?C&&/^#([\da-f]{3}){1,2}$|^#([\da-f]{4}){1,2}$/i.test(C):!1,c="(([\\d]{0,5})((\\.([\\d]{1,5}))?))",u="(".concat(c,"%)"),h="(([0-9]|[1-9][0-9]|100)%)",m="(".concat(h,"|(0?((\\.([\\d]{1,5}))?))|1)"),b="([\\s]{0,5})\\)?)(([\\s]{0,5})(\\/?)([\\s]{1,5})".concat("(((".concat(h,"))|(0?((\\.([\\d]{1,5}))?))|1))?"),"([\\s]{0,5})\\)"),y="(-?(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-9][0-9]|3[0-5][0-9])((\\.([\\d]{1,5}))?)|360)(deg)?)",A=C=>{if(r(C)){let $="([\\s]{0,5})([\\d]{1,5})%?([\\s]{0,5}),?",N="((([\\s]{0,5}),?([\\s]{0,5}))|(([\\s]{1,5})))",U=new RegExp("^(rgb)a?\\(".concat("".concat($).concat(N)).concat("".concat($).concat(N)).concat("".concat($).concat(N),"((\\/?([\\s]{0,5})(0?\\.?([\\d]{1,5})%?([\\s]{0,5}))?|1|0))?\\)$"));return C&&U.test(C)}return!1},w=C=>{if(r(C)){let $=new RegExp("^(hsl)a?\\((([\\s]{0,5})(".concat(y,"|(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-9][0-9]|3[0-9][0-9]|400)grad)|((([0-5])?\\.([\\d]{1,5})|6\\.([0-9]|1[0-9]|2[0-8])|[0-6])rad)|((0?((\\.([\\d]{1,5}))?)|1)turn))((([\\s]{0,5}),([\\s]{0,5}))|(([\\s]{1,5}))))(([\\s]{0,5})(0|").concat(h,")((([\\s]{0,5}),([\\s]{0,5}))|(([\\s]{1,5}))))(([\\s]{0,5})(0|").concat(h,")([\\s]{0,5})\\)?)(([\\s]{0,5})(\\/?|,?)([\\s]{0,5})(((").concat(h,"))|(0?((\\.([\\d]{1,5}))?))|1))?\\)$"));return C&&$.test(C)}return!1},x=C=>{if(r(C)){let $=new RegExp("^(hwb\\(([\\s]{0,5})".concat(y,"([\\s]{1,5}))((0|").concat(h,")([\\s]{1,5}))((0|").concat(h,")").concat(b,"$"));return C&&$.test(C)}return!1},M=C=>{if(r(C)){let $="(-?(([0-9]|[1-9][0-9]|1[0-5][0-9])((\\.([\\d]{1,5}))?)?|160))",N=new RegExp("^(lab\\(([\\s]{0,5})".concat(u,"([\\s]{1,5})").concat($,"([\\s]{1,5})").concat($).concat(b,"$"));return C&&N.test(C)}return!1},H=C=>{if(r(C)){let $="((([0-9]|[1-9][0-9])?((\\.([\\d]{1,5}))?)|100)(%)?)",N=""+c,U="((".concat(y,")|(0|").concat(m,")|(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-9][0-9]|3[0-5][0-9])((\\.([\\d]{1,5}))?)|360))"),de="(\\/([\\s]{0,5})".concat(m,")"),re=new RegExp("^lch\\(".concat("(([\\s]{0,5})".concat($,"([\\s]{1,5})").concat(N,"([\\s]{1,5})").concat(U,"([\\s]{0,5})(").concat(de,")?)"),"\\)$"));return C&&re.test(C)}return!1},I=C=>!!(C&&l(C)||A(C)||w(C)||x(C)||M(C)||H(C));t.default=C=>!!(C&&l(C)||s(C)||a(C)||A(C)||w(C)||x(C)||M(C)||H(C))}])});var nt=globalThis,st=nt.ShadowRoot&&(nt.ShadyCSS===void 0||nt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Zi=Symbol(),Xi=new WeakMap,ot=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Zi)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(st&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=Xi.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&Xi.set(e,t))}return t}toString(){return this.cssText}},Qi=i=>new ot(typeof i=="string"?i:i+"",void 0,Zi);var er=(i,t)=>{if(st)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),n=nt.litNonce;n!==void 0&&r.setAttribute("nonce",n),r.textContent=e.cssText,i.appendChild(r)}},ei=st?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Qi(e)})(i):i;var{is:Ys,defineProperty:Ks,getOwnPropertyDescriptor:Js,getOwnPropertyNames:Xs,getOwnPropertySymbols:Zs,getPrototypeOf:Qs}=Object,he=globalThis,tr=he.trustedTypes,ea=tr?tr.emptyScript:"",ti=he.reactiveElementPolyfillSupport,qe=(i,t)=>i,Ge={toAttribute(i,t){switch(t){case Boolean:i=i?ea:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch(r){e=null}}return e}},De=(i,t)=>!Ys(i,t),ir={attribute:!0,type:String,converter:Ge,reflect:!1,useDefault:!1,hasChanged:De},rr,nr;(rr=Symbol.metadata)!=null||(Symbol.metadata=Symbol("metadata")),(nr=he.litPropertyMetadata)!=null||(he.litPropertyMetadata=new WeakMap);var ae=class extends HTMLElement{static addInitializer(t){var e;this._$Ei(),((e=this.l)!=null?e:this.l=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=ir){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),n=this.getPropertyDescriptor(t,r,e);n!==void 0&&Ks(this.prototype,t,n)}}static getPropertyDescriptor(t,e,r){var s;let{get:n,set:o}=(s=Js(this.prototype,t))!=null?s:{get(){return this[e]},set(a){this[e]=a}};return{get:n,set(a){let l=n==null?void 0:n.call(this);o==null||o.call(this,a),this.requestUpdate(t,l,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){var e;return(e=this.elementProperties.get(t))!=null?e:ir}static _$Ei(){if(this.hasOwnProperty(qe("elementProperties")))return;let t=Qs(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(qe("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(qe("properties"))){let e=this.properties,r=[...Xs(e),...Zs(e)];for(let n of r)this.createProperty(n,e[n])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,n]of e)this.elementProperties.set(r,n)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let n=this._$Eu(e,r);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];
vendor: 5,021 bytes, line 1
1if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let n of r)e.unshift(ei(n))}else t!==void 0&&e.push(ei(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e,r;((e=this._$EO)!=null?e:this._$EO=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&((r=t.hostConnected)==null||r.call(t))}removeController(t){var e;(e=this._$EO)==null||e.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){var e;let t=(e=this.shadowRoot)!=null?e:this.attachShadow(this.constructor.shadowRootOptions);return er(t,this.constructor.elementStyles),t}connectedCallback(){var t,e;(t=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(r=>{var n;return(n=r.hostConnected)==null?void 0:n.call(r)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(e=>{var r;return(r=e.hostDisconnected)==null?void 0:r.call(e)})}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$ET(t,e){var o;let r=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,r);if(n!==void 0&&r.reflect===!0){let s=(((o=r.converter)==null?void 0:o.toAttribute)!==void 0?r.converter:Ge).toAttribute(e,r.type);this._$Em=t,s==null?this.removeAttribute(n):this.setAttribute(n,s),this._$Em=null}}_$AK(t,e){var o,s,a,l;let r=this.constructor,n=r._$Eh.get(t);if(n!==void 0&&this._$Em!==n){let c=r.getPropertyOptions(n),u=typeof c.converter=="function"?{fromAttribute:c.converter}:((o=c.converter)==null?void 0:o.fromAttribute)!==void 0?c.converter:Ge;this._$Em=n,this[n]=(l=(a=u.fromAttribute(e,c.type))!=null?a:(s=this._$Ej)==null?void 0:s.get(n))!=null?l:null,this._$Em=null}}requestUpdate(t,e,r){var n,o;if(t!==void 0){let s=this.constructor,a=this[t];if(r!=null||(r=s.getPropertyOptions(t)),!(((n=r.hasChanged)!=null?n:De)(a,e)||r.useDefault&&r.reflect&&a===((o=this._$Ej)==null?void 0:o.get(t))&&!this.hasAttribute(s._$Eu(t,r))))return;this.C(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:r,reflect:n,wrapped:o},s){var a,l,c;r&&!((a=this._$Ej)!=null?a:this._$Ej=new Map).has(t)&&(this._$Ej.set(t,(l=s!=null?s:e)!=null?l:this[t]),o!==!0||s!==void 0)||(this._$AL.has(t)||(this.hasUpdated||r||(e=void 0),this._$AL.set(t,e)),n===!0&&this._$Em!==t&&((c=this._$Eq)!=null?c:this._$Eq=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var r,n;if(!this.isUpdatePending)return;if(!this.hasUpdated){if((r=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[s,a]of this._$Ep)this[s]=a;this._$Ep=void 0}let o=this.constructor.elementProperties;if(o.size>0)for(let[s,a]of o){let{wrapped:l}=a,c=this[s];l!==!0||this._$AL.has(s)||c===void 0||this.C(s,void 0,a,c)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(n=this._$EO)==null||n.forEach(o=>{var s;return(s=o.hostUpdate)==null?void 0:s.call(o)}),this.update(e)):this._$EM()}catch(o){throw t=!1,this._$EM(),o}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$EO)==null||e.forEach(r=>{var n;return(n=r.hostUpdated)==null?void 0:n.call(r)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&(this._$Eq=this._$Eq.forEach(e=>this._$ET(e,this[e]))),this._$EM()}updated(t){}firstUpdated(t){}},or;ae.elementStyles=[],ae.shadowRootOptions={mode:"open"},ae[qe("elementProperties")]=new Map,ae[qe("finalized")]=new Map,ti==null||ti({ReactiveElement:ae}),((or=he.reactiveElementVersions)!=null?or:he.reactiveElementVersions=[]).push("2.1.0");var ze=globalThis,at=ze.trustedTypes,sr=at?at.createPolicy("lit-html",{createHTML:i=>i}):void 0,ni="$lit$",le="lit$".concat(Math.random().toFixed(9).slice(2),"$"),oi="?"+le,ta="<".concat(oi,">"),$e=document,Ye=()=>$e.createComment(""),Ke=i=>i===null||typeof i!="object"&&typeof i!="function",si=Array.isArray,pr=i=>si(i)||typeof(i==null?void 0:i[Symbol.iterator])=="function",ii="[ 	\n\f\r]",We=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ar=/-->/g,lr=/>/g,Oe=RegExp(">|".concat(ii,"(?:([^\\s\"'>=/]+)(").concat(ii,"*=").concat(ii,"*(?:[^ 	\n\f\r\"'`<>=]|(\"|')|))|$)"),"g"),cr=/'/g,ur=/"/g,fr=/^(?:script|style|textarea|title)$/i,ai=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}
vendor: 4,726 bytes, line 1
1),f=ai(1),zl=ai(2),Yl=ai(3),Z=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),dr=new WeakMap,Ae=$e.createTreeWalker($e,129);function mr(i,t){if(!si(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return sr!==void 0?sr.createHTML(t):t}var gr=(i,t)=>{let e=i.length-1,r=[],n,o=t===2?"<svg>":t===3?"<math>":"",s=We;for(let a=0;a<e;a++){let l=i[a],c,u,h=-1,m=0;for(;m<l.length&&(s.lastIndex=m,u=s.exec(l),u!==null);)m=s.lastIndex,s===We?u[1]==="!--"?s=ar:u[1]!==void 0?s=lr:u[2]!==void 0?(fr.test(u[2])&&(n=RegExp("</"+u[2],"g")),s=Oe):u[3]!==void 0&&(s=Oe):s===Oe?u[0]===">"?(s=n!=null?n:We,h=-1):u[1]===void 0?h=-2:(h=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?Oe:u[3]==='"'?ur:cr):s===ur||s===cr?s=Oe:s===ar||s===lr?s=We:(s=Oe,n=void 0);let b=s===Oe&&i[a+1].startsWith("/>")?" ":"";o+=s===We?l+ta:h>=0?(r.push(c),l.slice(0,h)+ni+l.slice(h)+le+b):l+le+(h===-2?a:b)}return[mr(i,o+(i[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},Je=class i{constructor({strings:t,_$litType$:e},r){let n;this.parts=[];let o=0,s=0,a=t.length-1,l=this.parts,[c,u]=gr(t,e);if(this.el=i.createElement(c,r),Ae.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(n=Ae.nextNode())!==null&&l.length<a;){if(n.nodeType===1){if(n.hasAttributes())for(let h of n.getAttributeNames())if(h.endsWith(ni)){let m=u[s++],b=n.getAttribute(h).split(le),y=/([.?@])?(.*)/.exec(m);l.push({type:1,index:o,name:y[2],strings:b,ctor:y[1]==="."?ct:y[1]==="?"?ut:y[1]==="@"?dt:Le}),n.removeAttribute(h)}else h.startsWith(le)&&(l.push({type:6,index:o}),n.removeAttribute(h));if(fr.test(n.tagName)){let h=n.textContent.split(le),m=h.length-1;if(m>0){n.textContent=at?at.emptyScript:"";for(let b=0;b<m;b++)n.append(h[b],Ye()),Ae.nextNode(),l.push({type:2,index:++o});n.append(h[m],Ye())}}}else if(n.nodeType===8)if(n.data===oi)l.push({type:2,index:o});else{let h=-1;for(;(h=n.data.indexOf(le,h+1))!==-1;)l.push({type:7,index:o}),h+=le.length-1}o++}}static createElement(t,e){let r=$e.createElement("template");return r.innerHTML=t,r}};function Te(i,t,e=i,r){var s,a,l;if(t===Z)return t;let n=r!==void 0?(s=e._$Co)==null?void 0:s[r]:e._$Cl,o=Ke(t)?void 0:t._$litDirective$;return(n==null?void 0:n.constructor)!==o&&((a=n==null?void 0:n._$AO)==null||a.call(n,!1),o===void 0?n=void 0:(n=new o(i),n._$AT(i,e,r)),r!==void 0?((l=e._$Co)!=null?l:e._$Co=[])[r]=n:e._$Cl=n),n!==void 0&&(t=Te(i,n._$AS(i,t.values),n,r)),t}var lt=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var c;let{el:{content:e},parts:r}=this._$AD,n=((c=t==null?void 0:t.creationScope)!=null?c:$e).importNode(e,!0);Ae.currentNode=n;let o=Ae.nextNode(),s=0,a=0,l=r[0];for(;l!==void 0;){if(s===l.index){let u;l.type===2?u=new Pe(o,o.nextSibling,this,t):l.type===1?u=new l.ctor(o,l.name,l.strings,this,t):l.type===6&&(u=new ht(o,this,t)),this._$AV.push(u),l=r[++a]}s!==(l==null?void 0:l.index)&&(o=Ae.nextNode(),s++)}return Ae.currentNode=$e,n}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},Pe=class i{get _$AU(){var t,e;return(e=(t=this._$AM)==null?void 0:t._$AU)!=null?e:this._$Cv}constructor(t,e,r,n){var o;this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=n,this._$Cv=(o=n==null?void 0:n.isConnected)!=null?o:!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Te(this,t,e),Ke(t)?t===E||t==null||t===""?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==Z&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):pr(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==E&&Ke(this._$AH)?this._$AA.nextSibling.data=t:this.T($e.createTextNode(t)),this._$AH=t}$(t){var o;let{values:e,_$litType$:r}=t,n=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=Je.createElement(mr(r.h,r.h[0]),this.options)),r);if(((o=this._$AH)==null?void 0:o._$AD)===n)this._$AH.p(e);else{let s=new lt(n,this),a=s.u(this.options);s.p(e),this.T(a),this._$AH=s}}_$AC(t){let e=dr.get(t.strings);return e===void 0&&dr.set(t.strings,e=new Je(t)),e}k(t){si(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,n=0;for(let o of t)n===e.length?e.push(r=new i(this.O(Ye()),this.O(Ye()),this,this.options)):r=e[n],r._$AI(o),n++;n<e.length&&(this._$AR(r&&r._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){var r;
1for((r=this._$AP)==null?void 0:r.call(this,!1,!0,e);t&&t!==this._$AB;){let n=t.nextSibling;t.remove(),t=n}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}},Le=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,n,o){this.type=1,this._$AH=E,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=E}_$AI(t,e=this,r,n){let o=this.strings,s=!1;if(o===void 0)t=Te(this,t,e,0),s=!Ke(t)||t!==this._$AH&&t!==Z,s&&(this._$AH=t);else{let a=t,l,c;for(t=o[0],l=0;l<o.length-1;l++)c=Te(this,a[r+l],e,l),c===Z&&(c=this._$AH[l]),s||(s=!Ke(c)||c!==this._$AH[l]),c===E?t=E:t!==E&&(t+=(c!=null?c:"")+o[l+1]),this._$AH[l]=c}s&&!n&&this.j(t)}j(t){t===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t!=null?t:"")}},ct=class extends Le{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===E?void 0:t}},ut=class extends Le{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==E)}},dt=class extends Le{constructor(t,e,r,n,o){super(t,e,r,n,o),this.type=5}_$AI(t,e=this){var s;if((t=(s=Te(this,t,e,0))!=null?s:E)===Z)return;let r=this._$AH,n=t===E&&r!==E||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,o=t!==E&&(r===E||n);n&&this.element.removeEventListener(this.name,this,r),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,r;typeof this._$AH=="function"?this._$AH.call((r=(e=this.options)==null?void 0:e.host)!=null?r:this.element,t):this._$AH.handleEvent(t)}},ht=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){Te(this,t)}},br={M:ni,P:le,A:oi,C:1,L:gr,R:lt,D:pr,V:Te,I:Pe,H:Le,N:ut,U:dt,B:ct,F:ht},ri=ze.litHtmlPolyfillSupport,hr;ri==null||ri(Je,Pe),((hr=ze.litHtmlVersions)!=null?hr:ze.litHtmlVersions=[]).push("3.3.0");var ne=(i,t,e)=>{var o,s;let r=(o=e==null?void 0:e.renderBefore)!=null?o:t,n=r._$litPart$;if(n===void 0){let a=(s=e==null?void 0:e.renderBefore)!=null?s:null;r._$litPart$=n=new Pe(t.insertBefore(Ye(),a),a,void 0,e!=null?e:{})}return n._$AI(i),n};var we=globalThis,pe=class extends ae{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,r;let t=super.createRenderRoot();return(r=(e=this.renderOptions).renderBefore)!=null||(e.renderBefore=t.firstChild),t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=ne(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return Z}},vr;pe._$litElement$=!0,pe.finalized=!0,(vr=we.litElementHydrateSupport)==null||vr.call(we,{LitElement:pe});var li=we.litElementPolyfillSupport;li==null||li({LitElement:pe});var _r;((_r=we.litElementVersions)!=null?_r:we.litElementVersions=[]).push("4.2.0");var T=i=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(i,t)}):customElements.define(i,t)};var ia={attribute:!0,type:String,converter:Ge,reflect:!1,hasChanged:De},ra=(i=ia,t,e)=>{let{kind:r,metadata:n}=e,o=globalThis.litPropertyMetadata.get(n);if(o===void 0&&globalThis.litPropertyMetadata.set(n,o=new Map),r==="setter"&&((i=Object.create(i)).wrapped=!0),o.set(e.name,i),r==="accessor"){let{name:s}=e;return{set(a){let l=t.get.call(this);t.set.call(this,a),this.requestUpdate(s,l,i)},init(a){return a!==void 0&&this.C(s,void 0,i,a),a}}}if(r==="setter"){let{name:s}=e;return function(a){let l=this[s];t.call(this,a),this.requestUpdate(s,l,i)}}throw Error("Unsupported decorator location: "+r)};function _(i){return(t,e)=>typeof e=="object"?ra(i,t,e):((r,n,o)=>{let s=n.hasOwnProperty(o);return n.constructor.createProperty(o,r),s?Object.getOwnPropertyDescriptor(n,o):void 0})(i,t,e)}function k(i){return _(Ee(D({},i),{state:!0,attribute:!1}))}var ee={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Q=i=>(...t)=>({_$litDirective$:i,values:t}),oe=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var{I:na}=br;var yr=i=>i.strings===void 0,Cr=()=>document.createComment(""),Ue=(i,t,e)=>{var o;let r=i._$AA.parentNode,n=t===void 0?i._$AB:t._$AA;if(e===void 0){let s=r.insertBefore(Cr(),n),a=r.insertBefore(Cr(),n);e=new na(s,a,i,i.options)}else{let s=e._$AB.nextSibling,a=e._$AM,l=a!==i;if(l){let c;(o=e._$AQ)==null||o.call(e,i),e._$AM=i,e._$AP!==void 0&&(c=i._$AU)!==a._$AU&&e._$AP(c)}if(s!==n||l){let c=e._$AA;
1for(;c!==s;){let u=c.nextSibling;r.insertBefore(c,n),c=u}}}return e},fe=(i,t,e=i)=>(i._$AI(t,e),i),oa={},Er=(i,t=oa)=>i._$AH=t,Or=i=>i._$AH,ft=i=>{var r;(r=i._$AP)==null||r.call(i,!1,!0);let t=i._$AA,e=i._$AB.nextSibling;for(;t!==e;){let n=t.nextSibling;t.remove(),t=n}};var Xe=(i,t)=>{var r;let e=i._$AN;if(e===void 0)return!1;for(let n of e)(r=n._$AO)==null||r.call(n,t,!1),Xe(n,t);return!0},mt=i=>{let t,e;do{if((t=i._$AM)===void 0)break;e=t._$AN,e.delete(i),i=t}while((e==null?void 0:e.size)===0)},Ar=i=>{for(let t;t=i._$AM;i=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(i))break;e.add(i),la(t)}};function sa(i){this._$AN!==void 0?(mt(this),this._$AM=i,Ar(this)):this._$AM=i}function aa(i,t=!1,e=0){let r=this._$AH,n=this._$AN;if(n!==void 0&&n.size!==0)if(t)if(Array.isArray(r))for(let o=e;o<r.length;o++)Xe(r[o],!1),mt(r[o]);else r!=null&&(Xe(r,!1),mt(r));else Xe(this,i)}var la=i=>{var t,e;i.type==ee.CHILD&&((t=i._$AP)!=null||(i._$AP=aa),(e=i._$AQ)!=null||(i._$AQ=sa))},me=class extends oe{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),Ar(this),this.isConnected=t._$AU}_$AO(t,e=!0){var r,n;t!==this.isConnected&&(this.isConnected=t,t?(r=this.reconnected)==null||r.call(this):(n=this.disconnected)==null||n.call(this)),e&&(Xe(this,t),mt(this))}setValue(t){if(yr(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var Ze=class extends oe{constructor(t){if(super(t),this.it=E,t.type!==ee.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===E||t==null)return this._t=void 0,this.it=t;if(t===Z)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;let e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};Ze.directiveName="unsafeHTML",Ze.resultType=1;var te=Q(Ze);function $r(i){return{log:t=>{typeof t=="string"?console.log("["+i+"] "+t):console.log("["+i+"]",t)},info:t=>{typeof t=="string"?console.info("["+i+"] "+t):console.info("["+i+"]",t)},error:t=>{typeof t=="string"?console.error("["+i+"] "+t):console.error("["+i+"]",t)},warn:t=>{typeof t=="string"?console.warn("["+i+"] "+t):console.warn("["+i+"]",t)},createLogger:t=>$r("peertube-plugin-livechat>"+t)}}var R=$r("peertube-plugin-livechat");var ci=class{constructor(t,e){this.ptOptions=t,this.logger=e}async getSettings(){var t;return(t=this._settings)!=null||(this._settings=await this.ptOptions.peertubeHelpers.getSettings()),this._settings}},ui;function z(){if(!ui)throw new Error("Peertube context not set yet, getPtContext was called too soon.");return ui}function Tr(i){ui=new ci(i,R)}var Lr,di=class extends me{constructor(e){super(e);this._translatedValue="";this._localizationId="";this._allowUnsafeHTML=!1;this.render=(e,r=!1)=>(this._localizationId=e,this._allowUnsafeHTML=r,this._translatedValue===""&&(this._translatedValue=e),this._asyncUpdateTranslation().then(()=>{},()=>{}),this._internalRender());this._internalRender=()=>this._allowUnsafeHTML?f(Lr||(Lr=p(["",""])),te(this._translatedValue)):this._translatedValue;this._asyncUpdateTranslation=async()=>{var r;let e=(r=await this._peertubeHelpers.translate(this._localizationId))!=null?r:"";return e!==""&&e!==this._translatedValue&&(this._translatedValue=e,this.setValue(this._internalRender())),!0};this._peertubeHelpers=z().ptOptions.peertubeHelpers,this._asyncUpdateTranslation().then(()=>{},()=>{})}},d=Q(di);var wr=Symbol(),Y=class{get taskComplete(){return this.t||(this.i===1?this.t=new Promise((t,e)=>{this.o=t,this.h=e}):this.i===3?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(t,e,r){var o,s,a;this.p=0,this.i=0,(this._=t).addController(this);let n=typeof e=="object"?e:{task:e,args:r};this.v=n.task,this.j=n.args,this.m=(o=n.argsEqual)!=null?o:Rr,this.k=n.onComplete,this.A=n.onError,this.autoRun=(s=n.autoRun)!=null?s:!0,"initialValue"in n&&(this.u=n.initialValue,this.i=2,this.O=(a=this.T)==null?void 0:a.call(this))}hostUpdate(){this.autoRun===!0&&this.S()}hostUpdated(){this.autoRun==="afterUpdate"&&this.S()}T(){if(this.j===void 0)return;let t=this.j();if(!Array.isArray(t))throw Error("The args function must return an array");return t}async S(){let t=this.T(),e=this.O;this.O=t,t===e||t===void 0||e!==void 0&&this.m(e,t)||await this.run(t)}async run(t){var s,a,l,c,u;let e,r;t!=null||(t=this.T()),this.O=t,this.i===1?(s=this.q)==null||s.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,this.autoRun==="afterUpdate"?queueMicrotask(()=>this._.requestUpdate()):this._.requestUpdate();let n=++this.p;
1this.q=new AbortController;let o=!1;try{e=await this.v(t,{signal:this.q.signal})}catch(h){o=!0,r=h}if(this.p===n){if(e===wr)this.i=0;else{if(o===!1){try{(a=this.k)==null||a.call(this,e)}catch(h){}this.i=2,(l=this.o)==null||l.call(this,e)}else{try{(c=this.A)==null||c.call(this,r)}catch(h){}this.i=3,(u=this.h)==null||u.call(this,r)}this.u=e,this.l=r}this._.requestUpdate()}}abort(t){var e;this.i===1&&((e=this.q)==null||e.abort(t))}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(t){var e,r,n,o;switch(this.i){case 0:return(e=t.initial)==null?void 0:e.call(t);case 1:return(r=t.pending)==null?void 0:r.call(t);case 2:return(n=t.complete)==null?void 0:n.call(t,this.value);case 3:return(o=t.error)==null?void 0:o.call(t,this.error);default:throw Error("Unexpected status: "+this.i)}}},Rr=(i,t)=>i===t||i.length===t.length&&i.every((e,r)=>!De(e,t[r]));var K=class extends Error{constructor(e,r,n){super(r);this.properties={};this.name=e,this.properties=n}};function V({peertubeHelpers:i},t=!1){return t?"/plugins/livechat/router":i.getBaseRouterRoute?i.getBaseRouterRoute():i.getBaseStaticRoute().replace(/\/static.*$/,"/router")}var Sr=["image/jpg","image/png","image/gif"];var ge=class{constructor(t){this._headers={};this.validateOptions=async t=>{var s;let e={};t.terms&&t.terms.length>400&&(e.terms=[5]);let r=t.bot,n=t.slowMode.duration,o=t.moderation.delay;if(e["slowMode.duration"]=[],e["moderation.delay"]=[],typeof n!="number"||isNaN(n)?e["slowMode.duration"].push(1):(n<0||n>1e3)&&e["slowMode.duration"].push(3),typeof o!="number"||isNaN(o)?e["moderation.delay"].push(1):(o<0||o>60)&&e["moderation.delay"].push(3),r.enabled){if(e["bot.nickname"]=[],e["bot.forbidSpecialChars.tolerance"]=[],e["bot.noDuplicate.delay"]=[],new RegExp("[^\\p{L}\\p{N}\\p{Z}_-]","u").test((s=r.nickname)!=null?s:"")&&e["bot.nickname"].push(2),r.forbidSpecialChars.enabled){let a=t.bot.forbidSpecialChars.tolerance;typeof a!="number"||isNaN(a)?e["bot.forbidSpecialChars.tolerance"].push(1):(a<0||a>10)&&e["bot.forbidSpecialChars.tolerance"].push(3)}if(r.noDuplicate.enabled){let a=t.bot.noDuplicate.delay;typeof a!="number"||isNaN(a)?e["bot.noDuplicate.delay"].push(1):(a<0||a>86400)&&e["bot.noDuplicate.delay"].push(3)}for(let[a,l]of r.forbiddenWords.entries())for(let c of l.entries)if(e["bot.forbiddenWords.".concat(a,".entries")]=[],l.regexp&&c.trim()!=="")try{new RegExp(c)}catch(u){e["bot.forbiddenWords.".concat(a,".entries")].push(2)}for(let[a,l]of r.quotes.entries())e["bot.quotes.".concat(a,".delay")]=[],typeof l.delay!="number"||isNaN(l.delay)?e["bot.quotes.".concat(a,".delay")].push(2):l.delay<=0&&e["bot.quotes.".concat(a,".delay")].push(3);for(let[a,l]of r.commands.entries())e["bot.commands.".concat(a,".command")]=[],/\s+/.test(l.command)&&e["bot.commands.".concat(a,".command")].push(2)}if(Object.values(e).find(a=>a.length>0))throw new K("ChannelConfigurationOptionsValidationError",await this._registerClientOptions.peertubeHelpers.translate("There was an error during validation."),e);return!0};this.frontToBack=(t,e)=>{var n,o;let r=JSON.parse(JSON.stringify(t));return e||(n=r.bot)==null||n.forbiddenWords.forEach(s=>{s.regexp=!1}),(o=r.bot)==null||o.quotes.forEach(s=>{typeof s.delay=="number"&&(s.delay=Math.round(s.delay*60))}),r};this.backToFront=t=>{var r;let e=JSON.parse(JSON.stringify(t));return(r=e.configuration.bot)==null||r.quotes.forEach(n=>{typeof n.delay=="number"&&(n.delay=Math.round(n.delay/60),n.delay<1&&(n.delay=1))}),e};this.saveOptions=async(t,e,r)=>{if(!await this.validateOptions(e))throw new Error("Invalid form data");let n=await fetch(V(this._registerClientOptions)+"/api/configuration/channel/"+encodeURIComponent(t),{method:"POST",headers:this._headers,body:JSON.stringify(this.frontToBack(e,r))});if(!n.ok){let o;try{o=await n.json()}catch(s){}throw o!=null&&o.validationErrorMessage&&typeof o.validationErrorMessage=="string"?new Error("Failed to save configuration options: "+o.validationErrorMessage):new Error("Failed to save configuration options.")}return n.json()};this.fetchUserChannels=async t=>{let e=await(await fetch("/api/v1/accounts/"+encodeURIComponent(t)+"/video-channels?start=0&count=100&sort=name",{method:"GET",headers:this._headers})).json();if(!e||!("data"in e)||!Array.isArray(e.data))throw new Error("Can't get the channel list.");for(let r of e.data)if(r.livechatConfigurationUri="/p/livechat/configuration/channel?channelId="+encodeURIComponent(r.id),!r.avatar&&r.avatars&&Array.isArray(r.avatars)){for(let n of r.avatars)if(n.width===120){r.avatar=n;break}}return e.data};this.fetchConfiguration=async t=>{let e=await fetch(V(this._registerClientOptions)+"/api/configuration/channel/"+encodeURIComponent(t),{method:"GET",headers:this._headers});if(!e.ok)throw new Error("Can't get channel configuration options.");return this.backToFront(await e.json())};var e;this._registerClientOptions=t,this._headers=(e=this._registerClientOptions.peertubeHelpers.getAuthHeader())!=null?e:{},this._headers["content-type"]="application/json;charset=UTF-8"}async fetchEmojisConfiguration(t){let e=V(this._registerClientOptions)+"/api/configuration/channel/emojis/"+encodeURIComponent(t),r=await fetch(e,{method:"GET",headers:this._headers});if(!r.ok)throw new Error("Can't get channel emojis options.");return r.json()}async validateEmojisConfiguration(t){let e={};if(t.customEmojis.length>200)throw new K("ChannelEmojisValidationError",await this._registerClientOptions.peertubeHelpers.translate("Too many entries"),e);let r=new Map;for(let[n,o]of t.customEmojis.entries())e["emojis.".concat(n,".sn")]=[],o.sn===""?e["emojis.".concat(n,".sn")].push(0):/^:?[\w-]+:?$/.test(o.sn)?r.has(o.sn)?e["emojis.".concat(n,".sn")].push(4):r.set(o.sn,!0):e["emojis.".concat(n,".sn")].push(2),e["emojis.".concat(n,".url")]=[],o.url||e["emojis.".concat(n,".url")].push(0);if(Object.values(e).find(n=>n.length>0))throw new K("ChannelEmojisValidationError",await this._registerClientOptions.peertubeHelpers.translate("There was an error during validation."),e);return!0}async saveEmojisConfiguration(t,e){if(!await this.validateEmojisConfiguration(e))throw new Error("Invalid form data");if(!e.customEmojis.find(a=>a.url.startsWith("data:")))return this._saveEmojisConfiguration(t,e);let r,n=[...e.customEmojis],o=n.findIndex(a=>a.url.startsWith("data:")),s=0;for(;o>=0;){if(s++,s>e.customEmojis.length+10)throw new Error("Seems we have sent too many emojis, this was not expected");let a=n.slice(0,o+1);a.push(...n.slice(o+1).filter(c=>!c.url.startsWith("data:"))),r=await this._saveEmojisConfiguration(t,{customEmojis:a});let l=r.emojis.customEmojis.slice(0,o+1);l.push(...n.slice(o+1)),n=l,o=n.findIndex(c=>c.url.startsWith("data:"))}if(!r)throw new Error("Unexpected: no last result");return r}async _saveEmojisConfiguration(t,e){let r=V(this._registerClientOptions)+"/api/configuration/channel/emojis/"+encodeURIComponent(t),n=await fetch(r,{method:"POST",headers:this._headers,body:JSON.stringify(e)});if(!n.ok)throw new Error("Can't get channel emojis options.");return n.json()}async enableEmojisOnlyModeOnAllRooms(t){let e=V(this._registerClientOptions)+"/api/configuration/channel/emojis/"+encodeURIComponent(t)+"/enable_emoji_only",r=await fetch(e,{method:"POST",headers:this._headers});if(!r.ok)throw new Error("Can't enable Emojis Only Mode on all rooms.");return r.json()}};
1var Re=class extends Event{constructor(t,e,r,n){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=r,this.subscribe=n!=null?n:!1}};var bt=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let r=e||!Object.is(t,this.o);this.o=t,r&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:r}]of this.subscriptions)e(this.o,r)},t!==void 0&&(this.value=t)}addCallback(t,e,r){if(!r)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:n}=this.subscriptions.get(t);t(this.value,n)}clearCallbacks(){this.subscriptions.clear()}};var gi=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},Me=class extends bt{constructor(t,e,r){var n,o;super(e.context!==void 0?e.initialValue:r),this.onContextRequest=s=>{var l;if(s.context!==this.context)return;let a=(l=s.contextTarget)!=null?l:s.composedPath()[0];a!==this.host&&(s.stopPropagation(),this.addCallback(s.callback,a,s.subscribe))},this.onProviderRequest=s=>{var l;if(s.context!==this.context||((l=s.contextTarget)!=null?l:s.composedPath()[0])===this.host)return;let a=new Set;for(let[c,{consumerHost:u}]of this.subscriptions)a.has(c)||(a.add(c),u.dispatchEvent(new Re(this.context,u,c,!0)));s.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),(o=(n=this.host).addController)==null||o.call(n,this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new gi(this.context,this.host))}};function be({context:i}){return(t,e)=>{let r=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(n){return r.get(this).setValue(n),t.set.call(this,n)},init(n){return r.set(this,new Me(this,{context:i,initialValue:n})),n}};{t.constructor.addInitializer(s=>{r.set(s,new Me(s,{context:i}))});let n=Object.getOwnPropertyDescriptor(t,e),o;if(n===void 0){let s=new WeakMap;o={get(){return s.get(this)},set(a){r.get(this).setValue(a),s.set(this,a)},configurable:!0,enumerable:!0}}else{let s=n.set;o=Ee(D({},n),{set(a){r.get(this).setValue(a),s==null||s.call(this,a)}})}return void Object.defineProperty(t,e,o)}}}var kr=Symbol("channel-configuration"),He=Symbol("channel-configuration-service");var O=class extends pe{constructor(){super();this.createRenderRoot=()=>this;this.ptContext=z(),this.ptOptions=this.ptContext.ptOptions,this.ptNotifier=this.ptOptions.peertubeHelpers.notifier,this.ptTranslate=this.ptOptions.peertubeHelpers.translate,this.logger=this.ptContext.logger.createLogger(this.tagName.toLowerCase())}};var xr,Ir,Nr,Dr,Pr,Ur,Ve=class extends O{constructor(){super(...arguments);this._asyncTaskRender=new Y(this,{task:async()=>{let e=window.localStorage.getItem("username");if(!e)throw new Error("Can't get the current username.");this._channelDetailsService=new ge(this.ptOptions),this._channels=await this._channelDetailsService.fetchUserChannels(e)},args:()=>[]});this.render=()=>this._asyncTaskRender.render({pending:()=>f(xr||(xr=p(["<livechat-spinner></livechat-spinner>"]))),error:()=>f(Ir||(Ir=p(["<livechat-error></livechat-error>"]))),complete:()=>{var e;return f(Ur||(Ur=p(['\n      <div class="margin-content peertube-plugin-livechat-configuration peertube-plugin-livechat-configuration-home">\n        <h1>\n          ',"\n            <livechat-help-button .page=",">\n            </livechat-help-button>\n        </h1>\n        <p>","</p>\n        <p>",'</p>\n        <ul class="peertube-plugin-livechat-configuration-home-channels">\n        ',"\n        </ul>\n      </div>\n      "])),d("Configure your live's chatrooms"),"documentation/user/streamers/channel",d("Here you can configure some advanced options for chatrooms associated to your live streams."),d("Please select bellow one of your channel, to setup its chatting options."),(e=this._channels)==null?void 0:e.map(r=>f(Pr||(Pr=p(['\n          <li>\n            <a href="','" aria-hidden="true">\n              ','\n            </a>\n            <div class="peertube-plugin-livechat-configuration-home-info">\n              <a href="','">\n                <div>',"</div>\n                <div>","</div>\n              </a>\n            </div>\n          </li>\n        "])),r.livechatConfigurationUri,r.avatar?f(Nr||(Nr=p(['<img class="avatar channel" src="','">'])),r.avatar.path):f(Dr||(Dr=p(['<div class="avatar channel initial gray"></div>']))),r.livechatConfigurationUri,r.displayName,r.name)))}})}};g([k()],Ve.prototype,"_channels",2),g([be({context:He})],Ve.prototype,"_channelDetailsService",2),Ve=g([T("livechat-channel-home")],Ve);var L=Q(class extends oe{constructor(i){var t;if(super(i),i.type!==ee.ATTRIBUTE||i.name!=="class"||((t=i.strings)==null?void 0:t.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(i){return" "+Object.keys(i).filter(t=>i[t]).join(" ")+" "}update(i,[t]){var r,n;
1if(this.st===void 0){this.st=new Set,i.strings!==void 0&&(this.nt=new Set(i.strings.join(" ").split(/\s/).filter(o=>o!=="")));for(let o in t)t[o]&&!((r=this.nt)!=null&&r.has(o))&&this.st.add(o);return this.render(t)}let e=i.element.classList;for(let o of this.st)o in t||(e.remove(o),this.st.delete(o));for(let o in t){let s=!!t[o];s===this.st.has(o)||(n=this.nt)!=null&&n.has(o)||(s?(e.add(o),this.st.add(o)):(e.remove(o),this.st.delete(o)))}return Z}});var Mr,Hr,Vr,Br;function Fr(i){var r,n,o,s,a,l,c,u,h,m,b,y,A,w,x,M,H,I,C,$,N,U,de,re,ye,Fe,je,Bi,Fi,ji,qi,Gi,Wi,zi;let t={forbiddenWords:Ee(D({enabled:{colName:d("Enabled")},entries:{colName:d("Forbidden words or expressions")}},i.enableUsersRegexp?{regexp:{colName:d("Consider as regular expressions"),description:d("By checking this option, you can use regular expressions.")}}:{}),{applyToModerators:{colName:d("Also moderate messages from moderators"),description:d("By default, moderator messages will not be affected by this feature. By checking this option, messages from moderators will also be deleted.")},label:{colName:d("Label"),description:d("Label for this forbidden words rule")},reason:{colName:d("Reason"),description:d("Reason to display besides deleted messages")},comments:{colName:d("Comments"),description:d("You can add here some comments about this rule, to remember how and why you created it. These 
1comments are purely indicative, and have no influence on the bot's behavior.")}}),quotes:{messages:{colName:d("Messages"),description:d("One message per line. If multiple messages, it will pick one randomly every X minutes.")},delay:{colName:d("Send every X minutes"),description:d("The bot will post the message every X minutes.")}},commands:{command:{colName:d("Command"),description:d('The command, without the starting "!". For example "help", "sponsor", ...')},message:{colName:d("Message"),description:d("The message to send.")}}},e={forbiddenWords:Ee(D({enabled:{inputType:"checkbox",default:!0},entries:{inputType:"tags",default:[],separator:"\n"}},i.enableUsersRegexp?{regexp:{inputType:"checkbox",default:!1}}:{}),{applyToModerators:{inputType:"checkbox",default:!1},label:{inputType:"text",default:""},reason:{inputType:"text",default:""},comments:{inputType:"textarea",default:""}}),quotes:{messages:{inputType:"textarea",default:[],separator:"\n"},delay:{inputType:"number",default:10,min:1}},commands:{command:{inputType:"text",default:""},message:{inputType:"text",default:""}}};return f(Br||(Br=p(['\n    <div class="margin-content peertube-plugin-livechat-configuration\n                peertube-plugin-livechat-configuration-channel">\n      <h1>\n        <span class="peertube-plugin-livechat-configuration-channel-info">\n          <span>',"</span>\n          <span>","</span>\n        </span>\n      </h1>\n\n      <livechat-channel-tabs .active="," .channelId=","></livechat-channel-tabs>\n\n      <p>\n        ","\n        <livechat-help-button .page=",'>\n        </livechat-help-button>\n      </p>\n\n      <form livechat-configuration-channel-options role="form" @submit='," @change=",">\n\n        <livechat-configuration-section-header\n          .label=","\n          .description=","\n          .helpPage=",'>\n        </livechat-configuration-section-header>\n        <div class="form-group">\n          <textarea\n            .title=','\n            name="terms"\n            id="peertube-livechat-terms"\n            .value=',"\n            maxlength=","\n            class=","\n            @change=","\n          ></textarea>\n          ","\n        </div>\n\n        <livechat-configuration-section-header\n          .label=","\n          .description=","\n          .helpPage=",'>\n        </livechat-configuration-section-header>\n        <div class="form-group">\n          <label>\n            <input\n              type="checkbox"\n              name="mute_anonymous"\n              id="peertube-livechat-mute-anonymous"\n              @input=','\n              value="1"\n              ?checked=',"\n            />\n            ","\n          </label>\n        </div>\n\n        <livechat-configuration-section-header\n          .label=","\n          .description=","\n          .helpPage=",'>\n        </livechat-configuration-section-header>\n        <div class="form-group">\n          <label>\n            ','\n            <input\n              type="number"\n              name="slowmode_duration"\n              class=','\n              min="0"\n              max="1000"\n              id="peertube-livechat-slowmode-duration"\n              aria-describedby="peertube-livechat-slowmode-duration-feedback"\n              @input=','\n              value="','"\n            />\n          </label>\n          ',"\n        </div>\n\n        <livechat-configuration-section-header\n          .label=","\n          .description=","\n          .helpPage=",'>\n        </livechat-configuration-section-header>\n        <div class="form-group">\n          <label>\n            ','\n            <input\n              type="number"\n              name="moderation_delay"\n              class=','\n              min="0"\n              max="60"\n              id="peertube-livechat-moderation-delay"\n              aria-describedby="peertube-livechat-moderation-delay-feedback"\n              @input=','\n              value="','"\n            />\n          </label>\n          ',"\n        </div>\n\n        <livechat-configuration-section-header\n          .label=","\n          .description=","\n          .helpPage=",'>\n        </livechat-configuration-section-header>\n        <div class="form-group">\n          <label>\n            <input\n              type="checkbox"\n              name="anonymize-moderation"\n              id="peertube-livechat-anonymize-moderation"\n              @input
1=','\n              value="1"\n              ?checked=',"\n            />\n            ","\n          </label>\n        </div>\n\n        <livechat-configuration-section-header\n          .label=","\n          .description=","\n          .helpPage=",'>\n        </livechat-configuration-section-header>\n        <div class="form-group">\n          <label>\n            <input\n              type="checkbox"\n              name="bot"\n              id="peertube-livechat-bot"\n              @input=','\n              value="1"\n              ?checked=',"\n            />\n            ","\n          </label>\n        </div>\n\n        ",'\n\n        <div class="form-group mt-5">\n          <button type="reset" @click='," ?disabled=",">\n            ",'\n          </button>\n          <button type="submit" ?disabled=',">\n            ","\n          </button>\n        </div>\n      </form>\n    </div>"])),(r=i.channelConfiguration)==null?void 0:r.channel.displayName,(n=i.channelConfiguration)==null?void 0:n.channel.name,"configuration",i.channelId,d("You can setup here some options for this channel (moderation policies, ...)."),"documentation/user/streamers/channel",i.saveConfig,i.resetValidation,d("Channel's chat terms & conditions"),d('You can configure a "terms & conditions" message that will be shown to users joining your chatrooms.',!0),"documentation/user/streamers/terms",d("Channel's chat terms & conditions"),(s=(o=i.channelConfiguration)==null?void 0:o.configuration.terms)!=null?s:"",i.termsMaxLength(),L(Object.assign({"form-control":!0},i.getInputValidationClass("terms"))),v=>{if(v!=null&&v.target&&i.channelConfiguration){let Zt=v.target.value;Zt===""&&(Zt=void 0),i.channelConfiguration.configuration.terms=Zt}i.requestUpdate("channelConfiguration")},i.renderFeedback("peertube-livechat-terms-feedback","terms"),d("Mute anonymous users"),d("Default value for new chatrooms. For existing chatrooms, you can change the feature in the room configuration form. When this feature is enabled, anonymous users can only read the chat, and not send messages.",!0),"documentation/user/streamers/moderation",v=>{v!=null&&v.target&&i.channelConfiguration&&(i.channelConfiguration.configuration.mute.anonymous=v.target.checked),i.requestUpdate("channelConfiguration")},(a=i.channelConfiguration)==null?void 0:a.configuration.mute.anonymous,d("Mute anonymous users"),d("Slow mode"),d("Slow mode default value: <ul> <li>0: slow mode disabled</li> <li>Any positive integer: users can send a message every X seconds (moderators are not limited)</li> </ul>",!0),"documentation/user/streamers/slow_mode",d("Slow mode"),L(Object.assign({"form-control":!0},i.getInputValidationClass("slowMode.duration"))),v=>{v!=null&&v.target&&i.channelConfiguration&&(i.channelConfiguration.configuration.slowMode.duration=Number(v.target.value)),i.requestUpdate("channelConfiguration")},(c=(l=i.channelConfiguration)==null?void 0:l.configuration.slowMode.duration)!=null?c:"",i.renderFeedback("peertube-livechat-slowmode-duration-feedback","slowMode.duration"),d("Moderation delay"),d("Moderation delay default value: <ul> <li>0: moderation delay disabled</li> <li>Any positive integer: messages will be delayed for X seconds for non-moderator participants, allowing moderators to delete message before any user can read it.</li> </ul>",!0),"documentation/user/streamers/moderation_delay",d("Moderation delay"),L(Object.assign({"form-control":!0},i.getInputValidationClass("moderation.delay"))),v=>{v!=null&&v.target&&i.channelConfiguration&&(i.channelConfiguration.configuration.moderation.delay=Number(v.target.value)),i.requestUpdate("channelConfiguration")},(h=(u=i.channelConfiguration)==null?void 0:u.configuration.moderation.delay)!=null?h:"",i.renderFeedback("peertube-livechat-moderation-delay-feedback","moderation.delay"),d("Anonymize moderation actions"),d("Anonymize moderation actions default value for new rooms. When this is enabled, moderation actions will be anonymized, to avoid disclosing who is banning/kicking/\u2026 occupants.",!0),"documentation/user/streamers/moderation",v=>{v!=null&&v.target&&i.channelConfiguration&&(i.channelConfiguration.configuration.moderation.anonymize=v.target.checked),i.requestUpdate("channelConfiguration")},(m=i.channelConfiguration)==null?void 0:m.configuration.moderation.anonymize,d("Anonymize moderation actions"),d("Moderation bot options"),"","documentation/user/streamers/channel",v=>{v!=null&&v.target&&i.channelConfiguration&&(i.channelConfiguration.configuration.bot.enabled=v.target.checked),i.requestUpdate("channelConfiguration")},(b=i.channelConfiguration)==null?void 0:b.configuration.bot.enabled,d("Enable moderation bot"),(y=i.channelConfiguration)!=null&&y.configuration.bot.enabled?f(Vr||(Vr=p(['<div class="form-group">\n            <label for="peertube-livechat-bot-nickname">\n              ','\n            </label>\n            <input\n              type="text"\n              name="bot_nickname"\n              class=','\n              id="peertube-livechat-bot-nickname"\n              aria-describedby="peertube-livechat-bot-nickname-feedback"\n              @input
1=','\n              value="','"\n            />\n            ',"\n          </div>\n\n          <livechat-configuration-section-header\n            .label=","\n            .description=","\n            .helpPage=",'>\n          </livechat-configuration-section-header>\n          <div class="form-group">\n            <label>\n              <input\n                type="checkbox"\n                name="forbid_special_chars"\n                id="peertube-livechat-forbid-special-chars"\n                @input=','\n                value="1"\n                ?checked=',"\n              />\n              ","\n            </label>\n          </div>\n          ","\n\n          <livechat-configuration-section-header\n            .label=","\n            .description=","\n            .helpPage=",'>\n          </livechat-configuration-section-header>\n          <div class="form-group">\n            <label>\n              <input\n                type="checkbox"\n                name="no_duplicate"\n                id="peertube-livechat-no-duplicate"\n                @input=','\n                value="1"\n                ?checked=',"\n              />\n              ","\n            </label>\n          </div>\n          ","\n\n          <livechat-configuration-section-header\n            .label=","\n            .description=","\n            .helpPage=",">\n          </livechat-configuration-section-header>\n          <livechat-dynamic-table-form\n            .header=","\n            .schema=","\n            .validation=","\n            .validationPrefix=","\n            .rows=","\n            @update=","\n            .formName=","\n          ></livechat-dynamic-table-form>\n\n          <livechat-configuration-section-header\n            .label=","\n            .description=","\n            .helpPage=",">\n          </livechat-configuration-section-header>\n          <livechat-dynamic-table-form\n            .header=","\n            .schema=","\n            .validation=","\n            .validationPrefix=","\n            .rows=","\n            @update=","\n            .formName=","\n          ></livechat-dynamic-table-form>\n\n          <livechat-configuration-section-header\n            .label=","\n            .description=","\n            .helpPage=",">\n          </livechat-configuration-section-header>\n          <livechat-dynamic-table-form\n            .header=","\n            .schema=","\n            .validation=","\n            .validationPrefix=","\n            .rows=","\n            @update=","\n            .formName=","\n          ></livechat-dynamic-table-form>\n        "])),d("Bot nickname"),L(Object.assign({"form-control":!0},i.getInputValidationClass("bot.nickname"))),v=>{v!=null&&v.target&&i.channelConfiguration&&(i.channelConfiguration.configuration.bot.nickname=v.target.value),i.requestUpdate("channelConfiguration")},(w=(A=i.channelConfiguration)==null?void 0:A.configuration.bot.nickname)!=null?w:"",i.renderFeedback("peertube-livechat-bot-nickname-feedback","bot.nickname"),d("Forbid special characters"),d("By enabling this option, the moderation bot will automatically delete messages containing more than X special characters. Special characters are those that don't fit into one of these categories: letters, numbers, punctuation symbols, currency symbols, emojis."),"documentation/user/streamers/bot/special_chars",v=>{v!=null&&v.target&&i.channelConfiguration&&(i.channelConfiguration.configuration.bot.forbidSpecialChars.enabled=v.target.checked),i.requestUpdate("channelConfiguration")},(x=i.channelConfiguration)==null?void 0:x.configuration.bot.forbidSpecialChars.enabled,d("Forbid special characters"),(M=i.channelConfiguration)!=null&&M.configuration.bot.forbidSpecialChars.enabled?f(Mr||(Mr=p(['\n              <div class="form-group">\n                <label>\n                  ','\n                  <input\n                    type="number"\n                    name="special_chars_tolerance"\n                    class=','\n                    min="0"\n                    max="','"\n                    id="peertube-livechat-forbid-special-chars-tolerance"\n                    aria-describedby="peertube-livechat-forbid-special-chars-tolerance-feedback"\n                    @input
1=','\n                    value="','"\n                  />\n                </label>\n                <small class="form-text text-muted">\n                  ',"\n                </small>\n                ",'\n              </div>\n              <div class="form-group">\n                <label>\n                  ','\n                  <input\n                    type="text"\n                    name="special_chars_reason"\n                    class=','\n                    id="peertube-livechat-forbid-special-chars-reason"\n                    aria-describedby="peertube-livechat-forbid-special-chars-reason-feedback"\n                    @input=','\n                    value="','"\n                  />\n                </label>\n                <small class="form-text text-muted">\n                  ',"\n                </small>\n                ",'\n              </div>\n              <div class="form-group">\n                <label>\n                  <input\n                    type="checkbox"\n                    name="forbid_special_chars_applyToModerators"\n                    id="peertube-livechat-forbid-special-chars-applyToModerators"\n                    @input=','\n                    value="1"\n                    ?checked=',"\n                  />\n                  ",'\n                </label>\n                <small class="form-text text-muted">\n                  ',"\n                </small>\n              </div>\n              "])),d("Tolerance"),L(Object.assign({"form-control":!0},i.getInputValidationClass("bot.forbidSpecialChars.tolerance"))),10,v=>{v!=null&&v.target&&i.channelConfiguration&&(i.channelConfiguration.configuration.bot.forbidSpecialChars.tolerance=Number(v.target.value)),i.requestUpdate("channelConfiguration")},(I=(H=i.channelConfiguration)==null?void 0:H.configuration.bot.forbidSpecialChars.tolerance)!=null?I:"0",d("Number of special characters to accept in a message without deleting it."),i.renderFeedback("peertube-livechat-forbid-special-chars-tolerance-feedback","bot.forbidSpecialChars.tolerance"),d("Reason"),L(Object.assign({"form-control":!0},i.getInputValidationClass("bot.forbidSpecialChars.reason"))),v=>{v!=null&&v.target&&i.channelConfiguration&&(i.channelConfiguration.configuration.bot.forbidSpecialChars.reason=v.target.value),i.requestUpdate("channelConfiguration")},($=(C=i.channelConfiguration)==null?void 0:C.configuration.bot.forbidSpecialChars.reason)!=null?$:"",d("Reason to display besides deleted messages"),i.renderFeedback("peertube-livechat-forbid-special-chars-reason-feedback","bot.forbidSpecialChars.reason"),v=>{v!=null&&v.target&&i.channelConfiguration&&(i.channelConfiguration.configuration.bot.forbidSpecialChars.applyToModerators=v.target.checked),i.requestUpdate("channelConfiguration")},(N=i.channelConfiguration)==null?void 0:N.configuration.bot.forbidSpecialChars.applyToModerators,d("Also moderate messages from moderators"),d("By default, moderator messages will not be affected by this feature. By checking this option, messages from moderators will also be deleted.")):"",d("No duplicate message"),d("By enabling this options, the moderation bot will automatically moderate duplicate messages. That means if a user send the same message twice within X seconds, the second message will be deleted."),"documentation/user/streamers/bot/no_duplicate",v=>{v!=null&&v.target&&i.channelConfiguration&&(i.channelConfiguration.configuration.bot.noDuplicate.enabled=v.target.checked),i.requestUpdate("channelConfiguration")},(U=i.channelConfiguration)==null?void 0:U.configuration.bot.noDuplicate.enabled,d("No duplicate message"),(de=i.channelConfiguration)!=null&&de.configuration.bot.noDuplicate.enabled?f(Hr||(Hr=p(['\n              <div class="form-group">\n                <label>\n                  ','\n                  <input\n                    type="number"\n                    name="no_duplicate_delay"\n                    class=','\n                    min="0"\n                    max="','"\n                    id="peertube-livechat-no-duplicate-delay"\n                    aria-describedby="peertube-livechat-no-duplicate-delay-feedback"\n                    @input
1=','\n                    value="','"\n                  />\n                </label>\n                <small class="form-text text-muted">\n                  ',"\n                </small>\n                ",'\n              </div>\n              <div class="form-group">\n                <label>\n                  ','\n                  <input\n                    type="text"\n                    name="no_duplicate_reason"\n                    class=','\n                    id="peertube-livechat-no-duplicate-reason"\n                    aria-describedby="peertube-livechat-no-duplicate-reason-feedback"\n                    @input=','\n                    value="','"\n                  />\n                </label>\n                <small class="form-text text-muted">\n                  ',"\n                </small>\n                ",'\n              </div>\n              <div class="form-group">\n                <label>\n                  <input\n                    type="checkbox"\n                    name="no_duplicate_applyToModerators"\n                    id="peertube-livechat-no-duplicate-applyToModerators"\n                    @input=','\n                    value="1"\n                    ?checked=',"\n                  />\n                  ",'\n                </label>\n                <small class="form-text text-muted">\n                  ',"\n                </small>\n              </div>\n              "])),d("Time interval"),L(Object.assign({"form-control":!0},i.getInputValidationClass("bot.noDuplicate.delay"))),86400 .toString(),v=>{v!=null&&v.target&&i.channelConfiguration&&(i.channelConfiguration.configuration.bot.noDuplicate.delay=Number(v.target.value)),i.requestUpdate("channelConfiguration")},(ye=(re=i.channelConfiguration)==null?void 0:re.configuration.bot.noDuplicate.delay)!=null?ye:"0",d("The interval, in seconds, during which a user can't send again the same message."),i.renderFeedback("peertube-livechat-no-duplicate-delay-feedback","bot.noDuplicate.delay"),d("Reason"),L(Object.assign({"form-control":!0},i.getInputValidationClass("bot.noDuplicate.reason"))),v=>{v!=null&&v.target&&i.channelConfiguration&&(i.channelConfiguration.configuration.bot.noDuplicate.reason=v.target.value),i.requestUpdate("channelConfiguration")},(je=(Fe=i.channelConfiguration)==null?void 0:Fe.configuration.bot.noDuplicate.reason)!=null?je:"",d("Reason to display besides deleted messages"),i.renderFeedback("peertube-livechat-no-duplicate-reason-feedback","bot.noDuplicate.reason"),v=>{v!=null&&v.target&&i.channelConfiguration&&(i.channelConfiguration.configuration.bot.noDuplicate.applyToModerators=v.target.checked),i.requestUpdate("channelConfiguration")},(Bi=i.channelConfiguration)==null?void 0:Bi.configuration.bot.noDuplicate.applyToModerators,d("Also moderate messages from moderators"),d("By default, moderator messages will not be affected by this feature. By checking this option, messages from moderators will also be deleted.")):"",d("Forbidden words or expressions"),d("You can configure some words that will be automatically moderated by the bot (messages containing such words will be instantly deleted). You can also add an optional reason that will be displayed at the place of deleted messages. Several examples are provided on the documentation page."),"documentation/user/streamers/bot/forbidden_words",t.forbiddenWords,e.forbiddenWords,(Fi=i.validationError)==null?void 0:Fi.properties,"bot.forbiddenWords",(ji=i.channelConfiguration)==null?void 0:ji.configuration.bot.forbiddenWords,v=>{i.resetValidation(v),i.channelConfiguration&&(i.channelConfiguration.configuration.bot.forbiddenWords=v.detail,i.requestUpdate("channelConfiguration"))},"forbidden-words",d("Timer"),d("You can configure several timers that will send messages at regular interval. These messages will be sent by the bot every X minutes. You can for example make the bot sent some sponsoring information every 5 minutes."),"documentation/user/streamers/bot/quotes",t.quotes,e.quotes,(qi=i.validationError)==null?void 0:qi.properties,"bot.quotes",(Gi=i.channelConfiguration)==null?void 0:Gi.configuration.bot.quotes,v=>{i.resetValidation(v),i.channelConfiguration&&(i.channelConfiguration.configuration.bot.quotes=v.detail,i.requestUpdate("channelConfiguration"))},"quote",d("Bot command"),d('You can configure the bot to respond to commands. A command is a message starting with a "!", like for example "!help" that calls the "help" command.'),"documentation/user/streamers/bot/commands",t.commands,e.commands,(Wi=i.validationError)==null?void 0:Wi.properties,"bot.commands",(zi=i.channelConfiguration)==null?void 0:zi.configuration.bot.commands,v=>{i.resetValidation(v),i.channelConfiguration&&(i.channelConfiguration.configuration.bot.commands=v.detail,i.requestUpdate("channelConfiguration"))},"command"):"",i.reset,i.actionDisabled,d("Cancel"),i.actionDisabled,d("Save"))}var jr,qr,Gr,Wr,zr,Yr,Kr,Jr,se=class extends O{constructor(){super();this.actionDisabled=!1;this.saveConfig=async e=>{var r;e==null||e.preventDefault(),this._channelDetailsService&&this.channelConfiguration&&(this.actionDisabled=!0,this._channelDetailsService.saveOptions(this.channelConfiguration.channel.i
1d,this.channelConfiguration.configuration,(r=this.enableUsersRegexp)!=null?r:!1).then(()=>{this.validationError=void 0,this.ptTranslate("Successfully saved").then(n=>{this.ptNotifier.info(n)},()=>{}),this.requestUpdate("_validationError")}).catch(async n=>{this.validationError=void 0,n instanceof K&&(this.validationError=n),this.logger.warn("A validation error occurred in saving configuration. ".concat(n.name,": ").concat(n.message)),this.ptNotifier.error(n.message?n.message:await this.ptTranslate("Error")),this.requestUpdate("_validationError")}).finally(()=>{this.actionDisabled=!1}))};this.getInputValidationClass=e=>{var n;let r=(n=this.validationError)==null?void 0:n.properties[e];return r?r.length?{"is-invalid":!0}:{"is-valid":!0}:{}};this.renderFeedback=(e,r)=>{var s,a;let n=[],o=(a=(s=this.validationError)==null?void 0:s.properties[r])!=null?a:void 0;return o&&o.length!==0?(o.includes(0)&&n.push(f(jr||(jr=p(["",""])),d("This value is required."))),o.includes(1)&&n.push(f(qr||(qr=p(["",""])),d("Value is of the wrong type."))),o.includes(2)&&n.push(f(Gr||(Gr=p(["",""])),d("Value is in the wrong format."))),o.includes(3)&&n.push(f(Wr||(Wr=p(["",""])),d("Value is not in authorized range."))),o.includes(5)&&n.push(f(zr||(zr=p(["",""])),d("Value too long"))),f(Yr||(Yr=p(["<div id=",' class="invalid-feedback">',"</div>"])),e,n)):E};this.render=()=>this._asyncTaskRender.render({pending:()=>f(Kr||(Kr=p(["<livechat-spinner></livechat-spinner>"]))),error:()=>f(Jr||(Jr=p(["<livechat-error></livechat-error>"]))),complete:()=>Fr(this)});this._asyncTaskRender=this._initTask()}_initTask(){return new Y(this,{task:async()=>{var e;this._channelDetailsService=new ge(this.ptOptions),this.channelConfiguration=await this._channelDetailsService.fetchConfiguration((e=this.channelId)!=null?e:0),this.enableUsersRegexp=!!(await this.ptOptions.peertubeHelpers.getSettings())["enable-users-regexp"],this.actionDisabled=!1},args:()=>[]})}termsMaxLength(){return 400}async reset(e){e==null||e.preventDefault(),this.actionDisabled=!0,this._asyncTaskRender=this._initTask(),this.requestUpdate()}resetValidation(e){this.validationError&&(this.validationError=void 0,this.requestUpdate("_validationError"))}};g([_({attribute:!1})],se.prototype,"channelId",2),g([be({context:kr}),k()],se.prototype,"channelConfiguration",2),g([_({attribute:!1})],se.prototype,"enableUsersRegexp",2),g([be({context:He})],se.prototype,"_channelDetailsService",2),g([k()],se.prototype,"validationError",2),g([k()],se.prototype,"actionDisabled",2),se=g([T("livechat-channel-configuration")],se);var Xr,Zr,Qr;function en(i){var r,n,o,s,a,l,c,u,h,m,b,y;let t={sn:{colName:d("Short name"),description:d('You can use emojis in the chat using ":shortname:". The short name can start and/or end by a colon (:), and only contain alphanumerical characters, underscores and hyphens. It is strongly recommended to start them by a colon, so that users can use autocompletion (by typing ":" then press TAB).'),headerClassList:["peertube-livechat-emojis-col-sn"]},url:{colName:d("File"),description:d("The emoji file."),headerClassList:["peertube-livechat-emojis-col-file"]}},e={sn:{inputType:"text",default:""},url:{inputType:"image-file",default:"",colClassList:["peertube-livechat-emojis-col-file"]}};return f(Qr||(Qr=p(['\n    <div\n      class="margin-content peertube-plugin-livechat-configuration peertube-plugin-livechat-configuration-channel"\n    >\n      <h1>\n        <span class="peertube-plugin-livechat-configuration-channel-info">\n          <span>',"</span>\n          <span>","</span>\n        </span>\n      </h1>\n\n      <livechat-channel-tabs .active="," .channelId=","></livechat-channel-tabs>\n\n      <h2>","</h2>\n\n      <p>\n        ","\n        <livechat-help-button .page=",'>\n        </livechat-help-button>\n      </p>\n\n      <form role="form" @submit='," @change=",'>\n        <div class="peertube-plugin-livechat-configuration-actions">\n          ',"\n          ","\n        </div>\n\n        <livechat-dynamic-table-form\n          .header=","\n          .schema=","\n          .maxLines=","\n          .validation=","\n          .validationPrefix=","\n          .rows=","\n          @update=",'\n        ></livechat-dynamic-table-form>\n\n        <div class="form-group mt-5">\n          <button type="reset" @click='," ?disabled=",">\n            ",'\n          </button>\n          <button type="submit" ?disabled=',">\n            ","\n          </button>\n        </div>\n      </form>\n\n      <h2>","</h2>\n\n      <p>\n        ","\n      </p>\n      <p>\n        ","\n      </p>\n      <p>\n        ",'\n      </p>\n\n      <div class="peertube-plugin-livechat-configuration-actions">\n        <button type="button" @click=',">\n          ","\n        </button>\n      </div>\n    </div>"])),(r=i.channelEmojisConfiguration)==null?void 0:r.channel.displayName,(n=i.channelEmojisConfiguration)==null?void 0:n.channel.name,"emojis",i.channelId,d("Channel emojis"),d('You can configure custom emojis for your channel. These emojis will be available in the emoji picker. Users can also use them by with their short name (for example by writing ":shortn
1ame:").'),"documentation/user/streamers/emojis",i.saveEmojis,i.resetValidation,(a=(s=(o=i.channelEmojisConfiguration)==null?void 0:o.emojis)==null?void 0:s.customEmojis)!=null&&a.length?f(Xr||(Xr=p(['\n              <button\n                type="button"\n                @click=',"\n                ?disabled=","\n              >\n                ","\n              </button>"])),i.exportEmojis,i.actionDisabled,d("Export")):"",((h=(u=(c=(l=i.channelEmojisConfiguration)==null?void 0:l.emojis)==null?void 0:c.customEmojis)==null?void 0:u.length)!=null?h:0)<200?f(Zr||(Zr=p(['\n              <button\n                type="button"\n                @click=',"\n                ?disabled=","\n              >\n                ","\n              </button>"])),i.importEmojis,i.actionDisabled,d("Import")):"",t,e,200,(m=i.validationError)==null?void 0:m.properties,"emojis",(y=(b=i.channelEmojisConfiguration)==null?void 0:b.emojis.customEmojis)!=null?y:[],A=>{i.resetValidation(A),i.channelEmojisConfiguration&&(i.channelEmojisConfiguration.emojis.customEmojis=A.detail,i.requestUpdate("channelEmojisConfiguration"))},i.reset,i.actionDisabled,d("Cancel"),i.actionDisabled,d("Save"),d("Emojis only mode"),d('You can enable an "Emojy only mode" in your chatrooms. When this mode is enabled, participants can only send emojis (standard, or channel custom emojis). Moderators are not affected by this limitation.',!0),d("This mode can be usefull for example: <ul> <li>To avoid spam or offensive message when you are not here to moderate.</li> <li>When there are too many speaking participants, and you can't no more moderate correctly.</li> </ul>",!0),d("To enable or disable this mode, you can use the room configuration form. If you want to enable it for all your chatrooms at once, you can use the button bellow.",!0),i.enableEmojisOnlyModeOnAllRooms,d("Enable the emoji only mode on all channel's chatrooms"))}var tn,rn,ve=class extends O{constructor(){super();this.actionDisabled=!1;this.render=()=>this._asyncTaskRender.render({pending:()=>f(tn||(tn=p(["<livechat-spinner></livechat-spinner>"]))),error:()=>f(rn||(rn=p(["<livechat-error></livechat-error>"]))),complete:()=>en(this)});this._asyncTaskRender=this._initTask()}_initTask(){return new Y(this,{task:async()=>{if(!this.channelId)throw new Error("Missing channelId");this._channelDetailsService=new ge(this.ptOptions),this.channelEmojisConfiguration=await this._channelDetailsService.fetchEmojisConfiguration(this.channelId),this.channelEmojisConfiguration.emojis.customEmojis.length||this.channelEmojisConfiguration.emojis.customEmojis.push({sn:"",url:""}),this.actionDisabled=!1},args:()=>[]})}async reset(e){e==null||e.preventDefault(),this.actionDisabled=!0,this._asyncTaskRender=this._initTask(),this.requestUpdate()}resetValidation(e){this.validationError&&(this.validationError=void 0,this.requestUpdate("_validationError"))}async saveEmojis(e){if(e==null||e.preventDefault(),!this._channelDetailsService||!this.channelEmojisConfiguration||!this.channelId){this.ptNotifier.error(await this.ptTranslate("Error"));return}try{this.actionDisabled=!0,this.channelEmojisConfiguration=await this._channelDetailsService.saveEmojisConfiguration(this.channelId,this.channelEmojisConfiguration.emojis),this.validationError=void 0,this.ptNotifier.info(await this.ptTranslate("Successfully saved")),this.requestUpdate("channelEmojisConfiguration"),this.requestUpdate("_validationError")}catch(r){this.validationError=void 0;let n;r instanceof K&&(this.validationError=r,r.message&&(n=r.message)),n!=null||(n=await this.ptTranslate("Error")),this.ptNotifier.error(n),this.requestUpdate("_validationError")}finally{this.actionDisabled=!1}}async importEmojis(e){var r,n,o;e.preventDefault();try{let s=await new Promise((u,h)=>{let m=document.createElement("input");m.setAttribute("type","file"),m.setAttribute("accept","application/json"),m.onchange=b=>{var A;b.preventDefault(),b.stopImmediatePropagation();let y=(A=b.target.files)==null?void 0:A[0];if(!y){h(new Error("Missing file"));return}u(y)},m.click(),m.remove()});this.actionDisabled=!0;let a=await new Promise((u,h)=>{let m=new FileReader;m.onerror=h,m.onload=()=>
1{if(m.result===null){h(new Error("Empty result"));return}m.result instanceof ArrayBuffer?h(new Error("Result is an ArrayBuffer, this was not intended")):u(m.result)},m.readAsText(s)}),l=JSON.parse(a);if(!Array.isArray(l))throw new Error("Invalid data, an array was expected");let c=(r=this.channelEmojisConfiguration)==null?void 0:r.emojis.customEmojis.slice(-1)[0];c&&c.sn===""&&c.url===""&&((n=this.channelEmojisConfiguration)==null||n.emojis.customEmojis.pop());for(let u of l){if(typeof u!="object")throw new Error("Invalid data");if(!u.sn||!u.url||typeof u.sn!="string"||typeof u.url!="string")throw new Error("Invalid data");let h=await this._convertImageToDataUrl(u.url),b={sn:u.sn,url:h};u.isCategoryEmoji===!0&&(b.isCategoryEmoji=!0),(o=this.channelEmojisConfiguration)==null||o.emojis.customEmojis.push(b)}this.requestUpdate("channelEmojisConfiguration"),this.ptNotifier.info(await this.ptTranslate("If imported data are okay, don't forgot to save the form."))}catch(s){this.ptNotifier.error(s.toString(),await this.ptTranslate("Error"))}finally{this.actionDisabled=!1}}async exportEmojis(e){var r,n,o;e.preventDefault(),this.actionDisabled=!0;try{let s=[];for(let c of(o=(n=(r=this.channelEmojisConfiguration)==null?void 0:r.emojis)==null?void 0:n.customEmojis)!=null?o:[]){if(!c.sn||!c.url)continue;let u=await this._convertImageToDataUrl(c.url),h={sn:c.sn,url:u};c.isCategoryEmoji===!0&&(h.isCategoryEmoji=c.isCategoryEmoji),s.push(h)}let a="data:application/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(s)),l=document.createElement("a");l.setAttribute("href",a),l.setAttribute("download","emojis.json"),l.click(),l.remove()}catch(s){this.logger.error(s),this.ptNotifier.error(s.toString())}finally{this.actionDisabled=!1}}async enableEmojisOnlyModeOnAllRooms(e){if(e.preventDefault(),!this._channelDetailsService||!this.channelId){this.ptNotifier.error(await this.ptTranslate("Error"));return}try{await this._channelDetailsService.enableEmojisOnlyModeOnAllRooms(this.channelId),this.ptNotifier.info(await this.ptTranslate("Successfully saved"))}catch(r){console.error(r),this.ptNotifier.error(await this.ptTranslate("Error"))}}async _convertImageToDataUrl(e){if(e.startsWith("data:"))return e;let r=await(await fetch(e)).blob();return await new Promise((o,s)=>{let a=new FileReader;a.onload=()=>{if(a.result===null){s(new Error("Empty result"));return}a.result instanceof ArrayBuffer?s(new Error("Result is an ArrayBuffer, this was not intended")):o(a.result)},a.onerror=s,a.readAsDataURL(r)})}};g([_({attribute:!1})],ve.prototype,"channelId",2),g([be({context:He})],ve.prototype,"_channelDetailsService",2),g([k()],ve.prototype,"validationError",2),g([k()],ve.prototype,"actionDisabled",2),ve=g([T("livechat-channel-emojis")],ve);var nn,Be=class extends O{constructor(){super(...arguments);this.render=()=>{var e,r;return f(nn||(nn=p(["\n      <a\n        class=","\n        href=","\n      >\n        ","\n      </a>\n      <a\n        class=","\n        href=","\n      >\n        ","\n      </a>\n    "])),L({"sub-menu-entry":!0,active:this.active==="configuration"}),"/p/livechat/configuration/channel?channelId="+encodeURIComponent((e=this.channelId)!=null?e:""),d("Channel options"),L({"sub-menu-entry":!0,active:this.active==="emojis"}),"/p/livechat/configuration/emojis?channelId="+encodeURIComponent((r=this.channelId)!=null?r:""),d("Channel emojis"))}}};g([_({attribute:!1})],Be.prototype,"channelId",2),g([_({attribute:!1})],Be.prototype,"active",2),Be=g([T("livechat-channel-tabs")],Be);var on,sn,an;async function ln(i){let{peertubeHelpers:t,registerClientRoute:e,registerHook:r}=i;(await t.getSettings())["disable-channel-configuration"]||(e({route:"livechat/configuration",onMount:async({rootEl:o})=>{ne(f(on||(on=p(["<livechat-channel-home .registerClientOptions=","></livechat-channel-home>"])),i),o)}}),e({route:"livechat/configuration/channel",onMount:async({rootEl:o})=>{var l;let s=new URLSearchParams(window.location.search),a=parseInt((l=s.get("channelId"))!=null?l:"");if(isNaN(a))throw new Error("Invalid channelId parameter");ne(f(sn||(sn=p(["\n        <livechat-channel-configuration\n          .registerClientOptions=","\n          .channelId=","></livechat-channel-configuration\n        ></livechat-channel-configuration>\n      "])),i,a),o)}}),e({route:"livechat/configuration/emojis",onMount:async({rootEl:o})=>{var l;let s=new URLSearchParams(window.location.search),a=parseInt((l=s.get("channelId"))!=null?l:"");if(isNaN(a))throw new Error("Invalid channelId parameter");ne(f(an||(an=p(["\n        <livechat-channel-emojis\n          .registerClientOptions=","\n          .channelId=","\n        ></livechat-channel-emojis>\n      "])),i,a),o)}}),r({target:"filter:left-menu.links.create.result",handler:async o=>{if(!t.isLoggedIn()||!Array.isArray(o))return o;let s;
1for(let l of o)if(typeof l=="object"&&"key"in l&&(l.key==="in-my-library"||l.key==="my-video-space")){s=l;break}if(!s||!Array.isArray(s.links))return o;let a=await t.translate("Chatrooms");return s.links.unshift({label:a,shortLabel:a,path:"/p/livechat/configuration",icon:"live"}),o}}))}var Ol=Pn(),Un=Ol();function Al(i){return i&&Un.toUUID(i)}function $l(i){return i?i.length===Un.maxLength:!1}function Mn(i){if(!i)return[];let t=i.split("\n");return t=t.map(e=>(e=e.replace(/#.*$/,"").replace(/^\s+/,"").replace(/\s+$/,""),$l(e)?Al(e):e)),t.filter(e=>e!=="")}function Hn(i,t){var r;if("isLocal"in t){if(!t.isLocal)return!1}else if(t.remote)return!1;return!!(i["chat-per-live-video"]&&t.isLive&&((r=t.pluginData)!=null&&r["livechat-active"])||i["chat-all-lives"]&&t.isLive||i["chat-all-non-lives"]&&!t.isLive||Mn(i["chat-videos-list"]).includes(t.uuid))}function Vn(i,t){if(i["federation-no-remote-chat"])return!1;if("isLocal"in t){if(t.isLocal)return!1}else if(!t.remote)return!1;return!(!t.pluginData||!t.pluginData["livechat-remote"])}function Ri(i){let t=document.createElement("a");if(t.classList.add("primary-button","orange-button","peertube-button-link","peertube-plugin-livechat-button","peertube-plugin-livechat-button-"+i.name),i.additionalClasses)for(let e=0;e<i.additionalClasses.length;e++)t.classList.add(i.additionalClasses[e]);if("callback"in i&&(t.onclick=i.callback),"href"in i&&(t.href=i.href),(!t.href||t.href==="#")&&(t.role="button",t.tabIndex=0,t.onclick&&(t.onkeydown=e=>{e.key==="Enter"&&(e.preventDefault(),t.click())})),"targetBlank"in i&&i.targetBlank&&(t.target="_blank"),i.icon){try{let e=i.icon(),r=document.createElement("span");r.innerHTML=e.trim();let n=r.firstChild;n&&("ariaHidden"in n&&(n.ariaHidden="true"),t.prepend(n))}catch(e){R.error("Failed to generate the "+i.name+" button: "+e)}t.setAttribute("title",i.label)}else t.textContent=i.label;i.buttonContainer.append(t)}var Bn=()=>'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 4.233 4.233">\n  <rect\n    style="\n      fill:currentColor;\n      stroke:currentColor;stroke-width:.529167;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1\n    "\n    width="4.223" height=".427" x=".882" y="-.213" transform="rotate(45)" ry=".213"\n  />\n  <rect\n    style="\n      fill:currentColor;\n      stroke:currentColor;stroke-width:.529167;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1\n    "\n    width="4.223" height=".427" x="-2.112" y="2.78" transform="scale(-1 1) rotate(45)" ry=".213"\n  />\n</svg>',Fn=()=>'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 8.467 8.467">\n  <path style="fill:transparent;stroke-width:.187325" d="M.838.848h2.643v1.861H.838zM4.896 4.38h2.451v.875H4.896z"/>\n  <path\n    d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2ZM9 11H7V9h2zm4 0h-2V9h2zm4 0h-2V9h2z"\n    style="fill:currentColor;" transform="matrix(-.18741 0 0 .18741 8.493 3.004)"\n  />\n  <path\n    d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2ZM6 9h12v2H6Zm8 5H6v-2h8zm4-6H6V6h12z"\n    style="fill:currentColor;" transform="scale(.18741)"\n  />\n</svg>',jn=()=>'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 4.233 4.233">\n  <g\n    transform="matrix(.45208 0 0 .45208 -.526 1.335)"\n    style="stroke-width:1.00021;stroke-miterlimit:4;stroke-dasharray:none"\n  >\n    <path\n      style="\n        opacity:.998;fill:none;fill-opacity:1;\n        stroke:currentColor;stroke-width:1.17052322;stroke-miterlimit:4;\n        stroke-dasharray:none;stroke-opacity:1\n      "\n      d="\n        m8.674.744.012 1.266v2.199a.94.94 0 0 1-.943.942H3.345a.94.94\n        0 0 1-.942-.942V-.19a.94.94 0 0 1 .942-.943h2.2l1.255.016\n      "\n    />\n    <rect\n      style="\n        opacity:.998;fill:currentColor;fill-opacity:1;\n        stroke:currentColor;stroke-width:1.17223459;stroke-miterlimit:4;\n        stroke-dasharray:none;stroke-opacity:1\n      "\n      width="5.632" height=".569"\n      x="-6.185" y="4.854" transform="scale(-1.03747 .96108) rotate(45)" ry=".285"\n    />\n    <path\n      style="\n        opacity:.998;fill:currentColor;fill-opacity:1;\n        stroke:currentColor;stroke-width:1.30528;stroke-miterlimit:4;\n        stroke-dasharray:none;stroke-opacity:1\n      "\n      d="m5.15.374 1.091-1.89L7.333.373Z"\n      transform="scale(.89676) rotate(45 9.536 3.618)"\n    />\n  </g>\n</svg>',qn=()=>'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewB
1ox="0 0 4.233 4.233">\n  <g style="stroke-width:1.17052;stroke-miterlimit:4;stroke-dasharray:none">\n    <path style="opacity:.998;fill:none;fill-opacity:1;stroke:currentColor;stroke-width:1.17052;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="m6.556-.435 1.132-1.132c.269-.268.618-.351.784-.186L9.867-.357c.166.165.083.515-.186.784L7.418 2.69c-.269.269-.618.352-.784.186l-.698-.697-.39-.407" transform="matrix(.45208 0 0 .45208 -.73 1.423)"/>\n    <path style="opacity:.998;fill:none;fill-opacity:1;stroke:currentColor;stroke-width:1.17052;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M6.038 3.505 4.906 4.637c-.268.268-.618.351-.784.186L2.727 3.427c-.166-.165-.083-.515.186-.784L5.176.38c.27-.269.619-.352.784-.186l.698.697.39.407" transform="matrix(.45208 0 0 .45208 -.73 1.423)"/>\n  </g>\n</svg>\n',It=()=>'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 4.233 4.233">\n  <path style="display:inline;opacity:.998;fill:none;fill-opacity:1;stroke:currentColor;stroke-width:.529167;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M1.48 1.583V.86c0-.171.085-.31.19-.31h.893c.106 0 .19.139.19.31v.838c0 .171-.107.219-.19.284l-.404.314c-.136.106-.219.234-.221.489l-.003.247"/>\n  <path style="display:inline;fill:currentColor;stroke-width:.235169" d="M1.67 3.429h.529v.597H1.67z"/>\n</svg>\n',Gn=()=>'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 4.233 4.233">\n  <g style="stroke-width:1.00021;stroke-miterlimit:4;stroke-dasharray:none">\n    <path style="opacity:.998;fill:none;fill-opacity:1;stroke:currentColor;stroke-width:1.17052;stroke-linecap:butt;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M2.943 1.626V-.34a.94.94 0 0 1 .942-.943l1.962-.023 1.961.01a.94.94 0 0 1 .942.942v1.968S7.126 4.746 5.847 4.767c-1.28.02-2.904-3.14-2.904-3.14Z" transform="matrix(.45208 0 0 .45208 -.526 1.335)"/>\n  </g>\n</svg>\n';var Wn;async function zn(i,t,e){let r=i.peertubeHelpers,n=await r.translate("Share chat link");R.info("Opening the share modal...");let o=new MutationObserver(s=>{for(let{addedNodes:a}of s)a.forEach(l=>{var c;if(l.localName==="ngb-modal-window"){R.info("Detecting a new modal, checking if this is the good one...");let u=(c=l.querySelector)==null?void 0:c.call(l,".modal-title");if((u==null?void 0:u.textContent)!==n)return;R.info("Yes, it is the good modal!"),o.disconnect();let h=l.querySelector(".modal-body");if(!h){R.error("Modal has no body... Dont know how to fill it.");return}h.childNodes.forEach(m=>h.removeChild(m)),ne(f(Wn||(Wn=p(["\n            <livechat-share-chat\n              ._settings=","\n              ._video=","\n            ></livechat-share-chat>\n          "])),t,e),h)}})});o.observe(document.body,{childList:!0}),r.showModal({title:n,content:"",close:!0}),setTimeout(()=>{o.disconnect()},1e3)}function Nt(i){return!i.peertubeHelpers.isLoggedIn()}function Si(i,t){var e,r;try{if(!t||!t.isLocal||!window.localStorage)return!1;let n=(e=window.localStorage.getItem("username"))!=null?e:"";return!(!n||n!==((r=t.account)==null?void 0:r.name))}catch(n){return R.error(n),!1}}function ki(i){var t;try{if(!window.localStorage)return!1;let e=(t=window.localStorage.getItem("role"))!=null?t:"";return!(!e||e!=="0"&&e!=="1")}catch(e){return R.error(e),!1}}function xi(i){let t="https://livingston.frama.io/peertube-plugin-livechat/";return i.lang&&/^[a-zA-Z_-]+$/.test(i.lang)&&(t=t+i.lang+"/"),i.page&&/^[\w/-]+$/.test(i.page)&&(t=t+i.page+"/"),t}async function Tl({peertubeHelpers:i}){let t=await i.translate("_language");return t==="_language"?"en":t}async function Dt(i,t){let e=(await Tl(i)).toLowerCase();return e==="en"?xi(t):xi(Object.assign({},t,{lang:e}))}var Ll=Kn().default;function Pt(i){return i==="peertube"}function Jn(i){let t=[];for(let e in i){let r=i[e];Ll(r)||t.push(r)}return t.length?t:!0}function Ut(){var o;if(!window.getComputedStyle)return R.warn("[AutoColors] getComputedStyle is not available, aborting."),null;let i=window.getComputedStyle(document.body),t=(o=document.querySelector(".publish-button"))!=null?o:document.querySelector(".peertube-button-link");if(!t)return R.warn("[AutoColors] Cant find a button, aborting."),null;let e=window.getComputedStyle(t),r={mainForeground:i.getPropertyValue("--fg").trim()||i.getPropertyValue("--mainForegroundColor").trim(),mainBackgroun
1d:i.getPropertyValue("--bg").trim()||i.getPropertyValue("--mainBackgroundColor").trim(),greyForeground:i.getPropertyValue("--fg-300").trim()||i.getPropertyValue("--greyForegroundColor").trim(),greyBackground:i.getPropertyValue("--bg-secondary-300").trim()||i.getPropertyValue("--greyBackgroundColor").trim(),menuForeground:i.getPropertyValue("--fg").trim()||i.getPropertyValue("--menuForegroundColor").trim(),menuBackground:i.getPropertyValue("--bg-secondary-400").trim()||i.getPropertyValue("--menuBackgroundColor").trim(),inputForeground:i.getPropertyValue("--input-fg").trim()||i.getPropertyValue("--inputForegroundColor").trim(),inputBackground:i.getPropertyValue("--input-bg").trim()||i.getPropertyValue("--inputBackgroundColor").trim(),buttonForeground:i.getPropertyValue("--on-primary").trim()||e.color.trim(),buttonBackground:i.getPropertyValue("--primary").trim()||i.getPropertyValue("--mainColor").trim(),link:i.getPropertyValue("--fg").trim()||i.getPropertyValue("--mainForegroundColor").trim(),linkHover:i.getPropertyValue("--fg-400").trim()||i.getPropertyValue("--mainForegroundColor").trim()},n=Jn(r);return n!==!0?(R.warn("[AutoColors] Computed colors are not valid, dropping. Invalid values: "+n.join(", ")),null):r}var Xn=!1;async function wl(i){return new Promise((t,e)=>{let r=document.createElement("link");r.onerror=()=>e(new URIError("CSS ".concat(i," didn't load correctly."))),r.onload=()=>t(),r.setAttribute("type","text/css"),r.setAttribute("rel","stylesheet"),r.setAttribute("href",i),document.head.appendChild(r)})}async function Zn(i){return new Promise((t,e)=>{let r=document.createElement("script");r.onerror=()=>e(new URIError("Script ".concat(i," didn't load correctly."))),r.onload=()=>t(),r.async=!0,r.src=i,document.head.appendChild(r)})}function Rl(){let i=Ut();if(!i)return;let t=document.querySelector("body");t&&(t.style.setProperty("--peertube-main-foreground",i.mainForeground),t.style.setProperty("--peertube-main-background",i.mainBackground),t.style.setProperty("--peertube-grey-foreground",i.greyForeground),t.style.setProperty("--peertube-grey-background",i.greyBackground),t.style.setProperty("--peertube-menu-foreground",i.menuForeground),t.style.setProperty("--peertube-menu-background",i.menuBackground),t.style.setProperty("--peertube-input-foreground",i.inputForeground),t.style.setProperty("--peertube-input-background",i.inputBackground),t.style.setProperty("--peertube-button-foreground",i.buttonForeground),t.style.setProperty("--peertube-button-background",i.buttonBackground),t.style.setProperty("--peertube-link",i.link),t.style.setProperty("--peertube-link-hover",i.linkHover))}async function Sl(i){Rl(),window.converse||await Promise.all([wl(i.staticBaseUrl+"conversejs/converse.min.css"),Zn(i.staticBaseUrl+"conversejs/converse.min.js")]),window.initConverse||(await Zn(i.staticBaseUrl+"static/builtin.js"),window.initConversePlugins(!0))}async function Mt(i,t,e,r,n){let o=i.peertubeHelpers,s=document.createElement("div");s.classList.add("livechat-spinner"),s.setAttribute("id","livechat-loading-spinner"),s.innerHTML="<div></div>",t.append(s);let a=document.createElement("converse-root");a.classList.add("theme-peertube"),t.append(a),a.addEventListener("click",m=>{if(!m.target)return;let b="tagName"in m.target&&m.target.tagName==="A"?m.target:m.target.closest("a");b&&b.getAttribute("href")==="#"&&(R.log("Intercepting a click on href=# in converse root, canceling the event."),m.preventDefault())});let l=o.getAuthHeader(),c=V(i)+"/api/configuration/room/"+encodeURIComponent(e)+(n?"?forcetype=1":""),u=await fetch(c,{method:"GET",headers:l});if(!u.ok)throw new Error("Can't get room configuration.");let h=await u.json();if(!Xn){let m=await i.peertubeHelpers.translate("Your vote has been taking into account, the counters will be updated in a moment.");Xn=!0,document.addEventListener("livechat-poll-vote",()=>{i.peertubeHelpers.notifier.success(m)})}await Sl(h),await window.initConverse(h,r,l!=null?l:null)}async function eo(i){var o;let t=z(),e=t.logger;if(!i){e.error("No video provided");return}let r=document.getElementById("plugin-placeholder-player-next");if(!r){e.error("The required placeholder div is not present in the DOM.");return}let n=r.querySelector("#peertube-plugin-livechat-container");if(n){e.log("The chat seems already initialized...");return}n=document.createElement("div"),n.setAttribute("id","peertube-plugin-livechat-container"),n.setAttribute("peertube-plugin-livechat-state","initializing"),n.setAttribute("peertube-plugin-livechat-current-url",window.location.href),n.role="region",n.ariaLabel=await t.ptOptions.peertubeHelpers.translate("Chat"),r.append(n);try{let s=await t.getSettings();if(e.log("Checking if this video should have a chat..."),s["chat-no-anonymous"]===!0&&Nt(t.ptOptions)){e.log("No chat for anonymous users");return}if(!Hn(s,i)&&!Vn(s,i)){e.log("This video has no webchat");return}let a=!1,l=!1;if(i.isLocal){let c=(o=s["chat-share-url"])!=null?o:"";c==="everyone"?a=!0:c==="owner"?a=Si(t.ptOptions,i):c==="owner+moderators"&&(a=Si(t.ptOptions,i)||ki(t.ptOptions)),ki(t.ptOptions)&&(l=!0)}await kl(n,i,s,!!s["chat-open-blank"],a,l),s["chat-auto-display"]?await to(i):n&&n.setAttribute("peertube-plugin-livechat-state","closed")}catch(s){e.error("initChat has failed"),e.error(s)}}
1async function kl(i,t,e,r,n,o){let s=z(),a=s.ptOptions.peertubeHelpers,l=s.logger;l.log("Adding livechat in the DOM...");let c=await Dt(s.ptOptions,{page:"documentation/user/viewers"});return new Promise(h=>{Promise.all([a.translate("Open chat"),a.translate("Open chat in a new window"),a.translate("Close chat"),a.translate("Share chat link"),a.translate("Online help"),a.translate("Become moderator")]).then(m=>{var C,$,N;let b=m[0],y=m[1],A=m[2],w=m[3],x=m[4],M=m[5],H=document.createElement("div");H.classList.add("peertube-plugin-livechat-buttons"),i.append(H);let I=[];if(I.push({buttonContainer:H,name:"open",label:b,callback:()=>{to(t).then(()=>{},()=>{})},icon:Fn,additionalClasses:[]}),r&&I.push({buttonContainer:H,name:"openblank",label:y,callback:()=>{Qn(),window.open("/p/livechat/room?room="+encodeURIComponent(t.uuid))},icon:jn,additionalClasses:[]}),n&&I.push({buttonContainer:H,name:"shareurl",label:w,callback:()=>{zn(s.ptOptions,e,t).then(()=>{},()=>{})},icon:qn,additionalClasses:[]}),o&&I.push({buttonContainer:H,name:"promote",label:M,callback:async()=>{try{let U=V(s.ptOptions)+"/api/configuration/room/"+encodeURIComponent(t.uuid),re=await(await fetch(U,{method:"GET",headers:a.getAuthHeader()})).json();if(re.isRemoteChat)throw new Error("Cant promote on remote chat.");let ye=re.room.replace(/@.*$/,"");await fetch(V(s.ptOptions)+"/api/promote/"+encodeURIComponent(ye),{method:"PUT",headers:a.getAuthHeader()})}catch(U){l.error(U)}},icon:Gn,additionalClasses:[]}),I.push({buttonContainer:H,name:"help",label:x,href:c,targetBlank:!0,icon:It,additionalClasses:[]}),I.length>1){(C=I[0].additionalClasses)==null||C.push("peertube-plugin-livechat-multi-button-main");for(let U=1;U<I.length-1;U++)($=I[U].additionalClasses)==null||$.push("peertube-plugin-livechat-multi-button-secondary");(N=I[I.length-1].additionalClasses)==null||N.push("peertube-plugin-livechat-multi-button-last-secondary")}for(let U of I)Ri(U);Ri({buttonContainer:H,name:"close",label:A,callback:()=>Qn(),icon:Bn}),h()})})}async function to(i){var l;let t=z(),e=t.ptOptions.peertubeHelpers,r=t.logger,n=await t.getSettings();if(!i)return r.log("No video."),!1;r.info("Trying to load the chat for video ".concat(i.uuid,"."));let o=i.uuid;if(!o)return r.error("Can't get room xmpp addr"),!1;let s=(l=n["chat-style"])!=null?l:"";r.info("Opening the chat...");let a=document.getElementById("peertube-plugin-livechat-container");try{if(!a)return r.error("Cant found the livechat container."),!1;if(a.getElementsByTagName("converse-root").length)return r.error("Seems that there is already a ConverseJS in the container."),!1;s&&a.setAttribute("style",s),a.setAttribute("peertube-plugin-livechat-state","open"),Ii(!0),await Mt(t.ptOptions,a,o,"peertube-video",!1)}catch(c){if(a){let u=document.createElement("div");u.classList.add("peertube-plugin-livechat-error-message"),u.innerText=await e.translate("This chatroom does not exist, or is not accessible to you."),a.append(u),a.querySelectorAll(".livechat-spinner, converse-root").forEach(h=>h.remove())}Ii(!1)}}function Qn(){var e;let i=z().logger,t=document.getElementById("peertube-plugin-livechat-container");if(!t){i.error("Can't close livechat, container not found.");return}(e=window.converse)!=null&&e.livechatDisconnect&&window.converse.livechatDisconnect(),t.querySelectorAll("converse-root, .livechat-spinner, .peertube-plugin-livechat-error-message").forEach(r=>r.remove()),t.setAttribute("peertube-plugin-livechat-state","closed"),Ii(!1)}function Ii(i){try{document.querySelectorAll(".peertube-plugin-livechat-buttons").forEach(t=>{i?t.classList.add("peertube-plugin-livechat-buttons-open"):t.classList.remove("peertube-plugin-livechat-buttons-open")})}catch(t){z().logger.error("Failed hacking styles:  '".concat(t,"'"))}}var io;function bo(i){let t=i.computeUrl();return f(io||(io=p(['<div class="livechat-shareurl-copy">\n    <input\n      type="text"\n      readonly autocomplete="off" placeholder=""\n      class="form-control readonly"\n      value=',"\n      @click=",'\n    />\n    <button\n      type="button" class="btn btn-outline-secondary text-uppercase"\n      @click=',"\n      ?disabled=","\n    >\n      ",'\n    </button>\n    <button\n      type="button" class="btn btn-outline-secondary text-uppercase"\n      @click=',"\n      ?disabled=","\n    >\n      ","\n    </button>\n    <livechat-help-button .page=","></livechat-help-button>\n  </div>"])),t.shareString,e=>{let r=e.target;r.select(),r.setSelectionRange(0,99999)},i.copyUrl,!t.shareString,d("Copy"),i.openUrl,t.openUrl===void 0,d("Open"),"documentation/user/streamers")}var ro;function Ht(i,t,e){return f(ro||(ro=p(["\n    <a\n      class=","\n      @click=","\n    >\n      ","\n    </a>
1"])),L({"sub-menu-entry":!0,active:i.currentTab===t}),r=>{r.preventDefault(),i.switchTab(t)},d(e))}var no;function vo(i){return f(no||(no=p(["\n    ","\n    ","\n    ","\n    ","\n  "])),Ht(i,"embed","Embed"),i.dockEnabled?Ht(i,"dock","Dock"):"",Ht(i,"peertube","Web"),i.xmppUriEnabled?Ht(i,"xmpp","Connect using XMPP"):"")}var oo,so,ao,lo;function _o(i){let t,e;switch(i.currentTab){case"peertube":t="This link will open the chat within the Peertube interface.";break;case"embed":t="Tips for streamers: To embed the chat in your video stream using OBS for example, generate a read-only link and use it as a browser source.",e=f(oo||(oo=p(["<livechat-help-button .page=","></livechat-help-button>"])),"documentation/user/obs");break;case"dock":t="You can generate a link that will open the chat in full page, logged in with your Peertube account. This can be use, for example, to have a web dock in your OBS, so you can read and interact with the chat directly from OBS. Don't share this link to anyone, as it would allow them to connect as yourself. Please find bellow the list of authentication token you have already generated. You can create a new one, or revoke any previous token. Please note that these tokens have no expiration date.",e=f(so||(so=p(["<livechat-help-button .page=","></livechat-help-button>"])),"documentation/user/obs");break;case"xmpp":t="You can connect to the room using an external XMPP account, and your favorite XMPP client.";break}return t?f(lo||(lo=p(['<div class="livechat-shareurl-tips">',"","</div>"])),d(t),e):f(ao||(ao=p([""])))}var co;function xl(i){return f(co||(co=p([""])))}var uo,ho;function Il(i){return f(ho||(ho=p(['\n    <label>\n      <input\n        type="checkbox"\n        ?checked=',"\n        @click=","\n      />\n      ",'\n    </label>\n\n    <label>\n      <input\n        type="checkbox"\n        ?checked=',"\n        @click=","\n      />\n      ","\n    </label>\n    <div\n      class=",'\n    >\n      <label>\n        <input\n          type="checkbox"\n          ?checked=',"\n          ?disabled=","\n          @click=","\n        />\n        ",'\n      </label>\n      <label>\n        <input\n          type="checkbox"\n          ?checked=',"\n          ?disabled=","\n          @click=","\n        />\n        ","\n      </label>\n    </div>\n\n    ","\n  "])),i.embedIFrame,()=>{i.embedIFrame=!i.embedIFrame},d("Generate an iframe to embed the chat in a website"),i.embedReadOnly,()=>{i.embedReadOnly=!i.embedReadOnly},d("Read-only"),L({"livechat-shareurl-suboptions":!0,"livechat-shareurl-suboptions-disabled":!i.embedReadOnly}),i.embedReadOnlyScrollbar,!i.embedReadOnly,()=>{i.embedReadOnlyScrollbar=!i.embedReadOnlyScrollbar},d("Show the scrollbar"),i.embedReadOnlyTransparentBackground,!i.embedReadOnly,()=>{i.embedReadOnlyTransparentBackground=!i.embedReadOnlyTransparentBackground},d("Transparent background (for stream integration, with OBS for example)"),i.autocolorsAvailable?f(uo||(uo=p(['\n          <label>\n            <input\n              type="checkbox"\n              ?checked=',"\n              @click=","\n            />\n            ","\n          </label>"])),i.embedAutocolors,()=>{i.embedAutocolors=!i.embedAutocolors},d("Use current theme colors")):"")}var po;function Nl(i){return f(po||(po=p(['<livechat-token-list\n    mode="select"\n    @update=',"\n  ></livechat-token-list>"])),t=>{i.requestUpdate()})}var fo;function Dl(i){return f(fo||(fo=p([""])))}var mo,go;function Co(i){let t;switch(i.currentTab){case"peertube":t=xl(i);break;case"embed":t=Il(i);break;case"dock":t=Nl(i);break;case"xmpp":t=Dl(i);break;default:t=f(mo||(mo=p([""])))}return f(go||(go=p(['<div class="livechat-shareurl-options">',"</div>"])),t)}function Ni(i,t,e,r={}){if(!t)return R.error("Settings are not initialized, too soon to compute the iframeUri"),null;let n=V(i,r.permanent);n+="/webchat/room/"+encodeURIComponent(e.uuid);let o=new URL(n,window.location.origin);if(!r.ignoreAutoColors&&t["converse-autocolors"]&&Pt(t["converse-theme"])){R.info("We have to try to compute autocolors.");try{let s=Ut();if(s)for(let a in s)o.searchParams.set("_ac_"+a,s[a])}catch(s){R.error("Failed computing autocolors:  '".concat(s,"'"))}}return r.readonly&&o.searchParams.set("_readonly",typeof r.readonly=="string"?r.readonly:"true"),r.transparent&&o.searchParams.set("_transparent","true"),n=o.href,n}function yo(i,t,e){if(!t["prosody-room-allow-s2s"])return null;let r;
1t["prosody-room-type"]==="channel"?r="channel."+e.channel.id.toString():r=e.uuid.toString();let n=window.location.hostname,o=r+"@room."+n;return{jid:o,uri:"xmpp:"+o+"?join"}}var Vt=["embed","dock","peertube","xmpp"],Eo,J=class extends O{constructor(){super(...arguments);this.currentTab=Vt[0];this.xmppUriEnabled=!1;this.dockEnabled=!1;this.autocolorsAvailable=!1;this.embedIFrame=!1;this.embedReadOnly=!1;this.embedReadOnlyScrollbar=!1;this.embedReadOnlyTransparentBackground=!1;this.embedAutocolors=!1;this.render=()=>f(Eo||(Eo=p(["\n      ","\n      ",'\n      <div class="livechat-shareurl-block">\n        ',"\n        ","\n      </div>\n    "])),vo(this),bo(this),_o(this),Co(this))}firstUpdated(e){super.firstUpdated(e);let r=this._settings;this.xmppUriEnabled=!!r["prosody-room-allow-s2s"],this.dockEnabled=!Nt(this.ptContext.ptOptions)&&this._video.isLocal&&!r["livechat-token-disabled"],this.autocolorsAvailable=Pt(r["converse-theme"]),this._restorePreviousState()}updated(e){super.updated(e),this.logger.log("Updated was triggered, saving current state."),this._saveCurrentState()}_restorePreviousState(){if(!window.localStorage){this.logger.warn("No localStorage, can't restore state.");return}let e=window.localStorage.getItem("peertube-plugin-livechat-shareurl");if(e){try{let r=JSON.parse(e);if(!r||typeof r!="object"||r.version!==2){this.logger.warn("Stored information are invalid, dropping");return}this.logger.log("Restoring previous state"),Vt.includes(r.currentTab)&&(this.currentTab=r.currentTab),this.embedIFrame=!!r.embedIFrame,this.embedReadOnly=!!r.embedReadOnly,this.embedReadOnlyScrollbar=!!r.embedReadOnlyScrollbar,this.embedReadOnlyTransparentBackground=!!r.embedReadOnlyTransparentBackground,this.embedAutocolors=!!r.embedAutocolors}catch(r){this.logger.error(r)}!this.xmppUriEnabled&&this.currentTab==="xmpp"&&(this.currentTab=Vt[0]),!this.dockEnabled&&this.currentTab==="dock"&&(this.currentTab=Vt[0])}}_saveCurrentState(){if(!window.localStorage){this.logger.warn("No localStorage, can't save state.");return}let e={version:2,currentTab:this.currentTab,embedIFrame:this.embedIFrame,embedReadOnly:this.embedReadOnly,embedReadOnlyScrollbar:this.embedReadOnlyScrollbar,embedReadOnlyTransparentBackground:this.embedReadOnlyTransparentBackground,embedAutocolors:this.embedAutocolors};window.localStorage.setItem("peertube-plugin-livechat-shareurl",JSON.stringify(e))}computeUrl(){switch(this.currentTab){case"embed":return this._computeUrlEmbed();case"dock":return this._computeUrlDock();case"peertube":return this._computeUrlPeertube();case"xmpp":return this._computeUrlXMPP();default:return{shareString:"",openUrl:void 0}}}_computeUrlPeertube(){let e=window.location.protocol+"//"+window.location.host+"/p/livechat/room?room="+encodeURIComponent(this._video.uuid);return{shareString:e,openUrl:e}}_computeUrlXMPP(){var r;let e=yo(this.ptContext.ptOptions,this._settings,this._video);return{shareString:(r=e==null?void 0:e.jid)!=null?r:"",openUrl:e==null?void 0:e.uri}}_computeUrlDock(){let e=this.querySelector("livechat-token-list"),r=e==null?void 0:e.currentSelectedToken;if(!r)return{shareString:"",openUrl:void 0};let n={ignoreAutoColors:!0,permanent:!0},o=Ni(this.ptContext.ptOptions,this._settings,this._video,n);return o?(o+="#?p="+encodeURIComponent(r.password),o+="&j="+encodeURIComponent(r.jid),r.nickname&&(o+="&n="+encodeURIComponent(r.nickname)),{shareString:o,openUrl:o}):{shareString:"",openUrl:void 0}}_computeUrlEmbed(){let e={ignoreAutoColors:this.autocolorsAvailable?!this.embedAutocolors:!0,permanent:!0};this.embedReadOnly&&(e.readonly=this.embedReadOnlyScrollbar?!0:"noscroll",this.embedReadOnlyTransparentBackground&&(e.transparent=!0));let r=Ni(this.ptContext.ptOptions,this._settings,this._video,e);if(!r)return{shareString:"",openUrl:void 0};if(!this.embedIFrame)return{shareString:r,openUrl:r};let n=document.createElement("iframe");n.setAttribute("src",r),n.setAttribute("title",this._video.name),n.setAttribute("sandbox","allow-same-origin allow-scripts allow-popups allow-forms"),n.setAttribute("width","560"),n.setAttribute("height","315"),n.setAttribute("frameborder","0");let o=n.outerHTML;return n.remove(),{shareString:o,openUrl:void 0}}async copyUrl(){await navigator.clipboard.writeText(this.computeUrl().shareString),this.ptNotifier.success(await this.ptTranslate("C
1opied"))}openUrl(){let e=this.computeUrl().openUrl;e&&window.open(e)}switchTab(e){this.currentTab=e}};g([_({attribute:!1})],J.prototype,"_video",2),g([_({attribute:!1})],J.prototype,"_settings",2),g([_({attribute:!1})],J.prototype,"currentTab",2),g([_({attribute:!1})],J.prototype,"xmppUriEnabled",2),g([_({attribute:!1})],J.prototype,"dockEnabled",2),g([_({attribute:!1})],J.prototype,"autocolorsAvailable",2),g([_({attribute:!1})],J.prototype,"embedIFrame",2),g([_({attribute:!1})],J.prototype,"embedReadOnly",2),g([_({attribute:!1})],J.prototype,"embedReadOnlyScrollbar",2),g([_({attribute:!1})],J.prototype,"embedReadOnlyTransparentBackground",2),g([_({attribute:!1})],J.prototype,"embedAutocolors",2),J=g([T("livechat-share-chat")],J);async function Oo(){let i=z();i.ptOptions.registerHook({target:"action:video-watch.video.loaded",handler:({video:t,playlist:e})=>{if(!t){i.logger.error("No video argument in hook action:video-watch.video.loaded");return}if(e){i.logger.info("We are in a playlist, we will not use the webchat");return}eo(t).then(()=>{},()=>{})}})}async function Ao(i){let{peertubeHelpers:t,registerClientRoute:e}=i;e({route:"livechat/room",onMount:async({rootEl:r})=>{try{let n=new URLSearchParams(window.location.search),o=n.get("room");if(!o)throw new Error("missing room parameter");let s=n.get("forcetype")==="1",a=document.createElement("div");a.classList.add("livechat-embed-fullpage"),r.append(a),await Mt(i,a,o,"peertube-fullpage",s)}catch(n){R.error(n),r.innerHTML="";let o=document.createElement("div");o.classList.add("peertube-plugin-livechat-error-message"),o.innerText=await t.translate("This chatroom does not exist, or is not accessible to you."),r.append(o)}}})}var $o=/^[a-zA-Z0-9_-]+$/;var Bt=class{constructor(t){this._headers={};var e;this._registerClientOptions=t,this._headers=(e=this._registerClientOptions.peertubeHelpers.getAuthHeader())!=null?e:{},this._headers["content-type"]="application/json;charset=UTF-8"}async validateConfiguration(t){let e={};if(t.files.length>20)throw new K("AdminFirewallConfigurationValidationError",await this._registerClientOptions.peertubeHelpers.translate("Too many entries"),e);let r=new Map;for(let[n,o]of t.files.entries())e["files.".concat(n,".name")]=[],o.name===""?e["files.".concat(n,".name")].push(0):o.name.length>20?e["files.".concat(n,".name")].push(5):$o.test(o.name)?r.has(o.name)?e["files.".concat(n,".name")].push(4):r.set(o.name,!0):e["files.".concat(n,".name")].push(2),e["files.".concat(n,".content")]=[],o.content.length>3072&&e["files.".concat(n,".content")].push(5);if(Object.values(e).find(n=>n.length>0))throw new K("AdminFirewallConfigurationValidationError",await this._registerClientOptions.peertubeHelpers.translate("There was an error during validation."),e);return!0}async saveConfiguration(t){if(!await this.validateConfiguration(t))throw new Error("Invalid form data");let e=await fetch(V(this._registerClientOptions)+"/api/admin/firewall/",{method:"POST",headers:this._headers,body:JSON.stringify(t)});if(!e.ok)throw new Error("Failed to save configuration.");return e.json()}async fetchConfiguration(){let t=await fetch(V(this._registerClientOptions)+"/api/admin/firewall/",{method:"GET",headers:this._headers});if(!t.ok)throw new Error("Can't get firewall configuration.");return t.json()}};var To,Lo;function wo(i){var r,n,o,s;let t={enabled:{colName:d("Enabled")},name:{colName:d("Name"),description:d("Can only contain: alphanumerical characters, underscores and hyphens. Scripts will be loaded in alphabetical order."),headerClassList:["peertube-livechat-admin-firewall-col-name"]},content:{colName:d("File content"),headerClassList:["peertube-livechat-admin-firewall-col-content"]}},e={enabled:{inputType:"checkbox",default:!0},name:{inputType:"text",default:"",maxlength:20},content:{inputType:"textarea",default:"",maxlength:3072}};return f(Lo||(Lo=p(['\n    <div class="margin-content peertube-plugin-livechat-admin-firewall">\n      <h1>\n        ',"\n      </h1>\n      <p>\n        ","\n        <livechat-help-button .page=",">\n        </livechat-help-button>\n      </p>\n      ",'\n\n      <form role="form" @submit='," @change=",">\n        <livechat-dynamic-table-form\n          .header=","\n          .schema=","\n          .maxLines=","\n          .validation=","\n          .validationPrefix=","\n          .rows=","\n          @update=",'\n        ></livechat-dynamic-table-form>\n\n        <div class="form-group mt-5">\n          <button type="reset" @click='," ?disabled=",">\n            ",'\n          </button>\n          <button type="submit" ?disabled=',">\n            ","\n          </button>\n        </div>\n      </form>\n    </div>"])),d("Prosody mod_firewall configuration"),d('Here you can configure Prosody <a href="https://modules.prosody.im/mod_firewall" target="_blank">mod_firewall</a> module. You can create multiple configuration files bellow, and change their order. Don\'t hesitate to share your configurations with the community (for example by adding some examples in the plugin documentation).',!0),"documentation/admin/mod_firewall",(r=i.firewallConfiguration)!=null&&r.enabled?"":f(To||(To=p(['<p class="peertube-plugin-livechat-warning">',"</p>"])),d('Warning: mod_firewall is disabled in the livechat <a href="/admin/plugins/show/peertube-plugin-livechat" target="_blank">plugin settings</a>, you have to enable it if you want this configuration to be taken into account.',!0)),i.saveConfig,i.resetValidation,t,e,20,(n=i.validationError)==null?void 0:n.properties,"files",(s=(o=i.firewallConfiguration)==null?void 0:o.files)!=null?s:[],a=>{i.resetValidation(a),i.firewallConfiguration&&(i.firewallConfiguration.files=a.detail,i.requestUpdate("firewallConfiguration"))},i.reset,i.actionDisabled,d("Cancel"),i.actionDisabled,d("Save"))}var Ro,So,ko,ke=class extends O{constructor(){super();this.actionDisabled=!1;this.saveConfig=async e=>{e==null||e.preventDefault(),!(!this.firewallConfiguration||!this._adminFirewallService)&&(this.actionDisabled=!0,this._adminFirewallService.saveConfiguration(this.firewallConfiguration).then(r=>{this.validationError=void 0,this.ptTranslate("Successfully saved").then(n=>{this.ptNotifier.info(n)},()=>{}),this.firewallConfiguration=r,this.requestUpdate("firewallConfiguration"),this.requestUpdate("_validationError")}).catch(async r=>{this.validationError=void 0,r instanceof K&&(this.validationError=r),this.logger.warn("A validation error occurred in saving configuration. ".concat(r.name,": ").concat(r.message)),this.ptNotifier.error(r.message?r.message:await this.ptTranslate("Error")),this.requestUpdate("_validationError")}).finally(()=>{this.actionDisabled=!1}))};this.getInputValidationClass=e=>{var n;let r=(n=this.validationError)==null?void 0:n.properties[e];return r?r.length?{"is-invalid":!0}:{"is-valid":!0}:{}};this.renderFeedback=(e,r)=>{var s,a;let n=[],o=(a=(s=this.validationError)==null?void 0:s.properties[r])!=null?a:void 0;return o&&o.length!==0?f(Ro||(Ro=p(["<div id=",' class="invalid-feedback">',"</div>"])),e,n):E};this.render=()=>this._asyncTaskRender.render({pending:()=>f(So||(So=p(["<livechat-spinner></livechat-spinner>"]))),error:()=>f(ko||(ko=p(["<livechat-error></livechat-error>"]))),complete:()=>wo(this)});this._asyncTaskRender=this._initTask()}_initTask(){return new Y(this,{task:async()=>{this._adminFirewallService=new Bt(this.ptOptions),this.firewallConfiguration=await this._adminFirewallService.fetchConfiguration(),this.actionDisabled=!1},args:()=>[]})}async reset(e){e==null||e.preventDefault(),this.actionDisabled=!0,this._asyncTaskRender=this._initTask(),this.requestUpdate()}resetValidation(e){this.validationError&&(this.validationError=void 0,this.requestUpdate("_validationError"))}};g([k()],ke.prototype,"firewallConfiguration",2),g([k()],ke.prototype,"validationError",2),g([k()],ke.prototype,"actionDisabled",2),ke=g([T("livechat-admin-firewall")],ke);var xo;async function Io(i){let{registerClientRoute:t}=i;t({route:"livechat/admin/firewall",onMount:async({rootEl:e})=>{ne(f(xo||(xo=p(["<livechat-admin-firewall .registerClientOptions=","></livechat-admin-firewall>"])),i),e)}})}var No,xe=class extends O{constructor(){super(...arguments);this.buttonTitle=d("Online help");this.page="";this.url=new URL("https://lmddgtfy.net/");this._asyncTaskRender=new Y(this,{task:async()=>{this.url=new URL(await Dt(this.ptOptions,{page:this.page}))},args:()=>[]});this.render=()=>this._asyncTaskRender.render({complete:()=>f(No||(No=p(['<a\n        href="','"\n        target=_blank\n        title="','"\n        class="primary-button orange-button peertube-button-link"\n      >',"</a>"])),this.url.href,this.buttonTitle,te(It()))})}};g([_({attribute:!1})],xe.prototype,"buttonTitle",2),g([_({attribute:!1})],xe.prototype,"page",2),g([k()],xe.prototype,"url",2),xe=g([T("livechat-help-button")],xe);var Do=(i,t,e)=>{let r=new Map;for(let n=t;n<=e;n++)r.set(i[n],n);return r},Ie=Q(class extends oe{constructor(i){if(super(i),i.type!==ee.CHILD)throw Error("repeat() can only be used in text expressions")}
1dt(i,t,e){let r;e===void 0?e=t:t!==void 0&&(r=t);let n=[],o=[],s=0;for(let a of i)n[s]=r?r(a,s):s,o[s]=e(a,s),s++;return{values:o,keys:n}}render(i,t,e){return this.dt(i,t,e).values}update(i,[t,e,r]){var A;let n=Or(i),{values:o,keys:s}=this.dt(t,e,r);if(!Array.isArray(n))return this.ut=s,o;let a=(A=this.ut)!=null?A:this.ut=[],l=[],c,u,h=0,m=n.length-1,b=0,y=o.length-1;for(;h<=m&&b<=y;)if(n[h]===null)h++;else if(n[m]===null)m--;else if(a[h]===s[b])l[b]=fe(n[h],o[b]),h++,b++;else if(a[m]===s[y])l[y]=fe(n[m],o[y]),m--,y--;else if(a[h]===s[y])l[y]=fe(n[h],o[y]),Ue(i,l[y+1],n[h]),h++,y--;else if(a[m]===s[b])l[b]=fe(n[m],o[b]),Ue(i,n[h],n[m]),m--,b++;else if(c===void 0&&(c=Do(s,b,y),u=Do(a,h,m)),c.has(a[h]))if(c.has(a[m])){let w=u.get(s[b]),x=w!==void 0?n[w]:null;if(x===null){let M=Ue(i,n[h]);fe(M,o[b]),l[b]=M}else l[b]=fe(x,o[b]),Ue(i,n[h],x),n[w]=null;b++}else ft(n[m]),m--;else ft(n[h]),h++;for(;b<=y;){let w=Ue(i,l[y+1]);fe(w,o[b]),l[b++]=w}for(;h<=m;){let w=n[h++];w!==null&&ft(w)}return this.ut=s,Er(i,l),Z}});var S=i=>i!=null?i:E;var Ft='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"\n  aria-hidden="true"\n  fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"\n  stroke-linejoin="round" class="feather feather-plus-square">\n    <rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>\n    <line x1="12" y1="8" x2="12" y2="16"></line><line x1="8" y1="12" x2="16" y2="12"></line>\n  </svg>',jt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"\n  aria-hidden="true"\n  fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"\n  stroke-linejoin="round" class="feather feather-x-square">\n    <rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>\n    <line x1="9" y1="9" x2="15" y2="15"></line><line x1="15" y1="9" x2="9" y2="15"></line>\n  </svg>';var Po,Uo,Mo,Ho,Vo,Bo,Fo,jo,qo,Go,Wo,zo,Yo,Ko,Jo,Xo,Zo,Qo,es,ts,is,rs,ns,os,ss,as,ls,cs,us,ds,hs,ps,fs,ms,gs,X=class extends O{constructor(){super(...arguments);this.header={};this.schema={};this.maxLines=void 0;this.validationPrefix="";this.rows=[];this._rowsById=[];this.formName="";this._lastRowId=1;this.columnOrder=[];this._updateLastRowId=()=>{for(let e of this._rowsById)this._lastRowId=Math.max(this._lastRowId,e._id+1)};this._getDefaultRow=()=>(this._updateLastRowId(),Object.fromEntries([...Object.entries(this.schema).map(e=>{var r;return[e[0],(r=e[1].default)!=null?r:""]})]));this.render=()=>{let e="peertube-livechat-".concat(this.formName.replace(/_/g,"-"),"-table");this._updateLastRowId(),this._rowsById=this._rowsById.filter(r=>this.rows.includes(r.row));for(let r=0;r<this.rows.length;r++)this._rowsById.find(n=>n.row===this.rows[r])?this._rowsById.filter(n=>n.row===this.rows[r]).forEach(n=>{n._originalIndex=r}):this._rowsById.push({_id:this._lastRowId++,_originalIndex:r,row:this.rows[r]});return this.columnOrder.length!==Object.keys(this.header).length&&(this.columnOrder=this.columnOrder.filter(r=>Object.keys(this.header).includes(r)),this.columnOrder.push(...Object.keys(this.header).filter(r=>!this.columnOrder.includes(r)))),f(Po||(Po=p(['\n      <div class="table-responsive">\n        <table class="table" id=',">\n          ","\n          <tbody>\n            ","\n          </tbody>\n          ","\n        </table>\n      </div>\n    "])),e,this._renderHeader(),Ie(this._rowsById,r=>r._id,this._renderDataRow),this._renderFooter())};this._renderHeader=()=>{let e=Object.entries(this.header).sort(([r,n],[o,s])=>this.columnOrder.indexOf(r)-this.columnOrder.indexOf(o));return f(Uo||(Uo=p(["<thead>\n      <tr>\n        ",'\n        <th scope="col"></th>\n      </tr>\n      <tr>\n        ','\n        <th scope="col"></th>\n      </tr>\n    </thead>'])),e.map(([r,n])=>this._renderHeaderCell(n)),e.map(([r,n])=>this._renderHeaderDescriptionCell(n)))};this._renderHeaderCell=e=>{var r,n;return f(Mo||(Mo=p(['<th scope="col" class=','>\n      <div\n        data-toggle="tooltip"\n        data-placement="bottom"\n        data-html="true"\n      >\n        ',"\n      </div>\n    </th>"])),(n=(r=e.headerClassList)==null?void 0:r.join(" "))!=null?n:"",e.colName)};this._renderDataRow=e=>{let r="peertube-livechat-".concat(this.formName.replace(/_/g,"-"),"-row-").concat(e._id);return f(Vo||(Vo=p(["<tr id=",">\n      ",'\n      <td class="form-group">\n        <button type="button"\n          class="dynamic-table-remove-row"\n          .title=',"\n          @click=","\n        >\n          ","\n        </button>\n      </td>\n    </tr>"])),r,Object.keys(this.header).sort((n,o)=>this.columnOrder.indexOf(n)-this.columnOrder.indexOf(o)).map(n=>{var o;return this.renderDataCell(n,(o=e.row[n])!=null?o:this.schema[n].default,e._id,e._originalIndex)}),d("Remove this entry"),async()=>
1this._removeRow(e._id),te(jt))};this._renderFooter=()=>this.maxLines&&this._rowsById.length>=this.maxLines?f(Bo||(Bo=p([""]))):f(jo||(jo=p(['<tfoot>\n    <tr>\n      <td class="dynamic-table-add-row-cell">\n        <button type="button"\n          class="dynamic-table-add-row"\n          .title=',"\n          @click=","\n        >\n          ","\n        </button>\n      </td>\n      ","\n    </tr>\n  </tfoot>"])),d("Add an entry"),this._addRow,te(Ft),Object.values(this.header).map(()=>f(Fo||(Fo=p(["<td></td>"])))));this.renderDataCell=(e,r,n,o)=>{var b,y,A,w,x,M,H,I,C,$,N,U,de,re,ye,Fe,je;let s=(b=this.schema[e])!=null?b:{},a,l="".concat(this.formName.replace(/-/g,"_"),"_").concat(e.toString().replace(/-/g,"_"),"_").concat(n),c="peertube-livechat-".concat(this.formName.replace(/_/g,"-"),"-").concat(e.toString().replace(/_/g,"-"),"-").concat(n),u=(A=s.inputTitle)!=null?A:(y=this.header[e])==null?void 0:y.colName,h=this._renderFeedback(c,e,o);switch((w=s.default)==null?void 0:w.constructor){case String:switch((x=s.inputType)!=null||(s.inputType="text"),s.inputType){case"text":case"color":case"date":case"datetime":case"datetime-local":case"email":case"file":case"image":case"month":case"number":case"password":case"range":case"tel":case"time":case"url":case"week":a=f(qo||(qo=p(["","\n              ","\n              "])),this._renderInput(n,c,l,u,e,s,r,o),h);break;case"textarea":a=f(Go||(Go=p(["","\n              ","\n              "])),this._renderTextarea(n,c,l,u,e,s,r,o),h);break;case"select":a=f(Wo||(Wo=p(["","\n              ","\n              "])),this._renderSelect(n,c,l,u,e,s,r,o),h);break;case"image-file":a=f(zo||(zo=p(["","\n              ","\n              "])),this._renderImageFileInput(n,c,l,u,e,s,r==null?void 0:r.toString(),o),h);break}break;case Date:switch((M=s.inputType)!=null||(s.inputType="datetime"),s.inputType){case"date":case"datetime":case"datetime-local":case"time":a=f(Yo||(Yo=p(["","\n              ","\n              "])),this._renderInput(n,c,l,u,e,s,r.toISOString(),o),h);break}break;case Number:switch((H=s.inputType)!=null||(s.inputType="number"),s.inputType){case"number":case"range":a=f(Ko||(Ko=p(["","\n              ","\n              "])),this._renderInput(n,c,l,u,e,s,r,o),h);break}break;case Boolean:switch((I=s.inputType)!=null||(s.inputType="checkbox"),s.inputType){case"checkbox":a=f(Jo||(Jo=p(["","\n              ","\n              "])),this._renderCheckbox(n,c,l,u,e,s,r,o),h);break}break;case Array:switch((C=s.inputType)!=null||(s.inputType="text"),s.inputType){case"text":case"color":case"date":case"datetime":case"datetime-local":case"email":case"file":case"image":case"month":case"number":case"password":case"range":case"tel":case"time":case"url":case"week":r.constructor!==Array&&(r=r?[r]:[]),a=f(Xo||(Xo=p(["","\n              ","\n              "])),this._renderInput(n,c,l,u,e,s,(de=(U=(N=r==null?void 0:r.join(($=s.separator)!=null?$:","))!=null?N:r)!=null?U:s.default)!=null?de:"",o),h);break;case"textarea":r.constructor!==Array&&(r=r?[r]:[]),a=f(Zo||(Zo=p(["","\n              ","\n              "])),this._renderTextarea(n,c,l,u,e,s,(je=(Fe=(ye=r==null?void 0:r.join((re=s.separator)!=null?re:","))!=null?ye:r)!=null?Fe:s.default)!=null?je:"",o),h);break;case"tags":r.constructor!==Array&&(r=r?[r]:[]),a=f(Qo||(Qo=p(["","\n              ","\n              "])),this._renderTagsInput(n,c,l,u,e,s,r,o),h);break}}a||this.logger.warn("value type '".concat(r.constructor.toString(),"' is incompatible")+"with field type '".concat(s.inputType,"' for form entry '").concat(e.toString(),"'."));let m=["form-group"];return s.colClassList&&m.push(...s.colClassList),f(es||(es=p(["<td class=",">","</td>"])),m.join(" "),a)};this._renderInput=(e,r,n,o,s,a,l,c)=>{var u;return f(rs||(rs=p(["<input\n      type=","\n      name=","\n      class=","\n      id=","\n      title=",'\n      aria-describedby="','-feedback"\n      list=',"\n      min=","\n      max=","\n      minlength=","\n      maxlength=","\n      @change=","\n      .value=","\n    />\n    ",""])),a.inputType,n,L(Object.assign({"form-control":!0},this._getInputValidationClass(s,c))),r,S(o),r,S(a.datalist?r+"-datalist":void 0),S(a.min),S(a.max),S(a.minlength),S(a.maxlength),h=>this._updatePropertyFromValue(h,s,a,e),l,a.datalist?f(is||(is=p(["<datalist id=",">\n      ","\n    </datalist>"])),r+"-datalist",((u=a.datalist)!=null?u:[]).map(h=>f(ts||(ts=p(["<option value=",">"])),h.toString()))):E)};this._renderTagsInput=(e,r,n,o,s,a,l,c)=>{var u;return f(ns||(ns=p(["<livechat-tags-input\n      .name=","\n      class=","\n      id=","\n      .inputTitle=",'\n      aria-describedby="','-feedback"\n      .min=',"\n      .max=","\n      .minlength=","\n      .maxlength=","\n      .datalist=","\n      .separator=","\n      @change=","\n      .value=","\n      ></livechat-tags-input>"])),n,L(Object.assign({"form-control":!0},this._getInputValidationClass(s,c))),r,o,r,a.min,a.max,a.minlength,a.maxlength,a.datalist,(u=a.separator)!=null?u:"\n",h=>this._updatePropertyFromValue(h,s,a,e),l)};this._renderTextarea=(e,r,n,o,s,a,l,c)=>f(os||(os=p(["<textarea\n      name=","\n      class=","\n      id=","\n      title=",'\n      aria-describedby="','-feedback"\n      min=',"\n      max=","\n      minlength=","\n      maxlength=","\n      @change=","\n      .value=","></textarea>"])),n,L(Object.assign({"form-control":!0},this._getInputValidationClass(s,c))),r,S(o),r,S(a.min),S(a.max),S(a.minlength),S(a.maxlength),u=>this._updatePropertyFromValue(u,s,a,e),l);this._renderCheckbox=(e,r,n,o,s,a,l,c)=>f(ss||(ss=p(['<input\n      type="checkbox"\n      name=',"\n      class=","\n      id=","\n      title=",'\n      aria-describedby="','-feedback"\n      @change=','\n      value="1"\n      ?checked='," />"])),n,L(Object.assign({"form-check-input":!0},this._getInputValidationClass(s,c))),r,S(o),r,u=>this._updatePropertyFromValue(u,s,a,e),l);this._renderSelect=(e,r,n,o,s,a,l,c)=>{var u,h;return f(ls||(ls=p(["<select\n      class=","\n      id=","\n      title=",'\n      aria-describedby="','-feedback"\n      aria-label=',"\n      @change=","\n    >\n      <option ?selected=",">","</option>\n      ","\n    </select>"])),L(Object.assign({"form-select":!0},this._getInputValidationClass(s,c))),r,S(o),r,n,m=>this._updatePropertyFromValue(m,s,a,e),!l,o!=null?o:"",(h=Object.entries((u=a.options)!=null?u:{}))==null?void 0:h.map(([m,b])=>f(as||(as=p(["<option ?selected="," value=",">","</option>"])),l===m,m,b)))};this._renderImageFileInput=(e,r,n,o,s,a,l,c)=>f(cs||(cs=p(["<livechat-image-file-input\n      .name=","\n      class=","\n      id=","\n      .inputTitle=",'\n      aria-describedby="','-feedback"\n      @change=',"\n      .value=","\n      .maxSize=","\n      .accept=","\n    ></livechat-image-file-input>"])),n,L(this._getInputValidationClass(s,c)),r,o,r,u=>this._updatePropertyFromValue(u,s,a,e),l,30720,Sr);this._getInputValidationClass=(e,r)=>{var o;let n=(o=this.validation)==null?void 0:o["".concat(this.validationPrefix,".").concat(r,".").concat(e)
1];return n!==void 0?n.length?{"is-invalid":!0}:{"is-valid":!0}:{}};this._renderFeedback=(e,r,n)=>{var a;let o=[],s=(a=this.validation)==null?void 0:a["".concat(this.validationPrefix,".").concat(n,".").concat(r)];return s!==void 0&&s.length!==0?(s.includes(0)&&o.push(f(us||(us=p(["",""])),d("This value is required."))),s.includes(1)&&o.push(f(ds||(ds=p(["",""])),d("Value is of the wrong type."))),s.includes(2)&&o.push(f(hs||(hs=p(["",""])),d("Value is in the wrong format."))),s.includes(3)&&o.push(f(ps||(ps=p(["",""])),d("Value is not in authorized range."))),s.includes(4)&&o.push(f(fs||(fs=p(["",""])),d("Duplicate value"))),s.includes(5)&&o.push(f(ms||(ms=p(["",""])),d("Value too long"))),f(gs||(gs=p(['<div id="','-feedback" class="invalid-feedback">',"</div>"])),e,o)):E};this._updatePropertyFromValue=(e,r,n,o)=>{var c;let s=e.target,a=s?s instanceof HTMLInputElement&&s.type==="checkbox"?!!s.checked:s.value:void 0;if(a===void 0){this.logger.warn("Could not update property : Target or value was undefined");return}let l=this._rowsById.find(u=>u._id===o);if(!l){this.logger.warn("Could not update property : Did not find a property named '".concat(r,"' in row '").concat(o,"'"));return}switch((c=n.default)==null?void 0:c.constructor){case Array:a.constructor===Array||!n.separator?l.row[r]=a:l.row[r]=a.split(n.separator);break;case Number:l.row[r]=Number(a);break;default:l.row[r]=a;break}this.rows=this._rowsById.map(u=>u.row),this.requestUpdate("rows"),this.requestUpdate("_rowsById"),this.dispatchEvent(new CustomEvent("update",{detail:this.rows}))}}async _addRow(){var n;let e=this._getDefaultRow();this._rowsById.push({_id:this._lastRowId++,_originalIndex:this.rows.length,row:e}),this.rows.push(e),this.requestUpdate("rows"),this.requestUpdate("_rowsById"),this.dispatchEvent(new CustomEvent("update",{detail:this.rows})),await this.updateComplete;let r=(n=this.querySelector("table"))==null?void 0:n.querySelector("&>tbody>tr:last-child>td input:not([type=hidden]),&>tbody>tr:last-child>td livechat-tags-input,&>tbody>tr:last-child>td textarea");r&&r.focus()}async _removeRow(e){let r=await this.ptTranslate("Are you sure you want to remove this entry?");await new Promise((o,s)=>{this.ptOptions.peertubeHelpers.showModal({title:r,content:"",close:!0,cancel:{value:"cancel",action:s},confirm:{value:"confirm",action:o}})});let n=this._rowsById.filter(o=>o._id===e).map(o=>o.row)[0];this._rowsById=this._rowsById.filter(o=>o._id!==e),this.rows=this.rows.filter(o=>o!==n),this.requestUpdate("rows"),this.requestUpdate("_rowsById"),this.dispatchEvent(new CustomEvent("update",{detail:this.rows}))}_renderHeaderDescriptionCell(e){var n;let r=["livechat-dynamic-table-form-description-header"];return e.headerClassList&&r.push(...e.headerClassList),f(Ho||(Ho=p(['<th scope="col" class=',">\n      ","\n    </th>"])),r.join(" "),(n=e.description)!=null?n:"")}};g([_({attribute:!1})],X.prototype,"header",2),g([_({attribute:!1})],X.prototype,"schema",2),g([_({attribute:!1})],X.prototype,"maxLines",2),g([_()],X.prototype,"validation",2),g([_({attribute:!1})],X.prototype,"validationPrefix",2),g([_({attribute:!1})],X.prototype,"rows",2),g([k()],X.prototype,"_rowsById",2),g([_({attribute:!1})],X.prototype,"formName",2),g([k()],X.prototype,"_lastRowId",2),g([_({attribute:!1})],X.prototype,"columnOrder",2),X=g([T("livechat-dynamic-table-form")],X);var bs,vs,_s,Ne=class extends O{constructor(){super(...arguments);this.label="???";this.render=()=>f(_s||(_s=p(["\n      <h2>\n        ","\n        ","\n      </h2>\n      ",""])),this.label,this.helpPage===void 0?"":f(bs||(bs=p(["<livechat-help-button .page=","></livechat-help-button>"])),this.helpPage),this.description===void 0?"":f(vs||(vs=p(["<p>","</p>"])),this.description))}};g([_({attribute:!1})],Ne.prototype,"label",2),g([_({attribute:!1})],Ne.prototype,"description",2),g([_({attribute:!1})],Ne.prototype,"helpPage",2),Ne=g([T("livechat-configuration-section-header")],Ne);var Mi=new WeakMap;var Cs=0,Hi=new Map,ys=new WeakSet,Vi=()=>new Promise(i=>requestAnimationFrame(i));var Wt=[{opacity:0}];var zt=[{opacity:0},{opacity:1}];var Es=(i,t)=>{let e=i-t;return e===0?void 0:e},Os=(i,t)=>{let e=i/t;return e===1?void 0:e},qt={left:(i,t)=>{let e=Es(i,t);return{value:e,transform:e==null||isNaN(e)?void 0:"translateX(".concat(e,"px)")}},top:(i,t)=>{let e=Es(i,t);return{value:e,transform:e==null||isNaN(e)?void 0:"translateY(".concat(e,"px)")}},width:(i,t)=>{let e;t===0&&(t=1,e={width:"1px"});let r=Os(i,t);return{value:r,overrideFrom:e,transform:r==null||isNaN(r)?void 0:"scaleX(".concat(r,")")}},height:(i,t)=>{let e;t===0&&(t=1,e={height:"1px"});let r=Os(i,t);return{value:r,overrideFrom:e,transform:r==null||isNaN(r)?void 0:"scaleY(".concat(r,")")}}},$s={duration:333,easing:"ease-in-out"}
1,Ts=["left","top","width","height","opacity","color","background"],As=new WeakMap,Gt=class extends me{constructor(t){if(super(t),this.t=!1,this.i=null,this.o=null,this.h=!0,this.shouldLog=!1,t.type===ee.CHILD)throw Error("The `animate` directive must be used in attribute position.");this.createFinished()}createFinished(){var t;(t=this.resolveFinished)==null||t.call(this),this.finished=new Promise(e=>{this.l=e})}async resolveFinished(){var t;(t=this.l)==null||t.call(this),this.l=void 0}render(t){return E}getController(){return Mi.get(this.u)}isDisabled(){var t;return this.options.disabled||((t=this.getController())==null?void 0:t.disabled)}update(t,[e]){var n;let r=this.u===void 0;return r&&(this.u=(n=t.options)==null?void 0:n.host,this.u.addController(this),this.u.updateComplete.then(o=>this.t=!0),this.element=t.element,As.set(this.element,this)),this.optionsOrCallback=e,(r||typeof e!="function")&&this.p(e),this.render(e)}p(t){var r;t=t!=null?t:{};let e=this.getController();e!==void 0&&((t=D(D({},e.defaultOptions),t)).keyframeOptions=D(D({},e.defaultOptions.keyframeOptions),t.keyframeOptions)),(r=t.properties)!=null||(t.properties=Ts),this.options=t}m(){let t={},e=this.element.getBoundingClientRect(),r=getComputedStyle(this.element);return this.options.properties.forEach(n=>{var a;let o=(a=e[n])!=null?a:qt[n]?void 0:r[n],s=Number(o);t[n]=isNaN(s)?o+"":s}),t}v(){let t,e=!0;return this.options.guard&&(t=this.options.guard(),e=((r,n)=>{if(Array.isArray(r)){if(Array.isArray(n)&&n.length===r.length&&r.every((o,s)=>o===n[s]))return!1}else if(n===r)return!1;return!0})(t,this._)),this.h=this.t&&!this.isDisabled()&&!this.isAnimating()&&e&&this.element.isConnected,this.h&&(this._=Array.isArray(t)?Array.from(t):t),this.h}hostUpdate(){var t;typeof this.optionsOrCallback=="function"&&this.p(this.optionsOrCallback()),this.v()&&(this.A=this.m(),this.i=(t=this.i)!=null?t:this.element.parentNode,this.o=this.element.nextSibling)}async hostUpdated(){if(!this.h||!this.element.isConnected||this.options.skipInitial&&!this.isHostRendered)return;let t;this.prepare(),await Vi;let e=this.O(),r=this.j(this.options.keyframeOptions,e),n=this.m();if(this.A!==void 0){let{from:o,to:s}=this.N(this.A,n,e);this.log("measured",[this.A,n,o,s]),t=this.calculateKeyframes(o,s)}else{let o=Hi.get(this.options.inId);if(o){Hi.delete(this.options.inId);let{from:s,to:a}=this.N(o,n,e);t=this.calculateKeyframes(s,a),t=this.options.in?[D(D({},this.options.in[0]),t[0]),...this.options.in.slice(1),t[1]]:t,Cs++,t.forEach(l=>l.zIndex=Cs)}else this.options.in&&(t=[...this.options.in,{}])}this.animate(t,r)}resetStyles(){var t;this.P!==void 0&&(this.element.setAttribute("style",(t=this.P)!=null?t:""),this.P=void 0)}commitStyles(){var t,e;this.P=this.element.getAttribute("style"),(t=this.webAnimation)==null||t.commitStyles(),(e=this.webAnimation)==null||e.cancel()}reconnected(){}async disconnected(){var e;if(!this.h||(this.options.id!==void 0&&Hi.set(this.options.id,this.A),this.options.out===void 0))return;if(this.prepare(),await Vi(),(e=this.i)==null?void 0:e.isConnected){let r=this.o&&this.o.parentNode===this.i?this.o:null;if(this.i.insertBefore(this.element,r),this.options.stabilizeOut){let n=this.m();this.log("stabilizing out");let o=this.A.left-n.left,s=this.A.top-n.top;getComputedStyle(this.element).position!=="static"||o===0&&s===0||(this.element.style.position="relative"),o!==0&&(this.element.style.left=o+"px"),s!==0&&(this.element.style.top=s+"px")}}let t=this.j(this.options.keyframeOptions);await this.animate(this.options.out,t),this.element.remove()}prepare(){this.createFinished()}start(){var t,e;(e=(t=this.options).onStart)==null||e.call(t,this)}didFinish(t){var e,r;t&&((r=(e=this.options).onComplete)==null||r.call(e,this)),this.A=void 0,this.animatingProperties=void 0,this.frames=void 0,this.resolveFinished()}O(){let t=[];for(let e=this.element.parentNode;e;e=e==null?void 0:e.parentNode){let r=As.get(e);r&&!r.isDisabled()&&r&&t.push(r)}return t}get isHostRendered(){let t=ys.has(this.u);return t||this.u.updateComplete.then(()=>{ys.add(this.u)}),t}j(t,e=this.O()){let r=D({},$s);return e.forEach(n=>Object.assign(r,n.options.keyframeOptions)),Object.assign(r,t),r}N(t,e,r){t=D({},t),e=D({},e);let n=r.map(a=>a.animatingProperties).filter(a=>a!==void 0),o=1,s=1;return n.length>0&&(n.forEach(a=>{a.width&&(o/=a.width),a.height&&(s/=a.height)}),t.left!==void 0&&e.left!==void 0&&(t.left=o*t.left,e.left=o*e.left),t.top!==void 0&&e.top!==void 0&&(t.top=s*t.top,e.top=s*e.top)),{from:t,to:e}}calculateKeyframes(t,e,r=!1){var l;let n={},o={},s=!1,a={};for(let c in e){let u=t[c],h=e[c];if(c in qt){let m=qt[c];if(u===void 0||h===void 0)continue;let b=m(u,h);b.transform!==void 0&&(a[c]=b.value,s=!0,n.transform="".concat((l=n.transform)!=null?l:""," ").concat(b.transform),b.overrideFrom!==void 0&&Object.assign(n,b.overrideFrom))}else u!==h&&u!==void 0&&h!==void 0&&(s=!0,n[c]=u,o[c]=h)}
1return n.transformOrigin=o.transformOrigin=r?"center center":"top left",this.animatingProperties=a,s?[n,o]:void 0}async animate(t,e=this.options.keyframeOptions){this.start(),this.frames=t;let r=!1;if(!this.isAnimating()&&!this.isDisabled()&&(this.options.onFrames&&(this.frames=t=this.options.onFrames(this),this.log("modified frames",t)),t!==void 0)){this.log("animate",[t,e]),r=!0,this.webAnimation=this.element.animate(t,e);let n=this.getController();n==null||n.add(this);try{await this.webAnimation.finished}catch(o){}n==null||n.remove(this)}return this.didFinish(r),r}isAnimating(){var t,e;return((t=this.webAnimation)==null?void 0:t.playState)==="running"||((e=this.webAnimation)==null?void 0:e.pending)}log(t,e){this.shouldLog&&!this.isDisabled()&&console.log(t,this.options.id,e)}},Yt=Q(Gt);var Ml=["top","right","bottom","left"],Kt=class extends me{constructor(t){if(super(t),t.type!==ee.ELEMENT)throw Error("The `position` directive must be used in attribute position.")}render(t,e){return E}update(t,[e,r]){var n;return this.u===void 0&&(this.u=(n=t.options)==null?void 0:n.host,this.u.addController(this)),this.S=t.element,this.C=e,this.F=r!=null?r:["left","top","width","height"],this.render(e,r)}hostUpdated(){this.$()}$(){var o,s;let t=typeof this.C=="function"?this.C():(o=this.C)==null?void 0:o.value,e=t.offsetParent;if(t===void 0||!e)return;let r=t.getBoundingClientRect(),n=e.getBoundingClientRect();(s=this.F)==null||s.forEach(a=>{let l=Ml.includes(a)?r[a]-n[a]:r[a];this.S.style[a]=l+"px"})}},Hl=Q(Kt);var Vl='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 4.233 4.233">\n  <g style="stroke-width:1.00021;stroke-miterlimit:4;stroke-dasharray:none"><path style="opacity:.998;fill:none;fill-opacity:1;stroke:currentColor;stroke-width:1.17052;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="m4.084 4.046-.616.015-.645-.004a.942.942 0 0 1-.942-.942v-4.398a.94.94 0 0 1 .942-.943H7.22a.94.94 0 0 1 .942.943l-.006.334-.08.962" transform="matrix(.45208 0 0 .45208 -.528 1.295)"/><path style="opacity:.998;fill:none;fill-opacity:1;stroke:currentColor;stroke-width:1.17052;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M8.434 5.85c-.422.009-1.338.009-1.76.01-.733.004-2.199 0-2.199 0a.94.94 0 0 1-.942-.941V.52a.94.94 0 0 1 .942-.942h4.398a.94.94 0 0 1 .943.942s.004 1.466 0 2.2c-.003.418-.019 1.251-.006 1.67.024.812-.382 1.439-1.376 1.46z" transform="matrix(.45208 0 0 .45208 -.528 1.295)"/></g>\n</svg>',Ls,ws,Rs,Ss,ks,xs,F=class extends O{constructor(){super(...arguments);this._inputValue="";this.inputTitle="";this.value=[];this._searchedTagsIndex=[];this._isPressingKey=[];this.separator="\n";this.animDuration=200;this.render=()=>{var e,r,n,o,s,a;return f(xs||(xs=p(["\n      <div class=","\n      >\n        <ul\n          class=",">\n            ","\n          </ul>\n          ","\n      </div>\n        <ul class=","\n        >\n          ",'\n        </ul>\n        <input\n        type="text"\n        name=','\n        id="','-input"\n        list="','-input-datalist"\n        min=',"\n        max=","\n        minlength=","\n        maxlength=","\n        @paste=","\n        @keydown=","\n        @keyup=","\n        @input=","\n        @change=","\n        .value=","\n        title="," />\n        ",""])),L({"livechat-empty":!this.value.length,"livechat-tags-container":!0}),L({"livechat-empty":!this.value.length,"livechat-unfocused":this._searchedTagsIndex.length,"livechat-tags":!0}),Ie(this.value,l=>l,(l,c)=>f(Ls||(Ls=p(["<li key=",' class="livechat-tag" title='," ",">\n                <span class='livechat-tag-name'>","</span>\n                <span class='livechat-tag-close'\n                      @click=","></span>\n              </li>"])),c,l,Yt({keyframeOptions:{duration:this.animDuration,fill:"both"},in:zt,out:Wt}),l,()=>this._handleDeleteTag(c))),((e=this.value)==null?void 0:e.length)===0?"":f(ws||(ws=p(['<button\n                type="button"\n                class="peertube-plugin-livechat-tags-input-copy"\n                title=',"\n                @click=","\n              >","</button>"])),d("Copy"),async l=>{l.preventDefault(),await navigator.clipboard.writeText(this.value.join(this.separator)),this.ptNotifier.success(await this.ptTranslate("C
1opied"))},te(Vl)),L({"livechat-empty":!this._searchedTagsIndex.length,"livechat-tags-searched":!0}),Ie(this._searchedTagsIndex,l=>l,l=>f(Rs||(Rs=p(["<li key=",' class="livechat-tag-searched" title='," ",">\n              <span class='livechat-tag-name'>","</span>\n              <span class='livechat-tag-close'\n                    @click=",">\n              </span>\n            </li>"])),l,this.value[l],Yt({keyframeOptions:{duration:this.animDuration,fill:"both"},in:zt,out:Wt}),this.value[l],()=>this._handleDeleteTag(l))),S(this.name),(r=this.id)!=null?r:"tags-input",(n=this.id)!=null?n:"tags-input",S(this.min),S(this.max),S(this.minlength),S(this.maxlength),l=>this._handlePaste(l),l=>this._handleKeyDown(l),l=>this._handleKeyUp(l),l=>this._handleInputEvent(l),l=>l.stopPropagation(),(o=this._inputValue)!=null?o:"",S(this.inputTitle),this.datalist?f(ks||(ks=p(['<datalist id="','-datalist">\n            ',"\n          </datalist>"])),(s=this.id)!=null?s:"tags-input",((a=this.datalist)!=null?a:[]).map(l=>f(Ss||(Ss=p(["<option value=",">"])),l))):"")};this._handlePaste=e=>{var n,o,s,a,l,c,u,h,m,b,y,A;let r=e==null?void 0:e.target;if(r){e.preventDefault();let x="".concat((l=(a=r==null?void 0:r.value)==null?void 0:a.slice(0,(s=(o=r.selectionStart)!=null?o:(n=r==null?void 0:r.value)==null?void 0:n.length)!=null?s:0))!=null?l:"").concat((u=(c=e.clipboardData)==null?void 0:c.getData("text/plain"))!=null?u:"").concat((A=(y=r==null?void 0:r.value)==null?void 0:y.slice((b=(m=r.selectionEnd)!=null?m:(h=r==null?void 0:r.value)==null?void 0:h.length)!=null?b:0))!=null?A:"").split(this.separator);if(x=x.map(M=>M.trim()).filter(M=>M!==""),x.length>0)return r.value="",this.value=[...new Set([...this.value,...x])],this._inputValue=r.value,this._updateSearchedTags(),this.requestUpdate("value"),this.dispatchEvent(new CustomEvent("change",{detail:this.value})),!1}return!0};this._handleKeyDown=e=>{let r=e==null?void 0:e.target;if(r)switch(e.key){case"Enter":if(!this._isPressingKey.includes(e.key))this._isPressingKey.push(e.key);else return e.preventDefault(),!1;return r.value===""?(this._isPressingKey.push(e.key),!0):(e.preventDefault(),this._handleNewTag(e),!1);case"Backspace":this._isPressingKey.includes(e.key)||(this._isPressingKey.push(e.key),r.selectionStart===r.selectionEnd&&r.selectionStart===0&&this._handleDeleteTag(this._searchedTagsIndex.length?this._searchedTagsIndex.slice(-1)[0]:this.value.length-1));break;case"Delete":this._isPressingKey.includes(e.key)||(this._isPressingKey.push(e.key),r.selectionStart===r.selectionEnd&&r.selectionStart===r.value.length&&this._handleDeleteTag(this._searchedTagsIndex.length?this._searchedTagsIndex[0]:0));break;default:break}return!0};this._handleKeyUp=e=>{if(e==null?void 0:e.target)switch(e.key){case"Enter":case"Backspace":case"Delete":this._isPressingKey.includes(e.key)&&this._isPressingKey.splice(this._isPressingKey.indexOf(e.key));break;default:break}return!0};this._handleInputEvent=e=>{let r=e==null?void 0:e.target;return r&&(this._inputValue=r.value,this.separator===r.value.slice(-1)?(e.preventDefault(),r.value=r.value.slice(0,-1),this._handleNewTag(e)):this._updateSearchedTags()),!0};this._handleNewTag=e=>{let r=e==null?void 0:e.target;r&&(this._addTag(r.value),r.value="",this._inputValue="",this._updateSearchedTags())};this._handleDeleteTag=e=>{this._removeTag(e),this._updateSearchedTags()};this._updateSearchedTags=()=>{var n;let e=[],r=(n=this._inputValue)==null?void 0:n.trim();if(r!=null&&r.length)for(let[o,s]of this.value.entries())s.toLowerCase().includes(r.toLowerCase())&&e.push(o);this._searchedTagsIndex=e,this.requestUpdate("_searchedTagsIndex")};this._addTag=e=>{if(e===void 0){this.logger.warn("Could not add tag : Target or value was undefined");return}e=e.trim(),e&&(this.value.push(e),this.value=[...new Set(this.value)],this.requestUpdate("value"),this.dispatchEvent(new CustomEvent("change",{detail:this.value})))};this._removeTag=e=>{if(e<0||e>=this.value.length){this.logger.warn("Could not remove tag : index out of range");return}this.value.splice(e,1),this.requestUpdate("value"),this.dispatchEvent(new CustomEvent("change",{detail:this.value}))}}focus(){let e=this.querySelector("input[type=text]");if(e){e.focus();return}this.updateComplete.then(()=>{let r=this.querySelector("input[type=text]");r&&r.focus()},()=>{})}};g([_({attribute:!1})],F.prototype,"name",2),g([_({attribute:!1})],F.prototype,"min",2),g([_({attribute:!1})],F.prototype,"max",2),g([_({attribute:!1})],F.prototype,"maxlength",2),g([_({attribute:!1})],F.prototype,"minlength",2),g([k()],F.prototype,"_inputValue",2),g([_({attribute:!1})],F.prototype,"inputTitle",2),g([_({attribute:!1})],F.prototype,"datalist",2),g([_({reflect:!0,type:Array})],F.prototype,"value",2),g([k()],F.prototype,"_searchedTagsIndex",2),g([k()],F.prototype,"_isPressingKey",2),g([_({attribute:!1})],F.prototype,"separator",2),g([_({attribute:!1})],F.prototype,"animDuration",2),F=g([T("livechat-tags-input")],F);var Is,Ns,ue=class extends O{constructor(){super(...arguments);this.accept=["image/jpg","image/png","image/gif"];this.render=()=>f(Ns||(Ns=p(["\n      ",'\n      <input\n        type="file"\n        title=','\n        accept="','"\n        class="form-control"\n        style=',"\n        @change=","\n      />\n    "])),this.value?f(Is||(Is=p(["<img src="," alt="," @click="," />"])),this.value,S(this.inputTitle),e=>{var n;e.preventDefault();let r=(n=this.parentElement)==null?void 0:n.querySelector('input[type="file"]');r==null||r.click()}):"",S(this.inputTitle),this.accept.join(","),this.value?"display: none;":"",async e=>this._upload(e))}async _upload(e){var o;e.preventDefault(),e.stopImmediatePropagation();let n=(o=e.target.files)==null?void 0:o[0];if(n){if(this.maxSize&&n.size>this.maxSize){let s=await this.ptTranslate("File size is too big (max size: %s).");s&&(s=s.replace("%s",Math.round(this.maxSize/1024).toString()+"k"),this.ptNotifier.error(s));return}try{let s=await new Promise((l,c)=>{let u=new FileReader;u.onload=()=>
1{if(u.result===null){c(new Error("Empty result"));return}u.result instanceof ArrayBuffer?c(new Error("Result is an ArrayBuffer, this was not intended")):l(u.result)},u.onerror=c,u.readAsDataURL(n)});this.value=s;let a=new Event("change");this.dispatchEvent(a)}catch(s){this.logger.error(s)}}}};g([_({attribute:!1})],ue.prototype,"name",2),g([_({reflect:!0})],ue.prototype,"value",2),g([_({attribute:!1})],ue.prototype,"maxSize",2),g([_({attribute:!1})],ue.prototype,"inputTitle",2),g([_({attribute:!1})],ue.prototype,"accept",2),ue=g([T("livechat-image-file-input")],ue);var Ds,Jt=class extends O{constructor(){super(...arguments);this.render=()=>f(Ds||(Ds=p(["<div></div>"])))}};Jt=g([T("livechat-spinner")],Jt);var Xt=class{constructor(){this._headers={};var t;this._headers=(t=z().ptOptions.peertubeHelpers.getAuthHeader())!=null?t:{},this._headers["content-type"]="application/json;charset=UTF-8",this._apiUrl=V(z().ptOptions)+"/api/auth/tokens"}async fetchTokenList(){let t=await fetch(this._apiUrl,{method:"GET",headers:this._headers});if(!t.ok)throw new Error("Can't get livechat token list.");return t.json()}async createToken(t){let e=await fetch(this._apiUrl,{method:"POST",headers:this._headers,body:JSON.stringify({label:t})});if(!e.ok)throw new Error("Can't create livechat token.");return e.json()}async revokeToken(t){let e=await fetch(this._apiUrl+"/"+encodeURIComponent(t.id),{method:"DELETE",headers:this._headers});if(!e.ok)throw new Error("Can't delete livechat token.");return e.json()}};var Ps,Us,Ms;function Hs(i){var t;return f(Ms||(Ms=p(['<div class="table-responsive">\n    <table class="table">\n      <thead>\n        <tr>\n          <th scope="col"></th>\n          <th scope="col">','</th>\n          <th scope="col">','</th>\n          <th scope="col"></th>\n        </tr>\n      </thead>\n      <tbody>\n        ','\n      </tbody>\n      <tfoot>\n        <tr>\n          <td>\n          <button type="button"\n            class="livechat-create-token"\n            .title=',"\n            ?disabled=","\n            @click=","\n          >\n            ","\n          </button>\n          </td>\n        </tr>\n      </tfoot>\n    </table>\n  </div>"])),d("Label"),d("Date"),Ie((t=i.tokenList)!=null?t:[],e=>e.id,e=>{var n;let r="";try{let o=new Date(e.date);r=o.toLocaleDateString()+" "+o.toLocaleTimeString()}catch(o){}return f(Us||(Us=p(["<tr>\n              <td>","</td>\n              <td>\n                <label for=",">\n                  ","\n                </label>\n              </td>\n              <td>\n                <label for=",">\n                  ",'\n                </label>\n              </td>\n              <td>\n                <button type="button"\n                  class="livechat-revoke-token"\n                  .title=',"\n                  ?disabled=","\n                  @click=","\n                >\n                  ","\n                </button>\n              </td>\n            </tr>"])),i.mode==="select"?f(Ps||(Ps=p(['<input\n                  type="radio"\n                  name="livechat-token"\n                  value=',"\n                  id=","\n                  ?checked=","\n                  @click=","\n                />"])),e.id,"livechat-token-radio-".concat(e.id),((n=i.currentSelectedToken)==null?void 0:n.id)===e.id,o=>i.selectToken(o,e)):"","livechat-token-radio-".concat(e.id),e.label,"livechat-token-radio-".concat(e.id),r,d("Revoke the token"),i.actionDisabled,()=>{i.revokeToken(e).then(()=>{},()=>{})},te(jt))}),d("Create a new token"),i.actionDisabled,()=>{i.createToken().then(()=>{},()=>{})},te(Ft))}var Vs,Bs,Ce=class extends O{constructor(){super();this.mode="list";this.actionDisabled=!1;this.render=()=>this._asyncTaskRender.render({pending:()=>f(Vs||(Vs=p(["<livechat-spinner></livechat-spinner>"]))),error:()=>f(Bs||(Bs=p(["<livechat-error></livechat-error>"]))),complete:()=>Hs(this)});this._tokenListService=new Xt,this._asyncTaskRender=this._initTask()}_initTask(){return new Y(this,{task:async()=>{this.tokenList=await this._tokenListService.fetchTokenList(),this.mode==="select"&&this.tokenList.length&&(this.currentSelectedToken=this.tokenList[0],this.dispatchEvent(new CustomEvent("update",{}))),this.actionDisabled=!1},args:()=>[]})}selectToken(e,r){var n;(n=this.tokenList)!=null&&n.includes(r)&&(this.currentSelectedToken=r,this.requestUpdate("tokenList"),this.dispatchEvent(new CustomEvent("update",{})))}async revokeToken(e){var n,o;let r=await this.ptTranslate("Are you sure you want to revoke this token?");if(window.confirm(r)){this.actionDisabled=!0;try{await this._tokenListService.revokeToken(e),this.tokenList=(o=(n=this.tokenList)==null?void 0:n.filter(s=>s!==e))!=null?o:[],this.currentSelectedToken===e&&(this.currentSelectedToken=void 0),this.requestUpdate("tokenList"),this.dispatchEvent(new CustomEvent("update",{}))}catch(s){this.logger.error(s),this.ptNotifier.error(s.toString(),await this.ptTranslate("Error"))}finally{this.actionDisabled=!1}}}async createToken(){var e;this.actionDisabled=!0;try{let r=await this._tokenListService.createToken(await this.ptTranslate("Token generated from the web interface"));(e=this.tokenList)!=null||(this.tokenList=[]),this.tokenList.push(r),this.mode==="select"&&(this.currentSelectedToken=r),this.requestUpdate("tokenList"),this.dispatchEvent(new CustomEvent("update",{}))}catch(r){this.logger.error(r),this.ptNotifier.error(r.toString(),await this.ptTranslate("Error"))}finally{this.actionDisabled=!1}}};g([_({attribute:!0})],Ce.prototype,"mode",2),g([_({attribute:!1})],Ce.prototype,"tokenList",2),g([_({attribute:!1})],Ce.prototype,"currentSelectedToken",2),g([_({attribute:!1})],Ce.prototype,"actionDisabled",2),Ce=g([T("livechat-token-list")],Ce);var Fs,rt=class extends O{constructor(){super(...arguments);this.msg=d("An error occured while loading data.");this.render=()=>f(Fs||(Fs=p(["",""])),this.msg)}};g([_({attribute:!1})],rt.prototype,"msg",2),rt=g([T("livechat-error")],rt);async function qg(i){let{peertubeHelpers:t,registerHook:e,registerVideoField:r}=i;Tr(i),e({target:"action:router.navigation-end",handler:()=>{var c;
1let l=document.querySelector("#peertube-plugin-livechat-container");if(l){let u=l.getAttribute("peertube-plugin-livechat-current-url");if(u&&u===window.location.href){console.warn("[peertube-plugin-livechat navigation-end] It seems that action:router.navigation-end was called after action:video-watch.video.loaded. Not removing the chat from the DOM.");return}l.remove()}(c=window.converse)!=null&&c.livechatDisconnect&&window.converse.livechatDisconnect()}});let[n,o,s]=await Promise.all([t.translate("Use chat"),t.translate("If enabled, there will be a chat next to the video."),t.getSettings()]),a={name:"livechat-active",label:n,descriptionHTML:o,type:"input-checkbox",default:!0,hidden:({liveVideo:l})=>!!(!l||!s["chat-per-live-video"]||s["chat-all-lives"])};r(a,{type:"update"}),r(a,{type:"go-live"}),await Promise.all([Oo(),Ao(i),ln(i),Io(i)])}export{qg as register};
2/*! Bundled license information:
3
4@lit/reactive-element/css-tag.js:
5  (**
6   * @license
7   * Copyright 2019 Google LLC
8   * SPDX-License-Identifier: BSD-3-Clause
9   *)
10
11@lit/reactive-element/reactive-element.js:
12lit-html/lit-html.js:
13lit-element/lit-element.js:
14@lit/reactive-element/decorators/custom-element.js:
15@lit/reactive-element/decorators/property.js:
16@lit/reactive-element/decorators/state.js:
17@lit/reactive-element/decorators/event-options.js:
18@lit/reactive-element/decorators/base.js:
19@lit/reactive-element/decorators/query.js:
20@lit/reactive-element/decorators/query-all.js:
21@lit/reactive-element/decorators/query-async.js:
22@lit/reactive-element/decorators/query-assigned-nodes.js:
23lit-html/directive.js:
24lit-html/async-directive.js:
25lit-html/directives/unsafe-html.js:
26@lit/task/task.js:
27@lit/context/lib/decorators/provide.js:
28lit-html/directives/repeat.js:
29  (**
30   * @license
31   * Copyright 2017 Google LLC
32   * SPDX-License-Identifier: BSD-3-Clause
33   *)
34
35lit-html/is-server.js:
36@lit/context/lib/decorators/consume.js:
37  (**
38   * @license
39   * Copyright 2022 Google LLC
40   * SPDX-License-Identifier: BSD-3-Clause
41   *)
42
43@lit/reactive-element/decorators/query-assigned-elements.js:
44@lit/context/lib/context-request-event.js:
45@lit/context/lib/create-context.js:
46@lit/context/lib/controllers/context-consumer.js:
47@lit/context/lib/value-notifier.js:
48@lit/context/lib/controllers/context-provider.js:
49@lit/context/lib/context-root.js:
50  (**
51   * @license
52   * Copyright 2021 Google LLC
53   * SPDX-License-Identifier: BSD-3-Clause
54   *)
55
56lit-html/directive-helpers.js:
57  (**
58   * @license
59   * Copyright 2020 Google LLC
60   * SPDX-License-Identifier: BSD-3-Clause
61   *)
62
63lit-html/directives/class-map.js:
64lit-html/directives/if-defined.js:
65  (**
66   * @license
67   * Copyright 2018 Google LLC
68   * SPDX-License-Identifier: BSD-3-Clause
69   *)
70*/

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.