advanced-chat-kai 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +349 -0
- package/dist/advanced-chat-kai.cjs.js +1949 -0
- package/dist/advanced-chat-kai.es.js +4057 -0
- package/dist/consts/index.d.ts +8 -0
- package/dist/consts/index.d.ts.map +1 -0
- package/dist/index-BAqe5cNa.cjs +4 -0
- package/dist/index-ChjDCgwc.cjs +4 -0
- package/dist/index-DII6YJVm.js +2661 -0
- package/dist/index-FIDC6lfi.js +1422 -0
- package/dist/types/event.d.ts +54 -0
- package/dist/types/event.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/props.d.ts +101 -0
- package/dist/types/props.d.ts.map +1 -0
- package/package.json +94 -0
|
@@ -0,0 +1,1949 @@
|
|
|
1
|
+
"use strict";/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/const rt=globalThis,bt=rt.ShadowRoot&&(rt.ShadyCSS===void 0||rt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,yt=Symbol(),St=new WeakMap;let Dt=class{constructor(t,s,i){if(this._$cssResult$=!0,i!==yt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=s}get styleSheet(){let t=this.o;const s=this.t;if(bt&&t===void 0){const i=s!==void 0&&s.length===1;i&&(t=St.get(s)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&St.set(s,t))}return t}toString(){return this.cssText}};const pe=o=>new Dt(typeof o=="string"?o:o+"",void 0,yt),g=(o,...t)=>{const s=o.length===1?o[0]:t.reduce((i,e,a)=>i+(r=>{if(r._$cssResult$===!0)return r.cssText;if(typeof r=="number")return r;throw Error("Value passed to 'css' function must be a 'css' function result: "+r+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(e)+o[a+1],o[0]);return new Dt(s,o,yt)},ue=(o,t)=>{if(bt)o.adoptedStyleSheets=t.map(s=>s instanceof CSSStyleSheet?s:s.styleSheet);else for(const s of t){const i=document.createElement("style"),e=rt.litNonce;e!==void 0&&i.setAttribute("nonce",e),i.textContent=s.cssText,o.appendChild(i)}},Rt=bt?o=>o:o=>o instanceof CSSStyleSheet?(t=>{let s="";for(const i of t.cssRules)s+=i.cssText;return pe(s)})(o):o;/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2017 Google LLC
|
|
8
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
+
*/const{is:ge,defineProperty:fe,getOwnPropertyDescriptor:ve,getOwnPropertyNames:_e,getOwnPropertySymbols:be,getPrototypeOf:ye}=Object,ht=globalThis,Pt=ht.trustedTypes,we=Pt?Pt.emptyScript:"",$e=ht.reactiveElementPolyfillSupport,W=(o,t)=>o,nt={toAttribute(o,t){switch(t){case Boolean:o=o?we:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,t){let s=o;switch(t){case Boolean:s=o!==null;break;case Number:s=o===null?null:Number(o);break;case Object:case Array:try{s=JSON.parse(o)}catch{s=null}}return s}},wt=(o,t)=>!ge(o,t),Bt={attribute:!0,type:String,converter:nt,reflect:!1,useDefault:!1,hasChanged:wt};Symbol.metadata??=Symbol("metadata"),ht.litPropertyMetadata??=new WeakMap;let z=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=Bt){if(s.state&&(s.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=!0),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),e=this.getPropertyDescriptor(t,i,s);e!==void 0&&fe(this.prototype,t,e)}}static getPropertyDescriptor(t,s,i){const{get:e,set:a}=ve(this.prototype,t)??{get(){return this[s]},set(r){this[s]=r}};return{get:e,set(r){const p=e?.call(this);a?.call(this,r),this.requestUpdate(t,p,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Bt}static _$Ei(){if(this.hasOwnProperty(W("elementProperties")))return;const t=ye(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(W("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(W("properties"))){const s=this.properties,i=[..._e(s),...be(s)];for(const e of i)this.createProperty(e,s[e])}const t=this[Symbol.metadata];if(t!==null){const s=litPropertyMetadata.get(t);if(s!==void 0)for(const[i,e]of s)this.elementProperties.set(i,e)}this._$Eh=new Map;for(const[s,i]of this.elementProperties){const e=this._$Eu(s,i);e!==void 0&&this._$Eh.set(e,s)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const s=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const e of i)s.unshift(Rt(e))}else t!==void 0&&s.push(Rt(t));return s}static _$Eu(t,s){const i=s.attribute;return i===!1?void 0:typeof i=="string"?i: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(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ue(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,s,i){this._$AK(t,i)}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(e!==void 0&&i.reflect===!0){const a=(i.converter?.toAttribute!==void 0?i.converter:nt).toAttribute(s,i.type);this._$Em=t,a==null?this.removeAttribute(e):this.setAttribute(e,a),this._$Em=null}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(e!==void 0&&this._$Em!==e){const a=i.getPropertyOptions(e),r=typeof a.converter=="function"?{fromAttribute:a.converter}:a.converter?.fromAttribute!==void 0?a.converter:nt;this._$Em=e,this[e]=r.fromAttribute(s,a.type)??this._$Ej?.get(e)??null,this._$Em=null}}requestUpdate(t,s,i){if(t!==void 0){const e=this.constructor,a=this[t];if(i??=e.getPropertyOptions(t),!((i.hasChanged??wt)(a,s)||i.useDefault&&i.reflect&&a===this._$Ej?.get(t)&&!this.hasAttribute(e._$Eu(t,i))))return;this.C(t,s,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,s,{useDefault:i,reflect:e,wrapped:a},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),a!==!0||r!==void 0)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),e===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(s){Promise.reject(s)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,a]of this._$Ep)this[e]=a;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[e,a]of i){const{wrapped:r}=a,p=this[e];r!==!0||this._$AL.has(e)||p===void 0||this.C(e,void 0,a,p)}}let t=!1;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach(i=>i.hostUpdate?.()),this.update(s)):this._$EM()}catch(i){throw t=!1,this._$EM(),i}t&&this._$AE(s)}willUpdate(t){}_$AE(t){this._$EO?.forEach(s=>s.hostUpdated?.()),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.forEach(s=>this._$ET(s,this[s])),this._$EM()}updated(t){}firstUpdated(t){}};z.elementStyles=[],z.shadowRootOptions={mode:"open"},z[W("elementProperties")]=new Map,z[W("finalized")]=new Map,$e?.({ReactiveElement:z}),(ht.reactiveElementVersions??=[]).push("2.1.0");/**
|
|
10
|
+
* @license
|
|
11
|
+
* Copyright 2017 Google LLC
|
|
12
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
+
*/const $t=globalThis,ct=$t.trustedTypes,Lt=ct?ct.createPolicy("lit-html",{createHTML:o=>o}):void 0,Vt="$lit$",j=`lit$${Math.random().toFixed(9).slice(2)}$`,Ft="?"+j,xe=`<${Ft}>`,O=document,K=()=>O.createComment(""),Y=o=>o===null||typeof o!="object"&&typeof o!="function",xt=Array.isArray,Ae=o=>xt(o)||typeof o?.[Symbol.iterator]=="function",ft=`[
|
|
14
|
+
\f\r]`,F=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ot=/-->/g,It=/>/g,B=RegExp(`>|${ft}(?:([^\\s"'>=/]+)(${ft}*=${ft}*(?:[^
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ut=/'/g,zt=/"/g,Wt=/^(?:script|style|textarea|title)$/i,Te=o=>(t,...s)=>({_$litType$:o,strings:t,values:s}),c=Te(1),S=Symbol.for("lit-noChange"),h=Symbol.for("lit-nothing"),Ht=new WeakMap,L=O.createTreeWalker(O,129);function Kt(o,t){if(!xt(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Lt!==void 0?Lt.createHTML(t):t}const Ce=(o,t)=>{const s=o.length-1,i=[];let e,a=t===2?"<svg>":t===3?"<math>":"",r=F;for(let p=0;p<s;p++){const l=o[p];let _,$,v=-1,k=0;for(;k<l.length&&(r.lastIndex=k,$=r.exec(l),$!==null);)k=r.lastIndex,r===F?$[1]==="!--"?r=Ot:$[1]!==void 0?r=It:$[2]!==void 0?(Wt.test($[2])&&(e=RegExp("</"+$[2],"g")),r=B):$[3]!==void 0&&(r=B):r===B?$[0]===">"?(r=e??F,v=-1):$[1]===void 0?v=-2:(v=r.lastIndex-$[2].length,_=$[1],r=$[3]===void 0?B:$[3]==='"'?zt:Ut):r===zt||r===Ut?r=B:r===Ot||r===It?r=F:(r=B,e=void 0);const M=r===B&&o[p+1].startsWith("/>")?" ":"";a+=r===F?l+xe:v>=0?(i.push(_),l.slice(0,v)+Vt+l.slice(v)+j+M):l+j+(v===-2?p:M)}return[Kt(o,a+(o[s]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),i]};class J{constructor({strings:t,_$litType$:s},i){let e;this.parts=[];let a=0,r=0;const p=t.length-1,l=this.parts,[_,$]=Ce(t,s);if(this.el=J.createElement(_,i),L.currentNode=this.el.content,s===2||s===3){const v=this.el.content.firstChild;v.replaceWith(...v.childNodes)}for(;(e=L.nextNode())!==null&&l.length<p;){if(e.nodeType===1){if(e.hasAttributes())for(const v of e.getAttributeNames())if(v.endsWith(Vt)){const k=$[r++],M=e.getAttribute(v).split(j),at=/([.?@])?(.*)/.exec(k);l.push({type:1,index:a,name:at[2],strings:M,ctor:at[1]==="."?Ee:at[1]==="?"?qe:at[1]==="@"?Me:lt}),e.removeAttribute(v)}else v.startsWith(j)&&(l.push({type:6,index:a}),e.removeAttribute(v));if(Wt.test(e.tagName)){const v=e.textContent.split(j),k=v.length-1;if(k>0){e.textContent=ct?ct.emptyScript:"";for(let M=0;M<k;M++)e.append(v[M],K()),L.nextNode(),l.push({type:2,index:++a});e.append(v[k],K())}}}else if(e.nodeType===8)if(e.data===Ft)l.push({type:2,index:a});else{let v=-1;for(;(v=e.data.indexOf(j,v+1))!==-1;)l.push({type:7,index:a}),v+=j.length-1}a++}}static createElement(t,s){const i=O.createElement("template");return i.innerHTML=t,i}}function H(o,t,s=o,i){if(t===S)return t;let e=i!==void 0?s._$Co?.[i]:s._$Cl;const a=Y(t)?void 0:t._$litDirective$;return e?.constructor!==a&&(e?._$AO?.(!1),a===void 0?e=void 0:(e=new a(o),e._$AT(o,s,i)),i!==void 0?(s._$Co??=[])[i]=e:s._$Cl=e),e!==void 0&&(t=H(o,e._$AS(o,t.values),e,i)),t}class ke{constructor(t,s){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=s}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:s},parts:i}=this._$AD,e=(t?.creationScope??O).importNode(s,!0);L.currentNode=e;let a=L.nextNode(),r=0,p=0,l=i[0];for(;l!==void 0;){if(r===l.index){let _;l.type===2?_=new G(a,a.nextSibling,this,t):l.type===1?_=new l.ctor(a,l.name,l.strings,this,t):l.type===6&&(_=new je(a,this,t)),this._$AV.push(_),l=i[++p]}r!==l?.index&&(a=L.nextNode(),r++)}return L.currentNode=O,e}p(t){let s=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,s),s+=i.strings.length-2):i._$AI(t[s])),s++}}class G{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,s,i,e){this.type=2,this._$AH=h,this._$AN=void 0,this._$AA=t,this._$AB=s,this._$AM=i,this.options=e,this._$Cv=e?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const s=this._$AM;return s!==void 0&&t?.nodeType===11&&(t=s.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,s=this){t=H(this,t,s),Y(t)?t===h||t==null||t===""?(this._$AH!==h&&this._$AR(),this._$AH=h):t!==this._$AH&&t!==S&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Ae(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!==h&&Y(this._$AH)?this._$AA.nextSibling.data=t:this.T(O.createTextNode(t)),this._$AH=t}$(t){const{values:s,_$litType$:i}=t,e=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=J.createElement(Kt(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===e)this._$AH.p(s);else{const a=new ke(e,this),r=a.u(this.options);a.p(s),this.T(r),this._$AH=a}}_$AC(t){let s=Ht.get(t.strings);return s===void 0&&Ht.set(t.strings,s=new J(t)),s}k(t){xt(this._$AH)||(this._$AH=[],this._$AR());const s=this._$AH;let i,e=0;for(const a of t)e===s.length?s.push(i=new G(this.O(K()),this.O(K()),this,this.options)):i=s[e],i._$AI(a),e++;e<s.length&&(this._$AR(i&&i._$AB.nextSibling,e),s.length=e)}_$AR(t=this._$AA.nextSibling,s){for(this._$AP?.(!1,!0,s);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}}class lt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,s,i,e,a){this.type=1,this._$AH=h,this._$AN=void 0,this.element=t,this.name=s,this._$AM=e,this.options=a,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=h}_$AI(t,s=this,i,e){const a=this.strings;let r=!1;if(a===void 0)t=H(this,t,s,0),r=!Y(t)||t!==this._$AH&&t!==S,r&&(this._$AH=t);else{const p=t;let l,_;for(t=a[0],l=0;l<a.length-1;l++)_=H(this,p[i+l],s,l),_===S&&(_=this._$AH[l]),r||=!Y(_)||_!==this._$AH[l],_===h?t=h:t!==h&&(t+=(_??"")+a[l+1]),this._$AH[l]=_}r&&!e&&this.j(t)}j(t){t===h?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Ee extends lt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===h?void 0:t}}class qe extends lt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==h)}}class Me extends lt{constructor(t,s,i,e,a){super(t,s,i,e,a),this.type=5}_$AI(t,s=this){if((t=H(this,t,s,0)??h)===S)return;const i=this._$AH,e=t===h&&i!==h||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,a=t!==h&&(i===h||e);e&&this.element.removeEventListener(this.name,this,i),a&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class je{constructor(t,s,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=s,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){H(this,t)}}const Se=$t.litHtmlPolyfillSupport;Se?.(J,G),($t.litHtmlVersions??=[]).push("3.3.0");const Re=(o,t,s)=>{const i=s?.renderBefore??t;let e=i._$litPart$;if(e===void 0){const a=s?.renderBefore??null;i._$litPart$=e=new G(t.insertBefore(K(),a),a,void 0,s??{})}return e._$AI(o),e};/**
|
|
16
|
+
* @license
|
|
17
|
+
* Copyright 2017 Google LLC
|
|
18
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
+
*/const At=globalThis;let u=class extends z{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const s=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Re(s,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return S}};u._$litElement$=!0,u.finalized=!0,At.litElementHydrateSupport?.({LitElement:u});const Pe=At.litElementPolyfillSupport;Pe?.({LitElement:u});(At.litElementVersions??=[]).push("4.2.0");/**
|
|
20
|
+
* @license
|
|
21
|
+
* Copyright 2017 Google LLC
|
|
22
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
|
+
*/const Be={attribute:!0,type:String,converter:nt,reflect:!1,hasChanged:wt},Le=(o=Be,t,s)=>{const{kind:i,metadata:e}=s;let a=globalThis.litPropertyMetadata.get(e);if(a===void 0&&globalThis.litPropertyMetadata.set(e,a=new Map),i==="setter"&&((o=Object.create(o)).wrapped=!0),a.set(s.name,o),i==="accessor"){const{name:r}=s;return{set(p){const l=t.get.call(this);t.set.call(this,p),this.requestUpdate(r,l,o)},init(p){return p!==void 0&&this.C(r,void 0,o,p),p}}}if(i==="setter"){const{name:r}=s;return function(p){const l=this[r];t.call(this,p),this.requestUpdate(r,l,o)}}throw Error("Unsupported decorator location: "+i)};function n(o){return(t,s)=>typeof s=="object"?Le(o,t,s):((i,e,a)=>{const r=e.hasOwnProperty(a);return e.constructor.createProperty(a,i),r?Object.getOwnPropertyDescriptor(e,a):void 0})(o,t,s)}/**
|
|
24
|
+
* @license
|
|
25
|
+
* Copyright 2017 Google LLC
|
|
26
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
+
*/function y(o){return n({...o,state:!0,attribute:!1})}/**
|
|
28
|
+
* @license
|
|
29
|
+
* Copyright 2017 Google LLC
|
|
30
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
31
|
+
*/const Oe=(o,t,s)=>(s.configurable=!0,s.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(o,t,s),s);/**
|
|
32
|
+
* @license
|
|
33
|
+
* Copyright 2017 Google LLC
|
|
34
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
35
|
+
*/function R(o,t){return(s,i,e)=>{const a=r=>r.renderRoot?.querySelector(o)??null;return Oe(s,i,{get(){return a(this)}})}}/**
|
|
36
|
+
* @license
|
|
37
|
+
* Copyright 2017 Google LLC
|
|
38
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
39
|
+
*/const Yt={ATTRIBUTE:1,CHILD:2},Jt=o=>(...t)=>({_$litDirective$:o,values:t});let Gt=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,s,i){this._$Ct=t,this._$AM=s,this._$Ci=i}_$AS(t,s){return this.update(t,s)}update(t,s){return this.render(...s)}};/**
|
|
40
|
+
* @license
|
|
41
|
+
* Copyright 2018 Google LLC
|
|
42
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
43
|
+
*/const A=Jt(class extends Gt{constructor(o){if(super(o),o.type!==Yt.ATTRIBUTE||o.name!=="class"||o.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(o){return" "+Object.keys(o).filter(t=>o[t]).join(" ")+" "}update(o,[t]){if(this.st===void 0){this.st=new Set,o.strings!==void 0&&(this.nt=new Set(o.strings.join(" ").split(/\s/).filter(i=>i!=="")));for(const i in t)t[i]&&!this.nt?.has(i)&&this.st.add(i);return this.render(t)}const s=o.element.classList;for(const i of this.st)i in t||(s.remove(i),this.st.delete(i));for(const i in t){const e=!!t[i];e===this.st.has(i)||this.nt?.has(i)||(e?(s.add(i),this.st.add(i)):(s.remove(i),this.st.delete(i)))}return S}});/**
|
|
44
|
+
* @license
|
|
45
|
+
* Copyright 2021 Google LLC
|
|
46
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
|
+
*/let Qt=class extends Event{constructor(t,s,i,e){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=s,this.callback=i,this.subscribe=e??!1}};/**
|
|
48
|
+
* @license
|
|
49
|
+
* Copyright 2021 Google LLC
|
|
50
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
51
|
+
*//**
|
|
52
|
+
* @license
|
|
53
|
+
* Copyright 2021 Google LLC
|
|
54
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
55
|
+
*/let Nt=class{constructor(t,s,i,e){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(a,r)=>{this.unsubscribe&&(this.unsubscribe!==r&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=a,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(a,r)),this.unsubscribe=r},this.host=t,s.context!==void 0){const a=s;this.context=a.context,this.callback=a.callback,this.subscribe=a.subscribe??!1}else this.context=s,this.callback=i,this.subscribe=e??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new Qt(this.context,this.host,this.t,this.subscribe))}};/**
|
|
56
|
+
* @license
|
|
57
|
+
* Copyright 2021 Google LLC
|
|
58
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
59
|
+
*/class Ie{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,s=!1){const i=s||!Object.is(t,this.o);this.o=t,i&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(const[s,{disposer:i}]of this.subscriptions)s(this.o,i)},t!==void 0&&(this.value=t)}addCallback(t,s,i){if(!i)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:s});const{disposer:e}=this.subscriptions.get(t);t(this.value,e)}clearCallbacks(){this.subscriptions.clear()}}/**
|
|
60
|
+
* @license
|
|
61
|
+
* Copyright 2021 Google LLC
|
|
62
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
63
|
+
*/let Ue=class extends Event{constructor(t,s){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=s}};class Zt extends Ie{constructor(t,s,i){super(s.context!==void 0?s.initialValue:i),this.onContextRequest=e=>{if(e.context!==this.context)return;const a=e.contextTarget??e.composedPath()[0];a!==this.host&&(e.stopPropagation(),this.addCallback(e.callback,a,e.subscribe))},this.onProviderRequest=e=>{if(e.context!==this.context||(e.contextTarget??e.composedPath()[0])===this.host)return;const a=new Set;for(const[r,{consumerHost:p}]of this.subscriptions)a.has(r)||(a.add(r),p.dispatchEvent(new Qt(this.context,p,r,!0)));e.stopPropagation()},this.host=t,s.context!==void 0?this.context=s.context:this.context=s,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Ue(this.context,this.host))}}/**
|
|
64
|
+
* @license
|
|
65
|
+
* Copyright 2017 Google LLC
|
|
66
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
67
|
+
*/function N({context:o}){return(t,s)=>{const i=new WeakMap;if(typeof s=="object")return{get(){return t.get.call(this)},set(e){return i.get(this).setValue(e),t.set.call(this,e)},init(e){return i.set(this,new Zt(this,{context:o,initialValue:e})),e}};{t.constructor.addInitializer(r=>{i.set(r,new Zt(r,{context:o}))});const e=Object.getOwnPropertyDescriptor(t,s);let a;if(e===void 0){const r=new WeakMap;a={get(){return r.get(this)},set(p){i.get(this).setValue(p),r.set(this,p)},configurable:!0,enumerable:!0}}else{const r=e.set;a={...e,set(p){i.get(this).setValue(p),r?.call(this,p)}}}return void Object.defineProperty(t,s,a)}}}/**
|
|
68
|
+
* @license
|
|
69
|
+
* Copyright 2022 Google LLC
|
|
70
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
71
|
+
*/function x({context:o,subscribe:t}){return(s,i)=>{typeof i=="object"?i.addInitializer(function(){new Nt(this,{context:o,callback:e=>{s.set.call(this,e)},subscribe:t})}):s.constructor.addInitializer(e=>{new Nt(e,{context:o,callback:a=>{e[i]=a},subscribe:t})})}}const f=g`
|
|
72
|
+
* {
|
|
73
|
+
box-sizing: border-box;
|
|
74
|
+
margin: 0;
|
|
75
|
+
font-family: inherit;
|
|
76
|
+
color: var(--text);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
button {
|
|
80
|
+
font-size: inherit;
|
|
81
|
+
cursor: pointer;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
:host {
|
|
85
|
+
--base-font-size: 10px;
|
|
86
|
+
font-size: var(--base-font-size);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
:host([theme="light"]) {
|
|
90
|
+
--white: hsl(0deg 0% 100%);
|
|
91
|
+
--black: hsl(0deg 0% 0%);
|
|
92
|
+
--success: hsl(153deg 71% 39%);
|
|
93
|
+
--danger: hsl(354deg 70% 53%);
|
|
94
|
+
--warning: hsl(45deg 100% 51%);
|
|
95
|
+
--info: hsl(211deg 100% 49%);
|
|
96
|
+
--surface-50: hsl(0deg 20% 99%);
|
|
97
|
+
--surface-100: hsl(0deg 23% 97%);
|
|
98
|
+
--surface-200: hsl(0deg 17% 93%);
|
|
99
|
+
--surface-300: hsl(0deg 12% 85%);
|
|
100
|
+
--surface-400: hsl(0deg 7% 75%);
|
|
101
|
+
--surface-500: hsl(0deg 1% 61%);
|
|
102
|
+
--surface-600: hsl(0deg 0% 45%);
|
|
103
|
+
--surface-700: hsl(0deg 0% 32%);
|
|
104
|
+
--surface-800: hsl(0deg 0% 23%);
|
|
105
|
+
--surface-900: hsl(0deg 0% 18%);
|
|
106
|
+
--surface-950: hsl(0deg 0% 16%);
|
|
107
|
+
--text: var(--surface-900);
|
|
108
|
+
--border: var(--surface-200);
|
|
109
|
+
--floating-item-border: none;
|
|
110
|
+
--floating-item-box-shadow: rgb(0 0 0 / 15%) 0 0.1em 0.1em 0;
|
|
111
|
+
--placeholder: var(--surface-500);
|
|
112
|
+
--deleted: hsl(0deg 0% 0% / 10%);
|
|
113
|
+
--overlay: hsl(0deg 0% 0% / 15%);
|
|
114
|
+
--chat-notification-badge-background: var(--info);
|
|
115
|
+
--chat-notification-badge-text: var(--white);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
:host([theme="dark"]) {
|
|
119
|
+
--white: hsl(0deg 0% 100%);
|
|
120
|
+
--black: hsl(0deg 0% 0%);
|
|
121
|
+
--success: hsl(135deg 69% 69%);
|
|
122
|
+
--danger: hsl(354deg 70% 53%);
|
|
123
|
+
--warning: hsl(46deg 100% 79%);
|
|
124
|
+
--info: hsl(211deg 100% 53%);
|
|
125
|
+
--surface-50: hsl(0deg 0% 16%);
|
|
126
|
+
--surface-100: hsl(0deg 0% 18%);
|
|
127
|
+
--surface-200: hsl(0deg 0% 23%);
|
|
128
|
+
--surface-300: hsl(0deg 0% 32%);
|
|
129
|
+
--surface-400: hsl(0deg 0% 45%);
|
|
130
|
+
--surface-500: hsl(0deg 0% 61%);
|
|
131
|
+
--surface-600: hsl(0deg 7% 75%);
|
|
132
|
+
--surface-700: hsl(0deg 12% 85%);
|
|
133
|
+
--surface-800: hsl(0deg 17% 93%);
|
|
134
|
+
--surface-900: hsl(0deg 23% 97%);
|
|
135
|
+
--surface-950: hsl(0deg 20% 99%);
|
|
136
|
+
--text: var(--surface-800);
|
|
137
|
+
--border: var(--surface-200);
|
|
138
|
+
--floating-item-border: solid 0.1em var(--border);
|
|
139
|
+
--floating-item-box-shadow: none;
|
|
140
|
+
--placeholder: var(--surface-500);
|
|
141
|
+
--deleted: hsl(0deg 0% 100% / 10%);
|
|
142
|
+
--overlay: hsl(1deg 100% 100% / 15%);
|
|
143
|
+
--chat-notification-badge-background: var(--info);
|
|
144
|
+
--chat-notification-badge-text: var(--white);
|
|
145
|
+
}
|
|
146
|
+
`,Tt="show-sidebar";var ze=Object.defineProperty,Q=(o,t,s,i)=>{for(var e=void 0,a=o.length-1,r;a>=0;a--)(r=o[a])&&(e=r(t,s,e)||e);return e&&ze(t,s,e),e};class Z extends u{constructor(){super(),this.actionType="room",this.roomId=null,this.messageId=null,this.actions=[],this._onClickOutside=t=>{t.composedPath().includes(this.chatActionList)||this.dispatchEvent(new CustomEvent("close"))},this._onClickOutside=this._onClickOutside.bind(this)}connectedCallback(){super.connectedCallback(),window.addEventListener("mousedown",this._onClickOutside)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("mousedown",this._onClickOutside)}static{this.styles=[f,g`
|
|
147
|
+
:host {
|
|
148
|
+
display: flex;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.chat-action-list {
|
|
152
|
+
z-index: 1;
|
|
153
|
+
display: flex;
|
|
154
|
+
flex-direction: column;
|
|
155
|
+
align-items: center;
|
|
156
|
+
overflow: hidden;
|
|
157
|
+
background-color: var(--surface-50);
|
|
158
|
+
border: var(--floating-item-border);
|
|
159
|
+
border-radius: 0.8em;
|
|
160
|
+
box-shadow: var(--floating-item-box-shadow);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.chat-action-list__item {
|
|
164
|
+
display: flex;
|
|
165
|
+
align-items: center;
|
|
166
|
+
justify-content: flex-start;
|
|
167
|
+
width: 100%;
|
|
168
|
+
min-width: 6.4em;
|
|
169
|
+
height: 3.2em;
|
|
170
|
+
padding: 0 0.8em;
|
|
171
|
+
font-size: 1.4em;
|
|
172
|
+
cursor: pointer;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.chat-action-list__item:hover {
|
|
176
|
+
background-color: var(--surface-100);
|
|
177
|
+
}
|
|
178
|
+
`]}render(){return c`<div class="chat-action-list">
|
|
179
|
+
${this.actions.map(t=>c`
|
|
180
|
+
<div
|
|
181
|
+
class="chat-action-list__item"
|
|
182
|
+
@click="${()=>this.actionType==="room"?this.dispatchEvent(new CustomEvent("select-room-action",{detail:{label:t.label,value:t.value,roomId:this.roomId},composed:!0})):this.dispatchEvent(new CustomEvent("select-message-action",{detail:{label:t.label,value:t.value,messageId:this.messageId},composed:!0}))}"
|
|
183
|
+
>
|
|
184
|
+
${t.label}
|
|
185
|
+
</div>
|
|
186
|
+
`)}
|
|
187
|
+
</div>`}}Q([n({type:String})],Z.prototype,"actionType");Q([n({type:String})],Z.prototype,"roomId");Q([n({type:String})],Z.prototype,"messageId");Q([n({type:Array})],Z.prototype,"actions");Q([R(".chat-action-list")],Z.prototype,"chatActionList");const dt="room";var He=Object.defineProperty,Ct=(o,t,s,i)=>{for(var e=void 0,a=o.length-1,r;a>=0;a--)(r=o[a])&&(e=r(t,s,e)||e);return e&&He(t,s,e),e};class mt extends u{constructor(){super(...arguments),this._showActionList=!1}get _selectedRoom(){return this.roomContext.rooms.find(t=>t.id===this.roomContext.selectedRoomId)}_openSidebar(){this.dispatchEvent(new CustomEvent("open-sidebar",{composed:!0}))}_toggleActionList(){this._showActionList=!this._showActionList}_closeActionList(){this._showActionList=!1}static{this.styles=[f,g`
|
|
188
|
+
:host {
|
|
189
|
+
display: flex;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.chat-header {
|
|
193
|
+
display: flex;
|
|
194
|
+
flex-grow: 1;
|
|
195
|
+
flex-direction: row;
|
|
196
|
+
gap: 1.6em;
|
|
197
|
+
align-items: center;
|
|
198
|
+
min-height: 6.4em;
|
|
199
|
+
max-height: 6.4em;
|
|
200
|
+
padding: 0 1.2em;
|
|
201
|
+
border-bottom: 0.1em solid var(--border);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.chat-header__body {
|
|
205
|
+
display: flex;
|
|
206
|
+
flex-direction: column;
|
|
207
|
+
gap: 0.4em;
|
|
208
|
+
justify-content: center;
|
|
209
|
+
width: 24em;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.chat-header__title {
|
|
213
|
+
overflow: hidden;
|
|
214
|
+
text-overflow: ellipsis;
|
|
215
|
+
font-size: 1.6em;
|
|
216
|
+
font-weight: 600;
|
|
217
|
+
white-space: nowrap;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.chat-header__subtitle {
|
|
221
|
+
overflow: hidden;
|
|
222
|
+
text-overflow: ellipsis;
|
|
223
|
+
font-size: 1.2em;
|
|
224
|
+
white-space: nowrap;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.chat-header__button {
|
|
228
|
+
display: flex;
|
|
229
|
+
align-items: center;
|
|
230
|
+
justify-content: center;
|
|
231
|
+
padding: 0.4em;
|
|
232
|
+
background-color: transparent;
|
|
233
|
+
border: none;
|
|
234
|
+
border-radius: 100px;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.chat-header__button:hover {
|
|
238
|
+
background-color: var(--surface-100);
|
|
239
|
+
}
|
|
240
|
+
`]}render(){return c`<header class="chat-header">
|
|
241
|
+
<button
|
|
242
|
+
class="chat-header__button"
|
|
243
|
+
style="display: ${this.showSidebar?"none":"block"}"
|
|
244
|
+
@click="${this._openSidebar}"
|
|
245
|
+
aria-label="Open sidebar"
|
|
246
|
+
>
|
|
247
|
+
<svg
|
|
248
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
249
|
+
height="2.4em"
|
|
250
|
+
viewBox="0 -960 960 960"
|
|
251
|
+
width="2.4em"
|
|
252
|
+
fill="var(--surface-700)"
|
|
253
|
+
>
|
|
254
|
+
<path
|
|
255
|
+
d="M160-240q-17 0-28.5-11.5T120-280q0-17 11.5-28.5T160-320h640q17 0 28.5 11.5T840-280q0 17-11.5 28.5T800-240H160Zm0-200q-17 0-28.5-11.5T120-480q0-17 11.5-28.5T160-520h640q17 0 28.5 11.5T840-480q0 17-11.5 28.5T800-440H160Zm0-200q-17 0-28.5-11.5T120-680q0-17 11.5-28.5T160-720h640q17 0 28.5 11.5T840-680q0 17-11.5 28.5T800-640H160Z"
|
|
256
|
+
/>
|
|
257
|
+
</svg>
|
|
258
|
+
</button>
|
|
259
|
+
<div class="chat-header__body">
|
|
260
|
+
<span class="chat-header__title"
|
|
261
|
+
>${this._selectedRoom?.headerTitle??""}</span
|
|
262
|
+
>
|
|
263
|
+
<span class="chat-header__subtitle"
|
|
264
|
+
>${this._selectedRoom?.headerSubtitle??""}</span
|
|
265
|
+
>
|
|
266
|
+
</div>
|
|
267
|
+
${this.roomContext.actions.length>0?c`<button
|
|
268
|
+
class="chat-header__button"
|
|
269
|
+
style="margin-left: auto;"
|
|
270
|
+
@click="${this._toggleActionList}"
|
|
271
|
+
aria-label="Show actions"
|
|
272
|
+
>
|
|
273
|
+
<svg
|
|
274
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
275
|
+
height="2.4em"
|
|
276
|
+
viewBox="0 -960 960 960"
|
|
277
|
+
width="2.4em"
|
|
278
|
+
fill="var(--surface-700)"
|
|
279
|
+
>
|
|
280
|
+
<path
|
|
281
|
+
d="M480-160q-33 0-56.5-23.5T400-240q0-33 23.5-56.5T480-320q33 0 56.5 23.5T560-240q0 33-23.5 56.5T480-160Zm0-240q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm0-240q-33 0-56.5-23.5T400-720q0-33 23.5-56.5T480-800q33 0 56.5 23.5T560-720q0 33-23.5 56.5T480-640Z"
|
|
282
|
+
/>
|
|
283
|
+
</svg>
|
|
284
|
+
</button>`:h}
|
|
285
|
+
${this._showActionList?c`<chat-action-list
|
|
286
|
+
style="position: absolute; top: 4em; right: 1.2em;"
|
|
287
|
+
.actionType="${"room"}"
|
|
288
|
+
.roomId="${this.roomContext.selectedRoomId}"
|
|
289
|
+
.actions="${this.roomContext.actions}"
|
|
290
|
+
@select-action="${this._closeActionList}"
|
|
291
|
+
@close="${this._closeActionList}"
|
|
292
|
+
></chat-action-list>`:h}
|
|
293
|
+
</header>`}}Ct([x({context:Tt,subscribe:!0}),n({type:Boolean})],mt.prototype,"showSidebar");Ct([x({context:dt,subscribe:!0}),n({type:Object})],mt.prototype,"roomContext");Ct([y()],mt.prototype,"_showActionList");/**
|
|
294
|
+
* @license
|
|
295
|
+
* Copyright 2017 Google LLC
|
|
296
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
297
|
+
*/class _t extends Gt{constructor(t){if(super(t),this.it=h,t.type!==Yt.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===h||t==null)return this._t=void 0,this.it=t;if(t===S)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;const s=[t];return s.raw=s,this._t={_$litType$:this.constructor.resultType,strings:s,values:[]}}}_t.directiveName="unsafeHTML",_t.resultType=1;const Ne=Jt(_t);var Ze=Object.defineProperty,Xt=(o,t,s,i)=>{for(var e=void 0,a=o.length-1,r;a>=0;a--)(r=o[a])&&(e=r(t,s,e)||e);return e&&Ze(t,s,e),e};class kt extends u{constructor(){super(...arguments),this.size=3.2,this.src=""}static{this.styles=[f,g`
|
|
298
|
+
:host {
|
|
299
|
+
display: flex;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.chat-avatar {
|
|
303
|
+
display: flex;
|
|
304
|
+
align-items: center;
|
|
305
|
+
justify-content: center;
|
|
306
|
+
border-radius: 50%;
|
|
307
|
+
}
|
|
308
|
+
`]}render(){return c`<img
|
|
309
|
+
class="chat-avatar"
|
|
310
|
+
style="width: ${this.size}em; height: ${this.size}em;"
|
|
311
|
+
src="${this.src}"
|
|
312
|
+
alt="Avatar"
|
|
313
|
+
></img>`}}Xt([n({type:Number})],kt.prototype,"size");Xt([n({type:String})],kt.prototype,"src");const X="current-user-id";var De=Object.defineProperty,D=(o,t,s,i)=>{for(var e=void 0,a=o.length-1,r;a>=0;a--)(r=o[a])&&(e=r(t,s,e)||e);return e&&De(t,s,e),e};class I extends u{constructor(){super(),this.currentUserId=null,this.messageId=null,this.width=300,this.height=300,this._hasEmojiPickerLoaded=!1,this._onClickOutside=t=>{t.composedPath().includes(this.emojiPicker)||this.dispatchEvent(new CustomEvent("close"))},this._onClickEmoji=t=>{this.dispatchEvent(new CustomEvent("select-emoji",{detail:{messageId:this.messageId,currentUserId:this.currentUserId,emoji:t.detail.unicode},composed:!0}))},this._onClickOutside=this._onClickOutside.bind(this)}async connectedCallback(){super.connectedCallback(),this._hasEmojiPickerLoaded||(await Promise.resolve().then(()=>require("./index-BAqe5cNa.cjs")),this._hasEmojiPickerLoaded=!0),window.addEventListener("mousedown",this._onClickOutside)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("mousedown",this._onClickOutside)}static{this.styles=[f,g`
|
|
314
|
+
:host {
|
|
315
|
+
display: flex;
|
|
316
|
+
overflow: hidden;
|
|
317
|
+
border-radius: 0.8em;
|
|
318
|
+
box-shadow: var(--floating-item-box-shadow);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
emoji-picker {
|
|
322
|
+
--background: var(--surface-50);
|
|
323
|
+
--border-color: var(--border);
|
|
324
|
+
--border-radius: 8px;
|
|
325
|
+
--button-active-background: var(--surface-100);
|
|
326
|
+
--button-hover-background: var(--surface-100);
|
|
327
|
+
--category-font-color: var(--surface-900);
|
|
328
|
+
--category-font-size: 12px;
|
|
329
|
+
--emoji-padding: 8px;
|
|
330
|
+
--emoji-size: 16px;
|
|
331
|
+
--indicator-color: var(--surface-700);
|
|
332
|
+
--indicator-height: 4px;
|
|
333
|
+
--input-border-color: var(--border);
|
|
334
|
+
--input-border-radius: 8px;
|
|
335
|
+
--input-border-size: 1px;
|
|
336
|
+
--input-font-color: var(--surface-900);
|
|
337
|
+
--input-font-size: 14px;
|
|
338
|
+
--input-padding: 8px;
|
|
339
|
+
--input-placeholder-color: var(--placeholder);
|
|
340
|
+
}
|
|
341
|
+
`]}render(){return c`${this._hasEmojiPickerLoaded?c`<emoji-picker
|
|
342
|
+
style="width: ${this.width}px; height: ${this.height}px"
|
|
343
|
+
@emoji-click="${this._onClickEmoji}"
|
|
344
|
+
></emoji-picker>`:h}`}}D([x({context:X,subscribe:!0}),n({type:String})],I.prototype,"currentUserId");D([n({type:String})],I.prototype,"messageId");D([n({type:Number})],I.prototype,"width");D([n({type:Number})],I.prototype,"height");D([y()],I.prototype,"_hasEmojiPickerLoaded");D([R("emoji-picker")],I.prototype,"emojiPicker");var Ve=Object.defineProperty,tt=(o,t,s,i)=>{for(var e=void 0,a=o.length-1,r;a>=0;a--)(r=o[a])&&(e=r(t,s,e)||e);return e&&Ve(t,s,e),e};class V extends u{constructor(){super(...arguments),this.mine=!1,this.isEmojiReactionAvailable=!1,this.isReplyAvailable=!1,this.isMessageActionAvailable=!1}_clickEmojiButton(){this.dispatchEvent(new CustomEvent("click-emoji-button"))}_replyToMesssage(){const t={...this.message};delete t.replyTo;const s=t;this.dispatchEvent(new CustomEvent("reply-to-message",{detail:{replyTo:s},composed:!0}))}_clickActionButton(){this.dispatchEvent(new CustomEvent("click-action-button"))}static{this.styles=[f,g`
|
|
345
|
+
:host {
|
|
346
|
+
display: flex;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.chat-message-menu {
|
|
350
|
+
z-index: 1;
|
|
351
|
+
display: flex;
|
|
352
|
+
flex-direction: row;
|
|
353
|
+
gap: 0.8em;
|
|
354
|
+
align-items: center;
|
|
355
|
+
padding: 0.4em;
|
|
356
|
+
background-color: var(--surface-100);
|
|
357
|
+
border: var(--floating-item-border);
|
|
358
|
+
border-radius: 0.8em;
|
|
359
|
+
box-shadow: var(--floating-item-box-shadow);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
.chat-message-menu--mine {
|
|
363
|
+
background-color: var(--surface-200);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
.chat-message-menu__button {
|
|
367
|
+
display: flex;
|
|
368
|
+
align-items: center;
|
|
369
|
+
justify-content: center;
|
|
370
|
+
padding: 0.4em;
|
|
371
|
+
font-size: var(--base-font-size);
|
|
372
|
+
background-color: transparent;
|
|
373
|
+
border: none;
|
|
374
|
+
border-radius: 100px;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
.chat-message-menu .chat-message-menu__button:hover {
|
|
378
|
+
background-color: var(--surface-200);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
.chat-message-menu--mine .chat-message-menu__button:hover {
|
|
382
|
+
background-color: var(--surface-300);
|
|
383
|
+
}
|
|
384
|
+
`]}render(){return c`<div
|
|
385
|
+
class="${A({"chat-message-menu":!0,"chat-message-menu--mine":this.mine})}"
|
|
386
|
+
>
|
|
387
|
+
${this.isEmojiReactionAvailable?c`<button
|
|
388
|
+
class="chat-message-menu__button"
|
|
389
|
+
@click="${this._clickEmojiButton}"
|
|
390
|
+
aria-label="Add emoji reaction"
|
|
391
|
+
>
|
|
392
|
+
<svg
|
|
393
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
394
|
+
height="2em"
|
|
395
|
+
viewBox="0 -960 960 960"
|
|
396
|
+
width="2em"
|
|
397
|
+
fill="var(--surface-700)"
|
|
398
|
+
>
|
|
399
|
+
<path
|
|
400
|
+
d="M480-480Zm0 400q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q33 0 65 5t62 15q23 8 29 23.5t1 30.5q-5 15-18.5 23.5T588-781q-26-9-52.5-14t-55.5-5q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160q133 0 226.5-93.5T800-480q0-18-2-36t-6-35q-5-19 5-31t25-15q15-3 29.5 4.5T871-564q5 20 7 41t2 43q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm320-680h-40q-17 0-28.5-11.5T720-800q0-17 11.5-28.5T760-840h40v-40q0-17 11.5-28.5T840-920q17 0 28.5 11.5T880-880v40h40q17 0 28.5 11.5T960-800q0 17-11.5 28.5T920-760h-40v40q0 17-11.5 28.5T840-680q-17 0-28.5-11.5T800-720v-40ZM620-520q25 0 42.5-17.5T680-580q0-25-17.5-42.5T620-640q-25 0-42.5 17.5T560-580q0 25 17.5 42.5T620-520Zm-280 0q25 0 42.5-17.5T400-580q0-25-17.5-42.5T340-640q-25 0-42.5 17.5T280-580q0 25 17.5 42.5T340-520Zm140 260q58 0 107-28t79-76q6-12-1-24t-21-12H316q-14 0-21 12t-1 24q30 48 79.5 76T480-260Z"
|
|
401
|
+
/>
|
|
402
|
+
</svg>
|
|
403
|
+
</button>`:h}
|
|
404
|
+
${this.isReplyAvailable?c`<button
|
|
405
|
+
class="chat-message-menu__button"
|
|
406
|
+
@click="${this._replyToMesssage}"
|
|
407
|
+
aria-label="Reply to message"
|
|
408
|
+
>
|
|
409
|
+
<svg
|
|
410
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
411
|
+
height="2em"
|
|
412
|
+
viewBox="0 -960 960 960"
|
|
413
|
+
width="2em"
|
|
414
|
+
fill="var(--surface-700)"
|
|
415
|
+
>
|
|
416
|
+
<path
|
|
417
|
+
d="m273-480 116 116q12 12 11.5 28T388-308q-12 11-28 11.5T332-308L148-492q-12-12-12-28t12-28l184-184q11-11 27.5-11t28.5 11q12 12 12 28.5T388-675L273-560h367q83 0 141.5 58.5T840-360v120q0 17-11.5 28.5T800-200q-17 0-28.5-11.5T760-240v-120q0-50-35-85t-85-35H273Z"
|
|
418
|
+
/>
|
|
419
|
+
</svg>
|
|
420
|
+
</button>`:h}
|
|
421
|
+
${this.isMessageActionAvailable?c`<button
|
|
422
|
+
class="chat-message-menu__button"
|
|
423
|
+
@click="${this._clickActionButton}"
|
|
424
|
+
aria-label="Message actions"
|
|
425
|
+
>
|
|
426
|
+
<svg
|
|
427
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
428
|
+
height="2em"
|
|
429
|
+
viewBox="0 -960 960 960"
|
|
430
|
+
width="2em"
|
|
431
|
+
fill="var(--surface-700)"
|
|
432
|
+
>
|
|
433
|
+
<path
|
|
434
|
+
d="M240-400q-33 0-56.5-23.5T160-480q0-33 23.5-56.5T240-560q33 0 56.5 23.5T320-480q0 33-23.5 56.5T240-400Zm240 0q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm240 0q-33 0-56.5-23.5T640-480q0-33 23.5-56.5T720-560q33 0 56.5 23.5T800-480q0 33-23.5 56.5T720-400Z"
|
|
435
|
+
/>
|
|
436
|
+
</svg>
|
|
437
|
+
</button>`:h}
|
|
438
|
+
</div>`}}tt([n({type:Boolean})],V.prototype,"mine");tt([n({type:Object})],V.prototype,"message");tt([n({type:Boolean})],V.prototype,"isEmojiReactionAvailable");tt([n({type:Boolean})],V.prototype,"isReplyAvailable");tt([n({type:Boolean})],V.prototype,"isMessageActionAvailable");var Fe=Object.defineProperty,pt=(o,t,s,i)=>{for(var e=void 0,a=o.length-1,r;a>=0;a--)(r=o[a])&&(e=r(t,s,e)||e);return e&&Fe(t,s,e),e};class et extends u{constructor(){super(...arguments),this.currentUserId=null,this.mine=!1}_clickReaction(t,s){this.dispatchEvent(new CustomEvent("click-reaction",{detail:{messageId:this.messageId,reaction:{emoji:t,users:s}},composed:!0}))}static{this.styles=[f,g`
|
|
439
|
+
:host {
|
|
440
|
+
display: flex;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
.chat-message-reaction-list {
|
|
444
|
+
display: flex;
|
|
445
|
+
flex-flow: row wrap;
|
|
446
|
+
gap: 0.4em;
|
|
447
|
+
align-items: center;
|
|
448
|
+
max-width: 80%;
|
|
449
|
+
padding: 0.4em;
|
|
450
|
+
background-color: var(--surface-100);
|
|
451
|
+
border: var(--floating-item-border);
|
|
452
|
+
border-radius: 0.4em;
|
|
453
|
+
box-shadow: var(--floating-item-box-shadow);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
.chat-message-reaction-list--mine {
|
|
457
|
+
margin-left: auto;
|
|
458
|
+
background-color: var(--surface-200);
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
.chat-message-reaction-list__button {
|
|
462
|
+
display: flex;
|
|
463
|
+
flex-direction: row;
|
|
464
|
+
gap: 0.4em;
|
|
465
|
+
align-items: center;
|
|
466
|
+
padding: 0 0.4em;
|
|
467
|
+
margin: 0;
|
|
468
|
+
font-size: 1.4em;
|
|
469
|
+
background-color: transparent;
|
|
470
|
+
border: none;
|
|
471
|
+
border-radius: 0.4em;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
.chat-message-reaction-list__button--reacted {
|
|
475
|
+
background-color: var(--surface-200);
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
.chat-message-reaction-list--mine
|
|
479
|
+
.chat-message-reaction-list__button--reacted {
|
|
480
|
+
background-color: var(--surface-300);
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
.chat-message-reaction-list__button:hover {
|
|
484
|
+
background-color: var(--surface-200);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
.chat-message-reaction-list--mine
|
|
488
|
+
.chat-message-reaction-list__button:hover {
|
|
489
|
+
background-color: var(--surface-300);
|
|
490
|
+
}
|
|
491
|
+
`]}render(){return c`<div
|
|
492
|
+
class="${A({"chat-message-reaction-list":!0,"chat-message-reaction-list--mine":this.mine})}"
|
|
493
|
+
>
|
|
494
|
+
${Array.from(this.reactions.entries()).map(([t,s])=>c`<button
|
|
495
|
+
class="${A({"chat-message-reaction-list__button":!0,"chat-message-reaction-list__button--reacted":this.currentUserId!==null&&s.has(this.currentUserId)})}"
|
|
496
|
+
@click="${()=>this._clickReaction(t,s)}"
|
|
497
|
+
>
|
|
498
|
+
<span>${t}</span>
|
|
499
|
+
<span>${s.size}</span>
|
|
500
|
+
</button>`)}
|
|
501
|
+
</div>`}}pt([x({context:X,subscribe:!0}),n({type:String})],et.prototype,"currentUserId");pt([n({type:String})],et.prototype,"messageId");pt([n({type:Boolean})],et.prototype,"mine");pt([n({type:Object})],et.prototype,"reactions");var We=Object.defineProperty,te=(o,t,s,i)=>{for(var e=void 0,a=o.length-1,r;a>=0;a--)(r=o[a])&&(e=r(t,s,e)||e);return e&&We(t,s,e),e};class Et extends u{constructor(){super(...arguments),this.attachments=[],this.mine=!1}_downloadAttachment(t){this.dispatchEvent(new CustomEvent("download-attachment",{detail:{attachment:t},composed:!0}))}static{this.styles=[f,g`
|
|
502
|
+
:host {
|
|
503
|
+
display: flex;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
.chat-message-attachment-list {
|
|
507
|
+
display: flex;
|
|
508
|
+
flex-grow: 1;
|
|
509
|
+
flex-direction: column;
|
|
510
|
+
gap: 0.8em;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
.chat-message-attachment-list__item {
|
|
514
|
+
display: flex;
|
|
515
|
+
flex-direction: column;
|
|
516
|
+
gap: 0.4em;
|
|
517
|
+
padding: 0.4em 0.8em;
|
|
518
|
+
text-align: start;
|
|
519
|
+
background-color: var(--surface-200);
|
|
520
|
+
border: none;
|
|
521
|
+
border-radius: 0.4em;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
.chat-message-attachment-list__text {
|
|
525
|
+
display: inline-block;
|
|
526
|
+
max-width: 120px;
|
|
527
|
+
overflow: hidden;
|
|
528
|
+
text-overflow: ellipsis;
|
|
529
|
+
font-size: 1.2em;
|
|
530
|
+
white-space: nowrap;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
.chat-message-attachment-list__item:hover {
|
|
534
|
+
background-color: var(--surface-300);
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
.chat-message-attachment-list--mine .chat-message-attachment-list__item {
|
|
538
|
+
background-color: var(--surface-300);
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
.chat-message-attachment-list--mine
|
|
542
|
+
.chat-message-attachment-list__item:hover {
|
|
543
|
+
background-color: var(--surface-400);
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
.chat-message-attachment-list__icon {
|
|
547
|
+
margin-left: auto;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
.chat-message-attachment-list__image-wrapper {
|
|
551
|
+
position: relative;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
.chat-message-attachment-list__image {
|
|
555
|
+
object-fit: cover;
|
|
556
|
+
border-radius: 0.4em;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
.chat-message-attachment-list__image-button {
|
|
560
|
+
position: absolute;
|
|
561
|
+
right: 0.8em;
|
|
562
|
+
bottom: 0.8em;
|
|
563
|
+
display: flex;
|
|
564
|
+
align-items: center;
|
|
565
|
+
justify-content: center;
|
|
566
|
+
padding: 0.4em;
|
|
567
|
+
background-color: var(--surface-50);
|
|
568
|
+
border: none;
|
|
569
|
+
border-radius: 0.8em;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
.chat-message-attachment-list__image-button:hover {
|
|
573
|
+
background-color: var(--surface-100);
|
|
574
|
+
}
|
|
575
|
+
`]}render(){return c`<div
|
|
576
|
+
class=${A({"chat-message-attachment-list":!0,"chat-message-attachment-list--mine":this.mine})}
|
|
577
|
+
>
|
|
578
|
+
${this.attachments.map(t=>t.imageUrl?c`<div class="chat-message-attachment-list__image-wrapper">
|
|
579
|
+
<img
|
|
580
|
+
class="chat-message-attachment-list__image"
|
|
581
|
+
src="${t.imageUrl}"
|
|
582
|
+
width="100%"
|
|
583
|
+
/>
|
|
584
|
+
<button
|
|
585
|
+
class="chat-message-attachment-list__image-button"
|
|
586
|
+
@click="${()=>this._downloadAttachment(t)}"
|
|
587
|
+
>
|
|
588
|
+
<svg
|
|
589
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
590
|
+
height="2.4em"
|
|
591
|
+
viewBox="0 -960 960 960"
|
|
592
|
+
width="2.4em"
|
|
593
|
+
fill="var(--surface-900)"
|
|
594
|
+
>
|
|
595
|
+
<path
|
|
596
|
+
d="M480-320 280-520l56-58 104 104v-326h80v326l104-104 56 58-200 200ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z"
|
|
597
|
+
/>
|
|
598
|
+
</svg>
|
|
599
|
+
</button>
|
|
600
|
+
</div>`:c`<button
|
|
601
|
+
class="chat-message-attachment-list__item"
|
|
602
|
+
@click="${()=>this._downloadAttachment(t)}"
|
|
603
|
+
>
|
|
604
|
+
<span class="chat-message-attachment-list__text"
|
|
605
|
+
>${t.name}</span
|
|
606
|
+
><span class="chat-message-attachment-list__text"
|
|
607
|
+
>${t.meta}</span
|
|
608
|
+
>
|
|
609
|
+
<svg
|
|
610
|
+
class="chat-message-attachment-list__icon"
|
|
611
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
612
|
+
height="2em"
|
|
613
|
+
viewBox="0 -960 960 960"
|
|
614
|
+
width="2em"
|
|
615
|
+
fill="var(--surface-700)"
|
|
616
|
+
>
|
|
617
|
+
<path
|
|
618
|
+
d="M360-240h240q17 0 28.5-11.5T640-280q0-17-11.5-28.5T600-320H360q-17 0-28.5 11.5T320-280q0 17 11.5 28.5T360-240Zm0-160h240q17 0 28.5-11.5T640-440q0-17-11.5-28.5T600-480H360q-17 0-28.5 11.5T320-440q0 17 11.5 28.5T360-400ZM240-80q-33 0-56.5-23.5T160-160v-640q0-33 23.5-56.5T240-880h287q16 0 30.5 6t25.5 17l194 194q11 11 17 25.5t6 30.5v447q0 33-23.5 56.5T720-80H240Zm280-560v-160H240v640h480v-440H560q-17 0-28.5-11.5T520-640ZM240-800v200-200 640-640Z"
|
|
619
|
+
/>
|
|
620
|
+
</svg>
|
|
621
|
+
</button>`)}
|
|
622
|
+
</div>`}}te([n({type:Array})],Et.prototype,"attachments");te([n({type:Boolean})],Et.prototype,"mine");var Ke=Object.defineProperty,Ye=(o,t,s,i)=>{for(var e=void 0,a=o.length-1,r;a>=0;a--)(r=o[a])&&(e=r(t,s,e)||e);return e&&Ke(t,s,e),e};class ee extends u{static{this.styles=[f,g`
|
|
623
|
+
:host {
|
|
624
|
+
display: flex;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
.chat-message-reply-to {
|
|
628
|
+
display: flex;
|
|
629
|
+
flex-grow: 1;
|
|
630
|
+
flex-direction: row;
|
|
631
|
+
gap: 0.8em;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
.chat-message-reply-to__container {
|
|
635
|
+
display: flex;
|
|
636
|
+
flex-direction: column;
|
|
637
|
+
gap: 0.4em;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
.chat-message-reply-to__text {
|
|
641
|
+
display: inline-block;
|
|
642
|
+
max-width: 100px;
|
|
643
|
+
overflow: hidden;
|
|
644
|
+
text-overflow: ellipsis;
|
|
645
|
+
font-size: 1.2em;
|
|
646
|
+
white-space: nowrap;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
.chat-message-reply-to__text--highlight {
|
|
650
|
+
font-weight: 600;
|
|
651
|
+
}
|
|
652
|
+
`]}render(){return c`<div class="chat-message-reply-to">
|
|
653
|
+
${this.replyTo.senderAvatar?c`<chat-avatar
|
|
654
|
+
.size="${2.4}"
|
|
655
|
+
.src="${this.replyTo.senderAvatar}"
|
|
656
|
+
></chat-avatar>`:h}
|
|
657
|
+
<div class="chat-message-reply-to__container">
|
|
658
|
+
<span
|
|
659
|
+
class="chat-message-reply-to__text chat-message-reply-to__text--highlight"
|
|
660
|
+
>${this.replyTo.senderName}</span
|
|
661
|
+
>
|
|
662
|
+
|
|
663
|
+
${this.replyTo.isDeleted?c`<chat-deleted-message
|
|
664
|
+
.fontSize="${1.2}"
|
|
665
|
+
></chat-deleted-message>`:c`<span class="chat-message-reply-to__text">
|
|
666
|
+
${this.replyTo.content}</span
|
|
667
|
+
>`}
|
|
668
|
+
</div>
|
|
669
|
+
</div>`}}Ye([n({type:Object})],ee.prototype,"replyTo");const st="i18n";var Je=Object.defineProperty,se=(o,t,s,i)=>{for(var e=void 0,a=o.length-1,r;a>=0;a--)(r=o[a])&&(e=r(t,s,e)||e);return e&&Je(t,s,e),e};class qt extends u{constructor(){super(...arguments),this.fontSize=1}static{this.styles=[f,g`
|
|
670
|
+
:host {
|
|
671
|
+
display: flex;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
.chat-deleted-message {
|
|
675
|
+
display: flex;
|
|
676
|
+
align-items: center;
|
|
677
|
+
white-space: nowrap;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
.chat-deleted-message__icon {
|
|
681
|
+
margin-right: 0.2em;
|
|
682
|
+
}
|
|
683
|
+
`]}render(){return c`<span
|
|
684
|
+
class="chat-deleted-message"
|
|
685
|
+
style="font-size: ${this.fontSize}em"
|
|
686
|
+
><svg
|
|
687
|
+
class="chat-deleted-message__icon"
|
|
688
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
689
|
+
height="1em"
|
|
690
|
+
viewBox="0 -960 960 960"
|
|
691
|
+
width="1em"
|
|
692
|
+
fill="var(--surface-700)"
|
|
693
|
+
>
|
|
694
|
+
<path
|
|
695
|
+
d="M280-120q-33 0-56.5-23.5T200-200v-520q-17 0-28.5-11.5T160-760q0-17 11.5-28.5T200-800h160q0-17 11.5-28.5T400-840h160q17 0 28.5 11.5T600-800h160q17 0 28.5 11.5T800-760q0 17-11.5 28.5T760-720v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM400-280q17 0 28.5-11.5T440-320v-280q0-17-11.5-28.5T400-640q-17 0-28.5 11.5T360-600v280q0 17 11.5 28.5T400-280Zm160 0q17 0 28.5-11.5T600-320v-280q0-17-11.5-28.5T560-640q-17 0-28.5 11.5T520-600v280q0 17 11.5 28.5T560-280ZM280-720v520-520Z"
|
|
696
|
+
/></svg
|
|
697
|
+
>${this.i18nContext.i18n.deletedMessage}</span
|
|
698
|
+
>`}}se([x({context:st,subscribe:!0}),n({type:Object})],qt.prototype,"i18nContext");se([n({type:Number})],qt.prototype,"fontSize");var Ge=Object.defineProperty,w=(o,t,s,i)=>{for(var e=void 0,a=o.length-1,r;a>=0;a--)(r=o[a])&&(e=r(t,s,e)||e);return e&&Ge(t,s,e),e};class b extends u{constructor(){super(...arguments),this.currentUserId=null,this.last=!1,this.isReplying=!1,this.isMarkdownAvailable=!1,this.myMessageActions=[],this.theirMessageActions=[],this.isEmojiReactionAvailable=!1,this.isReplyAvailable=!1,this.showTheirAvatar=!1,this.containerTop=0,this.containerBottom=0,this._timer=null,this._hover=!1,this._showActionList=!1,this._showEmojiPicker=!1,this._content="",this._showPopupAbove=!0}async updated(t){if(t.has("message")||t.has("isMarkdownAvailable"))if(this.isMarkdownAvailable){const{micromark:s}=await Promise.resolve().then(()=>require("./index-ChjDCgwc.cjs"));this._content=s(this.message.content)}else this._content=this.message.content}get _mine(){return this.message.senderId===this.currentUserId}get _isMessageActionAvailable(){return this._mine&&this.myMessageActions.length>0||!this._mine&&this.theirMessageActions.length>0}get _isMessageMenuAvailable(){return this.isEmojiReactionAvailable||this.isReplyAvailable||this._isMessageActionAvailable}_onMouseEnter(){clearTimeout(this._timer),this._hover=!0}_onMouseLeave(){this._timer=setTimeout(()=>{this._hover=!1},200)}_calculatePopupPosition(){const t=this.chatMessageMenu.getBoundingClientRect(),s=this.containerBottom-t.bottom,i=t.top-this.containerTop;this._showPopupAbove=i>=s}_toggleEmojiPicker(){this._calculatePopupPosition(),this._showEmojiPicker=!this._showEmojiPicker}_closeEmojiPicker(){this._showEmojiPicker=!1}_openActionList(){this._calculatePopupPosition(),this._showActionList=!0}_closeActionList(){this._showActionList=!1}static{this.styles=[f,g`
|
|
699
|
+
:host {
|
|
700
|
+
display: flex;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
.chat-message-item {
|
|
704
|
+
display: flex;
|
|
705
|
+
flex-direction: row;
|
|
706
|
+
gap: 0.8em;
|
|
707
|
+
margin-right: 40%;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
.chat-message-item--last {
|
|
711
|
+
margin-bottom: 1.6em;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
.chat-message-item--mine {
|
|
715
|
+
max-width: 60%;
|
|
716
|
+
margin-right: 0;
|
|
717
|
+
margin-left: auto;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
.chat-message-item__container {
|
|
721
|
+
position: relative;
|
|
722
|
+
display: flex;
|
|
723
|
+
flex-direction: column;
|
|
724
|
+
gap: 0.8em;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
.chat-message-item__meta {
|
|
728
|
+
display: flex;
|
|
729
|
+
flex-direction: row;
|
|
730
|
+
gap: 0.8em;
|
|
731
|
+
align-items: baseline;
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
.chat-message-item__name {
|
|
735
|
+
display: inline-block;
|
|
736
|
+
max-width: 100px;
|
|
737
|
+
overflow: hidden;
|
|
738
|
+
text-overflow: ellipsis;
|
|
739
|
+
font-size: 1.2em;
|
|
740
|
+
font-weight: 600;
|
|
741
|
+
white-space: nowrap;
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
.chat-message-item__date {
|
|
745
|
+
font-size: 0.8em;
|
|
746
|
+
font-weight: 600;
|
|
747
|
+
color: var(--surface-700);
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
.chat-message-item__body {
|
|
751
|
+
position: relative;
|
|
752
|
+
display: flex;
|
|
753
|
+
flex-direction: column;
|
|
754
|
+
gap: 0.8em;
|
|
755
|
+
padding: 0.8em 1.2em;
|
|
756
|
+
font-size: 1.4em;
|
|
757
|
+
background-color: var(--surface-100);
|
|
758
|
+
border-radius: 0.8em;
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
.chat-message-item__body--mine {
|
|
762
|
+
background-color: var(--surface-200);
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
.chat-message-item__body--deleted {
|
|
766
|
+
background-color: var(--deleted);
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
.chat-message-item--selected .chat-message-item__body {
|
|
770
|
+
background-color: var(--surface-300);
|
|
771
|
+
}
|
|
772
|
+
`]}render(){return c`<div
|
|
773
|
+
class="${A({"chat-message-item":!0,"chat-message-item--mine":this._mine,"chat-message-item--last":this.last,"chat-message-item--selected":this.isReplying||this.message.isSelected})}"
|
|
774
|
+
>
|
|
775
|
+
${!this._mine&&this.showTheirAvatar?c`<chat-avatar .src="${this.message.senderAvatar}"></chat-avatar>`:h}
|
|
776
|
+
<div class="chat-message-item__container">
|
|
777
|
+
${this._mine?h:c`<div class="chat-message-item__meta">
|
|
778
|
+
<span class="chat-message-item__name"
|
|
779
|
+
>${this.message.senderName}</span
|
|
780
|
+
><span class="chat-message-item__date"
|
|
781
|
+
>${this.message.timestamp}</span
|
|
782
|
+
>
|
|
783
|
+
</div>`}
|
|
784
|
+
<div
|
|
785
|
+
class="${A({"chat-message-item__body":!0,"chat-message-item__body--mine":this._mine,"chat-message-item__body--deleted":this.message.isDeleted})}"
|
|
786
|
+
@mouseenter="${this._onMouseEnter}"
|
|
787
|
+
@mouseleave="${this._onMouseLeave}"
|
|
788
|
+
>
|
|
789
|
+
${this.message.replyTo&&!this.message.isDeleted?c`<chat-message-reply-to
|
|
790
|
+
.replyTo="${this.message.replyTo}"
|
|
791
|
+
></chat-message-reply-to>`:h}
|
|
792
|
+
${this.message.isDeleted?c`<chat-deleted-message
|
|
793
|
+
.fontSize="${1.4}"
|
|
794
|
+
></chat-deleted-message>`:this.message.content!==""?c`<span
|
|
795
|
+
>${this.isMarkdownAvailable?Ne(this._content):this._content}</span
|
|
796
|
+
>`:h}
|
|
797
|
+
${!this.message.isDeleted&&this.message.attachments.length>0?c`<chat-message-attachment-list
|
|
798
|
+
style="margin-top: 0.8em;"
|
|
799
|
+
.attachments=${this.message.attachments}
|
|
800
|
+
.mine="${this._mine}"
|
|
801
|
+
></chat-message-attachment-list>`:h}
|
|
802
|
+
${!this.message.isDeleted&&this._hover&&this._isMessageMenuAvailable?c`<chat-message-menu
|
|
803
|
+
style="position: absolute; bottom: 0; left: ${this._mine?"auto":"calc(100% + 0.4em)"}; right: ${this._mine?"calc(100% + 0.4em)":"auto"};"
|
|
804
|
+
.mine="${this._mine}"
|
|
805
|
+
.message="${this.message}"
|
|
806
|
+
.isEmojiReactionAvailable="${this.isEmojiReactionAvailable}"
|
|
807
|
+
.isReplyAvailable="${this.isReplyAvailable}"
|
|
808
|
+
.isMessageActionAvailable="${this._isMessageActionAvailable}"
|
|
809
|
+
@click-emoji-button="${this._toggleEmojiPicker}"
|
|
810
|
+
@click-action-button="${this._openActionList}"
|
|
811
|
+
></chat-message-menu>`:h}
|
|
812
|
+
${!this.message.isDeleted&&this._showActionList?c`<chat-action-list
|
|
813
|
+
style="position: absolute; top: ${this._showPopupAbove?"auto":"calc(100% + 0.4em)"}; bottom: ${this._showPopupAbove?"4em":"auto"}; ${this._mine?"right: calc(100% + 0.4em);":"left: calc(100% + 0.4em);"} z-index: 1;"
|
|
814
|
+
.actionType="${"message"}"
|
|
815
|
+
.messageId="${this.message.id}"
|
|
816
|
+
.actions="${this._mine?this.myMessageActions:this.theirMessageActions}"
|
|
817
|
+
@select-action="${this._closeActionList}"
|
|
818
|
+
@close="${this._closeActionList}"
|
|
819
|
+
></chat-action-list>`:h}
|
|
820
|
+
${!this.message.isDeleted&&this.isEmojiReactionAvailable&&this._showEmojiPicker?c`<chat-emoji-picker
|
|
821
|
+
style="position: absolute; top: ${this._showPopupAbove?"auto":"calc(100% + 0.4em)"}; bottom: ${this._showPopupAbove?"4em":"auto"}; ${this._mine?"right: 50%;":"left: 50%;"} z-index: 1;"
|
|
822
|
+
.width="${300}"
|
|
823
|
+
.height="${180}"
|
|
824
|
+
.messageId="${this.message.id}"
|
|
825
|
+
@select-emoji="${this._closeEmojiPicker}"
|
|
826
|
+
@close="${this._closeEmojiPicker}"
|
|
827
|
+
></chat-emoji-picker>`:h}
|
|
828
|
+
</div>
|
|
829
|
+
${!this.message.isDeleted&&this.message.reactions.size>0?c`<chat-message-reaction-list
|
|
830
|
+
.messageId="${this.message.id}"
|
|
831
|
+
.mine="${this._mine}"
|
|
832
|
+
.reactions="${this.message.reactions}"
|
|
833
|
+
></chat-message-reaction-list>`:h}
|
|
834
|
+
</div>
|
|
835
|
+
</div>`}}w([x({context:X,subscribe:!0}),n({type:String})],b.prototype,"currentUserId");w([n({type:Object})],b.prototype,"message");w([n({type:Boolean})],b.prototype,"last");w([n({type:Boolean})],b.prototype,"isReplying");w([n({type:Boolean})],b.prototype,"isMarkdownAvailable");w([n({type:Array})],b.prototype,"myMessageActions");w([n({type:Array})],b.prototype,"theirMessageActions");w([n({type:Boolean})],b.prototype,"isEmojiReactionAvailable");w([n({type:Boolean})],b.prototype,"isReplyAvailable");w([n({type:Boolean})],b.prototype,"showTheirAvatar");w([n({type:Number})],b.prototype,"containerTop");w([n({type:Number})],b.prototype,"containerBottom");w([R("chat-message-menu")],b.prototype,"chatMessageMenu");w([y()],b.prototype,"_timer");w([y()],b.prototype,"_hover");w([y()],b.prototype,"_showActionList");w([y()],b.prototype,"_showEmojiPicker");w([y()],b.prototype,"_content");w([y()],b.prototype,"_showPopupAbove");var Qe=Object.defineProperty,Xe=(o,t,s,i)=>{for(var e=void 0,a=o.length-1,r;a>=0;a--)(r=o[a])&&(e=r(t,s,e)||e);return e&&Qe(t,s,e),e};class ie extends u{constructor(){super(...arguments),this.size=3.2}static{this.styles=[f,g`
|
|
836
|
+
:host {
|
|
837
|
+
display: flex;
|
|
838
|
+
align-self: center;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
.chat-loader {
|
|
842
|
+
border: 0.4em solid var(--surface-300);
|
|
843
|
+
border-top: 0.4em solid var(--surface-500);
|
|
844
|
+
border-radius: 50%;
|
|
845
|
+
animation: spin 1s linear infinite;
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
@keyframes spin {
|
|
849
|
+
0% {
|
|
850
|
+
transform: rotate(0deg);
|
|
851
|
+
}
|
|
852
|
+
100% {
|
|
853
|
+
transform: rotate(360deg);
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
`]}render(){return c`<div
|
|
857
|
+
class="chat-loader"
|
|
858
|
+
style="width: ${this.size}em; height: ${this.size}em;"
|
|
859
|
+
></div>`}}Xe([n({type:Number})],ie.prototype,"size");var ts=Object.defineProperty,es=(o,t,s,i)=>{for(var e=void 0,a=o.length-1,r;a>=0;a--)(r=o[a])&&(e=r(t,s,e)||e);return e&&ts(t,s,e),e};class oe extends u{constructor(){super(...arguments),this.suggestions=[]}_selectSuggestion(t){this.dispatchEvent(new CustomEvent("select-suggestion",{detail:{suggestion:t},composed:!0}))}static{this.styles=[f,g`
|
|
860
|
+
:host {
|
|
861
|
+
display: flex;
|
|
862
|
+
align-self: flex-end;
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
.chat-suggestion-list {
|
|
866
|
+
display: flex;
|
|
867
|
+
flex-direction: column;
|
|
868
|
+
gap: 8px;
|
|
869
|
+
margin-bottom: 1.6em;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
.chat-suggestion-list__item {
|
|
873
|
+
min-width: 45%;
|
|
874
|
+
max-width: 45%;
|
|
875
|
+
padding: 0.8em 1.2em;
|
|
876
|
+
margin-right: 0;
|
|
877
|
+
margin-left: auto;
|
|
878
|
+
font-size: 1.4em;
|
|
879
|
+
text-align: left;
|
|
880
|
+
background-color: var(--surface-200);
|
|
881
|
+
border: none;
|
|
882
|
+
border-radius: 8px;
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
.chat-suggestion-list__item:hover {
|
|
886
|
+
background-color: var(--surface-300);
|
|
887
|
+
}
|
|
888
|
+
`]}render(){return c`<div class="chat-suggestion-list">
|
|
889
|
+
${this.suggestions.map(t=>c`<button
|
|
890
|
+
class="chat-suggestion-list__item"
|
|
891
|
+
@click="${()=>this._selectSuggestion(t)}"
|
|
892
|
+
>
|
|
893
|
+
${t.text}
|
|
894
|
+
</button>`)}
|
|
895
|
+
</div>`}}es([n({type:Array})],oe.prototype,"suggestions");class ss extends u{static{this.styles=[f,g`
|
|
896
|
+
:host {
|
|
897
|
+
display: flex;
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
.chat-message-typing {
|
|
901
|
+
display: flex;
|
|
902
|
+
flex-direction: row;
|
|
903
|
+
gap: 0.8em;
|
|
904
|
+
margin-right: 40%;
|
|
905
|
+
margin-bottom: 1.6em;
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
.chat-message-typing__avatar {
|
|
909
|
+
display: flex;
|
|
910
|
+
align-items: center;
|
|
911
|
+
justify-content: center;
|
|
912
|
+
width: 4em;
|
|
913
|
+
height: 4em;
|
|
914
|
+
background-color: transparent;
|
|
915
|
+
border-radius: 50%;
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
.chat-message-typing__body {
|
|
919
|
+
position: relative;
|
|
920
|
+
display: flex;
|
|
921
|
+
flex-direction: row;
|
|
922
|
+
gap: 0.8em;
|
|
923
|
+
align-items: center;
|
|
924
|
+
padding: 0.8em 1.2em;
|
|
925
|
+
background-color: var(--surface-100);
|
|
926
|
+
border-radius: 0.8em;
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
.chat-message-typing__dot {
|
|
930
|
+
display: flex;
|
|
931
|
+
align-items: center;
|
|
932
|
+
justify-content: center;
|
|
933
|
+
width: 0.8em;
|
|
934
|
+
height: 0.8em;
|
|
935
|
+
background-color: var(--surface-300);
|
|
936
|
+
border-radius: 50%;
|
|
937
|
+
animation: typing 0.8s infinite alternate;
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
.chat-message-typing__dot:nth-child(2) {
|
|
941
|
+
animation-delay: 0.2s;
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
.chat-message-typing__dot:nth-child(3) {
|
|
945
|
+
animation-delay: 0.4s;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
@keyframes typing {
|
|
949
|
+
0% {
|
|
950
|
+
background-color: var(--surface-300);
|
|
951
|
+
transform: scale(1);
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
50% {
|
|
955
|
+
background-color: var(--surface-400);
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
100% {
|
|
959
|
+
background-color: var(--surface-500);
|
|
960
|
+
transform: scale(1.25);
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
`]}render(){return c`<div class="chat-message-typing">
|
|
964
|
+
<div class="chat-message-typing__avatar"></div>
|
|
965
|
+
<div class="chat-message-typing__body">
|
|
966
|
+
<div class="chat-message-typing__dot"></div>
|
|
967
|
+
<div class="chat-message-typing__dot"></div>
|
|
968
|
+
<div class="chat-message-typing__dot"></div>
|
|
969
|
+
</div>
|
|
970
|
+
</div>`}}var is=Object.defineProperty,os=(o,t,s,i)=>{for(var e=void 0,a=o.length-1,r;a>=0;a--)(r=o[a])&&(e=r(t,s,e)||e);return e&&is(t,s,e),e};class ae extends u{static{this.styles=[f,g`
|
|
971
|
+
:host {
|
|
972
|
+
display: flex;
|
|
973
|
+
justify-content: center;
|
|
974
|
+
width: 100%;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
.chat-message-divider {
|
|
978
|
+
display: flex;
|
|
979
|
+
flex-grow: 1;
|
|
980
|
+
align-items: center;
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
.chat-message-divider::before,
|
|
984
|
+
.chat-message-divider::after {
|
|
985
|
+
flex: 1;
|
|
986
|
+
margin: 0 0.8em;
|
|
987
|
+
content: "";
|
|
988
|
+
border-top: 1px solid var(--border);
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
.chat-message-divider__text {
|
|
992
|
+
display: inline-block;
|
|
993
|
+
max-width: 24em;
|
|
994
|
+
overflow: hidden;
|
|
995
|
+
text-overflow: ellipsis;
|
|
996
|
+
font-size: 1.2em;
|
|
997
|
+
font-weight: 600;
|
|
998
|
+
color: var(--surface-600);
|
|
999
|
+
white-space: nowrap;
|
|
1000
|
+
}
|
|
1001
|
+
`]}render(){return c`<div class="chat-message-divider">
|
|
1002
|
+
<span class="chat-message-divider__text">${this.message.content} </span>
|
|
1003
|
+
</div>`}}os([n({type:Object})],ae.prototype,"message");var as=Object.defineProperty,rs=(o,t,s,i)=>{for(var e=void 0,a=o.length-1,r;a>=0;a--)(r=o[a])&&(e=r(t,s,e)||e);return e&&as(t,s,e),e};class re extends u{constructor(){super(...arguments),this._onClickNotificationBadge=()=>{this.dispatchEvent(new CustomEvent("click-notification-badge"))}}static{this.styles=[f,g`
|
|
1004
|
+
:host {
|
|
1005
|
+
position: sticky;
|
|
1006
|
+
bottom: 1.6em;
|
|
1007
|
+
display: flex;
|
|
1008
|
+
align-self: center;
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
.chat-notification-badge {
|
|
1012
|
+
padding: 0.8em;
|
|
1013
|
+
color: var(--chat-notification-badge-text);
|
|
1014
|
+
background-color: var(--chat-notification-badge-background);
|
|
1015
|
+
border: none;
|
|
1016
|
+
border-radius: 10em;
|
|
1017
|
+
box-shadow: var(--floating-item-box-shadow);
|
|
1018
|
+
}
|
|
1019
|
+
`]}render(){return c`<button
|
|
1020
|
+
class="chat-notification-badge"
|
|
1021
|
+
@click="${this._onClickNotificationBadge}"
|
|
1022
|
+
>
|
|
1023
|
+
${this.i18nContext.i18n.newMeessageNotification}
|
|
1024
|
+
</button>`}}rs([x({context:st,subscribe:!0}),n({type:Object})],re.prototype,"i18nContext");const Mt="message";var ns=Object.defineProperty,U=(o,t,s,i)=>{for(var e=void 0,a=o.length-1,r;a>=0;a--)(r=o[a])&&(e=r(t,s,e)||e);return e&&ns(t,s,e),e};class P extends u{constructor(){super(...arguments),this._showScrollToBottomButton=!1,this._showNotificationBadge=!1,this._rectTop=0,this._rectBottom=0}get _isWithinClientHeight(){return this.scrollHeight-this.scrollTop-this.clientHeight<=this.clientHeight}_scrollToBottom(t,s="smooth"){this.chatMessageListBottom.scrollIntoView({behavior:s})}firstUpdated(){setTimeout(()=>{const s=this.getBoundingClientRect();this._rectTop=s.top,this._rectBottom=s.bottom});const t=new IntersectionObserver(s=>{if(!this.messageContext.isLoadingMessage)for(const i of s)i.target.classList.contains("chat-message-list__bottom")&&(i.isIntersecting?(this._showScrollToBottomButton=!1,this._showNotificationBadge=!1):this._showScrollToBottomButton=!0),i.isIntersecting&&i.target.classList.contains("chat-message-list__top")&&this.dispatchEvent(new CustomEvent("load-more-messages",{composed:!0}))});t.observe(this.chatMessageListTop),t.observe(this.chatMessageListBottom)}updated(t){if(t.has("messageContext")){const{id:s,roomId:i}=t.get("messageContext")?.messages[0]??{},e=t.get("messageContext")?.messages.length??0,a=this.scrollHeight,r=this.scrollTop,{id:p,roomId:l}=this.messageContext.messages[0]??{},_=this.messageContext.messages.length;if(i!==l){setTimeout(()=>{this._scrollToBottom(null,"instant")});return}_>e&&(s!==p?setTimeout(()=>{const $=this.scrollHeight;this.scrollTop=r+($-a)}):this._isWithinClientHeight?setTimeout(()=>{this._scrollToBottom(null,"smooth")}):this._showNotificationBadge=!0)}}static{this.styles=[f,g`
|
|
1025
|
+
:host {
|
|
1026
|
+
display: flex;
|
|
1027
|
+
flex-grow: 1;
|
|
1028
|
+
padding: 1.6em 1.2em;
|
|
1029
|
+
overflow-y: scroll;
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
.chat-message-list {
|
|
1033
|
+
position: relative;
|
|
1034
|
+
display: flex;
|
|
1035
|
+
flex-direction: column;
|
|
1036
|
+
gap: 1.6em;
|
|
1037
|
+
width: 100%;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
.chat-message-list__top {
|
|
1041
|
+
height: 0.1em;
|
|
1042
|
+
margin-bottom: -1.7em;
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
.chat-message-list__bottom {
|
|
1046
|
+
height: 0.1em;
|
|
1047
|
+
margin-top: -1.7em;
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
.chat-message-list__button {
|
|
1051
|
+
position: sticky;
|
|
1052
|
+
bottom: 0;
|
|
1053
|
+
left: 100%;
|
|
1054
|
+
z-index: 2;
|
|
1055
|
+
display: flex;
|
|
1056
|
+
align-items: center;
|
|
1057
|
+
align-self: flex-end;
|
|
1058
|
+
justify-content: center;
|
|
1059
|
+
padding: 0.8em;
|
|
1060
|
+
background-color: var(--surface-50);
|
|
1061
|
+
border: var(--floating-item-border);
|
|
1062
|
+
border-radius: 100%;
|
|
1063
|
+
box-shadow: var(--floating-item-box-shadow);
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
.chat-message-list__button:hover {
|
|
1067
|
+
background-color: var(--surface-100);
|
|
1068
|
+
}
|
|
1069
|
+
`]}render(){return c`
|
|
1070
|
+
<div class="chat-message-list">
|
|
1071
|
+
<div class="chat-message-list__top"></div>
|
|
1072
|
+
${this.messageContext.isLoadingMessage?c`<chat-loader
|
|
1073
|
+
style="position: absolute; top: 50%; transform: translateY(-50%);"
|
|
1074
|
+
></chat-loader>`:c` ${!this.messageContext.isLoadingMessage&&this.messageContext.isLoadingMoreMessages?c`<chat-loader></chat-loader>`:h}
|
|
1075
|
+
${this.messageContext.messages.map((t,s)=>t.type==="message"?c`<chat-message-item
|
|
1076
|
+
.message="${t}"
|
|
1077
|
+
.last="${s===this.messageContext.messages.length-1}"
|
|
1078
|
+
.isReplying=${this.messageContext.replyTo?.id===t.id}
|
|
1079
|
+
.isMarkdownAvailable="${this.messageContext.isMarkdownAvailable}"
|
|
1080
|
+
.myMessageActions="${this.messageContext.myMessageActions}"
|
|
1081
|
+
.theirMessageActions="${this.messageContext.theirMessageActions}"
|
|
1082
|
+
.isEmojiReactionAvailable="${this.messageContext.isEmojiReactionAvailable}"
|
|
1083
|
+
.isReplyAvailable="${this.messageContext.isReplyAvailable}"
|
|
1084
|
+
.showTheirAvatar="${this.messageContext.showTheirAvatar}"
|
|
1085
|
+
.containerTop="${this._rectTop}"
|
|
1086
|
+
.containerBottom="${this._rectBottom}"
|
|
1087
|
+
></chat-message-item>`:t.type==="divider"?c`<chat-message-divider
|
|
1088
|
+
.message="${t}"
|
|
1089
|
+
></chat-message-divider>`:h)}
|
|
1090
|
+
${this.messageContext.isTyping?c`<chat-message-typing></chat-message-typing>`:h}
|
|
1091
|
+
${this.messageContext.suggestions.length>0?c`<chat-suggestion-list
|
|
1092
|
+
.suggestions="${this.messageContext.suggestions}"
|
|
1093
|
+
></chat-suggestion-list>`:h}
|
|
1094
|
+
<button
|
|
1095
|
+
class="chat-message-list__button"
|
|
1096
|
+
style="display: ${this._showScrollToBottomButton?"flex":"none"}"
|
|
1097
|
+
@click="${this._scrollToBottom}"
|
|
1098
|
+
>
|
|
1099
|
+
<svg
|
|
1100
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1101
|
+
height="2.4em"
|
|
1102
|
+
viewBox="0 -960 960 960"
|
|
1103
|
+
width="2.4em"
|
|
1104
|
+
fill="var(--surface-700)"
|
|
1105
|
+
>
|
|
1106
|
+
<path
|
|
1107
|
+
d="M440-313v-447q0-17 11.5-28.5T480-800q17 0 28.5 11.5T520-760v447l196-196q12-12 28-11.5t28 12.5q11 12 11.5 28T772-452L508-188q-6 6-13 8.5t-15 2.5q-8 0-15-2.5t-13-8.5L188-452q-11-11-11-27.5t11-28.5q12-12 28.5-12t28.5 12l195 195Z"
|
|
1108
|
+
/>
|
|
1109
|
+
</svg>
|
|
1110
|
+
</button>`}
|
|
1111
|
+
<div class="chat-message-list__bottom"></div>
|
|
1112
|
+
${this._showNotificationBadge?c`<chat-notification-badge
|
|
1113
|
+
@click-notification-badge="${this._scrollToBottom}"
|
|
1114
|
+
></chat-notification-badge>`:h}
|
|
1115
|
+
</div>
|
|
1116
|
+
`}}U([x({context:Mt,subscribe:!0}),n({type:Object})],P.prototype,"messageContext");U([R(".chat-message-list__top")],P.prototype,"chatMessageListTop");U([R(".chat-message-list__bottom")],P.prototype,"chatMessageListBottom");U([y()],P.prototype,"_showScrollToBottomButton");U([y()],P.prototype,"_showNotificationBadge");U([y()],P.prototype,"_rectTop");U([y()],P.prototype,"_rectBottom");var cs=Object.defineProperty,hs=(o,t,s,i)=>{for(var e=void 0,a=o.length-1,r;a>=0;a--)(r=o[a])&&(e=r(t,s,e)||e);return e&&cs(t,s,e),e};class ne extends u{_cancelReply(){this.dispatchEvent(new CustomEvent("cancel-reply",{composed:!0}))}static{this.styles=[f,g`
|
|
1117
|
+
:host {
|
|
1118
|
+
display: flex;
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
.chat-footer-reply-to-section {
|
|
1122
|
+
display: flex;
|
|
1123
|
+
flex-direction: row;
|
|
1124
|
+
gap: 0.2em;
|
|
1125
|
+
align-items: center;
|
|
1126
|
+
font-size: 1em;
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
.chat-footer-reply-to-section__name {
|
|
1130
|
+
display: inline-block;
|
|
1131
|
+
max-width: 100px;
|
|
1132
|
+
overflow: hidden;
|
|
1133
|
+
text-overflow: ellipsis;
|
|
1134
|
+
font-weight: 600;
|
|
1135
|
+
white-space: nowrap;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
.chat-footer-reply-to-section__button {
|
|
1139
|
+
display: flex;
|
|
1140
|
+
align-items: center;
|
|
1141
|
+
justify-content: center;
|
|
1142
|
+
padding: 0.2em;
|
|
1143
|
+
margin-right: 0.4em;
|
|
1144
|
+
background-color: transparent;
|
|
1145
|
+
border: none;
|
|
1146
|
+
border-radius: 100px;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
.chat-footer-reply-to-section__button:hover {
|
|
1150
|
+
background-color: var(--surface-200);
|
|
1151
|
+
}
|
|
1152
|
+
`]}render(){return c`<div class="chat-footer-reply-to-section">
|
|
1153
|
+
<button
|
|
1154
|
+
class="chat-footer-reply-to-section__button"
|
|
1155
|
+
@click="${this._cancelReply}"
|
|
1156
|
+
aria-label="Cancel reply"
|
|
1157
|
+
>
|
|
1158
|
+
<svg
|
|
1159
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1160
|
+
height="1.6em"
|
|
1161
|
+
viewBox="0 -960 960 960"
|
|
1162
|
+
width="1.6em"
|
|
1163
|
+
fill="var(--surface-700)"
|
|
1164
|
+
>
|
|
1165
|
+
<path
|
|
1166
|
+
d="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"
|
|
1167
|
+
/>
|
|
1168
|
+
</svg>
|
|
1169
|
+
</button>
|
|
1170
|
+
Reply to
|
|
1171
|
+
<span class="chat-footer-reply-to-section__name"
|
|
1172
|
+
>${this.replyTo.senderName}</span
|
|
1173
|
+
>
|
|
1174
|
+
</div>`}}hs([n({type:Object})],ne.prototype,"replyTo");var ls=Object.defineProperty,ds=(o,t,s,i)=>{for(var e=void 0,a=o.length-1,r;a>=0;a--)(r=o[a])&&(e=r(t,s,e)||e);return e&&ls(t,s,e),e};class ce extends u{constructor(){super(...arguments),this.attachments=[]}_removeAttachment(t){this.dispatchEvent(new CustomEvent("remove-attachment",{detail:{attachment:t},composed:!0}))}static{this.styles=[f,g`
|
|
1175
|
+
:host {
|
|
1176
|
+
display: flex;
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
.chat-footer-attachment-section {
|
|
1180
|
+
display: flex;
|
|
1181
|
+
flex-grow: 1;
|
|
1182
|
+
flex-direction: row;
|
|
1183
|
+
gap: 0.8em;
|
|
1184
|
+
align-items: center;
|
|
1185
|
+
width: 0;
|
|
1186
|
+
overflow-x: scroll;
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
.chat-footer-attachment-section__item {
|
|
1190
|
+
display: flex;
|
|
1191
|
+
flex-direction: column;
|
|
1192
|
+
justify-content: space-between;
|
|
1193
|
+
min-width: 12em;
|
|
1194
|
+
min-height: 6.4em;
|
|
1195
|
+
padding: 0.4em;
|
|
1196
|
+
background-color: var(--surface-200);
|
|
1197
|
+
border-radius: 0.8em;
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
.chat-footer-attachment-section__button {
|
|
1201
|
+
display: flex;
|
|
1202
|
+
align-items: center;
|
|
1203
|
+
align-self: flex-end;
|
|
1204
|
+
justify-content: center;
|
|
1205
|
+
padding: 0.4em;
|
|
1206
|
+
background-color: transparent;
|
|
1207
|
+
border: none;
|
|
1208
|
+
border-radius: 10em;
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
.chat-footer-attachment-section__button:hover {
|
|
1212
|
+
background-color: var(--surface-300);
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
.chat-footer-attachment-section__text {
|
|
1216
|
+
display: inline-block;
|
|
1217
|
+
align-self: flex-start;
|
|
1218
|
+
max-width: 10em;
|
|
1219
|
+
overflow: hidden;
|
|
1220
|
+
text-overflow: ellipsis;
|
|
1221
|
+
font-size: 1em;
|
|
1222
|
+
white-space: nowrap;
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
.chat-footer-attachment-section__text--highlight {
|
|
1226
|
+
font-weight: 600;
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
.chat-footer-attachment-section__image-wrapper {
|
|
1230
|
+
position: relative;
|
|
1231
|
+
height: 6.4em;
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
.chat-footer-attachment-section__image {
|
|
1235
|
+
width: 12em;
|
|
1236
|
+
height: 100%;
|
|
1237
|
+
object-fit: cover;
|
|
1238
|
+
border-radius: 0.8em;
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
.chat-footer-attachment-section__image-button {
|
|
1242
|
+
position: absolute;
|
|
1243
|
+
top: 0.4em;
|
|
1244
|
+
right: 0.4em;
|
|
1245
|
+
background-color: var(--surface-50);
|
|
1246
|
+
border-radius: 10em;
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
.chat-footer-attachment-section__image-button:hover {
|
|
1250
|
+
background-color: var(--surface-100);
|
|
1251
|
+
}
|
|
1252
|
+
`]}render(){return c`<div class="chat-footer-attachment-section">
|
|
1253
|
+
${this.attachments.map(t=>t.imageUrl?c`<div class="chat-footer-attachment-section__image-wrapper">
|
|
1254
|
+
<img
|
|
1255
|
+
class="chat-footer-attachment-section__image"
|
|
1256
|
+
src="${t.imageUrl}"
|
|
1257
|
+
height="100%"
|
|
1258
|
+
width="120"
|
|
1259
|
+
/><button
|
|
1260
|
+
class="chat-footer-attachment-section__button chat-footer-attachment-section__image-button"
|
|
1261
|
+
@click="${()=>this._removeAttachment(t)}"
|
|
1262
|
+
>
|
|
1263
|
+
<svg
|
|
1264
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1265
|
+
height="1.6em"
|
|
1266
|
+
viewBox="0 -960 960 960"
|
|
1267
|
+
width="1.6em"
|
|
1268
|
+
fill="var(--surface-700)"
|
|
1269
|
+
>
|
|
1270
|
+
<path
|
|
1271
|
+
d="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"
|
|
1272
|
+
/>
|
|
1273
|
+
</svg>
|
|
1274
|
+
</button>
|
|
1275
|
+
</div>`:c`<div class="chat-footer-attachment-section__item">
|
|
1276
|
+
<button
|
|
1277
|
+
class="chat-footer-attachment-section__button"
|
|
1278
|
+
@click="${()=>this._removeAttachment(t)}"
|
|
1279
|
+
>
|
|
1280
|
+
<svg
|
|
1281
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1282
|
+
height="1.6em"
|
|
1283
|
+
viewBox="0 -960 960 960"
|
|
1284
|
+
width="1.6em"
|
|
1285
|
+
fill="var(--surface-700)"
|
|
1286
|
+
>
|
|
1287
|
+
<path
|
|
1288
|
+
d="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"
|
|
1289
|
+
/>
|
|
1290
|
+
</svg>
|
|
1291
|
+
</button>
|
|
1292
|
+
<span
|
|
1293
|
+
class="chat-footer-attachment-section__text chat-footer-attachment-section__text--highlight"
|
|
1294
|
+
>${t.name}</span
|
|
1295
|
+
>
|
|
1296
|
+
<span class="chat-footer-attachment-section__text"
|
|
1297
|
+
>${t.meta}</span
|
|
1298
|
+
>
|
|
1299
|
+
</div>`)}
|
|
1300
|
+
</div>`}}ds([n({type:Array})],ce.prototype,"attachments");const he="footer";var ms=Object.defineProperty,E=(o,t,s,i)=>{for(var e=void 0,a=o.length-1,r;a>=0;a--)(r=o[a])&&(e=r(t,s,e)||e);return e&&ms(t,s,e),e};class T extends u{constructor(){super(...arguments),this.currentUserId=null,this._textareaValue="",this._showEmojiPicker=!1}updated(t){t.has("footerContext")&&t.get("footerContext")?.inputMessage!==this.footerContext.inputMessage&&(this._textareaValue=this.footerContext.inputMessage)}get _selectedRoom(){return this.roomContext.rooms.find(t=>t.id===this.roomContext.selectedRoomId)}get _isSendButtonEnabled(){return this._textareaValue.trim()!==""||this.footerContext.attachments.length>0}_handleTextareaInput(t){const s=t.target;this._textareaValue=s.value}_handleFileInput(){this._fileInput.click()}_handleFileChange(t){const i=t.target.files?.[0];i&&this.dispatchEvent(new CustomEvent("select-file",{detail:{file:i},composed:!0}))}_onSelectEmoji(t){this._textarea.value+=t.detail.emoji,this._showEmojiPicker=!1}_toggleEmojiPicker(){this._showEmojiPicker=!this._showEmojiPicker}_closeEmojiPicker(){this._showEmojiPicker=!1}_sendMessage(){this._isSendButtonEnabled&&(this.dispatchEvent(new CustomEvent("send-message",{detail:{roomId:this.roomContext.selectedRoomId,senderId:this.currentUserId,content:this._textareaValue.trim()},composed:!0})),this._textareaValue="")}static{this.styles=[f,g`
|
|
1301
|
+
:host {
|
|
1302
|
+
display: flex;
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
.chat-footer {
|
|
1306
|
+
display: flex;
|
|
1307
|
+
flex-grow: 1;
|
|
1308
|
+
flex-direction: column;
|
|
1309
|
+
gap: 0.8em;
|
|
1310
|
+
padding: 0.8em 1.2em;
|
|
1311
|
+
border-top: 0.1em solid var(--border);
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
.chat-footer__message {
|
|
1315
|
+
font-size: 1.2em;
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
.chat-footer__textarea {
|
|
1319
|
+
display: flex;
|
|
1320
|
+
flex-grow: 1;
|
|
1321
|
+
padding: 0.8em;
|
|
1322
|
+
font-size: 1.4em;
|
|
1323
|
+
outline: none;
|
|
1324
|
+
background-color: var(--surface-50);
|
|
1325
|
+
border: 0.1em solid var(--border);
|
|
1326
|
+
border-radius: 0.8em;
|
|
1327
|
+
box-shadow: none;
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
.chat-footer__textarea::placeholder {
|
|
1331
|
+
color: var(--placeholder);
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
.chat-footer__menu {
|
|
1335
|
+
position: relative;
|
|
1336
|
+
display: flex;
|
|
1337
|
+
flex-direction: row;
|
|
1338
|
+
gap: 0.8em;
|
|
1339
|
+
align-items: center;
|
|
1340
|
+
justify-content: space-between;
|
|
1341
|
+
height: 3.2em;
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
.chat-footer__button {
|
|
1345
|
+
display: flex;
|
|
1346
|
+
align-items: center;
|
|
1347
|
+
justify-content: center;
|
|
1348
|
+
padding: 0.4em;
|
|
1349
|
+
background-color: transparent;
|
|
1350
|
+
border: none;
|
|
1351
|
+
border-radius: 100px;
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
.chat-footer__file {
|
|
1355
|
+
display: none;
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
.chat-footer__button:hover {
|
|
1359
|
+
background-color: var(--surface-100);
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
.chat-footer__button--emoji {
|
|
1363
|
+
margin-right: auto;
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
.chat-footer__button--send {
|
|
1367
|
+
margin-left: auto;
|
|
1368
|
+
background-color: var(--surface-700);
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
.chat-footer__button--send:hover {
|
|
1372
|
+
background-color: var(--surface-800);
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
.chat-footer__button--disabled {
|
|
1376
|
+
pointer-events: none;
|
|
1377
|
+
opacity: 0.5;
|
|
1378
|
+
}
|
|
1379
|
+
`]}render(){return c`<footer class="chat-footer">
|
|
1380
|
+
${this._selectedRoom?.hasEnded?c`<span class="chat-footer__message"
|
|
1381
|
+
>${this.i18nContext.i18n.closedRoomMessage}</span
|
|
1382
|
+
>`:c` ${this.footerContext.attachments.length>0?c`<chat-footer-attachment-section
|
|
1383
|
+
.attachments=${this.footerContext.attachments}
|
|
1384
|
+
></chat-footer-attachment-section>`:h}
|
|
1385
|
+
${this.messageContext.replyTo?c`<chat-footer-reply-to-section
|
|
1386
|
+
.replyTo="${this.messageContext.replyTo}"
|
|
1387
|
+
></chat-footer-reply-to-section>`:h}
|
|
1388
|
+
<textarea
|
|
1389
|
+
class="chat-footer__textarea"
|
|
1390
|
+
.placeholder="${this.i18nContext.i18n.chatFooterTextareaPlaceholder}"
|
|
1391
|
+
.value="${this._textareaValue}"
|
|
1392
|
+
@input="${this._handleTextareaInput}"
|
|
1393
|
+
></textarea>
|
|
1394
|
+
<div class="chat-footer__menu">
|
|
1395
|
+
${this.footerContext.isMessageAttachmentAvailable?c`<button
|
|
1396
|
+
class="chat-footer__button"
|
|
1397
|
+
@click="${this._handleFileInput}"
|
|
1398
|
+
aria-label="Select file"
|
|
1399
|
+
>
|
|
1400
|
+
<svg
|
|
1401
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1402
|
+
height="2.4em"
|
|
1403
|
+
viewBox="0 -960 960 960"
|
|
1404
|
+
width="2.4em"
|
|
1405
|
+
fill="var(--surface-700)"
|
|
1406
|
+
>
|
|
1407
|
+
<path
|
|
1408
|
+
d="M720-330q0 104-73 177T470-80q-104 0-177-73t-73-177v-370q0-75 52.5-127.5T400-880q75 0 127.5 52.5T580-700v350q0 46-32 78t-78 32q-46 0-78-32t-32-78v-330q0-17 11.5-28.5T400-720q17 0 28.5 11.5T440-680v330q0 13 8.5 21.5T470-320q13 0 21.5-8.5T500-350v-350q-1-42-29.5-71T400-800q-42 0-71 29t-29 71v370q-1 71 49 120.5T470-160q70 0 119-49.5T640-330v-350q0-17 11.5-28.5T680-720q17 0 28.5 11.5T720-680v350Z"
|
|
1409
|
+
/>
|
|
1410
|
+
</svg>
|
|
1411
|
+
</button>
|
|
1412
|
+
<input
|
|
1413
|
+
type="file"
|
|
1414
|
+
class="chat-footer__file"
|
|
1415
|
+
@change="${this._handleFileChange}"
|
|
1416
|
+
/>`:h}
|
|
1417
|
+
${this.footerContext.isEmojiPickerAvailable?c`<button
|
|
1418
|
+
class="chat-footer__button chat-footer__button--emoji"
|
|
1419
|
+
@click="${this._toggleEmojiPicker}"
|
|
1420
|
+
aria-label="Toggle emoji picker"
|
|
1421
|
+
>
|
|
1422
|
+
<svg
|
|
1423
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1424
|
+
height="2.4em"
|
|
1425
|
+
viewBox="0 -960 960 960"
|
|
1426
|
+
width="2.4em"
|
|
1427
|
+
fill="var(--surface-700)"
|
|
1428
|
+
>
|
|
1429
|
+
<path
|
|
1430
|
+
d="M620-520q25 0 42.5-17.5T680-580q0-25-17.5-42.5T620-640q-25 0-42.5 17.5T560-580q0 25 17.5 42.5T620-520Zm-280 0q25 0 42.5-17.5T400-580q0-25-17.5-42.5T340-640q-25 0-42.5 17.5T280-580q0 25 17.5 42.5T340-520ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 320q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-100q58 0 107-28t79-76q6-12-1-24t-21-12H316q-14 0-21 12t-1 24q30 48 79.5 76T480-260Z"
|
|
1431
|
+
/>
|
|
1432
|
+
</svg>
|
|
1433
|
+
</button>`:h}
|
|
1434
|
+
<button
|
|
1435
|
+
class="${A({"chat-footer__button":!0,"chat-footer__button--send":!0,"chat-footer__button--disabled":!this._isSendButtonEnabled})}"
|
|
1436
|
+
.disabled="${!this._isSendButtonEnabled}"
|
|
1437
|
+
@click="${this._sendMessage}"
|
|
1438
|
+
aria-label="Send message"
|
|
1439
|
+
>
|
|
1440
|
+
<svg
|
|
1441
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1442
|
+
height="2.4em"
|
|
1443
|
+
viewBox="0 -960 960 960"
|
|
1444
|
+
width="2.4em"
|
|
1445
|
+
fill="var(--surface-50)"
|
|
1446
|
+
>
|
|
1447
|
+
<path
|
|
1448
|
+
d="M440-647 244-451q-12 12-28 11.5T188-452q-11-12-11.5-28t11.5-28l264-264q6-6 13-8.5t15-2.5q8 0 15 2.5t13 8.5l264 264q11 11 11 27.5T772-452q-12 12-28.5 12T715-452L520-647v447q0 17-11.5 28.5T480-160q-17 0-28.5-11.5T440-200v-447Z"
|
|
1449
|
+
/>
|
|
1450
|
+
</svg>
|
|
1451
|
+
</button>
|
|
1452
|
+
${this.footerContext.isEmojiPickerAvailable?c`<chat-emoji-picker
|
|
1453
|
+
style="position: absolute; bottom: calc(100% + 0.8em); left: 0; display: ${this._showEmojiPicker?"block":"none"};"
|
|
1454
|
+
@select-emoji="${this._onSelectEmoji}"
|
|
1455
|
+
@close="${this._closeEmojiPicker}"
|
|
1456
|
+
></chat-emoji-picker>`:h}
|
|
1457
|
+
</div>`}
|
|
1458
|
+
</footer>`}}E([x({context:X,subscribe:!0}),n({type:String})],T.prototype,"currentUserId");E([x({context:dt,subscribe:!0}),n({type:Object})],T.prototype,"roomContext");E([x({context:Mt,subscribe:!0}),n({type:Object})],T.prototype,"messageContext");E([x({context:he,subscribe:!0}),n({type:Object})],T.prototype,"footerContext");E([x({context:st,subscribe:!0}),n({type:Object})],T.prototype,"i18nContext");E([y()],T.prototype,"_textareaValue");E([y()],T.prototype,"_showEmojiPicker");E([R("textarea")],T.prototype,"_textarea");E([R("input[type='file']")],T.prototype,"_fileInput");var ps=Object.defineProperty,us=(o,t,s,i)=>{for(var e=void 0,a=o.length-1,r;a>=0;a--)(r=o[a])&&(e=r(t,s,e)||e);return e&&ps(t,s,e),e};class le extends u{onClickLeftButton(){this.dispatchEvent(new CustomEvent("click-dialog-button",{detail:{event:this.dialog.event,side:"left"},composed:!0}))}onClickRightButton(){this.dispatchEvent(new CustomEvent("click-dialog-button",{detail:{event:this.dialog.event,side:"right"},composed:!0}))}static{this.styles=[f,g`
|
|
1459
|
+
:host {
|
|
1460
|
+
display: flex;
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
.chat-dialog {
|
|
1464
|
+
position: absolute;
|
|
1465
|
+
top: 0;
|
|
1466
|
+
left: 0;
|
|
1467
|
+
z-index: 999;
|
|
1468
|
+
display: flex;
|
|
1469
|
+
align-items: center;
|
|
1470
|
+
justify-content: center;
|
|
1471
|
+
width: 100%;
|
|
1472
|
+
height: 100%;
|
|
1473
|
+
background-color: var(--overlay);
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
.chat-dialog__window {
|
|
1477
|
+
display: flex;
|
|
1478
|
+
flex-direction: column;
|
|
1479
|
+
gap: 1.2em;
|
|
1480
|
+
width: 20em;
|
|
1481
|
+
padding: 1.6em;
|
|
1482
|
+
background-color: var(--surface-50);
|
|
1483
|
+
border-radius: 0.8em;
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
.chat-dialog__body {
|
|
1487
|
+
font-size: 1.4em;
|
|
1488
|
+
color: var(--surface-600);
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
.chat-dialog__footer {
|
|
1492
|
+
display: flex;
|
|
1493
|
+
flex-direction: row;
|
|
1494
|
+
gap: 1.2em;
|
|
1495
|
+
align-items: center;
|
|
1496
|
+
justify-content: flex-end;
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1499
|
+
.chat-dialog__button {
|
|
1500
|
+
font-size: 1.4em;
|
|
1501
|
+
background-color: transparent;
|
|
1502
|
+
border: none;
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1505
|
+
.chat-dialog__button--success {
|
|
1506
|
+
color: var(--success);
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1509
|
+
.chat-dialog__button--danger {
|
|
1510
|
+
color: var(--danger);
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
.chat-dialog__button--warning {
|
|
1514
|
+
color: var(--warning);
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
.chat-dialog__button--info {
|
|
1518
|
+
color: var(--info);
|
|
1519
|
+
}
|
|
1520
|
+
`]}render(){return c`<div class="chat-dialog">
|
|
1521
|
+
<div class="chat-dialog__window">
|
|
1522
|
+
<div class="chat-dialog__body">${this.dialog.body}</div>
|
|
1523
|
+
<div class="chat-dialog__footer">
|
|
1524
|
+
<button
|
|
1525
|
+
class="${A({"chat-dialog__button":!0,"chat-dialog__button--success":this.dialog.leftButton.variant==="success","chat-dialog__button--danger":this.dialog.leftButton.variant==="danger","chat-dialog__button--warning":this.dialog.leftButton.variant==="warning","chat-dialog__button--info":this.dialog.leftButton.variant==="info"})}"
|
|
1526
|
+
@click="${this.onClickLeftButton}"
|
|
1527
|
+
>
|
|
1528
|
+
${this.dialog.leftButton.text}
|
|
1529
|
+
</button>
|
|
1530
|
+
<button
|
|
1531
|
+
class="${A({"chat-dialog__button":!0,"chat-dialog__button--success":this.dialog.rightButton.variant==="success","chat-dialog__button--danger":this.dialog.rightButton.variant==="danger","chat-dialog__button--warning":this.dialog.rightButton.variant==="warning","chat-dialog__button--info":this.dialog.rightButton.variant==="info"})}"
|
|
1532
|
+
@click="${this.onClickRightButton}"
|
|
1533
|
+
>
|
|
1534
|
+
${this.dialog.rightButton.text}
|
|
1535
|
+
</button>
|
|
1536
|
+
</div>
|
|
1537
|
+
</div>
|
|
1538
|
+
</div>`}}us([n({type:Object})],le.prototype,"dialog");var gs=Object.defineProperty,ut=(o,t,s,i)=>{for(var e=void 0,a=o.length-1,r;a>=0;a--)(r=o[a])&&(e=r(t,s,e)||e);return e&&gs(t,s,e),e};class it extends u{constructor(){super(...arguments),this.isMobile=!1,this.isSingleRoom=!1,this.dialog=null}get _show(){return this.isSingleRoom||!(this.isMobile&&this.showSidebar)}static{this.styles=[f,g`
|
|
1539
|
+
:host {
|
|
1540
|
+
display: flex;
|
|
1541
|
+
flex-grow: 1;
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1544
|
+
.chat-container {
|
|
1545
|
+
position: relative;
|
|
1546
|
+
display: flex;
|
|
1547
|
+
flex-grow: 1;
|
|
1548
|
+
flex-direction: column;
|
|
1549
|
+
height: 100%;
|
|
1550
|
+
background-color: var(--surface-50);
|
|
1551
|
+
border-left: 0.1em solid var(--border);
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
.chat-container--mobile {
|
|
1555
|
+
position: absolute;
|
|
1556
|
+
top: 0;
|
|
1557
|
+
left: 0;
|
|
1558
|
+
width: 100%;
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
.chat-container--hidden {
|
|
1562
|
+
display: none;
|
|
1563
|
+
}
|
|
1564
|
+
`]}render(){return c`<div
|
|
1565
|
+
class="${A({"chat-container":!0,"chat-container--mobile":this.isMobile,"chat-container--hidden":!this._show})}"
|
|
1566
|
+
>
|
|
1567
|
+
<chat-header></chat-header><chat-message-list></chat-message-list
|
|
1568
|
+
><chat-footer></chat-footer>
|
|
1569
|
+
${this.dialog?c`<chat-dialog .dialog="${this.dialog}"></chat-dialog>`:h}
|
|
1570
|
+
</div>`}}ut([x({context:Tt,subscribe:!0}),n({type:Boolean})],it.prototype,"showSidebar");ut([n({type:Boolean})],it.prototype,"isMobile");ut([n({type:Boolean})],it.prototype,"isSingleRoom");ut([n({type:Object})],it.prototype,"dialog");var fs=Object.defineProperty,q=(o,t,s,i)=>{for(var e=void 0,a=o.length-1,r;a>=0;a--)(r=o[a])&&(e=r(t,s,e)||e);return e&&fs(t,s,e),e};class C extends u{constructor(){super(...arguments),this.active=!1,this.showAvatar=!1,this.actions=[],this.containerTop=0,this.containerBottom=0,this._hover=!1,this._showActionList=!1,this._showActionListAbove=!0}_selectRoom(){this.dispatchEvent(new CustomEvent("select-room",{detail:{room:this.room},composed:!0}))}_onMouseEnter(){this._hover=!0}_onMouseLeave(){this._hover=!1}_toggleActionList(){const t=this.getBoundingClientRect(),s=this.containerBottom-t.bottom,i=t.top-this.containerTop;this._showActionListAbove=i>=s,this._showActionList=!this._showActionList}_closeActionList(){this._showActionList=!1}static{this.styles=[f,g`
|
|
1571
|
+
:host {
|
|
1572
|
+
display: flex;
|
|
1573
|
+
width: 100%;
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
.chat-room-item {
|
|
1577
|
+
position: relative;
|
|
1578
|
+
display: flex;
|
|
1579
|
+
flex-direction: row;
|
|
1580
|
+
gap: 0.8em;
|
|
1581
|
+
align-items: center;
|
|
1582
|
+
width: 100%;
|
|
1583
|
+
height: 6.4em;
|
|
1584
|
+
padding: 0 1.2em;
|
|
1585
|
+
cursor: pointer;
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
.chat-room-item::after {
|
|
1589
|
+
position: absolute;
|
|
1590
|
+
right: 1.2em;
|
|
1591
|
+
bottom: 0;
|
|
1592
|
+
left: 1.2em;
|
|
1593
|
+
height: 0.1em;
|
|
1594
|
+
content: "";
|
|
1595
|
+
background-color: var(--border);
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
.chat-room-item--active {
|
|
1599
|
+
background-color: var(--surface-200);
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
.chat-room-item__text {
|
|
1603
|
+
display: flex;
|
|
1604
|
+
flex-direction: column;
|
|
1605
|
+
gap: 0.4em;
|
|
1606
|
+
width: calc(100% - 16em);
|
|
1607
|
+
min-width: 10em;
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
.chat-room-item__title {
|
|
1611
|
+
overflow: hidden;
|
|
1612
|
+
text-overflow: ellipsis;
|
|
1613
|
+
font-size: 1.4em;
|
|
1614
|
+
font-weight: 600;
|
|
1615
|
+
white-space: nowrap;
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1618
|
+
.chat-room-item__subtitle {
|
|
1619
|
+
overflow: hidden;
|
|
1620
|
+
text-overflow: ellipsis;
|
|
1621
|
+
font-size: 1.2em;
|
|
1622
|
+
white-space: nowrap;
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
.chat-room-item__menu {
|
|
1626
|
+
position: absolute;
|
|
1627
|
+
top: 1.2em;
|
|
1628
|
+
right: 1.2em;
|
|
1629
|
+
display: flex;
|
|
1630
|
+
flex-direction: column;
|
|
1631
|
+
gap: 0.8em;
|
|
1632
|
+
align-items: flex-end;
|
|
1633
|
+
text-align: right;
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
.chat-room-item__badge {
|
|
1637
|
+
display: flex;
|
|
1638
|
+
align-items: center;
|
|
1639
|
+
justify-content: center;
|
|
1640
|
+
padding: 0.2em 0.8em;
|
|
1641
|
+
border-radius: 0.4em;
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1644
|
+
.chat-room-item__badge--rounded {
|
|
1645
|
+
width: 1em;
|
|
1646
|
+
height: 1em;
|
|
1647
|
+
padding: 0;
|
|
1648
|
+
border-radius: 100px;
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
.chat-room-item__badge--success {
|
|
1652
|
+
color: var(--surface-50);
|
|
1653
|
+
background-color: var(--success);
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
.chat-room-item__badge--danger {
|
|
1657
|
+
color: var(--white);
|
|
1658
|
+
background-color: var(--danger);
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
.chat-room-item__badge--warning {
|
|
1662
|
+
color: var(--black);
|
|
1663
|
+
background-color: var(--warning);
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
.chat-room-item__badge--info {
|
|
1667
|
+
color: var(--white);
|
|
1668
|
+
background-color: var(--info);
|
|
1669
|
+
}
|
|
1670
|
+
|
|
1671
|
+
.chat-room-item__button {
|
|
1672
|
+
position: absolute;
|
|
1673
|
+
top: 1.2em;
|
|
1674
|
+
right: 1.2em;
|
|
1675
|
+
display: flex;
|
|
1676
|
+
align-items: center;
|
|
1677
|
+
justify-content: center;
|
|
1678
|
+
padding: 0.4em;
|
|
1679
|
+
font-size: 1.2em;
|
|
1680
|
+
background-color: transparent;
|
|
1681
|
+
border: none;
|
|
1682
|
+
border-radius: 100px;
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1685
|
+
.chat-room-item__button:hover {
|
|
1686
|
+
background-color: var(--surface-200);
|
|
1687
|
+
}
|
|
1688
|
+
`]}render(){return c`<div
|
|
1689
|
+
class="${A({"chat-room-item":!0,"chat-room-item--active":this.active||this._hover})}"
|
|
1690
|
+
@mouseenter="${this._onMouseEnter}"
|
|
1691
|
+
@mouseleave="${this._onMouseLeave}"
|
|
1692
|
+
@click="${this._selectRoom}"
|
|
1693
|
+
data-testid="chat-room-item"
|
|
1694
|
+
>
|
|
1695
|
+
${this.showAvatar?c`<chat-avatar .src="${this.room.avatar}"></chat-avatar>`:h}
|
|
1696
|
+
<div class="chat-room-item__text">
|
|
1697
|
+
<span class="chat-room-item__title">${this.room.sidebarTitle}</span>
|
|
1698
|
+
<span class="chat-room-item__subtitle">
|
|
1699
|
+
${this.room.sidebarSubtitle}</span
|
|
1700
|
+
>
|
|
1701
|
+
</div>
|
|
1702
|
+
${this._hover&&this.actions.length>0?c`<button
|
|
1703
|
+
class="chat-room-item__button"
|
|
1704
|
+
@click="${this._toggleActionList}"
|
|
1705
|
+
aria-label="Open room actions"
|
|
1706
|
+
>
|
|
1707
|
+
<svg
|
|
1708
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1709
|
+
height="2em"
|
|
1710
|
+
viewBox="0 -960 960 960"
|
|
1711
|
+
width="2em"
|
|
1712
|
+
fill="var(--surface-700)"
|
|
1713
|
+
>
|
|
1714
|
+
<path
|
|
1715
|
+
d="M240-400q-33 0-56.5-23.5T160-480q0-33 23.5-56.5T240-560q33 0 56.5 23.5T320-480q0 33-23.5 56.5T240-400Zm240 0q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm240 0q-33 0-56.5-23.5T640-480q0-33 23.5-56.5T720-560q33 0 56.5 23.5T800-480q0 33-23.5 56.5T720-400Z"
|
|
1716
|
+
/>
|
|
1717
|
+
</svg>
|
|
1718
|
+
</button>`:c`<div class="chat-room-item__menu">
|
|
1719
|
+
<span>${this.room.meta}</span>
|
|
1720
|
+
${this.room.badge?c`<span
|
|
1721
|
+
class="${A({"chat-room-item__badge":!0,"chat-room-item__badge--rounded":this.room.badge.label==="","chat-room-item__badge--success":this.room.badge.type==="success","chat-room-item__badge--danger":this.room.badge.type==="danger","chat-room-item__badge--warning":this.room.badge.type==="warning","chat-room-item__badge--info":this.room.badge.type==="info"})}"
|
|
1722
|
+
>${this.room.badge.label}</span
|
|
1723
|
+
>`:h}
|
|
1724
|
+
</div>`}
|
|
1725
|
+
${this._showActionList?c`<chat-action-list
|
|
1726
|
+
style="position: absolute; top: ${this._showActionListAbove?"1.2em":"auto"}; right: 1.2em; transform: translateY(-100%); bottom: ${this._showActionListAbove?"auto":"calc(-100% - 1.2em)"}; z-index: 1;"
|
|
1727
|
+
.actionType="${"room"}"
|
|
1728
|
+
.roomId="${this.room.id}"
|
|
1729
|
+
.actions="${this.actions}"
|
|
1730
|
+
@select-action="${this._closeActionList}"
|
|
1731
|
+
@close="${this._closeActionList}"
|
|
1732
|
+
></chat-action-list>`:h}
|
|
1733
|
+
</div>`}}q([n({type:Boolean})],C.prototype,"active");q([n({type:Object})],C.prototype,"room");q([n({type:Boolean})],C.prototype,"showAvatar");q([n({type:Array})],C.prototype,"actions");q([n({type:Number})],C.prototype,"containerTop");q([n({type:Number})],C.prototype,"containerBottom");q([y()],C.prototype,"_hover");q([y()],C.prototype,"_showActionList");q([y()],C.prototype,"_showActionListAbove");var vs=Object.defineProperty,gt=(o,t,s,i)=>{for(var e=void 0,a=o.length-1,r;a>=0;a--)(r=o[a])&&(e=r(t,s,e)||e);return e&&vs(t,s,e),e};class ot extends u{constructor(){super(...arguments),this._rectTop=0,this._rectBottom=0}firstUpdated(){setTimeout(()=>{const s=this.getBoundingClientRect();this._rectTop=s.top,this._rectBottom=s.bottom}),new IntersectionObserver(s=>{if(!this.roomContext.isLoadingRoom)for(const i of s)i.isIntersecting&&i.target.classList.contains("chat-room-list__bottom")&&this.dispatchEvent(new CustomEvent("load-more-rooms",{composed:!0}))}).observe(this.chatRoomListBottom)}static{this.styles=[f,g`
|
|
1734
|
+
:host {
|
|
1735
|
+
display: flex;
|
|
1736
|
+
flex-grow: 1;
|
|
1737
|
+
flex-direction: column;
|
|
1738
|
+
overflow-y: scroll;
|
|
1739
|
+
border-top: 0.1em solid var(--border);
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1742
|
+
.chat-room-list {
|
|
1743
|
+
position: relative;
|
|
1744
|
+
display: flex;
|
|
1745
|
+
flex-grow: 1;
|
|
1746
|
+
flex-direction: column;
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
.chat-room-list__bottom {
|
|
1750
|
+
height: 0.1em;
|
|
1751
|
+
}
|
|
1752
|
+
`]}render(){return c`<div class="chat-room-list">
|
|
1753
|
+
${this.roomContext.isLoadingRoom?c`<chat-loader
|
|
1754
|
+
style="position: absolute; top: 50%; transform: translateY(-50%);"
|
|
1755
|
+
></chat-loader>`:this.roomContext.rooms.map(t=>c`<chat-room-item
|
|
1756
|
+
.active="${this.roomContext.selectedRoomId===t.id}"
|
|
1757
|
+
.room="${t}"
|
|
1758
|
+
.showAvatar="${this.roomContext.showRoomAvatar}"
|
|
1759
|
+
.actions="${this.roomContext.actions}"
|
|
1760
|
+
.containerTop="${this._rectTop}"
|
|
1761
|
+
.containerBottom="${this._rectBottom}"
|
|
1762
|
+
></chat-room-item>`)}
|
|
1763
|
+
</div>
|
|
1764
|
+
<div class="chat-room-list__bottom"></div>
|
|
1765
|
+
${!this.roomContext.isLoadingRoom&&this.roomContext.isLoadingMoreRooms?c`<chat-loader
|
|
1766
|
+
style="padding: 1.6em 0;"
|
|
1767
|
+
.size="${2.4}"
|
|
1768
|
+
></chat-loader>`:h} `}}gt([x({context:dt,subscribe:!0}),n({type:Object})],ot.prototype,"roomContext");gt([R(".chat-room-list__bottom")],ot.prototype,"chatRoomListBottom");gt([y()],ot.prototype,"_rectTop");gt([y()],ot.prototype,"_rectBottom");var _s=Object.defineProperty,bs=(o,t,s,i)=>{for(var e=void 0,a=o.length-1,r;a>=0;a--)(r=o[a])&&(e=r(t,s,e)||e);return e&&_s(t,s,e),e};class de extends u{_onChangeInput(t){const s=t.target.value;this.dispatchEvent(new CustomEvent("search-room",{detail:{value:s},composed:!0}))}static{this.styles=[f,g`
|
|
1769
|
+
:host {
|
|
1770
|
+
display: flex;
|
|
1771
|
+
height: 4.8em;
|
|
1772
|
+
min-height: 4.8em;
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
.chat-search {
|
|
1776
|
+
display: flex;
|
|
1777
|
+
flex-grow: 1;
|
|
1778
|
+
flex-direction: row;
|
|
1779
|
+
gap: 0.4em;
|
|
1780
|
+
align-items: center;
|
|
1781
|
+
padding: 0.8em;
|
|
1782
|
+
color: var(--surface-900);
|
|
1783
|
+
outline: none;
|
|
1784
|
+
background-color: var(--surface-50);
|
|
1785
|
+
border: 0.1em solid var(--border);
|
|
1786
|
+
border-radius: 0.8em;
|
|
1787
|
+
box-shadow: none;
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
.chat-search__body {
|
|
1791
|
+
width: 100%;
|
|
1792
|
+
padding: 0;
|
|
1793
|
+
font-size: 1.4em;
|
|
1794
|
+
outline: none;
|
|
1795
|
+
background-color: transparent;
|
|
1796
|
+
border: none;
|
|
1797
|
+
}
|
|
1798
|
+
|
|
1799
|
+
.chat-search__body::placeholder {
|
|
1800
|
+
color: var(--placeholder);
|
|
1801
|
+
}
|
|
1802
|
+
`]}render(){return c`<div class="chat-search">
|
|
1803
|
+
<svg
|
|
1804
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1805
|
+
height="2em"
|
|
1806
|
+
viewBox="0 -960 960 960"
|
|
1807
|
+
width="2em"
|
|
1808
|
+
fill="var(--surface-700)"
|
|
1809
|
+
>
|
|
1810
|
+
<path
|
|
1811
|
+
d="M380-320q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l224 224q11 11 11 28t-11 28q-11 11-28 11t-28-11L532-372q-30 24-69 38t-83 14Zm0-80q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z"
|
|
1812
|
+
/>
|
|
1813
|
+
</svg>
|
|
1814
|
+
<input
|
|
1815
|
+
class="chat-search__body"
|
|
1816
|
+
.placeholder="${this.i18nContext.i18n.chatSearchPlaceholder}"
|
|
1817
|
+
@input="${this._onChangeInput}"
|
|
1818
|
+
/>
|
|
1819
|
+
</div>`}}bs([x({context:st,subscribe:!0}),n({type:Object})],de.prototype,"i18nContext");var ys=Object.defineProperty,me=(o,t,s,i)=>{for(var e=void 0,a=o.length-1,r;a>=0;a--)(r=o[a])&&(e=r(t,s,e)||e);return e&&ys(t,s,e),e};class jt extends u{constructor(){super(...arguments),this.show=!1,this.isMobile=!1}_closeSidebar(){this.dispatchEvent(new CustomEvent("close",{composed:!0}))}_addRoom(){this.dispatchEvent(new CustomEvent("add-room",{composed:!0}))}_onSelectRoom(){this.isMobile&&this._closeSidebar()}static{this.styles=[f,g`
|
|
1820
|
+
:host {
|
|
1821
|
+
display: flex;
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1824
|
+
.chat-sidebar {
|
|
1825
|
+
display: flex;
|
|
1826
|
+
flex-direction: column;
|
|
1827
|
+
min-width: 24em;
|
|
1828
|
+
max-width: 24em;
|
|
1829
|
+
height: 100%;
|
|
1830
|
+
background-color: var(--surface-100);
|
|
1831
|
+
}
|
|
1832
|
+
|
|
1833
|
+
.chat-sidebar--hidden {
|
|
1834
|
+
display: none;
|
|
1835
|
+
}
|
|
1836
|
+
|
|
1837
|
+
.chat-sidebar--mobile {
|
|
1838
|
+
position: absolute;
|
|
1839
|
+
min-width: 100%;
|
|
1840
|
+
max-width: 100%;
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
.chat-sidebar__header {
|
|
1844
|
+
display: flex;
|
|
1845
|
+
flex-direction: column;
|
|
1846
|
+
gap: 0.8em;
|
|
1847
|
+
width: 100%;
|
|
1848
|
+
min-height: 11.2em;
|
|
1849
|
+
padding: 1.6em 1.2em;
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
.chat-sidebar__button-group {
|
|
1853
|
+
display: flex;
|
|
1854
|
+
flex-direction: row;
|
|
1855
|
+
gap: 0.8em;
|
|
1856
|
+
}
|
|
1857
|
+
|
|
1858
|
+
.chat-sidebar__button {
|
|
1859
|
+
display: flex;
|
|
1860
|
+
align-items: center;
|
|
1861
|
+
justify-content: center;
|
|
1862
|
+
padding: 0.4em;
|
|
1863
|
+
background-color: transparent;
|
|
1864
|
+
border: none;
|
|
1865
|
+
border-radius: 100px;
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1868
|
+
.chat-sidebar__button:hover {
|
|
1869
|
+
background-color: var(--surface-200);
|
|
1870
|
+
}
|
|
1871
|
+
`]}render(){return c`<div
|
|
1872
|
+
class="${A({"chat-sidebar":!0,"chat-sidebar--hidden":!this.show,"chat-sidebar--mobile":this.isMobile})}"
|
|
1873
|
+
>
|
|
1874
|
+
<div class="chat-sidebar__header">
|
|
1875
|
+
<div class="chat-sidebar__button-group">
|
|
1876
|
+
<button
|
|
1877
|
+
class="chat-sidebar__button"
|
|
1878
|
+
@click="${this._closeSidebar}"
|
|
1879
|
+
aria-label="Close Sidebar"
|
|
1880
|
+
>
|
|
1881
|
+
<svg
|
|
1882
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1883
|
+
height="2.4em"
|
|
1884
|
+
viewBox="0 -960 960 960"
|
|
1885
|
+
width="2.4em"
|
|
1886
|
+
fill="var(--surface-700)"
|
|
1887
|
+
>
|
|
1888
|
+
<path
|
|
1889
|
+
d="M160-240q-17 0-28.5-11.5T120-280q0-17 11.5-28.5T160-320h640q17 0 28.5 11.5T840-280q0 17-11.5 28.5T800-240H160Zm0-200q-17 0-28.5-11.5T120-480q0-17 11.5-28.5T160-520h640q17 0 28.5 11.5T840-480q0 17-11.5 28.5T800-440H160Zm0-200q-17 0-28.5-11.5T120-680q0-17 11.5-28.5T160-720h640q17 0 28.5 11.5T840-680q0 17-11.5 28.5T800-640H160Z"
|
|
1890
|
+
/>
|
|
1891
|
+
</svg>
|
|
1892
|
+
</button>
|
|
1893
|
+
<button
|
|
1894
|
+
class="chat-sidebar__button"
|
|
1895
|
+
@click="${this._addRoom}"
|
|
1896
|
+
aria-label="Add Room"
|
|
1897
|
+
>
|
|
1898
|
+
<svg
|
|
1899
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1900
|
+
height="2.4em"
|
|
1901
|
+
viewBox="0 -960 960 960"
|
|
1902
|
+
width="2.4em"
|
|
1903
|
+
fill="var(--surface-700)"
|
|
1904
|
+
>
|
|
1905
|
+
<path
|
|
1906
|
+
d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h261q20 0 30 12.5t10 27.5q0 15-10.5 27.5T460-760H200v560h560v-261q0-20 12.5-30t27.5-10q15 0 27.5 10t12.5 30v261q0 33-23.5 56.5T760-120H200Zm280-360Zm-120 80v-97q0-16 6-30.5t17-25.5l344-344q12-12 27-18t30-6q16 0 30.5 6t26.5 18l56 57q11 12 17 26.5t6 29.5q0 15-5.5 29.5T897-728L553-384q-11 11-25.5 17.5T497-360h-97q-17 0-28.5-11.5T360-400Zm481-384-56-56 56 56ZM440-440h56l232-232-28-28-29-28-231 231v57Zm260-260-29-28 29 28 28 28-28-28Z"
|
|
1907
|
+
/>
|
|
1908
|
+
</svg>
|
|
1909
|
+
</button>
|
|
1910
|
+
</div>
|
|
1911
|
+
<chat-search></chat-search>
|
|
1912
|
+
</div>
|
|
1913
|
+
<chat-room-list @select-room="${this._onSelectRoom}"></chat-room-list>
|
|
1914
|
+
</div>`}}me([n({type:Boolean})],jt.prototype,"show");me([n({type:Boolean})],jt.prototype,"isMobile");const vt={deletedMessage:"This message has been deleted.",chatFooterTextareaPlaceholder:"Write a message..",chatSearchPlaceholder:"Search room",closedRoomMessage:"This chat has been ended.",newMeessageNotification:"New messages"};var ws=Object.defineProperty,m=(o,t,s,i)=>{for(var e=void 0,a=o.length-1,r;a>=0;a--)(r=o[a])&&(e=r(t,s,e)||e);return e&&ws(t,s,e),e};class d extends u{constructor(){super(...arguments),this.currentUserId=null,this.rooms=[],this.messages=[],this.attachments=[],this.suggestions=[],this.replyTo=null,this.selectedRoomId=null,this.isLoadingRoom=!1,this.isLoadingMessage=!1,this.isLoadingMoreRooms=!1,this.isLoadingMoreMessages=!1,this.inputMessage="",this.roomActions=[],this.myMessageActions=[],this.theirMessageActions=[],this.isMobile=!1,this.isSingleRoom=!1,this.isEmojiPickerAvailable=!0,this.isEmojiReactionAvailable=!0,this.isReplyAvailable=!0,this.isMessageAttachmentAvailable=!0,this.isMarkdownAvailable=!1,this.isTyping=!1,this.showRoomAvatar=!0,this.showTheirAvatar=!0,this.dialog=null,this.height="60em",this.width="80em",this.i18n=vt,this.theme="light",this.currentUserIdContext=this.currentUserId,this.roomsContext={rooms:this.rooms,selectedRoomId:this.selectedRoomId,isLoadingRoom:this.isLoadingRoom,isLoadingMoreRooms:this.isLoadingMoreRooms,showRoomAvatar:this.showRoomAvatar,actions:this.roomActions},this.messagesContext={messages:this.messages,suggestions:this.suggestions,replyTo:this.replyTo,isLoadingMessage:this.isLoadingMessage,isLoadingMoreMessages:this.isLoadingMoreMessages,isMarkdownAvailable:this.isMarkdownAvailable,myMessageActions:this.myMessageActions,theirMessageActions:this.theirMessageActions,isEmojiReactionAvailable:this.isEmojiReactionAvailable,isReplyAvailable:this.isReplyAvailable,isTyping:this.isTyping,showTheirAvatar:this.showTheirAvatar},this.footerContext={isEmojiPickerAvailable:this.isEmojiPickerAvailable,isMessageAttachmentAvailable:this.isMessageAttachmentAvailable,inputMessage:this.inputMessage,attachments:this.attachments},this.showSidebar=!0,this.i18nContext={i18n:vt}}updated(t){t.has("currentUserId")&&(this.currentUserIdContext=this.currentUserId),(t.has("rooms")||t.has("selectedRoomId")||t.has("isLoadingRoom")||t.has("isLoadingMoreRooms")||t.has("roomActions"))&&(this.roomsContext={rooms:this.rooms,selectedRoomId:this.selectedRoomId,isLoadingRoom:this.isLoadingRoom,isLoadingMoreRooms:this.isLoadingMoreRooms,showRoomAvatar:this.showRoomAvatar,actions:this.roomActions}),(t.has("messages")||t.has("suggestions")||t.has("replyTo")||t.has("isLoadingMessage")||t.has("isLoadingMoreMessages")||t.has("isMarkdownAvailable")||t.has("myMessageActions")||t.has("theirMessageActions")||t.has("isEmojiReactionAvailable")||t.has("isReplyAvailable")||t.has("isTyping"))&&(this.messagesContext={messages:this.messages,suggestions:this.suggestions,replyTo:this.replyTo,isLoadingMessage:this.isLoadingMessage,isLoadingMoreMessages:this.isLoadingMoreMessages,isMarkdownAvailable:this.isMarkdownAvailable,myMessageActions:this.myMessageActions,theirMessageActions:this.theirMessageActions,isEmojiReactionAvailable:this.isEmojiReactionAvailable,isReplyAvailable:this.isReplyAvailable,isTyping:this.isTyping,showTheirAvatar:this.showTheirAvatar}),(t.has("isEmojiPickerAvailable")||t.has("isMessageAttachmentAvailable")||t.has("inputMessage")||t.has("attachments"))&&(this.footerContext={isEmojiPickerAvailable:this.isEmojiPickerAvailable,isMessageAttachmentAvailable:this.isMessageAttachmentAvailable,inputMessage:this.inputMessage,attachments:this.attachments}),t.has("i18n")&&(this.i18nContext={i18n:{...vt,...this.i18n}})}get _isFullscreen(){return this.height==="100vh"&&this.width==="100vw"}_closeSidebar(){this.showSidebar=!1}_openSidebar(){this.showSidebar=!0}static{this.styles=[f,g`
|
|
1915
|
+
:host {
|
|
1916
|
+
display: block;
|
|
1917
|
+
width: fit-content;
|
|
1918
|
+
height: fit-content;
|
|
1919
|
+
}
|
|
1920
|
+
|
|
1921
|
+
.main {
|
|
1922
|
+
position: relative;
|
|
1923
|
+
display: flex;
|
|
1924
|
+
flex-direction: row;
|
|
1925
|
+
overflow: hidden;
|
|
1926
|
+
border: 0.1em solid var(--border);
|
|
1927
|
+
border-radius: 1.6em;
|
|
1928
|
+
box-shadow: rgb(0 0 0 / 15%) 0 0.3em 0.3em 0;
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
.main--fullscreen {
|
|
1932
|
+
border-radius: 0;
|
|
1933
|
+
}
|
|
1934
|
+
`]}render(){return c`<div
|
|
1935
|
+
class=${A({main:!0,"main--fullscreen":this._isFullscreen})}
|
|
1936
|
+
style="height: ${this.height}; width: ${this.width}"
|
|
1937
|
+
>
|
|
1938
|
+
${this.isSingleRoom?h:c`<chat-sidebar
|
|
1939
|
+
.show="${this.showSidebar}"
|
|
1940
|
+
.isMobile="${this.isMobile}"
|
|
1941
|
+
@close="${this._closeSidebar}"
|
|
1942
|
+
></chat-sidebar>`}
|
|
1943
|
+
<chat-container
|
|
1944
|
+
.isMobile="${this.isMobile}"
|
|
1945
|
+
.isSingleRoom="${this.isSingleRoom}"
|
|
1946
|
+
.dialog="${this.dialog}"
|
|
1947
|
+
@open-sidebar="${this._openSidebar}"
|
|
1948
|
+
></chat-container>
|
|
1949
|
+
</div>`}}m([n({type:String})],d.prototype,"currentUserId");m([n({type:Array})],d.prototype,"rooms");m([n({type:Array})],d.prototype,"messages");m([n({type:Array})],d.prototype,"attachments");m([n({type:Array})],d.prototype,"suggestions");m([n({type:Object})],d.prototype,"replyTo");m([n({type:String})],d.prototype,"selectedRoomId");m([n({type:Boolean})],d.prototype,"isLoadingRoom");m([n({type:Boolean})],d.prototype,"isLoadingMessage");m([n({type:Boolean})],d.prototype,"isLoadingMoreRooms");m([n({type:Boolean})],d.prototype,"isLoadingMoreMessages");m([n({type:String})],d.prototype,"inputMessage");m([n({type:Array})],d.prototype,"roomActions");m([n({type:Array})],d.prototype,"myMessageActions");m([n({type:Array})],d.prototype,"theirMessageActions");m([n({type:Boolean})],d.prototype,"isMobile");m([n({type:Boolean})],d.prototype,"isSingleRoom");m([n({type:Boolean})],d.prototype,"isEmojiPickerAvailable");m([n({type:Boolean})],d.prototype,"isEmojiReactionAvailable");m([n({type:Boolean})],d.prototype,"isReplyAvailable");m([n({type:Boolean})],d.prototype,"isMessageAttachmentAvailable");m([n({type:Boolean})],d.prototype,"isMarkdownAvailable");m([n({type:Boolean})],d.prototype,"isTyping");m([n({type:Boolean})],d.prototype,"showRoomAvatar");m([n({type:Boolean})],d.prototype,"showTheirAvatar");m([n({type:Object})],d.prototype,"dialog");m([n({type:String})],d.prototype,"height");m([n({type:String})],d.prototype,"width");m([n({type:Object})],d.prototype,"i18n");m([n({type:String,reflect:!0})],d.prototype,"theme");m([N({context:X})],d.prototype,"currentUserIdContext");m([N({context:dt})],d.prototype,"roomsContext");m([N({context:Mt})],d.prototype,"messagesContext");m([N({context:he})],d.prototype,"footerContext");m([N({context:Tt}),n({type:Boolean})],d.prototype,"showSidebar");m([N({context:st}),n({type:Object})],d.prototype,"i18nContext");customElements.define("advanced-chat-kai",d);customElements.define("chat-action-list",Z);customElements.define("chat-avatar",kt);customElements.define("chat-container",it);customElements.define("chat-deleted-message",qt);customElements.define("chat-dialog",le);customElements.define("chat-emoji-picker",I);customElements.define("chat-footer-attachment-section",ce);customElements.define("chat-footer-reply-to-section",ne);customElements.define("chat-footer",T);customElements.define("chat-header",mt);customElements.define("chat-loader",ie);customElements.define("chat-message-divider",ae);customElements.define("chat-message-attachment-list",Et);customElements.define("chat-message-item",b);customElements.define("chat-message-list",P);customElements.define("chat-message-menu",V);customElements.define("chat-message-reaction-list",et);customElements.define("chat-message-reply-to",ee);customElements.define("chat-message-typing",ss);customElements.define("chat-notification-badge",re);customElements.define("chat-room-item",C);customElements.define("chat-room-list",ot);customElements.define("chat-search",de);customElements.define("chat-sidebar",jt);customElements.define("chat-suggestion-list",oe);
|